Friday, February 21, 2025

Review of code for Pico in Virtual 2315 Cartridge Facility and preparation of testbench for it

COMPARING V1 AND V2 OF PICO CODE TO DETERMINE DIFFERENCES

I used WinMerge to check the code from both the original and latest versions of George Wiley's RK-05 Emulator on github. I found changes in

  • RK05_emulator_V00.cpp (main program)
  • disk_definitions.h
  • emulator_command.cpp
  • emulator_hardware.cpp
  • emulator_hardware.h
  • emulator_state.cpp
  • microsd_file_ops.cpp
  • _software_licenses.txt to be included with derived products

These mainly involve two areas - a new format for the files used on the MicroSD card and changes to the tester and debugging interfaces. There is also the addition of the explicit file describing the MIT license granted by the maker of the SSD1306.C and SSD1306.H code that was included in George's emulator and thus in my design. 

REQUIREMENT TO ADJUST MY CODE BASED ON THOSE CHANGES

My design does not have a tester mode, unlike the RK-05 Emulator which can connect one unit to another so that the tester unit drives the tested unit through its paces. There was also quite a bit of instrumentation such as serial log output and debugging signals that were included in George's design. I don't make any use of the debugging signals so the V2 code changes for these areas are irrelevant.

George developed an elegant flexible way of using his emulator with a variety of systems, supporting different disk formats, densities and other parameters. These were embedded in a header on each virtual cartridge file, but in V2 some of the parameters were communicated by two prefix words in each sector on the file. 

I had already substantially reworked the virtual cartridge file format and hardcoded the parameters that match the 2310 disk drive. Therefore I didn't make use of the information that supports flexible disk types, and considered the changes for this irrelevant.

The header designed by George contains a version number and a magic number, along with the various parameters being communicated. I created my own version number and modified the magic number. Because of this, I also changed the file suffix to be used on the microSD card. George used .rk05 in version 1 but switched to .rke for V2. 

I instead picked .dsk which is the type of suffix used with the IBM 1130 Simulator too, although the files are not directly compatible. One change in V2 was the addition of a Board Version in the file header, which specifies the minimum revision of the RK-05 Emulator hardware needed for this disk file. My design does not depend on the new board version (mainly because it supported the larger max sector count in V2), but I did include that field in the file header. 

Because of this, the changes to my Pico code were quite modest - interrogating the FPGA board number, handling the new field in the microSD card file headers, and a couple of minor message changes. 

TESTBED BEING READIED TO VALIDATE THE BEHAVIOR

I have a Pico and breakout board arriving this weekend which will allow me to hook up a microSD card reader and eventually a test driver Arduino. In this way, I can insert a card with a virtual cartridge image and validate that the Pico code correctly interprets it and sends the proper SPI transactions that the FPGA would need to load and unload that from SDRAM.

Further, I can test out the startup and shutdown logic which uses SPI messages to watch the state of the FPGA. When the Pico sees the Load/Unload switch activated, it mounts and reads the cartridge file. It transfers the contents down to the FPGA via over one million SPI messages. The Pico code will watch the state of the FPGA via SPI messages until it sees the File Ready signal turned on. 

Some of the lights on the emulator are driven by the Pico code, which interrogates the state of the FPGA for conditions like File Ready, seek active, read active or write active; others are set by the Pico code, such as Ready Only. I can drive these from Arduino and sample the LED output pins the same way. 

No comments:

Post a Comment