Hmm, next batch of questions...

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
Bobbias2.0
Rookie
Posts: 41
Joined: Wed Oct 12, 2005 12:34 am

Hmm, next batch of questions...

Post by Bobbias2.0 »

I've seen the operand "#\1" used in some macro code for loading VRAM using DMA in the SNES programming wikibook. These come up numerous times, and I'm not sure what they're doing with those.

That's just something I've been owndering, but my main question is would it be possible to write text to the screen without making paletts and tiles and crap? or is that the only way? (aside from possibly sending hardcoded palette data and tile data manually...)
anomie
Lurker
Posts: 151
Joined: Tue Dec 07, 2004 1:40 am

Re: Hmm, next batch of questions...

Post by anomie »

Bobbias2.0 wrote:I've seen the operand "#\1" used in some macro code for loading VRAM using DMA in the SNES programming wikibook. These come up numerous times, and I'm not sure what they're doing with those.
Macro arguements, most likely.
would it be possible to write text to the screen without making paletts and tiles and crap? or is that the only way? (aside from possibly sending hardcoded palette data and tile data manually...)
That is the only way. Note that you don't have to set up the whole palette, and you only need to make as many tiles as you have letters and such.
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

Right. If you look in the example I gave you previously, I only set up 4 colors. That's all i was using. you only need to set up the colors that your tiles reference.

Please.. go here and download xkas. Do away with all those stupid non intuitive assembler symbols that nobody cares about. I am not a fan of the WLA-65816 Micro Assembler. xkas is much better, however it's technically a cross assembler, so it doesnt just 'automagically' create a new ROM.

http://byuu.cinnamonpirate.com/?page=ut ... 4&browser=

How else would you think you can get text on the screen without making tiles? The SNES is a tile based system. It turns on and does basically nothing by itself. There is no way to get it to anything unless you tell it to. I'm interested in your logic here.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
Bobbias2.0
Rookie
Posts: 41
Joined: Wed Oct 12, 2005 12:34 am

Post by Bobbias2.0 »

I was wondering if there was a way of actually setting each pixel of colour somehow, aside from tiles and such, but whatever, if I have to use tiles, I'll use tiles. but I currently don't have a program that actually exports to .pcx, so I need to save bmps, and then convert, then convert again, which is a bit of a pain...

EDIT: Will I need to learn any different syntax for this?
(and what process do I need to follow to assemble stuff into a .smc/.fig?)

