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...
;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 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.
write an assembly language program to find sum of N numbers
fish
How to write the program un Assembly language to set a password for personal computers?
You need an 8086 assembly language pencil.
write program to concatenating two sting in 8086 assembly language
write a program to print A to Z on screen in c?
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.
Either in Assembly or in some high level language/the hex-code (for the mnemonics) that the microprocessor 8085 generally understands.
das
8086 assembly language program to check wether given number is perfect or not
That's what opcode 'NEG' does on some processors.Can be emulated with a 'NOT' and an 'INC'.
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.