TIMEX I/O Ports

Timex initially reserved ports 78h to FFh and left available to developers the 00h to 77h range.

Timex modem 2050 uses ports DFh, D7h, CFh, and C3h

  • C3h – 2050 modem
  • CFh – 2050 modem
  • D7h – 2050 modem
  • DFh – 2050 modem
  • EFh – Reserved
  • F4h – DOCK horizontal select read/write
  • F5h – Sound chip register address read/write
  • F6h – Sound chip register data read/write
  • F7h – Reserved
  • F8h – Printer read/write
  • F9h – Printer read/write
  • FAh – Printer reads/write
  • FBh – Printer reads/write
  • FCh – Bank selection DATA port
  • FDh – Bank selection ADDR port
  • FEh – Border/Tape/Beep/keyboard
  • FFh – SCLD, EXROM, keyboard interrupt

Timex made ports fully decoded, unlike Sinclair did with the ZX Spectrum.

PORT 255 (FFh – TIMEX CONTROL REGISTER):

Output:

bit D0:

  • =0 main video data (data about pixels on the screen) is located in the block at address 16384 (like on ordinary Spectrum),
  • =1 it is located at address 24576

bit D1:

  • =0, color attributes are 8×8 pixels in size, they occupy 768 bytes, and they are located just after main video memory (address 22528 like on ordinary Spectrum if D0=0, or 30720 when D0=1)
  • =1, color attributes are 8×1 pixels in size, occupies 6144 bytes, and are located at address 24576 (more precise, when D1=0, every 8×1 attribute is multiplicated eight times to make one 8×8 attribute)

bit D2:

  • =0, main video data and attributes are used as described above
  • =1 activates an extended resolution of 512×192 pixels (64×24 text), where main video data (from the address determined by D0) will be inserted in even columns (0, 2, 4…), and in odd columns (1, 3, 5…) will be inserted values which normally would be color attributes data, determined by D1 (this usually has sense only with D1=1, when odd columns will be inserted from the block at address 24576); color attributes does not exist when D2=1 (then only two colors exist: unique ink color and unique paper color)

bits D3-D5: Selection of ink and paper color in extended screen resolution mode. these bits are ignored when D2=0

  • 000=black/white
  • 001=blue/yellow
  • 010=red/cyan
  • 011=magenta/green
  • 100=green/magenta
  • 101=cyan/red
  • 110=yellow/blue
  • 111=white/black 

bit D6:

  • =1 forbid generation of the timer interrupt

bit D7: Selection of alternate memory bank which will be activated using horizontal MMU register

  • =0 DOCK
  • =1 EXROM

From the description above, one can conclude that only four combinations of bits D0-D2 may be useful:

  • 000 – Video data at address 16384 and 8×8 color attributes at address 22528 (like on ordinary Spectrum);
  • 001 – Video data at address 24576 and 8×8 color attributes at address 30720;
  • 010 – Multicolor mode: video data at address 16384 and 8×1 color attributes at address 24576;
  • 110 – Extended resolution: without color attributes, even columns of video data are taken from address 16384, and odd columns of video data are taken from address 24576
  • Combinations 011, 100, 101, and 111 are possible, but they will not give usable results.

Input: Returns the last value sent to this port.

PORT 244 (F4h – HORIZONTAL MMU REGISTER):

Output: Every bit in this register is linked with one 8-Kbyte chunk of 64-Kbyte Z80 address space (bit D0 corresponds to addresses 0-8191, D1 to addresses 8192-16383, and so on). When a bit is reset, the linked chunk belongs to the HOME bank, and when a bit is set, the linked chunk belongs to one of the alternative banks (DOCK or EXROM, depending on bit D7 in port 255). Notice that DOCK and EXROM chunks never can be simultaneously present in the address space.

Input: Returns the last value sent to this port.

PORT 245 (F5h – SOUND CHIP REGISTER SELECTION):

Output: Selects active sound chip register, like port 65533 on Spectrum 128.

Input: Always 255.

PORT 246 (F6h – SOUND CHIP REGISTERS):

Output: Writes sent value to active sound chip register, like port 49149 on Spectrum 128.

Input: Reads a value from the active sound chip register.

Everything is here similar like on Spectrum 128, except the usage of register R14 is different, mainly for joystick reading. Then address bits A8 and A9 determines whether the left or right joystick will be read (01=left, 10=right, 11=both reading are OR-ed). So, for left joystick reading mainly port 502 is used, and for right joystick reading port 758 is used (of course, with R14 as an active register). When R14 acts as output port (bit D6=1 in register R7), bits in register R14 have following meaning:

Output:

  • bits D0-D4: ‘masks’ for bits D0-D4 reading (see text below); also these bits may be used in various independent peripherals
  • bit D5: D5=0 enables access to the 16 MB bus expansion unit which seems to never have been released
  • bits D6-D7: usable in various independent peripherals

Input:

  • bit D0: joystick moving to up (0=active)
  • bit D1: joystick moving to down
  • bit D2: joystick moving to left
  • bit D3: joystick moving to right
  • bit D4: status of joystick fire button (0=active)
  • bits D5-D7: last values sent to these bits

The bits D0-D4 when reading return valid values only if they are not masked, i.e. if the corresponding mask bits is one, else they will return zeroes. When register R14 acts as an input port (bit D6=0 in register R7, this is the only reliable way for joystick reading), bits in register R14 have the following meaning:

Output: Ignored!

Input:

  • bit D0: joystick moving to up (0=active)
  • bit D1: joystick moving to down
  • bit D2: joystick moving to left
  • bit D3: joystick moving to right
  • bit D4: status of joystick fire button (0=active)
  • bits D5-D7: always one

In this case, bits D0-D4 could not be masked.

VIDEO MEMORY

Alternate reading and writing from this port generates a ‘strobe’ signal for the printer. On real Timex, it is possible using very dirty interrupt-based routines to make more than two colors in 512×192 mode. As an extremely simplified example, the BASIC program

10 OUT 255,6: OUT 255,14: PAUSE 1: GO TO 10

will produce a blue_on_yellow stripe across black_on_white screen, in hires mode. Also, it is possible (using a similar method) that one part of the screen has one video mode, the other part another video mode, etc. For example, the BASIC program

10 OUT 255,0: OUT 255,6: PAUSE 1: GO TO 10

will produce one hire (512×192) stripe in meters (256×192) surrounding on real Timex.

it seems that nobody produces software that uses described effects, although such effects were very popular on Commodore 64.

In the Warajevo emulator, this effect doesn’t work, but in Multimachine they work ok.