EUG PD


How To Print At Full Speed

 
Author: Gareth Babb
Published in EUG #7

The one thing about the Plus 1's printer port is that it doesn't run at full speed - the max cps you can get out of it is 100cps, even if your printer can go faster. The reason for this is that the printer port is only polled at 100hz, the hardware in the Plus 1 does not allow for interrupts to be generated when the printer acknowledges characters.

One way round it, if you have got a user port, is to take the necessary line from the printer port to a suitable line on the user port and write some software to do a proper interrupt driven printer system.

The other way is to test the printer every time you print a character. The only problem with this is you lose your printer buffer, but with a buffer you only get 100cps anyway, so what is there to lose? It is quite easy to replace the Plus 1's printer routine with something of your own and here's how:

This program ("U.PRIFAST") works by installing itself as a user printer driver (the FX5,3 automatically selects itself) and every time the OS says a character has gone in the printer buffer, it removes it and polls the printer directly.

To print your text using the m/code file PRND created, make sure to be in the directory where PRND is stored then type *PRND "filename"

       10FOR N=0 TO 3 STEP 3
       20P%=&900
       30[OPT N
       40.user
       50    PHP
       60    CPY #3           ; Our printer type?
       70    BNE userp1       ; No, do nothing
       80    CMP #1           ; Print char?
       90    BNE userp1       ; No, do nothing
      100.wait_for_prn
      110    LDA &FC72        ; Get printer status
      120    BMI wait_for_prn ; Check for ready
      130    CLV              ; Remove char
      140    JSR callremv     ; Call remv
      150    BCS end          ; No char infact
      160    STY &FC71        ; Write char to printer
      170.end
      180    LDA #1           ; Restore A
      190    LDY #3           ; Restore Y
      200    PLP
      210    SEC              ; We don't want polls
      220    RTS
      230.userp1
      240    PLP
      250    JMP (ovec)       ; Pass on call
      260.callremv
      270    JMP (&22C)       ; Indirect call to remv
      280.ovec       EQUW 0   ; Store for old userpv
      290.exec
      300    PHP
      310    SEI
      320    LDA &222         ; Get old routine
      330    STA ovec         ; And store it
      340    LDA &223
      350    STA ovec+1
      360    LDA #user MOD 256; Store new
      370    STA &222
      380    LDA #user DIV 256
      390    STA &223
      400    PLP
      410    LDA #5            ; fx 5,3
      420    LDX #3
      430    JMP &FFF4
      440]
      480NEXT
      490OSCLI"SAVE U.PRND 900 "+STR$P%+" "+STR$exec

To print your text using the m/code file PRND created, make sure to be in the directory where PRND is stored then type *PRND "filename"

Gareth Babb