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

Paradigm shifts in america, do you think paradigm shifts having taken place...

do you think paradigm shifts having taken place in marketing?

Functions, discuss the four functions of marketing management analysis, pla...

discuss the four functions of marketing management analysis, planning, implementation and control

Direct and interactive marketing, Direct and Interactive Marketing 1. S...

Direct and Interactive Marketing 1. Synthesize and apply all program concepts learned to date. 2. Continue to refine interpersonal/team skills, presentation skills and criti

Distinct stages in product life cycle, Q.  Described the distinct stages in...

Q.  Described the distinct stages in PLC? Ans.:  A product passes throughout distinct stages during its life and it is called product life cycle. The PLC is usually presented a

Statistics, 10% of inhabitants of a town are known to be suffering from a d...

10% of inhabitants of a town are known to be suffering from a disease. find the probability that in a random sample of 12 people from the town a. none will suffer from the disease

Characteristics of promotion, Characteristics of promotion: Customer ar...

Characteristics of promotion: Customer are informed about the product or services of the company either at the time of introduction of a new product into the matket or when any

Core concept, whats the core concept for marketing

whats the core concept for marketing

State the term- consumer goods, State the term- Consumer goods Goods...

State the term- Consumer goods Goods meant for personal consumption by households or ultimate consumers are known as consumer goods. This includes items such as toiletries,

Discuss the role of human resource management, Question 1: (a) Effectiv...

Question 1: (a) Effective Knowledge Management needs a review of existing HRM practices. Discuss the role of Human Resource Management in Knowledge Management and describe th

Cost function, A chair manufacturer finds that it costs $ 9800 to manufactu...

A chair manufacturer finds that it costs $ 9800 to manufacture 270 chairs and $ 16675 to manufacture 520 chairs in one day, including all costs associated with the factory and the

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