[Coco] Coco 3, Expanded Memory and Assembler

Joel Ewy jcewy at swbell.net
Mon Feb 25 21:03:13 EST 2008


Charles Shrader wrote:
> Greetings all!
>
> I'm still toying around with 6809 Assembler on the Coco and have written
> a few basic programs to accept user input and repeat it to the screen.
> I'm toying with the idea of writing a text adventure completely in
> assembler but that's still in the "dream" stage.
>
> If the 6809 can only access 65,535 memory locations, how would one
> access the additional RAM on a Coco3 that has 512k RAM memory?  On my 8
> bit Commodores I believe this is done using something called "banking".
> Is there a similar methodology for the Coco?
>
>   
Yes, indeed.  The CoCo's GIME chip has a memory management unit that
maps 8K blocks into the 6x09's 64K address space.  There are two sets of
8 6-bit write-only registers, from FFA0 to FFAF that select which 8K
blocks are used.  You can switch between the two sets by writing a 0
(FFA0-FFA7) or a 1 (FFA8-FFAF) into the low order bit of FF91.  This way
you can quickly switch between two 'tasks' with different MMU
assignments if you wish.  The blocks are numbered in sort of an odd way,
if you ask me.  A 128K CoCo 3 has blocks $30-$3F.  BASIC maps them such
that $38-$3F go from $0000-$FFFF normally.  Blocks $30-$33 are used by
BASIC's super-high-res (HSCREEN) graphics screens.  BASIC uses block $34
for its GET/PUT buffers, and the high-res text screen consumes $36. 
Some source I've seen lists $35 as "secondary stack" but fails to
mention what that's for.  So in a 128K CoCo 3 the only truly
unencumbered 8K block outside of the ones normally allocated to BASIC is
$37.  Of course, if you are writing your own assembly language programs,
and they don't have to interact with BASIC, you have more lattitude.  In
a 512K CoCo 3 you also get blocks $00-$2F to play with.

So, basically, you just write the block number you want into FFA0-FFA7
(or FFA8-FFAF and then put a 1 in FF91, bit 0) and you've mapped a fresh
8K block into the memory range assigned to that register.  Probably a
bit more flexible than the bank switching you might be accustomed to on
other 8-bit micros.
> For some reason I find assembler delightfully enjoyable to write for the
> Coco.  I don't recall similar programming for the 6502 or the Z-80 chips
> being nearly as fun.  
The 6809 has a reputation for being pleasant to program.

JCE
> Especially the Z-80; it seemed to be cantankerous
> when trying to run compiled programs on disks that are accessed on
> drives other than the current drive.  Or it could just be that CP/M is
> cantankerous.  Or maybe it's the programmer.  ;-)
>
> I really enjoy being part of and reading your posts to this list.  Being
> fairly new to the Coco crowd, it's been a great experience thus far.
>
> Chuck
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition. 
> Version: 7.5.516 / Virus Database: 269.21.1/1298 - Release Date:
> 2/25/2008 8:45 PM
>  
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
>   




More information about the Coco mailing list