WonderWitch/FreyaBIOS/Communication
From WSdev Wiki
Jump to navigationJump to search
The Communication (comm) interrupt provides an abstraction layer and helpers for the WonderSwan's serial port.
Interrupts
INT $14/AH=$00 - comm_open
- AH = $00
Opens the serial port. Note that the baud rate must be set before calling comm_open
.
INT $14/AH=$01 - comm_close
- AH = $01
Closes the serial port.
INT $14/AH=$02 - comm_send_char
- AH = $02
- BL = Character (byte) to send.
Return:
- AX = Return code.
Return codes:
- 0x0000 - Success
- 0x8101 - Transfer timeout
- 0x8102 - Transfer RX overrun
- 0x8103 - Transfer cancelled
INT $14/AH=$03 - comm_receive_char
- AH = $03
Return:
- AX = Character (byte) read (0x0000 - 0xFFFF) or error return code.
INT $14/AH=$04 - comm_receive_with_timeout
- AH = $03
- CX = Timeout, in frames (as in
comm_set_timeout
).
Return:
- AX = Character (byte) read (0x0000 - 0xFFFF) or error return code.
Unlike comm_receive_char
, this function uses an user-provided timeout.
INT $14/AH=$05 - comm_send_string
- AH = $05
- DS:DX = Input string to send.
Return:
- AX = Return code.
INT $14/AH=$06 - comm_send_block
- AH = $06
- CX = Buffer size, in bytes.
- DS:DX = Input buffer to send.
Return:
- AX = Return code.
INT $14/AH=$07 - comm_receive_block
- AH = $07
- CX = Buffer size, in bytes.
- DS:DX = Buffer to receive bytes to.
Return:
- AX = Return code.
- DX = Number of bytes successfully received.
INT $14/AH=$08 - comm_set_timeout
- AH = $08
- BX = Receive timeout (in frames; 0xFFFF - wait forever)
- CX = Send timeout (in frames; 0xFFFF - wait forever)
INT $14/AH=$09 - comm_set_baudrate
- AH = $09
- BX = Baud rate (0 = 9600 bps, 1 = 38400 bps).
Only affects newly opened serial port connections.
INT $14/AH=$0A - comm_get_baudrate
- AH = $0A
Return:
- AX = Baud rate (0 = 9600 bps, 1 = 38400 bps).
INT $14/AH=$0B - comm_set_cancel_key
- AH = $0B
- BX = Cancel key combination.
INT $14/AH=$0C - comm_get_cancel_key
- AH = $0C
Return:
- AX = Cancel key combination.
INT $14/AH=$0D - comm_xmodem
TODO