Printer Drivers Printer drivers exist in memory from $7900-$7FFF. This overlaps part of screen 2. Printer drivers are only memory resident when they are in use. GEOS loads the first printer driver that it can find on the disk, whenever it needs to print something. To make a particular printer driver always be the one found, all that must be done is to place it ahead of all the other printer drivers in the directory. There are five entry points to a printer driver. These form a jump table from $7900- $790E. $7900: InitForPrint The first entry point, at $7900, is the master reset. This routine must initialize any global variables that need to be set. This routine is called once when the driver is loaded. Usually only the baud rate it set with this routine. $7903: StartPrint The second entry point, at $7903, is the printer initialization. It is used to initialize the serial bus and open a logical file for the CBM KERNAL to address. This routine is called just prior to printing an image. The X register must be set to an error code if the printer is not available. This error code is the C64's KERNAL status byte at location $90. This routine must initialize any temporary variables used by the driver. $7906: PrintBuffer The third entry point, at $7906, actually performs the printing of a line. Locations $02-$03 R0 point to the bit image graphic data for the line (640 pixels, 8 bits high, 640 bytes). Locations $04-$05 R1 point to a similar buffer area free for use by the driver if it needs it. This is mainly to give printers which only print 7 pixels at a time a place to accumulate the extra bits. Locations $06-$07 R2 point to the color data for the line. This is only for the benefit of color printers. The printer driver must not modify any of these pointers. This routine works by calling SetDevice on device 4 and then calling InitForIO to access the CBM KERNAL. DoneWithIO should be called before returning to the application. $7909: StopPrint The fourth entry point, at $7909, closes the printer. This routine is called when the image is finished. This allows 7 bit printers to print the contents of their buffers. This is also to give the printer driver a chance to print a top of form character. Like PrintBuffer, this routine requires $02-$03 R0 to point to any extra data to print, and $04-$05 to point to a 640 byte buffer for the driver's use. It should send a form-feed for the end of page. $790C: GetDimensions The fifth entry point, at $790C, returns the number of character columns that the printer can print in the X register. The maximum number of lines per page is returned in the Y register. The accumulator is loaded with a zero. This gives applications the ability to compute necessary buffer sizes. Typical values are 80 columns by 90 lines or 60 columns by 90 lines. $790F: PrintASCII The sixth entry point, at $790F, is used for printing lines of ASCII text in draft or nlq modes. $02-$03 R0 should point to a null-terminated line of ASCII text for printing. $04-$05 should point to a 640 byte buffer for print driver use. $7912: StartASCII The seventh entry point, at $7912, is the same as StartPrint except that it prepares the printer for draft or nlq printing. It should set up device 4 for the printer. $7915: SetNLQ This routine should send whatever initialization string to the printer which is necessary for it to print in its NLQ mode.