home *** CD-ROM | disk | FTP | other *** search
/ 64'er 1989 February / 64er_Magazin_89-02_1989_Markt__Technik_de_Disk_2_of_2_Side_A.d64 / demo (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  7KB  |  263 lines

  1. 10 rem@ \fastfor:\shortif:\datatype byte
  2. 12 rem@ \word #,i=fast,x=fast
  3. 13 rem@ \constant vic,back,paper,spron,         prior,scol,xhi,irq,off,vol,mem
  4. 15 rem@ \byte a,x1,x2,y1,y2,xa,xe,ya,ye,co,cc,sx,sy,v1,h1,v2,h2,y(,ys(,co(
  5. 16 rem@ \byte p2(,sn
  6. 17 dim sc(24),co(23),x(7),y(7),xs(7),ys(7),p2(7)
  7. 20 vic=53248:back=vic+32:paper=vic+33:     spren=vic+21:off=vic+17:irq=56333
  8. 21 xhi=vic+16:scol=vic+39:pri=vic+27:      mem=2040
  9. 22 vol=54272+24
  10. 28 gosub13000:rem vorbereitung
  11. 29 poke back,0:poke paper,0:poke spren,0
  12. 30 print"[147]        *** [194]asic-[194]oss ***
  13. 32 [153]"(NULL)rogrammieren in peekasic mit der
  14. 34 print"[199]eschwindigkeit von [205]aschinensprache !
  15. 40 [153]"print#(NULL)nmoeglich? (NULL)ein!
  16. 42 print"[196]ieses [208]rogramm wurde von vorne bis
  17. 44 [153]"hinten in peekasic programmiert.
  18. 50 print"[196]ann wurde es vom [194]asic-[194]oss in reine
  19. 52 [153]"(NULL)aschinensprache uebersetzt.
  20. 60 print"[194]itte ueberzeugen [211]ie sich von seiner
  21. 70 [153]"chr$eschwindigkeit !
  22. 90 goto20000
  23. 100 print"[147]  [211]o sieht es aus, wenn die [194]ild-
  24. 110 [153]"  schirmfarbe in schneller ascolge
  25. 120 print"  veraendert wird:":gosub10020
  26. 130 poke irq,127:rem interrupt aus
  27. 135 poke off,0:rem bildschirm aus
  28. 150 for i=0 to60000
  29. 180 poke back,14
  30. 190 poke back,3
  31. 200 poke back,3
  32. 210 poke back,14
  33. 220 poke back,6
  34. 240 nexti
  35. 250 poke irq,129:poke off,27
  36. 253 print"[147] oder so:":gosub10020
  37. 265 poke irq,127:rem interrupt aus
  38. 266 poke off,0:rem bildschirm aus
  39. 270 for i=0 to 30000
  40. 271 poke back,0
  41. 272 poke back,2
  42. 273 poke back,2
  43. 274 poke back,2
  44. 275 poke back,8
  45. 276 poke back,8
  46. 277 poke back,8
  47. 280 poke back,7
  48. 281 poke back,1
  49. 282 poke back,1
  50. 283 poke back,7
  51. 284 poke back,8
  52. 285 poke back,8
  53. 286 poke back,8
  54. 287 poke back,2
  55. 288 poke back,2
  56. 289 poke back,2
  57. 290 poke back,2
  58. 291 poke back,0
  59. 295 next
  60. 300 poke irq,129:poke off,27:return
  61. 305 :
  62. 310 print"[147]  [215]enn ein mit dem [194]asic-[194]oss
  63. 320 [153]"  compiliertes peekasicprogramm den
  64. 330 print"  [194]ildschirm bearbeitet, sieht das
  65. 340 [153]"  so aus:
  66. 350 gosub10020:x1=10:x2=1:y1=14:y2=4
  67. 355 gosub11000
  68. 360 i=0
  69. 370 x1=x1+33:ifx1>=40thenx1=x1-40
  70. 375 x2=x2+17:ifx2>=40thenx2=x2-40
  71. 380 y1=y1+21:ify1>=25theny1=y1-25
  72. 385 y2=y2+7 :ify2>=25theny2=y2-25
  73. 390 co=(co+1and15)
  74. 395 gosub12000
  75. 400 i=i+1
  76. 405 if i<1000 and peek(198)=0 then370
  77. 410 mu=11:gosub14000:print" oder so:"
  78. 415 gosub10020
  79. 420 gosub11000:h1=1:v1=2:h2=2:v2=1:i=0
  80. 425 x1=1:y1=2:x2=37:y2=22:cc=1
  81. 430 if x1 =0  then h1=-h1
  82. 440 if x2<=1  then h2=-h2
  83. 450 if y1 =0  then v1=-v1
  84. 460 if y2 =0  then v2=-v2
  85. 470 if x1 =39 then h1=-h1
  86. 480 if x2>=38 then h2=-h2
  87. 490 if y1 =24 then v1=-v1
  88. 500 if y2 =24 then v2=-v2
  89. 510 x1=x1+h1:x2=x2+h2
  90. 520 y1=y1+v1:y2=y2+v2
  91. 525 co=co(cc):cc=cc+1:ifcc>23thencc=0
  92. 530 gosub12000
  93. 540 i=i+1:ifi<1000andpeek(198)=0then430
  94. 550 mu=500:gosub14000:return
  95. 560 :
  96. 570 print"[147][206]un huepfen ein paar [211]prites ueber
  97. 580 [153]"den peekildschirm. atnllerdings ergibt sich
  98. 590 print"hier ein [208]roblem: [196]as [208]rogramm ist
  99. 600 [153]"zu schnell. vals muss also gebremst
  100. 605 print"werden:":goto1000
  101. 610 :
  102. 620 for i=0 to 7
  103. 630 poke mem+i,13
  104. 640 poke scol+i,i+1
  105. 645 x(i)=130+i*25:y(i)=50+i*18
  106. 647 xs(i)=-i:ys(i)=i
  107. 650 next i
  108. 660 poke pri,0:poke spren,255
  109. 662 a=0:c=0
  110. 665 :
  111. 670 for i=0 to 7
  112. 690 if x(i)and256 then poke xhi,peek(xhi) or p2(i):goto710
  113. 700 poke xhi,peek(xhi)and (255-p2(i))
  114. 710 poke vic+i+i,x(i)and255
  115. 715 poke vic+1+i+i,y(i)
  116. 720 x(i)=x(i)+xs(i)
  117. 730 y(i)=y(i)+ys(i)
  118. 740 if x(i)>320 then x(i)=640-x(i):xs(i)=-xs(i):gosub950
  119. 750 if x(i)<24 then x(i)=48-x(i):xs(i)=-xs(i):gosub950
  120. 760 if y(i)<50 then y(i)=100-y(i):ys(i)=-ys(i):gosub950
  121. 770 if y(i)>229 then y(i)=458-y(i):ys(i)=-ys(i):gosub950
  122. 800 rem beschleunigung x und y
  123. 810 if a<3 then 880
  124. 820 xs(i)=xs(i)-1:ys(i)=ys(i)+1
  125. 880 next i
  126. 882 ifa=3 then a=0
  127. 883 a=a+1
  128. 886 rem auf rasterstrahl warten
  129. 887 if b then if (peek(53248+17)and128)=0 then 887
  130. 890 if peek(198)=0 then 670
  131. 900 poke198,0:  return
  132. 950 poke vol,sn:sn=15-sn:return
  133. 990 end
  134. 999 :
  135. 1000 gosub10600:b=0:gosub610
  136. 1010 print"jetzt ist es gebremst und wird
  137. 1020 [153]"mit dem (NULL)asterstrahl synchronisiert.
  138. 1030 gosub10600
  139. 1050 b=-1:gosub610
  140. 1090 return
  141. 9999 :
  142. 10000 ti$="000000":goto10100
  143. 10010 ti$="000030":goto10100
  144. 10020 ti$="000035":goto10100
  145. 10100 gosub10600:goto10500
  146. 10500 poke198,0
  147. 10510 get a$:ifa$=""andti$<"000040"then10510
  148. 10520 return
  149. 10600 print"            - [212]aste -":return
  150. 10998 :
  151. 11000 fori=1024to2023:pokei,160:next
  152. 11010 return
  153. 11997 :
  154. 11998 rem rechteck zeichnen mit farbe   (x1,y1,x2,y2,ch,co)
  155. 11999 rem (x1,y1,x2,y2,ch,co)
  156. 12000 if x2>=x1 then xa=x1:xe=x2:goto12002
  157. 12001 xa=x2:xe=x1
  158. 12002 if y2>=y1 then ya=y1:ye=y2:goto12050
  159. 12003 ya=y2:ye=y1
  160. 12050 for y=sc(ya) to sc(ye) step 40
  161. 12060 for x=y+xa to y+xe
  162. 12070 poke x,co:next x,y
  163. 12090 return
  164. 12998 :
  165. 12999 rem multiplikationstabelle
  166. 13000 for i=0 to 24:sc(i)=55296+i*40:next
  167. 13010 rem farben einlesen
  168. 13020 for a=0 to 23:read co(a):next
  169. 13030 mp=0
  170. 13040 for a=0 to 7:p2(a)=2^a:next
  171. 13050 for i=832 to 832+62
  172. 13060 read a:poke i,a:next i
  173. 13090 return
  174. 13499 rem farbdaten
  175. 13500 data 0,6,14,3,1,3,14,6,0,2,8,7,1,7,8,2,0,11,5,13,1,13,5,11
  176. 13599 rem spritedaten
  177. 13600 data   0,255,  0,  3,255,192, 15
  178. 13601 data 255,240, 31,255,248, 63,255
  179. 13602 data 252,127,255,254,127,255,254
  180. 13603 data 255,255,255,255,255,255,255
  181. 13604 data 255,255,255,255,255,255,255
  182. 13605 data 255,255,255,255,255,255,255
  183. 13606 data 127,255,254,127,255,254, 63
  184. 13607 data 255,252, 31,255,248, 15,255
  185. 13608 data 240,  3,255,192,  0,255,  0
  186. 13998 :
  187. 13999 rem bildschirm loeschen (mu)
  188. 14000 i=1024:a=21
  189. 14010 for a=1to5:next a
  190. 14020 pokei,32:i=i+mu
  191. 14030 ifi>=2045theni=i-1021
  192. 14040 ifi<>1024then14010
  193. 14050 return
  194. 20000 :
  195. 20010 print"[215]aehlen [211]ie:
  196. 20020 [153]"   1...peekildschirmdemo
  197. 20030 print"   2...[211]pritedemo
  198. 20040 [153]"   3...left$intergrunddemo
  199. 20050 print"   4...[206]och was
  200. 20090 [153]"((NULL)hilo left$errmann, 1988)
  201. 20092 :
  202. 20094 :
  203. 20100 ti$="000000":gosub10500
  204. 20110 if a$>="1" and a$<="4" then mp=val(a$):goto20130
  205. 20120 if a$<>""then20100
  206. 20125 mp=mp+1:if mp>4 then mp=1
  207. 20130 on mp gosub 310,570,100,21000
  208. 20140 goto29
  209. 21000 print"[147][211]ie sollten zum [214]ergleich mal die
  210. 21010 [153]"peekasic-(NULL)ersion dieses (NULL)rogramms
  211. 21015 print"ablaufen lassen !
  212. 21020 [153]"str$as peekasicprogramm zeigt auch, dass
  213. 21030 print"der [208]rogrammierer alle [205]oeglichkeiten
  214. 21040 [153]"von peekasic ausreizen kann, ohne dass er
  215. 21050 print"unnoetig eingeschraenkt wird.
  216. 21060 [153]"str$enn ausser solchen peekildschirm-
  217. 21070 print"spielereien kann man auch ernstere
  218. 21080 [153]"atnnwendungen programmieren, da der
  219. 21090 print"[194]asic-[194]oss z.[194]. eine wesentlich
  220. 21100 [153]"leistungsfaehigere (NULL)tringverwaltung
  221. 21110 print"besitzt als der [194]asicinterpreter. [196]arum
  222. 21120 [153]"ist nun auch die chr$arbage-lenollection
  223. 21130 print"um einiges schneller.":gosub10000
  224. 21140 print"[147][215]as das heisst, werden [211]ie merken,
  225. 21150 [153]"wenn (NULL)ie folgendes (NULL)rogramm ablaufen
  226. 21160 print"lassen:
  227. 21170 [153]"10 dim a$(2000)
  228. 21180 print"20 for i=1 to 2000
  229. 21190 [153]"30 a$(i)=chr$(65):next i
  230. 21200 print"40 ti$="000000":print"chr$(34)"frei"chr$(34)"fre(0);ti/60
  231. 21210 [153]"atnllein der asc(NULL)val-peekefehl benoetigt ca.
  232. 21220 print"339 [211]ekunden, da er eine [199]arbage-
  233. 21230 [153]"lenollection ausloest.
  234. 21240 print"[196]as gleiche [208]rogramm koennen [211]ie nun
  235. 21250 [153]"in der compilierten (NULL)ersion starten: ":[141]10000
  236. 21260 [153]"load gestartet...
  237. 21300 dim a$(2000)
  238. 21310 for i=1 to 2000
  239. 21320 a$(i)=chr$(65):next i
  240. 21330 ti$="000000":print"frei"fre(0);ti/60
  241. 21335 print"[196]amit ist die [199]arbage-[195]ollection
  242. 21336 [153]"in diesem ascall etwa 680 mal schneller !
  243. 21340 gosub10010
  244. 21400 print"[147][196]ie [204]eistungsdaten des [194]asic-[194]oss:
  245. 21410 [153]"- kurze lenompilate
  246. 21420 print"- optimierter und effizienter [195]ode
  247. 21430 [153]"- sehr schnelle (NULL)ariablentypen
  248. 21440 print"- extrem kurze [195]ompilierzeiten
  249. 21450 [153]"- eine hochflexible lenompilerarchitektur
  250. 21460 print"- 62 [203][194]yte [194]asicspeicher
  251. 21470 [153]"- eine schnelle asc(NULL)(NULL)-(NULL)val(NULL)(NULL)-(NULL)chleife
  252. 21480 print"- gepackte und schnelle [196]aten bei [196][193][212][193]
  253. 21490 [153]"- stark beschleunigte atnrrays
  254. 21500 print"- beliebig lange [214]ariablennamen
  255. 21510 [153]"- genaue deutsche ascehlermeldungen
  256. 21520 print"- [197]rzeugung echten [205]aschinencodes
  257. 21525 [153]"- kein (NULL)opierschutz
  258. 21530 print" und noch einiges mehr...
  259. 21540 [141]10000
  260. 21550 [153]"load right$ch bin jedem dankbar, der dieses
  261. 21560 print" [196]emoprogramm weiterverbreitet.
  262. 21570 [137]10000
  263.