A. 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: NOP
       PSW: 00000000  R1: 00000000  R9: 00000000   000002: NOP
       NZVC: 0 0 0 0  R2: 00000000  RA: 00000000   000004: NOP
                      R3: 00000000  RB: 00000000   000006: NOP
                      R4: 00000000  RC: 00000000   000008: NOP
                      R5: 00000000  RD: 00000000   00000A: NOP
                      R6: 00000000  RE: 00000000   00000C: NOP
                      R7: 00000000  RF: 00000000   00000E: NOP
    
     **HALTED**  r(run) s(step) q(quit) ?(help)
    

    Hawk emulators and low-level debuggers should offer a standard display of the CPU state. The entire display is shown above, with the parts of the display broken out below.

       /------------------CPU------------------\
       PC:  00000000
       PSW: 00000000
       NZVC: 0 0 0 0
    

    The upper left corner of the display should show the values of the program counter (PC) (see Section 1.3.2) and the processor-status word (PSW) (see Section 1.3.4.1) these should be displayed in hexadecimal. In addition, the 4-bit condition code field of the PSW (NZVC) should be displayed in binary.

    If any coprocessor is enabled, the coprocessor status word (COSTAT) (see Section 1.3.3). should be displayed in hexidecimal after a blank line below the condition codes. If the floating point unit is enabled and selected, the approximate values of the two floating point accumulators (A0 and A1) (see Section 15.1.3) should be displayed in decimal.

       /------------------CPU------------------\
                                    R8: 00000000
                      R1: 00000000  R9: 00000000
                      R2: 00000000  RA: 00000000
                      R3: 00000000  RB: 00000000
                      R4: 00000000  RC: 00000000
                      R5: 00000000  RD: 00000000
                      R6: 00000000  RE: 00000000
                      R7: 00000000  RF: 00000000
    

    The general purpose registers (see Section 1.3.1) r[0] through r[15] should occupy the center of the CPU display, in two columns. The register values should be shown in hexadecimal. The register labels R1 through RF also use hexidecimal.

                                                   /----MEMORY----\
                                                 -*000000: NOP
                                                   000002: NOP
                                                   000004: NOP
                                                   000006: NOP
                                                   000008: NOP
                                                   00000A: NOP
                                                   00000C: NOP
                                                   00000E: NOP
    

    The left column in the memory display shoul show the least significant 24 bits of the memory address, in hexidecimal. When the emultor is running, the memory window should always include the region of memory that includes the current instruction. The address containing the current instruction should be shown with either -> pointing to it or (as in the above example, -*. The asterisk *, if present, should mark a memory address that has been set as a breakpoint. The contents of memory may be displayed in two modes:

     HAWK EMULATOR                      01234567
       /------------------CPU------------------\   /----MEMORY----\
    

    When the the emulator or debugger is halted, hexadecimal input from the keyboard is accepted. If a nonzero value has been entered, this is displayed near the top center of the emulator display. This number is only used by emulator commands; when a command uses this number, it is set to zero.

     **HALTED**  r(run) s(step) q(quit) ?(help)
    

    Debugger and emulator displays should give the emulator or debugger mode at the bottom of the display, above any part of the window reserved for interacting with the emulated program. The two modes are RUNNING or **HALTED**, and a list of active commands should be shown after the mode.

    In running mode, the only command is control-C; this should halt the emulator or debugger. All other input should be directed to the running Hawk program.

    In halted mode, a short menu of active commands should be displayed after the mode indicator. If the set of active commands is too long to fit on one line, one of the commands in the list should be a help command that scrolls through other commands.

    All emulator commands are one letter each, possibly taking the hexidecimal number previously entered from the keyboard as a parameter.

    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 toggle between diassembly and hexadecimal display modes.

    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, clearing that number.

    + — 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.

    A.3. Running the Program

    s — execute a single instruction
    One instruction should be executed.

    n — execute until the next instruction
    Set a breakpoint at the next instruction after the current one and then start the processor running. This will do the same thing as s except when the next instruction is a call or branch, in which case execution will only stop when the called routine returns or when the branch is not taken.

    r — run the program
    Start the CPU running.

    p — set breakpoint and run
    Start the CPU running with the breakpoint set to the number most recently typed on the keyboard, clearing that number. If no number was entered from the keyboard, the breakpoint will be at location zero.

    i — execute one loop iteration
    Set the breakpoint to the current program counter and then start the CPU running.

    All commands that start the CPU running (n, r, p and i) should change the operating mode to running. The mode should change from running to halted when any of the following occurs:

    A.4. Entering Numbers from the Keyboard

    0-9 — digits
    a-f — extended digits
    A-F — alternative extended digits
    When the emulator or debugger is halted, entry of hexadecimal digits should modify the emulator or debugger's current number.

    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 should update the display of registers and memory contents every time the emulator or debugger enters halted mode. In addition, emulators should try to display the contents of registers more frequently. The z command uses the number most recently entered from the keyboard to set the interval between display updates, clearing that number. 1z gives an update after each instruction, slowing the execution significntly, 10000 will updates after 1000016 or 6553610 memory cycles, leading to a jerky display update.