Advertisement
PopaLepo

Utilizarea bibliotecilor de functii

Apr 1st, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. PLA 6
  2.  
  3. Utilizarea bibliotecilor de functii
  4.  
  5. res = myfunc(a, b, c, d)
  6.  
  7. Conventia cdecl ( de ex printf )
  8.  
  9. push d
  10. push c
  11. push b
  12. push a
  13. call myfunc
  14. add ESP, 16
  15. mov res, EAX
  16.  
  17. Conventia stdcall
  18.  
  19. sarcina de a curata argumentele de pe stiva revine functiei apelate, nu apelantului.
  20.  
  21. push d
  22. push c
  23. push b
  24. push a
  25. call myfunc
  26. mov res, EAX
  27.  
  28. Conventia fastcall
  29.  
  30. presupune transmiterea primilor 2 parametrii ai functiei, de la stanga la dreapta, care incap ca reprezentare intr-un DWORD, in registrii ECX si EDX, restul parametrilor punaandu-se pe stiva, de la dreapta la stanga.
  31.  
  32. mov ECX, a
  33. mov EDX, b
  34. push d
  35. push c
  36. call myfunc
  37. mov res, EAX
  38.  
  39. Functii standard din msvcrt (printf si scanf)
  40.  
  41. Lucrul cu fisiere text
  42.  
  43. FILE * fopen(const char * filename, const char * mode);
  44. int fclose(FILE * stream);
  45.  
  46. int fprintf(FILE * stream, const char * format, ...);
  47. int fscanf(FILE * stream, const char * format, ...);
  48.  
  49. (pt fisiere binare)
  50. size_t fread(void * ptr, size_t size, size_t count, FILE * stream);
  51. size_t fwrite(const void * ptr, size_t size, size_t count, FILE * stream);
  52.  
  53. Daca vre, sa afisam caracterul c :
  54.  
  55. mov eax,0
  56. mov al,c
  57. push eax
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement