1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-08-14 22:27:37 +00:00

fixed problem

This commit is contained in:
jespergravgaard
2019-01-03 18:55:56 +01:00
parent 8898dfb255
commit fe29de28d5

View File

@@ -1,66 +1,66 @@
// Illustrates a problem with a missing fragment - pbuc1_derefidx_vwuz1=vbuz2 // Illustrates a problem with a missing fragment - pbuc1_derefidx_vwuz1=vbuz2
import "c64.kc" import "c64.kc"
import "keyboard.kc" import "keyboard.kc"
import "memory.kc" import "memory.kc"
import "multiply.kc" import "multiply.kc"
const byte* screen = $400; const byte* screen = $400;
const byte* charset = $2000; const byte* charset = $2000;
const byte* tileset = $2800; const byte* tileset = $2800;
const byte* colors = $d800; const byte* colors = $d800;
const byte* level_address = $3000; const byte* level_address = $3000;
void main() { void main() {
init(); init();
for (byte x = 0; x < 16; x++ ){ for (byte x = 0; x < 16; x++ ){
for (byte y = 0; y < 9; y++) { for (byte y = 0; y < 9; y++) {
byte z = x+y; byte z = x+y;
byte tile = level_address[z]; byte tile = level_address[z];
draw_block(tile,x,y,YELLOW); draw_block(tile,x,y,YELLOW);
} }
} }
do { do {
} while(true); } while(true);
} }
void init() { void init() {
init_sprites(); init_sprites();
fill(screen,1000,0); fill(screen,1000,0);
fill(colors,1000,BLACK); fill(colors,1000,BLACK);
*D018 = toD018(screen, charset); *D018 = toD018(screen, charset);
asm { asm {
lda #$5b // as there are more than 256 rasterlines, the topmost bit of $d011 serves as 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. sta $d011 // the 8th bit for the rasterline we want our irq to be triggered.
} }
*BORDERCOL = BLACK; *BORDERCOL = BLACK;
*BGCOL1 = BLACK; *BGCOL1 = BLACK;
*BGCOL2 = RED; *BGCOL2 = RED;
*BGCOL3 = BLUE; *BGCOL3 = BLUE;
*BGCOL4 = GREEN; *BGCOL4 = GREEN;
} }
void init_sprites() { void init_sprites() {
*SPRITES_ENABLE = %00000001; // one sprite enabled *SPRITES_ENABLE = %00000001; // one sprite enabled
*SPRITES_EXPAND_X = 0; *SPRITES_EXPAND_X = 0;
*SPRITES_EXPAND_Y = 0; *SPRITES_EXPAND_Y = 0;
*SPRITES_XMSB = 0; *SPRITES_XMSB = 0;
*SPRITES_COLS = WHITE; *SPRITES_COLS = WHITE;
*SPRITES_MC = 0; *SPRITES_MC = 0;
} }
void draw_block(byte tileno, byte x, byte y, byte color) { void draw_block(byte tileno, byte x, byte y, byte color) {
tileno = tileno << 2; tileno = tileno << 2;
word x1 = x << 1; word x1 = x << 1;
y = y << 1; y = y << 1;
word z = mul8u(y,40); word z = mul8u(y,40);
z = z + x1; z = z + x1;
byte drawtile = tileset[tileno]; byte drawtile = tileset[tileno];
screen[z] = drawtile; screen[z] = drawtile;
colors[z] = YELLOW; colors[z] = YELLOW;
screen[z+1] = 1; screen[z+1] = 1;
colors[z+1] = YELLOW; colors[z+1] = YELLOW;
screen[z+40] = 2; screen[z+40] = 2;
colors[z+40] = YELLOW; colors[z+40] = YELLOW;
screen[z+41] = 3; screen[z+41] = 3;
colors[z+41] = YELLOW; colors[z+41] = YELLOW;
} }