SNES Mod : The lost Bottle ( Chapter 1 )

User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by spartacus735 »

The level have sense , it's just that you can not understand... The level 7 use the irugular-roomlink it's like a small maze.
And no I don't put a ton of guard like you, I prefer create the challenge with a good level structure. The level 7 is important for the story, it's where you meet for the first time Jaffar ( young ).
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
Kaslghnoon
Sultan
Sultan
Posts: 153
Joined: February 27th, 2010, 8:35 pm
Location: United States

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by Kaslghnoon »

Hello again spartacus735. Since I have had some free time this Labor Day weekend, I thought I should practice some ROM hacking as a response to your PM and also for me to avoid entirely losing the skill. After opening level 10 of your mod with Pr1SnesLevEd, I noticed that in level 10, room 9, you have positioned a regular guard (purple) and modified its sprite to use the sprite of Shadow/Prince to play the role of a young Jaffar. The problem is that if the young Jaffar kills the Prince, the sprite of young Jaffar becomes distorted (undefined). Feel free to to take a look for yourself.

In order to overcome this bug, the algorithm we will use is to assign a different identity to all guards in level 10 (since there is only one guard) as soon as the Prince's health is reduced to zero. Now I acknowledge that you have previously expressed interest in learning ROM hacking (I read your PM) so allow me to take this opportunity to share with you the hexadecimal solution to the above problem:

First, we will need some free, open space. Since you have used 0.smc, that tells me that free space is extremely scarce within that ROM. We must utilize an unused free space to add our level 10 rule. For this purpose, we will utilize the space taken by the "chomper speed" hack since you have not enabled that feature in your mod. We are now looking at offset xFB61. xFB61 is where we will add the identity swap for young Jaffar if Prince is dead so that way the young Jaffar will sheath his sword if his opponent (Prince) dies. Add a bookmark to xFB61 (Ctrl+w in Translhextion) since we will be coming back to this offset very soon.

Back when I was writing 0.smc, in order to modify chomper speed I had jumped the regular chomper routine at offset xD7E6. Since you have not had the need for modified chomper speed in your mod, let's go ahead and revert xD7E6, xD7E7, and xD7E8 back to their original values:

xD7E6 to $AD
xD7E7 to $8C
xD7E8 to $05

Now that we have opened some space at xFB61, let's begin solving our problem: Let's find a new offset containing $AD7905 and jump it to xFB61. Remember, now xFB61 is where our free space is to write our new young Jaffar rule for your level 10. The safest offset we can jump (that I found through trial and error) is at xCFAD. Any time you see values $AD7905 in the x8000-xFFFF region, it may be a safe offset to jump in order to add more rules to it. So xCFAD is where we are at now, let's jump it to our free space which is xFB61:

xCFAD to $4C
xCFAE to $61
xCFAF to $FB

We are now ready to begin writing our new rule for level 10 at xFB61:

Offset   Value   Description (pseudocode)
_____   ____   ______________________
xFB61 to $AD   checks...
xFB62 to $79   current...
xFB63 to $05   level
xFB64 to $C9   if the current level is...
xFB65 to $09   level 10
xFB66 to $F0   then go to...
xFB67 to $08   8 bytes from xFB66
xFB68 to $AD   else, back to our original code
xFB69 to $79   we are now returning to our...
xFB6A to $05   original routine
xFB6B to $4C   jump to the following offset to continue
xFB6C to $B0   xCFB0
xFB6D to $CF   $4CB0CF means jump back to xCFB0
xFB6E to $D0   I don't exactly know what $D0XY does but
xFB6F to $0D   I usually set this at $D00D
xFB70 to $AD   checks...
xFB71 to $08   remaining health point...
xFB72 to $05   of Prince...
xFB73 to $C9   if Prince's remaining health point is...
xFB74 to $00   0
xFB75 to $F0   then go to...
xFB76 to $05   5 bytes from xFB75
xFB77 to $4C   else, jump back to the original routine
xFB78 to $68   which was previously written at xFB68
xFB79 to $FB   $4C68FB means jump back to xFB68
xFB7A to $D0   I don't exactly know what $D0XY does but
xFB7B to $0D   I usually set this at $D00D
xFB7C to $A9   assign the following value...
xFB7D to $00   $00 [$00 = Prince, $01 = Shadow, $02 = regular guard, $03 = boss, $04 = skel, $05 = monster]
xFB7E to $8D   to...
xFB7F to $84   RAM address 0484, 0484 refers to the identity and behavior of present guard
xFB80 to $04   $8D8404 means STA 0484
xFB81 to $4C   Done, now we jump back to our else routine
xFB82 to $68   for all other conditions, go back and read offset xFB68
xFB83 to $FB   and remember xFB68 takes us back to where we came from (xCFB0)

