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

Tutorial2

The document contains a tutorial for the Microprocessors Programming and Interfacing course at the Birla Institute of Technology and Science, Pilani – KK Birla Goa Campus. It includes a series of exercises related to assembly language programming, such as manipulating registers, implementing arithmetic operations without specific instructions, and using subroutines. Additionally, it poses questions about stack operations and debugging a calculator program that incorrectly returns multiplication results.

Uploaded by

adityagupta.ahd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Tutorial2

The document contains a tutorial for the Microprocessors Programming and Interfacing course at the Birla Institute of Technology and Science, Pilani – KK Birla Goa Campus. It includes a series of exercises related to assembly language programming, such as manipulating registers, implementing arithmetic operations without specific instructions, and using subroutines. Additionally, it poses questions about stack operations and debugging a calculator program that incorrectly returns multiplication results.

Uploaded by

adityagupta.ahd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Birla Institute of Technology and Science, Pilani – KK Birla Goa Campus

EEE/ECE/INSTR F241
Microprocessors Programming and Interfacing
Tutorial 2

1. What will be the content of CX after execution of following set of instructions?

MOV AX, 0FFH


MOV BX, 51H
IMUL BX
JO endCode
MOV CX, 00
endCode: MOV CX, 0FFH

2. What will be the value of SP and IP after execution of following series of instructions?

MOV BX, 1000H


MOV SP, BX
MOV AX, 0FFFFH
Call sub1
.exit
sub1:
PUSH AX
PUSH BX
PUSH [1000]
POP CX
POP BX
RET

3. write a program to multiply two 1-byte unsigned numbers without using the MUL instruction

4. write a program to divide two 1-byte numbers without using the DIV instruction. Store the
quotient in ch and remainder in cl.

5. You were given a task to design a small calculator program that uses subroutines to perform basic
arithmetic operations (addition, subtraction, multiplication). The operations were to be coded as: 0
→ addition, 1 → subtraction, 2 → multiplication. You wrote the following program. However, no
matter what code was given, the program always returned result of multiplication. What do you think
went wrong?

cmp al, 0
JE addcal
cmp al, 1
JE subcall
cmp al, 2
JE mulcall
addcall: call addfunc
subcall: call subfunc
mulcall: call mulfunc

6. Write a program for multiplication of 2 16-bit numbers that uses the stack to pass parameters to a
subroutine and uses the returned value in the main program. (Let operands be stored at 3000)

7. Assume the following stack operations:

PUSH AX ; AX = 1234
PUSH BX ; BX = 5678
PUSH CX ; CX = 9ABC

Explain how can you store value of AX in DX without using the pop instruction?

8. Write a program to add two 32-bit numbers stored at consecutive memory locations starting from
1000H using 8086 and store the result in location starting from 3000H.

You might also like