Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-01-02 22:20:40

Torchickens
Member
Registered: 2011-01-02
Post 1/47

Location of Pikachu's voice?

I've been trying to find RAM address(es) which directly manage Pikachu's voice in Pokémon Yellow but I haven't had much luck. Does anybody here know of any? What I'm trying to do is experiment with either the in battle, walking or title screen Pikachu's voice when it is spoken to, or perhaps change what picture is displayed without changing its happiness addresses (D46F and D470).  Thanks.

Edit: My mistake for posting this in the Documents and Tutorials section. Can somebody please move this into a more suitable board? Sorry about that.

Last edited by Torchickens (2011-01-02 22:54:44)

Offline

#2 2011-01-04 04:29:57

118/703

Re: Location of Pikachu's voice?

You can read from memory address D447 to get Pikachu’s current emotion. The value is read‐only; changing it will not change Pikachu’s emotions. (It’s a debugging leftover.)

Emotions:

  • 00: Nothing

  • 01: Blinks

  • 02: “☺”, waves

  • 03: Frowns and waggles ear

  • 04: Jumps, smiles

  • 05: Waggles ear

  • 06: “☠”, turns to side

  • 07: Jumps, twitches

  • 08: Smiles

  • 09: “☠”, turns back

  • 0A: “♥”, heart above head

  • 0B: “Zzz…”, sleeping

  • 0C: Bored (initial happiness level if you beat Blue)

  • 0D: Turns to side

  • 0E: “⚡”, shocks you

  • 0F: Waves

  • 10: Heart above head

  • 11: Eyes closed

  • 12: Winks

  • 13: “♥”, two hearts above head

  • 14: “♥”, six hearts above head

  • 15: “fish”, bucket on head

  • 16: Shivers

  • 17: Question marks above head

  • 18: “!”, shakes head

  • 19: “⚡”, shocks you

  • 1A: “Zzz…”, wakes up

  • 1B: Surprised

  • 1C: Moans

  • 1D: Heart above head

  • 1E: “♥”, six hearts above head

  • 1F: Question marks above head

  • 20: Question marks above head

The pointer table for these emotions begins at 0xFD019, one pointer for each emotion. Following the pointer leads to a series of commands that defines that emotion.

