cleanup init code
authornotaz <notasas@gmail.com>
Tue, 7 Apr 2009 22:43:19 +0000 (22:43 +0000)
committernotaz <notasas@gmail.com>
Tue, 7 Apr 2009 22:43:19 +0000 (22:43 +0000)
hexed/sega_gcc.s

index 441d74c..99ecd31 100644 (file)
@@ -1,13 +1,3 @@
-*-------------------------------------------------------\r
-*\r
-*       Sega startup code for the GNU Assembler\r
-*       Translated from:\r
-*       Sega startup code for the Sozobon C compiler\r
-*       Written by Paul W. Lee\r
-*       Modified from Charles Coty's code\r
-*\r
-*-------------------------------------------------------\r
-\r
         dc.l 0x0,0x200\r
         dc.l INT,INT,INT,INT,INT,INT,INT\r
         dc.l INT,INT,INT,INT,INT,INT,INT,INT\r
         .ascii "                        "\r
         .ascii "                         "\r
         .ascii "JUE             "\r
-*debugee:\r
-*        bra     debugee\r
-        tst.l   0xa10008\r
-       bne     SkipJoyDetect                               \r
-        tst.w   0xa1000c\r
-SkipJoyDetect:\r
+\r
+       tst.l   0xa10008\r
        bne     SkipSetup\r
-        lea     Table,%a5                       \r
-        movem.w (%a5)+,%d5-%d7\r
-        movem.l (%a5)+,%a0-%a4                       \r
-* Check Version Number                      \r
-        move.b  -0x10ff(%a1),%d0\r
-        andi.b  #0x0f,%d0                             \r
-       beq     WrongVersion                                   \r
-* Sega Security Code (SEGA)   \r
-        move.l  #0x53454741,0x2f00(%a1)\r
+* Check Version Number\r
+       move.b  (0xa10000),%d0\r
+       andi.b  #0x0f,%d0\r
+       beq     WrongVersion\r
+* Sega Security Code (SEGA)\r
+       move.l  #0x53454741,(0xa14000)\r
 WrongVersion:\r
-        move.w  (%a4),%d0\r
-        moveq   #0x00,%d0                                \r
-        movea.l %d0,%a6                                  \r
-        move    %a6,%usp\r
-* Set VDP registers\r
-        moveq   #0x17,%d1\r
-FillLoop:                           \r
-        move.b  (%a5)+,%d5\r
-        move.w  %d5,(%a4)                              \r
-        add.w   %d7,%d5                                 \r
-        dbra    %d1,FillLoop                           \r
-        move.l  (%a5)+,(%a4)                            \r
-        move.w  %d0,(%a3)                                 \r
-        move.w  %d7,(%a1)                                 \r
-        move.w  %d7,(%a2)                                 \r
-L0250:\r
-        btst    %d0,(%a1)\r
-       bne     L0250                                   \r
-* Put initial values into a00000                \r
-        moveq   #0x25,%d2\r
-Filla:                                 \r
-        move.b  (%a5)+,(%a0)+\r
-        dbra    %d2,Filla\r
-        move.w  %d0,(%a2)                                 \r
-        move.w  %d0,(%a1)                                 \r
-        move.w  %d7,(%a2)                                 \r
-L0262:\r
-        move.l  %d0,-(%a6)\r
-        dbra    %d6,L0262                            \r
-        move.l  (%a5)+,(%a4)                              \r
-        move.l  (%a5)+,(%a4)                              \r
-* Put initial values into c00000                  \r
-        moveq   #0x1f,%d3\r
-Filc0:                             \r
-        move.l  %d0,(%a3)\r
-        dbra    %d3,Filc0\r
-        move.l  (%a5)+,(%a4)                              \r
-* Put initial values into c00000                 \r
-        moveq   #0x13,%d4\r
-Fillc1:                            \r
-        move.l  %d0,(%a3)\r
-        dbra    %d4,Fillc1\r
-* Put initial values into c00011                 \r
-        moveq   #0x03,%d5\r
-Fillc2:                            \r
-        move.b  (%a5)+,0x0011(%a3)        \r
-        dbra    %d5,Fillc2                            \r
-        move.w  %d0,(%a2)                                 \r
-        movem.l (%a6),%d0-%d7/%a0-%a6                    \r
-        move    #0x2700,%sr                           \r
+       moveq   #0,%d0\r
+       movea.l %d0,%a7\r
+       move    %a7,%usp\r
 SkipSetup:\r
