Skip to content

Commit

Permalink
Fix spacings in patch.asm
Browse files Browse the repository at this point in the history
  • Loading branch information
Infinest authored Apr 4, 2021
1 parent e1eed28 commit 88acb3b
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions patch.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; Constants: ---------------------------------------------------------------------------------
MD_PLUS_OVERLAY_PORT: equ $0003F7FA
MD_PLUS_CMD_PORT: equ $0003F7FE
REGISTER_BACKUP: equ $FFFFFF80
MD_PLUS_CMD_PORT: equ $0003F7FE
REGISTER_BACKUP: equ $FFFFFF80

; Overrides: ---------------------------------------------------------------------------------
org $2608
Expand Down Expand Up @@ -33,73 +33,73 @@ RETURN_FROM_RESUME_DETOUR
PAUSE_DETOUR
movem D1,(REGISTER_BACKUP)
move.w #$1300,D1
jsr WRITE_MD_PLUS_FUNCTION
jsr WRITE_MD_PLUS_FUNCTION
movem (REGISTER_BACKUP),D1
st $FFFFBFD6 ; Original game code
jsr $0001CB632
jmp RETURN_FROM_PAUSE_DETOUR
st $FFFFBFD6 ; Original game code
jsr $0001CB632
jmp RETURN_FROM_PAUSE_DETOUR

RESUME_DETOUR
movem D1,(REGISTER_BACKUP)
move.w #$1400,D1
jsr WRITE_MD_PLUS_FUNCTION
jsr WRITE_MD_PLUS_FUNCTION
movem (REGISTER_BACKUP),D1
sf $FFFFBFD6 ; Original game code
jsr $0001CB632
jmp RETURN_FROM_RESUME_DETOUR
sf $FFFFBFD6 ; Original game code
jsr $0001CB632
jmp RETURN_FROM_RESUME_DETOUR

STOP_DETOUR
cmpi.l #$FFFFFFFF,D0
bne DONT_STOP_MUSIC
bne DONT_STOP_MUSIC
movem D1,(REGISTER_BACKUP)
move.w #$1300,D1
bsr WRITE_MD_PLUS_FUNCTION
bsr WRITE_MD_PLUS_FUNCTION
movem (REGISTER_BACKUP),D1
DONT_STOP_MUSIC
movem.l D0/A0,-(A7) ; Original game code
jsr $0001CB622
jmp RETURN_FROM_STOP_DETOUR
movem.l D0/A0,-(A7) ; Original game code
jsr $0001CB622
jmp RETURN_FROM_STOP_DETOUR

PLAY_DETOUR
cmpi.b #$22,D0
bhi NOT_MUSIC ; Branch if higher than $22
bhi NOT_MUSIC ; Branch if higher than $22
movem D1-D2,(REGISTER_BACKUP)
move.w #$1200,D1
move.b D0,D1
addi.b #$1,D1
move.b #$0,D2
cmpi.b #$D,D0 ; Beginning from #$D, there is a set of 3 empty track ids
bcs DO_NOT_DECREMENT_FURTHER
cmpi.b #$D,D0 ; Beginning from #$D, there is a set of 3 empty track ids
bcs DO_NOT_DECREMENT_FURTHER
addi.b #$3,D2

cmpi.b #$13,D0
bcs DO_NOT_DECREMENT_FURTHER ; On #$13, there is one empty track id
bcs DO_NOT_DECREMENT_FURTHER ; On #$13, there is one empty track id
addi.b #$1,D2

cmpi.b #$15,D0
bcs DO_NOT_DECREMENT_FURTHER ; On #$15, there is one empty track id
bcs DO_NOT_DECREMENT_FURTHER ; On #$15, there is one empty track id
addi.b #$1,D2

cmpi.b #$19,D0
bcs DO_NOT_DECREMENT_FURTHER ; On #$19, there is one empty track id
bcs DO_NOT_DECREMENT_FURTHER ; On #$19, there is one empty track id
addi.b #$1,D2

cmpi #$1D,D0
bcs DO_NOT_DECREMENT_FURTHER ; Beginning from #$1D, there is a set of 3 empty track ids
bcs DO_NOT_DECREMENT_FURTHER ; Beginning from #$1D, there is a set of 3 empty track ids
addi.b #$3,D2

DO_NOT_DECREMENT_FURTHER
sub.b D2,D1 ; Subtract D2 from D1 to get rid of holes in the track index sequence
bsr WRITE_MD_PLUS_FUNCTION
sub.b D2,D1 ; Subtract D2 from D1 to get rid of holes in the track index sequence
bsr WRITE_MD_PLUS_FUNCTION
movem (REGISTER_BACKUP),D1-D2
rts
NOT_MUSIC
movem.l D0/A0/A6,-(A7) ; Original game code
movem.l D0/A0/A6,-(A7) ; Original game code
jsr $0001CB60C
jmp RETURN_FROM_PLAY_DETOUR

WRITE_MD_PLUS_FUNCTION:
move.w #$CD54,(MD_PLUS_OVERLAY_PORT) ; Open interface
move.w D1,(MD_PLUS_CMD_PORT) ; Send command to interface
move.w D1,(MD_PLUS_CMD_PORT) ; Send command to interface
move.w #$0000,(MD_PLUS_OVERLAY_PORT) ; Close interface
rts
rts

0 comments on commit 88acb3b

Please sign in to comment.