segment .data
prompt1: db "Enter a number: ", 0
len1: equ $-prompt1
prompt2: db "Enter another number: ", 0
len2: equ $-prompt2
outmsg1: db "You entered: ", 0
len3: equ $-outmsg1
outmsg2: db "The sum is: ", 0
len4: equ $-outmsg2
prompt1size1: db "Enter a size of number < 10 for size1: ", 0
len1size1: equ $-prompt1size1
prompt2size2: db "Enter another size of number < 10 for size2: ", 0
len2size2: equ $-prompt2size2
prompt9: db "Contains input1: ", 0
len9: equ $-prompt9
prompt8: db "Contains input2: ", 0
len8: equ $-prompt8
nl: db 10
segment .bss
input1: resb 10
inlen1 resd 1
input2: resb 10
inlen2 resd 1
segment .text
global _start
_start:
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [prompt1]
mov edx, len1 ; len
int 80h
mov eax, 3 ; read
mov ebx, 0 ; stdin
lea ecx, [input1]
mov edx, 10 ; len
:
lea ecx, [prompt1]
mov edx, len1 ; len
int 80h
mov eax, 3 ; read
mov ebx, 0 ; stdin
lea ecx, [input1]
mov edx, 10 ; len
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [prompt1]
mov edx, len1 ; len
int 80h
mov eax, 3 ; read
mov ebx, 0 ; stdin
lea ecx, [input1]
mov edx, 10 ; len
int 80h
mov [inlen1], eax
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [outmsg1]
mov edx, len4 ; len
int 80h
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [input1]
mov edx, [inlen1] ; len
:
mov edx, [inlen1] ; len
int 80h
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [prompt2]
mov edx, len2 ; len
int 80h
mov eax, 3 ; read
mov ebx, 0 ; stdin
lea ecx, [input2]
mov edx, 10 ; len
int 80h
mov [inlen2], eax
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [outmsg1]
mov edx, len3 ; len
int 80h
mov eax, 4 ; write
:
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [input2]
mov edx, [inlen2] ; len
int 80h
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [prompt9]
mov edx, len9 ; len
int 80h
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [input1]
mov edx, [inlen1] ; len
int 80h
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [prompt8]
mov edx, len8 ; len
:
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [input1]
mov edx, [inlen1] ; len
int 80h
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [prompt8]
mov edx, len8 ; len
int 80h
mov eax, 4 ; write
mov ebx, 1 ; stdout
lea ecx, [input2]
mov edx, [inlen2] ; len
int 80h
;Exiting
mov eax, 1
mov ebx, 0
int 80h
Well, I'm pretty sure the above is badly screwed up. I'm having a problem doing something as simple as copying and pasting. If it were right, it would confirm that you don't have a problem.
I notice that you have a prompt for "sum" but don't use it. Do you know how to do that?
Best,
Frank