gnarlyWarlock wrote:works fine; I put #$A100 into $4302 and #$7E into $4304, start HDMA and everything's groovy. HOWEVER, that same code with FREERAM = $A100, and stz $4304 : it doesn't work. -_-".
Of course not. $A100 isn't in the bottom $2000 bytes (8 kilobytes) of the bank, meaning it's not in the WRAM mirror. In bank $00, $A100 is a ROM location.
Also, in my modGradient subroutine, if I do indeed load the table to #$7FA100, looking at the documentation, I'd assume I can direct page to it (lda #$A100, tcd, and rock and roll). That doesn't work. wtf??
Why would you assume that? Like I said, you can't use direct page to access anything outside bank $00, and it's only $7E0000-$7E1FFF that's mirrored to $0000-$1FFF in banks $00-$3F and $80-$BF. You can't access
any of bank $7F via direct page, ever, and that also goes for the upper $E000 bytes (ie: most) of bank $7E.
ALSO, IF I put LVL1BLUE into another bank (lets say, bank 1, and try to lda.w $8000+LVL1BLUE, X), it can't find the table; the table has to be in the same bank as this subroutine.
Two things: First, the increment is not $8000; it's $10000. Banks are always $10000 bytes; it's just that they aren't always 100% ROM (the banks you're using are 50% ROM and 50% WRAM/MMIO/reserved areas). Second, by using
lda.w, you're probably forcing 16-bit addressing, which causes the assembler to ignore the top byte (ie: the bank byte) of the operand. Try
lda.l.
Or just try to arrange your code to minimize long accesses, because they're slow. Keep in mind that the data bank (the bank used for 16-bit addressing of data) does not have to be the same as the program bank (the bank the program counter is currently in), so you can access data that's in a different bank from the code doing the accessing without having to use long addresses. Of course, if you only have a handful of accesses to do in a particular bank, it's probably faster to use 24-bit addressing than to change the data bank just for that...
It might be a good idea to study up on the SNES memory map; once you get it, everything makes way more sense.
I define having 8 ROM banks, and each ROM bank is $8000; does that mean my ROM is necessarily in banks $00-$08, from CPU's reference point?
You mean $00-$07, right? It certainly should be (unless there's an assembler option I'm not aware of), but for a ROM that small you should also be able to find the data in $40-$47, $80-$87, and $C0-$C7. Since you're using LoROM, I wouldn't bother with the $40+ and $C0+ ranges - if you're using some variant of HiROM they allow access to all $10000 bytes of a ROM bank, but if you aren't, the only practical difference is that you can't access MMIO or the RAM mirror with 16-bit addressing in those banks. $80+ is useful for FastROM purposes, but that's out of scope so I'll leave off here.