From: notaz Date: Sun, 26 Oct 2014 22:49:07 +0000 (+0200) Subject: megaed-sv: move most start code to ROM X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bae3c7fdcbca9da77a40348cb74b4ae87c387a9d;p=megadrive.git megaed-sv: move most start code to ROM --- diff --git a/megaed-sv/asmtools.s b/megaed-sv/asmtools.s index 2ed3df7..89eb3d0 100644 --- a/megaed-sv/asmtools.s +++ b/megaed-sv/asmtools.s @@ -243,109 +243,78 @@ run_game: movea.l #0xc00000, a5 movea.l #0xc00005, a4 movea.l #0xc00004, a3 - moveq.l #0x00, d2 + moveq.l #0x00, d0 + move.b #0x40, d1 /* d2 is tmp */ move.b #0xff, d3 - move.b #0x40, d4 - move.b d4, (0x09,a6) /* CtrlA */ - move.b d2, (0x0b,a6) /* CtrlB */ - move.b d2, (0x0d,a6) /* CtrlC */ - move.b d2, (0x13,a6) /* S-CtrlA */ + move.b d1, (0x09,a6) /* CtrlA */ + move.b d0, (0x0b,a6) /* CtrlB */ + move.b d0, (0x0d,a6) /* CtrlC */ + move.b d0, (0x13,a6) /* S-CtrlA */ move.b d3, (0x0f,a6) /* TxDataA */ - move.b d2, (0x19,a6) /* S-CtrlB */ + move.b d0, (0x19,a6) /* S-CtrlB */ move.b d3, (0x15,a6) /* TxDataB */ - move.b d2, (0x1f,a6) /* S-CtrlC */ + move.b d0, (0x1f,a6) /* S-CtrlC */ move.b d3, (0x1b,a6) /* TxDataC */ /* set up for vram write */ move.l #0x40000000, (a3) move.l #0xff0000, a1 - move.l #0x10000/4/4-1, d0 + move.l #0x10000/4/4-1, d2 0: - move.l d2, (a1)+ - move.l d2, (a1)+ - move.l d2, (a1)+ - move.l d2, (a1)+ - dbra d0, 0b - - move.l #0xfffe00, a1 - tst.l d6 - bne use_tas_code + move.l d0, (a1)+ + move.l d0, (a1)+ + move.l d0, (a1)+ + move.l d0, (a1)+ + dbra d2, 0b lea (run_game_r,pc), a0 - move.l #(run_game_r_end - run_game_r)/2-1, d0 - bra 0f -use_tas_code: - lea (run_game_r_tas,pc), a0 - move.l #(run_game_r_tas_end - run_game_r_tas)/2-1, d0 - + move.l #0xffff80, a1 + move.l #(run_game_r_end - run_game_r)/2-1, d2 0: move.w (a0)+, (a1)+ - dbra d0, 0b - jmp 0xfffe00 - -run_game_r: - move.w #0x3210, (0xA13006) - - move.w d7, (0xA13010) - move.w #0, (0xA13000) - - move.l (0x00), a7 - move.l (0x04), a0 - jmp (a0) -run_game_r_end: - -run_game_r_tas: - move.w #0x3210, (0xA13006) - move.w d7, (0xA13010) - move.w #0, (0xA13000) - - move.l (0x00), a7 - move.l (0x04), a0 + dbra d2, 0b -0: /* wait for special code */ - move.b d4, (0x03,a6) - move.b (0x03,a6), d0 - move.b d2, (0x03,a6) - move.b (0x03,a6), d1 - and.b #0x3f, d0 - cmp.b d0, d1 - bne 0b - cmp.b #0x25, d0 - bne 0b + tst.l d6 + beq.s 0f -0: /* wait for special code to end */ - cmp.b (0x03,a6), d0 - beq 0b + movea.l #0xa10003, a0 + movea.l d0, a7 + bsr sync_with_teensy /* trashes d3 */ + move.l d0, (-4,a7) +0: /* wait for active display */ - moveq.l #3, d0 + moveq.l #3, d2 0: - btst d0, (a4) /* 8 */ + btst d2, (a4) /* 8 */ beq.s 0b /* 10 */ 0: - btst d0, (a4) + btst d2, (a4) bne.s 0b /* flood the VDP FIFO */ .rept 5 - move.w d2, (a5) + move.w d0, (a5) .endr - /* doesn't help.. */ -.if 0 -.rept 94 - nop -.endr - move.l #0x93049400, (a3) /* DMALEN LO/HI = 0x0008 */ - move.l #0x95009601, (a3) /* DMA SRC LO/MID */ - move.l #0x977f8114, (a3) /* DMA SRC HI/MODE, Turn off Display */ - move.l #0xc0000080, (a3) /* start DMA */ -.endif + movea.l d0, a0 + movea.l #0xA13000, a1 + + move.b d0, (0x09,a6) /* CtrlA */ + move.b d1, (0x03,a6) + + jmp 0xffff80 + +run_game_r: + move.w #0x3210, (0x06,a1) /* 0xA13006 */ + move.w d7, (0x10,a1) /* 0xA13010 */ + move.w d0, (a1) /* 0xA13000 */ + + move.l (a0)+, a7 + move.l (a0), a0 - move.b d2, (0x09,a6) /* CtrlA */ - move.b d4, (0x03,a6) jmp (a0) -run_game_r_tas_end: +run_game_r_end: # vim:filetype=asmM68k:ts=4:sw=4:expandtab