-
Notifications
You must be signed in to change notification settings - Fork 1
/
Commodore128.txt
138 lines (125 loc) · 5.15 KB
/
Commodore128.txt
1
100 rem basic week 5: winchester drive 110 rem http://reddit.com/r/retrobattlestations 120 rem written by fozztexx 130 rem commodore 128 version by fozztexx 200 gosub 3010: gosub 2010:sprcolor 6,2 210 x = w / 2 - 1:y = h / 2 - 1:fc = 0:fl = -1 220 gosub 1010 230 ke$ = "":nx = x:ny = y 250 get ke$:if ke$ = "" goto 250 260 if ke$ <> "i" then 270 261 ny = y - 1:fc = int (fc / 2) * 2 + 1:if ny >= 0 then 300 262 ny = 0: if nx <> w / 2 - 1 or mid$ (dr$,1,1) = " " then 300 263 gosub 2010:nx = w / 2 - 1:ny = h - 2: goto 320 270 if ke$ <> "j" then 280 271 nx = x - 1:fc = fc - int (fc / 2) * 2 + 2: if nx >= 0 then 300 272 nx = 0: if ny <> h / 2 - 1 or mid$ (dr$,3,1) = " " then 300 273 gosub 2010:nx = w - 2:ny = h / 2 - 1: goto 320 280 if ke$ <> "k" then 290 281 nx = x + 1:fc = fc - int (fc / 2) * 2: if nx <= w - 2 then 300 282 nx = w - 2: if ny <> h / 2 - 1 or mid$ (dr$,4,1) = " " then 300 283 gosub 2010:nx = 0:ny = h / 2 - 1: goto 320 290 if ke$ <> "m" then 300 291 ny = y + 1:fc = int (fc / 2) * 2: if ny <= h - 2 then 300 292 ny = h - 2: if nx <> w / 2 - 1 or mid$ (dr$,2,1) = " " then 300 293 gosub 2010:nx = w / 2 - 1:ny = 0: goto 320 300 if nx = x and ny = y then 230 320 x = nx:y = ny: gosub 1010 330 goto 230 1000 rem move character 1010 xp = x * 16 + 8 + xo * 2 + 24:yp = y * 16 + 8 + yo + 50 1020 if fl <> fc and fl >= 0 then sprite fl+1,0 1030 movspr fc+1,xp,yp 1040 if fl <> fc then sprite fc+1,1,10,0,0,0,1 1050 fl = fc:return 2000 rem create room 2010 for i = 1 to 8:sprite i,0:next 2015 fl = -1:color 0,1:graphic 3,1 2020 w = int ( rnd (1) * 4) * 2 + 6:h = int ( rnd (1) * 4) * 2 + 6 2030 cn = int ( rnd (1) * 3) 2040 xo = (160 - w * 8) / 2:yo = (200 - h * 16) / 2 2050 wc = 3 + int ( rnd (1) * 14) 2060 color 1,wc 2080 box ,xo+8,yo,xo+(w-1)*8,yo+3,0,1 2090 box ,xo+8,yo+h*16-4,xo+(w-1)*8,yo+h*16-1,0,1 2100 box ,xo,yo+16,xo+1,yo+(h-1)*16,0,1 2110 box ,xo+w*8-2,yo+16,xo+w*8-1,yo+(h-1)*16,0,1 2120 gshape cn$(1),xo+(w-1)*8,yo:gshape cn$(2),xo+(w-1)*8,yo+(h-1)*16 2130 gshape cn$(3),xo,yo:gshape cn$(4),xo,yo+(h-1)*16 2150 dr = 1 + int ( rnd (1) * 14) 2160 dr$ = "":dd$ = " n s w e" 2170 for i = 1 to 4 2180 dd = dr - int (dr / 2) * 2:dr = int (dr / 2):dr$ = dr$ + mid$ (dd$,i * 2 - 1 + dd,1) 2190 if dd = 0 then 2420 2200 ns = abs(i < 3):s = abs(i = 2):e = abs(i = 4) 2250 x1 = (w * 8 / (ns + 1)) * (ns + e) - 6 * ns - 2 * e 2260 x2 = (w * 8 / (ns + 1)) * (ns + e) + 5 * ns - 2 * e + (1 - ns) 2270 y1 = (h * 16 / ((1 - ns) + 1)) * ((1 - ns) + s) - 12 * (1 - ns) - 4 * s 2280 y2 = (h * 16 / ((1 - ns) + 1)) * ((1 - ns) + s) + 11 * (1 - ns) - 4 * s + 3 * ns 2290 box 0,xo+x1,yo+y1,xo+x2,yo+y2,0,1 2300 color 2,2 2310 x1 = (w * 8 / (ns + 1)) * (ns + e) - 8 * ns - 4 * e 2320 x2 = (w * 8 / (ns + 1)) * (ns + e) - 8 * ns - 4 * e + 3 * (1 - ns) + ns 2330 y1 = (h * 16 / (1 - ns + 1)) * (1 - ns + s) - 16 * (1 - ns) - 8 * s 2340 y2 = (h * 16 / (1 - ns + 1)) * (1 - ns + s) - 16 * (1 - ns) - 8 * s + 7 * ns + 3 * (1 - ns) 2350 box 2,xo+x1,yo+y1,xo+x2,yo+y2,0,1 2360 x1 = (w * 8 / (ns + 1)) * (ns + e) + 6 * ns - 4 * e 2370 x2 = (w * 8 / (ns + 1)) * (ns + e) + 6 * ns - 4 * e + 3 * (1 - ns) + ns 2380 y1 = (h * 16 / (1 - ns + 1)) * (1 - ns + s) + 12 * (1 - ns) - 8 * s 2390 y2 = (h * 16 / (1 - ns + 1)) * (1 - ns + s) + 12 * (1 - ns) - 8 * s + 7 * ns + 3 * (1 - ns) 2400 box 2,xo+x1,yo+y1,xo+x2,yo+y2,0,1 2420 next i 2430 return 3000 rem load sprites 3010 print "loading sprites..." 3020 for i = 1 to 4 3030 sp$ = "":for j = 1 to 67:read d:sp$ = sp$ + chr$(d):next j 3040 sprsav sp$,i 3050 next i 3060 for i = 1 to 4 3070 c$ = "":for j = 1 to 36:read d:c$ = c$ + chr$(d):next j 3080 cn$(i) = c$ 3090 next i 3100 return 9000 rem sprite data 9010 data 2,168,0,42,170,0,170,170,0 9020 data 171,252,0,172,204,0,172,204,0 9030 data 175,252,0,47,240,0,23,64,0,23 9040 data 64,0,53,64,0,53,64,0,43,128,0 9050 data 42,128,0,42,128,0,42,128,0,0 9060 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0 9070 data 23,0,20,0 9080 data 2,168,0,42,170,0,170,170,0 9090 data 170,168,0,170,168,0,170,168,0 9100 data 170,168,0,42,160,0,21,64,0,21 9110 data 64,0,21,192,0,21,192,0,42,128 9120 data 0,42,128,0,42,128,0,42,128,0 9130 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9140 data 23,0,20,0 9150 data 42,128,0,170,168,0,170,170,0 9160 data 63,234,0,51,58,0,51,58,0,63 9170 data 250,0,15,248,0,1,212,0,1,212 9180 data 0,1,84,0,1,92,0,1,92,0,2,232 9190 data 0,2,168,0,2,168,0,2,168,0,0,0 9200 data 0,0,0,0,0,0,0,0,0,0,23,0,20,0 9210 data 42,128,0,170,168,0,170,170,0 9220 data 42,170,0,42,170,0,42,170,0 9230 data 42,170,0,10,168,0,1,84,0,1 9240 data 84,0,1,84,0,3,84,0,3,84,0,2 9250 data 168,0,2,168,0,2,168,0,2,168,0 9260 data 0,0,0,0,0,0,0,0,0,0,0,0,23,0 9270 data 20,0 9280 data 80,0,80,0,80,0,80,0,80,0,84,0 9290 data 84,0,84,0,21,0,21,0,21,64,5 9300 data 80,5,85,1,85,0,85,0,21,14,0 9310 data 15,0 9320 data 0,21,0,85,1,85,5,85,5,80,21 9330 data 64,21,0,21,0,84,0,84,0,84,0 9340 data 80,0,80,0,80,0,80,0,80,0,14,0 9350 data 15,0 9360 data 0,5,0,5,0,5,0,5,0,5,0,21,0,21 9370 data 0,21,0,84,0,84,1,84,5,80,85 9380 data 80,85,64,85,0,84,0,14,0,15,0 9390 data 84,0,85,0,85,64,85,80,5,80,1 9400 data 84,0,84,0,84,0,21,0,21,0,21,0 9410 data 5,0,5,0,5,0,5,0,5,14,0,15,0