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

Building is into our operational processes, Building IS into our operationa...

Building IS into our operational processes - Information System Although information systems are becoming increasingly prevalent they are not always the correct solution to ev

Explain how presentation layer helps in establishing, Explain how presentat...

Explain how presentation layer helps in establishing and processing data in End to End layers. The idea of the presentation layer is to stand for information to the communicati

Subtract the numbers using 1's complements, Subtraction 11001-10110 using 1...

Subtraction 11001-10110 using 1's complement Ans. 11001 - 10110 01001 is 1' s Compliment of 10110, so     1 1 0 0 1 +  0 1 0 0 1 ------------------    1 0 0 0 1 0    Add 1

QUELING SYTEM , SHOW THAT AVERAGE NUMBER OF UNIT IN A (M/M/1) QUELING SYTEM...

SHOW THAT AVERAGE NUMBER OF UNIT IN A (M/M/1) QUELING SYTEM IS EQUAL TO P/(1-p). NOTE:P=ROW

Determine waiting and average waiting time of CPU, CPU burst time indicates...

CPU burst time indicates the time, the process needs the CPU. The following are the set of processes with their respective CPU burst time     (in milliseconds). Process

Give the truth table of S-R and D-flipflops, Give the truth table of S-R an...

Give the truth table of S-R and D-flipflops. Ans: The Truth Table for S-R Flip-Flop is illustrated in Fig.(a) and truth table of D Flip-Flop is illustrated in Fig.(b)

Conversion of data types done between abap/4 & db layer, How is conversion ...

How is conversion of data types done between ABAP/4 & DB layer? Conversion among ABAP/4 data types and the database layer is complete within the database interface

display the contents of the file grade, a) Input names of students from th...

a) Input names of students from the user, terminated by "ZZZ", 0, 0, 0 and create a data file grades with records of the following form: Student (string), test1 (integer), test2 (i

Determine the method for updating the main memory, The method for updating ...

The method for updating the main memory as soon as a word is removed from the Cache is known as  (A) Write-through                  (B) write-back   (C) protected write

Why generalization is very strong, Even while Generalization satisfies Stru...

Even while Generalization satisfies Structural, Interface, Behaviour properties. It is mathematically very strong, as it is Antisymmetric and Transitive. Antisymmetric: employe

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