Games to Play on Your Oric-!
Games to Play on Your Oric-l
C7zes Kosniowski
University of Neweastie Upon fyne
Vi Shiva Publishing Limited
SHIVA PUBLISHING LIMITED 4 Church Lane, Nantwich, Cheshire CW5 5RQ, England
© Czes Kosniowski, 1983 ISBN 0 906812 48 8
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording and/or otherwise, without the prior written permission of the Publishers.
This book is sold subject to the Standard Conditions of Sale of Net Books and may not be resold in the UK below the net price given by the Publishers in their current price list.
Typeset by the author using an ACT Sirius 1 microcomputer and printed by Devon Print Group, Exeter
Contents
Preface
Treasure hunt Don’t cry wolf Moon landing Bird and caterpillar Twenty-five squares Intelligence test? Hypnotic Dancing men Graphics show Square nim
Oh! Susanna Stop ‘em
Round and round Cascade
La Cucaracha Clock puzzle Blank out Surfaces
Blue Danube Snake
Space chase
Spell it
Sketch pad Bounce away Spirals
Knees up Mother Brown! Memory cards Hangman
Figure it out Don’t be greedy
VVURRPPHRPEBRRESE Ran eoepos OONDATIP W ROOMNADTUPWNRFPOOMANDUPLWNFH
w So
Appendix 1: Saving screen to tape Appendix 2: Renumber utility Appendix 3: The ORIC characters Appendix 4: Musical notes
13 18 23 29
36 39 43 47 49 52 55 59 62 67 70 73 75 79
89 92 94
104 109 113
118 120 125 127
Preface
In this book you'll find many new and exciting programs for your ORIC. Some are games, while others are purely entertainment (using sound and graphics). The games vary in nature. Dancing men, for example, is of the arcade type, relying on you to respond quickly and accurately. With some of the games you can take your time and exercise your mind a little bit. For example, in Don’t cry wolf you are chased by a pack of wolves. You can outwit them if you think about your moves. And there’s no hurry; the wolves don’t move until you’ve made your move. The third type are like puzzles, in which you have to rearrange various bits and pieces.
The program listings are printed directly from bug-free RUNning programs. Each program is accompanied by notes describing the general purpose of the program. Usually a sample screen print-out is included to give an idea of what to expect from the program. In addition, brief descriptions of the main routine and the various subroutines are included to help you understand the way each program works.
Each program has been written in a style which should enable you to see the program as a whole. The BASIC word G0TO is not used in any program. Excessive use of this word tends to make a program difficult to understand, and leads to what is commonly referred to as spaghetti programming. It is relatively easy to avoid using GOTO on the ORIC computer, the programs in this book provide the evidence.
All GOSUB statements are of the form GOSUB BLANK, where the variable BLANK is assigned a value in the first few lines of the program. This makes it easy to renumber the lines of the program. A short renumber utility program is given in the appendices, you can add this to the end of your programs if you wish.
Be careful when you type in a program; be particularly careful with colons and semicolons, with the number 1 and the letter I and finally with the number 0 and the letter 0. When you have typed out a program you should CSAVE it before trying to RUN it; just in case you have made a typing error. All the programs are bug-free; thus if a SYNTAX ERROR occurs you should carefully compare your program with the listing in this book. Please note that the spaces in the program listings are for clarity only, they need not be typed in.
Care has been taken to ensure that all the programs are robust. Consequently they shouldn’t crash if an incorrect key is pressed. For example, if a program is expecting a number and you type in a letter by mistake then the program will not crash!
The programs have been thoroughly tested by Ann, Kora and Inga as well
as by several unsuspecting visitors. Many thanks to them all for being guinea-pigs and for making many valuable comments. Many thanks also to Kathleen McCaffrey who managed to convert my scratchings into readable text using an ACT Sirius 1 microcomputer.
Czes Kosniowski Newcastle upon Tyne, June 1983
I freasure Hunt
This is a simple game in which you have to find the whereabouts of some hidden treasure. There are a number of bushes neatly displayed on your screen. The treasure is hidden under one of these. You are at the bush that is flashing and you can move from bush to bush by using the cursor keys. By pressing the space bar your ORIC will tell you approximately how far away you are from the treasure. Approximately, because the number displayed is the INTegral part of the distance between you and the treasure.
To confuse you, the ORIC will occasionally print a question mark instead of the distance. Furthermore, if the distance is 10 or more then an X is printed.
There is no limit to the number of guesses that you are allowed, but try to find the treasure in about 3 attempts!
TREASURE # 7 # 4
“J bh
te ae
J _
+tet ett + + + eet HOU SS +e e+ HH HH H H+ + ++teteetet e+ HH JT ttt +e +e te +H HH + +e H+ HHH HH + + + a a ee a a JT tet HE << + HE H+ + i a a
# 2 2 3 # # # # # #
# tH Ht H+ HF FP
+e eEHHHHHAHe ££ -) +eeHteteHetet ete Hee +tHHHEHA HH HH
Ess SE
# Use the cursor keys to move. Press the <Space bar? to view.
18 R 28 R 38 R 48 R 58 V 100 118 128 130 148 158 148 170 188 198 200 218 220 238 248 258 268 508 510 526 538 548 558 568 578 1080 1018 1820 “1038 1848 1858 1868 1870 1888 1898 1108
EM HEHEHE R ERE EERE HEE EM * TREASURE HUNT # EM HHERHHHHHHEE HERES EM
TEW=500: SETUP=1080: INFO=2008 REM * THE MAIN PROGRAM * GOSUB INFO:GOSUB SETUP REPEAT
: PLOT X,¥,12:GET K#:KK=ASC(K$):PLOT X,Y,8 : IF KK=32 THEN GOSUB VIEW
: IF KK=8 AND X>4 THEN X=X-2
: IF KK=9 AND X<3@ THEN X=X+2
: IF KK=1@ AND Y<22 THEN Y=Y+2
: IF KK=ii AND Y>2 THEN Y=Y-2 UNTIL STATE SHOOT: WAIT 4@:PING:WAIT 48:PING PRINT CHR$(14)+E$+"L"3SPC(11)3; "WELL DONE" PRINT E$t+"A"+" Another go? Y or N" PRINT CHR$(14)+CHR$(11)5:PING REPEAT: GET K$:UNTIL K$="Y" OR K$="N"
IF K$="Y¥" THEN RUN CLS:PING:PRINT “Bye for now.":POKE #26A,3:END REM * VIEW #
IF SCRN(X+1,Y)<>35 THEN RETURN DIST=INT (SQR ( (MM-X) # (MM-X) + (NN-Y) # (NN-Y)) /2) A$=CHR$ (48+DIST)
IF DIST>9 THEN A$="X"
IF DIST>@ AND RND(1)<.5 THEN A$="?" PLOT X+1,Y,A$:STATE=DIST=@ RETURN
REM * SETUP *
CLS:PRINT SPC(11)3; "TREASURE HUNT"sPRINT FOR I=1 TO 11
: PRINT SPC(3);
: FOR J=@ TO 13
: PRINT CHR$(27)+"H#"s
: NEXT
: PRINTs:PRINT NEXT PRINT E$+"A Use cursor keys to move." PRINT:PRINT E$+"D Press <Space bar> to view. ";
1110 PRINT CHR$(11);CHR$(11);CHRS$(11)
112@ X=16:Y=12 ‘INITIAL POSITION
1130 MM=2*INT(RND (9) #1441) +2: NN=2#INT(RND(9) #1141) 114@ STATE=FALSE
1158 RETURN
2008 REM # INFOrmation +#
2018 POKE #26A,1@ ‘Disables cursor and key click 2028 INK @:PAPER 3:CLS: PRINT
2030 ES=" "+CHR$(27) sD$S=E$+"J"+CHR$ (4)
2040 PRINT D$;SPC(9); "TREASURE HUNT":PRINT D$
2058 PRINT: PRINT
2068 PRINT D$;SPC(6)3"“by Czes Kosniowski":PRINT D$ 2070 PRINT:PRINT E$+"A Find the hidden treasure." 2080 PRINT “By pressing the <space bar> you will" 2098 PRINT “be told how far away the treasure is" 2100 PRINT “approximately. Sometimes a ? appears" 2118 PRINT “to confuse you. An X means that the" 2128 PRINT “distance is 1@ or more. 600D LUCK" 213@ PRINT: PRINT ES+"B"+E$4"L Press Y to continue." 2148 REPEAT: K$=KEY$:K=RND(1): UNTIL K$="Y"
2158 RETURN
The main routine
The main part of the program waits for you to press a key. If one of the cursor keys (ASC values 8 to 11) is pressed then the position of the flashing bush is changed. This is achieved by using PLOT X,Y,8 which disables flashing; and PLOT X,Y,12 which enables flashing. Note that position (X+2,Y) already contains the control character CHR$(27)+CHR$(8) which also disables flashing and consequently only the bush at (X+1,Y) flashes.
If the space bar (ASC value 32) is pressed then the subroutine VIEW is used to print the distance between you and the treasure. When this distance is zero the value of STATE is TRUE and the program exits from the loop. Various sound effects and messages are then displayed.
The subroutines
500 VIEW
This calculates the distance DIST between you and the treasure. If this distance is 10 or more then the number is converted to an X, also about half of the time the distance is not revealed! When the distance is zero the value of STATE becomes TRUE which causes the program to proceed to the finishing stages.
1000 SETUP
This creates the initial display of bushes. The position of the treasure is selected randomly. Note that PRINT CHR$(27)+"H#"; prints a space followed by the hash symbol. The space contains the control character CHR$(27)+CHR$(8) which is used to stop all characters to the right of that position flashing.
2000 INFO
Information briefly describing the game is contained in this subroutine. Note. When you switch on your ORIC and ask for a random number you
obtain the same sequence of random numbers. To randomize this sequence a
line has been inserted in the program whereby the computer selects (and
ignores) some random numbers until the player presses the Y key. You will
find such a line in most of the programs within this book.
2 Don't Cry Wolf
Imagine being in a deep forest and it’s getting late. You have to make your way home (H on the screen). There are several hungry wolves around ready to snap if they come near you. Can you reach home safely?
To move about use the cursor keys and the following keys (which enable you to move diagonally):
1 diagonally up-left \ diagonally up-right Z diagonally down-left / diagonally down-right
With these diagonal moves you can squeeze between trees.
Take your time and think about each move you make. If you are being chased by wolves — don’t despair — yc"! can outwit them if you try. The wolves are rather dumb and often get stuck in corners and behind trees. Also they cannot squeeze diagonally between the trees.
With each successful home coming you have the opportunity to play
YOUR MOVE
There are 8 wolves around.
again — with an extra wolf around. The wolves remain hidden during the first few moves — but they nevertheless move towards you. Beware! and don’t cry wolf.
10 REM HHHHERHEHRHHER RE ES
28 REM * DON’T CRY WOLF *
3O REM HHKRRERERERERE REESE
40 REM
5@ APPEAR=500: WMOVE=600: EEK=7@@: MOVE=808 6@ SETUP=1008: CHR=1500: INFO=2008
100 REM #* THE MAIN PROGRAM #*
11@ GOSUB INFO:GOSUB CHR
128 REPEAT
138 : GOSUB SETUP
148 : REPEAT
158 : PRINT H$:REPEAT: UNTIL KEY$="" 168 : REPEAT
178: GET 6$:G=ASC(6$) 188: ANS*FALSE
199: IF 6=49 OR G=9@ OR G=47 OR G=92 THEN ANS=TRUE 208 : IF 6>7 AND G<12 THEN ANS=TRUE
218 : UNTIL ANS
220: XN=X:YN=Y
230: IF (6=49 OR G=9@ OR G=8) AND XN>2 THEN XN=XN-1 240: IF (6=92 OR G=47 OR G=9) AND XN<35 THEN XN&XN+1 258: IF (6=9@ OR G=47 OR G=18) AND YN<23 THEN YN=YN+1 268: IF (6249 OR G=92 OR G=i1) AND YN>3 THEN YN=YN-1 278 : PLOT X,Y,32:WW=SCRN(XN, YN)
288: IF WW=32 OR WW=72 THEN X=XN:Y=YN
298 : PLOT X,Y,Z
308: IF X=33 AND Y=5 THEN PING: WAIT 20:PING:STATE=1 310 : PRINT W$:TEST=FALSE: XY=SCRN(A(NW4+1) ,B(NW+1) ) 320: IF NW<=WO AND RND(1)<.3 AND XY=#32 THEN TEST=TRUE 338: GOSUB WMOVE-TEST#(APPEAR-WMOVE)
34@ : UNTIL STATE
358 : PRINT At
368 : REPEATSGET K$: UNTIL K$="Y" OR-K$="N" 378 UNTIL K$="N" 388 CLS:PRINT “Bye for now. ":POKE #26A,3:END
588 518 520 538 548 608 618 628 638 648 658 668 678 688 708 718 728 730 740 B80 818 828 838 848 850 840 878 888 890 900 1008 1018 1028 1838 1040 1058 1068 1078 1088 1098 1188
REM ## APPEAR ## NW=NW+1:PLOT A(NW) ,B(NW) ,W MUSIC 1,1,4,0:PLAY 3,0,1,2500:WAIT 48 MUSIC 1,1,3,@:PLAY 3,0,1,2500:WAIT 58 PLAY 8,0,8,@:RETURN REM ** Wolf MOVE ## IF STATE THEN RETURN FOR I=@ TO WOLVES-1 : GOSUB MOVE : IF I<=NW THEN PLOT ACI), BCI) ,32 : ACT) =A:B(1I) 5B : IF I<=NW THEN GOSUB EEK NEXT RETURN REM ## EEK #4 PLOT A,B,W IF A<>X OR BX>Y OR STATE THEN RETURN PLOT X,Y,"EEK": ZAP:STATE=2 RETURN REM ## MOVE #+# XX=(ACT) OX) -CACT) CX) SYV= (BCI) OY) -( BCI) <Y) : S=8 IF YY=@ THEN S=1:YY=1 IF XX=@ THEN S=2:XX=1 TEST=FALSE: T=-1 REPEAT : T=T+1sAZA(T)+U(S,T)#XXsBeB( I) +V(S,T)#YY : SS=SCRN(A,B): TT=SCRN(A(I) ,B) sUU=SCRN(A,B(I)) : IF SS<W AND (TT<W OR UU<W) THEN TEST=TRUE UNTIL TEST OR T>7 RETURN REM ## SETUP of screen ## PAPER 3: INK @:PRINT FRE(9):CLS WOLVES=WOLVES+ (WOLVES<2@) #(STATE=1) STATE=@ NW=-1 ‘Number of wolves appearing FOR X=1 TO 34 : PLOT X,2,16@:PLOT X,24,168 NEXT PLOT 11,2,"DON‘'T CRY WOLF" FOR Y=3 TO 23 : PLOT 1,Y,16@:PLOT 36,Y,168
1118 1128 1138 1148 1158 1168 1178 1188 1198 1200 1218 1220 1230 1248 1250 1268 1278 1288 1588 1518 1520 1538 1548 1558 1548 1570 1588 1590 1608 1618 14620 1638 1648 1780 1718 1728 1738 1748 28008 2018 2628
10
: FOR X=2 TO 35
: IF RND(9)>.75 THEN PLOT X,Y,168
NEXT: NEXT
PLOT 5,246,"There are"
PLOT 146,26,MID$(STR$(WOLVES) ,2)
PLOT 19,26,"wolves around."
FOR Y=3 TO 7:FOR X=2 TO 4
: PLOT 29+X,Y,32:PLOT X,14+Y,32
NEXT: NEXT
PLOT 33,5,72:PLOT 4,21,37
X=43 Y=21:2=37
REM Position of the wolves
FOR I=@ TO WOLVES-1
: REPEAT
: ACT) SINT(RND (1) #3442) :B(1) =INT(RND (1) #21+3) : UNTIL SCRN(ACI),B(I))=32 AND B(I)-A(I)<17 NEXT
RETURN
REM #*# CHR ##
H$=CHR$ (30) +ESt+"L"+ES+"A YOUR MOVE" WS=CHR$ (30) +CHRS$ (14)
AS=CHR$ (30) +ES+"L"+E$+"D Another go? Y or N
W=38:DIM A(2@),B(2@) START=#B400+3748: AA=#AG0@
POKE AA,2:IF PEEK(AA)<>2 THEN START=START-#8008 FOR I=START TO START+7:READ R:POKE I,R:NEXT START=START+8
FOR I=START TO START+7:READ R:POKE 1,R:NEXT STATE=0
FOR S=@ TO 2:FOR T=@ TO 8
: READ U(S,T),V(8,T)
NEXT: NEXT
RETURN
DATA 14,14,4,31,14,14,10,108
DATA 2,3,35,30,30,38,18,18
DATA 1,1,1,@,0,1,1,-1,-1,1,0,-1,-1,0,8,0,0,8 DATA 1,@,1,-1,1,1,0,-1,0,1,-1,- i ie 1,0,0,0 DATA @,1,1,1,-1,1,1,0,-1,0,1,-1,-1,-1,8,-1,0,0
REM ## INFOrmation *# ES=" "4+CHR$(27) s D$=E$+CHR$(4)+"I" PAPER 6: INK @:CLS:PRINT
2038 PRINT D$3SPC(9);"DON'T CRY WOLF":PRINT: PRINT D$ 2040 PRINT:PRINT D$;SPC(7)3; “by Czes Kosniowski":PRINT D$ 2058 PRINT:PRINT "You are in a deep forest and there" 20468 PRINT “are wolves around. Try and get back"
2078 PRINT “home (H) - but"+E$+"DDON’T CRY WOLF." 2088 PRINT “You can sqeeze between the trees but" 2098 PRINT “the wolves can’t.”
21080 PRINT:PRINT “CONTROLS: "
2118 PRINT “Cursor keys for Left, Right, Up, Down" 212@ PRINT “ 1 for Up-Left \ for Up-Right*
2138 PRINT "| Z for Down-Left / for Down-Right" 2140 PRINT: PRINT
2158 PRINT “How many wolves do you to start with?" 2168 PRINT "Select a number between 2 and 9: “$3
2178 REPEAT: G$=KEY$:GG=RND(1)sUNTIL G$>"1" AND G$<"3" 2188 WOLVES=VAL (G$)
2198 POKE #26A,2 Disables cursor
2288 RETURN
The main routine
The main part of the program waits for a key to be pressed. If it is one of the eight permitted keys then the program proceeds to move you and, consequently, the wolves.
The subroutines
500 APPEAR
This determines when a wolf appears. There is a 30% chance that a wolf apppears during a move. Note that when a wolf appears the other wolves do not move. This gives the player a chance to escape.
600 WMOVE
This subroutine together with the subroutine MOVE, moves the wolves (even those not visible). It also checks to see if a wolf has reached you. Invisible wolves do no harm until they become visible.
700 EEK This is a subroutine of the subroutine WMOVE. Its main purpose is to ZAP you when a wolf reaches you.
800 MOVE A simple calculation is performed to determine where each wolf should move. If possible, each wolf moves closer to you, although if there isn’t a
11
closer position it will move one step away. Sometimes this causes a wolf to move backwards and forwards, giving you a chance to escape.
1000 SETUP This creates the random forest screen display and determines where the wolves are originally positioned. ;
1500 CHR The custom characters (you and the wolves) are created by this subroutine. There is also a line which takes care of changes in the location of characters between the 48K and the 16K ORICs.
In addition this subroutine initializes some of the constants (numbers of wolves etc.).
2000 INFO A brief outline of the game is contained in this subroutine.
12
o Mioon Landing
You are in command of a lunar module. It has just detached itself from the mother ship and is in free fall. Only the retro-rocket (the space bar) will slow you down. Fuel is in short supply; so don’t keep pressing that space bar.
Because of the cheap imported components used to build your module it is very sensitive to speed. Indeed, if you exceed a speed of 100, your module explodes!
Try to land at a speed of 10 or less.
Your ORIC provides a graphic display (with sound) of your velocity, height and fuel.
ATOrwmMm st
4 E L 0 Cc I ; ¥:
*Tmen Cmeoen romen
H E I G H T 9
13
10 REM He#HHRHRHREHEREES
2@ REM # MOON LANDING *#
3Q REM HHHHRHKHHEHHEHES
48 REM
5@ CALCFUEL=50@: DISP=400: INSTRUCT=1000: SETUP=1500
100 110 120 130 148 158 160 178 188 198 200 218 228 230 248 258 268 270 288 298 388 318 320 338 348 358 368 378 388 398 400 580 518 528 538 548
14
REM ## THE MAIN PROGRAM ##
GOSUB INSTRUCT: GOSUB SETUP
REPEAT
: VELOCITY=VELOCITY+ACCEL
: SOUND 4,125-VELOCITY/4,7
: IF VELOCITY<@ THEN SOUND 5,208-VELOCITY,7
: YI=INT(VELOCITY/5) : Y2=INT(VELOCITY-S#Y1) : X=7 : GOSUB DISP
: PLOT 7,26, MID$(STRE(INT(VELOCITY)),2)+" * : HEIGHT=HEIGHT-VELOCITY/188
s YIZINT(HEIGHT/8): Y2=INT(HEIGHT-8#Y1) 3 X=19
: GOSUB DISP
: PLOT 18,26, MID$(STRS(INT(HEIGHT#1@)),2)+" “ : IF KEY$<>"" THEN GOSUB CALCFUEL
UNTIL HEIGHT<.1 OR VELOCITY>180
EXPLODE
FOR I=8 TO INT(VELOCITY/1@)
: PAPER 1:WAIT 10:PAPER 4:WAIT 18:PAPER 7:WAIT 18 NEXT
PRINTsPRINT CHR$(14) 3 CHR$(1@) sCHR$(14);
PRINT CHR$(11);CHRS$(4)3
IF VE>10@ THEN PRINT Wi$
IF VE<=108 AND VE>2@ THEN PRINT SPC(10)3W2$ IF VE<=2@ AND VE>1@ THEN PRINT SPC(13)3W3$
IF VELOCITY<=18 THEN PRINT SPC(12);W4$
WAIT 5@8:PRINT
PRINT E$+"N Another go? Y or N“;SPC(8) PRINT CHR$(4)
REPEAT:GET K#s UNTIL K$="Y" OR K$="N"
IF K$="Y¥" THEN RUN
CLS:PRINT "Bye for now":POKE #26A,3:END
REM ## CALCulate FUEL ##
IF FUEL<1 THEN RETURN
FUEL=FUEL-F
YIsINT (FUEL/8) s Y2=INT (FUEL-8#Y1) 2 X=32
IF Yi¢@® THEN RETURN
558
548
578
4600
618
620
638
4648
658
640
1000 1812 1020 1830 1048 10508 1040 1070 1088 1098 1180 1110 1120 1130 1148 1158 1168 1588 1518 1520 1538 1548 1558 15468 1578 1580
1598 :
14680 1618 1628 1630
VELOCITY=VELOCITY-BRAKES:GOSUB DISP PLOT 31,24, MID$(STRSCINT(FUEL/2)/1@@) ,2)+" © RETURN REM ## DISPlay #+#
IF Yi<@ OR Yi>24 THEN RETURN FOR I=@ TO 1
: PLOT X#1,24-Y¥1,32:PLOT X+1,25-Y1i,32+Y2
: IF Y1>@ THEN PLOT X+I,24-Y1i,A$ NEXT RETURN
REM ## INSTRUCTions #**#
CLS:PAPER 4: INK 7:E$=" “+CHR$(27) D$=E$4+"J"+CHR$ (4): PRINT
PRINT D$+E$+"C"3SPC(9)3 "MOON LANDING"
PRINT D$: PRINT: PRINT
PRINT D$+E$+"C"3SPC(46)3 "by Czes Kosniowski" PRINT D$: PRINT: PRINT
PRINT “You are in command of a lunar module." PRINT “It is in free fall and only the retro" PRINT “rocket Cthe space bar) will slow you" PRINT “down. Do not exceed a speed of 100." PRINT:PRINT “Try to land at a speed of under 1@" PRINT: PRINT ES+"L"+E$+"A"3 SPC (10); "GOOD LUCK" PRINT: PRINT E$t+"L"+E$+"B Press Y to continue." POKE #26A,1@ ‘ Disables cursor and keyclick REPEAT: K$=KEY$:K=RND(1) UNTIL K$="¥"
RETURN
REM ## SETUP ##
CLS:PAPER 7: INK Q@:PING
START=#B400+33*8: AA=#ABOO
POKE AA,2:I1F PEEK(AA)<>2 THEN START=START-#8000 FOR I=@ TO &3:POKE START+1I,127: NEXT
FOR I=@ TO 6:FOR J=@ TO 4-I
: POKE START+J+1#8,8
NEXTsNEXT
FOR I=1 TO 25
PLOT 6,1,MID$(" EMV TY "V1,1) : PLOT 18,1,MID$("HETGHT HEIGHT",I,1) : PLOT 31,1,MID$("F UEL FUEL FUEL",I,1)
NEXT FOR I=@ TO 25
15
1640 : PLOT 1,1,1sPLOT 13,1,4:PLOT 24,1,2 1658 NEXT
14660 AS="(":BS="!"
167@ FOR I=8 TO i
1688 : FOR J=1 TO 25
1690 : PLOT 194+1,J,A$:PLOT 32+1,J,A$
1708 : NEXT
1710 : PLOT 1,24+1,5:PLOT 7+1,24,A$:PLOT 7+1,25,A$ 1728 NEXT
1738 PLOT 21,1,"200@":PLOT 21,7,"1580"
1748 PLOT 21,13,"100@":PLOT 21,19," 500"
1750 PLOT 21,25,B$+"80"
1768 PLOT 34,1,"FULL":PLOT 34,7," 3/4"
1770 PLOT 34,13,"HALF“:PLOT 34,19," 1/4"
1788 PLOT 34,25,B$+"8a"
1798 PLOT 9,5,B$+"10@":PLOT 9,18,B%+"75"
1888 PLOT 9,15,B$+"S@":PLOT 9,20,B%+"25"
181@ PLOT 9,23,B$+"1@":PLOT 9,25,B$+"00"
1828 PRINT ES "@ “s:PLOT 31,26,"FULL"
183@ HEIGHT=199: FUEL=199: ACCEL=. 9: BRAKES=1.8 1840 F=.9+.4#RND(1):VELOCITY=18
1850 WiS=E$+"N You went too fast and EXPLODED" 1868 W2$=E$+"NCRASH LANDING"
1870 W3$=E$+"NNOT BAD"
1880 W4$=E$+"NWELL DONE"
189@ PLAY 0,7,8,8
1988 RETURN
The main routine
On each cycle the current velocity and height are displayed - both numerically and visually. The latter uses the subroutine DISP. Whenever a key is pressed fuel is consumed (if there is any left) via the subroutine CALCFUEL.
The routine ends when either the velocity exceeds 100 or the height is about 0.
The subroutines
500 CALCFUEL This is used to calculate and display the quantity of fuel remaining. The
16
graphic display uses the subroutine DISP.
600 DISP This simply plots the appropriate custom character to display the velocity, height or fuel.
1000 INSTRUCT Brief instructions for the game are contained in this subroutine.
1500 SETUP The custom characters are created here. There is nothing fancy about these characters, each is a solid block of a certain height. The characters have ASC code 32 to 39 and range uniformly from a blank space to a solid block. After these custom characters have been created the initial screen display is produced. Note: After running this program you may like to press the reset button on the ORIC. This will restore the standard characters.
17
4 Bird and Caterpillar
In this game you are a hungry caterpillar crawling over the screen. There is food nearby — but can you reach it in time? The caterpillar cannot stop — but the direction that it moves can be changed by using the cursor keys.
Be careful, the caterpillar must not hit the wall (the edge of the screen display) otherwise it gets squashed. Also, the caterpillar mustn’t suddenly go backwards otherwise it bites itself and the game ends. Thus, if the caterpillar is moving left don’t press the right cursor key. Instead, press the up or down cursor key first.
There is even more danger around. A hungry bird (controlled by the ORIC) is flying around seeking the food and the caterpillar.
As soon as a piece of food is eaten another piece appears somewhere else. See how much food the caterpillar can eat before getting squashed, biting itself or being eaten by the bird.
BIRD AND CATERPILLAR
18
18 20 38 40 50 68 108 110 120 130 148
15@ :
1468 178
180 :
198 208 210 228 230
248 :
250 268
278 :
288
298 : 300:
318 328
330 :
358 :
368
370 :
380
398 :
400 418 420 430
REM HHHEHHHEEHHEEEHHER RHEE EHEE REM * BIRD AND CATERPILLAR * REM HHEHHHERRH HEHEHE EE HERE HEHE REM BIRD=500: DIRECT=700: FOOD=900: SETUP=1208 INITIAL=1500: CHR=1700: DESCRIP=2000
REM ** THE MAIN PROGRAM ##
GOSUB DESCRIP: GOSUB INITIAL
REPEAT
: GOSUB SETUP: GOSUB FOOD: STATE=FALSE
: REPEAT K$=KEY$: IF K$<>"" THEN GOSUB DIRECT : PLOT P(2),Q@(2),32 : FOR I=2 TO 1 STEP -1 P(T)=P(I-1):Q(1)=Q(1-1) : NEXT : P(@)=P(0)+DP:8(8)=8(0)+DO : PQ=SCRN(P(O) ,Q(Q)) : IF P@¢>32 AND PQ<>C THEN STATE=PQ : IF PQ=C THEN ZAP:WAIT 3@:GOSUB FOOD: SUM=SUM+1 FOR I=@ TO 2:PLOT P(I),Q(1) ,ReNEXT
: GOSUB BIRD : IF X=A AND Y=B THEN ZAP:WAIT 3@:GOSUB FOOD FOR [=@ TO 2 : IF X=P(I) AND Y=Q(I) THEN STATE=1 NEXT UNTIL STATE : EXPLODE
: FOR I=1 TO 3:PAPER i:WAIT 2@:PAPER 7:WAIT 20:NEXT : PAPER @:PRINT B$
: W=-(STATE=1)-(STATE=223) -2% (STATE=160)
: PRINT AS(W)
: PRINT CHR$(27)+"T"+E$+"GThe caterpillar ate ";SUM; IF SUM=1 THEN PRINT "bit of food"+C$
: IF SUM<>1 THEN PRINT "bits of food"+C$
PRINT CHR$(27)+"R°+E$+"G";
: PRINT "“ Another go? Y or N";SPC(1@)
: REPEAT: GET G$: UNTIL G$="Y" OR G$="N"
UNTIL G$<¢>"Y"
CLS:PRINT "Bye for now. ":INK 7:POKE #26A8,3:END
19
588 518 528 538 548 558 548 700 718 720 738 748 758 908 918 928 930 948 950 10880 1018 1828 1030 10840 1858 1068 1878 1080 1898 1180 1118 1120 1138 1148 1158 1168 1178 1508 1518 1528 1530
20
REM #* BIRD movement +## XX=SGN(A-X): YY=S6N(B-Y)
IF RND(1)<.3 THEN XX=SGN(P(@)-X): YY=SGN(Q0(@)-Y) IF XX#YY<¢>@ AND RND(1)<.5 THEN XX=0 IF XX#YY<>@ THEN YY=2 PLOT X,Y,32:X=X+XX:Y=VY+VY:PLOT X,Y,2Z RETURN REM *#* DIRECTion *#
KK=ASC(K$)
IF KK<8 OR KK>1i1 THEN RETURN DP=(KK=8) -(KK=9) DQ=(KK=11)-(KK=18) RETURN REM ## FOOD ** REPEAT
: A=INT(RND(1)#36+2) sBEINT(RND(1)*#25+1) UNTIL SCRN(A,B)=32 PLOT A,B,C RETURN
REM ## Screen SETUP ##
PAPER @: INK 2:PRINT FRE(9):CLS
FOR X=1 TO 38
: PLOT X,@,14@:PLOT X,26,140
NEXT
FOR Y=1 TO 25
: PLOT 1,Y,16@:PLOT 38,Y,168
NEXT
REM BIRD POSITION X=INT(RND (1) #3642): Y=3:2=223
PLOT X,Y,2Z
REM CATERPILLAR P(@)=30:P(1)=31:P(2)=32 Q(@)=22:6(1)=22:0(2)=22
FOR 1=@ TO 2:PLOT P(I),Q(1) ,R:NEXT DP=-1:DQ=@ ‘Direction C=38:R=37:SUM=0
RETURN
REM #* INITIAL setup ## START=#B400+37#8: AA=#AQ00
POKE AA,2:IF PEEK(AA)<>2 THEN START=START-#8008 GOSUB CHR
1548 1550 15468 1570 1580 1598 1680 1418 14620 1728 1718 1720 1730 1740 1758 2000 2010 2020 2038 2040 2050 2068 2070 2088 20908 2180 2118 2128 2130 2148 2150 2142
START=START+8:GOSUB CHR
START=START+454:G0SUB CHR
BS=CHR$ (27) +"Q"+CHR$(27)+"G .
C$=" "+CHR$ (14)
A$(0)=B$+" The caterpillar bit itself"+C$ A$(1)=B$+"The bird ate the caterpillar"+C$ A$(2)=B$+"The caterpillar got squashed"+C$ BS=CHR$ (30) +BS+" BIRD AND CATERPILLAR "+C$ RETURN
REM ## CHR #+#
FOR I=START TO START+7:READ X:POKE I,X:NEXT RETURN
DATA 12,12,30,43,463,38,12,12
DATA 4,14,31,31,14,4,4,4
DATA 63,45,63,63,51,63,33,63
REM ## DESCRIPtion #+#
INK @:PAPER 6:CLS:PRINT
POKE #26A,2 ‘Disables cursor
E$="— "4CHR$(27) s DS=E$St"J"+CHR$ (4)
PRINT D$;SPC(6)3;"BIRD-AND CATERPILLARS :¢PRINT D$ PRINT: PRINT
PRINT D$;SPC(7)3"by Czes Kosniowski"
PRINT D$:PRINT
PRINT "Guide the caterpillar to the food." PRINT “But, avoid the walls and the bird!" PRINT "Also, don’t bite yourself by suddenly" PRINT “going backwards.“
PRINT: PRINT “To CHANGE direction use the cursor" PRINT “keys."
PRINTSPRINT E$+"L"3SPC(8)3 "Press Y to start" REPEAT: G$=KEY$:G=RND(1):UNTIL G$="Y"
RETURN
The main routine
The main routine moves the caterpillar and bird around the screen.
A check is made to see if the caterpillar has hit the wall, bitten itself or eaten the food. Similarly a check is made to see if the bird has eaten the caterpillar or the food.
21
The subroutines
500 BIRD
This controls the direction in which the bird moves. On each occasion the computer decides whether the bird should move towards the caterpillar (30% of the time) or towards the food (70% of the time). Having decided what to aim for, the bird moves one step towards that goal.
700 DIRECT After reading the keyboard this subroutine calculates the direction that the caterpillar must move. Only the cursor keys have any effect.
900 FOOD
Whenever food is needed this subroutine selects its position on the screen. A check is made to ensure that the food only appears in an empty space (away from the wall, bird and caterpillar).
1000 SETUP The screen display is set up by this subroutine. It creates the surrounding wall, and positions the bird and caterpillar on the screen.
1500 INITIAL
Three custom characters are needed, the bird, the food and the caterpillar. The bird is just a face and replaces the character with ASC code 223 (which is the reverse of the character with code 95). The food and caterpillar designs replace the characters with ASC codes 37 and 38. The caterpillar actually consists of three diamonds joined together.
1700 CHR This is a short subroutine which reads the DATA for the custom characters and POKEs it into the appropriate place.
2000 DESCRIP This contains a brief description of the game.
22
5 fwenty-five Squares
This is a puzzle-type game in which the ORIC mixes up the twenty-five letters of the alphabet A to Y. The object is to rearrange them into their correct position as shown below.
=< < woo rom = a
< c ao + voz z r
Only certain groups of letters may be moved at any one time. These groups consist of the eight letters in the upper, bottom, left or right sections. The moves are achieved by pressing keys 1 - 8. Each of the odd numbered keys moves one particular group of letters round in a clockwise direction, while the even keys move them anticlockwise. For example, pressing key 1 moves the eight letters on the left (TUVWXYBA in the diagram) round in a clockwise direction. Key 0 is used to abandon the game.
23
The game has various levels of difficulty. At the easiest level (Level 1) only two moves are made by the computer. See if you can work out which two. At higher levels of play the game could prove to be quite hard and challenging. Speed is not important in this game, thinking is!
Twenty-five squares puzzle.
To give up —- press @
10 REM HEHEHE HHHEHREHHRH HERE EHEE
20 REM # TWENTY-FIVE SQUARES +*
3D REM HEHHHEEKH HHH HEHEHE EHEHHEE
40 REM
5Q@ MOVE=500: DISP=1000: INITIAL=1500: DETAILS=2000
108 110 120 138 140 158
1460 :
178 182 198 200
24
REM ** THE MAIN LOOP ##
GOSUB DETAILS: GOSUB INITIAL
GOSUB DISP:STATE=FALSE
REPEAT
: ANSWER=FALSE
: REPEAT:GET G$: UNTIL G$>"/" AND G$<"9" GOSUB MOVE+S@#VAL(6$):IF G$<>"@" THEN GOSUB DISP : REM CHECK FOR END
: IT=@
: REPEAT
: TsI+l:IF AZ(I)<>64+1I THEN ANSWER=TRUE
218 228 230 248 258 268 270 288 290 308 508 518 528 538 548 558 56a 578 388 598 608 618 628 630 648 658 660 670 4680 698 700 710 720 730 748 758 768 778 780 790 808
: IF 1>24 THEN ANSWER=TRUE: STATE=1
: UNTIL ANSWER
UNTIL STATE
PRINT CHR$(3@)
REM ENDING
IF STATE=i1 THEN PRINT WS$:PING: WAIT 3@:PING PLOT 10,3,"Another go? Y or N"
REPEAT: GET G$: UNTIL G$="Y" OR G$="N"
IF G$="Y" THEN RUN
CLS:PRINT “Bye for now. "sPOKE #26A,3:END REM ## MOVE @ - Quit #+#
STATE=2
ANSWER=TRUE
RETURN
REM Just to fill the space.
REM ## MOVE 1 - Left clockwise #+#
B4=A% (25)
FOR 1=25 TO 21 STEP -1:AZ(I)=AXL(1-1) NEXT AX(28)=AZ(1) sAX(1) =AZ (2) 2AZ(2) =B% RETURN
REM ** MOVE 2 - Left anticlockwise ## BZ=A% (28)
FOR 1=20 TO 24:sAX(1)=AX(I+1) sNEXT AZ(25)=AL(2)2AL(2) =AL(1) SAL (1) =BX RETURN
REM *## MOVE 3 - Up clockwise #*#
BA=A% (8)
FOR I=8 TO 2 STEP -1:AX(1)=AXZ(1I-1) s NEXT AZ(1) =B%
RETURN
REM #* MOVE 4 - Up anticlockwise #*# BA=AL(1)
FOR I=1 TO 7: AX(1)=AZ(I+1) sNEXT ALZ(B8)=B%
RETURN
REM ** MOVE 5 - Right clockwise #*# BZ=AZ(14)
FOR I=14 TO 9 STEP ~-1:AXZ(1T)=AZ(I-1) NEXT AZ(B) =A (1) :AL(1) =B%
RETURN
REM *#* MOVE 6 - Right anticlockwise ##
25
818 828 838 84a 858 84a 870 888 898 900 918 928 930 948 1880 1018 1028 1830 1040 1058 1580 1518 1520 1530 1548 1558 1568 1578 1588 1598 1608 1618 1628 1638 1648 1658 1648
1678 :
1688 1698 1782
26
BA=AZ (8) FOR I=8 TO 13:AZ(1)=AX (141) sNEXT AZ(14)=AZ (1) 3AZ(1) =B% RETURN REM *# MOVE 7 - Down clockwise #+# BZ=AZ (20) FOR I1=28 TO 15 STEP -1:A%Z(1)=AZ(I-1) s NEXT AZ(14)=AZ(1):AZ(1)=BZ RETURN REM ** MOVE 8 - Down anticlockwise #* BZ=AZ(14) FOR [=14 TO 19: AZ(1)=AZ(14+1) 2 NEXT AZ(20)=AZ(1): AZ (1) =B% RETURN REM ## DISPlay ## FOR [=1 TO 25 : PLOT X4Z(1),Y2(1) ,AZC(T) s PLOT X4(1),YA(1) +1, A2(1) NEXT RETURN REM ## INITIALisation #+# CLS:PAPER @:INK 7 DIM AZ(25) ,X4(25) ,Y¥%¢25) FOR I=1 TO 25 : AZ(I)=64+1 : READ X4(1),Y%(1) NEXT FOR [=5 TO 22:PLOT 0,1,1@8:NEXT PLOT 0,1,1@:PLOT @,2,1@:PLOT @,3,2:PLOT 1,3,12 REM MIXING FOR J=1 TO ZZ:GOSUB MOVE+5@*INT(8*RND(9) +1) 2NEXT Ws=" “ WS=ES+"A"+CHRS$(4)+W$4+"WELL DONE "+W$+CHRS (4) PRINT:PRINT V$:PRINT E$+"A" START=#B400+90#8: AA=#A000 POKE AA,2:IF PEEK(AA)<>2 THEN START=START-#8000 FOR I=@ TO 3 START=START+8 : FOR J=@ TO 7:READ R:POKE START+J,R: NEXT NEXT FOR I=1 TO 8
1718 1720 1730 1748 1750 1768 1778 1788 1798 1880 1818 1820 1830 1848 185@ 1848 1878 1888 1898 1988 2008 20108 2020 2038 2048 2058 2060 2078 2088 2098 2188 2118 2128 2138 2148 2158 2168 2178 2188 2198 2280
: READ U,V,X$
: PLOT U-1,V,4:PLOT U-1,V+1,4
: PLOT U,V,X$sPLOT U,V+1,X$
: PLOT U+3,V,7:PLOT Ut3,V+t1,7
NEXT
PLOT 8,24,4:PLOT 9,24,"To give up - press @" RETURN
REM LAYOUT DATA
DATA 19,13,17,11,17,9,17,7,19,5,21,7,21,9,21,11 DATA 23,11,25,11,27,13,25,15,23,15,21,15
DATA 21,17,21,19,19,21,17,19,17,17,17,15
DATA 15,15,13,15,11,13,13,11,15,11
REM NEW CHARACTERS DATA
DATA 30,6,10,18,16,14,8,4
DATA 4,8,16,16,18,18,46,38
DATA 30,24,20,18,2,2,4,4
DATA 4,4,2,2,18,20,24,38
REM MORE DATA FOR DISPLAY
DATA 8,15,01,8,11,\2,15,5,03,22,5,4]
DATA 29,11,5%,29,15,461,22,21,7%,15,21,\8
REM #* DETAILS #+#
CLS:PAPER @: INK 7:POKE #24A,3
E$=" “4+CHR$ (27): DS=ES+CHR$ (4) 4+"J" V$=E$+"A"+D$+" Twenty-five squares puzzle. "+D$ PLOT 1,2,1
PRINT:PRINT V$sPRINTs PRINT: PRINT
PRINT D$;SPC(7);"by Czes Kosniowski"
PRINT D$:PRINT
PRINT “Rearrange the 25 letters back into" PRINT “their correct position as shown below." PRINT SPC(17)3"E"sPRINT SPC(16)3"D F"
PRINT SPC(16)3"C G":PRINT SPC(14)3;"XYB HIJ" PRINT SPC(13)3"W A K"sPRINT SPC(14)3"VUT NML" PRINT SPC(146)3;"S O"sPRINT SPC(16)3"R P"
PRINT SPC(17);"Q"
PRINT: PRINT “Use the keys 1 to 7 to move the" PRINT “squares around."
PRINTSPRINT E$t+"DDifficulty level? 1 to 9: "$3 REPEAT: G$=KEY$: GG=RND (1) sUNTIL VAL(G$) >@ ZZ=3#VAL(G$)-1:POKE #26A,2
RETURN
27
The main routine
The main part of the program waits for one of the keys 0 - 8 to be pressed. The appropriate move is then carried out and a check is made to see if the letters are in their correct positions.
The subroutines
500 MOVE
Lines 500 to 540 contain the move to quit the game. The other moves, 1 - 8, are spaced out at intervals of 50 between lines 550 and 940. The moves are called by the statement GOSUB MOVE+50*VAL(G$) where G$ is the key pressed.
1000 DISP This simply displays the twenty-five letters in their current positions.
1500 INITIAL The twenty-five letters are stored by their ASC codes (65 to 89) in the integer array A%(1). The positions in which the letters are to be plotted is stored in the integer arrays X%(I) and Y%(1).
Four custom characters are created. These are simply four curved arrows.
2000 DETAILS Brief details of the game are contained in this subroutine.
28
6 intelligence fest?
Many questions in intelligence tests and quizzes involve a sequence of numbers and/or letters. For example,
19,7. 16, 135 10, 22% 0, K, H, E, «.-.
You then have to write down the next term in the sequence.
Your ORIC can be used to create all sorts of sequences which will test and amuse you.
For each sequence you have two attempts to get the correct answer. There is no hurry — the computer will wait patiently while you think.
After ten sequences you will be told how many you got correct. Don’t take the game too seriously, just have fun.
INTELLIGENCE TEST? SEQUENCE 3
osclU[wW OO AUreEUCUCdSTCUC<‘“(:™
What is the next term ? P
No - try again What is the next term ? R The answer is Q
Press Y to continue
29
10 REM €HHREEHHHER ERE RHEE REESE 20 REM * INTELLIGENCE TEST? * 3B REM HEREHEEERERERERE EEE EEE 40 REM
5@ SEQUENCE=580: INFO=1008
120 118 120 138 148 158 148 178 188 198 200 218 220 238 248 258 268 270 280 298 300 318 320 338 340 350 368 378 388 398 500 518 528 538 548
30
REM ## THE MAIN PROGRAM ## GOSUB INFO FOR Zz=1 TO 18 REM RANDOM NUMBERS A=INT(RND (1) #1041) sN=INT(RND (1) #4) B=INT(RND (1) #1@):C=1+2%(RND(1)¢.5) REM SCREEN CLS:PRINT “ "“sI$sPRINT PRINT ,,,," SEQUENCE "3ZZ:PRINT PRINT CHR$(4):PRINT E$+"J "5 GOSUB SEQUENCE+100#INT(RND(1)#5):PRINT PRINT CHR$(4): PRINT: PRINT FOR JJ=1 TO 2 INPUT “What is the next term "“sY$s:PRINT IF Y$=X$ THEN PING: JJ=3: PRINT W$:SC=SC+1 : IF JJ=1 THEN SHOOT:PRINT E$+"BNo - try again" : IF JdJ=2 THEN SHOOT:PRINT E$+"“BThe answer is "3;X$ : PRINT : NEXT t
PRINTSPRINT E$+"L“+E$+"D Press Y to continue" REPEAT: GET G$: UNTIL G$="Y" NEXT CLS:PRINT:PRINT D$+I$:PRINT D$: PRINT PRINT “ Your score out of 10 is “;SC FOR I=1 TO SCsPING: WAIT 20:NEXT PRINT: PRINT PRINT ESt+"L"+E$+"D Another go? Y or N" REPEAT: GET G$: UNTIL G$="Y" OR G$="N" IF G$="Y" THEN RUN CLS:PRINT "Bye for now. ": END REM # Arithmetic # IF C<® THEN B=B+B8@+INT(RND (1) #18) FOR I=1 TO S:PRINT AXI#C+B3" "3s NEXT X$=MID$(STRS(A#I#C+B) , 2) PRINT: RETURN
600 618 628 638 648 658 708 710 720 738 748 758 760 770 800 818 820 830 840 858 868 870 880 908 910 928 930 948 950 968 970 988 990 1000 1010 1028 1030 1048 1850 1068 1070
REM # Arithmetic letters *# FOR I=N TO N+6 W=A#C#I+B: W=W4+S-264INT(W/26) SPRINT CHRS(W)3" "5 NEXT WHAXC#I+Bs W=Wt+S-26#INT (W/26) 3s XS=CHRS(W) SPRINT RETURN REM * Two arithmetic *# W=8O+INT(RND(1) #18) FOR I=i TO 6 PRINT W;" “3 W=W+C#A:C=-Ci A=A+Bt1 NEXT PRINT: X$=MID$(STRS(W) ,2) RETURN REM * Increasing aritheatic # W=85+INT(RND (1) #1) D=1+2#(RND(1)<¢.5) FOR I=1 TO & PRINT Ws" "3 W=W+C#A:C=C#D: A=A+T NEXT X$=MID$(STRS(W) ,2) SPRINT RETURN REM # Arithmetic mixed * FOR I=N TO N+é W=AXC#I+Bs W=W+5-26#INT (W/26) s YS=CHRS (W)
IF 2#INT(I/2)=1 THEN Y$=MID$(STR$(W-S+1) ,2) PRINT Y$+" "3 NEXT W=A*C#I+Bs W=W+S5-264INT (W/26) s X$=CHRS (W)
IF 2*INT(I/2)=I THEN X$=MID$(STR$(W-S+1) ,2) PRINT RETURN
REM ** INFOrmation ##
INK 7:PAPER @:CLS
E$=" "+CHR$ (27) :S=65: D$=E$+"J"+CHR$ (4) IS=E$+"A INTELLIGENCE TEST?"
PRINTSPRINT D$+I$:PRINT D$:PRINT: PRINT
PRINT D$;SPC(7)3;"by Czes Kosniowski":PRINT D$¢ PRINT: PRINT “A sequence of numbers and/or letters" PRINT “will be given. Use your intelligence"
31
108@ PRINT "to work out the next term. Then type" 1098 PRINT “it in and press <return>.":PRINT:PRINT 1100 PRINT E$+"L"+E$+"B Press Y to start" 1118 REPEAT: G$=KEY$:6G=RND(1):UNTIL G$="Y"
1120 WS$=E$+"BWell done"
113@ RETURN
The main routine
The main routine consists of a loop executed ten times. On each occasion some random numbers and a sequence type (one of five) are selected. These are then used to produce a random sequence of letters and/or numbers.
After the sequence has been displayed the computer waits for an answer to be typed in. It then responds appropriately.
The subroutines
500 SEQUENCE This consists of five different sequence types as described below. They are called by the statement GOSUB SEQUENCE+100*INTCRND(1)*5).
500 Arithmetic number sequences
Examples: 2, 4, 6, 8, 10, 12, Vip lig 3G AD 7 C5 Gwe Bo 47 7 1S Oy Bp scene
In an arithmetic sequence the difference between any two consecutive terms is constant. In the examples above these differences are 2 for the first sequence, 6 for the second and —4 for the third.
600 Arithmetic letter sequences
Examples: A, C,E,G,I1,... U,X,A,D,G, ... 0O,N,M,L, K, wu Ry tp Hp Py Xpchy eae
An arithmetic letter sequence is like an arithmetic number sequence except that it consists of letters of the alphabet rather than numbers. Thus the sequence consists of letters chosen at regular intervals. When the end of the alphabet is reached the letters are re-used as in the second and fourth example above.
700 Two arithmetic sequences
Examples: 85, 91, 80, 96, 75, 101,... 80, 72, 85, 67, 90, 62, ... 91; 10151125 125.5-441., 161.7: sees
32
These sequences consist of two arithmetic sequences which are linked together by alternating between them. One is increasing while the other is decreasing.
800 Increasing arithmetic sequences
Examples: 87, 97, 108, 121, 137, 157, ... 90, 87,91, 85, 94, 81, ... 88, 83,77, 69, 58, 43, wan»
In these sequences the difference between two consecutive terms (ignoring whether it is positive or negative) increases at an increasing rate.
For example, in the third sequence the differences are 5, 6, 8, 11, 15 which increase by 1, 2, 3 and 4 respectively.
900 Arithmetic mixed sequences
Examples: 14, P, 18, 1, 22, X, 26, «.. 22,58, 16,M, 10,6,4,... J, 12,N, 16,R, 20, V, ....
These sequences are a combination of the arithmetic number and arithmetic letter sequences.
1000 INFO This contains information and brief details of the game.
33
? Hypnotic
This program is just for fun and amusement - it is not a game — just sit back and watch the screen.
10 REM 4H HHHHHR HEHE 2@ REM * HYPNOTIC # 3Q REM HHHHHHHHHEEE
40 REM
58 INFO=500
REM #* THE MAIN PROGRAM ## GOSUB INFO
FOR G=8 TO 40 STEP 18
180 118 128 130 148 150
168 :
178 18@ 198 200 218 228 238 240 258 268 278 280 298
34
HIRES: POKE #26A,1@:PLAY 2,0,0,8 FOR Y=198 TO @ STEP -6
CURSET 1.2#Y,Y,3:FILL 200-Y,1,17
SOUND 2,25@-Y+6,8
NEXT HIRES: POKE #26A,10:EXPLODE FOR [=@ TO 3:PAPER 1:WAIT 10:PAPER Q:WAIT S:NEXT PLAY 2,0,8,0 FOR Y=@ TO 199 STEP &
CURSET 1.2#Y,Y,3:FILL 208-Y,1,16+RND(1) #8 SOUND 2,250-Y+6,8 NEXT WAIT 10
NEXT
PLAY @,8,@,0:WAIT S@:E$=" "+CHR$(27)
PRINT:PRINT ES+"B"+E$+"L- Another go? Y or N" REPEAT: GET G$:UNTIL G$="Y" OR G$="N"
308 310 508 518 520 53a 548 55@ 568 578 588 598
TEXT: IF G$="Y" THEN RUN
CLS:PRINT “Bye for now. ":POKE #268,3:END REM ## INFOrmation #+#
INK 6:PAPER @:CLS:POKE #26A,10sPRINT
E$=" "+CHR$(27) :DS=E$t+"I"+CHR$ (4)
PRINT D$;SPC(11)3"“HYPNOTIC"sPRINT D$:PRINT PRINT:PRINT D$;SPC(4)3“by Czes Kosniowski" PRINT D$:PRINT:WAIT S@:PRINT "RELAX";
FOR [=@ TO 3@:PRINT ".“s: WAIT 18:NEXT: PRINT PRINT:PRINT “You are about to be"“ssWAIT 108 PRINT E$+"LHYPNOTIZED.“:WAIT 480
RETURN
The main routine
The main routine fills the HIRES screen in two ways. First with red rectangles of increasing size, and second with differently coloured rectang- les of decreasing size superimposed on each other. Sound aids the pseudo-hypnotic effect while the explosion snaps you out.
The subroutine
500 INFO This simply gives brief details about the program.
35
8 Dancing Men
We’ve all made paper chains by folding paper, snipping away and then unfolding. Try to make a long chain of dancing men on your ORIC.
In the beginning a man appears at the centre of the screen. A moment later another appears just below him. This process then repeats. You can change the direction in which the next man appears by using the cursor keys. The whole process stops when you hit one of the obstacles (this includes hitting a man that is already on the screen).
The number of men on the screen is displayed at the top right of the screen.
DANCING MEN TOTAL: 81
BERERSR EERE NS
a to
= HRERTRTAAETTE
Another go? Y or N
10
28
30
40
58
68
180 118 120 138 148 158 168 178 188 198 208 218 220 230 248 258 500 518 520 538 600 618 628 638 648 658 668 180 101 102 183 104 185 104 107
REM HHREEREEEEERERE REM * DANCING MEN *# REM HRREERERERER ERE REM KEY=500: OBSTACLE=400 SETUP=1000: INITIAL=150@0: DETAILS=2000 REM *#* THE MAIN PROGRAM #+#
GOSUB DETAILS:60SUB INITIAL
REPEAT
: GOSUB SETUP
: REPEAT
K$=KEY$:IF K$<>"" THEN GOSUB KEY X=X+DX: Y=Y¥+DY: STATE=SCRN(X,Y)< OC PLOT X,Y,Z: AMOUNT=AMOUNT+1
PLOT 35,1,MID$(STRS (AMOUNT) , 2)
GOSUB OBSTACLE UNTIL STATE PLOT X,Y,128+Z:EXPLODE: WAIT 48 PLOT 18,25,"Another go? Y or N" REPEAT: GET G$: UNTIL G$="Y" OR G$="N" UNTIL 6$="N"
CLS:PRINT “Bye for now. "“:POKE #26A,3:END REM ## KEY ##
K=ASC(K$): IF K<8 OR K>11 THEN RETURN DX=(K=8) - (K=9) s DY=(K=11)-(K=18)
RETURN
REM ## OBSTACLE ##
IF RND(1)<.2 THEN RETURN
REPEAT
: A=INT(RND (1)#3442):BeINT(RND(1) #2143) UNTIL SCRN(A,B)=C
PLOT A,B,168
RETURN @ REM *#* SETUP #+# @ PAPER 6: INK @:CLS @ FOR X=1 TO 3d:PLOT X,2,16@:PLOT X,24,160:NEXT @ FOR Y=2 TO 24:PLOT 1,Y,16@:PLOT 36,Y,1460:NEXT @ X219sV=132:DX=OsDV=1i:PLOT X,Y,Z:STATE=FALSE @ PLOT X,Y,Z:STATE=FALSE: W=20: AMOUNT=1 @ PLOT 0,25,4:PLOT 1,25,12 @ PLOT 1,1,"DANCING MEN"
37
108@ PLOT 27,1," TOTAL: i"
1098 RETURN
150@ REM *# INITIALisation ##
151@ START=#B400+38#8: AA=#A000
152@ POKE AA,2:IF PEEK(AA)<>2 THEN START=START-#8000 153@ FOR I=START TO START+7:READ R:POKE I,R:NEXT 154@ 2=38:C=32
155@ RETURN
156@ DATA 14,14,4,31,14,14,18,18
2008 REM *## DETAILS ##
2801@ CLS:PAPER i:INK 7:PRINT
2020 POKE #26A,2 ‘Disables cursor
2038 ES=" "+CHR$(27): DS=E$t+"J"+CHR$ (4)
2040 PRINT D$;SPC(ii); “DANCING MEN"“:PRINT D$:PRINT: PRINT 2058 PRINT D$;SPC(7)s"by Czes Kosniowski":PRINT D$ 2060 PRINT: PRINT "Make a chain of dancing men. Use the" 2078 PRINT “cursor keys to change direction. "sPRINT 208@ PRINT “But - watch out for the obstacles!"
2098 PRINTSPRINT E$+"L"3SPC(9)3 "Press Y to play," 210@ REPEAT: G$=KEY$:GG=RND(1):UNTIL G$="Y"
2118 RETURN
The main routine
The main program draws a man and checks to see if it has hit an obstacle.
The subroutines
500 KEY This is used when a key is pressed. When a cursor key is pressed the computer calculates the direction in which the man should move.
600 OBSTACLE This produces an obstacle (approximately 20% of the time).
1000 SETUP A boundary wall is printed together with a man at location (19,13).
1500 INITIAL One custom character, the man, is created. This replaces the character with ASC code 38.
2000 DETAILS This contains brief details of the game.
38
9 Graphics Show
Whenever you see an expensive business computer on display it always shows off some of its graphics facilities. Some of the patterns produced are very interesting and remarkably easy to produce on the ORIC. This program will show five different sorts of patterns. Each pattern uses several random numbers and so you should never see the same pattern twice.
See Appendix 1 for some notes on saving HIRES pictures via your tape recorder.
39
10 REM HHHHHHHHHHHHHRRHEE
2@ REM * GRAPHICS SHOW +#
3O REM HHEHHRHHHHHERHHRHEHE
4@ REM
5@ INC=100: GRAPH=40@: CARRY=1000: ARCS=1100
100 118 120 13@ 148 158 168 170 188 198 208 218 228 238 240 258 260 278 288 298 308 500 518 520 538 548
558
568 578 580 598 600 618 620 638 648
40
REM ## THE MAIN PROGRAM *## INK 4:PAPER @:CLS
REPEAT
: TEXT: CLS:PRINT: Z=FRE(1) : ES=" "“+CHR$(27) : D$=E$+"JI"+CHR$ (4)
: XMID=119:s YMID=99: DEF FNR(X)=INT(RND(1)#X)sPP&2#PI : PRINT D$;SPC(9);"GRAPHICS SHOW":PRINT D$
: PRINT:PRINT: PRINT D$3SPC (4);
: PRINT “by Czes Kosniowski":PRINT D$:PRINT
: PRINT “1. TWISTER": PRINT
: PRINT "2. STAR":PRINT
: PRINT “3. EYE"sPRINT
: PRINT “4. THISTLE“:PRINT
: PRINT "5S. MOIRE“s PRINT
: PRINT “@. QUIT"“:PRINT
: PRINT “Please enter the number of your choice"
: REPEAT: G$=KEY$:GG=RND(1):UNTIL G$>="@" AND G$<"6" : G=VAL(G$):HIRES:POKE #26A,2
: IF G>@ THEN GOSUB GRAPH+INC#6:GOSUB CARRY
UNTIL G=@
TEXT:CLS:PRINT “Bye for now. "sPOKE #26A,3:END
REM ## TWISTER ## A=.5-RND(1):B=.5-RND(1)sC=.5-RND (1): D2. 5-RND (1) PRINT SPC(14)3 "TWISTER": SH=15: XMID=XMID-SH
FOR I=1 TO 25 STEP .25
: X=XMID#SIN(A#I): YeYMID#COS (Bel)
: CURSET X+XMID+SH,Y+YMID, 1
: DRAW 1+XMID#SIN(C#I)-X,1L1+YMID#COS (D#1)-Y,1
NEXT
XMID=XMID+SH
RETURN
REM ## STAR ##
PRINT SPC(16)3 "STAR": N=34FNR(7) s ANGLE=PP/N W=YMID#RND (1) sSTART=P1#(2#INT(M/2) =N-1)/2
FOR I=YMID TO @ STEP -S5:X%=1#COS (START)
: YZ2T#SIN(START) sCURSET XX+XMID,YX+YMID,1
658 668 678 688 698 708 718 720 738 740 758 768 778 788 798 808 818 820 830 840 858 840 878 880 898 900 918 920 938 940 958 968 970 980 998
: FOR J=START+ANGLE TO START+PP+ANGLE STEP ANGLE : U%=W#COS (J-ANGLE/2) : VZ=W#SIN(J-ANGLE/2) : DRAW U%-X%,V%-V%, 12 X%2U%2 V%=V%U%21#COS (I) : VAEL#SIN(I) :DRAW UX-X%,VU-V%, Le XZ=U%2 VLEVE NEXT: NEXT: RETURN
REM #* EYE ##
PRINT SPC(16); "EYE" A=10+FNR(4@) :B=5Q+FNR (40) :N=1Q+FNR(4@) 60SUB ARCS
A= (A+B) /2:B=(B+YMID) /2
FOR I=@ TO PP STEP PI/N
: CURSET XMID+A#COS(1),YMID-A#SIN(I),1
: DRAW (B-A)#COS(I), (BHA) #SIN(T) ,1
NEXT
RETURN
REM ## THISTLE ##
PRINT SPC(14)5; "THISTLE"
A=10+FNR (48) rB=SO+FNR (40) :N=LO+ENR (48) GOSUB ARCS
A=(A+B) /2:B=(B+YMID) /2
FOR I=@ TO PI STEP PI/N
: CURSET XMID-A#COS(I),YMID#A#SIN(I), 1
: DRAW (B+A)#COS(I), (B-A)#SIN(I),1!
NEXT
RETURN
REM ## MOIRE ##
PRINT SPC(15) 5 "MOIRE"
XMAX=224s YMAX#1991K21+5#RND (1)
FOR I=@ TO XMAX STEP K
: CURSET 15,0,1:DRAW I, YMAX,1
NEXT
FOR I=YMAX TO @ STEP -K
: CURSET 15,@,1:DRAW XMAX,I,1
NEXT
RETURN
1088 REM ## CARRY ON ##
1010 PING:FOR I=1 TO 6:INK I: WAIT 75: NEXT
1028 E¢=" "+CHR$(27)
103@ PRINT E$+"B"+E$+"L Press Y to continue" 104@ REPEAT:UNTIL KEY$=""
1058 REPEAT:GET G$:UNTIL G$="Y"
Al
1060 HIRES: POKE #24A,2: RETURN
11@@ REM ** ARCS #+#
111@ FOR I=@ TO PP STEP PP/N
1120 : CURSET XMID,YMID,1
113@ : DRAW A#COS(PP-1) ,A#SIN(PP-I),1 1140 : CURSET XMID,YMID,1
1158 : DRAW BeCOS(PI/N+I) ,BeSIN(PI/N+I),1 1148 NEXT
1170 RETURN
The main routine
This is the main menu to find out which sort of pattern the operator wants created.
The subroutines
400 GRAPH There is no subroutine with this line number. The relevant subroutines are at intervals of 100 starting with line number 500. They are called by GOSUB GRAPH+INC*G where INC=100 and G is one of the numbers 1 - 5 typed by the operator. Details of these subroutines are given below.
500 TWISTER consists of a sequence of straight lines that twist around the screen.
600 STAR draws a random star with between 3 and 9 sides. The computer then fills in this region.
700 EYE is a sequence of lines that partly fan out from the centre of the screen. The final effect is much like an eye.
800 THISTLE is much like EYE.
900 MOIRE consists of a sequence of straight lines that emanate from the top-left corner of the screen, slowly filling the whole screen.
1000 CARRY This subroutine changes the colour of the picture and then asks if you want to carry on.
1100 ARCS This is needed for some of the GRAPH subroutines.
10 Square Nim
Square nim is a game for two people. As the name suggests it is a disguised version of Nim. In case you've forgotten, Nim is that pick-up-sticks game in which you are presented with some piles of sticks. Each player, in turn, picks up some of the sticks from any one pile. The player picking up the last stick wins.
In square nim we have a square board (something like a chess board). This has a letter A and a letter B in each row. One person is player A and the other player B.
Each player, in turn, chooses a row and moves his or her letter along that row without jumping over the opponent's letter. The game ends when the letters in each row are next to each other. The player creating this state wins.
The letter that is flashing can be moved by using the left or right cursor keys. If you want to move a different letter use the up or down cursor keys. The up and down cursor keys will only work if you have not yet moved your letter left or right. When you have moved your letter press Y for the next player’s turn. A letter must be moved before the Y key has any effect.
x *
* * * KK KK K * * ke ek DK *K * De * D*D* D *
D*x* D* D* OD * * * kee * eK ED * ok ke kK eK KO eK D * * ee Ke DK * OD ** OW * DO * * kK K * *x* * * OD kK eK Ke K OK OK
* ¥ * * * * * A * *
* x
* PLAYER - B
43
10 REM #H#HHHRHRERHHSEE
2@ REM * SQUARE NIM #
3O REM HHHHHHHHHE HEHE
40 REM
5@ FLASH=500: BIT=20: SETUP=100@: INFO=2000
10@ REM *##* THE MAIN PROGRAM ##
11@ GOSUB INFO:GOSUB SETUP
120 REPEAT
13@ : PLOT 8+2#X,5+2#Y,8: ZAP
140 : C=-(NOT-C):ANSWER=FALSE
158 : GOSUB FLASH+BIT
160 : PLOT 10,25,X$(C):T=0
178 : REPEAT
180 : GET G$:G=ASC(G$)
190 : PLOT 8+2#X,5+2#Y,8
200 : IF G=8 AND C=@ AND X>@ THEN A(Y)=AC(Y)-1:T=T-1
21@ : IF G=8 AND C=1 AND X>A(Y)+1 THEN B(Y)=B(Y)-1:T=T-1 220 : IF G=9 AND C=@ AND X<B(Y)-1 THEN A(Y)=A(Y) +1: T=T+1 230 : QIF G=9 AND C=1 AND X<9 THEN B(Y)=B(Y) +1: T=T+l
240 : IF G=8 OR G=9 THEN GOSUB FLASH
250 : IF G=1@ AND Y<? AND T=@ THEN Y=Y+1 268 : IF G=11 AND Y>@ AND T=@ THEN Y=Y-1 278 : IF G$="Y" AND T<>@ THEN ANSWER=TRUE 288 : GOSUB FLASH+BIT
290 : UNTIL ANSWER
3@0 : REM CHECK FOR WIN
31@ : STATE=TRUE
3280 : FOR IT=@ TO 9:STATE=STATE# (A(T) =B(1)-1) : NEXT 33@ UNTIL STATE
34@ PING: WAIT 3@:ZAP:WAIT 30:PING
358 PLOT 9,25,12:PLOT 23+C,25, "WINS"
368 PLOT 7,3,CHR$(12)+CHR$(4)+"Another go? Y or N" 37@ REPEAT:GET G$:UNTIL G$="Y" OR G$="N"
380 IF G$="Y" THEN RUN
39@ CLS:POKE #26A,3:PRINT “Bye for now. ":END
508 REM ** FLASH #%
S1i@ PLOT 94+2#X,5+2#Y,42
928 X=C#B(Y)-(C=8) #A(Y)
53@ PLOT 8+2#X,5+2#Y,12:PLOT 10+2#X,5+2#Y,8
540 PLOT 9+2#X,5+2#Y,45+C
55@ RETURN
4
1080 1818 1028 1830 1048 1058 1068 1878 1080 10898 1100 1110 1120 2008 2018 2028 2038 2048 2058 2860 2078 2088 2098 2108 2110 2120 2138 2140 2158 2160 2170 2188 2198 2200 2210
REM ## SET UP ##
PAPER 6: INK @:CLS:PRINT
PRINT S$:PRINT D$:PRINT: PRINT
FOR I=@ TO 9
: PRINT SPC(7)
: FOR J=@ TO 9:PRINT CHR$(136)+"#"5 2 NEXT
: PRINT: PRINT: A(T) =INT(RND(1) #5)
: BCI) =INTCRND (1) *#(9-ACI)) 4A(1) 41)
: PLOT 9+2#A(1),5+2#1,65:PLOT 9+2#B(1) ,5+2#1,66 NEXT
X$(@)="FIRST PLAYER - A “sX$(1)="SECOND PLAYER - B" C=1:Y=@:PLOT 8,25,4
RETURN
REM ## INFOrmation ##
CLSsPRINT:POKE #26A,2:PAPER 4: INK @
E$=" "4+CHR$(27) sDS$=E$+"JI“+CHRS$ (4)
S$=D$+" SQUARE NIM"
PRINT S$:PRINT D$:PRINT: PRINT
PRINT D$+" by Czes Kosniowski":PRINT D$:PRINT PRINT "This is a game for two players, A & B."
PRINT “Each player, in turn, chooses a row" PRINT “and moves his or her piece anywhere" PRINT “within that row, but without jumping" PRINT “over the opponents piece. The game" PRINT “ends when the pieces in each row are" PRINT "next to each other. The player creat-" PRINT “ing this state wins. "sPRINT
PRINT “The piece that is flashing can be " PRINT “moved left or right with the cursor” PRINT “keys. If you want to move a different" PRINT “piece, use the other cursor keys. ":PRINT PRINT “When you are ready, press Y."“:PRINT PRINT ES+"L"+E$+"D"3SPC(4)3 "Press Y to play"; REPEAT: G$=KEY$:G6G6=RND(1): UNTIL G$="Y"
RETURN
The main routine
The main loop responds to the key that has been pressed.
The value of T determines whether or not a letter has been moved. ANSWER becomes TRUE when both T is non zero and the Y key has been pressed.
45
The subroutines
500 FLASH
This is used to flash the appropriate position on the screen. There is another subroutine embedded in this subroutine — this is accessed by using GOSUB FLASH+BIT, i.e. GOSUB 520.
1000 SETUP
This prints out the board and randomly positions the A’s and B’s in each row.
2000 INFO A brief outline of the game is contained in this subroutine.
il Oh! Susanna
With this program the ORIC plays a tune and produces a random, colourful, pattern. Press @ when you want to quit the program.
10 REM H#EHHHHHEHHHRHEES
28 REM * OH! SUSANNA # 38 REM HHHHHHHHHEHEEEE
40 REM
5@ INFO=580
18@ REM *#* THE MAIN PROGRAM #+#
11@ GOSUB INFO
128 REPEAT
138 : PLOT FNR(37) ,FNR(27) ,CHRS(FNR(7) +1) +CHRS(32+FNR(M) ) 140 : [=I+it:IF 1558 THEN [=O:J=J+i:1F J>5 THEN J=1
150 : B=INT((ACI)-1)/12)
160 : IF ACI)>@ THEN MUSIC 1,J+B,A(I)-12#B,@:PLAY 3,@,1,L 178 : WAIT S#T(1)
18@ UNTIL KEY$="Q"
19@ PLAY 8,8,0,8
200 PRINT E$s"B"5E$3"L Another go? Y or N“sSPC(1@) 218 REPEAT: GET G$:UNTIL G$="Y" OR G$="N"
220 IF G$="Y" THEN RUN
23@ CLS:PRINT "Bye for now. ":POKE #26A,3: INK 7: END
5@@ REM ## INFOrmation #+#
51@ INK S:PAPER @:CLS:DEF FNR(X)=INT(RND(1) #X)
520 E¢=" “+CHR$ (27) :DS=E$+"I"+CHR$ (4): PRINT
53@ PRINT D$;SPC(18);"OH! SUSANNA“: PRINT D$:PRINT: PRINT 548 PRINT D$;SPC(4);"“by Czes Kosniowski":PRINT D$:PRINT 558 PRINT “Watch the computer while it produces"
47
56@ PRINT "a random pattern and plays a tune.“:PRINT 57@ PRINT “Press Y to start. "3
58@ REPEAT:GET G$:UNTIL G$="Y"
598 PRINTSPRINT:PRINT "Press @ to quit. "3
600 DIM A(58),7T(58):FOR [=@ TO S8:READ ACI), T(I) NEXT 618 IF 1(58)<>6 THEN PRINT “ERROR IN DATA! ":END
628 CLS:POKE #246A,18:LORES 1:L2=2500:4=95
63@ RETURN
70@ DATA 6,1,8,1,10,2,13,1,13,3,15,1,13,2,18,2
710 DATA 6,3,8,1,18,2,10,2,8,2,4,2,8,4,08,2,6,1
72@ DATA 8,1,10,2,13,3,13,1,15,1,13,2,10,2,4,3
730 DATA 8,1,10,2,10,2,8,2,8,2,6,46,0,2,11,4,11,4
748 DATA 15,2,15,5,15,1,13,2,13,2,10,2,6,2,8,4
758 DATA @,2,6,1,8,1,18,2,13,2,13,3,15,1,13,2
768 DATA 180,2,6,3,8,1,10,2,18,2,8,2,8,2,6,6,8,6
The main routine
The main program plays a note and plots a random character from the alternate character set. The tune is played on a different scale each time. See Appendix 4 for some musical notes.
The subroutine
500 INFO This contains a brief description of the program.
Following the description the DATA is read in. This. data consists of the note (stored in the array A(1)) and the time interval for which it should be played (stored in array T(1)).
An error check line has been inserted to make sure that all the data is there.
I? Stop’em
There are twelve lights on the screen which may be on or off. At the start only one or two lights are on. The position of each light moves from left to right. When it reaches the end of the row it goes back to the beginning and repeats. The object is to switch the lights off by pressing any key.
If the light in the marked position is on and you press a key then the light goes off. If it is off then it goes on. Thus, if you miss you have more lights on — all moving from left to right. Try to stop ‘em all.
STOP ’EM
BoOomenrpmsesomereodg& aoa
“
Press the <space bar> to stop’em
49
10 REM #HeHREHEHE RE 28 REM # STOP ‘EM # 3O REM HHEHHRHRHRHRE 4@ REM
5@ SETUP=400: INFO=600
100 118 120 138 148 158 148 178 188 198 208 218 220 238 248 258 268 278 400 418 420 438 440 458 468 478 480 498 580 318 680 618 420 638 648 658
50
REM #* THE MAIN PROGRAM ## GOSUB INFO:STATE=FALSE:GOSUB SETUP REPEAT FOR K=@ TO 18
WAIT ZZ:PRINT AS+CHR$(11)
IF A$=B$ THEN STATE=TRUE
AS=RIGHT$(A$,4) +LEFTS$(A$, 44)
N=ASC (MID$(A$,23,1))
IF NOT STATE AND KEY$<>"" THEN N=71-(N-64 AND 7) AS=LEFT$(A$,22) +CHRS(N) +MID$ (A$, 24) NEXT WAIT RND(1)#20+1 UNTIL STATE PING: WAIT 3O:PING:PRINT: PRINT SPC(14)3 "WELL DONE" PRINT:PRINT E$+"B"+E$+"L Another go? Y or N" REPEAT:GET G$:UNTIL G$="Y" OR G$="N"
IF 6$="Y" THEN RUN CLS:PRINT “Bye for now.":POKE #26A,3:END REM ## SET UP ## PAPER @: INK 46:CLS:PRINT CHR$(4) PRINT E$+"J"sSPC(12); "STOP ‘EM"*:PRINT: PRINT CHR$(4) FOR I=@ TO 4:PRINT: NEXT PLOT 18,12,94 POKE #26A,2 ‘Disables cursor FOR [=8 TO 11: BS=BS+E$+"F"+CHR$ (255) :NEXT AS=LEFT$(B$,22)+"A"+MID$ (BS, 24) AS=LEFT$(A$,14)+"A"+MID$ (A$, 14) AS=LEFT$(A$,2)+"A"+MID$(AS, 4) PLOT 4,146,"Press the <space bar> to stop ‘ea" RETURN REM ## INFOrmation ## PAPER @: INK 7:CLS E$=" “+CHR$(27):PRINT CHR$(4) PRINT E$t"J"s3SPC(1i)3 "STOP ‘EM"sPRINTSPRINT PRINTsPRINT ES+"J"sSPC(4)3 "by Czes Kosniowski" PRINTS: PRINT CHR$(4): PRINT: PRINT
66@ PRINT “Press the space bar to change the"
67@ PRINT “colour of the moving lights.":PRINT
68@ PRINT "Try to make them cyan (light blue).":PRINT 698 PRINT "At what speed do you want the lights"
708 PRINT “to move? @ (fast) to 9 (slow): "35
710 ‘REPEAT: G$=KEY$:GG=RND(1)sUNTIL G$<"s" AND G$>"/" 728 ZZ=VAL(G$) +1
73@ RETURN
The main routine
The lights are stored in the string A$. Each light occupies four characters. The moving effect is achieved by moving the last four characters (represent- ing the light on the right) to the front of A$.
If a key is pressed then the light in the sixth position is changed. A light in that position is on if the value of N is 65, or off if it is 70. The statement N = 71 - (N- 64 AND 7) changes 70 to 65 and vice versa.
The speed with which the lights move from left to right is controlled by two WAIT statements. One is determined by the player, the other is random.
The subroutines
400 SETUP This creates the string A$ of lights with three lights on. The string B$ is the string of lights with all lights off.
600 INFO
This contains a brief description of the game. The player has an option to decide at what speed the lights move from left to right.
51
13 Round and Round
With this program you can produce some spectacular curves. Technically speaking, the computer will plot the graphs of polar functions — but with a slight twist. The amount of twisting depends on the values of A and B that you input when requested to do so.
See Appendix 1 for some notes about saving screen pictures via your tape recorder.
52
10 REM #H#eHRERHERESERE SESE 20 REM * ROUND AND ROUND *# ZO REM HHHRHHREREEREESEREE 4@ REM
5@ PL=500
100 118 128 13@ 148 158 168 178 188 198
200 :
218 228 238 248 258 508 518 528 538 548 55@ 568 578 588 598 608 618 628 638 648 658 668 678 68@ 698
REM ## THE MAIN PROGRAM ##
INK 6:PAPER @:CLS:FOR I[=8 TO 6:READ AS(I): NEXT REPEAT
: TEXT: CLSs:PRINT: ZZ=FRE(1)
: E$=" "+CHR$(27) : DS$=E$+" J" +CHRS$ (4)
: XMID=119: YMID=99: PP=2#PI
: XRATIO=XMID#. 6: YRATIO=YMID#.9
: PRINT D$;SPC(7);"ROUND AND ROUND“:PRINT D$
: PRINT:PRINT:PRINT D$;SPC(6)5; "by Czes Kosniowski" : PRINT D$:PRINT:PRINT “@ QUIT"
: FOR [=8 TO S4:PRINT [+13" R = “sAS(T)ENEXT
: PRINT:PRINT “Type in the number of the equation." : REPEAT: GET G$: UNTIL G$>="@" AND G$<"8"
: G=VAL(6$)-1:I1F 6>=@ THEN GOSUB PL
UNTIL 6<@
CLS:PRINT “Bye for now. "sEND
REM * PLOTTING #
PRINT SPC (17-LEN(A$(6))/2);A$(6)
IF G=@ THEN DEF FNA(Z)=1
IF G=1 THEN DEF FNA(Z)=SIN(2#Z)
IF G=2 THEN DEF FNA(Z)=SIN(7#Z)
IF G=3 THEN DEF FNA(Z)=(1+2#C0S(Z))/3
IF G6=4 THEN DEF FNA(Z)=(1+C0S(Z))/2
IF G=5 THEN DEF FNA(Z)=(1+SIN(2#Z))/2
IF G=S THEN DEF FNA(Z)=(1+2#C0S(2#2))/3
PRINT: PRINT “Type in values of A and B then press" PRINT “<return>. For standard plot use A=1"
PRINT “and B=i."sPRINT: INPUT “Value of A“sA
INPUT "Value of B";B
HIRES: POKE #26A,2
PRINT SPC(13-LEN(A$(6))/2)sAS(G)3" A="sA3" B="3B FOR Z=@ TO PP+.@1 STEP .@1
: X=XMID+XRATIO#COS (A#Z) #FNA(Z)
: Y2YMID+YRATIO#SIN(B#Z) #FNA(Z)
: CURSET X,Y,1
NEXT
53
700 PINGSFOR I=1 TO 6: INK I:WAIT 75:NEXT
718 E$=" "+CHR$ (27)
720 PRINT ESt+"B°+E$t"L Press Y to continue" 73@ REPEAT: UNTIL KEY$=""
748 REPEAT:GET G$:UNTIL G$="Y"
758 RETURN
808 DATA 1,SIN(2#Z) ,SIN(7#Z) ,1+2#COS(Z) ,1+COS(Z) 818 DATA 1+SIN(2#Z) ,1+2#C0S5(2#2)
The main routine
This displays the various choices open to you — try them all. With option 1 (and with A = 1 and B = 1) the result will be a circle.
The subroutine 500 PL
This subroutine essentially plots the selected graph. On completion it waits for you to press Y which returns you to the main menu.
54
14 Cascade
In cascade you have to get a ball to drop from the top of the screen to the bottom. A ball may be dropped from any one of ten positions by pressing one of the keys 0 to 9.
There are several obstacles for your ball to overcome. If the ball hits an obstruction it may be reflected, deflected through a right angle or swallowed up. An 0 deflects the ball, an X reflects it while a solid red square eats it up.
The obstructions may change when hit.
CASCADE 1 2 3 4 3 & 7 8 9? @ 00,,00 X¥ 00 OX 00,,0% 00 XX 0 0 f ae
55
10 REM *###eeeeHHRE 2@ REM * CASCADE *# 3Q REM HHHHHREHERE 40 REM
58 C 100 118 120 138 142 158 148 178 188 198 200 218 220 230 240 258 268 270 288 290 308 508 518 528 538 540 55a 1800 1818 1828 1038 1040 1058 1868 1078 1088
56
HANGE=50@: SETUP=1000: INFO=2800 REM #* THE MAIN PROGRAM ## GOSUB INFO:GOSUB SETUP REPEAT
: REPEAT:GET G$:UNTIL G$>"/" AND G$<":"
: X=2+3#VAL (6$) -30#(G$="0")
: Y=4:A=0:B=1
: PLOT X,Y,Z
: STATE=FALSE
: REPEAT : U=X+A: V=Y+B:W=SCRN(U,V) : IF U<4 OR U>33 OR V4 THEN SHOOT: STATE=2 : IF V>24 THEN PING:WAIT 20:PING:STATE=1 : IF W>78 THEN GOSUB CHANGE : PLOT X,Y,32:X=X+A: Y=Y+B : IF STATE<2 THEN PLOT X,Y,2Z : UNTIL STATE
UNTIL STATE=1
PLOT 8,26,S$
REPEAT:GET G$:UNTIL G$="Y" OR GS$="N"
IF 6$="Y" THEN RUN
CLS:POQKE #26A,3:PRINT "Bye for now. "“:END REM ## CHANGE #+#
IF W=255 THEN ZAP:STATE=2
IF W=88 THEN A=-A:B=-B:PING
IF W=79 THEN C=-B:B=A: A=C:PING
PLOT U,V,A(FNR(P-3))
RETURN
REM *## SET UP ##
DEF FNR(X)=INT(RND(1) #X)
PAPER @: INK 6:CLS:Z=126
PRINT E$+"B"3SPC(12) 3 “CASCADE":PRINT PRINT E$+"B "3
FOR T=1 TO 9:PRINT CHR$(48+1)3SPC(2)3:NEXT PRINT "@"
P=7:FOR I1=8@ TO P-1:READ A(I):NEXT
FOR J=4 TO 33
1098 : IF J#INT(J/3)<>3-2 THEN PLOT J,4,A(1+FNR(2)) 1188 NEXT
1118 FOR I=5 TO 24
1128 : PLOT 4,1,A(1)
1130 : FOR J=4 TO 32 STEP &
114@ : IF RND(1)<.5 THEN PLOT J+FNR(4),1,ACFNR(P)) 1158 : NEXT
116@ : PLOT 33,1,A(2)
117@ NEXT
1188 FOR J=5 TO 32 STEP 3:PLOT J,S+FNR(17) ,A(2) NEXT 1198 S$=CHR$(2)+CHR$(12)+"Another go? Y or N"
1288 RETURN
1218 DATA 255,88,79,79,32,32,32
2000 REM ## INFOrmation ##
2010 PAPER @: INK 4:CLS:POKE #26A,2:PRINT
2020 E$=" "+CHR$(27):DS=E$+"J"+CHR$ (4)
2030 PRINT D$3SPC(12);"CASCADE":PRINT D$sPRINTsPRINT 2048 PRINT D$;SPC(6)3"by Czes Kosniowski":PRINT D$:PRINT 2058 PRINT “Try to get a ball to reach the bottoa." 2060 PRINT "Press one of the keys @ to 9 te"
2078 PRINT "release a ball. The obstructions will" 2080 PRINT “either eat your ball, deflect it or" 2090 PRINT "else reflect it.":PRINT
2108 PRINT “The red squares eat a ball. The 0’s" 2118 PRINT “deflect a ball and the X‘s reflect it."
2120 PRINT E$+"B"+E$+"L- Press Y to start." 213@ REPEAT: G$=KEY$:GG=RND(1): UNTIL G$="Y" 2148 RETURN
The main routine
The ball continues to move until it meets an obstruction after which the direction of movement may change or the ball may be consumed.
If STATE is FALSE then the ball is active. The value of STATE becomes NOT FALSE when it is either consumed or reaches the bottom of the screen.
If STATE = 1 the game ends (unless you want to play again). If STATE = 2 then your ball has been consumed and you have to try again.
The subroutines
500 CHANGE This is used when the ball meets an obstruction. It changes the direction in which the ball moves and the nature of the obstruction just met.
57
1000 SETUP A random arrangement of obstacles is produced by this subroutine.
2000 INFO Brief details of the game are provided by this subroutine.
58
15 La Cucaracha
Just a simple tune with some graphics portraying the notes.
La Cucaracha
59
10 REM £HHHHHHRHHEHKEREES
2@ REM * LA CUCARACHA *
JO REM HHHHRRHERHHERERE
48 REM
5@ INFO=500
10@ REM *#* THE MAIN PROGRAM ##
11@ GOSUB INFO: J=2:K=0
12@ REPEAT
138 : T=I+it:sPLOT 14,24,"La Cucaracha"
140 : IF I>MAX THEN [=O:J=J+i:CLS:INK J: IF J>5 THEN J=2 15@ : B=INT((A(I)-1)/12)
168 : K=K+i:IF A(I)=@ AND K>27 THEN K=@8:CLS
17@ : PLOT K,24-A(1) ,95+63# (A(T) =@)
18@ : IF AC(I)>@ THEN MUSIC 1,J+B,A(1)-12#B,@:PLAY 3,@,1,L 198 : WAIT S*T(T)
20@ UNTIL KEY$="Q"
21@ PLAY 0,8,8,8
228 PRINT ES$s"B"SE$ 3 "L Another go? Y or N"sSPC (18) 23@ REPEAT:GET G$:UNTIL G$="Y" OR G$="N"
248 IF G$="Y" THEN RUN
25@ CLS:PRINT "Bye for now.":POKE #26A,3:INK 7: END
5SQ@Q@ REM ## INFOrmation #+#
518 INK 5:PAPER @:CLS:DEF FNR(X)=INT(RND(1) #X)
520 E$=" "4CHR$(27): DS=E$t+"JI"+CHR$(4) sPRINT
53@ PRINT D$;SPC(9);"LA CUCARACHA":PRINT D$sPRINT: PRINT 548 PRINT D$;SPC(4)3"by Czes Kosniowski":PRINT D$:PRINT 55@ PRINT "Just a simple tune..... .":sPRINT
540 PRINT “Press Y to start......0. a
57@ REPEAT:GET G$:UNTIL G$="Y"
58@ PRINT:PRINT: PRINT “Press @ to quit. "$;
598 DIM A(10@),T(100) sMAX=-1
600 REPEAT: MAX=MAX+1:READ A(MAX) ,T(MAX) UNTIL A(MAX) #-1 61@ IF MAX<>87 THEN PRINT "DATA ERROR": END
628 MAX=MAX-1:CLS:POKE #26A,18: INK 6:L=2588
63@ RETURN
70@ DATA 8,1,8,1,8,1,13,3,17,1,8,1
71@ DATA 8,1,8,1,8,1,13,3,17,5,8,1
728 DATA 13,1,@,1
73@ DATA 13,1,12,1,12,1,18,1,10,1,8,4,0,1
740 DATA 8,1,8,1,8,1,12,3,15,1,8,1
758 DATA 8,1,8,1,8,1,12,3,15,5,0,1
60
760 DATA 20,1,@,1 77@ DATA 22,1,20,1,18,1,17,1,15,1,13,4,0,1 78@ DATA 8,1,8,1,8,1,13,3,17,1,8,1
79@ DATA 8,1,8,1,8,1,13,3,17,5,0,1
B@@ DATA 13,1,0,1
B10 DATA 13,1,12,1,12,1,18,1,10,1,8,4,@,1 820 DATA 8,1,8,1,8,1,12,3,15,1,0,1
830 DATA 8,1,8,1,8,1,12,3,15,5,0,1
848 DATA 20,1,0,1
Q5@ DATA 22,1,20,1,18,1,17,1,15,1,13,2 860 DATA 13,1,13,1,13,1,0,6
87@ DATA -1,-1
The main routine
As each note is played, a character is drawn at a suitable position on the
screen. The notes are stored in the array A(1I) and the time interval for which
they should be played is stored by T(1). Press @ to stop the program. See Appendix 4 for some musical notes.
The subroutine
500 INFO This contains the credits. The notes and time intervals are read into the arrays A(I) and T(1).
A line for data error checking is included.
61
16 Clock Puzile
This game is based on a sliding blocks puzzle invented by Czes Kosniowski and John Ewing (see Puzzle it out: Cubes, groups and puzzles published by Cambridge University Press).
There are twelve counters, numbered 1 to 12, and one empty space ona board as shown below.
The object is to move the counters around so that they appear in sequence as on a clock face.
62
The cursor keys are used to move the empty space around the playing area.
The puzzle is lots of fun, at times infuriating and certainly not easy.
li 12 1Q@ CLOCK 9 CLOCK 3
8 CLOCK
oe &
63
18 R 20 R 38 R 48 R 5@ 180 110 128 138
140:
158 142 178 188 198 208
210 :
220 238 240 258 268 278 288 298 308 318 500 518 528 1008 1018 1828 1038 1040 1058 1042 1078 1080 1098 1188
64
EM HERRHHHHHHEREREES
EM * CLOCK PUZZLE +*
EM HHXHRRHHEHEREEES
EM
OVE=500: SETUP=1000: INFO=2000 REM *## THE MAIN PROGRAM #+# GOSUB INFO:GOSUB SETUP: STATE=FALSE REPEAT
: ANSWER=FALSE REPEAT : REPEAT:GET G6$:G=ASC(G$):UNTIL G>7 AND 6<12 OR G=81 : U=X+(G=8)-(6=9) :V=V¥+(G=11)-(6=18)
: IF U>=@ AND U<3 AND V>=@ AND V<S THEN ANSWER=TRUE : IF U=i AND (V=i OR V=3) THEN ANSWER=FALSE : UNTIL ANSWER : W=S#U+VsP$(Z)=P$(W)sP$(W)=" " GOSUB MOVE: X=U:Y=V:Z=W:GOSUB MOVE
: STATE=TRUE
: FOR I=@ TO 14:STATE=STATE* (P$(1)=Q$(1)) 2 NEXT : IF G=81 THEN STATE=2
UNTIL STATE
IF STATE<2 THEN PING: WAIT 3@:PING:
PLOT 24,1,CHR$(12)+CHR$(2)+"Another go?" PLOT 26,3,CHR$(12)+CHR$(2)+"Y or N" REPEAT: GET 6G$:UNTIL G$="Y" OR G$="N"
IF 6$="¥" THEN RUN CLS:POKE #26A,3:PRINT "Bye for now. ":END REM ** MOVE ## PLOT 6+5#X,24+5#Y,P$(Z)sPLOT S+5#X,3+5#Y,P$(Z) RETURN
REM *# SET UP ##
E$=CHR$ (27) : F$=CHR$ (255)
PAPER @: INK 7:CLS
BS=" "FE$S+"D"+F $s XS=ES+"B"+BE AS=BS+X$+X$+X$: YS=BS
FOR I1=8 TO 4: Y$=YS+F$: NEXT CS=BStE$t+"B"+V$S4X$
FOR 1=8 TO 14:BS$3B$+F$: NEXT
REM PRINT BOARD
PRINT CHR$(30)+B$
FOR I=@ TO 4:FOR J=i TO 5
1118 1128 1138 1140 1158 1168 1178 1182 1198 1280 1218 1220 1238 1248 1250 1240 1278 1288 1298 1300 1310 1320 1330 1348 1358 1348 1370 1880 2000 2018 2020 2038 2040 2058 2042 2078 2088 2090 2100 2118 2120
: IF 2#INT(I/2)=I AND J<5 THEN PRINT A$
: IF 2*INT(I/2)<>1 AND J<5 THEN PRINT C$
: IF J=5 THEN PRINT B$
NEXT: NEXT
R$=CHR$(1):PLOT 25,4,R$+"11 12 | Nia
PLOT 25,9,R$+"10 CLOCK 2":PLOT 25,12,R$+" 9 CLOCK 3" PLOT 25,15,R$+" 8 CLOCK 4"
PLOT 25,18,R$+" 7 4 a"
REM THE PIECES
DIM P$(14) ,Q$(14)
FOR I=1 TO 9:P$(1I)=" “+CHR$(48+1) sNEXT
FOR [=@ TO 2:P$(10+1)="1"+CHR$(48+1): NEXT P$(O)=" "SP$(13)=FS+F$
FOR [=@ TO 14:READ K:Q$(1)=P$(K) NEXT
FOR I=@ TO 14:P$(1)=Q$(1) NEXT
REM MIXING
FOR I=1 TO 10
: K=INTCRND(1)#6)+9#INT(RND (1) #2)
: L=INT(RND(1)#46)+9#INT(RND (1) #2)
: R$=P$(K)sP$(K)=P$(L) sP$(L) =RF
NEXT
REM DISPLAY PIECES
FOR X=@ TO 2:FOR Y=@ TO 4
: Z=5#X+Y:GOSUB MOVE
NEXT: NEXT
X=1:Y=2:2=7
RETURN
DATA 11,10,9,8,7,12,13,0,13,6,1,2,3,4,5
REM ** INFOrmation #*+#
E$=" "4+CHR$(27):PAPER @: INK 7:CLSsPRINT CHR$(4) PRINT E$+"J"3SPC(11)3 "CLOCK PUZZLE":PRINT: PRINT PRINT: PRINT E$t+"J"3SPC(8)3 "by Czes Kosniowski" PRINT CHR$(4):PRINT
PRINT “Rearrange the numbers on the clock" PRINT "face into their correct postion."
PRINT: PRINT "Use the cursor keys to move the empty" PRINT “space. "s;E$t"A Press @ to Quit":PRINT: PRINT PRINT E$+"L"+E$+"B Press Y to play"
POKE #26A,2 ‘Disables cursor
REPEAT: G$=KEY$:GG=RND(1):UNTIL G$="Y"
RETURN
65
The main routine
There are two parts to the main routine. The first part waits for one of the cursor keys (ASC values 8 to 11) or the @ key (ASC value 81) to be pressed. Ifa cursor key is pressed, and if it indicates a valid position for the empty space to occupy then a move is made. If @ is pressed the game terminates.
The second part checks to see if the squares are in the correct positions.
The subroutines
500 MOVE This simply plots the appropriate number (or empty space) where it is needed.
1000 SETUP This is a rather long but straightforward subroutine to produce the square clock display.
In addition, the computer mixes up the pieces ready for play.
Note. If you decide to alter the number of times the computer mixes up the pieces, make sure that it is still an even number of times. If this number is odd then the puzzle becomes impossible to solve!
2000 INFO Brief details of the game are contained in this subroutine.
66
17 Blank Out
There are nine windows numbered 1 to 9. The curtains are drawn open. A lady walks behind these windows shining a light. She walks from window 1 to 9 and then jumps back to window 1 and repeats the process. If she is behind a window when you press the corresponding number of the window, then the curtains are closed. The object of the game is to draw all the curtains.
Note. There is a small bug in the program whereby you can cheat if you want to — details will not be given.
{286 RRR 33538
BLANK OUT Press the right key at the right time
67
18 R 20 R 38 R 4@R 58 B 100 118 128 130 148
158 :
168 178 188 198 200 218 228 508 518 528 538 548 1000 1010 1820 1038 1048 1850 10840 1878 1088 1898 1188 1118 1128 1130 2000 2018 2028 2838
68
EM HHERHHHHERE RH EM * BLANK OUT # EM #HHHERHHHEHES EM LANK=50@0: SETUP=1000: INFO=2000 REM #*# THE MAIN PROGRAM #+# GOSUB INFO:GOSUB SETUP REPEAT : PLOT X(C),Y,Z(C) : CaC+i:IF C9 THEN C=1i:WAIT 1+RND(1) #20 PLOT X(C),Y,W(C)SWAIT ZZ : IF KEY$=CHR$(Z(C)) THEN GOSUB BLANK UNTIL STATE PING: WAIT 2@:PING PRINTSPRINTSPRINT E$+"L Another go? Y or N" REPEAT:GET G$:UNTIL G$="Y" OR G$="N" IF G$="Y" THEN RUN POKE #26A,3:CLS: INK 7:PRINT “Bye for now. ":END REM ## BLANK ## Z(C)=32 FOR I=-1 TO isPLOT X(C)-1,Y+tI," "SNEXT W(C)=32:MM=MM+1:IF MM>8 THEN STATE=TRUE RETURN REM ## SET UP #+# PAPER @: INK 2:CLS PRINT: PRINT: PRINT: PRINT FOR T=1 TO 9sX(1)=4#1-2:72(1) =48+2:W(1)=255: NEXT FOR J=8 TO 2:FOR I=1 TO 9 : FOR K=@ TO 2:PRINT CHR$(Z(1))3:NEXT : PRINT " "3 NEXT: PRINT: NEXT Y=5: Z=255:C=1:MM=0 POKE #26A,2 ‘Disables cursor PLOT 13,11,CHR$(4)+"BLANK QUT" PLOT 0,13,"Press the right key at the right time" STATE=FALSE RETURN REM ## INFOrmation #+# PAPER @: INK 7:CLS:PRINT CHR$(4) E$=" "“+CHR$(27) PRINT E$+"J"sSPC (10) 3 "BLANK OUT":PRINT: PRINT
2040 PRINT: PRINT E$+"J"3SPC(6)3;"by Czes Kosniowski" 2058 PRINT CHR$(4):PRINT: PRINT
2068 PRINT "Blank out the numbered windows by"
2070 PRINT “pressing the right key at the right"
2088 PRINT “time. "3SPC(5)+E$+"AGOOD LUCK": PRINT
2098 PRINT:PRINT “At what speed do you want to play?" 2108 PRINT "@ (fast) to 9 (slow) "$5
2118 REPEAT: G$=KEY$:GG=RND(1):UNTIL G$>"/" AND G$<":" 2128 ZZ=VAL(G$) +1
213@ RETURN
The main routine
The main loop checks to see if the correct key has been pressed.
The subroutines
500 BLANK
This draws the curtain in the appropriate window, i.e. blanks out the display. Curtain number C is shut if W(C) = 32. It is open if W(C) = 255. The reason is that CHR$(32) is a blank square while CHR$(255) is a solid, coloured square.
1000 SETUP The array X(1) stores the position of window I. The array W(1) stores the information about whether the curtain in window I is open or not.
2000 INFO This subroutine prints out brief instructions for the game. In addition the player is asked for the speed of play.
69
18 Surfaces
This is a short program which produces some vivid three-dimensional pictures of surfaces.
Note. The whole process is quite time consuming but well worth the wait. If desired you could save the result on tape so that you wouldn’t have to replot every time. See Appendix 1 for further details.
70
10 REM HH#HRHREHHHRE 20 REM * SURFACES * 3B REM HHHHHHHRHREE 48 REM
58 PL=500
108 110 128 130 140 158 140 178 188 198 208 210 228 230 248 250 268 508 518 520 538 540 558 568 578 580 598 608 618 628 638 648 658 668 678 680
REM ## THE MAIN PROGRAM ##
INK 6:PAPER @:CLS:FOR I=@ TO S:READ A$(I):NEXT REPEAT
: TEXT: CLSs:PRINT: ZZ=FRE (1)
: E$=" "“4CHR$(27) :DS=E$+"J"+CHR$ (4)
: XMID=119: YMID=99:PP=2#PI:S=SQR(2)/2:SS=XMID#s :-PRINT D$;SPC(11);"“SURFACES":PRINT D$
PRINT: PRINT
: PRINT D$;SPC(6)3"by Czes Kosniowski"
PRINT D$:PRINT
: FOR I=8 TO SsPRINT Is A$(1)s PRINT: NEXT
: PLOT 26,11,"“where":PLOT 22,13, "R=SQR(X#X+Y#Y) " : PRINTsPRINT "Please type in your selection. "3 : REPEAT: GET G$:UNTIL G$>="@8" AND G$<"7"
: G=VAL(6$):1F G>@ THEN GOSUB PL
UNTIL 6=8
CLS:PRINT "Bye for now. ": END
REM ## PLotting #+#
HIRES: POKE #26A,2
PRINT SPC(18-LEN(A$(G))/2) 3A$(G)
FOR A=-SS TO SS+5#S
: MAX=-YMID: TT=SS+A-10#S5#INT( (A+ABS(A)) /18/S)
: FOR B=-TT TO TT+S#4 STEP 10#S
: X=$#(A+B): Y=S#(B-A) :s Z=BsR=SOR(X#X+YV#Y)
: IF G=i THEN Z=12#COS(R/5) +B
: IF G=2 THEN Z=YMID#EXP(-R#R/ 488) +B
: IF G=3 AND R<>@ THEN Z=2*XMID#SIN(R/S) /R+B
: IF G=4THEN 2=12#COS(X/10) *#COS(Y/10) +B
: IF G=5 AND R<>B THEN Z=X#V#(X-Y¥) #(X+Y) /(1808#R) +B : FB=1:1IF Z<MAX THEN FB=3 ELSE MAX=2Z
: U=XMID+tA: V=YMID-Z#S
: IF V>1 AND V<2#YMID THEN CURSET U,V,FB
: NEXT
NEXT
PING:FOR I=1 TO 6: INK IsWAIT 75sNEXTsE$=" “+CHR$(27) PRINT ES+"B°+E$+"L Press Y to continue"
71
69@ REPEAT: UNTIL KEY$=""
700 REPEAT:GET G$: UNTIL G$="Y"
71@ RETURN
B8@@ DATA QUIT,Z = COS(R),Z = EXP(-R#R) 810 DATA Z = SIN(R)/R,Z = COS(X)#COS(Y) 828 DATA The monkey saddle
The main routine
The main menu to the program is presented. You are asked to select the surface you want plotted.
The subroutine
500 PL
This plots the selected surface. The picture is put into perspective by using the variables A, B, and X, Y. Hidden points are not plotted, this is achieved by checking whether the current point to be plotted is less than MAX or not.
72
19 Blue Danube
Just a simple tune, with apologies to Strauss. See Appendix 4 for some general musical notes.
10 REM HEHHHHHRHRHHERE 2@ REM * BLUE DANUBE # 3O REM HHHHERERERREEEE 4@ REM
5@ INFO=500
100 118 120 130 148 158 140 178 188 198 208 218 228 238 248 588 518 520 538 548
REM #*# THE MAIN PROGRAM #+#
GOSUB INFO: J=3:K=0
REPEAT
: PLOT 6+A(I),26-A(I) ,32
: T=f+i1:1F I>MAX THEN [=O:J2J+i2 IF J>5 THEN J=3
: B=INT((AC(I)-1)/12)
: PLOT 6+A(I),26-A(I) , 144d
: IF ACI)>@ THEN MUSIC 1,J+B,A(I)-12*B,@:PLAY 1,0,1,L : WAIT B8#T(T)
UNTIL KEY$="Q"
PLAY 0,8,8,
PRINT ES; "“B"3E$3 "L Another go? Y or N"3SPC(18) REPEAT: GET G$:UNTIL 6$="Y" OR G$="N"
IF 6$="Y" THEN RUN
CLS:PRINT “Bye for now. "sPOKE #246A,3: INK 7sEND
REM ## INFOrmation ##
INK SsPAPER @sCLS:DEF FNR(X)=INT(RND(1) #X)
E$=" "+CHR$(27) s DS=E$+"J"+CHR$( 4): PRINT
PRINT D$sSPC(9)s "BLUE DANUBE“:PRINT D$:PRINT: PRINT PRINT D$;SPC(6); "by Czes Kosniowski":PRINT D$:PRINT
73
558 568 578 580 598 680 618 620 638 640 708 710 720 730 748 750 760 770 788
PRINT "Just a simple tune...... "sPRINT
PRINT “Press Y to start....00.."3
REPEAT: GET G$: UNTIL G$="Y"
PRINT:PRINT: PRINT “Press @ to quit. "3;
DIM A(1O00),1T(100):MAX=-1
REPEAT: MAX=MAX4+1:READ A(MAX) ,T(MAX): UNTIL A(MAX)=-1 IF MAX<>69 THEN PRINT “DATA ERROR": END MAX=MAX-1:CLS:POKE #26A,10: INK 6:L=2500
PRINT: PRINT D$3SPC(9);"BLUE DANUBE":PRINT D$
RETURN DATA 1,2,1,2,5,2,8,2,8,4,20,2,20,4,17,2,17,4 DATA 1,2,1,2,5,2,8,2,8,4,20,2,20,4,18,2,18,4 DATA 3,2,3,2,6,2y18,2,10,4,22,2,22,4,18,2,18,4 DATA 3,2,3,2,6,2,10,2,10,4,22,2,22,4,17,2,17,4 DATA 1,2,1,2,5,2,8,2,13,4,25,2,2544,20,2, 20,4 DATA 1,2,1,2,5,2,8,2,13,4,25,2,25,44 22422244 DATA 3,2,3,2,6,2,10,2,10,7,7,2,8,2,17,8
DATA 13,2,5,2)5,4,3)2,18,4,8,2,1,6
DATA -1,-1
The main routine
This plays each note for the required length of time. At the same time the pitch of the note being played is displayed graphically. Each time the tune is played the key is changed.
The subroutine
500 INFO The credits are contained here. When these are finished the program reads the necessary DATA, i.e. the notes and time intervals.
74.
20 Snake
This program is an action game in which you have to control a creature (a snake) using the cursor keys. Try to make the snake eat the food but avoid the rocks and wall (the edge of the screen). In addition don’t crash into yourself. Each time the snake eats some food it gets longer and moves a little more sedately. Success is achieved when the snake is 10 units long. It’s quite addictive trying to feed that ever-hungry growing snake.
75
10 REM #4448222
28 REM # SNAKE +#
38 REM ###eR RHEE
4@ REM
5@ CHECK=40@: DIRECT=500: FOOD=400 68 SETUP=1000: CAR=1200: INFO=2000
100 118 128 138 148 158 168 178 188 198 200 218 220 230 248 258 400 418 420 430 440 588 518 528 530 600 618 628 630 648 658 668
REM *#* THE MAIN PROGRAM #+#
GOSUB INFO:GOSUB SETUP: GOSUB FOOD
REPEAT
’ K$=KEY$:IF K$<>"" THEN GOSUB DIRECT
: FOR Ist TO 1 STEP -isP(1)=P(I-1):Q(1)=Q(1-1) NEXT : P(@)=P(8)+DP:@(@)=@(8)+DG:PQ=SCRN(P (8) ,8(@))
: PLOT P(@),Q(8),RsPLOT P(L) ,Q(L),32
: IF P@<>32 THEN GOSUB CHECK
UNTIL STATE OR L>18
IF L>1@ THEN PLOT 15,0,"WELL DONE"“:PING: WAIT 10:PING IF STATE THEN PLOT 17,0,"SPLAT":PAPER 1
WAIT 2@:PAPER @:PRINT
PRINT E$+"L"3SPC(8)3;"Another go? Y or N";SPC(18) REPEAT: GET G$:UNTIL 6$="Y" OR G$="N"
IF G$="Y" THEN RUN
CLS:PRINT “Bye for now. "“:POKE #26A,3: INK 7:END REM ## CHECK ##
IF P@=R THEN SHOOT: STATE=1
IF PQ=W THEN EXPLODE: STATE=2
IF P@=C THEN ZAP:GOSUB FOOD
RETURN
REM #* DIRECTion ##
KK2ASC(K$): IF KK<8 OR KK>11 THEN RETURN DP=(KK=8) -(KK=9) : DQ=(KK=11)-(KK=1@)
RETURN
REM #* FOOD #+#
FOR I=8 TO 3
REPEAT: A=FNR (36) +2: B2FNR(25) +i: UNTIL SCRN(A,B)=32 IF I#®@ THEN PLOT A,B,C:L=L+1
IF I>@ THEN PLOT A,B,W
NEXT
RETURN
1008 REM ## SETUP #+# 101@ PAPER @: INK 2:CLS:R=37:DIM P(28) ,Q(20):W=255 1028 FOR X=1 TO 38:PLOT X,@,WsPLOT X,26,W:NEXT
76
1038 1048 1058 10848 10872 1088 1098 1180 1208 1210 1220 1300 1318 2000 2018 2828 20308 2040 2058 2068 2678 2080 2890 2108 2118 2128 2130
FOR Y=1 TO 25:PLOT 1,Y,W:PLOT 38,Y,Ws:NEXT P(O)=30:P(1)=312P(2)=32:0(0)=22:0(1)=22:0(2) =22 L=1:FOR I=@ TO L:PLOT P(I),Q(1) ,ReNEXT DP=-1:DQ=0:C=38: START=#B400+R*#8: AA=#A080
POKE AA,2:1F PEEK(AA)<>2 THEN START=START-#8000 GOSUB CAR: START=START+8:60SUB CAR
STATE=8
RETURN
REM ## CAR ##
FOR I=START TO START+7:READ XsPOKE I,X:NEXT RETURN
DATA 12,12,30,63,63,30,12,12
DATA 21,21,14,14,4,4,4,4
REM *#* INFOrmation #*#
INK 46:PAPER @:CLS: DEF FNR(X)=INT(RND(1) #X)
E$=" "4+CHR$(27) :D$=E$+"J"+CHR$(4) SPRINT
PRINT D$;SPC(12);“SNAKE":PRINT D$:PRINT: PRINT PRINT D$;SPC(6)3"by Czes Kosniowski":PRINT D$:PRINT PRINT “Guide the SNAKE to the food. "“:PRINT PRINT “But - avoid the obstructions and the" PRINT “wall. Also don’t run into yourself! ":PRINT PRINT “To CHANGE direction use the cursor" PRINT “keys. “:PRINT
PRINT "Press Y to start..... ears
REPEAT: G$=KEY$: GG=RND(1):UNTIL G$="Y"
POKE #26A,2
RETURN
The main routine
The snake continues to move unless it hits an obstacle. The direction in which the snake moves is changed by using the cursor keys. The main routine scans the keyboard and changes the direction of the snake if appropriate. It also checks to see if the snake has met an obstacle.
The subroutines
400 CHECK If the head of the snake moves to a position which is not an empty space (ASC code 32) then this subroutine is used. The snake can either hit a rock or
77
wall (when P@ = W), or crash into itself (when P@ = R) or eat some food (when PQ=C).
500 DIRECT This subroutine is called into play when a key is pressed. If one of the cursor keys is pressed then the corresponding direction of movement is calculated.
600 FOOD Not only does this subroutine decide where to place some food, it also places two rocks on the screen.
1000 SETUP This draws the surrounding wall and creates two custom characters (for the snake and food).
1200 CAR This is a short subroutine to read the DATA and POKE it into the appropriate place for the custom characters.
2000 INFO Brief details of the game are in this subroutine.
78
Zi Space Chase
Deep in outer space you are the pilot of a space ship. Because of a shortage of fuel, you need to guide the space ship towards the energy sources which occasionally pass by. These energy sources look like asterisks.
A recent planetary explosion has left a lot of debris around which you must avoid. Your space ship is on full thrust and you can control movement by using the left and right cursor keys. ;
79
10 REM #HHHHHHHEREREERE
28 REM * SPACE CHASE *#
SO REM HHHHHRHRHHREREE
4@ REM
5@ HIT=50@: SETUP=1000: INSTRUCT=2008 108 REM ## THE MAIN PROGRAM #+%
118 GOSUB INSTRUCT:GOSUB SETUP
128 REPEAT
13@ : PLOT 39#RND(1),@,38 140 : FOR I=1 TO 20 15@ : PLOT 39#RND(1),@,46:PLOT X,Y,32:PRINT CHR$(11);
178 IF X<38 AND PEEK(769)=127 THEN X=X+1
188 XY=SCRN(X,Y)sIF XY=46 OR XY=38 THEN GOSUB HIT 198 PLOT X,Y,37
208 : NEXT
218 UNTIL COUNT>=MAX
220 FOR 128 TO 39:POKE TP+1,32:NEXT
23@ PRINT CHR$(4)
248 PRINT E$+"J"+E$+"B"3SPC(8); "YOUR SCORE: “3SC
258 PRINTsPRINT: PRINT: WAIT 208
268 PRINT E$+"N"+E$+"A Another go? Yor N
278 PRINT CHR$(4)
28@ REPEAT: GET K$: UNTIL K@="Y" OR K$="N"
298 IF K$="Y" THEN RUN
308 POKE #246A,3:CLS:PRINT “Bye for now. "sEND
500 REM #*# HIT #%
51@ IF XY¥=46 THEN EXPLODE:PAPERI:WAIT 2@:COUNT=COUNT+1 520 POKE TP+39,48+MAX-COUNT
53@ IF XY¥=38 THEN PING: PAPER 2:WAIT 20:PING:SC=SC+258 548 PAPER 3:WAIT 2@:PAPER @
55@ IF RND(1)<.5 THEN PLOT 39#RND(1) ,@,38
56@ FOR I=2 TO LEN(STR$(SC))
578 : POKE TP+I-1,48+VAL (MID$(STR$(SC) ,1,1))
588 NEXT
598 RETURN
1000 REM #* SETUP ##
101@ X=18:¥=21: COUNT=@: SC=8: AA=#A800:0=0
1020 POKE AA,2:IF PEEK(AA)<>2 THEN @=#8000
1838 START=46080+37#8-Q: TP=#BB80-Q
1048 FCR 128 TO 7:READ J:POKE START+I,J:NEXT
3 168 : IF X>@ AND PEEK(769)=223 THEN X=X-1 :
80
1058 FOR I=@ TO 7:READ J:POKE START+8+1,d:NEXT
1068 FOR [=36 TO 39:POKE TP+I,32:NEXT
1070 POKE TP+39,48+MAX: INK 7:PAPER @:CLS
108@ RETURN
110@ DATA 45,63,45,12,12,45,63,45
1110 DATA 33,18,12,63,63,12,18,33
2000 REM ** INSTRUCTions #*#
2010 E$=" "“+CHR$(27):CLS:POKE #26A,108
2020 INK 7:PAPER 1:CLS:PRINT CHRS#(4)
2030 PRINT E$+"J"+E$+"@"3SPC(8); "SPACE CHASE"
2040 PRINT:PRINTsPRINT: WAIT 28
20508 PRINT E$+"J"+E$+"D by Czes Kosniowski"
20460 PRINT CHR$(4):PRINT
2078 PRINT:PRINT “Pilot your space ship towards the " 2088 PRINT “energy sources - but be careful to"
2098 PRINT “avoid the cosmic debris ....."
210@ PRINT: PRINT “Use the left and right cursor keys” 2118 PRINT "to move. 600D LUCK"
212@ PRINT: PRINT
2130 PRINT E$+"@ Number of crashes allowed?"
2140 PRINT E$+"@Type a number between 1 and 9."
2150 REPEAT: 6$=KEY$:G6G=RND(1):UNTIL G$>"@" AND G$<":" 21468 MAX=VAL(G$):PING: WAIT 30:PING
2170 RETURN
The main routine
The screen is scrolled down (not up) one line by use of the command PRINT CHR$(11). On each scroll some cosmic debris is deposited on the top line via the command PLOT 39*RND(1),0,38
PEEK(769) reads the keyboard. If the left cursor key has been pressed this has a value of 223 (other keys also have the same value). The right cursor key has a value of 127. The use of PEEK(769) is faster than using the command KEYS.
The whole process continues until the space ship has hit some predetermined amount of cosmic debris.
The subroutines
500 HIT If the space ship hits something then this subroutine comes into play. It
81
updates (with sound effects) the number of crashes and energy source hits. The current score is POKEd into the top line of the screen usually used for system messages.
1000 SETUP This initializes the counters and creates two custom characters, the space ship and the energy sources.
2000 INSTRUCT
This gives brief details about the game. You are also asked how many crashes are permitted before a game ends.
82
22 Spell it
In this game a word is flashed onto the screen for a brief moment. Look carefully because you will have to spell it out. In order to help you, you have some control over how quickly the word is flashed on the screen.
SPELL IT WORD 8
Type out the word and press “return?
? CUPBORED
No, the answer is CUPBOARD Fress Y to continue
83
1@ R 28 R 38 R 40 R 5@ 5 100 118 128 138 148 158
168 :
170 188
198 :
208 218 220 238 248 258 268 278 280 290 300 588 518 528 938 1808 1018 10820 1030 1040 1100 1118 1128 1138 1140 1158
84
EM HHHRHHHRHH ES
EM * SPELL IT #
EM HHHHHHHHRHHE
EM
PELL=500: SETUP=1000: INFO=2000
REM #* THE MAIN PROGRAM #+#
GOSUB INFO:GOSUB SETUP
FOR I=1 TO 18
: AS=R$(INT(RND (1) #MAX))
: GOSUB SPELL: PING: WAIT S@:PING:PRINT: PRINT
: PRINT SPC(16-LEN(A$) /2) ;D$+A$
PRINT D$: WAIT T:GOSUB SPELL: PRINT
: PRINT: PRINT “Type out the word and press <return>" : PRINT: PRINT SPC(13);: INPUT B$¢
PRINTS PRINT: PRINT: PRINT
: IF A$=B$ THEN PING: SC=SC+1:PLOT 14,12,"WELL DONE" : IF A$<>BS THEN SHOOT: PLOT 8,12,N$+A$
: PRINT SPC(9)3;"Press Y to continue";
: REPEAT:GET G$:UNTIL 6$="Y"
NEXT
GOSUB SPELL:PLOT 15,3," *
PRINT SPC(8)s"You got “sSC3;"out of 10" PRINTSPRINT ES+"L"+E$+"B Another go? Y or N"
REPEAT:GET G$: UNTIL G$="Y" OR GS$="N"
IF 6$="Y" THEN RUN CLS:PRINT "Bye for now. ":END REM ## SPELL *# CLSsPRINT:PRINT S$:PRINT D$+E$+"A"s PRINT: PRINT PLOT 15,3,CHR$(8)+"WORD"+STR$(1) RETURN
REM ## SET UP ##
MAX=-1:DIM R$(100)
REPEAT: MAX=MAX+1:READ R#(MAX) UNTIL R#(MAX)="#" N$="No, the answer is “
RETURN
DATA TABLE,CHAIR,BOOK,PILLOW,CUBE,RULER, ISLAND DATA GLASS, BUCKET, TORCH, KITCHEN, BOTTLE, TISSUE DATA SLEEPING, RUNNER, MISS,RUBBER,TYRE,PERSON DATA PLASTIC, BANANA, GLOVE, BALLOON, BEGIN, PLEASE DATA MEAT, TREAT ,MAID,SAID,BACK,FLOWER,CUPBOARD DATA PLATE, BOXES,GHOST,LOVELY,PADDLE, CHURCH
1168 DATA SLEEP,SOLDIER, MONDAY, TUESDAY, WEDNESDAY 1178 DATA BEDROOM, HELLO,SUNNY,PAPER,CHAIN, TWENTY 1188 DATA THURSDAY ,UPWARDS,SELECTION,CIRCUS,PERSON 1198 DATA MAGIC,LETTER, JUNGLE, INNOCENT, INJURY
120@ DATA INFLUENCE, INCIDENT ,HORROR, GRAMMAR, GRAND 1210 DATA FRINGE, VACATE, TRIAL, TREND, STARTLE
122@ DATA REVEAL,QUIET,PROPERTY,POLICE,POISON
1998 DATA *
2000 REM ** INFOrmation ##
2018 PAPER O@: INK 7:E$=" "4CHR$(27) :DS$=E$+"J"+CHR$ (4)
2020 S$=D$+ES$+"A SPELL IT" 2038 GOSUB SPELL:PLOT 15,3," : 2048 PRINT D$+E$+"A by Czes Kosniowski"
2058 PRINT D$:PRINT: PRINT: PRINT
2068 PRINT "A word will be flashed on the screen. " 2078 PRINT “Look carefully, then SPELL IT out! "sPRINT 2080 PRINT:PRINT “How fast? 1 (fast) to 9 (slow) "; 2098 REPEAT: G$=KEY$:GG=RND(1):UNTIL G$>"@" AND GE<":" 2108 T=10#VAL(G$)
2118 PRINT:PRINT: PRINT SPC(18)3"0.K. - get ready." 212@ RETURN
The main routine
A word is chosen at random from the list in the program. Two PINGs later the word is flashed on the screen (in double height characters). The computer then waits for you to type that word. This is followed by an appropriate comment.
This process is repeated ten times after which the score out of ten is given.
The subroutines
500 SPELL This is used to refresh the screen after a word has been flashed.
1000 SETUP
The words are stored in the string array R$(1). You may add words to this list if you like. If the total number of words exceeds 100, change the DIMension statement in line 1010.
2000 INFO This contains brief information about the game. It is also used to find out how quickly you want the words to be flashed on the screen.
85
20 Sketch Pad
Display your artistic abilities with this simple but effective sketch pad. You can draw lines horizontally, vertically or diagonally. The lines you draw may be visible or invisible, the choice is yours.
Use the cursor keys to move left, right, up or down. To draw diagonally use the following keys:
1 for diagonally up-left _\ for diagonally up-right Z for diagonally down-left / for diagonally down-right
Pressing the I key toggles the visibility/invisibility and consequently determines whether the line you are drawing is visible or not.
To quit press @.
If you want to save any of your creations onto tape you'll have to add a few extra lines to the program. See Appendix 1 for further details.
86
10 REM HHXHHHHHHHHS 28 REM * SKETCH PAD 3Q REM HHHHHHHHHEHERE 40 REM
5@ SETUP=408: INFO=608
108 REM *#* THE MAIN PROGRAM ##
118 GOSUB INFO:G0SUB SETUP
128 REPEAT
13@ : CURSET X,Y,2 ‘Displays current position
14@ : GET G$:G=ASC(G$)
158 : A=(G=8)-(6=9) -(G=92) + (G=49) - (6=47) + (6=98)
160 : B=(G=11)-(6=10)+(G=92) +(G=49) - (G=47) -(6=98)
17@ : CURSET X,Y,@ ‘Erases current position
18@ : IF X+A>239 OR X+A<@ THEN A=@:PING
198 : IF Y+B>199 OR Y+B<@ THEN B=@:PING
200 : U=X:V=¥:X=X+A: Y=¥+B
218 : IF G=73 THEN FB=-NOT-FB
220 : IF NOT ((A=@) AND (B=@)) THEN CURSET U,V,FB
238 : Z=FRE(1)
248 UNTIL G=81
250 TEXT:E$=" "+CHR$(27)
260 PRINT E$+"B"+E$+"LAnother go? Y or N":PRINT
278 REPEAT:GET G$:UNTIL G$="Y" OR G$="N"
280 IF G$="Y" THEN RUN
290 CLS:PRINT "Bye for now. ":POKE #26A,3:END
400 REM *## SET UP #+#
41@ X=119:Y=99:FB=1:HIRES
420 POKE #24A,18 ‘Disables cursor and click
430 PRINT “Use cursor keys and 1, \, Z or /."
440 PRINT:PRINT “I - Draw on/off. Q - quit.";
45@ RETURN
600 REM ## INFOrmation ##
618 INK 6:PAPER @:CLS:PRINT
620 ES=" "+CHR$(27) : DS=E$+"J"+CHR$ (4)
63@ PRINT D$;SPC(18); "SKETCH PAD":PRINT D$sPRINT: PRINT 64@ PRINT D$;SPC(6);"by Czes Kosniowski":sPRINT D$:PRINT 658 PRINT “Draw a picture with this sketch pad. "s:PRINT 668 PRINT “Use the cursor keys for left, right,"
678 PRINT “up and down. Also, use”
68@ PRINT “1 for up-left, \ for up-right,"
698 PRINT "Z for down-left and / for down-right":PRINT
87
788 PRINT "To draw an invisible line press I," 71@ PRINT “pressing I again draws visible lines. " 720 PRINT "Press @ to quit. ":PRINT
738 PRINT E$+"B"+E$+"L Press Y to start." 740 REPEAT: GET G$: UNTIL G$="Y" 75@ RETURN
The main routine
The main program waits for a key to be pressed. If one of the movement keys is pressed then the direction of movement (A,B) is calculated. If the point at (X+A, Y+B) is still on the screen then it is plotted. If the I key is pressed the value of FB changes from 1 to 0 and vice versa. This determines whether the point plotted is visible or not.
The subroutines
400 SETUP
This initializes the variables and displays brief details of what the various keys do.
600 INFO This provides some brief details about the program.
88
24 Bounce Away
Here’s your chance to bounce a ball around the screen with a small bat. You can move this bat with the left and right cursor keys. The screen is set up with a number of rows of coloured squares. Each time the ball hits a coloured square it bounces off and the coloured square disappears. The object is to bounce the ball around until it reaches the top of the screen. The ball bounces off the sides, the coloured squares and your bat. To add to the fun there are a number of other obstacles which slowly disappear.
You have 7 chances.
89
10 REM 4HHHHHHEHHHRHRERHERE
20 REM *## BOUNCE AWAY #+#
3O REM HHHHHEHHEHERHEHEHE
4@ REM
50 MISS=500:FINISH=600: SETUP=1000: INFO=2000 ° 10@ REM *# THE MAIN PROGRAM ##
11@ GOSUB INFO:GOSUB SETUP
128 REPEAT
130 : PLOT X,Y,32:X=X+DX:Y=V+DY:PLOT X,Y,1264 148 : IF X<2 OR X>37 THEN DX=-DX:PING
15@ ; V=V¥+DY:W=SCRN(X,V)
160 : IF W>32 THEN DY=-DY:PING
17@ : IF W=4127 THEN PLOT X,V,32
18@ : IF V>25 AND W<33 THEN GOSUB MISS
19@ : IF V<i THEN GOSUB FINISH
200 : IF Z>@ AND PEEK(769)=223 THEN Z=Z-1:PLOT 2,26,B¢ 21@ : IF Z2<35 AND PEEK(769)=127 THEN Z=Z+1:PLOT Z,26,B$ 220 UNTIL STATE<1
230 PRINT E$s"B"SE$3"L Another go? Y or N" 248 REPEAT:GET G$: UNTIL G$="Y" OR G$="N"
258 TEXT: IF G$="Y" THEN RUN
260 CLS:PRINT “Bye for now. ":POKE #26A,3:END 5@@ REM *#* MISS ##
51@ EXPLODE: STATE=STATE-1:DY=-DY:WAIT 100
92@ PLOT X,Y,32:PLOT Z,246," "
53@ PLOT 19,8,MID#(STR$¢(STATE) ,2)+" chances. " 548 IF STATE=1 THEN PLOT 27,8,". “
55@ X=10+FNR(20):Z=X: DX=2#FNR(2) -1
568 PLOT X,Y,126:PLOT Z,26,B$
578 RETURN
60@ REM ** FINISH ¥#
610 PING: WAIT S@:PING: WAIT 5S@:PING
620 PLOT 13,1,CHR$(6)+CHR$(12)+"WELL DONE"
638 WAIT 10@:STATE=-1
648 RETURN
1000 REM ## SET UP #+#
1018 CLS: INK 7:PRINT SPC(9);"You have ";
1828 PRINT MID$(STR#(STATE) ,2);" chances." 1038 FOR I=1 TO SKILL:PLOT 0,2#1,1:NEXT
1048 A$="";FOR I=1 TO 38: A$=A$+CHR$(255) : NEXT 1050 PRINT: FOR I=1 TO SKILL:PRINT A$:NEXT
90
1060 PLOT @,26,9:Y=25: X=1O+FNR (28): Z2X
1078 BS=CHRS$ (9) +" #88 "
1088 DX=2#FNR(2)-1:DY=-1:PLOT X,Y,126:PLOT Z,26,B$ 1090 FOR I=8 TO 15
1100 : PLOT 2+FNR(34) ,2#SKILL+3+FNR(4) ,96
1118 NEXT
112@ RETURN
2000 REM #* INFOrmation #+#
2010 INK S:PAPER @:CLS:DEF FNR(X)=INT(RND(1) #X)
2020 ES=" “+CHR$ (27): DS=E$t+"J"+CHRS$ (4) s PRINT
2038 PRINT D$;SPC(9)3;"BOUNCE AWAY":PRINT D$:PRINTsPRINT 2048 PRINT D$;SPC(6);"by Czes Kosniowski":PRINT D$:PRINT 2050 PRINT "Use the left and right cursor keys to" 2060 PRINT “bounce the ball around. The obstruc-" 2078 PRINT "tions slowly disappear until the ball" 2088 PRINT “can reach the top.":PRINT
2098 PRINT “What skill level would you like to"
2108 PRINT “play at? i(easier) to 4(harder) "3
2118 REPEAT: G$=KEY$:GG=RND(1):UNTIL G$>"@" AND G$<"5" 2120. SKILL=2+VAL(6$):STATE=13-SKILL:POKE #246A,18
2138 RETURN
The main routine
The main routine moves the ball around and checks which obstacle, if any, is present.
PEEK(769) reads the keyboard. If the value is 223 then the left cursor has been pressed and the bat is moved to the left. If it is 127 then the right cursor key has been pressed and the bat is moved right.
The subroutines
500 MISS If the ball doesn’t hit the bat then this subroutine makes the necessary noises and updates the data.
600 FINISH If the ball has reached the top of the screen then this subroutine makes the necessary noises and displays the WELL DONE message.
1000 SETUP This prints the display and plots a few random obstacles.
2000 INFO This subroutine contains a brief outline of the game.
91
?5 Spirals
This is a short program demonstrating the drawing of spirals on the HIRES screen.
After the initial setting up of variables, several spirals are drawn at random. To draw a spiral you need to plot points of the form:
(XMID + Z*COS (Z),YMID + Z*SIN (Z))
for values of Z between 0 and some value such as 5*PI. The point (XMID,YMID) is the centre of the spiral.
92
10 REM HH#HHHHHHHHE
20 REM * SPIRALS # 3Q REM HHHRHHHHEES
40 REM
108 110 120 130 148 158 200 218 220 238 248 258 268 270 280 298 300 318 320 330 348 358 368 378 388 398
REM *#* SET UP ##
INK 6:PAPER @:CLS:DEF FNR(X)=INT(RND(1) #X)
E$=" "+CHR$(27) : D$=E$+"I"+CHR$ (4): PRINT
PRINT D$;SPC(11)3"SPIRALS":PRINT D$s:PRINT: PRINT PRINT D$;SPC(4)3"“by Czes Kosniowski":PRINT D$: PRINT PRINT “Just some random colourful spirals."
REM **# Plotting ##
WAIT 2@@0:HIRES:POKE #26A,2
PRINT SPC(14)3 "SPIRALS"
FOR Y=@ TO 199:CURSET @,Y,3:FILL 1,1,FNR(7) +13 NEXT FOR I=@ TO 9
: XMID=FNR(175) +40: YMID=FNR (148) +26
FOR Z=@ TO 15+FNR(1@) STEP .t
CURSET XMID+Z#COS(Z) ,YMID+Z*SIN(Z) ,1
: NEXT
NEXT
PING
FOR [=@ TO 5
: FOR Y=@ TO 199:CURSET @,Y,isFILL 1,1,FNR(7)+1:NEXT NEXT
WAIT S@:PING:FOR I=1 TO Ss INK IT:WAIT 75:NEXT
E$=" "+CHR$(27)
PRINT E$+"B"+E$+"L Another go? Y or N"
REPEAT: G$=KEY$:GG=RND(1):UNTIL 6$="Y" OR G$="N" TEXT: IF G$="Y¥" THEN RUN
CLS:PRINT “Bye for now. ":END
93
26 Knees up Mother Brown!
An old favourite song, known to many. If you don’t know the words you soon will. As each note is played the corresponding word, or part word, appears on the screen. If you know the words then you can watch the man doing his exercises, jumping up and down in time to the tune. The tune is played in several keys.
KNEES UP MOTHER BROWN!
@ just been _to a ding-dong n dear old Hrixton_way
Mother Brown the Pearly Queen’s undred years today
what a celebration!
er lah-di-dah!
Ma Ooh! knees up Mother Brown knees up Mother Brown Under the table eae must go Ee-i-ee-i-ee-i-oh! | If I catch you panei Og I’1l saw your leq right off So knees up knees up * Don’t let the breeze up Knees up Mother Brown!
--ToOs<
94
10 REM EEHHREREREREEEEREEE EEE REE E 20 REM * KNEES UR MOTHER BROWN! +# 3O REM HHEHRHRHHHRH HEE H EERE RERERER 48 REM
5@ SWITCH=300: INFO=508: CHR=808
108 118 120 138 148 158 168 178 180 198 200 218 220 230 248 258 268 308 318 320 338 588 518 528 538 548 55@ 568 578 588 598 608 618 628 638 640
REM *## THE MAIN PROGRAM ## 60SUB INFO REPEAT PLOT 35,Y," ":PLOT 35,Y+!," .
: IT=I+i:1F I>MAX THEN GOSUB SWITCH
: B=INT( (ACI) -1)/12)2Y=25-A(1) :K=NOT K
: PRINT C$(1);
: PLOT 35,Y,CHR$(J-1) +A$(-K)
: PLOT 35,Y+1,CHR$(J-1) +B$(-K)
: IF AC(I)>@ THEN MUSIC 1,J3+B,A(I)-12#B,@:PLAY 1,@,1,L : WAIT 7#T(T)
UNTIL KEY$="Q"
PLAY @,8,8,@8:PRINT
PRINT ES; "B"SE$5 "L Another go? Y or N"sSPC(1@) REPEAT: GET G$: UNTIL G$="Y" OR G$="N"
IF 6$="Y" THEN RUN
CLS:PRINT “Bye for now.":POKE #26A,3:INK 7:END REM *## SWITCH ##
T=@:CLS:PRINT: PRINT D$3SPC(4)3K$:PRINT D$sPRINT: PRINT J=J+i:IF J>5 THEN J=3
RETURN
REM ## INFOrmation ##
INK SsPAPER @:CLSsDEF FNR(X)=INT(RND (1) #X)
E$=" "“4+CHR$(27) : D$=E$+"I"+CHR$ (4) PRINT
K$="KNEES UP MOTHER BROWN!"
PRINT D$;SPC(4)3K$:PRINT D$: PRINT: PRINT
PRINT D$;SPC(6)3;"by Czes Kosniowski":PRINT D$:PRINT PRINT “Just a simple tune......"sPRINT
PRINT “and some words..ceeseeee "SPRINT
PRINT “Press Y to start.ccseeee"§
REPEAT:GET GS: UNTIL G$="Y"
PRINT:PRINT: PRINT “Press @ vy quit. “sPRINTs PRINT FOR J=@ TO 1
: A$(J) =CHRS$ (38-3) +CHR$(96-J)
: BS(J)=CHR$(124-J) +CHR$(126-J)
NEXT
95
658 668 678 680 690 700 710 728 738 748 750 760 770 780 798 888 818 828 1800 1818 1820 1830 1048 1050 1048 1078 1080 1090 110@ 1118 1120 1130 1148 115@ 1148 1178 1180 1190 1280 1218 1228
96
PRINT D$+A$(@)+" “+A$(1):PRINT D$ PRINT D$+B$(0)+" "+B$(1):PRINT D$ START=#B400+37%8: AA=#A008
POKE AA,2:IF PEEK(AA)<>2 THEN START=START-#8008 GOSUB CHR START=START+8:GOSUB CHR: START=START+57%#8:GOSUB CHR START=START+8: GOSUB CHR: START=START+27#8:GOSUB CHR FOR J=@ TO 2:START=START+8:GOSUB CHR: NEXT
DIM A(120),T(128) ,C$(120)sMAX=-1:WMAX2-1
REPEAT: MAX=MAX+1:READ A(MAX), T(MAX) UNTIL A(MAX) =-1 REPEAT: WMAX=WMAX+1:READ C$(WMAX) UNTIL C$(WMAX) ="-1" IF MAX<>WMAX THEN PRINT “Error in Data.":END MAX=MAX-1:CLS:POKE #246A,1@:INK 6
J=2: K=O: [=MAX: Y=13:L=2508
RETURN REM ** CHR ##
FOR I=START TO START+7:READ R:POKE I,R:NEXT RETURN
REM ** DATA ##
REM DATA - Characters
DATA 3,3,3,1,1,7,11,19
DATA 3,3,35,17,9,7,3,3
DATA 32,32,32,0,0,48,40,36
DATA 32,32,34,4,8,48,32,32
DATA 35,3,2,2,2,2,2,2
DATA 3,3,2,4,8,16,32,8
DATA 34,32,32,32,32,32,32,32
DATA 32,32,32,16,8,4,2,8
REM DATA - Notes
DATA 8,2,10,2,8,2,7,2,8,2,13,2,13,4,5,2
DATA 6,2,5,2,4,2,5,2,8,6,5,2,8,2,10,2,8,2,6,2 DATA 5,2,6,2,8,2,13,2,15,2,13,2,12,2,10,2
DATA 8,46,8,2,18,2,8,2,7,2,8,2,13,2,13,4,13,2 DATA 12,2,7,2,8,2,10,2,12,6,8,2,3,2,5924752,8,2 DATA 10,2,12,2,13,2,10,2,15,2,13,2,12,2,10,2 DATA 8,2,8,4,8,2
DATA 5,2,8,2,8,2,8,2,8,8,6,2,10,2,18,2,10,2,18,8 DATA 12,1,12,1,12,2,12,2,12,2,10,2,9,2,8,4
DATA 12,2,12,2,12,2,12,2,180,2,9,2,8,4
DATA 5,2,8,2,8,2,8,2,8,2,8,4,14,2,15,2,10,2,18,2 DATA 10,2,18,6,11,2,12,2,12,2,10,2,8,2,12,2,12,1
1230 DATA 12,1,10,2,8,2,8,2,8,2,10,2,12,2,13,6,8,2,8,8 124@ DATA -1,-1
125@ REM DATA - WORDS
1268 DATA I've ,just ,been ,to ,a ,ding-,"“dong . 1278 DATA down ,dear ,old ,Brix,ton ,“way , 1288 DATA Old ,Mot,her ,Brown ,the ,Pearl,y ,"Queen‘s * 1298 DATA a ,hun,dred ,years ,to,"“day : 1308 DATA Oh! ,what ,a ,cel,e,bra,"tion! 7 131@ DATA was ,prop,er ,lah-,di-,“dah! . 1328 DATA Un,til ,they ,roll‘d ,the ,car,pet ,"up * 1338 DATA and ,shou,ted ,Nah ,then ,"Ma "4 1348 DATA Ooh! ,knees ,up ,Moth,er ,"Brown . 1350 DATA knees ,up ,Moth,er ,"Brown " 136@ DATA Un,der ,the ,tab,le ,you ,must ,"go " 1378 DATA Ee-,i-,ee-,i-,ee-,i-,"oh! . 138@ DATA If ,I ,catch ,you ,bend,"ing - 1398 DATA I‘ll ,saw ,your ,leg ,right ,"off . 1408 DATA So ,knees ,up ,knees ,"“up . 1418 DATA Don’t ,let ,the ,breeze ,"“up : 1428 DATA Knees ,up ,Moth,er ,Brown! , ,
1430 DATA -t
The main routine
The main routine plays each note, displays the words and the jumping man. Press Q to quit the program.
The man is made up out of four characters, two held in A$(1) and two in B$(1I). He has two physical appearances depending on whether I is 0 or 1.
The notes are stored in the array A(1) with time intervals in T(1). The words are stored in C$(I).
See Appendix 4 for further details about MUSIC.
The subroutines
300 SWITCH When the song has finished the screen is refreshed. A new key for the tune is also selected.
500 INFO This contains brief details about the program.
Eight custom characters are created. When used in groups of four at a time a large man appears. The man can appear in one of two states.
97
After the creation of the special characters the DATA for the tune and words is read in. Be very careful when typing the DATA for the words, as each space is important. An extra space (or a missing space) could ruin the display. In general, string DATA may or may not be enclosed in quotation marks. The last bit of DATA in each DATA statement has been enclosed in quotation marks to ensure that the right number of spaces appear. In two of the DATA statements there is a comma at the end of the line, this simply means that the next bit of data is the empty string.
800 CHR
This subroutine reads the DATA for the custom characters and POKEs it where needed.
98
27 Memory Cards
Here is a program which may sharpen your memory. It is a game for two players and essentially consists of 22 pairs of cards with the letters A to V on them. The letters are not visible. When it is your turn you may turn over any two cards to reveal the letters. If the letters are the same you receive both cards and turn over two more cards. Otherwise, the cards are turned back and the next person has a turn. Play continues until all the cards have gone. The player with the largest collection wins.
‘In fact there are 45 cards, 22 pairs and an odd card with the symbol a on it. This odd card cannot be matched.
A card that is flashing may be turned over by pressing Y. Use the cursor keys to change the card that is flashing.
MEMORY CARDS
Hees: HB ss HBB sc Hee REE 2: HEB ss: ii EE ti itt tat RG ate Hae ge Eat ny ate at Hee HEE HEE ::: GHB ss: GHB sc: He GH RRE sc EERE cc EEE a
RED PLAYER BLUE PLAYER
99
18 28 38 40 58 40 108 118 128 130 148 158 168 178 180 198 208
210 :
228
230 :
248 258
268 :
270 288 290 308 318 320 330 348 358 368 3708 388 508 518 528 538 548
100
REM HHKRHHEEHHEREHES REM # MEMORY CARDS * REM HHEKERHH HERE EERE REM CHANGE=500: MOVE=400: YES=708: VIEW=800: BACK=900 SETUP=100@:INFO=2000 *
REM ** THE MAIN PROGRAM *#
GOSUB INFO:GOSUB SETUP
REPEAT
: PLOT X(M),24,8:PING: WAIT 3@:PING : M=-NOT-M:PLOT X(M),24,12
: REPEAT
: 722=12:G0SUB CHANGE: WW=2
: REPEAT
: REPEAT: UNTIL KEY$=""
: REPEAT
: GET G$:G=ASC(G$)
UNTIL G>7 AND G<12 OR G=89
: IF 6>7 AND G<1i2 THEN GOSUB MOVE
IF G=89 THEN GOSUB VIEW
> UNTIL WW
: STATE=TRUE: BS=" tH"
IF P$(@)=P$(1) THEN GOSUB YES
: GOSUB BACK
: UNTIL STATE
UNTIL SC(O)+SC(1)>21
CLS:PRINT:PRINT SPC(10);NSePRINT D$ PING:PRINT: PRINT "SCORES: ": PRINT: PRINT WAIT SQ@:PING: WAIT S@:PING
PRINT E$;"ARED PLAYER “3SC(O):PRINT:PRINT PRINT E$;"DBLUE PLAYER "3SC(1):PRINT:PRINT: WAIT 99 PRINT ES; "B" 3E$3"L Another go? Y or N" REPEAT: GET G$:UNTIL G$="Y" OR G$="N"
IF G$="Y" THEN RUN
CLS:PRINT "Bye for now.":INK 7:POQKE #26A,3:END REM ** CHANGE #+#
FOR I=@ TO 2
: PLOT 44#X+1,4#Y+4+1,22
NEXT
RETURN
608 618 620 630 648 658 668 670 708 718 720 738 748 758 808 818 820
830 :
848 858 840 878 900 918 920 938 940 950 960 978 1000 1018 1020 1838 1040 1058
1848 :
1070
1080 : 1090 :
1108
REM #* MOVE ## 72=8:GOSUB CHANGE
IF X>@ AND G=8 THEN X=X-1
IF X<8 AND G=9 THEN X=X+1
IF Y>@ AND G=11 THEN Y=Y-1
IF Y<4 AND G=1®@ THEN Y=Y+1 727=12:G0SUB CHANGE RETURN REM ¥* YES ## PING:SC(M) =SC(M) +1 PLOT 20#M+8,26,STR$(SC(M)) STATE=FALSE:B$="..."
IF SC(@)+SC(1)>21 THEN STATE=TRUE RETURN REM *#* VIEW ##
IF SCRN(4#X+3,4#Y+5)<>35 THEN RETURN FOR I=@ TO 2 PLOT 4#X+2,4#Y+441,A$(X4+9#Y) NEXT A(WH)=X:B(WW)=V:P$ (WW) =A$(X4+9#Y) WW=WW+1 RETURN REM ** BACK ##
77=8:G0SUB CHANGE: WAIT 100
IF STATE THEN SHOOT:WAIT 300 FOR J=@ TO i:FOR I=@ TO2
: PLOT 4#A(J)+2,4*B(J)+4+1,B$ NEXT: NEXT PING RETURN
REM *# SET UP ##
CLS: INK 5:PING
PRINT:PRINT SPC(10);N$:PRINT D$:PRINT FOR I=® TO 4
: FOR J=@ TO 2
: PRINT " “sCHR$(8); : FOR K=@ TO 8 : PRINT CHR$(27)+"H###"; : NEXT PRINT : NEXT
101
1118 1120 1130 1148 1158 1160 1178 1188
1198 :
12088 1210 1220 1230 1248 1258 1268 1270 1288
1298 :
1300 1318 2008 2018 2020 2038 2048 2058 2048 2078 2088 2098 2100 2110 2120 2138 2140 2158 2148 2178 2188 2198
102
NEXT
PRINT E$;"H";E$;"ARED PLAYER ms PRINT E$;"H";E$;"DBLUE PLAYER"
PLOT 8,26,STR$(Q8):PLOT 28,26,STR$#(Q) DIM A$(44)
FOR I=@ TO 22
: FOR J=8 TO 2
IF 1>@ THEN A$(2#I-1)=A$(2*I-1)+CHR$ (6441) 2 AS(2#1)=A$(2#1) +CHRE(64+1)
s NEXT
NEXT
M=@: IF RND(1)<.5 THEN M=i1 X(O)=2:X(1)=20
X=FNR(9): Y=FNR(5)
REM MIXING
FOR I=@ TO 43
: PP=FNR(45-I)+1
TT$=A$ (1) sAS(T)=AS(PP) SAS( PP) =TT$ NEXT RETURN REM *# INFOrmation #+#
INK 2:PAPER @:CLS:DEF FNR(X)=INT(RND(1) #X)
E$=" "+CHR$(27) :DS=E$t"JI"+CHR$(4) PRINT N$=D$+"MEMORY CARDS"
PRINT SPC(9)s; NS: PRINT D$:PRINT: PRINT
PRINT D$3;SPC (6); "by Czes Kosniowski":PRINT D#sPRINT PRINT "This is a game for two players. When" PRINT “it your turn, you may turn two cards" PRINT “over. If they are the same then you" PRINT “keep the cards and go again. Otherwise"; PRINT “the cards are turned back over and the"; PRINT “other player has a go.":PRINT: WAIT 99 PRINT “The card that is flashing may be"
PRINT "turned over. Use the cursor keys to" PRINT “move about. Then press Y to turn a" PRINT "card over. ":PRINT:WAIT 99
PRINT “Decide now who will be the RED player" PRINT “and who will be the BLUE player. ":PRINT PRINT:PRINT: PRINT “Press Y to start. “3;
REPEAT: G$=KEY$:GG=RND(1):UNTIL G$="Y"
2208 POKE #246A,2 ‘Disables cursor 2218 RETURN
The main routine
The main routine consists of several REPEAT/UNTIL loops. The first one provides a means of alternating between the two players and continues until all the cards are used up. The next loop continues until a pair of different cards appear. The third loop provides a process whereby two cards are selected by each player.
The subroutines
500 CHANGE This is the subroutine which turns the flashing of a card on or off depending upon whether ZZ is 8 or 12.
600 MOVE This moves the position of the flashing cards.
700 YES If the two revealed cards are the same then this subroutine is used to remove the cards from play.
800 VIEW This subroutine reveals the cards.
900 BACK This subroutine turns any revealed cards back.
1000 SETUP The screen display is created by this subroutine.
The array A$(1) stores the letter on each card. A short routine randomly mixes up the contents of the array.
2000 INFO This contains brief details of the game.
103
28 Hangman
This is the old familiar hangman game but without the hanging part. Instead a man is forced to walk up a flight of stairs. As usual you have to work out the word that the computer has selected. You are told how many letters there are in the word. Each time you enter a letter the computer tells you if that letter is in the word or not. If it belongs to the word then it is placed in the appropriate position. (All occurrences of that letter are automatically displayed.) Whenever you enter an incorrect letter the man walks one step up the flight of stairs. At the top of the stairs is a plank — one step beyond this and SPLAT!
Don’t enter the same letter twice — that will cause the man to take one step nearer to his doom.
AE IOYWSN
104
10 20 38 40 58 68 100 110 120 138
140 :
158 148 178 188 198 208 218 220 238 240 258 268 278 288 500 518 520 538 548 558 548 57@ 580 598 600 610 628 638 648
REM HHHHHHHHHEH REM # HANGMAN + REM HHHHEHHHHHH REM CHOICE=500: YES=4608: NO=700: WRNG=880 SETUP=1000: INFO=2008 REM *#* THE MAIN PROGRAM ## GOSUB INFO:GOSUB SETUP REPEAT : GOSUB CHOICE REPEAT : REPEAT:GET G$: UNTIL G$>"@" AND GS<"C" : PRINT G$;" "3: BLANK=TRUE : FOR I=1 TOL : IF MID$(B$,1,1)=6$ THEN GOSUB YES : NEXT : IF BLANK THEN GOSUB NO : UNTIL STATE=L OR NUMBERS? : PRINT: PRINT : IF STATE=L THEN PING: WAIT 1@:PING:PLOT 1,5,12 : IF NUMBER>9 THEN GOSUB WRNG : PRINT E$;"“B"5E$ 3 "L Another go? Y or N" : REPEAT: GET G$:UNTIL 6$="Y" OR G$="N" UNTIL 6$="N" CLS:PRINT "Bye for now."s:INK 7:END REM ## CHOICE #+# STATE=@:NUMBER=@:CLS:FOR I=8 TO 21sPRINT: NEXT BS=R$(FNR(MAX)) :L=LEN(BS) PLOT @,1,10:PLOT 1,1,4:PLOT @,2,1@:PLOT 1,2,6 PLOT @,3,9sPLOT 1,3,3:B=INT(i7-L) FOR I=B+2 TO B+2#L STEP 2:PLOT 1,3,44:NEXT PLOT @,5,2:PLOT 1,5,@:PLOT 14,5,“WELL DONE" FOR I=1 TO 6:PLOT 20-1,10+1 ,LEFT$(C$,1) : NEXT PLOT 20,11,LEFT$(C$,2):PLOT 10,17,C$ PLOT X(@),Y(@),37: RETURN REM #* YES ## IF SCRN(B+2*#1,1)>32 THEN SHOOT: WAIT 2@:RETURN PING:PLOT B+2#1,1,6$:PLOT B+2#1,2,6$% STATE=STATE+1: BLANK=FALSE RETURN
105
708
718
720
730
740
800
810
828
830
848
858
868
1080 1810 1028 1830 1048 1858 1048 1878 1180 11108 1120 1138 1148 1158 1168 1178 1188 1198 1280 1218 1220 1238 1248 1258 1288 1298 1380 1318 1328
106
REM #* NO ## PLOT X(NUMBER) , Y(NUMBER) ,32 ZAP: NUMBER=NUMBER+1 PLOT X (NUMBER) ,Y (NUMBER) ,37 RETURN REM ## WRNG ## FOR I=i TOL : GS=MID$(B$,1,1):B0SUB YES : PLOT 22,9+1,32sPLOT 22,10+1,37 NEXT PLOT 21,10+L,"SPLAT"sEXPLODE: WAIT 50 RETURN REM *## SET UP ## MAX=-1:DIM R$(100) REPEAT: MAX=MAX+1:READ R#(MAX) UNTIL R#(MAX)="%" FOR I=@ TO 18:READ X(1I),Y¥(I):NEXT START=#B400+37#8: AA=#A008 POKE AA,2: IF PEEK(AA)<>2 THEN START=START-#8008 FOR I=START TO START+7:READ R:POKE I,R:NEXT RETURN REM ** THE DATA ## DATA TABLE ,CHAIR,BOOK,PILLOW,CUBE,RULER, ISLAND DATA GLASS, BUCKET, TORCH, KITCHEN, TELEVISION, BOTTLE DATA BEAN,HELLO,NAME,WHOSE,RUNNER, TWELVE, ZEBRA DATA RUBBER,SUNNY ,ENDING,GUESS,CORNER, BUTTERFLY DATA ENEMY,FLOWER,ROCKET, ORANGE, YELLOW, BLACK DATA NOTHING, WATER, SUNSHINE, CHEAT, BLACKBOARD DATA MEAT, TREAT, THEATRE, PURPLE,GREEN,VIOLET DATA GRAMMAR ,SCHOOL,SIGN,POST,COAST,CHURCH,PADDLE DATA BEDROOM, TISSUE,MISS, TEST, AUGUST ,MOTHER,FATHER DATA ANIMAL, DIRTY,BEGIN,HANDLE,UNCLE, SHIP DATA ZOOM, TWENTY, SQUASH, SHEET, BEAUTIFUL, JANUARY DATA DIAMOND, FEBRUARY ,MARCH,APRIL,JUNE, JULY DATA SEPTEMBER, OCTOBER,NOVEMBER, DECEMBER, AUNT DATA DRONE, DROP ,NOTICE,OFFER,PATCH,PASTIME DATA POWDER, QUIZ,QUIET,SORROW, VOLUME, DAFT REM Room for more words DATA * DATA 12,16,13,16,14,15,15,14 DATA 16,13,17,12,18,11,19,18 DATA 20,18,21,18,22,18
1330 DATA 14,14,4,31,14,14,18,18
2080 REM ** INFOrmation #*#
201@ INK 5:PAPER @:CLS:DEF FNR(X)=INT(RND(1)#X)
2028 E$=" "+CHR$(27) :D$=E$4+"J"+CHR$ (4) s PRINT
2038 PRINT D$;SPC(12);"HANGMAN":PRINT D$:PRINT: PRINT 2048 PRINT D$;SPC(6)3“by Czes Kosniowski":PRINT D$:PRINT 2058 PRINT "Guess the word before the man reaches" 2068 PRINT “the top and falls off........ "SPRINT 2070 PRINT "For each incorrect letter the man "
208@ PRINT "moves one step closer........"8PRINT 2098 PRINT "Press Y to start. "3
2108 REPEAT: 6$=KEY$:GG=RND(1):UNTIL G$="Y"
2118 PRINT:PRINT:PRINT “Here we gow..."
2128 FOR I[=@ TO 9:C$=C$+CHR$(255) s NEXT
2138 RETURN
The main routine
The main routine waits for a letter key to be pressed (one of the keys A to 2Z). This letter is printed at the bottom of the screen. A check is made to see if this letter is contained in the selected word. If it is then the subroutine YES is called, otherwise NO is used.
The whole process continues until 10 errors have been made or the word has been guessed correctly.
The subroutines
500 CHOICE
This selects a word at random and creates the appropriate screen display. The string C$ consists of ten solid blocks (CHR$(255)) and is used to create the stairs.
600 YES
If the letter selected appears in the word then this subroutine is called to display that letter. Notice that if the letter has been selected previously it counts as an error.
700 NO A wrongly guessed letter (or duplicated letter) calls this subroutine. The effect is to make the man walk up that flight of stairs.
800 WRNG If the word is not guessed the man falls over the precipice and goes SPLAT.
107
1000 SETUP This reads the words into memory. You can add more words or change any
quite easily in the DATA statements. The path that the man walks up the stairs is stored in the arrays X(1),
Y(I). One custom character, the man, is needed.
2000 INFO This contains brief details of the game.
108
29 figure it Out
In this game the computer will select some numbers. You have to figure out what these numbers are using the information supplied by the computer. For each guess you will be told how many correct numbers you guessed. A cyan coloured marker is used to denote a correct number in the correct position. A magenta marker denotes a correct number in the incorrect position.
You are allowed to say how many numbers the computer should select. Also you may say in what range each of these numbers should be. For example, you may ask the computer to select three numbers between 1 and 2. That makes a rather easy game. At the other extreme you may ask the computer to select nine numbers between 1 and 9. That would be rather more difficult.
FIGURE IT 1 a
2
a 1 a Z a a a
121 ziti
WELL DONE - you Another
109
10 REM HHHHHHHEHHHRHR HEHE
28 REM * FIGURE IT OUT *#
3D REM HEHHHHHHEHH HERES
4@ REM
5@ CHECK=500: ANSWER=70@: SETUP=1000: INFO=2008
100 REM *#* THE MAIN PROGRAM #+#
11@ GOSUB INFO:GOSUB SETUP
12@ REPEAT
138 : FOR I=i1 TO NUMBER: C$(1I)=A$(1): NEXT
140 : PLOT 1,0,T#:PING: REPEAT: UNTIL KEY$=""
i5@ : FOR I=i1 TO NUMBER
168 : REPEAT: GET G$:UNTIL 6$>="@" AND G$<CHR$(49+RANGE) 170 : IF G$="8" THEN STATE=TRUE: I=NUMBER
188 : PRINT G$+" “3; :BS(1I)=6$
198 : NEXT
208 : PING:PLOT 1,0,5$
219 : IF NOT STATE THEN GOSUB CHECK
228 : PRINT: PRINT: TRIES=TRIES+1
23@ UNTIL STATE
248 IF STATE<@ THEN GOSUB ANSWER
25@ IF STATE=1 THEN PRINT W$; TRIES
268 WAIT S@s:PRINTsPRINT E$#"L Another go? Y or N “ 270 REPEAT: GET G$: UNTIL G$="Y" OR G$="N"
288 IF 6$="Y" THEN RUN
298 CLS: INK 7:PRINT "Bye for now. ":END
5@@ REM ## CHECK #+#
51@ X$=""*:Y$=""
52@ FOR I=i1 TO NUMBER
530 : IF C#$(I1)=BS(1) THEN X$=X$4+"C ":BS(I)="B":C$(1)="C" 548 NEXT
55@ FOR I=1 TO NUMBER: FOR J=1 TO NUMBER
560 : IF C$(I)=BS(J) THEN Y$=Y¥$+"9 “sBS(J)="B":C$(1)="C" 57@ NEXT: NEXT
58@ PRINT DS+FSt"FU+F Se" "+" "+X$S+D$StFSt"E"+VS4D$
590 IF LEN(X$)=2*NUMBER THEN STATE=1:PING:WAIT 38:PING 688 RETURN
780 REM *#* ANSWER #+#
71@ PRINT “Was it that hard?":SHOOT
720 PRINT: PRINT “The answer is :"“:PRINT
738 FOR I=1 TO NUMBERsPRINT AS$(I)+" “3 eNEXT
110
748 PRINT
75@ RETURN
1000 REM #* SET UP ##
101@ PAPER @:INK 2:CLS
1828 FOR I=i TO NUMBER
1030 : A$(I)=CHRS$(49+INT(RND(1) #RANGE) )
1048 NEXT
105@ T$=CHR$(12)+"Type "+MID$(STR$ (NUMBER) , 2) 1068 T$=T$+" numbers, between 1 and “+MID$(STR$ (RANGE) ,2) 1070 FOR I=@ TO 33:S$=S$+" "sNEXT
1088 STATE=FALSE:PRINT:PRINT: PRINT N$: PRINT 1090 W$="WELL DONE - you did it in "
1108 RETURN
2000 REM ** INFOrmation #+#
2018 2020 2030 2040 2050 2068 2078 2080 2898 2188 2118 2128 2138 2140 2158 2168 2178 2188 2198 2208 2218 2228 2238 2240 2258 2268 2270
PAPER @: INK 7:CLS
FS$=CHR$(27):E$=" "+F$: D$=CHR$ (8)
NS=E$+"A FIGURE IT OUT"
PRINT CHR$(4)sPRINT E$+"J"+N$sPRINTs PRINT PRINT:PRINT E$+"J"+E$+"B by Czes Kosniowski" PRINT CHR$(4):PRINT: PRINT
PRINT “The computer will select some numbers" PRINT “which you have to FIGURE out based on" PRINT “the information supplied. The special" PRINT “symbol "+F$+"I"+F$+"F("+F$+"H"+F$+"Gappears"; PRINT " for every number in";
PRINT “its correct position. The symbol";
PRINT FSt"I"+F $+" EQ"+F$+"H" +h $+"G"
PRINT “appears for every correct number in"
PRINT "the wrong position."
PRINT:PRINT “If you want to give up - press @." PRINT: PRINT
PRINT “How many numbers do you want the"
PRINT “computer to choose? 3 to 91 “3
REPEAT: G$=KEY$:GG=RND(1):UNTIL G$>"2" AND GS$<":" NUMBER=VAL (6$):PRINT 6$
PRINT:PRINT "How large can each of the numbers be?" PRINT “2 to 9: “3
REPEAT: G$=KEY$:GG=RND(1):UNTIL G$>"1" AND GS<"e" RANGE=VAL(G$):PRINT 6¢
PRINTSPRINT "O.K. Here we go! “s:WAIT 188
RETURN
111
The main routine
The main loop waits repeatedly for the required number of numbers to be typed in. These numbers are displayed and a check is made, with the subroutine CHECK, to see how many are correct.
The process continues until the correct sequence is guessed or the number 0 is pressed. Pressing 0 gives you the option of giving up.
The subroutines
500 CHECK
This first checks to see how many of the numbers are both correct and correctly positioned. It then checks to see how many of the remaining numbers are correct but incorrectly positioned.
700 ANSWER If 0 is pressed the main routine is aborted and this subroutine prints out the answer.
1000 SETUP This subroutine randomly selects the numbers you have to guess.
2000 INFO
This contains brief details of the game. It also requests how many numbers (NUMBER) the computer has to select and the range (RANGE) of these numbers.
112
30 Don't be Greedy
If you like dice rolling games then here is one for you. A lot of luck is involved but some skill is also needed.
The game uses two dice which look like ordinary dice except that there isn’t a number 1. Instead there is a miserable looking face.
You play against the computer. The object of the game is to be the first to score over 100. The computer and you take turns at rolling the dice. A round consists of a series of rolls (at least one but posssibly many). You can stop rolling whenever you want by pressing 4. If you get a face then your round is over and your score for that round is 0. If you get faces on both dice then your round is also over and your total score becomes 0. If no face appears then you have the choice of rolling again or passing the dice to the computer. If you pass the dice your round is over and the score of that round is added to your total score. The computer then goes through a
ROLLING Your go. Press @ to stop.
DON’T BE GREEDY!
Your score is 56 My score is 27
113
similar process, after which it is your turn again. The skill is to decide when to stop — just remember don’t be greedy. Note: The two dice are rolled randomly and the computer does not cheat.
10 REM 4HHHHHHHHHHHERHHHE ES
20 REM * DON’T BE GREEDY +*
3O REM HEHEHE HEREREREREEES
40 REM
5@ YOU=300: ME=500: DICE=700: ADDUP=800: CARRY=900: INFO=1000
180 110 120 138 148 158 148 178 188 198 208 308 318 320 338 340 358 368 378 388 398 400 418 420 430 440 4508 468 588 518 520
114
REM *# THE MAIN PROGRAM ## GOSUB INFO: ANSWER=TRUE REPEAT : IF ANSWER THEN GOSUB YOU : IF ANSWER THEN GOSUB ME UNTIL NOT ANSWER FOR I=@ TO 2:PING:WAIT 30:NEXT PRINTSPRINT ES; "B"SE$ 3 "L Another go? Y or N" REPEAT: GET G$: UNTIL G$="Y" OR G$="N" IF 6$="Y" THEN RUN CLS:PRINT “Bye for now.":POKE #26A,3: INK 7: END REM *# YOU ## STATE=FALSE: M=@:N=0sP=2:SC=YSC:T=8 PLOT 14,4,“Your go." REPEAT PLOT 10,4,"Press @ to stop."
: REPEAT: UNTIL KEY$=""
: GOSUB DICE: GOSUB ADDUP
: PLOT 10,4," .
: PRINT H$+" Your score this round is “+STR$(T) : IF NOT STATE THEN GOSUB CARRY
UNTIL STATE
YSC=SC+T
WAIT S@:PRINT H$:PRINT: PRINT J$
PLOT 1,28,"Your score is"+STR$(YSC)+" “:WAIT 188 IF YSC>1@@ THEN ANSWER=FALSE:PRINT H$;3SPC(14) sW$ PLOT 14,4," ":;WAIT 5@
RETURN
REM ## ME ##
: STATE=FALSE: N=@:N=1:P=FNR(28)+15:SC=MSCs T=8 PLOT 15,4,"My go."
538
540:
958 568 578 58@ 598 600 618 628 638 640 658 700 718 728 738 748 758
768 :
778 788 798 800 818 828 838 B48 858 900 918 920 938 948 958 1008 1018 1828 1830 1048 1850
REPEAT GOSUB DICE:GOSUB ADDUP : PRINT H$+" My score this round is “+STR¢#(T) : STATE=STATE OR (RND(1)<.5+.2*(SC+T<YSC) ) : IF SC+T>10@ THEN STATE=TRUE : IF NOT STATE THEN PRINT:PRINT SPC(108);Y$ : WAIT 25@0:PRINT CHR$(11)+d$ UNTIL STATE MSC=SC+T:WAIT S@:PRINT H$:PRINT:PRINT J$ PLOT 20,20,CHR$(5)+"My score is“+STR$(MSC)+" , IF MSC>10@ THEN ANSWER=FALSE:PRINT H$+J$;SPC(15)51$¢ PLOT 15,4," . RETURN REM ## DICE #+# PLOT 14,2,"ROLLING" REPEAT : K=FNR(6)sL=FNR(6) :M=M+tN
: FOR I=@ TO 2
: PLOT X,Y+2#1I1,BS(K,1):PLOT X+Z,Y+2#1,BS(L,I) NEXT UNTIL KEY$="Q" AND P<5S OR M>P PLOT 14,2," . RETURN REM #* ADD UP ##
IF K=@ OR L=@ THEN ZAP: T=@:STATE=TRUE
IF K=@ AND L=@ THEN EXPLODE:SC=@ S=@:I1F K>@ AND L>@ THEN S=K+L+2:PING T=T+§ RETURN REM ## CARRY on ## PRINT: PRINT E$+"LDo you want to roll again? Y or N" REPEAT: GET G$: UNTIL G$="Y" OR G$="N" PRINT CHR$(11)+J$
IF G$="N" THEN STATE=TRUE: RETURN RETURN
REM *## INFOrmation #+#
INK 3:PAPER @:CLS:DEF FNR(X)=INT(RND(1) #X)
E$=" "“4CHR$(27) :DS=E$t"J"+CHR$(4) sPRINT K$="DON'T BE GREEDY!"
PRINT D$;SPC(7);K$:PRINT D$:PRINTsPRINT
PRINT D$;SPC(6)3"by Czes Kosniowski":PRINT D$:PRINT
115
1068 1078 1088 1898 1108 1118 1120 1138 1140 1158 1168 1178 1188 1198 1208 1218 1228 1238 1240 1258 1268 1278 1288 1298 1300 1318 1328
PRINT "This game uses two dice. Try to be"
PRINT “first to get a score of over 100.":PRINT PRINT "A round consists of a series of rolls."; PRINT "You can stop when you want, BUT you"
PRINT “must stop if you get a ‘1i' (shown as aface.)" PRINT:PRINT “If you get a face then your score for" PRINT “that round is @. If you get two faces"
PRINT “then your total score becomes @.":PRINT PRINT “Press Y to start.....0.."3
REPEAT: G$=KEY$:GG=RND(1):UNTIL G$="Y"
AS="<C yyy 95 4S BSE"S D7 ECSe = agg gh BS(O,8)="<4 <4"sBS(O,1)=" OO ":BS(8,2)="<,,,,4" B$(1,8)=" \ "sBS(1,1)=" ":B$(1,2)="\ ; B$(2,0)=" \ ":B$(2,1)=" \ “:BS(2,2)2"\ . BS(3,8)="\ \ "1B$(3,1)=" "sB$(3,2)="\ \? BS(4,0)="\ \ ":BS(4,1)2" \ “:BS(4,2)="\ ‘os BS$(5,@)="\ \ "sB$(5,1)="\ \"sB$(5,2)2"\ \
X29: Y¥=9:Z212:CLS:POKE #26A,2: INK 5
FOR I=Y¥-2 TO Y+6:PLOT 0,1,9:NEXT
PLOT @,4,1:PLOT 0,6,3
PLOT X-1,Y-1,A$:PLOT X-1+Z,Y-1,A$
FOR I#V¥ TO Y+4:PLOT X-1,1,B$sPLOT X-1+2,1,B$:NEXT PLOT X-1,¥+5,C$:PLOT X-1+Z,Y+5,C$
J$=CHR$ (14) :HS=CHR$(3O)+I$:W$="YOU WIN"
1$s"T WIN": Y$="I'11 roll again."
PLOT 9,17,CHR$(4)+K$
RETURN
The main routine
The main routine is a short loop which terminates when the value of ANSWER is FALSE. This is the case when one of the players (you or the computer) reaches a score over 100.
The subroutines
300 YOU
This subroutine is used when it is your turn. It consists of a loop which ends when you decide to stop the round or when you are forced to stop a round because of a face.
116
500 ME This subroutine is similar to the one above except that it includes a strategy
for the computer.
700 DICE The actual rolling of the dice is performed here. As you can easily check, it is
quite random and fair.
800 ADDUP The score during a round is calculated with this subroutine.
900 CARRY This asks if you want to carry on rolling. That is, if you are allowed to.
1000 INFO
This contains details of the game followed by the board layout. The strings A$, B$ and C$ used correctly produce a square. The string array B$(I,J) contains the display that can appear on each dice. For example B$(0,0), B$(0,1) together with B$(0,2) produce a face while B$(3,0), B$(3,1) and B$(3,2) produce four dots. Note that all these strings are printed on the screen using the alternate character set.
117
Appendix |: Saving Screen to Tape
There may come a time when you want to save, on tape, a picture that you've created on the screen; particularly if it is a high-resolution picture which took a while to draw. You can do this quite easily with the following method.
Suppose that the ORIC is in HIRES mode and your picture is ready. Now type one of the following (depending on whether you have a 48K or 16K ORIC).
CSAVE "NAME", A#AQ00,E#BF3F | (48K model) CSAVE "NAME",A#2000,E#3F3F © (16K model)
Then press the RECORD and PLAY buttons on your tape recorder and press RETURN on the ORIC.
To view the picture later, first rewind the tape and adjust the volume to the correct level. Make sure that the ORIC is in HIRES mode. Then type one of the following,
CLOAD "NAME" ,A#A000,E#BF3F (48K model) CLOAD "NAME" ,A#2000,E#3F3F (16K model)
press RETURN on the ORIC and PLAY on the tape recorder. Soon you should see your picture rapidly reappear on the screen.
You could incorporate the saving part into any of your programs. At a suitable point of the program insert a line with the following command.
GOSUB 50000
Also, add the following lines to your program.
50008 REM ## SAVE UTILITY #+#
50018 PRINT: PRINT
58828 PRINT “Do you want the save this picture?" 5Q@83@ PRINT "Y or Ne “3
50048 REPEAT:GET G$:UNTIL 6$="Y" OR G$="N"
118
50058 50068 58878 50088 50898 50188 50118 58120 58138 50140 50158 50168 58178
IF G$="N" THEN RETURN
PRINT: PRINT
PRINT “Press RECORD and PLAY on your recorder"; PRINT CHR$(14@);SPC(10);"Press Y when ready"; REPEAT: GET G$:UNTIL G$="Y"
CSAVE “PICTURE”, A#AQQ0,E#BF3F
REM Change details above for 16K model
PRINT: PRINT
PRINT CHR$(14@);SPC(8)3; "Turn your recorder off" PRINT CHR$(140);SPC(11); “and press Y “;
REPEAT: GET G$:UNTIL G$="Y"
PRINT: PRINT
RETURN
119
Appendix 27: Renumber Utility
Whenever you write your own programs or modify others, there comes a time when you want to renumber the lines. Here is a short simple program that will renumber any block of lines. It will not, however, renumber those line numbers that you call within a program. In other words GOTO 999, GOSUB 237 etc., will not be changed. The way around this problem (used throughout this book) is to use named subroutines in the form GOSUB BLANK where the variable BLANK is assigned some value in the first lines of a program. Then, after renumbering, you need simply change the value of BLANK and the program will work.
Back to the renumber utility, first of all type in the program and save it under a name like RENUMBER. Whenever you write a program CLOAD "RENUMBER" first and then type in your program.
To use the utility type RUN 60000 and press RETURN. You will be asked for four numbers as follows.
Block start, Block finish, Start of new line numbers, Increment.
Here Block start, Block finish are the first and last line numbers of that part of your program you want renumbered. Start of new line numbers is the new starting line number and Increment is the amoiint by which you want each line to go up (this is usually 10).
Simply type in the four numbers required, separated by commas, and press RETURN. The program will then renumber the required block of lines.
60000 REM ## RENUMBER #+#
60018 PRINT "Type in 4 numbers, separated by commas" 60028 PRINT "Block start, finish, New line no., inc" 60030 INPUT X,Y,L,I
66048 S=1283
608058 REPEAT
60066 : IF DEEK(S)>=X THEN DOKE S,LsL=L+I
60076 : S#=DEEK(8-2)+2
60080 UNTIL DEEK(S)>Y OR DEEK(S) =60008
120
Warning: Be careful when using this utility. You could ruin your sanity and possibly your program. Make sure that the block you are renumbering still fits in between the existing non-renumbered lines. For example, look at the following sample program,
18 REM SAMPLE PROGRAM 12 FOR I=1 TO 10
14 PRINT I 16 PING 18 WAIT 38 28 NEXT
Type RUN 60000 and enter the following numbers: 12,16,10,10
This will renumber lines 12 - 16 with the new numbers beginning at 10 and having increments of 10. The result becomes:
18 REM SAMPLE PROGRAM 1@ FOR I=1 TO 18
20 PRINT I 38 PING 18 WAIT 38 28 NEXT
Very strange indeed — but the program still RUNs.
You can recover your original program by using RUN 60000 and entering the following numbers
10,100,10,2
Go back to the original program and try RUN 60000 with the following numbers:
10,20,10,0
The result is as follows:
121
1@ REM SAMPLE PROGRAM 18 FOR I=1 TO 10
18 PRINT I 1@ FING 10 WAIT 30 1@ NEXT
Again strange — but it still works.
Finally go back to the original program and RUN 60000 with the following numbers:
10,20,50,-10
which produces:
38 REM SAMPLE PROGRAM 40 FOR I=1 TO 18
30 PRINT I 28 PING 1@ WAIT 32 @ NEXT
This program still RUNs, but try to delete line 10! You can have lots of fun creating unusual looking programs. Problems usually arise with GOSUB and GOTO statements. Here is an example:
108 REM ANOTHER SAMPLE PROGRAM 12 GOSUB 20
14 PING
16 WAIT 38
18 END
28 PRINT "HELLO"
22 RETURN
Renumber this program (RUN 60000) with the numbers: 10,18,100,200
The result is shown below. This program will not work.
188 REM ANOTHER SAMPLE PROGRAM 308 GOSUB 20
508 PING
708 WAIT 38
900 END
20 PRINT "HELLO"
22 RETURN
Finally, here is the Treasure hunt program renumbered in a strange way. The program RUNs but you won't be able to type it in, and trying to edit any line becomes difficult. (If you want to renumber your programs in such a fashion, renumber the higher numbers first and work down.)
REM HHERHHHEHE HEHEHE EHS
REM # TREASURE HUNT *
REM HHHHHREHHHEHHEEES
REM
VIEW=1:SETUP=2: INFO=3
REM #* THE MAIN PROGRAM #
GOSUB INFO:GOSUB SETUP
REPEAT
: PLOT X,Y,12:GET K#:KK=ASC(K$):PLOT X,Y,8 IF KK=32 THEN GOSUB VIEW
IF KK=8 AND X>4 THEN X=X-2
IF KK=9 AND X<3@ THEN X=X+2
IF KK=1@ AND Y<22 THEN Y=Y+2
: IF KK=11 AND Y>2 THEN Y=Y-2
UNTIL STATE
SHOOT: WAIT 40:PING: WAIT 48:PING
PRINT CHR#(14)+E$+"L"3SPC(11); "WELL DONE" PRINT E$+"A"+" Another go? Y or N" PRINT CHR#(14)+CHR#(11)3:PING
REPEAT: GET K$:UNTIL K$="Y¥" OR K$="N"
123
NOWWWWWWWWWWDnwWwHTnWwWWWdW Ns NnNNNNNNYINN NN NNN NN FY KF Re KF KF ee KH eK SS
— NG
IF K$="Y" THEN RUN
CLS:PING:PRINT "Bye for now. ":POKE #26A,3:END REM * VIEW #
IF SCRN(X+1,Y)<>35 THEN RETURN
DIST=INT (SOR ( (MM-X) # (MM-X) + (NN-Y) #(NN-Y))/2) AS=CHR$ (48+DIST)
IF DIST>9 THEN A¢$="X"
IF DIST>@ AND RND(1)<¢.5 THEN A$="?"
PLOT X+1,Y,A$:STATE=DIST=8
RETURN
REM * SETUP +#
CLS:PRINT SPC(11)3 "TREASURE HUNT": PRINT
FOR I=1 TO ii
: PRINT SPC(3);
: FOR J=@ TO 13
: PRINT CHR$(27)+"H#"s
: NEXT
: PRINT: PRINT
NEXT
PRINT E$+"A Use cursor keys to move." PRINT:PRINT E$+"D Press <Space bar? to view. "; PRINT CHR$(11);CHR$(11)3CHR#(11)
X=16:Y=12 ‘INITIAL POSITION MM=2#INT(RND(9) #1441) +2: NN=2#INT(RND(9) #1141) STATE=FALSE
RETURN
REM * INFOrmation #
POKE #26A,10 ‘Disables cursor and key click INK O@:PAPER 3:CLS:PRINT
E$=" "“4CHR$(27) sDS=E$+"I"+CHR$ (4)
PRINT D$;SPC(9); "TREASURE HUNT":PRINT D$ PRINT: PRINT
PRINT D$;SPC(5)3"“by Czes Kosniowski":PRINT D$ PRINT:PRINT E$+"A Find the hidden treasure." PRINT “By pressing the <space bar> you will" PRINT “be told how far away the treasure is" PRINT “approximately. Sometimes a ? appears" PRINT “to confuse you. An X means that the" PRINT "distance is 1@ or more. 600D LUCK" PRINT: PRINT E$+"B"+E$+"L Press Y to continue." REPEAT: K$=KEY$:K=RND(1):UNTIL K$="Y"
RETURN
Appendix 3: The ORIC Characters
This appendix lists the ORIC standard and alternate character sets together with their ASCII values.
Standard characters
Gowoe Gow.
Jom ot
tl tA oN ant Wh
“Ua aww o
0
Om Dewy tay
Tm Oo
73 74 73 76 77 78 79
ee uUYy ARON KH KETC CAMA OT
me th
nF ow
oho Oo
1 81 82 a3 84 85 Bo 87 88 89 90 91 92 93 94 95 96 97 98 99 120 i@1 102 103
tH TO DOD Se Fee TF
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
125
Alternate characters
iB
74
tf
Ww
meee ea
“
81
7 8 9 6@
61
wf 6
4Q 41
o a
42
44 45 46 47 48 49
66
67
68 69 70 71 7
MM
11
38
2 =
94
i)
tH ie)
126
Appendix 4: Musical Notes
The MUSIC command in the ORIC requires four numbers. Channel, Octave, Note, Volume
Note can take any value from 1 to 12; other numbers produce error messages. These numbers correspond approximately to the following notes:
4 0 2 F# 8
C# 5 G 9
D 4 G# 10
D# 5 E 6 A 11 A# 12
F B
iow ou “ou “ou "ou out
To play a tune on the ORIC the relevant data has to be fed in, usually via DATA statements. Things are relatively easy if you stay in one octave. But often you want to move from one octave to another. The use of DATA statements to indicate the octave required is rather wasteful. This appendix describes a simple way of combining the note and octave values into a single number.
The idea is to use the numbers 1 to 12 for the first octave, the numbers 13 to 24 for the second and so on. Then one number, say R, is used for both the octave and note value, To recover the value OCT of the octave and NN the note simply use the following.
INTCCR - 1)/12) R - 12*0CT
OcT NN
With this scheme you can imagine a piano keyboard as illustrated below. Entering music from sheet music becomes easy.
24 7911 1416 79 81 83 tt 78|80|82|84 CDEFGABCDE FGAB
127
Of course this is not the whole story. Usually we set the volume control to 0 and use a command such as
PLAY 3,0,1,2500 : WAITT
This essentially controls the way the sound is produced (envelope mode etc.) and the time T for which the note is played. Thus our DATA statements should contain two numbers R and T. The value of R tells the ORIC which octave and note to play, while T tells it how long to play it for.
The above process will produce acceptable music on the ORIC. You can of course be much more adventurous.
128
Easy Programming for the BBC Micro £5.95 Eric Deeson
‘A well thought out approach to teaching the beginner not only BBC Basic but also program design’—BBC Micro User
Further Programming for the BBC Micro £5.95 Alan Thomas
BBC Micro Assembly Language August 1983 Bruce Smith
BBC Micro in Education August 1983 Eric Deeson
Easy Programming for the Dragon 32 £5.95
Ian Stewart & Robin Jones
Further Programming for the Dragon 32 £5.95 Ian Stewart & Robin Jones
Shiva Software
Spectrum Special 1 £5.95 Ian Stewart & Robin Jones
A selection of 10 educational games and puzzles
Spectrum Specials 2 & 3 £5.95 each Ian Stewart & Robin Jones
Plus more to come!
Other titles of interest
Easy Programming for the Oric-1 Ian Stewart & Robin Jones
Brainteasers for BASIC Computers Gordon Lee
Programming for REAL Beginners Philip Crookall
PEEK, POKE, BYTE & RAM! Basic Programming for the ZX81 Ian Stewart & Robin Jones
‘Far and away the best book for ZX81 users new to computing’ — Popular Computing Weekly
‘,.. the best introduction to using this trail-blazing micro’— Computers in Schools
‘One of fifty books already published on the Sinclair micros, it is the best introduction accessible to all computing novices’—Laboratory Equipment Digest
The ZX81 Add-On Book Martin Wren-Hilton
Machine Code and better Basic Ian Stewart & Robin Jones ‘...a beautifully written course in so-called advanced programming,
concentrating on program structuring, data-handling and machine coding’—Education Equipment
Easy Programming for the ZX Spectrum Ian Stewart & Robin Jones
‘,.. will take you a long way into the mysteries of the Spectrum: is written with a consistent and humorous hand: and shares the affection the authors feel for the computer’ —ZX Computing
Further Programming for the ZX Spectrum Ian Stewart & Robin Jones
Spectrum Machine Code Ian Stewart & Robin Jones
Computer Puzzles: For Spectrum and ZX81 Ian Stewart & Robin Jones
‘What a gem of a book! ’—Education Equipment
Games to Play on Your ZX Spectrum Martin Wren-Hilton
Spectrum in Education Eric Deeson
£5.95
£4.95
£2.95
£4.95
£5.50
£7.50
£5.95
£5.95
£5.25
£2.50
£1.95
£6.50
Can you:
@ escape from the pack of wolves @ pilot.the lunar module
@ sing ‘Knees Up Mother Brown @ tame the snake
’
This collection of 30 programs consists of four types of games: pure entertainment (using sound and colour), puzzles, arcade games and thought-provoking problems.
Included in the useful appendix section are:
@ program to SAVE the screen
@ renumber utility program
@ standard and alternate character sets
@ music on the ORIC
Program listings have all been printed directly from bug-free RUNning programs. Brief program descriptions and screen printouts are included. All programs are user- friendly and will not. ‘crash’ if presented with unexpected inputs.
A cassette is available containing six programs from the book.
et SHIVA
Shiva Publishing Limited ISBN 0 906812 48 8 UK price £4.95 net
GAMES TC PLAY ON YOUR ORIC-1 Ezes Kosniowsti