Language…
13 users online:  AmperSam, ASSATAKKU, Cristian Cardoso, DaMarioFan, Dangil, drkrdnk, Giftshaven, nonamelol1,  patcdr, Rauf, signature_steve, timothy726, tOaO - Guests: 235 - Bots: 331
Users: 64,795 (2,377 active)
Latest user: mathew

Number HP patch


I'm using this code in a hack I'm working on and I modified it a little. Everything seems to be working fine except getting a mushroom or any other powerup does not give me HP back. Here is what I have so far;

;------------------
;Numbered Health Bar
;------------------

!Freespace = $1FC000
!Health = $0DC4
!Dmg = $7F8611
!Mush = $02

Header
LoROM

org $01C510
db $00,00,00,00
org $01C515
db $00
org $01C51C
db $00
org $01C524
db $00,00,00,00

;--------
org $0491DB
JML Level
NOP
org $F2E0
JML Midwayheal
NOP #4
org $01C561
JML Mushroom
org $8F7E
JSL Tilemaps
org $F5F8
NOP #4
org $9E2C
JSL GameLoad
NOP #2
org $F5D5
JML Hit
org $F60A
JML SubDead
org $01C561;lol
org $01C604;my code. 1up=hp
JSL OneUpLives
org !Freespace
!CodeSize = Ending-Routine
db "STAR"
dw !CodeSize-$01
dw !CodeSize-$01^$FFFF
Routine:
;----------
;Level Load
;----------
Level:
LDA !Health
BNE NoRefill
LDA #$0A
STA !Health
NoRefill:
LDA #$02
STA $0DB1
JML $0491E0
;----------
;Mushroom Heal
;----------
Mushroom:
LDA !Health
CMP #$0A
BPL StoreItem
LDA !Health
CLC
ADC #!Mush
STA !Health
BRA CheckBig
StoreItem:
LDA $19
BEQ GetBig
LDA $0DC2
BNE NoItem
INC $0DC2
BRA NoItem
CheckBig:
LDA $19
BNE NoItem
GetBig:
LDX #$02
STX $71
NoItem:
JML $01C565
;----------
;Midway Heal
;----------
Midwayheal:
LDA !Health
CMP #$0A
BEQ .Skip
INC
STA !Health
LDA $19
BNE .Skip
INC
STA $19
.Skip
JML $00F2E8
;--------
;Game Load
;--------
GameLoad:
STA $0DBE
STZ $0DBF
LDA #$0A
STA !Health
RTL
;---------
;Tile Data
;---------
Tilemaps:
STX $0F18 ;coins tilemap 1st digit
STA $0F19 ;coins tilemap 2nd digit
; LDA !Health
; CMP #$01
; BNE End
; STZ $19 ;Hah, gotcha
; BRA Tiles ;Might as well nuke the check too
;End:
LDA #$01
STA $19
Tiles:
LDA #$11
LDX #$19
LDY #$26
STA $0F01 ;H
STX $0F02 ;P
STY $0F1B ;x
LDA !Health
JSL HexDec
STX $0F1C ;#
STA $0F1D ;#
Return:
RTL
;-------------
;Hex/Dec Conversion Loop
;-------------
HexDec:
LDX #$00
Loops:
CMP #$0A
BNE Return
SBC #$0A
INX
BRA Loops
;--------------
;Hit/Death Routine
;--------------
Hit:
PHB
PHK
PLB
LDA $7FAB10,x
AND #$08
BEQ NotCustom
LDA $7FAB9E,x
TAY
LDA CustSprList,y
BRA StoreSprDmg
NotCustom:
LDY $9E,x
LDA NormSprList,y
StoreSprDmg:
STA !Dmg
LDA !Dmg
BEQ NoSpr
LDA !Health
SEC
SBC !Dmg
BRA SprSet
NoSpr:
LDA !Health
DEC
SprSet:
STA !Health
PLB
LDA !Health
BEQ SubDeath
BMI SubDeath
JML $00F5F3
SubDeath:
STZ $19
STZ !Health
SubDead:
LDA #$09
STA $1DFB
JML $00F60F
SprReturn:
RTL
;My code
OneUpLives:
LDA #$0A
STA !Health
;JML $02ACE5;Uncomment to make it still give 1ups
RTL


