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

Real option for pharmaceutical company, The management team of a four year ...

The management team of a four year old pharmaceutical company in Boston is developing an immunization against malaria. The team has just learned from the FDC that is has passed sta

Concept and characteristics of environment, Concept of environment: enviro...

Concept of environment: environment literally means the surroundings, external objects, influences or circumstances under which someone or something exists. The environment of any

What is the effective way to internet marketing strategy, What is the effec...

What is the effective way to Internet marketing strategy? There is no certain formula for an effective internet marketing strategy. This depends upon your individual situation.

Brand you, where you want to go in life and how you are going to get there ...

where you want to go in life and how you are going to get there by using social media?

Define the marketing communications strategies, Define the marketing commun...

Define the marketing communications strategies Currently numerous definitions refer to an integrated perspective. This view has gathered momentum over the last 10 years and is

Tea Business, What is the physical evidence of tea business?

What is the physical evidence of tea business?

Concept of rules and discretionary central banking policies, Question 1: ...

Question 1: (a) Clearly explain the concept of rules versus discretionary central banking policies. (b) Discuss the various risks faced by the financial system and disc

Evaluate oranges approach to implementing rm and crm, Question 1: Why a...

Question 1: Why are relationship marketing (RM) and specifically customer relationship management (CRM) appropriate for Orange in managing its marketing efforts? Question

Commercialization or crash introduction strategy development, What is Comme...

What is Commercialization or Crash Introduction Strategy Development? Commercialization or Crash Introduction: A crash introduction is about full scale commercialization

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