Search Posts:

IMSAI 1.4 BASIC vs. MITS 8K BASIC

SHARE

Return to Threads

  IMSAI 1.4 BASIC vs. MITS 8K BASIC by Bill Degnan - 08/16/2009 21:44
I am working with the "Eliza" program found in the Jul-Aug 1977 Creative Computing magazine. It was written for MITS Altair BASIC, but I only have the IMSAI 1.4 BASIC.

Lines like this are incompatible:

90 DIM C$(72),I$(72),K$(72),F$(72),S$(72),R$(72),P$(72),Z$(72)

..need to find a useful detailed guide to IMSAI 1.4 BASIC, better still a guide for converting MITS 8K BASIC to IMSAI 1.4 BASIC.

Reply
  IMSAI BASIC by Thomas Lake - 08/27/2009 10:45
The IMSAI manual is here:

www2.applegate.org/~ragooman//files/vintage/BASIC/IMSAI/src/basic8k.doc

Since there are no string arrays in IMSAI BASIC, you can create a single string that has fixed-length substrings containing the elements of the original array. Example:
Altair: a$(1)="This":a$(2)="That":a$(3)="Other"
for i=1 to 3
print a$(i)
next i
This
That
Other

IMSAI: a$="This That Other"
for i=1 to 3
print mid$(a$,(i-1)*5+1)
next i
This
That
Other

Reply
  replacement for string array by Bill Degnan - 08/27/2009 10:55
