iq_132
Professional
Ok, looks like I still have some bugs in my code, then... I'll have to find some time to get this to work, though.
I find the discovery of the bios handler quite exciting, though, it would allow to set debug options in the game without running the game. Have you found if there are any functions exposed from the bios that a game can use?
Yes, there's a lookup table in the bios for a few functions (two of which I could figure out), otherwise the bios isn't really used.
The code below is enough to actually replace the entire bios (with Caveats, oriental legends requires the ram be initialized properly, asic games expect the bios to be going through the start-up process while they hash check and write the decryption code for the 68k rom, etc).
START:
ORG $0
dc.l $820000 ; sp
dc.l init_function ; initial pc
ORG $70
dc.l irq4
ORG $78
dc.l irq6
ORG $100
init_function
move.l $100004, -(A7)
rts
irq4
move.l $100070, -(A7)
rts
irq6
move.l $100078, -(A7)
rts
ORG $230
dc.b 'V0001', 0, 0, 0 ; first word read and used by the cart's rom for... something?
dc.l coin_handler ; 238
dc.l unknown_23c ; 23c
dc.l unknown_240 ; 240
dc.l test_mode_button ; 244
dc.l unknown_248 ; 248
coin_handler
unknown_23c
unknown_240
test_mode_button
unknown_248
rts
END START
Using this init in the bios is good enough (at least in an emulator) to get every game except Oriental Legend working/launching fine.
Code:
init_function
; count frames until we hit 760 - this is the standard boot time for a pgm game (with the splash enabled)
; this fixes killing blade plus, ddp2,
moveq.l #$0, D0
lea.l $b07000, A0 ; scanline counter
frame_counter_1
cmpi.w #$e0, (A0) ; check current scanline
bne.s frame_counter_1
frame_counter_2
cmpi.w #$e1, (A0) ; check current scanline
bne.s frame_counter_2
addq.l #$1, D0
cmpi.w #$2f8, D0 ;760 frames
bne.s frame_counter_1
move.l $100004, -(A7)
rts
Last edited: