Monday, October 31, 2022

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 groups.io site at:

https://groups.io/g/ET-3400/files/5.%20Projects/ETA-3400X and

https://groups.io/g/ET-3400/files/5.%20Projects/ALTAIR%20680%20BASIC%20for%20the%20ETA-3400X

You will need to become a member of the group to access the files.

The ever growing To-Do list:


  • Tidy up and create an assemble-able version of the source code.
  • Fix the errors on the pcb.
  • Complete more of the comments on the assembly source file, especially with the math sections.
  • Add the CSAVE and CLOAD commands to this version of ALTAIR 680 BASIC.
  • Add a command to jump into the monitor and return to BASIC similar to how Tiny BASIC works with the BYE and B command.
  • Build two enclosures for my ETA-3400X's and dress them up to look like the SWTPc 6800 and the ALTAIR 680 Turnkey enclosures.
  • Improve the serial communications speed by using XON/XOFF protocol or perhaps hardware handshaking if it's possible.
  • Make ETA-3400X pcbs available in complete kit, short form kit or blank pcb for other enthusiasts to build their own.
  • Complete and publish the parts list.
  • Place all this on my new guthub account when I learn how to use it properly.
  • See if the unused 64K of the RAM chip can be accessed through bank switching.
  • Burn the ALTAIR 680 BASIC machine code into high ROM to remove the step to download BASIC from the terminal. This will also require a memory transfer routine to move it into low RAM before running.

Other ETA-3400 retro projects in the works or under consideration

  • One other member of the ET-3400 group mentioned porting a version of the FORTH language and it should be possible on this ETA-3400X, although it may need a lot of patching to work with the Fantom II monitor just as ALTAIR 680 BASIC did.
  • One of the other ETA-3400 clones has a smaller 32K RAM chip, but only 4K is used, wasting 28K. I am currently working with another ET-3400 enthusiast on modifying this other board so it can utilise most of the memory and remap it so it can run ALTAIR 680 BASIC. This should leave about 24K for user programs which should still allow most of the 101 BASIC Computer Games and other important stuff to be run.

---end---

Part 2n: Super Star Trek

That's right, I can finally test out the Super Star Trek program. My older copy 101 BASIC Computer Games has the program under the title SPACWR possibly to avoid copyright infringement, but in later copies of that book under the title of Super Star Trek.

A scan of the title page from my original copy of 101 BASIC Computer Games.

I wasn't able to use the version out of my original 1978 copy of 101 BASIC Computer Games because it would take too long to type in, so I downloaded a very similar version.

I had to edit a lot of lines because they were too long.

10 REM SUPER STARTREK - MAY 16,1978 - REQUIRES 24K MEMORY
30 REM
40 REM ****        **** STAR TREK ****        ****
50 REM **** SIMULATION OF A MISSION OF THE STARSHIP ENTERPRISE,
60 REM **** AS SEEN ON THE STAR TREK TV SHOW.
70 REM **** ORIGIONAL PROGRAM BY MIKE MAYFIELD, MODIFIED VERSION
80 REM **** PUBLISHED IN DEC'S "101 BASIC GAMES", BY DAVE AHL.
90 REM **** MODIFICATIONS TO THE LATTER (PLUS DEBUGGING) BY BOB
100 REM *** LEEDOM - APRIL & DECEMBER 1974,
110 REM *** WITH A LITTLE HELP FROM HIS FRIENDS . . .
120 REM *** COMMENTS, EPITHETS, AND SUGGESTIONS SOLICITED --
130 REM *** SEND TO:  R. C. LEEDOM
140 REM ***           WESTINGHOUSE DEFENSE & ELECTRONICS SYSTEMS CNTR.
150 REM ***           BOX 746, M.S. 338
160 REM ***           BALTIMORE, MD  21203
170 REM ***
180 REM *** CONVERTED TO MICROSOFT 8 K BASIC 3/16/78 BY JOHN GORDERS
190 REM *** LINE NUMBERS FROM VERSION STREK7 OF 1/12/75 PRESERVED AS
200 REM *** MUCH AS POSSIBLE WHILE USING MULTIPLE STATEMENTS PER LINE
205 REM *** SOME LINES ARE LONGER THAN 72 CHARACTERS; THIS WAS DONE
210 REM *** BY USING "?" INSTEAD OF "PRINT" WHEN ENTERING LINES
215 REM ***
220 ?:?:?:?:?:?:?:?:?:?:?
221 ?"                                    ,------*------,"
222 ?"                    ,-------------   '---  ------'"
223 ?"                     '-------- --'      / /"
224 ?"                         ,---' '-------/ /--,"
225 ?"                          '----------------'":?
226 ?"                    THE USS ENTERPRISE --- NCC-1701"
227 ?:?:?:?:?

...

9040 G2$="ANTARES":GOTO9210
9050 G2$="RIGEL":GOTO9210
9060 G2$="PROCYON":GOTO9210
9070 G2$="VEGA":GOTO9210
9080 G2$="CANOPUS":GOTO9210
9090 G2$="ALTAIR":GOTO9210
9100 G2$="SAGITTARIUS":GOTO9210
9110 G2$="POLLUX":GOTO9210
9120 ONZ4GOTO9130,9140,9150,9160,9170,9180,9190,9200
9130 G2$="SIRIUS":GOTO9210
9140 G2$="DENEB":GOTO9210
9150 G2$="CAPELLA":GOTO9210
9160 G2$="BETELGEUSE":GOTO9210
9170 G2$="ALDEBARAN":GOTO9210
9180 G2$="REGULUS":GOTO9210
9190 G2$="ARCTURUS":GOTO9210
9200 G2$="SPICA"
9210 IFG5<>1THENONZ5GOTO9230,9240,9250,9260,9230,9240,9250,9260
9220 RETURN
9230 G2$=G2$+" I":RETURN
9240 G2$=G2$+" II":RETURN
9250 G2$=G2$+" III":RETURN
9260 G2$=G2$+" IV":RETURN

