You are on page 1of 3

Sheet (3.

2)
1- Complete the following statements
a- In assembly language, adding the prefix @ to the operands indicates that
……….. mode is used, and adding the prefix + to the operation code
indicates that ……………….. must be used.
b- The SIC/XE instructions that refer to memory are normally assembled using
either the ………….. relative or the ……… relative mode.
c- The main differences between the SIC/XE instructions and SIC instructions
are …………. instructions, ……….. addressing, and ………… addressing.
d- If the displacement calculated by assembler is too large to be fitted in 12 bits
…………… must be used.
e- The assembly programmer can use the directive ………… to inform the
assembler that the contents of the base register can no longer be relied upon
for addressing.

2- Consider the following code.

Line Location Source statement Object code


10 0000 FIRST STL RETADR 17202D
12 1003 LDB #LENGTH 69202D
13 BASE LENGTH
15 0006 CLOOP +JSUB RDREC 4B101036
.
.
.
95 0030 RETADR RESW 1
100 0033 LENGTH RESW 1
105 0036 BUFFER RESB 4096
.
.

1
.
125 1036 RDREC CLEAR X B410
.
.
.
160 104E STCH BUFFER,X 57C003

a- Given that the instruction of line 10 is neither indirect nor immediate


addressing , explain why the object code of this line is 17202D.
b- What is the value of bit e in the instruction of line 15?
c- Why is extended format used in line 15?
d- What is the addressing mode used for the instruction of line 160? And why?

2
Answer
1-
a- Indirect addressing, extended format (format 4).
b- program-counter, base.
c- register-to-register, immediate, indirect.
d- Extended instruction format (format 4).
e- NOBASE.

2-
a- Since PC contains the address (0003) and RETADR is assigned the address
(0030), then the displacement is 30 – 3 = 2D (in hexadecimal). Since bit p =
1 as PC relative addressing is used then the last 2 bytes of the instruction is
202D. Since indirect and immediate addressing are not used then bits n and I
are both set to 1, and this makes the first byte 17 rather than 14.
b- 1.
c- Because the address is too large to be fitted in 12 bits.
d- The base relative is used as PC relative addressing is not used because the
displacement (from PC) equals 54-4177 = -4123 (in decimal), and this value
is out of the range (-2048 to 2047).

You might also like