Docsity

Lab Session 4 - Assembly Programming, Exercises of Microprocessors

Toggle sidebar
bg1
Lab Session 4
March 22
Note: every number is in hexadecimal. Define code at 1000:100
Bit0 is the first bit in a byte / word
Q1. develop a sequence of instructions that will
i. set the rightmost four bits of AX,
ii. clear the leftmost bits of AX and
iii. invert bit position 7,8 and 9 of AX
Q2. Write the code to test bit 2 (3rd bit), bit 5, bit 6, bit 7 of AL , while AL= AA.
Trace the code (i.e. line by line) and check the status register. What do u observe
Q3. Two different codes are written in Fig1:-
Identify the label for the jump command in both the code to describe, short, near
and far jumps.
Observe the offset value stored in the op code for the three types of jump
instruction. Verify it with hand calculations/calculator and show it to the
instructor
Dump the code memory contents to observe the near and far jumps op code. What
is the command used
Fig:1
Q4. Transfer 5 words from 2000:300 to 3000:700 using JCXZ command. Point out the
difference between loop and JCXZ command
Q5. write code mov BX,0110 jmp BX what do u observe. Now append the code as
mov BX,0310 jmp BX. what do u observe now. Now append code as mov BL,10
jmp BL. what do u observe now (This is called jump with register operand)
Q6. following data(in hexa decimal) is stored in the location 3000:100
32 10 50 40 0a 35 60 30 55 25 26 58 2b 3c 04.
The above values shows the marks of 15 students in MATH subject
Write assembly code to count the number of students scored more than (50)10
marks in a particular subject (use conditional jumps)
****************
mov ax,2000
mov bx,1000
mov si,100
mov di,200
mov sp,002e
jmp xxxx
push ax
nop
nop
*****
mov cx,4
mov ds,ax
mov ax,1
mov [si],ax
inc si
inc si
jmp xxxx
docsity.com

Partial preview of the text

Download Lab Session 4 - Assembly Programming and more Exercises Microprocessors in PDF only on Docsity!

Lab Session 4

March 22

Note: every number is in hexadecimal. Define code at 1000: Bit0 is the first bit in a byte / word

Q1.develop a sequence of instructions that will

i. set the rightmost four bits of AX, ii. clear the leftmost bits of AX and iii. invert bit position 7,8 and 9 of AX Q2.Write the code to test bit 2 (3rd^ bit), bit 5, bit 6, bit 7 of AL , while AL= AA. Trace the code (i.e. line by line) and check the status register. What do u observe Q3.Two different codes are written in Fig1:- Identify the label for the jump command in both the code to describe, short, near and far jumps. Observe the offset value stored in the op code for the three types of jump instruction. Verify it with hand calculations/calculator and show it to the instructor Dump the code memory contents to observe the near and far jumps op code. What is the command used

Fig:

Q4.Transfer 5 words from 2000:300 to 3000:700 using JCXZ command. Point out the difference between loop and JCXZ command Q5.write code mov BX,0110 jmp BX what do u observe. Now append the code as mov BX,0310 jmp BX. what do u observe now. Now append code as mov BL, jmp BL. what do u observe now (This is called jump with register operand) Q6.following data(in hexa decimal) is stored in the location 3000: 32 10 50 40 0a 35 60 30 55 25 26 58 2b 3c 04. The above values shows the marks of 15 students in MATH subject Write assembly code to count the number of students scored more than (50) 10 marks in a particular subject (use conditional jumps)


mov ax, mov bx, mov si, mov di, mov sp,002e jmp xxxx push ax nop nop


mov cx, mov ds,ax mov ax, mov [si],ax inc si inc si jmp xxxx

docsity.com