Is this Quickbasic?

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
Shuey79
Newbie
Posts:4
Joined:Thu Dec 21, 2006 6:10 pm
Contact:
Is this Quickbasic?

Post by Shuey79 » Thu Dec 21, 2006 6:42 pm

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
     

buff1
Jr. Member
Posts:19
Joined:Mon Oct 30, 2006 4:37 pm
Contact:

Post by buff1 » Thu Dec 21, 2006 9:57 pm

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.

Shuey79
Newbie
Posts:4
Joined:Thu Dec 21, 2006 6:10 pm
Contact:

Post by Shuey79 » Fri Dec 22, 2006 12:00 am

WHats PB code?

buff1
Jr. Member
Posts:19
Joined:Mon Oct 30, 2006 4:37 pm
Contact:

Post by buff1 » Fri Dec 22, 2006 12:53 am

PB is short for PowerBasic. The MS-DOS version is about 95% compatible with QuickBasic.

(They also have 2 windows compilers)

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Sun Dec 31, 2006 5:19 pm

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!
Last edited by Ralph on Sun Dec 31, 2006 11:54 pm, edited 1 time in total.
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

Shuey79
Newbie
Posts:4
Joined:Thu Dec 21, 2006 6:10 pm
Contact:

Post by Shuey79 » Sun Dec 31, 2006 11:39 pm

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

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Mon Jan 01, 2007 3:09 am

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.
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

buff1
Jr. Member
Posts:19
Joined:Mon Oct 30, 2006 4:37 pm
Contact:

Post by buff1 » Mon Jan 01, 2007 6:52 am

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.

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Mon Jan 01, 2007 5:23 pm

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!
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

Shuey79
Newbie
Posts:4
Joined:Thu Dec 21, 2006 6:10 pm
Contact:

Post by Shuey79 » Tue Jan 02, 2007 6:30 pm

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?

surturz
Newbie
Posts:6
Joined:Mon Feb 19, 2007 12:38 am
Location:Australia

not QB

Post by surturz » Mon Feb 19, 2007 1:28 pm

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.

Post Reply