From 8de41e2438c5efc572b5f9afac3e15380a64926b Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Thu, 9 Jul 2020 09:57:10 +0200 Subject: [PATCH] Working on lazynes print.c demonstrating lnList() --- src/test/kc/complex/lazynes/lazynes.c | 2 ++ src/test/kc/complex/lazynes/print.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/test/kc/complex/lazynes/lazynes.c b/src/test/kc/complex/lazynes/lazynes.c index 7b8dddbde..97b2ebf11 100644 --- a/src/test/kc/complex/lazynes/lazynes.c +++ b/src/test/kc/complex/lazynes/lazynes.c @@ -200,6 +200,7 @@ void lnListTransfer() { char* ppuAddr = (char*)(uword){ addrHi&0x3f, addrLo }; char size = vram_update_list[idx++]; ppuDataTransfer(ppuAddr, vram_update_list+idx, size); + idx += size; } else if(addrHi&lfVer) { // The write is vertical char addrLo = vram_update_list[idx++]; @@ -211,6 +212,7 @@ void lnListTransfer() { ppuDataTransfer(ppuAddr, vram_update_list+idx, size); // restore PPUCTRL PPU->PPUCTRL = ppuCtrl; + idx += size; } else { // The write is single-byte char addrLo = vram_update_list[idx++]; diff --git a/src/test/kc/complex/lazynes/print.c b/src/test/kc/complex/lazynes/print.c index b1c72656d..e684b237e 100644 --- a/src/test/kc/complex/lazynes/print.c +++ b/src/test/kc/complex/lazynes/print.c @@ -9,14 +9,14 @@ #pragma target(nes) #include "lazynes.h" -// A string in ROM -#pragma data_seg(Data) -ubyte b_init[]={0,0,10,'B','U','B','B','L','E','S',':',0,0,lfEnd}; - // A string in RAM #pragma data_seg(GameRam) ubyte b[14]; +// A string in ROM +#pragma data_seg(Data) +ubyte b_init[]={0,0,10,'B','U','B','B','L','E','S',':',0,0,lfEnd}; + // print some text in the static area using lnList void Print(uword offset, ubyte value) { b[0]=(ubyte)(offset>>8)|lfHor; b[1]=(ubyte)offset; b[11]=b[12]='0'; @@ -26,14 +26,16 @@ void Print(uword offset, ubyte value) { } int lnMain() { - // Copy string from ROM to RAM - for(char i=0;i