INCDIR "Include:" INCLUDE whdload.i IFD BARFLY OUTPUT "KarateKid2.slave" BOPT O+ ;enable optimizing BOPT OG+ ;enable optimizing BOPT ODd- ;disable mul optimizing BOPT ODe- ;disable mul optimizing BOPT w4- ;disable 64k warnings BOPT wo- ;disable optimizer warnings SUPER ENDC _base SLAVE_HEADER ;ws_Security + ws_ID dc.w 10 ;ws_Version dc.w WHDLF_NoError|WHDLF_EmulTrap|WHDLF_ClearMem dc.l $80000 ;ws_BaseMemSize dc.l 0 ;ws_ExecInstall dc.w _Start-_base ;ws_GameLoader dc.w 0 ;ws_CurrentDir dc.w 0 ;ws_DontCache _keydebug dc.b 0 ;ws_keydebug _keyexit dc.b $59 ;ws_keyexit = F10 _expmem dc.l 0 ;ws_ExpMem dc.w _name-_base ;ws_name dc.w _copy-_base ;ws_copy dc.w _info-_base ;ws_info _name dc.b "Karate Kid 2",0 _copy dc.b "1987 Microdeal",0 _info dc.b "installed & fixed by Bored Seal",10 dc.b "V1.1 (01-Jul-2006)",0 even _Start lea (_resload,pc),a1 move.l a0,(a1) move.l a0,a2 lea (_tags,pc),a0 jsr (resload_Control,a2) lea $10000,a0 move.l a0,a6 moveq #0,d0 move.l #6*$1400,d1 moveq #1,d2 movem.l a0/d1,-(sp) jsr (resload_DiskLoad,a2) movem.l (sp)+,a0/d0 jsr (resload_CRC16,a2) cmp.w #$6a6e,d0 ;Chris Vella version bne Unsupported lea patchlist,a0 move.l a6,a1 jsr resload_Patch(a2) jmp $30(a6) patchlist PL_START PL_P $b0c,Loader PL_R $c7a ;kill disk operations PL_R $cd8 PL_R $c40 PL_W $6164,$33c0 ;fix modes for snoop PL_W $6184,$33c0 PL_W $61a4,$33c0 PL_W $61c,$604e ;remove stupid trap handlers PL_PS $1666,ButtonWait ; Install trainer if CUSTOM1=1 PL_IFC1 PL_PS $812,InstallTrainer PL_ENDIF PL_END Loader movem.l a0-a2/d0-d3,-(sp) move.w $432(a5),d2 ;disk side addq.w #1,d2 move.w $1a(a5),d0 ;offset subq #1,d0 MulOffset mulu.w #$1400,d0 move.w $24(a5),d1 ;amount of tracks mulu.w #$1400,d1 move.l $1c(a5),a0 ;buffer move.l (_resload,pc),a2 jsr (resload_DiskLoad,a2) movem.l (sp)+,a0-a2/d0-d3 clr.l d0 rts ButtonWait movem.l d0-d7/a0-a6,-(sp) lea button,a0 tst.l (a0) beq ButtonPressed lea $bfe001,a0 test btst #6,(a0) beq ButtonPressed btst #7,(a0) bne test ButtonPressed movem.l (sp)+,d0-d7/a0-a6 rts InstallTrainer move.b $bfec01,d0 ; Replace overwritten code due to JSR movem.l d0-d7/a0-a6,-(sp) ror.b #1,d0 not.b d0 cmp.b #$01,d0 ; Check for 1 pressed beq CheckTrainerP1Lives cmp.b #$02,d0 ; Check for 2 pressed beq CheckTrainerP2Lives cmp.b #$21,d0 ; Check for S pressed beq SkipLevel bra ReturnFromTrainer CheckTrainerP1Lives lea trainer_lives_p1,a0 eor.b #01,(a0) tst.b (a0) beq InstallTrainerP1Lives move.l #$916d005a,$139d0 ; Restore original p1 lives code bra ReturnFromTrainer InstallTrainerP1Lives move.l #$4e714e71,$139d0 ; Install the trainer bra ReturnFromTrainer CheckTrainerP2Lives lea trainer_lives_p2,a0 eor.b #01,(a0) tst.b (a0) beq InstallTrainerP2Lives move.l #$916d0058,$138f6 ; Restore original p1 lives code bra ReturnFromTrainer InstallTrainerP2Lives move.l #$4e714e71,$138f6 ; Install the trainer bra ReturnFromTrainer ; The following does not work on last level SkipLevel move.w #0,$f058 ; Set player two's health to 0 ;move.b #$19,$f1cf ; Skip Miyagi bonus level - Only works when I manually set it in WinUAE's debugger?! Does not work here. bra ReturnFromTrainer ReturnFromTrainer movem.l (sp)+,d0-d7/a0-a6 rts Unsupported pea TDREASON_WRONGVER _end move.l (_resload,pc),a2 jmp (resload_Abort,a2) _resload dc.l 0 _tags dc.l WHDLTAG_BUTTONWAIT_GET button dc.l 0,0 trainer_lives_p1 dc.b 1 trainer_lives_p2 dc.b 1