Micro, Ass 1
Micro, Ass 1
- Lana Isam-202111215
- Hadeel Hisham-202111207
__________________________________________________________________________________________
__________________________________________________________________________________________
______________________________________________________________________________
6 / 10 / 2023
Answer all 5 questions and provide screenshots from DOSBox for every part of each
question.
Question 1:
MOV [1500], AX
HLT
Show the contents of the AX register, BX register, and the memory location 1500 and 1501.
Question 2:
Which of the following statements give an error when written in the Debug function of the
DOSBox and which is accepted. If the statement gives an error explain the reason.
AL is an 8-bit register, and since our data is 16-bit we can’t fit it inside the register (error).
- MOV AX, 1234 (This statement would not produce an error).
- MOV SI, 1234 (This statement would not produce an error).
- MOV [AX], 1234
This instruction will give us errors. Since the square bracket indicates (indirect addressing) and
we can’t store 16-bit data like the given data directly into a memory location pointed to by AX
we should first use instructions like MOV [BX], AX to be able to store the value in the memory
location provided.
for example: MOV [1000], AX to store the value of AX at memory address 1000.
- MOV [SI], 1234
You cannot directly store a 16-bit immediate value into a memory location pointed to by SI. You
need to specify a valid memory address instead of the immediate value.
- MOV [SI], AX (This statement would not produce an error).
Question 3:
Write an assembly code that initializes the Registers AX, BX, and CX with the values 1234,
5678, and ABCD respectively then exchange their values using the Stack so that the final values
for them are AX = 5678, BX = ABCD, and CX = 1234.
MOV AX,1234
MOV BX,5678
PUSH AX
MOV AX, BX
MOV BX, CX
POP CX
HLT
Question 4:
Write an assembly code that triggers both the Parity and the Sign flags at the same time. (i.e.,
changes the parity flag from PO to PE and the sign flag from PL to NG).
MOV AX,0000
ADD AX, -3
ADD AX, -4
HLT
Question 5:
Show the content of the AX and BX registers after executing each line of the following code.
- MOV AL, 5
- MOV BL, A
- OR AL, BL
- AND AL, BL
- NOT AX
- XOR AL, BL