AppleTalk #4
Printing Through the Firmware

Revised by Jim Luther (September 1990)
Written by Matt Deatherage & Jim Luther (July 1989)

This Technical Note discusses considerations of printing through the AppleTalk Remote Print Manager (RPM) interface from ProDOS 8 applications.

Changes since March 1990: Revised code sample to simplify finding the transparent network printing slot with the ROM 03 Apple IIgs. Please note that the method of finding the transparent network printing slot shown in the March 1990 revision of this Note does work correctly, the new method is just simpler. In addition, revised the wording of the Note to clarify that transparent network printing is the RPM interface.


The AppleShare Programmer's Guide to the Apple IIgs stated that the Remote Print Manager (RPM) interface allowed transparent network printing through Super Serial Card entry points in slot 7. This statement is pretty short-sighted. It's much like saying printing to an ImageWriter II is initiated when you do a PR#1 command -- it's only true if what you want is where you think it is -- and usually it isn't.

Note: The AppleShare Programmer's Guide to the Apple IIgs has been superseded by the AppleShare Programmer's Guide to the Apple II Family.

An Apple IIe Workstation Card, although recommended for slot 7, can work in almost any slot (just like an ImageWriter II with a Super Serial Card can be connected to nearly any slot, except maybe slot 3 when the 80-column firmware is active). An Apple IIgs with ROM versions 00 or 01 may only have the firmware used by the RPM interface in slot 7. An Apple IIgs with ROM version 03 may only have the firmware used by the RPM interface in either slot 1 or 2.

Before printing through the RPM interface slot, take the same precautions you would take before printing to any slot -- check to make sure you see the requested slot is a Pascal device before using Pascal entry points, and try to look for the signature bytes that indicate the features you want are present. In general, avoid hard-coding slot numbers for anything.

ProDOS 8 applications which offer network printing through the RPM interface should give users the choice of printing to any of the seven slots as well as the Network Printer. When Network Printer is selected, the application can find the slot used by the RPM interface by using the 6502 code sample included in this Note. Allowing the selection of Network Printer is especially important for applications that keep a configuration file containing a user's default printer setup. If an application keeps only the slot number in the configuration file, users may need to change the printer selection often if they print from several different machines.

Warning: Printing to a slot with no firmware generally results in a crash.

The code sample uses two methods to determine the slot the RPM interface is using. The first method works with the Apple IIe Workstation card and the ROM 01 Apple IIgs. It looks at the AppleTalk completion routine address returned by the AppleTalk GetInfo call, and if that address is in the slot ROM space, then that slot is the slot used by the RPM interface. In other words, if the completion routine points to $0000CnXX, where n is between 1 and 7, then n is the slot to be used when printing through the RPM interface. If the completion routine address is not in the slot ROM space, then the application cannot determine what slot the RPM interface is using and must query the user. The second method works only with the ROM 03 Apple IIgs. It retrieves the slot the RPM interface is using from location $E101C2.

This technique applies only to ProDOS 8 programs. Apple IIgs applications running under GS/OS should do text printing over the network through the Remote Print Manager (.RPM) driver, which can be identified by a deviceID of $001F as returned from the DInfo call.


;
; This routine will identify AppleTalk and the RPM interface slot 
; (if possible).
; This routine is for ProDOS 8 applications only.
;
                    keep FindRPMSlot
                    longa off
                    longi off

FindRPMSlot         start
                    lda #$00
                    sta RPMSlot         default to no RPM interface slot

; Check for AppleTalk (see AppleTalk Technical Note #1)

                    jsr $BF00           ProDOS 8 MLI
                    dc  h'42'           $42 command for network calls
                    dc  a'InfoParams'   Parameter list address
                    bcs NoATalk         no AppleTalk; handle the error

; Get machine type & ROM version (see Apple II Miscellaneous Tech Note #7)

                    sec
                    jsr $FE1F           What kind of machine are we on?
                    bcs CheckCom        Not a IIGS, check completion address
                    cpy #$03
                    bcc CheckCom        Earlier than ROM 03 IIGS, check
;                                         completion address

ROM03               anop                ROM 03 or greater IIGS' use location 
;                                       $E101C2 to find the RPM interface slot
                    lda $E101C2         Get the RPM interface slot
                    sta RPMSlot

                    beq AskForSlot
                    bra HaveSlot

CheckCom            anop                use completion address to find slot
                    lda ComReturn+2     bank $00?
                    ora ComReturn+3     high byte = 0?
                    bne AskForSlot      no, so slot can't be determined
                    lda ComReturn+1     get the address page
                    cmp #$C8
                    bcs AskForSlot      greater or equal to $C8 is bad
                    cmp #$C1
                    bcc AskForSlot      less than $C1 is bad
                    and #$0F            $Cn = $0n
                    sta RPMSlot

HaveSlot            anop                AppleTalk is installed and RPM is 
;                                         using slot #RPMSlot

AskForSlot          anop                AppleTalk is installed but RPM 
 ;                                        interface slot cannot be determined

NoATalk             anop                AppleTalk is not installed

                    rts                 so this sample returns

RPMSlot             entry
                    dc  h'00'           Slot RPM interface is using

InfoParams          dc  h'00'           Synchronous only
                    dc  h'02'           GetInfo call number
                    ds  2               result code
ComReturn           ds  4               completion return address
                    ds  8               space for other result info

                    end

Further Reference


This and all of the other Apple II Technical Notes have been converted to HTML by Aaron Heiss as a public service to the Apple II community, with permission by Apple Computer, Inc. Any and all trademarks, registered and otherwise, are properties of their owners.