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

Explain circuit switching versus packet switching, Explain difference of Ci...

Explain difference of Circuit switching versus Packet switching. Within circuit switching an end-to-end path is to be establishing before any data can be sent. Previously a con

Define memory access time, Define memory access time? The time needed t...

Define memory access time? The time needed to access one word is known as the memory access time. Or It is the time that elapses among the initiation of an operation and the co

Cgi programming, For this assignment you should construct a comprehensive w...

For this assignment you should construct a comprehensive web site for Dangar Winery of Puddledock Road Armidale, makers of fine table wines and ports since 1983. Chief winemaker, A

Define general purpose register architecture, Q. Define General Purpose Reg...

Q. Define General Purpose Register Architecture? General Purpose Register (GPR) Architecture: A register is a word of internal memory similar to the accumulator. GPR architec

Characters in vi editor, What is the command used to replace many character...

What is the command used to replace many characters in Vi Editor? Ans) For replace most of the character in vi editor press esc key and then press R for change many character.

Create new user account - system administrator, A common task for a system ...

A common task for a system administrator is to create new user accounts. In this lab you will be creating output that looks like an /etc/passwd file. The Problem You are to

What is hysteresis, What is hysteresis? Hysteresis is well known in fer...

What is hysteresis? Hysteresis is well known in ferromagnetic materials. When an external magnetic field is applied to a Ferro magnet, the atomic dipoles align themselves with

Define device interface, Define device interface. The buffer registers ...

Define device interface. The buffer registers DATAIN and DATAOUT and the status flags SIN and SOUT are part of circuitry commonly called as a device interface.

Define memory management system, Define memory management system? The p...

Define memory management system? The part of the computer system that supervises the flow of information among auxiliary memory and main memory is known as memory management sy

Describe the size and speed of scanners, Q. Describe the Size and Speed of ...

Q. Describe the Size and Speed of Scanners? Before actual scanning, a quick, low resolution scan known as pre-scan is made to preview the image and select scanning area. After

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