News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_rk last

Sensational Games For The Amstrad CPC 464

Started by rk last, 23:00, 29 August 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rk last

Today I typed up one of the game listings from the book - Kinkey Kong.  I ran it via WinAPE (64k) and found the SYMBOL AFTER command wasn't accepted (i was left with no choice but to REM it).  After ironing out a few more problems I got the listing running but the joystick/key controls dont seem to work.

500 symbol after 228
510 symbol 241,66,126,66,66,66,126,66,66
520 symbol 242,60,66,189,165,165,189,66,60
530 symbol 243,255,165,165,36,66,66,129,129
540 symbol 244,56,60,16,44,52,56,16,28
550 symbol 245,28,60,8,52,44,28,8,56
560 symbol 246,186,186,146,124,56,68,130,130
600 memory 34495
750 gosub 22000
1000 gosub 20000
1100 gosub 19000
1500 if lev=1 then gosub 21100
1510 if lev=2 then gosub 21200
1520 if lev=3 then gosub 21300
1540 gosub 21500
1550 x=2:y=23
1560 bx=1:by=7:bd=1:be=0
1570 cx=20:cy=7:cd=-1:ce=0
1580 if lev=3 then bx=7:cx=13
1800 gosub 24000
1810 gosub 25000
1820 gosub 24500
1830 pen 7
1840 locate x,y:print om$
1850 gosub 23000
1860 if y=1 then gosub 3000
1870 locate x,y
1880 gosub 30000
1890 if ch<>241 and ch<>32 then goto 5000
1900 locate x,y+1
1910 gosub 30000
1920 if ch=32 then y=y+1
1940 pen 7
1950 locate bx,by:print ob$
1960 locate cx,cy:print oc$
2000 goto 1800
3000 lev=lev+1:if lev=4 then lev=1
3050 sc=sc+(lev*50)
3060 locate 7,25:print sc
3070 goto 1500
5000 sound 2,300,75,15,0,0,3
5010 li=li-1:if li=0 then goto 6000
5020 for n=1 to li
5030 locate 17+n,25
5040 next
5050 print " ";
5060 goto 1500
6000 cls
6010 print "  TOUGH MONKEYS !"
6020 PRINT "----------------"
6030 locate 3,10:print "You scored ";sc;
6040 locate 5,25:print "Press any key"
6050 a$=inkey$: if a$="" then goto 6050
6060 sound 1,250,25,15
6070 goto 1000
9980 rem >>>>> monster <<<<<<
10000 symbol 228,0,0,16,44,62,28,56,112
10010 symbol 229,129,66,126,90,126,106,80,60
10020 symbol 230,0,0,8,52,124,56,28,14
10030 symbol 231,112,121,127,63,31,7,1,1
10040 symbol 232,14,158,254,252,248,224,128,128
10050 symbol 233,14,158,254,252,248,224,128,128
10060 symbol 234,1,3,15,15,31,63,62,62
10070 symbol 235,171,213,235,215,235,255,60,0
10080 symbol 236,128,192,240,240,248,252,124,124
10090 symbol 237,30,15,15,3,59,127,12757
10100 symbol 238,0,0,0,0,129,195,195,129
10110 symbol 239,120,240,240,192,220,254,254,156
10120 pen 15
10130 locate 2,1:print chr$(228);chr$(229);chr$(230)
10140 locate2,2:print chr$(231);chr$(232);chr$(233)
10150 locate 2,3:print chr$(234);chr$(235);chr$(236)
10160 locate 2,4;print chr$(237);chr$(238);chr$(239)
10200 return
18980 rem >>> start game <<<
19000 sc=0:li=3
19010 lev=1
19020 l$=chr$(241)
19030 b$=chr$(242):m$=chr$(244)
19100 return
19980 rem >>> set screen <<<
20000 restore 20200
20010 for n=0 to 15
20020 read a
20030 ink n,a
20040 next
20050 border 0:paper 0:pen 1:mode 0
20100 return
20200 data 0,18,6,24,20,7,15,2
20210 data 22,12,17,9,26,3,22,13
20980 rem >>> screen <<<
21000 p$=string$(20,243)
21010 cls:pe=1
21020 for n=8 to 24 step 4
21025 pen pe
21030 locate 1,n:print p$
21040 pe=pe+1
21070 next n
21080 return
21095 rem >>> one <<<
21100 gosub 21000
21120 for n=9 to 20 step 4
21130 po=rnd(1)*17+2
21140 if n<24 then locate po,n:print " "
21150 lpo=rnd(1)*17+2:if lpo=po then goto 21150
21160 if n<>24 then po=lpo:gosub 21700
21170 pen 10
21180 next

