1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-25 20:32:25 +00:00

Working on lazynes print.c demonstrating lnList()

This commit is contained in:
jespergravgaard 2020-07-09 09:57:10 +02:00
parent 1f02f81b3d
commit 8de41e2438
2 changed files with 12 additions and 8 deletions

View File

@ -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++];

View File

@ -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<sizeof(b_init);i++)
b[i] = b_init[i];
static const ubyte bgColors[]={45,33,2};
ubyte objects=0;
ubyte objects=17;
uword tics=0;
lnSync(lfBlank); // blank screen to enable lnPush() usage
lnPush(lnBackCol,3,bgColors); // set background colors
// Copy string from ROM to RAM
for(char i=0;i<sizeof(b_init);i++)
b[i] = b_init[i];
for(;;) {
// update the number to display
tics+=1;