Skip to Content
GuidesDebuggingThe Memory view

The Memory View

The Memory view shows the machine’s memory as a hex dump with characters beside it. Use it to check what your program wrote, to look into a bank that is not paged in, to change a byte while the machine is paused, to find a byte pattern or a string, and, with code coverage on, to see which bytes were executed, read or written.

The Memory view: toolbar, memory map, registers, the dump and the inspector.
The Memory view: the toolbar, the memory map bar, the register strip, the dump with its label gutter and the inspector

Open it

Choose View › Machine Views › Memory, or click Show Memory Panel on the IDE toolbar. The view opens as a document in the IDE; the same items close it again. The show-memory command opens it too, at an address, a label, a register or a partition and offset.

The toolbar

  • Go to: type where to go and press Enter (Ctrl+G puts the cursor there). It takes:

    • an address, in hexadecimal (8000, $8000, 0x8000) or, with Dec on, decimal; % for binary;
    • a register name: HL, PC, IX;
    • a label: one from your build, your annotations or the ROM’s;
    • a partition and an offset, 47:$0100 or R0:$10, the syntax bp-set uses.

    The box turns red and its tooltip says why when it does not understand the text.

  • Find: see Find bytes and text.

  • Bytes: 8, 16 or 32 bytes a row.

  • Hex / Dec: the number format of addresses and bytes.

  • Chars: show each byte’s character beside the dump.

  • Labels: show the label gutter in front of each row: the row’s first label, and a tag for each register pointing into the row.

  • Heat: colour the bytes by how they were used since coverage started: Executed, Read, Written or All, or Off. It appears on machines that record coverage; turn coverage on with Debug › Code Coverage. See Code coverage and the heat map.

  • Follow: keep the cursor on the address a register holds, at every stop.

  • Inspector: show the inspector column beside the dump.

The memory map

The strip under the toolbar is the 64K as the CPU sees it now: one cell per paging unit (four 16K slots on a 128K, the Next’s eight MMU slots, the Cambridge Z88’s segments), each with its address range and the partition in it. ROM is hatched and an empty card slot dashed. The frame along the bottom is the part in view, the PC and SP ticks mark the registers, and with Heat on a strip under each cell shows where the hot bytes are. Click a cell to go to its start.

Below the map, the register strip has a chip for each register that holds an address, with its value and the partition it points into. Click one to go there; ⋯ adds the alternate registers, IR and WZ.

Look at one partition

On machines that page memory, the Partitions row picks what the view shows: 64K for the address space as the CPU sees it, or one partition on its own, shown by offset from $0000 even when it is not paged in. The map bar then describes that partition: its name, size, where it is paged in (or not paged in) and what the hardware uses it for.

A machine with a handful of partitions lists them all as chips; a badge on a chip gives the slots it is paged into. A machine with many (the Z88’s 256 banks, the Next’s 247 or 503 partitions) shows Paged in, the Recent partitions you opened in this view, and the Bank map button.

The Next's Bank map: paged-in badges, and bars for the ULA screen, Layer 2 and the tilemap.
The Bank map of a ZX Spectrum Next: the ROMs, DivMMC and the RAM pages as a grid, with paged-in badges and role bars

The Bank map (Ctrl+B) shows every partition, laid out the way the machine has them. Each cell carries:

  • its kind, as its fill: ROM, RAM, card RAM, flash, EPROM, DivMMC ROM or RAM, empty, or a mirror of another bank;
  • a badge with the slots it is paged into;
  • on the Next, a role bar: the ULA screen, the shadow screen, Layer 2 and its shadow, and the tilemap, read from the machine’s registers as it runs;
  • a dot when its bytes changed since the previous stop.

Type in Filter to fade what does not match: a name (47, M3), a kind (rom), a role (screen) or a slot (slot 2). Arrow keys move, Enter opens the partition and Esc closes the map.

The Z88's four card slots. A card smaller than its slot repeats across it: those banks are mirrors.
The Bank map of a Cambridge Z88: four card slots of 64 banks, filtered to mirrors
One partition on its own, shown by offset.
The Memory view showing one ZX Spectrum Next RAM page by offset

The dump

  • A register tag in the label gutter says which registers point into the row; the byte each points at is underlined.
  • A small dot marks each byte that changed since the previous stop: while paused, since the stop before this one.
  • The bytes a memory breakpoint watches are underlined in the breakpoint colour.
  • With the 64K shown, a rule marks the row where the next slot’s partition starts.

Click a byte to put the cursor on it. Shift+click, Shift+arrows or a drag select a range. The arrows, Page Up/Page Down and Home/End move the cursor.

Change a byte

Type over it: put the cursor on a RAM byte and type its new value in hexadecimal (decimal with Dec on). The byte is written as soon as it is complete and the cursor moves on; Enter writes a partial value and Esc drops it. ROM, flash and empty slots cannot be written; the inspector says why.

For a word or a double word, use the inspector’s Edit section (a value, its size in bytes, and BE for big-endian), or right-click the byte:

Right-click the byte

