import "c64.kc"
import "bitmap-draw.kc"

const byte* SCREEN = $400;
const byte* BITMAP = $2000;

byte[] lines_x = { 60, 80, 110, 80, 60, 40, 10, 40, 60 };
byte[] lines_y = { 10, 40, 60, 80, 110, 80, 60, 40, 10 };
byte lines_cnt = 8;

void main() {
    *BORDERCOL = 0;
    *BGCOL = 0;
    *D011 = VIC_BMM|VIC_DEN|VIC_RSEL|3;
    *VIC_MEMORY =  (byte)((((word)SCREEN&$3fff)/$40)|(((word)BITMAP&$3fff)/$400));
    bitmap_init(BITMAP);
    bitmap_clear();
    init_screen();
    do {
        lines();
    } while (true);
}

void lines() {
    for(byte l=0; l<lines_cnt;l++) {
        bitmap_line(lines_x[l], lines_x[l+1], lines_y[l], lines_y[l+1]);
    }
}

void init_screen() {
    for(byte* c = SCREEN; c!=SCREEN+$400;c++) {
        *c = $14;
    }
}
