Apple IIc: Setting serial port 2's firmware from BASIC

If DOS or ProDOS is in RAM, you can access the firmware of serial port 2 from BASIC using the list of command codes below.
- To change a firmware setting when the port is in terminal mode, issue a CTRL-D (hex 04), IN#2, the command character CTRL-A, and the command code.

- To change a firmware setting when the port is in non-terminal or local mode, issue a CTRL-D (hex 04), IN#2 or PR#2, the command character CTRL-A, and the command code.

- To change the firmware setting without DOS or ProDOS, leave CTRL-D out of the string and issue the IN#2 or PR#2, command character, and code.

As soon as you issue the command character, the serial port firmware displays a flashing question mark cursor to indicate that it's awaiting a command code. If you press RETURN, you get the current video cursor again. You do not have to press RETURN after command codes.

Subsequent input and output are routed to the modem (or other communications device) connected to serial port 2 until the next IN# commands that the input be routed to another port. You can therefore issue the CTRL-D and IN#2 and then a string of command codes, each beginning with the command character CTRL-A, to change more than one setting of the port firmware.

We recommended two substitutes to the command character CTRL-A: CTRL-V and CTRL-W. To make the substitution, issue the current command character and follow it with the substitute command character, e.g. CTRL-A CTRL-V.

For example, to set the port and startup AppleWorks:

1. Write a program to set the Apple IIc port and end the program with the line:

50 D$=CHR$(4)
100 PRINT D$;"-APLWORKS": REM Launch AppleWorks

2. Save the program as STARTUP on the AppleWorks startup disk.

3. Rename the file /APPLEWORKS/APLWORKS.SYSTEM as /APPLEWORKS/APLWORKS to match the named file in line 100 in step 1 above.

4. Copy the file BASIC.SYSTEM to the AppleWorks startup disk.

5. Boot the AppleWorks startup disk. STARTUP will set the port and then pass control to AppleWorks.

- Modem Port Command Codes:

1. Line width
a. Code: A number from 1 through 255 followed by a carriage return.
b. Code: A number from 1 through 255 followed by the letter N. This form of the command code also means that output will not be echoed to the screen.
c. To turn off automatic generation of carriage return, either:
1. use the Z command
2. use the System Utilities Disk.

2. Baud rate

Code Rate
1B 50
2B 75
3B 110 (109.92)
4B 135 (134.58)
5B 150
6B 300
7B 600
8B 1200
9B 1800
10B 2400
11B 3600
12B 4800
13B 7200
14B 9600
15B 19200

3. Data format

Code Data bits Stop bits
0D 8 1
1D 7 1
2D 6 1
3D 5 1
4D 8 2
5D 7 2
6D 6 2
7D 5 2

4. Echo output on the screen

Code Effect
I Output is echoed on the screen.

5. Line feed after carriage return.

Code Effect
K A line feed is not sent after a carriage return.
L A line feed is sent after a carriage return.

6. Parity

Code Parity
0P None
1P Odd
2P None
3P Even
4P None
5P MARK (1)
6P None
7P SPACE (0)

7. Terminal Mode

Code Effect
T Enter Terminal Mode. Use this command after IN#2 only. If you
follow this command by PR#2, the Apple IIc will echo input to
output. If the other device does so too, the first character
entered will loop endlessly, locking up the system. Use
CTRL-RESET to get out.

Q Quit terminal mode.

8. Reset
Code Effect
R Reset port 2 and exit from serial port 2 firmware.

9. Break
Code Effect
S Send a 233 millisecond BREAK character.

10. Ignore
Code Effect
Z Zap (ignore) further command characters until CTRL-Reset.

NOTE: Do not format output or insert carriage returns into output stream.

11. Terminal mode command codes from remote devices
Code Effect
CTRL-T If IN#2 is already in effect, this command puts the Apple IIc in terminal mode, just as does the local command T.

CTRL-R This command undoes the remote terminal mode command. If IN#2 and PR#2 are in effect, the remote keyboard and display become the input and output devices of the local Apple IIc.

WARNING: Apple IIc firmware DOES NOT allow you to use control characters B, C, H, I, J, L, M, or Y: doing so may cause unpredictable effects.
Last Modified: Feb 19, 2012

Additional Product Support Information