From:	CSBVAX::MRGATE!@KL.SRI.Com,@wiscvm.wisc.edu,@YMIR.BITNET:PORTIA@ENGVAX.SCG.HAC.COM@SMTP 25-JUL-1987 14:21
To:	EVERHART
Subj:	virtual file editor (VFE) source (3 of 5) (43 blocks)

Received: from wiscvm.wisc.edu by KL.SRI.COM with TCP; Sat 25 Jul 87 10:41:43-PDT
Received: from YMIR.BITNET by wiscvm.wisc.edu ; Sat, 25 Jul 87 12:39:49 CDT
Received: from ENGVAX.SCG.HAC.COM by YMIR.BITNET; Sat, 25 Jul 87 10:32 PDT
Date: Sat, 25 Jul 87 10:15 PDT
From: Portia 616-2635 <@YMIR.BITNET:PORTIA@ENGVAX.SCG.HAC.COM>
Subject: virtual file editor (VFE) source (3 of 5) (43 blocks)
To: info-vax@sri-kl.ARPA
X-VMS-To: INFO-VAX-SUBMIT

$ show default
$ check_sum = 1030314170
$ write sys$output "Creating DISPLAY.MAR"
$ create DISPLAY.MAR
$ DECK/DOLLARS="$*$*EOD*$*$"
        .TITLE  DISPLAY VFE formatted-output routines

        .ENABLE SUPPRESSION

        .LIBRARY        'VFELIB'

        .PSECT  CODE,EXE,NOWRT
        .PAGE
        .SBTTL  ASCII - Display in ASCII format
ASCII::
        BSBW    SETUP
        BLBS    R0,100$
        BRW     900$
100$:
        MOVL    #8,R1
        BSBW    ALIGN
        MOVB    #^A/ /,R9
200$:
        MOVL    PARA2,R3
        BSBW    NUMOUT
        ADDL2   LC6496,PARA2
        MOVL    LC0812,R8
        MOVB    #^A/ /,(R6)+
        BRB     350$
300$:
        MOVB    #^A/|/,(R6)+
350$:
        MOVL    #8,R7
400$:
        SOBGEQ  R10,600$
        MOVB    (R4)+,R9
        CMPB    R9,#32
        BLSS    500$
        CMPB    R9,#127
        BNEQ    600$
500$:
        MOVB    #^A/./,R9
600$:
        MOVB    R9,(R6)+
        SOBGTR  R5,700$
        BRB     800$
700$:
        SOBGTR  R7,400$
        SOBGTR  R8,300$
800$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        CMPB    STOP,#0
        BNEQ    900$
        ADDL2   #1,R5
        SOBGTR  R5,870$
        BSBW    COMPNXT
        BLBC    R0,900$
870$:
        BRW     200$
900$:
        RSB
        .PAGE
        .SBTTL  EBCDIC - Display in EBCDIC format
EBCDIC::
        BSBW    SETUP
        BLBS    R0,100$
        BRW     900$
100$:
        MOVL    #8,R1
        BSBW    ALIGN
        MOVL    #^X40,R9
200$:
        MOVL    PARA2,R3
        BSBW    NUMOUT
        ADDL2   LC6496,PARA2
        MOVL    LC0812,R8
        MOVB    #^A/ /,(R6)+
        BRB     350$
300$:
        MOVB    #^A/|/,(R6)+
350$:
        MOVL    #8,R7
400$:
        SOBGEQ  R10,600$
        MOVZBL  (R4)+,R9
600$:
        MOVB    EBCTBL[R9],(R6)+
        SOBGTR  R5,700$
        BRB     800$
700$:
        SOBGTR  R7,400$
        SOBGTR  R8,300$
800$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        CMPB    STOP,#0
        BNEQ    900$
        ADDL2   #1,R5
        SOBGTR  R5,870$
        BSBW    COMPNXT
        BLBC    R0,900$
870$:
        BRW     200$
900$:
        RSB
        .PAGE
        .SBTTL  IBYTE - Display in integer byte format
IBYTE::
        BSBW    SETUP
        BLBS    R0,100$
        BRW     900$
100$:
        MOVL    PARA1,PARA2
200$:
        MOVL    PARA2,R3
        BSBW    NUMOUT
        ADDL2   LC1624,PARA2
        MOVL    LC1624,R7
        MOVB    #^A/ /,(R6)+
300$:
        CLRQ    R9
        MOVB    #^A/ /,R11
        CVTBL   (R4)+,R8
        BGEQ    400$
        TSTB    SGNFLG
        BNEQ    360$
        MOVZBL  R8,R8
        BRW     400$
360$:
        MOVB    #^A/-/,R11
        MNEGL   R8,R8
