Hacking the SNES ROM

Discuss PoP1 for SNES here.
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 8th, 2020, 9:35 pm 4. I also see that on DOS each guard has a different hitpoint palette as well (I think it matches the turban colors), and on SNES all of them they share a green color. Can this be implemented somehow?
It actually matches the color of the guard's pants.

At 0x74CD write: 20 50 FF
At 0x7F50 write: 20 8C F5 AD 67 02 0A 0A 0A 0A 18 69 8A 8D 21 21 AE 3B 21 AC 3B 21 A9 76 8D 21 21 8E 22 21 8C 22 21 8E 22 21 8C 22 21 60

Details:

Code: Select all

At 0x74CD write:
20 50 FF  JSR $FF50

At 0x7F50 write:
20 8C F5  JSR $F58C ; write palette (A rows)
AD 67 02  LDA $0267 ; opponent palette
0A        ASL
0A        ASL
0A        ASL
0A        ASL
18        CLC
69 8A     ADC #$8A ; $80 for sprite palettes + a guard's color #10 is the color of their pants
8D 21 21  STA $2121 ; CGADD
AE 3B 21  LDX $213B ; RDCGRAM
AC 3B 21  LDY $213B ; RDCGRAM
A9 76     LDA #$76 ; dark green in guard's HP bottle
8D 21 21  STA $2121 ; CGADD
8E 22 21  STX $2122 ; CGDATA
8C 22 21  STY $2122 ; CGDATA
          ; overwrite the next color as well
8E 22 21  STX $2122 ; CGDATA
8C 22 21  STY $2122 ; CGDATA
60        RTS
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 8th, 2020, 9:35 pm 8. Hopefully, best time does not display time for Levels 13 & 14, and just add a total time on the Level 20 slot, as I think it will be a pain to add a ''name input'' for it.
At 0x1583B write: AD 79 05 C9 0D F0 06 C9 0C B0 48 80 05 A9 13 4C 70 FF
At 0x17F70 write: C2 30 48 AD 2D 05 38 E9 9C 63 8D 4B 05 68 4C 5D D8

By the way, why do you want to disable time for level 13 in addition to 14?
I understand level 14: There the timer already stopped, so time spent there doesn't count.
But why level 13?

Details:

Code: Select all

At 0x1583B write:
AD 79 05  LDA $0579 ; current level
C9 0D     CMP #$0D ; on level 14 store total time
F0 06     BEQ :1
C9 0C     CMP #$0C ; from level 13 don't store time
B0 48     BCS $D88E ; don't store
80 05     BRA :2
          :1
          ; store total time
A9 13     LDA #$13 ; level 20 slot
4C 70 FF  JMP $FF70
          :2

At 0x17F70 write:
C2 30     REP #$30
48        PHA
AD 2D 05  LDA $052D ; elapsed time 1 L ; FrameCount
38        SEC
E9 9C 63  SBC #$639C ; The elapsed time counter starts from this value, subtract it from the current value.
8D 4B 05  STA $054B ; elapsed time on this level L
68        PLA
4C 5D D8  JMP $D85D
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: May 10th, 2020, 10:27 am
Spoiler: show
Shauing wrote: May 9th, 2020, 10:12 pm All right, though because the prompt ''Press a button to continue'' appears for a brief moment, the player can actually manage to continue if it mashes the button fast enough.
Here is the fix.
It replaces and overwrites the previous version of the hack. (Again!)

At 0xF384 write back the original bytes: EE 66 04
(You can also fill 0xFDC0-0xFDDF with zeroes before you write the following codes.)

At 0xF648 write: 4C D0 FD
At 0xFDD0 write: AD 27 05 D0 03 4C 58 FF 4C FD CA

Code: Select all

The original code which we overwrite:
01:F648: 4C FD CA    JMP $CAFD ; show "press button"

Disassembly of the new code:

At 0xF648 write:
4C D0 FD  JMP $FDD0

At 0xFDD0 write:
AD 27 05  LDA $0527 ; remaining min
D0 03     BNE :1
4C 58 FF  JMP $FF58 ; time expired
          :1
