program Tutorial6_disc_files;
@use "screen"
@use "files"

// Init music player at 4C00
@define PLAYER_LOCATION 2
@use "player"



@export "resources/images/image2.flf" "resources/images/image2.bin" 256
@export "resources/images/image3.flf" "resources/images/image3.bin" 256

var
	time,i,j: byte;
	zp : pointer;
	music : incbin("resources/music/test.vgc");
	
	image1 : string=("IMAGE1",$0D);
	image2 : string=("IMAGE2",$0D);



procedure WaitABit();
begin
	for j:=0 to 16 do
	for i:=0 to 255 do wait(200);
end;


begin
	Screen::ResetStack();
	Screen::Init();

	RasterIRQ(Screen::DefaultIRQ());
	Screen::StartInterrupts();
	Screen::SetMode5();
	Screen::SetMode5Palette(#Screen::colorsRedBlue);	

	Screen::FillBanks(#mode5_vram,%00000000,$28);	
	
	// Init music player
	Player::InitMusic(#music);
	// Sets the IRQ procedure to point to the music player!
	Screen::irqProcedure := #Player::PlayMusic;
	while(true) do
	begin	
		//Screen::WaitForVerticalSync();
		Files::LoadFile(#image2, #mode5_vram);
		WaitABit();
		Files::LoadFile(#image1, #mode5_vram);
		WaitABit();

	end;
end.
