07-28-2023, 07:02 PM
just updated the main tiny_basic sub. Realized a few minutes ago it wasn't as verssatile as the load statement, so I updated it to number the load statement does.
Code: (Select All)
'just the one subroutine, replace the earlier version with this one.
Sub tiny_basic (icmd$, pl$())
Dim loadlines, prox
loadlines = UBound(pl$)
n = 0
For prox = 1 To loadlines
pgm(0) = pl$(prox)
Call initlex(0)
If toktype = "number" And num > 0 And num <= c_maxlines Then
n = num
Else
n = n + 1: textp = 1
End If
pgm(n) = Mid$(pgm(0), textp)
Next prox
curline = 0
icmd$ = LCase$(icmd$)
Select Case icmd$
Case "run"
tok = "run"
Call docmd
Case "list"
tok = "list"
Call docmd
Case "new"
tok = "new"
Call docmd
End Select
If Command$ <> "" Then
toktype = "string": tok = c_dquote + Command$
Call loadstmt
tok = "run": Call docmd
Else
' Call help
End If
Do
errors = false
Line Input "tinyb> ", pgm(0)
If pgm(0) <> "" Then
Call initlex(0)
If toktype = "number" Then
Call validlinenum
If Not errors Then pgm(num) = Mid$(pgm(0), textp)
Else
Call docmd
End If
End If
Loop Until toktype = "exit"
ReDim pgm(0 To c_maxlines) As String
End Sub