The SamRam contains a 32K static CMOS Ram chip, and some I/O logic for
port 31. If this port is read, it returns the position of the joystick,
as a normal Kempston joystickinterface would. If written to, the port
controls a programmable latch chip (the 74LS259) which contains 8
latches:
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
WRITE | address | bit |
The address selects on of the eight latches; bit 0 is the new state of
the latch. The 16 different possibilities are collected in the diagram
below:
OUT 31, | OUTPUT | RESULT |
0 | 0 | Switch on write protect of CMOS RAM |
1 | 0 | Write to CMOS RAM allowed |
2 | 1 | Turn on CMOS RAM (see also 6/7) |
3 | 1 | Turn off CMOS RAM (standard Spec. ROM) |
4 | 2 | — |
5 | 2 | Ignore all OUT's to 31 hereafter |
6 | 3 | Select CMOS bank 0 (Basic ROM) |
7 | 3 | Select CMOS bank 1 (Monitor,...) |
8 | 4 | Select interface 1 |
9 | 4 | Turn off IF 1 (IF1 ROM won't be paged) |
10 | 5 | Select 32K RAM bank 0 (32768-65535) |
11 | 5 | Select 32K RAM bank 1 (32768-65535) |
12 | 6 | Turn off beeper |
13 | 6 | Turn on beeper |
14 | 7 | — |
15 | 7 | — |
At reset, all latches are 0. If an OUT 31,5
is issued, only a reset
will give you control over the latches again. The write protect latch
is not emulated; you're never able to write the emulated CMOS ram in the
emulator. Latch 4 will pull up the M1 output of the Z80. The Interface
I won't page the ROM anymore then.