Close

Bootstrapping and IO

A project log for Z80 Computer

Yet another Z80 computer.

james-otsJames Ots 05/18/2017 at 20:240 Comments

It's probably about time I mentioned a bit about how my computer's memory is organized, and how I bootstrap programmes into it.

As I don't have a ROM programmer, I had to find some other way to get a programme loaded into RAM. The way I do it is using an FT245R. It has a USB port 'on one end', and on the other end it has 8 data lines, a read and a write line and a couple of signals which indicate whether data is available or the output buffer is full.

When the computer starts up, all memory reads from any address are directed to the FT245R. If no data is available, wait states are inserted until there is data.

In order to then be able to save things to RAM, you have to use OUT instructions to change the memory bank mappings.

I've split the memory into four banks. Which bank is used depends on A14 and A15.

You can choose what goes into each of these banks by sending a byte to one or ports 0, 1, 2 or 3. If the byte starts with 11, any reads from that bank will come from the FTDI, while writes are ignored. If the byte starts with 10 then memory accesses will be to the EEPROM, but I haven't got that set up yet. If the byte starts with a 0 then RAM will be used, and the bottom 7 bits of the byte become address lines A14..20 in theory, although as I only have a 512Kb RAM chip, only A14..18 are used.

Initially the only way to get data in from the FTDI was to map it into memory. However, this is rather a clunky way to do things, so I've now also made it so that you can use an IN instruction to read from the FTDI, and also allowed you to write to it with an OUT. At the moment these are blocking instructions, so I need to also set things up so that you can read the status of the FTDI.

Discussions