;* Updated on 08-Nov-89 at 7:32 PM by Ami Bar-Yadin; edit time: 3:17:51 *;
; Wild Card TYPE, plus extras
; (c) 1986,1987,1988 By Ami Bar-Yadin AMUS ID: AMI/AM
;
; (** main type loop is at "*main type loop*" **)
VMAJOR=1
VMINOR=2
VEDIT=113.
;
;-All commercial rights reserved, etc.
;-No warranties and/or guarranties of any kind, etc.
;-Not responsible for damages resulting from the use of this program, etc.
;-My employer (United Fashions) has nothing to do with this program and
; should not be blamed for it.
;
; I can be reached at:
; United Fashions of Texas, Inc.
; 200 Ash Ave.
; McAllen, TX 78501
; (512) 631-2277/2276
; 8am-6pm
;
; Switches:
;(def) NOD-opr NODELETE, don't allow output file to be overwritten
; D-opr DELETE, allow file to be overwritten
; S-fil Include size of file (in blocks) in output
; L-fil Include 1st line of file (if sequential). Cancels /T and /X
; (Stop at 1st control character, other than TAB)
; L:n-fil Include 1st n lines of file
; (for file output, line max len=512, to prevent making full
; copies of binary files)
;(def) T-fil Type Entire file. Cancels /L and /X. Inoperative if output
; is going into a file.
; X-fil Look for XCALL names in .RUN files. Cancels /L and /T
; G-opr Count blocks and number of files. Cancels all other switches.
;
;.......
; Modifications history (in reverse order):
;
; [113] 08-Nov-89 Ami Bar-Yadin
; For AM65/62A compatibility output a space at the start of the
; top status line message
; Also use TCRT -1,128 instead of -1,63
; Attempt to be all for all:
; Output 80 spaces;TCRT -1,2;TCRT -1,9
;
; [112] 03-Nov-89 Ami Bar-Yadin
; Support for Am65:
; Use TRMCHR to get nubmer of lines on screen to support 42-lines mode
; Also accept DEL as a restart file key like backspace
;
; [111] 10-Sep-89 /ABY
; Changed SAVE/REST at ENTRY7 to all regs (A0-A6,D0-D78)
;
; [110] 13-May-89 /aby
; In LINE mode (/L)
; lines which start with "!*" or ";*" are skipped.
; It is assumed that they are d/VUE update entries.
; [109] 04-Apr-89 /aby
; In TYPE mode (/T)
; At end of file return to TYPE's main prompt
; (only leave file when user says so)
; During output ^D toggles output mode
; a) Default DUMP output, all chars are filtered
; b) alternate COPY output, chars are not filtered
; page pause can only count linefeeds
; however, will also pause before a ^L
;
; [106-108] Updates 3/21/89 aby
;
; o Will now read random files too.
; o Added :n option to /L. Display, or output, 1st n lines of file.
; o /T options added: L and H -- One-line page, and Half page
; H from the 1st /T prompt sets full page mode,
; and sets half a page for the first page.
; H while display is paused will set half-page mode
; L is like H but uses 1 one line pages (pause after each line)
; o added size of file in bytes to /T 1st (file name) prompt.
; o Added filtering to /L and /T (can list .LITs and task.LOGs safely!)
; if hi bit is on display in low intensity (high bit is cleared)
; control characters other than CR,LF,and TAB displayed as ^x
; tabs are expanded to spaces every 8 columns.
; o A line for /T or /L assumes the max width of the display terminal
; uses TRMCHR AMOS call to get width; updated EVERY page in paging mode;
; uses 510 if /L is outputing to a file to avoid problems with .LITs;
; assumes terminal auto-wraps by itself;
; know bug: extra cr if line is exactly width, i'll work on it Real Soon Now
;
SYM
SEARCH SYS
SEARCH SYSSYM
SEARCH TRM
RADIX 16.
DEFAULT VEDIT,1
DEFAULT $$MFLG,PV$RSM!PV$WSM
DEFAULT $$SFLG,PH$REE!PH$REU
DEFAULT $$SFLG,0
DEFAULT $$LFLG,-1
94$: POP ; get rid of return address
JMP 4$ ; exit
95$: POP
JMP 5$
GTRMCH:
SAVE A2
LEA A2,ASCBUF(A5)
TRMCHR @A2,0
MOVW TC.COL(A2),MAXCOL(A5) ; get number of columns
;[1 2] also get number of rows
CLR D6
MOVW TC.ROW(A2),D6
SUB #2.,D6 ; 1 line for pause, 1 for overlap
MOV D6,PGLNS(A5)
REST A2
RTN
DMPBYT:
ANDB #^H0FF,D1
TSTB D1
BEQ 20$ ; output "." for NULLS
BPL 3$
PUSHB D1
XTABF 11.
POPB D1
AND #^H07F,D1
BSET #15.,D1 ; set high word bit as flag
BR 4$
3$: CMPB D1,#CR
BEQ 5$ ; ignore CR
CMPB D1,#LF
BEQ 50$ ; output CR/LF
CMPB D1,#TAB
BEQ 30$ ; output spaces to next (8) tab
4$: CMPB D1,#SPACE
BLO 10$ ; output ^x
CMPB D1,#DEL
BHIS 20$ ; output "." for DEL and above
OUTCHR
INCW COLUMN(A5)
5$:
TSTW D1
BPL 6$
XTABF 12.
6$: RTN
10$: PUSH D1
OUTCHR #'^
INCW COLUMN(A5)
POP D1
ADDB #'@,D1
OUTCHR
INCW COLUMN(A5)
BR 5$
20$: OUTCHR #'.
INCW COLUMN(A5)
BR 5$
30$: OUTCHR #SPACE
INCW COLUMN(A5)
MOVW COLUMN(A5),D7
ANDW #7,D7
BNE 30$
BR 5$
50$: CRLF
MOVB #LF,D1
BR 5$
; If char in D1 is '0..'9
; set speed for non page mode;
; clear D1;
; clear page mode (D4)
; else do nothing
SETSPD:
AND #^H07F,D1
CMPB D1,#'0
BLO 1$
CMPB D1,#'9
BHI 1$
MOVB D1,SPDCHR(A5)
SUBB #'0,D1
MUL D1,#FACTOR
MOV D1,SPEED(A5)
CLR D1
CLR D4
1$: RTN
GTBYTE:
0$: TST D0 ; more chars in buffer?
BLE 10$ ; no
DEC D0
MOVB (A3)+,D1
AND #0FF,D1 ; the old sign extend eliminator
RTN
10$: TST FBLKS(A5) ; get next block (or first)
BEQ 30$ ; no more blocks. EOF.
DEC FBLKS(A5)
INPUT DDB1(A5)
CMPB D.OPN+DDB1(A5),#D$OPNR
BNE 20$ ; seq
INC D.REC+DDB1(A5) ; inc rec# for random
20$: MOV D.SIZ+DDB1(A5),D0
MOV D.BUF+DDB1(A5),A3 ; get buffer addres
MOV D.IDX+DDB1(A5),D6 ; adjust to skip seq link
ADD D6,A3
SUB D6,D0
BR 0$
30$: MOV #-1,D1
RTN
;=======
; Compute length, in bytes, of file in DDB1(A5) (after a LOOKUP)
; Returns file size in D6
;
; lifted out of AMOS/L 1.3D SYS:SIZE.LIT 452-067-631-543 1.0(100)
; hope you guys won't squeal
; modified to only scramble D6 and D7, and A0
; and changed the #514. to D.SIZ(A0) just before 40$
FILSIZ:
LEA A0,DDB1(A5)
CLR D6
MOV D.FSZ(A0),D7
DEC D7
BEQ 30$
10$: ADD D.SIZ(A0),D6 ; add a block (in bytes) to D6
TSTW D.LSZ+2(A0) ; if this is a seq
BMI 20$
SUB #2,D6 ; don't count the link word
20$: DEC D7 ; blocks go..
BNE 10$ ; ..another block
30$: TSTW D.LSZ+2(A0) ;
BPL 40$
ADD D.SIZ(A0),D6 ; last block is full
RTN ; hey! will this work? hmm?
40$: ADD D.LSZ(A0),D6 ; count bytes in last block
SUB #2,D6 ; don't count link word
RTN