0% found this document useful (0 votes)
49 views

COAL - F23 Assignment#1

This assignment requires students to: 1) Execute several instructions updating registers and memory locations, calculating physical addresses. 2) Write the status of flags after executing an ADD instruction. 3) Write instructions to store a value in memory using direct, register indirect, and register relative addressing modes. 4) Determine which instructions are incorrect and provide reasons. The instructions check various addressing modes and data movement operations.

Uploaded by

Hamayon Wazir
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

COAL - F23 Assignment#1

This assignment requires students to: 1) Execute several instructions updating registers and memory locations, calculating physical addresses. 2) Write the status of flags after executing an ADD instruction. 3) Write instructions to store a value in memory using direct, register indirect, and register relative addressing modes. 4) Determine which instructions are incorrect and provide reasons. The instructions check various addressing modes and data movement operations.

Uploaded by

Hamayon Wazir
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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 Physical Address Registers
MOV [BX], CX 0x08CC
MOV [BP+SI], DX 0x1AB4
MOV AX, [BX+DI] 0x08CE AX=EE _______________
MOV [DI+6], CX 0x1AB8
MOV DX, [0x0100+SI] 0x1AB4 DX=_ 56_________________
Memory
0x 0x 0x 0x 0x 0x 0x 0x 0x 0x 0x 0x 0x
0 1 2 3 0x4 5 6 7 0x8 9 A B 0xC D E F
0x000 0xFED
0x1AB0 : 0 C
0x010
0x1AB0 : 0
0x011 4
0x1AB0 : 0 5 56 78
0x012 0x312 A C
0x1AB0 : 0 0 B D
0x010
0x08C0 : 0
0x011
0x08C0 : 0
0x012 0xFED
0x08C0 : 0 C EE 89

b) Write the status of various flags after the execution of the ADD instruction. (6 Marks)
MOV AL, 0x80 OF ZF SF PF AF CF
ADD AL, AL 1 1 0 1 0 1

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
MOV DS, 0x07DE0
MOV [0x0001], 0x0BAD

b) Register Indirect Addressing Mode


MOV DS, 0x07DE0
MOV BX, 0x0001
MOV [BX], 0x07DE0

c) Register relative base plus index addressing mode.

MOV DS, 0x07DE0


MOV BX,0x0000
MOV DI,0x0001
MOV [BX+DI] , 0x07DE0

Question#3
Which of the following instructions are incorrect. Provide reasons.

1. MOV 0X1234, AX Incorrect because you can’t move data from register to immediate(constant).

Page 1 of 2
Assignment#1
COAL
F23
2. MOV AX, [CX] Correct Because the value at the address pointed by CX can be moved. This is memory to register

addressing mode.

3. MOV AL, [BL + 4] Correct because it is the value pointed by BL with an offset of 4 bytes is stored in AL

4. ADD DX, [BX+DX+2] Incorrect because the ADD instruction expects both operands to be registers or immediate values,

and it doesn't support complex memory addressing modes

5. MOV CS, AX Incorrect because CS(code segment) register is not directly modifiable in user-level code.

6. ADD NUM1, NUM2 Incorrect because NUM1and NUM2 are neither a register nor an immediate.

7. MOV DS, 0X720 Correct because an immediate is loaded(stored) in DS.

8. ADD AX, BL Correct because the instruction add the value of register BL and AX and store in AX.

9. MOV BL, SI Correct because it is register to register data movement.

10. MOV AX, [BP+BX] Correct because it is data movement from memory into register i.e address pointed by BP with an

offset of value stored in BX.

11. MOV DX, [SI+DI] Correct because SI + DI value is taken as an address and the value pointed by that address is moved

to DX.

12. ADD BX, [NUMBER + CX] Incorrect because Number is not a true operand.

13. MOV [0X1234], BL Correct as it is Data movement from BL to the value memory address.

14. MOV AX, [BX+SI+4] Correct as it is data movement from the address pointed by Bx with an offset of SI + 4 into

AX.

Page 2 of 2

You might also like