1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-26 18:29:54 +00:00

Renamed a few VIC II registers

This commit is contained in:
jespergravgaard 2020-05-02 11:38:51 +02:00
parent 4ffba62276
commit 95a3759087
435 changed files with 4362 additions and 4296 deletions

View File

@ -69,7 +69,6 @@ public class CallingConventionStack {
return paramOffsetConstant.getConstantRef();
}
/**
* Get the number of bytes that needed on the stack to pass parameters/return value to/from a procedure
*

View File

@ -158,7 +158,7 @@ public class Pass1CallStack extends Pass2SsaOptimization {
}
}
// Convert callprepare(xxx,yyy,) stackpush(type)=xxx, ...;
// Convert callprepare(xxx,yyy,) to stackpush(type)=xxx, ...;
for(ControlFlowBlock block : getGraph().getAllBlocks()) {
ListIterator<Statement> stmtIt = block.getStatements().listIterator();
while(stmtIt.hasNext()) {
@ -258,7 +258,7 @@ public class Pass1CallStack extends Pass2SsaOptimization {
}
/**
* Generate stack push stackpull(type)=xxx assignments
* Generate stack push stackpush(type)=xxx assignments
*
* @param value The value to push
* @param symbolType The type of the value

View File

@ -62,7 +62,7 @@ const unsigned int SPRITE_PTRS = $3f8;
char * const SPRITES_XPOS = $d000;
char * const SPRITES_YPOS = $d001;
char * const SPRITES_XMSB = $d010;
char * const SPRITES_COLS = $d027;
char * const SPRITES_COLOR = $d027;
char* const SPRITES_ENABLE = $d015;
char* const SPRITES_EXPAND_Y = $d017;
char* const SPRITES_PRIORITY = $d01b;
@ -70,12 +70,12 @@ char* const SPRITES_MC = $d01c;
char* const SPRITES_EXPAND_X = $d01d;
char* const RASTER = $d012;
char* const BORDERCOL = $d020;
char* const BGCOL = $d021;
char* const BGCOL1 = $d021;
char* const BGCOL2 = $d022;
char* const BGCOL3 = $d023;
char* const BGCOL4 = $d024;
char* const BORDER_COLOR = $d020;
char* const BG_COLOR = $d021;
char* const BG_COLOR0 = $d021;
char* const BG_COLOR1 = $d022;
char* const BG_COLOR2 = $d023;
char* const BG_COLOR3 = $d024;
char* const SPRITES_MC1 = $d025;
char* const SPRITES_MC2 = $d026;

View File

@ -40,6 +40,23 @@ public class TestPrograms {
public TestPrograms() {
}
/* TODO: Add support for var*var
@Test
public void testMultiply3() throws IOException, URISyntaxException {
compileAndCompare("multiply-3.c");
}
*/
@Test
public void testMultiply2() throws IOException, URISyntaxException {
compileAndCompare("multiply-2.c");
}
@Test
public void testMultiply1() throws IOException, URISyntaxException {
compileAndCompare("multiply-1.c");
}
@Test
public void testStructPointerToMember2() throws IOException, URISyntaxException {
compileAndCompare("struct-pointer-to-member-2.c");

View File

@ -1,9 +1,9 @@
// Test declaring a variable as at a hard-coded address
// Changing border color using an __address variable
volatile char __address(0xd020) bgcol;
volatile char __address(0xd020) BG_COLOR;
void main() {
bgcol = 0;
BG_COLOR = 0;
}

View File

@ -6,9 +6,9 @@ void main() {
}
}
char* const BGCOL = 0xd020;
char* const BG_COLOR = 0xd020;
// Function only used inside the inline asm
void init() {
*BGCOL = 0;
*BG_COLOR = 0;
}

View File

@ -1,4 +1,4 @@
#include "bgblacklib.c"
void main() {
*BGCOL = BLACK;
*BG_COLOR = BLACK;
}

View File

@ -1,2 +1,2 @@
char* const BGCOL = 0xd021;
char* const BG_COLOR = 0xd021;
const char BLACK = 0x00;

View File