I hope the above was helpful to you and I have tested it: It does fix your young Jaffar's sprite bug if the Prince gets killed in that final battle. I also hope the information above motivates you to learn more about 6502, algorithms, and hexadecimal editing. I know you sent me a message about hexadecimal editing a few months ago but sorry man I am extremely busy in general and seldom do I find the time to entertain that hobby myself. We should all be open when it comes to sharing knowledge. Thankfully we do not have any plagiarizers in this community so there is no reason to keep the knowledge private.

Below is a list of PoP1 SNES RAM addresses which are very useful for ROM hacking:

0579 = Level
0544 = Level
0462 = Room
0472 = Room
0508 = Number of remaining health points (Prince)
0509 = Sets to FF when Prince loses a health point
050A = Number of lives (Prince)
051D = Number of lives (Prince)(for password memory)
024C = Level (used in hot effect)
052D = Time (second, small)
052E = Time (minutes, big)
0532 = Sword ($00 = no, $01 = yes)
054C = Time to beat level, large, 54B is small
054D = Show what the time was to beat (anything greater than 1 will not store best time)
0506 = Room number
057D = Has to do with loose floor
057E = To fix loose floor and switch problem
04B5 = To FF Meeting the princess, Jaffar defeated
0524 = Demo level modified guard skill
0540 = Slow fall
050B = Opponent health points
050D = Opponent health points
0574 = Freezes the prince if not $00
0519 = Guard skill
062B = Guard sprite
0484 = Guard identity 1
0580 = Exit door type
04A6 = Mouse
0464 = Guard identity 2
0280 = Button interruption 1 (demo level)
0281 = Button interruption 2 (demo level)
0518 = Time notification
0547 = Time notification (seconds) [to $01 turns it on]
045A = Prince's direction (turn) left or right (level start)
045B = Tile number (level start)
045C = Floor (level start)
0467 = Used in Shadow gate close
0468 = Horizontal position
046B = Column Prince is on ($00-09)
046C = Row Prince is on ($00-$02)
04C5 = Sets to 1 when sword is sheathed
04C1 = If exit opened, it sets to $01
0478 = Guard horizontal position
0479 = Guard vertical position
047A = Guard direction: $FF = Left, $00 = Right
047C = Guard row ($00, $01, $02)
0486 = Dead guard sets this to $01
0697 = Activated Triggered tile
06B7 = Activated triggered room
06D7 = Activated action

That is all the time I have for now. Please feel free to add to the above list of RAM addresses. And when you do, please remember to share the knowledge with everyone. I realize that my 6502 coding is rather poor and someone like David could most likely rewrite my instruction set using less jumps.
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by spartacus735 »

Image

WORK But I want to correct the remainings problems like :

Image


Or :

Image
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by salvadorc17 »

Ok, i have completed this level 7, but have found 2 bugs, one is that shadow keep appearing when you enter multiple times the room with the level end door, the other is that even when you die at the fall, you can complete the level. (that is kind fun)

Image
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by spartacus735 »

It's not really a bug ... The end of the level 7 is the same end of the original level 9 that explain why you lost your sword in the level 8 ( so the prince is not really dead it's a part of the story ). For the sequence with the young jaffar it's not really a bug again he ensures that you do not go to the other side so he is very aggressive to keep pressing the plate...
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by salvadorc17 »

Nvm, i have completed up to level 9, this is really testing my skill with all those traps, good work...
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by spartacus735 »

Haha good job dude , indeed the level 9 was hard !
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by David »

Kaslghnoon wrote:Please feel free to add to the above list of RAM addresses.
The disassembly has many of them.
In Prince_annot.txt, they start with "7E:" or "7F:".
Kaslghnoon wrote:We are now ready to begin writing our new rule for level 10 at xFB61:
Here is your hack as assembly code:

Code: Select all

