home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1986 February
/
Ahoy_Magazine_86-02_1986_Double_L.d64
/
windows
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2022-10-26
|
2KB
|
71 lines
1 rem *** windows ***
2 rem creates the illusion of windows using extended background color mode
13 rem set extended color mode
14 poke 53265,peek(53265)or 64
15 gosub 800
30 goto 100
39 rem get raw joystick value and invert it (joystick port 2)
40 jy=255-peek(56320)
41 rem get separate button value
42 jb=jy and 16
43 rem clean up joystick value and return
44 jy=jy and 15:return
49 rem read keyboard
50 d=0:get a$:if a$="" then return
51 a=asc(a$):if a<32 or a>95 then d=a:a=0:a$="":return
52 a=a-32:return
79 rem ** clear window
80 for i=mt(qq)-1 to mb(qq)+1:print vv$(i)tab(ml(qq)-1);
81 print "[146]";:if qq>1 then print "";
82 print left$(bl$(qq),mr(qq)-ml(qq)+2);:next:return
99 rem ** main keyread loop
100 gosub 40:gosub 50:if a$="" and d=0 and jy=0 and jb=0 then 100
101 if(d>132)and(d<137)then qq=d-133:goto 100
102 if d=137 then sys 58235
103 if d=147 then hp(qq)=ml(qq):vp(qq)=mt(qq):gosub 80:goto 100
104 if d=19 then hp(qq)=ml(qq):vp(qq)=mt(qq):goto 100
105 if d=17 then gosub 200
106 if d=145 then gosub 210
107 if d=29 then gosub 220
108 if d=157 then gosub 230
109 if d=13 or d=10 then gosub 200:hp(qq)=ml(qq):goto 100
110 print vv$(vp(qq))tab(hp(qq))fc$(qq)ch$(qq,a);:gosub 220:goto 100
190 goto 100
199 rem cursor down
200 vp(qq)=vp(qq)+1:if vp(qq)>mb(qq) then vp(qq)=mt(qq)
201 return
209 rem cursor up
210 vp(qq)=vp(qq)-1:if vp(qq)<mt(qq) then vp(qq)=mb(qq)
211 return
219 rem cursor right
220 hp(qq)=hp(qq)+1:if hp(qq)>mr(qq) then hp(qq)=ml(qq):gosub 200
221 return
229 rem cursor left
230 hp(qq)=hp(qq)-1:if hp(qq)<ml(qq) then hp(qq)=mr(qq)
231 return
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)
801 rem initial color values
802 for i=0 to 3:read fc$(i),bc(i),cb(i):next
803 data "[155][146]",2,53281,"[146]",14,53282,"[149]",7,53283,"[158]",5 ,53284
804 rem set margins & starting cursor positions
805 for i=0 to 3:read mt(i),mb(i),ml(i),mr(i):vp(i)=mt(i):hp(i)=ml(i):next
806 data 1,15,1,18,1,9,21,38,18,23,1,18,12,23,21,38
809 rem vertical placement strings
810 vv$(0)="":for i=1 to 24:vv$(i)=vv$(i-1)+"":next
819 rem set unshifted character tables
820 for i=0 to 63:ch$(0,i)=chr$(i+32):ch$(2,i)=ch$(0,i):next
821 rem set shifted character table
822 for i=0 to 31:ch$(1,i)=chr$(i+160):ch$(3,i)=ch$(1,i):next
823 for i=32 to 63:ch$(1,i)=chr$(i+64):ch$(3,i)=ch$(1,i):next
824 rem set unshifted blank line
825 bl$(0)=" ":bl$(2)=bl$(0)
826 rem set shifted blank line
827 bl$(1)="":for i=1 to 39:bl$(1)=bl$(1)+chr$(160):next:bl$(3)=bl$(1)
829 rem initialize screen
830 print "[147]";:for qq=0 to 3:gosub 80
831 rem clear window edges
832 for i=mt(qq)-1 to mb(qq)+1:poke 1024+i*40+mr(qq)+1,32+64*qq:next:next
833 qq=0
834 for i=0 to 3:poke cb(i),bc(i):next
890 return