Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Transferring memory/bytes in assembly language

  1. Nov 6, 2012 #1
    Hi Everyone,

    Trying to write some assembly code by just first working out some pseudo to get a basis down for a program which transfers N bytes from m amount different sources, whose sizes are N bytes to m amount different destinations.

    So far, I've been trying to simplify what it wants and so far i've come up with:

    Move R2, #TEMP // Load TEMP into R2 (R2 being a general register)
    Move R3, N // What this line and the subtract line does is that it initializes the outer loop index R3 to j = n-1
    Subtract R3, #1

    Outer: Move R4,R3
    Subtract R4,#1
    MoveByte R5, (R2, R3)

    From here I'm kinda lost at how to implement a way to do it for different sources going to different registers. If anyone could provide a means how I can achieve this or propose a different method which would be easier, it would be greatly appreciated!

    Thank you
     
  2. jcsd
  3. Nov 6, 2012 #2

    rcgldr

    User Avatar
    Homework Helper

    It's not clear to me what the actual moves are. Are you stating that there are m different source arrays, m different destination arrays, and that all arrays are N bytes long?

    What processor are you using? For X86 (Intel / AMD) processors, there is a move string instruction (MOVSB / MOVSW / MOVSD / MOVSQ) (8 / 16 / 32 / 64 bits), that uses ds:si / ds:esi / rsi as source ptr, es:di / es:edi / rdi as destination pointer, and cx / ecx / rcx as repeat count.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Transferring memory/bytes in assembly language
  1. Assembly language (Replies: 5)

  2. Assembly language or C (Replies: 5)

  3. New to assembly language (Replies: 12)

Loading...