.ENABL LC .TITLE BINCOM--Binary file compare .SBTTL Edit history .DSABL GBL ; ; [0] GPR 10/15/82 BINCOM was created and released ; ; [1] GPR 11/4/82 Module TELDIF did not wait for ; terminal I/O to finish. ; ; [2] GPR 11/18/82 Module FINSTR could not tell for ; sure if all terminal I/O was done ; because the TI event flag may be ; set for a previous QIO and not the ; last one. Solution was to change ; the TI QIO$ to QIOW$ and remove ; FINSTR. ; .SBTTL Definitions .IDENT /V01.02/ .MCALL GCMLB$,GCMLD$,GCML$,CSI$,CSI$1,CSI$2,CCML$,NMBLK$,FDOP$R .MCALL RCML$,FDOF$L,FCSBT$,ALUN$,DIR$,EXIT$S,QIOW$,QIO$,FDBDF$ .MCALL FSRSZ$,FDBK$R,FDAT$R,OPEN$R,OPEN$W,CLOSE$,CSI$SW,CSI$ND .MCALL FINIT$,READ$,PRINT$,NBOF$L,GTIM$S,PUT$,WTSE$ .GLOBL IO.WLB,$DSW,$DSPAT,IE.EOF,.RDFUI,.RDFDR,.PRSFN,IO.ATT,IO.DET .GLOBL .DLFNB ; ; ASCII character definitions ; LF=12 ;Line feed FF=14 ;Form feed BLANK=40 ;ASCII space COLON=': ;ASCII colon <:> COMMA=', ;ASCII comma <,> CSI$ ;Set up symbol definitions for CSI$1, CSI$2 FDOF$L ;Set up FDB symbol definitions FCSBT$ ;Set up FCS symbol definitions NBOF$L ;Set up file name block definitions TRUE=-1 ;Value of .TRUE. variables FALSE=0 ;Value of .FALSE. variables ; ; Logical unit number assignments ; CMDLUN=1 ;LUN for use by GCML$ TILUN=2 ;Terminal logical unit OUTLUN=3 ;Binary compare output unit IN0LUN=4 ;Binary input file 0 IN1LUN=5 ;Binary input file 1 BLKSIZ=512. ;Size of each block of data OUTBFS=120. ;Maximum size of output file line length CMDLEN=110. ;Length of user input line PAGLEN=62. ;Number of lines per page INDLVL=4 ;Number of nested command files allowed DSPTUC=4 ;Index into UIC of a DSPT table DSPTFN=10 ;Index into file name of a DSPT table ; ; Switch definitions ; BYTSW=1 ;/BYTE SPLSW=2 ;/SPOOL ; ; Event flags ; OUTEVF=1 ;Used with output comparison file IN0EVF=2 ;Used with input file zero IN1EVF=3 ;Used with input file one TTYEVF=4 ;Used with terminal I/O ; ; Indexes into WRTFIL transfer tables ; WRTCHR=0 ;Entry 0 - write out a character WRTOCT=2 ;Entry 1 - write out an octal number WRTR50=4 ;Entry 2 - write out a radix-50 word WRTSTN=6 ;Entry 3 - write out a string of characters .SBTTL Data section .PSECT DATA,D GCMDAT: GCMLB$ INDLVL,BIC,,CMDLUN,,CMDLEN ;Set up data block for GMCL$ .EVEN CSIDAT: .BLKB C.SIZE ;Set up data block for CSI$1, CSI$2 BYTMOD: .BLKB 1 ;True if /BYTE comparison SPOOL: .BLKB 1 ;True if /SPOOL requested BUFFER: .BLKB 1 ;Buffer for OUTCHR of one character TTYEOF: .BLKB 1 ;True if terminal EOF found EOF0: .BLKB 1 ;True if EOF found on input file 0 EOF1: .BLKB 1 ;True if EOF found on input file 1 .EVEN FPC: .BLKW 1 ;Location (PC) in file of words to compare DIFCNT: .BLKW 1 ;Number of differences encountered LINE: .BLKW 1 ;Current line on output page PAGE: .BLKW 1 ;Current page on output listing DATA0: .BLKW 1 ;Current word/byte to compare from input file 0 DATA1: .BLKW 1 ;Current word/byte to compare from input file 1 ; ; Time parameter block (following eight locations will be kept contiguous). ; TIMPAR: YEAR: .BLKW 1 ; Since 1900 MONTH: .BLKW 1 ; 1 - 12 DAY: .BLKW 1 ; 1 - 31 HOUR: .BLKW 1 ; 0 - 23 MINUTE: .BLKW 1 ; 0 - 59 SECOND: .BLKW 1 ; 0 - 59 TICK: .BLKW 1 ; 0 - 59 TICSEC: .BLKW 1 ; 60. ; ; The following two words are used by GETUIC in getting a file's UIC. ; They must be kept together: ; UICLEN: .BLKW 1 ;Length of .ASCII/[uic]/ FSRUIC: .BLKW 1 ;Address of .ASCII/[uic]/ ; GCMLUN: ALUN$ CMDLUN,TI,0 ;ASNLUN for GMCL$ input TTYLUN: ALUN$ TILUN,TI,0 ;Assign logical unit directive block TIWQIO: QIOW$ IO.WLB,TILUN,TTYEVF ;Write to TI: directive block WAIT: WTSE$ TTYEVF ;Wait for TI: directive block IN0WAT: WTSE$ IN0EVF ;Wait for file 0 input transfer IN1WAT: WTSE$ IN1EVF ;Wait for file 1 input transfer ATTACH: QIO$ IO.ATT,OUTLUN ;QIO to attach the terminal to enable control-O DETACH: QIO$ IO.DET,OUTLUN ;QIO to detach the terminal ; ; FDBs: ; OUTFIL: FDBDF$ ;FDB for comparison output INFIL0: FDBDF$ ;FDB for binary input file INFIL1: FDBDF$ ;FDB for other binary input file OUTDSP: .BLKW 6 ;File name dispatch table for output file INDSP0: .BLKW 6 ;File name dispatch table for input file 1 INDSP1: .BLKW 6 ;File name dispatch table for input file 2 DEFOUT: NMBLK$ BIC,LST,,SY,0 ;Default values for output file name DEFIN0: NMBLK$ ,,,SY,0 ;Default values for input file 0 DEFIN1: .BLKB S.FNB ;Default name block for input file 1 ; ; I/O buffers ; OUTPNT: .BLKW 1 ;Points to current fill location in OUTBUF OUTBUF: .BLKB OUTBFS ;Output file comparison buffer ; ; The following buffers have been structured into ring buffers; i.e., ; the first buffer points to the second buffer which points to the ; first buffer. Do not separate these words of core as the buffer ; is assumed to start immediately after the ring pointer. ; BFPNT0: .BLKW 1 ;Pointer into the current word/byte of ; the current buffer of input file 0 BFCNT0: .BLKW 1 ;Count of the number of words/bytes left ; in the current buffer of input file 0 NXTBF0: .BLKW 1 ;Pointer to the head of the next buffer RING00: .WORD RING10 ;This is the ring buffer BUFRA0: .BLKB BLKSIZ ; for input file 0 RING10: .WORD RING00 BUFRB0: .BLKB BLKSIZ BFPNT1: .BLKW 1 ;Pointer into the current word/byte of ; the current buffer of input file 1 BFCNT1: .BLKW 1 ;Count of the number of words/bytes left ; in the current buffer of input file 1 NXTBF1: .BLKW 1 ;Pointer to the head of the next buffer RING01: .WORD RING11 ;This is the ring buffer of BUFRA1: .BLKB BLKSIZ ; input file 1 RING11: .WORD RING01 BUFRB1: .BLKB BLKSIZ IN0STS: .BLKB 4 ;Input file zero status block IN1STS: .BLKB 4 ;Input file one status block ; ; WRTFIL transfer tables: Indexes into these tables are on the ; definition pages ; PUTWRT: .WORD PUTCHR ;WRTCHR .WORD PUTOCT ;WRTOCT .WORD PUTR50 ;WRTR50 .WORD PUTSTN ;WRTSTN PNTWRT: .WORD OUTCHR ;WRTCHR .WORD PNTOCT ;WRTOCT .WORD PNTR50 ;WRTR50 .WORD OUTSTN ;WRTSTN ; ; Switch table of allowable switches ; SWTAB: CSI$SW BY,BYTSW,,,NEG ;/BYTE CSI$SW SP,SPLSW,,,NEG ;/SPOOL CSI$ND ;Table done ; ; Radix-50 character conversion table ; RADX50: .BYTE 40 ; .BYTE 101 ; A .BYTE 102 ; B .BYTE 103 ; C .BYTE 104 ; D .BYTE 105 ; E .BYTE 106 ; F .BYTE 107 ; G .BYTE 110 ; H .BYTE 111 ; I .BYTE 112 ; J .BYTE 113 ; K .BYTE 114 ; L .BYTE 115 ; M .BYTE 116 ; N .BYTE 117 ; O .BYTE 120 ; P .BYTE 121 ; Q .BYTE 122 ; R .BYTE 123 ; S .BYTE 124 ; T .BYTE 125 ; U .BYTE 126 ; V .BYTE 127 ; W .BYTE 130 ; X .BYTE 131 ; Y .BYTE 132 ; Z .BYTE 44 ; $ .BYTE 56 ; . .BYTE 0 ; .BYTE 60 ; 0 .BYTE 61 ; 1 .BYTE 62 ; 2 .BYTE 63 ; 3 .BYTE 64 ; 4 .BYTE 65 ; 5 .BYTE 66 ; 6 .BYTE 67 ; 7 .BYTE 70 ; 8 .BYTE 71 ; 9 ; ; FCS error code index table into ASCIZ messages ; IOERRS: .WORD IOMBAD ; -1 .WORD IOMIFC ; -2 .WORD IOMDNR ; -3 .WORD IOMVER ; -4 .WORD IOMONP ; -5 .WORD IOMSPC ; -6 .WORD IOMDNA ; -7 .WORD IOMDAA ; -8 .WORD IOMDUN ; -9 .WORD IOMEOF ; -10 .WORD IOMEOV ; -11 .WORD IOMWLK ; -12 .WORD IOMDAO ; -13 .WORD IOMSRE ; -14 .WORD IOMABO ; -15 .WORD IOMPRI ; -16 .WORD IOMRSU ; -17 .WORD IOMOVR ; -18 .WORD IOMBYT ; -19 .WORD IOMBLK ; -20 .WORD IOMMOD ; -21 .WORD IOMCON ; -22 .WORD IOMNOD ; -23 .WORD IOMDFU ; -24 .WORD IOMIFU ; -25 .WORD IOMNSF ; -26 .WORD IOMLCK ; -27 .WORD IOMHFU ; -28 .WORD IOMWAC ; -29 .WORD IOMCKS ; -30 .WORD IOMWAT ; -31 .WORD IOMRER ; -32 .WORD IOMWER ; -33 .WORD IOMALN ; -34 .WORD IOMSNC ; -35 .WORD IOMSOC ; -36 .WORD IOMNLN ; -37 .WORD IOMCLO ; -38 .WORD IOMNBF ; -39 .WORD IOMRBG ; -40 .WORD IOMNBK ; -41 .WORD IOMILL ; -42 .WORD IOMBTP ; -43 .WORD IOMRAC ; -44 .WORD IOMRAT ; -45 .WORD IOMRCN ; -46 .WORD IOMICE ; -47 .WORD IOM2DV ; -48 .WORD IOMFEX ; -49 .WORD IOMBDR ; -50 .WORD IOMRNM ; -51 .WORD IOMBDI ; -52 .WORD IOMFOP ; -53 .WORD IOMBNM ; -54 .WORD IOMBDV ; -55 .WORD IOMBBE ; -56 .WORD IOMDUP ; -57 .WORD IOMSTK ; -58 .WORD IOMFHE ; -59 .WORD IOMNFI ; -60 .WORD IOMISQ ; -61 .WORD IOMEOT ; -62 .WORD IOMBVR ; -63 .WORD IOMBHD ; -64 .WORD IOMOFL ; -65 .WORD IOMBCC ; -66 .WORD IOMONL ; -67 .WORD IOMNNN ; -68 .WORD IOMNFW ; -69 .WORD IOMBLB ; -70 .WORD IOMTMM ; -71 .WORD IOMNDR ; -72 .WORD IOMUN1 ; -73 .WORD IOMUN2 ; -74 .WORD IOMUN3 ; -75 .WORD IOMBTF ; -76 .WORD IOMNNC ; -77 .WORD IOMNNL ; -78 .WORD IOMNLK ; -79 .WORD IOMNST ; -80 .WORD IOMFLN ; -81 .WORD IOMIES ; -82 .WORD IOMPES ; -83 .WORD IOMALC ; -84 .WORD IOMULK ; -85 .WORD IOMWCK ; -86 .WORD IOMR87 ; -87 .WORD IOMR88 ; -88 .WORD IOMR89 ; -89 .WORD IOMR90 ; -90 .WORD IOMR91 ; -91 .WORD IOMR92 ; -92 .WORD IOMR93 ; -93 .WORD IOMR94 ; -94 .WORD IOMR95 ; -95 .WORD IOMCNR ; -96 ; ; DSW error code index table into ASCIZ messages ; DSWERR: .WORD DSWUPN ; -1 .WORD DSWINS ; -2 .WORD DSWPTS ; -3 .WORD DSWUNS ; -4 .WORD DSWULN ; -5 .WORD DSWHWR ; -6 .WORD DSWACT ; -7 .WORD DSWITS ; -8 .WORD DSWFIX ; -9 .WORD DSWCKP ; -10 .WORD DSWTCH ; -11 .WORD DSWR01 ; -12 .WORD DSWR02 ; -13 .WORD DSWR03 ; -14 .WORD DSWRBS ; -15 .WORD DSWPRI ; -16 .WORD DSWRSU ; -17 .WORD DSWNSW ; -18 .WORD DSWILV ; -19 .WORD DSWR20 ; -20 .WORD DSWR21 ; -21 .WORD DSWR22 ; -22 .WORD DSWR23 ; -23 .WORD DSWR24 ; -24 .WORD DSWR25 ; -25 .WORD DSWR26 ; -26 .WORD DSWR27 ; -27 .WORD DSWR28 ; -28 .WORD DSWR29 ; -29 .WORD DSWR30 ; -30 .WORD DSWR31 ; -31 .WORD DSWR32 ; -32 .WORD DSWR33 ; -33 .WORD DSWR34 ; -34 .WORD DSWR35 ; -35 .WORD DSWR36 ; -36 .WORD DSWR37 ; -37 .WORD DSWR38 ; -38 .WORD DSWR39 ; -39 .WORD DSWR40 ; -40 .WORD DSWR41 ; -41 .WORD DSWR42 ; -42 .WORD DSWR43 ; -43 .WORD DSWR44 ; -44 .WORD DSWR45 ; -45 .WORD DSWR46 ; -46 .WORD DSWR47 ; -47 .WORD DSWR48 ; -48 .WORD DSWR49 ; -49 .WORD DSWR50 ; -50 .WORD DSWR51 ; -51 .WORD DSWR52 ; -52 .WORD DSWR53 ; -53 .WORD DSWR54 ; -54 .WORD DSWR55 ; -55 .WORD DSWR56 ; -56 .WORD DSWR57 ; -57 .WORD DSWR58 ; -58 .WORD DSWR59 ; -59 .WORD DSWR60 ; -60 .WORD DSWR61 ; -61 .WORD DSWR62 ; -62 .WORD DSWR63 ; -63 .WORD DSWR64 ; -64 .WORD DSWR65 ; -65 .WORD DSWR66 ; -66 .WORD DSWR67 ; -67 .WORD DSWR68 ; -68 .WORD DSWR69 ; -69 .WORD DSWR70 ; -70 .WORD DSWR71 ; -71 .WORD DSWR72 ; -72 .WORD DSWR73 ; -73 .WORD DSWR74 ; -74 .WORD DSWR75 ; -75 .WORD DSWR76 ; -76 .WORD DSWR77 ; -77 .WORD DSWR78 ; -78 .WORD DSWR79 ; -79 .WORD DSWAST ; -80 .WORD DSWMAP ; -81 .WORD DSWR82 ; -82 .WORD DSWIOP ; -83 .WORD DSWALG ; -84 .WORD DSWWOV ; -85 .WORD DSWNVR ; -86 .WORD DSWNVW ; -87 .WORD DSWITP ; -88 .WORD DSWIBS ; -89 .WORD DSWLNL ; -90 .WORD DSWIUI ; -91 .WORD DSWIDU ; -92 .WORD DSWITI ; -93 .WORD DSWPNS ; -94 .WORD DSWIPR ; -95 .WORD DSWILU ; -96 .WORD DSWIEF ; -97 .WORD DSWADP ; -98 .WORD DSWSDP ; -99 MONTAB: .WORD JAN ; January .WORD FEB ; February .WORD MAR ; March .WORD APR ; April .WORD MAY ; May .WORD JUN ; June .WORD JUL ; July .WORD AUG ; August .WORD SEP ; September .WORD OCT ; October .WORD NOV ; November .WORD DEC ; December .NLIST BEX ; ; FCS error messages ; IOMBAD: .ASCIZ \-1 (bad parameters)\ IOMIFC: .ASCIZ \-2 (invalid function code)\ IOMDNR: .ASCIZ \-3 (device not ready)\ IOMVER: .ASCIZ \-4 (parity error on device)\ IOMONP: .ASCIZ \-5 (hardware option not present)\ IOMSPC: .ASCIZ \-6 (illegal user buffer)\ IOMDNA: .ASCIZ \-7 (device not attached)\ IOMDAA: .ASCIZ \-8 (device already attached)\ IOMDUN: .ASCIZ \-9 (device not attachable)\ IOMEOF: .ASCIZ \-10 (end of file detected)\ IOMEOV: .ASCIZ \-11 (end of volume detected)\ IOMWLK: .ASCIZ \-12 (write attempted to locked unit)\ IOMDAO: .ASCIZ \-13 (data overrun)\ IOMSRE: .ASCIZ \-14 (send/receive failure)\ IOMABO: .ASCIZ \-15 (request terminated)\ IOMPRI: .ASCIZ \-16 (privilege violation (file protected))\ IOMRSU: .ASCIZ \-17 (shareable resource in use)\ IOMOVR: .ASCIZ \-18 (illegal overlay request)\ IOMBYT: .ASCIZ \-19 (odd byte count (or virtual address))\ IOMBLK: .ASCIZ \-20 (logical block number too large)\ IOMMOD: .ASCIZ \-21 (invalid UDC module number)\ IOMCON: .ASCIZ \-22 (UDC connect error)\ IOMNOD: .ASCIZ \-23 (system dynamic memory)\ IOMDFU: .ASCIZ \-24 (device full)\ IOMIFU: .ASCIZ \-25 (index file full)\ IOMNSF: .ASCIZ \-26 (file not found)\ IOMLCK: .ASCIZ \-27 (locked from read/write access)\ IOMHFU: .ASCIZ \-28 (file header full)\ IOMWAC: .ASCIZ \-29 (file accessed for write)\ IOMCKS: .ASCIZ \-30 (file header checksum failure)\ IOMWAT: .ASCIZ \-31 (attribute control list format error)\ IOMRER: .ASCIZ \-32 (file processor device read error)\ IOMWER: .ASCIZ \-33 (file processor device write error)\ IOMALN: .ASCIZ \-34 (file already accessed on LUN)\ IOMSNC: .ASCIZ \-35 (file ID, file number check)\ IOMSOC: .ASCIZ \-36 (file ID, sequence number check)\ IOMNLN: .ASCIZ \-37 (no file accessed on LUN)\ IOMCLO: .ASCIZ \-38 (file was not closed properly)\ IOMNBF: .ASCIZ \-39 (no buffer space available for file)\ IOMRBG: .ASCIZ \-40 (illegal record size)\ IOMNBK: .ASCIZ \-41 (file exceeds space allocated, no blocks)\ IOMILL: .ASCIZ \-42 (Illegal operaton on file descriptor block)\ IOMBTP: .ASCIZ \-43 (bad record type)\ IOMRAC: .ASCIZ \-44 (illegal record access bits set)\ IOMRAT: .ASCIZ \-45 (illegal record attribute bits set)\ IOMRCN: .ASCIZ \-46 (illegal record number--too large)\ IOMICE: .ASCIZ \-47 (FCS internal consistency error)\ IOM2DV: .ASCIZ \-48 ((Rename) two different devices)\ IOMFEX: .ASCIZ \-49 ((Rename) new file name already exists)\ IOMBDR: .ASCIZ \-50 (bad directory file)\ IOMRNM: .ASCIZ \-51 (cannot rename old file system)\ IOMBDI: .ASCIZ \-52 (bad directory syntax)\ IOMFOP: .ASCIZ \-53 (file already open)\ IOMBNM: .ASCIZ \-54 (bad file name)\ IOMBDV: .ASCIZ \-55 (bad device name)\ IOMBBE: .ASCIZ \-56 (bad block on device)\ IOMDUP: .ASCIZ \-57 ((Enter) file already exists)\ IOMSTK: .ASCIZ \-58 (not enough stack space in FCS or FCP)\ IOMFHE: .ASCIZ \-59 (fatal hardware error on device)\ IOMNFI: .ASCIZ \-60 (file ID was not specified)\ IOMISQ: .ASCIZ \-61 (illegal sequential operation)\ IOMEOT: .ASCIZ \-62 (End of tape detected)\ IOMBVR: .ASCIZ \-63 (bad version number)\ IOMBHD: .ASCIZ \-64 (bad file header)\ IOMOFL: .ASCIZ \-65 (device offline)\ IOMBCC: .ASCIZ \-66 (block check, CRC or framing error)\ IOMONL: .ASCIZ \-67 (device online)\ IOMNNN: .ASCIZ \-68 (no such node)\ IOMNFW: .ASCIZ \-69 (path lost to partner)\ IOMBLB: .ASCIZ \-70 (bad logical buffer)\ IOMTMM: .ASCIZ \-71 (too many outstanding messages)\ IOMNDR: .ASCIZ \-72 (no dynamic space available)\ IOMUN1: .ASCIZ \-73 (unknown)\ IOMUN2: .ASCIZ \-74 (unknown)\ IOMUN3: .ASCIZ \-75 (unknown)\ IOMBTF: .ASCIZ \-76 (bad tape format)\ IOMNNC: .ASCIZ \-77 (not an ANSI "D" format byte count)\ IOMNNL: .ASCIZ \-78 (not a network LUN)\ IOMNLK: .ASCIZ \-79 (task not linked to specified ICS/ICR interrupts)\ IOMNST: .ASCIZ \-80 (specified task not installed)\ IOMFLN: .ASCIZ \-81 (device offline when offline request was issued)\ IOMIES: .ASCIZ \-82 (invalid escape sequence)\ IOMPES: .ASCIZ \-83 (partial escape sequence)\ IOMALC: .ASCIZ \-84 (allocation failure)\ IOMULK: .ASCIZ \-85 (unlock error)\ IOMWCK: .ASCIZ \-86 (write check failure)\ IOMR87: .ASCIZ \-87 (unknown)\ IOMR88: .ASCIZ \-88 (unknown)\ IOMR89: .ASCIZ \-89 (unknown)\ IOMR90: .ASCIZ \-90 (unknown)\ IOMR91: .ASCIZ \-91 (unknown)\ IOMR92: .ASCIZ \-92 (unknown)\ IOMR93: .ASCIZ \-93 (unknown)\ IOMR94: .ASCIZ \-94 (unknown)\ IOMR95: .ASCIZ \-95 (unknown)\ IOMCNR: .ASCIZ \-96 (connection rejected)\ ; ; DSW error messages ; DSWUPN: .ASCIZ \-1 (insufficient dynamic storage)\ DSWINS: .ASCIZ \-2 (specified task not installed)\ DSWPTS: .ASCIZ \-3 (partition too small for task)\ DSWUNS: .ASCIZ \-4 (insufficient dynamic storage for send)\ DSWULN: .ASCIZ \-5 (unassigned LUN)\ DSWHWR: .ASCIZ \-6 (device driver not resident)\ DSWACT: .ASCIZ \-7 (task not active)\ DSWITS: .ASCIZ \-8 (directive inconsistent with task state)\ DSWFIX: .ASCIZ \-9 (task already fixed/unfixed)\ DSWCKP: .ASCIZ \-10 (issuing task not checkpointable)\ DSWTCH: .ASCIZ \-11 (task is checkpointable)\ DSWR01: .ASCIZ \-12 (unknown)\ DSWR02: .ASCIZ \-13 (unknown)\ DSWR03: .ASCIZ \-14 (unknown)\ DSWRBS: .ASCIZ \-15 (receive buffer is too small)\ DSWPRI: .ASCIZ \-16 (privelege violation)\ DSWRSU: .ASCIZ \-17 (resource in use)\ DSWNSW: .ASCIZ \-18 (no swap space available)\ DSWILV: .ASCIZ \-19 (illegal vector specified)\ DSWR20: .ASCIZ \-20 (unknown)\ DSWR21: .ASCIZ \-21 (unknown)\ DSWR22: .ASCIZ \-22 (unknown)\ DSWR23: .ASCIZ \-23 (unknown)\ DSWR24: .ASCIZ \-24 (unknown)\ DSWR25: .ASCIZ \-25 (unknown)\ DSWR26: .ASCIZ \-26 (unknown)\ DSWR27: .ASCIZ \-27 (unknown)\ DSWR28: .ASCIZ \-28 (unknown)\ DSWR29: .ASCIZ \-29 (unknown)\ DSWR30: .ASCIZ \-30 (unknown)\ DSWR31: .ASCIZ \-31 (unknown)\ DSWR32: .ASCIZ \-32 (unknown)\ DSWR33: .ASCIZ \-33 (unknown)\ DSWR34: .ASCIZ \-34 (unknown)\ DSWR35: .ASCIZ \-35 (unknown)\ DSWR36: .ASCIZ \-36 (unknown)\ DSWR37: .ASCIZ \-37 (unknown)\ DSWR38: .ASCIZ \-38 (unknown)\ DSWR39: .ASCIZ \-39 (unknown)\ DSWR40: .ASCIZ \-40 (unknown)\ DSWR41: .ASCIZ \-41 (unknown)\ DSWR42: .ASCIZ \-42 (unknown)\ DSWR43: .ASCIZ \-43 (unknown)\ DSWR44: .ASCIZ \-44 (unknown)\ DSWR45: .ASCIZ \-45 (unknown)\ DSWR46: .ASCIZ \-46 (unknown)\ DSWR47: .ASCIZ \-47 (unknown)\ DSWR48: .ASCIZ \-48 (unknown)\ DSWR49: .ASCIZ \-49 (unknown)\ DSWR50: .ASCIZ \-50 (unknown)\ DSWR51: .ASCIZ \-51 (unknown)\ DSWR52: .ASCIZ \-52 (unknown)\ DSWR53: .ASCIZ \-53 (unknown)\ DSWR54: .ASCIZ \-54 (unknown)\ DSWR55: .ASCIZ \-55 (unknown)\ DSWR56: .ASCIZ \-56 (unknown)\ DSWR57: .ASCIZ \-57 (unknown)\ DSWR58: .ASCIZ \-58 (unknown)\ DSWR59: .ASCIZ \-59 (unknown)\ DSWR60: .ASCIZ \-60 (unknown)\ DSWR61: .ASCIZ \-61 (unknown)\ DSWR62: .ASCIZ \-62 (unknown)\ DSWR63: .ASCIZ \-63 (unknown)\ DSWR64: .ASCIZ \-64 (unknown)\ DSWR65: .ASCIZ \-65 (unknown)\ DSWR66: .ASCIZ \-66 (unknown)\ DSWR67: .ASCIZ \-67 (unknown)\ DSWR68: .ASCIZ \-68 (unknown)\ DSWR69: .ASCIZ \-69 (unknown)\ DSWR70: .ASCIZ \-70 (unknown)\ DSWR71: .ASCIZ \-71 (unknown)\ DSWR72: .ASCIZ \-72 (unknown)\ DSWR73: .ASCIZ \-73 (unknown)\ DSWR74: .ASCIZ \-74 (unknown)\ DSWR75: .ASCIZ \-75 (unknown)\ DSWR76: .ASCIZ \-76 (unknown)\ DSWR77: .ASCIZ \-77 (unknown)\ DSWR78: .ASCIZ \-78 (unknown)\ DSWR79: .ASCIZ \-79 (unknown)\ DSWAST: .ASCIZ \-80 (directive issued/not issued from AST)\ DSWMAP: .ASCIZ \-81 (illegal mapping specified)\ DSWR82: .ASCIZ \-82 (unknown)\ DSWIOP: .ASCIZ \-83 (window has I/O in progress)\ DSWALG: .ASCIZ \-84 (alignment error)\ DSWWOV: .ASCIZ \-85 (address window allocation overflow)\ DSWNVR: .ASCIZ \-86 (invalid region ID)\ DSWNVW: .ASCIZ \-87 (invalid address window ID)\ DSWITP: .ASCIZ \-88 (invalid TI parameter)\ DSWIBS: .ASCIZ \-89 (invalid send buffer size (> 255.))\ DSWLNL: .ASCIZ \-90 (LUN locked in use)\ DSWIUI: .ASCIZ \-91 (invalid UIC)\ DSWIDU: .ASCIZ \-92 (invalid device or unit)\ DSWITI: .ASCIZ \-93 (invalid time parameters)\ DSWPNS: .ASCIZ \-94 (partition/region not in system)\ DSWIPR: .ASCIZ \-95 (invalid priority (> 250.))\ DSWILU: .ASCIZ \-96 (invalid LUN)\ DSWIEF: .ASCIZ \-97 (invalid event flag (> 64.))\ DSWADP: .ASCIZ \-98 (part of DPB out of user's space)\ DSWSDP: .ASCIZ \-99 (DIC or DPB size invalid)\ JAN: .ASCIZ /January / FEB: .ASCIZ /February / MAR: .ASCIZ /March / APR: .ASCIZ /April / MAY: .ASCIZ /May / JUN: .ASCIZ /June / JUL: .ASCIZ /July / AUG: .ASCIZ /August / SEP: .ASCIZ /September / OCT: .ASCIZ /October / NOV: .ASCIZ /November / DEC: .ASCIZ /December / ; ; GETCMD messages ; IORMES: .ASCIZ <15><12>\?I/O error \ ONMES: .ASCIZ / on input command / FILMES: .ASCIZ /file/ LINMES: .ASCIZ /line/ LNGMES: .ASCIZ <15><12>/?Input command line too long/ OVFMES: .ASCIZ <15><12>/?Too many nested command files/ FSPMES: .ASCIZ <15><12>/?Illegal command file specification/ ILCMES: .ASCIZ <15><12>/?Unrecognized command line syntax or switch/ EQLMES: .ASCIZ <15><12>/?No equal sign seen in input command line/ MNOMES: .ASCIZ <15><12>/?Too many output file names given/ MNIMES: .ASCIZ <15><12>/?Too many input file names given/ WLDMES: .ASCIZ <15><12>/?No wild card file names allowed/ FEWMES: .ASCIZ <15><12>/?Not enough input files to compare/ ; ; OUTPUT messages ; TITLE1: .ASCIZ /Binary compare of / TITLE2: .ASCIZ / and / TITLE3: .ASCIZ /Done on / TITLE4: .ASCIZ /, / TITLE5: .ASCIZ / at / TITLE6: .ASCIZ /Page / TITLE7: .ASCIZ / PC File 1 File 2 XOR/ TITLE8: .ASCIZ / -- ------ ------ ---/ SPACE3: .ASCIZ / / SPACE6: .ASCIZ / / SPACE9: .ASCIZ / / ; ; Miscellaneous messages ; OPNERR: .ASCIZ <15><12>/?Open failure / ONFILE: .ASCIZ / on file / QUENSP: .ASCIZ <15><12>/?Unable to spool output file / DSWQ: .ASCIZ /; DSW = / FCSQ: .ASCIZ /; FCS error = / READER: .ASCIZ <15><12>/?FCS read error / READRD: .ASCIZ <15><12>/?DSW read error / WRITER: .ASCIZ <15><12>/?FCS write error / WRITED: .ASCIZ <15><12>/?DSW write error / NODIF: .ASCIZ <15><12>/--No differences found--/ DIFMS1: .ASCIZ <15><12>/%Total of / DIFMS2: .ASCIZ /. differences found/ DIFMS3: .ASCIZ /. difference found/ .LIST BEX FSRSZ$ 1 ;Set up FSR region .SBTTL Main-line code .PSECT BINCOM,I START: DIR$ #GCMLUN,DSASTR ;Assign the LUN for GMCL$ DIR$ #TTYLUN,DSASTR ;Assign the terminal LUN GTIM$S #TIMPAR ;Get the time and date FINIT$ ;Initiate I/O with FCS GO: CALL GETCMD ;Go get command from the user BCS CHKEOF ;Did we have an error? CALL OPENIO ;No, get input files and open output files BCS GO ;Restart if we had an error CLR FPC ;Zero the file PC CLR DIFCNT ;We haven't had any differences yet CLR LINE ;Set the line count to top of page CLR PAGE ;Set the page count to zero CALL COMPAR ;Check these files out! BCS FINISH ;Oops--an I/O error CALL TELDIF ;Go tell the user how many differences there were FINISH: CALL FINIO ;Finish I/O with FCS JMP GO ;And go back for more CHKEOF: TSTB TTYEOF ;Was the error a command EOF? BEQ GO ;No EXIT$S ;Yes, let's quit DSASTR: MOV $DSW,R0 ;Get DSW in R0 for user to see HALT ;Create disaster .SBTTL GETCMD--Routine to get user command line GETCMD: MOVB #FALSE,BYTMOD ;Assume this is a word mode comparison MOVB #FALSE,SPOOL ; and no spooling of the output file GETLIN: GCML$ #GCMDAT ;Go get the users first input line BCC CHKSYN ;Did an error occur? JMP GCMERR ;Yes! CHKSYN: CSI$1 #CSIDAT,GCMDAT+G.CMLD+2,GCMDAT+G.CMLD ;Initialize parser BCC CHKNUL ;Continue processing if no error JMP ILLCMD ;Ooops...something wrong with syntax CHKNUL: TST CSIDAT+C.CMLD ;Did the user type anything on the line? BEQ GETLIN ;Ignore the line if he didn't BITB #CS.EQU,CSIDAT+C.STAT ;Did we see an equal sign? BNE GETOUT ;Continue processing if yes JMP NOEQUL ;Give error otherwise GETOUT: CSI$2 #CSIDAT,OUTPUT,#SWTAB ;Get the output file name BCS ILLCMD ;Error...perhaps user typed in a switch BITB #CS.WLD,CSIDAT+C.STAT ;Was this a wild card specification? BNE NOWILD ;If yes, this is a no-no MOV #OUTDSP,R0 ;Get the address of the internal DSPT table CALL FILDSP ;And store the DSPT information FDOP$R #OUTFIL,#OUTLUN,#OUTDSP,#DEFOUT,#FO.WRT ;Store the file name CALL SETSW ;Go check out any switches which were set BITB #CS.MOR,CSIDAT+C.STAT ;Are there anymore output files? BNE TOMNYO ;Yes! Too many output files CSI$2 #CSIDAT,INPUT,#SWTAB ;Get the input file name BCS ILLCMD ;Error...perhaps the user typed in a switch BITB #CS.WLD,CSIDAT+C.STAT ;Was this a wild card specification? BNE NOWILD ;If yes, this is a no-no MOV #INDSP0,R0 ;Get the address of the internal DSPT table CALL FILDSP ;And store the DSPT information FDOP$R #INFIL0,#IN0LUN,#INDSP0,#DEFIN0,#FO.RD,#FA.DLK ;Store name CALL SETSW ;Go check out any switches which were set BITB #CS.MOR,CSIDAT+C.STAT ;Did the user type in more than one input file? BEQ TOFEWI ;No, not enough input files CSI$2 #CSIDAT,INPUT,#SWTAB ;Get the input file name BCS ILLCMD ;Error...perhaps the user typed in a switch BITB #CS.WLD,CSIDAT+C.STAT ;Was this a wild card specification? BNE NOWILD ;If yes, this is a no-no MOV #INDSP1,R0 ;Get the address of the internal DSPT table CALL FILDSP ;And store the DSPT information CALL MAKDFN ;Make the default name block from input file 0 FDOP$R #INFIL1,#IN1LUN,#INDSP1,#DEFIN1,#FO.RD,#FA.DLK ;Store name CALL SETSW ;Go check out any switches which were set BITB #CS.MOR,CSIDAT+C.STAT ;Did the user type in more input file names? BNE TOMNYI ;Yes! Too many input files CLC ;Say all is well RETURN ;Bye.... ILLCMD: CALL ILCMDS ;Go print the error message JMP GETCMD ;And try for another line NOWILD: CALL NOWLDS ;Go print error message JMP GETCMD ;And try for another line NOEQUL: CALL NOEQLS ;Go print the error message JMP GETCMD ;And try for another line TOMNYO: CALL TMNYOS ;Go print the error message JMP GETCMD ;And try for another line TOMNYI: CALL TMNYIS ;Go print the error message JMP GETCMD ;And try for another line TOFEWI: CALL TFEWIS ;Go print error message JMP GETCMD ;And try for another line GCMERR: CMPB #GE.EOF,GCMDAT+G.ERR ;Is the user done? BNE GCMER2 ;No, it is a real error MOVB #TRUE,TTYEOF ;Yes, set return status SEC ;Say all is not well RETURN ;Bye.... GCMER2: CALL GCMERS ;Go process the error JMP GETCMD ;And try for another line FILDSP: MOV CSIDAT+C.DSDS+0,(R0)+ MOV CSIDAT+C.DSDS+2,(R0)+ MOV CSIDAT+C.DSDS+4,(R0)+ MOV CSIDAT+C.DSDS+6,(R0)+ MOV CSIDAT+C.DSDS+10,(R0)+ MOV CSIDAT+C.DSDS+12,(R0)+ RETURN MAKDFN: MOV #DEFIN1,R0 MAKDF1: CLR (R0)+ CMP R0,#DEFIN1+S.FNB BNE MAKDF1 MOV #INFIL1,R0 MOV #DEFIN1,R1 MOV INFIL0+F.DSPT,R2 CLR R3 CALL .PRSFN MOV #"SY,DEFIN1+N.DVNM RETURN SETSW: MOV CSIDAT+C.MKW1,R0 ;Get the switch word MOV CSIDAT+C.MKW2,R1 ;Get its +/- value BITB #BYTSW,R0 ;Did the user type /BYTE? BEQ TSTSPL ;No MOVB #TRUE,BYTMOD ;Yes, assume he typed /BYTE BITB #BYTSW,R1 ;Did he? BNE TSTSPL ;Yes MOVB #FALSE,BYTMOD ;No TSTSPL: BITB #SPLSW,R0 ;Did the user type /SPOOL? BEQ LEAVE ;No MOVB #TRUE,SPOOL ;Assume he typed /SPOOL BITB #SPLSW,R1 ;But did he really? BNE LEAVE ;Yes MOVB #FALSE,SPOOL ;No LEAVE: RETURN GCMERS: MOV #LNGMES,R1 ;Assume GE.RBG CMPB #GE.RBG,GCMDAT+G.ERR ;Was it? BEQ PUTMES ;Yes! MOV #OVFMES,R1 ;No, assume GE.MDE CMPB #GE.MDE,GCMDAT+G.ERR ;Yes, too many @ files BEQ PUTMES ;It was MOV #FSPMES,R1 ;No, assume command CMPB #GE.BIF,GCMDAT+G.ERR ; line was too long BEQ PUTMES ;Yes... MOV #IORMES,R0 ;No, must be file error CALL OUTSTR ;Tell user first part MOV GCMDAT+F.ERR,R0 ;Get FCS error code CALL PNTOCT ;Print it MOV #ONMES,R0 ;Now tell him which error CALL OUTSTR ; type MOV #FILMES,R1 ;Assume it was an @ file problem CMPB #GE.IOR,GCMDAT+G.ERR ;But was it? BNE PUTMES ;Yes... MOV #LINMES,R1 ;No, must be cmd line device problem PUTMES: RCML$ GCMDAT ;Clear out all indirect files MOV R1,R0 ;Get address of message in right place JMP OUTSTR ;Print message...OUTSTR will return for us ILCMDS: MOV #ILCMES,R0 ;Get illegal cmd line message JMP OUTSTR ;Let OUTSTR print and return NOEQLS: MOV #EQLMES,R0 ;Get no equal sign message JMP OUTSTR ;Let OUTSTR print and return TMNYOS: MOV #MNOMES,R0 ;Get too many output files message JMP OUTSTR ;Let OUTSTR print and return TMNYIS: MOV #MNIMES,R0 ;Get too many input files message JMP OUTSTR ;Let OUTSTR print and return NOWLDS: MOV #WLDMES,R0 ;Get no wild cards allowed message JMP OUTSTR ;Let OUTSTR print and return TFEWIS: MOV #FEWMES,R0 ;Get too few input files message JMP OUTSTR ;Let OUTSTR print and return .SBTTL OPENIO--Open all I/O OPENIO: OPEN$R #INFIL0,,,#FD.RWM,,,IN0OER ;Open input file zero FDBK$R #INFIL0,,#BLKSIZ,,#IN0EVF,#IN0STS ;Declare it block mode READ$ #INFIL0,#BUFRA0 ;Initiate a read CLR BFCNT0 ;Say there are zero words in the buffer CLR DATA0 ;Clear out old data incase of /BYte MOVB #FALSE,EOF0 ;We haven't seen an EOF yet MOV #RING00,NXTBF0 ;Declare where the next buffer will be OPEN$R #INFIL1,,,#FD.RWM,,,IN1OER ;Open input file one FDBK$R #INFIL1,,#BLKSIZ,,#IN1EVF,#IN1STS ;Declare it block morde READ$ #INFIL1,#BUFRA1 ;Initiate a read CLR BFCNT1 ;Say there are zero words in the buffer CLR DATA1 ;Clear out old data incase of /BYte MOVB #FALSE,EOF1 ;We haven't seen an EOF yet MOV #RING01,NXTBF1 ;Declare where the next buffer will be FDAT$R #OUTFIL,#R.VAR,#FD.CR ;Set up file attributes for output file OPEN$W #OUTFIL,,,,#OUTBUF,#OUTBFS,OUTERR ;Open output file MOV #OUTBUF,OUTPNT ;Initialize pointer to beginning of buffer BITB #FD.TTY,OUTFIL+F.RCTL ;Is this a terminal? BEQ OPENEX ;No DIR$ #ATTACH ;Yes, attach it to enable control-O's OPENEX: CLC ;Say all is ok RETURN IN0OER: MOV #INFIL0,R5 JMP OPENER IN1OER: CLOSE$ #INFIL0 ;Close the file already open MOV #INFIL1,R5 JMP OPENER OUTERR: CLOSE$ #INFIL0 CLOSE$ #INFIL1 MOV #OUTFIL,R5 OPENER: ADD #2,SP MOV #OPNERR,R0 CALL OUTSTR MOVB F.ERR(R5),R0 MUL #-2,R0 MOV IOERRS-2(R1),R0 CALL OUTSTR MOV #ONFILE,R0 CALL OUTSTR MOV R5,R0 CALL PNTFIL SEC RETURN .SBTTL COMPAR--routine to do actual compare of data COMPAR: TSTB EOF0 ;Is there data on file 0? BMI INPUT1 ;No CALL FETCH0 ;Yes, fetch a word/byte of data BCS ERROR0 ;Ooops...somethings wrong INPUT1: TSTB EOF1 ;Is there data on file 1? BMI COMP1 ;No, let's start our job CALL FETCH1 ;Yes, fetch a word/byte of data BCS ERROR1 ;Oooops...something's wrong COMP1: CMPB EOF0,EOF1 ;Let's see if either file has an EOF (both will not BNE LSTDIF ; be TRUE at this point) CMP DATA0,DATA1 ;Are the data the same? BEQ INCFPC ;Yes! LSTDIF: INC DIFCNT ;No--let's keep count of the number of differences CALL OUTPUT ;Print the difference BCS ERRDON ;Ooops...must have had an output error INCFPC: INC FPC ;Assume were in byte mode where PC is sequential TSTB BYTMOD ;But were we? BMI COMPAR ;Yes INC FPC ;No, add one again JMP COMPAR ;Go for another word/byte ERROR0: TSTB INFIL0+F.ERR+1 ;Was the error a directive error? BMI ERRDON ;Yes, just return (error message already printed) CMPB #IE.EOF,INFIL0+F.ERR ;The test--are we at the end of the file? BEQ CHKDON ;Yes--let's go check and see if EOF found on other file ERRDON: SEC ;Say we've seen an error RETURN CHKDON: MOVB #TRUE,EOF0 ;Declare an EOF TSTB EOF1 ;Was the other file done? BMI DONE ;Yes! JMP INPUT1 ;No--go for more data DONE: CLC ;Say all is ok RETURN ERROR1: TSTB INFIL1+F.ERR+1 ;Was it a directive error? BMI ERRDON ;Yes CMPB #IE.EOF,INFIL1+F.ERR ;Was it an end of file? BEQ CHKDN1 ;Yes--see if other input file done JMP ERRDON ;No--return with error CHKDN1: MOVB #TRUE,EOF1 ;Say we've seen an EOF on this file TSTB EOF0 ;Is the other file empty? BMI DONE ;Yes JMP COMP1 ;No--let's continue processing .SBTTL TELDIF--Tell the user how differences there were between the files TELDIF: TST DIFCNT ;Were there any differences? BNE DMPCNT ;Yes--tell the user MOV #NODIF,R0 ;No--make sure the user knows that too JMP OUTSTR ;[1][2]Print the note and let OUTSTR return for us DMPCNT: MOV #DIFMS1,R0 ;First part of CALL OUTSTR ; difference message MOV DIFCNT,R0 ;Get the number of differences CALL PNTDEC ;Print it MOV #DIFMS2,R0 ;And then finish off the message CMP #1,DIFCNT ;But wait--was there only one difference BNE MNYDIF ;Yes, original plural message ok MOV #DIFMS3,R0 ;No, get same message in singular MNYDIF: JMP OUTSTR ;[1][2]And print it and let OUTSTR return for us .SBTTL FINIO--Finish all FCS I/O FINIO: CLOSE$ #INFIL0 ;Close the CLOSE$ #INFIL1 ; input files BITB #FD.TTY,OUTFIL+F.RCTL ;Was the output device a terminal? BEQ CHKOUT ;No DIR$ #DETACH ;Yes, detach the terminal CHKOUT: TST DIFCNT ;Were there any differences? BNE CHKSPL ;Yes, go close the output file MOV #OUTFIL,R0 ;No, prepare to delete the output file JMP .DLFNB ; (as there is nothing in it); ; .DLFNB will return to the caller CHKSPL: TSTB SPOOL ;Should we spool the output file? BMI QUEUE ;Yes CLOSE$ #OUTFIL ;No, close it RETURN ;And return QUEUE: JMP QUEIT ;Call the spooling routine (QUEIT will return to the caller) .SBTTL OUTPUT--routine to format and print output OUTPUT: TST LINE BNE DMPLIN CALL WRTITL BCS PUTERR DMPLIN: MOV FPC,R0 CALL PUTOT6 MOV #SPACE6,R0 CALL PUTSTR TSTB BYTMOD BMI DMPBYT TSTB EOF0 BMI NODAT0 MOV DATA0,R0 CALL PUTOT6 JMP OUT1 NODAT0: MOV #SPACE6,R0 CALL PUTSTR OUT1: MOV #SPACE6,R0 CALL PUTSTR TSTB EOF1 BMI NODAT1 MOV DATA1,R0 CALL PUTOT6 JMP OUT2 NODAT1: MOV #SPACE6,R0 CALL PUTSTR OUT2: CMPB EOF0,EOF1 BNE DMPCR MOV #SPACE6,R0 CALL PUTSTR MOV DATA0,R0 MOV DATA1,R1 XOR R1,R0 CALL PUTOT6 JMP DMPCR DMPBYT: MOV #BLANK,R0 CALL PUTCHR TSTB EOF0 BMI NODAT2 MOV DATA0,R0 CALL PUTOT3 JMP OUT3 NODAT2: MOV #SPACE3,R0 CALL PUTSTR OUT3: MOV #SPACE9,R0 CALL PUTSTR TSTB EOF1 BMI NODAT3 MOV DATA1,R0 CALL PUTOT3 JMP OUT4 NODAT3: MOV #SPACE3,R0 CALL PUTSTR OUT4: CMPB EOF0,EOF1 BNE DMPCR MOV #SPACE9,R0 CALL PUTSTR MOV DATA0,R0 MOV DATA1,R1 XOR R1,R0 CALL PUTOT3 DMPCR: CALL FINREC BCS PUTERR INC LINE CMP #PAGLEN,LINE BNE EXIT CLR LINE EXIT: CLC RETURN PUTERR: SEC RETURN WRTITL: TST PAGE BEQ TITLE MOV #FF,R0 CALL PUTCHR CALL FINREC BCS TITERR TITLE: MOV #TITLE1,R0 CALL PUTSTR MOV #INFIL0,R0 CALL PUTFIL MOV #TITLE2,R0 CALL PUTSTR MOV #INFIL1,R0 CALL PUTFIL CALL WRTPAG CALL FINREC BCS TITERR MOV #TITLE3,R0 CALL PUTSTR MOV MONTH,R0 ADD R0,R0 MOV MONTAB-2(R0),R0 CALL PUTSTR MOV DAY,R0 CALL PUTDEC MOV #TITLE4,R0 CALL PUTSTR MOV YEAR,R0 ADD #1900.,R0 CALL PUTDEC MOV #TITLE5,R0 CALL PUTSTR MOV HOUR,R0 CALL PUTDC2 MOVB #COLON,R0 CALL PUTCHR MOV MINUTE,R0 CALL PUTDC2 CALL FINREC BCS TITERR CALL FINREC BCS TITERR MOV #TITLE7,R0 CALL PUTSTR CALL FINREC BCS TITERR MOV #TITLE8,R0 CALL PUTSTR CALL FINREC BCS TITERR CALL FINREC BCS TITERR MOV #8.,LINE CLC RETURN TITERR: SEC RETURN WRTPAG: INC PAGE CALL OUTCNT MOV R1,-(SP) MOV #74.,R1 SUB R0,R1 CMP #10.,PAGE BGT WRTSPC DEC R1 CMP #100.,PAGE BGT WRTSPC DEC R1 CMP #1000.,PAGE BGT WRTSPC DEC R1 WRTSPC: MOV #BLANK,R0 CALL PUTCHR SOB R1,WRTSPC MOV (SP)+,R1 MOV #TITLE6,R0 CALL PUTSTR MOV PAGE,R0 CALL PUTDEC RETURN .SBTTL QUEIT--routine to queue the output file QUEIT: PRINT$ #OUTFIL,QUERR RETURN QUERR: ADD #2,SP MOV #QUENSP,R0 CALL OUTSTR MOV #OUTFIL,R0 CALL PNTFIL MOV #OUTFIL,R0 TSTB F.ERR(R0) BMI FCSQER MOV #DSWQ,R0 CALL OUTSTR MOV $DSW,R0 MUL #-2,R0 MOV DSWERR-2(R1),R0 JMP OUTSTR FCSQER: MOV #FCSQ,R0 CALL OUTSTR MOVB OUTFIL+F.ERR,R0 MUL #-2,R0 MOV IOERRS-2(R1),R0 JMP OUTSTR .SBTTL I/O routines ; ; Routine to return byte/word of data in DATA0. R0 is destroyed; ; R1 - R5 are saved. ; FETCH0: DEC BFCNT0 ;Is there another word/byte to be had in this block? BMI NXTBK0 ;No TSTB BYTMOD ;Are we in byte mode? BEQ WRDMD0 ;No MOVB @BFPNT0,DATA0 ;Yes, get the byte INC BFPNT0 ;Set the pointer up for next run CLC ;Say all is well RETURN WRDMD0: MOV @BFPNT0,DATA0 ;Get the word of data ADD #2,BFPNT0 ;Set the pointer up for next run CLC ;Say all is well RETURN NXTBK0: TSTB INFIL0+F.ERR ;Have we received a read error getting the next block? BMI INERR0 ;Yes DIR$ #IN0WAT ;Let's wait for the next input block MOVB IN0STS,INFIL0+F.ERR ;And reset the file FDB in case of errors CLRB INFIL0+F.ERR+1 ;Say the code in there is not a DSW code TSTB INFIL0+F.ERR ;Was there an error reading this block? BMI INERR0 ;Yes MOV NXTBF0,R0 ;Get the address of the next ring buffer ADD #2,R0 ;Increment to the actual buffer MOV R0,BFPNT0 ;And store in the buffer pointer MOV @NXTBF0,NXTBF0 ;Increment to next ring MOV IN0STS+2,R0 ;Get the byte transfer count TSTB BYTMOD ;Are we in byte mode? BMI STCNT0 ;Yes--then transfer count is amount of data to look at ASR R0 ;No--divide by 2 to get number of words STCNT0: MOV R0,BFCNT0 ;Store it MOV R1,-(SP) ;Save R1 MOV NXTBF0,R1 ;Get the next buffer to fill ADD #2,R1 ;Increment to the actual buffer READ$ #INFIL0,R1 ;Begin read MOV (SP)+,R1 ;Restore R1 JMP FETCH0 ;And go for another piece of data INERR0: MOV #INFIL0,R0 ;Input failure...get FDB for processing ; error message INPERR: TSTB F.ERR+1(R0) ;See if this was a directive error BMI DSWPNT ;Yes CMPB #IE.EOF,F.ERR(R0) ;Was this an EOF? BEQ DONERR ;Yes MOV R1,-(SP) ;Save R1 MOV R0,R1 ;Save the FDB address MOV #READER,R0 ;Start telling user about his problem CALL OUTSTR MOVB F.ERR(R1),R0 ;Get the error number NEG R0 ;Convert to ADD R0,R0 ; table index MOV IOERRS-2(R0),R0 ;Get appropriate error message ERRPNT: CALL OUTSTR ;And print it MOV #ONFILE,R0 ;Continue error message CALL OUTSTR ; by printing MOV R1,R0 ; the name of CALL PNTFIL ; file in question MOV (SP)+,R1 ;Restore R1 DONERR: SEC ;Say all is not well RETURN DSWPNT: MOV R1,-(SP) ;Save R1 MOV R0,R1 ;Save the FDB address MOV #READRD,R0 ;Get DSW error message CALL OUTSTR ;Print it MOV $DSW,R0 ;Get the error number NEG R0 ;Convert to ADD R0,R0 ; table index MOV DSWERR-2(R0),R0 ;Get address of message JMP ERRPNT ;And go print rest of message ; ; Routine to return byte/word of data in DATA1. R0 is destroyed; ; R1 - R5 are saved. ; FETCH1: DEC BFCNT1 ;Is there another word/byte to be had in this block? BMI NXTBK1 ;No TSTB BYTMOD ;Are we in byte mode? BEQ WRDMD1 ;No MOVB @BFPNT1,DATA1 ;Yes, get the byte INC BFPNT1 ;Set the pointer up for next run CLC ;Say all is well RETURN WRDMD1: MOV @BFPNT1,DATA1 ;Get the word of data ADD #2,BFPNT1 ;Set the pointer up for next run CLC ;Say all is well RETURN NXTBK1: TSTB INFIL1+F.ERR ;Have we received a read error getting the next block? BMI INERR1 ;Yes DIR$ #IN1WAT ;Let's wait for the next input block MOVB IN1STS,INFIL1+F.ERR ;And reset the file FDB in case of errors CLRB INFIL1+F.ERR+1 ;Say the code in there is not a DSW code TSTB INFIL1+F.ERR ;Was there an error reading this block? BMI INERR1 ;Yes GOTBK1: MOV NXTBF1,R0 ;Get the address of the next ring buffer ADD #2,R0 ;Increment to the actual buffer MOV R0,BFPNT1 ;And store in the buffer pointer MOV @NXTBF1,NXTBF1 ;Increment to next ring MOV IN1STS+2,R0 ;Get the byte transfer count TSTB BYTMOD ;Are we in byte mode? BMI STCNT1 ;Yes--then transfer count is amount of data to look at ASR R0 ;No--divide by 2 to get number of words STCNT1: MOV R0,BFCNT1 ;Store it MOV R1,-(SP) ;Save R1 MOV NXTBF1,R1 ;Get the next buffer to fill ADD #2,R1 ;Increment to the actual buffer READ$ #INFIL1,R1 ;Begin read MOV (SP)+,R1 ;Restore R1 JMP FETCH1 ;And go for another piece of data INERR1: MOV #INFIL1,R0 ;Input failure...get FDB for processing JMP INPERR ; error message ; ; Routine to output one line of data to output file. R0 is destroyed; ; R1 - R5 are saved. ; FINREC: MOV R1,-(SP) ;Save R1 MOV OUTPNT,R1 ;Get the current fill location in output buffer SUB #OUTBUF,R1 ;Calculate number of characters in record PUT$ #OUTFIL,#OUTBUF,R1,RECERR ;Output the record MOV #OUTBUF,OUTPNT ;Reset line pointer to beginning of the buffer MOV (SP)+,R1 ;Restore R1 CLC ;Say all is well RETURN RECERR: ADD #2,SP ;Get rid of stack loc used to CALL here TSTB OUTFIL+F.ERR+1 ;See if this was a directive error BMI DSWER2 ;Yes MOV #WRITER,R0 ;Start telling user about his problem CALL OUTSTR MOVB OUTFIL+F.ERR,R0 ;Get the error number MUL #-2,R0 ;Convert to table index MOV IOERRS-2(R1),R0 ;Get appropriate error message ER2PNT: CALL OUTSTR ;And print it MOV #ONFILE,R0 ;Continue error message CALL OUTSTR ; by printing MOV #OUTFIL,R0 ; the name of CALL PNTFIL ; file in question MOV (SP)+,R1 ;Restore R1 SEC ;Say all is not well RETURN DSWER2: MOV #WRITED,R0 ;Get DSW error message CALL OUTSTR ;Print it MOV $DSW,R0 ;Get the error number MUL #-2,R0 ;Convert to table index MOV DSWERR-2(R1),R0 ;Get address of message JMP ER2PNT ;And go print rest of message .SBTTL WRTFIL--routines to output an FDB file name ; ; PUTFIL--routine to write an FDB file name out to OUTFIL ; ; Input: R0 contains address of FDB ; ; Registers R1 - R5 are saved ; PUTFIL: MOV R1,-(SP) MOV #PUTWRT,R1 PUTFL1: CALL WRTFIL MOV (SP)+,R1 RETURN ; ; PNTFIL--routine to write an FDB file name out to the terminal ; ; Input: R0 contains address of FDB ; ; Registers R1 - R5 are saved ; PNTFIL: MOV R1,-(SP) MOV #PNTWRT,R1 JMP PUTFL1 WRTFIL: MOV R2,-(SP) MOV R0,R2 MOVB F.FNB+N.DVNM(R2),R0 CALL @WRTCHR(R1) MOVB F.FNB+N.DVNM+1(R2),R0 CALL @WRTCHR(R1) MOV F.FNB+N.UNIT(R2),R0 CALL @WRTOCT(R1) MOVB #COLON,R0 CALL @WRTCHR(R1) CALL WRTUIC MOV F.FNB+N.FNAM(R2),R0 BEQ WRTDSP CALL @WRTR50(R1) MOV F.FNB+N.FNAM+2(R2),R0 CALL @WRTR50(R1) MOV F.FNB+N.FNAM+4(R2),R0 CALL @WRTR50(R1) TST F.FNB+N.FTYP(R2) BEQ NOEXT MOVB #'.,R0 CALL @WRTCHR(R1) MOV F.FNB+N.FTYP(R2),R0 CALL @WRTR50(R1) NOEXT: TST F.FNB+N.FVER(R2) BEQ WRTBYE MOVB #';,R0 CALL @WRTCHR(R1) MOV F.FNB+N.FVER(R2),R0 CALL @WRTOCT(R1) WRTBYE: MOV (SP)+,R2 RETURN WRTDSP: MOV F.DSPT(R2),R0 ADD #DSPTFN,R0 MOV (SP)+,R2 JMP @WRTSTN(R1) WRTUIC: MOV R3,-(SP) MOV R2,R0 CALL GETUIC BCC PNTUIC MOV R0,R3 MOV #'[,R0 CALL @WRTCHR(R1) MOV R3,R0 ASH #-8.,R0 BIC #177400,R0 CALL @WRTOCT(R1) MOVB #COMMA,R0 CALL @WRTCHR(R1) MOV R3,R0 BIC #177400,R0 CALL @WRTOCT(R1) MOVB #'],R0 CALL @WRTCHR(R1) MOV (SP)+,R3 RETURN PNTUIC: MOV (SP)+,R3 JMP @WRTSTN(R1) ; ; GETUIC--routine to get a file's UIC ; ; Input: R0 contains address of FDB ; ; Output: R0 contains UIC; carry bit is: ; ; 0 if UIC is in ASCII form (a la F.DSPT(FDB)). R0 contains address. ; ; 1 if UIC is in binary form in R0 ; ; ; This routine follows the path described in the documentation for .PARSE ; for returning the UIC of a file. Registers R1 - R5 are saved. ; GETUIC: MOV R1,-(SP) MOV R2,-(SP) MOV F.DSPT(R0),R1 TST DSPTUC(R1) BEQ CHKDEF MOV R1,R0 GOTUIC: ADD #DSPTUC,R0 RETUIC: MOV (SP)+,R2 MOV (SP)+,R1 CLC RETURN CHKDEF: MOV F.DFNB(R0),R0 TST DSPTUC(R0) BNE GOTUIC CHKFSR: CALL .RDFDR TST R2 BEQ NOUIC MOV R1,UICLEN MOV R2,FSRUIC MOV #UICLEN,R0 JMP RETUIC NOUIC: CALL .RDFUI MOV R1,R0 MOV (SP)+,R2 MOV (SP)+,R1 SEC RETURN JMP RETUIC .SBTTL PUTNUM--routines to numerically write R0 ; ; Routine to print R0 base 8 on the output file. Registers R1 - R5 are saved. ; PUTOCT: MOV R3,-(SP) CLR R3 PUTOTN: MOV R2,-(SP) MOV R1,-(SP) MOV #10,R2 CALL PUTNUM MOV (SP)+,R1 MOV (SP)+,R2 MOV (SP)+,R3 RETURN ; ; Routine to print R0 base 8 with leading zeros in an I3 format on the ; output file. Registers R1 - R5 are saved. ; PUTOT3: MOV R3,-(SP) MOV #3,R3 JMP PUTOTN ; ; Routine to print R0 base 8 with leading zeros in an I6 format on the ; output file. Registers R1 - R5 are saved. ; PUTOT6: MOV R3,-(SP) MOV #6,R3 JMP PUTOTN ; ; Routine to print R0 base 10 on the output file. Registers R1 - R5 are saved. ; PUTDEC: MOV R3,-(SP) CLR R3 PUTDCN: MOV R2,-(SP) MOV R1,-(SP) MOV #^D10,R2 CALL PUTNUM MOV (SP)+,R3 MOV (SP)+,R2 MOV (SP)+,R1 RETURN ; ; Routine to print R0 base 10 with leading zeros in I2 format on the output file. ; Registers R1 - R5 are saved. ; PUTDC2: MOV R3,-(SP) MOV #2,R3 JMP PUTDCN PUTNUM: MOV R0,R1 CLR R0 DIV R2,R0 MOV R1,-(SP) DEC R3 TST R0 BEQ LSTNUM CALL PUTNUM LSTNUM: DEC R3 BLT LSTNM2 MOVB #'0,R0 CALL PUTCHR JMP LSTNUM LSTNM2: MOV (SP)+,R0 ADD #60,R0 CALL PUTCHR RETURN .SBTTL PNTNUM--routines to numerically print R0 ; ; Routine to print R0 base 8 on the terminal. Registers R1 - R5 are saved. ; PNTOCT: MOV R1,-(SP) MOV R2,-(SP) MOV #10,R2 CALL PNTNUM MOV (SP)+,R2 MOV (SP)+,R1 RETURN ; ; Routine to print R0 base 10 on the terminal. Registers R1 - R5 are saved. ; PNTDEC: MOV R1,-(SP) MOV R2,-(SP) MOV #^D10,R2 CALL PNTNUM MOV (SP)+,R2 MOV (SP)+,R1 RETURN PNTNUM: MOV R0,R1 CLR R0 DIV R2,R0 MOV R1,-(SP) TST R0 BEQ TYPNUM CALL PNTNUM TYPNUM: MOV (SP)+,R0 ADD #60,R0 CALL OUTCHR RETURN .SBTTL PUTR50--routine to write RADIX-50 value in R0 ; ; Routine to print RADIX-50 value in R0 on the output file. R1 - R5 are saved. ; ; Method: ; ; R50(a,b,c) = (((a * 50) + b) * 50) + c ; ; a = R50 / (50 * 50) ; b = remainder(a) / 50 ; c = remainder(b) ; PUTR50: MOV R1,-(SP) MOV R0,R1 CLR R0 DIV #3100,R0 ; 3100 = 50 * 50 MOVB RADX50(R0),R0 CMP #BLANK,R0 BEQ NXTCH1 CALL PUTCHR NXTCH1: CLR R0 DIV #50,R0 MOVB RADX50(R0),R0 CMP #BLANK,R0 BEQ NXTCH2 CALL PUTCHR NXTCH2: MOVB RADX50(R1),R0 CMP #BLANK,R0 BEQ NXTCH3 CALL PUTCHR NXTCH3: MOV (SP)+,R1 RETURN .SBTTL PNTR50--routine to print RADIX-50 value in R0 ; ; Routine to print RADIX-50 value in R0 on terminal. R1 - R5 are saved ; ; Method: ; ; R50(a,b,c) = (((a * 50) + b) * 50) + c ; ; a = R50 / (50 * 50) ; b = remainder(a) / 50 ; c = remainder(b) ; PNTR50: MOV R1,-(SP) MOV R0,R1 CLR R0 DIV #3100,R0 ; 3100 = 50 * 50 MOVB RADX50(R0),R0 CMP #BLANK,R0 BEQ NXTCH4 CALL OUTCHR NXTCH4: CLR R0 DIV #50,R0 MOVB RADX50(R0),R0 CMP #BLANK,R0 BEQ NXTCH5 CALL OUTCHR NXTCH5: MOVB RADX50(R1),R0 CMP #BLANK,R0 BEQ NXTCH6 CALL OUTCHR NXTCH6: MOV (SP)+,R1 RETURN .SBTTL PUTIO--character output routines PUTSTR: MOV R1,-(SP) MOV OUTPNT,R1 PTSTR2: MOVB (R0)+,(R1)+ BNE PTSTR2 ;Did we load the end of message indicator? DEC R1 MOV R1,OUTPNT MOV (SP)+,R1 RETURN PUTCHR: MOVB R0,@OUTPNT INC OUTPNT RETURN PUTSTN: MOV R1,-(SP) MOV (R0),R1 MOV 2(R0),R0 NXTCHR: MOVB (R0)+,@OUTPNT INC OUTPNT SOB R1,NXTCHR MOV (SP)+,R1 RETURN OUTCNT: MOV OUTPNT,R0 SUB #OUTBUF,R0 RETURN .SBTTL TTYIO--routines to do TI: I/O OUTSTR: MOV R0,TIWQIO+14 ;Store address of character string for QIO CLR TIWQIO+16 ;[2] COUNT: TSTB (R0)+ BEQ PRINT INC TIWQIO+16 BR COUNT PRINT: DIR$ #TIWQIO RETURN OUTSTN: MOV (R0),TIWQIO+16 MOV 2(R0),TIWQIO+14 JMP PRINT OUTCHR: MOVB R0,BUFFER MOV #BUFFER,TIWQIO+14 MOV #1,TIWQIO+16 JMP PRINT .END START