-       bra     Continue\r
-Table:\r
-        dc.w    0x8000, 0x3fff, 0x0100, 0x00a0, 0x0000, 0x00a1, 0x1100, 0x00a1\r
-        dc.w    0x1200, 0x00c0, 0x0000, 0x00c0, 0x0004, 0x0414, 0x302c, 0x0754\r
-        dc.w    0x0000, 0x0000, 0x0000, 0x812b, 0x0001, 0x0100, 0x00ff, 0xff00                                   \r
-        dc.w    0x0080, 0x4000, 0x0080, 0xaf01, 0xd91f, 0x1127, 0x0021, 0x2600\r
-        dc.w    0xf977, 0xedb0, 0xdde1, 0xfde1, 0xed47, 0xed4f, 0xd1e1, 0xf108                                   \r
-        dc.w    0xd9c1, 0xd1e1, 0xf1f9, 0xf3ed, 0x5636, 0xe9e9, 0x8104, 0x8f01                \r
-        dc.w    0xc000, 0x0000, 0x4000, 0x0010, 0x9fbf, 0xdfff                                \r
-\r
-Continue:\r
-        tst.w    0x00C00004\r
-\r
-* set stack pointer\r
-*        clr.l   %a7\r
-        move.w   #0,%a7\r
-\r
-* user mode\r
-        move.w  #0x2300,%sr\r
-\r
-* clear Genesis RAM\r
-        lea     0xff0000,%a0\r
-        moveq   #0,%d0\r
-clrram: move.w  #0,(%a0)+\r
-        subq.w  #2,%d0\r
-       bne     clrram\r
-\r
-*----------------------------------------------------------        \r
-*\r
-*       Load driver into the Z80 memory\r
-*\r
-*----------------------------------------------------------        \r
-\r
-* halt the Z80\r
-        move.w  #0x100,0xa11100\r
-* reset it\r
-        move.w  #0x100,0xa11200\r
+       tst.w   0xC00004\r
+       jmp     main\r
 \r
-        lea     Z80Driver,%a0\r
-        lea     0xa00000,%a1\r
-        move.l  #Z80DriverEnd,%d0\r
-        move.l  #Z80Driver,%d1\r
-        sub.l   %d1,%d0\r
-Z80loop:\r
-        move.b  (%a0)+,(%a1)+\r
-        subq.w  #1,%d0\r
-       bne     Z80loop\r
-\r
-* enable the Z80\r
-        move.w  #0x0,0xa11100\r
-\r
-*----------------------------------------------------------        \r
-        jmp      main\r
-\r
-INT:    \r
-       rte\r
+* INT:\r
+*      rte\r
 \r
 HBL:\r
-        /* addq.l   #1,htimer */\r
        rte\r
 \r
 * VBL:\r
 *      addq.l #1,(vtimer).l\r
 *      rte\r
 \r
-*----------------------------------------------------------        \r
-*\r
-*       Z80 Sound Driver\r
-*\r
-*----------------------------------------------------------        \r
-Z80Driver:\r
-          dc.b  0xc3,0x46,0x00,0x00,0x00,0x00,0x00,0x00\r
-          dc.b  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
-          dc.b  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
-          dc.b  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
-          dc.b  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
-          dc.b  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
-          dc.b  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
-          dc.b  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
-          dc.b  0x00,0x00,0x00,0x00,0x00,0x00,0xf3,0xed\r
-          dc.b  0x56,0x31,0x00,0x20,0x3a,0x39,0x00,0xb7\r
-          dc.b  0xca,0x4c,0x00,0x21,0x3a,0x00,0x11,0x40\r
-          dc.b  0x00,0x01,0x06,0x00,0xed,0xb0,0x3e,0x00\r
-          dc.b  0x32,0x39,0x00,0x3e,0xb4,0x32,0x02,0x40\r
-          dc.b  0x3e,0xc0,0x32,0x03,0x40,0x3e,0x2b,0x32\r
-          dc.b  0x00,0x40,0x3e,0x80,0x32,0x01,0x40,0x3a\r
-          dc.b  0x43,0x00,0x4f,0x3a,0x44,0x00,0x47,0x3e\r
-          dc.b  0x06,0x3d,0xc2,0x81,0x00,0x21,0x00,0x60\r
-          dc.b  0x3a,0x41,0x00,0x07,0x77,0x3a,0x42,0x00\r
-          dc.b  0x77,0x0f,0x77,0x0f,0x77,0x0f,0x77,0x0f\r
-          dc.b  0x77,0x0f,0x77,0x0f,0x77,0x0f,0x77,0x3a\r
-          dc.b  0x40,0x00,0x6f,0x3a,0x41,0x00,0xf6,0x80\r
-          dc.b  0x67,0x3e,0x2a,0x32,0x00,0x40,0x7e,0x32\r
-          dc.b  0x01,0x40,0x21,0x40,0x00,0x7e,0xc6,0x01\r
-          dc.b  0x77,0x23,0x7e,0xce,0x00,0x77,0x23,0x7e\r
-          dc.b  0xce,0x00,0x77,0x3a,0x39,0x00,0xb7,0xc2\r
-          dc.b  0x4c,0x00,0x0b,0x78,0xb1,0xc2,0x7f,0x00\r
-          dc.b  0x3a,0x45,0x00,0xb7,0xca,0x4c,0x00,0x3d\r
-          dc.b  0x3a,0x45,0x00,0x06,0xff,0x0e,0xff,0xc3\r
-          dc.b  0x7f,0x00\r
-Z80DriverEnd:\r
-\r
-\r