10 rem a scrolling tile layer: two register writes a frame, no copying 20 poke 53359,86:poke 53359,88:poke 53359,33 30 if peek(53312)<>86 or peek(53313)<>88 then print "no vic-x here":end 40 print "{clr}"; 50 rem --- palette entries 16-18 60 a=131072+4*16 70 for i=0 to 2:for j=0 to 2:read v:gosub 1000:next:a=a+1:next 80 data 30,40,110, 70,90,190, 250,212,64 90 rem --- tiles are 64 bytes each from vram $4000. tile 0 stays empty, 100 rem tile 1 is a framed block, tile 2 a plain one 110 a=16384+64 120 for i=0 to 63:v=17:if i<8 or (i and 7)=0 then v=18 130 gosub 1000:next 140 for i=0 to 63:v=16:gosub 1000:next 150 rem --- the map: 32x32 entries of 2 bytes at vram 0, made by the blitter 160 rem first clear it, then put tile 1 in every entry 170 a=133248:for i=0 to 20:read v:gosub 1000:next:gosub 500 180 data 1,4, 0,0,0,0, 0,0,0,0, 0,8, 0,0, 0,0, 0,0, 0,0,255 190 a=133248:for i=0 to 20:read v:gosub 1000:next:gosub 500 200 data 1,20, 0,0,0,0, 0,0,0,0, 1,0, 0,4, 0,0, 2,0, 1,0,255 210 rem then tile 2 in every other entry of each row: a chequerboard 220 a=133260:v=16:gosub 1000:v=0:gosub 1000:rem 16 rows 225 a=133264:v=4:gosub 1000:a=133266:v=2:gosub 1000:rem 4 apart; tile 2 230 for r=0 to 31:d=r*64+2*((r+1) and 1) 240 a=133254:v=d and 255:gosub 1000:v=int(d/256):gosub 1000:gosub 500:next 250 rem --- layer 0 at $20800: 8-bit tiles, 32x32 map at 0, tiles at $4000 260 a=133120:for i=0 to 14:read v:gosub 1000:next 270 data 1,0, 0,0,0, 0,64,0, 0,0, 0,0, 0,0, 0 280 poke 53320,17 290 rem --- scroll: x is at $20808, y at $2080a. step 0, so one poke each 300 poke 53325,8:poke 53326,2:t=0 310 t=t+1:if t=512 then t=0 320 poke 53324,8:poke 53327,t and 255 330 poke 53324,10:poke 53327,int(t/2) 340 goto 310 500 rem --- start blitter descriptor 0 and wait for it 510 poke 53338,0 520 if peek(53338)>127 then 520 530 return 1000 rem --- write v at port address a, then a=a+1 1010 h=int(a/65536):m=int((a-h*65536)/256) 1020 poke 53324,a-h*65536-m*256:poke 53325,m:poke 53326,h 1030 poke 53327,v:a=a+1:return