Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix this BASIC compilation error?

Tags:

basic

dos

I have a problem compiling a program I made in BASIC. It's a DOS simulator that I was making in attempts to see if it is posssible to write an operating system entirly in BASIC. Every time I try to compile, I get these messages:

!SYNTAX ERROR IN LINE 15, COLUMN 50
 UNEXPECTED E
 EXPECTING : OR END OF LINE

What do I change to sovle this?

10 PRINT 
11 PRINT "Starting..."
12 PRINT 
13 PRINT 
14 INPUT "Type the location of the Command Interpretter:"; I$
15 IF I$ = "C:\WINDOWS\COMMAND.COM" THEN GOTO 14 ELSE GOTO 13
16 INPUT "C:\>"; D$
17 IF D$ = "FORMAT" GOTO 25
18 IF D$ = "FDISK" GOTO 47
19 IF D$ = "HELP" GOTO 16
20 IF D$ = "DIR" GOTO 16
21 IF D$ = "MKDIR" GOTO 16
22 IF D$ = "WIN" GOTO 16
23 IF D$ = "CD" GOTO 16
24 IF D$ = "DEL" GOTO 16
25 PRINT "WARNING, ALL DATA ON REMOVABLE DISK"
27 PRINT "DRIVE A: WILL BE LOST!"
28 INPUT "Proceed with Format (Y/N)"; F$
29 IF F$ = "Y" THEN GOTO 28
30 IF F$ = "N" THEN GOTO 16
31 PRINT 
32 PRINT 
33 PRINT 
34 PRINT "Fotmatting 1.44MB"
35 PRINT "Format complete."
36 PRINT "Writing out file allocation table"
37 PRINT "Complete."
38 PRINT "Calculating free space (this may take several minutes)...................."
39 PRINT "Complete."
40 PRINT 
41 INPUT "Volume Label (11 charchters, ENTER for none)"
42 PRINT 
43 PRINT "              1,440MB total disk space"
44 PRINT "              1,440MB available on disk"
45 PRINT 
46 PRINT "                       512 bytes in each allocation unit."
47 PRINT "                  32,624 allocation units available on disk."
48 PRINT "Volume Serial Number is 326A-1312"
49 GOTO 16
50 PRINT "Incorrect DOS Version"
51 PRINT 
52 GOTO 16

I used Vintage BASIC 1.0.1 as the compiler. Anyone know what's going on? Windoze NT

like image 522
WindozeNT Avatar asked Nov 27 '25 19:11

WindozeNT


2 Answers

I don't think there is an ELSE keyword in vintage basic, which is why you're getting the unexpected 'E' error.

I assume vintage BASIC is unstructured BASIC, you can refer to the wikipedia article for an example: http://en.wikipedia.org/wiki/BASIC_programming_language

Also, you have some duplicate line numbers for 26 and 27, which explains the other errors.

like image 182
dcp Avatar answered Dec 01 '25 22:12

dcp


The first two warnings are caused by your program having two lines 26, and two lines 27.

I would guess that the third message comes from your BASIC only supporting IF THEN and not IF THEN ELSE. In this case, you can encode it with IF GOTO.

like image 29
Pascal Cuoq Avatar answered Dec 01 '25 20:12

Pascal Cuoq