01:FB61: ad 79 05    LDA $0579 ; current level
01:FB64: c9 09       CMP #$09 ; level 10
01:FB66: f0 08       BEQ $fb70
01:FB68: ad 79 05    LDA $0579 ; current level
01:FB6B: 4c b0 cf    JMP $cfb0 ; return
01:FB6E: D0 0D
01:FB70: ad 08 05    LDA $0508 ; kid current HP
01:FB73: c9 00       CMP #$00
01:FB75: f0 05       BEQ $fb7c
01:FB77: 4c 68 fb    JMP $fb68
01:FB7A: D0 0D
01:FB7C: a9 00       LDA #$00 ; $00 = Prince, etc.
01:FB7E: 8d 84 04    STA $0484 ; Shad.chtype
01:FB81: 4c 68 fb    JMP $fb68
Kaslghnoon wrote:I don't exactly know what $D0XY does but I usually set this at $D00D
That area is never reached (it's after an unconditional jump), so it's not even needed.
($D0 is the opcode for BNE by the way.)
Kaslghnoon wrote:The safest offset we can jump (that I found through trial and error) is at xCFAD.
xCFAD (or 01:CFAD) happens to be the place where the kid dies if the shadow died.
Razor20
Efendi
Efendi
Posts: 6
Joined: July 4th, 2014, 5:10 pm

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by Razor20 »

Can anyone please help me? I'm stuck at level 4. If I go to the right, I can let a guard open a door, but if I fall down, I die because of the sparcling things or the spikes. If I go instead to the left of the level, there are 3 closed door and I can only open one and the others stay closed. What did I overlook?
Kaslghnoon
Sultan
Sultan
Posts: 153
Joined: February 27th, 2010, 8:35 pm
Location: United States

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by Kaslghnoon »

David wrote:The disassembly has many of them.
In Prince_annot.txt, they start with "7E:" or "7F:".
Thanks David I did not know that Prince_annot.txt also contains RAM addresses. If/when your schedule allows, it would be very generous of you to show us a few samples of how to properly write code in 6502 assembly using a hex editor. I acknowledge that my method of writing assembly code is relatively poor and many bytes are being wasted on poorely written/syntaxed algorithms. I am almost positive that the hack which I wrote above can be written in a way that saves at least 8 bytes. 0.smc is also extended using these poorely written hacks. A good place to start would be to rewrite my hack above the proper way. Thanks in advance for your help!
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by spartacus735 »

Razor20 wrote:Can anyone please help me? I'm stuck at level 4. If I go to the right, I can let a guard open a door, but if I fall down, I die because of the sparcling things or the spikes. If I go instead to the left of the level, there are 3 closed door and I can only open one and the others stay closed. What did I overlook?
First you need this trick to pass the guard : http://www.popot.org/documentation.php? ... ksPage2#50
Then you need this trick to pass the spikes : http://www.popot.org/documentation.php? ... ksPage2#61
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
salvadorc17
Calif
Calif
Posts: 553
Joined: August 27th, 2011, 2:04 am

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by salvadorc17 »

First you need this trick to pass the guard : http://www.popot.org/documentation.php? ... ksPage2#50
That trick took me a little to discover, after noticed it was really a trick...
Razor20
Efendi
Efendi
Posts: 6
Joined: July 4th, 2014, 5:10 pm

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by Razor20 »

spartacus735 wrote:
Razor20 wrote:Can anyone please help me? I'm stuck at level 4. If I go to the right, I can let a guard open a door, but if I fall down, I die because of the sparcling things or the spikes. If I go instead to the left of the level, there are 3 closed door and I can only open one and the others stay closed. What did I overlook?
First you need this trick to pass the guard : http://www.popot.org/documentation.php? ... ksPage2#50
Then you need this trick to pass the spikes : http://www.popot.org/documentation.php? ... ksPage2#61

Oh thanks, trick 2 was the one I needed, I didn't think that it could work that way. Nevertheless, I'm again stuck in the middle of the level, that one door before the 2 chompers doesn't want to open. It's a really hard mod :shock:
User avatar
elveskz
Sheikh
Sheikh
Posts: 33
Joined: January 6th, 2017, 9:01 pm

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by elveskz »

In level 3, i dont find The Floor to open a door After Crusher!!
User avatar
spartacus735
Wise Scribe
Wise Scribe
Posts: 217
Joined: November 20th, 2011, 12:41 pm
Location: France

Re: SNES Mod : The lost Bottle ( Chapter 1 )

Post by spartacus735 »

You need the trick number 1 for pass this door , http://www.popot.org/documentation.php?doc=Tricks#1

Also , do you like the mod ?

Good luck and have fun !
>>>>>>>>>>>>>>>>>>>> http://www.youtube.com/user/spartacus735 <<<<<<<<<<<<<<<<<<<< the channel of prince of persia snes mod
Post Reply