示例#1
0
文件: debug.c 项目: Godzil/quickdev16
void debug_enable(void)
{
    VRAMLoad((word) debugFont_pic, 0x5000, 2048);
    VRAMLoad((word) debug_map, 0x4000, 0x0800);
    setTileMapLocation(0x4000, (byte) 0x00, (byte) 0);
    setCharacterLocation(0x5000, (byte) 0);
    *(byte *) 0x2100 = 0x0f;    // enable background

    // Font Color
    // hex(24 << 10 | 24 << 5 | 24 ) = '0x6318'
    *(byte *) 0x2121 = 0x02;
    *(byte *) 0x2122 = 0xff;
    *(byte *) 0x2122 = 0x7f;

    // Font Border Color
    *(byte *) 0x2121 = 0x00;
    *(byte *) 0x2122 = 0x00;
    *(byte *) 0x2122 = 0x00;

    // Background Color
    *(byte *) 0x2121 = 0x01;
    *(byte *) 0x2122 = 0x05;
    *(byte *) 0x2122 = 0x29;


}
示例#2
0
文件: main.c 项目: optixx/snes
void main(void) {

	initInternalRegisters();

	// Screen map data @ VRAM location $1000
	setTileMapLocation(0x1000, (byte) 0x00, (byte) 0);
	//*(byte*) 0x2107 = 0x10;
	
	// Plane 0 Tile graphics @ $2000
	setCharacterLocation(0x2000, (byte) 0);
	//*(byte*) 0x210b = 0x02;

	VRAMLoad((word) title_pic, 0x2000, 0x1BE0);
	VRAMLoad((word) title_map, 0x1000, 0x0800);
	CGRAMLoad((word) title_pal, (byte) 0x00, (word) 256);
	
	// TODO sitwch to mode 0 for trying
	*(byte*) 0x2105 = 0x01;	// MODE 1 value

	*(byte*) 0x212c = 0x01; // Plane 0 (bit one) enable register
	*(byte*) 0x212d = 0x00;	// All subPlane disable

	*(byte*) 0x2100 = 0x0f; // enable background

	currentScrollEvent = NULL;
	scrollValue = 0;

	initEvents();
	enablePad();

	addEvent(&NMIReadPad, 1);
	
	// Loop forever
	while(1) {

		waitForVBlank();

		if(pad1.left) {
			if(currentScrollEvent == NULL)
				currentScrollEvent = addEvent(&scrollLeft, 1);
		} 
		
		if(pad1.right) {
			if(currentScrollEvent != NULL) {
				removeEvent(currentScrollEvent);
				currentScrollEvent = NULL;
			} 
		}

		if(pad1.up) {
			addEvent(&fadeOut, 1);
			addEvent(&mosaicIn, 1);
		}

		if(pad1.down) {
			addEvent(&fadeIn, 1);
			addEvent(&mosaicOut, 1);
		}

		if(pad1.start) {
			debug();
		}
	}
}