A extract from a full run...

RUN











                                    ,------*------,
                    ,-------------   '---  ------'
                     '-------- --'      / /
                         ,---' '-------/ /--,
                          '----------------'

                    THE USS ENTERPRISE --- NCC-1701





YOUR ORDERS ARE AS FOLLOWS:
     DESTROY THE 19 KLINGON WARSHIPS WHICH HAVE INVADED
   THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS
   ON STARDATE 3326   THIS GIVES YOU 26 DAYS.  THERE ARE
   4 STARBASES IN THE GALAXY FOR RESUPPLYING YOUR SHIP


YOUR MISSION BEGINS WITH YOUR STARSHIP LOCATED
IN THE GALACTIC QUADRANT, 'CANOPUS II'.

COMBAT AREA      CONDITION RED
   SHIELDS DANGEROUSLY LOW
---------------------------------
  *               *                     STARDATE           3300
                                        CONDITION          *RED*
                                        QUADRANT           5 , 2
                          *             SECTOR             6 , 7
                                        PHOTON TORPEDOES   10
      *                  <*>            TOTAL ENERGY       3000
                                        SHIELDS            0
     +K+                     +K+        KLINGONS REMAINING 19
---------------------------------
COMMAND? LRS
LONG RANGE SCAN FOR QUADRANT 5 , 2
-------------------
: 103 : 002 : 005 :
-------------------
: 003 : 204 : 008 :
-------------------
: 007 : 001 : 008 :
-------------------
COMMAND? SHE
ENERGY AVAILABLE = 3000 NUMBER OF UNITS TO SHIELDS? 1000
DEFLECTOR CONTROL ROOM REPORT:
  'SHIELDS NOW AT 1000 UNITS PER YOUR COMMAND.'
COMMAND? TOR
PHOTON TORPEDO COURSE (1-9)? 7.5
TORPEDO TRACK:
                7 , 8
                8 , 8
*** KLINGON DESTROYED ***
 132 UNIT HIT ON ENTERPRISE FROM SECTOR 8 , 2
      <SHIELDS DOWN TO 868 UNITS>
COMMAND? TOR
PHOTON TORPEDO COURSE (1-9)? 5.3
TORPEDO TRACK:
                6 , 6
                7 , 5
                7 , 4
                7 , 3
                8 , 2
*** KLINGON DESTROYED ***
COMMAND? SRS
---------------------------------
  *               *                     STARDATE           3300
                                        CONDITION          GREEN
                                        QUADRANT           5 , 2
                          *             SECTOR             6 , 7
                                        PHOTON TORPEDOES   8
      *                  <*>            TOTAL ENERGY       2864
                                        SHIELDS            868
                                        KLINGONS REMAINING 17
---------------------------------
COMMAND? NAV
COURSE (0-9)? 3
WARP FACTOR (0-8)? 1.5
WARP ENGINES SHUT DOWN AT SECTOR 5 , 7 DUE TO BAD NAVAGATION
---------------------------------
  *               *                     STARDATE           3301
                                        CONDITION          GREEN
                                        QUADRANT           5 , 2
                          *             SECTOR             5 , 7
                         <*>            PHOTON TORPEDOES   8
      *                                 TOTAL ENERGY       2842
                                        SHIELDS            868
                                        KLINGONS REMAINING 17
---------------------------------
COMMAND? NAV
COURSE (0-9)? 4
WARP FACTOR (0-8)? 1.5

NOW ENTERING VEGA I QUADRANT . . .

COMBAT AREA      CONDITION RED
---------------------------------
         <*>                  *         STARDATE           3302
  *                                     CONDITION          *RED*
                             +K+        QUADRANT           4 , 1
                                        SECTOR             1 , 3
                                        PHOTON TORPEDOES   8
                                        TOTAL ENERGY       2820
                                        SHIELDS            868
                          *             KLINGONS REMAINING 17
---------------------------------
COMMAND? TOR
PHOTON TORPEDO COURSE (1-9)? 8.6
TORPEDO TRACK:
                1 , 4
                2 , 5
                2 , 6
                3 , 7
                3 , 8
*** KLINGON DESTROYED ***
COMMAND? LRS
LONG RANGE SCAN FOR QUADRANT 4 , 1
-------------------
: *** : 002 : 307 :
-------------------
: *** : 003 : 002 :
-------------------
: *** : 003 : 004 :
-------------------
COMMAND? NAV
COURSE (0-9)? 1.5
WARP FACTOR (0-8)? 1.2
DAMAGE CONTROL REPORT:  SHIELD CONTROL STATE OF REPAIR IMPROVED


NOW ENTERING PROCYON II QUADRANT . . .

COMBAT AREA      CONDITION RED
---------------------------------
              *                         STARDATE           3303
                      *                 CONDITION          *RED*
         +K+                            QUADRANT           3 , 2
          *      <*>                    SECTOR             4 , 5
      *   *                             PHOTON TORPEDOES   7
          *                             TOTAL ENERGY       2798
                          *  +K+        SHIELDS            868
                     +K+                KLINGONS REMAINING 16
