Volex TTX2000 S Teletext adapter for the ZX Spectrum

Introduction

The Volex TTX2000 S is a broadcast teletext receiver for the Sinclair ZX Spectrum (16K and 48K models). It is a version of the OEL TTX2000 designed by Laurence Cook, and sometimes branded 4-DATA in partnership with Channel 4 Television.

Volex bought the design when OEL went into receivership in the wake of the collapse of Oric and Prism.

This page mostly deals with the TTX2000 S as that is the unit I own and have reverse engineered. I will add further information about other versions of the hardware and their history if I find it.

The schematics provided were obtained through reverse engineering of the hardware and may contain errors!

Hardware

The adapter is contained within an injection moulded plastic enclosure held together with four screws. The top and bottom case halves are identical, and branded OEL. They appear identical to those used for the Prism VTX5000 modem. The front and rear panels are loosely retained in slots moulded into the case halves.

The front of the case is a plastic blanking plate bearing the product branding printed in white.

The rear of the case is an aluminium plate with holes for a power socket, expansion edge connector slot, antenna socket, and four multi turn tuning resistors.

The power supply is specified as 18 volts AC, however this is rectified and regulated to 12 volts internally by an LM7812 so a DC supply may also be used. My adapter was missing any cables or power supply so I use a 15 volt DC wall-wart.

Unlike most other Spectrum peripherals the TTX2000 S has a card edge connection like the Spectrum motherboard itself, and is connected via a 56 way ribbon cable. The original cable had three connectors with a back to back card edge adapter PCB fitted in one to act as a pass through for additional peripherals.

The TTX2000 manual mentions that this small PCB contained “a component which gets warm in normal use”, but a supplement says this is only relevant to early models as the newer revision has “lower power logic boards”. The designer confirms that this was a power resistor as the early boards constructed from discrete logic required more current from the Spectrum. Partially bypassing the regulator prevented it overheating while still maintaining regulation of the 5 volt supply.

The internal hardware is divided between two printed circuit boards. Functionality is split between the two with one board predominantly containing analogue circuitry handling the television tuning and signal processing, and the other mostly devoted to logic and interfacing with the Spectrum. The discrete diode bridge rectifier and 12 volt regulation for the analogue components are located on the tuner board, and the logic board contains a boost circuit to generate the high voltage tuning supply from the Spectrum’s 9 volt supply.

The ‘tuner’ PCB is marked TIF A 003 and the ‘logic’ board UTX A 004, both © Volex 1985

Reverse engineered schematics (PDF).

TIF A 003 ‘Tuner board’

The tuner board is dominated by an Mullard U343 UHF tuner module, the tuning voltage for which is provided by a boost circuit on the other PCB and conditioned by a TAA550 voltage stabilizer before one of four multi-turn potentiometers is switched in to circuit using open-collector buffer drivers to set the coarse tuning.

The tuner module’s IF output is fed via a surface acoustic wave filter module to a TDA2541 demodulator IC. This chip generates an automatic gain control (AGC) voltage for the tuner, and an automatic frequency control (AFC) voltage which is mixed into the coarse manual tuning voltage from the potentiometers.

The demodulator’s video output is then sent via a filter to a Plessey SL9100 data slicer and clock regenerator IC. This chip extracts the teletext signal from the video waveform and outputs the regenerated teletext data clock and data bitstream.

A 74123 dual retriggerable monostable conditions the sync output of the data slicer and feeds it over the interconnect ribbon to the logic board alongside the clock and data signals.

UTX A 004 ‘Logic board’

The heart of the logic board is a 64 pin NEC 65000 series CMOS gate array. The use of a custom chip unfortunately made reverse engineering more difficult.

The gate array controls the paging of an 8kB EPROM and 2kbit×8 SRAM into the lower 16kB of the Spectrum’s memory space. The board supports the use of two 1kbit×4 RAM chips instead. The discrepancy in capacity is because only the lower half of the 2kB SRAM is used, the A10 line being tied low.

The EPROM is paged in at 0x0000-0x1FFF while the SRAM appears at 0x2000-0x3FFF , repeated to fill the space

A pair of pads on the PCB allow direct connection of the Spectrum’s RFSH signal to the gate array. This link is left clear and instead a 74121 monostable generates the signal from the M1 line.

Five outputs from the gate array cross the interconnect ribbon to the tuner board to 7407 open-collector buffers. Four to control channel selection, and one to enable the AFC.

Operation

On reset the adapter pages in its ROM and SRAM, replacing the Spectrum’s operating system. The ROM contains software for decoding teletext packets and displaying the received pages on screen.

Before any pages can be received, one or more UHF signals must be tuned in using the potentiometers at the rear.

