’Cause all games were better on the GBC

You are not logged in.

#1 2013-12-19 23:09:08

New member
Registered: 2013-12-19
Post 1/3

Pokemon disassembly and pointers?

Hi all, thanks to some people in the irc channel, I can now compile a working rom of pokemon red/blue. But now I have some questions about pointers.

I tried to do a hello world hack which add a new Guy in Pallet town that says "Hello world!" when we talk to him. Very simple.

In hex hacking I did it by simpling repointing text pointers and map data objects to an empty space in rom, and made the modifications. Everything works well.

But in assembly I don't know how to repoint things to an empty space in rom. I did everything without repointing as follows:

In text pointers I added a new text:

PalletTownTextPointers: ; 18f88 (6:4f88)
        dw PalletTownText1
        dw PalletTownText2
        dw PalletTownText3
        dw PalletTownText8 ; Added this to the table
        dw PalletTownText4
        dw PalletTownText5
        dw PalletTownText6
        dw PalletTownText7

In object data I modified this way:

PalletTownObject: ; 0x182c3 (size=58)
        db $4 ; signs
        db $d, $d, $5 ; PalletTownText4 - was $4 text, now it is $5
        db $9, $7, $6 ; PalletTownText5 - was $5 text, now it is $6
        db $5, $3, $7 ; PalletTownText6 - was $6 text, now it is $7
        db $5, $b, $8 ; PalletTownText7 - was $7 text, now it is $8

        db $4 ; people - Changed from 3 to 4 people
        db SPRITE_OAK, $5 + 4, $8 + 4, $ff, $ff, $1 ; person
        db SPRITE_GIRL, $8 + 4, $3 + 4, $fe, $0, $2 ; person
        db SPRITE_FISHER2, $e + 4, $b + 4, $fe, $0, $3 ; person
        db $04, $0e, $0a, $ff, $00, $4 ; Added this person


Added the text pointer:

        TX_FAR _PalletTownText8
        db "@"

And finally to the file text/mapPalletTown.asm

        db $0, "Hello world!", $57

Everything looks nice, there is a new guy in town which says Hello world when talk to him, but the connection between Route 2 and Viridian city is all messed up.

So I need to know how to change the text pointer table and object data to a new location, So i can add so many people as I want without overwrite important data.

I think my post is a little confusing, but I hope you guys can help me!

Thank you!


#2 2013-12-20 00:05:27

Danny-E 33
Registered: 2012-06-09
Post 708/1,205

Re: Pokemon disassembly and pointers?

Take a look a bit below PalletTownObject: and you'll see ViridianCityBlocks:

When you add a line in PalletTownObject: for the new person event, you shift ViridianCityBlocks: down, giving it a different address.

Unfortunately, pokered is not perfect, and many addresses are hardcoded.

In Route2_h:, in the connection data for Viridian City, you see "dw $43EE". This is a hardcoded pointer to the middle of ViridianCityBlocks:

If you shift the data down, that pointer doesn't work anymore.

For now, until all pointers are dynamic, you should always make sure you edit things without shifting other data and repoint thing to free space at the end of the bank.

For instance, I would change PalletTownObject: to PalletTownObjectOld: and leave the data there unchanged (same with PalletTownTextPointers:)

Then paste PalletTownObject: and PalletTownTextPointers: to the end of the bank and modify them there so that no data gets shifted and the pointers in the connection data remain intact.


#3 2013-12-20 00:46:42

New member
Registered: 2013-12-19
Post 2/3

Re: Pokemon disassembly and pointers?

Yep! That is it! Really thank you for the fast reply!


Board footer

Powered by FluxBB