어셈블리

정올 어셈블 문제 - 배열관련 - 아직 완변하지 않음

파아랑새 2018. 6. 14. 16:52

# include <stdio.h>

# define SIZE 10

int main(void)

{

char cData[SIZE] = { 0, };

char* Prompt = "%c ";

int temp = 0x0;

int indx = 0x0;

__asm

{

mov ecx, 0xa;

mov dword ptr[temp], ecx;

L:

// scanf("%c", cData + i);

mov dword ptr[temp], ecx;

mov ebx, dword ptr[indx];

lea edi, dword ptr[cData + ebx];

push         edi;

push         dword ptr[Prompt];

call         dword ptr[scanf];

pop ebx;

pop ebx;


mov ebx, dword ptr[indx];

add ebx, 0x1;

mov dword ptr[indx], ebx;

//

mov ecx, dword ptr[temp];

loop L;

}


for (int i = 0; i < SIZE; i = i+2)

{

printf("%c", *(cData + i));

}

printf("\n");

}