400$:
        INCL    R10
        EDIV    #10,R8,R8,-(SP)
        BNEQ    400$
        SUBL3   R10,#3,R9
        BLEQ    550$
500$:
        MOVB    #^A/ /,(R6)+
        SOBGTR  R9,500$
550$:
        MOVB    R11,(R6)+
600$:
        ADDL3   #^A/0/,(SP)+,R3
        MOVB    R3,(R6)+
        SOBGTR  R10,600$
        SOBGTR  R5,700$
        BRB     800$
700$:
        SOBGTR  R7,300$
800$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        CMPB    STOP,#0
        BNEQ    900$
        ADDL2   #1,R5
        SOBGTR  R5,870$
        BSBW    COMPNXT
        BLBC    R0,900$
870$:
        BRW     200$
900$:
        RSB
        .PAGE
        .SBTTL  IWLDSP - Display in int word/lword fmt
IWLDSP::
        BSBW    SETUP
        BLBS    R0,50$
        BRW     980$
50$:
        MOVL    #SS$_NORMAL,SVSTAT
100$:
        MOVL    PARA1,PARA2
        CLRL    R6
        EDIV    DSPCNT,R5,R5,R6
        MOVL    R6,OVERFL
        BEQL    120$
        INCL    R5
        SUBL3   R6,DSPCNT,OVERFL
120$:
        TSTL    REM
        BLEQ    200$
        CLRL    NXTBCT
        MOVL    SVSTAT,R0
        BLBC    R0,140$
        DIVL3   #512,CURBCT,R1
        ADDL2   CURBLK,R1
        MULL3   #512,BUFFCT,R2
        BSBW    READINT
        MOVL    R0,SVSTAT
        BLBS    R0,200$
140$:
        TSTL    OVERFL
        BLEQ    200$
        SOBGTR  R5,200$
        BRW     920$
200$:
        MOVL    PARA2,R3
        BSBW    NUMOUT
        ADDL2   WLINC,PARA2             ; 16 or 32 dep on width
        MOVL    WLCNT,R7                ; WLPARM*2 if wide display
300$:
        CLRQ    R9
        MOVB    #^A/ /,R11
        CMPL    WLPARM,#4
        BEQL    340$
        CVTWL   (R4)+,R8
        BGEQ    400$
        TSTB    SGNFLG
        BNEQ    360$
        MOVZWL  R8,R8
        BRB     400$
340$:
        MOVL    (R4)+,R8
        BGEQ    400$
        TSTB    SGNFLG
        BEQL    400$
360$:
        MOVB    #^A/-/,R11
        MNEGL   R8,R8
400$:
        INCL    R10
        EDIV    #10,R8,R8,-(SP)
        BNEQ    400$
        SUBL3   R10,WLPOSN,R9
500$:
        MOVB    #^A/ /,(R6)+
        SOBGTR  R9,500$
        MOVB    R11,(R6)+
600$:
        ADDL3   #^A/0/,(SP)+,R3
        MOVB    R3,(R6)+
        SOBGTR  R10,600$
        SOBGTR  R5,700$
        BRB     800$
700$:
        SOBGTR  R7,300$
800$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        TSTB    STOP
        BEQL    810$
        BRW     900$
810$:
        ADDL2   #1,R5
        SOBGTR  R5,820$
        BRB     830$
820$:
        BRW     200$
830$:
        MOVL    SVSTAT,R0
        BLBS    R0,840$
        TSTB    TAPFLG
        BNEQ    835$
        CMPL    NXTBCT,#512
        BGEQ    840$
835$:
        BRW     920$
840$:
        CMPL    REM,OVERFL
        BGTR    845$
        BRW     900$
845$:
        MOVL    CURBCT,R6
        MOVC3   NXTBCT,BUFF(R6),BUFF
        MOVL    NXTBCT,CURBCT
        MOVL    #1,R1
        TSTB    TAPFLG
        BNEQ    850$
        DIVL3   #512,R6,R1
850$:
        ADDL2   R1,CURBLK
        BSBW    BLOCK
        CLRL    LPTR
        MNEGL   #1,RECPTR
        MOVL    #1,R0
        MOVL    OVERFL,PARA1
        MOVAL   BUFF,R4
        ADDL2   PARA1,R4
        CMPL    REM,CURBCT
        BGTR    860$
        SUBL3   PARA1,REM,R5
        CLRL    REM
        BRB     880$
860$:
        SUBL2   CURBCT,REM
        SUBL3   PARA1,CURBCT,R5
880$:
        BRW     100$
900$:
        TSTL    REM
        BLEQ    980$
        BRB     950$
920$:
        TSTB    TAPFLG
        BEQL    930$
        CMPL    R0,#SS$_ENDOFFILE
        BEQL    940$
