Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Vdp ram

Reply to topic
Author Message
Etienne Baudin
  • Guest
Reply with quote
Vdp ram
Post Posted: Fri Mar 09, 2001 4:43 pm
Look at the Document

#############################################################
0000h-1FFFh The first 256 characters can be read from here.
2FFFh-37FFh The last 192 character definations read from here.
3800h-3DFFh Screen memory, can read from here to find out what
character is in what location on the screen.

3E00h-3EFFh Alternate read area for the sprite table?
3F00h-3F3Fh Read area for the sprite table, contains the 64 sprite Y coordinates.

3F80h-3F7Fh 64 unused bytes, read as you will.
3F80h-3FFFh 64 (sprite X coord, sprite character) pairs can be
read from here.

4000h-5FFFh The first 256 characters should be written here.
6000h-77FFh The last 192 character definations written here.
7800h-7DFFh Screen memory, writing here is how you display the different characters on the screen. Explained more later.

7E00h-7EFFh Alternate area for spirte tables? Well anyway using
one of the registers you can point the sprite table here, could be used for some quick screen changes.

7F00h-7F3Fh Start of the default sprite table. 64 sprite Y coordinates.

7F80h-7F7Fh 64 Unused bytes. Take as you will.
7F80h-7FFFh 64 (sprite X coord, sprite character) pairs.
##########################################################

So, if I want to write at the 1rst tile location I must use adress 0x4000, but when reading 0x0000 ? Why 2 differents address ?

And I this document is all right, the 256th (0x2FFF) tile isn't just after 255 (0x1FFF), error ? (while reading).
Thanks
Etienne Baudin
 
  • Joined: 18 Sep 1999
  • Posts: 498
  • Location: Portland, Oregon USA
Reply with quote
Post Posted: Fri Mar 09, 2001 5:20 pm
Quote
> So, if I want to write at the 1rst tile location I must use adress 0x4000, but when reading 0x0000 ? Why 2 differents address ?

It's not really two different addresses. The most-significant two bits of the 16-bit word are command-bits. Please see Charles Mac Donald's VDP document.

Quote
> And I this document is all right, the 256th (0x2FFF) tile isn't just after 255 (0x1FFF), error ? (while reading).

That's an error. It should read 0x2000, not 0x2FFF --> 2000h-37FFh The last 192 character definations read from here.

--
Eric Quinn
  View user's profile Send private message Visit poster's website
Heliohpoe
  • Guest
Reply with quote
Post Posted: Fri Mar 09, 2001 5:22 pm

Quote
> So, if I want to write at the 1rst tile location I must use adress 0x4000, but when reading 0x0000 ? Why 2 differents address ?

This Thread explains a lot about that.
In essence, you can just think of the 16kb of VRAM as a flat 14 bit address. The high two bits aren't part of the address (hence $4000 and $0000 refer to the same address in VRAM), rather they're 'command bits' which determine the meaning of the other 14 bits.

if the top two bits are :
00, then the VDP address is sent to the value of the other fourteen bits, in read mode.
01, then the VDP address is sent to the value of the other fourteen bits, in write mode.
10, then the VDP register specified by bits 8-11 are set to the value in bits 0-7
11, then the VDP is set to write to palette RAM, with bits 0-4 specifying which palette entry to start writing to.

This is correct -enough- for writing SMS stuff, but in fact you -can- read in write mode and write in read mode -there are issues with the first byte read or written not being valid or whatnot. Since I just write SMS software I've happily dodged the issue so far but with something else I've been working on I'll probably need to investigate more closely, since some games address VRAM in different ways.


Quote
> And I this document is all right, the 256th (0x2FFF) tile isn't just after 255 (0x1FFF), error ? (while reading).

You could just say there are 512 possible tiles (32 bytes per tile tiles 512 tiles = 16,384 bytes, which is exactly how much VRAM the SMS has), however, you can't fill 512 tiles with tile definitions because the name table and sprite table also take up some space (1536 bytes and 192 bytes, respectively).

However, since there is only one byte used to specify the sprite indexes, you can only select 0-255. So you must choose (through a VDP register) whether you want the sprite indexes in the sprite table to refer to sprites 0-255 or 256-512 (generally the name table and sprite table are in the upper area which gives you fewer tiles available for sprites). So thatbit in a VDP REgister acts as 'bit 8' for all sprite indexes.

That's why some docs break down the VRAM in that way.
 
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Heflioofloob
Post Posted: Fri Mar 09, 2001 7:16 pm
er, yeah.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!