Monday, October 17, 2022

Part 2a: Finding a better BASIC

After converting that Tiny BASIC Star Trek program to run on Heath Tiny BASIC (HTB as it is known), I realised that I was going to have a hard time with almost every program that I wanted to convert to HTB. In the Star Trek program there was about 68 USR() calls that I had to insert, and just reading the program is mentally exhausting. It took a lot of work to create the program in the first place.

As Tiny BASIC is only 16 bit integer math, it also limits what programs can be converted.

The limited functions of HTB :

Another disadvantage of HTB is that it uses two levels of interpretation to execute programs, and as a result the programs run very slowly. So slowly in fact that I thought my Star Trek program had crashed when it sometimes took 5 minutes! to set up the galaxy before the game starts. And that was after waiting 23 minutes to download the program off cassette. Plenty of coffee time.

What I really wanted was to be able to pick up any standard BASIC program and enter it with minimal conversion required. In particular I wanted to be able to key in programs out of the popular 101 BASIC Computer Games books.

This is the version of the 101 BASIC Computer Games book that I purchased from Digital Electronics Corporation (DEC) around 1977. 

There are newer versions of that book, that have been customised for specific dialects of BASIC for specific computers. An example is a version for the TRS-80, which I also have in my collection. When I look at all 101 programs in these books, there are hardly any programs that don't have arrays, strings, or floating point math, meaning that I can't use them without a lot of work.

What dialects of BASIC are out there for the 6800 CPU

Doing my internet research (or Google University for the poor), I found a few different 70's retro computers that had a version or versions of Microsoft BASIC written for them.


ALTAIR 680. Alternative CPU to the more popular ALTAIR 8800 designed a year earlier.

ALTAIR 680 Turnkey

SWTPc 6800

Besides creating the ETA-3400X pcb, I eventually plan to make a metal enclosure to fit my project in and try and make it look somewhat like the original ETA-3400, or possibly like one of the other vintage enclosures above. To that end the original ALTAIR 680 with all it's front panel switches is out of contention, but either of the other two may work as an alternate design to the original ETA-3400 enclosure, which just has a plain front panel.

Original ETA-3400

I discovered that Microsoft wrote three different version of BASIC for the ALTAIR 680.

  • 4K BASIC
  • 8K BASIC (resides in about 7.2K RAM)
  • EXTENDED BASIC (resides in about 10.2K RAM)
BASIC Functions in 4K and 8K BASIC:


EXTENDED BASIC has the following additional functions:

DELETE    LIST X-Y    ERASE    SWAP    TRON    TROFF
IF-THEN-ELSE    DEFINT    DEFSTR    DEFDBL    DEFSNG
CINT    CSNG    CDBL      MOD       EDIT X 

Variable types: STRINGS, INTEGER, SINGLE PRECISION, DOUBLE PRECISION

PEEK and POKE addresses can be an unsigned integer up to 65535

A note in APPENDIX E of the ALTAIR BASIC manual states that 8K BASIC runs about 40% faster than 4K BASIC.

Mike Douglas has a nice web site www.deramp.com where there is a lot of information on the ALTAIRs. He also does some excellent YouTube video's. I watched a lot of them to help me determine which version of BASIC I wanted to use. I also joined the AltairComputerClub groups.io to look for further information on the ALTAIR 680, however that site is more for the ALTAIR 8800.

At the time I could not find much about the BASIC on the SWTPc 6800 however I believe it is probably a variant of the ALTAIR 680 BASIC.

After looking at the function list for the three BASICs, I decided to go with 8K ALTAIR 680 BASIC as it included string commands and a lot of the BASIC programs in the 101 BASIC Games book needed that. Also I had plenty of room for 8K BASIC, possibly later I could fit it in high memory in ROM, although it was written to run in low memory RAM. I wasn't able to find EXTENDED BASIC to download and didn't think the extra functions were needed and the size might be a problem if I want to move it into ROM.

There was no disassembled version of  4K, 8K or EXTENDED ALTAIR 680 BASIC anywhere to be found on the www, and I did search hard. At best I found a partial disassembly of 4K ALTAIR 8800 BASIC here:

http://altairbasic.org/index2.html

And while this was a valuable resource, my 8080/Z80 machine programming skills are pretty weak. For that matter so are my 6800 programming skills. This was actually my first big 6800 program more than a few dozen bytes.

Any good programmers out there ?