While manually setting the coarse tuning, the ROM disable the AFC and displays all teletext header packets received irrespective of number or decoding errors. This allows the user to see which channel they have tuned onto and adjust until the text is most legible. Leaving this tuning mode re-enables the AFC.

Sync pulses from the data slicer IC on the tuner board are used by the gate array to determine the start of the vertical blanking interval (VBI) and the expected start of the teletext signal on each line.

43 bytes of teletext data is written into the onboard SRAM (the teletext framing code, magazine row address group, and 40 byte payload) at 64 byte offsets.

The SRAM has capacity for all 16 available VBI lines, however the number of lines stored is dependent on how the logic is set up by the firmware and defaults to the first 12 only.

The gate array appears to have an internal 4 bit counter which is initialised when the Z80 accesses SRAM to bits 6-9 of the memory address.

On receiving a frame sync the gate array begins incrementing the counter on each subsequent line sync. The counter is allowed to overflow until a teletext line has been detected.

When teletext lines are received they are stored in the SRAM at an address formed from the 4 bit counter, and a 6-bit byte counter.

Lines are stored until the 4-bit counter overflows, at which point further line syncs are ignored and the gate array generates a non maskable interrupt (NMI).

The NMI handler in the ROM loops through the sixteen packet offsets in SRAM, checking for a valid framing code followed by the magazine row address group (MRAG) to see if the packet is one it is waiting for and if so processes it accordingly. After checking each packet the teletext framing code at the start of the packet data is set to zero.

With a signal correctly tuned in and the adapter paged in, an NMI is generated to decode the stored packets every field (50Hz).

The gate array implements a control port at I/O address 0x7F. Bits 0 and 1 select the channel 1-4, bit 2 enables the AFC, and bit 3 controls paging. Setting the paging bit causes the adapter to page out.

Firmware

The TTX2000 S ROM was written by Nigel Wright and Martin McBride. It contains the software required to decode the teletext packets captured by the hardware, and render pages on the screen. It also implements a simple telesoftware format, enabling the downloading of data to the Spectrum’s memory from specially formatted teletext pages.

The TTX2000 S manual states that “users wishing to load BBC RTF format programs can obtain an RTF format downloader program, on cassette, directly from our Sales Dept.” however a letter received by the owner of a 4-DATA branded adapter contains the following quote which suggests that this was never released: “The RTF downloader is not available as CEEFAX do not have any plans to broadcast software for the Spectrum”.

The letter also indicates that N.Wright was responsible for the teletext decoding and display, while M.McBride wrote the telesoftware downloader. Laurence says that McBride worked for Scicon who wrote the downloader code for OEL under contract. Wright was employed by OEL.

The ROM in my adapter identifies itself as Issue 1.2. A ROM image from a 4-DATA branded adapter has identical contents apart from the text on the boot menu.

A ROM image from the earlier OEL TTX2000 adapter is significantly different and identifies itself as Issue 2.3, however this is an earlier version of the code. A lot of the code from this earlier ROM is still present in the Issue 1.2 ROMs but unused.

The OEL ROM contains the string “WRITTEN BY N.WRIGHT ( AND M.WILLAN )”. Laurence tells me this is Martin Willan who was another OEL employee.

I have been working on a commented disassemblies of the known ROMs using SkoolKit. There is a separate disassembly for each of the Volex Issue 1.2, 4Data Issue 1.2, and OEL Issue 2.3 ROMs. The OEL ROM disassembly is still very incomplete.

System variables

The TTX2000 S ROM sets up system variables in the Spectrum’s RAM at $5B00 onwards (23296) . The manual describes some of these in the section on using the adapter from BASIC:

Address (decimal) Function $5B17 (23319) Magazine number (0-7) $5B18 (23320) Page Tens (0-F) $5B19 (23321) Page Units (0-F) $5B6F (23407) Pointer to received page buffer

The disassembly process has identified some more variables which may be useful from BASIC, or machine code programs

Address (decimal) Function $5B1A (23322) Control register state $5B1E (23326) Page ready flag $5B56 (23382) Subcode search flag $5B57 (23383) Fourth digit of subcode $5B58 (23384) Third digit of subcode $5B59 (23385) Second digit of subcode $5B5A (23386) First digit of subcode $5B61 (23393) Hardware counter reset address $5B6D (23405) Pointer to page display buffer $5B79 (23417) Pointer to Warm Start routine $5B7B (23419) Pointer to Exit to BASIC routine $5B7D (23421) Pointer to Save routine

The ROM sets up a jump instruction to the warm start routine at $5BCC . This is used to re-enter the TTX2000 S ROM from BASIC with RANDOMIZE USR 23500 .

