# COMMAND_SPEC.md System Commands ABOUT BOOK CATALOG CLEAR CLS CLOSE #1 COLOR foreground COLOR foreground,background HELP INPUT #1, A$ LINE INPUT #1, A$ LIST LOAD LOAD "FIL.BAS" LOCATE row,column MODE AMBER MODE DOS MODE GREEN NEW NEWS OPEN "IN.TXT" FOR INPUT AS #1 OPEN "OUT.TXT" FOR OUTPUT AS #1 PRINT #1, "TEXT" RUN RUN "PROGRAM.BAS" SAVE SAVE "FIL.BAS" SOUND frequency,duration Keyboard Commands CTRL+C - BREAK AT LINE ESC - BREAK AT LINE Commands are case-insensitive. Program source casing and spacing are preserved for LIST, SAVE, and LOAD. `LOAD` opens a local `.BAS` text-file picker. `LOAD "FIL.BAS"` loads a bundled sample from `examples/` when it is listed in the catalog. `SAVE` downloads `CLASSIC.BAS`. `SAVE "FIL.BAS"` downloads the current program using the quoted filename. `RUN "PROGRAM.BAS"` loads a bundled sample and runs it immediately. `NEWS` prints the latest Classic BASIC new release notes. `CATALOG` lists bundled samples. `CLEAR` clears variables and arrays without deleting the stored program. `BOOK` opens the Classic BASIC guide book link. Display mode commands update terminal colors for the current session. Fresh loads and restarts begin in Green mode. `COLOR foreground` changes the current DOS text color only. `COLOR foreground,background` changes the current DOS text and background color. Printed lines keep the colors that were active when they were printed. In Green or Amber mode, `COLOR` is visually ignored for text and graphics. Nonzero graphics colors render in the active monochrome theme color; color 0 remains black so programs can clear graphics areas. DOS mode is the only true multi-color display mode. Core BASIC statements include PRINT, INPUT, LET, assignment, IF/THEN/ELSE, GOTO, GOSUB/RETURN, FOR/NEXT, WHILE/WEND, DIM, DATA, READ, RESTORE, REM, END, STOP, CLS, and graphics statements. `PRINT "TEXT";` keeps the next PRINT on the same output line. `LOCATE row,column` moves the text cursor to a 1-based screen position before the next PRINT. Press Escape or Ctrl+C while a program is running to stop it and return to the prompt. Ctrl+Break/Pause is supported when the browser exposes it. Touch/mobile devices without recent keyboard use show a small theme-aware BREAK button while a program is running. `SOUND frequency,duration` plays a browser-safe tone. Duration uses GW-BASIC-style clock ticks, about 18.2 ticks per second. `SLEEP seconds` pauses program execution for a browser-safe duration, capped at 5 seconds. Sequential file output downloads to the user's computer on CLOSE. Sequential file input uses the browser file picker. No BASIC file I/O touches the server. `CHR$(N)` returns the ASCII character for code N. `ASC(S$)` returns the ASCII code of the first character in S$. `DIM A(N)` creates a numeric array with indexes 0 through N. `DIM A$(N)` creates a string array with indexes 0 through N. `DIM A(N,N)` and larger multi-dimensional arrays are supported. Current game catalog: LOAD "BLACKJACK.BAS" LOAD "BLOCK.BAS" LOAD "FOOTBALL.BAS" LOAD "HANGMAN.BAS" LOAD "HIGHLOW.BAS" LOAD "RHOP.BAS" BLOCK DROP controls: LEFT ARROW or A = move left RIGHT ARROW or D = move right DOWN ARROW or S = soft drop UP ARROW, W, or SPACE = rotate P = pause/resume Q or ESC = quit ROAD HOPPER controls: LEFT ARROW or A = move left RIGHT ARROW or D = move right UP ARROW or W = move up DOWN ARROW or S = move down P = pause/resume Q or ESC = quit Graphics Commands SCREEN 1 PSET (10,10),15 PRESET (10,10) LINE (0,0)-(100,50),10 LINE (10,10)-(80,80),14,B CIRCLE (160,100),40,11 PAINT (160,100),12 POINT(100,50) DRAW "R40D20L40U20" GET (0,0)-(20,20),A PUT (40,40),A VIEW (0,0)-(319,199) WINDOW (0,0)-(100,100)