=============================== CHROMA 80 TECHNICAL DESCRIPTION =============================== (c)2018 Paul Farrow, www.fruitcake.plus.com Version 1.0, 16 Feb 2018 Version 1.1, 18 Nov 2018 Version 1.2, 19 Dec 2018 Version 1.3, 18 May 2020 Version 1.4, 15 Jun 2020 Version 1.5, 25 Jan 2021 Version 1.6, 31 Dec 2022 Version 1.7, 12 Jan 2023 Version 1.8, 17 Jan 2023 Version 1.9, 21 Jan 2023 Version 1.10, 13 Feb 2023 Version 1.11, 23 Feb 2023 Version 1.12, 16 Aug 2023 -------- Overview -------- Chroma 80 is a multi-function SCART interface for the ZX80, providing a clear, sharp picture on most modern TV sets. Note that modern Panasonic TVs do not implement the SCART specification correctly, with the result that Chroma may display shifted to the left or at worse the picture may be unstable jumping left/right. Chroma 80 is compatible with a ZX80 fitted with either the original 4K ROM or the 8K ROM upgrade, and with the SLOW mode modification board from CompShop Ltd. It is not compatible with alternate modern SLOW mode boards. Chroma 80 is not intended for use with the ZX81. Instead Chroma 81 must be used with the ZX81. -------- Switches -------- All facilities provided by the Chroma interface that use I/O ports can be disabled, thereby ensuring I/O compatibility with other devices (note that there might still be electrical or physical reasons that cause incompatibilities). Switch 1: ON=Enable CompShop SLOW mode board support. Switch 2: ON=Enable inverse video output. Switch 3: ON=Enable enhanced features (additional 16K RAM, RS232 socket, joystick socket, UDG support, colour modes). All combination of switch settings are supported. Each enhanced feature (apart from the joystick socket) has a mechanism that allows its presence to be detected, and these should be checked independently of each other since future Chroma versions might dedicate individual switches to each facility. ----------------- Power Consumption ----------------- The ZX80 was sold with both 0.6A and 0.7A power supplies. A ZX80 upgraded with the 8K ROM can drive the ZX Printer, and ZX Printers were initially shipped with a replacement 1.2A power supply. Care must be taken to ensure that the rating of the power supply used is not exceeded otherwise it might dangerously overheat. The approximate current consumptions used by various devices are shown below, but note that these are typical values and peak values might be higher. The Sinclair 0.6A power supply is not sufficient and should not be used. The 0.7A power supply should be ok for just a ZX80 with Chroma interface, but might struggle if a ROM cartridge is plugged in. Where possible, always use a 1.2A power supply. ZX80 = 400mA Chroma interface = 280mA ROM cartridge = 50mA ZX Printer = 210mA ZXpand interface = 120mA SLOW Mode board = 60mA ------------ SCART Socket ------------ The Chroma interface requires a standard RGB SCART cable since it only outputs a RGB picture (there is no composite video or S-video support). Sound is also output through the SCART socket (see below). Chroma provides the necessary signalling voltages to instruct the TV to automatically switch to display the SCART input as RGB. A SCART socket does not necessary have to support RGB and some TVs support different video formats on each of their SCART sockets. Therefore always try all SCART sockets on the TV if a picture cannot be obtained from the first one tried. A bi-directional SCART cable should be wired as follows: 1 - 2 2 - 1 4 - 4 3 - 6 6 - 3 5 - 5 7 - 7 8 - 8 9 - 9 11 - 11 13 - 13 15 - 15 16 - 16 17 - 17 18 - 18 19 - 20 20 - 19 21 - 21 ------------ Sound Output ------------ The video signal is output to the audio channels of the SCART socket whenever video synchronisation is lost, e.g. during BASIC program editing or during SAVE. This can also provide an audible indication whenever a key press is detected (useful when typing in a program). The sound facility also allows programs that produce musical tones by precisely toggling the video signal output for recording to a cassette or playing via a mis-tuned analogue TV to be heard. ------------------ Rear Expansion Bus ------------------ A full rear expansion bus is provided that passes all standard ZX80 signals through apart from a few exceptions. The /RFSH line is never passed through and is permanently held high. The /MREQ line is not passed through when either Chroma's RAM is being accessed, a ROM cartridge is being accessed or the lower 16K region is being read. MREQ is passed through for all writes, which allows memory mapped devices such as the QS Sound Board to be used. The state of the rear /RAMCS signal is ignored; the front /RAMCS signal is hard-wired to 5V to permanently override the internal 1K RAM. The 'missing' /ROMCS line is not passed to the ZX80's expansion bus and so ROM based devices that rely on the ZX80 being modified to have a /ROMCS line are not supported. ------------ Reset Button ------------ The reset button connects directly to the /RST line. Press and hold for about one second to ensure the CPU is properly reset. -------------- 8K ROM Support -------------- The ZX80 could be updated with the 8K ROM upgrade kit produced by Sinclair Research Ltd. The kit consisted of the first edition ZX81 ROM, along with an overlay to fix over the keyboard to indicate the locations of the new keywords. The Chroma interface automatically supports a ZX80 upgraded with the 8K ROM. ----------------------- SLOW Mode Board Support ----------------------- CompShop Ltd produced a SLOW mode board add-on for the ZX80. The board fitted inside the ZX80 case and required soldering to the ZX80 PCB. For the board to work, the ZX80 also had to be fitted with the 8K ROM upgrade produced by Sinclair Research Ltd. To support such an upgraded ZX80, configuration switch 1 must be set to ON. The CompShop board added hardware to generate horizontal sync pulses during the top and bottom order lines, but left the original ZX80 hardware to generate the horizontal sync pulses during the main picture area. However, the two sources of horizontal sync pulses were not properly aligned and that could upset a TV resulting in picture instability. Chroma compensates for this misalignment to allow a ZX80 fitted with an original CompShop SLOW mode board to be successfully used. Modern SLOW mode board designs typically include a correction for the misalignment issue, which means that Chroma will be introducing compensation when none is actually required. As a result, Chroma might not be compatible with SLOW mode boards other than the original produced by CompShop Ltd. --------------- Joystick Socket --------------- The joystick socket supports Kempston format and is read using input port $FF1F. The data read in from the port is formatted as follows: Port $FF1F (xxxxxxxx 0001xxxx) - IN: +---+---+---+---+---+---+---+---+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | | | +-------- 1=Right. | | | | | | +------------ 1=Left. | | | | | +---------------- 1=Down. | | | | +-------------------- 1=Up. | | | +------------------------ 1=Fire. +---+---+---------------------------- X=Not used. Kempston joystick interfaces were only released for the Spectrum but some did use the smaller ZX80 sized edge connector and so could in theory be used with the ZX80. The physical joystick socket is wired as follows: Pin Function --- -------- 1 Up 2 Down Female 9-Way D-Type 3 Left _____________________ 4 Right / 1 2 3 4 5 \ 5 n/c \ o o o o o / 6 Fire \ 6 7 8 9 / 7 +5V \ o o o o / 8 0V \_______________/ 9 n/c The data lines will be high when a joystick direction or button is activated. The +5V line provides support for auto- fire joysticks. The joystick socket is enabled using configuration switch 3. ------------ RS232 Socket ------------ The RS232 socket can be used to connect to a variety of serial devices. A standard non-crossover 9-way cable can be used to connect directly to a PC or a serial printer. These two purposes require slightly different wiring, differing only with regard to the handshaking input line used by the Chroma interface to determine whether it can send data. For a PC, the RTS line should be used, whereas for a serial printer the DTR line should be used. A jumper is present on the Chroma interface to select which handshaking line to receive. The RS232 socket is enabled using configuration switch 3. The RS232 socket is controlled by I/O port $FEEF (11111110 11101111). The address lines are fully decoded. The data is sent and received inverted and so a CPL instruction is necessary within software before sending and after receiving. Upon resetting the ZX80 or disabling of the RS232 socket via switch 2, the output lines are set to the IDLE state. Port $FEEF (11111110 11101111) - OUT: +---+---+---+---+---+---+---+---+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | | | +-------- TX data [output] (data inverted, 0=Idle). | | | | | | +------------ CTS [output] (0=Signal do not send, 1=Signal Ok to send). | | | | | +---------------- Reserved for future use (always set to 0). | | | | +-------------------- Reserved for future use (always set to 0). | | | +------------------------ Reserved for future use (always set to 0). | | +---------------------------- Reserved for future use (always set to 0). | +-------------------------------- Reserved for future use (always set to 0). +------------------------------------ Reserved for future use (always set to 0). Port $FEEF (11111110 11101111) - IN: +---+---+---+---+---+---+---+---+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | | | +-------- X=Not used (reserved for future use). | | | | | | +------------ 1=RS232 facility enabled. | | | | | +---------------- X=Not used (reserved for future use). | | | | +-------------------- X=Not used (reserved for future use). | | | +------------------------ X=Not used (reserved for future use). | | +---------------------------- RTS/DTR [input] (0=Do not send, 1=Ok to send). | +-------------------------------- 0=RS232 facility enabled. +------------------------------------ RX data [input] (data inverted, 0=Idle). Bits 1 and 6 can be used to determine whether the RS232 facility is available (both should be checked). However, it does rely on the assumption that the value returned when reading port $FEEF is from the Chroma interface (in theory the RS232 facilities could be disabled on Chroma and another device instead responds to reads from port $FEEF). With carefully timed software it is possible to achieve transmission speeds up to 57600 baud. Note that the IN port bit assignments are different to those of the Chroma 81 interface for the ZX81 and hence data receiving routines are not directly interchangeable between the computers. ----------- Onboard RAM ----------- The Chroma interface contains 32K of RAM. 16K of this is used as a 16K RAM pack. The additional 16K is used for colour attributes and user definable graphics [appearing at $C000-$FFFF]. It is also possible to just use the RAM as 16K of storage space. Both facilities use specific locations from the second 16K RAM and so they can be viewed as overlays over the same 16K. As a result, it is possible to use the colour and UDG facilities at the same time so long as they use different areas of the second 16K RAM. The location of the attributes for the two colour modes are summarised below: ADDITIONAL 16K RAM $C000 +------+ | | \ \ | | |__ Colour Mapping Table [Colour Mode 0] | | | | (appears in memory map at $C000-$C3FF) | | | / | $C400 +------+ | | | | | | | | | | | | | | | |__ Colour Attribute File [Colour Mode 1] | | | (appears in memory map between | | | $C000-$FFFF, at DFILE+$8000) | | | | | | | | | | | | | | | | | | | | / $FFFF +------+ The additional 16K RAM is not accessible when a ROM cartridge is present and enabled. The additional 16K RAM is enabled using configuration switch 3. ------- 16K RAM ------- 16K of the onboard 32K RAM is permanently enabled as a 16K RAM pack; it cannot be disabled. Only when using a ZX80 fitted with the 8K ROM upgrade might this cause an issue since it will force an expanded display file to be created. Should a program rely on there only being 1K of RAM, then it would be necessary to manually set the RAMTOP system variable to force the system to believe it only has 1K of RAM available. This can be done as follows: POKE 16389,68 NEW The standard 16K RAM is not mirrored in the 48K-64K region even when the additional 16K RAM is not enabled. -------------------- WRX Graphics Support -------------------- This mechanism uses memory refreshes to read from the onboard 16K RAM pack to allow true high resolution graphics to be generated by the ZX80. The facility is permanently enabled. ----------------------------------- User Defined Graphics (UDG) Support ----------------------------------- The additional 16K RAM provides support for user defined graphics (UDGs), allowing an alternate character set to be displayed instead of the normal set present in the ZX80's ROM. It uses a variant of the CHR$128 mechanism and so all 128 characters can be individually redefined. The Z80's I register specifies the high byte of the base address within the additional 16K RAM of the alternate character set, and needs to be an within the range $C0 to $FF. Note that unlike the traditional CHR$128 mechanism, bit 0 of the I register is ignored and so 128 character mode is selected irrespective of whether the value of the I register is even or odd. To use colourisation mode at the same time as UDG mode, the I register must be set within the range $C4 to $FF to avoid a clash with the RAM used for the character code mapping table. The alternate character set pixel patterns occupy 512 bytes of RAM and consists of 8 bytes per character. It begins with the non-inverted characters and is followed immediately by the inverted characters. The definition for a character is ordered from its top line downwards. The definitions for the inverted characters need to be stored in non-inverted form since the video hardware inherently inverts the pixel patterns. UDG support is enabled using configuration switch 3. ----------------------------- Custom Display Driver Support ----------------------------- The Chroma interface supports custom display drivers but requires the horizontal synchronisation (HSync) pulse output at the end of each scanline to occur at a particular position. This will automatically occur if the ROM display routines are used to generate the top and bottom borders since an interrupt will be triggered at the end of each scanline to cause the ZX80 hardware to output a HSync pulse at the necessary position. It is also possible for a custom display driver to generate every HSync pulse itself by using an IN / OUT sequence of instructions. Such display drivers must time their HSync pulses to occur at or close to the equivalent positions of those generated when using the ROM display routines. The positions will be a multiple of 207 clock cycles since the last interrupt triggered hardware generated HSync pulse was produced. A benefit of timing a display driver so that it positions its HSync pulses in this way is that it can be made to also run successfully on the ZX81 since the software generated HSync pulses will overlap with the ZX81's hardware generated HSync pulses. A display driver must create a vertical synchronisation (VSync) pulse of at least 2 scanlines that span at least 3 HSync positions and must output a minimum of 238 visible scanlines in order for Chroma 80 to recognise it as a valid TV frame. ------------ Colour Modes ------------ By default, the ZX80 will power up in standard monochrome display mode. Two colour modes are supported: Colour mode 0 - Character code colour mapping. Colour mode 1 - Attributes display file. Each mode supports independent colours for the reset pixels (paper) and set pixels (ink), and both allow the border colour to be selected. 15 colours are supported for ink and 15 colours for paper. This consists of green, red and blue bits and a bright bit (as per the Spectrum), and hence bright black and black both appear the same. The border may be set to any of these 15 colours. With colour mode 0 or 1 enabled, the additional 16K RAM appears at $C000-$FFFF within the memory map. Any locations not used by the colour mode may be freely used for storage by a program. However, the existing restriction that (mostly) prevents the execution of code from any location above $7FFF still applies. The colour facilities are enabled using configuration switch 3. I/O ports --------- I/O port $7FEF is used to select the active colour mode and to determine whether the colour facilities are enabled. The address lines are fully decoded. Port $7FEF (01111111 11101111) - OUT: +---+---+---+---+---+---+---+---+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | +---+---+-------- Border colour (format: GRB). | | | | +-------------------- Border colour bright bit. | | | +------------------------ Mode (0=Character code, 1=Attribute file). | | +---------------------------- 1=Enable colour mode. +---+-------------------------------- Reserved for future use (always set to 0). If configuration switch 3 is set to OFF, the colour mode is forcibly disabled, colour mode 0 (character code mapping) selected, and the border restored to bright white. Port $7FEF (01111111 11101111) - IN: +---+---+---+---+---+---+---+---+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | | | +-------- X=Not used (reserved for future use). | | | | | | +------------ 1=Colour modes available, i.e. configuration switch 3 is set to ON. | | +---+---+---+---------------- X=Not used (reserved for future use). | +-------------------------------- 0=Colour modes available, i.e. configuration switch 3 is set to ON. +------------------------------------ X=Not used (reserved for future use). If the colour facilities have not been enabled using configuration switch 3 or the Chroma interface is not connected then reading from port $7FEF will typically return a value of $40 (the default value of the data lines). However, since only data line 6 has a pull-up resistor on it inside the ZX80, the values of the other data lines might vary. Hence only data line 6 can be relied upon. With the Chroma interface present but colour facilities disabled, a read from port $7FEF will not set any data lines, thereby allowing another device exclusive access to this input port. A consequence of this is that a read of the port cannot differentiate between Chroma responding and another device responding. However, hopefully a user would not attempt to run a program that requires the Chroma colour facilities if they have a known conflicting device attached. To improve the chances of avoiding a mis-detection of the Chroma interface, both data lines 1 and 6 should be checked. Colour mode 0 ------------- This mode allows existing games to be colourised. A table is used to map colours for each character the ZX80 is capable of displaying. Colours can be mapped for the normal 64 characters and also for the inverse 64 characters. The colour mapping is per pixel line of each character, with separate paper and ink colours defined for each line. The mapping table appears at $C000-$C3FF in the memory map and is ordered with the mappings for the normal 64 characters first, followed immediately by the mappings for the inverse 64 characters. Each character's mapping entry consists of 8 bytes corresponding to the 8 pixel lines of the character bitmap (beginning with the top line). Therefore the entries for character 0 reside at $C000-$C007, the entries character 1 reside at $C008-$C00F, the entries for character 2 reside at $C010-$C017, etc. Each entry uses the following format: +---+---+---+---+---+---+---+---+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | +---+---+-------- Ink colour (format: GRB). | | | | +-------------------- Ink colour bright bit. | +---+---+------------------------ Paper colour (format: GRB). +------------------------------------ Paper colour bright bit. To colourise an existing game, the colour mapping table entries must first be configured, colour mode 0 enabled and then the game loaded. The border colour can also be set prior to loading the game by writing to port $7FEF (as defined above). The mapping colours will remain active until the ZX80 is reset, i.e. they will survive NEW and RANDOMISE USR(0) but not the reset button. The mapping colours are read from the RAM each time the display is generated and so it is possible for a program to dynamically adjust the colours. However, this would require explicit software created to do this. Colour mode 1 ------------- This mode can only be exploited by software explicitly written to control it. It utilises an attributes file located in the upper 16K of the memory map (between $C000-$FFFF) which is situated at DFILE+$8000, i.e. bit 15 is set. The attributes file has the same 'shape' as the display file. This approach makes it easy for a program to find the corresponding attribute cell for a particular display file cell. It also means that if the display file shifts in memory then so too will the attributes file. Note that the Chroma interface assumes the display file will always exist between $4000-$7FFF. This mode uses a single attribute byte per character, and hence only one paper colour and one ink colour may be applied to the 8x8 pixel character cell. Each attribute cell is formatted as follows: +---+---+---+---+---+---+---+---+ | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | +---+---+-------- Ink colour (format: GRB). | | | | +-------------------- Ink colour bright bit. | +---+---+------------------------ Paper colour (format: GRB). +------------------------------------ Paper colour bright bit. A consequence of the attribute file having the same shape as the display file is that it also contains gaps for the end of row NEWLINE markers. However, these locations are not used and so do not need to be set. The locations are available for use as storage by a program if desired. The attribute colours are read from the RAM each time the display is generated and so it is possible for a program to dynamically adjust the colours. -------------------- ROM Cartridge Socket -------------------- The ROM cartridge socket is identical to that of the ZX Interface 2 for the Spectrum. This allows my range of ZXC ROM cartridges to be used, thereby avoiding the additional cost of custom cartridges just for the Chroma interface. The latest in the range of ZXC ROM cartridges is the ZXC4. This supports a 4MB FLASH ROM, which is directly programmable from the ZX80. When a ROM cartridge is plugged into the Chroma interface, it appears in the memory map at the following (unshaded) locations: ADDITIONAL 16K RAM 16K RAM [0K-16K] [48K-64K] $4000 +------+ $C000 +------+ |//////| | | \ |//////| | | | |//////| | | | |//////| | | | |//////| | | | |//////| | | | |//////| | | |-- ROM Cartridge Data (appears when reading or writing) |//////| | | | |//////| | | | |//////| | | | |//////| | | | |//////| | | | |//////| | | / $7F80 +------+ $FF80 +------+ | | | | \ | | | | |-- Execution Window | | | | / (appears at $7F80-$7FBF when reading, and $FF80-$FFBF when reading or writing) $7FC0 +------+ $FFC0 +------+ |//////| | | \ |//////| | | |-- ZXC Paging Area |//////| | | / (appears at $FFC0-$FFFF when writing) $7FFF +------+ $FFFF +------+ It is not possible to execute code held in a ROM cartridge at locations $C000-$FFFF. To allow loading of programs from a ROM cartridge, an 'execution window' to the ROM cartridge is made visible at $7F80-$7FBF. A short transfer routine can be situated at these locations to copy the ROM cartridge data from $C000-$FFBF into the 16K RAM and hence allows a method for rapidly loading programs into the ZX80. Note that writing to locations $7F80-$7FBF will write to the 16K RAM and not to the ROM cartridge. Reading from the ROM cartridge within the ZXC Paging Area ($FFC0-$FFFF) is not possible. Instead the default data bus value will be returned. This limitation is imposed to avoid false triggering of the ZXC paging circuitry due to the 'Read' instruction present in the 8K ROM at $0237 which is used there purely for timing purposes. As a result, it is not possible to access (or program) data in the last 64 bytes of a bank in the ROM cartridge using a ZX80. The ROM cartridge only appears in the memory map when the ROM cartridge is paged in. However, write attempts to $FFC0-$FFFF are still passed to the ROM cartridge socket to allow a ROM cartridge to be paged back in. The ZXC4 supports a second paging area at $C000-$DFFF, but this can only be activated if the ROM cartridge is paged in. ------------- Inverse Video ------------- The ZX80 PCB supports inverting the video signal to produce a white on black picture. The Chroma interface can't detect when such a modification has been made to the ZX80 but it does allow its output to be inverted to replicate this functionality. Inverse video mode is selected using configuration switch 2. --------------------------- Horizontal Picture Position --------------------------- The horizontal position of the TV picture output by the ZX80 depends on the actual frequency of its clock, which often runs slightly slower than the nominal frequency of 3.25 MHz due aging of the resonator. As a result, the picture shifts towards the right. Chroma 80 compensates for this by biasing its picture output to the left. However, should this result in the picture now being too far towards to the left then it is possible to bypass the compensation mechanism by holding down the joystick's fire button as the ZX80 is reset. The joystick socket does not need to be enabled to invoke the compensation bypass facility. The compensation bypass facility does not operate when a SLOW mode board is fitted, i.e. when configuration switch 1 is set to ON. -------------- I/O Port Usage -------------- The Chroma interface uses base I/O port $EF (11101111). The address lines are fully decoded. The upper address lines A18-A15 are then used by Chroma to control different facilities provided by the interface. At present this only consists of the RS232 and colour facilities, but further I/O ports with base address $EF may be used in future versions of the interface. These I/O port addresses are therefore considered reserved for use by future Chroma interfaces.