Teaching the keyboard emulator cable new tricks !

1 post / 0 new
Last seen: 22 hours 53 min ago
Joined: Apr 1 2020 - 16:46
Posts: 806
Teaching the keyboard emulator cable new tricks !
Package icon Keyboard emulator files34.37 KB

Hi fans -


a few of you out there in the world actually have built my keyboard emulator cable (and use it), according to this plan:




... so I thought it's worthwhile to nudge you into beta testing my newest software for it, see the zip file attached.


This new keyboard emulator driver still only runs under DOS (I will soon try it under FreeDOS) but I have already put some scaffolding in to eventually port it to Linux. Actually, only three relatively simple functions would need to be written to make it compile and run under Linux. But I'm not there yet.


There are a few new features in this version:







The "upload" feature is new and it allows you to upload memory contents from the Apple-1 to the PC, via the keyboard emulator cable. No mods to the cable are needed for that. The speed is quite OK, ~ 1kByte/s, and it has a cyclic checksum. It can make .BIN (binary) and .APL ("Apple-1") files from the uploaded data. The binary is just that, a binary, and the .APL file is a Wozmon command file, which, when used with the F3/Download feature, can put the memory contents back into the Apple-1.


The "download" function also supports .TUR ("Turbotype") files and .BAS ("Basic") files. The difference is in the timing, which is detected from the filename extensions, so don't mess with these extensions. They also control various other things going on under the hood.


I've provided the following files in the zip:


AAPL30TH.TUR   30th anniversary program for the Apple-1

BASIC1.TUR     one version of BASIC

BASIC2.TUR     another version of BASIC

CODEBRK.TUR    Uncle Bernie's Codebreaker game

UPLOAD.APL     use attrib +r upload.apl to make it read only

HAMURABI.BAS   one of the first economy simulation games

CHKSUM.BAS     the BASIC interpreter checksummer

A1KB.C         the source file for MS C7.00

MAKEFILE       the make file for MS C7.00 - use 'nmake' command

A1KB.EXE       executable for DOS


The executable was provided for those who don't have the 32 years old MS C7.00 compiler. I would be interested if somebody can try to compile this for DOS using one of the other C compilers. IIRC, Borland C for DOS was put into the public domain, but I may be mistaken. Unlike most other Microsoft products, which in my own experience more often than not turned out to be crappy, and tend to drive the user nuts, because things don't work as expected, or are hidden, MS C7.00 is a perfectly fine compiler which never let me down. I built several commercially successful CAD programs with it, back in the day.


There are two versions of Apple BASIC (as written by Woz) in the .TUR format, which loads quickly, my famous 'Codebreaker' game, and my favorite BASIC game for the Apple-1, HAMURABI. I have massaged it a bit for better output formatting and shortend its verbosity so that it would load and run on a 8k machine. To load a BASIC program, first use F3 to download the BASIC interpreter, and then when it runs, use F3 again to download the BASIC program. This is very slow - because it has to be. BASIC takes a lot of time to ponder over each line entered, so we must wait long enough. I've set the timing such that it juuust works, except if it spits out an error message - no allowance was made for that, so you need to download clean programs without syntax errors. Because the first error message throws everything off track. I accepted this in lieu of increasing the delay after a CR in BASIC even further.


CHKSUM.BAS is a simple BASIC program which calculates the checksum of the BASIC interpreter. I once wrote this early in my Apple-1 career when the 'reliability mods' had not been invented yet, and the BASIC interpreter silently started to crumble away over a few hours. Now this little program is useful to identify which BASIC interpreter is loaded. BASIC1 has the checksum of 20222. BASIC2 has 19774. I've seen rumors that three Apple BASICs existed for the Apple-1, but I found only two. I don't know where are the key differences and which one came first.


I was not able to verify the reliability of the uploader on more than one notebook yet.  There is a constant UPLDIV in the source code, the smaller you make it, the slower (and more reliable) the upload process should work. But do not confuse error messages due to poor reliability with total failure, which happens if you invoke F4 without previously giving the Apple-1 a RESET to go to Wozmon. The uploader needs Wozmon to download the Apple-1 side upload driver first, and it assumes Wozmon is running and ready to accept commands.


This upload driver resides in the stack page which is sanitized first. So upload can be used even if the machine is crammed full with other software. This is the 'UPLOAD.APL' file.  Use the DOS command 'attrib +r UPLOAD.APL' to make it read only. This prevents it from being shown as a possible target file to place the uploaded data in. A safeguard against overwriting essential files. You can use the same command  for all the other .APL files, too.


There are a few other new features: the program now detects the printer port automatically, but you can override this with giving the hex address of the printer port to be used as a command line argument, just if something goes wrong. Both F3 and F4 now have a file menu feature which presents candidate file names to choose from. Either enter the number of the file name to use or a new file name. Everything sent to the Apple-1 now is shown on the screen of the PC.


Oh, and please tell me what you think about it and about any bugs you might find. I want to have this working perfectly before I start with the Linux port in earnest.


Enjoy !


- Uncle Bernie