remove the second -lssl in the generated Makefile so that it doesn't break the build.
[AROS-Contrib.git] / dopus / Program / assembly.asm
blob15a199e7cb76746722fa0267ed94a8d2385cae27
1 ; Directory Opus 4
2 ; Original GPL release version 4.12
3 ; Copyright 1993-2000 Jonathan Potter
4 ;
5 ; This program is free software; you can redistribute it and/or
6 ; modify it under the terms of the GNU General Public License
7 ; as published by the Free Software Foundation; either version 2
8 ; of the License, or (at your option) any later version.
9 ;
10 ; This program is distributed in the hope that it will be useful,
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; GNU General Public License for more details.
15 ; You should have received a copy of the GNU General Public License
16 ; along with this program; if not, write to the Free Software
17 ; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 ; All users of Directory Opus 4 (including versions distributed
20 ; under the GPL) are entitled to upgrade to the latest version of
21 ; Directory Opus version 5 at a reduced price. Please see
22 ; http://www.gpsoft.com.au for more information.
24 ; The release of Directory Opus 4 under the GPL in NO WAY affects
25 ; the existing commercial status of Directory Opus 5.
27 * include "exec/types.i"
28 include "devices/inputevent.i"
30 *STRUCTURE RLEinfo,0
31 * APTR rle_sourceptr
32 * APTR rle_destplanes
33 * WORD rle_imagebpr
34 * WORD rle_imageheight
35 * WORD rle_imagedepth
36 * WORD rle_destbpr
37 * WORD rle_destheight
38 * WORD rle_destdepth
39 * BYTE rle_masking
40 * BYTE rle_compression
41 * LONG rle_offset
42 * LABLE rle_SIZEOF
44 _LVORawDoFmt equ -$20a
46 VIEW_FILE_SIZE equ 0
47 VIEW_MAX_LINE_LENGTH equ 4
48 VIEW_TAB_SIZE equ 8
49 VIEW_TEXT_BUFFER equ 12
51 XREF _WorkbenchBase
52 XREF KPutChar
54 section code
56 XDEF _lsprintf
58 _lsprintf:
59 movem.l a2/a3/a6,-(sp)
60 move.l 4*4(sp),a3
61 move.l 5*4(sp),a0
62 lea.l 6*4(sp),a1
63 lea.l stuffChar(pc),a2
64 move.l 4,a6
65 jsr _LVORawDoFmt(a6)
66 movem.l (sp)+,a2/a3/a6
67 rts
69 stuffChar:
70 move.b d0,(a3)+
71 rts
73 XDEF _countlines
75 _countlines:
76 movem.l d2-d6/a2,-(sp) ; save registers
78 move.l VIEW_FILE_SIZE(a0),d1
79 move.l VIEW_MAX_LINE_LENGTH(a0),d2
80 move.l VIEW_TAB_SIZE(a0),d6
81 ; subq.l #1,d6
82 move.l VIEW_TEXT_BUFFER(a0),a0
84 * D1 = viewsize
85 * D2 = maximum line length
86 * D6 = tab size
87 * A0 = buffer
88 * ---
89 * D0 = number of lines
90 * D3 = number of characters counted
91 * D4 = tab skip
92 * D5 = earliest position to wordwrap from
93 * A1 = last white space character (for wordwrap)
95 moveq #0,d0
96 moveq #0,d3
97 move.l d2,d5
98 sub.l #10,d5
99 move.l #0,a1
100 loop:
101 addq #1,d3
102 cmp.l d2,d3
103 blt skip1 ;bne skip1
104 cmp.l #0,a1
105 beq nolastspace
106 move.l a0,a2
107 sub.l a1,a2
108 cmp.l d5,a2
109 bge nolastspace
110 add.l a2,d1
111 move.l a1,a0
112 nolastspace:
113 move.b #10,(a0)
114 addq.l #1,d0
115 moveq.l #0,d3
116 sub.l a1,a1
117 bra skip3
118 skip1:
119 cmpi.b #10,(a0)
120 bne skip2
121 sub.l a1,a1
122 addq.l #1,d0
123 moveq.l #0,d3
124 bra notspace ;bra skip3
125 skip2:
126 cmpi.b #9,(a0)
127 bne skip3
128 ; move.b #32,(a0)
129 ; subq #2,d3
130 move.l d3,d4
131 divu d6,d4 ; d4 = d3 % d6
132 clr.w d4
133 swap d4
135 ; move.l d0,-(sp) ;debug
136 ; move.b d4,d0
137 ; add.l #'0',d0
138 ; jsr KPutChar
139 ; move.l (sp)+,d0
141 ; subq.l #2,d4
142 neg.l d4 ; d4 = d6 - d4
143 add.l d6,d4 ;
144 add.l d4,d3
145 ; add.l d6,d3 ;added
146 move.l a0,a1 ;to implement
147 bra notspace ;TAB spacing
148 skip3:
149 cmpi.b #32,(a0)
150 bne notspace
151 move.l a0,a1
152 notspace:
153 subq.l #1,d1
154 cmpi.l #0,d1
155 beq endcountlines
156 addq.l #1,a0
157 bra loop
158 endcountlines:
159 cmpi.b #10,(a0)
160 beq lastlf
161 addq.l #1,d0
162 lastlf:
163 movem.l (sp)+,d2-d6/a2
166 XDEF _smartcountlines
168 _smartcountlines:
169 movem.l d2-d7/a2,-(sp)
171 move.l VIEW_FILE_SIZE(a0),d1
172 move.l d1,d7
173 move.l VIEW_MAX_LINE_LENGTH(a0),d2
174 move.l VIEW_TEXT_BUFFER(a0),a0
176 moveq #0,d0
177 moveq #0,d3
178 moveq #0,d4
179 move.l d2,d5
180 sub.l #10,d5
181 moveq #0,d6
182 move.l #0,a1
183 aloop:
184 addq #1,d3
185 cmp.l d2,d3
186 bne askip1
187 cmp.l #0,a1
188 beq nolastspace1
189 move.l a0,a2
190 sub.l a1,a2
191 cmp.l d5,a2
192 bge nolastspace1
193 add.l a2,d1
194 move.l a1,a0
195 nolastspace1:
196 move.b #10,(a0)
197 sub.l a1,a1
198 addq #1,d0
199 moveq #0,d3
200 bra askip2
201 askip1:
202 cmpi.b #-33,(a0)
203 blt aokay
204 cmpi.b #-1,(a0)
205 ble aishex
206 cmpi.b #9,(a0)
207 blt aishex
208 cmpi.b #14,(a0)
209 blt aokay
210 cmpi.b #32,(a0)
211 blt aishex
212 cmpi.b #128,(a0)
213 blt aokay
214 cmpi.b #160,(a0)
215 bge aokay
216 aishex:
217 cmpi.l #6,d7
218 blt nomorecheck
219 addq #1,d4
220 cmpi.l #6,d4
221 bge nomorecheck
222 cmpi.b #27,(a0)
223 bne aokay1
224 moveq #1,d6
225 bra aokay1
226 nomorecheck:
227 move.l #-1,d0
228 movem.l (sp)+,d2-d7/a2
230 aokay:
231 moveq #0,d4
232 cmpi.b #1,d6
233 bne aokay1
234 cmpi.b #'[',(a0)
235 beq isansi
236 moveq #0,d6
237 bra aokay1
238 isansi:
239 move.l #-2,d0
240 movem.l (sp)+,d2-d7/a2
242 aokay1:
243 cmpi.b #10,(a0)
244 bne askip2
245 sub.l a1,a1
246 addq #1,d0
247 moveq #0,d3
248 askip2:
249 cmpi.b #32,(a0)
250 bne notspace1
251 move.l a0,a1
252 notspace1:
253 subq.l #1,d1
254 cmpi.l #0,d1
255 beq endsmartcount
256 addq.l #1,a0
257 bra aloop
258 endsmartcount:
259 cmpi.b #10,(a0)
260 beq lastlf1
261 addq #1,d0
262 lastlf1:
263 movem.l (sp)+,d2-d7/a2
266 XDEF _ansicountlines
268 tabsize:
269 dc.l 0
271 _ansicountlines:
272 movem.l d2-d7/a2,-(sp)
274 move.l VIEW_TAB_SIZE(a0),d0
275 move.l d0,tabsize
276 move.l VIEW_FILE_SIZE(a0),d1
277 move.l VIEW_MAX_LINE_LENGTH(a0),d2
278 move.l VIEW_TEXT_BUFFER(a0),a0
280 moveq #0,d0
281 moveq #0,d3
282 move.l d2,d5
283 sub.l #10,d5
284 moveq #0,d6
285 move.l tabsize,d7
286 move.l #0,a1
288 nloop:
289 cmpi.b #32,(a0)
290 bge notillegal
291 cmpi.b #0,(a0)
292 blt notillegal
293 cmpi.b #9,(a0)
294 beq notillegal
295 cmpi.b #10,(a0)
296 beq notillegal
297 cmpi.b #27,(a0)
298 beq notillegal
300 move.b #' ',(a0)
301 bra nottab
303 notillegal:
304 cmpi.b #27,(a0)
305 bne notescape
306 moveq #1,d6
307 bra nnotspace
308 notescape:
309 cmpi.b #1,d6
310 bne notansi
311 cmpi.b #';',(a0)
312 beq nnotspace
313 cmpi.b #'[',(a0)
314 beq nnotspace
315 cmpi.b #'0',(a0)
316 blt endansi
317 cmpi.b #'9',(a0)
318 ble nnotspace
319 endansi:
320 moveq #0,d6
321 bra nnotspace
323 notansi:
324 cmpi.b #9,(a0)
325 bne nottab
326 add.l d7,d3
327 move.l tabsize,d7
328 bra notnexttab
329 nottab:
330 addq #1,d3
331 subq #1,d7
332 cmpi.b #0,d7
333 bgt notnexttab
334 move.l tabsize,d7
335 notnexttab:
336 cmp.l d2,d3
337 blt nskip1
338 cmp.l #0,a1
339 beq nnolastspace
340 move.l a0,a2
341 sub.l a1,a2
342 cmp.l d5,a2
343 bge nnolastspace
344 add.l a2,d1
345 move.l a1,a0
346 nnolastspace:
347 move.b #10,(a0)
348 addq #1,d0
349 moveq #0,d3
350 moveq #0,d6
351 move.l tabsize,d7
352 sub.l a1,a1
353 bra nskip2
354 nskip1:
355 cmpi.b #10,(a0)
356 bne nskip2
357 sub.l a1,a1
358 addq #1,d0
359 moveq #0,d3
360 moveq #0,d6
361 move.l tabsize,d7
362 nskip2:
363 cmpi.b #32,(a0)
364 beq isspace
365 cmpi.b #9,(a0)
366 bne nnotspace
367 isspace:
368 move.l a0,a1
369 nnotspace:
370 addq.l #1,a0
371 subq.l #1,d1
372 cmpi.l #0,d1
373 bgt nloop
374 movem.l (sp)+,d2-d7/a2
377 ; XDEF _removetabs
379 ;_removetabs:
380 ; move.l VIEW_FILE_SIZE(a0),d1
381 ; move.l VIEW_TEXT_BUFFER(a0),a0
383 ; moveq #0,d0
384 ;rloop:
385 ; cmpi.b #9,(a0)
386 ; bne rskip
387 ; move.b #' ',(a0)
388 ;rskip:
389 ; addq.l #1,a0
390 ; subq.l #1,d1
391 ; cmpi.l #0,d1
392 ; bgt rloop
393 ; rts
395 ; XDEF _filteroff
397 ;_filteroff:
398 ; btst.b #1,$bfe001
399 ; bne alreadyon
400 ; bset.b #1,$bfe001
401 ; moveq.l #1,d0
402 ; rts
403 ;alreadyon:
404 ; moveq.l #0,d0
405 ; rts
407 ; XDEF _filteron
409 ;_filteron:
410 ; bclr.b #1,$bfe001
411 ; rts