I am attempting to write assembly code for linux using nasm. I have an include file containing io functions that was originally written for windows using masm and I am trying to convert it. I have on procedure that I am having problems with. The procedure is supposed to recieve on character of input from the keybard. The windows version only allow you to input one character. Once a key is pressed the program continues with out requireing you to press the enter key. The version I have modified does not do this. It requires you to press enter and when you do it acts as if it is reading two characters, I am assuming this is because it is reading the enter key as well as the character typed. This casues the program to exit and I get two prompts after it ends, as if I was at the prompt and just pressed enter. I am including the code below. Can anyone tell me how to remedy this?

;********************procedure to get char from keyboard*******************
;Given	 : variable to store to in esi
;Process : make linux system call to get character from keyboard.
;Returns : nothing
;Author	 : Jason T. Murphree
;************************************************************************
getChar:
	pushad		;save registers
	pushfd		;save flags
	
	mov eax, 3		;sys_read(3)
	mov ebx, 0		;stdin (0)
	mov ecx, esi		;string to store to
	mov edx, 1		;number of bytes to read
	int 0x80		;interupt for linux
	
	
	
	popfd			;restore flags
	popad			;restore registers
	ret			;return to calling procedure

Thanks, that is exactly what I needed

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.