X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=megaed-sv%2Fsega_gcc.s;h=897acdfa1f43088fdcd51e1281f2502cccd4ddaf;hb=8d788f3de66aeda55c2518b5e511111face3a82a;hp=42e3d5f6c4d4a6949c88c1963e585282bde24bc2;hpb=ab6ed3c49797791b2cfd90f4f636e7489355d02b;p=megadrive.git diff --git a/megaed-sv/sega_gcc.s b/megaed-sv/sega_gcc.s index 42e3d5f..897acdf 100644 --- a/megaed-sv/sega_gcc.s +++ b/megaed-sv/sega_gcc.s @@ -1,44 +1,60 @@ - dc.l 0x0,0x200 - dc.l INT,INT,INT,INT,INT,INT,INT - dc.l INT,INT,INT,INT,INT,INT,INT,INT - dc.l INT,INT,INT,INT,INT,INT,INT,INT - dc.l INT,INT,INT,HBL,INT,VBL,INT,INT - dc.l INT,INT,INT,INT,INT,INT,INT,INT - dc.l INT,INT,INT,INT,INT,INT,INT,INT - dc.l INT,INT,INT,INT,INT,INT,INT,INT - dc.l INT,INT,INT,INT,INT,INT,INT - .ascii "SEGA EVERDRIVE " - .ascii "MEGA-ED host " - .ascii "MEGA-ED host " - .ascii "GM 00000000-00" - .byte 0x00,0x00 - .ascii "JD " - .byte 0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00 - .byte 0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff - .ascii " " - .ascii " " - .ascii " " - .ascii "JUE " +exc_tab: + dc.l 0, 0x200, exc02, exc03, exc04, exc05, exc06, exc07 + dc.l exc08, exc09, exc0a, exc0b, exc0c, exc0d, exc0e, exc0f + dc.l exc10, exc11, exc12, exc13, exc14, exc15, exc16, exc17 + dc.l exc18, exc19, exc1a, exc1b, HBL, exc1d, VBL, exc1f + dc.l exc20, exc21, exc22, exc23, exc24, exc25, exc26, exc27 + dc.l exc28, exc29, exc2a, exc2b, exc2c, exc2d, exc2e, exc2f + dc.l exc30, exc31, exc32, exc33, exc34, exc35, exc3e, exc37 + dc.l exc38, exc39, exc3a, exc3b, exc3c, exc3d, exc3e, exc3f + + .ascii "SEGA EVERDRIVE " + .ascii "MEGA-ED host " + .ascii "MEGA-ED host " + .ascii "GM 00000000-00" + .byte 0x00,0x00 + .ascii "JD " + .byte 0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00 + .byte 0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff + .ascii " " + .ascii " " + .ascii " " + .ascii "JUE " -/* magic ED app init */ RST: + move.w (0xc00008), start_hvc + move.w #0x2700, %sr +/* magic ED app init */ move.w #0x0000, (0xA13006) jmp init_ed.l init_ed: - move.w #0x210f, (0xA13006) - move.l #HBL, (0x70) - move.l #VBL, (0x78) +/* relocate to bank a, so that other ROMs can be loaded */ + move.w #0x0a0f, (0xA13006) + movea.l #0x100000, %a0 + movea.l #0x200000, %a1 + move.l #0x100000/4/4-1, %d0 +0: + move.l (a0)+, (a1)+ + move.l (a0)+, (a1)+ + move.l (a0)+, (a1)+ + move.l (a0)+, (a1)+ + dbra %d0, 0b - moveq #0,%d0 - movea.l %d0,%a7 - move %a7,%usp - bra main + move.w #0x10af, (0xA13006) -INT: - movem.l %d0-%d1/%a0-%a1,-(%sp) - jsr exception - movem.l (%sp)+,%d0-%d1/%a0-%a1 - rte + lea exc_tab, %a0 + adda.l #4*2, %a0 + movea.l #4*2, %a1 + move.l #64-2-1, %d0 +0: + move.l (a0)+, (a1)+ + dbra %d0, 0b + + moveq #0, %d0 + movea.l %d0, %a7 + move %a7, %usp + move.w #0x2000, %sr + bra main HBL: rte @@ -49,6 +65,15 @@ VBL: movem.l (%sp)+,%d0-%d1/%a0-%a1 rte +pre_exception: + move.w #0x2700, %sr + movem.l %d0-%d7/%a0-%a7,-(%sp) + move.l %sp, %d0 + move.l %d0,-(%sp) + jsr exception +0: + bra 0b + * Standard 32X startup code for MD side at 0x3F0 .org 0x3F0 @@ -119,3 +144,79 @@ VBL: .word 0xFFC0,0x4CD6,0x7FF9,0x44FC,0x0000,0x6014,0x43F9,0x00A1 .word 0x5100,0x3340,0x0006,0x303C,0x8000,0x6004,0x44FC,0x0001 +.macro exc_stub num +exc\num: + move.w #0x\num, -(%sp) + jmp pre_exception +.endm + +exc_stub 02 +exc_stub 03 +exc_stub 04 +exc_stub 05 +exc_stub 06 +exc_stub 07 +exc_stub 08 +exc_stub 09 +exc_stub 0a +exc_stub 0b +exc_stub 0c +exc_stub 0d +exc_stub 0e +exc_stub 0f +exc_stub 10 +exc_stub 11 +exc_stub 12 +exc_stub 13 +exc_stub 14 +exc_stub 15 +exc_stub 16 +exc_stub 17 +exc_stub 18 +exc_stub 19 +exc_stub 1a +exc_stub 1b +# exc_stub 1c +exc_stub 1d +# exc_stub 1e +exc_stub 1f +exc_stub 20 +exc_stub 21 +exc_stub 22 +exc_stub 23 +exc_stub 24 +exc_stub 25 +exc_stub 26 +exc_stub 27 +exc_stub 28 +exc_stub 29 +exc_stub 2a +exc_stub 2b +exc_stub 2c +exc_stub 2d +exc_stub 2e +exc_stub 2f +exc_stub 30 +exc_stub 31 +exc_stub 32 +exc_stub 33 +exc_stub 34 +exc_stub 35 +exc_stub 36 +exc_stub 37 +exc_stub 38 +exc_stub 39 +exc_stub 3a +exc_stub 3b +exc_stub 3c +exc_stub 3d +exc_stub 3e +exc_stub 3f + +.bss +.align 2 +.global start_hvc +start_hvc: + .word 0 + +# vim:filetype=asmM68k:ts=4:sw=4:expandtab