930$:
        BSBW    ERROUT
        BRB     950$
940$:
        OUTMSGC EOF
950$:
        BSBW    BACKSPACE
980$:
        RSB
        .PAGE
        .SBTTL  HEX - Display in hexadecimal format
HEX::
        BSBW    SETUP
        BLBS    R0,100$
        BRW     900$
100$:
        MOVL    #4,R1
        BSBW    ALIGN
200$:
        MOVL    PARA2,R3
        BSBW    NUMOUT
        ADDL2   LC3248,PARA2
        MOVL    LC0812,R8
300$:
        MOVL    #4,R7
        MOVB    #^A/ /,(R6)+
400$:
        SOBGEQ  R10,500$
        EXTZV   #4,#4,(R4),R9
        MOVB    HEXD[R9],(R6)+
        EXTZV   #0,#4,(R4)+,R9
        MOVB    HEXD[R9],(R6)+
        BRB     600$
500$:
        MOVW    #^A/  /,(R6)+
600$:
        SOBGTR  R5,700$
        BRB     800$
700$:
        SOBGTR  R7,400$
        SOBGTR  R8,300$
800$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        CMPB    STOP,#0
        BNEQ    900$
        ADDL2   #1,R5
        SOBGTR  R5,870$
        BSBW    COMPNXT
        BLBC    R0,900$
870$:
        BRW     200$
900$:
        RSB
        .PAGE
        .SBTTL  BINARY - Display in binary format
BINARY::
        BSBW    SETUP
        BLBS    R0,100$
        BRW     900$
100$:
        MOVL    PARA1,PARA2
200$:
        MOVL    PARA2,R3
        BSBW    NUMOUT
        ADDL2   LC0812,PARA2
        MOVL    LC0812,R8
300$:
        MOVL    #7,R7
        MOVB    (R4)+,R10
        MOVB    #^A/ /,(R6)+
400$:
        EXTZV   R7,#1,R10,R9
        ADDB3   #^A/0/,R9,(R6)+
        SOBGEQ  R7,400$
        SOBGTR  R5,700$
        BRB     800$
700$:
        SOBGTR  R8,300$
800$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        CMPB    STOP,#0
        BNEQ    900$
        ADDL2   #1,R5
        SOBGTR  R5,870$
        BSBW    COMPNXT
        BLBC    R0,900$
870$:
        BRW     200$
900$:
        RSB
        .PAGE
        .SBTTL  MULTI - Display combination alpha/hex
MULTI::
        BSBW    SETUP
        BLBS    R0,100$
        BRW     900$
100$:
        MOVL    #4,R1
        BSBW    ALIGN
200$:
        MOVL    PARA2,R3
        BSBW    NUMOUT
        ADDL2   LC3248,PARA2
        MOVQ    R4,R4R5S
        MOVL    R10,R9R10S
        MOVL    #1,R11
        BRB     280$
250$:
        MOVC3   #5,SP5,OUT_BUFF
        MOVAL   OUT_BUFF+5,R6
        MOVQ    R4R5S,R4
        MOVL    R9R10S,R10
280$:
        MOVL    LC0812,R8
300$:
        MOVL    #4,R7
        MOVB    #^A/ /,(R6)+
400$:
        SOBGEQ  R10,500$
        BLBC    R11,450$
        MOVB    #^A/ /,(R6)+
        MOVB    (R4)+,R9
        TSTB    EBCFLG
        BNEQ    440$
        CMPB    R9,#32
        BLSS    420$
        CMPB    R9,#127
        BNEQ    430$
420$:
        MOVB    #^A/./,R9
430$:
        MOVB    R9,(R6)+
        BRB     600$
440$:
        MOVB    EBCTBL[R9],(R6)+
        BRB     600$
450$:
        EXTZV   #4,#4,(R4),R9
        MOVB    HEXD[R9],(R6)+
        EXTZV   #0,#4,(R4)+,R9
        MOVB    HEXD[R9],(R6)+
        BRB     600$
500$:
        MOVW    #^A/  /,(R6)+
600$:
        SOBGTR  R5,700$
        BRB     800$
700$:
        SOBGTR  R7,400$
        SOBGTR  R8,300$
800$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        SOBGEQ  R11,830$
        BRB     850$
830$:
        BRW     250$
850$:
        TSTB    STOP
        BNEQ    900$
        INCL    R5
        SOBGTR  R5,870$
        BSBW    COMPNXT
        BLBC    R0,900$
870$:
        BRW     200$
900$:
        RSB
        .PAGE
        .SBTTL  DATE - Display in system date format
DATE::
        BSBW    SETUP
        BLBS    R0,100$
        BRW     900$