Although I made the hardware and got that working for Tiny BASIC and the Fantom II monitor relocation, I thought porting ALTAIR 680 BASIC was a step beyond my skill level, and that if I did try it would take forever, possibly years. After all, it took three great programmers to write Microsoft BASIC initially, Bill Gates, Paul Allen and Monte Davidoff.

Another problem I quickly learned is that the ALTAIR 8800, ALTAIR 680 and SWTPc 6800 all used a 6850 ACIA chip to make reading the keyboard a lot easier. On the other hand the ETA-3400 used a bit banged PIA to read the keyboard, one bit a a time. Luckily for me the Fantom II monitor took care of that.

The other much bigger hurdle was that the Fantom II monitor used a lot of zero-page memory ($0000..$00FF) for it's own use, and ALTAIR 680 BASIC used that too. The ALTAIR 680 used a completely different and much smaller PROM monitor and I suspect the SWTPc did too as it's pretty much the same hardware configuration. The 680 BASIC was written to share the zero-page space with the ALTAIR PROM monitor, but the Fantom II monitor on the ETA-3400X wasn't even written then and not even being considered.

Anyway, hoping to put it out there for an experienced programmer to tackle, I thought I should first try and see if it was even feasible. If I could get it started and de-conflict the Fantom II monitor and 680 BASIC, then there should be some hope of it working. Once I got the basic concept started, then I could bribe palm-it-off convince someone else to see the light and take over.

I eventually downloaded a file called MITS.RAW.txt but I forgotten now where I got it now (It may have been from www.deramp.com but the files may have had a name change since then). As far as I could tell this was the 8K version that was on paper tape.

*NOTE TO SELF: if you had researched properly you would have found an 8K cassette version!*

This is a sample of what is contained in the text file:

ALTAIR BASIC for 6800 
May 20, 2002
MITS-RAW.BIN      
S11300000D7600F37E18F97E033C00004838002C7E
S113001000000000000000000000000000000000DC
S113002000000000000000000000000000000000CC
S113003000000000000000000000000000000000BC
S113004000000000000000000000000000000000AC
S1130050000000000000000000000000000000009C
S1130060000000000000000000000000000000008C
S1130070000000000000000000000000000000007C
S1130080000000000000000000000000000000006C
S1130090000000000000000000000000000000005C
S11300A0000000000000000000000000000000004C
S11300B00000000000000000000000000000007CC0
S11300C000C926037C00C8B6EA60813A240881206E
S11300D027ED803080D039FFEA607E03C70000003E
S11300E006060606060604FFFDFFFDFFFFFFFDFDF5
S11200F0FFFDFD00FDFFFDFDFDFFFDFFFF646053
S11300FFFD00000000000000000000000000804F21
S113010FC752007E18F90CD80E341490150414AA93
S113011F0D4C0E150E4016FC17DC12D21768181270
.
.
.
S11319B78141270FCE0D4CFF012DFF0131FF012F70
S11319C7CE18124FA70008DF7ADE822B058C1B1B6B
S11219D72BB1DF82967AD67BBD02F0BD0834D6E1
S11319E683D07B9682927ABD15E0CE1A52BD0879D1
S11319F6CE0879FF0113BD04E486BD9704CE050025
S1131A06DF057E033C57414E542053494E2D434F28
S1131A16532D54414E2D4154CE000D0A0C575249B4
S1131A265454454E20425920524943484152442079
S1131A36572E205745494C414E44AE0D0A00544595
S1131A46524D494E414C2057494454C800204259EE
S1131A5654455320465245C50D0A0D0A4D49545363
S1131A6620414C5441495220363830204241534992
S1131A76432056455253494F4E20312E312052456C
S1131A865620332EB20D0A434F50595249474854F3
S1131A962031393736204259204D49545320494E76
S1131AA643AE0D0A004D454D4F52592053495AC570
S1131AB600002049532049542052455455524E0D96
S1131AC620424551204F55540D2042524120494E43
S1121AD65441504520474554204E455854204311
S1131AE548415241435445520D20454E440D000092
S10F1AF5000000000000000000000000E1
S9

MITS.RAW.txt  file

After I learned how to read a few lines of this Motorolla SREC file, I then converted it to a .BIN file using MOT2BIN.EXE, a file I had with some EPROM software from decades ago. I checked random parts of the file to make sure it converted properly and it seemed OK.

Now how am I going to get this onto the ETA-3400X ? Any guesses ?...

No comments:

Post a Comment

Part 2o: The future of the ETA-3400X

You can find all the work I've done on the ETA-3400X and 8K ALTAIR 680 BASIC, except for the ETA-3400X Gerber files, on the ET-3400 grou...