wiki:vtech/z80

Notes on VTech z80 based laptops

These notes are derived from the work of https://github.com/fraser125/PreTech/blob/main/Schematic/prc1000.pdf who reverse engineered the schematics by tracing pictures of the PCB. The PreComputer 1000 is simple enough and uses standard components, so from this tracing we can learn a lot about how the machine works.

Several later VTech machines seem to have a compatible cartridge port, however it isn't known how far the compatibility goes in terms of memory banks, etc.

IO decoding

The IO decoding uses A15 and A14 to split the IO space in 4 areas. Officially, the z80 IO space is only 8 bits addresses, but it is well known (and used on other machines) that the IN and OUT instructions set a full 16 bit address with known and reliable behavior.

The decoding is done using the logic ending with IC2B: it detects the IORQ and M1 lines (making sure this is an IN or OUT type instruction) and these two address bits. From there 4 signals are generated:

0xxx-3xxx: Keyboard

The keyboard can only be read. Writing to the keyboard using OUT instructions will have no effect, but if keys are pressed, it will short circuit data and address lines through one of the keyboard diodes and the pressed key. This is probably OK for short durations, but should still be avoided.

When reading, the address lines A0-A8 are wired directly to the keyboard matrix lines. So you should set one of these bits (and not more) to 0.

For example, you can use these port numbers:

  • 0FFE - line 0 (A0 = 0)
  • 0FFD - line 1 (A1 = 0)
  • 0FFB - line 2 (A2 = 0)
  • 0FF7 - line 3 (A3 = 0)
  • 0FEF - line 4 (A4 = 0)
  • 0FDF - line 5 (A5 = 0)
  • 0FBF - line 6 (A6 = 0)
  • 0F7F - line 7 (A7 = 0)
  • 0EFF - line 8 (A8 = 0)

For each line, the status of 8 keys will be read in the destination register of the IN instruction.

4xxx-7xxx: LCD display

The address bits A0-A3 are stored in a latch, but it isn't known yet what they are used for (STROBE_A -> IC1A in the schematics)

The A8 pin is used to determine if it's a read or write, which gives the nominal addresses: 40xx for a write, and 41xx for a read of the LCD.

Only 4 data bits are used, bits D0-D3. The protocol is typical https://fr.wikipedia.org/wiki/HD44780

TODO the wiring of the LCD is not fully documented and it's not known how the RS and E lines are controlled.

8xxx-Bxxx: Memory banks configuration

Only OUT instructions are allowed. IN instructions will leave the memory configured in an unknown state.

4 data bits are used:

  • D0: Low memory bank selection
  • D1, D2: High memory bank selection
  • D3: Cartridge enable

Cxxx-Fxxx: reserved for cartridge

IN and OUT instructions in this space result in enabling the CART_IORQ signal which is routed to the cartridge port (C2_17 pin). A cartridge could make use of this to add extra IO mapped hardware to the computer.

Memory space

Memory accesses are split in 3 areas also depending on the A14-A15 address lines.

0xxx-3xxx: "Low" ROM

This is mapped to either the first or second 16K of the BIOS, depending on D0 bit of the memory bank configuration.

4xxx-7xxx: Internal RAM

This is the 16K of internal RAM

8xxx-Fxxx: "High" ROM or cartridge

This 32K space allows to access either the internal ROM or the cartridge depending on the state of memory bank configuration bit D3.

One of 4 32K pages can be selected using bits D2 and D1 of the memory bank config. As a result, this can access up to 128K of data in the internal ROM, and an extra 128K in the cartridge, which can be either ROM or RAM.

Last modified 2 years ago Last modified on Jun 4, 2022, 2:27:06 PM
Note: See TracWiki for help on using the wiki.