Uploaded by Nayab Irfan

COALasgmnt1

advertisement
Assignment#1
COAL
F23
This assignment will be marked on the basis of VIVA.
____________________________________________________________________________
Question#1
The values of various registers before executing each of the following instructions are as
follows:
DS:0x1AB0 SI:0x0014 DI:0x0002 BP: 0x0110 SS:0x08C0
AX:0xACBD BX:0x012C CX:0xFEDC DX:0x3120
a) Execute the following instructions and update the registers and memory accordingly.
Also, calculate the physical addresses in the hexadecimal number system. (10 Marks)
Instructions
MOV [BX], CX
MOV [BP+SI], DX
MOV AX, [BX+DI]
MOV [DI+6], CX
MOV DX, [0x0100+SI]
Memory
0x
0
0x1AB0
0x1AB0
0x1AB0
0x1AB0
0x08C0
0x08C0
0x08C0
:
:
:
:
:
:
:
0x
1
0x
2
0x0000
0x0100
0x0110
0x0120
0x0100
0x0110
0x0120
Physical Address
1AC2C
Registers
AX=____0XCDAB______
1AC2E
1AB08
1AC14
0x
3
0x
4
0x
5
0x
6
45
56
78
DX=______0X7856_____
0x
7
0x8
DCFE
0x
9
0xA
0xB
0xC
0xD
2CAC
b) Write the status of various flags after the execution of the ADD instruction. (6 Marks)
MOV AL, 0x80
ADD AL, AL
Page 1 of 3
OF
ZF
SF
PF
AF
CF
1
1
0
1
0
1
0xE
0xF
AB
CD
EE
89
Assignment#1
COAL
F23
Question#2 (3 + 3 + 3 Marks)
Write set of instructions to store 0x0BAD in memory at physical address 0x07DE1 using the
following addressing modes one by one.
a) Direct Addressing Mode
b) Register Indirect Addressing Mode
c) Register relative base plus index addressing mode.
(A)
MOV AX,082BH
MOV DS:[0001] ,OBADH
(B)
MOV BX,0001H
MOV DS:[BX],DX
(C)
MOV AX,0001H
MOV BX,0002H
MOV CX,0004H
MOV[BX+SI],AX
Question#3
Which of the following instructions are incorrect. Provide reasons.
1. MOV 0X1234, AX
Incorrect.
2. MOV CS, AX
Incorrect because cs can not be modified directly.
3. ADD NUM1, NUM2
Incorrect because variables have’t been declared.
4. MOV DS, 0X720
Incorrect because we can not use segment register with immediate values
Page 2 of 3
Assignment#1
COAL
F23
5. ADD AX, BL
Inncorrect we can not add a 8 bit register to a 16 bit register
6. MOV BL, SI
Incorrect because operands do not match 8 bit register and 16 bit register.
7. MOV AX, [BP+BX]
Incorrect because of wrong addressing.
8. MOV DX, [SI+DI]
Incorrect because SI can not go with DI its wrong addressing.
9. ADD BX, [NUMBER + CX]
Incorrect because number hasn’t been declared
10. MOV [0X1234], BL
Correct
11. MOV AX, [BX+SI+4]
Correct
Page 3 of 3
Download