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

Consumer buying behaviour and industrial buying behaviour, Question 1: ...

Question 1: Discuss the differences and similarities between consumer buying behaviour and industrial buying behaviour. Question 2: For any organization of your choice,

#title.ms., factors affecting the product life cycle

factors affecting the product life cycle

Weighted average cost of capital, Omega Medical Group (OMG) manufactures hi...

Omega Medical Group (OMG) manufactures high precision medical equipment. OMG has spent €20m on research and development (R&D) for a new system to administer medical isotopes used i

Discussion, "consumer mind is a block box" -discuss

"consumer mind is a block box" -discuss

.marketing research, Illustrate why marketing research is important to a fi...

Illustrate why marketing research is important to a firm specially in a competitive market situation

Distinguish between primary and secondary research, QUESTION a) Provide...

QUESTION a) Provide the major sources of external new product ideas and explain why these sources offer advantages over internal sources b) Each product will have a life cyc

Marketing and society, Marketing and Society In working to meet the co...

Marketing and Society In working to meet the consumer's requirements, marketers can take some actions that are not accepted by all publics or consumers within the social secto

Explain the different stages of negotiation, ZEZ Company is in the business...

ZEZ Company is in the business of designing and printing bottle labels for soft drinks distributors. The company is, at present, facing very difficult times as recessionary economi

Role , role of marketing an organization and society

role of marketing an organization and society

Societal marketing concept, 1.  Tell me what topics you have chosen to writ...

1.  Tell me what topics you have chosen to write about....Choose any one of the three and tell me if you could ever see a career for yourself in that company.... Even if your answe

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