program TileMap;
var

// Take a look at the VBM commands in the help (press F1)
// and also in the platform section of the help file
//
// Note that TRSE for VIC 20 is using zero pages from $8F downwards
// and VBM uses zero pages from $00 upwards.
// The Zero page memory in between can be used by your programs.
// See VBM Memory in the Platforms help section for details. 

// Tile and Tilemap example

// declare all your include files here
chars: incbin( "resources/tilemap/vbm-char.bin", $4000 ); // individual tile characters
map: incbin( "resources/tilemap/vbm-map.bin", $4490 ); // full screen map of tiles
circle: incbin( "resources/tilemap/circle.bin", $4670 ); // circle char


	i, j : byte;

begin

	// set the default display mode showing all 20 columns
	vbmSetDisplayMode( 0 );
	
	// Clear the bitmap with a value of 0
	vbmClear( 0 );
	
	// set the colour memory to GREEN
	vbmClearColor( GREEN );
	
	// set screen colour
	SCREEN_BG_COLOR := SCREEN_BG_BLACK + BLACK;

	vbmDrawTileMap( #map, #chars, 0,0, 20,184 );

	fill(^$9414, yellow, 20);
	fill(^$94b4, white, 20);
	
	i := 72;

	while (true) do
	begin
	
		vbmDrawTileE( #circle );
		waitforraster( 125 );
		vbmDrawTileE( #circle );
		
		i := i - 3;

		vbmSetColumn( 10 );
		j := sine[ i ] >> 3;
		screenmemory := screenmemory + j + 40;

	end;
	
end.