21190 return
21195 rem >>> two <<<
21200 gosub 21000
21205 pen 12
21210 for n=13 to 24
21220 locate 7,n:print string$(8,207)
21230 next n
21240 locate 7,19:print string$(8,32)
21250 locate 7,23:print string$(8,32)
21270 po=8:n=8:gosub 21700;po=18:n=12:gosub 21700
21280 pen 10
21292 return
21295 rem >>> three <<<
21300 gosub 21000
21310 locate 1,8:print string$(5,32)
21320 locate 16,8:print string$(5,32)
21330 locate 1.12:print string$(4,32)
21340 locate 17,12:print string$(4,32)
21350 locate 1,16:print string$(2,32)
21360 locate 19,16:print string$(2,32)
21370 po=7:n=12:gosub 21700
21380 po=14:n=12:gosub 21700
21390 po=2:n=20:gosub 21700
21400 po=19:n=20:gosub 21700
21410 po=9:n=16:gosub 21700
21420 po=9:n=16:gosub 21700
21430 po=10:n=8:gosub 21700
21440 po=11:n=8:gosub 21700
21450 locate 6,20:print " ":locate 15,20: print " "
21455 pen 10
21480 return
21490 rem >>> top <<<
21500 locate 1,25
21510 print "SCORE:";sc
21520 locate 16,25
21525 pen 6
21530 for n=1 to li
21540 print chr$(248);
21550 next n
21555 pen 7
21560 locate 15,6:print string$(5,243)
21570 plot 0,325:draw 150,325
21580 po=18:n=2:gosub 21700
21680 return
21690 rem >>> ladder <<<
21700 for z=0 to 3
21705 pen 7
21710 locate po,n+z
21720 print l$
21730 next z
21740 return
21980 rem >>> initialize <<<
22000 addr=34999: gosub 29500
22010 loca=35024:gosub 30500
22150 return
22980 rem >>> move <<<
23000 gosub 29000
23050 if le=1 and x>2 then x=x-1:m$=chr$(245)
23060 if ri=1 and x<19 then x=x+1:m$=chr$(244)
23070 if up=1 then m$=chr$(246):goto 23300
23080 if do=1 then m$=chr$(246):goto 23400
23090 if fi=1 then goto 23500
23250 return
23300 locate x,y-1
23305 gosub 30000
23310 if ch<>241 then goto 23350
23320 y=y-1:goto 23080
23350 locate x,y+1
23360 gosub 30000
23370 if ch=241 then goto 23320
23380 goto 23080
23400 locate x,y+1
23405 gosub 30000
23410 if ch<>241 then goto 23090
23420 y=y-1:goto 23090
23500 if m$=chr$(245) then xd=-1 else xd=1
23510 if X<2 or x>19 then xd=0
23520 if m$=chr$(246) then xd=0
23530 locate bx,by: print ob$
23540 locate cx,cy:print oc$
23610 restore 23750
23650 for n=1 to 6
23660 read a
23670 y=y+a:gosub 23850
23680 if plat=1 then n=11
23690 next

23700 gosub 24500
23710 return
23750 data -1,-1,0,0,1,1
23850 x=x+xd:plat=0
23860 locate x,y+1
23870 gosub 30000
23880 if ch<>32 then plat=1:return
23890 if x<2 then x=2
23895 if x>19 then x=19
23900 gosub 24000
23910 gosub 24500
23920 sound 2,100,2,15
23925 pen 7
23930 locate bx,by:print ob$
23935 locate cx,cy:print oc$
23940 gosub 25000
23950 locate x,y:print om$
23960 return
23980 rem >>> print <<<
23995 rem >>> man <<<
24000 locate x,y:gosub 30000
24010 om$=chr$(ch)
24020 pen 2
24050 print m$
24100 return
24490 rem >>> barrels <<<
24500 locate bx,by:gosub 30000
24510 ob$=chr$(ch)
24520 locate cx,cy:gosub 30000
24530 oc$=chr$(ch)
24540 pen 3
24550 locate bx,by
24560 print b$
24570 locate cx,cy
24580 print b$
24600 return
24980 rem >>> barrel <<<
25000 a=rnd(1)*10
25005 locate bx,by+1
25010 gosub 30000
25020 if ch=32 or ch=241 and a>5 then be=1
25030 if ch=243 then be=0
25040 by=by+be:if be=0 then bx=bx+bd
25050 locate cx,cy+1
25060 gosub 30000
25070 if ch=32 or ch=241 and a>5 then ce=1
25080 if ch=243 then ce=0
25090 cy=cy+ce:if ce=0 then cx=cx+cd
25100 if bx<2 then bd=1
25105 if bx>19 then bd=-1
25110 if cx<2 then cd=1
25115 if cx>19 then cd=-1
25130 if (bx<2 or bx>19) and by=23 then bx=1:bd=1:by=7:if lev=3 then bx+7
25140 if (cx<2 or cx>19) and cy=23 then cx=20:cd=-1:cy=7: if lev=3 then cx=13
25250 return

28980 rem >>> faster keys/joystick routine <<<
29000 le=0:ri=0:up=0:do=0:fi=0:ex=0:q=0
29010 call addr+1:a=peek(addr)
29020 if a=8 or a=242 then le=1
29030 if a=9 or a=243 then ri=1
29040 if a=11 or a=240 then up=1
29050 if a=10 or a=241 then do=1
29060 if a=88 or a=224 then fi=1
29070 if a=13 then q=1
29080 if a=32 then ex=1
29090 return


29480 rem >>> poke inkeys <<<
29500 c=int(addr/256):b=addr-256*c
29510 restore 29580
29520 for x=addr to addr+13
29530 read a:if a=999 then a=b
29540 if a=998 then a=c
29550 poke n,a
29560 next n
29570 return
29580 data 0,62,0,50,999,998,205,27
29590 data 187,208,50,999,998,201

29980 rem >>> char check/collision routine <<<
30000 call loca+1
30010 ch=peek(loca)
30020 return
30480 rem >>> poke check <<<
30500 c=int(loca/256):b=loca-256*c
30510 restore 30580
30520 for n=loca to loca+13
30530 read a:if a=999 then a=b
30540 if a=998 then a=c
30550 poke n,a
30560 next n
30570 return
30580 data 0,62,244,50,999,998,205,96
30590 data 187,208,50,999,998,201

maRK

Fabrizio Radica

Quote from: rk last on 23:00, 29 August 16
Today I typed up one of the game listings from the book - Kinkey Kong.  I ran it via WinAPE (64k) and found the SYMBOL AFTER command wasn't accepted (i was left with no choice but to REM it).  After ironing out a few more problems I got the listing running but the joystick/key controls dont seem to work.

