home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1993 May / 1993-05.d64 / utildemo (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  2KB  |  60 lines

  1. 10 rem utility/demo
  2. 20 rem by eric j. bryant
  3. 30 rem copyright 1993 - compute publications - all rights reserved
  4. 32 if a=0 then a=1:load"utilityplus2.ml",8,1
  5. 40 rem dimensioning arrays
  6. 90 dim t%(100)
  7. 100 dim ir%(254)
  8. 110 dim s$(254)
  9. 120 rem
  10. 130 rem building arrays
  11. 140 rem
  12. 150 for x=1to100: t%(x)=100-x :next
  13. 160 for x=1to254: ir%(x)=x    :next
  14. 170 for x=1to254:s$(x)="trash":next
  15. 180 rem
  16. 190 for x=1to20 :ix$=mid$(str$(x),2)
  17. 200 y=int(rnd(0)*254):if s$(y)<>"trash" then 200
  18. 210 s$(y)="treasure-"+ix$:next x
  19. 220 rem
  20. 230 rem demo
  21. 240 rem integer arrays
  22. 250 rem
  23. 260 printchr$(147);chr$(18);"integer array demo:"
  24. 270 for x=1to10:y=int(rnd(0)*254):nu$=mid$(str$(y),2)
  25. 280 printspc(1);nu$;tab(5);"(t%)  ";
  26. 290 sys 52732,t%,y,0:if peek(251)=255 then print"not found":goto 310
  27. 300 print"location";peek(251)
  28. 310 printtab(5);"(ir%) ";
  29. 320 sys 52732,ir%,y,0
  30. 330 print"location";peek(251) :next x:gosub590
  31. 340 rem
  32. 350 rem string arrays
  33. 360 rem
  34. 370 printchr$(147);chr$(18);"string array demo:"
  35. 380 print" the text ";chr$(34);"treasure-(x)";chr$(34);" is located:":poke252,0
  36. 390 for x=1to20:ix$=mid$(str$(x),2):a$="treasure"
  37. 400 sys 52965,s$,peek(252)
  38. 410 vu$=mid$(str$(peek(252)),2):ln=len(vu$): ze$="000"
  39. 420 if ln<3 then vu$=left$(ze$,3-ln)+vu$
  40. 430 print" ";vu$;:li$=li$+vu$+" ":next x:gosub 590
  41. 440 rem
  42. 450 rem word wrapper
  43. 460 rem
  44. 470 printchr$(147);chr$(18);chr$(14);"[215][207][210][196] [215][210][193][208][208][197][210] [196][197][205][207]:";chr$(146);" ";
  45. 480 a$="[212]his is a demo for the [215]ord [215]rapping [213]tility! [211]ee how the words were "
  46. 490 a$=a$+"automatically wrapped around the heading? [215]ord [215]rapper keeps track "
  47. 500 a$=a$+"of what position on screen you enabled this utility, allowing for "
  48. 510 a$=a$+"much versitility."
  49. 520 sys 52376,1:print:print
  50. 530 a$="[193]lso notice how [215]ord [215]rapper just prompted you to press [[210][197][212][213][210][206]], "
  51. 540 a$=a$+"this allows you to prompt the user before continuing with a rather "
  52. 550 a$=a$+"lengthy text."
  53. 560 sys 52376:print:print:gosub 590:
  54. 570 printchr$(147);chr$(142);"utility/demo complete."
  55. 580 end
  56. 590 printchr$(18);"continue?":printchr$(18);"(y)es or (n)o"
  57. 600 get a$ :if a$="" then 600
  58. 610 if a$<>"n" then return
  59. 620 end
  60.