Dr. Niall McMahon
Lecture Notes
Table of Contents
CA644, System Software
Dr. Niall McMahon
2022-10-18
If you print these slides, think about using two pages per sheet although don't worry too much about it!
Dr. Niall McMahon
Drawing on previous work by:
Dr. Michael Scriney
Dr. Long Cheng
And sources credited in the references.
Autumn 2022.
----
Levels 1 - 3 are the domain of system programming and system software.
----
The following examples are all adapted from Dodd's excellent book (Computers by K.N. Dodd. Pan Books. 1968).
A 275
S n
- does the opposite.
M n
- equivalent multiplication.
D n
- equivalent division.
R n
- removes result from accumulator and stores it in location n.
E
- indicates complete calculation.
11:Z
12: A 1
13: A 2
14: R 3
15: E
Another program, implementing Dodd's calculator example:
The problem is to multiply 17 by 18, to multiply 19 by 20, to add the results of these two multiplications together and to divide by 2. The program is:
Words 1 - 10 are the working space (or memory).
17 in word 1
18 in word 2
19 in word 3
20 in word 4
2 in word 5
Words 11 - 1000 comprise the main store, i.e. where programs and constants go.
11: Z
12: A 1
13: M 2
14: R 6
15: Z
16: A 3
17: M 4
18: A 6
19: D 5
17: R 7
19: E
z = x(x + y)/(x - (x/y))
Assuming x and y values stored at words 200 and 201.
11: Z
12: A 201
13: D 200
14: R 203
15: Z
16: A 200
17: S 203
18: R 203
19: Z
20: A 200
21: A 201
22: M 200
23: D 203
24: R 202
25: E
To allow program flow control.
J n
K n
L n
M n (m)
J n
- Jump to position n and then proceed to n + 1 and so on.
K n
: Jump to position n if number in accumulator is positive or zero.
L n
: Jump to position n if number in accumulator is zero.
M n (m)
: address becomes n + C(m).
11: I 1
12: I 2
13: I 3
14: I 4
15: I 5
16: I 6
17: Z
18: A 5
19: S 6
20: S 1
21: K 27 - so if value in accumulator is negative go to 22, else 27
22: A 1 - Add back the 5000 (it's less than 5000)
23: M 3 - multiply the income by 0.2
24: R 6 - Store it in 6
25: 0 6 - Output balue in 6
26: J 15 - go back to 15 (next person)
27: M 4 - Multiply the excess by 0.4
28: A 2 - Add this to the amount of tax payable on the first 5000 (0.2 * 5000)
29: J 24 - Jump back to 24
5000
1000
0.2
0.4
In these examples, instructions can be represented by 20 digits.
If we take an instruction, A 37 (6)
, the instruction can be written using the encoding that takes the form of an order part A
, followed by the modification part 6
, followed by the instruction part, 37
.
If we use a 5-bit encoding for characters, e.g.
00000 blank
00001 1
00010 2
00011 3
00100 4
00101 5
00110 6
00111 7
01000 8
01001 9
01010 0
01011 ,
01100 .
01101 :
01110 (
01111 )
10000 /
10001 Z
10010 A
10011 S
10100 M
10101 D
10110 R
10111 E
11000 i
11001 o
11010 J
11011 K
11100 L
11101
11110
11111
Then A 37 (6)
can be written as,
10010 00110 0000100101 A (6) 37
So, 5 bits, 5 bits, 10 bits.
This is equivalent to an ISA.
We did not go into more detail about other levels, but in Dodd's examples, the lower hardware level(s) are built with transistors at the foundation level, grouped into AND and OR gates, Inverters and Flip-Flops. These are combined to make storage (registers), addition and subtraction units. Using a system clock, data can be moved and combined to create software at higher levels, i.e. the ISA outlined above.
© Copyright 2022. Please contact Niall McMahon for more.