100$:
        TSTL    REM
        BLEQ    110$
        BSBW    INVPARA
        BRW     900$
110$:
        DIVL2   DSPCNT,R5
120$:
        MOVL    PARA1,R3
        BSBW    NUMOUT
        ADDL2   #8,PARA1
        MOVB    #^A/ /,(R6)+
        TSTL    4(R4)
        BGTR    200$
        BLSS    150$
        TSTL    (R4)
        BNEQ    200$
150$:
        PUSHR   #^M<R4,R5>
        MOVC3   #IVTL,IVT,(R6)
        POPR    #^M<R4,R5>
        ADDL2   #IVTL,R6
        BRB     300$
200$:
        MOVL    #30,OUTDSCV
        MOVL    R6,OUTDSCV+4
        $ASCTIM_S  TIMLEN=OUTDSCV,TIMBUF=OUTDSCV,TIMADR=(R4)
        BLBS    R0,250$
        BSBW    ERROUT
        BRW     900$
250$:
        CVTWL   OUTDSCV,R1
        ADDL2   R1,R6
300$:
        ADDL2   #8,R4
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        TSTB    STOP
        BNEQ    900$
        SOBGTR  R5,800$
        BRB     900$
800$:
        BRW     120$
900$:
        RSB
        .PAGE
        .SBTTL  RECORD - Display sequential records
RECORD::
        TSTB    SEQFLG
        BEQL    50$
        BSBW    ZEROBLK
        BLBS    R0,100$
50$:
        OUTMSG  #NSFL,NSF
        BRW     900$
100$:
        ADDL3   #1,CURBCT,EOFBYTE
        SUBL3   CURBLK,EFBLK,R1
        BLSS    110$
        MULL2   #512,R1
        CMPL    R1,CURBCT
        BGEQ    120$
        ADDL3   R1,FFBYTE,EOFBYTE
        BGTR    120$
110$:
        OUTMSGC EOF
        BRW     900$
120$:
        CMPL    PARA1,CURBCT
        BGEQ    122$
        CMPL    PARA2,#0
        BNEQ    124$
122$:
        BSBW    INVPARA
        MNEGL   #1,RECPTR
        BRW     900$
124$:
        ADDL3   RSIZE,VFCSIZE,MAXREC
        MOVL    #132,RECWID
        TSTW    TERMON
        BEQL    1245$
        MOVL    TERMWD,RECWID
1245$:
        TSTL    PARA1
        BLSS    1247$
        BRW     126$
1247$:
        TSTL    PARA2
        BGTR    125$
        MOVL    RECCNT,PARA2
125$:
        MOVL    RECPTR,PARA1
        BLSS    1252$
        CMPL    RECPTR,CURBCT
        BLEQ    126$
1252$:
        TSTB    VFLAG
        BNEQ    128$
        CLRL    PARA1
        TSTB    NOSPNFLG
        BNEQ    126$
        SUBL3   #1,CURBLK,R2
        MULL2   #512,R2
        CLRL    R3
        MOVL    MAXREC,R1
        BLBC    R1,1255$
        INCL    R1
1255$:
        EDIV    R1,R2,R0,R3
        TSTL    R3
        BEQL    126$
        SUBL3   R3,MAXREC,PARA1
        CMPL    PARA1,CURBCT
        BLSS    126$
        BRW     160$
126$:
        BRW     180$
128$:
        CLRL    R4
        CMPL    CURBLK,#1
        BGTR    129$
        BRW     175$
129$:
        SUBL3   #2,EOFBYTE,R2
        DIVL3   #2,EOFBYTE,R3
130$:
        MOVZWL  BUFF(R4),R7
        MOVL    R4,R8
140$:
        CMPL    R7,MAXREC
        BGTR    150$
        ADDL2   #2,R7
        BLBC    R7,145$
        INCL    R7
145$:
        ADDL2   R7,R8
        CMPL    R8,R2
        BGEQ    170$
        MOVZWL  BUFF(R8),R7
        CMPL    R7,#^XFFFF
        BNEQ    140$
        BRB     170$
150$:
        ADDL2   #2,R4
        SOBGTR  R3,130$
160$:
        OUTMSG  #CNDL,CNDRSM
        BRW     900$
170$:
        CMPL    MAXREC,#140
        BLEQ    175$
        OUTMSG  #LRLL,LRLMSG
175$:
        MOVL    R4,PARA1
180$:
        ADDL3   #BUFF,PARA1,R4
        SUBL3   PARA1,CURBCT,R5
        MOVL    PARA2,R8
        BGTR    185$
        MOVL    #1,R8
185$:
        MOVL    R8,RECCNT
        CLRL    HDRCNT
        CLRL    R2
        TSTB    HDRFLG
        BEQL    190$
        MOVL    VFCSIZE,R2
        CMPL    R2,#8
        BLEQ    190$
        MOVL    #8,R2
