# The bus, the memory map, GLUE and the MMU ## The map (DOC: HWSPEC 8, 9; SVC "Main Memory", "System Startup") | Range | What | Notes | | --- | --- | --- | | 000000-000007 | the first 8 bytes of ROM | GLUE maps ROM's first 8 bytes (the reset SSP and PC) to 0-7; writing there is a bus error (DOC: HWSPEC 8; SVC) | | 000008-0007FF | RAM, supervisor only | the vectors and system variables; a user-mode access is a bus error (DOC: HWSPEC 8) | | 000800-top of RAM | RAM | bank 0 then bank 1; 512 KB on a 520ST, 1 MB on a 1040ST (DOC: SVC "RAM memory map") | | up to 3FFFFF | RAM, up to 4 MB | two banks of 2 MB (DOC: HWSPEC 9 "Memory Configuration") | | FA0000-FBFFFF | cartridge ROM, 128 KB | ROM3/ROM4 selects, only A1-A15 on the port (DOC: HWSPEC 7); TOS reads FA0000 for a diagnostic cartridge's magic number at reset (DOC: SVC "System Startup"; OBSERVED: MAME logs the unmapped reads of FA0000/FA0002 from FC0030) | | FC0000-FEFFFF | TOS 1.0-1.04, 192 KB | six 32 KB x 8 ROMs (DOC: SVC) | | E00000-E3FFFF | TOS 1.06 and later, 256 KB (STE, Mega STE; TOS 2.06 on an ST with a ROM adapter) | OBSERVED: MAME's STE starts at E00040 | | FF8000-FFFFFF | I/O, supervisor only | reserved addresses give a bus error (DOC: HWSPEC 9) | I/O (DOC: HWSPEC 9 unless marked): | Address | Register | | --- | --- | | FF8001 | MMU memory configuration (bank 0 and 1 sizes, 4 bits) | | FF8201, FF8203 | video base high, mid (the screen starts on a 256-byte boundary); STE adds FF820D low (DOC: STEADD) | | FF8205, 07, 09 | video address counter (read only on the ST; read/write on the STE: STEADD) | | FF820A | GLUE sync mode: bit 0 external/internal sync, bit 1 50/60 Hz | | FF820E, FF820F, FF8265 | STE: line offset, HSCROLL (DOC: STEADD) | | FF8240-FF825E | 16 palette registers (Shifter) | | FF8260 | Shifter mode: 0 320x200x4 planes, 1 640x200x2, 2 640x400x1, 3 reserved | | FF8604 | FDC or HDC register, or the sector count, chosen by FF8606 (word access) | | FF8606 | DMA status (read) / DMA mode control (write) | | FF8609, 0B, 0D | DMA base and counter, high, mid, low (load low, mid, high: HWSPEC Appendix C 841017B) | | FF8800 | PSG register select (write), read data (read) | | FF8802 | PSG write data | | FF8900-FF8925 | STE DMA sound and Microwire (DOC: STEADD) | | FF8A00-FF8A3D | Blitter (DOC: BLIT) | | FF9200-FF9222 | STE joypads, paddles, light gun (DOC: STEADD) | | FFFA01-FFFA2F | MFP, odd bytes (24 registers) | | FFFC00, 02 | keyboard ACIA control/status, data | | FFFC04, 06 | MIDI ACIA control/status, data | ## GLUE (DOC: SVC "Glue"; HWSPEC 8-10) GLUE "holds the system together" (SVC): it divides the 8 MHz clock into 2 MHz (the PSG) and 500 kHz (the ACIAs); generates BLANK, DE, VSYNC and HSYNC with a 50/60 Hz register; encodes the MFP's interrupt and the video sync interrupts onto IPL1 and IPL2 as four levels (none, MFP = 6, VSYNC = 4, HSYNC = 2: HWSPEC 10); decodes addresses into chip selects for the ACIAs, MFP, DMA chip, PSG, MMU and ROMs; arbitrates the bus for DMA; and asserts **BERR** on writes to ROM, byte writes to word-only registers, user-mode accesses to system memory, and when a device does not answer in time (SVC). Bus errors are therefore part of normal operation: TOS and programs probe for hardware (the STE's registers, a Blitter, more RAM) by catching them (HYPOTHESIS for which probes each TOS makes: the board will log every bus error TOS takes while booting, milestone 1). That makes the 68000's bus-error frame load-bearing on this board ([cpu-cores.md](cpu-cores.md)). ## The MMU and the shared bus (DOC: HWSPEC 2.2; SVC "Memory Controller") The MMU turns addresses into RAS/CAS, refreshes the DRAMs, holds the video address counter and the DMA address, loads the Shifter with display words (DCYC), and is programmed with the bank sizes at power-up. **RAM cycles are interleaved between the CPU and video so the CPU keeps its full bandwidth** (HWSPEC 2.2): a 68000 bus cycle is four clocks, and the MMU gives each four-clock period two slots, one to the CPU and one to video (or refresh, or DMA). What that means for the CPU's timing, which no Atari document states: - **Accesses to RAM, the Shifter's registers and (by most accounts) the other GLUE/MMU devices are aligned to the four-clock slot**: an access that becomes ready in the wrong half waits for the next CPU slot. Clock Signal's ST (MIT, tier 5) applies exactly this: "if accessing RAM or the shifter, align with the two cycles next available" (OBSERVED, `CLK Machines/Atari/ST/AtariST.cpp` at `cc085c4`). So an instruction's cycle count on the ST is its 68000 count rounded up access by access, which is why ST programmers count "NOPs" (4 cycles) per line. **Evidence: tier 5 only, and the rule as a whole is HYPOTHESIS** until a test program with real-unit results or the GLUE/MMU designs (ASIC: the STE's GSTMCU, 49 sheets) settle it (U4). - **ACIA accesses are 6800-style VPA cycles** synchronised to the 68000's E clock (the ACIAs are MC68xx peripherals at FFFC00: HWSPEC 9 groups them as "MC68xx"); the cost depends on the E phase (U5). - **The YM2149 and the MFP** answer through GLUE and DTACK; their wait states are U6. - **DMA and the Blitter take the bus** "on an egalitarian first come, first served basis", holding it until the operation completes or is relinquished (HWSPEC 2.3); the Blitter in 64-bus-cycle turns unless HOG is set (DOC: BLIT "HOG"). - **Wakestates.** GLUE and MMU start in one of several phase relationships at power-up (a community finding from demo coders and emulator authors, first written up on forums this survey cannot use: atari-forum.com refuses AI crawlers). Which phases exist and what each changes is U7; the board must make the phase a machine parameter, not a constant, and record it in save states. ## Sockets on this side Cartridge port (ROM image up to 128 KB, or a test-only fake), RAM size, the TOS image (by SHA-1), the monitor type.