---------------------------------
COMMAND? PHA
PHASERS LOCKED ON TARGET;  ENERGY AVAILABLE = 1930 UNITS
NUMBER OF UNITS TO FIRE? 1000
 182 UNIT HIT ON KLINGON AT SECTOR 7 , 8
*** KLINGON DESTROYED ***
 336 UNIT HIT ON KLINGON AT SECTOR 3 , 3
*** KLINGON DESTROYED ***
 221 UNIT HIT ON KLINGON AT SECTOR 8 , 6
*** KLINGON DESTROYED ***
COMMAND? LRS
LONG RANGE SCAN FOR QUADRANT 3 , 2
-------------------
: 105 : 004 : 103 :
-------------------
: 002 : 007 : 008 :
-------------------
: 003 : 002 : 005 :
-------------------

...

COMMAND? COM
COMPUTER ACTIVE AND AWAITING COMMAND? 7

FUNCTIONS AVAILABLE FROM LIBRARY-COMPUTER:
   0 = CUMULATIVE GALACTIC RECORD
   1 = STATUS REPORT
   2 = PHOTON TORPEDO DATA
   3 = STARBASE NAV DATA
   4 = DIRECTION/DISTANCE CALCULATOR
   5 = GALAXY 'REGION NAME' MAP

COMPUTER ACTIVE AND AWAITING COMMAND? 5

                        THE GALAXY
       1     2     3     4     5     6     7     8
     ----- ----- ----- ----- ----- ----- ----- -----
 1         ANTARES                  SIRIUS
     ----- ----- ----- ----- ----- ----- ----- -----
 2          RIGEL                   DENEB
     ----- ----- ----- ----- ----- ----- ----- -----
 3         PROCYON                 CAPELLA
     ----- ----- ----- ----- ----- ----- ----- -----
 4           VEGA                 BETELGEUSE
     ----- ----- ----- ----- ----- ----- ----- -----
 5         CANOPUS                ALDEBARAN
     ----- ----- ----- ----- ----- ----- ----- -----
 6          ALTAIR                 REGULUS
     ----- ----- ----- ----- ----- ----- ----- -----
 7       SAGITTARIUS               ARCTURUS
     ----- ----- ----- ----- ----- ----- ----- -----
 8          POLLUX                  SPICA
     ----- ----- ----- ----- ----- ----- ----- -----

COMMAND? COM
COMPUTER ACTIVE AND AWAITING COMMAND? 0


        COMPUTER RECORD OF GALAXY FOR QUADRANT 1 , 4

       1     2     3     4     5     6     7     8
     ----- ----- ----- ----- ----- ----- ----- -----
 1    004   002   001   002   001   ***   ***   ***
     ----- ----- ----- ----- ----- ----- ----- -----
 2    005   004   003   003   201   ***   ***   ***
     ----- ----- ----- ----- ----- ----- ----- -----
 3    002   007   008   001   ***   ***   ***   ***
     ----- ----- ----- ----- ----- ----- ----- -----
 4    003   002   005   ***   ***   ***   ***   ***
     ----- ----- ----- ----- ----- ----- ----- -----
 5    003   004   008   ***   ***   ***   ***   ***
     ----- ----- ----- ----- ----- ----- ----- -----
 6    007   001   008   ***   ***   ***   ***   ***
     ----- ----- ----- ----- ----- ----- ----- -----
 7    ***   ***   ***   ***   ***   ***   ***   ***
     ----- ----- ----- ----- ----- ----- ----- -----
 8    ***   ***   ***   ***   ***   ***   ***   ***
     ----- ----- ----- ----- ----- ----- ----- -----

COMMAND? COM
COMPUTER ACTIVE AND AWAITING COMMAND? 1

   STATUS REPORT:
KLINGONS LEFT:  10
MISSION MUST BE COMPLETED IN 19.6 STARDATES
THE FEDERATION IS MAINTAINING 4 STARBASES IN THE GALAXY

DEVICE             STATE OF REPAIR
WARP ENGINES              0
SHORT RANGE SENSORS       .16
LONG RANGE SENSORS        0
PHASER CONTROL            0
PHOTON TUBES              0
DAMAGE CONTROL            0
SHIELD CONTROL            1.73
LIBRARY-COMPUTER          .59

...

COMMAND? LRA
ENTER ONE OF THE FOLLOWING:
  NAV  (TO SET COURSE)
  SRS  (FOR SHORT RANGE SENSOR SCAN)
  LRS  (FOR LONG RANGE SENSOR SCAN)
  PHA  (TO FIRE PHASERS)
  TOR  (TO FIRE PHOTON TORPEDOES)
  SHE  (TO RAISE OR LOWER SHIELDS)
  DAM  (FOR DAMAGE CONTROL REPORTS)
  COM  (TO CALL ON LIBRARY-COMPUTER)
  XXX  (TO RESIGN YOUR COMMAND)

COMMAND? LRS
LONG RANGE SCAN FOR QUADRANT 8 , 6
-------------------
: 002 : 006 : 007 :
-------------------
: 004 : 003 : 018 :
-------------------
: *** : *** : *** :
-------------------
COMMAND? SRS
---------------------------------
                                        STARDATE           3320.1
                                        CONDITION          GREEN
                                        QUADRANT           8 , 6
                                        SECTOR             8 , 7
              *                         PHOTON TORPEDOES   4
                              *         TOTAL ENERGY       1758
  *                                     SHIELDS            625
                         <*>            KLINGONS REMAINING 3