190$:
        MOVL    R2,VFCOUT
        SUBL3   #1,R2,VFCOUTM1
        SUBL3   R2,VFCSIZE,VFCSKIP
250$:
        BLBC    R4,280$
        INCL    R4
        DECL    R5
280$:
        TSTL    R5
        BGTR    300$
290$:
        BSBW    RECNXT
        BLBS    R0,300$
        BRW     900$
300$:
        SUBL3   #BUFF,R4,R3
        MOVL    R3,RECPTR
        CMPL    R3,EOFBYTE
        BLSS    310$
        OUTMSGC EOF
        BRW     900$
310$:
        MOVAL   OUT_BUFF,R6
        TSTB    HDRFLG
        BEQL    315$
        MOVL    #6,HDRCNT
        BSBW    NUMOUT
315$:
        MOVL    VFCOUT,R10
        TSTB    VFLAG
        BNEQ    320$
        MOVL    MAXREC,R7
        BRW     400$
320$:
        SUBL2   #2,R5
        CVTWL   (R4)+,R7
        BGEQ    350$
        TSTB    NOSPNFLG
        BEQL    340$
        CMPL    CURBLK,EFBLK
        BGEQ    340$
        CLRL    R5
        BRW     290$
340$:
        MOVC3   #7,EOF,(R6)
        ADDL2   #7,R6
        BRB     380$
350$:
        CMPL    R7,MAXREC
        BLEQ    400$
        MNEGL   #1,RECPTR
        MOVL    #80,OUTDSCV
        MOVL    R6,OUTDSCV+4
        $FAO_S  CTRSTR=MAXMSG,OUTLEN=OUTDSCV,OUTBUF=OUTDSCV,-
                P1=R7,P2=RSIZE
        CVTWL   OUTDSCV,R3
        ADDL2   R3,R6
380$:
        SUBL2   #OUT_BUFF,R6
        OUTMSG  R6,OUT_BUFF
        BRW     900$
400$:
        SUBL3   HDRCNT,RECWID,R9
        TSTB    HDRFLG
        BNEQ    410$
        ADDL2   VFCSIZE,R4
        SUBL2   VFCSIZE,R5
        SUBL2   VFCSIZE,R7
        BLEQ    420$
        TSTL    R5
        BGTR    420$
        BRW     610$
410$:
        MOVB    #^A/ /,(R6)+
420$:
        TSTB    STOP
        BEQL    450$
        BRW     900$
450$:
        TSTL    R7
        BLEQ    460$
        TSTL    R5
        BGTR    480$
        TSTB    HDRFLG
        BNEQ    460$
        BSBW    RECNXT
        BLBS    R0,480$
        BRW     900$
460$:
        BRW     600$
480$:
        DECL    R7
        DECL    R5
        SOBGEQ  R10,482$
        BRW     490$
482$:
        CMPL    R10,VFCOUTM1
        BLSS    485$
        DECL    R6
        MOVB    #^A/</,(R6)+
485$:
        EXTZV   #4,#4,(R4),R3
        MOVB    HEXD[R3],(R6)+
        DECL    R9
        EXTZV   #0,#4,(R4)+,R3
        MOVB    HEXD[R3],(R6)+
        TSTL    R10
        BGTR    488$
        MOVB    #^A/>/,(R6)+
        MOVB    #^A/ /,(R6)+
        SUBL3   #OUT_BUFF,R6,HDRCNT
        SUBL2   #2,R9
        ADDL2   VFCSKIP,R4
        SUBL2   VFCSKIP,R5
        SUBL2   VFCSKIP,R7
488$:
        BRB     580$
490$:
        MOVZBL  (R4)+,R3
        TSTB    EBCFLG
        BEQL    491$
        MOVB    EBCTBL[R3],(R6)+
        BRB     580$
491$:
        TSTB    HDRFLG
        BNEQ    495$
        CMPB    R3,#^X09
        BNEQ    495$
        SUBL3   #OUT_BUFF,R6,R2
        CLRL    R3
        EDIV    #8,R2,R0,R1
        SUBL3   R1,#8,R3
492$:
        MOVB    #^A/ /,(R6)+
        SOBGTR  R3,493$
        BRB     580$
493$:
        SOBGTR  R9,492$
        BRB     600$
495$:
        CMPB    R3,#32
        BLSS    500$
        CMPB    R3,#127
        BNEQ    550$
500$:
        MOVB    #^A/./,R3
550$:
        MOVB    R3,(R6)+
580$:
        SOBGTR  R9,590$
        BRB     600$
590$:
        BRW     450$
