A. Hawk Emulator and Debugger Reference

Part of the Hawk Manual
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Contents

  • A.1. Display
  • A.2. Examining Memory Contents
  • A.3. Running the Program
  • A.4. Entering Numbers from the Keyboard
  • A.5. Other Commands

    A.1. Display

     HAWK EMULATOR                      01234567
       /------------------CPU------------------\   /----MEMORY----\
       PC:  00000000                R8: 00000000 -*000000: #0000
       PSW: 00000000  R1: 00000000  R9: 00000000   000002: #0000
       NZVC: 0 0 0 0  R2: 00000000  RA: 00000000   000004: #0000
                      R3: 00000000  RB: 00000000   000006: #0000
                      R4: 00000000  RC: 00000000   000008: #0000
                      R5: 00000000  RD: 00000000   00000A: #0000
                      R6: 00000000  RE: 00000000   00000C: #0000
                      R7: 00000000  RF: 00000000   00000E: #0000
    
     **HALTED**  r(run) s(step) q(quit) ?(help)
    

    Hawk emulators and low-level debuggers should conform to a standard form for their display of the CPU state. This is shown above. In the upper left, the PC and PSW displays should give the contents of the program counter and processor status word, displayed in hexadecimal. The condition codes, N Z V and C, should be broken out and displayed in binary, as shown. R1 through RF (or R15) should be displayed in two columns, in hexadecimal, as shown, with an optional "current window" into memory to the right.

    The current memory window may be displayed in various modes, for example, as disassembled code, as hexadecimal text, or as ASCII text. In disassembled text, illegal instructions should be displayed in hexadecimal as halfwords extra 16 bits coming from the next successive 16 bit halfword in memory following the instruction itself.

    If current memory window includes a disassembly of a location marked by a breakpoint, a * should be placed in front of that location. If the current memory window contains a disassembly of the instruction pointed to by the program counter, a -> should be displayed in front of that location. (If the PC points to a breakpoint, -* may be displayed.)

    The number shown above the contents of R8 is the number most recently typed in from the keyboard. It is only displayed when the value is nonzero, and it is set to zero after the value is used.

    Debugger and emulator displays give a short menu of active commands at the bottom of the display. All versions of this menu displayed when the emulator or debugger is halted include the help command (question mark). This line also indicates whether the emulator or debugger is currently running or halted.
     

    A.2. Examining Memory Contents

    Hawk emulators and debuggers should support the following commands to control the memory display:

    t — toggle display mode
    This command toggles between memory display modes; at minimum, it should be possible to examine memory as a string of disassembled halfwords or as a hexadecimal dump of 32 bit integers with parallel decoding of those bytes that hold ASCII characters.

    m — display memory location
    The number most recently typed on the keyboard is used as a memory address to control the region of memory to be displayed.

    + — move the memory display window up.
    - — move the memory display window down.
    The memory display window is moved to a higher or lower memory location.
    As a rule, when the processor is stopped at a breakpoint or after a single step, if the memory display mode is set for disassembled code, the current memory display window should be moved so that it contains a disassembly of the next instruction to be executed.

    A.3. Running the Program

    s — execute one instruction
    One instruction should be executed, and the emulator display should be updated to reflect the resulting changes to the registers.

    n — execute the next instruction
    One instruction or function call (JSR, JSRS with a nonzero return address) should be executed, and the emulator display should be updated to reflect the resulting changes to the registers.

    r — run the program
    Start the CPU running. Execution should continue until execution restarts at location zero or until a break is signalled from the keyboard.

    p — set breakpoint and run
    Start the CPU running with the breakpoint set to the number most recently typed on the keyboard. Execution will continue until the program counter reaches the breakpoint or a break is signalled from the keyboard. If no number was entered from the keyboard, the breakpoint will be zero.

    i — execute one loop iteration
    Set the breakpoint to the current program counter and then start the CPU running. Execution will continue until the program counter equals the breakpoint or a break is signalled from the keyboard.

    A.4. Entering Numbers from the Keyboard

    0-9 — digits
    a-f — extended digits
    When the emulator or debugger is halted, entry of hexadecimal digits between A and F modifies the contents of the emulator or debugger's current number register. This register is only displayed when its contents are nonzero, so typing 00000000 will always erase the display of this register. The contents of this register may be used to set breakpoints, to display memory, or to set the rate of display update. When used for one of these purposes, this register is always set to zero.
     

    A.5. Other Commands

    ? — help
    Toggle through the sequence of emulator help messages.

    q — quit
    Exit the emulator or debugger and return to the host operating system.

    z — set the screen refresh interval.
    All Emulators and debuggers will update the display of registers and memory contents every time the system ceases executing instructions and begins executing commands. In addition, emulators and some debuggers will display the contents of registers more frequently. This command uses the number most recently entered from the keyboard to set the frequency with which the display is updated. Frequent update (after every instruction) will tremendously slow down the system, while updating the display infrequently results in a jerky display update.