---------------------------------
COMMAND? NAV
COURSE (0-9)? 1.3
WARP FACTOR (0-8)? .6
DAMAGE CONTROL REPORT:  LONG RANGE SENSORS DAMAGED


NOW ENTERING SPICA III QUADRANT . . .

---------------------------------
                  *           *         STARDATE           3321.1
                                        CONDITION          GREEN
                          *             QUADRANT           8 , 7
              *                         SECTOR             6 , 4
  *                                     PHOTON TORPEDOES   4
             <*>                        TOTAL ENERGY       1743
  *   *                                 SHIELDS            625
  *                  >!<                KLINGONS REMAINING 3
---------------------------------
COMMAND? LRS
LONG RANGE SENSORS ARE INOPERABLE
COMMAND? NAV
COURSE (0-9)? 8
WARP FACTOR (0-8)? .2
WARP ENGINES SHUT DOWN AT SECTOR 7 , 5 DUE TO BAD NAVAGATION
SHIELDS DROPPED FOR DOCKING PURPOSES
---------------------------------
                  *           *         STARDATE           3321.3
                                        CONDITION          DOCKED
                          *             QUADRANT           8 , 7
              *                         SECTOR             7 , 5
  *                                     PHOTON TORPEDOES   10
                                        TOTAL ENERGY       3000
  *   *          <*>                    SHIELDS            0
  *                  >!<                KLINGONS REMAINING 3
---------------------------------
COMMAND? LRS
LONG RANGE SENSORS ARE INOPERABLE

...

COMMAND? COM
COMPUTER ACTIVE AND AWAITING COMMAND? 0


        COMPUTER RECORD OF GALAXY FOR QUADRANT 4 , 8

       1     2     3     4     5     6     7     8
     ----- ----- ----- ----- ----- ----- ----- -----
 1    004   002   001   002   001   001   002   004
     ----- ----- ----- ----- ----- ----- ----- -----
 2    005   004   003   003   001   004   006   002
     ----- ----- ----- ----- ----- ----- ----- -----
 3    002   007   008   001   004   007   007   006
     ----- ----- ----- ----- ----- ----- ----- -----
 4    003   002   005   001   002   003   014   006
     ----- ----- ----- ----- ----- ----- ----- -----
 5    003   004   008   003   003   007   006   003
     ----- ----- ----- ----- ----- ----- ----- -----
 6    007   001   008   002   005   007   005   006
     ----- ----- ----- ----- ----- ----- ----- -----
 7    ***   ***   006   005   002   006   007   002
     ----- ----- ----- ----- ----- ----- ----- -----
 8    ***   ***   ***   008   004   003   018   002
     ----- ----- ----- ----- ----- ----- ----- -----

COMMAND? NAV
COURSE (0-9)? 5.5
WARP FACTOR (0-8)? 6.5

NOW ENTERING SAGITTARIUS I QUADRANT . . .

---------------------------------
                                        STARDATE           3324.6
                                        CONDITION          GREEN
                                        QUADRANT           7 , 1
                                        SECTOR             5 , 7
                         <*>            PHOTON TORPEDOES   10
  *               *                     TOTAL ENERGY       2632
                                        SHIELDS            800
                                        KLINGONS REMAINING 2
---------------------------------
COMMAND? LRS
LONG RANGE SCAN FOR QUADRANT 7 , 1
-------------------
: *** : 007 : 001 :
-------------------
: *** : 002 : 207 :
-------------------
: *** : 006 : 007 :
-------------------
COMMAND? COM
COMPUTER ACTIVE AND AWAITING COMMAND? 1

   STATUS REPORT:
KLINGONS LEFT:  2
MISSION MUST BE COMPLETED IN 1.3 STARDATES
THE FEDERATION IS MAINTAINING 4 STARBASES IN THE GALAXY

DEVICE             STATE OF REPAIR
WARP ENGINES              .18
SHORT RANGE SENSORS       3.21
LONG RANGE SENSORS        0
PHASER CONTROL            0
PHOTON TUBES             -2.31
DAMAGE CONTROL            0
SHIELD CONTROL            1.73
LIBRARY-COMPUTER          .13

COMMAND? NAV
COURSE (0-9)? 1
WARP FACTOR (0-8)? .7
DAMAGE CONTROL REPORT:  LONG RANGE SENSORS STATE OF REPAIR IMPROVED


NOW ENTERING SAGITTARIUS II QUADRANT . . .

COMBAT AREA      CONDITION RED
---------------------------------
                  *           *         STARDATE           3325.6
          *       *                     CONDITION          *RED*
              *                         QUADRANT           7 , 2
 +K+     +K+                            SECTOR             5 , 5
      *          <*>                    PHOTON TORPEDOES   10
  *                                     TOTAL ENERGY       2616
                                        SHIELDS            800
                                        KLINGONS REMAINING 2
---------------------------------
COMMAND? TOR
PHOTON TUBES ARE NOT OPERATIONAL
COMMAND? PHA
PHASERS LOCKED ON TARGET;  ENERGY AVAILABLE = 1816 UNITS
NUMBER OF UNITS TO FIRE? 500
 144 UNIT HIT ON KLINGON AT SECTOR 4 , 1
   (SENSORS SHOW 98.4407 UNITS REMAINING)
 282 UNIT HIT ON KLINGON AT SECTOR 4 , 3
*** KLINGON DESTROYED ***
 63 UNIT HIT ON ENTERPRISE FROM SECTOR 4 , 1
      <SHIELDS DOWN TO 737 UNITS>
