Page 1 of 1

Is this Quickbasic?

Posted: Thu Dec 21, 2006 6:42 pm
by Shuey79
Hello, obviously I am a newbie by the title.
I have fooled around with java, c++ and alittle VB 6.0 so I can kind of follow whats going on here. Below is sample code taken from a program that was written for a friends company, my question is what language is this? I had thought it was Quickbasic but I was doing some searches on google and I found something called GW-basic, and Qbasic. Now I am confused on what this program is written in. I would appreciate any help. Thanks in advance!!!

Code: Select all

1:  DIM XX$(30),HDR$(5),Q$(20),FCT$(6)
    FCT$(0)="  ":FCT$(1)="R ":FCT$(2)="S ":FCT$(3)="M ":FCT$(4)="RP":
    FCT$(5)="SP":FCT$(6)="MP":
    ON ERROR GOTO WHAT
    E$=CHR$(27):HC$=E$+"[2J":MC$=E$+"[":LC$=MC$+"1D":BS$=LC$:
    RC$=MC$+"1C":TS$=MC$+"1;1H":TB$=CHR$(1):UC$=MC$+"1A":
    AL$=CHR$(7):DC$=MC$+"1B":RV$=MC$+"7m":RS$=MC$+"0m":
    HDR$(0)="":HDR$(1)="CREATE":HDR$(2)="CHANGE":HDR$(3)="DELETE":HDR$(4)=\
    " READ-ONLY":RT$=CHR$(13):RD$=MC$+"33m":GN$=MC$+"0m":FC1$="0"
    Z8$="0       ":PRINT E$+"[00;58;8p";:PRINT E$+"[00;59;04p";:
    PRINT E$+"[00;57;10p";:PRINT E$+"[00;60;03p";:
    BK4$=LC$+LC$+LC$+LC$:FW6$=RC$+RC$+RC$+RC$+RC$+RC$:EOL$=STRING$(30,"  ")
    PW$=COMMAND$:IF PW$="" THEN UF$="c:\ACES\USERDATA.ONE":GOTO 12
    IF END #5 THEN 22
    OPEN "INSTDATA" AS 5
21: READ #5;XX$(I%):I%=I%+1:GOTO 21
22: IF I%>0 THEN I%=I%-1:GOTO 23 ELSE PRINT HC$;"Cannot Find Instdata":stop
23: IF LEFT$(XX$(J%),1)="!" THEN GOTO 24
E1: PRINT HC$;"Cannot Find Password":STOP  
24: IF PW$=RIGHT$(XX$(J%),LEN(XX$(J%))-19) THEN UF$=MID$(XX$(J%),10,10)+".ONE":\
    UN$=MID$(XX$(J%),2,8):UR%=J%:J%=J%+1:GOTO PC1 ELSE J%=J%+1: IF J%>I% THEN\
    GOTO E1 ELSE GOTO 23
PC1: IF J%>I% THEN PW$="":GOTO 12 REM instdata used only for pswrds
     IF LEFT$(XX$(J%),1)="!" THEN J%=J%+1:GOTO PC1
     IF LEFT$(XX$(J%),1)<>"@" THEN GOTO LI1 REM PCS%=0 or pw$="" >> no paper defaults
     

Posted: Thu Dec 21, 2006 9:57 pm
by buff1
I'd say it's real close to being QB or PB code.
The one statement that stood out as being suspect is
...IF END #5 THEN

in QB/PB i would think it would be IF EOF(5) THEN

also the placement of this statement is not good programming (end of
a line of statements). Other than that it looks pretty much like QB code
but I didn't delve into it in depth.

It's looks like a good example of what is commonly termed spaghetti code.
lots of goto statements, very little comment (remarks about the program),
and appears to have no indention which is very helpful especially for debugging and modifying.

Posted: Fri Dec 22, 2006 12:00 am
by Shuey79
WHats PB code?

Posted: Fri Dec 22, 2006 12:53 am
by buff1
PB is short for PowerBasic. The MS-DOS version is about 95% compatible with QuickBasic.

(They also have 2 windows compilers)