4C FD CA  JMP $CAFD ; show "press button"
Thank you, it worked. It even partially fixed the long "pause cutscene during fade-out". Just like the rest of the game, the cutscene will pause and flash briefly if the start button is pressed at an specific moment during the fade-out. I think I could explain this better with a video.
David wrote: May 10th, 2020, 11:41 am
Spoiler: show
Shauing wrote: May 8th, 2020, 9:35 pm 7. Hopefully a way to display the title screen background on the staff roll with the animation. I tried to do it myself but didn't find success.
At 0x1B3E6 write: A9 05 -- load hidden second background needed for the animations
At 0x1B3F2 write: A9 04 -- load sky+moon background
At 0x1B406 write: A2 08 -- load palette for the sky+moon background
At 0x1B440 write: 80 12 -- disable transparency effects
At 0x1B667 write: EA EA EA -- remove elephant
At 0x1B695 write: EA EA EA -- remove wave animation
At 0x1B454 write: EA EA EA -- don't even apply a stopped wave to the screen

I also tried to add the animations of the title screen to the ending screen, but everything I tried so far has locked up the game.
Details:
Spoiler: show
At 0x1B695 I tried to write the following: 20 2E 81, or 20 49 81, or 20 83 81, or 20 9E 80.
These would call one out of the following codes:

Code: Select all

03:809E: a9 02       LDA #$02
03:80A0: a2 10       LDX #$10
03:80A2: 20 2e 81    JSR $812e ; sky+moon: wait frames
03:80A5: 60          RTS

sky+moon: wait frames:
03:812E: 48          PHA
03:812F: da          PHX
03:8130: da          PHX
03:8131: 20 49 81    JSR $8149 ; animate stars
03:8134: 20 83 81    JSR $8183 ; animate reflection of moon
03:8137: 20 0d 82    JSR $820d ; update screen

Great. A small curiosity/side effect is that the staff roll now scrolls smoothly, thus it plays faster and it ends much quicker than intended. Can the speed of the scroll be slowed down?
Maybe for the animation it could skip to a new place where the entire animation code of the water/stars can be copied?
David wrote: May 10th, 2020, 12:09 pm
Spoiler: show
Shauing wrote: May 8th, 2020, 9:35 pm 3. On DOS, when either the Prince or a guard has one hitpoint left, it flashes. Can this be implemented?
At 0x50E8 write: 20 80 FF
At 0x5133 write: 20 80 FF
At 0x7F80 write: 29 FF 00 C9 01 00 D0 03 2D 2F 05 60

Note: My first try had "2D 2D 05" instead of "2D 2F 05". That will make the flash slower than in the DOS version.
I mention it here in case someone wants that.

Details:

Code: Select all

The hit points are loaded here for the purpose of drawing the bottles:

00:D0E4: af 08 05 00 LDA $00:0508 ; kid current HP ; KidStrength
00:D0E8: 29 ff 00    AND #$00ff

00:D12F: af 0b 05 00 LDA $00:050b ; guard current HP ; OppStrength
00:D133: 29 ff 00    AND #$00ff

New code:

At 0x50E8 write:
20 80 FF  JSR $FF80

At 0x5133 write:
20 80 FF  JSR $FF80

At 0x7F80 write:
29 FF 00  AND #$00FF
C9 01 00  CMP #$0001 ; If we would draw 1 HP:
D0 03     BNE :1
2D 2F 05  AND $052F ; Do a bitwise and between that 1 and the low bit of the elapsed time (which is toggled in every frame).
                    ; The result is either 0 or 1.
          :1
60        RTS

The alternate version with slower flash contains this instead of "2D 2F 05":
2D 2D 05  AND $052D ; elapsed time 1 L ; FrameCount

Awesome. It does indeed flashes faster. I might test the other option, but probably will stick with the first one.
Last edited by Shauing on May 10th, 2020, 6:13 pm, edited 1 time in total.
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: May 10th, 2020, 1:17 pm
Spoiler: show
Shauing wrote: May 8th, 2020, 9:35 pm 4. I also see that on DOS each guard has a different hitpoint palette as well (I think it matches the turban colors), and on SNES all of them they share a green color. Can this be implemented somehow?
It actually matches the color of the guard's pants.

At 0x74CD write: 20 50 FF
At 0x7F50 write: 20 8C F5 AD 67 02 0A 0A 0A 0A 18 69 8A 8D 21 21 AE 3B 21 AC 3B 21 A9 76 8D 21 21 8E 22 21 8C 22 21 8E 22 21 8C 22 21 60

