This is a work post.
Down to the wire! And that's just how I like it. Normally I try to have my weekly duties done by end of day on Friday, but obviously this is end of day on Sunday, which is not Friday. When I got the GUI stuff caught back up to the point where I had it in the old project, I went on an improvement spree and made everything about a... a jillion times better than it was. I'm happy to report that everything I wasn't completely happy with in the old code is no longer a problem in the new code.
Attached to this post is the .jar file of the current build (with the source code inside it). As expected, it
looks about the same as the original build, but I can assure you that behind the scenes it's vastly different and vastly superior.
There is also an image attached to this post. I will be referring to it henceforth...
File MenuWhen you start the program, you'll just get a big gray box and a menu bar. There are two options under File: Load ROM and Exit, and they do about what you'd expect. You can select any Virtual Boy ROM file, and it will attempt to detect incorrect files.
Once a ROM is loaded, the meat and potatoes of the user interface are displayed. There are four main panels, described below.
Disassembler - Upper left
The disassembler pane displays the game program from the perspective of the CPU, where each line is one instruction. A translation module in the project converts the machine code to human-readable assembly for your human viewing pleasure. There are literally dozens of configuration options in this module (debugger/Disassembler.java), but for the moment none of them can be configured with the front-end. The settings provided will display instructions using standard V810 conventions.
The hilighted line is the current value of the CPU's program counter, which represents the instruction that will be executed next.
The Up and Down arrow keys will scroll the contents of the display one line at a time, and Page Up and Page Down will do so one "screen" at a time (the number of fully-visible lines). Additionally, the mouse scroll wheel can be used to navigate in this manner.
In contrast to most debuggers, there is no scroll bar in the disassembler. A scroll bar that covers an entire 32-bit memory range really isn't usable, since even small movements can skip hundreds of megabytes at a time. I decided to leave it out, since I can't find a good reason to put one in there.
In order to seek to a particular address, Ctrl+G will bring up a Goto prompt. By typing an address into this box and clicking Ok, the output of the disassembler will be repositioned to include the address you entered.
You can seek to the value of the program counter with Ctrl+P.
The second column of output is the binary data that contains the instructions' bits, and for most purposes isn't all that useful. You can toggle whether this bytes column is shown with Ctrl+H.
The F11 key is Single Step, which executes the instruction at PC, the hilighted line. Most CPU instructions are implemented and fully-functional, with the exception of floating-point and bit string instructions, as they require additional research before being implemented.
The F10 key is Step Over, which attempts to execute until the instruction immediately following the current instruction is reached. This is useful for skipping over function calls as well as breaking out of loops like the one very early on in the crt0 routine. In order to prevent endless loops from hanging the application, a limit of 20 megacycles is placed on this command, which will make it stop automatically after executing one second's worth of CPU cycles.
Hex Editor - Lower left
The Hex Editor pane displays memory values on the bus as the CPU would see them if it were to perform a read operation. This is useful for examining and editing the memory in use by the simulated Virtual Boy software.
By default, no byte is selected for editing. In this state, the Up and Down arrow keys will scroll the contents of the display one line at a time. Page Up and Page Down will always scroll by one "screen" of lines. The mouse scroll wheel can also be used to navigate.
By clicking any byte value with the mouse, it will be selected for editing. In this state, the arrow keys will move the cursor around as expected. At this point, typing any hex digit will begin composing a new byte value at the selected address. After the first digit is typed, the temporary staged value is only that low digit, but by typing a second digit, a full 8-bit value is written into memory and the cursor is advanced to the next byte. In order to commit an edit after only one digit, press the Enter key.
To de-select the selected byte value and return to the default state, press the Escape key.
Ctrl+G will present a Goto prompt where you can type an exact address to seek to. In addition to navigating to that location, the byte at the specified address will be selected for editing.
Registers - Right-hand side
Both of the right-hand panes are for CPU registers. The top pane contains the special "system regsiters", while the bottom pane contains the usual "program registers". Any register with a "+" next to its name can be expanded by clicking on it, revealing additional controls.
The value of each register, shown next to its name, is displayed in a flat text box and can be edited directly with the keyboard by clicking it and typing into it. The new value is stored into the register either when the text box loses focus or the Enter key is pressed. Although any value can be entered, certain bits of certain registers cannot be written and this will be reflected in the value that is immediately displayed after editing.
Certain system registers represent multiple values that are packed into a 32-bit unit. By expanding these registers, the individual fields can be inspected and edited. The I field in PSW, and both fields in ECR, are text boxes that can be typed in. The remaining fields are 1-bit flags that are controlled via text boxes.
Although TKCW has bit fields that are displayed in the expanded controls, the register is in fact read-only and the expansion controls cannot be interacted with.
All program registers have options for representing the value in different presentation formats. The available formats are Hex, Signed decimal, Unsigned decimal and Float. When a particular format is active on a program register, the value displayed is in that format and any values entered with the keyboard will be processed as that format.
Debug WritesLike I mentioned in last week's report, I set up the new back-end to support "debug" accesses for read and write operations. This is useful for the person doing the debugging, as it allows for test situations that aren't technically possible within the simulated software.
The debug accesses in use by the debugger are as follows:
ECR is read-only to emulated software, but can be changed in the debugger.
System register 31 provides the absolute value of the most recent value written to it, but the debugger can store any value.
Editing ROM data in the hex editor will update the backing memory, even though the simulated software cannot write to it.
Known IssuesWhat appears to be a long-standing bug in Java is creating a layout error intermittently with no known cause. If, after you select a ROM to load, the window goes white or otherwise doesn't display correctly, you'll need to close the program and try again. Hopefully I can find out how to work around this issue, or maybe someone else can help track it down. Or maybe my RAM is going bad and that has something to do with it...
Attach file:
vbemu_20180506.jar Size: 103.89 KB; Hits: 43
TheNewGuy.png (68.76 KB)