Skip to content

Commit

Permalink
Create single-entry table of maximum bytes in tokenized .BA
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerb9 committed Jul 31, 2024
1 parent 3e1159d commit 05d66b2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions degenerate/lorem/REAME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Largest BASIC programs

To experimentally discover the size of the largest possible tokenized
BASIC program on a Model T computer, use a host computer to send a
program line-by-line over the serial port to be tokenized.

* On Tandy 200:
```BASIC
?fre(0)
19334
load "com:98n1enn"
```
* On UNIX host:
```bash
$ stty -F /dev/ttyUSB0 icanon ixon ixoff stop ^S start ^Q susp undef eof ^Z
$ stty -F /dev/ttyUSB0 onlcr icrnl -echo 19200 pass8 -cstopb
$ ./lorem.sh 19214 > /dev/ttyUSB0 && echo -n $'\cZ' >/dev/ttyUSB0
```

On a Tandy 200, with the default of 19334 bytes free, a BASIC program
of <= 19214 bytes works, but >= 19215 gives an `?OM Error`. It
seems **120 bytes** are needed to parse a line of BASIC.

Note that after loading such a program, commands like `?fre(0)` and
`clear` will die with an out of memory error. In fact, while the
program can be `RUN` after loading it over the serial port, even just
`SAVE`ing the program will cause it to fail to RUN with an `?OM Error`!

Running `CLEAR 136` (which frees 120 characters compared to the
default of 256) gives 19454 bytes free on a Tandy 200. The maximum
lorem BASIC program then becomes 19454 - 120 = 19334 bytes.

The maximum possible filesize can be achieved by running `CLEAR 0`,
which on the Tandy 200 gives 19590 bytes free. Again, the maximum
lorem BASIC program I'm able to transmit is 19590 - 120 = 19470 bytes.
Of course, with zero bytes of string space reserved, no useful program
can be run.

| Model | Max Bytes Free | Max tokenized BASIC filesize |
|-----------|----------------|------------------------------|
| Model 100 | | |
| Tandy 200 | 19,588 | 19,470 |
| Tandy 102 | | |

0 comments on commit 05d66b2

Please sign in to comment.