2018-07-27 17:39:09 +00:00
|
|
|
|
2019-03-10 16:17:12 +00:00
|
|
|
#include "neslib.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
// link the pattern table into CHR ROM
|
|
|
|
//#link "chr_generic.s"
|
|
|
|
|
|
|
|
// function to write a string into the name table
|
|
|
|
// adr = start address in name table
|
|
|
|
// str = pointer to string
|
|
|
|
void put_str(unsigned int adr, const char *str) {
|
|
|
|
vram_adr(adr); // set PPU read/write address
|
|
|
|
vram_write(str, strlen(str)); // write bytes to PPU
|
|
|
|
}
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2019-03-10 16:17:12 +00:00
|
|
|
// main function, run after console reset
|
|
|
|
void main(void) {
|
|
|
|
// set palette colors
|
|
|
|
pal_col(1,0x04);
|
|
|
|
pal_col(2,0x20);
|
|
|
|
pal_col(3,0x30);
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2019-03-10 16:17:12 +00:00
|
|
|
// write text to name table
|
|
|
|
put_str(NTADR_A(2,2),"HELLO, WORLD!");
|
|
|
|
put_str(NTADR_A(2,4),"THIS CODE PRINTS SOME TEXT");
|
|
|
|
put_str(NTADR_A(2,5),"USING ASCII-ENCODED CHARACTER");
|
|
|
|
put_str(NTADR_A(2,6),"SET WITH CAPITAL LETTERS ONLY");
|
2018-07-27 17:39:09 +00:00
|
|
|
|
2019-03-10 16:17:12 +00:00
|
|
|
// enable PPU rendering (turn on screen)
|
|
|
|
ppu_on_all();
|
2018-07-27 17:39:09 +00:00
|
|
|
|
|
|
|
// infinite loop
|
2019-03-10 16:17:12 +00:00
|
|
|
while (1) ;
|
2018-07-27 17:39:09 +00:00
|
|
|
}
|