600$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        TSTL    R7
        BLEQ    750$
        TSTL    R5
        BGTR    700$
610$:
        BSBW    RECNXT
        BLBS    R0,700$
        BRB     900$
700$:
        TSTL    R9
        BGTR    720$
        SUBL3   HDRCNT,RECWID,R9
720$:
        SUBL3   R9,RECWID,R6
        BEQL    740$
        PUSHR   #^M<R4,R5>
        MOVC5   #0,OUT_BUFF,#^A/ /,R6,OUT_BUFF
        POPR    #^M<R4,R5>
740$:
        ADDL2   #OUT_BUFF,R6
        BRW     420$
750$:
        SOBGTR  R8,800$
        SUBL3   #BUFF,R4,RECPTR
        BRB     900$
800$:
        BRW     250$
900$:
        RSB

RECNXT:
        DIVL3   #512,CURBCT,R1
        ADDL2   CURBLK,R1
        CMPL    R1,EFBLK
        BGTR    100$
        BLSS    200$
        TSTL    FFBYTE
        BGTR    200$
100$:
        OUTMSGC EOF
        CLRL    R0
        BRB     900$
200$:
        MOVL    #1,PARA1
        BSBW    NEXT
        BLBC    R0,900$
        TSTB    HDRFLG
        BEQL    350$
        BSBW    BLOCK
350$:
        ADDL3   #1,CURBCT,EOFBYTE
        SUBL3   CURBLK,EFBLK,R1
        MULL2   #512,R1
        CMPL    R1,CURBCT
        BGEQ    400$
        ADDL3   R1,FFBYTE,EOFBYTE
400$:
        SUBL3   R5,#BUFF,R4
        ADDL2   CURBCT,R5
900$:
        RSB
        .PAGE
        .SBTTL  DIFF - Display differences with paste buffer
DIFF::
        TSTL    CURBCT
        BGTR    20$
        OUTMSGC CBEMPTY
        BRW     900$
20$:
        TSTL    PBBCT
        BGTR    30$
        OUTMSGC PBEMPTY
        BRW     900$
30$:
        BSBW    SETUP
        BLBS    R0,50$
        BRW     900$
50$:
        TSTL    REM
        BLEQ    100$
        BSBW    INVPARA
        BRW     900$
100$:
        MOVAL   PBUFF,R9
        CMPL    R5,PBBCT
        BLEQ    120$
        MOVL    #80,OUTDSC
        $FAO_S  CTRSTR=PBTRUNC,OUTLEN=OUTDSC,OUTBUF=OUTDSC,-
                P1=PBBCT
        OUTMSG  OUTDSC,OUT_BUFF
        MOVL    PBBCT,R5
120$:
        CMPC3   R5,(R4),(R9)
        CMPL    R0,#0
        BGTR    150$
        OUTMSG  #NDIFFL,NDIFF
        BRW     900$
150$:
        MOVL    #4,R1
        BSBW    ALIGN
200$:
        MOVB    #0,FLAG
        MOVL    PARA2,R3
        BSBW    NUMOUT
        ADDL2   LC3248,PARA2
        MOVQ    R4,R4R5S
        MOVQ    R9,R9R10S
        MOVL    #1,R11
        BRB     280$
250$:
        MOVC3   #5,PBOUT,OUT_BUFF
        MOVAL   OUT_BUFF+5,R6
        MOVQ    R4R5S,R4
        MOVQ    R9R10S,R9
280$:
        MOVL    LC0812,R8
300$:
        MOVL    #4,R7
        MOVB    #^A/ /,(R6)+
400$:
        SOBGEQ  R10,500$
        MOVL    R4,R3
        CMPB    (R4)+,(R9)+
        BNEQ    450$
        BLBS    R11,480$
        MOVW    #^A/../,(R6)+
        BRB     600$
450$:
        MOVB    #1,FLAG
        BLBS    R11,480$
        SUBL3   #1,R9,R3
480$:
        EXTZV   #4,#4,(R3),R1
        MOVB    HEXD[R1],(R6)+
        EXTZV   #0,#4,(R3),R1
        MOVB    HEXD[R1],(R6)+
        BRB     600$
500$:
        MOVW    #^A/  /,(R6)+
600$:
        SOBGTR  R5,700$
        BRB     800$
700$:
        SOBGTR  R7,400$
        SOBGTR  R8,300$
800$:
        CMPB    #0,FLAG
        BEQL    850$
        BLBS    R11,810$
        MOVB    #LF,(R6)+
810$:
        SUBL2   #OUT_BUFF,R6
        OUTPUT  R6,OUT_BUFF
        SOBGEQ  R11,830$
        BRB     850$
830$:
        BRW     250$
