Klepto
Member
I'm learning ARM assembly and mostly it's going OK, but I could use some help with reading characters from stdin. I can output to stdout using the following code. PSP and RSP are aliases for the registers I'm using as stack pointers, and OS_write=0x900004.
Basically I need the same to read a character from stdin, but I can't find any documentation on it... Anyone know?
Code:
STMFA RSP!, {r0-r3,LR} @ save registers and return address
MOV r0, #1 @ 1=stdout
MOV r1, PSP @ point at the char
MOV r2, #1 @ write one char
SWI OS_write @ perform the call
ADD PSP, PSP, #1 @ drop the char
LDMFA RSP!, {r0-r3,PC} @ restore regs and return
Basically I need the same to read a character from stdin, but I can't find any documentation on it... Anyone know?