The Debugger - Part I (English)

Let's start to see how the debugger works, in this part we will comment on each of the elements of the debugger and what its function is.

Before starting that all the development part in this first version is in a state let's say ALPHA. The debugger and the assembler will change substantially in later versions.

The Development Mode.

In order to enter the debugger we must first activate the development mode in the side panel.

Once we have activated the development mode, an icon with a blue hammer will appear in the upper control bar that will allow us to access the debugger. We can also access the debugger with the keyboard by pressing ALT+D (CMD+D in MacOs).

The debug panel.

Once we enter the debug panel at the top we'll see a series of controls that allow us to control the emulation.

  • Stop: Allows to stop the emulation.
  • Play: Resumes emulation.
  • Step: Advances the emulation one instruction.
  • Step over: Advances the emulation one instruction without entering the function calls.
  • Step T: Advances emulation one clock cycle.
  • 1: The emulation advances one line of the monitor.
  • 8: Advances the emulation 8 lines of the monitor.
  • F: Advances emulation one full frame of the monitor.
  • CPU: Displays the detailed processor window.
  • CPC (Only in Amstrad CPC): Displays information about CRTC and GateArray.
  • DIS: Opens a new disassembly window
  • MEM: Opens a new memory scan window
  • BRK: Shows the list of breakpoints.
  • >_: Shows the debugger terminal.
  • +: Opens a new monitor in an external window.
  • 1: Displays a single monitor in the main window.
  • 2: Displays two monitors above the main window.

Emulation Monitors

In the RVM debugger we can have up to two monitors in the main window each one showing a different view, for it we will have to click on the buttons in the upper right corner to choose between a monitor or two monitors on the main area.

With the '+' button we can open extra monitors in external windows.

Each one of these monitors allows to show the current state of the emulation according to the view that we have chosen in the bottom dropdown, according to the type of machine that we have selected we will have available one view or another.

Common views

All machines always have the following views available:

  • Last Frame: The last complete frame as seen on the monitor
  • Raster: A view that shows where the monitor is drawing the photo.
  • Raster & Previous: The last frame (in black and white) and superimposed, where the raster goes at the same time

Views for ZX Spectrum

In any model of ZX Spectrum, we have available the following options

  • ULA: How would be the immediate exit of the ULA. That is to say how would be the frame with the current configuration of the ULA and the state of the video memory.

  • ULA Attributes: The current state of the ula but showing only the attributes of each character, the colors of ink and paper are shown in each cell.

  • ULA Bitmap: The content of the video memory bitmap, each black pixel represents paper color and each white pixel represents ink color.

If the ZX Spectrum model has 128K all these views will be duplicated to see independently the screen stored in RAM5 and RAM7.

Views of the ZX-Uno

The ZXUno has several extra views to show the content of the video memory, either in RAM5 or in RAM7 by applying the "Radastan mode".

Views in the Amstrad CPC

The Amstrad CPC only have one extra view, the CRTC Immediate view that represents how the frame would look using the current crtc configuration.

This view is a bit special (and with a lot of bugs in this Beta) as it can be configured by pressing the options button.

Clicking on this button opens a dialog box in which we can choose if we want to see the "frame" from the values currently stored in the CRTC chip (With the CRTC option) or customize the view with the Custom option and show a portion of the memory with the specific width and height that we provide.

This is very useful for, for example, to debug routines that use double buffer.

Memory View (Hex Editor)

Clicking on the MEM button we can open hexadecimal views to see or modify the memory of the computer.

Once opened the hexadecimal view, we will see the following window

At the top the first thing we'll see is the drop-down menu on the left that allows us to choose the memory block we want to observe.

The available memory blocks change a lot from one machine to another, but as a general rule all machines have a common CPU block that represents the memory as it is observed by the Z80 at this time.

We must be careful with the CPU block if we have the machine in operation, since the memory blocks will be changing in real time, which can happen unexpected things, as a rule it would be logical to stop the machine before editing the memory.

Just to the right of this menu, we can indicate to rvm from which address inside the selected block we want to examine the memory.

Finally the last text box lets us specify how many bytes we want to see in this window.

The view is editable, both in the hexadecimal part and in the ASCII part simply putting the cursor and typing.

Disassembled view

By pressing the DIS button you can access one (or several) disassembly views.

The operation is very similar to the memory view, with the difference that the last text box does not indicate the length in bytes but in instructions, so if we put a 10 means disassemble 10 instructions from the current position.

IMPORTANT: Both in direction and length in the memory and disassembly view we can enter decimal, hexadecimal or binary numbers as follows:

  • Decimals: Write the number without any prefix
  • Hexadecimal: Write the hexadecimal number with any of the prefixes #, $, & or 0x. (EJ: #4000, $4000 and 0x4000 are valid hexadecimals)
  • Binary: Writing the number with one of the prefixes % or 0b.

The disassembly view is editable, if we put the cursor on any line we can modify the instruction with the assembler included in rvm. Useful to make small tests.

At the bottom of the hexadecimal or disassembled view, we have two buttons to change the size of the text, as well as a padlock to lock or unlock the edition of the ROM memory.

CPU View

Clicking on the CPU button we can see the state of the cpu

In this view we can see the state of all the registers, the content of the stack and a disassembly view of the current position of the PC register.

If we open a disassembly view from this window it will be automatically configured to the position of the PC register. However if we open a memory window it will be configured to the position pointed by the HL register.

The registers are editable, if the emulation is stopped.

CPC view (only in Amstrad CPC).

In the Amstrad CPC we can open an extra view by clicking on the CPC button

In this view we can see (and edit) the state of the CRTC and GATEARRAY chips.

In the lower part we will see the current state of the palette, clicking on each of the colors we can change them.

In this view there are a series of extra buttons that allow to advance the emulation a character, a line, a line of characters or a frame of the CRTC, that does not have to coincide necessarily with a line or frame of the monitor.

Retro virtual machine released this post 8 days early for patrons.   Become a patron
Tier Benefits
Recent Posts