X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=testpico%2Fsega_gcc.s;h=1e0116aeb58dc0e5fd0dca45b4d7be84c0e26da8;hb=HEAD;hp=d4fdc58351adc238146d75d88093608a1ad482e1;hpb=234c45567cc77a4eca9cddca7daaacab27cab767;p=megadrive.git diff --git a/testpico/sega_gcc.s b/testpico/sega_gcc.s index d4fdc58..4abb418 100644 --- a/testpico/sega_gcc.s +++ b/testpico/sega_gcc.s @@ -16,16 +16,19 @@ exc_tab: .ascii "J " .long 0x000000,0x3fffff .long 0xff0000,0xffffff - .ascii "RA"; .byte 0xf8,0x20 /* 1b0 */ - .long 0x200001,0x20ffff /* 1b4 */ - .ascii " " /* 1bc */ - .ascii " " /* 1c0 */ - .ascii " " - .ascii "JUE " /* 1f0 */ + .ascii "RA"; .byte 0xf8,0x20 /* 1b0 */ + .long 0x200001,0x20ffff /* 1b4 */ + .ascii " " /* 1bc */ + .ascii " " /* 1c0 */ + .ascii "src: https://github.com/notaz/megadrive/" /* 1c8 */ + .ascii "JUE " /* 1f0 */ + +# 32X reset vector (880200) + bra RST32X # mystery landing area for reset with 32X on and RV=1 # 2c8 - 304 in multiples of 4 -.rept 0x1c0/2 +.rept 0x1bc/2 illegal .endr @@ -109,20 +112,22 @@ exc_tab: .word 0x5100,0x3340,0x0006,0x303C,0x8000,0x6004,0x44FC,0x0001 RST: - move.w #0x2600, %sr - - move.b (0xA10001), %d0 - andi.b #0x0F, %d0 - beq.s 0f - move.l #0x53454741, (0xA14000) /* 'SEGA' */ + andi.b #0x0F, (0xA10001) /* 24 */ + bne.s 0f /* 10 */ + move.w #0x8104, (0xc00004) + bra 1f 0: - tst.w (0xc00004).l + move.l #0x53454741, (0xA14000) /* 28 'SEGA' */ +1: + move.w (0xc00008), %d0 /* 16 */ + move.w %d0, -(%sp) + subq.l #2, %sp + move %sp, %usp - moveq #0, %d0 - movea.l %d0, %a7 - move %a7, %usp + move.w #0x2600, %sr /* clear .bss */ + moveq.l #0, %d0 lea __bss_start, %a0 lea __end, %a1 0: @@ -139,12 +144,29 @@ RST: #VBL: # rte +RST32X: + lea ram_rv_switch, %a0 + movea.l #0xff0100, %a1 + lea ram_rv_switch_end, %a2 +0: + move.l (%a0)+, (%a1)+ + cmp.l %a2, %a0 + blt.s 0b + jmp (0xff0100).l + +ram_rv_switch: + move.l (0x880004).l, %a0 + bset #0, (0xa15107).l /* RV=1 */ + nop /* just in case */ + jmp (%a0) +ram_rv_switch_end: + pre_exception: move.w #0x2700, %sr movem.l %d0-%d7/%a0-%a7,-(%sp) - add.w #2, 0x3e(%sp) + add.w #2, 0x3e(%sp) /* ecxnum */ move.l %sp, %d0 - move.l %d0,-(%sp) /* arg0 */ + move.l %d0,-(%sp) /* arg0 */ jsr exception 0: bra 0b @@ -152,7 +174,7 @@ pre_exception: .macro exc_stub num exc\num: move.w #0x\num, -(%sp) - jmp pre_exception + bra pre_exception .endm exc_stub 02