ZXTape! 2 Computer Studies - Side B*Mercurian Pulp Products / Longman Software1984English Educational7.95 ROM LoaderOriginal ReleaseTZXed by Andrew BarkerPUTIN    "PUTIN" (1:1:7:56999  30 #821,0;" PLEASE WAIT " (<N=19 :G$:R=07:B:G$+R,B:R:N 2"A",28,34",33!,28,62>,63?,63?,31,"B",0,0,0,128,64@,32 ,144,200 7"C",15,7,3,1,0,0,0,0,"D",228,242,250,252,254,126~,62>,28 <~"E",0,480,60<,63?,60<,480,0,0,"F",63?,63?,63?,63?,513,33!,0,0,"G",63?,63?,63?,31,31,31,0,0,"H",255,255,255,255,255,255,0,0,"I",255,255,254,252,248,224,0,0 F@C=0242:0,C;"";1,C;"":C PL=2162:L,0;"";L+1,0;"";L,30-(4L=2)-(2L=4);"";L+1,30-(4L=2)-(2L=4);"":L ZBC=0302:18,C;"";19,C;"":C dq3,20;"";4,20;"";5,3;"LONGMAN SOFTWARE ";6,20;"" n9000(#:9000(# x1A$="COMPUTER":L=7:C=3:9180# }1A$="STUDIES":L=10 :C=4:9180# 0:1 140:A=57000 !N=023:B:A+N,B:N m33!,0,64@,17,0,228,1,0,27,237,176,201 m33!,0,228,17,0,64@,1,9 ,27,237,176,201 621,0;" " 57000 :21,0;" SEARCHING AND LOADING " &7:1:20,0; ""  #' "dbsize"" #("DOUBLE HEIGHT" #2a=57050 #<.z:z999a,z:a=a+1:9020<# #F237,75K,176,92\,121y,254,32 ,568,1,201,120x,254,21,568,1,201,205,158,14,197,6,0,9 ,193 #P229,229,120x,60<,205,158,14,6,0,9 ,209,1,0,7,9 ,235,9 ,229,6,4,126~,18,21,18,21,37%,16,248 #Z 209,6,4,126~,18,21,18,21,37%,16,248,225,124|,15,15,15,230,3,246,88X,103g,126~,1,32 ,0,9 ,119w,201,999 #"DOUBLE WIDTH" #a=57150> #.z:z999a,z:a=a+1:9130# #237,75K,176,92\,121y,254,31,568,1,201,120x,254,22,568,1,201,205,158,14,6,0,9 ,229,14 #8,126~,35#,546,0,6,4,15,568,6,203,14,203,14,24,8,203,14,203,14,203,254,203,246 #Ȥ16,237,43+,546,0,6,4,15,568,6,203,14,203,14,24,8,203,14,203,14,203,254,203,246,16,237,36$,13 ,32 ,203,225,124|,15,15,15,230,3,246,88X,103g,126~,35#,119w,201,999 # #n=1̱a$ #23729\,l:23728\,c # l,c;a$(n) #57150> #357050:23728\,c+1:57050 #c=c+2:n $ (bGIZ PazASTUDIESinput G- ,4I- "INPUT" D  COPYRIGHT 1984   MERCURIAN PULP PRODUCTS  AND (  CONTRACT BOOKS 2 <  DEBUGGED BY  F ******************** * WRITE YOUR * * NAME HERE. * ******************** PM21,0;" PROGRAM READY - PRESS ANY KEY ":1,0 ZA$=:A$=""90Z dv7:0:4::1,12 ;"I N P U T";3,9 ;"BASIC AT WORK." nG100d:N=15:G$:R=07:B:G$+R,B:R:N x"A",0,125},255,255,125},41),68D,136,"B",6,217,244,254,220,32 ,152,64@ "c",96`,155,47/,127,59;,4,25,2,"d",0,190,255,255,190,148,34",17 O"E",60<,60<,60<,60<,255,126~,60<,24 A$="PUTIN":500 a$="WORK AT BASIC!":600X P502:''" There were 5 perfectly good"''" demonstration routines in this" A'" program. They all worked - "''" then the bugs got at them!!" X'" You will have to debug them"''" yourself - the bugs got the"''" programmer too...." Y#1;0,0;" Poke  the right key  to go on ":2,-20 a$=:a$=""200 a$="o"a$="O"230 190 d4::1,12 ;"I N P U T";3,9 ;"BASIC AT WORK." A$="PUNIT":500 A$="OW BAA! TRICKS":600X F'" The bug-ridden routines start"''" at 1000,2000,3000,4000 & 5000." >'" The REMs will tell you what"''" they are supposed to do." 7'" If you have trouble debugging"''" then LIST 6000." " 500 ,BL$(32 ):n=13:L$:700:L$:800 :n 6B" The big rotten writings stop"," at 007, `5.95, 6.30 and No.10" @:" The RAMs won't tell you what"," your supper is today." J>" If you have double pea-pudding"," then LIST to starboard." T:20,0;" LIST 1000 for your first chore " ^ *C=029:1,C;" " YC>11 C<21C/2=(C/2)1,C;6;A$(C/2-5) +.02{# =,10 :.01z# =,20:C 1,30;" ": X5C=290-1:3,C;" " bAC>6C<213,C+3;5;A$(C-6) l+.02{# =,10 :.01z# =,20:C v3,0;" ": AC=029:n*4+1,C;L$(c+1);"" +.02{# =,10 :.01z# =,20:C -n*4+1,30;L$(31):  JC=290-1:n*4+3,C;"";L$(c+3) *+.02{# =,10 :.01z# =,20:C 4+n*4+3,0;L$(2):  BUBBLE-SORT ROUTINE. 1700:DATA LINE !N(10 ):NUMBER ARRAY #I=110 :READ 10 N$(J): ITEMS I:  $#I=19 :9 TIMES  .$J=19 :EACH LOOP 8<N(J)N(J+1)1120`:IN RIGHT ORDER - JUMP BX=N(J): SWAP  LN(J)=N(J+1):THE VN(J)=X: PAIR `I:ADD GOSUB 1200 jI:TO WATCH SORT tI=110 ~M(I);:FINAL I: PRINT OUT R10 ,5,7,9 ,2,4,8,3,6,1  > DISPLAY SUBROUTINE   FOLLOWS. IT'S O.K.!  ADD 1125 GOSUB 1200 AND 1135 STOP TO USE THIS. "RUN NUMBER ";I J=110 C=N(J):INK COLOUR C>5C=C-5 C;N(J);" "; J        ( 2 < F P e DRAWS A CIRCLE IN   DIAMOND,IN AN OVAL  IN AN SQUARE.  1:1: FILLED CIRCLE R=015 127,87W,P R   DIAMOND 127,579  '30,30:-30,30 **30,-70F:30,-30 4 OVAL >72H,65A H7110n,0,1.3&fff:0,44,,2 R;110n,0,-1.3&fff:0,-44,,2 \ SQUARE f524,12 p&150,0:0,150 z(-150,0:0,-150  ` FINDS THE MEAN OF 10 NUMBERS  NUMBERS INPUT I=110 "ENTRY ";I;"= "; D(I) D(1) I  AND TOTALLED  TATOL=0 I=110 TOTAL=TOTAL+D(I) I &MEAN=TOTAL*10 +FINAL FIGURES 0"TOTAL = ";TOTAL :"MEAN = ";MEAN D>:  ************ a  TABULAR DISPLAY - DATA   ON VARIOUS COMPUTERS.  4000: %'" MACHINE RAM COLOUR? PRICE" N=18  M$,R,C,P$ 8'1;M$;12 ;R;"k";TAP 18;C$;25;"`";P N %"Spectrum",480,"yes",776 !"ZX18",1,"yes",2392X $"APPLE PI",480,"yes",64@ #"IBM II",480,"yes",125} &"ITV ""B""",399,"yes",32 #"CBM 64",229,"yes",40(  "? scroll to see how   it should appear.  ,?   MACHINE RAM COLOUR? PRICE  6A   Spectrum 48k yes `125  @A   ZX81 1k no `40   JA   CBM 64 64k yes `229   TA   IBM PC 64k yes `2392  ^A   BBC "B" 32k yes `399  hC   APPLE II 48k yes `776  r=  |  All the necessary information  is in the DATA lines - just   not in the right places!  = *************  Simple Word Game  "GIVE ME A WORD ";W$ G=0:GO COUNTER  R=0:RIGHT GUESSES :M=1̱W$ "GUESS A LETTER ";G$ 10 ,N*2;"_":N N=1̱L$ G$=W$(N)5100 51702:NO GOOD 10 ,N*2;G$ W$=" ":MARK OFF R=R+1:SCORE  N:G=G+1:GO'S G=10 51702 R=W$5190F ( 5060 2" ENOUGH!YOU'VE LOST" <1,0:5010 F" WELL DONE" P!1,100d:5010 Z scroll for notes  d  This is rather a crude game  but I wanted to keep it all  on a single screen.  n   To end the game, BREAK in   during a BEEP, or EDIT out   the INPUT quotes and ENTER   the keyword STOP .  x  Include an "Another go ?"   routine before looping to   INPUT W$,to allow ending.     The words to be guessed   could be written in as DATA  and READ at random at the   start of each turn.    Have fun!! p  ARE YOU STUCK?!    FOLLOW THESE   ARROWS.  z$   $   $   $   $   $   $   $   X   INDEX   BUBBLE SORT....7100   PLOT & DRAW....7200  bC MEAN...........7300   HARDWARE DATA..7400  lC WORDGAME.......7500     vC LIST the numbers     ;  5  0  +  %    c  SORTING OUT   THE BUBBLE SORT   $1010 RESTORE 1170 !1040 READ N(I) *1080 IF N(J)N(J+1)... $1110 LET N(J+1)=X #1120 NEXT J %1130 NEXT I  1150 PRINT N(I) ^ **********  i  DEBUGGING   THE DRAWING   *$2010 PAPER 7:.... 4 2040 CIRCLE 127,87,R >#2090 DRAW -30,-30:.... H'2130 DRAW -110,0,+1.3 R$2150 PLOT 52,12 \p  Try different INK   and PAPER colours.  fk Try other curve   numbers on the   OVAL routine.  f  MAKING THE MEAN   MEAN SOMETING.    3010 DIM D(10) #3050 PRINT D(I) $3070 LET TOTAL .... $3100 NEXT  I  #3110 ...TOTAL/10 %3120 PRINT "TOTAL..... ʰ   Long variable names   are easy to read,but  more likely to give   typing errors.  d  CONFUSED COMPUTERS   "4030 FOR N=1 TO 6 !4040 READ M$,R,C$,P I4050 PRINT TAB 1;.. ...TAB 18;C$.... m Lines 4090 and 4120 have been switched   DATA can be corrected by reference to the table LISTed after the routine. (4140 on) $"  Lg   Worried about a word game  that won't work well?   V$5010 INPUT "GIVE ME...  `'5040..FOR N=... j#5070....LEN W$ t#5090 GOTO 5130 ~"5110 LET W$(N) #5150...THEN GOTO 5190 "5200 BEEP TOO HIGH ALINES 5050 & 5060 HAVE BEEN SWITCHED   >>THAT'S ALL << nnb# then LIST to starboard. GEA FILES  /=  "FILES" (1:1:7:56999  30 #821,0;" PLEASE WAIT " (<N=19 :G$:R=07:B:G$+R,B:R:N 2"A",28,34",33!,28,62>,63?,63?,31,"B",0,0,0,128,64@,32 ,144,200 7"C",15,7,3,1,0,0,0,0,"D",228,242,250,252,254,126~,62>,28 <~"E",0,480,60<,63?,60<,480,0,0,"F",63?,63?,63?,63?,513,33!,0,0,"G",63?,63?,63?,31,31,31,0,0,"H",255,255,255,255,255,255,0,0,"I",255,255,254,252,248,224,0,0 F@C=0242:0,C;"";1,C;"":C PL=2162:L,0;"";L+1,0;"";L,30-(4L=2)-(2L=4);"";L+1,30-(4L=2)-(2L=4);"":L ZBC=0302:18,C;"";19,C;"":C dq3,20;"";4,20;"";5,3;"LONGMAN SOFTWARE ";6,20;"" n9000(#:9000(# xbA$="COMPUTER":L=7:C=3:9180#:A$="STUDIES":L=10 :C=4:9180# 0:1 140 &N=5700057023:Z:N,Z:N m33!,0,64@,17,0,228,1,0,27,237,176,201 m33!,0,228,17,0,64@,1,9 ,27,237,176,201 621,0;" " 57000 :21,0;" SEARCHING AND LOADING " &7:1:20,0; ""  #("DOUBLE HEIGHT" #2&N=5705057129):z:N,z:N #<237,75K,176,92\,121y,254,32 ,568,1,201,120x,254,21,568,1,201,205,158,14,197,6,0,9 ,193 #F229,229,120x,60<,205,158,14,6,0,9 ,209,1,0,7,9 ,235,9 ,229,6,4,126~,18,21,18,21,37%,16,248 #P209,6,4,126~,18,21,18,21,37%,16,248,225,124|,15,15,15,230,3,246,88X,103g,126~,1,32 ,0,9 ,119w,201 #"DOUBLE WIDTH" #&N=57150>57241:z:N,z:N #237,75K,176,92\,121y,254,31,568,1,201,120x,254,22,568,1,201,205,158,14,6,0,9 ,229,14 #8,126~,35#,546,0,6,4,15,568,6,203,14,203,14,24,8,203,14,203,14,203,254,203,246 #16,237,43+,546,0,6,4,15,568,6,203,14,203,14,24,8,203,14,203,14,203,254,203,246,16,237,36$,13 ,32 ,203,225,124|,15,15,15,230,3,246,88X,103g,126~,35#,119w,201 # #23729\,L:n=1̱a$ #23728\,c # l,c;a$(n) #57150> #357050:23728\,c+1:57050 #c=c+2:n $ (bGIZ PzASTUDIESpfiles 78 7.98!1:57012:80P "Files" D 1984 MERCURIAN PULP  PRODUCTS/CONTRACT BOOKS (AA$=" FILES ":23729\,13 :C=4:7:1 -1N=1̱A$:23728\,C:13 ,C;A$(N) 2357150>:57050:23728\,C+1 757050:C=C+2:N 1,1;"F$(R,C,S)" 6;2,10 ;" COLUMNS ";5;4,3;"";5,3;" ";6,3;"R";7,3;"O";8,3;"W";9 ,3;"S";10 ,3;" ";11 ,3;"" .4;8,12 ;1;"SPACES" "f13 ,2;"Files handled by this program";14,2;"must take the shape F$(R,C,S)." ,l15,2;"ROWS COLUMNS & SPACES can be";16,2;"set to your requirements." 6e17,2;"Numbers can be handled but be";18,2;"sure you allow enough spaces." @c19,2;"Keep COLUMNS*SPACES under 30";20,2;"for better displays." J{.5,0:0,0;" NUmber of SPACES per item - set possible maximum ";a$:5000:f330J T%s=a$:8,19;4;s ^f.5,0:0,0;" Number of COLUMNS ? (MAX.6) ";a$:5000:f350^ h%c=a$:2,22;6;c rb.5,0:0,0;" Number of ROWS in file? ";a$:5000:f370r |$r=a$:6,5;5;r s*c*r>20000 Nx=((20000 N-s*r*c)*100d/(s*c*r)):21,2;" TOO BIG!! REDUCE BY ";x;"% ":350^  f$(r,c,s) #1;0,0;" Are you LOADing DATA from tape? Press  Y  or  N  ":.5,10 -23658j\,8:a$=:a$=""415 a$="N"460 a$"Y"410 w#1;0,0;" Find DATA tape, rewind to start of file and press any key  ":1,0 0:""f$()  500 dN=1C:.5,10 :0,0;(" Heading for column ";n;" ");f$(1,N) n x#1;0,0;" Create your file using Update routine. Press any key to go on.":.5,0 0:2000 1:1:7: ;2;z$;z$;z$;1,9 ;" FILE OPTIONS " k5,3;" 1  SEARCH A FILE ";8,3;" 2  UPDATE A FILE " 11 ,3;" 3  RE-ORDER A FILE ";14,3;" 4  SAVE DATA ON TAPE ";17,3;" 5  END OF PROGRAM " R21,0;"  PRESS A  NUMBER  TO SELECT ":.5,7 &A$=:A$=""550& 0A$<"1"A$>"5"540 :A$="5"600X D(1000*A$(1)) N 500 XE1:57012:21,8;" END OF PROGRAM ": 7:7:0: h0,9 ;" SEARCH A FILE "''" To do this you have to specify"'" FIELDS (column headings)." ;'" The demonstration DATA is from"'" a stamp collection." >" Select the FIELD ""PLACE"" and"'" specify ""UK""." ?'" The program will search for any"'" stamps from the UK" 9'" You can specify 2 or 3 FIELDS "'" at the same time." $@" Select the FIELD ""DATE"" and specify ""1972""." .a'" The program will now search for"'" those stamps from the UK with"'" a DATE of 1972." B`#1;1,0;" Press  any key  to search ":1,0:0 L :"  FIELD SPECIFICATION " V=T(3):P$(3,S):TEMPORARY STORES FOR SEARCH DATA ` k=1 j/N=1C:'3;N;" ";F$(1,N):N t_.5,0:0,0;" ENTER FIELD NUMBER: ";A$:5000:F1140t ~5000 checks numbers A$>C1140t  T(k)=A$ $'" FIELD ";F$(1,T(k));"" N.5,5:0,0;"PLEASE TELL ME WHAT TO LOOK FOR:";P$(k) 4;P$(k) k>21250 g23658j\,8:.5,10 :0,0;" ANOTHER FIELD ? ENTER (Y/N)";a$ !a$="Y"k=k+1:1140t a$"N"1210  end of field routine b#1;0,0;" FIELDS SET - ANY KEY TO SEARCH ":.5,10 :0 X:" SEARCHING FOR..."'':N=1K:4;F$(1,T(N));5;P$(N);:N '' :CS=(32 /C)-1: Column Spacing for display  CS>SCS=S  ;n=1C:7-N;9 ;f$(1,N,CS);" "; N:'' search routine  Q=0 n=1R:every row (2m=1k: how many fields set 2f$(n,t(m))p$(m)1390n <0m:Q=Q+1: number of lines displayed F.print files where Field specifications match P5o=1C:7-o;9 ;f$(n,o,cs);" "; Zo:'' d/q>85300:holds screen when full nn xQ1450 " There's nothing matches." '" Are you specifying your fields properly? Return and select the Update option. This will allow you to look closely at the files." |'" Field specifications must be spelt the same way,and in the same typeFACE as the entries you are searching for." t#1;0,0;"  WHAT NOW? ANOTHER SEARCH OR   A NEW OPTION ? PRESS S OR O " 1,0 .23658j\,8:A$=:A$=""1470 A$="S"1100L A$"O"1460  7:7:0: /0,5;" CREATE/UPDATE A FILE " @''" This shows you the file as it"'" is stands at the moment." ?" You can use it to remind "'" yourself what is in the file." ;" It's main use is for keeping"'" your files up to date." b" You can..."'"  ADD  a new entry"'"  DELETE  an old entry"'"  CHANGE  an entry."  g'" Only very small files will fit"'" on one screen. Others must be "'" displayed a little at a time." 6" I can start the display at any"'" row you choose."  u0,0;" ENTER number to start from - 1 to go from beginning ";a$:5000:f2080  *%sn=a$:sn=0sn>r2080  4<:23692\,R+22:Y=1:2900T :Y=0 CSN=1SN=2 H3N=SNR:4;N;:T=1C:F$(N,T);:T:'' R23658j\,8:25 \E=0:="H"2200 f$N/8=(N/8)2900T kE pN z 2200  #1;0,0;" ADD  A  DELETE  B  CHANGE  C  DISPLAY MORE  D  END UPDATE  E  ":.5,6 A$=:A$=""2210 A$<"A"A$>"E"2200 A$="A"2300 A$="B"2400` A$="C"2500 A$="D"" ";: A$="E"E=1:  2200 d.5,2:0,0;" ROW NUMBER OF NEW ENTRY ?";A$:5000:F2300 %NE=A$:NE<1NE>R2300 A$="1"#1;0,0;" ROW 1 CARRIES COLUMN HEADINGS. START FROM 2.[ANY KEY] TO GO ON":1,-5:0:2300 '5;NE;:Q=1C C0,0;(" ENTRY FOR ";F$(1,Q);"? ");F$(NE,Q) $F$(NE,Q);:Q .: `a.5,2:0,0;" ROW NUMBER TO DELETE ?";A$:5000:F2400` j%NE=A$:NE<1NE>R2400` t Q=1C:F$(NE,Q)=" ":Q: a.5,5:0,0;" ROW NUMBER TO CHANGE ?";A$:5000:F2500 %NE=A$:NE<1NE>R2500 X=1C #1;0,0;" FIELD ";F$(1,X);" ENTRY ";F$(NE,X);1,0;" PRESS C TO CHANGE  L  TO LEAVE" .5,0 A$=:A$=""2540 A$="L"2570 A$"C"2535 X.5,5:0,0;(" NEW ENTRY FOR ";F$(1,X);": ");F$(NE,X) X: T7R>8" PRESS  H  TO HOLD DISPLAY " YY$=" ":YY$="1" ^*'Y$;:X=1c:f$(1,X);:X:'' h 6:6:0: $7;"RE-ORDER A FILE" s''" This routine lets you re-order your file in an alphabetical or numerical order based on any of the columns." ֘'" For example,a stamp collection can be arranged alphabetically by PLACE,in DATE order,in order of FACE value,of COST price, or of re-sale VALUE." '" If you want to keep your file ordered in a particular way, then simply add new entries to the end of the file, and use this to sort them into order." @'" PRESS  ANY KEY  TO START ":.5,5 A$=:A$=""3060 ":" In order of which COLUMN ?" /N=1C:'3;N;" ";F$(1,N):N f.5,0:0,0;"  ENTER  column number: ";a$:5000:f3090 %cn=a$:cn>ccn<13090 &'''"  THIS MAY TAKE A MOMENT "'' 0find end of file :n=r1-1 D t=1c N"f$(n,t)z$(s)LN=n:3170b Xt:n b-bubble sorting routine used on file ln=2LN-1 vt=2LN-1 'f$(t,cn)f$(t+1,cn)3240 q=1c:b$=f$(t,q) f$(t,q)=f$(t+1,q) f$(t+1,q)=b$:q t:n C23692\,R+22:'"  Press  H  to hold display " #n=1LN+1:t=1c f$(n,t);:t:'' ="h"Ŧ="H"3260 n ""3270 A''" Press  ENTER  to go on ":.5,10 a$=:a$=""3280 A$13 3280  7:7:0:  7;" SAVING A FILE " :'" Find and insert a tape on"'" which to save the file." C" Note the tape counter number"'" and connect the MIC. lead." 60,0;" Filename for this DATA ?";w$  w$>10 w$=w$(10 ) c'" Note the following:"''"  FILENAME  ";W$''" ROWS ";R;" COLUMNS ";C;" SPACES ";S B'" FILENAME and TAPE COUNTER are"'" for your reference." I'" The rest you will have to tell me next time you use this file." Y#1;1,0;" Press  ENTER  when ready ":.5,10 a$=:a$=""4100 a$13 4090  w$f$() "h#1;0,0;" Do you want to VERIFY that it has been saved? Press  Y  or  N " ,.5,0 6.23658j\,8:a$=:a$=""41506 @a$="N"4250 Ja$"Y"4140, TM'" If VERIFY fails,you can restartthe SAVE routine by  GOTO 4000 " ^f#1;0,0;" Rewind to start of file, check EAR lead and press  ENTER  " h.5,10 ra$=:a$=""4210r |a$13 4200h " "  w$f$() V#1;0,0;"  E  to end  O  another option " .5,3 .23658j\,8:a$=:a$=""4270 a$="E"600X a$"O"4250   a$=""f=1: f=0:q=1̱a$  a$(q)<"0"a$(q)>"9"f=1 q: PH5200P:N=14:G$:R=07:B:G$+R,B:R:N Z"A",8,12 ,254,255,254,12 ,8,0,"B",16,480,127,255,127,480,16,0 d"C",28,28,28,28,127,62>,28,8,"D",8,28,62>,127,28,28,28,28 n X#1;0,0;" Press ENTER when ready for more":.5,0 a$=:a$=""5310 a$13 5300 @:o=1r:7-o;9 ;f$(1,o,rs);" ";:o '':Q=0: p&"PLACE","DATE","FACE","COST","VALUE" z "UK","1972",".01",".50","2.50" &"FRANCE","1920","5.00","1.25","3.00"  "UK","1965",".10",".25","1.25" ""USA","1920",".25","5.50","7.90" &"GERMNY","1978","3.00","1.25","1.35" '"FRANCE","1965","10.00","2.00","1.95" %"TAHITI","1966","1.05",".50","1.00" ""SWITZ","1980",".30",".05",".05" &"FRANCE","1948","5.00","7.50","8.75"  "UK","1972","1.00",".10",".20" # HPfcPPbGDA LOGIC  /  "LOGIC" (1:1:7:49999O  30 #821,0;" PLEASE WAIT " (<N=19 :G$:R=07:B:G$+R,B:R:N 2"A",28,34",33!,28,62>,63?,63?,31,"B",0,0,0,128,64@,32 ,144,200 7"C",15,7,3,1,0,0,0,0,"D",228,242,250,252,254,126~,62>,28 <~"E",0,480,60<,63?,60<,480,0,0,"F",63?,63?,63?,63?,513,33!,0,0,"G",63?,63?,63?,31,31,31,0,0,"H",255,255,255,255,255,255,0,0,"I",255,255,254,252,248,224,0,0 F@C=0242:0,C;"";1,C;"":C PL=2162:L,0;"";L+1,0;"";L,30-(4L=2)-(2L=4);"";L+1,30-(4L=2)-(2L=4);"":L ZBC=0302:18,C;"";19,C;"":C dq3,20;"";4,20;"";5,3;"LONGMAN SOFTWARE ";6,20;"" n9000(#:9000(# xbA$="COMPUTER":L=7:C=3:9180#:A$="STUDIES":L=10 :C=4:9180# 0:1 140 &N=50000P50023g:Z:N,Z:N m33!,0,64@,17,0,228,1,0,27,237,176,201 m33!,0,228,17,0,64@,1,9 ,27,237,176,201 621,0;" " 50000P :21,0;" SEARCHING AND LOADING " &7:1:20,0; ""  #("DOUBLE HEIGHT" #2&N=5005050129:z:N,z:N #<237,75K,176,92\,121y,254,32 ,568,1,201,120x,254,21,568,1,201,205,158,14,197,6,0,9 ,193 #F229,229,120x,60<,205,158,14,6,0,9 ,209,1,0,7,9 ,235,9 ,229,6,4,126~,18,21,18,21,37%,16,248 #P209,6,4,126~,18,21,18,21,37%,16,248,225,124|,15,15,15,230,3,246,88X,103g,126~,1,32 ,0,9 ,119w,201 #"DOUBLE WIDTH" #&N=5015050241A:z:N,z:N #237,75K,176,92\,121y,254,31,568,1,201,120x,254,22,568,1,201,205,158,14,6,0,9 ,229,14 #8,126~,35#,546,0,6,4,15,568,6,203,14,203,14,24,8,203,14,203,14,203,254,203,246 #16,237,43+,546,0,6,4,15,568,6,203,14,203,14,24,8,203,14,203,14,203,254,203,246,16,237,36$,13 ,32 ,203,225,124|,15,15,15,230,3,246,88X,103g,126~,35#,119w,201 # #23729\,L:n=1̱a$ #23728\,c # l,c;a$(n) #50150 #350050:23728\,c+1:50050 #c=c+2:n $ #(bGI ZPzACOMPUTER@logic >C U@,s@CZ=50012\:75K "Logic" E 1984 MERCURIAN PULP  PRODUCTS/CONTRACT BOOKS  AA$=" LOGIC ":C=3:7:1:23729\,13 (UN=17:23728\,C:13 ,C;A$(N):Z=50150:Z=50050 2723728\,C+1:Z=50050:C=C+2:N "5"180 a$="1"500:300, a$="2"1000:300, a$="3"1500:300, A$="4"2500 A$="5"340T ,a" ":#1;0,0;"  Press  any key  to go on ":.5,0 6a$=:a$=""3106 @ 100d TG1:Z=50012\:21,8;" END OF PROGRAM ": 1:7:0: (1,9 ;" BINARY BITS " a124|,131:128,0:0,-16:-128,0:0,16 LX=14023616:X,131:7;0,-16:X N6,1;" The BYTE ";6,16;"1 0 0 1 1 0 1 0" 0aw$=z$+" In an 8 BIT computer like the Spectrum, every BYTE has 8 BITS - 8 Binary digiITS. " Dtw$=w$+" Every BIT has a reference number. The BIT NUMBERS run from Right to Left and are numbered 0 to 7."+z$ N 5000 Xc4,1;" BIT NUMBERS ":n=07:4,30-2*n;1;n b31,0:4,30-2*n;n:n lfw$=z$+" Every BIT set to ""1"" has a decimal value. This value is 2 to the power of the BIT number." vCw$=w$+" BIT 1 is worth 2^1 = 2. BIT 4 is worth 2^4 = 16."+z$ 45000:9 ,1;"Decimal value" Mn=07:l=9 -(n/2=(n/2)):c=30-2*n 3l,c;2;"^";l+1,c;1;2^n ,1,5:l+1,c;2^n:n ww$=z$+" To calculate the total value of a BYTE, add together the decimal values of each BIT that is set to ""1""."+z$  5000 (12 ,1;" BYTE total " Q12 ,16;1;"^ ^ ^ ^";13 ,15;"128 + 16+8 +2" -1,5:15,18;"= 154" l#1;0,0;" Do you want to see this again? Press  Y  or  N  " .5,10 -23658j\,8:a$=:a$=""750 a$="Y"500 a$"N"740  " ": 1:7:0: )1,9 ;" LOGICAL BITS " a100d,147:128,0:0,-16:-128,0:0,16 LX=116t21216:X,147:7;0,-16:X J4,1;" BYTE A ";4,13 ;"1 0 0 1 1 0 1 0" a100d,123{:128,0:0,-16:-128,0:0,16 $LX=116t21216:X,123{:7;0,-16:X .J7,1;" BYTE B ";7,13 ;"1 1 0 0 1 0 0 1" 8XW$=Z$+" Computers process numbers by testing the logical relations between the BITS ." B7w$=w$+" This testing is done through LOGIC GATES."+z$ L 5000 V 5100 t{W$=Z$+" The results can be classified in a TRUTH TABLE. Different GATES give different values (0 or 1) in the C column." ~{w$=w$+" It is called a Truth Table because in computer logic a bit set to ""1"" is TRUE. A bit set to ""0"" is FALSE."+z$  5000 11 ,16;" TRUTH TABLE ";13 ,14;" BOTH 0 (FALSE) ";15,14;" DIFFERENT (F/T)";17,14;" DIFFERENT (T/F)";19,14;" BOTH 1 (TRUE) " e1200:n=22683X22669X-2:a:n,a:n+96`,a:.5,8:502:n I480,480,40(,32 ,480,40(,480,32 l#1;0,0;" Do you want to see this again? Press  Y  or  N  " .5,10 .23658j\,8:a$=:a$=""1230 a$="Y"1000 a$"N"1220 " ": 1500:T=15 1:1:0: 0T$:0,9 ;" THE ";T$;" GATE " A7:0:L=27:L,1;Z$(9 ):L 3X=16:Y=143:(4000+100d*T) @3,3;"A";5,3;"B";4,8;"C"  5100 "B$="00011011" ,N=14:4,1;1;B$(N*2-1):.5,0:25:1;6,1;B$(N*2) 6P.5,2:C$:25:5,9 ;1;C$:.5,5 @n502:4,1;0;B$(N*2-1);6,1;B$(N*2);5,9 ;C$ J.5,N*2:502:11 +n*2,9 ;8;1;c$:.5,10 :502:11 +n*2,9 ;8;c$:100d:N TFw$:w$=z$+w$+" Watch the BITS being processed by this gate."+z$ ^ 5000 hCl=27:7;0;l,14;z$(18):l r123{,131:0,24:128,0:0,-24:-128,0:0,-16:128,0:0,16 |Cx=13923516:x,155:0,-40(:x u3,14;"A";3,16;"1 0 1 0 1 0 1 0";4,14;"B";4,16;"1 1 0 0 0 1 1 0" ]c$:n=07:6,30-n*2;1;c$(8-n):.5,0 ]6,30-n*2;7-(3c$(8-n)="1");c$(8-n):502:n W$:w$=z$+W$+z$ El=10 20:7;0;l,16;z$(16):l 0:5200P 34050+100d*t:7:0:0 e11 ,17;"A";11 ,30;"B";19,17;0;19,30;4 ֣14,20;3;16,19;5;14,23;1;16,24;7;14,26;2;16,27;6  5000 w$:w$=z$+w$+z$:5000 T=51,6: ^.5,0:#1;1,0;"  N  for next  O  for new Option" .23658j\,8:a$=:a$=""1780 a$="O"t=5:1810 a$"N"1770 t: "AND","0","0","0","1" @"The BIT in C is ""1"" ONLY if both A and B are ""1"" (TRUE)."  "10000010" A" In this example, the AND gate has set BITS 1 and 7 to ""1""." $"BITS 1 and 7 satisfy (A AND B)." "OR","0","1","1","1" B"The BIT in C is ""1"" if EITHER A OR B ( OR BOTH ) are ""1"". "  "11101110" :" Here BITS 1,2,3,5,6 & 7 have all been set to ""1"". " )"BITS 1,2,3,5,6 & 7 satisfy (A OR B) ."  "NAND","1","1","1","0" *" NAND means NOT AND . It gives the inverse of an AND operation. The BIT in C is set to ""1"" unless both A and B are ""1"". " 4 "01111101" >)" BITS 0,2,3,4,5 & 6 are set to ""1""." C."BITS 0,2,3,4,5 & 6 satisfy NOT (A AND B) ." H"NOR","1","0","0","0" R*"NOR is ""NOT OR"" - the inverse of OR." \ "00010001" f7"Only BITS 0 and 4 are set to ""1"" by the NOR gate." k*"Only BITS 0 & 4 satisfy NOT (A OR B) ." p"X-OR","0","1","1","0" z6"X-OR is Exclusive OR . Either A or B but NOT both."  "01101100" $"BITS 2,3,5 & 6 are set to ""1""." 7"BITS 2,3,5 & 6 satisfy (A OR B) but not (A AND B)." 1:7:0: -1,6;" HOW'S YOUR LOGIC ? " a'" This section will test your"'" understanding of LOGIC GATES,"'" and your logical reasoning." '" You start with 8 separate BITS"'" at 4 Logic gates. The outputs"'" from those gates are fed into"'" 2 more, and on to a final gate." F'" Work your way through the gates"'" giving the outputs as you go." '" Would you like me to correct"'" any mistakes as you make them,"'" or would you prefer to plough"'" on to the end before I tell you"'" how you have done?" i2500 :h(7,5):i(8):j(4,2):k(2,2):l$(5,4) n=15:l$(n):n  "AND","OR","NAND","NOR","X-OR" 4N=17:T=14:H(N,T):T:N (16,156,2,1,16,116t,7,1,16,76L,12 ,1,16,36$,17,1 2p100d,132,5,12 ,100d,524,15,12 ,184,92\,10 ,22 Zl#1;0,0;" Press  F  for instant feedback or  W  to Wait till the end " d.5,0 n.23658j\,8:a$=:a$=""2670n x*f=0:a$="F"f=1:2700 a$"W"2660d SC=0 8:N=17:H(N,5)=(*5)+1 EX=H(N,1):Y=H(N,2):(4000+100d*H(N,5)) FH(N,3)-1,H(N,4)+5;6;L$(H(N,5)) N 80P,144:16,-12 :80P,108l:16,8:80P,64@:16,-12 :80P,28:16,8 Ȓ170,124|:4,0:0,-32 :4,0:170,44,:4,0:0,32 :4,0 &N=18:I(N)=(*2) ?M=((N+1)/2):MX=(2N/2=(N/2)) -H(M,3)+MX,H(M,4);5;I(N) N nN=14:A=I(N*2-1):B=I(N*2):3000 +100d*H(N,5):J(N,1)=C an=j(n,1):3600 J(N,2)=A$:n N=56:A=J(N*2-9 ,2):B=J(N*2-8,2):3000 +100d*H(N,5):K(N-4,1)=C "%an=K(n-4,1):3600 ,K(N-4,2)=A$:N 6`N=7:A=K(1,2):B=K(2,2):3000 +100d*H(N,5):AN=C @A3600:F=0SC<73800:C$=Z$:2930r J=R=0SC=7C$=" !! EXCELLENT LOGIC !! " TMR=0SC<7C$=" MADE IT BUT WITH "+(7-SC)+" MISTAKES. " ^5RSC=6C$=" EVERYONE RIGHT EXCEPT THE LAST " h5RSC<6C$="A LITTLE MORE REVISION IS NEEDED" rr#1;0,0;6;0;C$;1,0;"  A  Another go  O  a new Option" |1,0 .23658j\,8:a$=:a$=""2950 a$="A"2650Z a$"O"2940|  C=0:ABC=1 & C=0:ABC=1  C=1:ABC=0  HC=1:ABC=0 R C=0:AB ABC=1  FH(N,3)+1,H(N,4)+8;"?":.5,0 l#1;0,0;" Press  1  or  0  - don't worry you have a 50% chance of error " $a$=:a$=""3620$ .a$"0"a$"1"3610 82" ":r=1:a$=anr=0:SC=SC+1 =FL=R:F=0fl=0 B<h(n,3)+1,h(n,4)+8;FL;4;a$ L F=0 Vr3700t `<t=13:.2~L,0:.2~L,5:t: t2,-20 ~Ah(n,3)+1,h(n,4)+8;1;7;an  A$=(AN): d#1;0,0;"  YOU MADE SOME MISTAKES. I WILL SHOW YOU WHERE. " :N=14:J(N,1)=J(N,2)3850  BH(N,3)+1,H(N,4)+8;1;J(N,1) 5T=15:.25~,-10 :25:T BH(N,3)+1,H(N,4)+8;1;J(N,1)  N :N=12:K(N,1)=K(N,2)3900< RH(N+4,3)+1,H(N+4,4)+8;1;K(N,1) (5T=15:.25~,-10 :25:T 2RH(N+4,3)+1,H(N+4,4)+8;1;K(N,1) <N F A$=C P11 ,30;1;C Z5T=15:.25~,-10 :25:T d!11 ,30;1;C:  |X,Y:20,0:X,Y-16:20,0:X+20,Y+6:0,-28:0,28,3.6ffff (X+38&,Y-8:16,0 " 6 4 @13 ,23;"";14,22;"";15,22;"";16,22;"";17,22;"";18,23;"": h7x,y:20,0:x,y-16:20,0 rkx+16,y+6:0,-28,-1.5@:22,14,1:-22,14,1 |(x+38&,y-8:16,0  4:4460l: 4:41506:1 12 ,20;"";13 ,19;"";13 ,24;"";14,18;"";14,25;"";15,18;"";15,26;"" 16,18;"";16,26;"";17,18;"";17,25;"";18,19;"";18,24;"";19,20;""  |X,Y:20,0:X,Y-16:20,0:X+20,Y+6:0,-28:0,28,3.6ffff Fx+40(,y-8,2:x+42*,y-8:12 ,0   4370 ,7:4:4160@:5200P: <l=10 20:l,16;4;z$(16):l  07x,y:20,0:x,y-16:20,0 :kx+16,y+6:0,-28,-1.5@:22,14,1:-22,14,1 DFx+40(,y-8,2:x+42*,y-8:12 ,0 N b4370:7:4 l12 ,20;"";13 ,19;"";14,18;"";15,18;"" v16,18;"";17,18;"";18,19;"";19,20;"" 1:4700\: kx,y:16,0:x,y-16:16,0:X+12 ,Y+6:0,-28,-1.5@ kx+16,y+6:0,-28,-1.5@:22,14,1:-22,14,1 (x+38&,y-8:16,0  4:4260: \192,71G:16,-16:0,-16:-16,-16:-16,16:0,16:16,16:  q=1̱w$-31 >#1;1,0;7;0;w$(qq+31) 10 :q: D7:0:l=10 20:l,1;z$(11 ):l ?x=1688X24:x,12 :0,80P:x ?y=12 92\16:16,y:72H,0:y  11 ,3;"A B C";13 ,3;"0 0 ?";15,3;"0 1 ?";17,3;"1 0 ?";19,3;"1 1 ?"  Px=16820032 :x,79O:16,0:23,-23:0,-16:-24,-24:-16,0:-23,23:0,16:24,24:x Z H6100:n=14:g$:r=07:b:g$+r,b:r:n ?"a",1,3,7,15,31,63?,127,255,"b",128,192,224,240,248,252,254,255,"c",255,254,252,248,240,224,192,128,"d",255,127,63?,31,15,7,3,1  z b` P\\TSTX-ORB00011011Wr BITS 2,3,5 & 6 satisfy (A OR B) but not (A AND B). tL $d d4 \ +-AND OR NANDNOR X-ORfmacC !! EXCELLENT LOGIC !! # GdA