Chapter 2 of 7
Which RAM did I change?
X points to $3F0A. That address fits in sixteen bits, just like every other address the 6809 can put on its address bus. Yet this machine has 512 KB of RAM, enough for eight complete sets of sixteen-bit addresses. Find the particular byte you just wrote. The memory management unit (MMU) inside the CoCo 3’s GIME chip supplies the missing part of its address.
Translate one stopped address
Leave the processor at done from chapter 1. If you skipped ahead, run the scratch-byte exercise and Step once. Choose Inspector → MMU. Read the enabled/disabled indication, the selected task, and the row containing $3F0A.
The table has eight rows. Each covers $2000 bytes (8 KB) of CPU addresses. Task 0 and Task 1 are two sets of bank selections. In this Disk BASIC setup the MMU is enabled and task 0 is selected. The first row starts at $0000, so the row from $2000 to $3FFF is block 1. Its selected bank in this run is $39. Use the row for your own machine if it differs.
| Question | Calculation in hexadecimal | Answer |
|---|---|---|
| How far is the byte from the start of its CPU block? | $3F0A − $2000 | $1F0A |
| Where does physical bank $39 begin? | $39 × $2000 | $72000 |
| Which physical byte is that far into the bank? | $72000 + $1F0A | $73F0A |
Look at the two results side by side. The CPU supplied the offset $1F0A within an 8 KB block. The MMU chose the physical block underneath it. This translation requires no instruction in the program. The processor uses X as usual when executing the store.
Confirm the address from both sides
- Switch back to Memory and Mapped CPU. Enter 3F0A, choose Go, and read column 0A of row 3F00. After the store it reads 40.
- Switch the address space to Physical RAM, enter 73F0A and choose Go. Row 073F00, column 0A also reads 40. The physical display may pad the address with a leading zero.
- To test the connection, Continue to BASIC, keep the source stop on store, and Run the assembly again. The binary reloads sample as zero. At the stop read the same two addresses. They both read 00. Step once and both read 40. One guest store accounts for both changes.
- Continue. The program executes its return. Click the CoCo display, type
PRINT 27and press Return. BASIC should print 27 and its OK prompt.
Two unrelated RAM cells can happen to contain $40. What makes this a good diagnosis is that the active MMU row predicts the second address, and both views follow the transition from the assembled zero to the stored value. To see the same CPU address pick up an entirely different byte, follow Borrow block 2 in Book 9. That exercise deliberately changes one bank selection and restores it afterward.
Try this translation with a running OS-9 process in One address, two views.
Read the exceptions at the top of the map
Before using the same calculation elsewhere, read Effective read and RAM backing in the MMU table. They answer different questions. The scratch byte in this lab was in ordinary RAM. Other CPU addresses have other jobs.
| What the inspector shows | What you can conclude |
|---|---|
| A RAM bank for the active mapping | The bank and offset locate the physical byte, as they did for sample. |
| A ROM overlay | CPU code can read ROM at that address while RAM exists underneath. The RAM backing button inspects the physical RAM. Its contents can differ from the mapped view. |
| The note for $FE00–$FEFF | The RAM-vector setting decides whether this range follows the final bank or uses fixed RAM. Read the current setting before translating here. |
| Device I/O in $FF00–$FFEF | An address can select hardware. The inspector displays a dash where it cannot safely supply a value. A dash does not mean the device returned zero. |
| System vectors in $FFF0–$FFFF | The CPU reads vector bytes here to find destinations. Read the inspector’s system-ROM note when following one. |
If the MMU is disabled, the inspector’s Effective read column reports the fixed mapping. A number in an inactive task column describes what was programmed there; on its own it cannot tell you what a CPU read will see. This distinction also matters to breakpoints. The ordinary instruction breakpoint accepts a CPU address such as 3F07. The much larger number 73F0A identifies a byte in installed RAM.
For the circuitry behind the table, see Tandy Corporation, Color Computer 3 Service Manual, section V, figure 5-7, “MMU Block Diagram.” Follow the CPU block selection on one side of that figure and the bank selection on the other.