850$:
        CMPB    STOP,#0
        BNEQ    900$
        ADDL2   #1,R5
        SOBGTR  R5,870$
        BRB     900$
870$:
        BRW     200$
900$:
        RSB
        .PAGE
        .SBTTL  Miscellaneous utility routines

SETUP:
        TSTB    DPBFLG
        BNEQ    40$
        BSBW    ZEROBLK
        BLBS    R0,20$
        BRW     900$
20$:
        MOVL    CURBCT,DSPBCT
        ADDL3   #1,PARA2,R1
        BNEQ    50$
        DIVL3   DSPCNT,CURBCT,PARA2
        BRB     50$
40$:
        MOVL    PBBCT,DSPBCT
        BGTR    50$
        OUTMSGC PBEMPTY
        CLRL    R0
        BRW     900$
50$:
        CMPL    PARA1,DSPBCT
        BGEQU   100$
        CMPL    PARA2,#0
        BGTR    200$
100$:
        BSBW    INVPARA
        BRW     900$
200$:
        MOVAL   LC80,R4
        MOVL    #16,WLINC
        MOVL    WLPARM,WLCNT
        CMPL    TERMWD,#132
        BGEQ    250$
        TSTW    TERMON
        BNEQ    300$
250$:
        MULL2   #2,WLINC
        MULL2   #2,WLCNT
        MOVAL   LC132,R4
300$:
        MOVQ    (R4),LCBEGN
        MOVQ    8(R4),LCBEGN+8
        MULL2   DSPCNT,PARA2
        ADDL3   PARA1,PARA2,R3
        SUBL3   DSPBCT,R3,REM
        BLEQ    400$
        MOVL    DSPBCT,R3
400$:
        ADDL3   #BUFF,PARA1,R4
        TSTB    DPBFLG
        BEQL    500$
        TSTL    REM
        BLEQ    450$
        BSBW    INVPARA
        BRB     900$
450$:
        OUTPUT  #PBCL,PBCON
        ADDL3   #PBUFF,PARA1,R4
500$:
        SUBL3   PARA1,R3,R5
        MOVL    #1,R0
900$:
        RSB

ALIGN:
        DIVL3   R1,PARA1,R3
        MULL2   R1,R3
        MOVL    R3,PARA2
        SUBL3   R3,PARA1,R10
        ADDL2   R10,R5
        RSB

COMPNXT:
        CLRL    R0
        CMPL    REM,#0
        BLEQ    900$
        MOVL    #1,PARA1
        BSBW    NEXT
        BLBC    R0,900$
        BSBW    BLOCK
        MOVAL   BUFF,R4
        CLRL    PARA1
        CLRL    PARA2
        CLRL    R10
        CMPL    REM,CURBCT
        BGTR    200$
        MOVL    REM,R5
        CLRL    REM
        BRB     900$
200$:
        SUBL2   CURBCT,REM
        MOVL    CURBCT,R5
900$:
        RSB
        .PAGE
NUMOUT:
        PUSHR   #^M<R4,R5>
        CLRQ    R4
        MOVAL   OUT_BUFF,R6
        TSTB    TAPFLG
        BNEQ    100$
        TSTB    DPBFLG
        BNEQ    100$
        CMPL    BUFFCT,#1
        BEQL    120$
100$:
        INCL    R5
120$:
        TSTB    HEXFLG
        BNEQ    200$
        BLBC    R5,150$
        EDIV    #10000,R3,R2,R3
        EDIV    #1000,R3,R2,R3
        ADDB3   R2,#^A/0/,(R6)+
150$:
        EDIV    #100,R3,R2,R3
        ADDB3   R2,#^A/0/,(R6)+
        EDIV    #10,R3,R2,R3
        ADDB3   R2,#^A/0/,(R6)+
        ADDB3   R3,#^A/0/,(R6)+
        BRB     300$
200$:
        BLBC    R5,250$
        EXTZV   #12,#4,R3,R2
        MOVB    HEXD[R2],(R6)+
250$:
        EXTZV   #8,#4,R3,R2
        MOVB    HEXD[R2],(R6)+
        EXTZV   #4,#4,R3,R2
        MOVB    HEXD[R2],(R6)+
        EXTZV   #0,#4,R3,R2
        MOVB    HEXD[R2],(R6)+
300$:
        MOVB    #^A/:/,(R6)+
        BLBS    R5,320$
        MOVB    #^A/ /,(R6)+
320$:
        POPR    #^M<R4,R5>
        RSB
        .PAGE
        .SBTTL  Data definitions

        .PSECT  DATA,WRT,NOEXE

LF=^X0A

NDIFF:  .ASCII  /No differences./
NDIFFL=.-NDIFF

