Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-02-23 20:39:58

Montblanc
Member
Registered: 2016-02-23
Post 1/47

I need help changing pointers in RB

Hi

I was going to make an attempt to recreate Pokemon Green using a red ROM, but after finding the already existing patch in English now I want to do it in a Spanish ROM. After a bit of reading about the graphics, banks etc now I know the 1 gen uses a compression hard to understand, that there is a tool to compress 2bpp files and you can find the sprite data using the pointers after 0x383DE.

I downloaded the English patch to see how it was made, and attempted to port a few sprites (I tried the c compression tool to make my own, but always gives me the error "wrong file size", probably because I don't know how to make a proper 2bpp file) Bulbasaur and Ivysaur where easy, but Venusaur has more bytes than the original. In the patched ROM I found it in another bank, 0F. After more reading I found the Sawakita solution. The problem is that adresses are different in my ROM, for example to find the bank id using the tutorial I have you need to put a break point to $251A but in my ROM doesn't work, it does however at $2519. And when looking at the solution for the bank problem written here:

http://hax.iimarck.us/topic/2253/

The routine at 0x1633 has some different bytes. For example it begins with FA 96 instead of FA 91. And looking at the patched ROM for clues its starts as FA D3.

Can anyone help me to learn how to do usable 2bpp files for the tool or how to fix the problem with the banks? As you may see I'm a noob at this stuff, I don't have almost any experience in ASM but acquired some notion looking and editing a NES rom before.

Also, I want to ask the authors of the English patch if is OK to use the graphics of their patch (to avoid reinventing the wheel :P) after learning how to do it myself.


Edit: Finally compressed the Venusaur sprite after reading a tutorial written by Danny-E 33. Now the last thing I need to port the sprites is learn how to add that mod to use other banks.

This how it looks now:

FA 96 CF 47 FE 15 3E 01 28 25 78 FE B6 3E 0B 28 1E 78 FE 1F 3E 09 38 17 78 FE 4A 3E 0A 38 10 78 FE 74 3E 0B 38 09 78 FE 99 3E 0C 38 02 3E 0D C3 FC 24

Last edited by Montblanc (2016-02-24 00:17:54)

Offline

#2 2016-02-24 07:02:38

Miksy91
Member
Registered: 2010-10-16
Post 2,221/2,308

Re: I need help changing pointers in RB

That FA 96 (along with CF) there stands for asm instruction "ld a, (CF96)" making a register have the value stored in ram address $CF96 if I remember correctly. Knowing the way asm instructions are written in hex code isn't that useful though since you can edit that kind of code with an (asm) editor suited for the problem.

Anyway, I don't know for sure, but I believe that this English Green hack is based on pokered disassembly. All the code and data of Pokemon Red (U) rom has been written in form of "text" here (https://github.com/pret/pokered) and you can modify a "copy" of the disassembly yourself by re-writing some code or data with a text editor. Once you have done so, you can acquire a rom file that matches for the contents of all those files of disassembly by building it with cygwin.

The reason I'm saying this is that you might want to make use of the disassembly of English Green if you get the permission to. Spanish Red rom doesn't have a disassembly like this, so if you want to stick with editing it, you'll have to do everything with a hex and asm editing tools (which is totally possible as well, but not convenient).

Offline

#3 2016-02-24 18:12:47

Montblanc
Member
Registered: 2016-02-23
Post 2/47

Re: I need help changing pointers in RB

Thank you, I'm looking it! I asked some questions to the last person that logged in romhacking and worked on it (where I have found the patch) but he didn't reply so far.

The bytes I quoted before are supposed to be the ones that load the pokemon sprites. In the english ROM two bytes are different (96 is 91 and FC is FD). I tried a supposed fix that uses the last empty byte in the pokemon data to change the bank but the game freezes, both using the quoted code for english wich uses the 91 and FD or keeping these two unmodified.

Offline

#4 2016-02-26 02:40:13

Montblanc
Member
Registered: 2016-02-23
Post 3/47

Re: I need help changing pointers in RB

It works now!


For the english ROM the fix written by Danny-E 33 was:

FA 91 CF
47
FE B6
3E 0B
28 11
78
FE B7
3E 0D
28 0A
78
FE B8
3E 0D
28 03
FA D3 D0
C3 FD 24

Which means:

ld a, [$CF91] ; get Pokemon id
ld b, a       ; store Pokemon id
cp $B6        ; check if id = Kabutops fossil
ld a, $0B     ; store bank of fossil sprite
jr z, $11     ; jump forward 0x11 bytes if z-flag is set (if id = Kabutops fossil)
ld a, b       ; restore id into a
cp $B7        ; check if id = Aerodactyl fossil
ld a, $0D     ; store bank of fossil sprite
jr z, $0A     ; jump forward 0xA bytes if z-flag is set (if id = Aerodactyl fossil)
ld a, b       ; restore id into a
cp $B8        ; check if id = Ghost
ld a, $0D     ; store bank of ghost sprite
jr z, $03     ; jump forward 0x3 bytes if z-flag is set (if id = Ghost)
ld a, [$D0D3] ; load bank from last byte of current Pokemon's base stats
jp [$24FD]    ; end

To use it in my ROM I kept the original addresses for "loading the pokemon id" and "end". Then added the difference between the "get Pokemon id" adress of the original ROM ($CF96) and the one from the english ROM ($CF91).

In my case:

ld a, [$CF96] ; get Pokemon id
ld b, a       ; store Pokemon id
cp $B6        ; check if id = Kabutops fossil
ld a, $0B     ; store bank of fossil sprite
jr z, $11     ; jump forward 0x11 bytes if z-flag is set (if id = Kabutops fossil)
ld a, b       ; restore id into a
cp $B7        ; check if id = Aerodactyl fossil
ld a, $0D     ; store bank of fossil sprite
jr z, $0A     ; jump forward 0xA bytes if z-flag is set (if id = Aerodactyl fossil)
ld a, b       ; restore id into a
cp $B8        ; check if id = Ghost
ld a, $0D     ; store bank of ghost sprite
jr z, $03     ; jump forward 0x3 bytes if z-flag is set (if id = Ghost)
ld a, [$D0D8] ; load bank from last byte of current Pokemon's base stats
jp [$24FC]    ; end


The problem I have now is center the sprites so they are in the same spot of the screen (as I am copying them from a sprite sheet), and finding new empty bytes to store them. In the end I'm still looking at the english green hack as a guide to find where to place things...

So for now all is solved!

Offline

Board footer

Powered by FluxBB