Appendix A — Debug Expressions

Debug80 supports Z80-focused expressions in the standard VS Code Watch panel and in conditional breakpoints. Add Watches while the program is paused. Add a breakpoint condition by right-clicking a breakpoint and choosing Edit Breakpoint.

Examples

These examples show the shape of the expression language:

A
HL
PC
zero
not carry
PACMO_LIVES
[PACMO_LIVES]
[HL]
[IX + 4]
PC = MainLoop
[PACMO_LIVES] = 0
zero and A = 0
(A ^ $ff) = $df

Registers

Watch expressions can refer directly to Z80 registers:

A
B
C
BC
DE
HL
IX
IY
SP
PC
I
R

Alternate registers are supported:

A'
BC'
DE'
HL'
AF'

Index-register and stack-pointer halves are supported:

IXH
IXL
IYH
IYL
SPH
SPL

Flags

Flags use spelled-out names:

zero
carry
sign
parity
halfCarry

This keeps carry separate from the C register.

zero
not carry
zero and A = 0

Symbols

Symbols from the active source map can be used by name. A symbol by itself evaluates to its address or constant value.

MainLoop
PACMO_LIVES
PC = MainLoop

Build the active target again when a symbol Watch needs to be generated or refreshed.

Memory Reads

Square brackets read one byte from memory at the address inside the brackets:

[HL]
[PACMO_LIVES]
[IX + 4]

Z80 assembly normally uses parentheses for indirect references, as in (HL). Debug80 expressions use square brackets for memory reads so parentheses can keep their ordinary expression-grouping role.

(A + 1) = $21
([FLAGS] & $80) != 0
([PACMO_LIVES] = 3) or carry

Operators

Arithmetic operators:

+ - * / %

Bitwise operators:

& | ^ ~

& is bitwise AND. | is bitwise OR. ^ is bitwise XOR. ~ is bitwise invert.

Comparison operators:

= == != <> < <= > >=

= and == test equality. != and <> test inequality. < tests less than. <= tests less than or equal. > tests greater than. >= tests greater than or equal.

Logical operators:

and or not

Truth Values

Debug80 treats zero as false and any non-zero value as true:

A
[PLAYER_LIVES]
not [PLAYER_LIVES]
carry or zero

Conditional breakpoints use the same syntax. When execution reaches a conditional breakpoint, a true or non-zero expression stops the program. A false or zero expression lets execution continue. Expression errors stop the program and appear in the Debug Console.