Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-02 - decus/20-0045/pager.mac
There are 2 other files named pager.mac in the archive. Click here to see a list.
	TITLE PAGER 
	SUBTTL PROGRAM BY MARTY SCHULTZ
; COPYRIGHT 1972,1973 MASCO PROGRAM DEVELOPMENT, SYOSSET NY



JOBVER==137
JOBREN==124
JOBFF==121
JOBREL==44


	LOC	JOBREN
	EXP	NEXT

VWHO=2
VPAGER=4
VEDIT=7
VMINOR=6

	LOC	JOBVER
	BYTE(3)VWHO(9)VPAGER(6)VEDIT(18)VMINOR

	RELOC
	IFNDEF HELPPN,	<HELPPN==<2,,5>>
	IFNDEF OUTEXT,	<OUTEXT=='PAG'>
	IFNDEF INEXT,	<INEXT=='BAS'>
RD==1	;CHANNEL TO READ FROM
PG==2	;CHANNEL TO PAGE TO.

.PWAIT==1B35
.NOTXT==1B34
.PTIT==1B33
.PDAT==1B32
.PCUT==1B31
.PFROM==1B30
.PKILL==1B29
.PWID==1B28
.PSEQ==1B27
.PTAB==1B26
.PLIN==1B25
.PEND==1B24
.PDEV==1B23
.PNUM==1B22
.PFF==1B21
.PHELP==1B20
.PTIME==1B19

GNL=1
AC=2
IO=3
N=IO
PAGE=4
PQ=PAGE
WID=5
WORD=6
W=WORD
OFF=7
FLG=10
CNT=11
PNT=12

AA=13
BB=14
CC=15
DD=16
P=17


.FIRST==1
DEFINE EQ (LAB,VAL),
	<MOVEI AC,VAL
	MOVEM AC,LAB>

DEFINE ST (%A,LEN),
<%A:	BLOCK LEN>

DEFINE ERR(STRING),
	<JRST [OUTSTR [ASCIZ/
?'STRING/]
	JRST RETPAG]>


DEFINE PRINT(CHAR),
	<MOVEI IO,CHAR
	PUSHJ P,PUT>

DEFINE STRING(CHARS),
	<MOVEI PNT,CHARS
	PUSHJ P,MESTY>

DEFINE SETP,
	<SETZ WORD,
	MOVE PNT,[POINT 6,WORD]>



.CRLF:	BYTE(7) 15,12,0
.BDB:	ASCII/ - /
ST CCL$,1
ST CCLBUF,20
ST SAVEM,2
ST .PDL,20
ST .LPP,1
ST .WIDTH,1
ST .TAB,1
ST .PAGE,1
ST .TITLE,12
CCLBLK:	SIXBIT/PAG/
	IOWD	12,CCLBUF


PAGER.:	TDZA AC,AC
	SETO AC,
	MOVEM AC,CCL$
	SKIPN CCL$
	OUTSTR [ASCIZ"

TYPE /H FOR NEW HELP: 11-20

"]
	MOVE AC,JOBFF
	MOVEM AC,SAVEM
	MOVE AC,JOBREL
	MOVEM AC,SAVEM+1
	MOVE P,[IOWD 20,.PDL]
NEXT:	EQ .PAGE,1
	EQ .TAB,10
	EQ .WIDTH,^D72
	EQ .LPP,^D55
	PUSHJ P,GETFIL
	TRO FLG,.PDEV
BEGIN:	TRNE FLG,.PWAIT
	JRST NEWPAG
	PRINT 14
NEWPAG:	ADDI PAGE,1
	TRNN FLG,.NOTXT
	JRST GOPAG
	CAML PAGE,.PAGE
	TRZ FLG,.NOTXT
GOPAG:	TRNE FLG,.PWAIT
	TRNE FLG,.NOTXT
	JRST DASH
	OUTPUT	PG,
	INCHRW
	JRST REEN
DASH:	MOVEI CNT,^D72
	PRINT "-"
	SOJG CNT,.-1
REEN:	STRING .CRLF
	PRINT 12
	PRINT 12
	TRNE FLG,.PKILL
	JRST NOTIT
	MOVEI CNT,4
	PRINT 11
	SOJG CNT,.-1
	STRING .BDB
	MOVE AC,PAGE
	PUSHJ P,DECTY
	STRING .BDB
	STRING .CRLF
	TRNN FLG,.PTIT
	JRST NOTIT
	STRING .TITLE
NOTIT:	TRNN FLG,.PDAT
	JRST NODAT
	PRINT 11
	PUSHJ P,PUT
	DATE GNL,
	IDIVI GNL,^D31
	PUSH P,AC
	IDIVI GNL,^D12
	ADDI AC,1
	PUSHJ P,DECTY
	PRINT "-"
	POP P,AC
	ADDI AC,1
	PUSHJ P,DECTY
	PRINT "-"
	MOVEI AC,^D64(GNL)
	PUSHJ P,DECTY
NODAT:	TRNN FLG,.PTIME
	JRST NOTIME
	SETZ GNL,
	MSTIME GNL,
	PRINT 11
	PUSHJ P,PUT
	IDIVI GNL,^D1000*^D60
	IDIVI GNL,^D60
	PUSH P,AC
	MOVE AC,GNL
	PUSHJ P,DECTY
	PRINT ":"
	POP P,AC
	MOVEI IO,"0"
	CAIGE AC,^D10
	PUSHJ P,PUT
	PUSHJ P,DECTY
NOTIME:	STRING .CRLF
	PRINT 12
	SETZ WID,

	MOVE CNT,.LPP
TEXT:	PUSHJ P,GET
	CAIE AC,12
	CAIN AC,13
	JRST CHECK
	CAIE AC,14
	JRST NOFF
	TRNN FLG,.PFF
	JRST CHECK
	PRINT 12
	SOJG CNT,.-1
	JRST CHK2
NOFF:	CAIN AC,15
	SUBI WID,1
	CAIE AC,11
	JRST TEXTA
	MOVE GNL,WID
	IDIV GNL,.TAB
	MOVE GNL,.TAB
	SUBM GNL,AC
	ADD WID,AC
	PRINT " "
	SOJG AC,.-1
	JRST TEXT
TEXTA:	CAMGE WID,.WIDTH
	JRST NORM
	TRNN FLG,.PCUT
	JRST 	[SETZ WID,
		SOJA CNT,NORM]
	PUSHJ P,GET
	CAIE AC,12
	JRST .-2
	PRINT 15

CHECK:	MOVEI IO,12
	PUSHJ P,PUT
	SETZ WID,
	SOJG CNT,TEXT
CHK2:	MOVEI CNT,4
	PRINT 12
	SOJG CNT,.-1
	JRST NEWPAG

NORM:	MOVE IO,AC
	PUSHJ P,PUT
	AOJA WID,TEXT

EOFILE:	STRING .CRLF
	ADDI CNT,3
	PRINT 12
	SOJG CNT,.-1
	TRNE FLG,.PWAIT
	JRST LST
	MOVEI CNT,^D72
	PRINT "-"
	SOJG CNT,.-1
LST:	MOVEI CNT,10
	STRING .CRLF
	PRINT 12
	SOJG CNT,.-1
	OUTPUT	PG,
	CLOSE 1,
	CLOSE 2,
	RELEAS 1,
	RELEAS 2,
	TRNN FLG,.PEND
	JRST RETPAG
	OUTSTR [ASCIZ/
LAST PAGE:/]
	TRZ FLG,.PDEV
	MOVE AC,PAGE
	PUSHJ P,DECTY

RETPAG:	SKIPN	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