answersLogoWhite

0


Best Answer

we can do this using two techniques:

here i m assuming that two number which is to be multiplied are given..

say 05H and 04H,

so coz 5*4 = 5+5+5+5 = 20

and 4*5 = 4+4+4+4+4 = 20

use this concept ...

MVI A,05H;

MVI B,04H;

L1:

ADD A;

DCR B;

JNZ : L1;

STA 2004H;

HLTType your answer here...

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

;this program adds 2 1-digit numbers
;without carry ,sum < 10 or with carry , sum >9
;coded by -----LenmorVash------
;coded in emu8086




org 100h


mov dx,offset str
mov ah, 09h
int 21h


mov dx,offset str2
mov ah, 09h
int 21h


mov dx,offset str3
mov ah, 09h
int 21h


;---new line---


mov ah, 2
mov dl, 10
int 21h
mov ah, 2
mov dl, 13
int 21h
;---------------
;========================================
mov dx,offset str5
mov ah, 09h
int 21h


;accept 1 char from keyboard
mov ah, 1
int 21h




;convert to number
sub al,30h


mov [temp],al


;=======================================





;---------------------------------------


mov dx,offset str6
mov ah, 09h
int 21h


;accept 1 char from keyboard
mov ah, 1
int 21h




;convert to number
sub al,30h


mov [temp2],al




;-----------------------------------------






;++++++++++++++++++++++++++++++++++++++++++
;ADD [temp],[temp2] xxx illegal xxx


mov bh, [temp]
add bh, [temp2]





;jump to g10 if sum is greater than 9, >=10
cmp bh,09h
jg g10




;sub bh,30h
;sub bl,30h


;push bx








;print answer if not greater than 9


add bh, 30h ;convert back to ASCII equiv


mov dx,offset str7 ;some message
mov ah, 09h
int 21h


mov ah,2 ;print answer
mov dl,bh
;mov dl,ch
;add dl, 30h
int 21h




jmp exit ;jump to program termination


;---------------------------------------

;execution jumps here if answer >=10
g10:



xor ax,ax ;clear ax to 00, ah=0h al=0h


mov al, bh ;transfer prev. answer to al


aaa ;separate result to AH and AL, and correct the
;sum using AAA



mov cx,ax ;transfer AX to CX



add cx, 3030h ;convert back to ASCII equiv





mov dx,offset str7 ;some message
mov ah, 09h
int 21h


mov ah,2 ;print answer


mov dl,ch ;1st digit in CH
int 21h






mov dl,cl ;2nd digit in CL
int 21h






;++++++++++++++++++++++++++++++++++++++++++




exit:





;pause.......
mov ah,00h
int 16h
;............


ret






str db "Lab. Activity No.2 $"
str2 db 10,13,"Codere: Lenmor Vash $"
str3 db 10,13,"God Bless ^_^ $"


temp db 0
temp2 db 0




str5 db "Enter the 1st No: $"
str6 db 10,13,"Enter the 2nd No: $"


str7 db 10,13,"The answer is: $"

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

This depends very much on which type of assembly language you are using.

Typically one uses a compare instruction if it exists, or a subtract instruction followed by checking a condition flag (e.g. carry, borrow, negative, etc.). Note that it is important to distinguish between a compare of signed vs. unsigned integers, as the results will differ when the two arguments have opposite high order bits.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in assembly language to add two 8 bit numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


Write an assembly language program to multiply two BCD numbers?

fish


Example of Password program code in assembly language?

How to write the program un Assembly language to set a password for personal computers?


Write a program in 8086 assembly language to draw a circle?

You need an 8086 assembly language pencil.


Assembly language program for string concatenation using 8086 microprocessor?

write program to concatenating two sting in 8086 assembly language


Write an assembly language program to print a to z on screen?

write a program to print A to Z on screen in c?


How would you define assembly language?

assembly language uses abbreviation called menmonics.it is a bit easier to write computer programs in assembly language as compared to machine language but still requires skill and experienci.A program called assembler is used to convert an assembly language into machine language.


How do you write a program in 8085?

Either in Assembly or in some high level language/the hex-code (for the mnemonics) that the microprocessor 8085 generally understands.


Write an Assembly language program which implements sorting algorithm both ascending and descending order and display those numbers with certain delay say of 5sec between successive displays?

das


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


How do you write a program in assembly language for 2's component?

That's what opcode 'NEG' does on some processors.Can be emulated with a 'NOT' and an 'INC'.


Write a program using 8086 instructions to double a number?

There isn't a reason to write a complete program to do this; in any assembly language just shift the value 1 bit to the left to double it.