Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ ContentsIntroduction0. Introductory exercises1. Basic operations2. Modification, counting and testing3. B-register operations4. Accumulator operations5. Extracode functions6. Input and output operations7. Magnetic tape operations8. Advanced programming techniques9. Complete programs
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLLiteratureAtlas manualsABL Exercises :: ATLAS 1 COMPUTER ABL PROGRAMMING EXERCISES
ACLLiteratureAtlas manualsABL Exercises :: ATLAS 1 COMPUTER ABL PROGRAMMING EXERCISES
ACL ACD C&A INF CCD CISD Archives
Further reading

Contents
Introduction
0. Introductory exercises
1. Basic operations
2. Modification, counting and testing
3. B-register operations
4. Accumulator operations
5. Extracode functions
6. Input and output operations
7. Magnetic tape operations
8. Advanced programming techniques
9. Complete programs

6 INPUT AND OUTPUT OPERATIONS

See Chapter 8

LIBRARY ROUTINES L1 and L100 should be used and only questions 9 and 11 should be treated as complete programs.

(1) Read a floating point number from input stream 1 and output its modulus in fixed point form, on a new line, on output stream 1. The number is less than 100 and is required to two decimal places.

(2) Read ten mixed numbers from input stream one to the store locations starting at word 10000.

(3) Modify the solution to example 2 so that n numbers are read, where n is an integer at the head of the data.

(4) Output the floating point numbers stored in locations 550 to 577 inclusive, in floating point form to 7 significant figures, each number on a new line. Use output two.

(5) Search the information on input stream 2 ignoring everything until the letter X (internal code 7.0) is encountered. Then read the following number to the accumulator and arrange that any further information on this line is ignored.

(6) Output the 20 numbers stored in word 512 onwards, five per line, in signed fixed point form, separated by at least two spaces. The numbers are less than 1000 and are required to four decimal places. Use output stream one.

(7) Input stream 1 consists of a set of numbers of the order 105 terminated by -1 (which does not form part of the set). Form the sum of these numbers and print it, preceded by the number of numbers read. End output on this line.

(8) How could the solution to example 7 be modified to accept * (internal code 1.6) as the terminator? Set any parameters required by L100.

(9) Read a set of 10 numbers from input stream 6, For each number x, output x on a new line, followed by sqrt(x). If x is negative, replace sqrt(x) by the letter I (internal code 5.1). Output should be in floating point form to five significant figures. Arrange to separate the exponent from the mantissa by a comma instead of enclosing it in brackets.

(10) Write a subroutine, R2, to evaluate sine θ and cosine θ given (in degrees) in the accumulator on entry. Store the functions in A99/0 and 1A99/0 respectively. (Use B50 for the link and make use of the extracodes 1730, am' = sin s and 1732, am' = cos s where s must be in radians. π = 3.141593).

(11) Use this routine to tabulate sine θ and cosine θ for θ at 10° intervals between 0° and 180°. Print θ as a three digit unsigned integer and sine θ, cosine θ as five digit fractions preceded by + or -. Ensure there are two spaces between each number and use output three.

(12) Print, on output zero, the character ≠. Output zero is a 7 hole paper tape punch, Write out the contents of B81 in binary just before exit to L1.

(13) Store the text:-

TAPE FAULT φ ≠ 7

in successive character locations in the store. Put the address of the first character in B21 and the number of characters in B22.

(14) In question 11, assuming output to be to 7 hole paper tape, arrange for the columns to be headed sin θ, cos θ respectively.

(15) Adapt the program of question 9 to read a title of one line from immediately before the first x on the data tape and to print it, followed by 13 new lines, after the last sqrt(x).

For the following examples use input and output extracodes.

(16) If input 5 is at the end of the current record read the first character of the next record; if not read the next character. Store it in the least significant 6 bits of halfword A10 if it is a six bit character or A11 and 0.4A11 if it is a binary character.

(17) Delete all previous output 4. Write the binary representation of M on 7 hole paper tape to Output 4, end the record and arrange for printing as soon as possible.

(18) Read a record (not binary) from input 3 and write it to output 5 unless there are more than 12 characters. In this case write the first 12 only and do not end the record. What alterations would be necessary to end the record in the latter case with 5 new lines?

Answers: 6 Input Output Operations

(1)

1050 0 0 1 121 90 0 A1 121 127 0 A1/L1001) 121 90 0 A2 1060 0 0 1 121 89 0 2:2.6 1767 0 0 J4 121 127 0 A1/L12)Select inputSet linkRead next numberSet linkSelect outputSet styleModulusPrint accumulator(Next instruction)

(2)

1050 0 0 1 121 3 0 -95) 1362 0 0 A1/L100 356 0 3 1009 201 127 3 A5Select inputSet countRead next numberStore numberCount and repeat

(3)

1050 0 0 1 1362 0 0 A2/L100 121 2 81 -1 123 3 2 05) 1362 0 0 A1/L100 356 2 3 1000 201 127 3 A5Select inputRead nRead next numberStore numberCount and repeat

(4)

1060 0 0 2 121 1 0 -27 121 89 0 1:6.3 121 90 0 3*1) 324 0 1 577 121 127 0 A1/L1 201 127 1 A1

(5)

1050 0 0 22) 1362 0 0 A3/L100 122 81 0 7.0 215 127 81 A2 1362 0 0 A1/L100 1362 0 0 A4/L100Select inputRead next characterRepeat unless characteris "X"Read next numberLose rest of line

(6)

1060 0 0 1 121 89 0 5:4 121 2 0 0 121 1 0 -191) 203 127 2 A2 121 2 0 4 1362 0 0 A4/L12) 324 0 1 1:19 1362 0 0 A1/L1 201 127 1 A1Select outputSet styleTerminate recordPrint number

(7)

1) +12) +0 1060 0 0 1 1050 0 0 1 121 1 0 13) 1362 0 0 A1/L100 320 0 0 A1 234 127 0 A4 320 0 0 A2 321 0 0 A1 346 0 0 A2 201 127 1 A34) 121 81 1 -1 121 88 0 3:0.2 1362 0 0 A2/L1 324 0 0 A2 121 89 0 6:3.0 1362 0 0 A1/L1 1065 0 0 2.1Partial sumRead next numberAdd one to itJump if accumulator = 0Add in partial sumSubtract oneStore new partial sumCount and repeatCount of numbers (n)Print nPrint sumNew line

(8)

Omit the instructions in store locations A1, 1A3, 2A3, 4A3. Replace "4)" by "21/L100".

(9)

A28/L1 = 1.2 A29/L1 = 0.1 1050 0 0 6 121 1 0 91) 1362 0 0 A1/L100 121 89 0 1:4.3 346 0 0 A3 1362 0 0 A1/L1 237 127 0 A2 1710 0 0 A3 121 89 0 1:4.1 1362 0 0 A1/L1 203 127 1 A1 1117 0 0 02) 1064 0 0 5.1 121 127 0 -2A23) +0 E-2A1Comma instead of "("Space instead of ")"Read numberPrint numberPrint square rootEndPrint "I"

(10)

R21) 374 0 0 A2 362 0 0 A3 346 0 0 A4 1730 0 0 A4 346 0 0 A99/0 1732 0 0 A4 346 0 0 1A99/0 121 127 50 02) +1803) +3.1415934) +0 ZConvert to radiansStore sin thetaStore cos thetaReturn via link

(11)

A25/L1 = 3.51) -10, 99)+0, +0, 2)+10 1060 0 0 3 121 1 0 183) 324 0 0 A1 320 0 0 A2 356 0 0 A1 121 89 0 3:0.6 1362 0 0 A1/L1 1101 50 0 A1/2 121 89 0 2:5 324 0 0 A99 1101 90 0 A1/L1 324 0 0 1A99 1362 0 0 A1/L1 203 127 1 A3 1117 0 0 0 [Subroutine R2] E1A2Print plus ratherthan spacePrint thetaJump to subroutinePrint sin thetaPrint cos thetaCount and repeatSubroutine inserted here

(12)

121 81 0 J2K701.7 1362 1 0 A3/L1 or 121 90 0 J2K363.4 1362 0 1 A3/L1 010,000,000,000,111,000,001,111 or 010,000,000,000,011,110,011,100

(13)

7) TAPE FAULT φ ≠ 7 121 21 0 A7 121 22 0 P123

(14)

Any time before label 3) write T3 (Sp)θ(3 sp) sin θ(5 sp) cos θ

(15)

After 1050 0 0 6 add 121 89 0 A4 1362 0 0 A6/L100 Read textAfter 203 127 1 A1 add 121 89 0 A4 1101 90 0 A6/L1 Write text 1065 0 0 3.5 Write 13 N.L.'sthen label the enter directive thus:-4) E-2A1 This means that the text will be stored immediately after the program

(16)

1050 0 0 52) 1053 127 0 A1 1054 1 0 A2 113 1 0 A10 121 127 0 A31) 1054 1 0 A2 113 1 0 A11 1054 1 0 0 113 1 0 0.4A113) [Next Instruction]Select input 5If binary jump to 1)b1=char, jump if c.c.c.b-=char, jump if c.c.c.Read to b1

(17)

1063 0 0 42) 1060 0 0 4.1 1064 0 0 0.1 1064 0 0 3.5 1065 0 0 2.11) 1071 0 0 4Delete output 4Select binary outputNewlineBreak output

(18a)

1050 0 0 3 1060 0 0 5 1057 5 0 A3 170 5 0 1.4 227 127 0 A1 1067 5 0 A3 121 127 0 A21) 121 5 0 1.4J4 1066 5 0 A32) [Next Instruction] = Read record to A3Jump to 1) if more than12 characters readWrite complete recordJump to 2)Reset b5Write only 12 chars

(18b)

Before instruction 2) write 1065 0 0 2.5 = Output 5 N.L.'s
⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site