Section 9.1: The history of assembler programs (Frame 5)                     [prev][home][next]

Just looking at the decimal values is very misleading since they do not show the breakdown in binary. Let's cut and the paste the original program so that it is next to the binary:

0000     0000     0000     0100  |      4   |       LOD     A
0011     0000     0000     0101  |  12293   |       ADD     B
0001     0000     0000     0110  |   4102   |       STD     C
1111     1001     0000     0000  |  63744   |       HLT
0000     0000     0000     0101         5     A:    NUM     5
0000     0000     0000     0111         7     B:    NUM     7
0000     0000     0000     0000         0     C:    NUM     0

The underlined bits represent the opcode of the four instructions. LOD has opcode 0 (see Chapter 7) and ADD has opcode 3. HLT is 248 and STD is 1. Following the opcodes in the first three lines are the operands, which refer to memory cells. Since the program was only four words long, the assembler decided to put the memory word assigned to variable A in location 4, right after the HLT instruction. Since the assembler programmer assigned the initial value of 5 to that, 5 (101) is put into this memory word. Similarly, B is assigned to location 5 and has an initial value of 7, whereas C, assigned to word 6, just has 0. In the LOD, ADD and STD instructions of the program, all references to A are replaced by 4, B is replaced by 5 and C by 6.