dmgtris/tools/Expressions.txt

65 lines
4.0 KiB
Plaintext

Expressions/conditions/messages support the following:
arithmetic operators: +, -, *, /, %, # (modulo)
bitwise/logical operators: & (bitwise AND), | (bitwise OR), ^ (XOR), ~ (bitwise NOT), ! (logical NOT), && (logical AND), || (logical OR)
shift operators: <<, >>
compare operators: =, ==, !=, <, >, <=, >=
decimal numbers
hex numbers (prefixed by either $ or 0x)
binary numbers (prefixed by %)
character literals (surrounded by ')
symbols loaded from a symfile
variables (see below)
the @ operator to "read" a value from a calculated address
the @@ operator to specifcy the location to read from (Usage: location@@address)
the : operator to map a specified address to a specified bank (Usage: bank:address)
the & operator to retrive the bank at the specified address (Usage: &address)
the && operator to retrive the bank of the specified symbol (Usage: &&symbol)
Besides that the following variables are supported:
All register names (As single registers and as register pairs)
Flag names followed by the letter f (For example zf for the zero flag)
va (the current vdp address)
vaddress (the current vdp address)
scanline (the current scanline)
address (the current address)
ie (1 if interrupts enabled else 0)
ime (same as above)
sram (0 if sram disabled, 1 if sram enabled, -1 if sram not available)
bank0 (the bank in slot 0)
bank1 (the bank in slot 1)
bank2 (the bank in slot 2)
bankS (the SRAM bank)
For read/write watchpoints only:
value (the value being read/written)
port (the port being read/written)
source (the address being read/written)
op (the operation: 0 - read, 1 - write, 2 - execute)
oldvalue (the value before the operation)
For read watchpoints only:
destination (the destination of a branch instruction)
Possible locations are:
rom, ram, vram, sram,
word (word is a pseudo-location to read words instead of bytes),
dword (same as word but for double words, i.e. 4 bytes),
beword (same as word but big-endian),
bedword (same as dword but big-endian)
Locations can be prefixed with "word." to read a word from a location. Example: "word.ram@@spritePointer" to read the sprite pointer from RAM.
Examples:
Expression "a:hl" maps the value of register hl to the bank specified by register a
Watchpoint on RAM address $c000 with condition "value = $82": The watchpoint only triggers when the value being read/written from/to $c000 equals to $82
Watchpoint on RAM address $c000 with condition "value != oldvalue": The watchpoint only triggers when the value being written to $c000 differs from its old value
Breakpoint on ROM address $0100 with condition "!zf": The breakpoint only triggers when the zero flag is not set.
Explanation: f is the flags register, $40 has only the 6th bit set (which is the zero flag)
Watchpoint on RAM address $c000 with condition "value != 0": The watchpoint only triggers when the value being read/written from/to $c000 is not 0
Watchpoint on RAM address $c000 with condition "oldvalue > 0 && value = 0": The watchpoint only triggers when the value being written to $c000
is 0 and the old value at $c000 was greater than 0
Watchpoint on RAM address $c000 with condition "(value & 1) != (oldvalue & 1)": The watchpoint only triggers when bit 0 at $c000 changes by a write
Breakpoint on ROM at vBlankHandler with condition "@flagUpdatingGame != 0"
and message "Entered VBlank while still in the Game Update!": The breakpoint only triggers when the value read from flagUpdatingGame is not 0.
It then logs the message "Entered VBlank while still in the Game Update!".
Explanation: flagUpdatingGame is a RAM label, @ is the read operator
Watchpoint on Port $dc and all its mirrors is achieved by entering "pc0..ff" as address and "(source & 1) = 0" as condition