diff --git a/MEMORY_LAYOUT.md b/MEMORY_LAYOUT.md new file mode 100644 index 0000000..3afeaa4 --- /dev/null +++ b/MEMORY_LAYOUT.md @@ -0,0 +1,4 @@ +The root directory is from byte 24000h to 26FFFh
+The currently opened file's metadata is from 27000h to 2701Fh
+The to be outputted string is stored from 27020h to 27FFFh
+The currently opened file is from 28000h
diff --git a/README.md b/README.md index 3bd9dd5..466c242 100644 --- a/README.md +++ b/README.md @@ -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)
docs on writing BASIC code. In order to create new
-files, place them in the /data/ directory, not the file
+files, place them in the /data/ directory, note the file
names are limited to 11 characters due to FAT12 limitations
(8 for the name and 3 for the extension). diff --git a/data/fb.bas b/data/fb.bas index 4884acb..8727fc4 100644 --- a/data/fb.bas +++ b/data/fb.bas @@ -1,9 +1,11 @@ -FOR A = 1 TO 100 -PRINT A ; -B = A % 3 -C = A % 5 -IF B = 0 then PRINT "Fizz" ; -IF C = 0 then PRINT "Buzz" ; -PRINT "" +# 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" ; + IF C = 0 then PRINT "Buzz" ; + PRINT "" NEXT A END diff --git a/data/hello.bas b/data/hello.bas index 5012fa4..89c2188 100644 --- a/data/hello.bas +++ b/data/hello.bas @@ -1,17 +1,17 @@ $1 = "_________" A = & $1 FOR X = 1 TO 9 -FOR Y = 1 TO 9 -PEEK B A -IF B = 95 THEN PRINT "_" ; -IF B = 88 THEN PRINT "X" ; -IF B = 79 THEN PRINT "O" ; -C = A % 3 -IF C = 0 THEN PRINT " " -A = A + 1 -NEXT Y -Z = X % 2 -IF Z = 0 THEN PRINT "You are X" -IF Z = 1 THEN PRINT "You are O" + FOR Y = 1 TO 9 + PEEK B A + IF B = 95 THEN PRINT "_" ; + IF B = 88 THEN PRINT "X" ; + IF B = 79 THEN PRINT "O" ; + C = A % 3 + IF C = 0 THEN PRINT " " + A = A + 1 + NEXT Y + Z = X % 2 + IF Z = 0 THEN PRINT "You are X" + IF Z = 1 THEN PRINT "You are O" NEXT X END diff --git a/source/kernel/features/basic.asm b/source/kernel/features/basic.asm index 4df9eca..8c952ae 100644 --- a/source/kernel/features/basic.asm +++ b/source/kernel/features/basic.asm @@ -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