BASIC

Firmware

MGT


Dr Andy Wright


1989

SAM Basic was one of the prime selling points of the machine in it’s early days, written by Dr Andy Wright and with it’s roots in the highly successful BetaBASIC for the ZX Spectrum it offered a powerful interpreter with many advanced features such as sound and sprite handling.

Information from Frode Tennebø taken from the Sam Coupé Scrapbook

Programs may be up to 217K long on a standard 256K Coupe. (470K on a 512K). Line numbers up to 61439 are allowed, with each line containing up to 127 statements. Strings and arrays can have names up to 10 character long. The names of user-defined functions and numerical variables can have up to 32 characters. Strings can be up to 64K long; arrays can fill all available memory. SAM Basic is fully structured and includes procedures with local variables and parameter passing by value and reference. Long and short IF and ELSE are implemented, as are DO, LOOP, REPEAT, UNTIL, a CASE equivalent, ON, ON ERROR and GOTO label.

Graphics are well catered for, with vary fast DRAW, CIRCLE, PLOT and pattern FILL. RECORD and BLITZ allow complex graphics sequences to be stored and replayed at high speed. Any part of the screen can be moved in any direction with ROLL and SCROLL, and sections can be GRABed and PUT back elsewhere. PALETTE allows instant changes to the screen colours; all 128 colours can be displayed at once. The displayed screen can be instantly switch for another. The character set includes block graphics and a wide range of foreign characters. Character size can be altered to give 32, 64 or 85 columns. Double-hight characters can also be used. Text and graphics screen copies can be made to a suitable printer in a variety of sizes.

Sound commands include BEEP, SOUND and a range of pre-programmed sound effects. It is possible to have interrupt driven music from BASIC.

There are 56 built-in functions, which provide a full range of mathematical and string-handling functions as well as mouse and light-pen handling, string searching, hex and binary conversion and other features.

The tape system can handle program, data, binary and screen files at a wide range of speeds.

The keyboard can be completely re-programmed; predefined strings can be generated by any key.

Programs can be automatically indented to reflect structure and renumbered.

The first ROM 1.0 machines contained many bugs, most of which were ironed out in ROM 3.0 although a few ROM bugs still exist.

Dr Wright also offered an improvement on SAM Basic called MasterBASIC which included further additions to the syntax as well as performance improvements to the original.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.