Apple II Serial Port Firmware Interface Commands also Pascal 1.1 Firmware Protocol serial interface commands and Apple II Super Serial Card commands ref. The Apple IIgs Firmware Reference The Apple IIc Technical Reference Manual The Apple IIe Technical Reference Manual I. The Command Character The normal command character is ... Control-I (ASCII $09) in printer mode Control-A (ASCII $01) in communications mode. You can change the command character. For example, to change the Printer mode command character from Control-I to another character, say, Control-W, send ... Control-I Control-W. To change back, send ... Control-W Control-I. No return character is required after either of these commands. In case you want to send the current command character through the output stream, the Apple Super Serial Card (or "SSC") allows you to do it by sending the character twice in a row. The built-in serial ports do not allow this; the character will not be output. To send the command character through a built-in serial port, you must temporarily change to an alternate command character. For example, if the current command character is Control-I and you want to send a Control-I out the serial port, then send Control-I Control-A Control-I Control-A Control-I The first two characters change the command character to a Control-A. The third character is the Control-I you wanted to send. The fourth and fifth characters restore the command character to Control-I again. An alternative is to disable all command-character parsing by using the Z command. II. Command Strings A command string is a letter sometimes with a number prefix and sometimes with an E or a D suffix (for "enable" or "disable). Command strings select the option to be used; for instance, they may change the baud rate, select the data format, and set the parity. To generate a command in Applesoft BASIC, enter PRINT CHR$ ( 9); "command-string": REM Sends Control-I and a command string For Pascal, enter WRITELN (CHR(9), 'command-string'); The following example shows how to generate commands from a BASIC program: 10 D$ = CHR$(4) : REM Printing D$ will send Control-D (a CR) 20 I$ = CHR$(9) : REM Printing I$ will send Control-I 30 PRINT D$; "PR#l": REM Establishes link: BASIC to port 1 40 PRINT I$; "6B" : REM Changes to 300 baud 50 ... : REM Continue program The commands in the following sections are generated from the keyboard. III. Printer/Communications mode Commands The following commands are typically useful in either printer or communications mode. (Discussion examples use the printer mode command character, Control-I. In communications mode, you would use Control-A.) Baud rate, nB You can use the nB command to select the baud rate for the serial-port firmware. For example, to change the baud rate to 9600, send Control-I 14B CR to the serial-port firmware (see Table 5-1). Table 5-1 Baud-rate selections n Baud rate n Baud rate _____________________________ 0 Default* 8 1200 1 50 9 1800 2 75 10 2400 3 110 11 3600 4 134.5 12 4800 5 150 13 7200 6 300 14 9600 7 600 15 19,200 *On the IIgs, you set the default by using the Control Panel. Data format, nD You can override the Control Panel setting that specifies the data format by using the nD command. Table 5-2 shows how many data bits and stop bits correspond to each value of n. For example, Control-I 1D makes the serial-port firmware transmit each character in the form of 1 start bit (always transmitted), 7 data bits, and 1 stop bit Table 5-2 Data-format selections n Data Stop bits bits _____________ O 8 1 (standard setting) 1 7 1 2 6 1 3 5 1 4 8 2 5 7 2 6 6 2 7 5 2 Parity, nP You can use the nP command to set the parity you want to use for data transmission and reception. Table 5-3 Parity selections n Parity _____________ 0 None (standard setting) 1 Odd 2 None 3 Even 4 None* 5 MARK (1)* 6 None* 7 SPACE (0)* *Not available on IIgs The SCC 8530 does not support MARK and SPACE parity. Line length, nN The line length is set by sending Control-I nN. The number n can be in the range of 1 to 255 characters. For example, if you send Control-I 75N, the line length is set to 75 characters. (Note: Use the C command, discussed next, to enable line formatting.) If you set n to 0, formatting is disabled. Line formatting Enable/Disable, CE and CD A forced carriage return is invoked after a lineful of characters by sending Control-I CE. For example, Control-I 75N (see "Line Length" above) and Control-I CE cause a forced carriage return after 75 characters are typed on a line. Handshaking protocol, XE and XD Sending Control-I XE CR or Control-I XD CR to the serial-port firmware determines whether the firmware looks for any XOFF ($13) character coming from a device attached to the SCC. It responds by halting transmission of characters until the serial-port firmware receives an XON ($11) character from the device, signaling the SCC to continue transmission. In printer mode, this function normally is disabled. XE = Detect XOFF, await XON. XD = Ignore XOFF. Keyboard input, FE and FD The FD command is used to make the serial-port firmware ignore keyboard input. For example, you can include Control-I FD CR in a program, followed by a routine that retrieves data through the serial-port firmware, followed by Control-I FE CR to turn the keyboard back on. As a default, the serial-port firmware keyboard input is enabled. FE -Insert keystrokes into serial-port firmware input stream. FD -Disable keyboard input. Automatic line feed, LE and LD The automatic line-feed command causes the serial-port firmware to generate and transmit a line-feed character after each return character. For example, use Control-I LE CR to print listings or double-spaced text. LE -Add line feeds after each carriage return output LD -Do not add line feeds after carriage return output. Reset the serial-port firmware, R The R command resets the serial-port firmware, cancels all previous commands to the serial-port firmware and reinstalls the Control Panel default settings. Sending Control-I R CR to the serial-port flfmware has the same effect as sending PR#O and N#O to a BASIC program and then resetting the serial-port firmware. This call also relinquishes any memory obtained from the Memory Manager for buffering purposes. Suppress control characters, Z The Z command causes all further commands to be ignored. This command is useful when the data you are transmitting (for instance, graphics data) contains bit patterns that the serial-port firmware could mistake for control characters. Sending Control-I Z CR to the serial-port firmware prevents the firmware from recognizing any further control characters, whether from the keyboard or contained in a stream of characters sent to the serial-port firmware. All tabbing and line formatting are disabled after a ControlI Z command. Important Note The only way to reinstate command recognition after the Z command Is either to Initialize the serlal-port firmware or to use the SetModeBlts call. IV. Communications mode Commands The following commands are typically most useful in communications mode. (Discussion examples use the communications mode command character, Control-A.) Terminal mode, T and Q The T command transfers you to terminal mode. In this mode, you can communicate with another computer or a computer time-sharing service. Terminal mode is entered through the BASIC interface. This means that you must initialize the firmware by typing IN#n and then sending Control-AT. Note: IN#n sets the port input link, and PR#n sets the port output link. The lowercase n indicates the port number. To quit terminal mode, send Control-AQ. Send a Break, S Often, when communicating with another computer in terminal mode, you want to send a break character to signal the other computer that you wish to signal the end of the current segment of transmission. To send a break character, send Control-AS CR. This command causes the serial hardware to transmit a 233-millisecond break signal, recognized by most time-sharing systems as a sign-off signal. Echo characters to the screen, EE and ED The EE and ED commands are used to display (echo) or not to display a character on the video screen during communication. For example, if you send Control-A ED CR, the serial-port firmware disables the forwarding of incoming characters to the screen. This command can be used to hide a password entered at a terminal or to avoid the double display of characters. EE = Echo input. ED = Don't echo input. Mask line feed in, ME and MD If you send Control-A ME to the serial-port firmware, the firmware will ignore any incoming line-feed character that immediately follows a return character. Input/Output buffering, BE and BD The BE and BD commands control input and output communication buffering. Scanning, reformatting, and minor mods: R/ 2004