Skip to content

Developer guide

Andrew Owen edited this page Jun 14, 2023 · 77 revisions

Build applications

Applications are stored as a collection of files and folders within a folder in a top-level folder called PROGRAMS. Application names can be any length and contain any valid FAT-32 filename character (including space). In SE Basic IV 4.2, applications are launched with RUN "MY APP NAME". The application name is truncated to derive the folder and binary filenames and spaces are converted to underscores.

PROGRAMS
|----------- MY_APP_N.AME
             |----------- PRG
                          |----------- MY_APP_N.PRG
                          RSC
                          |----------- RESOURCE.BIN

The RUN command sets the stack pointer to $6000, loads the binary (PRG file) at $6000, changes the path to the resource (RSC) folder and sets the program counter to $6000.

If the binary fails to load it restores the stack and falls back to BASIC. This means the binary can be up to 40K in length. The binary is then responsible for loading its own resources. The method for passing parameters to the app is to define a variable in BASIC.

This approach has a number of advantages over the single executable file method. For example, with multi-lingual software, only the selected language resources need to be loaded. It is also easy to customize the app without the need to recompile it.

Create PSG music

The Chloe 280SE, and some other SE Basic IV target platforms, support a programmable sound generator (PSG) with six channels. While it is possible to drive this chip directly, it is usually more convenient to use a tracker program. Two such programs are available, both with cross-platform support:

Unless you are already experienced with Vortex, we recommend using Arkos. For more information, refer to the manual.

Import MIDI

Arkos Tracker II enables you to import .MID files. Even unmodified files can often give good results. However, for the best results you should edit each channel so that a maximum of one note is playing at a time per channel. The easiest way to do that is with Aria Maestosa. If there is no drum track, you can use up to six channels for music. Otherwise, for simplicity you can use five channels for music and the sixth channel for drums. If you don't mind editing the tune in Arkos Trakcer II you can merge the simplest music channel with the drum track and change the instrument on the notes that are not drum sounds to get a full six channels of music plus drums.

Configure song properties

  1. Select Edit > Song properties.
  2. In the Replay rate section, select the Custom (Hz) check box and enter 60 in the box.
  3. In the PSG section, ensure the PSG count is 2. You may need to click Add PSG to add a second PSG or click X to remove unwanted PSGs.
  4. For each PSG, click Edit to edit the PSG properties:
    1. In the PSG type section, select the YM (Atari ST) check box.
    2. In the Reference frequency section, ensure the 440 Hz check box is selected.
    3. In the Master clock section, select the 1750000 Hz (Pentagon 128) check box.
    4. Ensure the Sample player frequency is set to 11025.
    5. From the Pan menu, select ACB. If you choose a different setting You must also configure panning on the Chloe 280SE before you play back the tune. This is goverend by port $F7 (AaBbCcDd):
      • 10 - pan left
      • 11 - pan center
      • 01 - pan right
      • 00 - mute
    6. Click OK to finish editing the PSG settings.
  5. Click OK to finish editing the song properties.

Export a song

Six channels tunes are only supported in the AKY format:

  1. Select File > Export > Export as AKY.
  2. Select a subsong from the menu. If there is only one subsong this will be Main.
  3. Ensure both PSG check boxes (1 and 2) are seleted.
  4. Select the Generate configuration file for players check box.
  5. In the Export as section, select the source file check box.
  6. (Optional) Enter an ASM labels prefix.
  7. Cleear the Encode to address check box.
  8. Click Export.
  9. Navigate to your project folder.
  10. Enter a File name and click Save.

Encode DAC audio

The Chloe 280SE includes two digital to analog converters (DACs). You can use these to play samples:

  • Encoding: Unsigned PCM
  • Channels: 1 @ 8-bit
  • Sample rate: variable (15350Hz recommended)

The easiest way to convert audio to this format is with the cross-platform command line tool SoX - Sound eXchange.

For example: ./sox input.wav -b8 -r15350 -c1 output.wav

Encode MVZ video

Miguel Angel Rodríguez Jódar has createad a video player for the Uno's DMA. It combines audio in a format suitable for playback over the DAC with mono 256 x 192 pixel images that can be displayed in low res mode. To create an MVZ file you must extract the audio and individual frames from a video. The easiest way to do this is with the cross-platform command-line tool Ffmpeg. To extract the audio use ffmpeg -i input.mp4 output.wav. You can then convert the audio to the required format with SoX. To extract the video use ./ffmpeg -i input.mp4 -pix_fmt monob -vf "vflip, scale=256:192" mvz%04d.bmp. You can experiment with other filters.

Encode SCR images

Images that use the Chloe 280SE's legacy video modes can be encoded in the SCR format.

The highest quality legacy color video mode is:

  • 256 x 192 pixels
  • 8 x 1 attributes
  • 64 colors (from a palette of 256).

There are two platform-specific GUI tools you can use to convert to this and other resolutions supported by the SCR format:

Note: With SCRplus, the attributes will be in serial (MLT) order and must be changed to the same order as the bitmap (SCR) to display the image correctly.

macOS

On macOS, you can try compiling SCRplus from source. Use Homebrew to install the dependencies:

brew install gtk
brew install sdl

And then download the project and use make. We couldn't get the GUI app to build, but we managed to build the command line tool after we fixed the reported errors (change fabs to abs and %hhu to %u).

You can use it with ./scrplus +U +t < input.png > output.scr. For more information, see the documenation.

Build SE Basic IV from source

SE Basic IV is developed using Git source control and the VScode text editor on Debian, macOS and Windows and hosted on GitHub. Documentation depends on Markdown.

Build prerequisites

