A little script to help transfer code under linux

General discussions related to the Altair 8800 Clone

A little script to help transfer code under linux

Postby pngwen » July 27th, 2016, 11:55 am

I have been building a nice little tape library for my students to play with and transferring code under linux has been giving me fits. My laptop *really* does not like going at 110 baud. It works fine at 300, but some larger 8k BASIC programs still outstrip the interpreter. After about 100 lines it tends to get out of sync.

So to that end, I wrote a little script which I call "slowcat" which makes it a snap to transfer BASIC code (and Assembly source for MITS Programming Package) to my altair. My setup starts with minicom running at 9600 baud. (For BASIC or MITS I set the serial port to 7S1: 7 bits, space parity, 1 stop bit). Then I also have the following script, which I call "slowcat"

Code: Select all
#!/bin/bash
#slowcat script for transmitting code

IFS=$'\n'
for line in `cat $1`
do
  echo -n -e "$line\r\n"
  sleep 0.25
done


There isn't much to it, basically it just reads in the file specified on the command line, echos the line with CRLF at the end, and then it pauses for 1/4 of a second before going on to the next line. This gives BASIC plenty of time to digest the line, even when transmitting at 9600 baud.

To use the script, just redirect the output to your serial port. On my laptop this is at /dev/ttyUSB0. For example a full session for me works like this:
  1. Launch minicom with my 9600 7S1 setup
  2. Load 8k BASIC from tape.
  3. Launch a second window (either another term or screen, tmux, etc.)
  4. Use slowcat to send the code to the altair.

For instance, suppose I wanted to send the terribly addictive game wumpus4k.bas to /dev/ttyUSB0. I would type:
Code: Select all
slowcat wumpus4k.bas > /dev/ttyUSB0

(assuming you put slowcat somewhere on your path of course!)

While that runs, you'll see the code echo out on your minicom session. Once it completes, you can run it, save it to tape, and do antyhing else you want. Best of all, you don't have to leave the comfort of 9600 baud!

So that's my first little code contribution. I hope you find the information useful. I think I'll soon be uploading some altair code for you to play with.
pngwen
 
Posts: 14
Joined: July 7th, 2016, 9:57 am

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 10 guests

cron