500 symbol after 228
510 symbol 241,66,126,66,66,66,126,66,66
520 symbol 242,60,66,189,165,165,189,66,60
530 symbol 243,255,165,165,36,66,66,129,129
540 symbol 244,56,60,16,44,52,56,16,28
550 symbol 245,28,60,8,52,44,28,8,56
560 symbol 246,186,186,146,124,56,68,130,130
600 memory 34495
750 gosub 22000
1000 gosub 20000
1100 gosub 19000
1500 if lev=1 then gosub 21100
1510 if lev=2 then gosub 21200
1520 if lev=3 then gosub 21300
1540 gosub 21500
1550 x=2:y=23
1560 bx=1:by=7:bd=1:be=0
1570 cx=20:cy=7:cd=-1:ce=0
1580 if lev=3 then bx=7:cx=13
1800 gosub 24000
1810 gosub 25000
1820 gosub 24500
1830 pen 7
1840 locate x,y:print om$
1850 gosub 23000
1860 if y=1 then gosub 3000
1870 locate x,y
1880 gosub 30000
1890 if ch<>241 and ch<>32 then goto 5000
1900 locate x,y+1
1910 gosub 30000
1920 if ch=32 then y=y+1
1940 pen 7
1950 locate bx,by:print ob$
1960 locate cx,cy:print oc$
2000 goto 1800
3000 lev=lev+1:if lev=4 then lev=1
3050 sc=sc+(lev*50)
3060 locate 7,25:print sc
3070 goto 1500
5000 sound 2,300,75,15,0,0,3
5010 li=li-1:if li=0 then goto 6000
5020 for n=1 to li
5030 locate 17+n,25
5040 next
5050 print " ";
5060 goto 1500
6000 cls
6010 print "  TOUGH MONKEYS !"
6020 PRINT "----------------"
6030 locate 3,10:print "You scored ";sc;
6040 locate 5,25:print "Press any key"
6050 a$=inkey$: if a$="" then goto 6050
6060 sound 1,250,25,15
6070 goto 1000
9980 rem >>>>> monster <<<<<<
10000 symbol 228,0,0,16,44,62,28,56,112
10010 symbol 229,129,66,126,90,126,106,80,60
10020 symbol 230,0,0,8,52,124,56,28,14
10030 symbol 231,112,121,127,63,31,7,1,1
10040 symbol 232,14,158,254,252,248,224,128,128
10050 symbol 233,14,158,254,252,248,224,128,128
10060 symbol 234,1,3,15,15,31,63,62,62
10070 symbol 235,171,213,235,215,235,255,60,0
10080 symbol 236,128,192,240,240,248,252,124,124
10090 symbol 237,30,15,15,3,59,127,12757
10100 symbol 238,0,0,0,0,129,195,195,129
10110 symbol 239,120,240,240,192,220,254,254,156
10120 pen 15
10130 locate 2,1:print chr$(228);chr$(229);chr$(230)
10140 locate2,2:print chr$(231);chr$(232);chr$(233)
10150 locate 2,3:print chr$(234);chr$(235);chr$(236)
10160 locate 2,4;print chr$(237);chr$(238);chr$(239)
10200 return
18980 rem >>> start game <<<
19000 sc=0:li=3
19010 lev=1
19020 l$=chr$(241)
19030 b$=chr$(242):m$=chr$(244)
19100 return
19980 rem >>> set screen <<<
20000 restore 20200
20010 for n=0 to 15
20020 read a
20030 ink n,a
20040 next
20050 border 0:paper 0:pen 1:mode 0
20100 return
20200 data 0,18,6,24,20,7,15,2
20210 data 22,12,17,9,26,3,22,13
20980 rem >>> screen <<<
21000 p$=string$(20,243)
21010 cls:pe=1
21020 for n=8 to 24 step 4
21025 pen pe
21030 locate 1,n:print p$
21040 pe=pe+1
21070 next n
21080 return
21095 rem >>> one <<<
21100 gosub 21000
21120 for n=9 to 20 step 4
21130 po=rnd(1)*17+2
21140 if n<24 then locate po,n:print " "
21150 lpo=rnd(1)*17+2:if lpo=po then goto 21150
21160 if n<>24 then po=lpo:gosub 21700
21170 pen 10
21180 next

21190 return
21195 rem >>> two <<<
21200 gosub 21000
21205 pen 12
21210 for n=13 to 24
21220 locate 7,n:print string$(8,207)
21230 next n
21240 locate 7,19:print string$(8,32)
21250 locate 7,23:print string$(8,32)
21270 po=8:n=8:gosub 21700;po=18:n=12:gosub 21700
21280 pen 10
21292 return
21295 rem >>> three <<<
21300 gosub 21000
21310 locate 1,8:print string$(5,32)
21320 locate 16,8:print string$(5,32)
21330 locate 1.12:print string$(4,32)
21340 locate 17,12:print string$(4,32)
21350 locate 1,16:print string$(2,32)
21360 locate 19,16:print string$(2,32)
21370 po=7:n=12:gosub 21700
21380 po=14:n=12:gosub 21700
21390 po=2:n=20:gosub 21700
21400 po=19:n=20:gosub 21700
21410 po=9:n=16:gosub 21700
21420 po=9:n=16:gosub 21700
21430 po=10:n=8:gosub 21700
21440 po=11:n=8:gosub 21700
21450 locate 6,20:print " ":locate 15,20: print " "
21455 pen 10
21480 return
21490 rem >>> top <<<
21500 locate 1,25
21510 print "SCORE:";sc
21520 locate 16,25
21525 pen 6
21530 for n=1 to li
21540 print chr$(248);
21550 next n
21555 pen 7
21560 locate 15,6:print string$(5,243)
21570 plot 0,325:draw 150,325
21580 po=18:n=2:gosub 21700
21680 return
21690 rem >>> ladder <<<
21700 for z=0 to 3
21705 pen 7
21710 locate po,n+z
21720 print l$
21730 next z
21740 return
21980 rem >>> initialize <<<
22000 addr=34999: gosub 29500
22010 loca=35024:gosub 30500
22150 return
22980 rem >>> move <<<
23000 gosub 29000
23050 if le=1 and x>2 then x=x-1:m$=chr$(245)
23060 if ri=1 and x<19 then x=x+1:m$=chr$(244)
23070 if up=1 then m$=chr$(246):goto 23300
23080 if do=1 then m$=chr$(246):goto 23400
23090 if fi=1 then goto 23500
23250 return
23300 locate x,y-1
23305 gosub 30000
23310 if ch<>241 then goto 23350
23320 y=y-1:goto 23080
23350 locate x,y+1
23360 gosub 30000
23370 if ch=241 then goto 23320
23380 goto 23080
23400 locate x,y+1
23405 gosub 30000
23410 if ch<>241 then goto 23090
23420 y=y-1:goto 23090
23500 if m$=chr$(245) then xd=-1 else xd=1
23510 if X<2 or x>19 then xd=0
23520 if m$=chr$(246) then xd=0
23530 locate bx,by: print ob$
23540 locate cx,cy:print oc$
23610 restore 23750
23650 for n=1 to 6
23660 read a
23670 y=y+a:gosub 23850
23680 if plat=1 then n=11
23690 next

