OUT 1, 255This will turn all of the pins of output port 1 on (5v).
OUT 3, 0This will turn all the pins of output port 2 off (0v). The output is latched, and will retain this setting until it is changed.
IN 1So for example,
PRINT IN 1will print the value read from input port 1
IF IN 3 AND 8 THEN GO TO 100Will test to see if digital input pin 4 on port 2 is high
Yes, this will work on later +2/+3 machines but some adjustment to the port numbers may be necessary to avoid port numbers assigned to the internal hardware on these machines.