Details:

Code: Select all

At 0x74CD write:
20 50 FF  JSR $FF50

At 0x7F50 write:
20 8C F5  JSR $F58C ; write palette (A rows)
AD 67 02  LDA $0267 ; opponent palette
0A        ASL
0A        ASL
0A        ASL
0A        ASL
18        CLC
69 8A     ADC #$8A ; $80 for sprite palettes + a guard's color #10 is the color of their pants
8D 21 21  STA $2121 ; CGADD
AE 3B 21  LDX $213B ; RDCGRAM
AC 3B 21  LDY $213B ; RDCGRAM
A9 76     LDA #$76 ; dark green in guard's HP bottle
8D 21 21  STA $2121 ; CGADD
8E 22 21  STX $2122 ; CGDATA
8C 22 21  STY $2122 ; CGDATA
          ; overwrite the next color as well
8E 22 21  STX $2122 ; CGDATA
8C 22 21  STY $2122 ; CGDATA
60        RTS

Oh, you're right.
Great. Though I see that it's only using one color of the pants palette only. Can it use the three colors of the pants? I wanted to keep this a surprise for the trailer, but I also changed the hitpoints look to match the DOS though I'm using three colors instead of two.
EDIT: I noticed the Shadow uses the Prince's red hitpoint palette and not the pants 'palette'. Can he have a red palette? (The hitpoint design cannot be the same though, as the Prince triangle points to the right, and the guards one point to the left).
EDIT 2: I tried to do the three color palette by first trying to just change the A9 76 to A9 8B, but it changes the Prince's belt as well to a flat red (I think it matches the guard's hitpoint).
Last edited by Shauing on May 10th, 2020, 6:48 pm, edited 3 times in total.
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: May 10th, 2020, 4:30 pm
Spoiler: show
Shauing wrote: May 8th, 2020, 9:35 pm 8. Hopefully, best time does not display time for Levels 13 & 14, and just add a total time on the Level 20 slot, as I think it will be a pain to add a ''name input'' for it.
At 0x1583B write: AD 79 05 C9 0D F0 06 C9 0C B0 48 80 05 A9 13 4C 70 FF
At 0x17F70 write: C2 30 48 AD 2D 05 38 E9 9C 63 8D 4B 05 68 4C 5D D8

By the way, why do you want to disable time for level 13 in addition to 14?
I understand level 14: There the timer already stopped, so time spent there doesn't count.
But why level 13?

Details:

Code: Select all

At 0x1583B write:
AD 79 05  LDA $0579 ; current level
C9 0D     CMP #$0D ; on level 14 store total time
F0 06     BEQ :1
C9 0C     CMP #$0C ; from level 13 don't store time
B0 48     BCS $D88E ; don't store
80 05     BRA :2
          :1
          ; store total time
A9 13     LDA #$13 ; level 20 slot
4C 70 FF  JMP $FF70
          :2

At 0x17F70 write:
C2 30     REP #$30
48        PHA
AD 2D 05  LDA $052D ; elapsed time 1 L ; FrameCount
38        SEC
E9 9C 63  SBC #$639C ; The elapsed time counter starts from this value, subtract it from the current value.
8D 4B 05  STA $054B ; elapsed time on this level L
68        PLA
4C 5D D8  JMP $D85D


I wanted to see if the time of Level 13 and maybe even Level 14 can be added to Level 12, to maintain the illusion that Level 12 is one long level like on DOS. That's why I want to omit the ''Level 13'' time display, and add it to Level 12, and maybe also add the time for Level 14 (though the timer has stopped already by then, though the SNES game also times Level 20 even though the timer has stopped by then as well).
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 10th, 2020, 5:38 pm A small curiosity/side effect is that the staff roll now scrolls smoothly, thus it plays faster and it ends much quicker than intended. Can the speed of the scroll be slowed down?
Huh, I haven't even noticed that!
But you're right.
I figured out that the scrolling is sped up by the hack which removes the elephant.

Originally, the text scrolls up one every 6th or 7th frame.
If the elephant is removed, it scrolls once every 3th or 4th frame.

At 0x1B667 write back the original bytes: 20 A8 B6
At 0x1B6C8 write: 69 00 01