DAMAGE CONTROL REPORTS LIBRARY-COMPUTER DAMAGED BY THE HIT'
COMMAND? LRS
LONG RANGE SCAN FOR QUADRANT 7 , 2
-------------------
: 007 : 001 : 008 :
-------------------
: 002 : 107 : 006 :
-------------------
: 006 : 007 : 004 :
-------------------
COMMAND? SRS
---------------------------------
                  *           *         STARDATE           3325.6
          *       *                     CONDITION          *RED*
              *                         QUADRANT           7 , 2
 +K+                                    SECTOR             5 , 5
      *          <*>                    PHOTON TORPEDOES   10
  *                                     TOTAL ENERGY       2053
                                        SHIELDS            737
                                        KLINGONS REMAINING 1
---------------------------------
COMMAND? PHA
COMPUTER FAILURE HAMPERS ACCURACY
PHASERS LOCKED ON TARGET;  ENERGY AVAILABLE = 1316 UNITS
NUMBER OF UNITS TO FIRE? 200
 126 UNIT HIT ON KLINGON AT SECTOR 4 , 1
*** KLINGON DESTROYED ***
CONGRULATION, CAPTAIN!  THEN LAST KLINGON BATTLE CRUISER
MENACING THE FDERATION HAS BEEN DESTROYED.

YOUR EFFICIENCY RATING IS 550.083


THE FEDERATION IS IN NEED OF A NEW STARSHIP COMMANDER
FOR A SIMILAR MISSION -- IF THERE IS A VOLUNTEER,
LET HIM STEP FORWARD AND ENTER 'AYE'? NAY

OK

Next I discuss the future of the ETA-3400X...




Part 2m: What to do with all that Memory and 8K ALTAIR 680 BASIC?

In the end, I had 8K ALTAIR 680 BASIC taking up about 7.2K of low RAM, the Fantom II monitor using about 32 bytes of the top of RAM leaving about 41K for user program space, more than enough for almost any conceivable BASIC program and it's variables, arrays and strings.

Free memory is calculated as 65536-23986 or 41550 bytes.

101 BASIC Computer Games...

This is what I really wanted to try out. Yes, ALL 101 BASIC Computer Games. But I'm not about to type them in all by hand and then have no way to easily save them, remembering that I don't have any cassette routines in ALTAIR BASIC.

Internet to the rescue. Luckily after 4 decades and the advent of the internet, some people got bored and typed all those programs in for me. All I had to do was get them onto my ETA-3400X with BASIC running.

FTDI USB serial port

Since I couldn't find my real DB25F to DB25M serial cable and DB25M-DB25M adapter, and I had recently purchased a couple of cheap FTDI to USB serial adapters. It was a simple matter of trying to use that to connect my PC to the ETA-3400X using 3-wire serial connection.

All I had to do was remove a few jumpers on the ETA-3400X and connect the TXO on the FTDI adapter to PIA pin 9 and RXI on the FTDI adapter to the PIA pin 2, and the GND wire to any ETA-3400X signal ground. I was able to use those single pin dupont breadboard cables to do this without any soldering.

Low cost FTDI - USB serial adapter.

I installed Tera Term onto my PC, set the speed to 4800 baud, 8 data bits and 2 stop bits. I also set the baud rate jumpers on the ETA-3400X to 4800. I loaded the last saved version of ALTAIR 680 BASIC off the cassette which takes about 100 seconds. Now using the Fantom II monitor's Punch command I am able to send a Motorola S-REC file output of the BASIC ROM to the terminal port. 

MON> P 0000,1C00
S11300000D7600707E18F97E033C000D5046002CDE
S113001031302052454D2048454C4C4F20574F52CB
S11300204C4400FF0120BFFF0000F26E00300100CD
S11300303132330D0D00000000000000000000000C
S113004000000000000000000000000000000000AC
S11300500000000000000000222200FFFF0000005A
S113006000006500610B001AABFFEA607E03C70065
S113007080000000000000001BFD18F318F518F5BF
S113008018F51BFF3E7F00003E7FFFFF0000000AC3
S113009000000000000018F2009E8B0016FC7CFF9C
S11300A0BF00000000000000000000000000000B82
S11300B000006520000080000200001AAB1AB6039D
S11300C00030007E18FC1B0100FA001B001B001B03
S11300D000FB5826030000FEFF7E00000000000025
S11300E00000FC19FFFFFFFFFFFFFFFF031300E009
S11300F0C16F00CB1C00CEEEDEEEDEEEDEEEFF7C4A
.
.
.
S1131B00804FC7520000707E18F9847F7EF865000C
S1131B1003F878202008B00008FD1917000000FD24
S1131B2020303039393939000000000000804FC7B7
S1131B30520053A60028080101BD08AD0820E4396D
S1131B40FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA1
S1131B50F8FEDCDBFEFDEDDFFEDDEDC9D8FEFFD8CF
S1131B609FBC9DD8CEFBFBDACBDBCBEFFBFF8FDC3E
S1131B70FEDEBDFE0EDEFCFFEDCBFBF8FE1D8D9FF1
S1131B80FCFDCDEFFE9ED7DECCDFCBDEFFEDFCDB34
S1131B90EAFF7CCC9CDFFECE8DFFCFDE9EDFFEBF56
S1131BA0CFCEFEFBECDC88DE8BCFBCCEBFECDECE32
S1131BB0DAEF4FDFFBFBFDCC9DCCFCDE9FEFE8FEB4
S1131BC0AEDEDE9DCDEFDCFFDECFADCBDEDF9ECC27
S1131BD0FCDDC9DBBFEBFBAEEDEC8FEE8FFFCEAFD0
S1131BE0FFDBCDDBFE9F8DCECECFC8FDECDECFF884
S1131BF0A103F8A10320F8E40104220103F3191757
S1041C006877
S9
MON>

Punching the ROM out to the serial terminal port.

At 4800 baud with character delay of 0ms and line delay of 10ms this only takes 55 seconds. By using copy-paste I am able to copy this text and save it in a separate file and even add some header text to the file. This becomes the ALTAIR 680 BASIC ROM that will need to be loaded next time the ET-3400 and ETA-3400X is powered up.

To reload BASIC 680 from this file you use the Fantom II monitors Load from paper tape command which is just like the Load from cassette except that you use a parameter of 0. Then you copy the text out of the Motorola S-REC file and paste it into the terminal.

MON>L 0
S9041C006877F8A10320F8E40104220103F3191757
MON> R C=00 B=1B A=00 X=1B00 P=FB58 S=00D2 0F
MON>

Loading ALTAIR BASIC from the serial terminal port using L 0.

The 'S9' at the end of the S-REC file terminates the Load. To start ALTAIR 680 BASIC we just jump to address $0000 using MON>G 0 command then answer the BASIC questions. For maximum memory just hit <Enter> and BASIC will test RAM to find the top of RAM.

MON> G 0
MEMORY SIZE?
TERMINAL WIDTH? 80
WANT SIN-COS-TAN-ATN? Y

42156 BYTES FREE

MITS ALTAIR 680 BASIC VERSION 1.1 REV 3.2
COPYRIGHT 1976 BY MITS INC.

OK
?FRE(0)
-23392

OK

8K ALTAIR 680 BASIC up and running.

To load BASIC programs from the terminal you simply cut and paste them into the terminal window. In order to give time for BASIC to tokenise each line there needs to be an adequate delay between lines. In my case I had to use a value of 750ms for the line delay and 5ms was enough for the character delay. This means loading BASIC programs does slow down a fair bit.

We'll try the 3DPLOT program as it's pretty short.

1 PRINT TAB(32);"3D PLOT"
2 PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
3 PRINT:PRINT:PRINT
5 DEF FNA(Z)=30*EXP(-Z*Z/100)
100 PRINT
110 FOR X=-30 TO 30 STEP 1.5
120 L=0
130 Y1=5*INT(SQR(900-X*X)/5)
140 FOR Y=Y1 TO -Y1 STEP -5
150 Z=INT(25+FNA(SQR(X*X+Y*Y))-.7*Y)
160 IF Z<=L THEN 190
170 L=Z
180 PRINT TAB(Z);"*";
190 NEXT Y
200 PRINT
210 NEXT X
300 END
RUN
                                3D PLOT
               CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY



                         *
                     *   *  *
                  *  *   *  *   *
              *   *  *   *  *   *  *
              *   *  *   *  *   *  *
              *   *  *   *  *   *  *
           *  *   *  *   *  *   *  *   *
           *  *   *   *  *   *  *  *   *
           *  *   *   *   *  *  *  *   *
       *   *  *   *    *  *   * *  *   *  *
       *   *  *    *   *    * *  * *   *  *
       *   *   *   *     *   *  **  *  *  *
       *   *   *    *      *    * * *  *  *
       *   *   *     *       *    * *  *  *
       *   *   *      *        *      **  *
       *   *    *       *         *       *
       *   *    *        *           *       *
       *   *     *         *            *        *
       *   *     *          *             *         *
       *   *     *          *               *         *
    *  *   *     *           *              *          *
       *   *     *          *               *         *
       *   *     *          *             *         *
       *   *     *         *            *        *
       *   *    *        *           *       *
       *   *    *       *         *       *
       *   *   *      *        *      **  *
       *   *   *     *       *    * *  *  *
       *   *   *    *      *    * * *  *  *
       *   *   *   *     *   *  **  *  *  *
       *   *  *    *   *    * *  * *   *  *
       *   *  *   *    *  *   * *  *   *  *
           *  *   *   *   *  *  *  *   *
           *  *   *   *  *   *  *  *   *
           *  *   *  *   *  *   *  *   *
              *   *  *   *  *   *  *
              *   *  *   *  *   *  *
              *   *  *   *  *   *  *
                  *  *   *  *   *
                     *   *  *
                         *
OK

All of the 101 BASIC Computer Games can be downloaded from various sites including:

https://deramp.com/downloads/altair/software/basic_programs/Games%20(Creative%20Comp)/

http://www.vintage-basic.net/games.html

Scans only: https://www.atariarchives.org/basicgames/

After trying several programs I found that some have to be edited slightly because of the maximum line length of 72 characters. This was normally easily solved by replacing the PRINT keyword with '?', which is a shorthand version of the PRINT command. Once it's LISTED back on the screen it will display PRINT as normal.

There was also several typo's or misinterpreted characters during OCR scanning in some of the downloaded programs, so I had to check my book and the scanned books on-line in order to verify the correct characters.

And lastly the game I've been waiting to try...


Sunday, October 30, 2022

Part 2l: Floating Point tests and Debugging

Floating Point tests

Within a couple of days of my historical 'PRINT 2+2' replication I had enough code in to write this small program and RUN it. For me this was the icing on the cake. I could now see the potential of  having a real floating point BASIC on the ETA-3400X.

A more impressive floating point test.

Debugging

The majority of the time I was able to fix bugs by using the Fantom II monitor and stepping through the section of code for a specific instruction until it started to do something unexpected or branch off to a section of code that I hadn't entered.

