December 22, 2012

zxsp 0.8.0.pre10: Debugger

Let's the year's end rallye start...
(phht, i had to look up 'rallye'...)

The last weeks i was working on the debugger, especially on break points, and some cosmetic&nice stuff.

So what's new?

In Hex and Disass Memory Inspector:
  • Highlight opcode addressed by register
  • Indicate breakpoints
  • Set & clear Breakpoints
  • Edit memory

Editing in the Hex Memory Inspector

Color codes in the Hex Memory Inspector

The toolbar in the hex inspector now has a button group "Edit", "R", "W" + "X".

If you push down "Edit" you can directly edit the displayed hex data. Any editing is instantaneous. Note, that key input now goes to the edit field and no longer to the running machine. Currently it is not visually shown that the hex field has focus. That's on the ToDo list. Also you cannot yet edit in the Ascii field.

If you push down "R", "W" and/or "X" you are in breakpoint editor mode. Where ever you click you set or clear a breakpoint for Read, Write or Execute. Breakpoints are indicated with colored hex characters:
  • Blue = read
  • Green = Write
  • Red = Execute
  • and any combination, e.g. Yellow = Green+Red = Write+Execute.
If a register points to a certain memory address, the background of the bytes is colored:
  • red (pink) = PC
  • green = SP
  • cyan = HL
  • yellow = other registers
If you hover the mouse over the byte the register is displayed in the tooltip.

Editing in the Disass Inspector

PC highlight and the Edit mode popup in Disass View
The toolbar in the disass view now contains a popup menu for selecting edit mode or breakpoint mode. It has the same functionality as the button group in the hex view. I'm not sure which method is better. 
As in the hex view registers and breakpoints are indicated with colors. As you can see im the screenshot the colors are shown in the hex code column, except for the PC which is shown in the full row. 
If you have selected "Edit" you can edit memory in the hex code column. Again there is not yet a visual indicator that this view has keyboard focus. Also, while you can click on the disassembled opcode to toggle breakpoints you cannot yet edit the opcodes. This will come next.

Other Changes

The Disass inspector now tries to lock on actual opcode boundaries. But this can only be done 95% because this is unavoidably ambiguous.

Qt Version

As you may know Qt 5.0.0 was release yesterday. I have already tried to compile zxsp with Qt 5.0.0. Most code compiled with no problems, but i'm currently stuck because i probably ran into a bug in Qt 5.0.0: OpenGL drawing cannot be set to single buffer mode, but that's what i use in zxsp. Switching to double buffered mode is not trivial in this special case. I hope this is fixed quickly and the next version is compiled against Qt 5.0.0. We'll see.


Happy Christmas to all and a peaceful start into the new year!

    ... Kio !

St. Johann, Erlangen 2012-12-08

p.s: as written, we had a fire in our building and one apartment was completely destroyed.
If you start at the burnt-out flat and go 3 flats right and 6 floors up you may note the small black spot at my window, which is the "little-bat". :-)



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! :-)

November 17, 2012

zxsp 0.8.0.pre8

Hello again,

Snapshot from the Dies Irae Demo, captured with zxsp
Starting with version 0.8.0.pre8 i am working on the debugger. Z80 register editing is implemented again and there is a memory inspector, if you select the 'Mmu' inspector in the Windows menu. Currently only the 'Bytes' display works, others will follow in the next release. Breakpoints are also still ahead.

During the work on this version i managed to freeze my Mac several times. I believe this should no longer be possible with nowadays operating systems, but it is. I suspect OpenGL is still somewhat instable in OSX.

During my work to fix this i worked on the screen display routines and also improved the behavior during window resizing.

New in this version:

  • CPU register editor
  • Memory display
  • Reduced flicker during window resize

CPU Register Editor

Values are committed with 'Return' and 'Tab'.

Memory Display

Only the 'Bytes' display works. You cannot edit memory, and select & copy also does not yet work.
The text widgets provided by Qt did not meet my needs so i have written my own text widget. The drawback is, that i have to implement stuff like copy&paste by myself.

    ... Kio !

2012-11-05: I was ill this week and instead of having 5 free days to work on zxsp i had 5 days i couldn't do anything. :-/

October 19, 2012

zxsp 0.8.0.pre7

Timex Sinclair 1500 Keyboard
Timex Sinclair 1500 Keyboard









Changes in this version:
  • Fixed: crash if started by double clicking on a snapshot file
  • CPU: halt, step in, out, over
  • AY inspector: edit registers
  • enabled TS1000, TS1500, TK85, TK90X, TK95 and TC2048 for testing purpose
  • made a lot of new photos, mostly of the b&w machines
  • Fixed keyboard support for the new b&w models
  • Added joystick support for TK90X and TK95
The poll has now been reseted twice by Google (or who ever).  :-(
Despite this it is useful for me!

Request for help:

I am looking for images of
  • TK95 keyboard at 90° angle, high resolution
  • TK95 rear view at ~45°
I am looking for technical specs for
  • TK85: joystick, rom, AY sound chip
  • TK90X joystick, wait cycles, known incompatibilities 
  • TK95 joystick, wait cycles, known incompatibilities


    ... Kio !

October 18, 2012

zxsp 0.8.0.pre6

Hello,

this is the start of some sporadic posts about my software projects. Featuring today: 

Space Invaders - animated game for ZX80
Currently i'm busy rewriting source from the latest public release for Qt. I switched to Qt 4 years ago but then suspended work because i worked on another project, my self-built cpu.
I switched to Qt because it has the better API and i don't have to bother with obj-c any more. I took the chance to do a redesign in order to separate model and view which will make the source better portable, if ever. Version 0.8.x marks the switch to Qt.
One major drawback comes with the use of Qt ( nothing comes for free :-/ ): I have to include a lot of Qt libraries which explodes the size of the binary. But on the other hand, hey, today even 10 or 20 MB take only a fraction of a minute to download...

The current state of zxsp is roughly like this:
  • ZX80, ZX81, Jupiter Ace, ZX Spectrum 48k, 128k, +2 and +2A emulation working flawless (i hope). 
  • load & save .z80 files
  • load & save other model-specific snapshot formats
  • read .tap and .tzx tape files
  • fast load standard tape blocks for ZX Spectrum models
  • misc. joystick interfaces, AY sound interfaces and Sinclair IF 2
  • USB Joystick support
  • Images of all machines and interfaces
  • virtual keyboards for all models
  • save gif snapshot and movies
Missing so far:
  • Debugger
  • Save to tape
  • Whatever was missing in 0.7.2
Not yet tested:
  • Audio input from standard microphone input
  • Audio output to speaker for models other than ZX Spectrum 
A new pre-version is ahead: 0.8.0pre6. I tried to fix some bugs in pre5.
What's new in 0.8.0pre6?
  • load ZX80 snapshot from .o or .80 file
  • load ZX81 snapshot from .p, .81 or .p81 file
  • Management of ToolWindows reworked
  • Re-organized source: Qt/, Mac/, Uni/
  • Splashscreen after start without snapshot  
  • reduced size (zip from ~15MB down to ~11MB)
I started this blog because this enables you to leave some feedback and because i have the faint memory that there is a possibility to make polls. Let's see...

    ... Kio !



October 7, 2012

zxsp 0.8.0.pre4


This version runs on Mac OS X 10.6 or later on Intel 64 bit.
Please send me bug reports!

New in this preview version:
  • Save snapshot back in: Save .sna, .z80, .o, .80, .p, .81, .scr and .rom.
  • Some improvements with the inspector windows handling. 
  • Display of "Machine image".
  • "Instant load" standard tape blocks for ZX80 and ZX81.

October 2, 2012

zxsp 0.8.0.pre2


This month i restarted work on zxsp.

Since i migrated to Qt actually 4 years ago i have some work to equal the state of the "native" OSX version. But it's worth it. Qt is a much better API.
The current state of zxsp is, that models are supported as in 0.7.2, debugger is missing and save snapshot and save tape file is not yet done again. Audio-in is also mostly missing.