Character RAM data write

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

tepples
Posts: 22223
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Character RAM data write

Post by tepples » Wed Feb 04, 2015 8:34 am

tokumaru wrote:
from what I recall Battletoads just has a block of LDA imm / STA $2007 in RAM, and updates the immediate values as needed.
I didn't know Battletoads did this. I never expected a game without extra RAM to do this, since even a small block of 8 tiles (128 bytes) would expand to 640 bytes, over 30% of the RAM total (2KB).
I know the NROM version of Driar does it, but in which level of Battletoads does this happen? I seem to remember that Battletoads stores its VRAM update list in unused stack and does an unrolled PLA STA $2007 loop.

User avatar
tokumaru
Posts: 11932
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Character RAM data write

Post by tokumaru » Wed Feb 04, 2015 8:47 am

tepples wrote:I know the NROM version of Driar does it
True, I was aware of Driar. It's a simpler game though, with smaller worlds to keep track of, so it can spare a little more RAM than the typical early 90's NES game.

Ti_
Posts: 36
Joined: Sat Aug 03, 2013 3:08 pm
Location: Russia
Contact:

Re: Character RAM data write

Post by Ti_ » Thu Feb 05, 2015 1:44 pm

rainwarrior wrote:No, from what I recall Battletoads just has a block of LDA imm / STA $2007 in RAM, and updates the immediate values as needed. If you want to know the details, though, it's easy to just take a look in a debugger.
Actually, Battletoads has a block of LDY PTR,X STY $2007 (16 times) in RAM (about 110 bytes).
to prepare code it's change ptr (of char gfx), with every next low byte of ptr greater on 1.
X and A starts from zero, and incremented by ADC #$10 TAX BNE loop. (so total 16 times) =256 bytes (16tiles).
However it doesn't run for full speed, because before it waits for cross-page penalty of ptr,X based on low ptr value - required to timings.
Similar code also used to animate tiles for level2 parallax.
(and you can find same code in my duck tales 2 - two players hack.)

PLA/STA used for update raw/column/attributes/palette.

For update snakes in karnath lair it's uses extreme code in ROM with much of everything. (see BANK3:8062) (bank6 in fceux).
My profile on RHDN.

Post Reply