Computer Peripherals and Interfaces Home Work - Ii DOA - 13/9/2010 DOT - 28/9/2010 DOS - 28/9/2010 MM - 25 (SUB 7 + TEST 18)
Computer Peripherals and Interfaces Home Work - Ii DOA - 13/9/2010 DOT - 28/9/2010 DOS - 28/9/2010 MM - 25 (SUB 7 + TEST 18)
Computer Peripherals and Interfaces Home Work - Ii DOA - 13/9/2010 DOT - 28/9/2010 DOS - 28/9/2010 MM - 25 (SUB 7 + TEST 18)
HOME WORK – II
DECLARATION:-
Darshan
Singh
MARKS:-
OUT OF:-
PART A
OUT DX, AL
IN AL, DX
CMP AL, 30
JB YELLOW
JMP GREEN
OUT DX, AL
JMP, EXIT
OUT DX, AL
CODE ENDS
END
Ans.
Q3: How the near call procedures and far call procedures are different
from each other.
3. It also loads the segment selector of the segment that contains the called
procedure in the CS register.
1. Near Call procedure pushes the current value of the EIP register on the stack
Q4: Write a program to push and pop some data using assembly language.
Ans. PUSH and POP operation is done in stack. Stack is a place where data is
temporarily stored. The SS and SP registers point to that place like this –
SS: SP So the SS register is the segment and the SP register contains the offset. We
can now use PUSH and POP instruction to this. It will be done like this –
PUSH AX
MOV AH, 09
INT 21H
POP AX
The final value of AX will be 1234H. In this we first load 1234H into AX, then we
push that value into the stack. We now store 9 in AH, so AX will be 0934H and
execute INT. The we Pop the AX register. We retrieve the pushed value from the
stack. So Ax contains 1234H again.
Ans.
a) CALL instruction
b) CMP instruction is used to compare two operands given and sets/clears the
appropriate flags. For example –
MOV CX, 10
CMPLOOP
DEC AX
CMP AX, 3
LOOPNE CMPLOOP
c) INC instruction
INC AX
LOOP_LABEL
d) INT instruction
INT 21H
Q6: What are the benefits of using macros in microprocessor and give an
example to show the working of the macro.
Ans. A macro is a gro of repetitive instructions in a program which are copied only
once and can be used as many times as necessary. Here are some of its features -
For example if we want to place the cursor on a determined position on the screen
using macro, we will do it like this –
PUSH AX
PUSH BX
PUSH DX
MOV BH, 0
INT 10H
POP DX
POP BX
POP AX
ENDM
To use this macro we have to call it by its name as there were other assembler
instructions.