BBC BASIC Host Interface Physical Colour Specification ====================================================== Physical colour numbers are used as the short physical colour in the VDU 19 command, and used in the COLOUR and GCOL commands on platforms without a palette. The colour number is a bitmap of the colour to select. When implementing a VDU driver to interface with other platforms this mapping must be adhered to. ===Colour bitmap=== 7 6 5 4 3 2 1 0 +---+---+---+---+---+---+---+---+ | L | D | E | F | I | B | G | R | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | | | +---Red | | | | | | +-------Green | | | | | +-----------Blue | | | | +---------------Intense | | | +-------------------Flash | | +-----------------------Extension | +---------------------------Border +-------------------------------Layer 0=Foreground, 1=Background This gives: 0 0 e f i b g r - &00+n - foreground colour 0 1 e f i b g r - &40+n - extension 1 0 e f i b g r - &80+n - background colour 1 1 e f i b g r - &C0+n - border colour Extensions are implementation specific. For examples, the ZX Spectrum uses bit 5 and 6 to independently select Flash/Bright and RGB, and ANSI drivers select underline and inverse. The BBC and RISC OS uses b3=flash, whereas all other platforms use b4=flash. For visual compatibility, programs should use 0-7 for non-flashing colours and 24-31 for flashing colours. On the BBC/RISC OS these will be standard intensity flashing colours, on other platforms these will be bright flashing colours where supported. Where individual control is needed in platform-independent code, the following coding method should be used: os% set from OSBYTE 0 IF os%<8 THEN flash%=8:bright%=16 ELSE flash%=16:bright%=8 COLOUR n :REM select the specified colour COLOUR bright%+n :REM select a bright colour COLOUR flash%+n :REM select a flashing colour COLOUR flash%+bright%+n :REM select a bright flashing colour