1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2025-01-10 16:29:48 +00:00

33 lines
707 B
C
Raw Normal View History

2018-07-27 13:39:09 -04:00
2019-05-22 11:45:05 -04:00
/*
A simple "hello world" example.
Set the screen background color and palette colors.
Then write a message to the nametable.
Finally, turn on the PPU to display video.
*/
2019-03-10 12:17:12 -04:00
#include "neslib.h"
// link the pattern table into CHR ROM
//#link "chr_generic.s"
// main function, run after console reset
void main(void) {
2019-07-30 13:03:59 -04:00
2019-03-10 12:17:12 -04:00
// set palette colors
2019-04-15 19:37:11 -04:00
pal_col(0,0x02); // set screen to dark blue
2019-08-05 11:15:26 -04:00
pal_col(1,0x14); // fuchsia
2019-04-15 19:37:11 -04:00
pal_col(2,0x20); // grey
pal_col(3,0x30); // white
2018-07-27 13:39:09 -04:00
2019-03-10 12:17:12 -04:00
// write text to name table
2019-04-15 19:37:11 -04:00
vram_adr(NTADR_A(2,2)); // set address
vram_write("HELLO, WORLD!", 13); // write bytes to video RAM
2018-07-27 13:39:09 -04:00
2019-03-10 12:17:12 -04:00
// enable PPU rendering (turn on screen)
ppu_on_all();
2018-07-27 13:39:09 -04:00
// infinite loop
2019-03-10 12:17:12 -04:00
while (1) ;
2018-07-27 13:39:09 -04:00
}