04365c173c4f6799bf01654e347736763024a7b8
[megadrive.git] / testpico / sega_gcc.s
1 exc_tab:\r
2     dc.l     0, 0x200, exc02, exc03, exc04, exc05, exc06, exc07\r
3     dc.l exc08, exc09, exc0a, exc0b, exc0c, exc0d, exc0e, exc0f\r
4     dc.l exc10, exc11, exc12, exc13, exc14, exc15, exc16, exc17\r
5     dc.l exc18, exc19, exc1a, exc1b, HBL,   exc1d, VBL,   exc1f\r
6     dc.l exc20, exc21, exc22, exc23, exc24, exc25, exc26, exc27\r
7     dc.l exc28, exc29, exc2a, exc2b, exc2c, exc2d, exc2e, exc2f\r
8     dc.l exc30, exc31, exc32, exc33, exc34, exc35, exc3e, exc37\r
9     dc.l exc38, exc39, exc3a, exc3b, exc3c, exc3d, exc3e, exc3f\r
10 \r
11     .ascii "SEGA GENESIS                    "\r
12     .ascii "PD testsuite                                    "\r
13     .ascii "PD testsuite                                    "\r
14     .ascii "GM 00000000-00"\r
15     .byte 0x00,0x00\r
16     .ascii "J               "\r
17     .byte 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00\r
18     .byte 0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff\r
19     .ascii "RA"; .byte 0xf8,0x20                     /* 1b0 */\r
20     .byte 0x00,0x02,0x00,0x00,0x00,0x3f,0xff,0xff    /* 1b4 */\r
21     .ascii "    "                                    /* 1bc */\r
22     .ascii "                        "                /* 1c0 */\r
23     .ascii "                        "\r
24     .ascii "JUE             "                        /* 1f0 */\r
25 \r
26 RST:\r
27     move.w  #0x2700, %sr\r
28 \r
29     move.b (0xA10001), %d0\r
30     andi.b #0x0F, %d0\r
31     beq.s 0f\r
32     move.l  #0x53454741, (0xA14000) /* 'SEGA' */\r
33 0:\r
34         tst.w   (0xc00004).l\r
35 \r
36     moveq   #0, %d0\r
37     movea.l %d0, %a7\r
38     move    %a7, %usp\r
39 \r
40     /* clear .bss */\r
41     lea     __bss_start, %a0\r
42     lea     __end, %a1\r
43 0:\r
44     move.l  %d0, (%a0)+\r
45     cmp.l   %a1, %a0\r
46     blt.s   0b\r
47 \r
48 #    move.w  #0x2000, %sr\r
49     jsr     main\r
50 0:\r
51     bra     0b\r
52 \r
53 #HBL:\r
54 #VBL:\r
55 #    rte\r
56 \r
57 pre_exception:\r
58     move.w  #0x2700, %sr\r
59     movem.l %d0-%d7/%a0-%a7,-(%sp)\r
60     move.l %sp, %d0\r
61     move.l %d0,-(%sp)\r
62     jsr exception\r
63 0:\r
64     bra 0b\r
65 \r
66 .macro exc_stub num\r
67 exc\num:\r
68     move.w #0x\num, -(%sp)\r
69     jmp pre_exception\r
70 .endm\r
71 \r
72 exc_stub 02\r
73 exc_stub 03\r
74 exc_stub 04\r
75 exc_stub 05\r
76 exc_stub 06\r
77 exc_stub 07\r
78 exc_stub 08\r
79 exc_stub 09\r
80 exc_stub 0a\r
81 exc_stub 0b\r
82 exc_stub 0c\r
83 exc_stub 0d\r
84 exc_stub 0e\r
85 exc_stub 0f\r
86 exc_stub 10\r
87 exc_stub 11\r
88 exc_stub 12\r
89 exc_stub 13\r
90 exc_stub 14\r
91 exc_stub 15\r
92 exc_stub 16\r
93 exc_stub 17\r
94 exc_stub 18\r
95 exc_stub 19\r
96 exc_stub 1a\r
97 exc_stub 1b\r
98 HBL:\r
99 exc_stub 1c\r
100 exc_stub 1d\r
101 VBL:\r
102 exc_stub 1e\r
103 exc_stub 1f\r
104 exc_stub 20\r
105 exc_stub 21\r
106 exc_stub 22\r
107 exc_stub 23\r
108 exc_stub 24\r
109 exc_stub 25\r
110 exc_stub 26\r
111 exc_stub 27\r
112 exc_stub 28\r
113 exc_stub 29\r
114 exc_stub 2a\r
115 exc_stub 2b\r
116 exc_stub 2c\r
117 exc_stub 2d\r
118 exc_stub 2e\r
119 exc_stub 2f\r
120 exc_stub 30\r
121 exc_stub 31\r
122 exc_stub 32\r
123 exc_stub 33\r
124 exc_stub 34\r
125 exc_stub 35\r
126 exc_stub 36\r
127 exc_stub 37\r
128 exc_stub 38\r
129 exc_stub 39\r
130 exc_stub 3a\r
131 exc_stub 3b\r
132 exc_stub 3c\r
133 exc_stub 3d\r
134 exc_stub 3e\r
135 exc_stub 3f\r
136 \r
137 # vim:filetype=asmM68k:ts=4:sw=4:expandtab\r