I received a tip from Dan Roganti to replace line 90 (REM'd out) as follows

90 REM C$(72),I$(72),K$(72),F$(72),S$(72),R$(72),P$(72),Z$(72)
91 C$="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
92 I$="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
93 K$="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
94 F$="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
95 S$="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
96 R$="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
97 P$="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
98 Z$="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"

...but I get a data error (contact me for a code listing if intereste). I am going to re-test and then do the following:

After I run the program and the error is displayed, I will enter these commands one at a time at the command line:

PRINT N1
PRINT X
PRINT S(X)
PRINT R(X)
PRINT N(X)
PRINT L

stay tuned...

Reply
  string array by Daniel Roganti - 08/27/2009 20:51
Bill,

While you're fixing the terminal problem there,
One quick thing to try is to put a RESTORE statement between line 100 and 110. There could be something quirky with the way the array index pointer is initialized.

Once you get the terminal running again, we can see why you get a Data error at line 140.

I'm trying to find a copy of the Microsoft Basic rev 4.0 manual wihtout nay luck. I though I had this already. I wanted to doublecheck the string arrays.

=Dan

Reply
  Altair BASIC 4.0 Manual by Thomas Lake - 08/27/2009 21:01
The BASIC 4.1 manual is at

http://www.bitsavers.org/pdf/mits/

It's virtually identical to the 4.0 manual. The fixes were minor. What do you want to know about string arrays?

Reply
  string array by Daniel Roganti - 08/27/2009 21:32

ok, I know that one. I wasn't sure if that was the same as Microsoft Basic rev 4.0

After looking at the code several times, the Eliza code doesn't seem to correspond with Altair Basic the way it was intended.

Remember that I mentioned in my earlier email, that none of the string arrays use a data pointer anywhere in the Eliza code. It's simply referenced as if it were just a string variable instead [see lines 430,460,470,480,490,510,520,530,555,630]

Normally, when you access an array, you need a subscript variable with an index pointer, as in C$(I). One piece of code [lines 300-360] show this. The string array K$ is being used to read data but it never uses a subscript.

I like to know if this actually runs in Altair Basic. You never know if there's a 30yr old bug.



Reply
  Eliza by Thomas Lake - 08/27/2009 21:35
This is not a bug. In Altair BASIC, a scalar variable can have the same name as an array. Thus, K$="This is a scalar" and K$(3)="This is an array element" can appear in the same program.

Reply
  Eliza by Daniel Roganti - 08/27/2009 22:07


Line 90 shows

90 DIM C$(72),I$(72),K$(72),F$(72),S$(72),R$(72),P$(72),Z$(72)

Why would 8 string arrays be defined if they are never used or referenced anywhere in the code by using a subscript variable ?

There is no K$(3) or any other array in the code being referenced this way.

Lines 430-550 is another case, no subscript variables.

I still think the DIM statement is some kind of memory initialization to reserve enough memory for each string (scalar) variable and not a string array of 72 elements.

Bill,
would you have the original code listing online ?


Reply
  Eliza code by Daniel Roganti - 08/27/2009 22:13
I put another copy on here

http://www2.applegate.or.../games/eliza.MITS8K.bas


Reply
  Eliza code by Daniel Roganti - 08/27/2009 22:28

I googled for any other versions of Eliza -- I'm collecting every one that I find now--

Here's one of them;
http://www2.applegate.or...es/eliza_ehbasic68k.bas

If you notice, the DIM statements have arrays with the subscripts which actually match the amount of strings in the data statements -- instead of making them all 72 "elements".

And the arrays are being used in the code in the way that you expect -- using a subscript variable to index the array elements.


Reply
  Eliza by Thomas Lake - 08/27/2009 23:55
It's possible that the person who translated it to Altair BASIC was originally using a BASIC that required DIMing all strings. (S)he didn't know it's unnecessary in Altair BASIC and, in fact wastes memory since the arrays are separate from the scalars of the same name.

Reply
  Eliza by Daniel Roganti - 08/28/2009 00:12

that's a thought,

How about deleting line 90 then and see if works any better.



Reply
  Eliza by Thomas Lake - 08/28/2009 08:13
I looked at the Eliza program with the DIMs in line 90. They are NOT necessary in the Altair version. I also noticed a few lines out of sequence. In those lines, a 1 has been substituted for what should be a 7.
The second line 510 should be 570, the second 1310 should be 1370, the second 1410 should be 1470, etc.
Also, in line 1060, there's a colon (:) that should be a quotation mark (").

Reply
  Eliza by Daniel Roganti - 08/28/2009 08:27

I think Bill fixed the typos that you mentioned already. I must have an earlier copy from when he first transcribed the code out of the book.

I agree also that line 90 should be deleted - it never made sense in the first place.




Reply
  Stand by for updated version by Bill Degnan - 08/28/2009 22:14
Sorry I have been busy and not replied. Dan has been sent the last edit, I will post it asap and will look for the bugs TOm noticed....

Regarding the repeated prompt issue, I have not tried a different terminal or a more stable Altair.

Reply
  Eliza by Daniel Roganti - 08/29/2009 00:07

I uploaded the corrected copy too eliza.MITS8K.bas
http://www2.applegate.or...an/files/vintage/games/

Plus there other different versions/langauages on there too if anyone is interested in experimenting.

I confirmed with Rich Cini -- he tested this also -- that this code also does work in MBASIC (Microsoft Basic on CP/M), which is essentially the same as the Altair Basic (a la Bill Gates)

The fact that line 90 is in there is redundant and was never needed for Altair, Microsoft, Imsai or any Basic version for that matter.

So while not necessarily a bug, it's still a 30yrd old typo - a big one for that matter.



Reply
  Eliza by Thomas Lake - 08/29/2009 06:27
"The fact that line 90 is in there is redundant and was never needed for Altair, Microsoft, Imsai or any Basic version for that matter. "

Wrong. This line IS needed for HP minicomputer BASIC (before the Altair), Atari BASIC, North Star BASIC and any other BASIC patterned on HP.

Reply
  Eliza by Daniel Roganti - 08/29/2009 09:48
Yes, I see that , it also mentions about the issue with HP Basic in 101 Computer Games book. I have an Atari 800 and noticed this too. I remember this issue about strings from programming in Fortran too.

The code in that book is based on Microsoft Basic, this is what I was referring too - didn't mean to mislead anyone.

I realize there are countless variations of Basic.


Bill,
I hope you're having some luck with the serial port



Reply
  Testing Same code on Compupro by Bill Degnan - 08/29/2009 13:14
I loaded MBASIC on my CompuPro system and using the same laptop downloaded the Eliza for Altair BASIC...the laptop serial port is OK, so is the cable. It's possible that the cable in the Altair that connects to the serial cable (it's a patch cable) has a wiring fault.

