basic:spc stmt and more sample codes

This commit is contained in:
minjaesong
2020-11-27 16:55:36 +09:00
parent 83e573dab3
commit bdcef683ae
4 changed files with 23 additions and 2 deletions

View File

@@ -699,7 +699,10 @@ if no arg text were given (e.g. "10 NEXT"), args will have zero length
"END" : function(lnum, args) {
serial.println("Program terminated in "+lnum);
return Number.MAX_SAFE_INTEGER; // GOTO far-far-away
}
},
"SPC" : function(lnum, args) {
return oneArgNum(lnum, args, function(lh) { return " ".repeat(lh); });
},
};
Object.freeze(bStatus.builtin);
let bF = {};
@@ -1676,6 +1679,7 @@ bF.system = function(args) { // SYSTEM function
tbasexit = true;
};
bF.new = function(args) { // NEW function
bStatus.vars = initBvars();
cmdbuf = [];
};
bF.renum = function(args) { // RENUM function
@@ -1744,7 +1748,11 @@ bF.load = function(args) { // LOAD function
}
let prg = fs.readAll();
// reset the environment
cmdbuf = [];
bStatus.vars = initBvars();
// read the source
prg.split('\n').forEach(function(line) {
let i = line.indexOf(" ");
let lnum = line.slice(0, i);

6
assets/gugu.bas Normal file
View File

@@ -0,0 +1,6 @@
10 FOR I = 2 TO 9
20 FOR J = 1 TO 9
30 PRINT I; "*"; J; "="; I * J
40 NEXT
50 INPUT "Press Enter Key..."; A
60 NEXT

7
assets/tri.bas Normal file
View File

@@ -0,0 +1,7 @@
10 FOR I = 1 TO 20
20 PRINT SPC(20-I);
30 FOR J = 1 TO I*2
40 PRINT "*";
50 NEXT
60 PRINT ""
70 NEXT

View File

@@ -1241,7 +1241,7 @@ void main() {
val DEFAULT_CONFIG_COLOR_CRT = AdapterConfig(
"crt_color",
560, 448, 80, 32, 254, 255, 256.kB(), "./cp437_fira_code.png", 0.32f, TEXT_TILING_SHADER_COLOUR
560, 448, 80, 32, 254, 255, 256.kB(), "./FontROM7x14.png", 0.32f, TEXT_TILING_SHADER_COLOUR
)
val DEFAULT_CONFIG_PMLCD = AdapterConfig(
"pmlcd_inverted",