User:Kmeisthax/Findings/2011/6/9/v64 Patch Notes

From Wikifang, a definitive guide to Telefang, Dino Device and Bugsite
Jump to navigation Jump to search
   ROM 29:560A draws Denjuu names on the call screen. It does not manage HL at all and thus the VWF clobbers it by implicitly moving it up one tile each letter.
   
   So we need to insert some advice inside the drawing loop.
   
   Our three byte pointcut needs to be fit at A5640 which is:
   
   ld a, [DE]
   cp $E0
   jr nz, NotATerminator
   ld a,0
   NotATerminator: inc de (A5640) = 13
   push bc = C5
   push de = D5
   call StatusVWF_Pointcut = CD C7 2F
   pop de = D1
   pop bc = C1
   dec b = 05
   jr nz, A5639 = 20 EE
   
   Exactly three byte between inc de (which is a label I don't wanna move around) and the call to StatusVWF_Pointcut. That's where we put our advice.
   
   TextLoop_Advice: inc de = 13
   push bc = C5
   push de = D5
   push hl = E5
   call StatusVWF_Pointcut = CD C7 2F
   pop hl = E1
   pop de = D1
   pop bc = C1
   ld a, [WRAM_VWFMode] (C7C5) = FA C5 C7
   dec a = 3D
   
   jr nz, NoMoveup = 20 08
   push de = D5
   ld D, 00 = 16 00
   ld E, 10 = 1E 10
   add HL, DE = 19
   pop de = D1
   
   NoMoveup: dec b = 05
   jp nz, 5639 = C2 39 56
   jp TextLoopAdvice_End = C3 4B 56
   
   Free space in 29 starts at 29:786A, so that's where we'll put our advice.
   
   Finally, let's patch in the new advice:
   
   ld a, [DE]
   cp $E0
   jr nz, NotATerminator
   ld a,0
   NotATerminator: jp TextLoop_Advice = C3 6A 78
   nop
   nop
   nop
   nop
   nop
   nop
   nop
   nop