## Thursday, January 19, 2017

### Building a 68000 Single Board Computer - Tiny Basic

Tiny BASIC is a dialect of the BASIC programming language that was originally written by Dennis Allison for early microcomputers including 6502 systems like the KIM-1. It could fit into as little as two or three kilobytes of memory. I earlier blogged about running the 6502 version on my Replica 1 computer.

Tiny Basic spawned a newsletter called Dr. Dobb's Journal of Tiny BASIC Calisthenics and Orthodontia, which evolved into the magazine Dr. Dobb's Journal. In 1985, the 100th issue of Dr. Dobb's Journal published an article by Gordon Brandly describing a Tiny Basic interpreter he had written for the Motorola 68000 microprocessor.

I came across this and thought I would try porting it to my TS2 computer. It turns out that no porting is needed, as it was designed to run on the Motorola MEX68KECB Educational Computer Board, which the TS2 is compatible with. I simply loaded the Motorola S record file and it came up on the console:

TUTOR  1.3 > GO 900

Gordo's MC68000 Tiny BASIC, v1.2

OK
>

The supported Basic keywords are BYE, CALL, FOR, GOSUB, GOTO, IF, INPUT, LET, LIST, LOAD, NEW, NEXT, PEEK, POKE, PRINT, READ, REM, RETURN, RUN, SAVE, STEP, STOP, AND TO. It is quite a limited version of Basic (it is only about 3K in size!), but some programs have been developed for or ported to it. One that comes with the Tiny Basic distribution is a version of the classic Star Trek game. Here is a transcript of a portion of a game:

> RUN
Do you want a difficult game?  (Y or N): N
Stardate 3200:  Your mission is to destroy 5 Klingons in 30 stardates.
There are 3 starbases.
Enterprise in Q-75 S-31
Captain: HELP
R=Report       S=SR. sensor   L=LR. sensor
G=Galaxy map   P=Phaser       T=Torpedo
W=Warp engine  * Please use one of these commands *
Captain: R
Status report:
Stardate      3200
Time Left     30
Condition     Green
Position      Q-75 S-31
Energy        4000
Torpedoes     10
Klingons left  5
Starbases     3
Captain: G
Enterprise in Q-75 S-31
Computer display of galaxy map

1:   0   0   0   0   0   0   0   0

2:   0   0   0   0   0   0   0   0

3:   0   0   0   0   0   0   0   0

4:   0   0   0   0   0   0   0   0

5:   0   0   0   0   0   0   0   0

6:   0   0   0   0   0   0   0   0

7:   0   0   0   0   0   0   0   0

8:   0   0   0   0   0   0   0   0
..  ..  ..  ..  ..  ..  ..  ..
1   2   3   4   5   6   7   8

Captain: S
Enterprise in Q-75 S-31
Short range sensor
1 . . . . . . . .
2 . . . . . . . .
3 E . . . . . . .
4 . . . . . . . .
5 . . . . . . . .
6 . . . . . . . .
7 . . . . . . . .
8 . . . . . . . *
1 2 3 4 5 6 7 8
Captain: L
Enterprise in Q-75 S-31
Long range sensor
1   7   7
1   1   1
101   5   1
Captain: W
Captain: W
Warp engine
Sector distance: 10
Course (0-360): 180
Enterprise in Q-84 S-61
Klingon attack
218 units hit from Klingon at S-63
160 units hit from Klingon at S-51
143 units hit from Klingon at S-21
124 units hit from Klingon at S-12
3305 units of energy left.
Captain: S
Enterprise in Q-84 S-61
Short range sensor
1 . K . . . . . *
2 K . . . . . . .
3 . . . . . . . .
4 . . . . . . . .
5 K . . . . . . .
6 E . K . . . . .
7 . . . . . . . .
8 * . . . . . . .
1 2 3 4 5 6 7 8
Captain: W
Warp engine
Sector distance: 1
Course (0-360): 0
**EMERGENCY STOP**
Spock: "To err is Human."
Enterprise in Q-84 S-61
Klingon attack
242 units hit from Klingon at S-63
172 units hit from Klingon at S-51
189 units hit from Klingon at S-21
83 units hit from Klingon at S-12
2619 units of energy left.
Shield damaged, 4 stardates estimated for repair
Captain: S
Enterprise in Q-84 S-61
Short range sensor
1 . K . . . . . *
2 K . . . . . . .
3 . . . . . . . .
4 . . . . . . . .
5 K . . . . . . .
6 E . K . . . . .
7 . . . . . . . .
8 * . . . . . . .
1 2 3 4 5 6 7 8
Captain:

The article about Tiny Basic was also published in a book: Dr. Dobb's Toolbook of 68000 Programming. I'll have to see if I can find a copy of this.