!--------------------------------------------------
!- søndag 1. mars 2020 00.26.32
!- import of : 
!- c:\users\stein-ove\documents\cbm64\mrhr.prg
!- commodore 64
!--------------------------------------------------

1 rem mirror horror - joystick version
4 rem advavsel - ranmmen maa ikke fjernes, ellers krasjer spillet
10 rem "mirror horror - joystick"
20 poke 53281,0:poke 53280,0
30 poke 646,5:print chr$(147):gosub 200
40 poke 646,1
100 poke 214,4:print:poke 211,3
110 print "drep monster med speilene!"
111 poke 214,6:print:poke 211,3
115 print "bruk stikka til aa rore deg rundt i spillet"
121 poke 214,8:print:poke 211,3
125 print "fire + venstre - vri speilene"
131 poke 214,10:print:poke 211,3
135 print "ikke kom borti monstere"
136 poke 214,12:print:poke 211,3
138 print "fire + stikka hoyre - skyt kanon"
139 poke 214,13:print:poke 211,3
140 print "fire + mot deg - plukke opp speil"
141 poke 214,14:print:poke 211,3
142 print "fire + fra deg er plasser spei"
143 poke 214,16:print
144 print spc(4)"tips, naar du beverger deg:"
145 print spc(5)"slipp knappen forst."
146 j = peek(56320) and 31
149 if keyb$="" and j<>15 then goto 146
154 keyb$="":
197 for cnt=1 to 100:print:next
198 poke 646,1:print chr$(147):gosub 200:goto 300
199 :rem
200 for cnt=0 to 19:rem "spill-ramme"
201 poke 1024+19-cnt+40*24,160
202 poke 1024+19-cnt+40*0,160
203 poke 1024+20+cnt+40*24,160
204 poke 1024+20+cnt+40*0,160
206 poke 1024+00+40*(12+int(12/19*cnt)),160
207 poke 1024+00+40*(12-int(12/19*cnt)),160
208 poke 1024+39+40*(12+int(12/19*cnt)),160
209 poke 1024+39+40*(12-int(12/19*cnt)),160
210 next:return
300 :rem
301 dim m(4):rem "speil vinkler"
302 m(1)=78:m(2)=67:m(3)=77:m(4)=66
303 g(1)=107:g(2)=113:g(3)=115:g(4)=114
400 :rem
401 for cnt=1 to 10:rem "stille speil"
402 mx=int(rnd(0)*37)+1
403 my=int(rnd(0)*22)+1
404 m=int(rnd(0)*4)+1
405 pk=peek(1024+mx+40*my)
406 if pk<> 32 then 402
407 poke 1024+mx+40*my,m(m):next
410 :rem
411 for cnt=1 to 10:rem "monster ut"
412 ex=int(rnd(0)*37)+1
413 ey=int(rnd(0)*22)+1
414 pk=peek(1024+ex+40*ey)
415 if pk<>32 then 412
416 poke 1024+ex+40*ey,88
417 poke55296+ex+40*ey,2:next
420 :rem
421 rem "kanon plassert"
422 gx=int(rnd(0)*37)+1
423 gy=int(rnd(0)*22)+1
424 g=int(rnd(0)*4)+1
425 pk=peek(1024+gx+40*gy)
426 if pk<>32 then 422
427 poke 1024+gx+40*gy,g(g)
428 poke55296+gx+40*gy,6
500 :rem
501 rem "spiller plassert"
502 px=int(rnd(0)*38)+1
503 py=int(rnd(0)*23)+1
504 pk=peek(1024+px+40*py)
505 if pk<>32 then 502
600 :rem
601 pk=peek(1024+px+40*py)
602 poke1024+px+40*py,81:rem rst stp
603 poke1024+px+40*py,pk:dx=0:dy=0
604 j=peek(56320) and 31:if j=31 then 602
605 if j=11 then gosub 700
606 if j=23 then dx=+1
607 if j=27 then dx=-1
608 if j=29 then  dy=+1
609 if j=30 then dy=-1
610 if j=14 or j=13 then gosub800
611 if j=7 then goto 900
617 s=peek(1024+px+dx+40*(py+dy))
618 if s=160 then 602
619 if s=88 then goto 2000
620 px=px+dx:py=py+dy:goto 601
699 :end
700 :rem
702 rem "tegne spillet"
704 ad=peek(1024+px+40*py)
706 if ad=m(1) then ad=m(2):goto 725
708 if ad=m(2) then ad=m(3):goto 725
710 if ad=m(3) then ad=m(4):goto 725
712 if ad=m(4) then ad=m(1):goto 725
714 if ad=g(1) then ad=g(2):goto 725
716 if ad=g(2) then ad=g(3):goto 725
718 if ad=g(3) then ad=g(4):goto 725
720 if ad=g(4) then ad=g(1):goto 725
725 poke 1024+px+40*py,ad:return
800 :rem
801 if j=14 then 810:pick mirr
802 for cnt=1 to 4
804 pk=peek(1024+px+40*py)
806 if pk<>m(cnt) then 809
808 poke1024+px+40*py,32:mr=mr+1
809 next
810 if j=13 then 825:place mir
812 if mr=0 then 825
814 pk=peek(1024+px+40*py)
816 if pk<>32 then 825
818 m=int(rnd(0)*4)+1:mr=mr-1
820 poke 1024+px+40*py,m(m)
825 return
900 :rem "boom, straalen"
910 pk=peek(1024+gx+40*gy)
911 :rem
912 if pk=107 then bx=+1:by=0
914 if pk=115 then bx=-1:by=0
916 if pk=114 then bx=0:by=+1
918 if pk=113 then bx=0:by=-1
920 x=gx:y=gy
921 pk=peek(1024+x+40*y)
922 if pk=32 then poke 1024+x+40*y,102
924 if pk=88 then sc=sc+1000
925 if pk=88 then poke 1024+x+40*y,86
926 x=x+bx:y=y+by
928 pk=peek(1024+x+40*y)
929 if pk<>66 then 932
930 if bx=+1 and by=0 then d=2
931 if bx=-1 and by=0 then d=1
932 if pk<>67 then 945
937 if bx=0 and by=+1 then d=4
941 if bx=0 and by=-1 then d=3
945 if pk<>78 then 950
946 if bx=+1 and by=0 then d=4:
947 if bx=-1 and by=0 then d=3:
948 if bx=0 and by=+1 then d=2:
949 if bx=0 and by=-1 then d=1:
950 if pk<>77 then 960
952 if bx=+1 and by=0 then d=3
954 if bx=-1 and by=0 then d=4
956 if bx=0 and by=+1 then d=1
958 if bx=0 and by=-1 then d=2
960 if d=1 then bx=+1:by=0
962 if d=2 then bx=-1:by=0
964 if d=3 then bx=0:by=+1
966 if d=4 then bx=0:by=-1
999 if pk<>160 then 921
1000 rem "slutten paa straale"
1001 print chr$(147):
1010 x=2:y=2:x$=" bra jobba":gosub 3000
1020 x=3:y=4:x$="du kverket ":gosub 3000
1040 x$=str$(sc/1000)+" monster av 10 mulige"
1050 x=4:y=6:gosub 3000:
1060 x=4:y=8:x$="en gang til?":gosub 3000
1068 x=9:y=12:x$=":ja:":gosub 3000
1069 x=9:y=14:x$=":nei:":gosub 3000
1070 x=8:y=13:d=1
1071 j = peek(56320) and 31 
1072 if j = 29 then d=2
1075 if j = 30 then d=1
1076 if d=1 then poke 1024+x+40*y,81:poke 1024+x+40*(y+2),32
1077 if d=2 then poke 1024+x+40*y,32:poke 1024+x+40*(y+2),81
1080 if j=15 and d=1 then run
1090 if j=15 and d=2 then end
1099 goto 1071
2000 :rem
2001 poke 214,12:print:poke 211,13
2002 print chr$(10);"            ";chr$(146)
2004 poke 214,13:print:poke 211,13
2006 print chr$(10);" spill over ";chr$(146)
2008 poke 214,14:print:poke 211,13
2009 print chr$(10);"            ";chr$(146)
2010 for wt=0 to 400:next wt:
2011 print chr$(147);
2012 print " vi prover igjen "
2013 for wt=0 to 400:next wt:run
3000 poke 214,y:print:poke 211,x
3010 print x$;:return