mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-14 23:04:57 +00:00
fixed problem
This commit is contained in:
parent
8898dfb255
commit
fe29de28d5
@ -1,66 +1,66 @@
|
||||
// Illustrates a problem with a missing fragment - pbuc1_derefidx_vwuz1=vbuz2
|
||||
import "c64.kc"
|
||||
import "keyboard.kc"
|
||||
import "memory.kc"
|
||||
import "multiply.kc"
|
||||
|
||||
const byte* screen = $400;
|
||||
const byte* charset = $2000;
|
||||
const byte* tileset = $2800;
|
||||
const byte* colors = $d800;
|
||||
const byte* level_address = $3000;
|
||||
|
||||
void main() {
|
||||
init();
|
||||
for (byte x = 0; x < 16; x++ ){
|
||||
for (byte y = 0; y < 9; y++) {
|
||||
byte z = x+y;
|
||||
byte tile = level_address[z];
|
||||
draw_block(tile,x,y,YELLOW);
|
||||
}
|
||||
}
|
||||
do {
|
||||
} while(true);
|
||||
}
|
||||
|
||||
void init() {
|
||||
init_sprites();
|
||||
fill(screen,1000,0);
|
||||
fill(colors,1000,BLACK);
|
||||
*D018 = toD018(screen, charset);
|
||||
asm {
|
||||
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;
|
||||
}
|
||||
|
||||
void init_sprites() {
|
||||
*SPRITES_ENABLE = %00000001; // one sprite enabled
|
||||
*SPRITES_EXPAND_X = 0;
|
||||
*SPRITES_EXPAND_Y = 0;
|
||||
*SPRITES_XMSB = 0;
|
||||
*SPRITES_COLS = WHITE;
|
||||
*SPRITES_MC = 0;
|
||||
}
|
||||
|
||||
void draw_block(byte tileno, byte x, byte y, byte color) {
|
||||
tileno = tileno << 2;
|
||||
word x1 = x << 1;
|
||||
y = y << 1;
|
||||
word z = mul8u(y,40);
|
||||
z = z + x1;
|
||||
byte drawtile = tileset[tileno];
|
||||
screen[z] = drawtile;
|
||||
colors[z] = YELLOW;
|
||||
screen[z+1] = 1;
|
||||
colors[z+1] = YELLOW;
|
||||
screen[z+40] = 2;
|
||||
colors[z+40] = YELLOW;
|
||||
screen[z+41] = 3;
|
||||
colors[z+41] = YELLOW;
|
||||
// Illustrates a problem with a missing fragment - pbuc1_derefidx_vwuz1=vbuz2
|
||||
import "c64.kc"
|
||||
import "keyboard.kc"
|
||||
import "memory.kc"
|
||||
import "multiply.kc"
|
||||
|
||||
const byte* screen = $400;
|
||||
const byte* charset = $2000;
|
||||
const byte* tileset = $2800;
|
||||
const byte* colors = $d800;
|
||||
const byte* level_address = $3000;
|
||||
|
||||
void main() {
|
||||
init();
|
||||
for (byte x = 0; x < 16; x++ ){
|
||||
for (byte y = 0; y < 9; y++) {
|
||||
byte z = x+y;
|
||||
byte tile = level_address[z];
|
||||
draw_block(tile,x,y,YELLOW);
|
||||
}
|
||||
}
|
||||
do {
|
||||
} while(true);
|
||||
}
|
||||
|
||||
void init() {
|
||||
init_sprites();
|
||||
fill(screen,1000,0);
|
||||
fill(colors,1000,BLACK);
|
||||
*D018 = toD018(screen, charset);
|
||||
asm {
|
||||
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;
|
||||
}
|
||||
|
||||
void init_sprites() {
|
||||
*SPRITES_ENABLE = %00000001; // one sprite enabled
|
||||
*SPRITES_EXPAND_X = 0;
|
||||
*SPRITES_EXPAND_Y = 0;
|
||||
*SPRITES_XMSB = 0;
|
||||
*SPRITES_COLS = WHITE;
|
||||
*SPRITES_MC = 0;
|
||||
}
|
||||
|
||||
void draw_block(byte tileno, byte x, byte y, byte color) {
|
||||
tileno = tileno << 2;
|
||||
word x1 = x << 1;
|
||||
y = y << 1;
|
||||
word z = mul8u(y,40);
|
||||
z = z + x1;
|
||||
byte drawtile = tileset[tileno];
|
||||
screen[z] = drawtile;
|
||||
colors[z] = YELLOW;
|
||||
screen[z+1] = 1;
|
||||
colors[z+1] = YELLOW;
|
||||
screen[z+40] = 2;
|
||||
colors[z+40] = YELLOW;
|
||||
screen[z+41] = 3;
|
||||
colors[z+41] = YELLOW;
|
||||
}
|
Loading…
Reference in New Issue
Block a user