Main Menu
Main Page
Forums
Recent changes
Random page
Help

Databases
GlitchDex
AttackDex
ItemDex
TypeDex
UnownDex
More

Major Glitches
Trainer escape glitch
Old man trick
Celebi trick
Select glitches (Japan)
SRAM glitch
CoolTrainer♀ corruption
LOL glitch
Rival LOL glitch
Super Glitch
ZZAZZ glitch
Pomeg corruption glitch (Glitzer Popping)
Tweaking
Elite Four door glitch (Japan)
Pokémon merge glitch
Pokémon cloning
Time Capsule exploit
Arbitrary code execution
Coin Case glitch
More

Other Glitch Categories
Glitches by generation
Glitches between two generations
Japan-only/language specific glitches
Music glitches
Natural glitches
Non-core series glitches
Non-Pokémon glitches
Officially acknowledged glitches
Recurring glitches
Dead glitches

References
Pokémon GameShark codes
The Big HEX List
GB programming
Curiosities
Debugging features
Easter eggs
Error traps
Glitch areas
Glitch myths
Non-glitch exploits
Placeholder texts
Pokémon glitch terminology
Unused content and prerelease information

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!

Search Wiki

 

Search Forums

 

Author Topic: [Utility] 8F Helper - gbz80aid  (Read 1570 times)

0 Members and 1 Guest are viewing this topic.

Cryo

  • Arceus Tamer
  • Distinguished Member
  • Offline Offline
  • Glitch researcher
    • View Profile
[Utility] 8F Helper - gbz80aid
« on: December 10, 2016, 09:57:42 pm »
Heya guys,

After a good bit of going back-and-forth to the Wiki (and later back-and-forth to a text file) in order to look up values for the 8F glitch, I decided to write a program in C using lookup tables that could directly parse gbz80 assembly and machine code, then output the results to the console pretty quickly (~12 milliseconds) in a variety of outputs.

You can check it out over at its Github page, 8F Helper.

As an example of its output, I took the assembly instructions for the perpetually resetting save file by Wacko and converted them to 8F items with the utility.

test.asm:
Code: [Select]
ld l,$6E
ld (hl),$36
ld a,$D3
ld ($D36F),a
inc b
ld c,$1c
ld h,$78
ld l,$48 ; 1c:7848: SaveSAVtoSRAM
ld b,c
call $35d6 ; BankSwitch
jp nc,$1f49 ; SoftReset

Command and output:
Code: [Select]
root@gbdev:~# gbz80aid -o gen1 -f test_code.asm

Item            Quantity
========================
X Accuracy      x110
Max Revive      x54
Lemonade        x211
TM34            x111
TM11            x4
Awakening       x28
Carbos          x120
X Accuracy      x72
X Attack        x205
TM14            x53
TM10            x73
Old Amber       xAny

Hope it can be of use! ;D

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: [Utility] 8F Helper - gbz80aid
« Reply #1 on: December 11, 2016, 05:28:02 am »
Sure it'll be useful ! (And kudos for running this on Linux :D)

That reminds me of my old JavaScript "compiler", and I'd like to suggest some features that came to my mind as I was developing it.

- A -w option that would enable warnings (such as invalid items, using key items with a non-one quantity, two stacks of the same item...).
- Turn the gen2 option into gen2i to make room for the next option.
- Add a gen2b that outputs box names for more recent Gen II ACE exploits.
- More label support.
- Different syntax ? There are multiple syntax used out there.

Which compiler do you use ?

I have some knowledge about C and GBz80, so I forked your repository and did some edits.
« Last Edit: December 11, 2016, 05:50:40 am 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 !)

Wack0

  • Coder, reverser, beta collector [BetaArchive staff]
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • cBRH - Doing nothing since 2k7
    • View Profile
Re: [Utility] 8F Helper - gbz80aid
« Reply #2 on: December 11, 2016, 08:42:47 am »
Nice work :)
C H E C K E D . B U I L D S . A R E . A W E S O M E N E S S

BetaArchiveSoftHistory Forumsirc.rol.im #galaxy,#softhistory

Also known as The Distractor.

Shane, please stop telling children that there's a Mew outside under the delivery trucks. - Management

Pokémon: arbitrary code execution 1996-2016

