Memcpy procedure for 80188 embedded system - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Memcpy procedure for 80188 embedded system

WtwhWtwh Posts: 4Member
Hi

I need to write a "memcpy" procedure in assembly for an embedded system running on an 80188 microprocessor. Memcpy() copies n bytes from memory area s2 to s1 and returns s1. It is called in C code as follows:

void *memcpy(void *s1, const void *s2, size_t n)

I am very new to assembly programming and is hoping for some advice how this can be done. Btw, is there a compiler which translate C code into assembly?

Any advice is very much appreciated. Thank you.

Regards
Wilson

Comments

  • BitdogBitdog Posts: 528Member
    : Hi, I need to write a "memcpy" procedure in assembly

    [code]
    MOV SI,OFFSET SOURCE (DS:SI = source addr) (x86 real mode addressing)
    MOV DI,OFFSET DESTINATION (ES:DI = destination address)
    MOV CX,SIZE
    REPZ MOVSB
    [/code]
    That's your standard .asm memory copy for x86.
    Maybe others can add more to this...

    Bitdog


  • ShoSho Posts: 22Member
    : : Hi, I need to write a "memcpy" procedure in assembly
    :
    : [code]
    : MOV SI,OFFSET SOURCE (DS:SI = source addr) (x86 real mode addressing)
    : MOV DI,OFFSET DESTINATION (ES:DI = destination address)
    : MOV CX,SIZE
    : REPZ MOVSB
    : [/code]
    : That's your standard .asm memory copy for x86.
    : Maybe others can add more to this...
    :
    : Bitdog
    :
    :
    :
    Most compilers have a commandline switch that will output their assembly code generation to a file; the best compilers, however, generate AT&T syntax. Borland's free commandline C++ 5.5 outputs assembly by specifying -s, for example. It's output is not always as high-quality as some of the UNIX-ported compilers, most notably, LCC (Little C Compiler, Navia, http://www.cs.virginia.edu/~lcc-win32/ ), which only generates AT&T syntax.

    Obviously, the programmers of UNIX knew there were shift and caps lock keys, since the name UNIX is capitalized. From then on in, they seemed oblivious to them.

Sign In or Register to comment.