VRAM: Byte address or word address?

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply

Do you think of VRAM in terms of...

Byte address
3
21%
Word address
11
79%
 
Total votes: 14

User avatar
HihiDanni
Posts: 186
Joined: Tue Apr 05, 2016 5:25 pm

VRAM: Byte address or word address?

Post by HihiDanni »

So right now I'm working on a few example programs for the first release of my framework. It has some imperfections here and there, but one bit that really bothers me right now is the style of VRAM address. The macros I'm using for load-time VRAM transfers use word addresses, and so do the VRAM address registers of course. However, bsnes-plus and the constants I wrote for deciding VRAM address use byte addresses. Somewhere I'm going to need to make both the macro and the constants use the same style of address.

Currently I'm leaning toward word address but I'd like to hear what others think.
SNES NTSC 2/1/3 1CHIP | serial number UN318588627
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: VRAM: Byte address or word address?

Post by psycopathicteen »

Wow, a unanimous majority voted for word address!
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: VRAM: Byte address or word address?

Post by zzo38 »

psycopathicteen wrote:Wow, a unanimous majority voted for word address!
There isn't enough votes yet for that.
(Free Hero Mesh - FOSS puzzle game engine)
User avatar
HihiDanni
Posts: 186
Joined: Tue Apr 05, 2016 5:25 pm

Re: VRAM: Byte address or word address?

Post by HihiDanni »

Hmm, 9 to 1. Well, that was easy enough. Thanks everyone!
SNES NTSC 2/1/3 1CHIP | serial number UN318588627
Optiroc
Posts: 129
Joined: Thu Feb 07, 2013 1:15 am
Location: Sweden

Re: VRAM: Byte address or word address?

Post by Optiroc »

Except for the (damning!) fact that the VRAM data port register use word addressing, I see little reason to think about addresses in VRAM as word[n], when I think of any other address ever as byte[n].
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VRAM: Byte address or word address?

Post by lidnariq »

Ignoring mode 7, everything else in the S-PPU works with 16-bit words: both RAMs have the same address.

It made things a lot easier for me (who is, admittedly, coming to this from the point of view of an EE) when I realized not only how the various offset registers in the S-PPU could literally be mapped to address pins on the RAM, but how they were almost all nicely aligned within:

$2101: [...aaBBB] where BBB is literally PPU RAM A15, A14, A13
$2107(8,9,a): [CCCCCC..] and CCCCCC is literally PPU RAM A15, A14, A13, A12, A11, A10
$210b(c): [DDDDEEEE] and both DDDD and EEEE are literally PPU RAM A15, A14, A13, A12

$2107/8/9/a are conveniently aligned to a multiple of 256; you can literally throw away the lower byte (and mask two bits out of the upper byte) and use it, if you're starting with word addresses.
both $210b/c are half nice (the upper nybble is again conveniently aligned) but the lower nybble requires more massaging.

If not for the repeatedly present and unconnected PPU RAM A15, the distinction wouldn't have clicked so strongly for me.
Post Reply