Usage from standard BASIC
Although full advantage of the new display modes provided by the SPECTRA interface is only achievable using machine code, it is still possible to control all row based modes directly from standard BASIC, allowing access to the new 64 colour palette, half cell mode, enhanced border and screen buffer mechanism. These modes can be used because they do not require the use of an extended attributes file.
Mode: Full cell, row, single byte colour, extra colours (8x8 SE)
In this mode, the ink pixels can be set to any of 64 colours and the paper pixels can be set to black and white only.
The following program displays all available colour combinations. It sets the ink pixel colour through the combined use of BASIC commands INK and PAPER,
with DEF FN statements being used to simplify the process of translating the 64 palette colour into values to pass to the INK and PAPER commands.
The paper pixel colour is set through the use of the BASIC command BRIGHT. The BASIC commands FLASH and INVERSE operate as usual.
10 OUT 32735,4 20 DEF FN p(c)=INT (c/8): DEF FN i(c)=c-8*FN p(c) 30 FOR f=0 TO 1 40 FOR p=0 TO 1 50 FOR n=0 TO 1 60 FOR i=0 TO 63 70 PRINT FLASH f; INVERSE n; BRIGHT p; PAPER FN p(i); INK FN i(i);"a"; 80 NEXT i 90 NEXT n 100 NEXT p 110 NEXT f
It produces the following output:
![]() |
Mode: Half cell, row, single byte colour, basic colours (4x8 SB)
In this mode, the ink pixels of the left and right halves of each cell can be set to any of 8 colours, with the paper pixels always being set to black.
The following program displays all available colour combinations. It sets the ink pixel colour through the combined use of BASIC commands INK and PAPER.
The BASIC commands FLASH, BRIGHT and INVERSE operate as usual.
10 OUT 32735,128 20 FOR n=0 TO 1 30 FOR p=0 TO 7 40 FOR f=0 TO 1 50 FOR b=0 TO 1 60 FOR i=0 TO 7 70 PRINT FLASH f; INVERSE n; BRIGHT b; PAPER p; INK i;"a"; 80 NEXT i 90 NEXT b 100 NEXT f 110 NEXT p 120 NEXT n
It produces the following output:
![]() |
Mode: Half cell, row, single byte colour, extra colours (4x8 SE)
In this mode, the ink pixels of the right half of each cell can be set to any of 64 colours but the ink pixels of the left half of each cell can only be set to black or white.
The paper pixels are always set to black.
The following program displays all available colour combinations. It sets the ink pixel colour through the combined use of BASIC commands INK and PAPER,
with DEF FN statements being used to simplify the process of translating the 64 palette colour into values to pass to the INK and PAPER commands.
The paper pixel colour is set through the use of the BASIC command BRIGHT. The BASIC commands FLASH and INVERSE operate as usual.
10 OUT 32735,128+4 20 DEF FN p(c)=INT (c/8): DEF FN i(c)=c-8*FN p(c) 30 FOR f=0 TO 1 40 FOR p=0 TO 1 50 FOR n=0 TO 1 60 FOR i=0 TO 63 70 PRINT FLASH f; INVERSE n; BRIGHT p; PAPER FN p(i); INK FN i(i);"a"; 80 NEXT i 90 NEXT n 100 NEXT p 110 NEXT f
It produces the following output:
![]() |
Enhanced border
The enhanced border facilities can also be accessed from BASIC. For example, the following program cycles through all of the colours in the new 64 colour palette.
10 OUT 32735,20 20 DEF FN p(c)=INT (c/8): DEF FN i(c)=c-8*FN p(c): DEF FN b(c)=32*FN p(c)+FN i(c) 30 FOR c=0 TO 63 40 OUT 254,FN b(c) 50 PAUSE 25 60 NEXT c 70 GO TO 30
It produces the following output:
![]() |
Screen Buffering
The screen buffering facilities can also be accessed from BASIC and can be applied to all display modes.
The following program displays screens of random numbers one after the other.
To see the effect of screen buffering, uncommented lines 10 and 60.
Line 10 selects screen bank 0 for display and screen bank 1 to shadow the Spectrum's lower 16K RAM bank.
Line 60 reverses this to select screen bank 1 for display and screen bank 0 to shadow the Spectrum's lower 16K RAM bank.
10 REM OUT 32735,64 20 CLS 30 FOR r=0 TO 20 40 PRINT RND 50 NEXT r 60 REM OUT 32735,32 70 CLS 80 FOR r=0 TO 20 90 PRINT RND 100 NEXT r 110 IF INKEY$="" THEN GO TO 10 120 OUT 32735,0
It produces output similar to the following:
![]() |
![]() |
|
Without Screen Buffering | With Screen Buffering |
With screen buffering enabled, the process of printing to the screen becomes invisible to the user. The program still takes the same length of time to run but the result can be more pleasing to the eye.