some tests
[megadrive.git] / testpico / sega_gcc.s
diff --git a/testpico/sega_gcc.s b/testpico/sega_gcc.s
new file mode 100644 (file)
index 0000000..04365c1
--- /dev/null
@@ -0,0 +1,137 @@
+exc_tab:\r
+    dc.l     0, 0x200, 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, HBL,   exc1d, VBL,   exc1f\r
+    dc.l exc20, exc21, exc22, exc23, exc24, exc25, exc26, exc27\r
+    dc.l exc28, exc29, exc2a, exc2b, exc2c, exc2d, exc2e, exc2f\r
+    dc.l exc30, exc31, exc32, exc33, exc34, exc35, exc3e, exc37\r
+    dc.l exc38, exc39, exc3a, exc3b, exc3c, exc3d, exc3e, exc3f\r
+\r
+    .ascii "SEGA GENESIS                    "\r
+    .ascii "PD testsuite                                    "\r
+    .ascii "PD testsuite                                    "\r
+    .ascii "GM 00000000-00"\r
+    .byte 0x00,0x00\r
+    .ascii "J               "\r
+    .byte 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00\r
+    .byte 0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff\r
+    .ascii "RA"; .byte 0xf8,0x20                     /* 1b0 */\r
+    .byte 0x00,0x02,0x00,0x00,0x00,0x3f,0xff,0xff    /* 1b4 */\r
+    .ascii "    "                                    /* 1bc */\r
+    .ascii "                        "                /* 1c0 */\r
+    .ascii "                        "\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
+\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
+exc_stub 20\r
+exc_stub 21\r
+exc_stub 22\r
+exc_stub 23\r
+exc_stub 24\r
+exc_stub 25\r
+exc_stub 26\r
+exc_stub 27\r
+exc_stub 28\r
+exc_stub 29\r
+exc_stub 2a\r
+exc_stub 2b\r
+exc_stub 2c\r
+exc_stub 2d\r
+exc_stub 2e\r
+exc_stub 2f\r
+exc_stub 30\r
+exc_stub 31\r
+exc_stub 32\r
+exc_stub 33\r
+exc_stub 34\r
+exc_stub 35\r
+exc_stub 36\r
+exc_stub 37\r
+exc_stub 38\r
+exc_stub 39\r
+exc_stub 3a\r
+exc_stub 3b\r
+exc_stub 3c\r
+exc_stub 3d\r
+exc_stub 3e\r
+exc_stub 3f\r
+\r
+# vim:filetype=asmM68k:ts=4:sw=4:expandtab\r