Copy Buffer1 to Buffer2 in Intel 586 ASM: Beginner's Guide

  • Thread starter liahow
  • Start date
In summary, the conversation discusses how to copy the contents of one buffer to another in assembly language without using string functions. The speaker is new to coding in assembly and is unsure about the differences between real and protected mode assembly, and how they affect the DOS in different versions of Windows.
  • #1
liahow
6
0
In assembly language (on at least an Intel 586 arch) how would I copy the string contents of one buffer to another without using any string functions for copying? I want to copy the contents from buffer1 to buffer2. I'm just beginning to learn how to code in assembly language, so I'm completely lost!
 
Technology news on Phys.org
  • #2
Are you doing real or protected mode assembly?
 
  • #3
I was wondering, is it the real mode and protected mode difference that makes the current DOS in windows XP seem different to the DOS in windows 95? I know that real mode is limited to 1mb and protected is something like 4gb.
 

1. How do I copy data from one buffer to another using Intel 586 Assembly?

To copy data from one buffer to another in Intel 586 Assembly, you can use the MOVSB (move string bytes) instruction. This instruction moves a byte of data from the source buffer to the destination buffer, and then increments the source and destination pointers to point to the next byte in each buffer. You can repeat this instruction as many times as needed to copy all of the data from one buffer to the other.

2. What are the benefits of using the Intel 586 Assembly language for copying data?

The Intel 586 Assembly language is a low-level programming language that allows for direct access to hardware and memory. This makes it a more efficient and faster way to copy data compared to high-level languages. Additionally, using Assembly language can result in smaller and more optimized code, which can be beneficial for programs with limited memory or processing power.

3. How do I specify the size of the data to be copied in Intel 586 Assembly?

To specify the size of the data to be copied, you can use the REP (repeat) prefix before the MOVSB instruction. This prefix tells the processor to repeat the MOVSB instruction a certain number of times based on the specified size. For example, if you want to copy 100 bytes of data, you would use the MOVSB instruction with the REP prefix followed by the number 100.

4. Can I copy data between buffers of different sizes in Intel 586 Assembly?

Yes, you can copy data between buffers of different sizes in Intel 586 Assembly. However, you must ensure that the source and destination buffers have enough space to accommodate the data being copied. If the destination buffer is smaller than the source buffer, you may encounter data loss. It is important to carefully manage the size and allocation of buffers when copying data in Assembly language.

5. Are there any other instructions besides MOVSB that can be used to copy data in Intel 586 Assembly?

Yes, there are other instructions that can be used to copy data in Intel 586 Assembly, such as MOVSX (move with sign extension) and MOVZX (move with zero extension). These instructions are used for copying data that is larger than a single byte. Additionally, there are also block transfer instructions like REP MOVSB, REP MOVSX, and REP MOVZX that can be used to copy larger chunks of data more efficiently than using individual instructions.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
Replies
52
Views
4K
  • Programming and Computer Science
Replies
4
Views
5K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
2
Replies
60
Views
16K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
6K
  • Programming and Computer Science
Replies
5
Views
5K
  • Programming and Computer Science
Replies
4
Views
3K
  • STEM Academic Advising
Replies
14
Views
672
Back
Top