23700 gosub 24500
23710 return
23750 data -1,-1,0,0,1,1
23850 x=x+xd:plat=0
23860 locate x,y+1
23870 gosub 30000
23880 if ch<>32 then plat=1:return
23890 if x<2 then x=2
23895 if x>19 then x=19
23900 gosub 24000
23910 gosub 24500
23920 sound 2,100,2,15
23925 pen 7
23930 locate bx,by:print ob$
23935 locate cx,cy:print oc$
23940 gosub 25000
23950 locate x,y:print om$
23960 return
23980 rem >>> print <<<
23995 rem >>> man <<<
24000 locate x,y:gosub 30000
24010 om$=chr$(ch)
24020 pen 2
24050 print m$
24100 return
24490 rem >>> barrels <<<
24500 locate bx,by:gosub 30000
24510 ob$=chr$(ch)
24520 locate cx,cy:gosub 30000
24530 oc$=chr$(ch)
24540 pen 3
24550 locate bx,by
24560 print b$
24570 locate cx,cy
24580 print b$
24600 return
24980 rem >>> barrel <<<
25000 a=rnd(1)*10
25005 locate bx,by+1
25010 gosub 30000
25020 if ch=32 or ch=241 and a>5 then be=1
25030 if ch=243 then be=0
25040 by=by+be:if be=0 then bx=bx+bd
25050 locate cx,cy+1
25060 gosub 30000
25070 if ch=32 or ch=241 and a>5 then ce=1
25080 if ch=243 then ce=0
25090 cy=cy+ce:if ce=0 then cx=cx+cd
25100 if bx<2 then bd=1
25105 if bx>19 then bd=-1
25110 if cx<2 then cd=1
25115 if cx>19 then cd=-1
25130 if (bx<2 or bx>19) and by=23 then bx=1:bd=1:by=7:if lev=3 then bx+7
25140 if (cx<2 or cx>19) and cy=23 then cx=20:cd=-1:cy=7: if lev=3 then cx=13
25250 return

28980 rem >>> faster keys/joystick routine <<<
29000 le=0:ri=0:up=0:do=0:fi=0:ex=0:q=0
29010 call addr+1:a=peek(addr)
29020 if a=8 or a=242 then le=1
29030 if a=9 or a=243 then ri=1
29040 if a=11 or a=240 then up=1
29050 if a=10 or a=241 then do=1
29060 if a=88 or a=224 then fi=1
29070 if a=13 then q=1
29080 if a=32 then ex=1
29090 return


29480 rem >>> poke inkeys <<<
29500 c=int(addr/256):b=addr-256*c
29510 restore 29580
29520 for x=addr to addr+13
29530 read a:if a=999 then a=b
29540 if a=998 then a=c
29550 poke n,a
29560 next n
29570 return
29580 data 0,62,0,50,999,998,205,27
29590 data 187,208,50,999,998,201

29980 rem >>> char check/collision routine <<<
30000 call loca+1
30010 ch=peek(loca)
30020 return
30480 rem >>> poke check <<<
30500 c=int(loca/256):b=loca-256*c
30510 restore 30580
30520 for n=loca to loca+13
30530 read a:if a=999 then a=b
30540 if a=998 then a=c
30550 poke n,a
30560 next n
30570 return
30580 data 0,62,244,50,999,998,205,96
30590 data 187,208,50,999,998,201




Here code corrected and working  ;)
Only simple typing error at 29550 and 29560 :)



