1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-01 13:50:30 +00:00
8bitworkshop/presets/nes/rletitle.c

51 lines
1.0 KiB
C
Raw Normal View History

2019-03-10 16:17:12 +00:00
2019-05-22 15:45:05 +00:00
/*
Unpacks a RLE-compressed nametable+attribute table into VRAM.
Also uses the pal_bright() function to fade in the palette.
*/
2019-03-10 16:17:12 +00:00
#include "neslib.h"
extern const byte climbr_title_pal[16];
extern const byte climbr_title_rle[];
// link the pattern table into CHR ROM
//#link "chr_generic.s"
// link title screen palette and RLE nametable
//#link "climbr_title.s"
2019-03-10 16:17:12 +00:00
void fade_in() {
byte vb;
for (vb=0; vb<=4; vb++) {
// set virtual bright value
2019-03-10 16:17:12 +00:00
pal_bright(vb);
// wait for 4/60 sec
ppu_wait_frame();
ppu_wait_frame();
ppu_wait_frame();
ppu_wait_frame();
}
}
void show_title_screen(const byte* pal, const byte* rle) {
// disable rendering
ppu_off();
// set palette, virtual bright to 0 (total black)
pal_bg(pal);
pal_bright(0);
// unpack nametable into the VRAM
vram_adr(0x2000);
vram_unrle(rle);
// enable rendering
ppu_on_all();
// fade in from black
fade_in();
}
void main(void)
{
show_title_screen(climbr_title_pal, climbr_title_rle);
while(1);//do nothing, infinite loop
}