program Display_multicolor_image;
var
/*
	Automatically export the image	
*/
	@export "resources/images/image1.flf" "resources/images/image1.bin" 0
// Image data and colour. Image at $6000
	const bitmapLocation : address = $6000;
	image_data: IncBin("resources/images/image1_data.bin", bitmapLocation);
	image_color: IncBin("resources/images/image1_color.bin", $8000);

	i:byte;

/*

// basically the same as the built-in method copyimagecolordatamanually

procedure CopyImageColordataManually();
var
  zp:pointer;
begin
	zp:=#image_color;
	screen_bg_col:=zp[0]; // first byte is border color
	zp+=1;
	screen_fg_col:=zp[0]; // 2nd byte is foreground color 
	zp+=1;
	copyfullscreen(zp,^$4400); // Copy first 1000 bytes (1 screen worth of data) to bank 1
	zp+=1000; // point to next screen 
	copyfullscreen(zp,#screen_col_loc); // copy 1 screen worth of data to color ram
end;
*/

begin
	preventirq();
	disableciainterrupts();
	// Enable RAM
	setmemoryconfig(0,1,1,1,0);
	// Set multicolor bitmap mode
	setmulticolormode();
	setbitmapmode();
	// Sets C128 bitmap location. Must be a multiple of $2000
	setbitmaplocation(#bitmapLocation);
	
	setbank(vic_bank1);
	
	CopyImageColordata(#image_color, 1);
	// Copy image color data from $5000 to $4400 (on bank 1) and $D800 
	screen_fg_col:=black;
	// Example of how to copy the color data manually
	
	Loop();

end.
