home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 April / Ahoy_Magazine_86-04_1986_Double_L.d64 / bitmapper (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1986-01-01  |  2.3 KB  |  80 lines

  1. 1 rem =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. 2 rem   =-=     bitmapper      =-=
  3. 3 rem     c-64 bit map graphics
  4. 4 rem       rupert report #28
  5. 5 rem ======  for c-64 only!  =======
  6. 6 rem  use -- gosub 1000 - to initialize bit map mode
  7. 7 rem  use -- gosub 2000 - to plot point at location px,py
  8. 8 rem  use -- gosub 3000 - to return to  text mode
  9. 9 rem----------------------------------
  10. 10 gosub 1000
  11. 20 rem -- draw sun --  (or any circle of radius r)
  12. 30 r=2 : for th=0 to 2*(NULL) step .5
  13. 40 px=160+r*cos(th)
  14. 50 py=100-r*sin(th)
  15. 60 next
  16. 65 rem *********************************
  17. 66 rem lines 440 through 485 are for use
  18. 67 rem        with comet catcher
  19. 68 rem *********************************
  20. 435 if sd=0 then a$=chr$(13)
  21. 440 if a$="" then 270
  22. 450 if a$=chr$(13) then gosub 3000 : print chr$(147) : end
  23. 460 if a$="[145]" then gosub 490 : goto 270
  24. 470 if a$="" then gosub 500 : goto 270
  25. 475 if a$<>"p" then 270
  26. 480 get a$ : if a$="" then 480
  27. 485 goto 270
  28. 486 rem ********************************
  29. 960 rem
  30. 970 rem >>> initialize bit map mode <<<
  31. 980 rem
  32. 990 rem  set & reset bit functions
  33. 1000 def fnsb(n)=peek(mm) or 2^n
  34. 1010 def fnrb(n)=peek(mm) and (255-2^n)
  35. 1020 vv=53248 :rem vic-ii register 0
  36. 1030 :rem >>> put bit map at 8192 <<<         (set bit 3 of vic register 24)
  37. 1040 mm=vv+24 : poke mm,fnsb(3)
  38. 1050 :rem >>> select bit map mode <<<         (set bit 5 of vic register 17)
  39. 1060 mm=vv+17 : poke mm,fnsb(5)
  40. 1070 base=8192 :rem start bit map memory
  41. 1080 :rem >>> clear bit map <<<
  42. 1090 gosub 4000
  43. 1100 :rem > select colors c1 and c0   <
  44. 1110 c1=1 : c0=0 : cc=16*c1 + c0
  45. 1120 :rem fill screen memory with color
  46. 1130 for mm=1024 to 2023:poke mm,cc:next
  47. 1140 return
  48. 1150 :
  49. 1970 rem ==============================
  50. 1980 rem > turn on pixel at (px,py) <<<
  51. 1990 rem ==============================
  52. 2000 bit=7-(px and 7)
  53. 2010 mm=base+320*int(py/8)+8*int(px/8)+(py and 7)
  54. 2020 poke mm,fnsb(bit)
  55. 2030 return
  56. 2040 :
  57. 2970 rem ==========================
  58. 2980 rem >>> reset bit map mode <<<
  59. 2990 rem ==========================
  60. 3000 mm=vv+17 : poke mm,fnrb(5)
  61. 3010 rem  restore screen memory base
  62. 3020 mm=vv+24 : poke mm,fnrb(3)
  63. 3030 return
  64. 3960 :
  65. 3970 ============================
  66. 3980 >>> clear bit map screen <<<
  67. 3990 ============================
  68. 4000 for m=828 to 828+43
  69. 4010 read b : poke m,b
  70. 4020 ck=ck+b
  71. 4030 next
  72. 4040 if ck<>5133 then print "data error in lines 4060 - 4110" : stop
  73. 4050 sys 828: return
  74. 4060 data 76,68,3,0,32,31,64,0
  75. 4070 data 173,63,3,133,251,173,64,3
  76. 4080 data 133,252,174,65,3,160,0,173
  77. 4090 data 67,3,136,145,251,208,251,230
  78. 4100 data 252,202,48,7,208,244,172,66
  79. 4110 data 3,208,239,96
  80.