Add a byte number from one memory location, Computer Engineering

Assignment Help:

Add a byte number from one memory location to a byte from subsequent memory location and put sum in the third memory location. Also save carry flag in the least significant bit of fourth memory location. 

; ABSTRACT                         : This program adds 2-8-bit words in the memory locations

;                                               : NUM1 and NUM2. The result is stored in the memory 

;                                               : location RESULT. The carry bit, if any will be stored as 

;                                               : 0000 0001 in the location CARRY

 

; ALGORITHM:

;                       get NUM1

;                       add NUM2 in it

;                       put sum into memory location RESULT

;                       rotate carry in LSB of byte

;                       Mask off upper seven bits of byte

;                       store the result in the CARRY location.

;

; PORTS:                     None used

; PROCEDURES:      None used

; REGISTERS:           Uses CS, DS, AX

;

DATA   SEGMENT

NUM1                         DB                  25h                  ; First number

 NUM2                        DB                  80h                  ; Second number

 RESULT                    DB                  ? ; Put sum here

 CARRY                     DB

DATA   ENDS

CODE   SEGMENT

                        ASSUME CS: CODE, DS: DATA

START: MOV AX, DATA                ; Initialise data segment

MOV DS, AX                        ; register using AX

            MOV AL, NUM1                   ; Load the first number in AL

            ADD AL, NUM2                   ; Add 2ndnumber in AL

MOV RESULT, AL  ; Store the result

               RCL AL, 01                         ; rotate carry into LSB

               AND AL, 00000001B         ; Mask out all but LSB

               MOV CARRY, AL             ; Store the carry result

            MOV AH, 4CH

               INT 21H

CODE ENDS

END START

Discussion:

RCL instruction brings carry in the least significant bit position of AL register. AND instruction is employed for masking higher order bits of the carry now in AL.

In the same way we can also write applications employing other shift instructions.


Related Discussions:- Add a byte number from one memory location

Internet application development, As an employee of an up and coming web De...

As an employee of an up and coming web Design Company, you have been approached by a small local cinema, called Valley Viewing who are looking to revamp their existing HTML website

What are the types of instructions, Q. What are the types of Instructions? ...

Q. What are the types of Instructions? Computer instructions are translation of high level language code to machine level language programs. So from this point of view machine

Determine about the web authoring tools, Web authoring tools CGI was cons...

Web authoring tools CGI was considered excellent in the beginning since it was also open standard. The only drawback it suffered was that it was slow. Major software developers v

Difference between the real mode and the protected mode, Problem (a) ...

Problem (a) Explain the difference between the real mode and the protected mode in the 80x86 family of processors. (b) The 32-bit physical address 047C:0048 is to be conv

Explian service topologies, Explian Service Topologies Service Topolog...

Explian Service Topologies Service Topologies In a service-based architecture there increase dependencies between services resulting from cooperation

Define the system analysis of object oriented modelling, Define the System ...

Define the System Analysis of Object oriented modelling System Analysis: In this stage a statement of the queries is formulated and a model is designed by the analyst in enc

How a file can be shared among different users, Discuss the different techn...

Discuss the different techniques with which a file can be shared among different users. Several popular techniques with that a file can be shared among various users are: 1

Determine the number of classes of ip addresses, The total number of class ...

The total number of class of IP address are? The total number of class of IP addresses are 5.

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