There is a sprite list below all this code, but the problem must be in here somewhere.
Layout by LDA during C3.
First of all you should use the code-tag when posting large code to make the code more readable.

Secondly the actual code doesn't seem wrong from what I can see (I checked below the "Mushroom:" label). My guess is that it's propably a problem with the hijack position. Maybe you hijacked at the wrong position and therefore your code doesn't get executed when you take a mushroom. That's the only problem I can imagine at the moment.
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!

Originally posted by Satan
First of all you should use the code-tag when posting large code to make the code more readable.


Actually I did that first and for some reason placed it all on one line a stretched the tables. :P

I was even tried changing the BCS to a BCC by a suggestion and had no luck.

Everything else works, the 1-ups work they way they should, the midway point works too, but getting a mushroom or fire flower does nothing and the fire flower has no effect on Mario even if his HP is full.

EDIT Changing it to BPL seemed to work but there is still the issue with the fireflower doing nothing.
Layout by LDA during C3.
You might want to consider changing

Quote
org $01C510
db $00,00,00,00
org $01C515
db $00
org $01C51C
db $00
org $01C524
db $00,00,00,008


Into

Quote
org $01C510
db $EA,EA,EA,EA
org $01C515
db $EA
org $01C51C
db $EA
org $01C524
db $EA,EA,EA,EA


As 00 stands for the opcode BRK(Software Break), while EA is NOP(No Operation)
Those are table entries, not opcodes.
My YouTube channel
Get the official ASMT resource pack here!

Well in that case, never mind =P
I'm no pro at asm hacking, but I used a Doki Doki Panic health patch which I had a bit of the same problem.

I suggest looking at this for a help.

http://www.smwcentral.net/download.php?id=650&type=patches
Originally posted by Darkvayne
Actually I did that first and for some reason placed it all on one line a stretched the tables. :P


Try something that is not IE.

Don't insult me like that, I would never touch that malformed piece of bloatware; I use Firefox :P

I decided to use Ninjawolfs idea and use the DokiDoki patch. I liked the other one because of the customizable damage for each enemy, but this will have to do.
Layout by LDA during C3.
Well with that patch, I didn't like when you had a powerup other then Mushroom, that it would take your powerup and a heart or that the other powerup wouldn't give you a heart.

I can help a little bit with it, making it when you lose cape or flower, you don't lose a health.

Also if you figure out how to combine it with SMB3 Powerdown patch, it looks nicer then when you get hit as Big Mario, and it plays the shrinking animation but doesn't give you small Mario.
Originally posted by ImJacke-O-Lantern9
Originally posted by Darkvayne
Actually I did that first and for some reason placed it all on one line a stretched the tables. :P


Try something that is not IE.

Because your post totally is relevant to the topic I'm warning you to not derail the thread.
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
Originally posted by The Judge
Originally posted by ImJacke-O-Lantern9
Originally posted by Darkvayne
Actually I did that first and for some reason placed it all on one line a stretched the tables. :P


Try something that is not IE.

Because your post totally is relevant to the topic I'm warning you to not derail the thread.

What. That's perfectly relevant. See these screenshots for reference.
<blm> zsnes users are the flatearthers of emulation
Originally posted by Alcaro
Originally posted by The Judge
Originally posted by ImJacke-O-Lantern9
Originally posted by Darkvayne
Actually I did that first and for some reason placed it all on one line a stretched the tables. :P


Try something that is not IE.

Because your post totally is relevant to the topic I'm warning you to not derail the thread.

What. That's perfectly relevant. See these screenshots for reference.

The topic was Lightvayne asking for help, not how table stretching acts in various browsers. It wouldn't be as bad if there was more content in that post. Also, you could've instead PM'd me that just to avoid further derailing. Now lets get back on topic.

Unless Lightvayne really decided to abondon his idea and use the DokiDoki patch, then the thread probably served its purpose.
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)

Originally posted by The Judge
Unless Lightvayne really decided to abondon his idea and use the DokiDoki patch, then the thread probably served its purpose.

It has ^_^

Thanks to all those that helped close this thread by the senseless non-sense that usually happens in these threads. :P
Layout by LDA during C3.