The serial port XCMDs allow HyperTalk programs to read and write both of the serial ports. They closely follow the calls available in the Mac OS. All the commands and func-tions take a «port» parameter, which is 1 for the modem port or 2 for the printer port.
openSPort «port» — This command opens the serial driver for the port.
resetSPort «port»,«configuration» — This command resets the port and sets the baud rate,
parity, number of stop bits, and number of data bits according to «configuration». See
pages II-250 and II-251 of Inside Macintosh for valid configuration values.
bufferSPort(«port»,«oldBuffer»,«newBuffSize») — This function is used to change the
buffer used to store incoming serial port characters. It performs three functions: it
deallocates the old buffer, if any; it allocates a new buffer, if any; and it sets the
buffer to be used. The allocation is performed using NewPtr, so it is VERY important
that a matching DisposPtr be invoked before exiting HyperCard (otherwise, the
buffer will be automatically deallocated despite the fact that the serial port is still
using it. The normal way to use bufferSPort, therefore, is to call it twice: On
openStack, "put bufferSPort(«port»,0,«newBufferSize») into theBuffer" allocates a
new buffer of «newBufferSize» bytes and installs it; theBuffer is a global variable.
On closeStack, "bufferSPort(«port»,theBuffer,0)" tells the port to use the deafult serial
port buffer, and deallocates the buffer we allocated in the first call.