Cryo

  • Arceus Tamer
  • Distinguished Member
  • Offline Offline
  • Glitch researcher
    • View Profile
Re: [Utility] 8F Helper - gbz80aid
« Reply #3 on: December 11, 2016, 10:10:59 pm »
- A -w option that would enable warnings (such as invalid items, using key items with a non-one quantity, two stacks of the same item...).
- Turn the gen2 option into gen2i to make room for the next option.
- Add a gen2b that outputs box names for more recent Gen II ACE exploits.
- More label support.
- Different syntax ? There are multiple syntax used out there.

Thanks for the feedback! I'll start experimenting with the label support and warnings, and I'll start doing research into Gen II ACE exploits.

And yeah, the pointer operations are pretty hacky; I'll work on standardizing the code and sticking with one style. :D

Which compiler do you use ?

I have some knowledge about C and GBz80, so I forked your repository and did some edits.

Oh awesome! As for my go-to compiler, I use gcc almost exclusively, but I use Visual Studio's cl.exe compiler on very rare occasions.

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: [Utility] 8F Helper - gbz80aid
« Reply #4 on: December 12, 2016, 09:37:42 am »
The edits are sitting on my PC as I'm writing stuff in gedit. I dunno which command you use to compile, so here's mine :
Code: [Select]
gcc gbz80aid.c -o gbz80aid -std=c99

Progression thus far :
Added bounds checking on options using arguments (-f and -o).
Added comments when I needed them.
Added a -v (version) argument, prints light version info.
Added support for brackets instead of parentheses.
Replaced some "malloc"s by some local strings.
Adding a -ofs option of asm format.
"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 !)

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: [Utility] 8F Helper - gbz80aid
« Reply #5 on: December 14, 2016, 08:39:37 am »
I've sent a pull request, but I'm working on implementing some more features and cleaning stuff up.
"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 !)

Cryo

  • Arceus Tamer
  • Distinguished Member
  • Offline Offline
  • Glitch researcher
    • View Profile
Re: [Utility] 8F Helper - gbz80aid
« Reply #6 on: December 14, 2016, 11:54:00 am »
I've sent a pull request, but I'm working on implementing some more features and cleaning stuff up.

Oh awesome! I've merged the pull request with the changes in the master repo, which contains support for multiple labels, some error handling, and more efficient/standardized code than my initial master commit. ;D

As for my compilation command, I usually just use:
Code: [Select]
gcc -o gbz80aid gbz80aid.c

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: [Utility] 8F Helper - gbz80aid
« Reply #7 on: December 15, 2016, 11:39:17 am »
You never get any warnings when compiling ?
I got a ton when I ran this command, mostly about "for(int i = 0; ...", which went away when I switched to C99 standard (-std=c99)

I added "-Wall -Wextra" and commited changes to remove almost all warnings.
I'm also getting ready to write a box name format for Gen II.
"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 !)

Cryo

  • Arceus Tamer
  • Distinguished Member
  • Offline Offline
  • Glitch researcher
    • View Profile
Re: [Utility] 8F Helper - gbz80aid
« Reply #8 on: December 16, 2016, 05:57:49 pm »
Nah, no warnings from the compiler; I'm using GCC 6.2.1 on Kali 2016.2 Rolling. Same with GCC using MinGW on Windows.

It only complains about warnings whenever I enable all warnings during compilation, but it's otherwise quiet.

Yeniaul

  • Guest
Re: [Utility] 8F Helper - gbz80aid
« Reply #9 on: December 16, 2016, 08:22:35 pm »
...why are you running Kali for everyday use?

Wack0

  • Coder, reverser, beta collector [BetaArchive staff]
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • cBRH - Doing nothing since 2k7
    • View Profile
Re: [Utility] 8F Helper - gbz80aid
« Reply #10 on: December 17, 2016, 05:57:17 am »
...why are you running Kali for everyday use?

FTFY
C H E C K E D . B U I L D S . A R E . A W E S O M E N E S S

BetaArchiveSoftHistory Forumsirc.rol.im #galaxy,#softhistory

Also known as The Distractor.

Shane, please stop telling children that there's a Mew outside under the delivery trucks. - Management

