Skip to content

Instantly share code, notes, and snippets.

@NewbiZ
Created January 28, 2015 21:42
Show Gist options
  • Save NewbiZ/a401f28ae24f36b62db8 to your computer and use it in GitHub Desktop.
Save NewbiZ/a401f28ae24f36b62db8 to your computer and use it in GitHub Desktop.
Example rgbdbg session on a simple Z80 program that sums up integers in register a
$ ./target/rgbdbg
RGB debugger 0.0.1
Copyright (C) 2015 Aurelien Vallee
License MIT: http://opensource.org/licenses/MIT
(rgbdbg) h
Commands:
help |h List available commands
file |f Load Z80 executable binary
next |n Step execute the next instruction
run |r Run the program until Cpu is stopped
list |l List upcoming instructions
dump |d Dump memory at location
print|p Print the current CPU state
quit |q Quit
(rgbdbg) l
-> NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
(rgbdbg) d
@x0000 | x00 x00 x00 x00 |
@x0004 | x00 x00 x00 x00 |
@x0008 | x00 x00 x00 x00 |
@x000C | x00 x00 x00 x00 |
@x0010 | x00 x00 x00 x00 |
@x0014 | x00 x00 x00 x00 |
(rgbdbg) p
| A F | B C | D E | H L | PC | SP | ZNHC---- | M | T |
| x00 x00 | x00 x00 | x00 x00 | x00 x00 | @x0000 | @x0000 | 00000000 | 0 | 0 |
| 0 0 | 0 0 | 0 0 | 0 0 | - | - |
| 0 | 0 | 0 | 0 | @ 0 | @ 0 |
(rgbdbg) file samples/sum_integers.z80
Loading: samples/sum_integers.z80.
Successfully loaded 8 bytes in memory.
(rgbdbg) l
-> LD B, 0x0A
XOR A
ADD A, B
DEC B
JR NZ, 0xFE
STOP 0
NOP
NOP
NOP
NOP
(rgbdbg) d
@x0000 | x06 x0A xAF x80 |
@x0004 | x05 x20 xFE x10 |
@x0008 | x00 x00 x00 x00 |
@x000C | x00 x00 x00 x00 |
@x0010 | x00 x00 x00 x00 |
@x0014 | x00 x00 x00 x00 |
(rgbdbg) p
| A F | B C | D E | H L | PC | SP | ZNHC---- | M | T |
| x00 x00 | x00 x00 | x00 x00 | x00 x00 | @x0000 | @x0000 | 00000000 | 0 | 0 |
| 0 0 | 0 0 | 0 0 | 0 0 | - | - |
| 0 | 0 | 0 | 0 | @ 0 | @ 0 |
(rgbdbg) n
LD B, 0x0A
(rgbdbg) n
XOR A
(rgbdbg) n
ADD A, B
(rgbdbg) n
DEC B
(rgbdbg) n
JR NZ, 0xFE
(rgbdbg) p
| A F | B C | D E | H L | PC | SP | ZNHC---- | M | T |
| x0A x40 | x09 x00 | x00 x00 | x00 x00 | @x0003 | @x0000 | 01000000 | 8 | 32 |
| 10 64 | 9 0 | 0 0 | 0 0 | - | - |
| 2624 | 2304 | 0 | 0 | @ 3 | @ 0 |
(rgbdbg) r
LD B, 0x0A
XOR A
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
ADD A, B
DEC B
JR NZ, 0xFE
STOP 0
(rgbdbg) p
| A F | B C | D E | H L | PC | SP | ZNHC---- | M | T |
| x37 xC0 | x00 x00 | x00 x00 | x00 x00 | @x0008 | @x0000 | 11000000 | 53 | 212 |
| 55 192 | 0 0 | 0 0 | 0 0 | - | - |
| 14272 | 0 | 0 | 0 | @ 8 | @ 0 |
(rgbdbg) l
-> NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
(rgbdbg) q
Bye.
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment