Post Reply 
air traffic control program for Tandy model 102
05-25-2015, 12:43 AM (This post was last modified: 05-26-2015 01:15 PM by Don Shepherd.)
Post: #1
air traffic control program for Tandy model 102
I wrote an air traffic control program for the Macintosh way back around 1987-1988. It was fun to write, and I learned Microsoft BASIC for the Mac with that program.

A few months ago a forum member gave me a Tandy 102 laptop computer, which also runs BASIC. This computer is not a graphics-based computer like the Mac, but I thought it would be fun to do a rather simple ATC program for it.

The horizontal line across the middle of the screen represents an airway that planes fly on. There will be eastbound planes, entering from the left side of the screen, and westbound planes entering from the right side of the screen. The exact location of the plane is represented by a little plane symbol and associated with the plane is the aircraft ID (letter A-Z, for 26 planes) and the current altitude, in thousands of feet (the data for west bound planes is above the line, and the data for eastbound planes is below the line). Planes enter at a random altitude from 1000 to 8000 feet and should leave the screen at 9000 feet so that they won't run into another plane at 1000-8000 feet just entering the screen.

The screen is updated about once every seven seconds, which is about what the real-life ATC enroute system does in the US (or perhaps I should say what it did back in the 1990's when I worked on it).

Unlike real ATC, you can only do one thing to a plane: change his altitude. You can't vector him, hold him, slow him down or speed him up, tell him to get lost, etc. So the challenge is to use altitude to separate planes flying across the screen. If two planes are at the exact same location at the same altitude, they crash and the game is over. I should point out that a crash can only occur between a westbound plane and an eastbound plane; eastbound or westbound planes can't crash into one another because they all go the same speed.

You give an altitude command by keying in: C8. This tells plane C to climb or descend to 8000 feet. When a new plane comes onto the screen, you hear a beep. You will amost always want to give him an altitude command, and for a NEW plane you just have to enter the altitude, like 8, a nice little shortcut.

Your goal is to handle all 26 planes.

In real life, planes don't fly airways at just any old altitude. Eastbound flights fly at odd thousands of feet, and westbound flights fly at even thousands of feet. I could have implemented that with this simulator, but it wouldn't have made it very challenging. So basically you have planes headed directly at one another and it's your job to keep their altitudes different so they don't crash.

There is no mouse on a Tandy 102. Your control is from the keyboard.

Pressing ESC stops the simulation. The pause key on the Tandy will pause the simulation; press it again to resume.

The program will change the time-of-day clock on the computer, so be aware.

There are no rules regarding how one must run the simulation or define the separation procedures; that's up to you.

Anyhow, it was fun to write and I post it here in case anyone is interested.

Code:

5 cls
10 'atc for tandy 102
20 defint a-z
30 dim ac(25,4)'data on 26 planes A-Z
31 dim a(40,9)' pos x alt check for crash
32 dim p(40)'fix erase plane symbol problem
38 ' array ac contains 5 things for each plane:
40 '(0) = active indicator 0=inactive 1=active
50 '(1) = direction 0=westbound 1=eastbound
60 '(2) = current position (160-199)
70 '(3) = current altitude (1-9) thousand feet
80 '(4) = assigned altitude (1-9) thousand feet
100 'planes enter @ 1000-8000 feet and should leave at 9000 feet
110 ' A2 to change altitude of plane A to 2000 feet
200 print@160,string$(40,"-");' airway
210 np=0'next plane to add, starts at 0 goes to 25
211 pe=0'planes exited, 26=game over
260 gosub 400 'generate random number
300 time$ on:time$="00:00:00"
310 on time$ = "00:00:02" gosub 2000'update screen about once in 5 secs
350 a$=inkey$:if a$="" then 350 'loop to get input altitude command
360 if a$>="A" and a$<="Z" then b$=a$ 'aircraft id
365 if a$>="a" and a$<="z" then b$=chr$(asc(a$)-32) 'aircraft id if no caps lock
370 if a$>="1" and a$<="9" then ac(asc(b$)-65,4)=val(a$) 'assigned altitude
375 if a$=chr$(27) then print@10,"Game stopped";:end 'stop the program
380 goto 350 'continuous loop looking for alt commands
400 sec = val(right$(time$,2)) 'seed RNG with current seconds
410 for i=1 to sec
420 d=rnd(1)
430 next i
440 return
2000 'update screen about once every 5 seconds
2010 for i=1to40:p(i)=0:next i
2020 for i=0 to 25 'update each active plane on screen
2030 if ac(i,0)=0 then 2170 'ignore inactive planes
2035 'lines 2040 and 2050 remove planes that are now leaving the screen, 2040 WB and 2050 EB
2040 if ac(i,1)=0 and ac(i,2)=160 then pe=pe+1:ac(i,0)=0:print@80," ";:print@120," ";:print@160,"-";:goto 2170
2050 if ac(i,1)=1 and ac(i,2)=199 then pe=pe+1:ac(i,0)=0:print@279," ";:print@239," ";:print@199,"-";:goto 2170
2060 if ac(i,3)=ac(1,4) then 2080 'current alt = assigned alt so don't adjust
2070 if ac(i,4)>ac(i,3) then ac(i,3)=ac(i,3)+1 else ac(i,3)=ac(i,3)-1
2080 'update each active plane position
2090 if ac(i,1)=1 then 2140 'eastbound
2100 print@ac(i,2)-80," ";:print@ac(i,2)-40," ";:if p(ac(i,2)-159)=0 then print@ac(i,2),"-";
2110 ac(i,2)=ac(i,2)-1:p(ac(i,2)-159)=1
2120 print@ac(i,2)-80,right$(str$(ac(i,3)),1);:print@ac(i,2)-40,chr$(i+65);:print@ac(i,2),chr$(133);
2130 goto 2170
2140 print@ac(i,2)+80," ";:print@ac(i,2)+40," ";:if p(ac(i,2)-159)=0 then print@ac(i,2),"-";
2150 ac(i,2)=ac(i,2)+1:p(ac(i,2)-159)=1
2160 print@ac(i,2)+80,right$(str$(ac(i,3)),1);:print@ac(i,2)+40,chr$(i+65);:prin​t@ac(i,2),chr$(133);
2170 next i 'loop for all active aircraft
2171 if pe=26 then print@10,"all done -- congrats";:end 'all planes handled successfully
2172 gosub 2200 'add a plane sometimes
2173 gosub 2400 'check to see if 2 planes have the same alt and position (=crash, game over)
2180 return
2200 'add a new plane sometimes
2210 if int(4*rnd(1)+1)<>4 then return 'do it about once in every 4 updates
2215 if np=26 then return 'don't add more planes if 26 already
2220 ac(np,0)=1 'active
2230 ac(np,1)=int(2*rnd(1)) 'direction, gives random 0 or 1
2240 if ac(np,1)=0 then ac(np,2)=199 else ac(np,2)=160 'current position based on EB or WB
2250 ac(np,3)=int(8*rnd(1)+1):ac(np,4)=ac(np,3) 'initial alt = random 1000-8000 feet
2260 'draw new plane on screen
2270 print@ac(np,2),chr$(133);
2280 if ac(np,1)=1 then 2310 'eastbound
2290 print@ac(np,2)-80,right$(str$(ac(np,3)),1);:print@ac(np,2)-40,chr$(np+65);
2300 goto 2330
2310 print@ac(np,2)+80,right$(str$(ac(np,3)),1);:print@ac(np,2)+40,chr$(np+65);
2330 b$=chr$(np+65):np=np+1:beep
2340 return
2400 'check for 2 planes at same position and altitude = crash and game over
2410 for i=1 to 40:for j= 1 to 9:a(i,j)=0:next j:next i
2420 for i=0 to 25 'check each active plane
2430 if ac(i,0)=0 then 2450 'inactive, skip
2440 if a(ac(i,2)-159,ac(i,3))>0 then print@10,"crash -- game over";:stop else a(ac(i,2)-159,ac(i,3))=1
2450 next i
2460 return
Find all posts by this user
Quote this message in a reply
05-26-2015, 02:34 AM
Post: #2
RE: air traffic control program for Tandy model 102
Cool!

(If you haven't found it already, Club 100 is an excellent resource for the Kyocera portables like the M102. )

Bob
Find all posts by this user
Quote this message in a reply
05-26-2015, 11:52 AM
Post: #3
RE: air traffic control program for Tandy model 102
(05-26-2015 02:34 AM)BobVA Wrote:  Cool!

(If you haven't found it already, Club 100 is an excellent resource for the Kyocera portables like the M102. )

Bob
Thanks Bob.

Yeah, I know about that site, it has a treasure trove if information about these early laptops from Radio Shack. The fellow who started it apparently died. There is another fellow who has taken over for him, but he has not replied to my requests to buy some things from the site. He did eventually contact me months after I ordered something to see if I was still interested, and I said yes, but then he disappeared again. Oh well.

But it is a good site for information.

Don
Find all posts by this user
Quote this message in a reply
05-26-2015, 06:21 PM
Post: #4
RE: air traffic control program for Tandy model 102
(05-26-2015 11:52 AM)Don Shepherd Wrote:  
(05-26-2015 02:34 AM)BobVA Wrote:  Cool!

(If you haven't found it already, Club 100 is an excellent resource for the Kyocera portables like the M102. )

Bob
Thanks Bob.

Yeah, I know about that site, it has a treasure trove if information about these early laptops from Radio Shack. The fellow who started it apparently died. There is another fellow who has taken over for him, but he has not replied to my requests to buy some things from the site. He did eventually contact me months after I ordered something to see if I was still interested, and I said yes, but then he disappeared again. Oh well.

But it is a good site for information.

Don

I wonder if some place like Digikey or Jameco sells the appropriate RAM chip for upgrading a 102. I remember ordering a bunch of bare 128 KB chips from Jameco in the late '90s to upgrade an Apple IIgs memory expansion board.

I'd also like to build a cassette cable, but all the Radio Shacks are dying out, and the ones that aren't don't carry the appropriate 5-pin DIN connectors anymore. Seems appropriate to buy TRS-80 parts at a Radio Shack, you know?
Visit this user's website Find all posts by this user
Quote this message in a reply
05-26-2015, 06:35 PM
Post: #5
RE: air traffic control program for Tandy model 102
(05-26-2015 06:21 PM)Dave Britten Wrote:  I'd also like to build a cassette cable, but all the Radio Shacks are dying out, and the ones that aren't don't carry the appropriate 5-pin DIN connectors anymore. Seems appropriate to buy TRS-80 parts at a Radio Shack, you know?

Does this mean do cannot get hold of a simple 5-pin standard (or mini) DIN-connector? Like the type that was used for PC keyboards years ago?

Dieter
Find all posts by this user
Quote this message in a reply
05-26-2015, 07:08 PM
Post: #6
RE: air traffic control program for Tandy model 102
(05-26-2015 06:35 PM)Dieter Wrote:  
(05-26-2015 06:21 PM)Dave Britten Wrote:  I'd also like to build a cassette cable, but all the Radio Shacks are dying out, and the ones that aren't don't carry the appropriate 5-pin DIN connectors anymore. Seems appropriate to buy TRS-80 parts at a Radio Shack, you know?

Does this mean do cannot get hold of a simple 5-pin standard (or mini) DIN-connector? Like the type that was used for PC keyboards years ago?

Dieter

I'm sure I could get one by mail order, but I don't see them in the retail locations anymore.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-26-2015, 09:37 PM
Post: #7
RE: air traffic control program for Tandy model 102
(05-26-2015 06:21 PM)Dave Britten Wrote:  I wonder if some place like Digikey or Jameco sells the appropriate RAM chip for upgrading a 102. I remember ordering a bunch of bare 128 KB chips from Jameco in the late '90s to upgrade an Apple IIgs memory expansion board.

Unfortunately no, those machines came out well before the 32k CMOS static RAM, so they sort of invented their own pinout for the little 8k modules.
Same with the ROM on the earlier M100's which also had a non-standard pinout.

If you wanted a project, you could probably replace the entire 32k RAM with a single chip, but it would require quite a lot of white-wires, trace cutting and some external decoder logic.
Find all posts by this user
Quote this message in a reply
05-26-2015, 09:43 PM (This post was last modified: 05-26-2015 09:58 PM by BobVA.)
Post: #8
RE: air traffic control program for Tandy model 102
(05-26-2015 11:52 AM)Don Shepherd Wrote:  He did eventually contact me months after I ordered something to see if I was still interested, and I said yes, but then he disappeared again.

Don

Yeah, the stock of parts got rescued by some volunteers when the original operator passed away. The great guy who took on the lion's share of the task (and who also invented the external SD card storage for the 100 series) is unfortunately super busy and has a lot of things going on.

You might try again, or sign up for the list serve and post a query to that. If the new admin can't get to it, sometimes someone else will jump in.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)