OK, since there seems to be some interest in this, I thought
I would mail my musings on the subject.

The SAM's memory map, as you know, consists of 4 16K chunks
called A (0-3FFF) B (4000-7FFF) C (8000-BFFF) and D (C000-FFFF).
The Speccy 128 map also has 4 16K chunks, A being one of two
16K roms - this would be replaced by the 32K RAM which would
be loaded with an image of the ROM before switching to 128
mode. Incidentally, the z80 in the SAM would be disabled,
and a new z80 attached to the expansion port is being used
instead (for both SAM and 128 mode).

Now, page D of the 128 map can point to one of 8 16K chunks
of ram, whereas pages B and C always point to the same
two 16K pages. By juggling the a14 and a15 lines from the
z80 before they reach the SAM's ASIC, we can map the
128's memory map onto the ASIC's memory map like this:

128      Sam's ASIC

A        - (goes two one of two 16K pages in the 32K ram)
B        B
C        A
D        D

In other words, the non-pageable 32K chunk in the 128 map
maps onto a 32K page specified by the SAM's LMPR register,
whereas page D (which can bank in 16K pages) maps to a
16K page specified by the SAM's HMPR register.

The trick then is to catch any writes to the 128's banking
register and convert this to a write to the SAM's HMPR
register, with a certain amount of twiddling to the value
that is being written. The LMPR register would be set
prior to switching to 128 mode. Since the z80 is hanging
off the back of the SA, it is quite easy to catch writes
to an output port and divert them to a different port.

There's one more snag: the 128 can take its screen from
one of two of its 16K pages, and this is determined
by setting or unsetting a bit in the same register
as is used to control the 128's memory paging for bank D.
Any modification to this bit has to be reflected in the
SAM's VMPR register. So, a writed to the spectrum 128's
memory/video port (port FD, I think) has to be converted
to a write to two SAM ports - HMPR and VMPR. This can be
achieved with a simple state machine.

There are some other minor complications - the sam's FD
port will need to be re-mapped to elsewhere in the spectrum's
i/o map, other ports may need re-mapping, a soundchip will
be necessary to give the 128 sound, and 128 peripherals
may not like working at a 6MHz clock. A bonus is that the 32K
ram could be used as a soft-rom when in SAM mode. Also, speccy
peripherals may or may not be accessible in SAM mode - simple
things like joystick interfaces, speech synthesisers and so
on should be OK, but a multiface won't be. (That said,
I think I know how to make a SAM multiface if anyone is
interested).

So there you go, something to think about. I think it's
very do-able, but possibly not worth the effort (except
for the challenge of the design).

Andy

Reply via email to