# 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

### Printing the screen using PrinterDebug routine (EN Yellow) - Page 1

Previous Page

- 1

Next Page

#### Printing the screen using PrinterDebug routine (EN Yellow)

Posted by: Torchickens
Date: 2019-04-10 07:30:55
In a nutshell:
Put these at item 3 and then setup an arbitrary code execution (ACE) method to run it, such a stored Pokémon bootstrap code for ws m or the placement of ThunderStone x211 at item 42 in the expanded item pack.
Awakening x 58
Carbos x78
X Accuracy x 121
X Attack x 64
TM05 x132
Lemonade x201
Connect your Game Boy Printer and then run your ACE (the order may matter; make sure your Game Boy Printer is connected before running the code). If everything goes to plan, there will be a short delay and the game will print out what was on the screen. :) You may want to print out a Pokédex entry the normal way (Pokédex>Print) to confirm your Game Boy Printer works first. This might also work on a Game Boy Printer emulator but I've yet to confirm.
(Could be optimised for better items. This exact setup was not used and there is a chance (as this changes the c register in addition to the b register) there may be complications, which I unfortunately can't test right now as my Game Boy Printer seems to be low on battery. Any further verifications would be much appreciated.)
Long explanation:
In EN Yellow, using a short arbitrary code execution program and a Game Boy Printer, it is possible to print out a copy of the screen. Not much work is required as this is already a function of 3A:4E79 (PrinterDebug), which is apparently unused.
The base code to do this is as such;
ld b,3A
ld hl,4E79
call 3e84
ret
As always, you will need to adjust this so you can get items/whatever.
By using different entry points, you can print a wide range of things.

'Anything':
1. OAM DMA hijacking (unconfirmed)

Printing the overworld with your inventory open
1. Glitch item ACE (confirmed)

Printing overworld states (no text boxes, no player movements active):
1. Map script ACE (e.g. via little endian D36D/D36E pointer) (confirmed)

Printing a wider range of overworld states:
1. CC57/8 ACE (unconfirmed)

Printing battle scenes:
1. ACE executing glitch moves (confirmed)
2. Using a glitch item in battle (confirmed)

Printing a scene during the Pikachu's Beach minigame:
1. Pikachu's Beach ACE (confirmed, aided with cheating device but non-cheating device method described in article may work too)

Here is one example of what it looks like on real hardware using glitch item ACE:
[img]https://i.imgur.com/NhSBnEG.png[/img]
Notes:
There will be a short delay before your Game Boy Printer works. Sometimes when you do this, numbers are printed on the screen. At a first glance, I'm unsure if this is part of the routine and/or is bugged but the answer could probably be found in the Pokémon Yellow disassembly.
If the map is a Glitch City, the game will print what it looks like as if the Start menu was open (if it is different when closed the game normally won't print that version).
Using more complex ACE, you could in theory put anything on the screen (within the limitations of the Game Boy Color hardware) you want and then print it.

#### Re: Printing anything on the screen using PrinterDebug routine (EN Yellow)

Posted by: Sherkel
Date: 2019-04-10 12:56:41
That's a nice technique and keepsake to show for it! I somehow have a working one of these myself, but have always been afraid to use it due to how hard thermal paper of the correct width apparently is to come by. This, however, is a heck of an incentive…
Could the numbers appearing on the screen be CopyVideoData?

#### Re: Printing anything on the screen using PrinterDebug routine (EN Yellow)

Posted by: Parzival
Date: 2019-04-10 14:41:41
@Torchickens, does this ignore the darkness setting?
@Sherkel, see attached. $50 USD will net you more than you could use in 30 lifetimes (3750 feet). The rolls are way too big for the printer itself, but if you buy or rig a wire paper holder, that's not really an issue. (Theoretically you could put one ON the printer!)

#### Re: Printing anything on the screen using PrinterDebug routine (EN Yellow)

Posted by: Sherkel
Date: 2019-04-11 12:21:03
Good to know, Parzival! Someday I hope to be plastering my walls with screenshots of JACK and -gm.
As for brightness, I'm not really sure…printer.asm doesn't seem to refer to wPrinterSettings at all, so I'd need to give it a closer look unless someone can test it.

#### Re: Printing anything on the screen using PrinterDebug routine (EN Yellow)

Posted by: Torchickens
Date: 2019-04-11 14:10:41

> That's a nice technique and keepsake to show for it! I somehow have a working one of these myself, but have always been afraid to use it due to how hard thermal paper of the correct width apparently is to come by. This, however, is a heck of an incentive…
> Could the numbers appearing on the screen be CopyVideoData?

> @Torchickens, does this ignore the darkness setting?
> @Sherkel, see attached. $50 USD will net you more than you could use in 30 lifetimes (3750 feet). The rolls are way too big for the printer itself, but if you buy or rig a wire paper holder, that's not really an issue. (Theoretically you could put one ON the printer!)

RE: Both of your questions, not sure yet, sorry. Will need to do more research for both.

#### Re: Printing anything on the screen using PrinterDebug routine (EN Yellow)

Posted by: ISSOtm
Date: 2019-04-13 14:21:38
The topic says "print anything on the screen", which implies a way to draw eg. text on the screen itself; wouldn't Printing the screen using […] be less misleading?

#### Re: Printing the screen using PrinterDebug routine (EN Yellow)

Posted by: Torchickens
Date: 2019-04-13 14:51:11

> The topic says "print anything on the screen", which implies a way to draw eg. text on the screen itself; wouldn't Printing the screen using […] be less misleading?

Changed, thanks. Yeah; if you're in a Glitch City the game will print as if the menu was opened (which can give different results) rather than closed.

#### Re: Printing anything on the screen using PrinterDebug routine (EN Yellow)

Posted by: Parzival
Date: 2019-04-13 19:48:08

> The topic says "print anything on the screen", which implies a way to draw eg. text on the screen itself; wouldn't Printing the screen using […] be less misleading?

wouldn't that be "to the screen" if you wanted to imply that?

#### Re: Printing the screen using PrinterDebug routine (EN Yellow)

Posted by: ISSOtm
Date: 2019-04-22 13:48:07
"on" can be synonym of "to", here.
Previous Page

- 1

Next Page