Main Menu
Main Page
Forums
Recent changes
Random page
Help

Databases
GlitchDex
AttackDex
AreaDex
DexDex
ItemDex
MetascriptDex
TMHMDex
TrainerDex
TypeDex
UnownDex
More

Major Glitches
Trainer escape glitch
Old man glitch
Celebi Egg glitch
SRAM glitch
Buffer overflow techniques
Pomeg glitch data corruption (Glitzer Popping)
Tweaking
Pokémon cloning
Select glitches (Japan)
Time Capsule exploit
Arbitrary code execution
More

Other Glitch Categories
Glitches by generation
Japan-only/language specific glitches
Natural glitches
Non-core series glitches
Non-Pokémon glitches
Recurring glitches
More

References
Pokémon GameShark codes
Pokémon Game Genie codes
Disassembly projects
The Big HEX List
GB programming
Curiosities
Debugging features
Error traps
Non-glitch exploits
Pokémon glitch terminology
Unused content and prerelease information
More

Useful Tools
8F Helper
GBz80 to Items
Old man trick name generator
PATH (Prama's Advanced Tweaking Heaven)
Save file editors
Special stat/Pokémon converter
Trainer escape Trainer Pokémon finder

Affiliates
Legendary Star Blob 2 (Hakuda)
Pokémon Speedruns wiki
PRAMA Initiative
Become an affiliate!

Technical
Site Source Code

Search Wiki

 

Search Forums

 

Author Topic: 8F Script Help, Simple Text Box  (Read 2253 times)

0 Members and 1 Guest are viewing this topic.

Connor

  • GCLF Member
  • Offline Offline
  • Hey it's me
    • View Profile
8F Script Help, Simple Text Box
« on: June 26, 2018, 10:07:19 pm »
Hello all, I've been trying to figure out a script that I can implement using 8F. All I want to do is have a text box appear with whatever text I want in it. I've been using TheZZAZZGlitch's creepy pasta script as a reference, but I'm fairly new to assembly and don't understand all of the syntax he uses. Near the beginning of the script, he has
Code: [Select]
dw _DBA5_Tx_DoNotBe ; Text pointer for text ID $01 ["DO NOT BE AFRAID"]but then doesn't actually have the values
Code: [Select]
_DBA5_Tx_DoNotBe:
db 00,83,8e,7f,8d,8e,93,4f,81,84,7f,80,85,91,80,88,83,51
db 88,93,7f,96,8e,8d,93,7f,87,84,8b,8f,4f,98,8e,94,7f,80,93,7f,80,8b,8b,57
; DO NOT BE AFRAID :: IT WONT HELP YOU AT ALL
until the end of the script. Also, in the part where he actually calls the text box function
Code: [Select]
ld a,$01
ld ($ff00+8c),a
call $2920          ; Display the text ID #1 (DO NOT BE AFRAID)
I don't really understand what "ld ($ff00+8c),a" does or how it is used in this script.
I suppose my two main questions are: what does he do to define that text as having text id 01, and what does "ld ($ff00+8c),a" do in this script? Any help or information would be appreciated. Sorry for the long-winded post, and thanks in advance.

Epsilon

  • Zeta
  • Member+
  • *
  • Online Online
  • The default personal text makes no sense
    • View Profile
Re: 8F Script Help, Simple Text Box
« Reply #1 on: June 27, 2018, 06:35:15 am »
Near the beggining of his code, the following is written:
Code: [Select]
ld hl,$d36c
ld (hl),$03
inc hl
ld (hl),$db      ; Set $D36C to $03DB [Repoint current map's text table to $DB03]

This redirects the Map Text Pointer Table to $DB03. At $DB03, he has two pointers defined: _DBA5_Tx_DoNotBe and DBCF_Tx_ThereIs. The former pointer is defined before the latter, so the the former pointer can be treated as text ID 01, and the latter is to be treated as text ID 02.

As for ld ($ff00+8c),a, $FF8c is responsible for what ID us to be displayed by the text bix when calling $2920.
« Last Edit: June 27, 2018, 06:36:00 am by Epsilon »
grouchy

Connor

  • GCLF Member
  • Offline Offline
  • Hey it's me
    • View Profile
Re: 8F Script Help, Simple Text Box
« Reply #2 on: June 27, 2018, 10:49:34 am »
Hey, thanks for the reply, it explains a lot. I have some follow-up questions to the information you gave me.

Are those two text pointers only 1 byte each? Those two lines are supposedly from DB03 to DB04, but I don't see how he points to both DBA5 and DBCF in only two bytes.

Also, why does he use "ld ($ff00+8c), a" instead of just "ld ($ff8c), a"? Does it do something different? Or does it use less opcodes and he uses it for ease of implementation.

Thanks in advance, again.

Epsilon

  • Zeta
  • Member+
  • *
  • Online Online
  • The default personal text makes no sense
    • View Profile
Re: 8F Script Help, Simple Text Box
« Reply #3 on: June 27, 2018, 12:35:08 pm »
Are those two text pointers only 1 byte each? Those two lines are supposedly from DB03 to DB04, but I don't see how he points to both DBA5 and DBCF in only two bytes.

Nope. All addresses and pointers in the Gameboy's architechture are 2 bytes.

As for ld (ff00+8c),a, it swallows only 2 bytes wheras the former instruction ld (ff8c),a swallows three.
« Last Edit: June 27, 2018, 12:35:59 pm by Epsilon »
grouchy

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: 8F Script Help, Simple Text Box
« Reply #4 on: June 27, 2018, 05:39:56 pm »
To be correct, the correct instruction would be `ldh [$FF00+$8C], a`, or `ldh [$FF8C], a`.

Also, making text appear using 8F shouldn't be too complicated.
I think you'd just need to load a pointer to the text stream in `hl`, and then `call PrintText`. Maybe also `call EnableAutoTextboxDrawing` prior, although I'm not sure if it's necessary there, since auto-drawing is already enabled.
« Last Edit: June 27, 2018, 05:50:17 pm by ISSOtm »
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

Connor

  • GCLF Member
  • Offline Offline
  • Hey it's me
    • View Profile
Re: 8F Script Help, Simple Text Box
« Reply #5 on: July 27, 2018, 11:54:48 pm »
Hey guys, thanks for the help. I had moderate success with ISSOtm's method, but as soon as the message finishes printing, the textbox disappears. Is there another function I need to call so that the textbox only disappears once I press a button, or is there something else I'm missing?

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: 8F Script Help, Simple Text Box
« Reply #6 on: July 30, 2018, 08:44:19 pm »
I think there's a function that waits for a button press before closing the textbox.
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)