Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Arbitrary Code Execution Discussion

Arbitrary code execution in Red/Blue using the "8F" item - Page 37

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: Torchickens
Date: 2017-02-07 16:34:47

Is there an Intuitive, Searchable, opcode map for the GB, I would like to write some item codes.


As Flandre Scarlet suggested you can use the table found at Pastraiser.

We also have an opcode table on http://glitchcity.info/wiki/The_Big_HEX_List but if you want a plain text file with only opcodes and operands another one can be found here (https://iimarck.us/etc/asmopcodes.txt) which is the table I used to use. I personally feel the latter two are simpler and may be more user friendly.

And if you want to learn assembly I learned some of it after experimenting with http://marc.rawer.de/Gameboy/Docs/GBCPU_Instr.html and http://datacrystal.romhacking.net/wiki/Pok%C3%A9mon_Red/Blue:RAM_map for a list of memory addresses, so for example ld a, xx puts a value into a and ld (xxyy),a puts the value of a into another memory address and a ret ($C9 byte) will end the code.

Hope that helps!

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: ISSOtm
Date: 2017-02-08 00:48:03
You also have our Big HEX List, whoch makes for a nice conversion tool. It's not as much readable IMO, but saves a ton of time.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: tigere89
Date: 2017-02-09 14:23:23
Greetings to all,

I simply wanted to say thank you for the information provided on this topic. Unfortunately I  lost my 8F shortly after obtaining it by putting it into my item box.

This being said, I wanted to confirm that by placing the item in Computer Item Box, that it would be lost; I think this is due to not resetting the item list by buying 3 different items first before saving.

Thank you, any insight would be great.

Tigere89

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: Unused Trainer
Date: 2017-02-10 02:48:36
Quick question: how powerfull is the 8F item for discovet new glitchs in future?

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: ISSOtm
Date: 2017-02-10 07:25:57
Since 8F is all-powerful, I guess "infinitely" is the right answer.
Until we exhaust the number of possible glitches, I guess.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: Yeniaul
Date: 2017-02-10 07:52:27

Until we exhaust the number of possible glitches, I guess.
You do realize it's Game Freak's first(?) game we're talking about, right? I doubt my grandkids will see the last glitch to be found in this game be discovered.  ::)

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: Stackout
Date: 2017-02-10 17:39:06


Until we exhaust the number of possible glitches, I guess.
You do realize it's Game Freak's first(?) game we're talking about, right? I doubt my grandkids will see the last glitch to be found in this game be discovered.  ::)


First GB game, maybe.

First game, no. Their first game was Mendel Palace for NES.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: Charmy
Date: 2017-02-11 03:58:00



Until we exhaust the number of possible glitches, I guess.
You do realize it's Game Freak's first(?) game we're talking about, right? I doubt my grandkids will see the last glitch to be found in this game be discovered.  ::)


First GB game, maybe.

First game, no. Their first game was Mendel Palace for NES.
And in Yellow, there's a unused port of it's boss theme, so it's confirmed now.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: []J.
Date: 2017-02-14 22:27:14
    Hi, I'm new to GCL (at least my account is) and I've recently obtained 8F in Pokemon red due to the recently (I think) discovered easier party arrangement redirecting to the fifth byte of the item menu. After messing with it, (accidentally) making a script of my own, and completing my Pokedex, I quickly became tired of being a script kiddie. I fear that I may loose interest in Pokemon red and never boot the cartridge up again (I understand it's hazardous to script on something lacking savestates, but I'm careful.) due to the fact that there isn't all too much left to do.

Anyway, I'll stop beating around the bush. What is the best resource I can use to learn how to script in Pokemon? I'm fluent in many refined languages, but machine code eludes me.

Any help would be much appreciated.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: NUNsLAUGHTER
Date: 2017-02-14 22:47:26






