News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Problem with Patch Merging

Started by Draconis Kenjishiya, August 21, 2015, 09:29:49 PM

Previous topic - Next topic

Draconis Kenjishiya

I am having difficulty combining the effects of two patches.

The patches are these, here:

Super Missile Upgrade (Fusion)
lorom                   ;always needed

org $90BECF ;projectile spawning routine

        JSR $F640       ;jump to free space

org $90F640
LDA $09A4 ;load equipped items
BIT #$0010 ;check for super missile plm
BEQ MISSILE ;if not, shoot a normal missile
LDA #$0002 ;if so, load the super missile spawning routine
        RTS             ;exit this routine

MISSILE:
LDA #$0001 ;load the missile spawning routine
RTS ;exit

org $8489E6 ;HUD icon drawing address for super missiles
NOP ;takes away the JSL to drawing routine
NOP
NOP
NOP

org $8489D2
JSR $F0B0 ;JSR to free space
NOP : NOP : NOP ;getting rid of all the stuff that's not useful anymore
NOP : NOP : NOP 
NOP : NOP : NOP
NOP : NOP : NOP 
NOP : NOP : NOP
NOP : NOP

org $84F0B0
LDA $09A4 ;load the item array
ORA #$0010 ;turn on the first unused bit
STA $09A4 ;store it back to the item array
RTS

org $809D72 : DB $1C : org $809A2A : DB $1C ;all the hex tweaks for
;shifting the HUD icons over
org $809B26 : DB $9C : org $809C50 : DB $9C ;1st line - PB icon/highlight
;2nd - PB counter
org $809D74 : DB $22 : org $809A3A : DB $22 ;3rd - grapple icon/highlight
;4th - Xray icon/highlight
org $809A4A : DB $28 : org $809D76 : DB $28 ;5th/6th same as first 2 but
;for SM icon and counter
org $809A1A : DB $2E : org $809D70 : DB $2E

org $809B15 : DB $A2 : org $809C27 : DB $A2


and, Double Jump:
lorom

org $90A4C4 ;DOUBLE JUMP CHECK ROUTINE
JSR EXTRAJUMPCHECK : NOP

org $90DD40 ;ZEROS THE COUNTER FOR CHARGE JUMPING
JSR ZEROJUMPCOUNTER




org $90F640

ZEROJUMPCOUNTER:
LDA #$0000 : STA $7FFDE6 : LDA $0D32 : RTS

EXTRAJUMPCHECK:
LDA $7FFDE6 : BEQ JUMPAGAIN
BRA DONTJUMPAGAIN ;COMMENT THIS IF YOU WANT SCREW ATTACK TO GIVE YOU 5 JUMPS LIKE IN MP2
; LDA $09A2 : BIT #$0008 : BEQ DONTJUMPAGAIN ;AND UNCOMMENT THIS
; LDA $7FFDE6 : CMP #$0004 : BPL DONTJUMPAGAIN ;UNCOMMENT THIS ONE TOO
JUMPAGAIN:
LDA $7FFDE6 : INC A : STA $7FFDE6
JSL $9098BC
DONTJUMPAGAIN:
RTS


I believe it to be an error of overlapping free space but I don't know what, exactly, to repoint. I understand how to use Lunar Address and find new values, but I do not know what to replace. I know this seems rather newbie-ish but I am, as it were, a newbie to proper code work.
I tried several things (repointing several values to free space in $90) but I managed to bring up the following errors:
1. Firing a missile instead used two missiles and fired a spazer-like beam
2. Firing a missile crashed the game
3. Everything worked, but the space jump (sans the Screw Attack) did not work at all. I have double jump modded to allow the Screw Attack to jump five times, and when I only have the Space Jump, it refuses to function.

Thanks for any assistance given. :)

Mettyk25jigsaw

#1
I just patched this now for my next hack, it worked...

Instructions...Delete the 2 comments (;) B4 the 2nd and 3rd last LDA's and above these LDA's is a BRA, but here you add a comment (in other words you put a ; right in front of the BRA...

Now if you have data already used between 8-7640 to 8-766F (pc address) like I did, repoint the org somewhere else in same bank where there is free space. The org that is by default $90F640 that is...

EDIT: Oops, I forgot to tell you, that my message is related to the double jump and the double jump only...Sorry...

Scyzer

It's simply that they both write to $90F640. It's easy to fix. Use this one.


lorom                   ;always needed
org $90A4C4                  ;DOUBLE JUMP CHECK ROUTINE
   JSR EXTRAJUMPCHECK : NOP

org $90DD40                  ;ZEROS THE COUNTER FOR CHARGE JUMPING
   JSR ZEROJUMPCOUNTER

org $90BECF      ;projectile spawning routine

        JSR $F640       ;jump to free space

org $90F640
   LDA $09A4   ;load equipped items
   BIT #$0010   ;check for super missile plm
   BEQ MISSILE   ;if not, shoot a normal missile
   LDA #$0002   ;if so, load the super missile spawning routine
        RTS             ;exit this routine

MISSILE:
   LDA #$0001   ;load the missile spawning routine
   RTS       ;exit

ZEROJUMPCOUNTER:
   LDA #$0000 : STA $7FFDE6 : LDA $0D32 : RTS
   
EXTRAJUMPCHECK:
   LDA $7FFDE6 : BEQ JUMPAGAIN
   BRA DONTJUMPAGAIN                           ;COMMENT THIS IF YOU WANT SCREW ATTACK TO GIVE YOU 5 JUMPS LIKE IN MP2
;   LDA $09A2 : BIT #$0008 : BEQ DONTJUMPAGAIN         ;AND UNCOMMENT THIS
;   LDA $7FFDE6 : CMP #$0004 : BPL DONTJUMPAGAIN      ;UNCOMMENT THIS ONE TOO
   JUMPAGAIN:
      LDA $7FFDE6 : INC A : STA $7FFDE6
      JSL $9098BC
      DONTJUMPAGAIN:
         RTS

org $8489E6      ;HUD icon drawing address for super missiles
   NOP      ;takes away the JSL to drawing routine
   NOP     
   NOP     
   NOP     

org $8489D2
   JSR $F0B0   ;JSR to free space
   NOP : NOP : NOP ;getting rid of all the stuff that's not useful anymore
   NOP : NOP : NOP 
   NOP : NOP : NOP
   NOP : NOP : NOP 
   NOP : NOP : NOP
   NOP : NOP   

org $84F0B0
   LDA $09A4   ;load the item array
   ORA #$0010   ;turn on the first unused bit
   STA $09A4   ;store it back to the item array
   RTS

org $809D72 : DB $1C : org $809A2A : DB $1C   ;all the hex tweaks for
                  ;shifting the HUD icons over
org $809B26 : DB $9C : org $809C50 : DB $9C   ;1st line - PB icon/highlight
                  ;2nd - PB counter
org $809D74 : DB $22 : org $809A3A : DB $22   ;3rd - grapple icon/highlight
                  ;4th - Xray icon/highlight
org $809A4A : DB $28 : org $809D76 : DB $28   ;5th/6th same as first 2 but
                  ;for SM icon and counter
org $809A1A : DB $2E : org $809D70 : DB $2E

org $809B15 : DB $A2 : org $809C27 : DB $A2

Draconis Kenjishiya

Oh, that's the value I had to change. Ugh.

Thanks so much! *studies your changes for learning purposes*