[Coco] ML Question: MMU Block Switching

William Mikrut wmikrut72 at gmail.com
Tue Feb 17 21:06:02 EST 2015


I figured that out.. I was toying around with $FF9D/E in 80 col mode.
Increment/Decremented offsets of $20 pushed the screen one line
backward/forward.

Perhaps it's best if I show what I have been working to accomplish.

It's probably not the most efficiently coded... and not the most
spectacular code.
What I wanted to do was create an overlay for the screen -- and manipulate
the text inside the box and below the box in the Hires text mode.

What I previously been doing was loading page 36, writing text, restoring
page 39.
It became tedious to constantly be swapping in pages every time I wanted to
manipulate hires text.

So what I learned is that if I relocate the stack (not a requirement but
will help), I can map page 36 and leave it for the duration of my program.
Provided I don't spill into $2000 --- then I would pick a higher block to
map the Hires text screen to.

Of course I know position independent is out the window atm... but I'll
attack that beast later.

3,584 bytes is more than enough for what I am working on right now.




On Tue, Feb 17, 2015 at 7:37 PM, Robert Gault <robert.gault at att.net> wrote:

> William Mikrut wrote:
>
>> Thank you Robert.
>>
>> I am playing around with this some more tonight an I want to go into the
>> unraveled document and look at how LPOKE specifically sets registers for
>> execution.
>>
>> If i interpret what you are saying, FF9D/E just remaps vidram to a
>> different starting address in high ram.
>>
>> I still need to load the MMU with that page to read/write data to that
>> location... but could easily offset the default of 6C000 with the example
>> you listed above.... or to any place in High ram as long as the MMU was in
>> sync with the address block I selected.
>>
>> Sorry if I am such a noob at this, but I have wanted to learn these things
>> for a LONG, long time.
>>
>>
>>
> The video pointer and MMU registers are completely independent. The only
> time you need to change an MMU register is when you want to read/write to
> memory in a specific MMU block.
> Put another way, video will be displayed (hi-res Coco3) where $FF9D/E
> point regardless of the MMU values.
>
>
> Robert
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>
-------------- next part --------------
	org	$1200
	
begin	jmp	start
	fdb	done-begin
	
start	nop
	ldx	#stack+200	Relocate the stack
	tfr	x,s
		
	jsr	$f679   Switch to 80 col mode ($f65c 40 Col)
	ldd	#$0132	Load colors
	sta	$ffb0	Background
	stb	$ffb8	Foreground
	lda	#3	Load border Color
	sta	$ff9a	Set border color
	
	orcc	#$50	Interrupts Off
	lda	$ffa1	Save current page
	anda	#63	
	pshs	a	Save a
	lda	#$36	Map in Hi-res Text
	sta	$ffa1	Tell the MMU
	andcc	#$af	Restore Interrupts
	
wrthd0	ldx	#$2000	Point to start of hires test
	ldd	#$000a	
	ldy	#hbox	
wrthd1	lda	,y+
	cmpa	#$0d
	beq	wrthdx
	sta	,x++
	jmp	wrthd1
wrthdx	nop


	nop		Can do lots more stuff here

wait	jsr	[$a000]
	beq	wait
	
	orcc	#$50	Interrupts Off
	puls	a
	sta	$ffa1
	andcc	#$af
	
done	rts

hbox	fcc	'*-CoCo-Head--------------------------------------------------------------------*'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                Welcome to my test                            |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'|                                                                              |'
	fcc	'*------------------------------------------------------------------------------*'
	fcb	$0d
stack	rmb	200
	end


More information about the Coco mailing list