Add two five-byte numbers using arrays, Marketing Management

Assignment Help:

Program: Add two five-byte numbers using arrays

; ALGORITHM:

;           Make count = LEN

;           Clear the carry flag

;           Load address of NUM1

;           REPEAT

;                       Put byte from NUM1 in accumulator

;                       Add byte from NUM2 to accumulator + carry

;                       Store result in SUM

;                       Decrement count

;                       Increment to next address

;           UNTIL count = 0

;           Rotate carry into LSB of accumulator

;           Mask all but LSB of accumulator

;           Store carry result, address pointer in correct position.

; PORTS   : None used

; PROCEDURES: None used

; REGISTERS: Uses CS, DS, AX, CX, BX, DX

DATA SEGMENT

                        NUM1 DB 0FFh, 10h ,01h ,11h ,20h

                        NUM2 DB 10h, 20h, 30h, 40h ,0FFh

                        SUM DB 6DUP (0)

DATA ENDS

                        LEN EQU 05h; constant for length of the array

CODE SEGMENT

                        ASSUME CS: CODE, DS: DATA

START:           MOV AX, DATA; initialise data segment

                        MOV DS, AX; using AX register

                        MOV SI, 00; load displacement of 1stnumber.

                                                ; SI is being used as index register

                        MOV CX, 0000; clear counter

                        MOV CL, LEN; set up count to designed length

                        CLC   ; clear carry. Ready for addition

AGAIN:          MOV AL, NUM1 [SI]; get a byte from NUM1

ADC AL, NUM2 [SI]; add to byte from NUM2 with carry

MOV SUM [SI], AL; store in SUM array

INC SI

LOOP AGAIN; continue until no more bytes

RCL AL, 01h; move carry into bit 0 of AL

AND AL, 01h; mask all but the 0th bit of AL

MOV SUM [SI], AL; put carry into 6th byte

FINISH:          MOV AX, 4C00h

INT 21h

CODE             ENDS

END START


Related Discussions:- Add two five-byte numbers using arrays

Places, what are the identifying the major channel alternatives ?

what are the identifying the major channel alternatives ?

Tools of promotion, Tools of Promotion Advertising A paid form of...

Tools of Promotion Advertising A paid form of non-personal communication regarding to an organization and/or its manufacture to a target audience via a mass medium. P

International bonds and markets, International Bonds and Markets (a) ...

International Bonds and Markets (a) Calculate both Macaulay and modified durations of the 8-year, 8.5% coupon bond given a flat yield curve a 10%.

Create a graph of widget sales, Q1 Create a graph of widget sales on the t...

Q1 Create a graph of widget sales on the tab "Q1-Graph" and characterize the time series.  That is, does the time series appear to include the effects of ( 1 ) cyclicality, ( 1 )

Pricing and factors influencing pricing, Q. Describe briefly the concept of...

Q. Describe briefly the concept of pricing and the factors that influence pricing. Ans.:   Price is all around us. We pay rent for our apartment, tuition for our, railways, ed

Introduction to market positioning, Positioning: Meaning and definitio...

Positioning: Meaning and definitions: positioning is a platform for the brand. It facilitates the brand of to get the target consumer. Positioning is the act of fixing the lo

assgnment, #what is personal selling,direct marketing,exhibitions

#what is personal selling,direct marketing,exhibitions?

What is sales research in scope of marketing research, What is Sales Resear...

What is Sales Research in scope of Marketing Research? Sales Research: Sales research comprises decision concerning selection of store channels, sales; territories force

Description of algebra, In algebra, it seems appropriate that a sequence of...

In algebra, it seems appropriate that a sequence of content designed to help mother and father better comprehend Algebra's primary ideas should start with a description of Algebra

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd