1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-23 06:32:11 +00:00
8bitworkshop/cc65/default_conio.c

44 lines
882 B
C
Raw Normal View History

#include "nes.h"
unsigned char index;
2017-05-21 21:34:57 +00:00
const unsigned char TEXT[]={"No cart loaded"};
const unsigned char PALETTE[]={0x1, 0x00, 0x10, 0x20}; //blue, gray, lt gray, white
void main (void) {
// turn off the screen
PPU.control = 0;
PPU.mask = 0;
// load the palette
PPU.vram.address = 0x3f;
PPU.vram.address = 0x0;
for(index = 0; index < sizeof(PALETTE); ++index){
PPU.vram.data = PALETTE[index];
}
// load the text
PPU.vram.address = 0x21; // set an address in the PPU of 0x21ca
2017-05-21 21:34:57 +00:00
PPU.vram.address = 0xc9; // about the middle of the screen
for( index = 0; index < sizeof(TEXT); ++index ){
PPU.vram.data = TEXT[index];
}
// reset the scroll position
PPU.vram.address = 0x20;
PPU.vram.address = 0x0;
PPU.scroll = 0;
PPU.scroll = 0;
// turn on screen
PPU.control = 0x80; // NMI on
PPU.mask = 0x1e; // screen on
// infinite loop
2017-05-21 21:34:57 +00:00
while (1) {
}
}