500 'symbol after 228
510 symbol 241,66,126,66,66,66,126,66,66
520 symbol 242,60,66,189,165,165,189,66,60
530 symbol 243,255,165,165,36,66,66,129,129
540 symbol 244,56,60,16,44,52,56,16,28
550 symbol 245,28,60,8,52,44,28,8,56
560 symbol 246,186,186,146,124,56,68,130,130
600 memory 34495
750 gosub 22000
1000 gosub 20000
1100 gosub 19000
1500 if lev=1 then gosub 21100
1510 if lev=2 then gosub 21200
1520 if lev=3 then gosub 21300
1540 gosub 21500
1550 x=2:y=23
1560 bx=1:by=7:bd=1:be=0
1570 cx=20:cy=7:cd=-1:ce=0
1580 if lev=3 then bx=7:cx=13
1800 gosub 24000
1810 gosub 25000
1820 gosub 24500
1830 pen 7
1840 locate x,y:print om$
1850 gosub 23000
1860 if y=1 then gosub 3000
1870 locate x,y
1880 gosub 30000
1890 if ch<>241 and ch<>32 then goto 5000
1900 locate x,y+1
1910 gosub 30000
1920 if ch=32 then y=y+1
1940 pen 7
1950 locate bx,by:print ob$
1960 locate cx,cy:print oc$
2000 goto 1800
3000 lev=lev+1:if lev=4 then lev=1
3050 sc=sc+(lev*50)
3060 locate 7,25:print sc
3070 goto 1500
5000 sound 2,300,75,15,0,0,3
5010 li=li-1:if li=0 then goto 6000
5020 for n=1 to li
5030 locate 17+n,25
5040 next
5050 print " ";
5060 goto 1500
6000 cls
6010 print "  TOUGH MONKEYS !"
6020 PRINT "----------------"
6030 locate 3,10:print "You scored ";sc;
6040 locate 5,25:print "Press any key"
6050 a$=inkey$: if a$="" then goto 6050
6060 sound 1,250,25,15
6070 goto 1000
9980 rem >>>>> monster <<<<<<
10000 symbol 228,0,0,16,44,62,28,56,112
10010 symbol 229,129,66,126,90,126,106,80,60
10020 symbol 230,0,0,8,52,124,56,28,14
10030 symbol 231,112,121,127,63,31,7,1,1
10040 symbol 232,14,158,254,252,248,224,128,128
10050 symbol 233,14,158,254,252,248,224,128,128
10060 symbol 234,1,3,15,15,31,63,62,62
10070 symbol 235,171,213,235,215,235,255,60,0
10080 symbol 236,128,192,240,240,248,252,124,124
10090 symbol 237,30,15,15,3,59,127,12757
10100 symbol 238,0,0,0,0,129,195,195,129
10110 symbol 239,120,240,240,192,220,254,254,156
10120 pen 15
10130 locate 2,1:print chr$(228);chr$(229);chr$(230)
10140 locate2,2:print chr$(231);chr$(232);chr$(233)
10150 locate 2,3:print chr$(234);chr$(235);chr$(236)
10160 locate 2,4;print chr$(237);chr$(238);chr$(239)
10200 return
18980 rem >>> start game <<<
19000 sc=0:li=3
19010 lev=1
19020 l$=chr$(241)
19030 b$=chr$(242):m$=chr$(244)
19100 return
19980 rem >>> set screen <<<
20000 restore 20200
20010 for n=0 to 15
20020 read a
20030 ink n,a
20040 next
20050 border 0:paper 0:pen 1:mode 0
20100 return
20200 data 0,18,6,24,20,7,15,2
20210 data 22,12,17,9,26,3,22,13
20980 rem >>> screen <<<
21000 p$=string$(20,243)
21010 cls:pe=1
21020 for n=8 to 24 step 4
21025 pen pe
21030 locate 1,n:print p$
21040 pe=pe+1
21070 next n
21080 return
21095 rem >>> one <<<
21100 gosub 21000
21120 for n=9 to 20 step 4
21130 po=rnd(1)*17+2
21140 if n<24 then locate po,n:print " "
21150 lpo=rnd(1)*17+2:if lpo=po then goto 21150
21160 if n<>24 then po=lpo:gosub 21700
21170 pen 10
21180 next


21190 return
21195 rem >>> two <<<
21200 gosub 21000
21205 pen 12
21210 for n=13 to 24
21220 locate 7,n:print string$(8,207)
21230 next n
21240 locate 7,19:print string$(8,32)
21250 locate 7,23:print string$(8,32)
21270 po=8:n=8:gosub 21700;po=18:n=12:gosub 21700
21280 pen 10
21292 return
21295 rem >>> three <<<
21300 gosub 21000
21310 locate 1,8:print string$(5,32)
21320 locate 16,8:print string$(5,32)
21330 locate 1.12:print string$(4,32)
21340 locate 17,12:print string$(4,32)
21350 locate 1,16:print string$(2,32)
21360 locate 19,16:print string$(2,32)
21370 po=7:n=12:gosub 21700
21380 po=14:n=12:gosub 21700
21390 po=2:n=20:gosub 21700
21400 po=19:n=20:gosub 21700
21410 po=9:n=16:gosub 21700
21420 po=9:n=16:gosub 21700
21430 po=10:n=8:gosub 21700
21440 po=11:n=8:gosub 21700
21450 locate 6,20:print " ":locate 15,20: print " "
21455 pen 10
21480 return
21490 rem >>> top <<<
21500 locate 1,25
21510 print "SCORE:";sc
21520 locate 16,25
21525 pen 6
21530 for n=1 to li
21540 print chr$(248);
21550 next n
21555 pen 7
21560 locate 15,6:print string$(5,243)
21570 plot 0,325:draw 150,325
21580 po=18:n=2:gosub 21700
21680 return
21690 rem >>> ladder <<<
21700 for z=0 to 3
21705 pen 7
21710 locate po,n+z
21720 print l$
21730 next z
21740 return
21980 rem >>> initialize <<<
22000 addr=34999: gosub 29500
22010 loca=35024:gosub 30500
22150 return
22980 rem >>> move <<<
23000 gosub 29000
23050 if le=1 and x>2 then x=x-1:m$=chr$(245)
23060 if ri=1 and x<19 then x=x+1:m$=chr$(244)
23070 if up=1 then m$=chr$(246):goto 23300
23080 if do=1 then m$=chr$(246):goto 23400
23090 if fi=1 then goto 23500
23250 return
23300 locate x,y-1
23305 gosub 30000
23310 if ch<>241 then goto 23350
23320 y=y-1:goto 23080
23350 locate x,y+1
23360 gosub 30000
23370 if ch=241 then goto 23320
23380 goto 23080
23400 locate x,y+1
23405 gosub 30000
23410 if ch<>241 then goto 23090
23420 y=y-1:goto 23090
23500 if m$=chr$(245) then xd=-1 else xd=1
23510 if X<2 or x>19 then xd=0
23520 if m$=chr$(246) then xd=0
23530 locate bx,by: print ob$
23540 locate cx,cy:print oc$
23610 restore 23750
23650 for n=1 to 6
23660 read a
23670 y=y+a:gosub 23850
23680 if plat=1 then n=11
23690 next


