68k initialization: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (1 revision) |
(No difference)
|
Revision as of 07:36, 7 February 2011
Vectors
Vector table and header for AES/MVS roms:
org $0 dc.l $0010F300 ; Initial SP dc.l $00C00402 ; Initial PC dc.l $00C00408,$00C0040E,$00C0040E,$0000034C ; Bus error (2),Address error (3),Illegal Instruction (4),Divide by 0 (5) dc.l $0000034E,$0000034E,$00C0041A,$00C00420 ; CHK Instruction (6),TRAPV Instruction (7),Privilege Violation (8),Trace (9) dc.l $0000034E,$0000034E,$00C00426,$00C00426 ; Emu(10),Emu(11),Reserved,Reserved dc.l $00C00426,$00C0042C,$00C00426,$00C00426 ; Reserved,Reserved,Reserved,Reserved dc.l $00C00426,$00C00426,$00C00426,$00C00426 ; Reserved,Reserved,Reserved,Reserved dc.l $00C00426,$00C00426,$00C00432,VBlank ; Reserved,Reserved,Spurious Interrupt(24) dc.l IRQ2,$00C00426,$00C00426,$00C00426 dc.l $00C00426,$00C00426,$0000056E,$0000056E ; Auto,Auto,Trap 0, Trap1... dc.l $0000056E,$0000056E,$0000056E,$0000056E dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF org $0100 dc.b "NEO-GEO",$00 dc.w $0052 ; NGH Number in BCD (0052 is ssideki) dc.l $00080000 ; ? dc.l $00100000 ; ? dc.w $0000 org $0114 dc.b $01 ; Bootscreen flag ($00 skips it) dc.b $1B ; First tile number of the NeoGeo logo in the C ROM dc.l $00000200 ; Japanese config menu pointer dc.l $00000200 ; English config menu pointer dc.l $00000200 ; European config menu pointer jmp Start jmp Start ; Not used ? jmp Start ; Not used ? jmp Start ; Not used ? dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF dc.l $FFFFFFFF,$FFFFFFFF dc.l $00000186 ; Security code pointer ? org $186 ; ??? dc.l $76004A6D,$0A146600,$003C206D,$0A043E2D dc.l $0A0813C0,$00300001,$32100C01,$00FF671A dc.l $30280002,$B02D0ACE,$66103028,$0004B02D dc.l $0ACF6606,$B22D0AD0,$67085088,$51CFFFD4 dc.l $36074E75,$206D0A04,$3E2D0A08,$3210E049 dc.l $0C0100FF,$671A3010,$B02D0ACE,$66123028 dc.l $0002E048,$B02D0ACF,$6606B22D,$0AD06708 dc.l $588851CF,$FFD83607 dc.w $4e75 org $200 ; Config menus, need to find format... dc.b "0123456789ABCDEF" dc.l $FFFFFFFF dc.w $0364 dc.b $14,$13,$24,$01
Basic init code
The initial PC value in your 68k binary must be $C00402 (Init BIOS call), the initial SP value must be $10F300 (end of user RAM).
The entrypoints for your 68k code start at $000122. There's usually 4 JMP instructions there (why ?).
lea $10F300, sp lea $10F300, a7 move.b d0,REG_DIPSW ; Kick the watchdog move.w #7,REG_IRQACK ; Acknowledge any pending interrupts move.w #$2700,sr ; Disable all interrupts
See 68k interrupts and Watchdog for more informations.
Clearing user RAM:
lea RAMSTART,a0 ; Should be $100000 move.l #($F300/4)-1,d0 ; User RAM's size is $F300, and we clear longwords (4 bytes) clram: clr.l (a0)+ dbra d0,clram
Note that this function also clears the stack. Don't make a subroutine out of it unless you're sure of what addresses you're clearing.
Clearing sprites: make a BIOS call. Clearing fix: make a BIOS call too.
Don't forget to kick the watchdog regularly in your init code if the VBL interrupt isn't enabled or doesn't kick it itself.