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

Working on lazyNES. now lnList() works for single and horizontal.

This commit is contained in:
Jesper Gravgaard 2020-07-11 08:42:49 +02:00
parent 00e8822ff5
commit 6c8a320f5c
5 changed files with 65 additions and 5 deletions

View File

@ -7,6 +7,8 @@
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
#pragma target(nes)
#pragma emulator("java -jar c:/c64/Nintaco/Nintaco.jar")
#include "lazynes.h"
int lnMain() {
@ -15,6 +17,7 @@ int lnMain() {
lnSync(lfBlank); // blank screen to enable lnPush()
lnPush(lnBackCol, sizeof(bgColors), bgColors); // set colors, always directly after lnSync()
lnPush(lnNameTab0+32, sizeof(text)-1, text); // draw text in 2nd line
lnSync(0); // sync with vblank, unblank screen
while(1)
lnSync(0); // sync with vblank, unblank screen
return 0;
}

View File

@ -92,6 +92,8 @@ char * volatile vram_update_list;
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
interrupt(hardware_stack) void vblank() {
// Transfer any queued data to the PPU
lnListTransfer();
// DMA transfer the entire sprite buffer to the PPU
ppuSpriteBufferDmaTransfer(SPRITE_BUFFER);
// Set scroll
@ -144,9 +146,6 @@ ubyte lnSync(ubyte flags) {
// Update the mode
sync_mode = flags;
// Move any pending data to the VRAM
lnListTransfer();
// TODO: Handle lfSplit = 2 : activates split mode, NMI waits for SPR0HIT and sets registers
// Return number of vblank since last sync

View File

@ -0,0 +1,53 @@
// lazyNES lnlist demo
// lazyNES - As lazy as possible NES hardware support library for vbcc6502
// V1.0, 'Lazycow 2020
// Ported to KickC 2020 by Jesper Gravgaard
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
#pragma target(nes)
#pragma emulator("java -jar c:/c64/Nintaco/Nintaco.jar")
#include "lazynes.h"
// Data (in PRG ROM)
#pragma data_seg(GameRam)
static ubyte list[64];
#pragma data_seg(Data)
void lnMain() {
uword offset1 = lnNameTab0+64;
uword offset2 = lnNameTab0+96;
uword offset3 = lnNameTab0+128;
list[0]=(ubyte)(offset1>>8)|lfHor; // PPU address hi
list[1]=(ubyte)offset1; // PPU address lo
list[2]=3; // Size
list[3] = 'R'; // Data
list[4] = 'X'; // Data
list[5] = '0'; // Data
list[6]=(ubyte)(offset2>>8); // PPU address hi
list[7]=(ubyte)offset2; // PPU address lo
list[8]='X'; // Size
list[9]=(ubyte)(offset3>>8)|lfHor; // PPU address hi
list[10]=(ubyte)offset3; // PPU address lo
list[11]=3; // Size
list[12] = 'R'; // Data
list[13] = 'X'; // Data
list[14] = '0'; // Data
list[15] = lfEnd; // End transfer
static const ubyte bgColors[]={45,33,2};
static const char text[]="HELLO LAZYNES!";
lnSync(lfBlank); // blank screen to enable lnPush() usage
lnPush(lnBackCol,3,bgColors); // set background colors
lnPush(lnNameTab0+32,14,text); // draw text in 2nd line
for (;;) {
list[5] = ((list[5]+1)&7)+'0';
list[8] = ((list[8]+1)&7)+'0';
list[14] = ((list[14]+1)&7)+'0';
lnList(list);
lnSync(0); // sync with vblank, activate SPR0HIT splitscreen
}
}

View File

@ -7,6 +7,7 @@
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
#pragma target(nes)
#pragma emulator("java -jar c:/c64/Nintaco/Nintaco.jar")
#include "lazynes.h"
// A string in RAM
@ -36,6 +37,9 @@ int lnMain() {
for(char i=0;i<sizeof(b_init);i++)
b[i] = b_init[i];
static const char text[]="HELLO LAZYNES!";
lnPush(lnNameTab0+32, sizeof(text)-1, text); // draw text in 2nd line
for(;;) {
// update the number to display
tics+=1;
@ -44,7 +48,7 @@ int lnMain() {
objects = (objects+1)&0x3f;
}
// display a number
Print(lnNameTab0+32,objects+1);
Print(lnNameTab0+64,objects+1);
lnSync(0); // sync with vblank
}
return 0;

View File

@ -7,6 +7,7 @@
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
#pragma target(nes)
#pragma emulator("java -jar c:/c64/Nintaco/Nintaco.jar")
#include "lazynes.h"
int lnMain() {