
 1000  *---------------------------------
 1010  *         PRINTER HANDLER
 1020  * USED SO THAT PROGRAM DOESN'T HANG
 1030  *      WHEN PRINTER IS BUSY
 1040  *
 1050  *           JIM KASSEL
 1060  *       1161 GOODRICH AVE.
 1070  *       ST. PAUL, MN 55105
 1080  *---------------------------------
 1090  PRINT.SLOT.SHIFTED  .EQ $10
 1100  *                   PRINTER SLOT # SHIFTED LEFT BY 4
 1110  PBII   .EQ $CE      PRINT BUFF INPUT INDEX
 1120  PBOI   .EQ $CF      PRINT BUFF OUTPUT INDEX 
 1130  PBCC   .EQ $1F      PRINT BUFF CHAR COUNT
 1140  PBUFF  .EQ $9400    PRINT BUFF BASE ADDRESS
 1150  CR     .EQ $D       CARRIAGE RETURN WITH MSB CLR
 1160  LF     .EQ $A       LINE FEED WITH MSB CLR
 1170  *---------------------------------
 1180  START  .EQ $800
 1190         .OR START
 1200  *---------------------------------
 1210  * PRINT BUFF INPUT SUBROUTINE
 1220  *---------------------------------
 1230  PRINT.FIFO.INPUT
 1240         PHA
 1250         AND #$7F     CLEAR BIT 7
 1260  
 1270  .1     LDY PBII
 1280         STA PBUFF,Y  STORE CHAR IN PRINT BUFF
 1290         INC PBII     INCREMENT INPUT INDEX
 1300         INC PBCC     INCREMENT CHAR COUNT
 1310  
 1320         CMP #CR      CARRIAGE RETURN?
 1330         BNE .2       NO
 1340         LDA #LF      YES
 1350         BNE .1       SEND <LF>
 1360         
 1370  .2     PLA          RESTORE CHAR
 1380         RTS
 1390  *---------------------------------
 1400  * PRINTER OUTPUT SUBROUTINE
 1410  *---------------------------------
 1420  PRINT.FIFO.OUTPUT.1
 1430         LDA PBCC     PRINT BUFF EMPTY?
 1440         BEQ .1       YES
 1450         
 1460         LDY PBOI     NO
 1470         LDA PBUFF,Y  GET PRINT CHAR
 1480         JSR PRINT.FIFO.OUTPUT.2
 1490  *                     HANDLER OF SPECIFIC INTERFACE
 1500         BCS .1       DON'T UPDATE IF PRINTER WAS BUSY
 1510  
 1520         INC PBOI     ELSE, INCREMENT OUTPUT INDEX
 1530         DEC PBCC     AND DECREMENT CHAR COUNT
 1540  
 1550  .1     RTS
 1560  *---------------------------------
 1570  *   HANDLER FOR THE GRAPPLER (+)
 1580  *         INTERFACE CARD
 1590  *      AND MX-80 PRINTER(++)
 1600  
 1610  * PRINT CHAR MUST BE IN THE A-REG
 1620  *   CARRY SET IF CHAR NOT SENT
 1630  *   CARRY CLEARED IF CHAR SENT
 1640  
 1650  PSTAT  .EQ $C081    PRINTER STATUS REG
 1660  PREG   .EQ $C081    PRINTER DATA REG
 1670  PSTRBL .EQ $C082    PRINTER STROBE LOW
 1680  PSTRBH .EQ $C084    PRINTER STROBE HIGH
 1690  *---------------------------------
 1700  PRINT.FIFO.OUTPUT.2
 1710         TAX          SAVE PRINT CHAR
 1720         LDY #PRINT.SLOT.SHIFTED
 1730         LDA PSTAT,Y  GET PRINTER STATUS
 1740         AND #$A      MASK
 1750         EOR #$2      PRINTER SELECTED AND NOT BUSY?
 1760         BNE .1       NO, EXIT
 1770  
 1780         TXA          YES, RESTORE PRINT CHAR
 1790         STA PREG,Y   LOAD PRINTER OUTPUT REG
 1800         STA PSTRBL,Y SET STROBE
 1810         STA PSTRBH,Y CLR STROBE
 1820         CLC          CLEAR CARRY
 1830         BCC .2       EXIT
 1850  .1     SEC          SET CARRY
 1860  
 1870  .2     RTS
 1880  *---------------------------------
 1890  END
 1900  SIZE   .EQ END-START
 1910  *---------------------------------
 1920  * NOTE:
 1930  * (+) : TRADEMARK OF ORANGE MICRO, INC.
 1940  * (++): TRADEMARK OF EPSON AMERICA, INC.
 1950  *---------------------------------