EDIT2: Ok, read the info along with it, I should be writing for it sometime soon... (I'm currently working out my own assembly routines for multiplication and division (simple integer)) just for practice.
byuu

Post by byuu »

Try direct color mode 7. You only get a 128x128 window, and the data is interleaved with the tile map, but that's the closest you'll get to a frame buffer on the SNES.
You're better off just learning how to use a tilemap, though.

xkas file.asm file.smc

Be sure to make a valid header. I don't much care to explain how to do that myself.
Bobbias2.0
Rookie
Posts: 41
Joined: Wed Oct 12, 2005 12:34 am

Post by Bobbias2.0 »

I've got enough info and ASM code to help with that myself.

EDIT: That means the header, I'll teach myself the tile map shit too, though.
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

Bobbias2.0 wrote:I was wondering if there was a way of actually setting each pixel of colour somehow, aside from tiles and such, but whatever, if I have to use tiles, I'll use tiles. but I currently don't have a program that actually exports to .pcx, so I need to save bmps, and then convert, then convert again, which is a bit of a pain...

EDIT: Will I need to learn any different syntax for this?
(and what process do I need to follow to assemble stuff into a .smc/.fig?)

EDIT2: Ok, read the info along with it, I should be writing for it sometime soon... (I'm currently working out my own assembly routines for multiplication and division (simple integer)) just for practice.
No.. there really is no way to draw pixels on the SNES. The architecture is tile based. If you really want to lean SNES programming, you HAVE to learn how to use the system and tilemaps are a very large part of that.

The example I gave you is very basic. Follow the registers I write to with a register document and you will start to understand. All you're really doing is setting up the screen and VRAM modes. Set some palette colors. Set some starting VRAM address for the tiledata and tilemap Then load the data and tilemap data to the addresses you told it they'd be at.

Break it down step by step and it's not nearly as complicated as it might appear.

One way to help teach you this would be to have you start coding a ROM and post some code here and we can work together to answer your questions and give you direction.

You mentioned you want to learn how things work in detail. It seems your current methods of swimming in information and have some trouble grasping some concepts may not be the best approach. But who am I to tell you how to learn. I was just making a suggestion.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
byuu

Post by byuu »

No.. there really is no way to draw pixels on the SNES.
Hmm, did you not read my post? You can do exactly that, just only at 128x128, and you certainly don't have enough time to update the entire thing every frame. The only requirement is to do all the writes inside vblank. The pixel data is even in BGR233 format. Since it's mode7, you could even scale the 128x128 to the full screen and apply rotozoom effects when you wanted.
Practical, no. Possible, yes.

If only the damn system had more power... the most data you can get in one vblank is ~6300 bytes, or ((262-225)*1364/8) bytes.
With 4-color data and a dedicated DSP (like the one used in Dungeon Master that transcodes pixel data to bitplane data on-the-fly), a 180*128 framebuffer that's updated every NMI would be possible.

If only mid-frame VRAM writes were possible (CGRAM and OAM can be written to even mid-scanline, but not VRAM), I could probably make a video player for the system running at 240x160x256 colors. Send new data only at 10-30 fps to save on ROM size. Have to make a new memory mapper to hold all the data, but that wouldn't be hard. Interlacing could double the vertical resolution, too.

I think I'll play around with VRAM writes today just to make sure it's totally impossible to write to it outside of vblank.
Bobbias2.0
Rookie
Posts: 41
Joined: Wed Oct 12, 2005 12:34 am

Post by Bobbias2.0 »

wow, now that would be awesome! seriously, if that could be pulled off, that would be funny as hell, simply because you could do some crazy homebrew stuff...

Anyway, I'll have to get used to using xkas instead of WLA before I start seriously trying to wrte something.
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

byuusan wrote:
No.. there really is no way to draw pixels on the SNES.
Hmm, did you not read my post? You can do exactly that, just only at 128x128, and you certainly don't have enough time to update the entire thing every frame. The only requirement is to do all the writes inside vblank. The pixel data is even in BGR233 format. Since it's mode7, you could even scale the 128x128 to the full screen and apply rotozoom effects when you wanted.
Practical, no. Possible, yes.

If only the damn system had more power... the most data you can get in one vblank is ~6300 bytes, or ((262-225)*1364/8) bytes.
With 4-color data and a dedicated DSP (like the one used in Dungeon Master that transcodes pixel data to bitplane data on-the-fly), a 180*128 framebuffer that's updated every NMI would be possible.

If only mid-frame VRAM writes were possible (CGRAM and OAM can be written to even mid-scanline, but not VRAM), I could probably make a video player for the system running at 240x160x256 colors. Send new data only at 10-30 fps to save on ROM size. Have to make a new memory mapper to hold all the data, but that wouldn't be hard. Interlacing could double the vertical resolution, too.

I think I'll play around with VRAM writes today just to make sure it's totally impossible to write to it outside of vblank.
Yes, of course I read your post. But I dismiss that as a possibility due to it's being impractical. What could that possibly be useful for?

I suppose you could print some text to the screen that way by writing pixels, but it's simpler to simpley load a few tiles and spit them out. And it wouldn't be in a virtually featureless screen mode.

Anyway, I don't want to argue on this. Yes, it is POSSIBLE to write to some pixels, but it's uses are little to none.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
Bobbias2.0
Rookie
Posts: 41
Joined: Wed Oct 12, 2005 12:34 am

Post by Bobbias2.0 »

Well, it is interesting though, but yeah, I'll just do all the tile stuff and get that over and done so I understand it. Be cool if someone could actually use that screen mode and pixel writing for something though.
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

Are there any games that use DirectColor?
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Post Reply