home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 April
/
Ahoy_Magazine_85-04_1985_Double_L.d64
/
joyvic
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
845b
|
45 lines
1 rem vic joystick
2 rem
3 rem stop this program by pressing joystick button!!!
4 rem
10 gosub 600:gosub 500
80 v=10:h=10
90 goto 140
97 rem
98 rem main movement loop
99 rem
100 s=(peek(37137)and 60)or (peek(37152)and 128)
101 if (s and 4)=0 then v=v-1
102 if (s and 8)=0 then v=v+1
103 if (s and 16)=0 then h=h-1
104 if (s and 128)=0 then h=h+1
105 if (s and 32)=0 then poke 37154,255:end
110 if h=hx and v=vx then 100
120 if v>be then v=v-bf
121 if v<0 then v=v+bf
122 if h>re then h=h-rf
123 if h<0 then h=h+rf
140 print vm$(vx)tab(hx)" "vm$(v)tab(h)pf$
150 hx=h:vx=v
190 goto 100
497 rem
498 rem set up movement strings
499 rem
500 dim vm$(be):vm$(0)=chr$(19)
510 for i=1 to be:vm$(i)=vm$(i-1)+chr$(17):next i
540 return
597 rem
598 rem set up screen margins
599 rem
600 re=20
605 rf=21
610 be=21
615 bf=22
620 pf$=chr$(122):rem player-figure
627 rem
628 rem screen color
629 rem
630 poke 36879,8:print chr$(147)
660 poke 37154,127:rem enable joystick (disables part of keyboard)
690 return