Force encounter with a pokemon of a specified species (lvl is not guaranteed, for me it was lvl11 usually) :
1: Any item
2: wsm
3: Lemonade x[SpeciesIndex] (http://glitchcity.info/wiki/The_Big_HEX_List)
4: TM34 x93
5: TM08 x201


Receive a lvl 2 pokemon of a specified species (as if a NPC was giving it to the character):
1: Any item
2: wsm
3: Repel x[SpeciesIndex] (http://glitchcity.info/wiki/The_Big_HEX_List)
4: X Speed x14
5: Ultra Ball x64
6: TM05 x92
7: Lemonade x201
Note : the lvl is equal to the hex ID (http://glitchcity.info/wiki/The_Big_HEX_List) of the item in the fifth position (here, the Ultra ball

For your first one, if you withdraw a level 5/whatever level pokemon then put it back in the pc, next encounter will be that level, at least on blue.
I've got a question for the pokemon giving method, can you use something other than ultra balls to make the pokemon 40/50/100? I'd like to use this for getting ditto but pokebank doesn't see level 2 ditto as acceptable and I'd rather use this than having to battle ditto, catch it then deposit it but I don't want to use a bunch of rare candy, that'd make it more time consuming than the first one.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: Unused Trainer
Date: 2017-02-15 02:46:06







Force encounter with a pokemon of a specified species (lvl is not guaranteed, for me it was lvl11 usually) :
1: Any item
2: wsm
3: Lemonade x[SpeciesIndex] (http://glitchcity.info/wiki/The_Big_HEX_List)
4: TM34 x93
5: TM08 x201


Receive a lvl 2 pokemon of a specified species (as if a NPC was giving it to the character):
1: Any item
2: wsm
3: Repel x[SpeciesIndex] (http://glitchcity.info/wiki/The_Big_HEX_List)
4: X Speed x14
5: Ultra Ball x64
6: TM05 x92
7: Lemonade x201
Note : the lvl is equal to the hex ID (http://glitchcity.info/wiki/The_Big_HEX_List) of the item in the fifth position (here, the Ultra ball

For your first one, if you withdraw a level 5/whatever level pokemon then put it back in the pc, next encounter will be that level, at least on blue.
I've got a question for the pokemon giving method, can you use something other than ultra balls to make the pokemon 40/50/100? I'd like to use this for getting ditto but pokebank doesn't see level 2 ditto as acceptable and I'd rather use this than having to battle ditto, catch it then deposit it but I don't want to use a bunch of rare candy, that'd make it more time consuming than the first one.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: ISSOtm
Date: 2017-02-15 09:09:06
J. link=topic=6638.msg204331#msg204331 date=1487132834]
    Hi, I'm new to GCL (at least my account is) and I've recently obtained 8F in Pokemon red due to the recently (I think) discovered easier party arrangement redirecting to the fifth byte of the item menu. After messing with it, (accidentally) making a script of my own, and completing my Pokedex, I quickly became tired of being a script kiddie. I fear that I may loose interest in Pokemon red and never boot the cartridge up again (I understand it's hazardous to script on something lacking savestates, but I'm careful.) due to the fact that there isn't all too much left to do.

Anyway, I'll stop beating around the bush. What is the best resource I can use to learn how to script in Pokemon? I'm fluent in many refined languages, but machine code eludes me.

Any help would be much appreciated.

I tried making a page about programming for the Game Boy. I find it hard to read though, so after you are done reading it head to the "ASM in 28 days" thing linked at the end, it is a tutorial for TI 8x calcs, which have almost the same processor as the GB. The tutorial talks about sutff such as "ports" which don't exist on the GB anymore, but the more you know.
Then you'll probably figure out the rest, just use GBdevWiki as a reference to all GameBoy-specific stuff.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: Stackout
Date: 2017-02-15 13:35:46

J. link=topic=6638.msg204331#msg204331 date=1487132834]
    Hi, I'm new to GCL (at least my account is) and I've recently obtained 8F in Pokemon red due to the recently (I think) discovered easier party arrangement redirecting to the fifth byte of the item menu. After messing with it, (accidentally) making a script of my own, and completing my Pokedex, I quickly became tired of being a script kiddie. I fear that I may loose interest in Pokemon red and never boot the cartridge up again (I understand it's hazardous to script on something lacking savestates, but I'm careful.) due to the fact that there isn't all too much left to do.

Anyway, I'll stop beating around the bush. What is the best resource I can use to learn how to script in Pokemon? I'm fluent in many refined languages, but machine code eludes me.

Any help would be much appreciated.

I tried making a page about programming for the Game Boy. I find it hard to read though, so after you are done reading it head to the "ASM in 28 days" thing linked at the end, it is a tutorial for TI 8x calcs, which have almost the same processor as the GB. The tutorial talks about sutff such as "ports" which don't exist on the GB anymore, but the more you know.
Then you'll probably figure out the rest, just use GBdevWiki as a reference to all GameBoy-specific stuff.


I'm pretty sure this is the wiki page you meant to link to.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: ISSOtm
Date: 2017-02-15 14:01:11
Yep.

Re: Arbitrary code execution in Red/Blue using the "8F" item

Posted by: []J.
Date: 2017-02-15 19:25:42


J. link=topic=6638.msg204331#msg204331 date=1487132834]
    Hi, I'm new to GCL (at least my account is) and I've recently obtained 8F in Pokemon red due to the recently (I think) discovered easier party arrangement redirecting to the fifth byte of the item menu. After messing with it, (accidentally) making a script of my own, and completing my Pokedex, I quickly became tired of being a script kiddie. I fear that I may loose interest in Pokemon red and never boot the cartridge up again (I understand it's hazardous to script on something lacking savestates, but I'm careful.) due to the fact that there isn't all too much left to do.

Anyway, I'll stop beating around the bush. What is the best resource I can use to learn how to script in Pokemon? I'm fluent in many refined languages, but machine code eludes me.

Any help would be much appreciated.

I tried making a page about programming for the Game Boy. I find it hard to read though, so after you are done reading it head to the "ASM in 28 days" thing linked at the end, it is a tutorial for TI 8x calcs, which have almost the same processor as the GB. The tutorial talks about sutff such as "ports" which don't exist on the GB anymore, but the more you know.
Then you'll probably figure out the rest, just use GBdevWiki as a reference to all GameBoy-specific stuff.


I'm pretty sure this is the wiki page you meant to link to.


"MediaWiki internal error.

Original exception: [df666237fde71cf5d357b568] /wiki/GB_Programming MWException from line 767 of /application/w/includes/skins/SkinTemplate.php: SkinTemplate::makeTalkUrlDetails given invalid pagename User:[]J.
Backtrace:
#0 /application/w/includes/skins/SkinTemplate.php(606): SkinTemplate->makeTalkUrlDetails(string)
#1 /application/w/includes/skins/SkinTemplate.php(472): SkinTemplate->buildPersonalUrls()
#2 /application/w/includes/skins/SkinTemplate.php(246): SkinTemplate->prepareQuickTemplate(OutputPage)
#3 /application/w/includes/OutputPage.php(2324): SkinTemplate->outputPage()
#4 /application/w/includes/MediaWiki.php(753): OutputPage->output()
#5 /application/w/includes/MediaWiki.php(519): MediaWiki->main()
#6 /application/w/index.php(43): MediaWiki->run()
#7 {main}

Exception caught inside exception handler: [df666237fde71cf5d357b568] /wiki/GB_Programming MWException from line 767 of /application/w/includes/skins/SkinTemplate.php: SkinTemplate::makeTalkUrlDetails given invalid pagename User:[]J.
Backtrace:
#0 /application/w/includes/skins/SkinTemplate.php(606): SkinTemplate->makeTalkUrlDetails(string)
#1 /application/w/includes/skins/SkinTemplate.php(472): SkinTemplate->buildPersonalUrls()
#2 /application/w/includes/skins/SkinTemplate.php(246): SkinTemplate->prepareQuickTemplate(OutputPage)
#3 /application/w/includes/OutputPage.php(2324): SkinTemplate->outputPage()
#4 /application/w/includes/exception/MWException.php(204): OutputPage->output()
#5 /application/w/includes/exception/MWException.php(244): MWException->reportHTML()
#6 /application/w/includes/exception/MWExceptionHandler.php(69): MWException->report()
#7 /application/w/includes/exception/MWExceptionHandler.php(180): MWExceptionHandler::report(MWException)
#8 /application/w/includes/MediaWiki.php(528): MWExceptionHandler::handleException(MWException)
#9 /application/w/index.php(43): MediaWiki->run()
#10 {main}"

This is all that link gave me…