When I run the code I get the following error
RUN
Subscript out of range in 90
Ok
LIST 90
90 C$(72),I$(72),K$(72),F$(72),S$(72),R$(72),P$(72),Z$(72)
Ok
PRINT X
0
Ok
PRINT S(X)
0
Ok
PRINT R(X)
0
Ok
PRINT N(X)
0
Ok
PRINT L
0
Ok

Reply
  Shorter and Faster Eliza by Bill Degnan - 08/29/2009 13:51
Found this in Creative Computing Nov/DEc '77

"Shorter and Faster Eliza" USING MITS EXTENDED BASIC

paraphrase of things to try:

1. Delete line 90 which allocated array space for strings. These are never used since in MITS BASIC each non-dimensioned string variable and each member of a string array can each contain up to 255 characters

2. DEFINT A-Z to define all non-string variables as interger

3. Replace lines 315-350 with a line incorporating INSTR the string search function
330 T=INSTR(I$,k$): IF T THEN S=K: F$=K$: GO TO 365

-Alan R. Miller New Mexico Tech.

note: removing line 90 results in a an out of data error on line 140.

Reply
  Success! Eliza Works by Bill Degnan - 08/29/2009 15:04
Going over the code with a fine-toothed comb, I added spaces between some of the statements and the parameters
GOTO390
to
GOTO 390

I also found a I that should have been a 1.

Here is a sample run:
? I CAN'T SLEEP
HOW DO YOU KNOW YOU CAN'T SLEEP
? BECAUSE I DO NOT FEEL RESTED WHEN I WAKE UP
WHY DO YOU ASK?
? WHY DO I ASK WHAT?
WHY DO YOU ASK?
? BECAUSE I DO NOT KNOW WHAT YOU ARE TALKING ABOUT
WHAT MAKES YOU THINK I AM TALKING ABOUT
? YOU ARE MISSING MY POINT. I SAID I AM HAVING TROUBLE SLEEPING.
DOES IT PLEASE YOU TO BELIEVE I AM
MISSING YOUR POINT. YOU SAID YOU ARE HAVING TROUBLE SLEEPING.
? YES. PLEASE HELP ME
ARE YOU SURE?
? YES
I SEE.
? WE ARE GETTING NOWHERE
WHY DO YOU ASK?
? I'M NOT ASKING
DID YOU COME TO ME BECAUSE YOU ARE NOT ASKING
? WHERE DID YOU GET YOUR DEGREE?
WE WERE DISCUSSING YOU-- NOT ME.
? I'M LEAVING YOU
HOW LONG HAVE YOU BEEN LEAVING I
?

Reply
  Serial port.....Success! Eliza Works by Daniel Roganti - 08/29/2009 19:19


Well, that's a big relief !

That's running on the Compupro system you just rcvd, right ?

I suppose it's the code listing that you just uploaded to the Altair group, right ?

I see that you REM'd line 90 in there.

I think you should still test my Compupro SS-1 card in there to verify the hardware. Just document the jumper settings before you match them with the SS-1 in your systems. Don't forget the wire jumper at J11.

See if the 1489 rcvr chip is in a socket at U3, you might want to swap this out.

That serial patch cable only has 3 wires connected, pin 2, pin 3, and ground. There's not much which can go wrong there.

See if there's any continuity between the the J2 header and the DB25 connector for those pins.

DB25,pin 2 TO U3,pin 10
DB25,pin 3 TO U4,pin 6
And check of the ground wire is connected to ground on the card.





Reply
  Testing Eliza on Altair emulator by Daniel Roganti - 08/29/2009 23:11

I thought that I should try testing this program with the Altair emulator. The program starts running fine and you get the opening message from the program.
"HI! I'M ELIZA. WHAT'S YOUR PROBLEM?"

I type in a reply and immediately get a ?OS ERROR IN 201.
This means 'Out of String Space'. The manual describes you need to increase string storage -- but I couldn't find how to do this anywhere in the manual.