This will move the elephant sprite offscreen, instead of completely removing it.
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 10th, 2020, 5:53 pm Great. Though I see that it's only using one color of the pants palette only. Can it use the three colors of the pants? I wanted to keep this a surprise for the trailer, but I also changed the hitpoints look to match the DOS though I'm using three colors instead of two.
I'd like to see which palette indices do you use in the new hitpoint graphics.
Maybe you could send me a version of the mod which has them?

Shauing wrote: May 10th, 2020, 5:53 pm EDIT 2: I tried to do the three color palette by first trying to just change the A9 76 to A9 8B, but it changes the Prince's belt as well to a flat red (I think it matches the guard's hitpoint).
The palette slots of the HP bottles are between 0x70 and 0x7F.
0x8B is outside that, apparently it's one of the palette slots for the prince sprite.


I think this is my last post for today; I will see your replies next weekend.
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: May 10th, 2020, 7:10 pm
Spoiler: show
Shauing wrote: May 10th, 2020, 5:53 pm Great. Though I see that it's only using one color of the pants palette only. Can it use the three colors of the pants? I wanted to keep this a surprise for the trailer, but I also changed the hitpoints look to match the DOS though I'm using three colors instead of two.
I'd like to see which palette indices do you use in the new hitpoint graphics.
Maybe you could send me a version of the mod which has them?
Only the brown-yellow colors have been changed. If I recall correctly:
The lightest one has been changed to a darkest red.
The darkest one has been changed to a darkest green.
David wrote: May 10th, 2020, 7:10 pm
Spoiler: show
Shauing wrote: May 10th, 2020, 5:53 pm EDIT 2: I tried to do the three color palette by first trying to just change the A9 76 to A9 8B, but it changes the Prince's belt as well to a flat red (I think it matches the guard's hitpoint).
The palette slots of the HP bottles are between 0x70 and 0x7F.
0x8B is outside that, apparently it's one of the palette slots for the prince sprite.


I think this is my last post for today; I will see your replies next weekend.
I see, I might experiment with the 70-7F thing and see what happens.

EDIT: After quite some experimentation a bit of blessing, I managed to insert the three color palette for the guard's hitpoints. I just did trail-and-error tests by copying parts of the same code and changing values at 69 XX and A9 XX to see if specific colors would change to another color in the guard's pants palette. In the end, it was by copying pretty much the entire code twice (except the first three bytes and the last six before the 60 byte) that lead me to insert it succesfully; because the code became larger I had to change the first pointer to 20 20 FF. Probably it could be made shorter but I'm not sure how.

A sort of sidepoint: I found while watching the demo that when the demo guard is in his last hitpoint, it does not flash, instead it disappears. Why this happens?
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 10th, 2020, 7:24 pm A sort of sidepoint: I found while watching the demo that when the demo guard is in his last hitpoint, it does not flash, instead it disappears. Why this happens?
It's because the blinking is controlled by the elapsed time, but time doesn't pass on the demo level, because the demo level is "after" Jaffar's level (by its level number).
See also here about the connection between the blinking and the timer: viewtopic.php?p=27523#p27523

My solution is to enable time passing on the demo level.
At 0xEFFD write: 20 C0 FD
At 0xFDC0 write: AD 79 05 C9 15 D0 02 A9 00 60
At 0xE9C3 write: EA EA

Details:

Code: Select all

At 0xEFFD write:
20 C0 FD  JSR $FDC0

This overwrites the first line here:
01:EFFD: ad 79 05    LDA $0579 ; current level
01:F000: c9 13       CMP #$13 ; (in your mod this has been changed to CMP #$0C in an earlier hack)
01:F002: 90 05       BCC $f009 ; :ticking
01:F004: ad b5 04    LDA $04b5 ; (this has been changed as well)
01:F007: d0 03       BNE $f00c ; :stopped
:ticking:
01:F009: 20 be e9    JSR $e9be ; level 20 (timer check) ; KEEPTIME
:stopped:

At 0xFDC0 write:
AD 79 05  LDA $0579 ; current level
C9 15     CMP #$15 ; demo level
D0 02     BNE :1
A9 00     LDA #$00 ; pretend it's a level before Jaffar's level
          :1
60        RTS

The third write disables this additional level check:

level 20 (timer check): KEEPTIME:
01:E9BE: AD 79 05    LDA $0579 ; current level
01:E9C1: C9 13       CMP #$13
01:E9C3: B0 49       BCS $EA0E ; return

(Really, why does the game check the current level *twice* before updating the timer?)
User avatar
Shauing
Calif
Calif
Posts: 432
Joined: April 5th, 2018, 10:38 pm
Contact:

Re: Hacking the SNES ROM

Post by Shauing »

David wrote: May 16th, 2020, 12:01 pm
Spoiler: show
Shauing wrote: May 10th, 2020, 7:24 pm A sort of sidepoint: I found while watching the demo that when the demo guard is in his last hitpoint, it does not flash, instead it disappears. Why this happens?
It's because the blinking is controlled by the elapsed time, but time doesn't pass on the demo level, because the demo level is "after" Jaffar's level (by its level number).
See also here about the connection between the blinking and the timer: viewtopic.php?p=27523#p27523

My solution is to enable time passing on the demo level.
At 0xEFFD write: 20 C0 FD
At 0xFDC0 write: AD 79 05 C9 15 D0 02 A9 00 60
At 0xE9C3 write: EA EA

Details:

Code: Select all

At 0xEFFD write:
20 C0 FD  JSR $FDC0

This overwrites the first line here:
01:EFFD: ad 79 05    LDA $0579 ; current level
01:F000: c9 13       CMP #$13 ; (in your mod this has been changed to CMP #$0C in an earlier hack)
01:F002: 90 05       BCC $f009 ; :ticking
01:F004: ad b5 04    LDA $04b5 ; (this has been changed as well)
01:F007: d0 03       BNE $f00c ; :stopped
:ticking:
01:F009: 20 be e9    JSR $e9be ; level 20 (timer check) ; KEEPTIME
:stopped:

At 0xFDC0 write:
AD 79 05  LDA $0579 ; current level
C9 15     CMP #$15 ; demo level
D0 02     BNE :1
A9 00     LDA #$00 ; pretend it's a level before Jaffar's level
          :1
60        RTS

The third write disables this additional level check:

level 20 (timer check): KEEPTIME:
01:E9BE: AD 79 05    LDA $0579 ; current level
01:E9C1: C9 13       CMP #$13
01:E9C3: B0 49       BCS $EA0E ; return

(Really, why does the game check the current level *twice* before updating the timer?)

Hmm ok, but the ''60 minutes left'' text prompt is back. This cannot be hidden?

Listing the few pending things left:
1. Be able to skip the Konami and/or Title Screen by pressing any button like in the Japanese version and on DOS, instead of being forced to wait until after the title screen appears.
2. Shadow's hitbox palette should be the same as Prince but not in design, as the Prince has the triangle pointing to the right, and all of the enemies triangle point to the left.
Hitpoint Palette:
Spoiler: show
Hitpoint Palette.png
Hitpoint Palette.png (376 Bytes) Viewed 55542 times
3. The float potion lacks a green screen flash like on DOS; without it, visually there's no indication for the potion. Also, the maximum time value for the duration of the effect (FF) is still a bit short than what the music lasts (potion effect lasts 17 seconds, music lasts around 19).
4. Can the Best Time menu look like this? :
Spoiler: show
Before:
In-Game Best Time.png
In-Game Best Time.png (9.83 KiB) Viewed 55543 times
After:
Mock-Up Best Time.png
Mock-Up Best Time.png (6.93 KiB) Viewed 55543 times
Spoiler: show
5. There's a major glitch I shall explain on a PM, and see if there's any possible solution.
NEW UPDATE! Prince Of Persia: 30th Anniversary Port v1.1.5. Download it today!: viewtopic.php?p=29053#p29053
NEW UPDATE! Prince Of Persia: The Queen Of Light v2.6. Download it today! viewtopic.php?p=33174#p33174
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 16th, 2020, 4:53 pm 1. Be able to skip the Konami and/or Title Screen by pressing any button like in the Japanese version and on DOS, instead of being forced to wait until after the title screen appears.
At 0x1807D write: A9 00

Details:
The byte at RAM offset $0456 determines whether interruption is enabled.
If it's #$FF then the player can't interrupt the current scene, if it's #$00 then thay can interrupt it.

The hack changes the code where it's initially disabled:

