OBJNAM AWTEST.PDV ; AlphaWRITE test printer driver by Irv Bromberg
SEARCH SYS
SEARCH SYSSYM
COPY PDVSYM
OBJNAM .PDV
VMAJOR=1.
VMINOR=3.
VEDIT=4.
if eq,1
Edit history:
25-Jul-88 fix symbols to assemble under pre-2.0 assembler
17-Jun-88 1.3(4) add PD$FED flag; always output to .LST file without spooling
18-May-88 1.2(3) fix PDLF to show "linefeeds"
endc
Buffer=A2
DDB=A2
IMP=A3
Atemp=A6
Char=D1
CrtCmd=D1
Number=D1
Value=D2
Cmd=^H0FF00
PDV: PHDR -1,0,PH$REE!PH$REU
; flags: variable & proportional spacing, sheet feeder
LWORD PD$VAR!PD$PRO!PD$FED
JMP PDINI ; initialize printer
JMP PDCLS ; shut down printer
JMP PDCHR ; output a character in D1
JMP PDCTL ; output control string indexed by D1
JMP PDSPL ; output special string & character
JMP PDMNLN ; move to next line & start new line
JMP PDMTOF ; move to Top of Form & setup for new page
JMP PDPSON ; enable proportional
JMP PDSOF ; disable proportional
JMP PDUNDR ; toggle underscore
JMP PDBOLD ; toggle bold
JMP PDSTRK ; toggle strikeout
JMP PDBAR ; toggle over-bar
JMP PDSLPI ; set Lines Per Inch
JMP PDSHMI ; set Horizontal Motion Index
JMP PDSCPI ; set Characters Per Inch
JMP PDSTM ; set Top Margin
JMP PDMTM ; move to Top Margin
JMP PDSLPO ; set Left Paper Offset
JMP PDMLPO ; move to Left Paper Offset
JMP PDSLPP ; set Lines per Page
JMP PDSLSP ; set line spacing (in 1/2 lines)
JMP PDOVRP ; setup to overprint last char.
JMP PDLF ; output LFs per count in D2
JMP PDDBL ; toggle double underscore
JMP PDFONT ; select font # in D1
JMP Res1 ; entries reserved for Alpha Micro
JMP Res2
JMP Res3
JMP Res4
JMP Res4
JMP Res5
JMP Res6
JMP Res7
JMP User1 ; entries reserved for user definition
JMP User2
JMP User3
JMP User4
JMP User5
JMP User6
JMP User7
JMP User8
PDSPL: ; output control string (code# in D1) & then the byte in D2
; in the format: <string=#>
BCALL PDCTL
CLR Number
MOVB Value,Number
NumOut: ; expects LWORD in Number=D1 to output in format: #>
PUSH DDB
LEA DDB,PTDDB(IMP)
OCVT 0,OT$DDB ; set desired RADIX at monitor level
POP DDB
MOVB #'>,Char
FILOTB PTDDB(IMP)
JMP DoCRLF
PDCTL: ; output control string (code# in D1)
LEA Atemp,BadCode ; default to bad code string
CMPB Number,#MAXCDE ; valid special code ?
BHIS 10$ ; no, ignore it [108]
PUSHW Number
ADDW Number,Number ; make index into word offset
MOVW CTLTBL[~Number],Number ; get string offset
LEA Atemp,CTLTBL[~Number]
POPW Number
10$: JMP StrNum ; go output it
; 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 color 2=blue
STRING RIBSC2 ; 08 color 3=red
STRING RIBSC3 ; 09 color 4=yellow
STRING RIBPRM ; 10 color 1=black
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
STRING ORANGE ; 21 color 5=orange
STRING VIOLET ; 22 color 6=violet
STRING GREEN ; 23 color 7=green
STRING BROWN ; 24 color 8=brown
TBLEND: ; end of table
MAXCDE = <<TBLEND-CTLTBL>/2.> ; maximum special code
PDCHR: ; Output the character in D1
FILOTB PTDDB(IMP)
RTN
StrNum: ; output string indexed by Atemp to DDB indexed by PTDDB(IMP)
; followed by a number in current radix in format: <string=#>
; Number=D1
PUSH Number
BCALL DoStr
MOVB #'=,Char
FILOTB PTDDB(IMP)
POP Number
JMP NumOut
StrOut: ; output string indexed by Atemp to DDB indexed by PTDDB(IMP)
; in the format: <string>. Terminate on NULL.
BCALL DoStr
MOVB #'>,Char
FILOTB PTDDB(IMP)
JMP DoCRLF
PDINI: ; initialize the printer
MOVW #-1,HMISAV(IMP) ; no HMI yet
MOVW #-1,LPISAV(IMP) ; no LPI yet
MOVW #-1,CPISAV(IMP) ; no CPI yet
MOVW #-1,TPMSAV(IMP) ; no top margin yet
MOVW #-1,LPOSAV(IMP) ; no left paper offset yet
CLRW CURCOL(IMP) ; at column 0
CLR CURLIN(IMP) ; at start of page
CMPW PTDDB+D.EXT(IMP),#[LST] ; already set for output to disk?
BEQ DoInit ; yes, skip warning & ext'n switch
PUSHW CrtCmd
MOVW #3_8.!1,CrtCmd ; row 3, column 1
TCRT
POPW CrtCmd
TYPE <%Warning - Test Printer Driver always outputs to .LST >
TYPE <file without spooling>
MOVW #[LST],PTDDB+D.EXT(IMP) ; change file extension to .LST
LOOKUP PTDDB(IMP) ; is file already on disk?
BNE DoInit ; no, go ahead & create .LST file
DSKDEL PTDDB(IMP) ; erase old .LST file
DoInit: LEA Atemp,Initialize
JMP StrOut
PDCLS: ; Shut down the printer
LEA Atemp,ShutDown
JMP StrOut
PDSTM: ; Set Top Margin from value in D2
; D2 contains the number of lines required in the Top Margin
MOVW Value,TPMSAV(IMP) ; save top margin value
LEA Atemp,SetTopMargin
CLR Number
MOVW Value,Number
JMP StrNum
PDMTM: ; Move to Top Margin
LEA Atemp,MvToTopMargin
JMP StrOut
PDLF: ; Output Line feeds per count in D2
LEA Atemp,LineFeeds
CLR Number
MOVW Value,Number
CALL StrNum
LSL Number ; x2
ADD Number,CURLIN(IMP)
RTN
PDSLPO: ; Set Left Paper Offset
; D2 contains the number of 1/10 inch units required
MOVW Value,LPOSAV(IMP) ; save left paper offset
LEA Atemp,SetLeftOffset
CLR Number
MOVW Value,Number
JMP StrNum
PDMLPO: ; Move to Left Paper Offset
LEA Atemp,MvToLeft
JMP StrOut
PDSLPP: ; Set lines per page
; D2 contains the form length in number of lines
MOVW Value,LPPSAV(IMP) ; save for later
LEA Atemp,SetLPP
CLR Number
MOVW Value,Number
JMP StrNum
PDSLSP: ; Set line spacing
; D2 contains the number of 1/2 lines
MOVW Value,LSPSAV(IMP) ; save for later
LEA Atemp,SetLSP
CLR Number
MOVW Value,Number
JMP StrNum
PDMNLN: ; Move to Next Line and setup for new line
LEA Atemp,NewLine
CLRW CURCOL(IMP) ; back to column 0
ADD #2.,CURLIN(IMP) ; bump current line number by full line
JMP StrOut
DoCRLF: MOVB #$CR,Char ; output a carriage return [105]
FILOTB PTDDB(IMP)
MOVB #$LF,Char
FILOTB PTDDB(IMP) ; output the LF
RTN
PDMTOF: ; Move to Top of Form and setup for new page
CLR CURLIN(IMP) ; at start of page
LEA Atemp,MoveTOF
JMP StrOut
PDUNDR: ; Toggle Underscore
BCHG #FM%UND,FM.FLG(IMP) ; toggle underscore
BNE UNDOFF ; and go do it if end of field
UNDON: LEA Atemp,ONunder
JMP StrOut
UNDOFF: LEA Atemp,OFFunder
JMP StrOut
PDDBL: ; Toggle Double Underscore
BCHG #FM%DBL,FM.FLG(IMP) ; toggle double underscore
BNE DBLOFF ; and go do it if end of field
DBLON: LEA Atemp,ONdouble
JMP StrOut
DBLOFF: LEA Atemp,OFFdouble
JMP StrOut
PDBOLD: ; Toggle Bold
BCHG #FM%BLD,FM.FLG(IMP) ; bold enabled ?
BNE 10$ ; yes, end of bold field
LEA Atemp,BoldON
JMP StrOut
10$: LEA Atemp,BoldOFF
JMP StrOut
PDSTRK: ; Toggle strikeout
BCHG #FM%STK,FM.FLG(IMP) ; toggle strikeout flag
BNE STKOFF ; and go do it if end of field
MOVW CURCOL(IMP),STKCOL(IMP) ; or set field start
MOVB Char,STKCHR(IMP) ; save strikeout character
PUSHW Char
LEA Atemp,ONstrike
CALL DoStr
MOVB #'=,Char
FILOTB PTDDB(IMP)
POPW Char
FILOTB PTDDB(IMP)
MOVB #'>,Char
FILOTB PTDDB(IMP)
RTN
PDFONT: ; set font, Number=D1 contains font code#
LEA Atemp,SetFont
JMP StrNum
PDSLPI: ; set lines per inch
; Value=D2 contains number of lines per inch required
MOVW Value,LPISAV(IMP)
LEA Atemp,SetLPI
PerInch:CLR Number
MOVW Value,Number
JMP StrNum
PDSCPI: ; set characters per inch
; Value=D2 contains number of characters per inch required
MOVW Value,CPISAV(IMP)
LEA Atemp,SetCPI
BR PerInch
PDSHMI: ; set horizontal motion index
; Value=D2 contains number of characters per inch required
; Note: AlphaWRITE calls PDSHMI very frequently, especially if variable
; spacing is requested. For best efficiency this routine should output
; the real HMI control sequence only if the current HMI value is different
; from the last set value. We don't do this here, so for testing purposes
; you can see when HMI is called.
MOVW Value,HMISAV(IMP)
LEA Atemp,SetHMI
BR PerInch
PDOVRP: ; Setup to overprint the last character
LEA Atemp,OverPrint
JMP StrOut