Switching visible VRAM page

By Daemos

Paragon (2044)

Daemos의 아바타

10-04-2011, 17:49

Quick and easy question.

It should be possible to switch between visible pages in the VRAM. So I should be able to display page 1,2 or 3 on screen right?

I have searched and searched but I just cannot find the info which register on the VDP controls that. How do I do this.

Login or 등록 to post comments

By Guillian

Prophet (3516)

Guillian의 아바타

10-04-2011, 19:39

Try this:

; A = VRAM page (0-3)
setPage:
	rrca
	rrca
	rrca
	or	%11111
	out	(#99),a
	ld	a,#82		; Pattern name table base address register
	out	(#99),a
	ret

By Daemos

Paragon (2044)

Daemos의 아바타

11-04-2011, 23:44

OK lets see if I understand this. I have to change the pattern name table base adress to make another page visible so if I for instance do this:

ld a,&h8000
out (&h99),a
ld a,82+128
out (&h99),a

It should switch to page 1 in this case, am I right?

By Guillian

Prophet (3516)

Guillian의 아바타

12-04-2011, 00:04

Not really. You can't put a 16 bit value into a 8 bit register Tongue
IIRC, correct values are #1f, #3f, #5f and #7f
So:
ld a,#7f ; Page 3
out (#99),a
ld a,#80 + 2
out (#99),a

By Daemos

Paragon (2044)

Daemos의 아바타

12-04-2011, 13:06

Ah silly me. I was thinking about this after I turned the computer off. And when I calculated the decimal value for #82 I came out at 128+2. And #8000 resulted into a higher number then 64K and I though. Ohw boy, please think before you ask silly questions...

Anyway. The #1F, #3F, etc values are unclear to me. Why these values? Is this because you search within the pattern name table which stores the page info for all pages?