You are on page 1of 12

REPORT

COURSE – COMPUTER
ENGINEERING

PROGRAM – microprocessor

MICROPROJECT:
ACADEMIC YEAR: 2022 –
2023
COURSE: Computer
Engineering
TITEL: Write an assembly language using macros. write an
ALP using macross to solve equation such as
z=(A+B)* (C + D)
SUBJECT: microprocessor

SEMESTER: 4th

TEAM MEMBERS:
SR.NO NAME ROLL NO.
1 Kaushal TAPSE 26
2 sahil kumbhar 27
3 Atharv dhumal 29
4 sagar deshmukh 31

Under the Guidance of: -

MISS. Sable k . s.
(Subject Teacher)

DESCRIPTION:
We are studying in 2ndYear computer engineering. In This
semester we Have been prescribed micro project by MSBTE.
The basic reason of micro-Project is Developed skills. In this
micro project we try to Understand Over all information of
our micro project. It is very important for our Career & built
confident as Will knowledge full about our field .This program
defines two macros, ADD_MACRO and MUL_MACRO, which
are used to perform addition and multiplication operations.
The program then calculates the value of z by adding A and B,
adding C and D, and then multiplying the two results
together. Finally, the program prints the value of z using the
WriteInt function provided by the Irvine32 library.

Aim of the Micro-Project:


Write an assembly language using macros. write an ALP using
macross to solve equation such as z=(A+B)* (C + D).

Procedure:
1.Define the variables A, B, C, D, and Z in the data
segment with initial values.
2.Load the data segment address into AX and set
the data segment register to point to the data
segment.
3.Define a macro called COMPUTE_Z that
calculates the value of (A + B) * (C + D) and stores
it in Z.
4.Define a macro called DISPLAY_Z that displays
the value of Z using a subroutine called DISPLAY.
5.Call the COMPUTE_Z macro to calculate the
value of Z.
6.Call the DISPLAY_Z macro to display the value of
Z.
7.Use the TITLE macro to end the program.

RESOURCES
USED
Sr. Name of Specifications Quantity Remark
Resources /
Material
1 Internet www.Wikipedia.Com - √
2 Typing Microsoft Office Word - √
Software (2019)

3 Photos of To explain more - √


OUTPUT simply

4 MIC Book To Type Information - √

Guide Teacher – .k .s

SOURCE CODE

TITLE MACRO
MOV AH, 4CH ; Set up exit code for DOS

INT 21H

ENDM
DATA SEGMENT

A DW 100 ; Define A as a word-sized variable with initial value 100

B DW 200 ; Define B as a word-sized variable with initial value 200

C DW 300 ; Define C as a word-sized variable with initial value 300

D DW 400 ; Define D as a word-sized variable with initial value 400

Z DW ? ; Define Z as a word-sized variable with initial value unknown

DATA ENDS

CODE SEGMENT

MAIN PROC

ASSUME CS:CODE, DS:DATA

MOV AX, DATA ; Load the data segment address into AX

MOV DS, AX ; Set the data segment register to point to the data segment

; Compute (A + B) * (C + D)

MACRO

MOV AX, A ; Load A into AX

ADD AX, B ; Add B to AX

MOV BX, C ; Load C into BX

ADD BX, D ; Add D to BX

IMUL AX, BX ; Multiply AX by BX

MOV Z, AX ; Store the result in Z

ENDM
; Display the result

MOV AX, Z ; Load Z into AX

MOV CX, 10 ; Set CX to 10 (base 10)

CALL DISPLAY ; Call the display subroutine

TITLE ; End of program

MAIN ENDP

DISPLAY PROC

PUSH AX ; Save AX

PUSH BX ; Save BX

PUSH CX ; Save CX

PUSH DX ; Save DX

; Convert AX to a string and display it

MOV BX, AX ; Load the value to convert into BX

MOV CX, 0 ; Initialize the counter to 0

MOV DX, 0 ; Initialize the quotient to 0

MOV AH, 0 ; Set the division mode to integer division

MOV DI, OFFSET BUFFER ; Load the buffer address into DI

; Handle the special case of zero


CMP BX, 0

JNZ CONVERT

; Zero is a special case, handled separately

MOV BYTE PTR [DI], '0'

INC DI

JMP DISPLAY_DONE

CONVERT:

; Convert the value in BX to a string

CMP BX, 0

JG CONVERT_LOOP

NEG BX

MOV BYTE PTR [DI], '-'

INC DI

CONVERT_LOOP:

MOV DX, 0 ; Clear DX

DIV CX ; Divide BX by CX

PUSH DX ; Save the remainder on the stack

INC CX ; Increment the counter

TEST BX, BX ; Check if BX is zero

JNZ CONVERT_LOOP ; If not, repeat the loop


; Display the string

DEC DI ; Back up one character

CONVERT_DISPLAY:

MOV DL, BYTE PTR [DI] ; Load the character to display

MOV AH, 2 ; Set up the DOS output function

INT 21H ; Call the DOS function

INC DI ; Move to the next character

TEST DI, DI ; Check if we've reached the end of the string

JNZ CONVERT_DISPLAY ; If not, repeat the loop

DISPLAY_DONE

Conclusion:
The above program calculates the value of the equation
z = (A + B) * (C + D) using macros in assembly
language. The program defines the variables A, B, C, D,
and Z in the data segment and uses the COMPUTE_Z
macro to calculate the value of Z. The DISPLAY_Z
macro is used to display the value of Z using a
subroutine called DISPLAY. The program then calls the
COMPUTE_Z and DISPLAY_Z macros to compute and
display the value of Z respectively. Finally, the program
ends using the TITLE macro.
Skill developed out of this
microprojects:
Plan and organize – Planning and
organizing skills developed.
Communicate effectively – By
communicating problems are solved.
Work independently and as part of team
– By working independently project
completed accurately.
Show a positive attitude - Positive
attitude can developed by this course and
micro project.
Demonstrate good work practice
including time, keeping, tidiness,
responsibility, quality, awareness and
safety awareness.
Decisions making – By
performing this project decision making
ability is increased.
Leadership and management –
This project gave given the ability
how to leading and managing the
project.
Analysis skill – By making this project
analysis skill are developed.

You might also like