# 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.

## Tech Help

### Pokemon Crystal Remote Code Execution - Page 2

Previous Page

- 1
- 2

Next Page

#### Re: Pokemon Crystal Remote Code Execution

Posted by: Torchickens
Date: 2019-11-28 11:43:53

> The Problem is that it does like that : https://ibb.co/pRmGYwH
> any fix
> CTRL + G works but on the code it just shows -

As it's not automatic and sometimes BGB starts at the wrong place, the trick is to right click at the start of your code I think (i.e. D322 here) and access it via Go to; then BGB will update it.
Edit: In this case the display won't change because D321 was a one byte instruction (though if it was 2 bytes it would require right clicking method). Your code currently grabs FFD3, puts it into "a" and then puts "a" in D059 (instant encounter) (in contrast with e.g. 3E 15 at the start, which compiles as ld a,15 where 15 can be replaced with any value). When a is on the left side of the code it is storing something into the "a" register.
Additionally hope this may help https://iimarckus.org/etc/asmopcodes.txt

#### Re: Pokemon Crystal Remote Code Execution

Posted by: Parzival
Date: 2019-11-28 15:42:43

> > The Problem is that it does like that : https://ibb.co/pRmGYwH
> > any fix
> > CTRL + G works but on the code it just shows -

> As it's not automatic and sometimes BGB starts at the wrong place, the trick is to right click at the start of your code I think (i.e. D322 here) and access it via Go to; then BGB will update it.
> Edit: In this case the display won't change because D321 was a one byte instruction (though if it was 2 bytes it would require right clicking method). Your code currently grabs FFD3, puts it into "a" and then puts "a" in D059 (instant encounter) (in contrast with e.g. 3E 15 at the start, which compiles as ld a,15 where 15 can be replaced with any value). When a is on the left side of the code it is storing something into the "a" register.
> Additionally hope this may help https://iimarckus.org/etc/asmopcodes.txt

you missed the "CTRL + G works but on the code it just shows -" part
when it just shows a - it's an invalid opcode and will pop the debugger when hit.

#### Re: Pokemon Crystal Remote Code Execution

Posted by: Torchickens
Date: 2019-11-28 16:17:11
Sorry about that, I didn't see the Ctrl+G part. Yeah Parzival is right, if there are any opcodes not on the opcodes text file they show as "-". That automatically brings up BGB debugger where other emulators e.g. VBA may act differently (invalid opcode at (address) message etc.) On a Game Boy this freezes, while on 3DS Virtual Console it skips them. (This actually makes me wonder if this is deeper technically/if invalid opcodes have separate effects that can only be understood on a hardware level/or if any obscure peripherals use them like what Shonumi is doing)

#### Re: Pokemon Crystal Remote Code Execution

Posted by: Parzival
Date: 2019-11-28 16:28:38

> Sorry about that, I didn't see the Ctrl+G part. Yeah Parzival is right, if there are any opcodes not on the opcodes text file they show as "-". That automatically brings up BGB debugger where other emulators e.g. VBA may act differently (invalid opcode at (address) message etc.) On a Game Boy this freezes, while on 3DS Virtual Console it skips them. (This actually makes me wonder if this is deeper technically/if invalid opcodes have separate effects that can only be understood on a hardware level/or if any obscure peripherals use them like what Shonumi is doing)

Nope. The CPU hangs as the silicon isn't built to handle that set of bits as an instruction anymore so it goes apeshit.

#### Re: Pokemon Crystal Remote Code Execution

Posted by: bbbbbbbbba
Date: 2019-11-28 17:27:42

> > Sorry about that, I didn't see the Ctrl+G part. Yeah Parzival is right, if there are any opcodes not on the opcodes text file they show as "-". That automatically brings up BGB debugger where other emulators e.g. VBA may act differently (invalid opcode at (address) message etc.) On a Game Boy this freezes, while on 3DS Virtual Console it skips them. (This actually makes me wonder if this is deeper technically/if invalid opcodes have separate effects that can only be understood on a hardware level/or if any obscure peripherals use them like what Shonumi is doing)

> Nope. The CPU hangs as the silicon isn't built to handle that set of bits as an instruction anymore so it goes apeshit.

My guess would be that, since each instruction takes a different number of cycles, there must be a signal that tells the CPU that the previous instruction has finished and the next instruction can begin. And whatever undefined behavior the invalid opcode triggers, it never emits that signal, so the CPU never gets to the next instruction.

#### Re: Pokemon Crystal Remote Code Execution

Posted by: Parzival
Date: 2019-11-28 21:12:19

> > > Sorry about that, I didn't see the Ctrl+G part. Yeah Parzival is right, if there are any opcodes not on the opcodes text file they show as "-". That automatically brings up BGB debugger where other emulators e.g. VBA may act differently (invalid opcode at (address) message etc.) On a Game Boy this freezes, while on 3DS Virtual Console it skips them. (This actually makes me wonder if this is deeper technically/if invalid opcodes have separate effects that can only be understood on a hardware level/or if any obscure peripherals use them like what Shonumi is doing)

> > Nope. The CPU hangs as the silicon isn't built to handle that set of bits as an instruction anymore so it goes apeshit.

> My guess would be that, since each instruction takes a different number of cycles, there must be a signal that tells the CPU that the previous instruction has finished and the next instruction can begin. And whatever undefined behavior the invalid opcode triggers, it never emits that signal, so the CPU never gets to the next instruction.

The clock signal, the thing that only has power in and clock out? :P

#### Re: Pokemon Crystal Remote Code Execution

Posted by: Torchickens
Date: 2020-03-07 02:30:55
Might now be possible with https://forums.glitchcity.info/index.php?topic=9005.0 too? :)
Previous Page

- 1
- 2

Next Page