Advertisement
Armakuni

simple lego editor for C64, written in basic.

Jan 29th, 2022
4,146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 10 print"{clear}lego demo":poke53281,0:poke53280,0:gosub330:gosub 750
  2. 30 for t=1 to 23:printspc(29)"{cm g}":next
  3. 50 gosub250
  4. 70 gosub 110
  5. 80 rem print "{home}"xc,yc
  6. 90 goto 70
  7. 110 rem choose block
  8. 130 get a$
  9. 150 for t=1 to 5:if a$=i$(t) then b$=b$(t):xs=24:ys=50:l=t:gosub550:gosub 950:go=-1
  10. 170 next
  11. 190 if a$=" " then gosub 470
  12. 211 if a$="{return}" then gosub 1270
  13. 212 if not go then return
  14. 213 if a$="{up}" then gosub1100
  15. 221 if a$="{down}" then gosub1140
  16. 223 if a$="{left}" then gosub1180
  17. 225if a$="{right}" then gosub1230
  18. 230 return
  19. 250 rem print blocks on right
  20. 270 for t=1 to 5:print"{home}"c$(co)left$(d$,t*2)spc(37-t)b$(t)" f"right$(str$(t),len(str$(t))-1):next
  21. 290 printspc(31)"space{down}{left}{left}{left}{left}{left}for color"
  22. 300 printspc(31)"cursors{down}{left}{left}{left}{left}{left}{left}{left}to move"
  23. 302 print
  24. 305 printspc(31)"return{down}{left}{left}{left}{left}{left}{left}confirms"
  25. 310 return
  26. 330 rem presets
  27. 350 s$=" ":d$="{down}":fort=1to5:d$=d$+d$:s$=s$+s$:next
  28. 370 fort=1to8:c$(t)=mid$("{black}{white}{red}{cyan}{purple}{green}{blue}{yellow}",t,1):next
  29. 390 for t=1 to 5:b$(t)="{reverse on}"+left$(s$,t)+"{reverse off}":next
  30. 410 i$(1)="{f1}":i$(2)="{f2}":i$(3)="{f3}":i$(4)="{f4}":i$(5)="{f5}"
  31. 430 co=2:vic=13*4096:xs=0:ys=0:xc=0:yc=0:go=0
  32. 450 return
  33. 470 rem change colour
  34. 490 co=co+1:if co=9 then co=1
  35. 500 pokevic+39,co-1
  36. 530 return
  37. 550 rem adjust block length
  38. 570 if l=1 then l1=240:l2=0:l3=0:gosub 1010
  39. 590 if l=2 then l1=255:l2=0:l3=0:gosub 1010
  40. 610 if l=3 then l1=255:l2=240:l3=0:gosub 1010
  41. 630 if l=4 then l1=255:l2=255:l3=0:gosub 1010
  42. 650 if l=5 then l1=255:l2=255:l3=240:gosub 1010
  43. 670 return
  44. 750 rem sprites creation
  45. 770 pokevic+21,1:poke53277,1:rem double x
  46. 790 poke2040,192:rem set sprite 0's pointer
  47. 810 pokevic,xs:rem set sprite 0-1's x position
  48. 830 pokevic+1,ys:rem set sprite 0-1's y position
  49. 850 pokevic+39,co-1:rem set sprite 0's color
  50. 870 fort=0to63:rem byte counter with sprite loop
  51. 890 poke192*64+t,((t<24)*255)*(t<24):rem store the data in sprite area
  52. 910 next:rem close loop
  53. 930 return
  54. 950 rem move block
  55. 970 pokevic,xs:pokevic+1,ys
  56. 990 return
  57. 1010 rem set block lenght
  58. 1030 for t=0 to 7
  59. 1050 poke192*64+t*3,l1:poke1+192*64+t*3,l2:poke2+192*64+t*3,l3
  60. 1070 next
  61. 1080 go=-1
  62. 1090 return
  63. 1100rem up
  64. 1105 ys=ys-8:yc=yc-1
  65. 1110 if ys<50 then ys=50
  66. 1115 if yc<0 then yc=0
  67. 1120 gosub 950
  68. 1130 return
  69. 1140 rem down
  70. 1150 ys=ys+8:yc=yc+1
  71. 1155 if ys>242 then ys=242:yc=24
  72. 1160 gosub 950
  73. 1170 return
  74. 1180 rem left
  75. 1190 xs=xs-8:xc=xc-1
  76. 1200 if xs<24 then xs=24
  77. 1205 if xc<0 then xc=0
  78. 1210 gosub 950
  79. 1220 return
  80. 1230 rem right
  81. 1240 xs=xs+8:xc=xc+1
  82. 1245 if xs>256-l*8 then xs=256-l*8
  83. 1248 if xc>28 then xc=28
  84. 1250 gosub 950
  85. 1260 return
  86. 1270 rem place the block
  87. 1280 xs=0:ys=0:gosub950:l1=240:l2=0:l3=0:gosub 1010
  88. 1290 print"{home}"left$(d$,yc)spc(xc)c$(co)b$(l)"{home}"
  89. 1295 gosub430:pokevic+39,co-1
  90. 1298 go=0
  91. 1300 return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement