I'm programmig in x86 assembly language, and I found one problem.
I call C function getch
to get single character from stdin. But the problem is that the return value is stored in register EAX. And I want to know, how to get one character. Not 4 byte value. Thanks.
Asked
Active
Viewed 3,307 times
0
![](../../users/profiles/1348709.webp)
Mike
- 40,613
- 26
- 100
- 171
![](../../users/profiles/2759262.webp)
Smax Smaxović
- 490
- 2
- 7
- 16
-
1What do you want to do with it? Very often you can just ignore the existence of extra bits – harold Oct 15 '13 at 18:22
-
3Note: `getch()` typically returns 1 of **256+1** different values. Hard to fit into one `char`. – chux - Reinstate Monica Oct 15 '13 at 18:31
1 Answers
6
you can use one-byte part of the EAX
that is AL
mov [MEMORY], al
AL
is the LOW byte of the AX
register. You also can use AH
- HIGH byte of the AX
![](../../users/profiles/1885193.webp)
Gangadhar
- 9,510
- 3
- 27
- 48
![](../../users/profiles/1063854.webp)
Mikhail Krayushkin
- 181
- 1
- 7