Advertisement
Shaun_B

Commodore 64 sprite and joystick example CBM BASIC

Sep 8th, 2014
1,329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 0 dim x,y,a,sp,i,j,n,s,w,e,f,v,jo,po,b,c,z,ff,sd,mn,mx:poke 53280,z:poke 53281,z:gosub 63993:print"{clear}":x=64:y=x:a=w:j=a+s
  2. 1 poke v+f,(peek(v+f)and c)or(-w*(x>ff)):poke v+a,x+(ff*(x>ff)):poke v+j,y:jo=b-peek(po):x=x+abs((jo and e)=e)+((jo and w)=w):y=y+abs((jo and n)=n)+((jo and s)=s):x=x+abs(x<mn)+(x>mx):y=y+abs(y<z)+(y>ff):on -(jo<>f) goto 1
  3. 2 poke 56334,peek(56334)or 1:end
  4. 100 rem sprite and joystick port 2 demo, commodore 64 basic by donkeysoft
  5. 101 rem this is a minimized and obfuscated version of this example: http://www.melon64.com/forum/viewtopic.php?f=24&t=507
  6. 102 rem written with cbm prg studio by arthur jordison: http://www.ajordison.co.uk/
  7. 63993 rem initialisation:
  8. 63994 poke 56334, peek(56334)and 254:f=16:e=8:w=4:n=2:s=1:po=56320:b=127:c=251:ff=255:mn=e:mx=334:v=53248:sd=832:sp=21:a=13:j=4:i=2042
  9. 63995 poke v+sp,j:poke i,a:i=z
  10. 63996 read j:if j>-s then poke sd+i,j:i=i+s:goto 63996
  11. 63997 return
  12. 63998 rem sprite data:
  13. 63999 data ,127,,1,255,192,3,255,224,3,231,224,7,217,240,7,223,240,7,217,240,3,231,224,3,255,224,3,255,224,2,255,160,1,127,64,1,62,64,,156,128,,156,128,,73,,,73,,,62,,,62,,,62,,,28,,-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement