2590:3 2590:4

Module #6, the skip tape file subroutine.

Initialize FLAG. If FLAG=1 program flow is altered in line 2590.

The tape file is read by the INPUT#-1 statement but Z1 $ and Z2$ are dummy variables. "Q" is the signal to abort tape read. See line 2560. Module #7, the heading type I subroutine.

Note that expressions within the line are separated by semicolons. This indicates that no space should separate individual expressions.

Module #8, the heading type II subroutine.

Module #19, the single key Y/N subroutine.

Note use of "N" and "Y". No other entry except "N" or "Y" is accepted. C$ is tested in line 3180. Module #9, the Cassette Ready subroutine.

The appropriate messages have been printed on the video screen. Any keyboard entry will return program to lines 2010 or 2510.

Module #10, the select question subroutine. A random number is selected in the range 1-N.

If the total number of responses is greater is less than or equal to 5 then I is selected.

If the number of responses is greater than 5 but the number of incorrect responses is too great the question is repeated.

If questions and answers are to be mixed (MIX=1) then J1 is set at random to 1 or 2.

If J1 = 1 then J2 becomes 2 vice versa. The INT statement truncates 1/2+1 to 1 but preserves 1 + 1=2.

Module #11, the delay loop subroutine.

Simple loop runs for 300 iterations and returns. Used in lines 3230 and 3250. Module #12, the initialization of answers subroutine.

It is good practice to make sure that the initial values of all variables are precisely the values you expect. Failure to properly initialize variables is a common programming error which may not become apparent until the results of a computation are examined. Used in line 3010. Module #13, the prepare for scores subroutine.

Since ANS(I,1) and ANS(I,2) were initialized for convenience at +1, this amount must be subtracted in order to compute scores. Used in line 3290. Module +14, the enter or edit a drill subroutine. Define TITLE$.

Print type I heading (G0SUB500).

If a title is already known and stored in $H, then print the title.

If there is no current title, acquire it in the subroutine at line 350.

If title of exercise was just acquired and is stored in $A then transfer it to $H.

Set up loop over the range of MX.

Print type I header (GOSUB500) and messages.

Initialize A$ to null string (""),

If there is no keyword or the keyword is to be changed, call subroutine at line 350. Note in line 380 that the "ENTER" key returns the program to line 1090:4 where the acquird information is placed in A$. If new material is present in A$, transfer it to A$(l,1). Note that A$ and A$(I,J) are different variables. If A$(l,1) is the "end" signal, prepare to exit at line 1160. Acquire A$(l,2) in a similar manner. Terminate loop.

Decrease number of stored questions in A$(l,1) by 1. This in effect deletes the "end" message.

Store the current number of questions in N and return.

Module +1 5, the save a drill to tape subroutine.

Define TITLE$, print cassette messages and type 1 heading.

This is probably the most important statement in the subroutine. PRINT+-1, is the write-to-tape statement. The information which follows constitutes the tape label. Tape labels are essential for the orderly operation of a computer and for the interchange of data and programs. The TRS-80 has standard tape labels for BASIC and SYSTEM programs. You should adopt a standard method of labelling your own data tapes. The label in this program consists of a concateration string containing the name of the drill followed by the number of questions (N).

The quotation marks (ASCII character 34) are necessary so that when reading the taped title, the program will recognize the data as a string variable.

Set up loop to write to tape N questions and answers.

Write questions and answers to tape.

Print questions and answers on video screen using format F3$. (See line 90:4).

Call the delay subroutine to allow time for final computer book-keeping and switching and return.

Module #16, the input a drill from tape subroutine.

Print instructions.

Print additional directions and call subroutines.

Read tape label from tape and print the contents (H$,N) on the screen.

This is a nested IF statement to check if title of tape (H$) is the same as the one stored in A$. Note that the desired title was acquired as IN$ in line 2560:3 (GOSUB350) and transferred to A$ in line 2560:4. If the titles do not match, skip the e GOSUB440). If FLAG=0 continue

2600 If A$=H$ the program will "fall through" the logic statements (2590) and the file name will be printed.

2610 Set up loop to read N questions and answers; read them and for each, print at screen position 896,1 and N

embedded in format F4$. See line 100. Note carefully all punctuations!!

3000-3270 Module #17, the run drill subroutine.

3000-3110 Print instructions and hold screen at end of first page.

3120-3190 Continue directions, test for mix option (3170-3180).

3200:1 Select a question (GOSUB650).

3200: Print question.

0 0

Post a comment