Program to move contents in memory-machine level programs, Assembly Language

Assignment Help:

Example : Write a program to move the contents of the memory location 0500H to BX and also to register CX. Add immediate byte 05H to the data residing in memory location, whose address is computed by using DS=2000H and offset=0600H. Store up the result of the addition in 0700H. Consider that the data is located in the segment specified by the data segment register which contain 2000H.

Solution :

The flow chart for the program is shown in given figure.

After initializing the data segment register the content of the location 0500H are moved to the BX register by using MOV instruction. The similar data is moved also to the CX register. For this data transfer, there can be 2 options as shown.

1739_example1.jpg

826_example2.jpg

(a) MOV CX,       BX      ; As the contents of BX register will be similar as 0500H after execution

                                   ; of MOV BX,[0500H].

(b) MOV CX, [050OH]   ; Move directly from 0500H to CX

 

In the first option the opcode is just of 2 bytes, whereas the second option will have 4 bytes of opcode. Thus the second option will need execution time and more memory. Due to these reasons, the first option is preferable.

The immediate data byte 05H is added to content of 0600H by using the ADD instruction. The result will be goes in destination operand 0600H. It is next stored at the location 0700H. In particular case of the 8086/8088 instruction set, there is no instruction for direct transfer of data from the memory source operand to the memory destination operand rather than the string instructions. So the result of addition which is present at 0600H should be moved to any one registration amongst the general purpose registers, except BX and CX, or else the contents of BX and CX will be changed. We have chosen DX (we could have selected register AX also, because once DS is initialized to 2000H the contents of register AX are no longer useful for this purpose. therefore the transfer of result from 0600H to 0700H is accomplished in two stages by using successive MOV instructions, for an instance,

Firstly, the content of 0600H is DX register and then the content of DX register is moved to 0700H. The program terminated with the instruction HLT.

 


Related Discussions:- Program to move contents in memory-machine level programs

String manipulation instruction-microprocessor, String Manipulation Instruc...

String Manipulation Instruction A series of words or data bytes are available in memory at consecutive locations, to be mention to individually or collectively, are known as by

Write a program that will input a number from the keyboard, Write a program...

Write a program that will input a number from the keyboard, and then display the number in binary form, as well as the number of one's in the number. Hint: Shift the value left (or

Summation Program., Write a program to solve problem 9, Summation Program, ...

Write a program to solve problem 9, Summation Program, on page 179 of chapter 5 in the textbook (book:kip Irvine Assembly Language sixth edition)

Not-logical instruction-microprocessor, NOT : Logical Invert: The NOT inst...

NOT : Logical Invert: The NOT instruction complements (inverts) the contents of an a memory location or operand register bit by bit. The instance are as following: Example :

Seg-segment-assemblers directive-microprocessor, SEG : Segment of a Label:...

SEG : Segment of a Label:- The SEG operator is which is used to decide the segment address of the, variable, label or procedure and substitutes the segment base address in plac

Minecraft/Terminal issues, I am running a small minecraft server off of my ...

I am running a small minecraft server off of my old mac mini, and am having a big issue. My computer isn''t very good, and even just running this server is an issue. I use a comma

8255 programmable peripheral interface-microprocessor, 8255 Programmable Pe...

8255 Programmable Peripheral Interface Intel's 8255 A programmable peripheral interface provides a nice instance of a parallel  interface. As shown the interface have a control

Cache components-microprocessor, Cache components The cache sub-system ...

Cache components The cache sub-system may be divided into 3 functional blocks: Tag RAM, SRAM and theCache Controller. In real designs, these blocks can be implemented  by multi

Fourth generation microprocessor, Fourth  Generation Microprocessor : T...

Fourth  Generation Microprocessor : The single chip 32-bit microprocessor was introduced in 1981 by Intel as iAPX 432. The other 4th generation  microprocessors  were;  Hewlett

Lds/les instruction execution-microprocessor, LDS/LES Instruction execution...

LDS/LES Instruction execution :  LAHF : Load AH from Lower Byte of Flag: - This instruction loads the AH register with the lower byte of the flag register. This instruction ca

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