Code: Select all

clear screen for intro:
03:8075: 22 0b b6 00 JSR $00:b60b ; screen off (RTL)
03:8079: 22 2d a9 00 JSR $00:a92d ; clear joypad data
03:807D: a9 ff       LDA #$ff
03:807F: 8d 56 04    STA $0456 ; disable interruption
03:8082: 60          RTS
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 16th, 2020, 4:53 pm 2. Shadow's hitbox palette should be the same as Prince but not in design, as the Prince has the triangle pointing to the right, and all of the enemies triangle point to the left.
This hack will use the Prince's HP flipped for the shadow, because I found this easier than fiddling with the palette.

At 0x5141 write: 20 30 FF
At 0x7F30 write: A9 FD 3E E2 20 48 AD 84 04 C9 02 68 C2 20 B0 03 A9 FC 7E 60

Details:

Code: Select all

We overwrite this code:
00:D141: A9 FD 3E    LDA #$3EFD ; opponent's HP

With the following:

At 0x5141 write:
20 30 FF  JSR $FF30

At 0x7F30 write:
A9 FD 3E  LDA #$3EFD ; opponent's HP
E2 20     SEP #$20 ; 8-bit acc
48        PHA
AD 84 04  LDA $0484 ; Shad.chtype ; ShadID
C9 02     CMP #$02 ; check if chtype<2 (kid=0, shadow=1)
68        PLA
C2 20     REP #$20 ; 16-bit acc
B0 03     BCS :1 ; skip if not <2
A9 FC 7E  LDA #$7EFC ; Prince's HP flipped
          :1
60        RTS
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 16th, 2020, 4:53 pm 3. The float potion lacks a green screen flash like on DOS; without it, visually there's no indication for the potion.
At 0xD06A write: 20 A0 FD
At 0xFDA0 write: 8D 40 05 A9 6F 8D C4 04 A9 05 8D C3 04 60

Details:

Code: Select all

At 0xD06A write:
20 A0 FD  JSR $FDA0

At 0xFDA0 write:
8D 40 05  STA $0540 ; slow fall blue
A9 6F     LDA #$4F ; color: green
8D C4 04  STA $04c4 ; flash color
A9 05     LDA #$05
8D C3 04  STA $04c3 ; flash count
60        RTS
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 16th, 2020, 4:53 pm Hmm ok, but the ''60 minutes left'' text prompt is back. This cannot be hidden?
At 0xF00C write: 20 90 FD
At 0xFD90 write: AD 79 05 C9 13 B0 03 20 0C E3 60

Code: Select all

At 0xF00C write:
20 90 FD  JSR $FD90

At 0xFD90 write:
AD 79 05  LDA $0579 ; current level
C9 13     CMP #$13
B0 03     BCS :1
20 0C E3  JSR $E30C ; showtime
          :1
60        RTS
David
The Prince of Persia
The Prince of Persia
Posts: 2850
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Hacking the SNES ROM

Post by David »

Shauing wrote: May 16th, 2020, 4:53 pm Also, the maximum time value for the duration of the effect (FF) is still a bit short than what the music lasts (potion effect lasts 17 seconds, music lasts around 19).
My solution is to decrement the slow fall counter only in every other frame.
This makes the length of the slow fall the double of what's specified in the Hacks window.

At 0xF8AF write: 4C 70 FD
At 0xFD70 write: AD 01 05 1A 29 01 8D 01 05 D0 06 AD 00 05 4C B2 F8 AD 00 05 F0 F8 4C BA F8

Code: Select all

At 0xF8AF write:
4C 70 FD  JMP $FD70

At 0xFD70 write:
AD 01 05  LDA $0501 ; I've repurposed this unused byte to toggle between 00 and 01 in each frame.
1A        INC
29 01     AND #$01
8D 01 05  STA $0501 ; as above
D0 06     BNE :1
AD 00 05  LDA $0500 ; slow fall remaining time
          :2
4C B2 F8  JMP $F8B2 ; continue with decrement
          :1
AD 00 05  LDA $0500 ; slow fall remaining time
F0 F8     BEQ :2 ; if slow fall is not active, jump to the BEQ at F8B2 which will skip everything related to slow fall
4C BA F8  JMP $F8BA ; skip decrement
Post Reply