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

2 MODIFICATION, COUNTING AND TESTING

See Chapter 4

Exercises

Any constants required such as a zero in the clearing operations of numbers (11) - (14) should be stored and labelled.

Answers: Modification, Counting and Testing

(1) 121 0 0 99113 1 1 A4203 127 1 -1*
(2) 324 0 0 -1P26A10 121 1 0 -2P261) 362 0 1 A10 203 127 1 A1
(3a) 121 1 0 13P17121 2 0 0104 2 1 A17102 2 1 Y4A17203 127 1 -2*113 2 0 A49
(3b) 121 6 0 A17101 2 6 0152 2 6 Y4221 127 6 -2*
(4) 346 0 0 0121 1 0 60320 0 1 54122 1 0 6215 127 1 -2*
(5) SOLUTIUON 1 121 2 0 0 121 1 0 1D16) 124 2 1 0 113 0 2 0 172 1 0 99D1 220 127 1 A6

SOLUTION 2

This solution illustrates a technique that is sometimes useful, namely direct address modification. Thus the instruction

     114     1    0     -Y4*

adds b1 into the address part of the previous instruction. The last instruction restores the address part of the directly modified 113 instruction to its original state.

121 1 0 1D16) 113 0 1 0 114 1 0 -Y4* 172 1 0 99D1 220 127 1 A6 113 0 0 Y4A6
(6) 1312 5 5 0 121 7 0 -1P71) 1312 6 6 0 203 127 7 A1 1314 1 2 0 124 1 0 1 113 1 0 A6
(7) 121 1 0 0121 6 0 P41104 1 6 A61304 1 12 0203 127 6 -2*
(8) 121 1 0 -A77A90 121 30 0 06) 101 2 1 A77 122 2 0 P13 216 127 2 2* 124 30 0 1 202 127 1 A6
(9) 121 90 0 A131) 101 1 90 0 172 1 90 0 221 127 90 A1
(10) 10) +0 346 0 0 J4 121 80 0 -99D13) 101 1 80 A1+99D1 1524 0 1 0 101 1 80 A2+99D1 1574 0 1 0 320 0 0 A10 356 0 0 A10 200 127 80 A3 1300 3 0 A10
(11) 346 0 0 J4121 1 0 -99356 0 1 99A3201 127 1 -1*
(12) 346 0 0 J4121 1 0 -1P7356 12 1 0203 127 1 -1*
(13) 346 0 0 J4 121 1 0 9D15) 101 2 1 A1 122 2 0 1 101 3 1 A2 356 2 3 0 203 127 2 -1* 202 127 1 A5
(14) 121 1 0 999 121 2 0 -Y4 121 3 0 11) 124 2 0 Y4 150 3 2 A7 225 127 0 A1 113 0 2 A7 203 127 1 A1
(15a) 121 1 0 0 121 2 7 01) 104 1 2 0 101 2 2 0.4 172 2 7 0 225 127 0 A1 113 0 0 A3
(15b) 121 1 0 0 121 2 0 A131) 101 3 2 0 113 3 1 A12 101 2 2 0.4 172 2 0 A13 220 127 1 A1

(16a) Two solutions are given here. In the first, which requires 3n2 + 12n + 10 instructions, the inner loop evaluates each ck in turn and the sum c0 + .......ck is accumulated in the outer loop. The second solution requires 1 + 8n instructions and is based on the observation that the sum of the ck's is also given by the formula

anb0 + a1 (b0 + b1) + .... + a0 (b0 + b1 + ... bn)

If n=20, the first solution takes 1450 instructions, whilst the second solution takes 161 instructions.

SOLUTION 1

40) +0 121 1 0 P76) 121 2 0 -1 121 3 1 05) 124 2 0 1 324 0 2 A1 362 0 3 A2 320 0 0 A40 356 0 0 A40 203 127 3 A5 203 127 1 A6

SOLUTION 2

40) +041) +0 121 6 0 P7 121 7 0 -15) 124 7 0 1 324 0 0 A41 320 0 7 A2 356 0 0 A41 362 0 6 A1 320 0 0 A40 356 0 0 A40 203 127 6 A5Accummulate partial sum,P of the b's(A40)' = (A40) + aP

Notice the similarity of the above solution to the conventional method of polynomial evaluation:

ax3 + bx2 + cx + d = d + x (c + x (b + ax))

(16b) 13) +014) +1 324 0 0 P7A1 320 0 0 P7A2 121 1 0 -1P7 217 127 1 A1110) 356 0 0 A13 324 0 0 A14 374 0 0 A13 362 0 1 A2 320 0 1 A1 203 127 1 A1011) 356 0 0 A3Accummulate partial sum,P of the b's(A40)' = (A40) + aP
⇑ 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