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 - SMs coding Stuff

Reply to topic
Author Message
PolestaR
  • Guest
Reply with quote
SMs coding Stuff
Post Posted: Wed Feb 28, 2001 4:16 am
I was just reading heliophobes source code to one of his programs and something I read triggered something in my brain. I remember reading the old docs like Jons and remember James McKay saying to only write to vram addresses >0x4000 to <0x7fff . In helio's source he says that he sets the addresses to 0x4000 to start writing and clears vram till 0x7fff. What im thinking is maybe that you arent really writing to addresses 0x4000-0x7fff, just you have to set bit 15 to write to vram, and you have to clear it to read from vram. IF anyone can point out some obvious thing I am missing out then please do so, I just thought it was an interesting little thing ;).
 
  • Site Admin
  • Joined: 25 Oct 1999
  • Posts: 2029
  • Location: Monterey, California
Reply with quote
Post Posted: Wed Feb 28, 2001 4:37 am
Quote
> I was just reading heliophobes source code to one of his programs and something I read triggered something in my brain. I remember reading the old docs like Jons and remember James McKay saying to only write to vram addresses >0x4000 to <0x7fff . In helio's source he says that he sets the addresses to 0x4000 to start writing and clears vram till 0x7fff. What im thinking is maybe that you arent really writing to addresses 0x4000-0x7fff, just you have to set bit 15 to write to vram, and you have to clear it to read from vram. IF anyone can point out some obvious thing I am missing out then please do so, I just thought it was an interesting little thing ;).

Yeah, it's better explain in Charles somethingorother's VDP doc, but:

There's 16k of VRAM. Thus, it's a 14-bit addressable space. When sending bytes to the VDP address port ($bf), the top two bits of the two-byte sequence sent to it have the following meaning:

00 - Set the VDP to address specified in the other 14 bits, in read mode.
01 - Set the VDP to address specified in the other 14 bits, in write mode.
10 - Write to a VDP register: the first 8 bits sent are the value to write, bits 8-11 are the VDP register #. (bits 12 and 13 are probably ignored, but I don't know this for certain).
11 - Set the VDP to write the the palette registers (not really part of video ram). bits 0-4 select which palette to write to, the other bits are probably masked (ignored). There's no way to read the palette registers (so I've heard).

You could just as well look at it that $0-$3fff and $4000-$7fff are mirrors to eachother, one in read mode and one in write, but the above explaination more accurately reflects the actual behavior of the VDP.
I guess.
  View user's profile Send private message Visit poster's website
PolestaR
  • Guest
Reply with quote
Post Posted: Wed Feb 28, 2001 5:41 am
Yah i know the stuff abuot the command bits in the second byte from Charles doc. What do you think happens when a read is requested when its 01, and a write when its 00? Do you think they are ignored or do you not know? Just curious is all ;).
-Jason Starr-
 
  • Joined: 21 Apr 2000
  • Posts: 598
  • Location: Newcastle upon Tyne, England
Reply with quote
Post Posted: Wed Feb 28, 2001 7:17 am
Quote
> Yah i know the stuff abuot the command bits in the second byte from Charles doc. What do you think happens when a read is requested when its 01, and a write when its 00? Do you think they are ignored or do you not know? Just curious is all ;).


I think this comes back to what was said in one of the docs (Jon's?) about throwing away the first byte read (which you'd need to do if reading in write mode, as the data in the latch will be invalid). Setting read mode supposedly has the effect of automatically loading the latch with the byte from the address specified and incrementing the address counter, or something like that (from the 9918 doc).

So it should be possible to do reads in "write" mode and vice versa; how you set the control bits just affects the initial behaviour. Perhaps you could use this to do both read and write operations on contiguous sections of VRAM, without needing to change the control bits. Maybe.

Mike
  View user's profile Send private message Visit poster's website
PolestaR
  • Guest
Reply with quote
Post Posted: Wed Feb 28, 2001 7:23 am
Why did James McKay implecitly tell Zoop and SMSC to only write to $4000 - $7FFF then? Just curious as he seems adamant about that. And if it was possible to write with command bits being 00, why does he say not to? Weird hey :)
-Jason Starr-
 
  • Joined: 14 Aug 2000
  • Posts: 742
  • Location: Adelaide, Australia
Reply with quote
Re: VDP command bits
Post Posted: Fri Mar 02, 2001 4:49 am
i think JM is right, after all the Z80 accesses VRAM through the VDP. the command bit in question tells the VDP whether to (1) transfer the data from the CPU interface latches to VRAM on the next free memory cycle or (2) transfer data from VRAM to the CPU interface latches. All the CPU does is write to or read the latches, nothing more.

...it makes sense to me anyways.

a s out.
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!