working on inputing floating point values into an array, then adding them up and getting a sum

so far i have this code for it, but my flag that checks to see if an input is 0 to exit the loop for entering floats, keeps on going(endless loop)

%include "asm_io.asm"

segment .bss
array1		resd 	20
segment .data
done		db	"That was ridiculously incredible! Bye!", 0
segment .text
	extern puts, _printf, scanf, dump_line, stack_dump, geomean
	global asm_main

asm_main:
	enter 0,0
	pusha
;Declare Array:
	push 20
	push 0
	push array1
	
	call	read_sarray32

	;call getfloat
	;call putfloat

	xor ebx, ebx
	mov eax, 1
	int 80h
	
	mov	eax, done
	call	print_string

	popa
	leave
	ret

;beginning of get float
;*******************************getFLoat:*****************************
segment .bss
;
segment .data
	fmt1 		db "%lf", 0
	enterNumber 	db "Enter Your Float Number: ", 0
segment .text
getfloat:
	push ebp
	mov	eax, enterNumber
	call	print_string
	mov ebp, esp
	sub esp, 8
	lea eax, [ebp-8]
	push eax
	push fmt1
	call scanf
	add esp, 8
	
	fld qword [ebp -8]
	mov esp, ebp
	pop ebp
	ret
;Beginning of putfloat
;************************putfloat:*****************************************
segment .bss
;
segment .data
	fmt2 db 10, "The number is: %f", 10, 0
segment .text
putfloat:
	push ebp
	mov ebp, esp
	sub esp, 8

	fst qword [ebp - 8]
	push fmt2
	call printf
	add esp, 12

	mov esp, ebp
	pop ebp
	ret
;*********************READ array*************************************************
segment .bss
;
segment .data
prompt2		db	"Do you have more inputs? (-1 = yes,0 = no)?: ", 0

segment .text
read_sarray32:
	pusha
	mov	ebx, [esp+36]	;move starting position into ebx
	mov	edx, [esp+40]	;move max size into edx
	mov	ecx, 0
read_loop:		
	;mov 	eax, prompt2
	;call 	print_string
	;call 	read_int
	call	getfloat
	inc 	ecx;		increment counter
	cmp	eax, 12	
	jnc	Done
	jmp	continue_loop
continue_loop:
	mov 	[ebx], eax	;move value into memory slot ebx
	add	ebx, 8		;move to next location for db word
	
	cmp	ecx, edx	; did i reach maximum values of array size?
	jz	Done
	jmp	read_loop
Done:
	call	putfloat
	sub	ecx, 1		;to offset the 0 that was entered to exit loop
	mov	[esp+44], ecx	;moves counter back to stack
	popa
	ret

oh on line 97, i had 12 because i was testing a different number, but i changed it back to 0

I am just starting asm in my cs class. What architecture is this?

I am just starting asm in my cs class. What architecture is this?

It is INTEL/AMD x86

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.