CoCo 3 RAM addressing. The GIME chip can access 512K of memory, yet the 6809 can only access 64K. The barrier is broken by a MMU (Memory Management Unit) which splits the access into 8 blocks of 8K each. These blocks are accessed through the registers FFA0-FFA7. They represent the following address areas: FFA0 = $0000-$1FFF this is the 32K of basic RAM FFA1 = $2000-$2FFF FFA2 = $4000-$5FFF FFA3 = $6000-$7FFF FFA4 = $8000-$9FFF <- this page is Extended Color Basic FFA5 = $A000-$BFFF <- this page is Color Basic FFA6 = $C000-$DFFF <- this page is Disk Extended Color Basic FFA7 = $E000-$FFFF <- this page is "Super" Basic & hardware I/O In each page there can be a six bit value xx000000 to xx111111 or hex $00 to $3F. Each of these 64 values accesses a distinct area of memory. the pages are numbered as so Hex Value Page Contents ---------------------------!-------------------------------------------------- $00-$2F $00000 - $5FFFF 512K upgrade RAM $30 Hi-Res page #1 $60000-$61FFF $31 Hi-Res page #2 $62000-$63FFF $32 Hi-Res page #3 $64000-$65FFF $33 Hi-Res page #4 $66000-$67FFF $34 HGET/HPUT buffer $68000-$69FFF $35 Secondary Stack $6A000-$6BFFF $36 Hi-Res text screen RAM $6C000-$6DFFF $37 unused $6E000-$6FFFF $38 Basic memory $0000-$1FFF $70000-$71FFF $39 Basic memory $2000-$3FFF $72000-$73FFF $3A Basic memory $4000-$5FFF $74000-$75FFF $3B Basic memory $6000-$7FFF $76000-$77FFF $3C Extended Basic Interpreter $78000-$79FFF $3D Color Basic Interpreter $7A000-$7BFFF $3E Disk Basic Interpreter $7C000-$7DFFF $3F Super Basic, GIME regs, I/O, Interrupts $7E000-$7FFFF So, if you wanted to set memory location $60000 to $00, you could: ORCC #$50 SEE NOTE 1 LDA $FFA1 GET THE PAGE FOR THE RESTORE PSHS A SAVE THE PAGE FOR LATER LDA #$30 ACCESS TO PAGE $30 STA $FFA1 PAGE $60000-$61FFF IN LOACTIONS $2000-$3FFF LDA #$00 THE BYTE IS 0 STA $2000 SET THE PROPER BYTE PULS A RESTORE THE PAGE STA $FFA1 AND ACCESS TO IT RTS RETURN FROM CALLER Note 1- ALWAYS shut off interrupts during extended RAM access! If you change a page that has an interrupt handler in it, and an interrupt occurs, you will crash the computer! Also note that if you do a load off of one of the registerrs the current page will be read. This technique can also be used in clearing the hi res text screen. ORCC #$50 LDA $FFA1 PSHS A LDA #$76 STA $FFA1 LDX #$2000 START OF THE PAGE LDD #$2000 A CLEAR SPACE (32=BLANK SPACE WITH 00 ATTRIBUTE BYTE) CR STD ,X++ CMPX #$2000+(2*80*24) 2BYTES*80CHARS*24ROWS! BNE CR PULS A STA $FFA1 RESTORE RTS this will clear out the text screen. Note 2- If you are using the stack, BE SURE NEVER to page over the stack! therefore, KNOW WHERE THE STACK IS! In basic, it will be in the $6000-$7FFF page. If there's a CLEAR xxx,mmmm the stack is at location mmmm and those lower. Hi-Res screen notes- the screen is arranged in this format for each 16 bit character: CACACACACACACACA CACACACACACACACA CACACACACACACACA where C is the ASCII code byte, and A is the attribute byte. the attribute byte looks like this: bit 7 flash (1=flash) 6 underline (1=underline) 5 \ 4 - three foreground color bits 3 / (palettes 8-15) 2 \ 1 - three background color bits 0 / (palettes 0-7) ------------------------------------------------------------------------------- End Part 1