ASM to C - 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.

ASM to C

Is there someone that could help me converting a small

program from ASM to C or C++.


Please send me an email if...


Regards

Anders


Comments

  • The simplest way is to use the inline assembler

    from the C++. If you have no assembler at your

    C++ compiler read that:


    The assembler works with registers:

    (PC >= 80386)


    16 bit register:

    AX,BX,CX,DX


    8 bit register:

    Al,AH,BL,BH,CL,CH,DL,DH


    32 bit register:

    EAX,(ECX?)


    Operation:

    MOV ax,xxx //Zuweisen eines registers


    ADD ax,xxx //Addition eines registers

    ..

    ..

    ..


    Search in the www for assembler routine.

    More problems are memory ore port operations:


    Port operation:

    Assembler:

    MOV al,xxx

    MOV dx,yyy

    OUT dx,al

    C/C++

    Outportb(yyy,xxx);


    Memory operation:


    Assembler:

    mov ax,a000h

    mov es,ax // Set es to a000

    mov ax,0

    mov si,ax // Set si to 0

    mov al,ffh // set value to ffh

    mov es:[si],al


    C++

    pokeb (0xa000,0,FF); // Not in Visual C++



















Sign In or Register to comment.