Jump to content
bhavacakra

inline asm (masm) wrapped by c code (VC++)

Recommended Posts

Posted

Am o problema legata de sintaxa masm. Problema e ca vreau sa incarc continutul unei variabile in registrul eax, nimic mai simplu:


int main(void) {
int i;
__asm {
mov eax,[i];
}
return EXIT_SUCCESS;
}

Probleme apar cand vreau sa umplu un registru cu valoarea unei variabile care nu are are aceeasi dimensiune ca registrul in cauza. Stiu ca masm cunoaste instructiuni de padding ca TYPE, dar nu e de gasit un exemplu concret. Bineintelex ca vreau ca daca am un char c=7; si eax = 0xCCCCCCCC, si apoi fac (teoretic, practic va da eroare) un

mov eax,[c]

nu vreau sa am in eax apoi 0xCCCCCC07, ci sa dea automat 0-padding - presimt ca exista o posibilitate sintactica in masm pentru acest lucru, un fel de "casting" - in afara de smecheria cu xor eax,eax.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...