NSF:    .ASCII  /File must be SEQUENTIAL in order to use this command./
NSFL=.-NSF

CNDRSM: .ASCII  /Can not determine record start address in this block/
CNDL=.-CNDRSM

LRLMSG: .ASCII  /**Auto record locate is unpredictable with /
        .ASCII  /large V-length records**/
LRLL=.-LRLMSG

MAXMSG: .ASCID  /**Record size of !UL exceeds maximum allowed (!UL)**/

IVT:    .ASCII  /Invalid date-time format/
IVTL=.-IVT

PBCON:  .ASCII  /      Paste buffer contents:/
PBCL=.-PBCON

PBTRUNC: .ASCID /Comparison truncated to paste buffer length (!UL bytes)/

HEXD::  .ASCII  /0123456789ABCDEF/

SP5:    .ASCII  /     /
PBOUT:  .ASCII  /*PB* /
EOF:    .ASCIC  /**EOF**/

EBCTBL: .ASCII  /................/ ; HEX 00 - 0F
        .ASCII  /................/ ; HEX 10 - 1F
        .ASCII  /................/ ; HEX 20 - 2F
        .ASCII  /................/ ; HEX 30 - 3F
        .ASCII  / .........[.<(+!/ ; HEX 40 - 4F
        .ASCII  /&.........]$*);^/ ; HEX 50 - 5F
        .ASCII  \-/........|,%_>?\ ; HEX 60 - 6F
        .ASCII  /.........`:#@'="/ ; HEX 70 - 7F
        .ASCII  /.abcdefghi....../ ; HEX 80 - 8F
        .ASCII  /.jklmnopqr....../ ; HEX 90 - 9F
        .ASCII  /.~stuvwxyz....../ ; HEX A0 - AF
        .ASCII  /................/ ; HEX B0 - BF
        .ASCII  /{ABCDEFGHI....../ ; HEX C0 - CF
        .ASCII  /}JKLMNOPQR....../ ; HEX D0 - DF
        .ASCII  /\.STUVWXYZ....../ ; HEX E0 - EF
        .ASCII  /0123456789....../ ; HEX F0 - FF

LC80:   .LONG   64,32,16,8
LC132:  .LONG   96,48,24,12
LCBEGN:
LC6496: .LONG   0
LC3248: .LONG   0
LC1624: .LONG   0
LC0812: .LONG   0
OUTDSCV: .QUAD  0
DSPBCT: .LONG   0
REM:    .LONG   0
;
; Used by IWLDSP
;
OVERFL: .LONG   0
SVSTAT: .LONG   0
DSPCNT:: .LONG  0
WLINC:  .LONG   0
WLCNT:  .LONG   0
WLPARM:: .LONG  0
WLPOSN:: .LONG  0
;
; Used by DIFF and MULTI
;
R4R5S:  .QUAD   0
R9R10S: .QUAD   0
FLAG:   .BYTE   0
;
; Used by RECORD
;
RECPTR:: .LONG  -1
RECCNT: .LONG   1
HDRCNT: .LONG   0
RECWID: .LONG   0
VFCOUT: .LONG   0
VFCOUTM1: .LONG 0
VFCSKIP: .LONG  0
MAXREC: .LONG   0
EOFBYTE: .LONG  0

        .END
$*$*EOD*$*$
$ checksum DISPLAY.MAR
$ if checksum$checksum .ne. check_sum then -
$   write sys$output "Checksum failed, file probably corrupted"
$ check_sum = 645546437
$ write sys$output "Creating VFELIB.MAR"
$ create VFELIB.MAR
$ DECK/DOLLARS="$*$*EOD*$*$"
        .MACRO  INPUT   ARG1,ARG2,ARG3,ARG4
        CVTWL   ARG3,-(SP)
        PUSHAL  ARG4
        CVTWL   ARG1,-(SP)
        PUSHAL  ARG2
        CALLS   #4,TERMIO
        .ENDM

        .MACRO  OUTPUT  ARG1,ARG2
        CVTWL   ARG1,-(SP)
        PUSHAL  ARG2
        CALLS   #2,TERMIO
        .ENDM

        .MACRO  OUTMSG  ARG1,ARG2
        PUSHL   #1
        CVTWL   ARG1,-(SP)
        PUSHAL  ARG2
        CALLS   #3,TERMIO
        .ENDM

        .MACRO  OUTMSGC ARG1
        PUSHL   #1
        MOVZBL  ARG1,-(SP)
        PUSHAL  ARG1+1
        CALLS   #3,TERMIO
        .ENDM
$*$*EOD*$*$
$ checksum VFELIB.MAR
$ if checksum$checksum .ne. check_sum then -
$   write sys$output "Checksum failed, file probably corrupted"
$ exit
