/1.1 OS8 BINARY MAP (BITMAP) V4
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1972,1973,1974,1975 BY DIGITAL EQUIPMENT CORPORATION
/
/
/
/
/
/
/
/
/
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE
/AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
/CORPORATION.  DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
/
/THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FURNISHED TO THE PURCHASER
/UNDER A LICENSE FOR USE ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED
/(WITH INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH
/SYSTEM, EXCEPT AS MAY OTHERWISE BE PROVIDED IN WRITING BY DIGITAL.
/
/DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
/DIGITAL.
/
/
/
/
/
/
/
/
/
/
/NO CHANGES MADE FOR OS/8 V3C

	VERSION=	4
	SUBVER=		01	/LOCATED AT "VERLOC" AS 60+VERSION^100+SUBVER

XR=	10
LOADXR=	11
XFIELD=	20	/HOLDS FIELD WE ARE "STORING" INTO
ORIGIN=	21	/HOLDS CURRENT ORIGIN
OUT=	22
B1=	23
B3=	24
C1=	25
COLCTR=	27
WD=	30
WD1=	31
WD2=	32
FILPTR=	33
FLDNO=	35

/OS/8 EQUIVALENCES

MPARAM=	7643
JSBITS=	7746
MIFILE=	7617
PTP=	20
DCB=	7760

/BUFFER AND DEVICE HANDLER ASSIGNMENTS

OUCTL=	4200
OUBUF=	6000
OUDEVH=	6400
	FIELD 1
	*2000

BITMAP,	JMP CALLCD
	JMP NOCD	/CHAINED ENTRY POINT
NEXTCD,	TAD I	(MPARAM-1
	SPA CLA
	JMP I	(BUILD	/ALTMODE TERMINATES INPUT, STARTS OUTPUT
CALLCD,	JMS I (200
	5		/COMMAND DECODE
	0216		/DEFAULT EXTENSION IS .BN
NOCD,	TAD	(LDRPCH
	DCA	OUT
	ISZ	ONCE
	JMP	CDCOOL
	CLA CLL CMA RTL
	CDF 0
	AND I	(JSBITS	/REMOVE "DON'T CARE ABOUT CD AREA" BIT
	DCA I	(JSBITS
	CDF 10
	JMS I	(CTINIT
CDCOOL,	TAD I (MPARAM+1
	AND (100
	SZA CLA		/IS /R SWITCH ON?
	JMS I (CTINIT	/YES - RE-INITIALIZE LOADER TABLES
LD7400,	7400
	TAD (MIFILE
	DCA FILPTR
	JMP I	(NEWFIL
ONCE,	-1
/SUBROUTINE TO "LOAD" A WORD.
/INCREMENTS TWO-BIT QUANTITY CORRESPONDING TO THE WORD.
/FIELD 0 IS MAPPED INTO WORDS 00000-01377,FIELD 1 INTO 01400-02777
/FIELDS 4-7 ARE MAPPED INTO 20000-25777

LOADWD,	0		/ENTER WITH LOW 4 BITS OF ORIGIN IN AC
	CLL RAL
	TAD	(BITTBL-1
	DCA	LOADXR
	TAD I	LOADXR	/GET WORD IN THE 3-WORD SET
	DCA	LDOFST	/(WHICH MAPS 16 WORDS)
	TAD I	LOADXR	/GET THE LOW ORDER BIT OF THE PAIR
	DCA	LDBIT	/WHICH MAPS THIS WORD
	TAD	ORIGIN	/NOW FIND OUT WHICH TRIPLEWORD TO USE
	RTL
	RTL
	AND	(7407
	TAD	XFIELD
	RTL
	RTL
	CDF 0
	RTL
	RAL
	SZL
CDF20Y,	CDF 20		/NOP'ED IF NO FIELD 2 IN MACHINE
	CLL RTR		/FIELDS 4-7 MAPPED IN FIELD 2
	DCA	LTEMP
	TAD	LTEMP
	CLL RAL
	TAD	LTEMP
	TAD	LDOFST
	DCA	LTEMP
	TAD	LDBIT
	CLL RAL
	TAD	LDBIT
	AND I	LTEMP
	SNA CLA		/IF COUNT IS AT 3 (MAX),
	JMP I	LOADWD	/DON'T INCREMENT IT
	TAD	LDBIT
	CIA
	TAD I	LTEMP
	DCA I	LTEMP
	RDF
	CDF 10
	SZA CLA
	DCA I	(F4FLAG	/SEARCH FIELD 2 IF WE STORED THERE
	JMP I	LOADWD
LDOFST,	0
LDBIT,	0
LTEMP,	0
/BIT TABLE FOR MAPPING

BITTBL,	0;2000;0;400;0;100;0;20;0;4;0;1
	1;2000;1;400;1;100;1;20;1;4;1;1
	2;2000;2;400;2;100;2;20;2;4;2;1
	PAGE
NEWFIL,	TAD (7001
	DCA HANDLR
	TAD I FILPTR
	AND (7760
	SZA		/LENGTH OF 256 BLOCKS IMPLIES AT LEAST 256
	TAD (17
	CLL CML RTR
	RTR
	DCA RCDCNT
	TAD I FILPTR
	ISZ FILPTR
	SNA
	JMP I	(NEXTCD	/FILE POINTER = 0 MEANS NO MORE INPUT FILES
	JMS I (200
	1		/ASSIGN
HANDLR,	7001		/LOAD INTO 7000 IF NOT ALREADY LOADED
	JMP I (IOERR
	TAD I FILPTR
	DCA RECNO
	ISZ FILPTR
	CLA CMA
	DCA CHCNT
	DCA REOF
	TAD I (MPARAM	/TEST FOR /I
	AND (10
	SNA CLA
	JMP I (LOADER	/I IS NOT ON
	JMP I (OERR	/NO!
GETCH,	0		/GET-NEXT-INPUT-CHARACTER ROUTINE
	JMS I	(CTCTST
	ISZ JMPGET
	ISZ CHCNT
JMPX,	JMP JMPGET
	TAD REOF
	SZA CLA
	JMP I GETCH	/EOF REACHED BEFORE LOGICAL END - ERROR
	CLL
	TAD	RCDCNT
	TAD	(6
	SNL
	DCA	RCDCNT
	SZL
	ISZ	REOF
	CLL CMA CML RTR
	RTR
	RTR
	TAD	(1411
	DCA	RCTL
	CIF 0
	JMS I HANDLR
RCTL,	0		/READ RECORDS INTO FIELD 1
PBUFFR,	BUFFER
RECNO,	0
	JMP RERROR
	TAD	RECNO
	TAD	(6
	DCA	RECNO
	TAD	(-4401
	DCA CHCNT
	TAD PBUFFR
	DCA CHPTR
	TAD JMPX
	DCA JMPGET
	JMP GETCH+1
JMPGET,	JMP .
	JMP CHAR1
	JMP CHAR2
	TAD JMPX
	DCA JMPGET
	TAD I CHPTR
	AND (7400
	CLL RTR
	RTR
	TAD CHTMP
	RTR
	RTR
	ISZ CHPTR
	JMP GCHCOM
CHAR2,	TAD I CHPTR
	AND (7400
	DCA CHTMP
	ISZ CHPTR
CHAR1,	TAD I CHPTR
GCHCOM,	AND (377
	ISZ GETCH
	JMP I GETCH
RERROR,	SPA CLA
	JMP I (IOERR	/AN ACTUAL READ ERROR - AMAZING!
	ISZ REOF
	JMP RECNO+2
REOF,	0
CHCNT,	0
CHPTR,	0
CHTMP,	0
RCDCNT,	0
ZTST,	0		/TEST A BLOCK OF THE BITMAP FOR ALL ONES
	DCA	B3	/LENGTH OF THE BLOCK IN AC
	TAD	LOADXR
	DCA	XR
	STA
	JMS I	(XCDF
	AND I	XR
	ISZ	B3
	JMP	.-2
	CDF 10
	CMA
	SZA
	JMP I	ZTST
	TAD	XR
	DCA	LOADXR	/UPDATE LOADXR IF ALL ZEROES
	JMP I	ZTST
	PAGE
ITSOVR,	JMS ASSEMB	/GET THE CHECKSUM
	CIA
	TAD LCKSUM
	SZA CLA		/IS IT GOOD?
	JMP I (BADCKS	/NO
	TAD I (MPARAM+1
	AND L40
	SNA CLA		/IF /S IS NOT SET,
	JMP I (NEWFIL	/ONLY ONE PROGRAM PER FILE.
LOADER,	DCA LCKSUM
	JMS GETFLD
	DCA XFIELD
	TAD (200
	DCA ORIGIN	/INITIALIZE FOR PROGRAM
	JMS I (GETCH
	JMP I (NEWFIL
	SNA
	JMP .-3
	TAD (-200	/FIND SOME LEADER
	SZA CLA
	JMP LOADER+1
LEADER,	JMS I (GETCH
	JMP I (NEWFIL
	SNA
	JMP LOADER+1
	TAD (-200	/FIND END OF LEADER
	SNA
	JMP LEADER
NEWWD,	SMA		/FIELD SETTING?
	JMP FIELDW	/YES
	TAD (200
	DCA WD1		/STORE 1ST CHAR
	JMS I (GETCH
	JMP I (BADINP
	DCA WD2		/2D CHAR
	JMS I (GETCH
	JMP I (BADINP
	TAD (-200	/IF THIS IS LEADER, WE HAVE THE CHECKSUM
	SNA
	JMP ITSOVR
	DCA WD
	JMS ASSEMB
	SNL		/ORIGIN OR DATA?
	JMP DATAWD	/DATA
	DCA ORIGIN
	JMP GETNXT
DATAWD,	CLA
	TAD	ORIGIN
	AND	(17
	JMS I (LOADWD	/GO SET THE CORRECT BIT(S)
	CDF 10
	ISZ ORIGIN
L40,	40
GETNXT,	TAD WD1
	TAD WD2
	TAD LCKSUM
	DCA LCKSUM
	TAD WD
	JMP NEWWD

ASSEMB,	0
	TAD WD1
	CLL RTL
	RTL
	RTL
	TAD WD2
	JMP I ASSEMB

FIELDW,	TAD (-32
	SNA
	JMP CTLZ
	TAD (-46
	SPA
	JMP NOTXP
	DCA WD1
	TAD WD1
	AND (7
	SZA CLA
	JMP NOTXP
	TAD WD1
	AND (70
	DCA XFIELD
	JMS I (GETCH
	JMP I (BADINP
	TAD (-200
	SZA
	JMP NEWWD
NOTXP,	CLA
	TAD LCKSUM
	SNA CLA
	JMP LOADER
	JMP I (BADINP
LCKSUM,	0

CTLZ,	TAD LCKSUM
	SZA CLA
	JMP I (BADINP
	JMP I (NEWFIL
GETFLD,	0		/ROUTINE TO CHECK FOR OPTION 0-7
	DCA C1		/AND RETURN LOWEST-NUMBERED VALUE
	TAD I (MPARAM+2
	AND (1774
	SNA
	JMP I GETFLD
	RTL
	RAL
	ISZ C1
	SNL
	JMP .-3
	CLA CMA
	TAD C1
	CLL RTL
	RAL
	JMP I GETFLD
	PAGE
ERPCH,	0
	AND (77		/GET LOW ORDER 6 BITS
	SZA
	JMP NZCHAR
	JMS ERR
FILMSG,	TEXT	/, FILE 0/
	JMP I	(BITMAP
NZCHAR,	TAD	(240
	AND	(77
	TAD	(240
	JMS I	OUT	/PRINT
	JMP I ERPCH	/AND RETURN

LDRPCH,	0
	TLS
	TSF
	JMP .-1
	CLA
	JMP I LDRPCH

ERR,	0
	CLA
	CDF 10
	TAD I (FILPTR	/ZERO CHAR GETS REPLACED BY "FILE #"
	TAD (322	/MAGIC NUMBER
	CLL CML RAR	/AC NOW CONTAINS " #"
	DCA FILMSG+3
ERRLUP,	TAD I ERR
	SNA
	JMP EOMESG	/MESSAGE MUST BE EVEN NUMBER OF CHARS LONG
	RTR
	RTR
	RTR
	JMS ERPCH
	TAD I ERR
	JMS ERPCH
	ISZ ERR
	JMP ERRLUP
EOMESG,	JMS I	(ECRLF
	JMP I	ERR	/RETURN
IOERR,	JMS ERR
	TEXT	%I/O ERROR%
	JMP I	(BITMAP
BADINP,	JMS ERR
	TEXT	/BAD INPUT/
	JMP I	(BITMAP
BADCKS,	JMS ERR
	TEXT	/ BAD CHECKSUM/
	JMP I	(BITMAP
NULERR,	JMS ERR
	TEXT	/NO INPUT/
	JMP I	(BITMAP
OUTERR,	TAD	(LDRPCH
	DCA	OUT
	JMS ERR
	TEXT	/ERROR ON OUTPUT DEVICE/
	JMP I	(CALLCD
OERR,	JMS ERR
	TEXT %NO /I!%
	JMP I	(BITMAP
CTINIT,	0
	CLA CLL CML RTR
	DCA	C1
	DCA	B1
	DCA	0	/STRAIGHT-8 CROCK
CTINLP,	CDF 0
	CLA CMA
	DCA I B1
CDF20X,	CDF 20
	STA
	DCA I	B1
	JMP	CTFLD2	/*** THIS INSTR SKIPPED IF 8K PDP-8!!!
	DCA	CDF20X	/DUE TO BUG IN EXTENDED MEMORY CONTROLLER
	TAD	ERR+1	/A CLA
	CDF 10
	DCA I	(CDF20Y
CTFLD2,	ISZ	B1
	ISZ C1
	JMP CTINLP
	CDF 10
	JMP I CTINIT
	PAGE
/GENERAL OUTPUT ROUTINES

	/JMS I (OOPEN		INITIALIZES THE OUTPUT ROUTINE
	/ERROR RETURN		AC>0 IF NO OUTPUT DEVICE/FILE, AC<0 IF ERROR

	/JMS I (OCHAR		OUTPUTS A CHARACTER
	/ERROR RETURN		OUTPUT ERROR OR TOO MUCH OUTPUT

	/JMS I (OCLOSE		CLOSES THE OUTPUT FILE
	/ERROR RETURN		FILE TOO LARGE TO BE CLOSED OR OUTPUT ERROR

	/JMS I (OTYPE		RETURNS DCB WORD OF OUTPUT DEVICE IN AC



	/PARAMETERS NEEDED:

	/OUBUF=		ADDRESS OF OUTPUT BUFFER
	/OUCTL=		OUTPUT BUFFER CONTROL WORD (MUST BE NEGATIVE)
	/OUDEVH=	ADDRESS OF PAGE FOR OUTPUT HANDLER

	/ASSUMES I/O MONITOR IS RESIDENT IN CORE.
	/CAN BE CALLED FROM ANY FIELD WITH BUFFERS IN ANY FIELD.

OUFLD=	OUCTL&70
OOPEN,	0
OU7600,	7600
	TAD OU7601
	DCA OUBLK
	TAD (OUDEVH+1
	DCA OUHNDL
	CDF 10
	TAD I	(7604
	SNA		/IF OUTPUT HAS NO EXTENSION,
	TAD	(1520	/GIVE IT THE EXTENSION .MP
	DCA I	(7604
OUASGN,	TAD I OU7600		/GET DEVICE NUMBER WORD OF OUTPUT FILE ENTRY
	AND (17			/STRIP OFF ANY LENGTH INFO
	SNA			/IS THERE AN OUTPUT DEVICE?
	JMP USETTY		/NO - INHIBIT OUTPUT
	JMS I (200
	1			/ASSIGN, FETCH HANDLER
OUHNDL,	0			/OUTPUT DEVICE HANDLER ENTRY
	HLT			/HUH?
OUENTR,	TAD I OU7600
	JMS I (200
	3			/ENTER OUTPUT FILE
OUBLK,	7601			/REPLACED WITH STARTING BLOCK
OUELEN,	0			/REPLACED WITH LENGTH OF HOLE
	JMP OEFAIL		/FAILED - MAYBE WE ASKED TOO MUCH
	DCA OUCCNT
	JMS I (OUSETP
	CDF CIF 10		/RESTORE CALLING FIELDS
	JMP I OOPEN
OEFAIL,	TAD I OU7600
	AND (7760		/GET REQUESTED LENGTH
	SNA CLA			/WAS IT AN INDEFINITE REQUEST
	JMP I	(OUTERR		/YES - CANNOT ENTER THE FILE
	TAD I OU7600
	AND (17			/MAKE THE REQUESTED LENGTH ZERO
	DCA I OU7600
	JMP OUENTR		/TRY, TRY AGAIN
USETTY,	DCA	TTYNO
	JMS I	(200
	12
	5524
TTYNO,	0
	0
	HLT	/NO TELETYPE!
	TAD	TTYNO
	DCA I	OU7600
	JMP	OUASGN
OUTDMP,	0
	DCA OUCTLW		/STORE THE CONTROL WORD
	CDF 10
	TAD OUCCNT
	SNA
	ISZ OUCTLW
	TAD OUBLK
	DCA OUREC		/COMPUTE THE STARTING BLOCK NUMBER OF THIS TRANSFER
	TAD OUCTLW
	CLL RTL
	RTL
	RTL
	AND (17			/COMPUTE THE NUMBER OF RECORDS
	TAD OUCCNT		/UPDATE THE NUMBER OF BLOCKS IN THE FILE
	DCA OUCCNT
	TAD OUCCNT
	CLL CML
	TAD OUELEN
	SNL SZA CLA		/DOES THE LENGTH EXCEED THE GIVEN LENGTH?
	JMP I (OUTERR		/YES - SIGNAL OUTPUT ERROR
	CIF 0
	JMS I OUHNDL
OUCTLW,	0
	OUBUF
OUREC,	0
	JMP I	(OUTERR
	JMP I OUTDMP
OCLOSE,	0
	CDF 10
	JMS I (OTYPE
	AND (770
	TAD (-PTP		/CHECK FOR PAPER TAPE PUNCH OUTPUT
	SZA CLA			/AND SKIP ^Z OUTPUT IF TRUE
	TAD (232		/OUTPUT A ^Z
	JMS I (OCHAR
	JMS I (OCHAR
FILLLP,	JMS I (OCHAR
	JMS I (OTYPE		/GET TYPE OF OUTPUT DEVICE
	SPA CLA
	TAD (100		/IF ITS A DIRECTORY DEVICE FORCE A RECORD
	TAD (77			/BOUNDARY - OTHERWISE A HALF-RECORD
	AND I (OUDWCT
	SZA CLA			/UP TO THE BOUNDARY YET?
	JMP FILLLP		/NO - FILL WITH ZEROS
	TAD I (OUDWCT		/GET DOUBLEWORD COUNT LEFT
	TAD (OUCTL&3700
	SNA			/A FULL WRITE LEFT?
	JMP NODUMP		/YES - DON'T DO IT - THE ^Z IS ALREADY OUT
	TAD (4000+OUFLD		/PUT IN THE FIELD BITS AND THE WRITE BIT
	JMS OUTDMP
NODUMP,	TAD I OU7600		/GET THE DEVICE NUMBER
	JMS I (200
	4			/CLOSE THE OUTPUT FILE
OU7601,	7601			/POINTER TO THE OUTPUT FILE NAME
OUCCNT,	0
	JMP I	(OUTERR
	CDF CIF 10		/RESTORE CALLING FIELDS
	JMP I OCLOSE
	PAGE
OUCTMP=	OUCTL&3700
OUSETP,	0			/ROUTINE TO INITIALIZE CHARACTER POINTERS
	TAD (-OUCTMP		/GET SIZE OF BUFFER IN DOUBLEWORDS
	DCA OUDWCT
	TAD (OUBUF
	DCA OUPTR		/INITIALIZE WORD POINTER
	TAD OUJMPE
	DCA OUJMP		/INITIALIZE THREE-WAY CHARACTER SWITCH
	JMP I OUSETP

OCHAR,	0
	AND (377
	DCA OUTEMP
	RDF
	TAD CDIF0
	DCA OUCRET
	CDF OUFLD		/SET DATA FIELD TO BUFFER'S FIELD
	ISZ OUJMP		/BUMP THE CHARACTER SWITCH
OUJMP,	HLT			/THREE WAY CHARACTER SWITCH
	JMP OCHAR1
	JMP OCHAR2
OCHAR3,	TAD OUTEMP
	CLL RTL
	RTL
	AND (7400
	TAD I OUPOLD
	DCA I OUPOLD		/UPDATE FIRST WORD OF TWO WITH HIGH
	TAD	OUTEMP		/ORDER 4 BITS OF THIRD CHAR
	CLL RTR
	RTR
	RAR
	AND (7400
	TAD I OUPTR
	DCA I OUPTR		/UPDATE SECOND WORD FROM LOW ORDER 4 BITS
	TAD OUJMPE
	DCA OUJMP		/RESET SWITCH
	ISZ OUPTR
	ISZ OUDWCT		/BUMP DOUBLEWORD COUNTER EVERY 3 CHARS
	JMP OUCRET
	TAD (OUCTL		/LOAD CONTROL WORD FOR A FULL WRITE
	JMS I (OUTDMP		/DUMP THE BUFFER
	JMS OUSETP		/RE-INITIALIZE THE POINTERS
	JMP OUCRET
OCHAR2,	TAD OUPTR
	DCA OUPOLD		/SAVE POINTER TO FIRST WORD OF TWO
	ISZ OUPTR		/BUMP WORD POINTER TO SECOND WORD
OCHAR1,	TAD OUTEMP
	DCA I OUPTR
OUCRET,	HLT			/RESTORE CALLING FIELDS
	JMP I OCHAR
OUTEMP,	0
OUPOLD,	0
OUPTR,	0
OUJMPE,	JMP OUJMP
OUDWCT,	0
OTYPE,	0
	RDF
	TAD CDIF0
	DCA OTRTN
	CDF 10
	TAD I (7600
	AND (17
	TAD (DCB-1
	DCA OUTEMP
	TAD I OUTEMP
OTRTN,	HLT
	JMP I OTYPE

DOBITS,	0
	DCA	B3
	JMS I	(XCDF
	TAD I	LOADXR
	CDF 10
	DCA	B1
BITLP,	TAD	B1
	CLL RTL
	DCA	B1
	TAD	B1
	CMA CML RAL
	AND	(3
	TAD	(260
	JMS I OUT
	ISZ COLCTR
	TAD	COLCTR
	AND	(7
	SZA CLA
	JMP BITISZ
	TAD I	(TTOFLG
	SNA CLA		/IF OUTPUT IS NOT TO TTY,
	TAD (240	/PUT A SPACE AFTER EVERY GROUP OF 8
	SZA 
	JMS I OUT
BITISZ,	ISZ	B3
	JMP	BITLP
	JMP I	DOBITS
CTCTST,	0
	TAD	(200
	KRS
	TAD (-203
	SNA CLA			/IS THE TELETYPE BUFFER A ^C
	KSF			/WITH THE TELETYPE FLAG ON?
	JMP I CTCTST			/NO
CDIF0,	CDF CIF 0		/YES - GO TO MONITOR
	JMP I (7605		/THROUGH THE "DON'T SAVE CORE" RETURN

	PAGE
BUILD,	STA
	DCA	SOMTHN
	TAD	(-10
	DCA	FLDNO
	TAD	MAPSKP
	DCA	F4SKP	/INITIALIZE ONCE-ONLY SKIP
FLDLP,	TAD	FLDNO
	AND	(4
	CLL RTL
	TAD	(CDF
	DCA	CDFX	/STORE A CDF 0 OR CDF 20
	TAD	FLDNO
	RTR
	SZL SPA CLA	/IF FLDNO IS 0 OR 4,
	JMP	NOT04	/INITIALIZE LOADXR TO 0
F4SKP,	SKP
F4FLAG,	JMP	MAPOVR	/ZEROED IF INFO IN FIELD 2
	DCA	F4SKP
	STA
	DCA	LOADXR
NOT04,	TAD	(-1400
	JMS I	(ZTST
	SZA CLA		/FIELD EMPTY?
	JMP	NONEMP	/NO
FLDISZ,	ISZ	FLDNO
	JMP	FLDLP
MAPOVR,	ISZ	SOMTHN	/WAS THERE ANY INPUT?
MAPSKP,	SKP
	JMP I	(NULERR
	JMS I	(ECRLF
	JMS I	(ECRLF
	JMS I	(OCLOSE
	CDF CIF 0
	JMP I	(7605

NONEMP,	ISZ	SOMTHN	/HAVE WE OUTPUT ANYTHING YET?
	JMP	NOTFST
	JMS I	(OOPEN	/NO - OPEN OUTPUT FILE NOW
	JMS I	(OTYPE
	SNA CLA		/SET MODE OF OUTPUT - /T INVERTS
	TAD	(20	/NORMAL TTY/NO TYY DISTINCTION
	TAD I	(MPARAM+1
	AND	(20
	DCA I	(TTOFLG
	TAD	(OCHAR
	DCA	OUT
NOTFST,	JMS I	(EJECT1	/PAGE HEADING
	TAD	(-100
	DCA	PAGECT
PAGELP,	TAD	FLDNO
	TAD	(270
	JMS I	OUT
	TAD	PAGECT
	AND	(70
	CLL RTR
	RAR
	TAD	(260	/OUTPUT LOC (HIGH 3 DIGITS) AT LEFT MARGIN
	JMS I	OUT
	TAD	PAGECT
	AND	(7
	TAD	(260
	JMS I	OUT
	TAD	(260
	JMS I	OUT
	TAD	(260
	JMS I	OUT
	TAD	(240
	JMS I	OUT
	DCA	COLCTR
	TAD	(-14
	JMS I	(ZTST	/IF ALL 64 WORDS ARE ZERO,
	SNA CLA
	JMP NO1ND0	/DON'T PRINT LINE
	TAD	(-4
	DCA	SOMTHN
DOBTLP,	TAD	(-6
	JMS I	(DOBITS	/OUTPUT 4 TRIPLEWORDS FOR 64 LOCATIONS
	TAD	(-6
	JMS I	(DOBITS
	TAD	(-4
	JMS I	(DOBITS
	ISZ	SOMTHN
	JMP	DOBTLP
NO1ND0,	JMS I	(ECRLF
	CLA IAC
	AND	PAGECT
	SZA CLA
	JMS I	(ECRLF	/SKIP A LINE EVERY PDP-8 PAGE
	TAD	PAGECT
	TAD	(41
	SNA CLA
	JMS I	(EJECT1	/NEW PAGE AT LOCATION 4000
	ISZ	PAGECT
	JMP	PAGELP
	JMP	FLDISZ
PAGECT,	0
SOMTHN,	0

XCDF,	0
CDFX,	HLT
	JMP I	XCDF
	PAGE
EJECT1,	0
	TAD	FLDNO
	TAD	(4070
	DCA	FLDNUM
	TAD	TTOFLG
	SZA CLA		/TELETYPE STYLE OUTPUT?
	JMP	EJKTTY	/YES
	TAD	(214	/NO - FORM FEED
	JMS I	OUT
PRTFLD,	JMS I	(ERR
	TEXT	/ BITMAP  V/
	*.-1
VERLOC,	60+VERSION^100+SUBVER	/V5A, ETC...
	TEXT	/   FIELD/
	*.-1
FLDNUM,	TEXT	/ 0/
	JMS	ECRLF
	TAD	TTOFLG
	SNA CLA		/IF NOT TTY OUTPUT,
	JMP EJKLPT	/DON'T PRINT HORIZONTAL GUIDE

	JMS I	(ERR
	TEXT	/      0000000011111111222222223333333344444444555555556666666677777777/
	JMS I	(ERR
	TEXT	/      0123456701234567012345670123456701234567012345670123456701234567/
EJKLPT,	JMS	ECRLF
	JMP I	EJECT1
EJKTTY,	TAD	(-13
	DCA	EJKTMP
	JMS	ECRLF
	ISZ	EJKTMP
	JMP	ECRLFX
	JMS I	(ERR
	TEXT	/----/
	JMS	ECRLF
	JMP	PRTFLD
EJKTMP,	0

ECRLF,	0
	TAD	(215
	JMS I	OUT
ECRLFX,	TAD	(212
	JMS I	OUT
	JMP I	ECRLF

TTOFLG,	0		/20 IF TTY-STYLE OUTPUT
	PAGE
	BUFFER=.
	$-$-$

