The document outlines an exercise for a Microprocessors and Microcontroller lab at Presidency University, Bengaluru, focusing on writing an Assembly Language Program (ALP) for basic arithmetic operations on two numbers. It includes details on using the AAA instruction for BCD addition and provides a sample ALP code for adding two BCD numbers. Additionally, it lists the steps to execute Assembly Language programs using DOSBOX and MASM.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
1 views
Exercise-2 - BCD Addition
The document outlines an exercise for a Microprocessors and Microcontroller lab at Presidency University, Bengaluru, focusing on writing an Assembly Language Program (ALP) for basic arithmetic operations on two numbers. It includes details on using the AAA instruction for BCD addition and provides a sample ALP code for adding two BCD numbers. Additionally, it lists the steps to execute Assembly Language programs using DOSBOX and MASM.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6
PRESIDENCY UNIVERISTY, BENGALURU
School of Engineering
Microprocessors and Microcontroller
Lab CSE 254
IV Semester 2018-19 Exercise- 1
Write an Assembly Language Program (ALP) to perform
Arithmetic operations like Addition, subtraction, Multiplication and Division on two numbers Descriptio n •AAA (ASCII Adjust After Addition) instruction converts the result of the addition of two valid unpacked BCD digits to a valid 2-digit BCD number and takes the AL register as its implicit operand. • The following example shows how to add BCD numbers then adjust the result: MOV AH,0 ; Clear AH for most significant digit MOV AL,6 ; BCD 6 in AL ADD AL,5 ; Add BCD 5 to digit in AL AAA ; AH=1, AL=1 representing BCD 11. ALP to to add two Binary Coded Decimal (BCD) numbers
.model small mov ah,0
.data aam num1 db 05 mov result, ax num2 db 09 mov ah,4ch result dw ? int 21h .code end mov ax,@data mov ds,ax mov ah, 00 mov al,num1 add al,num2 mov result,ax Steps to Execute Assembly Language programs 1) Install DOSBOX 0.74
2) Launch DOSBOX, By default it will be in Z drive <Z:\>
3) Change the drive to that, in which MASM is installed mount c:\8086 4) C: 5) C:\> cd 8086 6) C:\:8086> Edit filename.asm 7) C:\:8086> Masm filename.asm; 8) C:\:8086> Link filename.obj; 9) C:\:8086> CV filename.exe THANK YOU