Continuing with the neslib examples, I will import a full background (with rendering off) from a RLE compressed nametable.
Last time, I successfully imported a BMP into NES Screen Tool (the newest version, with ‘lossy’ on). I saved the .chr graphics file. Then, I exported the nametable as a compressed RLE with a .h extension.
(note, I had to remove 1 used tile from the .chr, because the RLE code won’t work with 256 unique tiles on screen. See, I made one of the tiles an X, and removed references to it on the nametable, then saved the RLE, and resaved the CHR)
Also, I cut and pasted the palette, from NES Screen Tool…palette/put to clipboard/C data. And, pasted into the .c file.
In the crt0.s file, I had to edit the CHR segment to include the “Girl2.chr” file. In the C code, I had to import the “Girl2.h” (our RLE compressed background data).
Step 1, set a nametable address to start from.
Step 2, uncompress the BG data, by sending a pointer to the data to this function…
(if you open the Girl2.h file, the array of chars is called ‘Girl2’).
And, then turn on rendering. (the scroll position is still set to the default, nametable #0, X and Y are 0,0).
And, compile. Here’s what we have…
I find that flat tones (Anime style) works well for NES images.
Here’s the source code…