Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting input from user

Status
Not open for further replies.

ogito

Programmer
Nov 14, 2003
4
0
0
US
I need to get input from the user, check the range of the number, then reprint the number to the screen. This is what I have so far

Code:
main:

	mov ax, 0
	mov [sum], ax

beg:
	mov eax, 3
	mov ebx, 0
	mov ecx, chr
	mov edx, 3
	int 0x80

	cmp byte [chr], 0x30
	jb e1
	cmp byte [chr], 0x39
	ja e1
   ;;This converts the input into a number
	
	mov ax, [sum]
	imul ax, 10
	mov bx, 0
	mov bl, [chr	sub bl, 0x30
	add ax, bx
	mov [sum], ax
	jmp beg
;;Check the number 
e1:	cmp word [sum], 125
	ja tobig
	mov ecx, right
	mov edx, rlen
	jmp e2

;	mov al, [sum]
;	mov si, 0

;e3:	mov ah, 0
;	mov bl, 10
;	idiv bl
;	add ah, 0x30
;	mov [num], ah
;	inc si
;	cmp al, 0
;	je e2
;	jmp e3


tobig:	mov ecx, big
	mov edx, blen


e2:	mov eax, 4
	mov ebx, 1
	int 0x80
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top