GEORGE WILEY'S EMULATOR HAD A SIGNIFICANT ENHANCEMENT IN THE INTERIM
I had downloaded the prior version of the RK-05 Emulator as the basis for my design for the Virtual 2315 Cartridge Facility. Sometime after I began to alter the code, with the goal of preserving the known debugged parts of the logic which remained valid for my purposes, I saw a major change to the github archive.
When I received my RK-05 Emulator kit and tested it, the RK-05 disk image files I had saved from the V1 archive were not detected. It was then that I found the switch to a new image file format, along with a new suffix for the files on the SD card. The hardware was slightly changed as well from the V1 boards.
As a consequence, I thought it wise to merge my code changes into the V2 source particularly as those changes related to changed hardware or discovered vulnerabilities.
FINDING ALL THE DIFFERENCES BETWEEN V1 AND V2 OF HIS CODE
I compared each FPGA and C code module to locate all the changed lines that represented his improvements to create version 2. I used a program called WinMerge that displayed the changes side by side, allowing me to understand what he altered and in most cases, why.
DETERMINING AND FITTING APPROPRIATE CHANGES INTO MY VERSION OF THE CODE
Some of the changes were in support of a more flexible 'swiss army knife' version of the RK-05 Emulator to work with more disk and DEC system types. As a result, he changed the file format for the virtual disk images on SD card and quite a bit of the internal logic, allowing more geometry and timing values to be stored with the virtual disk image files.
Since the 2310 drive in the IBM 1130 has only one very specific format and timing, I removed all that logic and hard coded my version to the desired values. Thus, I just needed to have a version of the disk image files that the C and FPGA code would accept. I therefore ignored all the changes related to the more flexible mission of the RK-05 Emulator.
One of the changes, for example, was to support cartridges with more physical sectors on them, increasing the size of the sector number from five to six bits. This percolated through the code base, but the 2315 cartridges used with the IBM 1130 have only one choice - eight sectors - and instead my code had shrunk the sector number to three bits. I stuck with that design choice and skipped George's changes.
A few changes related to his debugging and the ability of his emulator to act as a tester for either real RK-05 drives or another instance of the emulator in its normal mode. I didn't need a role like that so I had stripped most of the logic related to it. I could ignore those code changes from V1 to V2.
His logic to decode the written stream from the DEC computer in order to capture a newly written sector, or to read a sector from the virtual cartridge file properly, weren't useful. I had to almost totally rewrite the logic of these functions based on the substantial differences between RK-05 and 2310 disk drives and the data formats on the cartridge.
I did spot one change that appeared to close a vulnerability in his code related to the time when the sector number changes, since the SDRAM address for reading and writing is derived from the sector number. The code change altered the time to a couple of microseconds after the simulated sector pulse begins.
The IBM 1130 doesn't read or write until the end of the sector pulse, about 165 microseconds after its start. Thus my code doesn't have the vulnerability that the original emulator had. No change needed in my code.
CAREFUL SIMULATION OF THE RESULTING CODE TO ENSURE CORRECT OPERATION
I spent three days carefully simulating the FPGA code to ensure it still worked properly. My Virtual 2315 Cartridge Facility runs in two modes - real or virtual. The real mode is the primary way I intended it to be used. A slightly modified disk drive in an 1130 would be turned on with a physical cartridge inserted. The spinning drive would furnish some signals such as the File Ready, plus the sector and index pulses.
Moving the head in and out would occur on the real drive, with my logic tracking the movement to shadow the cylinder and sector under the real drive heads. However, all reading and writing operations would only take place between my design and the IBM 1130 controller logic. The real disk drive does not have the heads pressed down on the disk surface.
Because of the two modes, I simulated both ways for every function I was testing. This lengthened the testing time but was important to flag any change I made that impaired operation. With that complete now, I will move on to testing the C code running in the Raspberry Pi Pico that is part of the RK-05 Emulator hardware. This too had changes to retrofit from the V2 version of the code base, then testing to perform.