Most of the time it was some access to a zero-page address that had been relocated that I missed.

Sometimes I wasn't sure if I had a bug or not, because the result seemed to work but it didn't match what the BASIC Reference manual had in it. On a couple of occasions I contacted one of the ET-3400 group members for confirmation of the bug.

I have to thank two people in particular who helped check some bugs or discrepancies for me since I didn't have an original or clone ALTAIR 680 to test things on.

Mike Douglas of deramp.com helped me with PEEK and POKE instruction where we found that the manual was incorrect. According to the manual you could only use 0 to 32767 PEEK and POKE range, however I was able to PEEK and POKE from 0 to 65535. He also confirmed the FRE(0) memory results. He also confirmed I had an error with the leading zero's in the program LIST command and the BYTES FREE statement after boot up, which I was slightly disappointed with as I thought the leading zero's looked cool and made the listings neater.

Jeff Tranter went to great lengths and helped me with memory dumps using his home built 6800 based SBC with a 6850 ACIA which can emulate an ALTAIR 680.

Also I got a lot of tips, theories and encouragement from members of the ET-3400 group as I progressed.

An appropriate cartoon posted by one of the ET-3400 group members was closer to the truth than he realised.

Memory mapping decisions

Up until near the end of the port I was working on a limited amount of BASIC program memory and this was because I had to add a few small subroutines to patch some of the code and there wasn't anywhere within the existing space to do that. Also I wasn't sure where in zero-page that the pointers for BASIC Variables, Arrays, Strings or the BASIC Stack was stored, partly because those addresses were seemingly replicated in a couple of places.

