| 1 | exc_tab:\r |
| 2 | dc.l 0, RST, 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, 0xff0100, exc1d, 0xff0140, 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 32X "\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 | .long 0x000000,0x3fffff\r |
| 18 | .long 0xff0000,0xffffff\r |
| 19 | .ascii "RA"; .byte 0xf8,0x20 /* 1b0 */\r |
| 20 | .long 0x200001,0x20ffff /* 1b4 */\r |
| 21 | .ascii " " /* 1bc */\r |
| 22 | .ascii " " /* 1c0 */\r |
| 23 | .ascii "src: https://github.com/notaz/megadrive/" /* 1c8 */\r |
| 24 | .ascii "JUE " /* 1f0 */\r |
| 25 | \r |
| 26 | # 32X reset vector (880200)\r |
| 27 | bra RST32X\r |
| 28 | \r |
| 29 | # mystery landing area for reset with 32X on and RV=1\r |
| 30 | # 2c8 - 304 in multiples of 4\r |
| 31 | .rept 0x1bc/2\r |
| 32 | illegal\r |
| 33 | .endr\r |
| 34 | \r |
| 35 | /* MARS data */\r |
| 36 | .org 0x3c0\r |
| 37 | .ascii "PD testsuite "\r |
| 38 | .long 0 /* version? not used */\r |
| 39 | .long sh2_test /* ROM src */\r |
| 40 | .long 0 /* SDRAM dst */\r |
| 41 | .long sh2_test_end-sh2_test /* length */\r |
| 42 | .long 0x06000400 /* master entry */\r |
| 43 | .long 0x06000404 /* slave entry */\r |
| 44 | .long 0x06000000 /* master VBR */\r |
| 45 | .long 0x06000200 /* slave VBR */\r |
| 46 | /* Standard 32X startup code for MD side at 0x3F0 */\r |
| 47 | .org 0x3f0\r |
| 48 | .word 0x287C,0xFFFF,0xFFC0,0x23FC,0x0000,0x0000,0x00A1,0x5128\r |
| 49 | .word 0x46FC,0x2700,0x4BF9,0x00A1,0x0000,0x7001,0x0CAD,0x4D41\r |
| 50 | .word 0x5253,0x30EC,0x6600,0x03E6,0x082D,0x0007,0x5101,0x67F8\r |
| 51 | .word 0x4AAD,0x0008,0x6710,0x4A6D,0x000C,0x670A,0x082D,0x0000\r |
| 52 | .word 0x5101,0x6600,0x03B8,0x102D,0x0001,0x0200,0x000F,0x6706\r |
| 53 | .word 0x2B78,0x055A,0x4000,0x7200,0x2C41,0x4E66,0x41F9,0x0000\r |
| 54 | .word 0x04D4,0x6100,0x0152,0x6100,0x0176,0x47F9,0x0000,0x04E8\r |
| 55 | .word 0x43F9,0x00A0,0x0000,0x45F9,0x00C0,0x0011,0x3E3C,0x0100\r |
| 56 | .word 0x7000,0x3B47,0x1100,0x3B47,0x1200,0x012D,0x1100,0x66FA\r |
| 57 | .word 0x7425,0x12DB,0x51CA,0xFFFC,0x3B40,0x1200,0x3B40,0x1100\r |
| 58 | .word 0x3B47,0x1200,0x149B,0x149B,0x149B,0x149B,0x41F9,0x0000\r |
| 59 | .word 0x04C0,0x43F9,0x00FF,0x0000,0x22D8,0x22D8,0x22D8,0x22D8\r |
| 60 | .word 0x22D8,0x22D8,0x22D8,0x22D8,0x41F9,0x00FF,0x0000,0x4ED0\r |
| 61 | .word 0x1B7C,0x0001,0x5101,0x41F9,0x0000,0x06BC,0xD1FC,0x0088\r |
| 62 | .word 0x0000,0x4ED0,0x0404,0x303C,0x076C,0x0000,0x0000,0xFF00\r |
| 63 | .word 0x8137,0x0002,0x0100,0x0000,0xAF01,0xD91F,0x1127,0x0021\r |
| 64 | .word 0x2600,0xF977,0xEDB0,0xDDE1,0xFDE1,0xED47,0xED4F,0xD1E1\r |
| 65 | .word 0xF108,0xD9C1,0xD1E1,0xF1F9,0xF3ED,0x5636,0xE9E9,0x9FBF\r |
| 66 | .word 0xDFFF,0x4D41,0x5253,0x2049,0x6E69,0x7469,0x616C,0x2026\r |
| 67 | .word 0x2053,0x6563,0x7572,0x6974,0x7920,0x5072,0x6F67,0x7261\r |
| 68 | .word 0x6D20,0x2020,0x2020,0x2020,0x2020,0x2043,0x6172,0x7472\r |
| 69 | .word 0x6964,0x6765,0x2056,0x6572,0x7369,0x6F6E,0x2020,0x2020\r |
| 70 | .word 0x436F,0x7079,0x7269,0x6768,0x7420,0x5345,0x4741,0x2045\r |
| 71 | .word 0x4E54,0x4552,0x5052,0x4953,0x4553,0x2C4C,0x5444,0x2E20\r |
| 72 | .word 0x3139,0x3934,0x2020,0x2020,0x2020,0x2020,0x2020,0x2020\r |
| 73 | .word 0x2020,0x2020,0x2020,0x2020,0x2020,0x2020,0x2020,0x2020\r |
| 74 | .word 0x2020,0x2020,0x2020,0x524F,0x4D20,0x5665,0x7273,0x696F\r |
| 75 | .word 0x6E20,0x312E,0x3000,0x48E7,0xC040,0x43F9,0x00C0,0x0004\r |
| 76 | .word 0x3011,0x303C,0x8000,0x323C,0x0100,0x3E3C,0x0012,0x1018\r |
| 77 | .word 0x3280,0xD041,0x51CF,0xFFF8,0x4CDF,0x0203,0x4E75,0x48E7\r |
| 78 | .word 0x81C0,0x41F9,0x0000,0x063E,0x43F9,0x00C0,0x0004,0x3298\r |
| 79 | .word 0x3298,0x3298,0x3298,0x3298,0x3298,0x3298,0x2298,0x3341\r |
| 80 | .word 0xFFFC,0x3011,0x0800,0x0001,0x66F8,0x3298,0x3298,0x7000\r |
| 81 | .word 0x22BC,0xC000,0x0000,0x7E0F,0x3340,0xFFFC,0x3340,0xFFFC\r |
| 82 | .word 0x3340,0xFFFC,0x3340,0xFFFC,0x51CF,0xFFEE,0x22BC,0x4000\r |
| 83 | .word 0x0010,0x7E09,0x3340,0xFFFC,0x3340,0xFFFC,0x3340,0xFFFC\r |
| 84 | .word 0x3340,0xFFFC,0x51CF,0xFFEE,0x4CDF,0x0381,0x4E75,0x8114\r |
| 85 | .word 0x8F01,0x93FF,0x94FF,0x9500,0x9600,0x9780,0x4000,0x0080\r |
| 86 | .word 0x8104,0x8F02,0x48E7,0xC140,0x43F9,0x00A1,0x5180,0x08A9\r |
| 87 | .word 0x0007,0xFF80,0x66F8,0x3E3C,0x00FF,0x7000,0x7200,0x337C\r |
| 88 | .word 0x00FF,0x0004,0x3341,0x0006,0x3340,0x0008,0x4E71,0x0829\r |
| 89 | .word 0x0001,0x000B,0x66F8,0x0641,0x0100,0x51CF,0xFFE8,0x4CDF\r |
| 90 | .word 0x0283,0x4E75,0x48E7,0x8180,0x41F9,0x00A1,0x5200,0x08A8\r |
| 91 | .word 0x0007,0xFF00,0x66F8,0x3E3C,0x001F,0x20C0,0x20C0,0x20C0\r |
| 92 | .word 0x20C0,0x51CF,0xFFF6,0x4CDF,0x0181,0x4E75,0x41F9,0x00FF\r |
| 93 | .word 0x0000,0x3E3C,0x07FF,0x7000,0x20C0,0x20C0,0x20C0,0x20C0\r |
| 94 | .word 0x20C0,0x20C0,0x20C0,0x20C0,0x51CF,0xFFEE,0x3B7C,0x0000\r |
| 95 | .word 0x1200,0x7E0A,0x51CF,0xFFFE,0x43F9,0x00A1,0x5100,0x7000\r |
| 96 | .word 0x2340,0x0020,0x2340,0x0024,0x1B7C,0x0003,0x5101,0x2E79\r |
| 97 | .word 0x0088,0x0000,0x0891,0x0007,0x66FA,0x7000,0x3340,0x0002\r |
| 98 | .word 0x3340,0x0004,0x3340,0x0006,0x2340,0x0008,0x2340,0x000C\r |
| 99 | .word 0x3340,0x0010,0x3340,0x0030,0x3340,0x0032,0x3340,0x0038\r |
| 100 | .word 0x3340,0x0080,0x3340,0x0082,0x08A9,0x0000,0x008B,0x66F8\r |
| 101 | .word 0x6100,0xFF12,0x08E9,0x0000,0x008B,0x67F8,0x6100,0xFF06\r |
| 102 | .word 0x08A9,0x0000,0x008B,0x6100,0xFF3C,0x303C,0x0040,0x2229\r |
| 103 | .word 0x0020,0x0C81,0x5351,0x4552,0x6700,0x0092,0x303C,0x0080\r |
| 104 | .word 0x2229,0x0020,0x0C81,0x5344,0x4552,0x6700,0x0080,0x21FC\r |
| 105 | .word 0x0088,0x02A2,0x0070,0x303C,0x0002,0x7200,0x122D,0x0001\r |
| 106 | .word 0x1429,0x0080,0xE14A,0x8242,0x0801,0x000F,0x660A,0x0801\r |
| 107 | .word 0x0006,0x6700,0x0058,0x6008,0x0801,0x0006,0x6600,0x004E\r |
| 108 | .word 0x7020,0x41F9,0x0088,0x0000,0x3C28,0x018E,0x4A46,0x6700\r |
| 109 | .word 0x0010,0x3429,0x0028,0x0C42,0x0000,0x67F6,0xB446,0x662C\r |
| 110 | .word 0x7000,0x2340,0x0028,0x2340,0x002C,0x3E14,0x2C7C,0xFFFF\r |
| 111 | .word 0xFFC0,0x4CD6,0x7FF9,0x44FC,0x0000,0x6014,0x43F9,0x00A1\r |
| 112 | .word 0x5100,0x3340,0x0006,0x303C,0x8000,0x6004,0x44FC,0x0001\r |
| 113 | \r |
| 114 | RST:\r |
| 115 | andi.b #0x0F, (0xA10001) /* 24 */\r |
| 116 | bne.s 0f /* 10 */\r |
| 117 | move.w #0x8104, (0xc00004)\r |
| 118 | bra 1f\r |
| 119 | 0:\r |
| 120 | move.l #0x53454741, (0xA14000) /* 28 'SEGA' */\r |
| 121 | 1:\r |
| 122 | move.w (0xc00008), %d0 /* 16 */\r |
| 123 | move.w %d0, -(%sp)\r |
| 124 | subq.l #2, %sp\r |
| 125 | move %sp, %usp\r |
| 126 | \r |
| 127 | move.w #0x2600, %sr\r |
| 128 | \r |
| 129 | /* clear .bss */\r |
| 130 | moveq.l #0, %d0\r |
| 131 | lea __bss_start, %a0\r |
| 132 | lea __end, %a1\r |
| 133 | 0:\r |
| 134 | move.l %d0, (%a0)+\r |
| 135 | cmp.l %a1, %a0\r |
| 136 | blt.s 0b\r |
| 137 | \r |
| 138 | # move.w #0x2000, %sr\r |
| 139 | jsr main\r |
| 140 | 0:\r |
| 141 | bra 0b\r |
| 142 | \r |
| 143 | #HBL:\r |
| 144 | #VBL:\r |
| 145 | # rte\r |
| 146 | \r |
| 147 | RST32X:\r |
| 148 | lea ram_rv_switch, %a0\r |
| 149 | movea.l #0xff0100, %a1\r |
| 150 | lea ram_rv_switch_end, %a2\r |
| 151 | 0:\r |
| 152 | move.l (%a0)+, (%a1)+\r |
| 153 | cmp.l %a2, %a0\r |
| 154 | blt.s 0b\r |
| 155 | jmp (0xff0100).l\r |
| 156 | \r |
| 157 | ram_rv_switch:\r |
| 158 | move.l (0x880004).l, %a0\r |
| 159 | bset #0, (0xa15107).l /* RV=1 */\r |
| 160 | nop /* just in case */\r |
| 161 | jmp (%a0)\r |
| 162 | ram_rv_switch_end:\r |
| 163 | \r |
| 164 | pre_exception:\r |
| 165 | move.w #0x2700, %sr\r |
| 166 | movem.l %d0-%d7/%a0-%a7,-(%sp)\r |
| 167 | add.w #2, 0x3e(%sp) /* ecxnum */\r |
| 168 | move.l %sp, %d0\r |
| 169 | move.l %d0,-(%sp) /* arg0 */\r |
| 170 | jsr exception\r |
| 171 | 0:\r |
| 172 | bra 0b\r |
| 173 | \r |
| 174 | .macro exc_stub num\r |
| 175 | exc\num:\r |
| 176 | move.w #0x\num, -(%sp)\r |
| 177 | bra pre_exception\r |
| 178 | .endm\r |
| 179 | \r |
| 180 | exc_stub 02\r |
| 181 | exc_stub 03\r |
| 182 | exc_stub 04\r |
| 183 | exc_stub 05\r |
| 184 | exc_stub 06\r |
| 185 | exc_stub 07\r |
| 186 | exc_stub 08\r |
| 187 | exc_stub 09\r |
| 188 | exc_stub 0a\r |
| 189 | exc_stub 0b\r |
| 190 | exc_stub 0c\r |
| 191 | exc_stub 0d\r |
| 192 | exc_stub 0e\r |
| 193 | exc_stub 0f\r |
| 194 | \r |
| 195 | exc_stub 10\r |
| 196 | exc_stub 11\r |
| 197 | exc_stub 12\r |
| 198 | exc_stub 13\r |
| 199 | exc_stub 14\r |
| 200 | exc_stub 15\r |
| 201 | exc_stub 16\r |
| 202 | exc_stub 17\r |
| 203 | exc_stub 18\r |
| 204 | exc_stub 19\r |
| 205 | exc_stub 1a\r |
| 206 | exc_stub 1b\r |
| 207 | HBL:\r |
| 208 | exc_stub 1c\r |
| 209 | exc_stub 1d\r |
| 210 | VBL:\r |
| 211 | exc_stub 1e\r |
| 212 | exc_stub 1f\r |
| 213 | \r |
| 214 | exc_stub 20\r |
| 215 | exc_stub 21\r |
| 216 | exc_stub 22\r |
| 217 | exc_stub 23\r |
| 218 | exc_stub 24\r |
| 219 | exc_stub 25\r |
| 220 | exc_stub 26\r |
| 221 | exc_stub 27\r |
| 222 | exc_stub 28\r |
| 223 | exc_stub 29\r |
| 224 | exc_stub 2a\r |
| 225 | exc_stub 2b\r |
| 226 | exc_stub 2c\r |
| 227 | exc_stub 2d\r |
| 228 | exc_stub 2e\r |
| 229 | exc_stub 2f\r |
| 230 | exc_stub 30\r |
| 231 | exc_stub 31\r |
| 232 | exc_stub 32\r |
| 233 | exc_stub 33\r |
| 234 | exc_stub 34\r |
| 235 | exc_stub 35\r |
| 236 | exc_stub 36\r |
| 237 | exc_stub 37\r |
| 238 | exc_stub 38\r |
| 239 | exc_stub 39\r |
| 240 | exc_stub 3a\r |
| 241 | exc_stub 3b\r |
| 242 | exc_stub 3c\r |
| 243 | exc_stub 3d\r |
| 244 | exc_stub 3e\r |
| 245 | exc_stub 3f\r |
| 246 | \r |
| 247 | .align 4\r |
| 248 | \r |
| 249 | # must avoid anything use 1070, 2070, 3070 after RV is set,\r |
| 250 | # so let's place some data here\r |
| 251 | .global z80_test\r |
| 252 | .global z80_test_end\r |
| 253 | z80_test:\r |
| 254 | .incbin "z80_test.bin80"\r |
| 255 | z80_test_end:\r |
| 256 | \r |
| 257 | .align 4\r |
| 258 | \r |
| 259 | .global sh2_test\r |
| 260 | .global sh2_test_end\r |
| 261 | sh2_test:\r |
| 262 | .incbin "sh2_test.binsh"\r |
| 263 | sh2_test_end:\r |
| 264 | \r |
| 265 | .org 0x2070\r |
| 266 | .long 0x1234567f\r |
| 267 | \r |
| 268 | .global font_base\r |
| 269 | font_base:\r |
| 270 | .incbin "font.bin"\r |
| 271 | \r |
| 272 | .org 0x3070\r |
| 273 | .long 0x3456789f\r |
| 274 | \r |
| 275 | # vim:filetype=asmM68k:ts=4:sw=4:expandtab\r |