Register 2 VRAM Location Question

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
Okie
Interested
Posts: 37
Joined: Wed Jun 30, 2021 7:31 pm
Location: United States Of America

Register 2 VRAM Location Question

Post by Okie » Sun Jul 04, 2021 11:13 pm

http://md.railgun.works/index.php?title=VDP states about the bit 3 4 5 of the the VDP Register:
SA15-SA13 defines the upper three bits of the VRAM location of Plane A's nametable. This value is effectively the address divided by $400; however, the low three bits are ignored, so the Plane A nametable has to be located at a VRAM address that's a multiple of $2000. For example, if the Plane A nametable was to be located at $C000 in VRAM, it would be divided by $400, which results in $30, the proper value for this register.

Couple questions

First :

$c000 in Binary is 1100 0000 000 0000

$30 in binary is 0011 0000

Is it a coincidence that the 13-15 bit of $c000 and the 3-5 bit in 30 are both 110. This identical number seems to occur with other addresses like $d000.

Second:
Can you please explain when they say “however the low three bits are ignored , so the plane A Nametable has to be located at a vram address that’s a multiple of $2000”

What does this mean about the three bottom bits are ignored ? Are they referring to the actually address $c000 ? And why does it cause you to have to divide by $2000

Third:

A question on setting registers . The top bits must be 1 and 0 . I see hex 8 is the first nyble often to set registers but what if we are using register 17 then in binary that’s 10010001 where the first two bits are 1 and 0 so in hex it is 91 so the 8 is a 9 ? Maybe I misunderstand where the placent of the register number is . I’m probably just thinking stupidly :)

pitcrawler
Newbie
Posts: 6
Joined: Mon Jul 24, 2017 8:24 pm

Re: Register 2 VRAM Location Question

Post by pitcrawler » Tue Jul 06, 2021 4:24 pm

The Plane A nametable location is a 16 bit value. Register 02 is an 8 bit register and bit 5 of this register is the top bit of the nametable location, meaning it will turn into bit 15. So in other words it has to be shifted left by 10 bits. Shifting anything left by 10 bits divides it by $400.

You can only set bits 3-5 in the register, meaning it will always be a multiple of 8 between 8 and 56.

8 << 10 = $2000
16 << 10 = $4000
24 << 10 = $6000
etc...

Okie
Interested
Posts: 37
Joined: Wed Jun 30, 2021 7:31 pm
Location: United States Of America

Re: Register 2 VRAM Location Question

Post by Okie » Sun Jul 11, 2021 1:01 am

Thank you pitcrawler; it took me some time to wrap my brain around bit shifting and it’s relation to multiplication and division and why it has to be divisible by $2000. This definitely helped.

Post Reply