Downloader for uKenbak object (.out) files

94 views
Skip to first unread message

Tom C

unread,
Jul 14, 2019, 2:51:31 PM7/14/19
to uken...@googlegroups.com, altair...@googlegroups.com
I finally got my serial to USB module for my µKenbak wired up yesterday.  Works great, but I soon got tired of setting up parameters in RealTerm to download files.  So I wrote a Python 3 program to handle this.

It's called sendtokenbak, and designed to download .out files generated by my assembler using Mark's BitN+SET extension.

Since once the µKenbak is connected to a PC, the COM port will stay the same, I am using a parameters file instead of command line arguments to specify this. 
The com port and baud rate must be set up in a separate file in the same directory as the executable, named sendtokenbak.params and containing one line, e.g.

COM4,9600

where the first parameter is the virtual COM port name, and the second is the desired baud rate.

Run the program using:

sendtokenbak filename.out             where the .out file is the one produced by my assembler.

links:

After starting the program, hold down one of the keys 0-3 on the uKenbak and press SET, where the key corresponds to the baud rate in the params file: 0/1/2/3 are 4800/9600/19200/38400.  You should see "[0" sent from the uKenbak, then the contents of the .out file, followed by the calculated length and checksum which should match the ones sent back from the uKenbak.

Here is sample output from downloading my simon says game:

D:\tryout\kenbak>sendtokenbak simon_says.out
using comport = COM4  baud rate = 9600
[0
000,000,000,004,023,221,123,000,360,023,000,034,171,344,113,003,005,000,023,222,123,144,360,023,000,
354,021,000,364,021,364,021,354,033,000,023,001,224,170,126,357,154,042,211,113,001,344,051,000,024,
176,034,200,364,033,034,200,364,021,354,060,023,377,034,176,364,060,364,060,364,060,034,377,344,332,
023,021,360,024,001,324,017,224,171,036,357,023,000,034,377,034,170,364,042,034,200,364,033,364,033,
364,021,034,200,364,033,024,170,014,171,044,204,024,170,003,001,034,170,344,134,000,000,000,000,000,
000,000,000,000,000,000,000,023,000,034,170,364,042,034,174,023,144,034,172,024,377,043,241,023,222,
123,012,360,024,172,013,001,043,216,344,075,034,173,023,222,123,062,360,024,377,014,173,043,214,024,
173,014,174,043,075,024,173,034,200,364,033,034,200,034,377,024,170,014,171,044,312,024,170,003,001,
344,206,024,171,003,001,034,171,014,020,043,113,364,340,364,340,364,340,024,377,044,332,344,011,000,
023,360,034,176,364,060,023,017,034,176,364,060,354,340,060,060,060,060,060,060,060,060,060,060,060,
060,060,060,060,060,e

sent: len=255 (0xff), chksum=5 (0x05)

123456789ABCDEF] len=0xFF chk=0x5
done




Dave Bell

unread,
Jul 14, 2019, 4:08:18 PM7/14/19
to Tom C, Altair-Duino
Very nice, Tom! I’ll have to add that serial interface soon. This looks like a great tool  

Except when I read it as “send token back”!

Dave

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "Altair-Duino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altair-duino...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/altair-duino/38418267-2232-48c8-83e6-281c825f43eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom C

unread,
Jul 21, 2019, 8:30:15 PM7/21/19
to uken...@googlegroups.com
A new version (1.1) of my downloader has been posted to my website
The only change, is after finishing doing a download it now resets the baudrate in the downloader to 38400 (regardless of what is specified in the .params file), and starts to listen to the serial output of the Kenbak. In addition, any characters you type will be sent to the serial input of the Kenbak, except for CTRL-Z, which is used to terminate the program on your PC.  So it acts like a terminal program.

After the checksum message, it will say:
Done, listening to serial output at 38400 baud.
Press START key to run program.
Type Ctrl-Z to exit.

Before, I was downloading the program and then switching to a terminal program (RealTerm) to do any serial I/O, however doing so reset the Kenbak and wiped out my program if I forgot to save it to EEPROM first.  This avoids that.

You can also use the downloader as a standalone terminal program, by typing:

        sendtokenbak  -t

and it will pick up the COM port from the sendtokenbak.params file, but ignore the baud rate since it will always be set to 38400.

I have both the .exe and the .params file copied to my c:\bin folder, which is in my environment variable Path, so I can use the program in a Command Prompt from anywhere.

See the first message in the topic (shown below) for more information.   The Python source file (.py) also has program documentation at the beginning.

To unsubscribe from this group and stop receiving emails from it, send an email to altair...@googlegroups.com.
Message has been deleted
Message has been deleted

Frank Prindle

unread,
Jul 22, 2019, 7:51:58 AM7/22/19
to uKenbak-1
Whoops, your .exe link got de-linkized. Easy enough to type or copy/paste it though, which in retrospect would have worked even when the links were wrong.

