Professional Documents
Culture Documents
Ans)
2) Write an Assembly language program to send the data 7AH and 1234H to the two output
ports whose addresses are 126EH and 34H respectively and load the same data into the
registers CL and BX from input ports whose addresses are 33H and 3456H respectively.
Initiates the AX register to 0000H.Write a loop to increment the value of AX up to 200
times and send the every increment value of AX to the output port whose address is of
4567H. [3M]
Ans) AL=47H, BL=01H, CX=0000H, and Flags – S=0, P=1, Z=1, C=0, A=0
4) What are the flags effected after performing addition on following data NUM1 =87h and
NUM2=F7H. Write the result and flags contents also. [1M]
Ans) AX=007EH and Flags C=1, Z=0, S=0, O=1, P=1, A=0
5) Write an assembly language program (Just Logic Only) for controlling the traffic lights
with the below mentioned conditions. Port 4 is used whose address is of 4h and it
contains 16 I/O Pins. [3M]
Note: Port 4 (16 bit – 16 I/O Pins) -- 0,3,6,9 are red lights,
2, 5, 8, B are green lights.
1, 4, 7, A are yellow lights.
i) Turnoff all the Lights in all ii) Red light must be turned on in all
direction as shown in the below. directions.
iii) Only one green light must be turned on and write some delay using LOOP. Till the
loop breaks, only green light must be turned on, remaining all red.
Red Lights
Turned on
Ans) 1) DS: DS register hold the upper 16 bit of the starting address of the segment which is
used for data.
2) IP: The Instruction Pointer is a register that holds the address of the next instruction
to be fetched from memory. It contains the offset of the next word of instruction code
instead of its actual address. It is associated with the CS register only.
3) SI: SI can be used to hold the offset of a data word in the data segment. In this case,
20 bit physical data address is calculated from SI and DS.
pop from stack this instruction when executed, loads the specified register/memory location
with the contents of the memory location of which address is formed using the current stack
segment and stack pointer. The stack pointer is incremented by 2.The operation is as follows:
Input the Port this instruction is used for reading an input port. The address of the input port
may be specified in the instruction directly or indirectly. AL and AX are the allowed destination
for 16 bit and 8 bit input operation. DX is the only register which is allowed to carry the port
address.
E.g. 1) IN AL,03H; This instruction reads data from an 8 bit port whose address is 03H and
Stores in AL
2) IN AX,DX; This instruction reads data from a 16 bit port address whose address is in
DX and stores in AX.
3) MOV DX,0800H
IN AX,DX
3) Discuss memory organization briefly [4M]
Ans) 8086 supports 220=1,048,576 (1 Mbytes) of memory over the address range
00000H to FFFFFH.
Two Consecutive bytes can be accessed as one word (16 bits). The lower-addressed byte is the
least significant byte of the word and the higher addressed-byte is the most significant byte of
the word.
Address of the lower byte of word is called address of the full word.
Memory space of 1MB is divided into two chips called banks of 512KB each having even and
odd addresses because commercially available memory chips are only byte size i.e. they can
store only one byte in a memory location but as 8086 is capable to read/write 16 bit (2 bytes) at
a time. So, we need to use two chips for 16 bit operation.
Two banks have alternate addresses because 16 bit words are stored in consecutive
locations and at the same time 8086 must access both banks simultaneously for 16 bit
operation. Suppose if we use only one chip of 1MB, 8086 could read only 1 byte at a time.
Thus, would need two operations for every 16 bit operation. Then, finally process would have
been slower.
4) i) Discuss Instruction Queue briefly [3M]
ii) How many conditional flags are affected by adding 1B8DH and FC5AH. Write those
affected flags values also and neglect Sign Flag. [2.5M]
Ans) 3 flags are affected; those are Carry Flag, Parity Flag and Auxiliary Flag.
DS = E7B5H= 1110 0111 1011 0101 (Segment Address left shifted with appended zeros)