I'm working on a small project that gets a name and a number from user input. I want to add a number (eg. 5555) to the user entered number and then tell the user the answer. I having trouble and could use some help. Here's the code:
SECTION .data
askName: db "Enter your name: ",0
askNum: db "Enter an integer no more than four digits: ",0
formats: db "%s", 10, 0 ; string with line feed
formatsnlf db "%s",0 ; string w/o line feed
formatd: db "%d", 10, 0 ; integer with line feed
formatdnlf db "%d",0 ; integer w/o line feed
fResult: db "Thank you %s. After the addition to your number the sum is now: %d",10, 0
; arrays
number: times 4 db 0
; answer: times 4 db 0
SECTION .bss
name: resd 20
; number: resb 5
answer: resb 5
SECTION .text
extern printf
extern scanf
global main
main:
;set up stack frame
push EBP
mov EBP, ESP
pushad
;ask user name
push askName
call printf
add ESP, 8
; get name input
push name
push formats ; %s (string) and newline
call scanf
add ESP, 8
;ask user number
push askNum
call printf
add ESP, 4
; get usr number
push number
push formatd ; %d and line feed
call scanf
add ESP, 8
; add number to 5555 and print mess to usr
mov EAX, [number+5555]
mov [answer], EAX
push fResult ; final sentence
push formatsnlf
push formatd
call printf
add ESP, 12
; destroy stack frame
popad
mov ESP, EBP
pop EBP
ret