Close

The array @

A project log for One kilobyte Tiny BASIC for the 8080 and Z80

BASIC for the 8080 and Z80, fits in 1K of memory, runs BASIC games on a 2K system. Features similar to Palo Alto Tiny BASIC.

willstevenswill.stevens 01/27/2024 at 09:120 Comments

There is a single array @, and it starts at the first byte of free memory after the parse area. The ^ variable stores the address of the start of the array. If I input LANDER.BAS (the classic LUNAR LANDER game) then PRINT ^ gives 1502. This means that Lunar Lander occupies 414 bytes (1502 - 1024 (start of RAM) - 64 (variable storage area)). Free memory is 2048 - 1502 = 546, but some of this is used by INPUT and for the stack.

There is no range checking on the array index, and the index can be negative. This means that @ can be used to access the whole of memory. This can be used in lieu of PEEK and POKE. PRINT @(-(^+1)/2) shows the 16-bit value at address 0000.

Discussions