A single byte is read from the address stored at $5B61 at the end of the NMI service routine. This resets the gate array’s internal 4 bit line counter ready for the next field. The ROM initialises this variable to $2240 , which results in the counter being initialised to 9 .

There are 11 line syncs before the first possible teletext line, so the counter is incremented to (11 + 9) modulo 16 , i.e. 4 . The NMI is generated when the counter next overflows, meaning that only the first 12 lines are stored.

Changing this variable to $2140 by executing POKE 23394,33 in BASIC results in the initial counter value being 0 at the first teletext line, and thus all 16 lines are stored.

If a Packet 30 is received (of any magazine number) it is stored in row 29 of the received page buffer (i.e. at 1160 byte offset from the pointer in $5B6F )

Telesoftware

The telesoftware format used by the TTX2000 S is much simpler than the BBC’s redefinable telesoftware format (RTF). The details were again deduced from disassembly of the ROM code.

Programs and data are transmitted as one or more memory dumps in blocks of 660 bytes per subpage. Every subpage contains a footer in packet 23 holding the relevant metadata for that block as per the table below:

Columns Function 0-3 magic string 4 don’t care 5 number of blocks 6 block number 8-11 data address 12 BASIC flag 13 command 20-23 program length 24-27 variables length 28-31 command length 32-35 start line/address 36-39 checksum

The footer begins with the magic string COMP followed by characters representing the total number of blocks, and the block number. These are 6-bit values encoded with bit 6 set.

The next four characters encode four nibbles, forming the address at which the block of data is to be loaded. The high 4 bits are ignored meaning that printable characters can be used rather than control codes.

The remaining values excluding the checksum must be the same in all block footers (columns 12-35). The first of these values is a flag determining whether the downloaded data is to be treated as BASIC (character B ) or as machine code (any other character).

Column 13 contains one of three codes which define what the computer will do on completion of the download. Command R instructs the computer to execute a BASIC program from the designate line number, or run machine code from the given address. If the download is BASIC, command H will execute a BASIC STOP instruction, while command E will execute loaded BASIC instructions in immediate mode.

For a BASIC program the program length and variables length values are used to initialize the VARS and E_LINE system variables respectively. For an immediate command the command length value is also stored in WORKSP .

The final four columns encode a simple block checksum which is generated by the exclusive or of every other character in the page (rows 1-23).

Up to 660 bytes of memory are encoded in the 880 characters of the download block by packing three bytes at a time into groups of four characters.

The first three characters in the group hold bits 0-5 of each of the three bytes respectively. The fourth character holds the remaining two high bits of the three bytes in bits 0-1, 2-3, and 4-5 respectively. As bit 6 of each character is unused in the encoding it can be set to ensure all characters are printable.

Using the TTX2000 S

Analogue terrestrial television broadcasting was phased out in the UK over a five year period, concluding in October 2012. Ceefax was shut down at that time as the decision had been made not to continue the service on digital television in favour of the MHEG5 ‘Red Button’ service. Teletext Ltd had already ceased their news and information service on ITV and Channel 4 in 2009, with Ofcom revoking their license in 2010. Channel 5’s ‘Five Text’ service ended in 2011.

Consequently there have been no signals for the TTX2000 S to receive off-air in the UK for several years. Thankfully a growing ‘teletext scene’ has emerged to keep the technology alive. This includes the development of tools which enable anyone to generate teletext signals at home without expensive broadcast inserter equipment.

The raspi-teletext project by Alistair Buxton enables the generation of teletext signals in the VBI of a Raspberry Pi’s composite video output.

One important thing to note is that by default raspi-teletext utilises all 16 available teletext lines, meaning the TTX2000 S will miss some packets unless a line mask is specified, or the counter system variable ‘poke’ is applied every boot.

By connecting the Raspberry Pi’s composite video output to a UHF video modulator (a standalone modulator or VCR may be used) a suitable signal can be provided to the TTX2000 S antenna port, which can then be tuned in as described in the manual.

The raspi-teletext tool generates a couple of demonstration pages, but its main function is outputting a teletext packet stream in ‘T42’ format either from a capture file, or some other program generating a datastream on the fly.

One such program is VBIT2, which generates a packet stream from a directory of teletext page files. The installation script for VBIT2 also downloads the pages for the community run TEEFAX service.

The image above was generated by a custom build of FUSE – the Free Unix Spectrum Emulator with experimental TTX2000 S emulation, which will hopefully be included in a future release.

If you would like to know more about generating teletext signals for vintage TVs or microcomputer adapters, consider joining the Teletext Facebook group or Teletext Discord server.