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

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.