Modified the BASIC interpreter to support comments using #
and sol whitespace support (eg tabs or spaces for indentation)
This commit is contained in:
4
MEMORY_LAYOUT.md
Normal file
4
MEMORY_LAYOUT.md
Normal file
@@ -0,0 +1,4 @@
|
||||
The root directory is from byte 24000h to 26FFFh<br/>
|
||||
The currently opened file's metadata is from 27000h to 2701Fh<br/>
|
||||
The to be outputted string is stored from 27020h to 27FFFh<br/>
|
||||
The currently opened file is from 28000h<br/>
|
||||
@@ -49,6 +49,6 @@ To allow for easier debugging.
|
||||
# BASIC development
|
||||
Please refer to the [MikeOS BASIC documentation](https://mikeos.sourceforge.net/handbook-appdev-basic.html)<br/>
|
||||
docs on writing BASIC code. In order to create new<br/>
|
||||
files, place them in the /data/ directory, not the file<br/>
|
||||
files, place them in the /data/ directory, note the file<br/>
|
||||
names are limited to 11 characters due to FAT12 limitations<br/>
|
||||
(8 for the name and 3 for the extension).
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
FOR A = 1 TO 100
|
||||
PRINT A ;
|
||||
# A cool fizzbuzz program
|
||||
PRINT "FizzBuzz!"
|
||||
FOR A = 1 TO 16
|
||||
PRINT A ; # Prints the number
|
||||
B = A % 3
|
||||
C = A % 5
|
||||
IF B = 0 then PRINT "Fizz" ;
|
||||
|
||||
@@ -3970,6 +3970,14 @@ get_token:
|
||||
mov word si, [prog]
|
||||
lodsb
|
||||
|
||||
cmp al, 09h
|
||||
je .whitespace
|
||||
cmp al, 20h
|
||||
je .whitespace
|
||||
|
||||
cmp al, '#'
|
||||
je .comment
|
||||
|
||||
cmp al, 10
|
||||
je .newline
|
||||
|
||||
@@ -3990,13 +3998,28 @@ get_token:
|
||||
|
||||
jmp get_string_token
|
||||
|
||||
.whitespace:
|
||||
inc word [prog]
|
||||
jmp get_token
|
||||
|
||||
.comment:
|
||||
inc word [prog] ; Move past first quote (") char
|
||||
mov word si, [prog]
|
||||
mov di, token
|
||||
.loop:
|
||||
lodsb
|
||||
cmp al, 0Ah
|
||||
je .done
|
||||
inc word [prog]
|
||||
jmp .loop
|
||||
.done:
|
||||
inc word [prog] ; Move past final quote
|
||||
jmp get_token
|
||||
|
||||
.newline:
|
||||
inc word [prog]
|
||||
jmp get_token
|
||||
|
||||
|
||||
|
||||
get_number_token:
|
||||
mov word si, [prog]
|
||||
mov di, token
|
||||
@@ -4273,6 +4296,8 @@ vars_loc:
|
||||
work_page db 0 ; Page to print to
|
||||
disp_page db 0 ; Page to display
|
||||
|
||||
tab_skip db " ", 0
|
||||
space_skip db " ", 0
|
||||
alert_cmd db "ALERT", 0
|
||||
askfile_cmd db "ASKFILE", 0
|
||||
break_cmd db "BREAK", 0
|
||||
|
||||
Reference in New Issue
Block a user