Advertisement
Guest User

Untitled

a guest
Jan 14th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     .386
  2.     .model flat, c
  3.     .stack 100h
  4. printf  PROTO arg1:Ptr Byte, printlist:VARARG
  5.     .data
  6. msg1fmt byte "%s%d", 0Ah, 0 ;string formatting
  7. msg1    byte "The answer is: ", 0
  8. num1    sdword ? ;create variables called num 1
  9. num2    sdword ? ;create variable num 2
  10.         .code
  11. main    proc
  12.         mov num1, 5 ;mov takes 2 operands (take 5, move to first operand from ___)
  13.         mov eax, num1 ;take the data from num1 into a register (we will mostly use eax)
  14.         mov num2, eax ;move data from register into num2
  15.         INVOKE printf, ADDR msglfmt, ADDR msgl, num2 ;will call our printf function with msg1fmt
  16.         ret ;ret or return
  17. main    endp ;tell the system our procedure is ending
  18.         end ;tell the program it's ending
  19. ;first column names, second column data type
  20. ;3rd column = ?
  21. ; strings are null terminated with a 0
  22. ;assembly cannot directly move data from variable to variable.
  23. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement