Java Reference
In-Depth Information
Table 5.4 Sum program
Loc.
Content
Type
Description
0
code
Load the content of location 5 into register A
LOADA 5
1
code
Load the content of location 6 into register B
LOADB 6
2
code
Sum the two registers and put the result into register A
ADD
3
code
Store the value of register A in memory location 7
STOREA 7
4
code
Terminate the program
HALT
5
data
The first number to be summed
123
6
data
The second number to be summed
432
7
data
This cell will contain the result of the sum
0
Table 5.5 Test program 2
Loc.
Content
Type
Description
0
LOADA 13
code
Load content of location 13 (loop index) into register A
1
JUMPZ 12
code
If register A is zero jump to location 12 (end)
2
LOADB 14
code
Load content of location 14 (loop index increment) into register B
3
ADD
code
Add register A and register B (loop increment)
4
STOREA 13
code
Store the contents of register A in location 13
5
LOADB 15
code
Load content of location 15 (base address) into register B
6
ADD
code
Sum register A and register B
7
STOREA 16
code
Store the content of register A in location 16
8
LOADA 17
code
Load the content of location 17 (fixed value) into register A
9
LOADB 16
code
Load location 16 (address of location to be filled in) into register B
10
MOVEAB
code
Store value in register A in location whose address is in register B
11
JUMP 0
code
Jump to location 0 (the first of the program)
12
HALT
code
Terminate execution
13
12
data
Loop index
14
0 1
data
Loop increment
15
20
data
The lower address to fill in with fixed value
16
0
data
Contains the current address of the location to be filled in
17
99
data
The fixed value with which to fill in the locations
18
0
data
Empty cell
19
0
data
Empty cell
20
0
data
Will be filled in with the fixed value
21
0
data
Will be filled in with the fixed value
22
0
data
Will be filled in with the fixed value
23
0
data
Will be filled in with the fixed value
24
0
data
Will be filled in with the fixed value
25
0
data
Will be filled in with the fixed value
26
0
data
Will be filled in with the fixed value
27
0
data
Will be filled in with the fixed value
28
0
data
Will be filled in with the fixed value
29
0
data
Will be filled in with the fixed value
30
0
data
Will be filled in with the fixed value
31
0
data
Will be filled in with the fixed value
 
Search WWH ::




Custom Search