Quantcast
Channel: nesdev.org
Viewing all articles
Browse latest Browse all 746

Handling background nametables (noobie help needed)

$
0
0
Hi all, I am new to the site and NES game dev, but wanted to try and make some homebrew games. A long time ago I wrote some games for ZX Spectrum, so I do remember little things about how to write a program in assembly. ( I also dabbled in Game Boy and GBA, which is very relevant here, because they also use an OAM, although perhaps a little differently)

I have studied the memory map, the different "registers" (not sure if correct word) in memory where I have to hit it with setup values and then follow up with other writes to the same address (eg. The DMA routine).

But I am wondering, is it written anywhere, the minimal steps one must take to start displaying sprites/bg tiles on screen?

I have found some examples from Nerdy Nights which have helped me, as well as a "Minimal ca65 example" from the forum member RainWarrior. Both have helped me get started, but it's not really what I call minimal. There is stuff in there for gamepad input, background scrolling, the "sprite" or cursor consists of 4 sprites. There are other confusing parts too that I did not list.

Furthermore , in both examples, the background is just a single tile repeated over and over (or in Rainwarrior's example it's a checkerboard style with 2 alternating). And so the true spirit of how to use the nametable to display backgrounds is not really on show. I also realise that a true NES developer will use something called "Metatiles" and so any beginner level use of the nametable will not show a true recommended approach to making complete games.

But I just want to see some basic background code, displaying some background based on the tileset. Without all the pollution of the gamepad input, scrolling etc. For me i think the "init" code maybe be over the top also not really needed just to draw a single background.

Sorry for the long and disorganised post here. But I am quite confused, been at it a number of days just staring at code now and not achieving anything fast.


(TL:DR?)= Is there any example code showing just a background being loaded and displayed (ideally using ca65 or any assembler), and one that makes use of the nametables properly (rather than just poking a single tile copied into all slots?


Thank you for any help!

Statistics: Posted by Kilbaba — Tue Jan 16, 2024 8:28 am — Replies 0 — Views 79



Viewing all articles
Browse latest Browse all 746

Trending Articles