Section 11.3: Approaches to Relocation (Frame 1)                     [     ][home][next]

In Fig. 11.3.1 a small CSC-1 program that adds up elements of an array is shown. This version uses mnemonic opcodes but no symbolic labels. Instead, absolute addresses are given. The numbers to the left are only for reference, showing where in memory these instructions would be placed:

0:    LOD   1000
1:    ADD   1001
2:    SUB   1002
3:    STD   1003
4:    LOD   2000
5:    SHL
6:    SHL
7:    ADD   1003
8:    STD   1000
9:    (gap)
1000: NUM   47
1001: NUM   3
1002: NUM   149
1003: NUM   0
      (gap)
2000: NUM   99

Fig. 11.3.1: CSC-1 program to compute a = a+b-c+d*4