• while文の中でVBlank待ちをしなくても、.asmで宣言した処理(NMIProc)が毎回実行されます。
#include <kihon.h>
 
// メイン処理
void NesMain()
{
    const char bgpalette[] = {
        0x0f, 0x21, 0x11, 0x20, 0x0f, 0x21, 0x11, 0x20,
        0x0f, 0x21, 0x11, 0x20, 0x0f, 0x21, 0x11, 0x20 };
    const char sppalette[] = {
        0x0f, 0x0a, 0x37, 0x20, 0x0f, 0x0a, 0x25, 0x20,
        0x0f, 0x0a, 0x11, 0x20, 0x0f, 0x0a, 0x2a, 0x20 };
 
    InitPPU();
    SetPalette((char *)bgpalette ,0);
    SetPalette((char *)sppalette, 1);
 
    //NMI割り込みの設定(flag1の7bitを1に)
    SetPPU(0x80,0x1e);
 
    while (1);
}
 
//NMI割り込み
void NMIProc(void)
{
    static unsigned char x = 50;
    x++;
    SetSprite(1,x,100,1,0);
}
 
最終更新:2014年07月28日 22:12