Skip to content

Development Diary

Marcel van Tongeren edited this page Dec 1, 2023 · 5 revisions

September 23rd, 2023

The High Speed Direct Connect project was triggered by Hank (Riley) when he asked (on the COSMAC ELF Group) if there was any bit-bang serial port software available for the COMX 35. I (Marcel van Tongeren) replied: Sorry, not that I know of.

Of course we have the SuperBoard which is much more than just a COMX <-> PC interface, Hank was looking for a very simple solution.

September 24th

I started to consider writing and/or porting some bit-bang routines for the COMiX!

The initial thought was to create HW including FW which could be accessed by CALL commands. However I expected all COMiX users to have the possibility to replace the COMX System ROM and as such I decided to try and replace the COMX cassette routines (PLOAD, PSAVE, DLOAD, DSAVE) with bit-bang routines. This of course directly forced us to look for routines that were optimised for size.

September 25th-26th

I ported the RCA BASIC3 PLOAD bit-bang routines to the COMX and got them running on Emma 02 via CALL statements. This solution was able to load RCA BASIC3 .pload files.

September 27th

I ported the VIP2K files to the COMX because the BASIC3 routines only supported 7 bit text files. VIP2K routines supported 8 bit and as such I deemed these easier to use for .comx file support.

September 28th-29th

Andrew (Wasson) joined us as tester on COMiX HW!

Chuck (The Eagle) provided his routines, which I ported and tested on the Emma 02 COMX emulator. Chuck's routines looked very promising, especially for supporting multiple CPU speeds and baud rates. Disadvantage was the larger size of these routines which meant they would be difficult to fit into the COMX System ROM.

Hank suggested to use Lee's binary load bit-bang routine as described here on Herb's site. I hesitated about these as I had just gotten Chuck's routines working.

September 30th

Tony (Hefner) provided input about his formats which were also very interesting, but I decided to stick with .comx format to keep compatibility with my already existing COMX routines in Emma 02 and the SuperBoard.

I concluded that Chuck's routines unfortunately would not fit into the available COMX System ROM space. Due to this I moved to Lee's more compact load routine. I ported the routines and tested on the Emma 02 COMX emulator.

Test ROM V1.00 made available which included a PLOAD routine for loading .pload files using 9600 baud.

October 2nd

Test ROM V1.01 made available adding an option to load .comx files.

We never got these working on real HW we suspected that it was due to a need to reverse EF.

October 3rd

Test ROM V1.02 made available one using 1200 and one using 9600 baud, both with reversed EF.

October 4th

Andrew managed to load multiple programs on a real COMiX using 1200 baud! The reversal of EF was indeed one of the main issues.

Nothing loads correct on 9600 baud, suspicion is that the code between Lee's byte load routines takes too much time.

Test ROM V1.03 made available with optimisation in the code so that less time was executed in between the core byte load routines. In this solution I don't use SCRT to call the core byte load routine but use RA to point to the byte load routine and call it with SEP RA.

October 5th

Andrew tested V1.03 PLOAD which worked on 1200 and 4800 baud, 9600 baud doesn't load anything.

Test ROM V1.04 made available with additional optimisation, removing some left over checks from the original cassette PLOAD routine (memory full check). I also optimised a bit more for speed and repeated some code for PLOAD and DLOAD (DLOAD was working on Emma 02 but not tested on a real COMiX).

October 7th-8th

Test ROM V1.05 made available including PSAVE code.

Andrew managed to load a small file on 9600 only once. PSAVE didn't work at all. At this time we have no idea why 9600 baud or PSAVE don't work.

October 9th-10th

Test ROM V1.06 made available with an even more optimised PLOAD routine. I did this optimisation so that between checking the value of incoming bits as well as between bytes a maximum of 18 instructions is executed. Detecting length and BASIC parameter info is handled in between the SEP RA calls.

Unfortunately this version didn't load anything on the real COMiX and just came back with ERR CODE 57.

October 11th

Test ROM V1.07 made available with some changes I thought might help but it didn’t work.

October 12th

Plan is to move Emma 02 testing to windows so we can connect the same terminal SW (TeraTerm) that Andrew is using to see if that gives the same problems as on the real COMiX.

In the meantime Andrew confirmed that PLOAD with ML .comx files also works (on 4800 baud).

October 13th-14th

Initially it looked like the Emma 02 setup with PC terminal SW behaved the same as the real COMiX setup, however this was not the case. At this stage I felt it was getting difficult to get 9600 baud working.

As another 'long shot' I decided to reduce the delay with two instructions. This was based on sometimes seeing that delay when using auto baud routines. For this Test ROM V1.08 made available.

October 15th

We finally got PLOAD on 9600 baud working, the delay reduction paid off!

PSAVE still came back with strange results and we could make no sense of the data received on the PC. I think at some stage Andrew mentioned that we should maybe reverse Q. Stupidly I just dismissed that as on Emma 02 I was not using a reversed Q.

We also started discussing if it would be good to add an auto baud routine so we could handle different CPU speeds (PAL, NTSC, COMiX, COMX, turbo mode etc.).

October 16th-17th

Instead of guessing the delay timing Hank rightly pointed out that calculating it was a better approach. This was done for V1.09. At the same time I got the feeling that the data received on the PC looked almost inverted. Not exactly but every low byte value came over as high and every high value byte was received as low. So next to the calculated delay I added a version with reversed Q as Andrew had already suggested a few days earlier.

YES! Andrew got PSAVE working and on 9600 baud!

We did still have some issues:

  • PSAVE was indeed running on 9600 baud but PLOAD was for some unknown reason much slower
  • The COMiX wasn't scrolling normally anymore

October 18th-19th

I had seen the same scrolling issue on Emma 02 but had put it down to a bug in Emma 02. This was however not the case, due to the Q reversal the COMiX was starting in PAL mode. Or in other words the NTSC/PAL detection wasn't working anymore.

The original COMX System ROM has the following logic:

  • A check is done on EF2 and based on the EF value, NTSC or PAL mode is selected
  • Right after that a Q pulse is done as follows Q=0, Q=1, Q=0
  • The COMX HW then start DRAM DMA refresh and both the COMX and COMiX HW activates keyboard repeat function on EF2

The Q reversal cause the last step to be done directly on startup and as such the EF2 check would always detect PAL.

Test ROM V1.10 fixed this by hard coding NTSC mode. At this time we decided to make multiple ROMs, i.e., one for PAL and one for NTSC.

October 20th-22nd

We figured out that TeraTerm and other terminal SW was adding delays between sending bytes. When we set that delay to 0 ms we got PLOAD to execute on 9600 baud. Due to the earlier optimisation I did in the PLOAD code it actually worked with a 0 ms delay. If I’m correct most existing routines demand a 5 ms delay as the SCRT call adds too many instructions which slows down loading quite a bit.

As it started to look like we were getting to the end of this project we discussed the welcome message on startup. You can see the result yourselves!

We also still had the idea to add an auto baud and with that maybe support for COMiX turbo mode. In theory with a 6 MHz CPU we should be able to get baud rate up to 19200.

I provided Test ROM V1.11 with option to patch delay values manually with POKE commands.

October 23rd

My wife and I were on our way to London for a 5 day trip when Andrew reported that Turbo mode (with a 6 MHz CPU) worked perfectly both on 9600 and 19200 baud!

At this stage I was quite proud that in one month we had reached this milestone. We managed to load and save 20K files over a serial cable in 10 seconds! Note that time spend on this project on a daily basis was probably only about 1 hour each. At least with work and family commitments I don't normally spend much more than that on Emma 02 or 1802 projects.

October 28th

Test ROM V1.12 with the BAUD command and also a small a addition to show the execution address when loading ML only .comx files.

I tried to use an improved auto baud routine, instead of just detecting the delay for one bit I detect the delay for two bits. Then I shift the result one bit to the right (divide by 2) to get the average delay value.

For the core load routine I also use half of the detected delay at the start of the routine. This to 'check' every bit somewhere in the middle of the bit. We noticed that with a delay factor of 5, which shifted 1 bit right giving a half delay factor of 2, the COMiX load wouldn't work. To resolve this inaccuracy I always round up using half a delay factor of 3 instead of 2.

October 29th-30th

Test ROM V1.13 fixing an issue with handling of the BAUD command. Using it in a BASIC program caused errors in LIST. I guess there is no use to put a BAUD command in a BASIC program but of course I fixed it anyway.

Andrew tested BAUD on a real COMiX, confirming it indeed detected the right delay factors for:

  • Standard Clock 2.8224 MHz / 9600 baud
  • Turbo 6.0 MHz / 9600 baud
  • Turbo 6.0 MHz / 19200 baud

November 1st-2nd

Early November I was getting close to finalising the FW. As I had some space left I decided to look at what COMX ROM bugs I had fixed in the SB FW and could port to the HSDC FW. I managed the following bug fixes:

  • Shape of #: top horizontal line 1 line lower
  • Shape of &: 1 line up
  • Crash fixed when 65535 (or higher) line number is used
  • Crash fixed when typing READ x when no DATA statement is available in the loaded BASIC program
  • Crash fixed when EDIT x was used where x was not an integer value like EDIT (10

I also found a bug in the PLOAD causing problems loading some specific SW. This bug was in the code since the start but would only happen on .comx files that were originally loaded from floppy disk. All SW recovered from tapes did work. My mistake as I had kept the PLOAD BASIC 'parameter setting routine' (for DEFUS and EOP) as was in the cassette PLOAD. However those routines assume that the DEFUS value is always stored on 0x4400 (or in the first actual data byte). That is however not (always) the case for files loaded from floppy disk.

Test ROM V1.14 fixed this issue.

November 3rd-7th

I had DLOAD/DSAVE working for a while but the implementation wasn’t compatible with the SuperBoard or Emma 02 .comx format. Probably not the most important but I thought it would be better to try and make them compatible. This took a few versions but in the end I managed to do this without the need to update the SB FW. New Emma 02 and SB PC SW is needed.

Final version was Test ROM V1.17.

Final released firmware is available here.

Disassembly showing code differences compared to COMX BASIC B1.03 can be found here: comix.1.04_hsdc.1.00.asm

November 17th

Andrew received and build the adapter board today! See below for some pictures.

HSDC Build HSDC Adapter Red HSDC Adapter COMiX and HSDC Adapter

December 1st

Wiki 'ready' and release message published to COSMAC ELF Group

Clone this wiki locally