At first glance it looks like and also its program editing enviroment, syntax of commands and even some system variables are identical to the ZX BASIC and BETA BASIC. Internally it is completely a new programming language, that supports the advanced features of the Coupé (especially graphics modes, colour palette and 64 or 85 characters per line), works with the entire basic memory of 512KB RAM, has 56 mathematical functions and provides hex and binary conversions.
The SAM BASIC uses the computer's memory completely and effectively, has an allocation table of every 16KB memory page, respect a marked memory layout, fills memory pages with programs, procedures, functions, variables, arrays, graphics screens and system extensions and protects any part from being overwritten. This means, among other things, that SAM BASIC programs can be up to 480 Kbytes long, with individual string variables up to 65520 characters long and up to 65535 items in one dimension of data arrays.
The SAM BASIC paging system can be even extended to support more RAM, the maximum that the Coupé's hardware can control is 32 16KB pages.
The SAM BASIC takes 32KB in two separate ROM pages, main first page at 0000H and the second, switchable if needed, at C000H. The lower ROM is always paged in unless user-loaded software initiates complex paging operations. The lower ROM pages in the upper ROM as required, for example, to handle floating-point calculations, BEEP or tape operations.
Z80 restarts addresses in the SAM BASIC ROM are partly similar to the ZX Spectrum
- RST 00H - "start-up" code
- RST 08H - errors handling
- RST 10H - PRINT the character in the A register
- RST 18H - get the current character (pointed to by CHAD variable) from a Basic line
- RST 20H - get the next character by advancing CHAD
- RST 28H - call the floating point calculator
- RST 30H - CALL or JP to the upper ROM
- RST 38H - maskable interrupt
The expansion named MasterBASIC brings some speed improvements, more comfortable program editing and tracing and an interrupt-driven video and sound capabilities.