;***************************************************************************
;* *
;* Printer Driver for Dumping Text Without Control Chars *
;* *
;***************************************************************************
; ASL- -
; NOTICE
;
;All rights reserved. This software is the property of Alpha Microsystems
;and the material contained herein is the proprietary property and trade
;secrets of Alpha Microsystems, embodying substantial creative efforts and
;confidential information, ideas and expressions, no part of which may be
;reproduced or transmitted in any form or by any means, electronic,
;mechanical, or otherwise, including photocopying or input into any
;information storage or retrieval system without the express written
;permission of Alpha Microsystems.
;
;CAUTION: Unauthorized distribution or reproduction of this material may
;subject you to legal action.
;
;Copyright (C) 1983,1984 - Alpha Microsystems
;
SEARCH SYS
SEARCH SYSSYM
COPY PDVSYM
OBJNAM .PDV
VMAJOR=1.
VMINOR=1.
VEDIT=107.
;Edit History:
; Hacked around by IKLF to disable most functions so as to provide
; DUMP.PDV, to dump text without control chars etc. Quick and dirty
; but it works.
;
;[107] 5 August 1984
; Fix problem with leaving bold, underscore or strikeout on across
; multiple lines when left paper offset was non-zero. /RBC
;[106] 8 June 1984
; Make use PDVSYM for all symbols. /RBC
;[105] 3 June 1984
; Output both CR's and LF's to make .LST files VUE compatible. /RBC
;[104] 15 May 1984
; Update impure area definition. /RBC
;[103] 21 April 1984
; Make PDLF output CRLF's instead of just line feeds. /RBC
;[102] 01 Dec 1983
; Major rewrite of module. /PPJ
;[101] 20 February 1983
; Handle special print position code. /RBC
;[100] 12 January 1983
; Created. /RBC
;
PAGE
;************************
;* PDV entry *
;************************
;Define the entry points of the .PDV
;
; CAUTION: Do Not Change the order or size of the entry points.
; If any of the functions are not implemented replace the entry
; point with 'JMP IGNORE'.
;
; A3 indexes the impure area defined above on entry to the driver.
;
PDV: PHDR -1,0,PH$REE!PH$REU
LWORD 0 ; nothing fancy on this printer
JMP PDINI ; PDINI, initialize printer
JMP IGNORE ; PDCLS, shut down printer
JMP PDCHR ; PDCHR, output a character in D1
JMP PDCTL ; PDCTL, output control string indexed by D1
JMP PDSPL ; PDSPL, output special string & character
JMP PDMNLN ; PDMNLN, move to next line & start new line
JMP IGNORE ; PDMTOF, move to Top of Form & setup for new page
JMP IGNORE ; PDPSON, enable proportional
JMP IGNORE ; PDSOF, disable proportional
JMP IGNORE ; PDUNDR, toggle underscore
JMP IGNORE ; PDBOLD, toggle bold
JMP IGNORE ; PDSTRK, toggle strikeout
JMP IGNORE ; PDBAR, toggle over-bar
JMP IGNORE ; PDSLPI, set Lines Per Inch
JMP IGNORE ; PDSHMI, set Horizontal Motion Index
JMP IGNORE ; PDSCPI, set Characters Per Inch
JMP IGNORE ; PDSTM, set Top Margin
JMP IGNORE ; PDMTM, move to Top Margin
JMP IGNORE ; PDSLPO, set Left Paper Offset
JMP IGNORE ; PDMLPO, move to Left Paper Offset
JMP PDSLPP ; PDSLPP, set Lines per Page
JMP PDSLSP ; PDSLSP, set line spacing (in 1/2 lines)
JMP IGNORE ; PDOVRP, setup to overprint last char.
JMP PDLF ; PDLF, output LFs per count in D2
JMP IGNORE ; ENTRY RESERVED FOR ALPHA MICRO
JMP IGNORE ; ENTRY RESERVED FOR ALPHA MICRO
JMP IGNORE ; ENTRY RESERVED FOR ALPHA MICRO
JMP IGNORE ; ENTRY RESERVED FOR ALPHA MICRO
JMP IGNORE ; ENTRY RESERVED FOR ALPHA MICRO
JMP IGNORE ; ENTRY RESERVED FOR ALPHA MICRO
JMP IGNORE ; ENTRY RESERVED FOR ALPHA MICRO
JMP IGNORE ; ENTRY RESERVED FOR ALPHA MICRO
JMP IGNORE ; ENTRY RESERVED FOR USER DEFINITION
JMP IGNORE ; ENTRY RESERVED FOR USER DEFINITION
JMP IGNORE ; ENTRY RESERVED FOR USER DEFINITION
JMP IGNORE ; ENTRY RESERVED FOR USER DEFINITION
JMP IGNORE ; ENTRY RESERVED FOR USER DEFINITION
JMP IGNORE ; ENTRY RESERVED FOR USER DEFINITION
JMP IGNORE ; ENTRY RESERVED FOR USER DEFINITION
JMP IGNORE ; ENTRY RESERVED FOR USER DEFINITION
PAGE
;************************
;* PDSPL *
;************************
; Output a control string & then the byte in D2
; String number is in D1.
;
PDSPL: BCALL PDCTL ; output the string
MOVB D2,D1
ORB #^H80,D1 ; make sure it gets thru TRMSER
FILOTB PTDDB(A3) ; output it
IGNORE: RTN ; just return to caller of .PDV
PAGE
;************************
;* PDCTL *
;************************
; Output a control string.
; String index is in D1
;
PDCTL: CMPB D1,#MAXCDE ; valid special code ?
BHI 99$ ; no, ignore it
ADDW D1,D1 ; make index into word offset
MOVW CTLTBL[~D1],D1 ; get string offset
LEA A6,CTLTBL[~D1]
JMP STROUT ; go output it
99$: RTN
; Printer control string table
; CAUTION: Do Not Change the order of the string table.
; If the string is not implemented put a length of zero at the label.
;
DEFINE STRING TAG
WORD TAG-CTLTBL
ENDM
CTLTBL: STRING CHOME ; 00 return carriage home
STRING MOVAHT ; 01 move to absolute horizontal tab
STRING ROLUP ; 02 roll up a partial line
STRING ROLDWN ; 03 roll down a partial line
STRING NEGLF ; 04 output negative line feed
STRING SPLPT0 ; 05 special print position 0
STRING SPLPT1 ; 06 special print position 1
STRING RIBSC1 ; 07 print in Secondary ribbon color 1
STRING RIBSC2 ; 08 print in Secondary ribbon color 2
STRING RIBSC3 ; 09 print in Secondary ribbon color 3
STRING RIBPRM ; 10 print in Primary ribbon color
STRING FEDTR1 ; 11 select Feeder tray 1
STRING FEDTR2 ; 12 select Feeder tray 2
STRING FEDTR3 ; 13 select Feeder tray 3
STRING FEDTR4 ; 14 select Feeder tray 4
STRING FEDTGL ; 15 select Feeder tray 1 & then tray 2
STRING FEDEJT ; 16 select Feeder eject
STRING USR1 ; 17 user function 1
STRING USR2 ; 18 user function 2
STRING USR3 ; 19 user function 3
STRING USR4 ; 20 user function 4
TBLEND: ; end of table
MAXCDE = <<TBLEND-CTLTBL>/2.> ; maximum special code
PAGE
;************************
;* PDCHR *
;************************
; Output the character in D1
;
PDCHR: FILOTB PTDDB(A3)
ADDW #1,CURCOL(A3) ; advance to next column
BTST #FM%BLD,FM.FLG(A3) ; bold active ?
BEQ 99$ ; no, just return
MOV BLDPTR(A3),A6 ; yes, save this character
MOVB D1,(A6)+
MOV A6,BLDPTR(A3)
99$: RTN
PAGE
;************************
;* STROUT *
;************************
; Output string indexed by A6 to DDB indexed by A3
;
STROUT: SAVE A0,D1,D2 ; save registers
MOV A6,A0
CLR D2
MOVB (A0)+,D2 ; get string length
BR 20$ ; and enter loop at end
10$: MOVB (A0)+,D1 ; get byte from string
FILOTB PTDDB(A3) ; output it
20$: DBF D2,10$ ; loop until all characters output
REST A0,D1,D2 ; restore registers
RTN
PAGE
;************************
;* PDINI *
;************************
; Initialize the printer
;
PDINI: MOVW #-1,HMISAV(A3) ; no HMI yet
MOVW #-1,LPISAV(A3) ; no LPI yet
MOVW #-1,CPISAV(A3) ; no CPI yet
MOVW #-1,TPMSAV(A3) ; no top margin yet
MOVW #-1,LPOSAV(A3) ; no left paper offset yet
CLRW CURCOL(A3) ; at column 0
CLR CURLIN(A3) ; at start of page
RTN
;************************
;* PDCLS *
;************************
; Shut down the printer
;
PDCLS: ; not needed since nothing is altered
PAGE
;************************
;* PDSTM *
;************************
; Set Top Margin from value in D2
; D2 contains the number of lines required in the Top Margin
;
PDSTM: MOVW D2,TPMSAV(A3) ; save top margin value
RTN
;************************
;* PDMTM *
;************************
; Move to Top Margin
;
PDMTM: PUSHW D2 ; save register
MOVW TPMSAV(A3),D2 ; get offset value
BCALL PDLF ; go output line feeds
POPW D2
RTN
;************************
;* PDLF *
;************************
; Output Line feeds per count in D2
;
PDLF: PUSHB D1
BR 15$ ; and enter loop at end
10$: MOVB #$CR,D1 ; output a carriage return [103]
FILOTB PTDDB(A3) ; [103]
MOVB #$LF,D1 ; then a line feed [103]
FILOTB PTDDB(A3) ; output a single space
ADD #2,CURLIN(A3) ; bump number of 1/2 lines
15$: DBF D2,10$ ; and loop until all done
POPB D1
RTN
PAGE
;************************
;* PDSLPO *
;************************
; Set Left Paper Offset
; D2 contains the number of 1/10 inch units required
;
PDSLPO: MOVW D2,LPOSAV(A3) ; save left paper offset
RTN
;************************
;* PDMLPO *
;************************
; Move to Left Paper Offset
;
PDMLPO: SAVE D1,D2
MOVW LPOSAV(A3),D2 ; get offset value
MOVW D2,BLDCOL(A5) ; set bold column in case it is on [107]
MOVW D2,UNDCOL(A5) ; set underline column in case it is on [107]
MOVW D2,STKCOL(A5) ; set strikeout column in case it is on [107]
MOVB #$SPC,D1 ; get a space
BR 15$ ; and enter loop at end
10$: ADDW #1,CURCOL(A3) ; bump current column
FILOTB PTDDB(A3) ; output a single space
15$: DBF D2,10$ ; and loop until all done
REST D1,D2
RTN
PAGE
;************************
;* PDSLPP *
;************************
; Set lines per page
; D2 contains the form length in number of lines
;
PDSLPP: MOVW D2,LPPSAV(A3) ; save for later
RTN
PAGE
;************************
;* PDSLSP *
;************************
; Set line spacing
; D2 contains the number of 1/2 lines
;
PDSLSP: MOVW D2,LSPSAV(A3) ; save for later
RTN
PAGE
;************************
;* PDMTOF *
;************************
; Move to Top of Form and setup for new page
;
PDMTOF: CLR D7
MOVW LPPSAV(A3),D7 ; get lines per page
ADD D7,D7 ; convert to number of 1/2 lines
CMP D7,CURLIN(A3) ; are we already at new page ?
BEQ 10$ ; yes, don't output a Form Feed
PUSHB D1 ; save register
MOVB #$FF,D1
FILOTB PTDDB(A3) ; output a Form Feed
POPB D1 ; restore register
10$: CLR CURLIN(A3) ; at start of page
RTN
PAGE
;************************
;* PDMNLN *
;************************
; Move to Next Line and setup for new line
;
PDMNLN: SAVE D1,D2
CALL BLDTST ; go output bold (if any)
CALL UNDTST ; go output underline (if any)
CALL STKTST ; go output strikout (if any)
;[105] MOVB #$CR,D1
;[105] FILOTB PTDDB(A3) ; output the CR
CLRW CURCOL(A3) ; back to column 0
MOVW LSPSAV(A3),D2 ; get current line spacing
ADDW #1,D2 ; round it up
LSRW D2,#1 ; convert to number of whole LFs
BR 20$ ; enter at end of loop
10$: ADD #2.,CURLIN(A3) ; bump current line number by full line
MOVB #$CR,D1 ; output a carriage return [105]
FILOTB PTDDB(A3) ; [105]
MOVB #$LF,D1 ; [105]
FILOTB PTDDB(A3) ; output the LF
20$: DBF D2,10$ ; and loop until done
REST D1,D2
RTN
PAGE
;************************
;* PDUNDR *
;************************
; Toggle Underscore
;
PDUNDR: BCHG #FM%UND,FM.FLG(A3) ; toggle underscore
BNE UNDOUT ; and go do it if end of field
MOVW CURCOL(A3),UNDCOL(A3) ; or set field start
RTN
; Test for underscore and output it if true
;
UNDTST: BTST #FM%UND,FM.FLG(A3) ; underscore active ?
BEQ UNDOTX ; no, just return
; Output everything up to here & return the carriage home
;
UNDOUT: SAVE D1,D2
MOVB #$CR,D1 ; get a carriage return
FILOTB PTDDB(A3) ; and output it
; Output leading spaces until start of underscore field
;
MOVW UNDCOL(A3),D2 ; get start of underscore field
MOVB #$SPC,D1 ; get a space
BR 15$ ; and enter loop at end
10$: FILOTB PTDDB(A3) ; output a space
15$: DBF D2,10$ ; loop until start of underline field
; Output the required number of underscores
;
MOVW CURCOL(A3),D2 ; get field end
SUBW UNDCOL(A3),D2 ; and calculate field length
MOVB #'_,D1 ; get underscore
BR 25$ ; and enter loop at end
20$: FILOTB PTDDB(A3) ; output an underscore
25$: DBF D2,20$ ; loop until end of underscore field
REST D1,D2
UNDOTX: CLRW UNDCOL(A3)
RTN
PAGE
;************************
;* PDBOLD *
;************************
; Toggle Bold
;
PDBOLD: BCHG #FM%BLD,FM.FLG(A3) ; bold enabled ?
BNE BLDOUT ; and go do it if end of field
MOVW CURCOL(A3),BLDCOL(A3) ; or set field start
LEA A6,BLDBUF(A3) ; index the bold buffer
MOV A6,BLDPTR(A3) ; and save
RTN
; Test of bold and output it if true
;
BLDTST: BTST #FM%BLD,FM.FLG(A3) ; bold active ?
BEQ BLDOTX ; no, just return
; Setup to do bold & then do it
;
BLDOUT: SAVE A2,D1-D2
MOV BLDPTR(A3),A2 ; index the buffer
CLRB @A2 ; terminate the bold string
CALL BLDIT ; output bold string
CALL BLDIT ; output bold string
REST A2,D1-D2
BLDOTX: LEA A6,BLDBUF(A3) ; index the start of the buffer
MOV A6,BLDPTR(A3)
CLRW BLDCOL(A3)
RTN
; Do the actual bold output
;
BLDIT: MOVB #$CR,D1 ; get a carriage return
FILOTB PTDDB(A3) ; and output it
; Output leading spaces until start of bold field
;
MOVW BLDCOL(A3),D2 ; get start of bold field
MOVB #$SPC,D1 ; get a space
BR 15$ ; and enter loop at end
10$: FILOTB PTDDB(A3) ; output a space
15$: DBF D2,10$ ; loop until start of bold field
; Output the required bold string
;
LEA A2,BLDBUF(A3) ; index the bold buffer
20$: MOVB (A2)+,D1 ; get a character from bold string
BEQ 99$ ; terminate on null
FILOTB PTDDB(A3) ; output a character
BR 20$ ; loop until null
99$: RTN
PAGE
;************************
;* PDSTRK *
;************************
; Toggle strikeout
;
PDSTRK: BCHG #FM%STK,FM.FLG(A3) ; toggle strikeout flag
BNE STKOUT ; and go do it if end of field
MOVW CURCOL(A3),STKCOL(A3) ; or set field start
MOVB D1,STKCHR(A3) ; save strikeout character
RTN
; Test for strikeout and output it if true
;
STKTST: BTST #FM%STK,FM.FLG(A3) ; strikeout active ?
BEQ STKOTX ; no, just return
; Output everything up to here & return the carriage home
;
STKOUT: SAVE D1,D2
MOVB #$CR,D1 ; get a carriage return
FILOTB PTDDB(A3) ; and output it
; Output leading spaces until start of strikeout field
;
MOVW STKCOL(A3),D2 ; get start of strikeout field
MOVB #$SPC,D1 ; get a space
BR 15$ ; and enter loop at end
10$: FILOTB PTDDB(A3) ; output a space
15$: DBF D2,10$ ; loop until start of strikeout field
; Output the required number of strikeout
;
MOVW CURCOL(A3),D2 ; get field end
SUBW STKCOL(A3),D2 ; and calculate field length
MOVB STKCHR(A3),D1 ; get strikeout character
BR 25$ ; and enter loop at end
20$: FILOTB PTDDB(A3) ; output an strikeout
25$: DBF D2,20$ ; loop until end of strikeout field
REST D1,D2
STKOTX: CLRW STKCOL(A3)
RTN
PAGE
;************************
;* PDOVRP *
;************************
; Setup to overprint the last character
;
PDOVRP: SAVE D1,D2
MOVB #$CR,D1 ; get a carriage return
FILOTB PTDDB(A3) ; and output it
; Output leading spaces until positioned over last character
;
MOVW CURCOL(A3),D2 ; get start position of last char.
BEQ 5$
SUBW #1,D2 ; adjust to actual column number
MOVW D2,CURCOL(A3)
5$: MOVB #$SPC,D1 ; get a space
BR 15$ ; and enter loop at end
10$: FILOTB PTDDB(A3) ; output a space
15$: DBF D2,10$ ; loop until positioned over last char
REST D1,D2
RTN
PAGE
;*********************
;* Carriage Movement *
;*********************
; Move to Absolute Horizontal Tab
;
MOVAHT: BYTE 0