The Set Memory Content dialog opens for that address.

Enter the value

Type a decimal number, a hexadecimal one with $, or a binary one with %. Choose the Content size, 1 to 4 bytes. The value is written least significant byte first; tick Big-endian write to write the most significant byte first.

Click Set

Click Set or press Enter.

Memory can be written while the machine runs, but the program may overwrite the value at once: pause it first. While you stand in the past with reverse debugging on, an edit asks to take over first.

Find bytes and text

Type in Find and press Enter (Ctrl+F puts the cursor there):

  • bytes: 21 00 58, with ?? for any byte: 21 ?? 58;
  • text in quotes: "HELLO";
  • a label’s name, which goes to the label.

The count says which match is shown of how many; F3 and Shift+F3 (or the arrows) step through them. View searches what the view shows; All searches every partition of the machine, and a match in a partition that is not shown opens it.

Find: every match is marked, the current one outlined.
The Memory view with the matches of a byte pattern marked in the dump

The inspector

The column beside the dump describes the byte under the cursor:

  • Location: the partition and offset, what the partition is, where the CPU sees it, its role, its label, the registers pointing at it.
  • Value at cursor: the byte unsigned and signed, in binary and as a character; the word at the cursor in both byte orders, with its label; the double word.
  • Edit: write a value of 1, 2 or 4 bytes.
  • Selection: the range, its length, sum and XOR, and its text; Copy hex, Copy as .defb, Show as graphics (the Graphics Finder) and Find these bytes.
  • Instructions here: the bytes at the cursor disassembled, and Open in Disassembly.
  • Heat: how often the byte was executed, read and written.
  • Use: Breakpoint here, Break on write (over the selection, when there is one) and Watch as word for a labelled address. A breakpoint on a RAM bank’s byte is set bank-relative (bp-set 10:+$0010), so it fires wherever the bank is paged, also for a bank shown here that is not paged in now.
The inspector.
The Memory view's inspector: location, value at cursor, edit and instructions

Below about 120 characters of width, the inspector moves under the dump. Clear Inspector to give the dump the whole width.

Machine-specific memory partitions

Every partition has one name and one description. The name is what identifies it: it is what the chips and the bank map show, what a breakpoint is listed under, and what the bp-* commands and Go to accept in a partition-qualified address such as r1:$32ac. The description is the longer form shown beside the name.

Names are accepted case-insensitively, so r1 and R1 are the same partition.

ZX Spectrum 48K

No partitions: this model has only the 64K view.

ZX Spectrum 128K

NameDescriptionWhat it is
R0, R1ROM 0, ROM 1The two ROM pages, 16K each
B0 … B7Bank 0 … Bank 7The eight RAM banks, 16K each

Bank 5 holds the screen and bank 7 the shadow screen.

ZX Spectrum +2E, +3E

NameDescriptionWhat it is
R0 … R3ROM 0 … ROM 3The four ROM pages, 16K each
B0 … B7Bank 0 … Bank 7The eight RAM banks, 16K each

Cambridge Z88

NameWhat it is
00 … 3FSlot 0: the ROM (00-1F) and the internal RAM (20-3F)
40 … 7F, 80 … BF, C0 … FFCard slots 1, 2 and 3

The bank map shows what is in each slot: a RAM, EPROM or flash card and its size, or an empty slot. A card sits at the top of its slot and repeats below it when it is smaller than the slot’s 1M; those banks are mirrors, and their tooltip names the bank they repeat.

ZX Spectrum Next

GroupNameWhat it is
Next ROMR0 … R3The ROM pages of the ZX Next OS, 16K each
Alt ROMX0, X1The alternate ROM pages, 16K each
DivMMC ROMDMThe DivMMC ROM, 8K
DivMMC RAMM0 … MFThe 16 DivMMC RAM banks, 8K each
RAM pages00 … DFThe 224 RAM pages, 8K each (000 to 223 in decimal view)
Upper RAMU00 … UFFA KS3 board’s upper 2 MB, 256 pages of 8K

On the ZX Next a RAM partition is an 8K page, which is the granularity of the machine’s own MMU. Code and tools that think in 16K banks (the .bank pragma, a NEX file’s banks, the .nex viewer) address them in pairs: 16K bank B is the two partitions 2B and 2B+1, its low half first. So 16K bank 5 is partitions 0A and 0B; a page’s tooltip names its 16K bank.

The alternate ROMs are named X0 and X1 rather than the more obvious A0/A1, and the DivMMC RAM banks M0…MF rather than D0…DF, because A0 and D0 are already valid RAM bank names on this machine. A name has to mean one thing.

Earlier versions called the alternate ROMs Q0 and Q1. Those spellings are still accepted by bp-set and friends, so existing scripts keep working, but the IDE now shows X0 and X1.

Coming from an earlier version: the 64K View switch and the Selected bank chooser are the 64K chip and the partition row (or the Bank map), the View drop-down is Bytes, and the two-column 8-byte layout is gone: such a view opens with 16-byte rows.

Last updated on