M/C Part 14 MEMORY ------ The 64k addressing range is split into four 16k pages, of which there are 32 Ram and 2 ROM. For clarity, I shall refer to the memory map used in the technical manual: 0000 4000 8000 C000 FFFF _______________________________ | | | | | | A | B | C | D | |_______|_______|_______|_______| \______ ______/ \_____ ______/ \/ \/ Lower memory Upper memory (See lmpr) (See hmpr) NB. Only sections A and C can be controlled - B is always the page after the one in A and D is always the page after C. PORTS ----- lmpr: D0 \ D1 \ * 250 * D2 > Page in section A of memory map. D3 / Read/ D4 / Write. D5 0 for ROM0 in section A. 1 for RAM page. D6 0 for RAM in section D. 1 for ROM1. D7 RAM in section A write protected when this bit is high. hmpr: D0 \ D1 \ * 251 * D2 > Page in section C of memory map. D3 / Read/ D4 / Write. D5 \ In mode 3, used as D2 and D3 of colours. D6 / D7 When high, extra memory is used for sections C and D. vmpr: D0 \ D1 \ * 252 * D2 > Page to use for video display. D3 / Read/ D4 / Write. D5 \ Screen mode (0-3). D6 / D7 I/O bit for Midi. Sound: Address port 511 & data port 255. See Technical Manual for extra information. Write only. Midi: Outputs through port 253. See Tech Manual. Border: D0 \ D1 \ D2 \ Border colour (0-15) __\ / | / / | D5 / | D6 Midi operation allowed if high. | D7 In modes 3 & 4, disables screen if high. | | __________________________________________________ | | | |__| D3 - Output bit for ~mic~, normally high. | | D4 - Output bit for ~beep~, normally low. | |__________________________________________________| (Write only) Line: Write only register addressed through port 249. When TV scan reaches Y line specified by this register, an interrupt is generated. Range of 0-191. Any other value disables this function. Palette: Base port 248. Registers from 0-F correspond to palette colours, addressed using 248 as the LSB and the register no. as the MSB. Each register is write only: the colour is defined as follows: D0 \ / B D1 > Least significant bit of: < R D2 / \ G D3 Half bit brightness on all colours. D4 \ / B D5 > Most significant bit of: < R D6 / \ G D7 Attributes register: Read only from port 255. Returns the attributes of the currently displayed cell in modes 1 & 2, and the third byte in every four in modes 3 & 4. Keyboard: Base port 254. MSB specifies line of keys to scan. Read only. D0 \ D1 \ D2 > First 5 keys. Low when pressed. D3 / D4 / D5 Light pen strobe/ serial input bit. D6 Input from ~EAR~ of cassette recorder. D7 Status bit showing external memory on/off MSB on A8 - A15 gives keyboard lines as follows:- 1 2 3 4 5 6 7 8 A8 low (others high) = FE SHIFT Z X C V F1 F2 F3 A9 low = FD A S D F G F4 F5 F6 A10 low = FB Q W E R T F7 F8 F9 A11 low = F7 1 2 3 4 5 ESC TAB CAPS A12 low = EF 0 9 8 7 6 - + DEL A13 low = DF P O I U Y = " F0 A14 low = BF ENTER L K J H ; : EDIT A15 low = 7F SPC SYM M N B , . INV none low (all high) = FF CTRL /\ \/ < > Status: Read only from port 249. Keys similar to Keyboard port. D0 \ LINE D1 \ COMMS D2 > When low, indicates the interrupt. MIDI-in D3 / FRAME D4 / MIDI-out D5 \ D6 > Keys 6, 7 and 8 as listed above. D7 / Midi-in: Read only port 253 which generates an interrupt (see above) when read. Data must be read by the CPU before the next interrupt. Pen: LPEN (248) - gives X coordinate. HPEN (504) - gives Y coordinate. LPEN: (additional) D0 Inputs D0 of current colour (as in palette no). D1 When high, shows that a byte is being transmitted through Midi-out. SCREEN MODES ------------ There are four screen modes available. MODE 1. Spectrum emulation. 192 pixels vert * 256 horiz. 6k bit-mapped (0-paper, 1-pen) +768 byte attribute file. Each attribute covers 8*8 pixel cell. Worked as follows D0 \ D1 > Pen colour (0-7) D2 / D3 \ D4 > Paper colour (0-7) D5 / D6 Bright on/off. (D4 of pen AND paper). D7 Flash on/off. MODE 2. Similar to mode 1. 192 pixels vert * 256 horiz. 6k bit-mapped (0-paper, 1-pen). + 6k attribute file. Each attribute covers a byte slice. (8 pixels horiz.) Worked as above. MODE 3. Hi-resolution. 192 pixels vert * 512 horiz. 24k bit-mapped. 2 bits per pixel giving 4 colours. D2 and D3 for every colour is given by hmpr (see above). MODE 4. Start-up mode. 192 pixels vert* 256 horiz. 24k bit-mapped. 4 bits per pixel giving 16 colours.