Commands
  • 00: Do nothing

  • 01 YY XX: Print the text at $XXYY.

  • 02 XX: If XX is $FF, do nothing. Otherwise, play cry $XX.

    00–29 are valid cries. Here’s a recording of all the cries in order.

  • 03 XX: Display speech bubble $XX.

    handle_list_tag('
    [*]00: !

  • 01: ?

  • 02: ☺

  • 03: ☠

  • 04: ♥

  • 05: ⚡

  • 06: Zzz…

  • 07: Fish

  • ', '*')

    [/*]

  • 04 YY XX: Run the PointCommand at $XXYY.

    handle_list_tag('
    [*]$5218: Turn back.

  • $521E: Turn sideways.

  • $5224: Jump twice quickly.

  • $522C: Spin around twice. (buggy)

  • $5230: Jump twice slowly.

  • $5238: Walk in a circle.

  • ', '*')[/*]
  • 05 XX: Display sprite/cry pair $XX.

  • 06 XX: Run a predefined command. (Pointers at 0xFCFDA.)
    handle_list_tag('
    [*]00: Load Pikachu’s shadow and extra walking sprites into VRAM.

  • 01: Load font into VRAM.

  • 02:

    call $0B06
    call $231C
    call $3DDB
    ret
  • 03:

    ld a,[$FF8B]
    push af
    ld a,[$FF8C]
    push af
    xor a
    ld [$FF8B],a
    ld a,6
    ld [$FF8C],a
    $385F
    push hl
    ld a,[$D09A]
    and a
    jr z,$3872
    push de
    push bc
    ld hl,$5753
    ld b,$1C
    call $3E84
    pop bc
    pop de
    ld hl,$C4F2
    call $3BF1
    pop hl
    call $381E
    ld a,$2D
    call $3EB4
    ld a,[$FFB5]
    and a,3
    jr z,$385F
    pop af
    ld [$FF8C],a
    pop af
    ld [$FF8B],a
    ret
  • 04:

    ld hl,$C4F2
    call $3BF1
    pop hl
    call $381E
    ld a,$2D
    call $3EB4
    ld a,[$FFB5]
    and a,3
    jr z,$385F
    ; 04: 58D4
    ld a,[$D35D]
    cp $3A
    ret nz
    call $1542
    call $4FF2
    ret
  • 05:

    ld a,[$D35D]
    cp $5A
    ret nz
    call $1542
    call $4FF2
    ret
  • 06:

    ld a,[$D35D]
    cp $58
    ret nz
    call $1542
    ret
  • ', '*')[/*]
  • 07 XX: Delay for $XX frames.

  • 08: Do nothing. This is probably related to the debugging leftover mentioned earlier, as every emotion starts with this command.

  • 09: Toggle bit 2 of $C109 and store it in $C1F9. call $231C.

  • 0A: Do nothing.

  • FF: End of emotion.

Example: emotion $0C, Pikachu’s initial emotion if you don’t lose against Blue.
08: Do nothing
02 FF: Do nothing
05 0C: Display sprite/cry set $C (bored)
FF: End of emotion

Example: emotion $15, Pikachu’s emotion immediately after using a rod.
08: Do nothing
03 07: Display fish above head
02 FF: Do nothing
05 15: Display sprite/cry set $15 (bucket on head)
FF: End of emotion

PointCommand
  • $5218: Turn back. 00 39 01 3E 1E 3F

  • $521E: Turn sideways. 00 39 00 3E 1E 3F

  • $5224: Jump twice quickly. 00 3C 07 2F 3C 07 2F 3F

  • $522C: Spin around twice. (Buggy; prefix with 00 to make it work.) 3B 1F 03 3F

  • $5230: Jump twice slowly. 00 3C 0F 1F 3C 0F 1F 3F

  • $5238: Walk in a circle. 00 05 07 39 00 05 07 06 07 39 00 06 07 08 07 39 00 08 07 07 07 39 00 07 07 3F

These are really complicated and I haven’t figured them out yet. Near as I can tell, it works like this:

while command ≠ $3F {
    get the byte at 0xFD3B0 + 4 × command
    if (byte = $80)
        byte ← next argument byte
    [$D44D] ← byte
    get the byte at 0xFD3B0 + 4 × command + 1
    if (byte = $80)
        byte ← next argument byte
    [$D44F] ← byte
    [$D451] ← $00
    call $5329
}
  • 00: Setup?

  • 39 XX: Turn clockwise 90°, $XX + 1 times.

  • 3F: End of PointCommand

Sprite/Cry pairs

Valid ones are $00–1D, but in reality they only run from $01–1C. Pointer table at 0xFDA5E. (Is it a pointer table? It definitely used to be, but the functionality may have been removed and only the first pointer is valid. Maybe.)

They begin at 0xFE28A. 26 bytes wide.

  • bytes 1–21: ???

  • byte 22: Cry

  • bytes 23–24: ???

  • bytes 25–26: pointer to something

Sorry for the general incompleteness of this guide. I’ve been working on this when I should have been doing other things.

#3 2011-01-04 17:53:33

Torchickens
Member
Registered: 2011-01-02
Post 2/47

Re: Location of Pikachu's voice?

I found it really useful and a lot more than I needed. Thanks!

Offline

#4 2013-07-07 19:40:00

YORAMRW
Member
From: The Netherlands
Registered: 2013-03-29
Post 411/1,199
Website

Re: Location of Pikachu's voice?

If someone could find the actual address of the Pikachu voice PCM sample, I will replace it with a piece of Gangnam Style PCM.


Hacks Gameboy 8-bit music in Pokémon Gen I & II, composes 8-bit music in FamiTracker

Offline

#5 2013-07-18 14:14:04

FroggestSpirit
Member
Registered: 2012-03-12
Post 208/300
Website

Re: Location of Pikachu's voice?

It's most likely going to be 8-bit uncompressed wav... the same format as the wav instruments for channel 3. Correct me if I'm wrong, as this is just an educated guess.


This isn't easy to say, but…
Music and ASM hacker

Offline

#6 2013-07-18 19:40:40

YORAMRW
Member
From: The Netherlands
Registered: 2013-03-29
Post 453/1,199
Website

Re: Location of Pikachu's voice?

FroggestSpirit wrote:

It's most likely going to be 8-bit uncompressed wav... the same format as the wav instruments for channel 3. Correct me if I'm wrong, as this is just an educated guess.

If I am right, the sound system of Channel 3 works the same as the Square Channels (1 & 2), and the Noise Channel (4). Only, Channel 3 has different choices than 1 & 2, and 4 has a really different way of playing the sound, like white noise. They are all plain duty pulse waves, played in different notes, in many volumes.
The PCM system works in a really different way. This is just RAW audio, which can be simply imported and played in programs like Audacity. It COULD be true that PCM uses the same channel as the Triangle Channel (3), which causes that patterns in Triangle can not be played at the same time as PCM samples. So, GAME BOY ROMs with PCM samples must have an engine for playback them in the game, and thus on the GAME BOY.

The actual problem of replacing the PIKACHU samples with pieces of GANGNAM STYLE is that audio editors shift or suck a piece of bytes, which cause that the entire ROM is useless. The only way I see to edit the PCM samples succesfully is importing the pieces of GANGNAM STYLE to an audio editor, make them faster (and probably louder), export them as PCM, open the PCM files up in a Hex Editor, copy the data, open up the Pokémon Yellow ROM in a hex editor, access the offsets of the PIKACHU voices, replace them with the GANGNAM STYLE pieces.

Correct me if I am wrong. This is just the most logic way it could be working, that I have found.


Hacks Gameboy 8-bit music in Pokémon Gen I & II, composes 8-bit music in FamiTracker

Offline

#7 2013-11-09 04:33:37

bg321
New member
Registered: 2013-11-09
Post 1/1

Re: Location of Pikachu's voice?

TheMoneyOfTheWorld wrote:

If someone could find the actual address of the Pikachu voice PCM sample, I will replace it with a piece of Gangnam Style PCM.

I think I found the Pikachu PCM data starting at address $84000 (bank $21) in the Pokemon Yellow US ROM. The sample rate is approximately 3000Hz, and it's in unsigned 8-bit PCM. And yes, it's uncompressed. The data format is : [size of PCM data] [PCM data].  The size of data is in hexadecimal and in little endian.

Last edited by bg321 (2013-11-09 04:34:18)

Offline

#8 2015-01-08 07:50:42

pigdevil2010
New member
Registered: 2014-09-29
Post 8/8

Re: Location of Pikachu's voice?

Pikachu's PCM data locates in bank $21 - $23. The data format is like what bg321 said but the PCM data is in 4-bit uncompressed PCM playing at about 6000 samples/second. I assume that the game just copy each block into channel 3 sample data in I/O section directly and play it like audio buffer.

I decided to copy the entire PCM data from $84000 - $98000 and play it in the format I said above. Here's the result.

Offline

Board footer

Powered by FluxBB