[Coco] Help with some HiRes CoCo 3 MMU settings

Robert Gault robert.gault at att.net
Wed Dec 7 10:02:29 EST 2016


Glen Hewlett wrote:
> Hi All,
>
> I’ve been fighting for days trying to figure out why the program I’ve written is crashing.  I think it’s the MMU doing some bank switching in the background while my program is running.
>
> My program disables all the interrupts the sets up the graphic mode in my case a 256x225 2 colour screen.  I’m trying to use blocks 0 ($0000 to $1fff) and block 1 ($2000 to $3fff) for my graphics output screen and variables.  My program code is running at $4000 and the stack is at $7FFF.
>
> While testing my program with the MAME emulator in debug mode, my program shows some graphics on the screen and runs along for a about 10 seconds then blamo, it crashes.  As far as I can tell the bank memory is coming into play somehow.  With Mame’s debugger I can see the banks of memory have wiped out my graphics screen and my program and filled it all with a bunch of $CD values in my RAM.  Does this sound familiar to anyone maybe you know what I’m missing or doing wrong that would cause such a thing to happen.
>
> I looked all over the internet to see if anyone has some example code for  setting up graphics modes and the MMU in assembly.  All I’ve been able to find is tons and tons of technical manuals that do a great job of explaining what all the values do, but there aren’t any real world examples that I could find.  If someone has some nice code that they want to share that would be awesome…
>
> Below is the initializing code that I’ve written and plan to use over and over for future programs.
>
> Thanks for looking,
> Glen
>

Glen,

There are several things that likely are not right.

1) As already mentioned, you did not set the Task register but rather sent a 
second value to $FF90. The value sent would have caused the Task register to use 
a 279nsec clock and not Task#1. Should be %00000001

2) Your comments and values do not match.
* Load GIME pages $30 & $31 into CPU RAM $0000-$1FFF & $2000-$4000
         LDA     #$38                    * Start at Hi-Res page #1
	STA	$FFA0
	LDA	#$39
	STA	$FFA1

With these changes, MESS does not crash.

Robert



More information about the Coco mailing list