// Tests the simple bitmap plotter
// Plots a few lines using the bresenham line algorithm
import "c64"
import "bitmap2"
import "print"

byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;

byte[0x180] align(0x100) SINTAB = kickasm {{ .fill $180, 99.5+99.5*sin(i*2*PI/256) }};
byte* COSTAB = SINTAB+0x40;

void main() {
    bitmap_init(BITMAP, SCREEN);
    bitmap_clear(BLACK, WHITE);
    *D011 = VIC_BMM|VIC_DEN|VIC_RSEL|3;
    *D018 = toD018(SCREEN, BITMAP);
    for( byte i=0, a=0; i!=8; i++, a+=32) {
        bitmap_line( (word)COSTAB[a]+120, (word)SINTAB[a], (word)COSTAB[a+32]+120, (word)SINTAB[a+32]);
    }
    while(true)
        (*(SCREEN+999))++;
}
