Wednesday, May 18, 2016

Program to Multiply 8 Bit integers in assembly language



Program to Multiply 8 Bit integers in assembly language

.Model Small
.Stack 100
.Data
A DB 'Enter A : ','$' ; A is 8-bit Integer , 0ah for New Line

B DB 0ah,'Enter B : ','$' ; B is 8-Bit Integer

Output DB 0ah,'Mul of A*B : '
Result DB ?

Result2 DB ?,'$'

;Output1 DB 0ah,'Enter : '
;Result1 DB ?,'$'

.

Ml PROC
Mov ax,@data
Mov ds,ax
Mov dx,OFFSET A ; Call A
Mov ah,9h
int 21h
Mov ah,1 ; Input in A
int 21h

Mov bl,al

Mov dx,OFFSET B ; Call B
Mov ah,9h
int 21h
Mov ah,1 ; Input In B
int 21h

sub bl,30h
sub al,30h
Mul bl

Mov bl,10
div bl

Add al,30h
Mov Result,al

Add ah,30h
Mov Result2,ah


Mov dx,OFFSET Output ; Call Output
Mov ah,9h
int 21h


Mov al,0 ; Ending Program Instruction
Mov ah,4ch
int 21h
Ml ENDP
END Ml

No comments:

Post a Comment