#highlight(c){{{ #include <kihon.h> //NMI割り込み void NMIProc(void) { } // メイン処理 void NesMain() { unsigned char x=50,y=50,bgy=0; const char palettebg[] = { 0x0f, 0x11, 0x21, 0x30, 0x0f, 0x11, 0x21, 0x30, 0x0f, 0x11, 0x21, 0x30, 0x0f, 0x11, 0x21, 0x30 }; const char palettesp[] = { 0x0f, 0x00, 0x10, 0x21, 0x0f, 0x0f, 0x10, 0x21, 0x0f, 0x09, 0x19, 0x21, 0x0f, 0x15, 0x27, 0x30 }; InitPPU(); // パレット設定 SetPalette((char *)palettebg,0); SetPalette((char *)palettesp,1); // 背景設定 SetBackground(0x21,0xc9,"SAMPLE",6); // スクロール設定 SetScroll( 0, 0); SetPPU(0x08,0x1e); while (1) { VBlank(); // スプライト設定 SetSprite(1,x,y,1,0); CheckPad(); if ( ButtonDown(0, BTN_UP ) ) { y--; } if ( ButtonDown(0, BTN_DOWN ) ) { y++; } if ( ButtonDown(0, BTN_LEFT ) ) { x--; } if ( ButtonDown(0, BTN_RIGHT) ) { x++; } bgy++; if (bgy == 240) { bgy = 0; } SetScroll( 0, bgy); } } }}}