23 Program to multiply two 8 bit unsigned numbers result is max 16 bit in 8086 Microprocessor.

Code:

; PPROGRAM TO MULTIPLY TWO 8 BIT
; UNSIGNED NUMBERS RESULT IS MAX 16 BIT

.MODEL SMALL
.STACK 100
.DATA
   NUM1 DB 03H
   NUM2 DB 05H
   RES  DW ?
.CODE
  MOV AX , @DATA ; Intialize data segment
  MOV DS , AX

  MOV AL , NUM1   ; LOADS NUM1 TO AL
  MOV BL , NUM2   ; LOADS NUM2 TO BL

  MUL BL          ; MULTIPLY NUM1 BY NUM2 AND STORE RESULT IN AX

  AAM           ;(ASCII ADJUST AFTER MULTIPLICATION)

  MOV RES , AX    ; STORING RESULT IN AX

  MOV CL , AL     ; COPYING RESULT IN SAFE PLACE
  MOV CH , AH

  MOV DL , CH     ; PRINTING HIGHER BIT
  MOV AH , 2
  INT 21H

  MOV DL , CL     ; PRINTING LOWER BIT 
  MOV AH , 2
  INT 21H

  MOV AH , 4CH   ; EXIT
  INT 21H
END




Ouput:

Previous
Next Post »