+ 3

Verifying assembly x86 code.

Hi, I'm learning win32 x86 assembly with MASM. So far, I've noticed two ways you could write a procedure in MASM. I'm getting the correct output (18). But I'm not sure I'm missing something, There are very few online docs available on how you can write subroutine with "Invoke" directive. If possible could anyone verify if the way I'm writing is correct or not (I know that I should include comments). .386 .model flat, stdcall .stack 4096 ExitProcess proto, dwExitcode:dword .data? sum dword ? .code addNum proc push ebp mov ebp, esp sub esp, 4 mov ebx, 2 mov [ebp - 4], ebx mov eax, [ebp + 8] add eax, [ebp + 12] sub eax, [ebp - 4] add esp, 4 mov esp, ebp pop ebp ret addNum endp addNum2 proc numA:dword, numB:dword sub esp, 8 mov ebx, 3 mov [ebp - 4], ebx mov ebx, 2 mov [ebp - 8], ebx mov eax, numA add eax, numB sub eax, [ebp - 4] sub eax, [ebp - 8] add esp, 8 ret addNum2 endp main proc push 5 push 5 call addNum invoke addNum2, 15, eax mov sum, eax add esp, 8 invoke ExitProcess, sum main endp end main

23rd Oct 2021, 2:05 PM
lona
1 ответ
+ 3
Hello There Mate! I Prefer You To Post Your Questions On StackOverflow. Devs Are Highly Active And You Get Your Answer ASAP. If you Want Ask Questions Here wait for Atleast A Month Or So.
29th Oct 2021, 4:44 PM
Shubhan
Shubhan - avatar