23700 gosub 24500
23710 return
23750 data -1,-1,0,0,1,1
23850 x=x+xd:plat=0
23860 locate x,y+1
23870 gosub 30000
23880 if ch<>32 then plat=1:return
23890 if x<2 then x=2
23895 if x>19 then x=19
23900 gosub 24000
23910 gosub 24500
23920 sound 2,100,2,15
23925 pen 7
23930 locate bx,by:print ob$
23935 locate cx,cy:print oc$
23940 gosub 25000
23950 locate x,y:print om$
23960 return
23980 rem >>> print <<<
23995 rem >>> man <<<
24000 locate x,y:gosub 30000
24010 om$=chr$(ch)
24020 pen 2
24050 print m$
24100 return
24490 rem >>> barrels <<<
24500 locate bx,by:gosub 30000
24510 ob$=chr$(ch)
24520 locate cx,cy:gosub 30000
24530 oc$=chr$(ch)
24540 pen 3
24550 locate bx,by
24560 print b$
24570 locate cx,cy
24580 print b$
24600 return
24980 rem >>> barrel <<<
25000 a=rnd(1)*10
25005 locate bx,by+1
25010 gosub 30000
25020 if ch=32 or ch=241 and a>5 then be=1
25030 if ch=243 then be=0
25040 by=by+be:if be=0 then bx=bx+bd
25050 locate cx,cy+1
25060 gosub 30000
25070 if ch=32 or ch=241 and a>5 then ce=1
25080 if ch=243 then ce=0
25090 cy=cy+ce:if ce=0 then cx=cx+cd
25100 if bx<2 then bd=1
25105 if bx>19 then bd=-1
25110 if cx<2 then cd=1
25115 if cx>19 then cd=-1
25130 if (bx<2 or bx>19) and by=23 then bx=1:bd=1:by=7:if lev=3 then bx+7
25140 if (cx<2 or cx>19) and cy=23 then cx=20:cd=-1:cy=7: if lev=3 then cx=13
25250 return

28980 rem >>> faster keys/joystick routine <<<
29000 le=0:ri=0:up=0:do=0:fi=0:ex=0:q=0
29010 call addr+1:a=peek(addr)
29020 if a=8 or a=242 then le=1
29030 if a=9 or a=243 then ri=1
29040 if a=11 or a=240 then up=1
29050 if a=10 or a=241 then do=1
29060 if a=88 or a=224 then fi=1
29070 if a=13 then q=1
29080 if a=32 then ex=1
29090 return



29480 rem >>> poke inkeys <<<
29500 c=int(addr/256):b=addr-256*c
29510 restore 29580
29520 for x=addr to addr+13
29530 read a:if a=999 then a=b
29540 if a=998 then a=c
29550 poke x,a 'ERROR corrected FAB
29560 next x 'ERROR corrected FAB
29570 return
29580 data 0,62,0,50,999,998,205,27
29590 data 187,208,50,999,998,201

29980 rem >>> char check/collision routine <<<
30000 call loca+1
30010 ch=peek(loca)
30020 return
30480 rem >>> poke check <<<
30500 c=int(loca/256):b=loca-256*c
30510 restore 30580
30520 for n=loca to loca+13
30530 read a:if a=999 then a=b
30540 if a=998 then a=c
30550 poke n,a
30560 next n
30570 return
30580 data 0,62,244,50,999,998,205,96
30590 data 187,208,50,999,998,201

rk last

#2
Thank you!  I was distracted on three occasions whilst typing up that code.  If there is interest in those type-ins I will add more of them from the book here.

Fabrizio, those two very small machine code routines may be ideal for your own project.
maRK

AMSDOS

There's also some additional pages at the end of the PDF with Corrections for some of the programs from that book.
* Using the old Amstrad Languages :D * And create my own ;)
* Incorporating the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

rk last

I have amended a couple of lines in the ladder routine.  You and the barrels can now interact with them.

21700 for z=0 to 7
21710 locate po,n+z-1
maRK

Fabrizio Radica

Quote from: rk last on 11:09, 30 August 16


Fabrizio, those two very small machine code routines may be ideal for your own project.


yes! thanks :)
i'll try to use them... That made me think of an idea :D

rk last

Heres the code with errors ironed out.

