AH = 02h: Receive One Character
This function returns the character received by the serial port. The sequence of operations performed is
- 01h is written to the Modem Control Register (DTR on, RTS off).
- Loop waiting for xx1xxxxxb (DSR) in the Modem Status Register.
- Loop waiting for xxxxxxx1b (Data Ready) in the Line Status Register.
- Reset display timeout counter (Avoid Auto-Turn Off).
- Input char from the Receive Buffer.
Either of the above loops can result in a timeout error.
- Input: AH = 02h
DX = Port# (0 = Built-In Serial Port).
- Output: AH = LSR (except: Only bits 1,2,3,4, and 7 are returned.)
AL = Char received (valid only if AH = 0)
- Error conditions: If AH[7]=1, a timeout error has occurred and all other data is invalid. If AH[7]=0, but AH is non-zero, a transmission error has occurred, and the character in AL should be discarded.
- Registers modified: AX