Posted: Sun Dec 31, 2006 5:19 pm
by Ralph
Shuey79 wrote:
"I had thought it was Quickbasic but I was doing some searches on google and I found something called GW-basic, and Qbasic. Now I am confused on what this program is written in. I would appreciate any help. Thanks in advance!!! "

One thing it is not, as presented, is any of the BASICs previous to QuickBASIC and QBasic, as they all require each line to have a line number, which the code presented does not. I assumed that any line ending in ":" (my quotes) was simply a part of an actual long line. This way, I can consider that the first four lines are really all part of line 1. However, the 5th line is not part of line 1, and does not have a line number, thus, this cannot be BASIC, GW-BASIC, or any such.

As Buff1 pointed out, it is real close to QuickBASIC, but, not quite!

Posted: Sun Dec 31, 2006 11:39 pm
by Shuey79
The reason I think its GWBasic is because the line

Code: Select all

 OPEN "INSTDATA" AS 5 
I found this website that gives a help tutorial (http://www.geocities.com/KindlyRat/GWBASIC_Help.zip)
When I looked up "OPEN" I found that it closely resembles some of the code. This is the format that it lists:

Code: Select all

Syntax:
OPEN mode,[#]file number,filename[,reclen]
OPEN filename [FOR mode][ACCESS access][lock] AS [#]file number [LEN=reclen]
Thanks alot for all your help guys!!!!

Posted: Mon Jan 01, 2007 3:09 am
by Ralph
Shuey79:

The syntax that you quote is a standard for all BASICs, including QuickBASIC. However, when used as code, BASIC and GW-BASIC both require line numbers, as I wrote before. So, unless the original code has line numbers, and the code you posted is incomplete in this respect, it CANNOT run in GW-BASIC.

Posted: Mon Jan 01, 2007 6:52 am
by buff1
A little history (by no means intended to be a complete history),

GW-Basic from MS and BasicA (ibm or compaq) were early forms of basic
for pcs. GW-Basic was included with MS-DOS up through version 4.x

Beginning with version 5, MS changed to QBasic and marketed QuickBasic.

Qbasic was included with the OS up to win98.

Contrary to statements i've seen posted around, MS did not invent the
BASIC computer language. As a matter of fact GW-Basic came from BasicA.

Posted: Mon Jan 01, 2007 5:23 pm
by Ralph
To complement Buff1's post, I quote, from the Wikipedia:
In computer programming, BASIC (an acronym for Beginner's All-purpose Symbolic Instruction Code[1]) refers to a family of high-level programming languages. It was originally designed in 1963, by John George Kemeny and Thomas Eugene Kurtz at Dartmouth College, to provide access for non-science students to computers. At the time, nearly all computer use required writing custom software, which was something only scientists and mathematicians tended to do. The language (in one variant or another) became widespread on home microcomputers in the 1980s, and remains popular to this day in a handful of heavily evolved dialects.
I think it is nice to be able to credit Professor Kemeny and student Kurtz with their tremendous contribution. They certainly accelerated the advancement of computation via computers. In the same breath, I have to be fair and recognize that IBM, though its tremendous hold on the business world, very greatly increased the use of computers and BASIC, by packaging a BASIC language program with its computers in 1980 (or was it 1981?). But, even before IBM, Tandy-Radio Shack's TRS-80 computers were already making their marks, as they ONLY ran in BASIC!

Posted: Tue Jan 02, 2007 6:30 pm
by Shuey79
Thanks Buff1 and Ralph, that clears alittle up. So does anyone have any ideas on how I can figure out what kind of code this is?

not QB

Posted: Mon Feb 19, 2007 1:28 pm
by surturz
I don't think it is QB...

Code: Select all

IF END #5 THEN 22
is a syntax error in QB. It looks like it's checking if the cursor is at the end of file 5 - equivalent QB code would be

Code: Select all

IF EOF(5) THEN 22
. Anyone know a BASIC dialect where 'END' is used as EOF?? END normally terminates execution.

Code: Select all

PRINT E$+"[00;59;04p";: 
is a clue too, that looks to me like an ANSI graphics code sequence, which you wouldn't use in QB since you have the COLOR and LOCATE commands.

Do you have the binaries? If so, you could look for a runtime module/library which might give you a clue.