SHOW:
|
|
- or go back to the newest paste.
| 1 | #include "crt.bi" | |
| 2 | ||
| 3 | - | dim shared as zstring*12 zText = "Hello World" |
| 3 | + | dim shared as zstring*12 zText = "eax+ebx=%i" |
| 4 | ||
| 5 | asm | |
| 6 | ||
| 7 | mov eax, 10 | |
| 8 | - | call puts |
| 8 | + | mov ebx, 30 |
| 9 | - | add esp, 4 |
| 9 | + | add eax, ebx |
| 10 | - | call getchar |
| 10 | + | |
| 11 | - | call _exit |
| 11 | + | 'notice the parameters are pushed on the inverse order because you are pushing to a stack |
| 12 | 'so the last pushed is the first in memory order... (string,number) | |
| 13 | push eax | |
| 14 | push offset zText | |
| 15 | ||
| 16 | call printf | |
| 17 | '(8 bytes were passed to the CDECL style function, the 4 byte pointer, and the 4 byte integer) | |
| 18 | 'so this is to clean up what the two PUSH stored. when calling a function that uses C calling convention) | |
| 19 | add esp, 8 | |
| 20 | ||
| 21 | end asm | |
| 22 | ||
| 23 | 'mixed is simpler :P | |
| 24 | sleep | |
| 25 |