Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-01-08 08:41:48

blackopient
Member
From: Houston, TX
Registered: 2010-11-01
Post 7/15

Calling the New Name Naming Screen from a script?

I'm curious on how to go about doing this, I've been fiddling around but I haven't found out how to do it yet. My guess is that I will have to call the ASM from within a script but I'm not sure where the ASM begins?
I basically want to skip the whole intro dialogue and make those choices (choosing date, name, etc) in-game.

Offline

#2 2011-01-08 12:06:13

Miksy91
Member
Registered: 2010-10-16
Post 259/2,317

Re: Calling the New Name Naming Screen from a script?

Koolboyman kept the intro as "original" in Prism and I don't think anyone else has done this either.
So basically, I'd suppose the ASM is somewhere in Bank 1 (which you likely already know) but yeah...can't say more than that.

Offline

#3 2011-01-08 22:48:34

123/701

Re: Calling the New Name Naming Screen from a script?

blackopient wrote:

I'm curious on how to go about doing this, I've been fiddling around but I haven't found out how to do it yet. My guess is that I will have to call the ASM from within a script but I'm not sure where the ASM begins?

The ASM begins at 01:60A4 in Gold.

#4 2011-01-09 02:28:35

blackopient
Member
From: Houston, TX
Registered: 2010-11-01
Post 8/15

Re: Calling the New Name Naming Screen from a script?

Perfect. Works like a charm.
Thank you sirs :)

Last edited by blackopient (2011-01-09 02:31:05)

Offline

#5 2011-01-15 03:29:55

blackopient
Member
From: Houston, TX
Registered: 2010-11-01
Post 9/15

Re: Calling the New Name Naming Screen from a script?

May I ask, how you came to find out the precise offset for that ASM routine IIMarkus?
I know probably from debugging, but I'm having trouble understanding how to find these kinds of things using a debugger.
I used no$gmb until I stumbled upon a thread here speaking good of BGB.

So for instance, how would I (or did you) backtrack and find, the beginning of the ASM for the naming screen?

Offline

#6 2011-01-15 05:28:25

133/701

Re: Calling the New Name Naming Screen from a script?

I didn’t actually use a debugger this time. In some cases (e.g., when you want to know what reads or writes from a particular memory address), debuggers are essential. Here it was easier without.

What happens right before the naming screen comes up?

Wnzs1.png

Oak says “Now, what did you say your name was?”. That text is at offset 0x1957B7. The pointer to that is at 0x607B. The pointer to that is at 0x6046, which is ASM:

ld hl,$607B ; 21 7B 60
call $0F5E ; CD 5E 0F
call $6085 ; CD 85 60
…

$0F5E is an ASM routine that prints the text pointed to by hl. I know that from experience, but you can easily deduce it: if you replace the call with nops (00s), he won’t say the text, so we know it prints text.

21 7B 60 00 00 00 CD 85 60

H6jxv.png

What happens if we nop out the call to $6085?

WuFBq.png

The naming screen never comes up and the player’s name is left blank. So $6085 pulls up the naming menu. Let’s look at that offset:

call $617E ; CD 7E 61
…

Let’s nop out the call to $617E and see what happens.

yj6uY.png

Looks like $617E is the routine that moves the player’s image to the right. If we comment it out the image stays in place and is covered by the menu.

What comes next?

…
ld hl,$60D9 ; 21 D9 60
call $6108 ; call $6108
ld a,[$CEE0] ; FA E0 CE
dec a ; 3D
jr z,+$10 ; 28 10
…

Now this is interesting. If we nop out the call to $6108, we get instantly pulled into the naming screen, without a menu popping up.

lELAT.png

You can see right away that the conditional construct is based on whether the player chose “New Name” or not. Somewhere in the depths of $6108, $CEE0 is modified. If you’ve been paying attention, you can see that $CEE0 is 1 if the player chose “New Name,” because that way the code jumps to 01:60A4—the location we know corresponds to the spell‐out‐your‐name screen. If we follow that, we can learn a little bit about how naming screens work:

ld b,1 ; 06 01
ld de,$D1A3 ; 11 A3 D1
ld a,4 ; 3E 04
ld hl,$5AAD ; 21 AD 5A
rst $08 ; CF
…

Changing the value loaded to b will change the sprite and text displayed on the naming screen: player, rival, mom, PC box… so the real naming procedure is “load b with the type of name, load de with the address of the name, and call 04:5AAD.” But of course this is difficult to do from a script, so it’s easier to call 01:60A4 (and besides, there’s more code after that, which you can figure out on your own).

You can use the concept of “things that happen at the same time are nearby in the code” often to find the ASM for things. Above, we used a single text pointer to derive everything else. I’ve found the code for changing the intro animation and title screen by searching for the music that plays during those scenes. And so forth.

#7 2011-04-15 22:05:58

LucidLynx
Member
Registered: 2011-04-12
Post 15/21

Re: Calling the New Name Naming Screen from a script?

Okay, the hiro's name is at $D1A3. How can i hide the name selection and have a default name ?

How i put a name in this address ?

Offline

#8 2011-05-22 07:25:01

Miksy91
Member
Registered: 2010-10-16
Post 372/2,317

Re: Calling the New Name Naming Screen from a script?

I wonder if someone knows how to change the palette of the character that's shown in the naming screen ?
I'd like to make rival's palette to blue.

What I've only found out is that the asm starts before offset $C3F8 (very likely) and part of it is stored in $B9D1.
Byte at $C3F8 determines which naming screen to pick by the way.

Offline

#9 2011-05-22 13:16:29

Sawakita
Administrator
Registered: 2010-10-16
Post 120/364

Re: Calling the New Name Naming Screen from a script?

Miksy91 wrote:

I wonder if someone knows how to change the palette of the character that's shown in the naming screen ?
I'd like to make rival's palette to blue.

What I've only found out is that the asm starts before offset $C3F8 (very likely) and part of it is stored in $B9D1.
Byte at $C3F8 determines which naming screen to pick by the way.

The problem is that both the player's naming screen and the rival's naming screen share the same palette, so changing rival's naming screen's palette would change hero's naming screen's palette too.

I can't think of a simpler way other than ASM to modify this behaviour.
[If you're interested, the palette for OW-character shown in the naming screen is copied from its original location ($BAC6-$BACD, in ROM) to $C240-$C247 in RAM, before being loaded as actual GBC-palette using hardware registers $FF6A-$FF6B. But, don't just change the actual palette or it will affect other things you don't want to.]

Offline

#10 2011-05-22 13:22:41

Miksy91
Member
Registered: 2010-10-16
Post 374/2,317

Re: Calling the New Name Naming Screen from a script?

Thanks for the explanation :)
I'll try to change it someday, maybe (it's really no big deal that the game shows wrong palette for rival).

Offline

#11 2011-11-06 20:00:37

tysonrss
Member
From: US, Ohio
Registered: 2011-08-27
Post 49/649

Re: Calling the New Name Naming Screen from a script?

Well this is rather interesting.

If I call the part of the rival name on the intro I assume it would work. However, calling a sprite up at the end after the hero...that might take some work...and be buggy.

Nonetheless I've learned from this.


Pokemon Blue DX is reborn!

Offline

Board footer

Powered by FluxBB