CONST varType_UINTEGER
= 7 CONST varType_UINTEGER64
= 8 CONST varType_INTEGER64
= 9
thisScope$ = "MAIN MODULE"
varType_DEFAULT = varTypeSINGLE
'internal variables (functions)
varIndex = addVar("val"): vars(varIndex).protected = true
varIndex = addVar("int"): vars(varIndex).protected = true
varIndex = addVar("asc"): vars(varIndex).protected = true
varIndex = addVar("cos"): vars(varIndex).protected = true
varIndex = addVar("sin"): vars(varIndex).protected = true
varIndex = addVar("len"): vars(varIndex).protected = true
varIndex = addVar("rnd"): vars(varIndex).protected = true
varIndex = addVar("timer"): vars(varIndex).protected = true
varIndex = addVar("time$"): vars(varIndex).protected = true
varIndex = addVar("date$"): vars(varIndex).protected = true
varIndex = addVar("inkey$"): vars(varIndex).protected = true
varIndex = addVar("_width"): vars(varIndex).protected = true
varIndex = addVar("_height"): vars(varIndex).protected = true
varIndex = addVar("_mousex"): vars(varIndex).protected = true
varIndex = addVar("_mousey"): vars(varIndex).protected = true
varIndex = addVar("_mousebutton(1)"): vars(varIndex).protected = true
varIndex = addVar("_mousebutton(2)"): vars(varIndex).protected = true
IF running
THEN running
= false
currentLine = currentLine + 1
running = false
L1$ = program(currentLine)
tryWithExtension:
loaded
= load
(MID$(L1$
, 6)) L1$ = L1$ + ".bas"
L1$ = "LOAD " + loadedFile$
PRINT "No program loaded." program(i + 1) = program(i)
L$
= "EDIT " + MID$(L$
, 8) PRINT "No program loaded." program(i - 1) = program(i)
'interval
program(lower + (i - (upper + 1))) = program(i)
PRINT "No program loaded." PRINT "Missing: file name." PRINT "Saved - "; loadedFile$
PRINT "No program loaded." IF saveFile$
<> loadedFile$
THEN INPUT "Overwrite (y/N)?", q$
1 overWrite:
loadedFile$ = saveFile$
PRINT "Saved - "; loadedFile$
PRINT "No program loaded." loaded = true
Edit:
'EDIT can be used to increase program size without the need for INSERT
p$ = ""
col = col - 1
IF col
< 80 THEN col
= col
+ 1 IF col
< 80 THEN col
= col
+ 1 PRINT "No program loaded." j = 0
j = j + 1
MyBad = true
MyBad = false
thisLineNum$
= SPACE$(maxSpaceBefore
- LEN(thisLineNum$
) - 1) + thisLineNum$
+ " " MyBad = true
MyBad = false
MyBad = true
MyBad = false
MyBad = true
MyBad = false
PRINT "End of file - "; loadedFile$
ListEnd:
PRINT "No program loaded." PRINT "No program loaded." WIDTH GetVal
(p1$
), GetVal
(p2$
) externalLimit
= GetVal
(MID$(L$
, 8)) 'it's a comment.
currentLine = 0
externalLimit = 0
running = true
PRINT "No program loaded." COLOR GetVal
(c1$
), GetVal
(c2$
) LOCATE GetVal
(c1$
), GetVal
(c2$
) checkVar
= searchVar
(MID$(L1$
, 7)) IF CurrentSCREEN%
= 0 THEN PRINT "Invalid mode.": running
= false:
GOTO Parse.Done
Comma1%
= INSTR(L$
, ","): Comma2%
= INSTR(Comma1%
+ 1, L$
, ","): Comma3%
= INSTR(Comma2%
+ 1, L$
, ",")
XPos1%
= INSTR(L$
, " (") + 2 YPos1% = Comma1% + 1
X1%
= GetVal
(MID$(L$
, XPos1%
, Comma1%
- XPos1%
)) Y1%
= GetVal
(MID$(L$
, YPos1%
, Comma2%
- YPos1%
- 1))
Rad%
= GetVal
(MID$(L$
, Comma2%
+ 1, Comma3%
- Comma2%
- 1))
EPos%
= INSTR(L$
, ", , , ")
EPos%
= EPos%
+ 6: Elipse
= GetVal
(MID$(L$
, EPos%
)) Arc%
= INSTR(Comma3%
+ 1, L$
, ",")
Comma4% = Arc%
Comma5%
= INSTR(Comma4%
+ 1, L$
, ",")
ArcBeg
= GetVal
(MID$(L$
, Comma4%
+ 1, Comma5%
- Comma4%
- 1)) ': PRINT "ArcBeg:"; ArcBeg; '* * * * Test PRINT ArcEnd
= GetVal
(MID$(L$
, Comma5%
+ 1)) ': PRINT " ArcEnd:"; ArcEnd;
IF INSTR(Comma5%
+ 1, L$
, ",") > 0 THEN EPos%
= INSTR(Comma5%
+ 1, L$
, ",") + 1: Elipse
= GetVal
(MID$(L$
, EPos%
))
IF Arc%
> 0 AND Elipse
= 0 THEN CIRCLE (X1%
, Y1%
), Rad%
, DrawClr%
, ArcBeg
, ArcEnd:
GOTO Circ.Done
IF Arc%
> 0 AND Elipse
> 0 THEN CIRCLE (X1%
, Y1%
), Rad%
, DrawClr%
, ArcBeg
, ArcEnd
, Elipse:
GOTO Circ.Done
CIRCLE (X1%
, Y1%
), Rad%
, DrawClr%
'No arc, no elipse
Circ.Done: Rad%
= 0: Arc%
= 0: Elipse
= 0: c$
= "": DrawClr%
= 0:
GOTO Parse.Done
retainCursor = true
retainCursor = false
varIndex
= searchVar
(MID$(L1$
, 7)) varIndex
= searchVar
(MID$(L1$
, 8)) IF running
THEN running
= false
varIndex = addVar(varName$)
strings(varIndex) = d$
nums(varIndex) = d##
IF running
THEN doLine
= currentLine
loopLine = currentLine
IF doLine
> 0 THEN currentLine
= doLine
currentLine = loopLine
currentLine = currentLine + 1
IF currentLine
> UBOUND(program
) THEN PRINT "DO without LOOP on line"; doLine: running
= false:
GOTO Parse.Done
L1$ = program(currentLine)
PRINT "END IF without IF - on line"; currentLine
running = false
PRINT "Not valid in immediate mode." PRINT "Not valid in immediate mode."
ifLine = currentLine
s$ = "="
s$ = ">"
s$ = "<"
s$ = ""
r = false
IF GetVal
(i1$
) = GetVal
(i2$
) THEN r
= true
IF GetVal
(i1$
) > GetVal
(i2$
) THEN r
= true
IF GetVal
(i1$
) < GetVal
(i2$
) THEN r
= true
currentLine = currentLine + 1
IF currentLine
> UBOUND(program
) THEN PRINT "IF without END IF on line"; ifLine: running
= false:
GOTO Parse.Done
L1$ = program(currentLine)
'Assignment
varIndex = addVar(varName$) 'either add or acquire existing index
IF vars
(varIndex
).protected
THEN PRINT "Variable is protected";
running = false
PRINT " on line "; currentLine
strings
(varIndex
) = MID$(strings
(varIndex
), 2) IF RIGHT$(strings
(varIndex
), 1) = CHR$(34) THEN strings
(varIndex
) = LEFT$(strings
(varIndex
), LEN(strings
(varIndex
)) - 1) varIndex2 = searchVar(strings(varIndex))
strings(varIndex) = strings(varIndex2)
t$ = doMath(v$)
syntaxerror:
PRINT " on line"; currentLine
running = false
Parse.Done:
oops:
PRINT " on line"; currentLine
running = false
'check if var exists
found = searchVar(varName$)
totalVars = totalVars + 1
vars
(totalVars
).
name = varName$
'type detection -----------------------------------------------------------
vars
(totalVars
).
type = detectType
(varName$
) '--------------------------------------------------------------------------
vars(totalVars).scope = thisScope$
addVar~& = totalVars
detectType%% = varType_DEFAULT
IF RIGHT$(varname$
, 1) = "$" THEN detectType%%
= varTypeSTRING
detectType%% = varType_UBYTE
detectType%% = varType_BYTE
detectType%% = varType_UINTEGER
detectType%% = varTypeINTEGER
detectType%% = varTypeSINGLE
detectType%% = varType_FLOAT
detectType%% = varTypeDOUBLE
detectType%% = varType_UINTEGER64
detectType%% = varType_INTEGER64
detectType%% = varType_ULONG
detectType%% = varType_LONG
varName$ = __varName$
bracket1
= INSTR(varName$
, "(") bracket2 = i
'array or function
temp$
= MID$(varName$
, bracket1
+ 1, bracket2
- bracket1
- 1) 'string literal
isString = true
temp##
= VAL(doMath
(MID$(varName$
, bracket1
+ 1, bracket2
- bracket1
- 1))) 'a variable?
checkVar = searchVar(temp$)
temp$ = strings(checkVar)
isString = true
temp## = nums(checkVar)
'number literal?
varName$ = "val"
special = true
varName$ = "cos"
special = true
varName$ = "len"
special = true
varName$ = "asc"
special = true
varName$ = "sin"
special = true
varName$ = "int"
special = true
'special cases
special = true
special = true
special = true
special = true
special = true
special = true
special = true
special = true
special = true
special = true
special = true
'check if var exists
found = true
nums(i) = temp##
strings(i) = temp$
currentLine = 0
currentLine = currentLine + 1
program(currentLine) = l$
currentLine = 0
load%% = true
loadedFile$ = file$
load%% = false
IF hasOperator
(c$
) AND firstOperator
(c$
) > 1 THEN c$
= LEFT$(c$
, firstOperator
(c$
) - 1)
varIndex = searchVar(c$)
GetVal## = nums(varIndex)
GetVal##
= VAL(c$
) 'maybe it was 0 anyway...
v$ = __v$
IF hasOperator
(v$
) AND firstOperator
(v$
) > 1 THEN s$
= MID$(v$
, firstOperator
(v$
), 1)
v2$
= MID$(v$
, firstOperator
(v$
) + 1)
PRINT "found "; v1$
, s$
, v2$
PRINT "getval():"; GetVal
(v1$
), GetVal
(v2$
)
temp$
= STR$(GetVal
(v1$
) + GetVal
(v2$
)) temp$
= STR$(GetVal
(v1$
) - GetVal
(v2$
)) temp$
= STR$(GetVal
(v1$
) * GetVal
(v2$
)) temp$
= STR$(GetVal
(v1$
) / GetVal
(v2$
)) temp$
= STR$(GetVal
(v1$
) ^ GetVal
(v2$
))
DO WHILE hasOperator
(v2$
) AND firstOperator
(v2$
) > 1 s$
= MID$(v2$
, firstOperator
(v2$
), 1) v2$
= MID$(v2$
, firstOperator
(v2$
) + 1) temp$ = doMath$(temp$ + s$ + v2$)
v2$
= MID$(v2$
, firstOperator
(v2$
) + LEN(v2$
))
op$ = "+-*/^"
firstOperator = i