@ -10,7 +10,7 @@ void main() {
fill(BITMAP,40*25*8,0);
fill(SCREEN,40*25,$16);
*BORDERCOL = BLUE;
*BORDER_COLOR = BLUE;
*D011 = VIC_BMM|VIC_DEN|VIC_RSEL|3;
*VIC_MEMORY = (byte)((((word)SCREEN&$3fff)/$40)|(((word)BITMAP&$3fff)/$400));

View File

@ -14,7 +14,7 @@ void main() {
fill(BITMAP,40*25*8,0);
fill(SCREEN,40*25,$16);
*BORDERCOL = BLUE;
*BORDER_COLOR = BLUE;
*D011 = VIC_BMM|VIC_DEN|VIC_RSEL|3;
*VIC_MEMORY = (byte)((((word)SCREEN&$3fff)/$40)|(((word)BITMAP&$3fff)/$400));

View File

@ -10,8 +10,8 @@ byte* const BITMAP = $2000;
byte next=0;
void main() {
*BORDERCOL = 0;
*BGCOL = 0;
*BORDER_COLOR = 0;
*BG_COLOR = 0;
*D011 = VIC_BMM|VIC_DEN|VIC_RSEL|3;
*VIC_MEMORY = (byte)((((word)SCREEN&$3fff)/$40)|(((word)BITMAP&$3fff)/$400));
bitmap_init(BITMAP);

View File

@ -10,8 +10,8 @@ byte* const BITMAP = $2000;
word next=0;
void main() {
*BORDERCOL = 0;
*BGCOL = 0;
*BORDER_COLOR = 0;
*BG_COLOR = 0;
*D011 = VIC_BMM|VIC_DEN|VIC_RSEL|3;
*VIC_MEMORY = (byte)((((word)SCREEN&$3fff)/$40)|(((word)BITMAP&$3fff)/$400));
bitmap_init(BITMAP, SCREEN);

View File

@ -51,9 +51,9 @@ void init_irq() {
// Interrupt Routine counting frames
interrupt(hardware_clobber) void irq() {
*BGCOL = WHITE;
*BG_COLOR = WHITE;
if(frame_cnt) frame_cnt++;
*BGCOL = BLACK;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -58,9 +58,9 @@ void init_irq() {
// Interrupt Routine counting frames
interrupt(hardware_clobber) void irq() {
*BGCOL = WHITE;
*BG_COLOR = WHITE;
if(frame_cnt) frame_cnt++;
*BGCOL = BLACK;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -41,7 +41,7 @@ void main() {
if(r>=512*12+256) break;
}
while(true)
(*BORDERCOL)++;
(*BORDER_COLOR)++;
}
// Counts frames - updated by the IRQ
@ -67,9 +67,9 @@ void init_irq() {
// Interrupt Routine counting frames
interrupt(hardware_clobber) void irq() {
*BGCOL = WHITE;
*BG_COLOR = WHITE;
if(frame_cnt) frame_cnt++;
*BGCOL = BLACK;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -9,7 +9,7 @@ byte* D016 = $d016;
byte MCM = %00010000;
byte CSEL = %00001000;
byte* D018 = $d018;
byte* BGCOL = $d020;
byte* BG_COLOR = $d020;
byte* FGCOL = $d021;
byte* COLS = $d800;
@ -19,7 +19,7 @@ byte* SCREEN = $400;
byte* const BITMAP = $2000;
void main() {
*BGCOL = 0;
*BG_COLOR = 0;
*FGCOL = 0;
*D011 = BMM|DEN|RSEL|3;
*D018 = (byte)(((word)SCREEN/$40)|((word)BITMAP/$400));
@ -27,9 +27,9 @@ void main() {
init_plot_tables();
do {
do {} while (*RASTER!=$ff);
(*BGCOL)++;
(*BG_COLOR)++;
plots();
(*BGCOL)--;
(*BG_COLOR)--;
} while (true);
}

View File

@ -60,14 +60,14 @@ void main() {
}
*VIC_CONTROL = VIC_DEN | VIC_ECM | VIC_RSEL | 3;
*BORDERCOL = 0;
*BORDER_COLOR = 0;
byte rst = $42;
while(*RASTER!=rst) {}
asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
do {
rst = *RASTER;
*VIC_CONTROL = VIC_DEN | VIC_ECM | VIC_RSEL | (rst&7);
*BORDERCOL = rst*$10;
*BORDER_COLOR = rst*$10;
asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
} while (rst!=$f2);
}

View File

@ -51,14 +51,14 @@ void main() {
}
*VIC_CONTROL = VIC_DEN | VIC_ECM | VIC_RSEL | 3;
*BORDERCOL = 0;
*BORDER_COLOR = 0;
byte rst = $42;
while(*RASTER!=rst) {}
asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
do {
rst = *RASTER;
*VIC_CONTROL = VIC_DEN | VIC_ECM | VIC_RSEL | (rst&7);
*BORDERCOL = rst*$10;
*BORDER_COLOR = rst*$10;
asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
} while (rst!=$f2);
}

View File

@ -13,10 +13,10 @@ void main() {
while(*RASTER!=$40) { }
// Create rasterbars
*BGCOL = 0;
*BG_COLOR = 0;
for (byte r : $31..$ff) {
asm { nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop }
(*BGCOL)++;
(*BG_COLOR)++;
}
// Rotate palette

View File

@ -66,8 +66,8 @@ void menu() {
// Char Colors
for(byte* c=COLS;c!=COLS+1000;c++) *c=LIGHT_GREEN;
// Screen colors
*BGCOL = 0;
*BORDERCOL = 0;
*BG_COLOR = 0;
*BORDER_COLOR = 0;
// Display menu Text
print_set_screen(SCREEN);
print_cls();
@ -173,7 +173,7 @@ void mode_ctrl() {
if(ctrl != dtv_control) {
dtv_control = ctrl;
*DTV_CONTROL = ctrl;
*BORDERCOL = ctrl;
*BORDER_COLOR = ctrl;
}
}
}
@ -184,7 +184,7 @@ void mode_ctrl() {
// Normal VIC Adressing:
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
// Pixel Shifter (1)
// - 0: 4bpp BgColor0[3:0]
// - 0: 4bpp BG_COLORor0[3:0]
// - 1: 4bpp ColorData[3:0]
void mode_stdchar() {
byte* const SCREEN = $8000;
@ -211,8 +211,8 @@ void mode_stdchar() {
DTV_PALETTE[i] = DTV_PALETTE_DEFAULT[i];
}
// Screen colors
*BGCOL = 0;
*BORDERCOL = 0;
*BG_COLOR = 0;
*BORDER_COLOR = 0;
// Char Colors and screen chars
byte* col=COLORS;
byte* ch=SCREEN;
@ -232,10 +232,10 @@ void mode_stdchar() {
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & "00" & CharData[5:0] & RowCounter[2:0] )
// GfxData Pixel Shifter (1)
// - 0: 4bpp Background Color
// - CharData[7:6] 00: 4bpp BgColor0[3:0]
// - CharData[7:6] 01: 4bpp BgColor1[3:0]
// - CharData[7:6] 10: 4bpp BgColor2[3:0]
// - CharData[7:6] 11: 4bpp BgColor3[3:0]
// - CharData[7:6] 00: 4bpp BG_COLORor0[3:0]
// - CharData[7:6] 01: 4bpp BG_COLORor1[3:0]
// - CharData[7:6] 10: 4bpp BG_COLORor2[3:0]
// - CharData[7:6] 11: 4bpp BG_COLORor3[3:0]
// - 1: 4bpp ColorData[3:0]
void mode_ecmchar() {
byte* const SCREEN = $8000;
@ -262,11 +262,11 @@ void mode_ecmchar() {
DTV_PALETTE[i] = DTV_PALETTE_DEFAULT[i];
}
// Screen colors
*BORDERCOL = 0;
*BGCOL1 = 0;
*BGCOL2 = 2;
*BGCOL3 = 5;
*BGCOL4 = 6;
*BORDER_COLOR = 0;
*BG_COLOR = 0;
*BG_COLOR1 = 2;
*BG_COLOR2 = 5;
*BG_COLOR3 = 6;
// Char Colors and screen chars
byte* col=COLORS;
byte* ch=SCREEN;
@ -286,12 +286,12 @@ void mode_ecmchar() {
// Normal VIC Adressing:
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
// GfxData Pixel Shifter (1) if ColorData[3:3] = 0:
// - 0: 4bpp BgColor0[3:0]
// - 0: 4bpp BG_COLORor0[3:0]
// - 1: 4bpp ColorData[2:0]
// GfxData Pixel Shifter (2) if ColorData[3:3] = 1:
// - 00: 4bpp BgColor0[3:0]
// - 01: 4bpp BgColor1[3:0]
// - 10: 4bpp BgColor2[3:0]
// - 00: 4bpp BG_COLORor0[3:0]
// - 01: 4bpp BG_COLORor1[3:0]
// - 10: 4bpp BG_COLORor2[3:0]
// - 11: 4bpp ColorData[2:0]// Standard Character Mode (LINEAR/HICOL/CHUNK/COLDIS/ECM/MCM/BMM = 0)
void mode_mcchar() {
byte* const SCREEN = $8000;
@ -318,10 +318,10 @@ void mode_mcchar() {
DTV_PALETTE[i] = DTV_PALETTE_DEFAULT[i];
}
// Screen colors
*BORDERCOL = 0;
*BGCOL1 = BLACK;
*BGCOL2 = GREEN;
*BGCOL3 = BLUE;
*BORDER_COLOR = 0;
*BG_COLOR = BLACK;
*BG_COLOR1 = GREEN;
*BG_COLOR2 = BLUE;
// Char Colors and screen chars
byte* col=COLORS;
byte* ch=SCREEN;
@ -364,8 +364,8 @@ void mode_stdbitmap() {
DTV_PALETTE[i] = DTV_PALETTE_DEFAULT[i];
}
// Screen colors
*BGCOL = BLACK;
*BORDERCOL = BLACK;
*BG_COLOR = BLACK;
*BORDER_COLOR = BLACK;
// Bitmap Colors
byte* ch=SCREEN;
for(byte cy: 0..24 ) {
@ -393,7 +393,7 @@ void mode_stdbitmap() {
// Normal VIC Adressing:
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
// Pixel Shifter (1)
// - 0: 8bpp BgColor0[7:0]
// - 0: 8bpp BG_COLORor0[7:0]
// - 1: 8bpp ColorData[7:0]
void mode_hicolstdchar() {
byte* const SCREEN = $8000;
@ -420,8 +420,8 @@ void mode_hicolstdchar() {
DTV_PALETTE[i] = i;
}
// Screen colors
*BGCOL = 0;
*BORDERCOL = 0;
*BG_COLOR = 0;
*BORDER_COLOR = 0;
// Char Colors and screen chars
byte* col=COLORS;
byte* ch=SCREEN;
@ -443,10 +443,10 @@ void mode_hicolstdchar() {
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & "00" & CharData[5:0] & RowCounter[2:0] )
// GfxData Pixel Shifter (1)
// - 0: 8bpp Background Color
// - CharData[7:6] 00: 8bpp BgColor0[7:0]
// - CharData[7:6] 01: 8bpp BgColor1[7:0]
// - CharData[7:6] 10: 8bpp BgColor2[7:0]
// - CharData[7:6] 11: 8bpp BgColor3[7:0]
// - CharData[7:6] 00: 8bpp BG_COLORor0[7:0]
// - CharData[7:6] 01: 8bpp BG_COLORor1[7:0]
// - CharData[7:6] 10: 8bpp BG_COLORor2[7:0]
// - CharData[7:6] 11: 8bpp BG_COLORor3[7:0]
// - 1: 8bpp ColorData[7:0]
void mode_hicolecmchar() {
byte* const SCREEN = $8000;
@ -473,11 +473,11 @@ void mode_hicolecmchar() {
DTV_PALETTE[i] = i;
}
// Screen colors
*BORDERCOL = 0;
*BGCOL1 = $50;
*BGCOL2 = $54;
*BGCOL3 = $58;
*BGCOL4 = $5c;
*BORDER_COLOR = 0;
*BG_COLOR = $50;
*BG_COLOR1 = $54;
*BG_COLOR2 = $58;
*BG_COLOR3 = $5c;
// Char Colors and screen chars
byte* col=COLORS;
byte* ch=SCREEN;
@ -497,12 +497,12 @@ void mode_hicolecmchar() {
// Normal VIC Adressing:
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
//GfxData Pixel Shifter (1) if ColorData[3:3] = 0:
// - 0: 8bpp BgColor0[7:0]
// - 0: 8bpp BG_COLORor0[7:0]
// - 1: 8bpp ColorData[7:4] "0" & Color[2:0]
//GfxData Pixel Shifter (2) if ColorData[3:3] = 1:
// - 00: 8bpp BgColor0[7:0]
// - 01: 8bpp BgColor1[7:0]
// - 10: 8bpp BgColor2[7:0]
// - 00: 8bpp BG_COLORor0[7:0]
// - 01: 8bpp BG_COLORor1[7:0]
// - 10: 8bpp BG_COLORor2[7:0]
// - 11: 8bpp ColorData[7:4] "0" & Color[2:0]
void mode_hicolmcchar() {
byte* const SCREEN = $8000;
@ -529,10 +529,10 @@ void mode_hicolmcchar() {
DTV_PALETTE[i] = i;
}
// Screen colors
*BORDERCOL = 0;
*BGCOL1 = $50;
*BGCOL2 = $54;
*BGCOL3 = $58;
*BORDER_COLOR = 0;
*BG_COLOR = $50;
*BG_COLOR1 = $54;
*BG_COLOR2 = $58;
// Char Colors and screen chars
byte* col=COLORS;
byte* ch=SCREEN;
@ -552,10 +552,10 @@ void mode_hicolmcchar() {
// Resolution: 320x200
// Linear Adressing
// GfxData/PlaneA Pixel Shifter (1), CharData/PlaneB Pixel Shifter (1):
// - Plane A = 0 Plane B = 0: 8bpp BgColor0[7:0]
// - Plane A = 0 Plane B = 0: 8bpp BG_COLORor0[7:0]
// - Plane A = 0 Plane B = 1: 8bpp "0000" & ColorData[7:4]
// - Plane A = 1 Plane B = 0: 8bpp "0000" & ColorData[3:0]
// - Plane A = 1 Plane B = 1: 8bpp BgColor1[7:0]
// - Plane A = 1 Plane B = 1: 8bpp BG_COLORor1[7:0]
void mode_twoplanebitmap() {
byte* const PLANEA = $4000;
byte* const PLANEB = $6000;
@ -588,9 +588,9 @@ void mode_twoplanebitmap() {
DTV_PALETTE[i] = i;
}
// Screen colors
*BORDERCOL = $00;
*BGCOL1 = $70; // Color for bits 00
*BGCOL2 = $d4; // Color for bits 11
*BORDER_COLOR = $00;
*BG_COLOR = $70; // Color for bits 00
*BG_COLOR1 = $d4; // Color for bits 11
// Colors for bits 01 / 10
byte* col=COLORS;
for(byte cy: 0..24 ) {
@ -658,7 +658,7 @@ void mode_sixsfred() {
DTV_PALETTE[i] = i;
}
// Screen colors
*BORDERCOL = $00;
*BORDER_COLOR = $00;
// Colors for high 4 bits of 8bpp
byte* col=COLORS;
for(byte cy: 0..24 ) {
@ -724,7 +724,7 @@ void mode_sixsfred2() {
DTV_PALETTE[i] = i;
}
// Screen colors
*BORDERCOL = $00;
*BORDER_COLOR = $00;
// Colors for high 4 bits of 8bpp
byte* col=COLORS;
for(byte cy: 0..24 ) {
@ -788,7 +788,7 @@ void mode_8bpppixelcell() {
*DTV_PLANEB_MODULO_LO = 0;
*DTV_PLANEB_MODULO_HI = 0;
// Border color
*BORDERCOL = $00;
*BORDER_COLOR = $00;
// DTV Palette - Grey Tones
for(byte i : 0..$f) {
DTV_PALETTE[i] = i;
@ -849,7 +849,7 @@ void mode_8bppchunkybmm() {
*DTV_PLANEB_MODULO_LO = 0;
*DTV_PLANEB_MODULO_HI = 0;
// Border color
*BORDERCOL = $00;
*BORDER_COLOR = $00;
// DTV Palette - Grey Tones
for(byte i : 0..$f) {
DTV_PALETTE[i] = i;

View File

@ -10,10 +10,10 @@ void main() {
byte sumb = min+max;
byte midb = (sumb>>1)+1;
SCREEN[1] = midb;
byte* BGCOL = $d021;
byte* BG_COLOR = $d021;
if(SCREEN[0]==SCREEN[1]) {
*BGCOL = 5;
*BG_COLOR = 5;
} else {
*BGCOL = 2;
*BG_COLOR = 2;
}
}

View File

@ -1,5 +1,5 @@
byte* BORDERCOL = $d020;
byte* BORDER_COLOR = $d020;
byte* RASTER = $d012;
byte DARK_GREY = $b;
byte BLACK = 0;
@ -13,7 +13,7 @@ void main() {
volatile byte irq_raster_next = 0;
interrupt(hardware_clobber) void irq() {
*BORDERCOL = DARK_GREY;
*BORDER_COLOR = DARK_GREY;
irq_raster_next += 21;
// Setup next interrupt
byte raster_next = irq_raster_next;
@ -21,5 +21,5 @@ interrupt(hardware_clobber) void irq() {
raster_next -=1;
}
*RASTER = raster_next;
*BORDERCOL = BLACK;
*BORDER_COLOR = BLACK;
}

View File

@ -4,7 +4,7 @@
#pragma link("ataritempest.ld")
char* const BGCOL = 0xc01a;
char* const BG_COLOR = 0xc01a;
#pragma data_seg(RomData)
char MESSAGE[] = "hello world";
@ -17,11 +17,11 @@ void entryPoint() {
}
void interrupt(HARDWARE_ALL) nmiHandler() {
(*BGCOL)++;
(*BG_COLOR)++;
}
void main() {
(*BGCOL)++;
(*BG_COLOR)++;
}
#pragma data_seg(Vectors)

View File

@ -181,7 +181,7 @@ void processChars() {
// Enable the sprite
*SPRITES_ENABLE |= bitmask;
// Set the sprite color
SPRITES_COLS[processing->id] = processing->col;
SPRITES_COLOR[processing->id] = processing->col;
// Set sprite pointer
*(SCREEN+SPRITE_PTRS+processing->id) = processing->ptr;
// Set status
@ -274,7 +274,7 @@ void initSprites() {
for( char* sp = SPRITE_DATA; sp<SPRITE_DATA+NUM_PROCESSING*64; sp++) *sp = 0;
// Initialize sprite registers
for( char i: 0..7) {
SPRITES_COLS[i] = LIGHT_BLUE;
SPRITES_COLOR[i] = LIGHT_BLUE;
}
*SPRITES_MC = 0;
*SPRITES_EXPAND_X = 0;
@ -308,11 +308,11 @@ const char RASTER_IRQ_TOP = 0x30;
interrupt(hardware_all) void irqTop() {
if(DEBUG) {
for( char i: 0..4) {}
*BORDERCOL = WHITE;
*BGCOL = WHITE;
*BORDER_COLOR = WHITE;
*BG_COLOR = WHITE;
for( char i: 0..7) {}
*BORDERCOL = LIGHT_BLUE;
*BGCOL = BLUE;
*BORDER_COLOR = LIGHT_BLUE;
*BG_COLOR = BLUE;
}
// Trigger IRQ at the middle of the screen
@ -328,13 +328,13 @@ const char RASTER_IRQ_MIDDLE = 0xff;
interrupt(hardware_all) void irqBottom() {
if(DEBUG) {
for( char i: 0..4) {}
*BORDERCOL = WHITE;
*BGCOL = WHITE;
*BORDER_COLOR = WHITE;
*BG_COLOR = WHITE;
}
processChars();
if(DEBUG) {
*BORDERCOL = LIGHT_BLUE;
*BGCOL = BLUE;
*BORDER_COLOR = LIGHT_BLUE;
*BG_COLOR = BLUE;
}
// Trigger IRQ at the top of the screen

View File

@ -18,7 +18,7 @@ char MEDUSA_COLORS[] = kickasm(resource "medusac.prg" ) {{
byte* SCREEN = 0x0400;
void main() {
*BGCOL = BLACK;
*BG_COLOR = BLACK;
memcpy(SCREEN, MEDUSA_SCREEN, 1000);
memcpy(COLS, MEDUSA_COLORS, 1000);
while(true) {

View File

@ -70,7 +70,7 @@ void main() {
// Render Grid of BOBs
while(true) {
do { } while (*RASTER<$f8);
*BORDERCOL = 0xf;
*BORDER_COLOR = 0xf;
renderBobCleanup();
int rowX = origX;
int rowY = origY;
@ -79,18 +79,18 @@ void main() {
int y = rowY;
for(char row: 0..4) {
//kickasm {{ .break }}
*BORDERCOL = 1;
*BORDER_COLOR = 1;
renderBob(>x, >y);
x += rowOffsetX;
y += rowOffsetY;
*BORDERCOL = 2;
*BORDER_COLOR = 2;
}
rowX += colOffsetX;
rowY += colOffsetY;
}
origX += 0x0100;
rowOffsetY += 0x0080;
*BORDERCOL = 0;
*BORDER_COLOR = 0;
if(keyboard_key_pressed(KEY_SPACE)) {
break;
}

View File

@ -80,22 +80,22 @@ void main() {
char angle = 0;
while(true) {
do { } while (*RASTER<$f8);
*BORDERCOL = 0xf;
*BORDER_COLOR = 0xf;
renderBobCleanup();
signed char r = 30;
char a = angle;
for(char i: 0..NUM_BOBS-1) {
//kickasm {{ .break }}
*BORDERCOL = 1;
*BORDER_COLOR = 1;
int x = mulf8s(r, COS[a]) + 75*0x100;
int y = mulf8s(r, SIN[a])*2 + 90*0x100;
*BORDERCOL = 2;
*BORDER_COLOR = 2;
a += 98;
r += 3;
renderBob(>x, >y);
}
angle += 3;
*BORDERCOL = 0;
*BORDER_COLOR = 0;
if(keyboard_key_pressed(KEY_SPACE)) {
break;
}

View File

@ -51,7 +51,7 @@ void init() {
// Enable & initialize sprites
*SPRITES_ENABLE = 0xff;
for(char i: 0..7) {
SPRITES_COLS[i] = GREEN;
SPRITES_COLOR[i] = GREEN;
}
mulf_init();
// Clear screen
@ -70,12 +70,12 @@ void loop() {
char angle = 0;
while(true) {
do { } while (*RASTER<0xd8);
*BORDERCOL = 0xf;
*BORDER_COLOR = 0xf;
signed char r = 30;
char a = angle;
for(char i: 0..NUM_BOBS-1) {
//kickasm {{ .break }}
*BORDERCOL = 6;
*BORDER_COLOR = 6;
int x = mulf8s(r, COS[a])*2 + 125*0x100;
PLEX_XPOS[i] = >x;
int y = mulf8s(r, SIN[a])*2 + 125*0x100;
@ -83,21 +83,21 @@ void loop() {
a += 98;
r += 3;
}
*BORDERCOL = 3;
*BORDER_COLOR = 3;
plexSort();
angle += 3;
*BORDERCOL = BLACK;
*BORDER_COLOR = BLACK;
// Sort the sprites by y-position
while((*D011&VIC_RST8)!=0) {}
// Show the sprites
for( char i: 0..PLEX_COUNT-1) {
*BORDERCOL = BLACK;
*BORDER_COLOR = BLACK;
char rasterY = plexFreeNextYpos();
while(*RASTER<rasterY) {}
(*BORDERCOL)++;
(*BORDER_COLOR)++;
plexShowSprite();
}
*BORDERCOL = BLACK;
*BORDER_COLOR = BLACK;
if(keyboard_key_pressed(KEY_SPACE)) {
break;
}

View File

@ -58,7 +58,7 @@ void main() {
// Enable & initialize sprites
*SPRITES_ENABLE = 0xff;
for(char s: 0..7) {
SPRITES_COLS[s] = WHITE;
SPRITES_COLOR[s] = WHITE;
}
// Move the sprites
@ -86,12 +86,12 @@ void main() {
while(!frame_done) {
}
frame_done = false;
//*BORDERCOL = RED;
//*BORDER_COLOR = RED;
// Move the sprites
plex_move();
// Sort the sprites by y-position
plexSort();
//*BORDERCOL = BLACK;
//*BORDER_COLOR = BLACK;
}
}
@ -138,7 +138,7 @@ volatile bool frame_done = false;
// Show sprites from the multiplexer, rescheduling the IRQ as many times as needed
interrupt(kernel_min) void plex_irq() {
asm { sei }
//*BORDERCOL = WHITE;
//*BORDER_COLOR = WHITE;
// Show sprites until finding one that should not be shown until a few raster lines later
char rasterY;
do {
@ -157,7 +157,7 @@ interrupt(kernel_min) void plex_irq() {
}
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
//*BORDERCOL = 0;
//*BORDER_COLOR = 0;
asm { cli }
}

View File

@ -27,7 +27,7 @@ void main() {
char s2 = s*2;
SPRITES_XPOS[s2] = xpos;
SPRITES_YPOS[s2] = ypos;
SPRITES_COLS[s] = s-3;
SPRITES_COLOR[s] = s-3;
PLAYFIELD_SPRITE_PTRS_1[s] = toSpritePtr(SIN_SPRITE);
xpos += 24;
ypos += 24;

View File

@ -51,11 +51,11 @@ void render_init() {
vicSelectGfxBank(PLAYFIELD_CHARSET);
// Enable Extended Background Color Mode
*D011 = VIC_ECM | VIC_DEN | VIC_RSEL | 3;
*BORDERCOL = BLACK;
*BGCOL1 = BLACK;
*BGCOL2 = PIECES_COLORS_1[0];
*BGCOL3 = PIECES_COLORS_2[0];
*BGCOL4 = GREY;
*BORDER_COLOR = BLACK;
*BG_COLOR = BLACK;
*BG_COLOR1 = PIECES_COLORS_1[0];
*BG_COLOR2 = PIECES_COLORS_2[0];
*BG_COLOR3 = GREY;
// Setup chars on the screens
render_screen_original(PLAYFIELD_SCREEN_1);
@ -85,8 +85,8 @@ void render_show() {
d018val = toD018(PLAYFIELD_SCREEN_2, PLAYFIELD_CHARSET);
}
*D018 = d018val;
*BGCOL2 = PIECES_COLORS_1[level];
*BGCOL3 = PIECES_COLORS_2[level];
*BG_COLOR1 = PIECES_COLORS_1[level];
*BG_COLOR2 = PIECES_COLORS_2[level];
render_screen_showing = render_screen_show;
}

View File

@ -28,7 +28,7 @@ void sprites_init() {
for(char s:0..3) {
char s2 = s*2;
SPRITES_XPOS[s2] = xpos;
SPRITES_COLS[s] = BLACK;
SPRITES_COLOR[s] = BLACK;
xpos = xpos+24;
}
}
@ -74,7 +74,7 @@ void sprites_irq_init() {
// Repeats 10 timers every 2 lines from line IRQ_RASTER_FIRST
// Utilizes duplicated gfx in the sprites to allow for some leeway in updating the sprite pointers
interrupt(hardware_clobber) void sprites_irq() {
//(*BGCOL)++;
//(*BG_COLOR)++;
// Clear decimal flag (because it is used by the score algorithm)
asm { cld }
// Place the sprites
@ -125,5 +125,5 @@ interrupt(hardware_clobber) void sprites_irq() {
// Acknowledge the IRQ and setup the next one
*IRQ_STATUS = IRQ_RASTER;
//(*BGCOL)--;
//(*BG_COLOR)--;
}

View File

@ -25,7 +25,7 @@ void main() {
while(true) {
// Wait for a frame to pass
while(*RASTER!=0xff) {}
//*BORDERCOL = render_screen_show/0x10;
//*BORDER_COLOR = render_screen_show/0x10;
// Update D018 to show the selected screen
render_show();
// Scan keyboard events
@ -36,7 +36,7 @@ void main() {
render = play_movement(key_event);
} else {
while(true) {
(*BORDERCOL)++;
(*BORDER_COLOR)++;
}
}
if(render!=0) {
@ -46,6 +46,6 @@ void main() {
render_score();
render_screen_swap();
}
//*BORDERCOL = 0;
//*BORDER_COLOR = 0;
}
}

View File

@ -10,7 +10,7 @@
char* const RASTER = 0xd012;
char* const VIC_MEMORY = 0xd018;
char* const SCREEN = 0x0400;
char* const BGCOL = 0xd021;
char* const BG_COLOR = 0xd021;
char* const COLS = 0xd800;
const char BLACK = 0;
const char WHITE = 1;
@ -32,9 +32,9 @@ void main() {
// Loop forever with 2 bars
while(true) {
if(*RASTER==54 || *RASTER==66) {
*BGCOL = WHITE;
*BG_COLOR = WHITE;
} else {
*BGCOL = BLACK;
*BG_COLOR = BLACK;
}
}
}

View File

@ -2,12 +2,12 @@ byte* const SCREEN = $0400;
const byte STAR = 81;
byte* VIC = $d000;
byte* BGCOL = VIC+$10*2+1;
byte* BG_COLOR = VIC+$10*2+1;
byte RED = 2;
void main() {
*SCREEN = STAR;
*BGCOL = RED;
*BG_COLOR = RED;
for(byte i: 40..79) {
SCREEN[i] = (STAR+1);
}

View File

@ -1,11 +1,11 @@
#include <print.h>
byte* const BGCOL = $d021;
byte* const BG_COLOR = $d021;
const byte GREEN = 5;
const byte RED = 2 ;
void main() {
print_cls();
*BGCOL = GREEN;
*BG_COLOR = GREEN;
test_bytes();
test_sbytes();
}
@ -24,7 +24,7 @@ void assert_byte(byte* msg, byte b, byte c) {
print_str(msg);
print_str(" ");
if(b!=c) {
*BGCOL = RED;
*BG_COLOR = RED;
print_str("fail!");
} else {
print_str("ok");
@ -50,7 +50,7 @@ void assert_sbyte(byte* msg, signed byte b, signed byte c) {
print_str(msg);
print_str(" ");
if(b!=c) {
*BGCOL = RED;
*BG_COLOR = RED;
print_str("fail!");
} else {
print_str("ok");

View File

@ -2,5 +2,5 @@
#include "imported.c"
void main() {
*BGCOL = RED;
*BG_COLOR = RED;
}

View File

@ -161,7 +161,7 @@ void sprites_init() {
char* sprites_ptr = SCREEN+$3f8;
for(char i: 0..7) {
sprites_ptr[i] = (char)(SPRITE/$40);
SPRITES_COLS[i] = GREEN; //8+i;
SPRITES_COLOR[i] = GREEN; //8+i;
}
}

View File

@ -34,7 +34,7 @@ void main() {
// Show the loaded sprite on screen
VICII->SPRITES_ENABLE = %00000001;
SPRITES_PTR[0] = toSpritePtr(LOAD_SPRITE);
SPRITES_COLS[0] = GREEN;
SPRITES_COLOR[0] = GREEN;
SPRITES_XPOS[0] = 0x15;
SPRITES_YPOS[0] = 0x33;
}

View File

@ -6,15 +6,15 @@
#pragma link("linking.ld")
char* BGCOL = 0xd021;
char* BG_COLOR = 0xd021;
void main() {
for(char i:0..255)
base[i] = i;
while(true) {
fillscreen(*BGCOL);
(*BGCOL)++;
fillscreen(*BG_COLOR);
(*BG_COLOR)++;
}
}

View File

@ -42,7 +42,7 @@ void init() {
// Enable & initialize sprites
VICII->SPRITES_ENABLE = $ff;
for(char ss: 0..7) {
SPRITES_COLS[ss] = GREEN;
SPRITES_COLOR[ss] = GREEN;
}
}

View File

@ -29,7 +29,7 @@ void init() {
char* sprites_ptr = SCREEN+$3f8;
for(char i: 0..7) {
sprites_ptr[i] = (char)(SPRITE/$40);
SPRITES_COLS[i] = GREEN;
SPRITES_COLOR[i] = GREEN;
}
}

View File

@ -112,7 +112,7 @@ void place_sprites() {
sprites_ptr[j] = spr_id++;
SPRITES_XPOS[j2] = spr_x;
SPRITES_YPOS[j2] = 80;
SPRITES_COLS[j] = col;
SPRITES_COLOR[j] = col;
spr_x = spr_x + 32;
col = col^($7^$5);
j2++;

View File

@ -5,7 +5,7 @@
#pragma link("zpcode.ld")
char* RASTER = 0xd012;
char* BGCOL = 0xd020;
char* BG_COLOR = 0xd020;
void main() {
asm { sei }
@ -20,14 +20,14 @@ void main() {
loop();
// Call code on zeropage
zpLoop();
*BGCOL = 0;
*BG_COLOR = 0;
}
}
// Code in "normal" memory
void loop() {
for(char i:0..100) {
(*BGCOL)--;
(*BG_COLOR)--;
}
}
@ -41,6 +41,6 @@ char zpCodeData[] = kickasm {{
#pragma code_seg(ZpCode)
void zpLoop() {
for(char i:0..100) {
(*BGCOL)++;
(*BG_COLOR)++;
}
}

View File

@ -15,11 +15,11 @@ void main() {
}
void fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
}
void fn2() {
byte* const BGCOL = $d021;
(*BGCOL)++;
byte* const BG_COLOR = $d021;
(*BG_COLOR)++;
}

View File

@ -25,11 +25,11 @@ ff:
}}
void fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
}
void fn2() {
byte* const BGCOL = $d021;
(*BGCOL)++;
byte* const BG_COLOR = $d021;
(*BG_COLOR)++;
}

View File

@ -18,11 +18,11 @@ void main() {
}
void fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
}
void fn2() {
byte* const BGCOL = $d021;
(*BGCOL)++;
byte* const BG_COLOR = $d021;
(*BG_COLOR)++;
}

View File

@ -16,11 +16,11 @@ void()* getfn(byte b) {
}
void fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
}
void fn2() {
byte* const BGCOL = $d021;
(*BGCOL)++;
byte* const BG_COLOR = $d021;
(*BG_COLOR)++;
}

View File

@ -12,7 +12,7 @@ void()* getfn(byte b) {
}
void fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
}

View File

@ -1,13 +1,13 @@
// Tests calling into arrays of pointers to non-args no-return functions
void fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
}
void fn2() {
byte* const BGCOL = $d021;
(*BGCOL)++;
byte* const BG_COLOR = $d021;
(*BG_COLOR)++;
}
void()* fns[2] = { &fn1, &fn2 };

View File

@ -1,8 +1,8 @@
// Tests creating, assigning and calling pointers to non-args no-return functions
void fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
}
void main() {

View File

@ -14,11 +14,11 @@ void main() {
}
void fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
}
void fn2() {
byte* const BGCOL = $d021;
(*BGCOL)++;
byte* const BG_COLOR = $d021;
(*BG_COLOR)++;
}

View File

@ -18,13 +18,13 @@ void main() {
}
byte fn1() {
byte* const BORDERCOL = $d020;
(*BORDERCOL)++;
return *BORDERCOL;
byte* const BORDER_COLOR = $d020;
(*BORDER_COLOR)++;
return *BORDER_COLOR;
}
byte fn2() {
byte* const BGCOL = $d021;
(*BGCOL)++;
return *BGCOL;
byte* const BG_COLOR = $d021;
(*BG_COLOR)++;
return *BG_COLOR;
}

View File

@ -1,7 +1,7 @@
// Test setting the program PC through a #pc directive
byte* const BGCOL = 0xd021;
byte* const BG_COLOR = 0xd021;
byte* const RASTER = 0xd012;
#pragma pc(0x1000)
@ -12,12 +12,12 @@ void main() {
if(*RASTER<30)
incScreen();
else
*BGCOL = 0;
*BG_COLOR = 0;
}
}
#pragma pc(0x2000)
void incScreen() {
*BGCOL = *RASTER;
*BG_COLOR = *RASTER;
}

View File

@ -2,14 +2,14 @@
#pragma pc(0x1000)
byte* const BGCOL = 0xd021;
byte* const BG_COLOR = 0xd021;
byte* const RASTER = 0xd012;
void main() {
asm { sei }
while(true) {
byte col = *RASTER;
*BGCOL = col;
*BG_COLOR = col;
}
}

View File

@ -2,7 +2,7 @@
unsigned char * const control = 0xd011;
unsigned char * const raster = 0xd012;
unsigned char * const bordercol = 0xd020;
unsigned char * const BORDER_COLOR = 0xd020;
void main() {
asm { sei }
@ -12,15 +12,15 @@ void main() {
unsigned char rst = (*control&0x80)|(*raster>>1);
} while (rst!=0x30);
unsigned char *screen = 0x0400;
*bordercol = 1;
*BORDER_COLOR = 1;
unsigned char time_start = *raster;
utoa16w(00000, screen); (*bordercol)++; screen += 40;
utoa16w(01234, screen); (*bordercol)++; screen += 40;
utoa16w(05678, screen); (*bordercol)++; screen += 40;
utoa16w(09999, screen); (*bordercol)++; screen += 40;
utoa16w(00000, screen); (*BORDER_COLOR)++; screen += 40;
utoa16w(01234, screen); (*BORDER_COLOR)++; screen += 40;
utoa16w(05678, screen); (*BORDER_COLOR)++; screen += 40;
utoa16w(09999, screen); (*BORDER_COLOR)++; screen += 40;
utoa16w(58888, screen);
unsigned char time_end = *raster;
*bordercol = 0;
*BORDER_COLOR = 0;
unsigned char time = time_end - time_start;
utoa10w((unsigned int)time, screen+80);
byte msg[] = "raster lines";

View File

@ -1,2 +1,2 @@
byte * const BGCOL = $d021;
byte * const BG_COLOR = $d021;
const byte RED = 2;

View File

@ -3,5 +3,5 @@
void main() {
byte* screen = $0400;
*screen = 1;
*BGCOL = RED;
*BG_COLOR = RED;
}

View File

@ -1,10 +1,10 @@
// Incrementing / decrementing pointer content should result in code modifying the memory location - eg. inc $d020.
// Currently it does not but instead leads to just reading the value a few times.
byte* BGCOL = $d020;
byte* BG_COLOR = $d020;
void main() {
do {
++*BGCOL;
(*BGCOL)--;
++*BG_COLOR;
(*BG_COLOR)--;
} while (true);
}

View File

@ -3,7 +3,7 @@
byte* RASTER = $d012;
byte* D018 = $d018;
byte* BGCOL = $d021;
byte* BG_COLOR = $d021;
byte* screen = $0400;
byte* charset1 = $1000;
@ -14,10 +14,10 @@ void main() {
while(true) {
while(*RASTER!=$ff) {}
*D018 = toD018(screen, charset1);
*BGCOL = $6;
*BG_COLOR = $6;
while(*RASTER!=$62) {}
*D018 = toD018(screen, charset2);
*BGCOL = $b;
*BG_COLOR = $b;
}
}

View File

@ -17,7 +17,7 @@ void main() {
*HARDWARE_IRQ = &irq;
asm { cli }
while(true) {
(*BORDERCOL)++;
(*BORDER_COLOR)++;
}
}
@ -27,8 +27,8 @@ interrupt(hardware_clobber) void irq() {
}
void do_irq() {
*BGCOL = WHITE;
*BGCOL = BLACK;
*BG_COLOR = WHITE;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -10,7 +10,7 @@ const byte IRQ_RASTER = %00000001;
const byte IRQ_COLLISION_BG = %00000010;
const byte IRQ_COLLISION_SPRITE = %00000100;
const byte IRQ_LIGHTPEN = %00001000;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
byte* const FGCOL = $d021;
const byte WHITE = 1;
const byte BLACK = 0;
@ -51,8 +51,8 @@ void main() {
// Interrupt Routine
interrupt(hardware_clobber) void irq() {
*BGCOL = WHITE;
*BGCOL = BLACK;
*BG_COLOR = WHITE;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -10,7 +10,7 @@ const byte IRQ_RASTER = %00000001;
const byte IRQ_COLLISION_BG = %00000010;
const byte IRQ_COLLISION_SPRITE = %00000100;
const byte IRQ_LIGHTPEN = %00001000;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
byte* const FGCOL = $d021;
const byte WHITE = 1;
const byte BLACK = 0;
@ -51,8 +51,8 @@ void main() {
// Interrupt Routine
interrupt(hardware_stack) void irq() {
*BGCOL = WHITE;
*BGCOL = BLACK;
*BG_COLOR = WHITE;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -10,7 +10,7 @@ const byte IRQ_RASTER = %00000001;
const byte IRQ_COLLISION_BG = %00000010;
const byte IRQ_COLLISION_SPRITE = %00000100;
const byte IRQ_LIGHTPEN = %00001000;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
byte* const FGCOL = $d021;
const byte WHITE = 1;
const byte BLACK = 0;
@ -51,8 +51,8 @@ void main() {
// Interrupt Routine
interrupt(hardware_all) void irq() {
*BGCOL = WHITE;
*BGCOL = BLACK;
*BG_COLOR = WHITE;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -11,6 +11,6 @@ void main() {
// The Interrupt Handler
interrupt(kernel_keyboard) void irq() {
*BGCOL = WHITE;
*BGCOL = BLACK;
*BG_COLOR = WHITE;
*BG_COLOR = BLACK;
}

View File

@ -9,7 +9,7 @@ const byte IRQ_RASTER = %00000001;
const byte IRQ_COLLISION_BG = %00000010;
const byte IRQ_COLLISION_SPRITE = %00000100;
const byte IRQ_LIGHTPEN = %00001000;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
const byte WHITE = 1;
const byte BLACK = 0;
@ -32,8 +32,8 @@ void main() {
// Interrupt Routine
interrupt(kernel_keyboard) void irq() {
*BGCOL = WHITE;
*BGCOL = BLACK;
*BG_COLOR = WHITE;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -6,7 +6,7 @@ byte* const VIC_CONTROL = $d011;
byte* const IRQ_STATUS = $d019;
byte* const IRQ_ENABLE = $d01a;
const byte IRQ_RASTER = %00000001;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
byte* const FGCOL = $d021;
byte* const CIA1_INTERRUPT = $dc0d;
@ -36,7 +36,7 @@ void main() {
}
interrupt(kernel_min) void irq() {
(*BGCOL)++;
(*BG_COLOR)++;
for( byte i: 0..10 )
for( byte j: 0..10 )
for( byte k: 0..10 ) {
@ -44,19 +44,19 @@ interrupt(kernel_min) void irq() {
sub_irq();
}
*IRQ_STATUS = IRQ_RASTER;
(*BGCOL)--;
(*BG_COLOR)--;
}
void sub_main() {
for( byte i: 0..10 )
for( byte j: 0..10 )
for( byte k: 0..10 )
*BGCOL = i+j+k;
*BG_COLOR = i+j+k;
}
void sub_irq() {
for( byte i: 0..10 )
for( byte j: 0..10 )
for( byte k: 0..10 )
*BGCOL = i+j+k;
*BG_COLOR = i+j+k;
}

View File

@ -9,7 +9,7 @@ const byte IRQ_RASTER = %00000001;
const byte IRQ_COLLISION_BG = %00000010;
const byte IRQ_COLLISION_SPRITE = %00000100;
const byte IRQ_LIGHTPEN = %00001000;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
const byte WHITE = 1;
const byte BLACK = 0;
@ -32,8 +32,8 @@ void main() {
// Interrupt Routine
interrupt void irq() {
*BGCOL = WHITE;
*BGCOL = BLACK;
*BG_COLOR = WHITE;
*BG_COLOR = BLACK;
// Acknowledge the IRQ
*IRQ_STATUS = IRQ_RASTER;
}

View File

@ -7,7 +7,7 @@ byte* const VIC_CONTROL = $d011;
byte* const IRQ_STATUS = $d019;
byte* const IRQ_ENABLE = $d01a;
const byte IRQ_RASTER = %00000001;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
byte* const CIA1_INTERRUPT = $dc0d;
const byte CIA_INTERRUPT_CLEAR = $7f;
@ -34,10 +34,10 @@ void main() {
volatile bool framedone = false;
interrupt(kernel_min) void irq() {
(*BGCOL)++;
(*BG_COLOR)++;
*IRQ_STATUS = IRQ_RASTER;
if (*RASTER>50) {
framedone = false;
}
(*BGCOL)--;
(*BG_COLOR)--;
}

View File

@ -2,14 +2,14 @@
// The glitch is caused by the "normal" C64 interrupt occuring just as the keyboard is read.
// Press "I" to disable interrupts (red border)
// Press "E" to enable interrupts (green border)
// Press "C" to enter pressed state (increaded bgcol) - and "SPACE" to leave presssed state again.
// Press "C" to enter pressed state (increaded BG_COLOR) - and "SPACE" to leave presssed state again.
// Holding SPACE will sometimes trigger the pressed state when normal interrupts are enabled (green border)
// but never when they are disabled (red border)
#include <keyboard.h>
#include <c64.h>
void main() {
*BORDERCOL = GREEN;
*BORDER_COLOR = GREEN;
while(true) {
menu();
}
@ -25,12 +25,12 @@ void menu() {
return;
}
if(keyboard_key_pressed(KEY_I)!=0) {
*BORDERCOL = RED;
*BORDER_COLOR = RED;
asm { sei }
return;
}
if(keyboard_key_pressed(KEY_E)!=0) {
*BORDERCOL = GREEN;
*BORDER_COLOR = GREEN;
asm { cli }
return;
}
@ -39,7 +39,7 @@ void menu() {
}
void pressed() {
(*BGCOL)++;
(*BG_COLOR)++;
// Wait for key press
while(true) {
if(keyboard_key_pressed(KEY_SPACE)!=0) {

View File

@ -2,7 +2,7 @@
// The vector used when the KERNAL serves IRQ interrupts
void()** const KERNEL_IRQ = $0314;
byte* const BGCOL = $d021;
byte* const BG_COLOR = $d021;
const byte BLACK = $0;
const byte WHITE = $1;
@ -21,8 +21,8 @@ void main() {
// The Interrupt Handler
interrupt(kernel_keyboard) void irq() {
*BGCOL = WHITE;
*BGCOL = BLACK;
*BG_COLOR = WHITE;
*BG_COLOR = BLACK;
}

View File

@ -47,7 +47,7 @@ void main() {
}
while(true) {
while(*RASTER!=$ff) {}
(*BORDERCOL)++;
(*BORDER_COLOR)++;
}
}

View File

@ -1,16 +1,16 @@
// Tests anonymous scopes inside functions
byte* const BGCOL = $d021;
byte* const BG_COLOR = $d021;
void main() {
{
byte i = 0;
*BGCOL = i;
*BG_COLOR = i;
}
{
byte i = 1;
*BGCOL = i;
*BG_COLOR = i;
}
}

View File

@ -1,7 +1,7 @@
// Tests that long branch fixing works with interrupt exits (to $ea81)
void()** const KERNEL_IRQ = $0314;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
volatile byte col = 0;
void main() {
@ -17,7 +17,7 @@ interrupt(kernel_min) void irq() {
asm {
lda $dc0d
}
*BGCOL = col;
*BG_COLOR = col;
if(col!=0) {
col++;
}

View File

@ -1,4 +1,4 @@
byte* const BORDERCOL = $d020;
byte* const BORDER_COLOR = $d020;
byte* const SCREEN = $0400;
void main() {
@ -14,11 +14,11 @@ void print_cls() {
void mode_ctrl() {
while(true) {
byte before = *BORDERCOL;
byte before = *BORDER_COLOR;
if(before==$ff) {
*BORDERCOL = 2;
*BORDER_COLOR = 2;
} else {
*BORDERCOL = 3;
*BORDER_COLOR = 3;
}
}
}

View File

@ -7,6 +7,6 @@
void main() {
dword result = mul16u(4,123);
word kaputt = <result;
*BORDERCOL = <kaputt;
*BGCOL = >kaputt;
*BORDER_COLOR = <kaputt;
*BG_COLOR = >kaputt;
}

View File

@ -1,7 +1,7 @@
#include <print.h>
byte* RASTER = $d012;
byte* BORDERCOL = $d020;
byte* BORDER_COLOR = $d020;
byte* SCREEN = $400;
void main() {
@ -11,9 +11,9 @@ void main() {
asm { sei }
while(true) {
while(*RASTER!=$ff) {}
(*BORDERCOL)++;
(*BORDER_COLOR)++;
dword r = mulf16u(a, b);
(*BORDERCOL)--;
(*BORDER_COLOR)--;
print_ulong(r);
print_set_screen(SCREEN);
}

View File

@ -36,7 +36,7 @@ void init() {
// Enable & initialize sprites
*SPRITES_ENABLE = 0xff;
for(char ss: 0..7) {
SPRITES_COLS[ss] = GREEN;
SPRITES_COLOR[ss] = GREEN;
}
// enable the interrupt
asm { sei }
@ -53,7 +53,7 @@ volatile bool framedone = true;
interrupt(kernel_min) void plex_irq() {
asm { sei }
*BORDERCOL = WHITE;
*BORDER_COLOR = WHITE;
char rasterY;
do {
plexShowSprite();
@ -66,7 +66,7 @@ interrupt(kernel_min) void plex_irq() {
*RASTER = 0x0;
framedone = true;
}
*BORDERCOL = 0;
*BORDER_COLOR = 0;
asm { cli }
}
@ -76,7 +76,7 @@ void loop() {
char sin_idx = 0;
while(true) {
while(!framedone) { }
*BORDERCOL = RED;
*BORDER_COLOR = RED;
// Assign sinus positions
char y_idx = sin_idx;
for(char sy: 0..PLEX_COUNT-1) {
@ -85,9 +85,9 @@ void loop() {
}
sin_idx +=1;
// Sort the sprites by y-position
(*BORDERCOL)++;
(*BORDER_COLOR)++;
plexSort();
*BORDERCOL = GREEN;
*BORDER_COLOR = GREEN;
framedone = false;
}

12
src/test/kc/multiply-1.c Normal file
View File

@ -0,0 +1,12 @@
// Test compile-time and run-time multiplication
// Compile-time multiplication
char * const SCREEN = 0x0400;
void main() {
char c1 = 4;
char c2 = c1*2;
c2++;
char c3 = c1*c2;
SCREEN[0] = c3;
}

15
src/test/kc/multiply-2.c Normal file
View File

@ -0,0 +1,15 @@
// Test compile-time and run-time multiplication
// var*const multiplication - converted to shift/add
char * const SCREEN = 0x0400;
void main() {
char i=0;
for(char c1=0;c1<5;c1++) {
// const*const
char c2 = 3*2+1;
// var*const
char c3 = c1*c2;
SCREEN[i++] = c3;
}
}

31
src/test/kc/multiply-3.c Normal file
View File

@ -0,0 +1,31 @@
// Test compile-time and run-time multiplication
// var*var multiplication - converted to call
char * const SCREEN = 0x0400;
void main() {
char i = 0;
for(char c1=0;c1<5;c1++) {
for(char c2=0;c2<5;c2++) {
// var*var
char c3 = (char)mul8u(c1,7);
char c4 = (char)mul8u(c2,5);
SCREEN[i++] = (char)mul8u(c3, c4);
}
}
}
// Perform binary multiplication of two unsigned 8-bit chars into a 16-bit unsigned int
unsigned int mul8u(__ma char a, __ma char b) {
unsigned int res = 0;
unsigned int mb = b;
while(a!=0) {
if( (a&1) != 0) {
res = res + mb;
}
a = a>>1;
mb = mb<<1;
}
return res;
}

View File

@ -3,7 +3,7 @@
void main() {
word* const screen = 0x0400;
byte* const bgcol = 0xd020;
byte* const BG_COLOR = 0xd020;
const byte RED = 2;
byte b1 = 250;
@ -11,6 +11,6 @@ void main() {
word w = b2+1;
screen[0] = w;
if((w)>255) *bgcol = RED;
if((w)>255) *BG_COLOR = RED;
}

View File

@ -28,8 +28,8 @@ void main() {
--*(byte*)($d000+$21);
// Increment on a const named pointer
byte* BGCOL = $d020;
++*BGCOL;
byte* BG_COLOR = $d020;
++*BG_COLOR;
}

View File

@ -32,11 +32,11 @@ void init() {
lda #$5b // as there are more than 256 rasterlines, the topmost bit of $d011 serves as
sta $d011 // the 8th bit for the rasterline we want our irq to be triggered.
}
*BORDERCOL = BLACK;
*BGCOL1 = BLACK;
*BGCOL2 = RED;
*BGCOL3 = BLUE;
*BGCOL4 = GREEN;
*BORDER_COLOR = BLACK;
*BG_COLOR = BLACK;
*BG_COLOR1 = RED;
*BG_COLOR2 = BLUE;
*BG_COLOR3 = GREEN;
}
void init_sprites() {
@ -44,7 +44,7 @@ void init_sprites() {
*SPRITES_EXPAND_X = 0;
*SPRITES_EXPAND_Y = 0;
*SPRITES_XMSB = 0;
*SPRITES_COLS = WHITE;
*SPRITES_COLOR = WHITE;
*SPRITES_MC = 0;
}

View File

@ -42,7 +42,7 @@ void main() {
byte bucket_idx = 0;
while(true) {
do { } while (*RASTER!=0xff);
(*BORDERCOL)++;
(*BORDER_COLOR)++;
word* bucket = BUCKETS[bucket_idx];
byte bucket_size = BUCKET_SIZES[bucket_idx];
if(bucket_size>0) {
@ -65,7 +65,7 @@ void main() {
// Found something to fill!
byte* fill = SCREEN_FILL+min_offset;
*fill = FILL_CHAR;
(*BORDERCOL)--;
(*BORDER_COLOR)--;
continue;
}
}
@ -73,10 +73,10 @@ void main() {
bucket_idx++;
if(bucket_idx==NUM_BUCKETS) {
// All buckets complete - exit loop!
(*BORDERCOL)--;
(*BORDER_COLOR)--;
break;
}
(*BORDERCOL)--;
(*BORDER_COLOR)--;
}
while(true)
(*(COLS+999))++;

View File

@ -19,7 +19,7 @@ void init() {
*SPRITES_EXPAND_Y = 0;
SPRITES_XPOS[0] = 100;
SPRITES_YPOS[0] = 100;
SPRITES_COLS[0] = WHITE;
SPRITES_COLOR[0] = WHITE;
SPRITES_PTR[0] = (byte)(SPRITE/$40);
for(byte* sc=SCREEN; sc!=SCREEN+1000; sc++ ) {
*sc = ' ';

View File

@ -14,7 +14,7 @@ void main() {
*SPRITES_ENABLE = 1;
SPRITES_XPOS[0] = 100;
SPRITES_YPOS[0] = 100;
SPRITES_COLS[0] = WHITE;
SPRITES_COLOR[0] = WHITE;
SPRITES[0] = toSpritePtr(SPRITE);
memset(SPRITE,0,64);
asm { jsr GENERATOR }

View File

@ -13,11 +13,11 @@ struct SCREEN_COLORS {
struct SCREEN_COLORS COLORS;
// The border color
char * const BORDERCOL = &COLORS.BORDER;
char * const BORDER_COLOR = &COLORS.BORDER;
// The background color
char * const BGCOL = &COLORS.BG0;
char * const BG_COLOR = &COLORS.BG0;
void main() {
*BORDERCOL = 0;
*BGCOL = 6;
*BORDER_COLOR = 0;
*BG_COLOR = 6;
}

View File

@ -13,11 +13,11 @@ struct SCREEN_COLORS {
struct SCREEN_COLORS* const COLORS = 0xd020;
// The border color
char * const BORDERCOL = &COLORS->BORDER;
char * const BORDER_COLOR = &COLORS->BORDER;
// The background color
char * const BGCOL = &COLORS->BG0;
char * const BG_COLOR = &COLORS->BG0;
void main() {
COLORS->BORDER = 0;
*BGCOL = 6;
*BG_COLOR = 6;
}

View File

@ -1,5 +1,5 @@
void()** const KERNEL_IRQ = $0314;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
byte* const FGCOL = $d021;
void main() {
@ -10,7 +10,7 @@ void main() {
}
interrupt void irq() {
(*BGCOL)++;
(*BG_COLOR)++;
asm {
lda $dc0d
}

View File

@ -2,7 +2,7 @@
// Currently fails because the modification is optimized away
void()** const KERNEL_IRQ = $0314;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
volatile byte col = 0;
void main() {
@ -18,7 +18,7 @@ interrupt(kernel_min) void irq() {
asm {
lda $dc0d
}
*BGCOL = col;
*BG_COLOR = col;
if(col!=0) {
col++;
} else {

View File

@ -1,5 +1,5 @@
void()** const KERNEL_IRQ = $0314;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
volatile byte col = 0;
void main() {
@ -13,5 +13,5 @@ interrupt(kernel_min) void irq() {
asm {
lda $dc0d
}
*BGCOL = col;
*BG_COLOR = col;
}

View File

@ -1,5 +1,5 @@
void()** const KERNEL_IRQ = $0314;
byte* const BGCOL = $d020;
byte* const BG_COLOR = $d020;
byte* const FGCOL = $d021;
void main() {
@ -10,7 +10,7 @@ void main() {
}
interrupt(kernel_min) void irq() {
(*BGCOL)++;
(*BG_COLOR)++;
asm {
lda $dc0d
}

View File

@ -3,10 +3,10 @@
byte* TABLE = $2000;
void main() {
byte* BORDERCOL = $d020;
byte* BORDER_COLOR = $d020;
byte i=0;
while(true) {
*BORDERCOL = TABLE[i++];
*BORDER_COLOR = TABLE[i++];
}
}

View File

@ -6,9 +6,9 @@ void main() {
while(true) {
do {} while (*RASTER!=$ff);
if(keyboard_key_pressed(KEY_SPACE)!=0) {
*BGCOL = GREEN;
*BG_COLOR = GREEN;
} else {
*BGCOL = BLUE;
*BG_COLOR = BLUE;
}
}
}

View File

@ -3,10 +3,10 @@
#include <multiply.h>
#include <fastmultiply.h>
byte* BGCOL = $d021;
byte* BG_COLOR = $d021;
void main() {
*BGCOL = 5;
*BG_COLOR = 5;
print_cls();
mulf_init();
mul16u_compare();
@ -61,7 +61,7 @@ void mul16u_compare() {
ok = 0;
}
if(ok==0) {
*BGCOL = 2;
*BG_COLOR = 2;
mul16u_error(a,b, ms, mn, mf);
return;
}
@ -106,7 +106,7 @@ void mul16s_compare() {
ok = 0;
}
if(ok==0) {
*BGCOL = 2;
*BG_COLOR = 2;
mul16s_error(a,b, ms, mn, mf);
return;
}

View File

@ -3,10 +3,10 @@
#include <multiply.h>
#include <fastmultiply.h>
byte* BGCOL = $d021;
byte* BG_COLOR = $d021;
void main() {
*BGCOL = 5;
*BG_COLOR = 5;
print_cls();
mulf_init();
mulf_init_asm();
@ -109,7 +109,7 @@ void mulf_tables_cmp() {
byte* asm_sqr = mula_sqr1_lo;
for( byte* kc_sqr=mulf_sqr1_lo; kc_sqr<mulf_sqr1_lo+512*4; kc_sqr++) {
if(*kc_sqr != *asm_sqr) {
*BGCOL = 2;
*BG_COLOR = 2;
print_str("multiply table mismatch at ");
print_uint((word)asm_sqr);
print_str(" / ");
@ -137,7 +137,7 @@ void mul8u_compare() {
ok = 0;
}
if(ok==0) {
*BGCOL = 2;
*BG_COLOR = 2;
mul8u_error(a,b, ms, mn, mf);
return;
}
@ -176,7 +176,7 @@ void mul8s_compare() {
ok = 0;
}
if(ok==0) {
*BGCOL = 2;
*BG_COLOR = 2;
mul8s_error(a,b, ms, mn, mf);
return;
}

View File

@ -9,11 +9,11 @@ void main() {
// Test the result
byte* pos = $501;
byte* bgcol = $d021;
byte* BG_COLOR = $d021;
if(*pos=='m') {
*bgcol = 5;
*BG_COLOR = 5;
} else {
*bgcol = 2;
*BG_COLOR = 2;
}
}

View File

@ -3,7 +3,7 @@ byte* const SCREEN = $0400;
byte b=2/2;
// unused vars
byte* const BGCOL = $d021;
byte* const BG_COLOR = $d021;
byte msg[] = "hello world";
byte arr[] = { 7, 8, 9};
byte c=1;

View File

@ -2,7 +2,7 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label BGCOL = $d020
.label BG_COLOR = $d020
main: {
// asm
jsr init
@ -11,9 +11,9 @@ main: {
}
// Function only used inside the inline asm
init: {
// *BGCOL = 0
// *BG_COLOR = 0
lda #0
sta BGCOL
sta BG_COLOR
// }
rts
}

Some files were not shown because too many files have changed in this diff Show More