Hex values for VDP registers...

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

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
Count SymphoniC
Very interested
Posts: 149
Joined: Sat Nov 17, 2012 3:58 am

Hex values for VDP registers...

Post by Count SymphoniC » Mon Sep 22, 2014 5:51 pm

I have a general question about the usage of VDP registers.

Where do I find more information about the hex values? Are they in the Sega Manual? For example, move.w #$80xx,($C00004) for register 0... I'm curious about the 80 part of the hex value. I found in the YaVDP the hex values all the way up to register 15 which is #$8F. But that's the end of the document and there's more registers after that. Would register 16 for setting scroll size be #$90? Just need clarity here. I already understand how to setup all the bits for the instructions to the data + control ports, thanks to the vdp calculators I found.

Thanks again for the help. I have my first screen layout on Plane A loaded using a nametable, and it's skewed beyond the boundaries of the screen. I figured either I set the scroll size, or I do some code that resets the x coord back to 0 and y down to the next line once the drawing routine reaches the rightmost part of the visible display area. Either way, I would like to understand register 16 and up better.

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Post by tryphon » Mon Sep 22, 2014 6:25 pm

I think someone mentionned Charles McDonald's genvdp guide. Everything's clear there :
Programming VDP registers
-------------------------

Any one of the 23 VDP registers can be programmed by writing 16 bits of
data to the control port. The data written has the following format:

1 0 ? R04 R03 R02 R01 R00 (D15-D8)
D07 D06 D05 D04 D03 D02 D01 D00 (D7-D0)

Rxx = VDP register select (00-1F)
Dxx = VDP register data (00-FF)

Writing to non-existant VDP registers has no effect.

Bits 15 and 14 must be set to 1 and 0 respectively, otherwise the write
will be treated as the first half of a command word. The state of bit 13
does not matter.

Here's an example of programming one register:

; Set border color to palette $3, index $F
move.w #$873F, $00C00004

Since the 68000 treats 32-bit memory access as two 16-bit operations,
you can program two registers at once:

; Set split point bits for both window registers
move.w #$91809280, $00C00004

Count SymphoniC
Very interested
Posts: 149
Joined: Sat Nov 17, 2012 3:58 am

Post by Count SymphoniC » Mon Sep 22, 2014 6:55 pm

Haha thanks. I have this document but I didn't fully understand that setting the r0-r4 bits as well as the first two bits being 1 and 0 is the way to get the value I'm looking for. I get it now. Thanks again, that was really confusing at first. Working with binary is still a bit awkward for me.

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Post by tryphon » Mon Sep 22, 2014 9:20 pm

You're welcome. FWIW, from all the examples (commercial games such as Phantasy Star II & III, Psy-O-Blade, Tetris, Shadow Dancer), bit 13 was 0.

BigEvilCorporation
Very interested
Posts: 209
Joined: Sat Sep 08, 2012 10:41 am
Contact:

Post by BigEvilCorporation » Tue Sep 23, 2014 8:46 am

The VDP register calculator from here is my new best friend: http://www.pascalorama.com/article.php?news=28&cat=21
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Post by tryphon » Tue Sep 23, 2014 9:28 am

Nox it's mine too :)

Post Reply