「DMA転送」の編集履歴(バックアップ)一覧はこちら

DMA転送」(2014/07/28 (月) 21:49:07) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

-DMA転送により、まとめてスプライトの設定ができます。 -(char *)0x0700は.cfgでDMAAREAとして設定したアドレスへのポインタです。 #highlight(c){{{ #include <kihon.h> void ClearScreen() { unsigned char i,pos[2]; for (i = 0; i < 30; i++) { GetBackgroundAddress(0, 0, i, pos); VBlank(); FillBackground(*(pos + 0),*(pos + 1),32,32); } } // メイン処理 void NesMain() { unsigned char i,j,first; static unsigned char cnt=0; 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 }; VBlank(); InitPPU(); SetPalette((char *)bgpalette ,0); SetPalette((char *)sppalette, 1); SetPPU(0x08,0x1e); ClearScreen(); while (1) { VBlank(); SetScroll( 0, 0); SendDMA(0x7); first = 1; for (i=0;i<6;i++) { for (j=1;j<5;j++) { SetDMA((char *)0x0700,first,i * 20,j * 10,i,0); first = 0; } } } } //NMI割り込み void NMIProc(void) { } }}} -.cfgの例 #highlight(c){{{ RAM: start = $0400, size = $0400, type = rw, define = yes; ↓ RAM: start = $0400, size = $0300, type = rw, define = yes; DMAAREA: start = $0700, size = $0100, type = rw, define = yes; }}}
-DMA転送により、まとめてスプライトの設定ができます。 -(char *)0x0700は.cfgでDMAAREAとして設定したアドレスへのポインタです。 #highlight(c){{{ #include <kihon.h> void ClearScreen() { unsigned char i,pos[2]; for (i = 0; i < 30; i++) { GetBackgroundAddress(0, 0, i, pos); FillBackground(*(pos + 0),*(pos + 1),32,32); } } // メイン処理 void NesMain() { unsigned char i,j,first; static unsigned char cnt=0; 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); ClearScreen(); SetPPU(0x08,0x1e); while (1) { VBlank(); SetScroll( 0, 0); SendDMA(0x7); first = 1; for (i=0;i<6;i++) { for (j=1;j<5;j++) { SetDMA((char *)0x0700,first,i * 20,j * 10,i,0); first = 0; } } } } //NMI割り込み void NMIProc(void) { } }}} -.cfgの例 #highlight(c){{{ RAM: start = $0400, size = $0400, type = rw, define = yes; ↓ RAM: start = $0400, size = $0300, type = rw, define = yes; DMAAREA: start = $0700, size = $0100, type = rw, define = yes; }}}

表示オプション

横に並べて表示:
変化行の前後のみ表示: