exc_tab:\r
- dc.l 0, 0x200, exc02, exc03, exc04, exc05, exc06, exc07\r
+ dc.l 0, RST, exc02, exc03, exc04, exc05, exc06, exc07\r
dc.l exc08, exc09, exc0a, exc0b, exc0c, exc0d, exc0e, exc0f\r
dc.l exc10, exc11, exc12, exc13, exc14, exc15, exc16, exc17\r
dc.l exc18, exc19, exc1a, exc1b, 0xff0100, exc1d, 0xff0140, exc1f\r
.ascii "J "\r
.long 0x000000,0x3fffff\r
.long 0xff0000,0xffffff\r
- .ascii "RA"; .byte 0xf8,0x20 /* 1b0 */\r
- .long 0x200001,0x20ffff /* 1b4 */\r
- .ascii " " /* 1bc */\r
- .ascii " " /* 1c0 */\r
- .ascii " "\r
- .ascii "JUE " /* 1f0 */\r
+ .ascii "RA"; .byte 0xf8,0x20 /* 1b0 */\r
+ .long 0x200001,0x20ffff /* 1b4 */\r
+ .ascii " " /* 1bc */\r
+ .ascii " " /* 1c0 */\r
+ .ascii "src: https://github.com/notaz/megadrive/" /* 1c8 */\r
+ .ascii "JUE " /* 1f0 */\r
\r
-RST:\r
- move.w #0x2700, %sr\r
-\r
- move.b (0xA10001), %d0\r
- andi.b #0x0F, %d0\r
- beq.s 0f\r
- move.l #0x53454741, (0xA14000) /* 'SEGA' */\r
-0:\r
- tst.w (0xc00004).l\r
-\r
- moveq #0, %d0\r
- movea.l %d0, %a7\r
- move %a7, %usp\r
-\r
- /* clear .bss */\r
- lea __bss_start, %a0\r
- lea __end, %a1\r
-0:\r
- move.l %d0, (%a0)+\r
- cmp.l %a1, %a0\r
- blt.s 0b\r
-\r
-# move.w #0x2000, %sr\r
- jsr main\r
-0:\r
- bra 0b\r
+# 32X reset vector (880200)\r
+ bra RST32X\r
\r
-#HBL:\r
-#VBL:\r
-# rte\r
-\r
-pre_exception:\r
- move.w #0x2700, %sr\r
- movem.l %d0-%d7/%a0-%a7,-(%sp)\r
- move.l %sp, %d0\r
- move.l %d0,-(%sp)\r
- jsr exception\r
-0:\r
- bra 0b\r
-\r
-.macro exc_stub num\r
-exc\num:\r
- move.w #0x\num, -(%sp)\r
- jmp pre_exception\r
-.endm\r
-\r
-exc_stub 02\r
-exc_stub 03\r
-exc_stub 04\r
-exc_stub 05\r
-exc_stub 06\r
-exc_stub 07\r
-exc_stub 08\r
-exc_stub 09\r
-exc_stub 0a\r
-exc_stub 0b\r
-exc_stub 0c\r
-exc_stub 0d\r
-exc_stub 0e\r
-exc_stub 0f\r
-exc_stub 10\r
-exc_stub 11\r
-exc_stub 12\r
-exc_stub 13\r
-exc_stub 14\r
-exc_stub 15\r
-exc_stub 16\r
-exc_stub 17\r
-exc_stub 18\r
-exc_stub 19\r
-exc_stub 1a\r
-exc_stub 1b\r
-HBL:\r
-exc_stub 1c\r
-exc_stub 1d\r
-VBL:\r
-exc_stub 1e\r
-exc_stub 1f\r
+# mystery landing area for reset with 32X on and RV=1\r
+# 2c8 - 304 in multiples of 4\r
+.rept 0x1bc/2\r
+ illegal\r
+.endr\r
\r
/* MARS data */\r
.org 0x3c0\r
.long sh2_test /* ROM src */\r
.long 0 /* SDRAM dst */\r
.long sh2_test_end-sh2_test /* length */\r
- .long 0x06000244 /* master entry */\r
- .long 0x06000248 /* slave entry */\r
+ .long 0x06000400 /* master entry */\r
+ .long 0x06000404 /* slave entry */\r
.long 0x06000000 /* master VBR */\r
- .long 0x06000124 /* slave VBR */\r
+ .long 0x06000200 /* slave VBR */\r
/* Standard 32X startup code for MD side at 0x3F0 */\r
.org 0x3f0\r
.word 0x287C,0xFFFF,0xFFC0,0x23FC,0x0000,0x0000,0x00A1,0x5128\r
.word 0xFFC0,0x4CD6,0x7FF9,0x44FC,0x0000,0x6014,0x43F9,0x00A1\r
.word 0x5100,0x3340,0x0006,0x303C,0x8000,0x6004,0x44FC,0x0001\r
\r
+RST:\r
+ andi.b #0x0F, (0xA10001) /* 24 */\r
+ bne.s 0f /* 10 */\r
+ move.w #0x8104, (0xc00004)\r
+ bra 1f\r
+0:\r
+ move.l #0x53454741, (0xA14000) /* 28 'SEGA' */\r
+1:\r
+ move.w (0xc00008), %d0 /* 16 */\r
+ move.w %d0, -(%sp)\r
+ subq.l #2, %sp\r
+ move %sp, %usp\r
+\r
+ move.w #0x2600, %sr\r
+\r
+ /* clear .bss */\r
+ moveq.l #0, %d0\r
+ lea __bss_start, %a0\r
+ lea __end, %a1\r
+0:\r
+ move.l %d0, (%a0)+\r
+ cmp.l %a1, %a0\r
+ blt.s 0b\r
+\r
+# move.w #0x2000, %sr\r
+ jsr main\r
+0:\r
+ bra 0b\r
+\r
+#HBL:\r
+#VBL:\r
+# rte\r
+\r
+RST32X:\r
+ lea ram_rv_switch, %a0\r
+ movea.l #0xff0100, %a1\r
+ lea ram_rv_switch_end, %a2\r
+0:\r
+ move.l (%a0)+, (%a1)+\r
+ cmp.l %a2, %a0\r
+ blt.s 0b\r
+ jmp (0xff0100).l\r
+\r
+ram_rv_switch:\r
+ move.l (0x880004).l, %a0\r
+ bset #0, (0xa15107).l /* RV=1 */\r
+ nop /* just in case */\r
+ jmp (%a0)\r
+ram_rv_switch_end:\r
+\r
+pre_exception:\r
+ move.w #0x2700, %sr\r
+ movem.l %d0-%d7/%a0-%a7,-(%sp)\r
+ add.w #2, 0x3e(%sp) /* ecxnum */\r
+ move.l %sp, %d0\r
+ move.l %d0,-(%sp) /* arg0 */\r
+ jsr exception\r
+0:\r
+ bra 0b\r
+\r
+.macro exc_stub num\r
+exc\num:\r
+ move.w #0x\num, -(%sp)\r
+ bra pre_exception\r
+.endm\r
+\r
+exc_stub 02\r
+exc_stub 03\r
+exc_stub 04\r
+exc_stub 05\r
+exc_stub 06\r
+exc_stub 07\r
+exc_stub 08\r
+exc_stub 09\r
+exc_stub 0a\r
+exc_stub 0b\r
+exc_stub 0c\r
+exc_stub 0d\r
+exc_stub 0e\r
+exc_stub 0f\r
+\r
+exc_stub 10\r
+exc_stub 11\r
+exc_stub 12\r
+exc_stub 13\r
+exc_stub 14\r
+exc_stub 15\r
+exc_stub 16\r
+exc_stub 17\r
+exc_stub 18\r
+exc_stub 19\r
+exc_stub 1a\r
+exc_stub 1b\r
+HBL:\r
+exc_stub 1c\r
+exc_stub 1d\r
+VBL:\r
+exc_stub 1e\r
+exc_stub 1f\r
+\r
exc_stub 20\r
exc_stub 21\r
exc_stub 22\r
exc_stub 3e\r
exc_stub 3f\r
\r
-.section .rodata\r
-.align 2\r
+.align 4\r
+\r
+# must avoid anything use 1070, 2070, 3070 after RV is set,\r
+# so let's place some data here\r
+.global z80_test\r
+.global z80_test_end\r
+z80_test:\r
+.incbin "z80_test.bin80"\r
+z80_test_end:\r
+\r
+.align 4\r
\r
.global sh2_test\r
.global sh2_test_end\r
.incbin "sh2_test.binsh"\r
sh2_test_end:\r
\r
+.org 0x2070\r
+.long 0x1234567f\r
+\r
+.global font_base\r
+font_base:\r
+.incbin "font.bin"\r
+\r
+.org 0x3070\r
+.long 0x3456789f\r
+\r
# vim:filetype=asmM68k:ts=4:sw=4:expandtab\r