500 Rem >>> A most bizarre line numbering system is employed below :) <<<
510 symbol 241,66,126,66,66,66,126,66,66
520 symbol 242,60,66,189,165,165,189,66,60
530 symbol 243,255,165,165,36,66,66,129,129
540 symbol 244,56,60,16,44,52,56,16,28
550 symbol 245,28,60,8,52,44,28,8,56
560 symbol 246,186,186,146,124,56,68,130,130
600 memory 34495
750 gosub 22000
1000 gosub 20000
1100 gosub 19000
1500 if lev=1 then gosub 21100
1510 if lev=2 then gosub 21200
1520 if lev=3 then gosub 21300
1540 gosub 21500
1550 x=2:y=23
1560 bx=1:by=7:bd=1:be=0
1570 cx=20:cy=7:cd=-1:ce=0
1580 if lev=3 then bx=7:cx=13
1800 gosub 24000
1810 gosub 25000
1820 gosub 24500
1830 pen 7
1840 locate x,y:print om$
1850 gosub 23000
1860 if y=1 then gosub 3000
1870 locate x,y
1880 gosub 30000
1890 if ch<>241 and ch<>32 then goto 5000
1900 locate x,y+1
1910 gosub 30000
1920 if ch=32 then y=y+1
1940 pen 7
1950 locate bx,by:print ob$
1960 locate cx,cy:print oc$
2000 goto 1800
3000 lev=lev+1:if lev=4 then lev=1
3050 sc=sc+(lev*50)
3060 locate 7,25:print sc
3070 goto 1500
5000 sound 2,300,75,15,0,0,3
5010 li=li-1:if li=0 then goto 6000
5020 for n=1 to li
5030 locate 17+n,25
5040 next
5050 print " ";
5060 goto 1500
6000 cls
6010 print "  TOUGH MONKEYS !"
6020 PRINT "----------------"
6030 locate 3,10:print "You scored ";sc;
6040 locate 5,25:print "Press any key"
6050 a$=inkey$: if a$="" then goto 6050
6060 sound 1,250,25,15
6070 goto 1000
9980 rem >>>>> monster <<<<<<
10000 symbol 228,0,0,16,44,62,28,56,112
10010 symbol 229,129,66,126,90,126,106,80,60
10020 symbol 230,0,0,8,52,124,56,28,14
10030 symbol 231,112,121,127,63,31,7,1,1
10040 symbol 232,14,158,254,252,248,224,128,128
10050 symbol 233,14,158,254,252,248,224,128,128
10060 symbol 234,1,3,15,15,31,63,62,62
10070 symbol 235,171,213,235,215,235,255,60,0
10080 symbol 236,128,192,240,240,248,252,124,124
10090 symbol 237,30,15,15,3,59,127,127,57
10100 symbol 238,0,0,0,0,129,195,195,129
10110 symbol 239,120,240,240,192,220,254,254,156
10120 pen 15
10130 locate 2,1:print chr$(228);chr$(229);chr$(230)
10140 locate 2,2:print chr$(231);chr$(232);chr$(233)
10150 locate 2,3:print chr$(234);chr$(235);chr$(236)
10160 locate 2,4:print chr$(237);chr$(238);chr$(239)
10200 return
18980 rem >>> start game <<<
19000 sc=0:li=3
19010 lev=1
19020 l$=chr$(241)
19030 b$=chr$(242):m$=chr$(244)
19100 return
19980 rem >>> set screen <<<
20000 restore 20200
20010 for n=0 to 15
20020 read a
20030 ink n,a
20040 next
20050 border 0:paper 0:pen 1:mode 0
20100 return
20200 data 0,18,6,24,20,7,15,2
20210 data 22,12,17,9,26,3,22,13
20980 rem >>> screen <<<
21000 p$=string$(20,243)
21010 cls:pe=1
21020 for n=8 to 24 step 4
21025 pen pe
21030 locate 1,n:print p$
21040 pe=pe+1
21070 next
21080 return
21095 rem >>> one <<<
21100 gosub 21000
21120 for n=8 to 20 step 4
21130 po=rnd(1)*17+2
21140 if n<24 then locate po,n:print " "
21150 lpo=rnd(1)*17+2:if lpo=po then goto 21150
21160 if n<>24 then po=lpo:gosub 21700
21170 pen 10
21180 next n
21190 return
21195 rem >>> two <<<
21200 gosub 21000
21205 pen 12
21210 for n=13 to 24
21220 locate 7,n:print string$(8,207)
21230 next n
21240 locate 7,19:print string$(8,32)
21250 locate 7,23:print string$(8,32)
21260 locate 7,15:print string$(8,32)
21270 po=8:n=8:gosub 21700:po=18:n=12:gosub 21700
21275 po=3:n=16:gosub 21700:po=18:n=20:gosub 21700
21280 pen 10
21292 return
21295 rem >>> three <<<
21300 gosub 21000
21310 locate 1,8:print string$(5,32)
21320 locate 16,8:print string$(5,32)
21330 locate 1,12:print string$(4,32)
21340 locate 17,12:print string$(4,32)
21350 locate 1,16:print string$(2,32)
21360 locate 19,16:print string$(2,32)
21370 po=7:n=12:gosub 21700
21380 po=14:n=12:gosub 21700
21390 po=2:n=20:gosub 21700
21400 po=19:n=20:gosub 21700
21410 po=9:n=16:gosub 21700
21420 po=9:n=16:gosub 21700
21430 po=10:n=8:gosub 21700
21440 po=11:n=8:gosub 21700
21450 locate 6,20:print " ":locate 15,20: print " "
21455 pen 10
21480 return
21490 rem >>> top <<<
21500 locate 1,25
21510 print "SCORE:";sc
21520 locate 16,25
21525 pen 6
21530 for n=1 to li
21540 print chr$(248);
21550 next n
21555 pen 7
21560 locate 15,6:print string$(5,243)
21570 plot 0,325:draw 150,325
21580 po=18:n=2:gosub 21700
21650 gosub 10000
21680 return
21690 rem >>> ladder <<<
21700 for z=0 to 3
21705 pen 7
21710 locate po,n+z
21720 print l$
21730 next z
21740 return
21980 rem >>> initialize <<<
22000 addr=34999: gosub 29500
22010 loca=35024:gosub 30500
22150 return
22980 rem >>> move <<<
23000 gosub 29000
23050 if le=1 and x>2 then x=x-1:m$=chr$(245)
23060 if ri=1 and x<19 then x=x+1:m$=chr$(244)
23070 if up=1 then m$=chr$(246):goto 23300
23080 if do=1 then m$=chr$(246):goto 23400
23090 if fi=1 then goto 23500
23250 return
23300 locate x,y-1
23305 gosub 30000
23310 if ch<>241 then goto 23350
23320 y=y-1:goto 23080
23350 locate x,y+1
23360 gosub 30000
23370 if ch=241 then goto 23320
23380 goto 23080
23400 locate x,y+1
23405 gosub 30000
23410 if ch<>241 then goto 23090
23420 y=y-1:goto 23090
23500 if m$=chr$(245) then xd=-1 else xd=1
23510 if X<2 or x>19 then xd=0
23520 if m$=chr$(246) then xd=0
23530 locate bx,by: print ob$
23540 locate cx,cy:print oc$
23610 restore 23750
23650 for n=1 to 6
23660 read a
23670 y=y+a:gosub 23850
23680 if plat=1 then n=11
23690 next n
23700 gosub 24500
23710 return
23750 data -1,-1,0,0,1,1
23850 x=x+xd:plat=0
23860 locate x,y+1
23870 gosub 30000
23880 if ch<>32 then plat=1:return
23890 if x<2 then x=2
23895 if x>19 then x=19
23900 gosub 24000
23910 gosub 24500
23920 sound 2,100,2,15
23925 pen 7
23930 locate bx,by:print ob$
23935 locate cx,cy:print oc$
23940 gosub 25000
23950 locate x,y:print om$
23960 return
23980 rem >>> print <<<
23995 rem >>> man <<<
24000 locate x,y:gosub 30000
24010 om$=chr$(ch)
24020 pen 2
24050 print m$
24100 return
24490 rem >>> barrels <<<
24500 locate bx,by:gosub 30000
24510 ob$=chr$(ch)
24520 locate cx,cy:gosub 30000
24530 oc$=chr$(ch)
24540 pen 3
24550 locate bx,by
24560 print b$
24570 locate cx,cy
24580 print b$
24600 return
24980 rem >>> barrel <<<
25000 a=rnd(1)*10
25005 locate bx,by+1
25010 gosub 30000
25020 if ch=32 or ch=241 and a>5 then be=1
25030 if ch=243 then be=0
25040 by=by+be:if be=0 then bx=bx+bd
25050 locate cx,cy+1
25060 gosub 30000
25070 if ch=32 or ch=241 and a>5 then ce=1
25080 if ch=243 then ce=0
25090 cy=cy+ce:if ce=0 then cx=cx+cd
25100 if bx<2 then bd=1
25105 if bx>19 then bd=-1
25110 if cx<2 then cd=1
25115 if cx>19 then cd=-1
25130 if (bx<2 or bx>19) and by=23 then bx=1:bd=1:by=7:if lev=3 then bx=7
25140 if (cx<2 or cx>19) and cy=23 then cx=20:cd=-1:cy=7: if lev=3 then cx=13
25250 return

