# Memory map, paging and interrupts Citations as in [start-here.md](start-here.md). ## Model B (row 1) | Range | What | Source | | --- | --- | --- | | &0000-&7FFF | 32 KB DRAM (16 KB on a Model A, mirrored: a row parameter) | DOC: SM85-1 3.2 ("Locations 0 - &7FFF are assigned to the dynamic RAM") | | &8000-&BFFF | the selected paged ("sideways") ROM | DOC: SM85-1 3.2; AUG 21 | | &C000-&FBFF | MOS ROM (IC51, a 16 KB device "but 3/4K of it is left unused") | DOC: SM85-1 3.2 | | &FC00-&FCFF | FRED: 1 MHz bus page | DOC: AUG 17, 28 | | &FD00-&FDFF | JIM: 1 MHz bus page (paged through a FRED register by convention) | DOC: AUG 28 | | &FE00-&FEFF | SHEILA: internal devices (table below) | DOC: AUG 17 | | &FF00-&FFFF | MOS ROM (vectors) | DOC: SM85-1 3.2 (IC21 decodes &C000-&FFFF; IC20/IC25 mask the ROM over &FC00-&FEFF) | ### SHEILA (DOC: AUG 17 table; each device repeats through its block) | Offset | Device | Notes | | --- | --- | --- | | &00-&07 | 6845 CRTC | address register at even, data at odd offsets ([crtc6845.md](crtc6845.md)) | | &08-&0F | MC6850 ACIA | status/control, data ([adc-serial-tape.md](adc-serial-tape.md)) | | &10-&1F | serial ULA | write-only control | | &20-&2F | Video ULA | &20 control, &21 palette; write-only ([video-ula.md](video-ula.md)) | | &30-&3F | paged ROM select latch (74LS161) | write-only; "could equally well be addressed at any one of the fifteen other locations &31-&3F" (AUG 17) | | &40-&5F | system VIA | 16 registers, mirrored ([via6522.md](via6522.md)) | | &60-&7F | user VIA | | | &80-&9F | 8271 FDC (when fitted) | &80-&83 registers, &84-&87 data (DACK) on the B+ variant (DOC: SMBP 5.5.1) ([discs.md](discs.md)) | | &A0-&BF | 68B54 ADLC (Econet, when fitted) | | | &C0-&DF | uPD7002 ADC | | | &E0-&FF | Tube ULA | out of scope until a second processor is wanted | **Reads of write-only registers and of absent devices** (the Video ULA, the ROM latch, an unfitted 8271 or ADLC): not documented. The usual 6502 behaviour is that the data bus keeps the last value driven (open bus), but on the BBC the data bus is buffered (IC72 for the 1 MHz bus only) and what an absent SHEILA device returns is unknown: **U5**, to be measured by a test on a real machine (none in hand) or taken from a detector and tagged. ### Paged ROMs (DOC: AUG 15, 21; SM85-1 3.2) - Four sockets on the board (IC52, IC88, IC100, IC101), up to 16 slots with an expansion board; the latch at &FE30 holds the slot number (4 bits). Socket priority and which slot numbers the four sockets answer to are link-dependent (SM85-1 link survey 5.1): a machine-table field. - Sockets may hold 16 KB devices, or 8 KB/4 KB devices decoded by A12/A13 (SM85-1 3.2): the board models a slot as a 16 KB window over a file of 8 or 16 KB (mirroring an 8 KB image is the common case: Acorn DFS 0.90 is 8 KB, [census.md](census.md)). - An empty slot reads as... unknown: U5 again (the OS scans every slot's header at &8006/ &8007 on reset, so this value is read on every boot: it matters). - Sideways RAM boards (Solidisk, Watford, ATPL) are third-party: a later socket device, not row 1. ## Model B+ (row 2) DOC: SMBP 5.4. - 64 KB DRAM: 32 KB main, 20 KB shadow screen (&3000-&7FFF), 12 KB paged RAM. - **&FE30 bit 7** (a PAL bit beside the 74LS161's four): set, the 12 KB paged RAM appears at &8000-&AFFF, and the top 4 KB of the selected ROM stays at &B000-&BFFF (DOC: SMBP 5.4.2). - **&FE34 bit 7** (VDUSEL): shadow mode. The 6845 then displays the shadow RAM, and the CPU reaches shadow RAM at &3000-&7FFF **only while executing code from &C000-&DFFF (the MOS VDU drivers) or from paged RAM at &A000-&AFFF**: the PAL watches each opcode fetch and sets a one-bit flag that lasts until an opcode outside that space is fetched (DOC: SMBP 5.4.3 and appendix, "the PAL checks the address of each CPU opcode fetch"). - **Core requirement**: the board must know which bus cycles are opcode fetches. 6502-python marks them (SYNC); see [cpu-and-reuse.md](cpu-and-reuse.md). ## Master 128 (row 3) DOC: MRM "Machine Memory Map". - **ROMSEL (&FE30)**: bit 7 RAM (ANDY, 4 KB at &8000-&8FFF over the selected ROM), bits 0-3 the slot. Slots 4-7 are sideways RAM by default (link-selected); slots 0-3 and 8-15 are ROM, the MOS ROM is a 128 KB device carrying several slots plus &C000-&FFFF. - **ACCCON (&FE34)**: IRR (bit 7: drives the CPU's IRQ line), TST, IFJ (FRED/JIM go to the cartridges), ITU (internal Tube), Y (HAZEL, 8 KB at &C000-&DFFF), X (all &3000-&7FFF accesses go to LYNNE), E (VDU-driver accesses go to LYNNE, as on the B+), D (the CRTC displays LYNNE). - The Master's own SHEILA additions (the 1770 control register and registers, the cartridge pages, the CMOS RAM through the system VIA's port B: MRM "Slow Data Control Port") are to be read in full from MRM and MSM when row 3 starts; the Phase 0 has not checked their addresses (MAME places the 1770 at &FE24/&FE28: OBSERVED from its device list order only, not checked) (**U9**). ## Interrupts IRQ is wire-ORed: the two VIAs, the ACIA, the Tube, the 1 MHz bus, the ADLC (when not routed to NMI), and on the Master ACCCON's IRR (DOC: AUG 13; MRM). NMI comes from the disc controller (the 8271's or 1770's data request) and the ADLC (DOC: SMBP 5.5.1 "notNMI is a wire NOR signal"; AUG 13). The MOS's NMI handler lives at &0D00 (DOC: AUG 13, not the board's concern: it is firmware). System VIA interrupt bits (DOC: AUG 13.9): CA2 key pressed, CA1 6845 vertical sync, shift register (unused), CB2 light pen, CB1 ADC end of conversion, T2 (speech), T1 (the 100 Hz clock), bit 7 any. ## Reset A 555 timer gives the reset at power-up and on BREAK; a separate CR network gives "Reset A" only at power-up, to the system VIA, so the OS can tell a cold start from BREAK by the VIA's interrupt register (DOC: SM85-1 3.1). **The board must model this**: on BREAK the system VIA is not reset, everything else is. On the Master, the CMOS RAM holds the configuration and survives power-off (a battery-backed state for save files).