view tmss.s68 @ 2038:5b51f03b2227

Don't init IO ports in TMSS ROM as it trips up the standard Sega init code
author Michael Pavone <pavone@retrodev.com>
date Sun, 07 Mar 2021 22:45:25 -0800
parents 33f454232aee
children f500831f7fb4
line wrap: on
line source

	dc.l $0, start
	dc.l empty_handler
	dc.l empty_handler
	;$10
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$20
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$30
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$40
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$50
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$60
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$70
	dc.l empty_handler
	dc.l empty_handler
	dc.l int_6
	dc.l empty_handler
	;$80
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$90
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$A0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$B0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$C0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$D0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$E0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	;$F0
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.l empty_handler
	dc.b "SEGA IS COOL    "
	dc.b "(C)M.Pavone 2021"
	dc.b "TRAIN MEMES STAN"
	dc.b "D SILENTLY      "
	dc.b "                "
	dc.b "TRIUMPHANT MAMMA"
	dc.b "LS SALUTE SOCIAL"
	dc.b "ITES            "
	dc.b "MP 20210227-01",0,0
	dc.b "J               "
	dc.l $0
	dc.l romend-1
	dc.l $FF0000
	dc.l $FFFFFF
	dc.b "                "
	dc.b "                "
	dc.b "                "
	dc.b "                "
	dc.b "JUE             "
	
frame_counter equ $FFFF8000
ram_code equ $FFFF8002

empty_handler:
	rte
start:
	lea $A14000, a3
	move.l #'SEGA', (a3)
	lea $C00000, a0
	lea $C00004, a1
	move.w #$8104, (a1) ;Mode 5, everything turned off
	move.w #$8004, (a1)
	move.w #$8220, (a1) ;Scroll a table $8000
	move.w #$8404, (a1) ;Scroll b table $8000
	move.w #$8560, (a1) ;SAT table $C000
	move.w #$8700, (a1) ;backdrop color 0
	move.w #$8A01, (a1) ;Set HINT counter
	move.w #$8B00, (a1) ;full screen scroll
	move.w #$8C81, (a1) ;40 cell mode, no interlace
	move.w #$8D00, (a1) ;hscroll table at 0
	move.w #$8F02, (a1) ;autoinc 2
	move.w #$9011, (a1) ;64x64 scroll size
	move.l #$C0000000, (a1)
	move.w #$000, (a0)
	move.w #$EEE, (a0)

	;clear scroll table
	move.l #$40000000, (a1)
	move.l #0, (a0)

	;load tiles
	move.l #$44000000, (a1)
	lea font, a2
	move.w #((fontend-font)/4 - 1), d0
tloop:
	move.l (a2)+, (a0)
	dbra d0, tloop

	;clear name table
	move.l #$40000002, (a1)
	moveq #32, d0
	move.w #(64*64-1), d1
ploop:
	move.w d0, (a0)
	dbra d1, ploop
	move.l #$45960002, d7
	move.l d7, (a1)
	move.l #$800000, d6
	
	lea ram_code_src(pc), a6
	lea ram_code.w, a5
	moveq #(font-ram_code_src)/2-1, d0
copy:
	move.w (a6)+, (a5)+
	dbra d0, copy
	lea $101(a3), a4
	lea $100.w, a5
	move.l #'SEGA', d5
	move.l #' SEG', d4
	moveq #0, d0
	moveq #1, d2
	move.w #180, d3
	btst #6, $A10001
	beq .not_pal
	move.w #150, d3
.not_pal:
	jmp ram_code.w

ram_code_src:
	move.b d2, (a4)
	cmp.l (a5), d5
	beq.s is_good
	cmp.l (a5), d4
	bne.s is_bad
is_good:
	move.b d0, (a4)
	lea good(pc), a6
	bsr.s print_string
	
	add.l d6, d7
	move.l d7, (a1)
	bsr.s print_string
	
	add.l d6, d7
	move.l d7, (a1)
	bsr.s print_string

	move.w #$8164, (a1)
	move #$2500, SR
wait:
	cmp.w frame_counter.w, d3
	bne.s wait
	move #$2700, SR
	move.b d2, (a4)
	move.l $0.w, a7
	move.l $4.w, a6
	move.w #$8104, (a1)
	move.l d0, (a3)
	jmp (a6)
	
is_bad:
	move.b d0, (a4)
	lea bad(pc), a6
	bsr.s print_string
	
	add.l d6, d7
	move.l d7, (a1)
	bsr.s print_string
	
	add.l d6, d7
	move.l d7, (a1)
	bsr.s print_string
	
	move.w #$8144, (a1)
forever:
	bra.s forever


int_6:
	addq.w #1, frame_counter.w
	rte

;Prints a null terminated string
;a6 - pointer to string
;a0 - VDP data port
;d0 - base tile attribute
;
;Clobbers: d1.w
print_string:
.loop
	moveq #0, d1
	move.b (a6)+, d1
	beq .end
	add.w d0, d1
	move.w d1, (a0)
	bra .loop
.end
	rts
	
good:
	dc.b "  BLASTEM THINKS", 0
	dc.b "  THAT THIS CART", 0
	dc.b " TASTES DELICIOUS!", 0
	
bad:
	dc.b "  *sniff* *sniff*", 0
	dc.b " something doesn't", 0
	dc.b "  smell right...", 0

	align 1
font:
	incbin font.tiles
fontend

romend