Page 1 of 1

What version of BASIC is this?

Posted: Fri Jun 29, 2018 10:51 am
by AElfstangard
Hello Everyone....

I'm trying to convert a pre-QBASIC program from 1982 into QBASIC. The author goes into detail about how the program works he but does not identify the version of BASIC he is using. It would be helpful if someone could identify this version of BASIC for me so I may research it. Below is a transcript of one of the shorter programs. Thank you kindly.


10 REM ALGEBRAIC FILE SCRAMBLING DECRYPTION PROGRAM
20 DIM B(100), C(100), K(100)
30 PRINT "YOUR KEYWORD IS";
40 INPUT K$
50 CHANGE K$ TO K
60 LET J=0
70 OPEN:PT:2000
80 FOR L = 1 TO 10
90 INPUT:CTF:A$
100 CHANGE A$ TO B
110 FOR I = 1 TO B(0)
120 GO SUB 250
130 LET K=59-K
130 IF B(I) > 90-K THEN 170
140 LET C(I) = B(I)+K
150 GO TO 180
160 LET C(I)=(B(I)+K-90)+31
170 NEXT I
180 LET C(0)=B(0)
190 CHANGE C TO E$
210 PRINT:PT:E$
220 NEXT L
230 CLOSE:PT
240 STOP
250 LET J=J+1
260 IF J>K(0) THEN 290
270 LET K=K(J)-32
280 RETURN
290 LET J=1
300 LET K=K(J)-32
310 RETURN
320 END

Re: What version of BASIC is this?

Posted: Mon Jul 02, 2018 8:24 am
by burger2227
50 CHANGE K$ TO K
Is not a Qbasic command. You cannot change a string TO a numerical value.
OPEN:PT:2000
Is not a Qbasic OPEN format

Re: What version of BASIC is this?

Posted: Mon Jul 02, 2018 9:38 am
by AElfstangard
Hi...

I'm well aware that this is not QBasic or QuickBasic. I would like to know what version of BASIC it is so I can better research and understand how to rewrite the programs in QBasic..

Thank you.

Re: What version of BASIC is this?

Posted: Mon Jul 02, 2018 9:48 am
by AElfstangard
I hit submit a little too soon...

What I want to know is, is this Sinclair BASIC, TSR80 BASIC, Apple BASIC, Joe Schmeky BASIC or what? I have no idea what some of these commands do so knowing what version of BASIC is being used would help me to research it and better understand how to port these programs to QBasic. That is about as clear as I can make it.

Thanks again,

Aelf

Re: What version of BASIC is this?

Posted: Mon Jul 02, 2018 11:26 am
by burger2227
The code looks like it opens a file, reads it and arranges file names in that file to arrays.

Exactly what do you want the program to do?

Posted: Sun Jul 08, 2018 11:29 am
by MikeHawk
The code you posted is likely written in a VERY old dialect since the interpreter requires line numbers, still uses LET, direct jump with THEN, splits GO TO, may likely not support concatenation (because of line 70, 90, 210 and 230), and features CHANGE (a statement I had never heard of before reading "The BASIC Cookbook" by Ken Tracton - it's the only source I've found describing this instruction, yet the book claims it's "available on the majority of BASIC language versions"). And it also seems to use colon instead of hash?

After looking around, I'm fairly certain it cannot be MBASIC, GW-BASIC, Altair BASIC or Mallard BASIC (because none of them has the CHANGE statement). It cannot be Applesoft BASIC (because it uses colon to write multiple statements on the same line), and cannot be Atari BASIC (because it uses # to access files - assuming line 70 is trying to open a file).

Line 70 (OPEN:PT:2000) and 90 (INPUT:CTF:A$) bother me a lot. For line 70, I don't know if PT is a variable or a keyword, but it seem to open a buffer with 2000 bytes of memory? I'm pulling this out of my ass, but line 210 (PRINT:PT:E$) seem to go in that direction; however line 230 is attempting to close it? That sounds more like a file but where's the filename in that? About line 90, I have no idea what that CTF is supposed to be (again, either a variable or a keyword). I'm pretty sure it reads A$, but where? There's no "OPEN:" or "CLOSE:" statement using CTF...

If it's any help, the "CHANGE i TO o" statement works like a "chain" CHR$() or ASC() (depending on the two variables used), or like strings in C (that is, an array of BYTES that can be accessed either as individual elements or a full string). I cannot test it, but I think this would work in whatever dialect your source uses:

Code: Select all

10  REM Convert string to array
20  M$ = "HELLO WORLD"
30  CHANGE M$ TO A
40  REM Should output "72 69 76 76 79 32 87 79 82 76 68"
50  FOR I = 1 TO A(0)
60  PRINT A(I);
70  NEXT I
80  PRINT ""
90  REM Should output "HELLO WORLD"
100 FOR I = 1 TO A(0)
110 PRINT CHR$(A(I));
120 NEXT I
The equivalent in QuickBASIC:

Code: Select all

' Convert string to array
DECLARE SUB CHANGEsTOi(message$, array())
DECLARE SUB CHANGEiTOs(array(), message$)
REDIM A(0)
M$ = "HELLO WORLD"
CHANGEsTOi M$, A() ' CHANGE M$ TO A
' Should output "72 69 76 76 79 32 87 79 82 76 68"
FOR I = 1 TO A(0)
  PRINT A(I);
NEXT I
PRINT ""
' Should output "HELLO WORLD"
FOR I = 1 TO A(0)
  PRINT CHR$(A(I));
NEXT I

' STRING to INTEGER array
SUB CHANGEsTOi(message$, array())
  REDIM array(0 to len(message$))
  array(0) = LEN(message$)
  FOR i% = 1 TO array(0)
    array(i%) = ASC(MID$(message$, i%, 1))
  NEXT i%
END SUB

' INTEGER array to STRING
SUB CHANGEiTOs(array(), message$)
  message$ = ""
  FOR i% = 1 TO array(0)
    message$ = message$ + CHR$(array(i%))
  NEXT i%
END SUB
EDIT: I've found other instances of "CHANGE" in "101 Basic Computer Games", by Digital Equipment Corporation, published in 1975. The instruction is used in 4 different programs (page 23, 25, 68, and 237), and doesn't seem to warrant any comment even though the author insist that "with few exceptions, the games all run in standard BASIC" and "Any exceptions are noted in the write-ups under the heading, Computer Limitations". All that to say, it likely was a common statement back in the 70ies.

EDIT2: Found one language that had "CHANGE": UBASIC (the statement is explained page 38 of "Univac 1100 Series BASIC - Programmer Reference", published 1972 by Sperry Rand Corporation). Also, True Basic seems to be using colon to input information instead of concatenation.

Re: What version of BASIC is this?

Posted: Sun Jul 08, 2018 2:29 pm
by AElfstangard
Hi...

Thank you for your help. CTF and PT are file names. (In this case it was supposed to mean Cipher Text File and Plain Text) I found an explanation of OPEN:PT:2000 in Lien's The BASIC Handbook but no reference to in what versions of BASIC it occurs in. A real headache! This version of BASIC seems to handle alpha-numeric strings the way Turbo Pascal does with its String type where A[0] is used to hold the length of the current string. This restricts the total length of the string to 255 characters. Line 110 could be replaced by FOR I = 1 TO LEN(B). I managed to replace the GOSUBs with IF... THEN... ELSE... END IF statements in QBasic. The CHANGE statements I handled pretty much the same way you did.

Again, thanks for your help.

Alf