# Memory, the VIA, the PSG, keyboard, printer and tape Citations: **OSM** (service manual, page), **OFF** (Fabrice Francès's hardware page), **O1M** (Oric-1 BASIC manual), **ULA-RTL** (ula.md), **MAME** (OBSERVED). ## Rows | Row | RAM | ROM | Source | | --- | --- | --- | --- | | `oric1` | 48 KB (64 KB of DRAM fitted, top 16 KB under the ROM); a 16 KB model ignores A14-A15 | BASIC 1.0 (16 KB; early boards: two 2764 EPROMs plus IC11) | OSM pp. 10-11; MAME; Muso's ROM page | | `orica` (Atmos) | 48 KB (64 KB fitted) | BASIC 1.1 (two versions, told apart by PEEK(#E4B6): 162 early, 142 later; Muso's ROM page) | OSM; MAME | | `oric1-16k` | 16 KB | BASIC 1.0 | OSM p. 11 (later row) | | `prav8d`, `telstrat` | | | MAME (later rows, decision 1) | ## Memory map $0000-$BFFF RAM, except page 3 ($0300-$03FF) which is I/O; $C000-$FFFF ROM, or RAM when an expansion asserts MAP (the Microdisc's overlay); with MAP during $0000-$BFFF the internal DRAM is inhibited for external memory (OSM pp. 10-14; ULA-RTL 185-186). The screen sits at $BB80 (text) or $A000 (hires) with character sets at $B400/$B800 or $9800/$9C00 (ula.md). BASIC reports 47,870 bytes free on the Oric-1 and 37,631 on the Atmos in MAME's boot screens (OBSERVED; the difference is not explained in anything read, U5). ## The VIA (6522, IC6) at $0300-$030F The ULA asserts I/O for the whole of page 3; the VIA is selected for every page-3 address (so mirrored 16 times) unless an expansion pulls I/O CONTROL to free the bus (OSM p. 13; OFF). Software uses $0300-$030F. Wiring (OFF's table; OSM pp. 16-20 agree where they speak): | VIA line | Oric use | | --- | --- | | PA0-PA7 | the PSG's data bus, shared with the printer data lines | | CA1 | printer acknowledge | | CA2 | PSG BC1 | | CB2 | PSG BDIR | | PB0-PB2 | keyboard row select (a 3-to-8 decoder on the keyboard PCB) | | PB3 | keyboard sense (1 = pressed) | | PB4 | printer strobe | | PB5 | not connected | | PB6 | tape motor relay | | PB7 | tape output | | CB1 | tape input | | IRQ | the CPU's IRQ (wire-ANDed with expansions'); NMI is the reset button on the Oric-1/Atmos (OFF says the Telestrat's NMI is unconnected) | The ROM sets timer 1 for an interrupt every 1/100 s (OFF). MAME's trace (OBSERVED): the first VIA writes come at cycle 2,312,654 (after the RAM test): DDRB $F7, DDRA $FF, ORA $B7, PCR $DD, IER $7F, ACR $00 then $40, T1 latch/counter $2710 (10,000 cycles = 100 Hz), and an IFR clear every 10,000 cycles from then on. The VIA comes from the shared **`mos6522-python`** core (to be built; proposed by vic20-python, bbcmicro-python and the C64's 1541 discussion): the Oric is one more user. ## The PSG (AY-3-8912, IC4) Clocked at 1 MHz (MAME: "AY-3-8912A PSG @ 1.00 MHz"); its three outputs are tied together to one amplifier (OFF; OSM p. 16). Its bus control: BDIR/BC1 from CB2/CA2 (BC2 tied high inside the 8912): 00 inactive, 01 read, 10 write, 11 latch address (OFF). Its **port A** (register 14) is an output driving the keyboard's eight columns, active low (OFF). [ay8910-python](../../ay8910-python) already has `AY8912` (port A only) with `port_a_out(value)` / `port_a_in()` callbacks: nothing new is needed from the core; the board maps CA2/CB2 to the select/write/read calls. OFF says "other flavors of the PSG, 8910 and 8913, have 0 or 2 IO ports": the order is reversed (the 8910 has two, the 8913 none; ay8910-python's variants and GI's data sheet): conflict C3, minor. ## Keyboard An 8 x 8 passive matrix (Oric-1 lacks FCT): select a row on PB0-PB2, a column by writing port A of the PSG (one bit low), read PB3 (OFF; OSM p. 17). 64 tests for a full scan. ## Printer Centronics: data on port A (shared with the PSG), strobe PB4, acknowledge CA1 (OFF; OSM p. 20). MAME models a printer; the board offers a socket. ## Tape Two speeds: fast 2400 baud (one carrier cycle a bit) and slow 300 baud (OSM p. 18). TAPE OUT is generated with the VIA's timers on PB7; TAPE IN goes through an op-amp with ~50 mV hysteresis into CB1, its pulse widths measured by the VIA's timers (OSM pp. 18-19). OFF: fast mode writes one 2400 Hz period for a 1 and half a 2400 Hz plus half a 1200 Hz period for a 0; slow mode writes 8 periods at 2400 Hz for a 1 and 4 at 1200 Hz for a 0. The board feeds a timestamped edge stream into CB1 (`.tap` files hold the bytes, not the waveform: the encoder lives in the board's tape module, decision 7). ## Expansion The edge connector carries the bus, MAP, ROMDIS, I/O and I/O CONTROL (OSM p. 12-14): the Microdisc and Jasmin disk interfaces (disks.md), joystick interfaces and others.