The preferred IDE is Visual Studio Code (https://code.visualstudio.com/) with Maziac's Z80 Debugger extension (install from the app).

The compiler is RASM, although Windows also requires the Zeus Command Line assembler. The emulator is ZEsarUX on macOS and Windows (binaries are included in the repository). On Linux, ZEsarUX has a bug which prevents mounting a folder as a file system. Therefore, we use Linux with the FUSE emulator exclusively to develop the file system. You can run ZEsarUX on Linux, but you will need to create a suitable image file.

These steps are valid for Linux, macOS and Windows:

  • Install Visual Studio Code.
  • Install Git.
  • Clone the repository: git clone https://github.com/cheveron/sebasic4.git

You can now use the build scripts within Visual Studio Code to build the project.

macOS

The Universal Mac/Windows application must be compressed on a Mac. Copy the ChloeVM application into a folder called ChloeVM. From the Terminal, navigate to the ChloeVM folder and enter zip -r ChloeVM.zip . -x ".*" -x "__MACOSX". This creates a file suitable for distribution to Mac and Windows users that preserves the UNIX file permisisons.

Note: Currently the VM binary is x64. This runs fine under Rosetta 2. The VM builds on ARM64, but we'll stick to distributing the x64 version until Apple drops support for Rosetta 2.

Windows

The API reference requires Perl, which is not included with Windows:

  1. Create a subfolder called perlin the asmdoc folder.
  2. Install the portable version of Strawberry Perl: http://strawberryperl.com/releases.html.

iOS

It is not possible to build on iOS but it is possible to edit the source with Textastic and manage the repository with Working Copy. You can add Z80 syntax highlighting to Textastic by using a Sublime 3 plugin and copying it to a folder called #Textastic in Local Files.

Components

The firmware comprises:

  • BOOT: A small program that initializes the hardware and copies the font and parts of the BASIC and DOS programs to the required locations in memory.
  • BASIC: A 23K program containing the BIOS and an interpreter for the BASIC language.
  • OS: A 16K program that provides an interface between the BIOS and MMC media.

Binary structure

The binaries are contained in three ROM files:

  • 0: First 8K of OS.
  • 1: Bootstrap, second 8K of OS and last 7K of BASIC.
  • 2: First 16K of BASIC.

Boot sequence

From a cold start:

  • ROM-0 is selected.
    1. Initialization of OS commences.
    2. Second half of OS is copied from ROM-1 to OS-RAM.
    3. OS jumps to start of ROM-2, where code ensures that:
  • ROM-1 is selected.
    1. All RAM is cleared.
    2. All audio is muted.
    3. Initial palette is set.
    4. The font is copied to the frame buffer.
    5. The last 7K of BASIC is copied to HOME-RAM, then:
  • ROM-2 is selected.
    1. BASIC system variables and editor are initialized.
    2. Copyright message is displayed and the user is prompted for input.

X80 pseudo op-codes

X80 is an unofficial name for the virtual floating-point unit originally implemented in T/S1000 BASIC and subsequently used in SE Basic IV.

Because the original names of the calculator op-codes are unknown, the X80 specification defines its own, based loosely on those used by the Intel 8087 and the Motorola 68881. All X80 instructions start with an F. You can add the instructions to assemblers that support macros, for example:

MACRO fwait;							// stop the Z80
	rst $28;
ENDM

MACRO fjpt n;							// jump if true
	defb 0, {n} - $ - 1;
ENDM

Note: Typically, macros are case sensitive, so you must decide in advance if you prefer upper or lower case.

Instruction Set

Opcode	Instruction	Description

RST28H	FWAIT		cpu wait
00	FJPT		jump true
01	FXCH		exchange
02	FDEL		delete
03	FSUB		subtract
04	FMUL		multiply
05	FDIV		divide
06	FTOP		to power
07	FBOR		binary or
08	FBAND		binary and
09	FCP	.LE	compare (less or equal)
0A	FCP	.GE	compare (greater or equal)
0B	FCP	.NE	compare (not equal)
0C	FCP	.GT	compare (greater than)
0D	FCP	.LT	compare (less than)
0E	FCP	.EQ	compare (equal)
0F	FADD		add
10	FBANDS		string binary and
11	FCPS	.LE	string compare (less or equal)
12	FCPS	.GE	string compare (greater or equal)
13	FCPS	.NE	string compare (not equal)
14	FCPS	.GT	string compare (greater than)
15	FCPS	.LT	string compare (less than)
16	FCPS	.EQ	string compare (equal)
17	FCAT		string concatenate
18	FVALS		VAL$
19	FMULS		string by number multiplication
1A	FREAD		read in
1B	FNEG		negate
1C	FASC		character ASCII value
1D	FVAL		VAL
1E	FLEN		length of string
1F	FSIN		sine
20	FCOS		cosine
21	FTAN		tangent
22	FASIN		arcsine
23	FACOS		arccosine
24	FATAN		arctangent
25	FLOGN		natuaral logarithm
26	FEXP		exponential
27	FINT		integer
28	FSQRT		square root
29	FSGN		signum
2A	FABS		absolute magnitude
2B	FPEEK		PEEK
2C	FINP		INP
2D	FUSR		USR
2E	FSTRS		STR$
2F	FCHRS		CHR$
30	FNOT		not
31	FMOVE		move
32	FMOD		modulus
33	FJP		jump
34	FSTK		stack data
35	FDJNZ		equivalent to DJNZ
36	FCP	.LZ	less than zero
37	FCP	.GZ	greater than zero
38	FCE		cpu enable
39	FGET		get argument
3A	FTRN		truncate
3B	FSGL		single operation 
3C	FDEEK		DEEK
3D	FRSTK		restack
3E	FXOR		XOR
3F	FQUOT		integer quotient

A0	FSTK0		stack zero
A1	FSTK1		stack one
A2	FSTK.5		stack half
A3	FSTKPIX.5	stack pi/2
A4	FSTK10		stack ten

C0	FST	0	store in mem 0
C1	FST	1	store in mem 1
C2	FST	2	store in mem 2
C3	FST	3	store in mem 3
C4	FST	4	store in mem 4
C5	FST	5	store in mem 5

E0	FGT	0	get from mem 0
E1	FGT	1	get from mem 1
E2	FGT	2	get from mem 2
E3	FGT	3	get from mem 3
E4	FGT	4	get from mem 4
E5	FGT	5	get from mem 5

Other values are used by the series generator.

Chloe 280SE specification

The primary target for SE Basic IV is the Chloe 280SE, a personal color computer implemented as an FPGA core for a board derived from the ZX-Uno. It is envisaged as coming from an alternative 1987. It has the following features (subject to change):

  • CPU: Z80 @ 28MHz
  • Interrupt: 60Hz (programmable)
  • ROM: 40K (BASIC and OS)
  • RAM: 512K
    • 128K pageable in 16K chunks at the top of RAM.
    • Two exclusive banks of 64K, pageable in 8K chunks across the address space.
  • BASIC: SE Basic IV (23K, Microsoft BASIC compatible, extensible)
  • OS: UnoDOS 3 (ROM-based, FAT32 compatible, API compatible with esxDOS 0.8.5)
  • Video:
    • NTSC / 60FPS.
    • 32K VRAM (mirrors main RAM).
    • User programmable raster interrupt.
    • 256 colors (G3R3B2).
  • Software Video Modes:
    • 240 x 192 with 16 colors (palette of 256), 8 x 1 attributes, 40 column x 24 row text
    • 480 x 192 with 2 colors (palette of 256), 80 column x 24 row text
  • Physical Video Modes:
    • Legacy:
      • 256 x 192, 8 x 8 attributes, 16 / 64 colors (palette of 256)
      • 256 x 192, 8 x 1 attributes 16 / 64 colors (palette of 256)
      • 512 x 192, 2 colors (palette of 256)
  • Audio
    • 6-channel PSG (Dual AY-3-8913)
    • 8-bit / 44.1 KHz DAC
    • 1-channel beeper
  • Ports
    • Video out (VGA and composite NTSC)
    • Stereo audio out (3.5mm)
    • Mono audio in (3.5mm)
    • Keyboard (PS/2)
    • Mouse (PS/2)
    • Joystick x 1 (Atari D-type, configurable)
    • MMC (SDHC card)

Comparison chart

Model Year Price CPU @ MHz ROM RAM Colors Res Voices Keys
Apple IIGS 1986 US$999 65C816 2.80 128K 256K 4096 640x200 32 79
Atari 520ST 1985 US$799 MC68K 8.00 192K 512K 512 640x400 3 95
Chloe 280SE 1987 ? R80 33.33 40K 512K 256 640x200 6 88
Commodore Amiga 1985 US$1,295 MC68K 7.16 256K 256K 4096 640x400 4 89
Commodore 65 1991 - CSG4510R3 3.54 128K 128K 4096 1280x400 6 77
Panasonic FSA1GT 1992 US$999 R800 7.16 96K 512K 19268 256x212 12 92
Tandy 1000 1984 US$1,200 8088 4.70 ? 128K 16 16 3 99
TI-99/4A 1981 US$525 TMS9900 3.00 16K 16K 16 256x192 3 48
TS1500 1983 Z80 3.25 8K 16K 2 256x192 0 41
TS2068 1983 Z80 3.58 24K 48K 16 512x192 3 42

Releases

Aside from Windows, which has gone back to using numbers, most operating systems now have some kind of naming convention. For example, Debian is named after characters from Toy Story while Ubuntu is named after animals in alphabetical order. Because of the usenet:comp.sys.sinclair obsession with Buffy the Vampire Slayer, it seemed appropriate to name future releases of SE Basic after female characters from the Buffyverse. The canonical list of version names will continue with 4.2.x releases until the dedicated Chloe core is created. At that point the next release will be a 4.3.x release and this list will be renumbered.

  • 4.0 Anya - released in 2011 as a fork of OpenSE BASIC 3.1 with 80 column support.
  • 4.1 Buffy - released in 2013 as a failed attempt to refactor the entire codebase in one go.
  • 4.2.0 Cordelia - in development since 2019: scheduled for release on November 19, 2023.
    • Audio: All audio commands now use the PSG instead of the buzzer.
      • BEEP command. Equivalent of PRINT CHR$(7).
      • PLAY command optimized.
      • SOUND command updated to match MSX BASIC functionality.
    • SE/OS version 1.0.0. APIs for:
      • Console
      • File system
      • Graphics
      • Sound
    • Calculator: added 40-bit float to 32-bit long conversion subroutine.
    • Messages: trimmed to save space.
    • NEW command preserves status of CAPS LOCK and screen mode.
    • SEEK command (random access for files up to 4GB in length from BASIC).
  • 4.2.1 Drusilla
  • 4.2.2 Eve
  • 4.2.3 Faith
  • 4.2.4 Glory
  • 4.2.5 Harmony
  • 4.2.6 India
  • 4.2.7 Jenny
  • 4.2.8 Kendra
  • 4.2.9 Lucy
  • 4.2.10 Molly
  • 4.2.11 Nikki
  • 4.2.12 Olivia
  • 4.2.13 Peaches
  • 4.2.14 Queen
  • 4.2.15 Rona
  • 4.2.16 Sandy
  • 4.2.17 Tara
  • 4.2.18 Uftar
  • 4.2.19 Violet
  • 4.2.20 Willow
  • 4.2.21 Xin
  • 4.2.22 Yuki
  • 4.2.23 Zoe

Beta releases

SE Basic IV beta releases have an incept date and codename based on characters from Blade Runner.

  • 200214 Pris
    • Frame interval now configured for 60Hz interrupt.
    • Changes for compatibility with native file system under emulation.
    • Fixed initialization bug affecting CLEAR command.
    • BASIC bytes free now calculated from CLEAR address.
    • Space now permitted as a substitute for underscore in file names.
    • UnoDOS 3 moved into its own project.
    • Updated UnoDOS 3 kernel to 3.1 Wolf.
    • Hardened file commands to work around limitations in the kernel.
    • LOCATE now works correctly for first 22 rows.
    • BREAK clears the keyboard buffer.
    • Updated system font.
    • Code page support for 437 IBM English US, 1250 Central Europe, 1251 Cyrillic, 1252 Western Europe, 1253 Greek, 1254 Turkish, 1255 Hebrew, ATASCII (Atari 8-bit), Atari ST, MSX2+ (Japanese), PETSCII (Commodore 8-bit)
    • Language support for German, English (US), Spanish, Finnish, French, Greek, Hungarian, Italian, Dutch, Portuguese, Russian, Turkish, Ukrainian
  • 200410 Leon
    • CPU clock is increased to 28MHz on rev4.1 hardware with core EXP27.
    • New MASKADD system variable enables users to have the maskable interrupt call a custom routine after the FRAME and TIME system variables are updated but before the keyboard is read. This removes the need to use IM2 mode and tables in interrupt driven routines.
    • Return of the detokenizer. On editing a line, tokens are now converted back into individual characters. This improves cursor movement in the edit line.
    • Return of trace (TRON/TROFF). Reports the current line while executing BASIC.
    • Return of renumbering (RENUM). Enables the user to renumber the program with an optional starting line and increment.
    • Return of error trapping (ON ERROR {CONT|GOTO|STOP}). Enables the user to redirect the program when an error is detected.
    • Return of extended LIST [<start>][,[<end>]]. Enables a range of lines to be listed where start and end lines are optional.
  • 200523 Rachael
    • Localization and code page support now works in the VM using the host file system.
    • Default code page is now set to Western European (for regression testing). Default language is now set to French (for regression testing).
    • Channels and streams subsystem update in anticipation of future BASIC file access support in the format OPEN #3,"O","/docs/output.txt".
    • HEX$ function to convert an integer decimal to a hexadecimal string. Example: H$=HEX$ 16384.
    • CAPS LOCK is now on by default. Very old BASIC programs written for systems with no lowercase character support fail if CAPS LOCK is off. SHIFT toggles the case of the character so that when CAPS LOCK is on it will produce lower case characters.
    • Updated start screen.
    • Cleaned up code comments and added new section headings.
  • 200612 Zhora
    • Changed timestamp message for intermediate builds.
    • Removed double spacing after certain tokens.
    • Restored setting background color on NEW.
    • Moved channel code in preparation for extension.
    • Fixed ASCIIZ message printing to ensure no tokens are printed.
    • Fixed DEF FN bug (incorrect token prevented function discovery).
    • Added two new calculator literals (unused at present).
    • Faster random number generation.
    • Functions can now be called recursively: 10 DEF FN a(x,y)=x+y : PRINT FN a(2,FN a(1,1))=4.
    • Fixed division bug: IF 1/4<> 0.25 THEN PRINT "BUG".
    • Fixed exponentiation: (-10)^5.
    • Now passes Daniel Nagy's calculator test suite.
    • Fixed note table (Zeus truncates so constants are hard coded again).
    • Added vector table for frequently called routines.
    • Added printing codes for cursor up and down.
    • Minor optimizations to the file handling code.
    • All editing keys can now be read.
    • F-keys can now be read from BASIC (experimental).
    • Combined table of operators and priorities.
    • Updated copyright date.
    • Source cleanup.
    • Added Baltic (CP1257) and Vietnamese (CP1258) code pages.
    • New HELP.CP code page with Serif, Italic and Bold.
  • 200715 Morton
    • Assembler switched from Zeus to RASM for everything except firmware update builds.
    • Supports the final layout of the Chloe 280SE keyboard.
    • Video is VGA / NTSC @ 60Hz.
    • 15 function key macros for common commands.
    • Support for loading keyboard maps at boot.
    • US keyboard maps for rev2.1 and rev4.1 devkits.
    • Chloe keyboard maps for rev2.1 and rev4.1 devkits.
    • Printing character codes $07 to $1F now functions as in Microsoft BASIC.
    • New JSTATE system variable for reading the joystick.
    • New MSTATE system variable for reading the mouse.
    • Added delay before error message printing on BREAK and NEW.
    • Sets correct speed on Prism hardware.
    • DB9 port defaults to Kempston (K-stick).
    • Keyboard-mappable joystick switched off.
    • Mouse initialized on boot.
    • Key delay now closer to PC-BASIC.
    • Raster interrupts enabled by default on scan line 201.
    • Default IM2 routine at $00FF.
    • New config.sys option sc= switches scan-doubler on or off for Uno hardware. This may improve the image on some monitors. If no image is displayed, use the other setting.
    • Japanese localization.
    • Lithuanian localization.
    • Updated code pages.
    • Boot ROM now explicitly sets all hardware settings.
    • Source cleanup.
    • Added Linux target.
    • Fixed LIST bug.
    • Restored line cursor in auto-listing.
    • Fixed editor bugs; duplicate cursor, missing bell, edit non-existent line.
  • 200930 Iggy
    • New keyboard support:
      • Brazilian
      • Spanish
      • AZERTY (work in progress)
      • QWERTZ (work in progress)
    • Language support:
      • New code pages:
        • KOI-8R (Russian)
        • Updated code page 437 (IBM) character definitions.
      • Translation:
        • Updated existing languages.
        • Switched Russian translation to use KOI-8R to enable future JCUKEN keyboard support.
      • New languages ​​​​added:
        • Danish
        • Polish
        • Romanian
    • Updates to the file system framework
    • Raster interrupt examples.
    • Removed all dependencies on Zeus assembler. Now builds on macOS, Linux and Windows using RASM assembler.
  • 210628 Rick
    • Refactoring and label improvements.
    • Internal API for system calls.
    • Localization extended:
      • 9 keyboard maps (including Colemak and Dvorak).
      • 15 code pages (mainly from the Windows 125x series).
      • 25 language localization files (22 unique languages plus code page variants).
    • Updated docs.
  • 220122 Gaff
    • Shortcuts
      • & : AND
      • ~ : NOT
      • | : OR
      • ? : PRINT
      • ' : carriage return in PRINT statement (replaces \).
    • New commands
      • DPOKE: 16-bit POKE.
      • OLD: Restore program to state before last NEW.
    • New functions
      • DPEEK: 16-bit PEEK.
      • FIX: Truncate a number towards zero (remove fractional part).
      • LEFT$, MID$, RIGHT$: Microsoft style string slicing (Timex style string slicing remains available).
      • STR$: Now incorporates BIN$, HEX$ and OCT$ functionality (base 2 to 36).
      • STRING$: Defines a string from a repeated character.
    • New operators
      • \: Truncated division
      • MOD: Module
      • NOT: Bitwise NOT
      • AND: Bitwise AND
      • OR: Bitwise OR
      • XOR: Bitwise XOR
      • PRINT: Now supports string multiplication.
    • Interpreter changes
      • Order of precedence changed to match Microsoft BASIC.
      • Timex style boolean operators replaced with Microsoft style 16-bit signed bitwise operators (true = -1, false =0).
      • Unified detokenizer gives the same results in listings and in the editor.
      • Long variable names are now supported.
      • Various bug fixes and speed improvements.
      • All calculator functions are assigned, and the calculator is now complete.
      • Added /SYSTEM/TEMPORARY folder (used by NEW/OLD to store/retrieve a copy of the previous program).
    • Build changes
      • Changed the Linux build target to run with the FUSE emulator. Mounting a folder as the file system does not work on Linux with the ZEsarUX emulator.
      • An SZX snapshot containing only the machine settings and a copy of UnoDOS 3 is provided for use with the FUSE emulator. After a build, a hard reset is required to mount the file system.
      • A change in the location of the localization data necessitates a definition of the start location being set in boot.asm. This can be derived from the symbols.txt file generated when building the interpreter.
  • 220422 Freysa
    • Return of the MERGE command.
    • LOAD, SAVE and MERGE now use plain text.
    • LOAD f$,"R" autoruns program f$.
    • LOAD f$,"T" and SAVE f$,"T" load and save programs in tokenized form.
    • Load BASIC programs from incompatible interpreters (must be modified to run).
    • KEY command to list (KEY LIST) and define (KEY n, f$) the 15 macros. These work in any program that uses the ROM keyboard routine, including apps.
    • New default set of macros (LIST,RUN,LOAD ".BAS",SAVE ".BAS,CONT,TRACE,BLOAD "",,BSAVE "",,,KEY,SCREEN,FILES,CHDIR "",FILES "\PROGRAMS",COLOR 7,1,KEY LIST)
    • File access from BASIC (input, output, append, experimental random).
    • Fixed file buffers replaced with temporary buffers in workspace.
    • Reorganized token table and reallocated unassigned tokens before commands in the table.
    • Renamed DPOKE and DPEEK to DOKE and DEEK for consistency with other 16-bit BASICs.
    • Square brackets enabled as substitutions for parenthesis in the tokenizer.
    • Added a substitution table to the tokenizer and refactored the substitution code.
    • Refactored the way prefix operators are handled in expression scanning.
    • Expressions between curly braces { and } are not evaluated, but their syntax is checked upon entering. They are interpreted as strings that can be passed to VAL or VAL$ for actual evaluation.
    • IF/THEN/ELSE directive.
    • WHILE/WEND loops.
    • Fixed function key repeat bug.
    • Combined code pages into unified base Unicode font to generate required code pages with BitsNPicas.
    • New languages: Albanian, Arabic, Basque, Bosnian, Catalan, Chinese (Pinyin), Czech, Esperanto, Estonian, Icelandic, Indonesian, Irish, Korean, Maltese, Norweigan, Slovak, Slovene, Spanish (Latin America), Swahili, Welsh. This brings the total number of localizations to 49.
    • Updated code pages: CP437, CP1250, CP1251, CP1252, CP1253, CP1254, CP1255, CP1257, ATARI-ST, ATASCII, KOI8-R, PETSCII.
    • New code pages: CP1256 (incomplete), APPLE-II, ISO-8859-3, ISO-8859-16, PINYIN, RISC-OS. This brings the total number of code pages to 23.
    • INSTR function.
    • TRACE {ON|OFF} replaces {TRON|TROFF}.
    • BASIC pre-processor converts:
      • => to >=, =< to <= and >< to <>.
      • [ to ( and ] to ).
      • &H to $ and &O to @.
      • ATN(n) to ATAN(n)
      • COLOUR to COLOR
      • ELSE to :ELSE except if it is the first statement in a line.
      • FNa to FN a where a is an alphabetical character.
      • HEX$(n) to STR$(n, 16) and OCT$(n) to STR$(n, 8).
      • RND(n) to RND where n is any single digit value.
      • THEN n to THEN GOTO n where n is a numerical character.
      • TRON to TRACE ON and TROFF to TRACE OFF.
      • SPACE$(n) to STRING$(n,32).
    • Quick launch applications with !<application_name>.
    • ON n {GOTO|GOSUB} n1, n2... command.
    • RUNBASIC app provides a framework for packaging tokenized BASIC programs as applications.
    • An AUTOEXEC.BAS program in tokenized format stored in the root path will run automatically on a cold boot or hard reset.
    • User-defined channels: OPEN #s,c$ with the channel creation address in the open_x system variable where s is a stream [3 to 15] and c$ is an alphabetic character excluding A, F, I, K, O, R, S and W. CLOSE #s with the channel close routine following the channel letter in the channel descriptor.
    • File commands completely refactored and no-longer use fixed buffers.
    • Updated the behavior of CLEAR, CLOSE, END and RUN to match the documentation / Microsoft BASIC.
    • CALL and RUN f$ now take comma-separated BASIC variables as parameters.
    • IM1 priority changed to run call user routine first.
    • First beta release of the public API (for OS calls).
  • 230605 Roy
    • Updated COLOR and PALETTE commands to work in any screen mode.
    • 40 column mode (SCREEN 1).
      • PLOT command sets a pixel to the current foreground/background color combination.
      • CIRCLE draws a circle in the the current color combination (0 to 239 by 0 to 121).
      • DRAW draws a line x, y distance from the last PLOT location (negative values accepted).
      • Vector table for user-definable screen modes.
    • 80 column mode (SCREEN 0) updates.
      • Line drawing commands can be entered in text mode but will produce a runtime error.
      • PALETTE values preserved when changing screen mode.
    • PLAY command for accessing the square wave and the GM-MIDI capabilities of the sound chip.
    • Refactored and removed the miscellaneous module to make room for the PLAY command.

Alpha releases

Prior to the first beta release, there were eight alpha releases:

  • Phase 1:
    • Removed redundant code including tape and printer routines.
    • Source broken into separate modules.
    • Added a tokenizer with the ability to ignore external OS commands.
    • Replaced the 7-bit character set with an 8-bit character set suitable for viewing at single and double height.
    • New display code supports 8-bit code pages. The default is page 437.
    • Boot ROM created. This initializes the palette, reads it back to the palette buffer, and copies the font to the frame buffer. It also copies the parts of the OS and BASIC that reside in RAM into the appropriate memory locations.
    • Use % to prefix binary numbers.
    • Moved almost all the data to a separate area of ​​memory starting at $3d00. This avoids the disk hardware trapping the PC for emulation purposes.
    • Renamed commands based on Microsoft BASIC.
    • Rewrote error messages based on Microsoft BASIC.
    • New keyboard routines. Meta (set 7) and Control (set 7, res 6, res 5) modes enable entering characters 32 to 255 directly.
    • New command tables.
    • Initial version of COLOR command for text mode enables setting foreground and background from 16 palette registers.
  • Phase 2 - added file system commands:
    • BLOAD "filename.bin", to
    • BSAVE "filename.bin", a, l
    • COPY "filename.a" TO "filename.b"
    • CHDIR "path"
    • DLOAD "filename.dat"
    • DSAVE "filename.dat"
    • FILES "path"
    • KILL "filename.ext"
    • LOAD "filename.bas"
    • MKDIR "foldername"
    • NAME "filename.a" TO "filename.b"
    • RMDIR "foldername"
    • SAVE "filename.bas"
  • Phase 3:
    • CP1254 - Turkish.
    • Debugged calculator.
    • Light optimization of file commands.
    • Reorganized data.
    • Tokens are now reserved words.
    • LET is optional.
    • Substitute ' for REM.
    • Cleaned up restarts.
    • Cleaned up SKIPS.
    • Added POSIX time support.
    • Updated keyboard handler.
    • Swapped SOUND input parameters.
    • CALL, DELETE, EDIT, END, ERROR, LOCATE and PALETTE commands.
    • Removed redundant flag checks.
    • Increased printable character range.
    • ASCIIZ message printing.
    • Optimized screen module.
    • NMI fix.
    • Added 37 tokens.
    • Move up and down in an edit line.
    • Delete, Home, End, Page Up, Page Down keys.
    • Sym + Space / Enter now produces a separate character.
    • NMI break.
  • Phase 4:
    • Fixed a RETURN bug.
    • Marked UnoDOS 3 entry points.
    • Optimized arithmetic module.
    • Renamed LN to LOG.
    • Added empty comments to remaining modules.
    • Keyboard buffer.
    • System variable and ORG cleanup.
    • Editor cleanup.
    • Empty comments to remaining frameworks.
    • Extended RUN to work as a file command.
    • Overhauled reports.
    • Three new command classes and shortened command parameter table.
    • Style clean-up.
    • Optimized command module.
    • Fixed ORG offsets.
    • Fixed a tokenizer bug.
  • Phase 5:
    • Source formatting cleanup and comments.
    • Removed unused ORGs.
    • Moved expression tables to data module.
    • bin, oct and hex digits.
    • \ = newline.
    • Updated bitwise operators.
    • Optimized expression module.
    • Fixed WAIT bug.
    • Increased line range to 16383.
    • Cleaned up streams.
    • Fixed INPUT bug.
  • Phase 6:
    • Added auto update feature for the ZX Uno. Warning: Replaces esxDOS with UnoDOS 3 and requires a 32K ROM in slot 1 to 2.
    • FILES command now accepts a path.
    • Boot chime is no-longer CPU speed dependent.
    • Build scripts now produce a firmware file for use with the auto update mechanism.
    • UnoDOS 3 is now mandatory (but supports a patched version of the Dr. Slump NMI menu when emulating a TC2048).
  • Phase 7:
    • Auto-update consumes a "Firmware .bin" file at the root of the SD card on boot. The process includes three integrity checks. WARNING: Power off required before restart when transferring file wirelessly.
    • Added a timestamp to the boot message. This provides a visual indicator that an update has been successful.
    • COLOR command now supports the official ULAplus spec and the ZX-Uno implementation of palettes in hi-res mode.
    • COLOR f,b sets the foreground and background color (from 0 to 15).
    • PALETTE c, v sets a color (0-15) to a BGR value.
    • You can use octal with PALETTE to choose the BGR color levels (bright white = @377, full blue = @300, full green = @070, full red = @007).
    • Commented out remount code in FILES command as a precaution.
  • Phase 8:
    • Localization support using a plain text CONFIG.SYS file in the SYSTEM folder.
    • User configurable keyboard layout.
    • User configurable error messages.
    • Chloe keymap for ZX Uno.
    • Windows code pages: 1250 to 1255.
    • IBM, Atari ST, Atari 8-bit and Commodore 8-bit character sets.
    • Enhanced FILES command (folders and files are grouped, folder names can be 11 characters, wide display).
    • 256-byte COPY buffer.

Earlier releases

SE Basic IV was forked from the OpenSE BASIC project. Version 4.0 (Anya) introduced 80 column mode. Version 4.1 (Buffy) was an unsusccessful attempt to refactor the code. Version 4.2 (Cordelia) was rebuilt from the ground up for the Chloe 280SE hardware. Earlier versions used the T/S 2000 BASIC dialect, but this has been deprecated in favor of the Microsoft BASIC dialect.

Here is the changelog for OpenSE BASIC the curious:

3.1.2 - 28 MAY 2012

  • Fixed a bug in DEF FN recursive functions (thanks to Miguel Jodar).
  • Note: This fix causes problems with logical operators. Rolled back in version 4.
  • New default palette (mostly using code as data to free 64 bytes for the fix).
  • Moved the UDGs next to the palette to create 22 user variables addressable via the IY register.
  • Changed the COPY command to CALL.
  • ZXC3 version excludes the DEF FN fix, and moves the cursor and font definitions, but is otherwise identical.

3.1.1 - 20 MAY 2012

  • Fixed a bug where STR$ would remove the value of ATTRT. For example: PRINT PAPER 5;1;STR$ 234. All available space is now used.
  • Added support for building a special version for ZXC3 cartridges for the Interface II.
  • Revised version numbering to add another point. The were four builds of version 3.08. These are now retrospectively labelled 3.0.8 to 3.1.1. This brings OpenSE BASIC in line with GNU version numbering (major.minor.revision).

3.1.0

  • Minor optimization.

3.0.9

  • Applied a patch to support a commonly called routine. Should improve compatibility.
  • Removed service routine at 4200. 9 bytes spare.

3.0.8

  • Contents after REM no-longer tokenized. This was introduced a long time ago to support HiSoft BASIC, but there is no prospect of HiSoft BASIC working with OpenSE BASIC so there's really no need to tokenize after a REM.

3.0.7 - 29 APR 2012

  • Fixed the bug in handling keywords beginning with IN introduced by the <=/<>/>= fix.
  • INK is no longer available as an alternate command and CAT goes back to DIR.
  • COPY 4200 fills the second display file with the permanent attribute.

3.0.6 - 23 APR 2012

  • Fixed the tokenizer bug: <=, <>, >= are now handled correctly.
  • EDIT with no parameters now edits the last line entered.

3.0.5 - 05 APR 2012

  • Further optimization: 24 spare bytes.
  • Cursor handling modified to deal with the removal of the EDIT key.
  • Restored original palette for the time being due to anomalies with HSL hardware.
  • Restored the Insert mode cursor from version 3.03.
  • Reformatted the tabs for VisualStudio/TextWrangler.

3.0.4 - 14 FEB 2012

  • Minor optimization
  • New default palette for RGB or HSL modes in ULAplus
  • Changed four commands DIR > CAT, GO SUB > GOSUB, GO TO > GOTO, ON ERR > ON ERROR
  • Now uses CLUT 0 on boot
  • EDIT key replaced with TAB key
  • Insert mode cursor now uses character 128
  • Cryptic credits changed

3.0.3 - 29 MAY 2011

  • Fixed a bug in the DRAW command

3.0.2 - 24 MAY 2011

  • Compiler changed to GNU binutils.
  • Initialization routine now puts a copy of the default palette in the palette buffer.
  • ERASE command now sets the palette to the values stored in the buffer.
  • Corrected an error with the '_' glyph.

3.0.1 - 13 APR 2011

  • Moved the UDGs up next to the system variables creating space for 64 palette bytes after the attributes for use with ULAplus screen files.

3.0.0 - 06 APR 2011

  • Switched to using OPEN81.ASM as the base assembly file.
  • Implemented the X80 math co-processor instruction set via macros.
  • A complete rewrite replacing all the encumbered code with open source code or legally reverse engineered code where that was not available.
  • Functionally compatible with SE Basic 2.21.
  • New RENUM routine. It only accepts the first two parameters (start and step), but it isn't broken either.
  • New tokenizer. You can now enter INK and it will automatically be translated to PEN. Abbreviations for 60 commands.
  • New I-beam cursor for INSERT mode.

2.2.1 - 04 DEC 2010

  • Fixed a bug where 8-bit character sets were being automatically enabled.
  • Enabled support for IM2 code that uses the first two ROM bytes as part of a JP 0xAFFF instruction (used by Starstrike II).
  • There is a bug in the colour handling during editing where entering a bad colour value will result in a syntax error report instead of producing the error cursor. This is caused by an incorrect guard condition on a jump but has no effect in runtime.
  • Deprecated Features
  • macro support.
  • big colourful copyright message.
  • colour cursors.
  • built-in 42-column mode.
  • ANSI BASIC-78 command names. (later reinstated)
  • page up/down.
  • 8 extra symbol definitions.

2.2.0 - 06 NOV 2010

  • Modified the GRAPHICS mode cursor.
  • Changed the location of the detokenizer flag.
  • Changed the location of the 8-bit flag.
  • Used the spare bytes to include a few initials for credits.

2.1.9 - 01 NOV 2010

  • DIR command replaces CAT command.
  • Key click is off by default. POKE 23609 to enable.
  • Modified the error sound code to prevent crashes caused by the detokenizer.
  • Error sound now occurs on a syntax error in direct entry.

2.1.8 - 28 OCT 2010

  • Fixed ON ERR bug.
  • SAM BASIC style cursor.

2.1.7 - 27 OCT 2010

  • PEN command replaces INK command.
  • Cursors no-longer FLASH. Looks better with ULAplus and saves 15 bytes.
  • Change default start colours to white on black.

2.1.6 - 22 OCT 2010

  • Relocated the UDGs to the former print buffer giving an additional 168 bytes for BASIC programs.

2.1.5

  • Syntax frozen with this release.
  • Modified the CAT command to take parameters.
  • Added the ERASE command to reset the default palette.
  • Replaced the error messages to make space for the above changes.

2.1.4 - 18 OCT 2010

  • Removed the 8 extra symbol definitions.
  • Fixed the embedded control codes edit line bug.
  • Added the CAT command to switch between 7-bit and 8-bit character sets.
  • Added the MOVE command to provide BASIC access to the Z80's block copy feature.

2.1.3

  • Fixed the RENUM stack overflow bug (RENUM still unstable).

2.1.2 - 25 MAR 2010

  • Modified fp_mod to use mem 1 instead of mem 0.
  • Changed the scroll count in ld_look_h from 3 to 255.
  • Changed the pilot signal in ld_start from 0x0415 to 0x0115.
  • Changed the maskable interrupt to avoid using IY.
  • Optimized stack_bc.
  • Changed error RASP duration.

2.1.1

  • Extended SCREEN$ function to handle characters 32 to 255 (for 8-bit character sets).

2.1.0 - 24 MAR 2010

  • Fixed an error introduced while cleaning up the code.
  • Added support for 8-bit character sets.
  • Replaced unused bytes with RETs.

2.0.9 - 23 MAR 2010

  • Fixed the PAUSE bug (thanks Woody!). The LastK flag (bit 5 of [23611]) is set prior to the PAUSE, prematurely ending the pause immediately. For example, FOR N = 1 TO 100 : NEXT N : PAUSE 0 (run, press a key. no pause). The ROM should clear bit 5, [23611] before the first test after the HALT.
  • Moved some routines around.
  • Replaced the 8 unused bytes in the main area with RETs.
  • 9 spare continuous bytes left.

2.0.8 - 21 MAR 2010

  • Fixed an error in the ON ERR handler introduced by a formatting change.

2.0.7

  • Improved palette.
  • Detokenizer.

2.0.6 - 17 MAR 2010

  • Still using USRA.ASM as the base assembly file.
  • Appears to be internally consistent.
  • Feature freeze until compatibility issues are resolved.
  • Built on a stripped version of the GW03 ROM (code but not the assembly listing) with all the new functionality removed and just the bug-fixes remaining.
  • The 'style' bugs (not corrected in GW03) were fixed.
  • Floating point and other optimisations from the SC01 ROM were applied.
  • Code was merged, one routine at a time, into the Uncommented Spectrum ROM Assembly, and tested with the Interface I (this relies on many entry points being maintained and is a good acid test).
  • The source was cross-compiled with Pasmo by Julian Albo and the resulting code tested on Fuse (by Philip Kendall et. al.) and the ULAplus code tested in SpecEmu (by Woody).

2.0.5

  • Removed the last fragment of ZX Printer support.
  • RUN and STOP tokens replaced with CODE and RUN.
  • 'C' mode replaced with 'G' mode for entering reserved words.

2.0.4

  • Enter octal with \.

2.0.3

  • Prevented the GO TO token from displaying during LOADing and SAVEing.

2.0.2

  • Used TOKENs to abbreviate error messages.
  • Restored missing palette data.

2.0.1

  • Shifted the @ and © characters right by one pixel for proper display in 6x8 modes.
  • Fixed a error with the initialization routine-misplaced org and overrun.
  • ON ERR is now reset after an NMI or a NEW. This also fixes what looked like a bug in DELETE.
  • Shrank the canned report messages by adding support for canned tokens, saving 26 bytes.
  • Moved two routines to make use of free space.
  • Added LOAD, CODE and RUN tokens on Q, W and E keys with symbol shift.
  • Modified the tokenizer. In 'C' mode, lower case text is not tokenized. Enables use of reserved words as variable names. Variable names are case insensitive and can be entered in a mixture of letters in this mode, providing they contain at least one lowecase letter.
  • Restored IM2 vectors at 0x38ff, 0x39ff, 0x3aff, and 0x3bff.
  • Trimmed ON ERR code.
  • CLEAR does a RESTORE as per the manual.

2.0.0 - 12 FEB 2010

  • Switched to using USRA.ASM as the base assembly file.
  • ULAplus support.
  • ON ERR commands.
  • PALETTE command.
  • Convert decimal to hex with ~.

1.0.0 - 06 JAN 2006

  • Warm restart from SC01.
  • RENUM command.
  • Compiler changed to Pasmo.

0.9.4 - 16 DEC 2004

  • Changed to a different base assembly file.
  • SOUND command (adapted from TS2068 ROM).

0.9.3 - 22 NOV 2002

  • Shipped with vbSpec and ZX Spin.
  • DELETE command.
  • Enter hexadecimal with &.
  • Inverted line marker.
  • SYSTEM command.
  • Detokenizer removed.
  • TRUE VID and INV VID now do page up and down 10 lines.
  • CLS n sets the border and attributes.
  • extended LIST command (from IMC ROM).

0.9.2

  • Experimental detokenizer.

0.8.3 - 13 NOV 2002

  • Colourful copyright message.
  • Colour cursors.

0.8.0 - 10 NOV 2002

  • All known bugs fixed.
  • Newton Raphson square roots.
  • Human readable assembly labels.
  • Fully relocatable source.
  • Error cursor jumps to the error.
  • NMI warm restart.
  • Increased the range of printable characters to 104.
  • Made the scroll? message sentence case.
  • Removed the COPY command.
  • Added error sound to invalid line.
  • 0x12a0 trap for ResiDOS.
  • 0x1349 entry point for IF1/ResiDOS.
  • Shortened error messages.
  • Removed redundant routines.
  • EDIT command.
  • Optimized code involving modes since modes are gone.
  • SCREEN$ handles UDGs (thanks to Hob).

0.7.4

  • Moved the credits into a separate file.

0.7.3

  • Optimized initialization code.

0.7.2

  • Removed the redundant REC-EDIT code.

0.7.1 - 23 JAN 2002

  • Fixed an error in scroll handling.

0.7.0

  • Fixed an error in ED-EDIT.

0.6.9 - 20 JAN 2002

  • Compiles with ZASM and TASM.

0.6.8

  • First version with all functionality of 0.5.8 to compile from a single source file.
  • Full support for line numbers up to 16383.
  • Bugfixes:
    • PLOT.
    • WAIT-KEY.

0.6.7

  • Fast RAM wipe.
  • Bugfixes:
    • EDIT.
    • LIST.
    • RESTORE.

0.6.6

  • 16K machine test.
  • Cursor up and down in an edit line (adapted from LEC ROM).

0.6.5

  • Reworked the cursor routines.

0.6.4

  • Removed 'K' mode.
  • Removed the redundant key tables.

0.6.3

  • Bugfixes:
    • leading space.

0.6.2

  • Reduced the number of key tables to four.
  • Used a key table for numbers and symbol.
  • Enabled STOP in INPUT using cursor down for all cases.
  • Bugfixes:
    • -65536 (PRINT INT -65536).
    • DEC-TO-FP.
    • double store.
    • MOD-DIV.
    • PO-FETCH.
    • RUN/GO TO/GO SUB.
    • stack.

0.6.1

  • Speeded up pilot signal sync. at 0x0571.
  • Set the scroll counter to 0xFF at 0x077A.
  • Dropped the error number from error messages.
  • Changed the RASP duration at 0x108E and 0x116C.
  • Bugfixes:
    • CHR$ 8 (PRINT AT 0,0;CHR$ 8;"A").
    • CHR$ 9 (PRINT "A";CHR$ 9;"B").
    • CLEAR-PRB.
    • colour commands.
    • MAIN-4.
    • PR-CC.
    • ROM overwrite.
    • ROM scroll.

0.6.0

  • Removed the redundant ZX81-name routine.
  • Removed the call to the redundant 'CLOSE-2 subroutine' from the 'CLOSE routine.'
  • ANSI BASIC-78 command names.
  • Bugfixes:
    • NMI.
    • CLOSE #4.

0.5.9 - 02/01/2002

  • Now using an assembly file instead of patches.
  • Began converting patches to properly documented source file.
  • Changed copyright message.
  • Experimental 42 column mode.
  • Color Draw support broken.
  • LOAD, RUN, and STOP tokens replace <=, <>, and >= tokens on Q, W, and E keys.
  • Inverted cursor for Timex 512x192 mode.
  • NEW command extended; 0=warm reset, 1=cold reset.
  • PAUSE defaults to PAUSE 0.
  • Bugfixes:
    • division (IF 1/2<>0. 5 THEN PRINT "BUG").
    • 'G' mode.
    • 'K' mode.
    • SCREEN$ (IF "X"=SCREEN$ (0,0) THEN PRINT "BUG").
    • scroll? (Press TRUE VIDEO at the request).
    • STR$ (PRINT "BUG"+STR$ 0.5).
    • syntax check.

0.5.8

  • Re-released as an IPS patch with an ultra-restrictive license.
  • Last version to be created from patches.

0.5.3

  • Identified the problem with Travel With Trashman (checksums the ROM).

0.5.1

  • Removed 'E' mode except for control codes.

0.5.0

  • Line range extended to 16383.

0.4.3 - 14 DEC 2001

  • Limited beta release.

0.4.2

  • Identified the problem with Roller Coaster (spare bytes used as sprite).

0.4.0

  • Removed +3DOS compatiblity.
  • Removed experimental Timex video support.

0.3.0

  • +3DOS compatible version.

0.2.2

  • Tokenizer (adapted from LEC ROM but 55 bytes shorter).
  • Experimental Timex video support.

0.2.1 - 14 NOV 2001

  • Removed patch silently introduced by MacSpectacle.

0.2.0

  • Returned from Australia and began to reapply bug-fixes to the original BASIC ROM.

0.1.0

  • Last version based on the 128 version of the BASIC ROM.

0.0.1 - 05 JUL 2000

  • Realized the +4 ROM was an abomination.
  • Introduced the Geneva Mono (6x8) font.
  • Changes applied as patches; no base assembly file.