I added the patches after $1AB8 for the Random seed value, the VT100 7-bit patch, a POLCAT routine, a COLD start routine, a non-destructive Find-Top-of-RAM routine and the Baudot buffer (which I've misnamed throughout). As it turns out the apparent unused #$00 bytes between $0100 and $010C that I repurposed for relocated zero-page code were actually needed as a scratchpad to convert binary to decimal (as far as I can tell) and possibly other uses, so I had to reinstate it in a new location.

In the original version of the 8K BASIC the user is asked whether they require SIN-COS-TAN-ATN? and this determines where in the RAM that BASIC stores it's user BASIC programs. It actually overwrites itself from $18F3 or lower overwriting code that it no longer needs once BASIC starts. This can include floating-point data for trigonometric functions and all of the startup strings for MEMORY SIZE? and the startup message. Microsoft did this to give the user more RAM on an already small memory size because the cost of RAM was prohibitive and every byte counted.

I wasn't able to keep all that RAM for the user because I had to squeeze in the patches somewhere, however I did have the advantage of having about 48K of user RAM for BASIC interpreter and it's programs, so losing about 800 bytes was a reasonable trade off. Instead I have the start of BASIC program space etc starting from $1C00 regardless of what the user types in response to WANT SIN-COS-TAN-ATN ?

The last difficult bug I had was with the READ and DATA statements. This took about 3 weeks to find, where other bugs were typically found within a day. First I had to try and nail down what the bug actually was and be able to replicate it reliably. This is typically what would happen for this bug:

10 READ A,B
20 PRINT A,B
100 DATA 1,2,3,4

When I first entered the program and ran it I got:

?SN ERROR

If I then typed certain commands such as PRINT "ABCDEFGHI" in immediate mode, then ran the program it would work and display:

1           2

I even analysed the tokenised program in memory and it did not change. This one had me stumped and I got a lot of suggestion on what to try, but nothing worked.

I tried my typical trace method I had used successfully on most of the other bugs, but this time that method didn't work because of the way that the Stack Pointer was used. If I used the Step command in the Fantom II monitor it would normally execute a single instruction, however in doing so it also dumped the registers at whatever the Stack pointer address was at the time, and this unfortunately overwrote data or code. Then when the code continued for the next instruction it would restore the registers from the Stack pointer location and continue execution.

This bug was really annoying me because it was the one bug that stood in the way of completing this project to 99% or better. If a user typed in a program, about 20% of programs I tested would encounter this bug. To me this was unacceptable.

In the end I had to try and trap the bug by putting breakpoints at the other end of the code that ran and gradually moved that breakpoint backward. Each time I could examine the registers and know if it had hit the bug or not. The disadvantage of this method was that in some cases the program could jump to a subroutine from several locations, so I had to eliminate one at a time.

The cause of the bug turned out to be one more of those zero-page patches that I had typed wrong and I have no explanation of how it ran at all with that bug in it because it was jumping into the wrong zero page address. For me it was a one in a million chance that the bug still allowed the program to run and not crash, just produce weird results.

There's only one more thing to do now that all the bugs have been squashed...



Part 2k: Microsoft Binary Format

 At some stage I was going to need to figure out how floating point numbers are stored to help with the disassembly and for my own curiosity.

I know Integer BASICs often stores Integers as twos-complement binary format using 16 bits to represent numbers in the range of -32768 to 32767. It's not too hard to convert those from binary to decimal for the user to read. I think most retro microcomputer enthusiasts and programmers will already be familiar with that to some extent.

However it's a whole different kettle of fish when it come to floating point numbers, and to make it even harder to follow, different methods have been used on different interpreters. It's up to the programmer to some extent how they want to store the numbers unless they have to follow some standard.

If you look up Wikipedia you will find this list of standards:

But which 32-bit standard one do we want ?

IEEE 754 32-bit floating-point standard. Almost but NOT the standard used on the ALTAIR!

Microsoft's Monte Davidoff was the one who came up his own floating-point standard to be used in the 4K and 8K interpreters on the ALTAIR, and since there were no standards back in 1976, he made up his own. He decided on a 32 bit format because it kept the memory usage down and was adequate for floating point representation.

The way ALTAIR BASIC stores the floating point numbers is like this:

Microsoft Binary Format (MBF). Similar to IEEE 754 but different.

There are some examples of Microsoft Binary Format here:

https://en.wikipedia.org/wiki/Microsoft_Binary_Format

Good, but how do I convert other numbers.

I tried unsuccessfully to find an on-line converter for 32 bit MBF but failed. So I had to create my own method instead. I did one or two by hand and it took ages and prone to errors. Eventually I created a spreadsheet that could do a reasonable job of converting from HEX (binary) to decimal, although a bit clunky to use it was much faster and more accurate than my manual attempts:

My own spreadsheet to convert from Hexadecimal (binary) to Decimal. Here we see hexadecimal $86 $34 $00 $00 converts to decimal 45. You can also see the Binary representation under the Hexadecimal.

The reason I need to convert hexadecimal to binary is because throughout the ROM there is apparent blocks of data and I want to know if they are decimal constants and if so what their value is. Once I know that I can then work out where some of the math subroutines are located and how they work (eventually).

This is an example of a random block that looks like it might be data constants:

12B1 : 81 00 "  " cmpa #$00
;
12B3 : 00 " " db $00
12B4 : 00 " " db $00
12B5 : 02 " " db $02
;
12B6 : 80 19 "  " suba #$19
12B8 : 56 "V" rorb
12B9 : AA 80 "  " oraa $80,x
12BB : 76 22 F1 "v" " ror X22F1
12BE : 82 38 " 8" sbca #$38
12C0 : AA 45 " E" oraa $45,x
12C2 : 80 35 " 5" suba #$35
;
12C4 : 04 " " db $04
12C5 : F3 " " db $F3
;
12C6 : 81 35 " 5" cmpa #$35
;
12C8 : 04 " " db $04
12C9 : F3 " " db $F3
;
12CA : 80 80 "  " suba #$80
;
12CC : 00 " " db $00
12CD : 00 " " db $00
;
12CE : 80 31 " 1" suba #$31
;
12D0 : 72 "r" db $72
12D1 : 18 " " db $18

At first glance this looks like garbage or data, certainly not code with all those 'db' declarations.

After some tidying up and MBF conversion it becomes a lot clearer what's stored here:

;********************************************************************
; Data constants section
; Unity
12B1 : 81 00 00 00 X12B1: db $81, $00, $00, $00 ;=1.000000 yes
; LOG series table
12B5 : 02 db $02 ;3 entries in LOG() series
12B6 : 80 19 56 AA X12B5: db $80, $19, $56, $AA ;=0.59897864 yes
12BA : 80 76 22 F1 db $80, $76, $22, $F1 ;=0.96147066 yes
12BE : 82 38 AA 45 db $82, $38, $AA $45 ;=2.8853934 yes
; Other constants
12C2 : 80 35 04 F3 X12C2: db $80, $35, $04, $F3 ;SQR(0.5) =  0.70710677 yes
12C6 : 81 35 04 F3 X12C6: db $81, $35, $04, $F3 ;SQR(2)   =  1.4142135 yes
12CA : 80 80 00 00 X12CA: db $80, $80, $00, $00 ;-1/2     = -0.50000000 yes
12CE : 80 31 72 18 X12CE: db $80, $31, $72, $18 ;Ln(2)    =  0.69314718 (natural log) yes
;********************************************************************

Other Microsoft BASICs have similar constants stored in the ROM for their maths routines. By comparing those to this BASIC allowed me to figure out what the data constant blocks were used for in the math routines. Although sometimes the values differed slightly to those BASICs.

;**********************************************************************
;floating point constants
1881 : 81 49 0F DB db $81, $49, $0F, $DB ;pi/2 = 1.570796 yes
1885 : 83 49 0F DB db $83, $49, $0F, $DB ;2*pi = 6.283185 yes
;(why a 2nd entry for 2*pi)
1889 : 7F 00 00 00 db $7F, $00, $00, $00 ;1/4 = 0.25 yes
;Taylor series used for SIN()
188D : 04 db $04 ;5 coefficients for SIN()

188E : 86 1E D7 BA db $86, $1E, $D7, $BA ; ((2*pi)^9)/9! = 39.710670 yes
1892 : 87 99 26 64 db $87, $99, $26, $64 ;-((2*pi)^7)/7! = -76.574982 yes
1896 : 87 23 34 58 db $87, $23, $34, $58 ; ((2*pi)^5)/5! =  81.602234 yes
189A : 86 A5 5D E0 db $86, $A5, $5D, $E0 ;-((2*pi)^3)/3! = -41.341675 yes
189E : 83 49 0F DA db $83, $49, $0F, $DA ; (2*pi)        =  6.283185 yes
;this section may be overwritten by start of BASIC program data depending on trig option selected
;**********************************************************************

Another block of floating point constants. These ones are used for SIN function and probably for COS and TAN as well.

Armed with this information I may eventually determine how the math routines worked, however I decided that was going to take a lot of time to work out, so most if not all the the math functions have barely any comments other than identifying what location in the memory they occupy.

Entering the math routines was more or less robotic and I was just typing in a lot of blocks of code monotonously. Fortunately there was not a lot of patching to do in those commands.

Next I get some of the bugs out...





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...