Click here to join us on IRC (#charas on irc.freenode.net)!
So hey, I've taken up the study of 6502 assembly code, the basis for NES ROMs. A three-second search didn't find 6502 on this forum (maybe I should've been less lazy and tried other keywords too), so here's a topic to cover it, because I'm hoping to get some help.Through various internet resources I have managed to get a handle on Hex code and Assembly opcodes and how to switch between them; it'll take more study, but my notes are pretty good and I expect no problem there. I've found some info on I/O as far as user input, and I'm ignoring music for the moment. The main thing I'm interested in but having problems understanding is graphics.My studies have left me with this understanding:Somewhere in the code, possibly the D000 block, there are two databases for sprites: one holds characters, the other holds background and foreground objects. (So far, this is sounding a lot like RPGMaker, which cheers me.) I have a list of D000-block codes that should allow me to set the graphics themselves, the colors used, and so forth. Then when the program's ready to put them onscreen, I set 8 pointers to 8 sprites (the max char sprites onscreen at any one time) and use associated settings to control their location, visibility, priority over foreground objects, etc.Things I haven't run across yet, or need clarification on:Is the D000 block the correct spot for NES, or is it for a different form of 6502 code (or perhaps another code entirely)? I'm confused because it's part of the larger PRG-ROM upper bank area that I understood was half of my personal playground (where I'd put all my code).How do I properly set up a font in 1BPP (one bit per pixel)? The sprite database apparently uses 64 bytes to hold each sprite, but using that much data for each character seems wasteful, so I assume I'm missing something about either graphical compression or the usual way of doing things.How do I handle animation? Does the 8-sprite limit mean that (e.g.) if I had a 2-frame animation I could only have 4 sprites onscreen at a time?Does the 8-sprite limit apply to duplicate sprites (e.g., I couldn't have 1 guard duplicated a dozen times)?How do I go about creating a tiled background? I assume the 8-sprite limit doesn't apply to backgrounds, but I'm not sure where to begin either. Are there implicit routines for bg and fg or will I have to craft my own from scratch?I think I had more questions on this matter, but they slip my mind. Here's hoping someone with some experience can help me through some of these early hurdles (or at least put my mind at ease regarding whether or not my studies are causing me to mix up different codes.
These PPU Ports (in the I/O registers in areas $2000-2007 and $4000-401F)... I guess the NES understands the address and I don't have to do anything special except read them and write to them?
Also, anyone have a link to a simple listing of what each of these ports does and how to use it?
... PPU internal memory ... is the program going to be rewriting this periodically, or does this operation only happen once, or...?
Wait, if the sprites get transfered to the PPU, why do you change their position and stuff back in the $0200 block they were in originally? Is the PPU now watching these areas and keeping track of the changes there??
Several times the tutorials use code with a .db start. Coming from a BASIC background, this looks like a vague memory I have of a command code for "send out these values, in order, when you're called upon" (like a "NextLetterInAlphabet" function with the data "abcdefg" etc. and internal incrementation). I haven't seen this in my studies of Hex codes; is there a Hex code for this operation, or is it a lot more complex in Hex than in Assembly mneumonics?
Similar question about subroutine titles: How do you (in Hex) include stuff like "this subroutine is called LoadSprites"?
The controllers are really set up to return a byte with a single bit 8 times to tell you whether their buttons are pressed or not?Huh? What are the other bits doing that they can't tell you this info with the use of a single read of a single byte?? (I assume there's a reason, but on the face of it it sounds like crazy talk. So I'd like to know.)