28980 rem >>> faster keys/joystick routine <<<
29000 le=0:ri=0:up=0:do=0:fi=0:ex=0:q=0
29010 call addr+1:a=peek(addr)
29020 if a=8 or a=242 then le=1
29030 if a=9 or a=243 then ri=1
29040 if a=11 or a=240 then up=1
29050 if a=10 or a=241 then do=1
29060 if a=88 or a=224 then fi=1
29070 if a=13 then q=1
29080 if a=32 then ex=1
29090 return


29480 rem >>> poke inkeys <<<
29500 c=int(addr/256):b=addr-256*c
29510 restore 29580
29520 for x=addr to addr+13
29530 read a:if a=999 then a=b
29540 if a=998 then a=c
29550 poke x,a
29560 next
29570 return
29580 data 0,62,0,50,999,998,205,27
29590 data 187,208,50,999,998,201

29980 rem >>> char check/collision routine <<<
30000 call loca+1
30010 ch=peek(loca)
30020 return
30480 rem >>> poke check <<<
30500 c=int(loca/256):b=loca-256*c
30510 restore 30580
30520 for n=loca to loca+13
30530 read a:if a=999 then a=b
30540 if a=998 then a=c
30550 poke n,a
30560 next n
30570 return
30580 data 0,62,244,50,999,998,205,96
30590 data 187,208,50,999,998,201




 
maRK

rk last

#7
Im currently typing up the rest of the books offerings and will post them here.  One annoying thing about the listings in that book is the irregular use of line numbers.  Its almost like the coders removed foreign basic approaches as they completed a compliant working example.

One thing I will say about the arcade games is in how platforms are checked.  The standard and often slow DATA method is avoided and replaced with a machine code CHR check.  Am I correct in assuming that the 6128s character check command did a similar thing? 

maRK

AMSDOS

Quote from: rk last on 01:09, 06 September 16
Im currently typing up the rest of the books offerings and will post them here.  One annoying thing about the listings in that book is the irregular use of line numbers.  Its almost like the coders removed foreign basic approaches as they completed a compliant working example.

One thing I will say about the arcade games is in how platforms are checked.  The standard and often slow DATA method is avoided and replaced with a machine code CHR check.  Am I correct in assuming that the 6128s character check command did a similar thing?


There are subtle differences from the BASIC 1.1 COPYCHR$(#0) and Firmware TXT RD CHAR (&BB60) if that's what you're referring to. The COPYCHR$ returns a Character to a Character String. TXT RD CHAR returns the value of a character. Lots of games from that period used TXT RD CHAR as a form of Collision Detection, unfortunately this led to problems when BASIC 1.1 came out as some games were checking other things (Graphics in those cases) with TXT RD CHAR. The firmware was updated and modifications were made as to how TXT RD CHAR would read something. Most notably the 464 didn't carry out checks of other colours as it wasn't necessary, but this became a big deal when BASIC 1.1 came out, which resulted in a Collision Detect not being detected and games not behaving as they would on a 464. Though different programs had different problems, some games were still playable, though were harder and in other cases some were easier and some were unplayable. Depending on what the problem was, some of the programs I've converted to work in BASIC 1.1, some problems were easier to solve and other more difficult, I just hope you don't run into any problems if that's what you're dealing with.  :-X
* Using the old Amstrad Languages :D * And create my own ;)
* Incorporating the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

rk last

maRK

Powered by SMFPacks Menu Editor Mod