Skip to content

BASIC V2 Hints and Tips

greg-king5 edited this page Oct 12, 2019 · 3 revisions

Saving and Loading Programs

In the emulator, device 1 is connected to the current directory of the host computer. This means you can load and save programs directly.

Type in a short program, then use SAVE"HELLO.PRG",1 to save it. A new file, HELLO.PRG, is created on the host computer. Now, restart the emulator, and use LOAD"HELLO.PRG",1 to load the program.

Because device 1 is the default, you can leave off the ,1 part. Just type LOAD"HELLO.PRG".

List BASIC Keywords

** Note: This does not currently work, due to ROM banking. The BASIC ROM is not visible to PEEK(). A later version of the ROM should fix this issue. Watch this issue for a possible solution.

10 BASE=$C0A6
20 FOR P=BASE TO BASE+286
30 G = PEEK(P)
40 PRINT CHR$(G AND %01111111);
50 IF G > 127 THEN PRINT "",
60 NEXT P

This program prints out all the BASIC keywords. It shows that you can use hexadecimal numbers ($C0A6=49318) and binary numbers (%01111111=127).

You can use longer words for variable names (BASE), but only the first two characters are significant. This means that BASE and BALL are the same variable, but BASE and BEST (BA vs BE) are different variables.