Pokémon: arbitrary code execution 1996-2016

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: [Utility] 8F Helper - gbz80aid
« Reply #11 on: December 17, 2016, 03:42:26 pm »
I have GCC 4.9, if I'm correct (I'm on my Windows right now, so no checking that 'cause I got stuff to do before I reboot).
That might explain.
"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 !)

Cryo

  • Arceus Tamer
  • Distinguished Member
  • Offline Offline
  • Glitch researcher
    • View Profile
Re: [Utility] 8F Helper - gbz80aid
« Reply #12 on: December 17, 2016, 07:17:09 pm »
...why are you running Kali for everyday use?
Probably PTSD from taking the OSCP and OSCE.

...why are you running Kali for everyday use?

To spread holiday cheer. ;D

I have GCC 4.9, if I'm correct (I'm on my Windows right now, so no checking that 'cause I got stuff to do before I reboot).
That might explain.
Oh yeah, GCC 5 changed the default from 89 to 11. :P

Cryo

  • Arceus Tamer
  • Distinguished Member
  • Offline Offline
  • Glitch researcher
    • View Profile
Re: [Utility] 8F Helper - gbz80aid
« Reply #13 on: December 21, 2016, 03:42:08 pm »
I apologize for the double post, but I just pushed a pretty big update to the repo that will, among other things, greatly help with determining the inputs for the recently-posted Full Control 8F RAM manipulation method.


Due to an oversight on my end, I had neglected to implement translation for the JP instruction and only supported the JR instruction; it now includes full support for both the JP and JR instructions, even when using custom offsets with the -ofs flag.

The program now supports both the reading and printing of gbz80 ASM in a variety of formats, primarily the BGB format—for example, the instructions ldi (hl),a and ld (hl+),a are treated as the same instruction and can be output in BGB format by specifying the -o bgb flag.

Most notably, however, the program can now convert gbz80 ASM (and gbz80 machine code) into button presses for use with the Full Control 8F method. In this mode, each line of button presses represents a single byte written to memory, and even calculated the total number of button presses required (just for fun). You can specify this mode with the -o joy flag.


As an example of the 8F Full Control button output, here's a snippet of the output when using the ASM code for credits warping on Super Mario Land 2 from TheZZAZZGlitch's recent ACE video.

SAMPLE OUTPUT:
Code: [Select]
C:\gbdev>gbz80aid.exe -o joy -f sml2_ace.asm

Joypad Values:

A
DOWN UP LEFT RIGHT B A A
RIGHT SELECT B B
START B A A
DOWN A DOWN DOWN
UP DOWN LEFT RIGHT START SELECT B A A
DOWN UP LEFT RIGHT START SELECT B A A
START B A A
UP LEFT RIGHT START A A
DOWN LEFT RIGHT RIGHT

[92 lines omitted]

LEFT B B
DOWN LEFT START SELECT B A A
LEFT B B
LEFT RIGHT START SELECT B B
DOWN UP RIGHT RIGHT
LEFT B B
DOWN UP B A A
DOWN UP LEFT LEFT
DOWN UP RIGHT RIGHT
START + SELECT

Total number of button presses: 506

If you're interested in testing it out, you can grab the Windows executable all zipped up here.

Torchickens

  • Administrator
  • *****
  • Offline Offline
  • Gender: Female
    • View Profile
Re: [Utility] 8F Helper - gbz80aid
« Reply #14 on: December 21, 2016, 04:19:37 pm »
Very cool! It's funny these are button combinations like classic game cheats. What would the Konami code or Up-Down-Left-Right-A+Start give, lol?
Hello. I actually identify as gender questioning, but nowadays feel more firmly that I identify as female. My sex is male but I like to express myself as female.  She/her pronouns, please.


Thank you Myri for my avatar! Thank you Aeriixion for the cute sprite above! :) Roelof also made different variations of the sprite (which I animated).

Contact:

Email Youtube Twitter
Skype: Torchickens
Bulbapedia Starfy Wiki

Beyond all philosophies are the things that go best for you; what makes you feel content. It's important to always follow your heart, so unless you feel perfectly happy about it don't just follow something because it is popular, fits a style or is conventional. Sometimes you may reach a point you're not sure who you are, but as things settle I'm convinced things do work out in time.