Sim68K Serial I/O
TRAP #15 is used for I/O. Put the task number in lower 8 bits of D0.
The success of the Serial I/O calls is returned in
D0.W as follows:
0 = Success
1 = Invalid port identifier (PID)
2 = Error
3 = Port not initialized (Tasks 41, 42, 43 only)
4 = Timeout (Tasks 42, 43 only)
A maximum of 16 communications ports are supported.
40 |
Initialize communications port. This must be called once for each port before any other serial I/O function. The port defaults to 9600 baud, 8 data bits, no parity, one stop bit. Pre: High 16 bits of D0 contain port identifier (PID), (0 through 15). The PID is used to identify the port in all other serial I/O tasks. It is not used to specify the COM port number, (i.e. A PID of 4 does not mean the same thing as COM4) (A1) address of serial port name as null terminated string (e.g. PORT DC.B 'COM4',0) Post: D0.W is 0 on success, 1 on invalid PID, 2 on error Example:
; initialize serial port
Visit www.EASy68K.com
for examples. |
41 |
Set port parameters. Pre: High 16 bits of D0 contain port identifier (PID) D1.L Bits 0-7 (D1.B) Baud rate: 0=9600(default), 1=110, 2=300, 3=600, 4=1200, 5=2400, 6=4800, 7=9600 8=19200, 9=38400, 10=56000, 11=57600, 12=115200, 13=128000, 14=256000. Bits 8-9 Parity: 0=no, 1=odd, 2=even, 3=mark Bits 10-11 Number of data bits: 0=8 bits, 1=7 bits, 2=6 bits Bit 12 Stop bits: 0=1 stop bit, 1=2 stop bits The higher bits of D1.L are reserved for future use. Post: D0.W is 0 on success, 1 on invalid PID, 2 on error, 3 on port not initialized |
42 |
Receive string. Pre: High 16 bits of D0 contain port identifier (PID) (A1) buffer address. D1.B max number of characters to receive. The port will wait sufficient time for the requested number of bytes to be received. A timeout will occur if the number of bytes received is less than the requested number. For faster response use a smaller number in D1.B. Post: D0.W is 0 on success, 1 on invalid PID, 2 on error, 3 on port not initialized, 4 on timeout D1.B number of characters received. (A1) null terminated string of characters received. |
43 |
Send string. Pre: High 16 bits of D0 contain port identifier (PID) (A1) buffer address. D1.B number of characters to send. The port will wait sufficient time for the specified number of bytes to be sent. A timeout will occur if the number of bytes sent is less than the requested number. Post: D0.W is 0 on success, 1 on invalid PID, 2 on error, 3 on port not initialized, 4 on timeout D1.B number of characters sent. |