It is currently Thu Dec 14, 2017 3:06 am

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Mon May 15, 2017 6:16 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19342
Location: NE Indiana, USA (NTSC)
Use ASCII, render the map to a buffer in main memory, and then DMA the map to VRAM.

While rendering the map to a buffer in main memory, you can interpret control characters such as newline and form feed. Thwaite, RHDE, the Action 53 menu, Haunted: Halloween '85, and The Curse of Possum Hollow all respond to the newline character (0x0A); some also do something special with form feed (0x0C).


Top
 Profile  
 
PostPosted: Mon May 15, 2017 6:26 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 818
Espozo wrote:
I thought I heard there was a way to skip every other byte when using DMA to upload data to VRAM. Is this true, and what do you have to do if so?

The top bit of VMAIN ($2115) tells the PPU whether to increment the word address on a write to VMDATAL or VMDATAH.

Normally you set it to 1 (increment on VMDATAH/$2119) and DMA in a word pattern to $2118-$2119. But if you set it to 0 and DMA single bytes to $2118, you can write to just the low byte of a region in VRAM, and if you set it to 1 and DMA single bytes to $2119, you can write to just the high byte.

This is useful for Mode 7, since the low byte is map data and the high byte is pixel data. You can load either map data or tiles separately, without having to interleave them in software and perhaps waste time overwriting something that doesn't need changing.

I've also used this to display the OAM on screen, by setting up character tiles from 00 to FF and simply dumping the contents of OAM (loaded into WRAM from $2138) directly into VRAM via $2118.


Top
 Profile  
 
PostPosted: Mon May 15, 2017 7:35 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1868
Location: DIGDUG
Quote:
The top bit of VMAIN ($2115) tells the PPU whether to increment the word address on a write to VMDATAL or VMDATAH.

Normally you set it to 1 (increment on VMDATAH/$2119) and DMA in a word pattern to $2118-$2119. But if you set it to 0 and DMA single bytes to $2118, you can write to just the low byte of a region in VRAM, and if you set it to 1 and DMA single bytes to $2119, you can write to just the high byte.

This is useful for Mode 7, since the low byte is map data and the high byte is pixel data. You can load either map data or tiles separately, without having to interleave them in software and perhaps waste time overwriting something that doesn't need changing.

I've also used this to display the OAM on screen, by setting up character tiles from 00 to FF and simply dumping the contents of OAM (loaded into WRAM from $2138) directly into VRAM via $2118.


Interesting. Is the source of the DMA an array of single bytes, or word sized.

That is to say. If I unpack compressed tiles, of just the low bytes, will I have to unpack it to a buffer of every other byte being filled?

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Mon May 15, 2017 7:54 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 818
As far as the DMA unit is concerned, data is 8-bit. MDMA source options are pretty barebones: a stream of consecutive bytes, a stream of consecutive bytes in reverse order, or the same byte over and over. You can't skip bytes. It's the combination of DMAPx and VMAIN settings - how the DMA unit writes to the B bus and how the PPU distributes the received data, respectively - that allows you to send the whole byte stream to just one of the 32 KB VRAM chips instead of alternating between them.

In short, no. You don't have to leave spaces in your WRAM buffer.

...your post kinda sounds like you're talking about using NES format for sprites, or something like that. What exactly is the use case here?


Top
 Profile  
 
PostPosted: Tue May 16, 2017 5:08 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1868
Location: DIGDUG
I found this today...

(source, MIT)

https://github.com/Optiroc/SuperFamiconv

(binary)

http://www.romhacking.net/utilities/1293/

It appears to convert a PNG image to a 'palette', 'tiles', or 'map' for SNES.

I have absolutely no idea how it works, but it may be useful.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Wed May 17, 2017 1:28 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 603
Yes, that was posted a page ago :P


Top
 Profile  
 
PostPosted: Thu May 18, 2017 11:04 am 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3153
Location: Nacogdoches, Texas
Well, this isn't very related to this, but how do you put BG3 in front of BG1 and BG2 in mode 1? It looks like setting bit $08 (so writing $09) on $2105 should do it, but I've had no success. I'm only referencing $2105 once outside of the initialization routine, so overwriting the register isn't the problem. Is there any other register that influences this?


Top
 Profile  
 
PostPosted: Thu May 18, 2017 11:29 am 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 818
You have to set the tile priority bit.


Top
 Profile  
 
PostPosted: Thu May 18, 2017 12:28 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3153
Location: Nacogdoches, Texas
For each entry on BG3's tilemap? :( (I have to manually go through it again if so.)


Top
 Profile  
 
PostPosted: Thu May 18, 2017 1:21 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 818
I'm afraid so. Priority 0 just ends up behind everything regardless.


Top
 Profile  
 
PostPosted: Thu May 18, 2017 1:40 pm 
Offline
User avatar

Joined: Mon Jan 23, 2006 7:47 am
Posts: 79
It can also still end up behind other layers if you put it on the subscreen.


Top
 Profile  
 
PostPosted: Thu May 18, 2017 3:11 pm 
Offline
User avatar

Joined: Tue Apr 05, 2016 5:25 pm
Posts: 159
The priority bit thing is likely so that you can have both a far BG and a HUD providing that the two never overlap the same vertical space.

_________________
SNES NTSC 2/1/3 1CHIP | serial number UN318588627


Top
 Profile  
 
PostPosted: Thu May 18, 2017 3:40 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1868
Location: DIGDUG
Quote:
It can also still end up behind other layers if you put it on the subscreen.


Ok, this is completely different from my understanding of main screen / sub screen.

Can someone else confirm this info? I thought main/sub was independent of priority layers.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Thu May 18, 2017 3:48 pm 
Offline

Joined: Sun Mar 27, 2016 7:56 pm
Posts: 138
dougeff wrote:
Can someone else confirm this info? I thought main/sub was independent of priority layers.

It is, but you can add the subscreen to just the backdrop layer of the main screen, and that gives the appearance of the subscreen being behind the layers on the main screen.


Top
 Profile  
 
PostPosted: Thu May 18, 2017 6:57 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3153
Location: Nacogdoches, Texas
What (I think) Nicole is talking about is most notably (only example I can think of) done in Donkey Kong Country 3, where they actually get BG3 to render between BG1 and BG2 in the canyon and factory level archetypes.

Anyway, the reason I wanted to know all of this information is that I made a rudimentary slideshow for my high school history class where we are supposed to give a summary of a person's life and determine whether or not they are a "hero or a zero". It's a bullshit end of the year project, and as such, my teacher was emphasizing creativity, with one example he showed us being a scrapbook someone made last year. I said screw that and decided to make this, which ended up being exponentially more work than I would have thought, and I never even ended up making the ability to display pictures in the slides, but there's so few words you can write in a 32x32 grid that pictures is all it would be anyway. The code is also really sloppy because I had to get this done in time.

I just realized that this is my first fully completed code of anything... Man, that's sad... :lol:

Attachment:
Slideshow.zip [1.07 MiB]
Downloaded 26 times

Oh yeah, what does the "Address Remapping" in $2115 (described here: https://wiki.superfamicom.org/snes/show/Registers) actually do? Their description really confused me. I'm asking because I had to use it sometimes and othertimes I didn't to get everything to display properly.


Last edited by Espozo on Thu May 18, 2017 8:13 pm, edited 1 time in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group