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,764 times
1
Mike
- 47,263
- 29
- 113
- 177
Smax Smaxović
- 550
- 2
- 7
- 17
-
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
7
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
Gangadhar
- 10,248
- 3
- 31
- 50
Mikhail Krayushkin
- 311
- 3
- 7