annotate 3rdparty/utils/boisy/more.asm @ 1163:5cbcbfd738ae

Added
author boisy
date Thu, 08 May 2003 20:50:59 +0000
parents 6641a883d6b0
children bdd2f61d5dbc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * More - Prompts lists a file or files one screen at a time.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 * If no files are specified, STDIN is used.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 * At the --More-- prompt, press:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * <ENTER> to go advance one line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 * <BREAK> or 'Q' to quit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * <SPACE> or any other key to advance one screenful
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 * Usage: More [-l -w] [file] [...]
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11 * -l = show the name of the file before viewing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12 * (handy for multiple files)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 * -w = don't allow lines to wrap around. This option truncates
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14 * the line to a length of window's X size - 1.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 * If you are using a terminal other than the OS-9 Level II
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 * windowing system, you will need to change the reverse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 * on/off sequence as well as the clear line sequence
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 * NOTE: More works great with Shell+'s wildcards! It also works
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 * well with external terminals. Just change the Reverse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 * on/off and DelLine bytes to match your terminal's codes.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 * If you are running 'more' on a terminal, it assumes an 80x24
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 * terminal screen size.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26 * By: Boisy G. Pitre
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 * 1204 Love Street
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 * Brookhaven, MS 39601
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 * Internet: bgpitre@seabass.st.usm.edu
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33 use defsfile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 * Terminal specific equates:
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 XSIZE equ 80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 YSIZE equ 24
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39 DELNE equ $3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 REVON equ $1f20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 REVOFF equ $1f21
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 mod Size,Name,Prgrm+Objct,Reent+1,Start,Fin
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44 Name fcs /M/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45 Ed fcb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 Path rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 Response rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 XH rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 XL rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 YH rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 YL rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 Lflag rmb 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 FilePtr rmb 2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 Buffer rmb 250
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 FileBuf rmb 60
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 Stack rmb 200
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 * I make the Parms buffer large in case the wildcard expansion is long,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 * else the system crashes. You can alternately use the shell's memory
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 * modifier (i.e. #4k) to insure a big buffer.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 Parms rmb 4096
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64 Fin equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 Message fdb REVON Reverse Video on
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 fcc /--More--/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 fdb REVOFF Reverse Video off
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 MessLen equ *-Message
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 Header fdb $0a0d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 fcc /****** File: /
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 HeadLen equ *-Header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 DelLine fcb DELNE Delete line char
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 CR fcb $0d Carriage Return
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 ****** SUBROUTINES
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 PutHead pshs x Here, we actually print the header
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 leax Header,pcr for the file we are working on.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 ldy #HeadLen
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 lda #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 os9 I$Write
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 lbcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 puls x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 bsr SaveFile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 lda #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 leax FileBuf,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 ldy #60
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 os9 I$WritLn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 lbcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 SaveFile pshs x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 leay FileBuf,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 SaveF2 lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 cmpa #$20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 bne SaveF3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100 lda #$0d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 SaveF3 sta ,y+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 cmpa #$0d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 bne SaveF2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 puls x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107 GetSize pshs x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
108 lda #1 Using stdout...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 ldb #$26
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110 os9 I$GetStt Find the X and Y size of window
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 bcs ChekErr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112 stx XH Save the X value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 sty YH Save the Y value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 clr XH Clear high-order byte of X
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115 dec XL Decrement the X value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 dec YL Decrement the Y value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 dec YL and dec Y again
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 puls x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119 lda YL Do the initial load of the counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 sta YH
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123 ChekErr cmpb #E$UnkSvc If this is true, then we are probably
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124 bne Error dealing with a terminal, not a hardware
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 lda #XSIZE window. We'll assume 80x24 as the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 sta XL terminal size.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127 lda #YSIZE
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128 sta YL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 clr XH
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132 ********* PROGRAM ENTRY
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133 Start pshs x put away X temporarily,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134 leax IntSvc,pc point to the interrupt service routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 os9 F$Icpt and make the system aware of it
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 puls x then get X back for processing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 clr Path Clear the path (assume stdin)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 clr LFlag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 bsr GetSize
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 Parse lda ,x+ Parsing of the line is done here
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 cmpa #$20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 beq Parse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 cmpa #'-
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145 beq GetOpt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 cmpa #$0d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 bne TestFlag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 tst Path
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 beq Cycle
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 bra Done
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 GetOpt lda ,x+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153 cmpa #$20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154 beq Parse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 anda #$df
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 cmpa #'L
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 bne IsitW
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 com LFlag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 bra Parse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 IsItW cmpa #'W
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 bne Done
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 lda XL
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 deca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 sta XH
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 bra Parse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 TestFlag leax -1,x Here, we test to see if the -l
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 tst LFlag flag is set (to display the file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
169 bne TestF2 header) If so, we print it, else
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 bsr OpenFile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171 bra ReadLine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 TestF2 pshs x we continue with reading...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 lbsr PutHead
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 puls x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 bsr OpenFile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 dec YH Decrement counter twice to take into
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 dec YH account the header (two lines)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 lda YH See if the count is less than 1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 cmpa #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 blt ShowMess if so, time to show prompt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 bra ReadLine else read the line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 OpenFile lda #Read. Prepare for reading
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184 os9 I$Open Then open the file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
185 bcs Error Exit on error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 stx FilePtr Save X for later use
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 sta Path ...else save the path
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 Done clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191 Error os9 F$Exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 Cycle lda YL Get the low order byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 sta YH and use the high as a counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 bsr PutCR
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 ReadLine lda Path Get the path
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 ldy #250 max chars read = 250
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 leax Buffer,u point to the buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201 os9 I$ReadLn and read the line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 bcs EOF if error, check for EOF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 tst XH Is high order byte set?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 beq WriteOut Nope, continue as normal
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205 pshs x else loop until end of the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 ldb XH string and place a CR at the
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 Loop leax 1,x end.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 decb This is unnecessary if the line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209 bne Loop is less than XH, but doesn't slow
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210 lda #$0d down the processing considerably
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
211 sta ,x and would take longer if we actually
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212 puls x checked to see if a CR existed.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 WriteOut lda #1 Prepare to write to stdout
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 os9 I$WritLn Write!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 bcs Error if error, leave
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 dec YH else decrement the counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 bne ReadLine if not 0, more lines to show
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 ShowMess leax Message,pc Prepare to show message
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 ldy #MessLen
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 lda #2 to stderr...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 os9 I$Write write it!
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 bcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 lda #2 Now get response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 ldy #1 of one character
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 leax Response,u from stderr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 os9 I$Read
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229 bcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 bsr KillLine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 bra TestInp
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 PutCR leax CR,pc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 lda #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235 ldy #1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 os9 I$Write
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 bcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 KillLine lda #2 Here we send a delete line char
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 ldy #1 to clean the prompt.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242 leax DelLine,pc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243 os9 I$Write
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 bcs Error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247 EOF cmpb #E$EOF Check for end-of-file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 bne Error If not, exit w/ error
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 EOF2 lda Path else close the path
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250 os9 I$Close
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 tst Path If the path is stdin, we can quit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 lbeq Done
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253 ldx FilePtr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254 lbra Parse command line.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 TestInp lda Response Here we test the response at prompt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257 cmpa #$0d is it cr?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 beq OneLine yep, go up one line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 anda #$df else mask uppercase
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260 cmpa #'Q is it Q?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261 beq IntSvc Yep, kill prompt and exit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 cmpa #'N is it N?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 lbne Cycle nope, must be space or other char
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264 bsr KillLine else Kill the prompt
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 bra EOF2 and get next file
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 IntSvc bsr KillLine Interrupt service routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 lbra Done
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 OneLine lda #1 We go here if <ENTER> was pressed
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 sta YH,u to increment only one line
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272 lbra ReadLine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 Size equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 end