Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern printf
- segment .data
- n_pt_s db `asm: x%.8X `,10,0
- segment .txt
- global display_number
- display_number: ;;
- enter 0,0
- mov eax, 25 ;;random number
- call num_print
- leave
- ret
- num_print: pusha ;;pusha puts all values in my registers away so that I don't lose them
- push eax ;;now that value in eax, is the second argument of my printf call
- push n_pt_s ;;this string pointer (in the segment .data part) is the 1st argument of my printf call
- call printf ;;watch magic
- add esp, 8 ;;this is like poping twice from the 2 pushes I did earlier, only I don't write anything to the registers ;remove 2 pushes on stack
- popa ;; now I pop all values that were stored when I did the pusha
- ret
Advertisement
Add Comment
Please, Sign In to add comment