How do I convert this to assembly?

static unsigned char i, j, aResult[15]; /* Define Vars */
static const unsigned char aData[]={0xA0,0x1F,0xA5,0xB2,0x00} ; /* Define Data */
/* Initialize aResult array to all zeros */
aResult[i] = 0;
i=0; /* Set index for aData array */
while(aData[i] != 0){ /* While not EOS do */
if((aData[i]>= 0xA0) && (aData[i] <= 0xAF)) /* Check if between $A0 and $AF */
{ j = aData[i] ‐ 0xA0; /* if so, increment result array */
i++; /* Look at next byte in aData array */
} /* End While loop */
/* Add SPIN Code here */

Recommended Answers

You didn't post a question.

Jump to Post

All 3 Replies

You didn't post a question.

Your compiler should have an "output to assembly" option; for GCC, this is "-S"

format PE GUI 4.0

include ''

;Initialize aResult array to all zeros
        mov     ecx,15
        mov     edi,aResult
        mov     byte [edi],0
        inc     edi
        loop    mIni

        mov     esi,aData;Set index for aData array
        mov     edi,aResult
        cmp     byte [esi],0
        jne     mSkEx;While not EOS do
        jmp     mEx

        cmp     byte [esi],0A0h;Check if between $A0 and $AF
        jl      mskA
        cmp     byte [esi],0AFh;Check if between $A0 and $AF
        jg      mskA
        mov     eax,0
        mov     al,[esi]
        sub     eax,0A0h;if so, increment result array
        add     edi,eax
        inc     byte [edi];Look at next byte in aData array
        sub     edi,eax

        inc     esi
        jmp     mMain

        invoke  ExitProcess,0

aResult db 15 dup (?);Define Vars
aData   db 0xA0,0x1F,0xA5,0xB2,0x00;Define Data

data import

        library kernel32,'KERNEL32.DLL'

        import  kernel32,\

end data
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.