# The gate-array registers, re-read against Sega's hardware manual Status: milestone 1 re-read (2026-11-09) of every register fact in the Phase 0 notes (`start-here.md`, not carried into the 2026-11-19 restart) against Sega's *MEGA-CD HARDWARE MANUAL: THE HARDWARE*, VER 1.0, 1991/10/14 (`reference/docs/sega/mega-cd-hardware-manual.pdf`, 97 PDF pages). No emulator source was consulted for this document. ## How this was read, and what could not be - **Source of every fact: the PDF, read as page images.** Citations are `p.M (PDF N)`: `M` is the page number printed on the manual page, `N` the page of the PDF file. For the main manual `N = M + 7`. - **The "HTML transcription" is not a transcription.** `sega-cd-manual-html-1999.zip` holds one HTML file (`segacd_toc.html`, a table of contents) and GIFs; `MegaCD/Hardware/Cdh-NN.gif` is a picture of manual page `NN`, from the **same fax copy** as the PDF (same fax header, same watermark, lower resolution: 848x1098 against the PDF's 300 dpi). There is no text to grep. It was used twice as a cross-check (`Cdh-22.gif`, `Cdh-31.gif`) and showed nothing the PDF did not. Everything below is therefore marked **[PDF]**; the two cross-checked places are marked **[PDF, GIF same]**. - **Shaded cells are unreadable.** The manual shades register bits that "the BIOS masks" (p.3, PDF 10: "Masking is used in the BIOS"). The fax turned the shading into a dither that covers the bit names. High-resolution crops with a blur recovered some (`$A12002`, `$FF8034`, part of `$FF8068`, `$A12000` bit 0) and not others. Where a bit's *name* comes from the text under the table but its *position* could not be read, this document says **position unreadable** rather than guess. - **Pages.** Manual p.4 (PDF 11) and p.45 (PDF 52) are "Blank Page" inserts; the contents list "OUTLINE OF MEGA-CD HARDWARE" on p.4, so **that section is missing from the scan** (and from the GIF set, which has no `Cdh-04.gif`). PDF 77-97 are the appendix "PCM SOUND SOURCE (RF5C164)", pp.1-22, checked by contact sheet only: it holds nothing about the gate array. - **Hand corrections.** p.24-25 (PDF 31-32) carry handwritten corrections over struck-out print; they are reported as such. "Derived" marks an inference from a table or example in the manual, not a sentence in it. ## 1. Register summary (p.19-20, PDF 26-27) [PDF] Offsets are from `$FF8000` (sub) and `$A12000` (main). Size unit is the word. "If not otherwise mentioned, byte/word access and bit operation commands are allowed." | Offset | Words | Sub-CPU side | Main-CPU side | | --- | --- | --- | --- | | `00` | 1 | VER NO./RESET/LED | Reset/INT2 | | `02` | 1 | Memory mode/Priority/Write protect | Memory mode/Write protect | | `04` | 1 | CDC mode/CDC register address | CDC mode | | `06` | 1 | CDC register data | H-INT (boxed, beside offsets 04-08) | | `08` | 1 | CDC host data (16 bit) | CDC host data (16 bit) | | `0A` | 1 | CDC DMA address | (reserved, p.59) | | `0C` | 1 | Stop watch | Stop watch | | `0E` | 1 | Communication flag | Communication flag | | `10-1E` | 8 | Communication command R/O | Communication command R/W | | `20-2E` | 8 | Communication status R/W | Communication status R/O | | `30` | 1 | TIMER (INT 3) | - | | `32` | 1 | INT mask | - | | `34` | 1 | Fader | - | | `36` | 1 | CDD control | - | | `38-40` | 5 | CDD status (INT 4) | - | | `42-4A` | 5 | CDD command | - | | `4C` | 1 | Font color | - | | `4E` | 1 | Font bit | - | | `50-56` | 4 | Font data | - | | `58-66` | 8 | Rotation reduction ("INT 1 for only 2M mode") | - | | `68` | 1 | Sub-code address | - | | `6A-FE` | "4B" | Reserved by the system | - | | `100-17E` | "40" | Sub-code data (INT6) | - | | `180-1FE` | "40" | Sub-code data image | - | The manual documents nothing on the main side above `$A1202E`, and says nothing about mirrors of either register block. ### Power-on values and access rules (p.21, PDF 28) [PDF] "Initial values of registers after Power ON. (X means unknown.)" Access: W/B = word or byte, W = word only. Bit-op: whether `BSET`/`BCLR`/`BTST`-class instructions may be used. The rows of the access columns are slightly skewed in the fax; the assignment below is the natural one but a one-row slip cannot be excluded. | Register | Initial | Access | Bit ops | Note | | --- | --- | --- | --- | --- | | `FF8000` | `0000` | W/B | yes | "the RES0 (bit 0) after approx. 100ms automatically becomes '1'" | | `FF8002` | `0001` | W/B | yes | RET=1, MODE=0: 2M, main CPU owns word RAM | | `FF8004` | `0000` | W/B | only `btst` | | | `FF8006` | `00XX` | W/B | no | | | `FF8008` | `XXXX` | W | no | | | `FF800A` | `XXXX` | W | no | | | `FF800C` | `----` | W | no | "Counting is started at approximately the same time when the MAIN-CPU is started." | | `FF800E` | `0000` | W/B | yes | | | `FF8010-2E` | `0000` | W/B | yes | | | `FF8030` | `0000` | W/B | yes | | | `FF8032` | `0000` | W/B | yes | | | `FF8034` | `0000` | W | no | | | `FF8036` | `0100` | W/B | no | | | `FF8038-4A` | `0000` | W/B | no | | | `FF804C` | `0000` | W/B | yes | | | `FF804E` | `0000` | W/B | yes | | | `FF8050-56` | `0000` | W/B | yes | | | `FF8058` | `0000` | W/B | yes | | | `FF805A` | `0000` | W | no | | | `FF805C` | `0000` | W/B | no | | | `FF805E` | `0000` | W | no | | | `FF8060` | `0000` | W/B | yes | | | `FF8062` | `0000` | W | no | | | `FF8064` | `0000` | W | no | | | `FF8066` | `XXXX` | W | no | | | `FF8068` | `00XX` | W/B | yes | | | `FF8100-81FE` | `XXXX` | W/B | yes | | | `A12000` | `0002` | W/B | only `btst` | SBRQ=1, SRES=0: sub CPU held in reset with its bus granted | | `A12002` | `0001` | W/B | yes | RET=1 | | `A12004` | `0000` | W/B | yes | | | `A12006` | `FFFF` | W | no | | | `A12008` | `XXXX` | W | no | | | `A1200A` | `----` | | | | | `A1200C` | `0000` | W | no | | | `A1200E` | `0000` | W/B | yes | | | `A12010-2E` | `0000` | W/B | yes | | ## 2. Main-CPU side registers (`$A12000-$A1202F`) ### `$A12000` BUSREQ, RESET (p.56, PDF 63) [PDF] | Bit | Name | RD | WR | Meaning | | --- | --- | --- | --- | --- | | 15 | IEN2 | 0/1 | 0 | "The mask state of INT LEVEL2 on the SUB-CPU side": 0 mask, 1 enable. Read-only copy. | | 8 | IFL2 | 0/1 | 0/1 | Write 1: "INT Level 2 is generated (When IEN2=1)"; write 0 "is not used". Read 0: "in the process of doing a LEVEL2 interrupt"; read 1: "Level 2 is not treated yet". | | 1 | SBRQ | 0/1 | 0/1 | Write 0 "cancel BUS request", 1 "BUS request". Read 0 "SUB-CPU is operating", 1 "BUS request; satisfied". | | 0 | SRES | 0/1 | 0/1 | Write 0 "RESET", 1 "RUN". Read 0 "reset in process", 1 "RESET finished". | - Bits 1-0 are shaded. "RES" is legible in the bit-0 cell; SBRQ at bit 1 is by elimination and agrees with the power-on value `0002` and with p.6 (PDF 13), which names the byte: "By setting SBRQ=1 or SRES=0 in the MAIN side register $A12001". - "bset and bclr can not be used" on the shaded bits (p.56); p.21 says "only btst". - **SRES is a level in the manual**: 0 holds the sub CPU in reset, 1 lets it run. The manual does not describe an edge, a delay, or what reads back when both bits are written at once. - The manual does not say IFL2 is cleared by the level-2 acknowledge; the read meanings above are all it gives. p.30 (PDF 37) adds: "For proper synchronization LEVEL 2 should be issued from V-INT." ### Forced reset of the gate array (p.56-57, PDF 63-64) [PDF] "When the MAIN-CPU executes a specific command pattern, the interior of the Gate Array is initialized." The pattern, with "Attention must be paid to address and size": ``` MOVE.W #$FF00,$A12002 MOVE.B #$03,$A12001 MOVE.B #$02,$A12001 MOVE.B #$00,$A12001 ``` "a is not executed by command patterns other than those mentioned above." - **Not initialised**: "All the registers belonging to the MAIN-CPU" -- listed as `$A12000` (`=XX00`), `$A12002` (`=FF00`), `$A12004`, `$A12006` ... `$A1202E`. (The labels printed beside `$A12004` "(H-INT)" and `$A12006` "(STATUS REGISTER)" look shifted by one row; the manual's own p.58 puts H-INT at `$A12006`.) - **Initialised**: "All the functions other than the MAIN-CPU registers are reset": "Registers and functions connected to the SUB-CPU: Refresh/Timer/Stop watch/DMA/Rotation/Interrupt/CDD communication/Sub-code reception/Fader, etc." ### `$A12002` Memory mode / Write protect (p.57, PDF 64) [PDF] | Bit | Name | RD | WR | Meaning | | --- | --- | --- | --- | --- | | 15-8 | WP7-WP0 | (shaded) | (shaded) | PRG-RAM write protect, see below | | 7-6 | BK1-BK0 | (shaded) | (shaded) | PRG-RAM bank seen at main `$020000` | | 5-3 | - | 0 | 0 | | | 2 | MODE | 0/1 | 0 | Read-only here: 0 = 2M mode, 1 = 1M/1M mode | | 1 | DMNA | 0/1 | 0/1 | "Declaration of MAIN-CPU No Access on the ram" | | 0 | RET | 0/1 | 0 | Read-only here | Names in the shaded cells (WP7..WP0, BK1, BK0) were legible in a blurred crop; their RD/WR rows were not. - **WP**: "The address range $0 to $1FDFF of the SUB-CPU is protected in multiples of $200. If a WP bit field is set to '1' then the corresponding $200 element range is protected." p.14 (PDF 21): "Write protection can be applied between $0 and $1FDFF in units of $200 by means of the MAIN-CPU register $A12002." p.24 (PDF 31): "protected by the MAIN-CPU ... in multiples of $200 elements. If a WP bit field is nonzero then the corresponding $200 element range is protected." **The unit is $200 bytes.** The stated maximum, `$1FDFF`, is `$FF x $200 - 1`, which fits "sub-CPU writes below `WP x $200` are blocked" (derived); the "corresponding element" wording is loose and the manual gives no worked example. - **BK1-0**: "the PRG-RAM is accessed through 4 BANKs. (When SBRQ=1 or SRES=0)". - **DMNA, 2M mode**: write 0 "no significance", 1 "returns the 2M RAM to the SUB-CPU". Read 0 "in the process of returning the 2M RAM", 1 "Completion of the return of the 2M RAM to the SUB-CPU". - **DMNA, 1M mode**: "In the Write mode '0' = Swap request / '1' = No significance. In the Read mode '0' = Swap completion / '1' = In the process of requesting a swap". **This contradicts the sub-side chapter** (p.24: "This bit is set to '1' to request switching, setting the bit to '0' has no significance"). See section 5. - **RET, 2M**: read 0 "the SUB-CPU is in the process of returning the 2M RAM", 1 "the 2M RAM has been returned to the MAIN-CPU". - **RET, 1M**: read 0 "WORD-RAM 0 is attached to the MAIN-CPU, and ... WORD-RAM 1 is attached to the SUB-CPU"; 1 = the reverse. ### `$A12004` CDC mode (p.58, PDF 65) [PDF] Read-only. Bit 15 EDT ("all data has been transferred from the CDC"), bit 14 DSR ("the data from the CDC has been put into the $A12008 register"), bits 10-8 DD2-DD0 ("Refer to the SUB-CPU register $FF8004"). All other bits read 0. No UBR on this side. ### `$A12006` H-INT vector (level 4) (p.58, PDF 65) [PDF] Word access only. Bits 15-0 HIBF-HIB0, read/write. "When H-INT is generated in the MAIN-CPU, the addresses placed on $70 and $72 are ignored and a jump address is formed using $70 for the high order portion of the address and HIB15-0 for the low order portion of the address. After a reset, $A12006 is set to -1." Power-on value `FFFF` (p.21). The manual does not mention mode 1 here. ### `$A12008` CDC host data (p.58, PDF 65) [PDF] Word access, read-only, HD15-HD00. "Two bytes from the CDC are accumulated in the host data register and then transferred to the MAIN-CPU or SUB-CPU. After the data in HD00-15 has been read, the CDC transfers the next 2 bytes of data into this register." ### `$A1200A` (p.59, PDF 66) [PDF] "Reserved by the system". ### `$A1200C` Stop watch (p.59, PDF 66) [PDF] Word access, read-only. Bits 11-0 TD11-TD00, bits 15-12 read 0. "This timer counts from 0 to 4095, one count taking 30.72µs. $FF800C of the SUB-CPU clears the timer." ### `$A1200E` Communication flag (p.59, PDF 66) [PDF] Bits 15-8 CFM7-CFM0 (main CPU's flags): read/write. Bits 7-0 CFS7-CFS0 (sub CPU's flags): read, write 0 (read-only here). ### `$A12010-$A1201E` Communication command, `$A12020-$A1202E` Communication status (p.60, PDF 67) [PDF] Command 0-7: eight words, "Read/Write". Status 0-7: eight words, "Read Only". ## 3. Sub-CPU side registers (`$FF8000-$FF8067`, and the sub-code block) ### `$FF8000` Reset (p.22, PDF 29; example on p.3, PDF 10) [PDF, GIF same] | Bit | Name | RD | WR | Meaning | | --- | --- | --- | --- | --- | | 15-10 | - | 0 | 0 | | | 9-8 | LEDG, LEDR (shaded; **which is bit 9 and which bit 8 is unreadable**) | ? | ? | "Red LED '1'=ON '0'=OFF (ACCESS)", "Green LED '1'=ON '0'=OFF (READY)" | | 7-4 | Ver3-Ver0 | 0/1 | 0 | "shows chip version" | | 3-1 | - | 0 | 0 | | | 0 | RES0 (shaded; "RES" faintly legible; p.21 says "RES0 (bit 0)") | ? | ? | "Periphery reset" | - **RES0**: "In the Write mode, '0'= reset, '1' is not used. In the Read mode, '0'= the periphery is being reset. '1'= the periphery is operable. (100 ms after a reset, the periphery becomes operable and RES0 becomes '1'.)" - **The manual does not list what "periphery" covers.** - LED table (p.22; "The BIOS is set"): Green 1 Red 1 as printed, with the Red digit circled and a handwritten "0/1" (blink) pointing at it = "CD READY...No CD is installed, or waiting for the reading of the TOC to complete"; Green 1 Red 0 = "CD READY...A CD is installed"; Green 1 Red 1 = "CD ACCESS"; Green blinking Red 0 = "STANDBY MODE". - "Power-on and a reset cause the hardware to set LEDG and LEDR to '0'." ### `$FF8002` Memory mode (p.22-25, PDF 29-32) [PDF] | Bit | Name | RD | WR | Meaning | | --- | --- | --- | --- | --- | | 15-8 | WP7-WP0 | 0/1 | 0 | read-only copy of the main side's write protect | | 7-5 | - | 0 | 0 | | | 4-3 | PM1-PM0 | 0/1 | 0/1 | priority mode | | 2 | MODE | 0/1 | 0/1 | "'0'=2Mmode '1'=1Mmode" | | 1 | DMNA | 0/1 | 0 | read-only here | | 0 | RET | 0/1 | 0/1 | | - **PM1-0** (p.23): 00 "MODE OFF (Default)", 01 "Underwrite mode", 10 "Overwrite mode", 11 "Prohibited". "When writing from the SUB-CPU into WORD-RAM in 1M mode ... the priority determines the write mode"; "In the 2M mode, only the rotation function can Overwrite and Underwrite data taken from the stamp map onto the image buffer." Off: "All of the data from the stamp map is written". Overwrite: "Non zero stamp map data overwrites data in the image buffer." Underwrite: "If the data stored in the image buffer is $0, the data from the stamp map is Underwritten". - **DMNA** "Declaration of Main ram No Access". 2M: "When the DMNA bit is set to '1', the 2M RAM is returned to the SUB-CPU"; read 0 "the 2M RAM has not yet been returned to the SUB-CPU", 1 "has been returned to the SUB-CPU". 1M: read 1 "the MAIN-CPU has made a swap request to the SUB-CPU", read 0 "the completion of swap"; and (p.23) "Setting the RET bit also causes the DMNA bit to be set to '1'" -- which reads as an error against p.24, "After the WORD-RAM has been switched, the DMNA bit returns to '0'", and against the p.9 (PDF 16) figure, "When the RET bit is changed ... DMNA=0", footnoted "However, when the MAIN-CPU sets the DMNA bit to '1', the DMNA is set to '1'." - **RET**, 2M: "when the RET bit is set to '1', the 2M RAM is returned to MAIN-CPU"; read 0 "not yet been returned to the MAIN-CPU", 1 "has been returned". 1M (p.24): "When the RET bit is set to '0', WORD-RAM 0 is returned to the MAIN-CPU and WORD-RAM 1 is returned to the SUB-CPU. When the RET bit is set to '1', WORD-RAM 0 is returned to the SUB-CPU and WORD-RAM 1 is returned to the MAIN-CPU." "In READ mode, the current RET bit setting can be read." - Handwritten corrections (p.24-25) replace the struck-out "WORD-RAM can be written only in the MAIN-CPU / SUB-CPU" with "Only the MAIN-CPU can set this bit" (DMNA) and "Only the SUB-CPU can set this bit" (RET), in both modes. - 2M state figure (p.25): DMNA,RET = 0,1 is "WORD-RAM MAIN-CPU"; 1,0 is "WORD-RAM SUB-CPU"; "Set the DMNA bit to '1'" moves down, "Set the RET bit to '1'" moves up. "After setting the DMNA or RET bits, verify that both the DMNA and RET bits have changed to the desired state. Then access the WORD-RAM." - "In the initial state of the system, the MAIN-CPU is given access to WORD-RAM in the 2M mode." (p.24; p.16: "When the power is turned ON, the WORD-RAM is attached here in this mode.") - **Sub CPU touching word RAM it does not own** (p.24 note): "If the SUB-CPU accesses the WORD-RAM when mode is 0 and RET is 1, the CPU becomes hang up and will not operate after the access. In this case the back-up state of the SUB-CPU can not be canceled unless a forced reset is done." ### `$FF8004` CDC mode / CDC register address (p.26-27, PDF 33-34) [PDF] | Bit | Name | RD | WR | Meaning | | --- | --- | --- | --- | --- | | 15 | EDT | 0/1 | 0 | End of Data Transfer | | 14 | DSR | 0/1 | 0 | Data Set Ready | | 13 | UBR | 0 (as printed) | 0 | Upper Byte Ready | | 10-8 | DD2-DD0 | 0/1 | 0/1 | Device Destination | | 3-0 | CA3-CA0 (shaded; names from the text, "CA" legible) | ? | ? | "CDC register address" | - UBR: "the high order data has been sent from the CDC. When the low order data is sent, the UBR is cleared." - DSR: "the CDC has sent the low order data"; cleared after the main CPU reads the data once, or the DMA transfers it once. For PCM DMA it sets per byte received and clears per byte sent; for words, per two bytes. - EDT: "all the data has been transferred from the CDC. This is reset when the device destination is set. When the data transfer from the CDC is complete, this is set. When the data transfer from the CDC starts again, this is reset." - DD2-0: 0, 1, 6 "Do not set"; 2 "MAIN-CPU READ"; 3 "SUB-CPU READ"; 4 "PCM sound source DMA"; 5 "PRG-RAM DMA"; 7 "SUB-CPU side 2M RAM DMA" (2M) / "SUB-CPU side 1M RAM DMA" (1M). "Only when attached to the SUB-CPU. When attached to the MAIN-CPU, DMA can not be done." - "For all resets except for Power-On, the DD2-DD0 hold previous values, but the circuit for transferring may sometimes be unsteady. Therefore, after a reset, set the register again." - "When data is written in DD2-DD0, the DMA circuit is reset (The DMA address is also reset.)." - p.62 (PDF 69), precaution 2: "In the CDC mode ($FF8004) register, all bits are set to '0' when they are initialized." ### `$FF8006` CDC register data (p.27, PDF 34) [PDF] Bits 15-8 read 0. Bits 7-0 shaded; the text names them CD0-7, "CDC register". "This register may not be accessed using commands such as BTST, BCLR, BSET, CLR, etc." ### `$FF8008` CDC host data (p.27, PDF 34) [PDF] Read-only, word access, HD15-HD00, same text as `$A12008`. "$FF8008 may be read when DSR, bit 15 of $FF8004, is 1." (The table on p.26 puts DSR at bit 14; "bit 15" here is the manual's own slip, or it counts EDT.) ### `$FF800A` CDC DMA address (p.27, PDF 34) [PDF] Write-only, word access. Bits 15-0 hold **A18-A3** (the address divided by 8). "For the PCM sound source, the limit is A12, and A13 to A18 are '0'. For WORD-RAM 0 (1M) and WORD-RAM 1 (1M), the limit is A16, and A17 and A18 are '0'. In the 2M mode, A18 is '0'. For the PRG-RAM, all can be used." ### `$FF800C` Stop watch (p.28, PDF 35) [PDF] Word access. Bits 11-0 SW11-SW00, read 0/1; bits 15-12 read 0. Every bit's WR row is "W0". "30.72 µs/count: Counting from 0 to 4095 is possible. Set to '0' to clear the counter. Upon overflow, the counter starts from '0' again." "W0: When writing, only write '0'. A write causes the counter to restart from '0'." ### `$FF800E` Communication flag (p.28, PDF 35) [PDF] Bits 15-8 CFM7-0: read, write 0 (read-only here). Bits 7-0 CFS7-0: read/write. "CFS0-7 ... a flag for communications from the SUB-CPU to the MAIN-CPU"; "CFM0-7 ... from the MAIN-CPU to the SUB-CPU." "Values written on lower bytes of the SUB-CPU appear on lower bytes of the MAIN-CPU." Race: "When both ... simultaneously Read and Write using the Communication flags, the write will execute normally, but the data resulting from the Read may sometimes include former data"; single-bit tests are safe. ### `$FF8010-$FF801E`, `$FF8020-$FF802E` (p.29, PDF 36) [PDF] Communication command 0-7: "Read Only". Communication status 0-7: "Read/Write". ### `$FF8030` Timer W/INT3 (p.30, PDF 37) [PDF] Bits 7-0 TD7-TD0 read/write; bits 15-8 read 0. - "30.72µs/count: Count down from n to 0 is started when 'n' is written. (0> 2) * (V * 4) + y * 4 + (xb & 3) ``` that is: cells are stacked in columns (cell 0 at the top left, cell 1 below it; p.18), a cell is 8 lines of 4 bytes, and a column of `V/8` cells takes `V * 4` bytes (`$400`, `$200`, `$100`, `$80`, `$80`). The inverse, for a cell address `C`: `xb = (C / (V*4)) * 4 + (C & 3)`, `y = (C % (V*4)) >> 2`. "The number of v-cells in a line is determined by a 1M address": 32 at `$220000`, 16 at `$230000`, 8 at `$238000`, 4 at `$23C000` and `$23E000`. The manual says the data is "converted and written into" the cell range; it does not say what a main-CPU *write* to `$220000-$23FFFF` does. ### 1M: the sub CPU's dot image and PM1-0 (p.1, 14, 23, 54; PDF 8, 21, 30, 61) [PDF] - "RAM in this mode contains VRAM images which have been converted into decode format. Data with 2 pixels per byte is accessed as if it had 1 pixel per byte. The upper 4 bits are set to 0 in Read mode and decoded in Write mode." (p.14) Normal format is `$0C0000-$0DFFFF`; decode format is `$080000-$0BFFFF` (p.1). - **Nibble order** (derived from the p.54 example): a word write of `$0507` to `$080000` makes `$0C0000` read `$57`. So dot-image byte `$080000 + 2n` is bits 7-4 of bank byte `n`, and `$080000 + 2n + 1` is bits 3-0. - **Priority example** (p.54): "$0C0000 contains the original data '0A', and $080000 contains the write data": | Write | Normal | Overwrite | Underwrite | | --- | --- | --- | --- | | `$0507` | `57` | `57` | `5A` | | `$0B00` | `B0` | `BA` | `BA` | "In the Overwrite mode, only the '0' portion of the new data is not overwritten onto the corresponding portion of the previous data. In the Underwrite mode, new data is written only to the '0' portion of the previous data." Per pixel: overwrite writes when the new pixel is non-zero; underwrite writes when the old pixel is zero. - "When the WORD-RAM is in the 2M mode, priority is applied to the data written to the image buffer by graphics operations. Therefore, when the CPU writes in the WORD-RAM, the WORD-RAM works as ordinary RAM." "When the WORD-RAM is in the 1M mode, priority is applied to the data written to a dot image area." ### VDP DMA from the CD's memory (p.61, PDF 68) [PDF] - 2M: "the WORD-RAM must be switched to the MAIN side at the time of DMA"; 1M: use the main side's bank. - "In the case where the VDP accesses the WORD-RAM by DMA, the data read from the WORD-RAM will be output with a one cycle delay". Solutions: "Set the source address to one word greater than the original address"; rewrite the top two words afterwards. p.63 is a sample routine. - "Never access the PRG-RAM from the MAIN-CPU" for DMA; do not run the DMA program from WORD-RAM (the following line, "Put the program in the WORD-RAM", contradicts it and is presumably a misprint for work RAM). ## 5. Answers by topic - **PRG-RAM write protect.** Unit `$200` bytes, range `$0-$1FDFF`, set by the main CPU in `$A12002` bits 15-8, readable by the sub CPU in `$FF8002` bits 15-8 (p.14, 24, 57). No statement on whether it also stops main-CPU or DMA writes. - **Backup RAM.** 8 KB, sub `$FE0000-$FE3FFF`, odd bytes, image through `$FEFFFF` (p.15); block diagram (p.iv, PDF 7) "8Kx8bit BACKUP RAM" with a battery. No format, no write-enable. - **HINT vector `$A12006`.** High word from the ROM's `$70`, low word from the register; word access only; `$FFFF` at power-on and "after a reset"; not touched by the forced reset (p.56, 58). **Mode 1: the manual does not say.** - **SBRQ / SRES.** Levels, with read-back as status: SRES write 0 = reset, 1 = run, read 0 = "reset in process", 1 = "RESET finished"; SBRQ write 1 = request, read 1 = "satisfied", read 0 = "SUB-CPU is operating" (p.56). Power-on `$A12000 = $0002` (p.21). Either SBRQ=1 or SRES=0 gives the main CPU the PRG-RAM (p.6, 16, 57). - **IFL2 / IEN2.** Bit 8 / bit 15 of `$A12000`; see section 2. IEN2 mirrors the sub CPU's mask. - **Timer `$FF8030`.** 8 bits, 30.72 µs a count, starts on write of n, INT3 at 0, period (n+1) x 30.72 µs, 0 disables, reads return the written value (p.30). - **Stopwatch `$FF800C` / `$A1200C`.** 12 bits, 30.72 µs a count, wraps 4095 to 0, free-running from about when the main CPU starts; the sub CPU may only write 0 and any write restarts it from 0; the main CPU can only read it (p.21, 28, 59). - **Interrupt levels and mask.** Section 3, `$FF8032`. - **Font registers.** Section 3; colour for a 0 bit is `$FF804C` bits 3-0, for a 1 bit bits 7-4; font bit 15 is the top nibble of `$FF8050`. - **Expansion-port pinout.** **Not in this manual.** No connector, no pin list, no mention of the 68000's RESET output or the VDP's /HL. (The only pin table is the RF5C164's, appendix p.3-5.) The contents list no such section; the missing p.4 is titled "Outline of Mega-CD hardware". - **Reset.** The manual never distinguishes the console's reset button from power-on by name. What it does say: (1) power-on values, section 1; (2) "Power-on and a reset cause the hardware to set LEDG and LEDR to '0'" (p.22); (3) RES0 written 0 resets "the periphery", reads 0 until about 100 ms later (p.3, 21, 22); (4) "For all resets except for Power-On, the DD2-DD0 hold previous values" (p.27); (5) "After a reset, $A12006 is set to -1" (p.58); (6) the forced-reset pattern initialises everything on the sub side -- refresh, timer, stopwatch, DMA, rotation, interrupts, CDD communication, sub-code, fader -- and none of the main-side registers (p.56-57); (7) a sub CPU hung on word RAM it does not own needs a forced reset (p.24). - **Clocks.** Main CPU "7.67MHz", sub CPU "12.5MHz" (p.1); block diagram (p.iv, rotated, small print): "XTAL 50MHz", "BOOT-ROM 1M bit", PRG-RAM "4M bit", two "1MbRAM (WORD-RAM 0/1)", "RF5C164 PCM" with "64Kx8bit" RAM and D/A "LC7881", CDC "LC8951" with "16Kx8" RAM, "D/A FADER LC7883". 30.72 µs = 384 / 12.5 MHz; graphics "1 clock = 80ns" = 1 / 12.5 MHz. **The drive's clock is not described.** ## 6. Differences from the Phase 0 notes (`start-here.md`, archived) ### Contradictions 1. **SRES is a level, not an edge.** start-here: "reset fires on the 0-to-1 transition" and "RESET bit is cleared and BUSREQ bit is set to 1 ... when both are asserted". Manual (p.56): write 0 = reset, 1 = run; read 0 = reset in process, 1 = finished. Nothing about an edge or the both-written read-back. To undocumented-behavior.md. 2. **DMNA in 2M reads 1 when the hand-over is complete, not while pending.** start-here: "DMNA reads 1 while a hand-over is pending". Manual (p.23, 57): read 0 = "in the process of returning", 1 = "Completion of the return of the 2M RAM to the SUB-CPU"; RET likewise reads 1 once the main CPU has it. (In **1M** mode DMNA=1 does mean "swap requested".) 3. **1M DMNA write polarity: the manual contradicts itself.** Sub chapter (p.24): set 1 to request a swap, 0 "has no significance". Main chapter (p.57): write 0 = "Swap request", 1 = "No significance". Needs a hardware answer. 4. **INT4 is tied to status 7, not to the 75 Hz tick as such.** start-here: "CDD (75 Hz status)". Manual (p.15, 30, 33): "When the reception of Receiving Status 7 is complete, INT4 will be generated." 5. **Sub-code buffer is 64 words, with an image.** start-here: "a 128-byte buffer at `$FF8100-$FF81FF`". Manual (p.55): `$FF8100-$FF817E` is the 64-word buffer, `$FF8180-$FF81FE` its image, and `$FF8068` holds the address and overrun flag (missing from start-here's table, whose range stops at `$FF8067`). 6. **PCM range.** start-here: `$FF0000-$FF7FFF`. Manual (p.15): `$FF0000-$FF3FFF`; `$FF4000-$FF7FFF` is an image that software must not use. 7. **Level 1 is 2M-only** in the manual (p.15, 20, 30); start-here does not qualify it. ### Additions - Power-on values and access widths for every register (section 1): `$A12000 = $0002`, `$A12002 = $0001`, `$FF8002 = $0001`, `$FF8036 = $0100`, `$A12006 = $FFFF`. - Word-only registers: `$A12006/08/0C`, `$FF8008/0A/0C`, `$FF8034`, `$FF805A/5E/62/64/66`. - `$A12000`: "only btst"; bset/bclr forbidden. - The forced-reset pattern (`$FF00` to `$A12002`, then `$03`, `$02`, `$00` to `$A12001`). - `$FF8000`: version in bits 7-4, LEDs in bits 9-8, RES0 reads 0 for about 100 ms. - `$FF8004`: UBR at bit 13; DD write resets the DMA circuit and address; DD survives every reset but power-on; DD values 0, 1, 6 "do not set". - `$FF800A`: holds A18-A3, with per-destination limits. - `$FF800C`: sub side is write-0-only and any write restarts the count. - `$FF8030`: period is (n+1) counts; reads return the latch, not the count. - `$FF8034`: EFDT busy flag at bit 15; volume in bits 14-4; DEF 01/10/11 = 44.1/32/48 kHz. - `$FF8036`: a fourth bit, D/M (data/music). - `$FF8058`: GRON at bit 15; `$FF8064` counts down during an operation. - Graphics clock: 80 ns, with a (partly illegible) duration formula. - VDP DMA from word RAM is one word late. - Main `$040000-$1FFFFF` is "reserved"; sub `$FE4000-$FEFFFF` is a backup-RAM image. - The communication-flag read race. ### Items the Phase 0 notes marked for the manual | Item | Manual's answer | | --- | --- | | WP unit ("sub CPU cannot write below `WP x $200`") | **Confirmed: `$200` units**, range `$0-$1FDFF` (p.14, 24, 57). The threshold reading is derived, not stated. | | `$A12006` has no effect in mode 1 | **The manual does not say.** | | Whether the drive's clock is a separate crystal; what clocks the CDD MCU | **The manual does not say** (block diagram shows only "XTAL 50MHz"). Section "Outline of Mega-CD hardware", p.4, is **missing from the scan**. | | Sub-code: 98 bytes into a buffer at `$FF8100`, INT6 | INT6 "When 98 byte buffering is completed" confirmed; buffer is 64 words plus image (above). R-W handling: the manual does not say. | | No dump of the CDD MCU's program ("to check") | The manual does not say; CDD registers are "prohibited" to applications and their table is unreadable. | | When a pending DMNA write takes effect | The manual does not say; it says only to poll both bits before touching word RAM (p.25). | | Mirrors (BIOS every 256 KB, word RAM to `$3FFFFF`, registers to `$A120FF`, sub map every 1 MB) | **The manual does not say**; it marks the unused ranges reserved or prohibited. | | Sub CPU waits on word RAM it does not own | Confirmed in effect: "the CPU becomes hang up", cleared only by a forced reset (p.24). | | Level-2 acknowledge clears IFL2 | The manual does not say; IFL2 reads 1 = "not treated yet", 0 = "in the process" (p.56). | | What RES0 resets | "Periphery reset"; **no list**. | | CD-DA byte order in CHD; model notes; RAM cartridge registers | Outside this manual. | ### Confirmed without change Bit positions of IFL2, IEN2, SBRQ, SRES, BK1-0, MODE, DMNA, RET; main EDT/DSR/DD; the 12-bit 30.72 µs stopwatch; the 8-bit 30.72 µs timer; communication flag, command and status directions; the six interrupt sources and their levels; the mask at `$FF8033`; PM1-0 overwrite/underwrite on the dot image; `$080000` / `$0C0000` in 1M; backup RAM on odd bytes at `$FE0000`; the two-bank word interleave in 2M; mode 1 / mode 2 swapping `$000000` and `$400000`; 7.67 MHz / 12.5 MHz / 50 MHz.