home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 February / Ahoy_Magazine_86-02_1986_Double_L.d64 / windows (.txt) < prev   
Commodore BASIC  |  2022-10-26  |  2KB  |  71 lines

  1. 1 rem *** windows ***
  2. 2 rem creates the illusion of windows using extended background color mode
  3. 13 rem set extended color mode
  4. 14 poke 53265,peek(53265)or 64
  5. 15 gosub 800
  6. 30 goto 100
  7. 39 rem get raw joystick value and invert it (joystick port 2)
  8. 40 jy=255-peek(56320)
  9. 41 rem get separate button value
  10. 42 jb=jy and 16
  11. 43 rem clean up joystick value and return
  12. 44 jy=jy and 15:return
  13. 49 rem read keyboard
  14. 50 d=0:get a$:if a$="" then return
  15. 51 a=asc(a$):if a<32 or a>95 then d=a:a=0:a$="":return
  16. 52 a=a-32:return
  17. 79 rem ** clear window
  18. 80 for i=mt(qq)-1 to mb(qq)+1:print vv$(i)tab(ml(qq)-1);
  19. 81 print "[146]";:if qq>1 then print "";
  20. 82 print left$(bl$(qq),mr(qq)-ml(qq)+2);:next:return
  21. 99 rem ** main keyread loop
  22. 100 gosub 40:gosub 50:if a$="" and d=0 and jy=0 and jb=0 then 100
  23. 101 if(d>132)and(d<137)then qq=d-133:goto 100
  24. 102 if d=137 then sys 58235
  25. 103 if d=147 then hp(qq)=ml(qq):vp(qq)=mt(qq):gosub 80:goto 100
  26. 104 if d=19 then hp(qq)=ml(qq):vp(qq)=mt(qq):goto 100
  27. 105 if d=17 then gosub 200
  28. 106 if d=145 then gosub 210
  29. 107 if d=29 then gosub 220
  30. 108 if d=157 then gosub 230
  31. 109 if d=13 or d=10 then gosub 200:hp(qq)=ml(qq):goto 100
  32. 110 print vv$(vp(qq))tab(hp(qq))fc$(qq)ch$(qq,a);:gosub 220:goto 100
  33. 190 goto 100
  34. 199 rem cursor down
  35. 200 vp(qq)=vp(qq)+1:if vp(qq)>mb(qq) then vp(qq)=mt(qq)
  36. 201 return
  37. 209 rem cursor up
  38. 210 vp(qq)=vp(qq)-1:if vp(qq)<mt(qq) then vp(qq)=mb(qq)
  39. 211 return
  40. 219 rem cursor right
  41. 220 hp(qq)=hp(qq)+1:if hp(qq)>mr(qq) then hp(qq)=ml(qq):gosub 200
  42. 221 return
  43. 229 rem cursor left
  44. 230 hp(qq)=hp(qq)-1:if hp(qq)<ml(qq) then hp(qq)=mr(qq)
  45. 231 return
  46. 800 dim vv$(24),ch$(3,63),fc$(3),bc(3),vp(3),hp(3),cb(3),mt(3),mb(3),ml(3),mr(3)
  47. 801 rem initial color values
  48. 802 for i=0 to 3:read fc$(i),bc(i),cb(i):next
  49. 803 data "[155][146]",2,53281,"[146]",14,53282,"[149]",7,53283,"[158]",5 ,53284
  50. 804 rem set margins & starting cursor positions
  51. 805 for i=0 to 3:read mt(i),mb(i),ml(i),mr(i):vp(i)=mt(i):hp(i)=ml(i):next
  52. 806 data 1,15,1,18,1,9,21,38,18,23,1,18,12,23,21,38
  53. 809 rem vertical placement strings
  54. 810 vv$(0)="":for i=1 to 24:vv$(i)=vv$(i-1)+"":next
  55. 819 rem set unshifted character tables
  56. 820 for i=0 to 63:ch$(0,i)=chr$(i+32):ch$(2,i)=ch$(0,i):next
  57. 821 rem set shifted character table
  58. 822 for i=0 to 31:ch$(1,i)=chr$(i+160):ch$(3,i)=ch$(1,i):next
  59. 823 for i=32 to 63:ch$(1,i)=chr$(i+64):ch$(3,i)=ch$(1,i):next
  60. 824 rem set unshifted blank line
  61. 825 bl$(0)="                                      ":bl$(2)=bl$(0)
  62. 826 rem set shifted blank line
  63. 827 bl$(1)="":for i=1 to 39:bl$(1)=bl$(1)+chr$(160):next:bl$(3)=bl$(1)
  64. 829 rem initialize screen
  65. 830 print "[147]";:for qq=0 to 3:gosub 80
  66. 831 rem clear window edges
  67. 832 for i=mt(qq)-1 to mb(qq)+1:poke 1024+i*40+mr(qq)+1,32+64*qq:next:next
  68. 833 qq=0
  69. 834 for i=0 to 3:poke cb(i),bc(i):next
  70. 890 return
  71.