global _main extern _printf extern _scanf section .data message1 db "Enter first number: ", 0 message message2 db "Enter second number:
My assembly code is having an error in Jdoddle's online assembly compiler. Please tell me whats wrong so I can keep that in mind. Thanks!
----
global _main
extern _printf
extern _scanf
section .data
message1 db "Enter first number: ", 0
message
message2 db "Enter second number:",
formatIn db '%d', 0
formatOut db '%d', 10, 0
show db "Sum: ", 0
section .bss
firstInt resb 4
secondInt resb 4
section .text
_main:
push message1
call _printf
pop eax
push firstInt
push formatIn
call _scanf
pop eax
pop eax
push message2
call _printf
pop eax
push secondInt
push formatIn
call _scanf
pop eax
pop eax
push show
call _printf
pop eax
mov ebx, dword [firstInt]
mov ebx, dword [secondInt]
add ebx, ecx,
push ebx
push formatOut
call _printf
Step by step
Solved in 2 steps