mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-08-14 07:25:46 +00:00
Working on lazyNES. now lnList() works for single and horizontal.
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
|
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
|
||||||
|
|
||||||
#pragma target(nes)
|
#pragma target(nes)
|
||||||
|
#pragma emulator("java -jar c:/c64/Nintaco/Nintaco.jar")
|
||||||
|
|
||||||
#include "lazynes.h"
|
#include "lazynes.h"
|
||||||
|
|
||||||
int lnMain() {
|
int lnMain() {
|
||||||
@@ -15,6 +17,7 @@ int lnMain() {
|
|||||||
lnSync(lfBlank); // blank screen to enable lnPush()
|
lnSync(lfBlank); // blank screen to enable lnPush()
|
||||||
lnPush(lnBackCol, sizeof(bgColors), bgColors); // set colors, always directly after lnSync()
|
lnPush(lnBackCol, sizeof(bgColors), bgColors); // set colors, always directly after lnSync()
|
||||||
lnPush(lnNameTab0+32, sizeof(text)-1, text); // draw text in 2nd line
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -92,6 +92,8 @@ char * volatile vram_update_list;
|
|||||||
|
|
||||||
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
|
// NMI Called when the PPU refreshes the screen (also known as the V-Blank period)
|
||||||
interrupt(hardware_stack) void vblank() {
|
interrupt(hardware_stack) void vblank() {
|
||||||
|
// Transfer any queued data to the PPU
|
||||||
|
lnListTransfer();
|
||||||
// DMA transfer the entire sprite buffer to the PPU
|
// DMA transfer the entire sprite buffer to the PPU
|
||||||
ppuSpriteBufferDmaTransfer(SPRITE_BUFFER);
|
ppuSpriteBufferDmaTransfer(SPRITE_BUFFER);
|
||||||
// Set scroll
|
// Set scroll
|
||||||
@@ -144,9 +146,6 @@ ubyte lnSync(ubyte flags) {
|
|||||||
// Update the mode
|
// Update the mode
|
||||||
sync_mode = flags;
|
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
|
// TODO: Handle lfSplit = 2 : activates split mode, NMI waits for SPR0HIT and sets registers
|
||||||
|
|
||||||
// Return number of vblank since last sync
|
// Return number of vblank since last sync
|
||||||
|
53
src/test/kc/complex/lazynes/list.c
Normal file
53
src/test/kc/complex/lazynes/list.c
Normal 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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -7,6 +7,7 @@
|
|||||||
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
|
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
|
||||||
|
|
||||||
#pragma target(nes)
|
#pragma target(nes)
|
||||||
|
#pragma emulator("java -jar c:/c64/Nintaco/Nintaco.jar")
|
||||||
#include "lazynes.h"
|
#include "lazynes.h"
|
||||||
|
|
||||||
// A string in RAM
|
// A string in RAM
|
||||||
@@ -36,6 +37,9 @@ int lnMain() {
|
|||||||
for(char i=0;i<sizeof(b_init);i++)
|
for(char i=0;i<sizeof(b_init);i++)
|
||||||
b[i] = 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(;;) {
|
for(;;) {
|
||||||
// update the number to display
|
// update the number to display
|
||||||
tics+=1;
|
tics+=1;
|
||||||
@@ -44,7 +48,7 @@ int lnMain() {
|
|||||||
objects = (objects+1)&0x3f;
|
objects = (objects+1)&0x3f;
|
||||||
}
|
}
|
||||||
// display a number
|
// display a number
|
||||||
Print(lnNameTab0+32,objects+1);
|
Print(lnNameTab0+64,objects+1);
|
||||||
lnSync(0); // sync with vblank
|
lnSync(0); // sync with vblank
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
|
// Original Source VBCC alpha 2 http://www.ibaug.de/vbcc/vbcc6502_2.zip
|
||||||
|
|
||||||
#pragma target(nes)
|
#pragma target(nes)
|
||||||
|
#pragma emulator("java -jar c:/c64/Nintaco/Nintaco.jar")
|
||||||
#include "lazynes.h"
|
#include "lazynes.h"
|
||||||
|
|
||||||
int lnMain() {
|
int lnMain() {
|
||||||
|
Reference in New Issue
Block a user