On Sunday, July 21, 2019 at 11:29:27 PM UTC-4, Tom C wrote:
For the exe, select the whole URL, right click and do a Save Link As.

Tom C

unread,
Jul 22, 2019, 11:08:46 AM7/22/19
to uKenbak-1
fixed.

Frank Prindle

unread,
Jul 22, 2019, 1:20:49 PM7/22/19
to uKenbak-1
Hi Tom,
I know I'm being needy, but I'm not much of a Python programmer and apparently don't have the right Python standard installed, so perhaps you could consider adding this (hopefully simple) enhancement:

In your code where you do...
        bytes1 = bytes(line, 'utf-8')
        ser.write(bytes1)
would it be possible to split bytes1 roughly in half (or at 512 characters) and do two writes (one for each half) with a
0.1 second delay in between? This would only be necessary if the baud rate was 38400 and bytes1 is longer than
512 characters.

The reason I ask is because I'm accessing my µKenbak-1 via a bluetooth adapter which is
permanently set to 38400 baud (just as the one in the AltairDuino is permanently set to 9600),
and at that speed, full 256-byte downloads nearly
always fail over the bluetooth. The 100ms delay halfway through will give the sketch
time to drain the serial buffer before the second half hits. The delay will be barely
perceptible to everybody else without this issue, but will benefit 38400 baud
downloaders (like me) significantly.

This would be like editing the .out file to make it into 2 lines, and then sending it through TeraTerm with a 100ms.
per-line delay. Using TeraTerm with a per-character delay is unacceptable because the minimum delay is 15.6ms.
regardless of what you may ask for that is shorter than that (e.g.: 1ms), and that makes the download way too slow.

Tom C

unread,
Jul 22, 2019, 1:23:34 PM7/22/19
to uken...@googlegroups.com
I'll look into this tonight.  Otherwise is it working okay for you, for smaller files?  You've been my best tester so far, so I don't mind making it work for you.  I hope you get a chance to test the new assembler release (2.0) also, with escape characters (e.g. \n)  for DS and multi-byte DB's.

In order to compile the sendtokenbak.py file, you need version 3 of Python (I'm still using 3.6) plus you have to have pySerial downloaded and installed.

Frank Prindle

unread,
Jul 22, 2019, 1:42:16 PM7/22/19
to uKenbak-1
Yep, my SerialBlinkenLightsV21 (which is only 193 bytes, not 256) downloads just fine over the bluetooth at 38400.

Of course, since cmd is not a VT100 emulator (nor is PowerShell), it just displays a bunch of garbage when it runs :)

On Monday, July 22, 2019 at 1:23:34 PM UTC-4, Tom C wrote:
I'll look into this tonight.  Otherwise is it working okay for you, for smaller files?  You've been my best tester so far, so I don't mind making it work for you.

Tom C

unread,
Jul 22, 2019, 2:12:18 PM7/22/19
to uken...@googlegroups.com
I've thought about adding a terminal emulation.  I never had a VT100, but I did have an ADM-3A (which I modified to have lower case) which had cursor addressing etc.  I also had an ASR-33 Teletype connected to my original Kenbak, and have thought about doing an emulator for that, with simulated paper tape reader and punch controlled by the DC1-DC4 control characters.

Frank Prindle

unread,
Jul 22, 2019, 3:23:59 PM7/22/19
to uKenbak-1
I certainly don't think it's necessary to add a VT100 emulation (that'd be a real can-of-worms), but rather run it in a command console that provides a VT100 emulation. I've unsuccessfully tried to do this using the "screen" program under Ubuntu under Windows 10, but can't get the VT100 emulation working for some reason (though I had previously done it using cu). I also tried MobaXterm but was only able to get output (from the µKenbak via sendtokenbak -t) to work - keystrokes just wouldn't go through. In any case, it's not all that difficult to close the sendtokenbak window after download and reconnect TeraTerm.

If anyone knows of a windows command console that handles VT100 escape sequences, it would sound like a terribly useful capability.

Tom C

unread,
Jul 23, 2019, 1:57:09 AM7/23/19
to uKenbak-1
New version 1.2 ready to download.

Inserting a -p before the filename will cause the serial output to pause 100 ms (0.1 sec) after every 512 characters, or the number of characters specified after the p (no space between the p and the number).  You can also specify this number as the third parameter in the params file, e.g. COM4,9600,1000 and you don't need
to include the -p on the command line.

      sendtokenbak -p filename.out     or sendtokenbak -p1000 filename.out       or sendtokenbak filename.out      (with third parameter in sendtokenbak.params)

Same download links as before.

Frank Prindle

unread,
Jul 23, 2019, 9:04:51 AM7/23/19
to uKenbak-1
Works like a charm Tom! Thank you so much. I've wanted to do this to TeraTerm's Send file... code but I don't have (and never will have) the proper version of Visual Studio.
Reply all
Reply to author
Forward
0 new messages