I have the emulator with the maximum amount of Ram, 64K (minus the 256byte Disk Rom boot loader at xFF00) and it still gives this error.

Rich Cini and I have been trying to debug this problem recently. We were wondering if there is actually a limitation on the amount of strings storage in MITS Basic versus MBASIC. So we're still trying to resolve this.

BTW, I also loaded CP/M into the Altair emulator and used MBASIC to run the program and it works fine on the Altair with only 64K Ram.


Reply
  Testing Eliza on Altair emulator by Thomas Lake - 08/29/2009 23:26
See the CLEAR nnnn command. That allows you to reserve more sting space.
If you don't use CLEAR, 8K BASIC will allow 50 bytes total for all strings and Extended will allow 200. These are the totals for ALL strings, not the individual length.

CLEAR 1000 will allow 1000 bytes to be shared by all strings.

Reply
  Testing Eliza on Altair emulator by Daniel Roganti - 08/29/2009 23:51
ah yes, I saw that command but skimmed so quickly over it thinking it didn't apply. My eyes are kinda tired this late at night. I wish I had ocr'd versions of these old manuals to help search for the text :)

thanks !

Reply
  Testing Eliza on Altair emulator by Daniel Roganti - 08/30/2009 01:22
That CLEAR command made a big difference. It works fine in Altair Basic.

However, I had to use the original code listing without the spaces in the program statements. Because Altair Basic has a limitation of 72 char/line.

The extra spaces make the lines too long and so the statements get cutoff and cause more errors at runtime.

The Terminal width setting that you enter when first booting Altair Basic doesn't seem to help either when I select 80char/line. Because the longest line in the new file is only 75char.

The other issue I noticed is that I can't use the "compressed" version in MBASIC. It complains,with a syntax error, when you don't put spaces in the program statements.

Bill,
the current version that you uploaded recently this afternoon,eliza.MITS8K.bas, (spaces included) would actually be compatible with MBASIC

I created another Folder in the Altair group, called Programs, and uploaded eliza.MBASIC.bas and eliza.ALTAIR8K.bas so others can see the differences.


Reply
  MBASIC vs MITS 8K BASIC by Bill Degnan - 08/30/2009 09:02
I will bare these differences in mind. I guess I should delete the copy I originally posted to avoid confusion.

Reply
  MBASIC vs MITS 8K BASIC by Daniel Roganti - 08/30/2009 10:53
I found out from Rich that the TERMINAL WIDTH setting that you enter when you boot Altair Basic only affects the screen width of the terminal and not the length of the line statements.

So Altair Basic is limited to 72 char/line when entering programs even if you have a 80 column screen.


Reply
  Eliza on Imsai 1.4 BASIC by Bill Degnan - 08/31/2009 22:10
I was able to get Eliza running in IMSAI 1.4 BASIC on the Altair 8800. It takes eons for just one exchange, but it works!

It's kind of cool to watch the lights.

Here is a transcript of a test sample run:

:RUN
HI! I'M ELIZA. WHAT'S YOUR PROBLEM?
? STINK FOOT
SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?
? YES
ARE YOU SURE?
? YES
PLEASE DON'T REPEAT YOURSELF!
? OK
WHAT DOES THAT SUGGEST TO YOU?
? MY FEET SMELL BADLY
I SEE.
? THANK YOU FOR UNDERSTANDING
WE WERE DISCUSSING YOU-- NOT ME.
? TRUE. I GUESS I GET CAUGHT UP IN THINGS
HOW DO YOU DO .,. PLEASE STATE YOUR PROBLEM.
? I HAVE STINK FOOT
I'M NOT SURE I UNDERSTAND YOU FULLY.
? MY FEET STINK

Reply
  Eliza on Imsai 1.4 BASIC by Bill Degnan - 08/31/2009 22:11
I was able to get Eliza running in IMSAI 1.4 BASIC on the Altair 8800. It takes eons for just one exchange, but it works!

It's kind of cool to watch the lights.

Here is a transcript of a test sample run:

