testpico: 32x reset + other tests
[megadrive.git] / testsram / 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 "SRAM test                                       "\r
13     .ascii "SRAM test                                       "\r
14     .ascii "GM 00000000-00"\r
15     .byte 0x00,0x00\r
16     .ascii "J               "\r
17     dc.l  0x000000,0x3fffff\r
18     dc.l  0xff0000,0xffffff\r
19     .ascii "RA"; .byte 0xf8,0x20                     /* 1b0 */\r
20     /* retrode compat: wants odd and <= 0xffff */\r
21     dc.l  0x200001,0x20ffff                          /* 1b4 */\r
22     .ascii "    "                                    /* 1bc */\r
23     .ascii "                        "                /* 1c0 */\r
24     .ascii "                        "\r
25     .ascii "JUE             "                        /* 1f0 */\r
26 \r
27 RST:\r
28     move.w  #0x2700, %sr\r
29 \r
30     move.b (0xA10001), %d0\r
31     andi.b #0x0F, %d0\r
32     beq.s 0f\r
33     move.l  #0x53454741, (0xA14000) /* 'SEGA' */\r
34 0:\r
35         tst.w   (0xc00004).l\r
36 \r
37     moveq   #0, %d0\r
38     movea.l %d0, %a7\r
39     move    %a7, %usp\r
40 #    move.w  #0x2000, %sr\r
41     jsr     main\r
42 0:\r
43     bra     0b\r
44 \r
45 #HBL:\r
46 #VBL:\r
47 #    rte\r
48 \r
49 pre_exception:\r
50     move.w  #0x2700, %sr\r
51     movem.l %d0-%d7/%a0-%a7,-(%sp)\r
52     move.l %sp, %d0\r
53     move.l %d0,-(%sp)\r
54     jsr exception\r
55 0:\r
56     bra 0b\r
57 \r
58 .macro exc_stub num\r
59 exc\num:\r
60     move.w #0x\num, -(%sp)\r
61     jmp pre_exception\r
62 .endm\r
63 \r
64 exc_stub 02\r
65 exc_stub 03\r
66 exc_stub 04\r
67 exc_stub 05\r
68 exc_stub 06\r
69 exc_stub 07\r
70 exc_stub 08\r
71 exc_stub 09\r
72 exc_stub 0a\r
73 exc_stub 0b\r
74 exc_stub 0c\r
75 exc_stub 0d\r
76 exc_stub 0e\r
77 exc_stub 0f\r
78 exc_stub 10\r
79 exc_stub 11\r
80 exc_stub 12\r
81 exc_stub 13\r
82 exc_stub 14\r
83 exc_stub 15\r
84 exc_stub 16\r
85 exc_stub 17\r
86 exc_stub 18\r
87 exc_stub 19\r
88 exc_stub 1a\r
89 exc_stub 1b\r
90 HBL:\r
91 exc_stub 1c\r
92 exc_stub 1d\r
93 VBL:\r
94 exc_stub 1e\r
95 exc_stub 1f\r
96 exc_stub 20\r
97 exc_stub 21\r
98 exc_stub 22\r
99 exc_stub 23\r
100 exc_stub 24\r
101 exc_stub 25\r
102 exc_stub 26\r
103 exc_stub 27\r
104 exc_stub 28\r
105 exc_stub 29\r
106 exc_stub 2a\r
107 exc_stub 2b\r
108 exc_stub 2c\r
109 exc_stub 2d\r
110 exc_stub 2e\r
111 exc_stub 2f\r
112 exc_stub 30\r
113 exc_stub 31\r
114 exc_stub 32\r
115 exc_stub 33\r
116 exc_stub 34\r
117 exc_stub 35\r
118 exc_stub 36\r
119 exc_stub 37\r
120 exc_stub 38\r
121 exc_stub 39\r
122 exc_stub 3a\r
123 exc_stub 3b\r
124 exc_stub 3c\r
125 exc_stub 3d\r
126 exc_stub 3e\r
127 exc_stub 3f\r
128 \r
129 # vim:filetype=asmM68k:ts=4:sw=4:expandtab\r