Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50141/tutr15.bas
There are 2 other files named tutr15.bas in the archive. Click here to see a list.
00001REM   TUT15
00100PRINT"EGAD - YOU AGAIN?   WHAT PERSEVERANCE."
00110PRINT
00120PRINT"IN THE PAST SESSIONS WE HAVE DEALT PRIMARILY WITH STATEMENTS"
00130PRINT"AND INSTRUCTIONS WHICH DETERMINE THE LOGIC OF A PROGRAM."
00140PRINT"A SYSTEM COMMAND, AS DISTINCT FROM A PROGRAM INSTRUCTION,"
00150PRINT"REQUESTS A CHANGE IN YOUR CURRENT STATUS WITH THE COMPUTER.  FOR"
00160PRINT"EXAMPLE, THE SYSTEM COMMAND 'RUN' DIRECTS THE COMPUTER TO"
00170PRINT"EXECUTE A PROGRAM.  IN NO WAY CAN IT AFFECT THE LOGICAL"
             00180PRINT"STRUCTURE OF THE PROGRAM."
00190PRINT
00200PRINT"TO SEE IF THIS DISTINCTION IS REASONABLY CLEAR, TRY YOUR HAND"
00210PRINT"AT THE FOLLOWING.  TYPE A ZERO IF YOU THINK A SYSTEM COMMAND IS"
00220PRINT"INVOLVED, AND A ONE FOR A PROGRAM INSTRUCTION."
00230PRINT
00240LETS=0
00250LETT=0
00260LETH(1)=1
00270LETH(2)=1
00280LETH(3)=0
00290LETH(4)=1
00300LETH(5)=0
00310LETH(6)=0
00320LETH(7)=1
00330LETH(8)=1
00340LETH(9)=0
00350LETH(10)=0
00360PRINT" "," ";"        BATTING AVERAGE"
                                      00370PRINT
00380PRINT"GOSUB ";
00390GOSUB600
00400PRINT"DEF ";
00410GOSUB600
00420PRINT"GOODBYE ";
00430GOSUB600
00440PRINT"IF...THEN... ";
00450GOSUB600
00460PRINT"HELLO ";
00470GOSUB600
00480PRINT"OLD ";
00490GOSUB600
00500PRINT"LET ";
00510GOSUB600
00520PRINT"INPUT ";
00530GOSUB600
00540PRINT"BASIC ";
00550GOSUB600
00560PRINT"LIST ";
00570GOSUB600
00580GOTO710
00590 R E M SUBR
00600LETT=T+1
00610INPUTZ
00620IFZ=H(T)THEN650
00630PRINT" ","    OUT",
00640GOTO670
00650PRINT" ","    HIT",
                                                     00660LETS=S+1
00670LETB=INT(S/T*1000+0.5)
00680PRINTB
00690RETURN
00700 R E M END SUBR
00710PRINT
00720IFB>850THEN760
00730IFB>600THEN780
00740PRINT"YOUR BATTING AVERAGE WAS .....NEVER MIND.   TENNIS ANYONE?"
00750GOTO790
00760PRINT"THE DODGERS COULD HAVE USED YOU LAST SEPTEMBER."
00770GOTO790
00780PRINT"HOW ARE YOU AT PING PONG?"
00790PRINT
00800PRINT"--NOTE-- A PROGRAM INSTRUCTION MUST BE PRECEEDED BY A STATEMENT"
00810PRINT"NUMBER -- A SYSTEM COMMAND  IS NEVER PRECEEDED BY ONE."
00820PRINT
                                                                    00830PRINT
00840PRINT"LET'S SEE HOW SOME OF THESE SYSTEM COMMANDS CAN BE USED.  ASSUME"
00850PRINT"THE FOLLOWING IS PART OF A PROGRAM BEING DEVELOPED:"
00860PRINT
00870PRINT"    ."
00880PRINT"    ."
00890PRINT"   410 GOSUB 800"
00900PRINT"   420 LET T=T+T1"
00910PRINT"   430 LET T=T+T1"
00920PRINT"   440 LET D=V*T"
00930PRINT"    ."
00940PRINT"    ."
00950PRINT"   800 LET Q=C1*V^2"
00960PRINT"   810 LET R=K*D"
00970PRINT"   820 END"
00980PRINT
00990PRINT"UPON EXAMINATION, YOU MAY NOTE THAT STATEMENT 430 IS REDUNDANT."
   01000PRINT"YOU COULD DELETE THIS BY MERELY TYPING IN THE STATEMENT NUMBER,"
01010PRINT"THEN DEPRESSING THE CARRIAGE RETURN.  THE COMPUTER INTERPETS"
01020PRINT"THIS AS AN ERASURE OF THE PREVIOUSLY WRITTEN STATEMENT 430."
01030PRINT
01040PRINT"THERE IS ALSO A STATEMENT MISSING FROM THE SAMPLE PROGRAM ABOVE,"
01050PRINT"WITHOUT WHICH THE PROGRAM WOULD NOT RUN. JUST FOR EXERCISE,"
01060PRINT"TYPE IN THE 2 STATEMENT NUMBERS (SEPARATED BY A COMMA) WHERE"
01070PRINT"THE MISSING STATEMENT SHOULD HAVE BEEN.";
01080LETZ=0
01090INPUTB,T
                                                                   01100PRINT
01110IFB+T=1630THEN1190
01120IFZ>0THEN1170
01130LETZ=1
01140PRINT"NO.  I'LL GIVE YOU A HINT.  THE SUBROUTINE IS INCOMPLETE."
01150PRINT"TRY TO GUESS THE 2 NUMBERS AGAIN.  ";
01160GOTO1090
01170PRINT"REALLY,NOW...";
01180GOTO1200
01190PRINT"VERY GOOD.   ";
01200PRINT"A 'RETURN' STATEMENT WAS OMITTED FROM THE"
01210PRINT"SUBROUTINE, WHICH SHOULD BE INSERTED BETWEEN STATEMENT NUMBERS"
01220PRINT"810 AND 820.  YOU COULD CORRECT THIS BY TYPING IN:"
01230PRINT
01240PRINT"   815 RETURN"
01250	PRINT
01260PRINT"DO YOU SEE THE ADVANTAGE OF NUMBERING YOUR STATEMENTS"
01270PRINT"INCREMENTALLY?  IT'S EASIER TO INSERT STATEMENTS AT A LATER"
01280PRINT"TIME WITHOUT NEEDLESS RETYPING OF NEIGHBORING STATEMENTS."
01290PRINT
01300PRINT"IF YOU WERE CORRECTING A PROGRAM, YOU WOULD SOON REALIZE THAT"
01310PRINT"YOU HAVE A HOPELESS RECORD OF YOUR WORK, AND WOULD"
01320PRINT"LIKE A FRESH UPDATED LISTING."
01330PRINT
01340PRINT"THE SYSTEM COMMAND 'LIST' WILL SUPPLY THIS FOR YOU, STARTING"
01350PRINT"FROM THE VERY FIRST STATEMENT OF YOUR PROGRAM.  SHOULD YOU"
       01360PRINT"WANT A LISTING STARTING FROM A SPECIFIED STATEMENT NUMBER,"
01370PRINT"FOR EXAMPLE 1280, YOU SHOULD TYPE "
01380PRINT
01390PRINT"   LIST  1280"
01400PRINT
01410PRINT"NOTICE THAT THERE ARE TWO BLANKS BETWEEN THE COMMAND AND THE"
01420PRINT"NUMBER."
01430PRINT
01440PRINT"WE'LL PRACTICE ON A TEST PROGRAM CALLED 'TEST*'."
01450PRINT
01460PRINT"HERE ARE SOME OF THE THINGS I WOULD LIKE YOU TO DO AFTER YOU"
01470PRINT"CALL IN THE TEST PROGRAM:"
01480PRINT"   (1) TYPE THE WORD 'LIST'.  YOU WILL THEN GET A LISTING."
       01490PRINT"   (2) TYPE 'LIST  30'. REMEMBER THE TWO BLANKS."
01500PRINT"   (3) TYPE 'LIST 30', USING ONLY ONE BLANK TO SEE WHAT"
01510PRINT"       WILL HAPPEN."
01520PRINT"   (4) TRY DELETING ANY ONE OF THE STATEMENTS, AS DISCUSSED"
01530PRINT"       IN THE EXAMPLE ABOVE.  AFTER YOU HAVE DELETED THE"
01540PRINT"       STATEMENT, AGAIN TYPE 'LIST' TO SEE IF YOU HAVE BEEN"
01550PRINT"       SUCCESSFUL."
01560PRINT"   (5) TYPE 'OLD' TO GET 'TEST*' BACK AGAIN IN IT'S"
01570PRINT"       ORIGINAL FORM.  THEN TYPE THE FOLLOWING:"
                 01580PRINT"           ' RESEQUENCE 120,2'"
01590PRINT"       AFTER THE '*' APPEARS, LIST THE PROGRAM TO SEE"
01600PRINT"       WHAT EFFECT THIS COMMAND HAD."
01610PRINT"   (6) TYPE 'OLD' TO GET PROGRAM 'TEST*' BACK AGAIN"
01620PRINT"       THEN TYPE THE FOLLOWING:"
01630PRINT"           ' DELETE 30,80'"
01640PRINT"       AGAIN, AFTER THE '*', LIST THE PROGRAM."
01650PRINT
01660PRINT"WHEN YOU ARE THROUGH, COME BACK TO THE NEXT SEQUENCE IN THIS"
01670PRINT"SERIES, THE PROGRAM CALLED 'TUTR16'. SEE YOU SOON."
                 01680END