:RUN
HI! I'M ELIZA. WHAT'S YOUR PROBLEM?
? STINK FOOT
SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?
? YES
ARE YOU SURE?
? YES
PLEASE DON'T REPEAT YOURSELF!
? OK
WHAT DOES THAT SUGGEST TO YOU?
? MY FEET SMELL BADLY
I SEE.
? THANK YOU FOR UNDERSTANDING
WE WERE DISCUSSING YOU-- NOT ME.
? TRUE. I GUESS I GET CAUGHT UP IN THINGS
HOW DO YOU DO .,. PLEASE STATE YOUR PROBLEM.
? I HAVE STINK FOOT
I'M NOT SURE I UNDERSTAND YOU FULLY.
? MY FEET STINK

Reply
  IMSAI 1.4 BASIC vs. MITS 8K BASIC by Daniel Roganti - 08/31/2009 22:30

That's a relief !

I noticed that too about the speed when running it on the emulator

What was wrong before with the serial port ?




Reply
  IMSAI BASIC on Altair 8800 by Thomas Lake - 09/01/2009 08:41
Does IMSAI BASIC need any patches to run on an Altair 8800? Is a tape image available somewhere? I collect BASIC versions the way some people collect stamps or coins and having IMSAI BASIC would be a great addition!
I searched the Web for it but couldn't find it. Would you consider making it available on a Website?

Reply
  Copies of IMSAI 1.4 BASIC on tape? by Bill Degnan - 09/01/2009 09:21
The only patching is with the SIO card, the BASIC runs just fine, but there are no string arrays and other differences. I am borrowing a PROM with IMSAI BASIC on it, I don't have the original. Dan Roganti is the one to talk to about all of this....Dan?

Reply
  Copies of IMSAI 1.4 BASIC by Daniel Roganti - 09/01/2009 14:12

I've been collecting this stuff too, but I don't have all of it online.

I have the Imsai Basic sourcecode(original), Tarbell Basic, and some binaries online

http://www2.applegate.or...an/files/vintage/BASIC/

I also patched the Imsai basic for several different SIO cards, Compupro SS-1(which Bill is borrowing), and others. Right now I'm adding The Bitstreamer II card to this list.

I'm in the process of organizing all the different SIO cards and their UART chips. This will turn into a kind of library to make it easier to patch any source code to use with any SIO card. Especially when it comes to getting CP/M to run on any hardware.

I'll get to uploading the rest of this online soon after VCF when things settle down.



Reply
  Altair BASIC running on other machines by Daniel Roganti - 09/02/2009 13:10
I forgot mention that I'm working on the reverse too. Getting Altair Basic to work on other machines too. Once the code is patched to work with other SIO cards. Since this is more popular.

The trick is get to get it to bootup using EPROM's -- which isn't that hard-- with a little copy routine to move it down to Ram (since it was coded to run out of Ram -variables are embedded inthe code--and not Rom as others are).

The hard part is I haven't found the source code in a file. I left off where I OCR'd the source code from the manual. But the pdf wasn't scanned very well, so there were alot of typos to fix. Then my hard drive crashed, so I had to start all over.

So I was going to ask Bill is he could scan it in again with his manuals--I hope he has a print copy-- then the OCR should zip right thru it with far less typos.

That Imsai Basic runs out of Rom. Once it's patched with the SIO init code, another copy can be burned in Eproms. There's several Ram cards which let you use Eproms too. I suggest getting one that supports at least 6116 Ram (2716 Eproms)--less Roms to deal with, only 4 roms. The others that support only 2708 Roms is ok too, that would be 8 Roms then. Please don't ask for 1702's unless you like getting tortured :) That's fine you just like little programs.

But I don't have a 2708 burner--another project that's waiting. Bill has a 2708 programmer card that needs to get tested still. But these days I like to program this stuff on my PC and not use my machines any more for this.



Reply

Resources:


Buy a Commodore Computer Poster

Popular Topics and FAQs


Past Issues:


LDOS v513 max 513 splash 02

This image was selected at random from the archive. Click image for more photos and files from this set.