December 7, 2012

zxsp 0.8.0.pre9: Memory Inspectors

And on it goes...

"0.8.0.pre9" is out.

What's new?
  • Audio input from standard audio input device
  • Memory inspectors. see screenshot. :-)
Screenshot of zxsp with memory (and some other) inspectors

22:30 It's late and i'm tired.

03:00 Fire in the building, smell of smoke, blue flashlights, -5°C, brrrr...

10:00 Front got a new painting (partially): black.

11:00 ok, back to zxsp!

Audio input

I must admit, this is a little bit kind of "forgotten". Audio input is now enabled by default, if the standard audio input device is compatible with the standard audio out device. Basically this requires the sampling frequencies to be the same. Audio-in selection and support for different sampling frequencies will be added some day in the future.

Memory Inspectors

They can be accessed from the "Windows" menu. 
There are 4 kinds of them: 
  • Hex Inspector
  • Disassembler Inspector
  • Graphical Inspector
  • Memory Access Inspector

Common Functions

All windows are updated in real-time. 
Most windows are freely resizable.

Data Source and Page Selector, Base Address
The first popup lets you select from 5 different kinds of sources: 
  • As seen by CPU: This will display the 64 kB which the CPU currently sees when reading (writing may differ). On some models memory is mirrored or some addresses are not mapped to any memory. Note: if you display memory which is repeatedly mapped to different physical ram or rom with a very large inspector window, then this will result in high CPU usage (of your Mac's CPU).
  • All Ram: Show (a section of) all ram. Memory order is as seen by the CPU for models with no paged memory and in sequence of page numbers for models with paged memory.
  • All Rom: Similar, except for the rom. Note: You cannot display the contents of an external rom, e.g. a rom cartridge, this way. But it can be displayed with "as seen by cpu".
  • Ram Pages: Limit view to certain ram pages. The "Page" popup is added to the tool bar. Ram pages typically range from 1 kB to 16 kB in size. On models with no memory paging the ram is divided into 16 kB chunks. 
  • Rom Pages: Similar, except for the rom.
The second popup let's you select the ram or rom page, if "Ram Pages" or "Rom Pages" is selected.

The address view shows the base address of the inspector display and a new address can be entered here.

Hex Inspector

Hex Inspector
Three fields are shown: The start address of the row, memory contents in hex and memory contents in ascii characters. Editing is not yet supported.
The display can be toggled between byte and word display.
There's a popup which let's you navigate quickly to the address in a register.
Two buttons let you quickly resize the window to 16 and 32 bytes per row.

Disassembler Inspector

Disassembler Inspector
The disassembler also shows three fields: Address of an instruction, up to 4 bytes which construct the instruction and the disassembled opcode.
There's also a quick "goto register" popup. 
Note that the disassembler currently does not try to "lock" to the real start of a Z80 opcode for the first line, so the first lines may always contain garbage, due to a misaligned window base address. 
It's nice to point it at some self-modifying code and watch how the addresses change. :-)
I plan to add a "import labels" option for some later release.

Graphical Inspector

Graphical Inspector: video ram; pixels and attributes

The graphical memory view lets you easily find where the graphics are stored or e.g. view the video ram in it's real layout. 
There's also a quick "goto register" popup and 
a "quick resize" button for 32 bytes per row.
You can make the window as tall as 1 byte per row to see 1-byte-wide graphics or e.g. a character set.

Memory Access Inspector

ZX80 Space Invaders running in 2 kB of ram
The optical highlight, due to it's colors, is the memory access inspector.
Every grid point represents one byte of memory and it's color is composed from red, green and blue.
Each color component has a distinct meaning:
  • Red: This address was executed by the CPU
  • Green: This address was written to by the CPU
  • Blue: This address was read by the CPU
These 3 color components combine to 8 base colors:
  • Black: not accessed
  • Red: executed
  • Green: written
  • Blue: read
  • Cyan: = Green + Blue = read and written
  • Yellow: = Red + Green  = executed and written
  • Magenta: = Red + Blue   = Executed & read: rarely seen.
  • White: = Red + Green + Blue = Executed, written & read.
Depending on the decay mode all color components may come in shades. White tends to be a little magenta'ish.

Decay modes:
  • Flash: The currently accessed memory only flashes once. The update speed is roughly 1/10 sec, so you'll see what has been accessed within 0.1 sec.
  • Decay fast: The displayed pixels are faded slowly, like on a very old oscilloscope. 
  • Decay slow: The displayed pixels are faded very slowly.
  • Accumulate: Pixels are not faded and the access information accumulates. This is good to determine code sections on a long run or to display access during single stepping the CPU.
A popup let's you select the grid size from 2x2 to 4x4.

The rightmost popup let's you select the display width from 32 bytes per row to 512 bytes per row.
The memory access inspector window cannot be resized freely.

Note: You can open as many inspectors as you like and fit on your screen, but the memory access inspector should only opened once, because it "consumes" meta information collected in the target machine. You could, however, open one for ram only and one for rom only, which will not interfere. Or for two different machines, as soon as multiple instances are supported by this version of zxsp.

Summary

These four memory inspectors give you a complete new insight into any scrutinized game! :-)

No comments:

Post a Comment