Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

14: Simple Assembly Language Programs > 14.9 MULTIPLY TWO NUMBERS OF SIZE 8 BIT...

images 14.9 MULTIPLY TWO NUMBERS OF SIZE 8 BITS

Write an 8085 assembly language program to multiply two 8-bit numbers stored at locations X and Y. Store the 16-bit result in locations Z and Z+1. Also display the result in the address field.

Flowchart for the program

Flowchart for solving the problem is shown in Fig. 14.9.

images

Fig. 14.9 Multiplication of two 8-bit numbers

Program to multiply two 8-bit numbers

;FILE NAME C:\ALS\MULT.ASM

;8085 ALP TO MULTIPLY 2 ONE BYTE BINARY NUMBERS STORED AT LOCATIONS X AnD
;Y. DISPLAY THE 16 BIT RESULT IN THE ADDRESS FIELD.

;IT USES REPEATED ADDITION, AND AS SUCH IS NOT AN EFFICIENT METHOD.

            ORG C100H
  X:        DB 05H

            ORG C200H
  Y:        DB 04H
            ORG C000H
  Z:        EQU C300H
  CURAD:    EQU FFF7H
  UPDAD:    EQU 06BCH

            LXI H, X
            MOV E,M
            MVI D,00H  ;;;Load DE with the byte at location X

            LXI H,Y
            MOV A,M    ;;Load A with the number at location Y

            LXI H,0000H;Initialise HL with 0000H

            CPI 00H
            JZ EXIT    ;;If A value is 00H jump to EXIT to display 0000

 AGAIN:     DAD D      ....

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint