]> 4ch.mooo.com Git - 16.git/blob - 16/xw__/mxln.asm
cleaned up the repo from debugging watcom2 ^^
[16.git] / 16 / xw__ / mxln.asm
1 .387
2                 PUBLIC  MXLINE
3                 EXTRN   MX_BYTESPERLINE:BYTE
4                 EXTRN   MX_VIDEOSEGMENT:BYTE
5                 EXTRN   MX_CLIPX1:BYTE
6                 EXTRN   MX_CLIPX2:BYTE
7                 EXTRN   MX_CLIPY1:BYTE
8                 EXTRN   MX_CLIPY2:BYTE
9 MX_TEXT         SEGMENT PARA PUBLIC USE16 'CODE'
10                 ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
11 L$1:
12     DW  offset L$29
13     DW  offset L$32
14     DW  offset L$35
15     DW  offset L$38
16 MXLINE:
17         push            bp
18         mov             bp,sp
19         sub             sp,12H
20         push            ds
21         push            si
22         push            di
23         mov             ax,word ptr 10H[bp]
24         mov             bx,word ptr 0eH[bp]
25         mov             cx,word ptr 0cH[bp]
26         mov             dx,word ptr 0aH[bp]
27         call            near ptr L$8
28         jae             L$2
29         jmp             near ptr L$7
30 L$2:
31         mov             si,cx
32         xchg            ax,si
33         sub             ax,si
34         jge             L$3
35         xchg            cx,si
36         xchg            dx,bx
37         neg             ax
38 L$3:
39         mov             word ptr -2[bp],ax
40         mov             cx,word ptr cs:MX_BYTESPERLINE
41         mov             ax,dx
42         sub             ax,bx
43         jge             L$4
44         neg             cx
45         neg             ax
46 L$4:
47         mov             word ptr -4[bp],ax
48         mov             word ptr -0cH[bp],cx
49         mov             ax,bx
50         mul             word ptr cs:MX_BYTESPERLINE
51         mov             cx,si
52         shr             si,1
53         shr             si,1
54         add             si,ax
55         and             cl,3
56         mov             ax,1102H
57         shl             ah,cl
58         mov             byte ptr -12H[bp],ah
59         mov             dx,3c4H
60         out             dx,ax
61         mov             ax,word ptr cs:MX_VIDEOSEGMENT
62         mov             ds,ax
63         xor             bx,bx
64         mov             al,byte ptr 6[bp]
65         cmp             al,0
66         je              L$5
67         and             al,3
68         shl             al,1
69         shl             al,1
70         shl             al,1
71         mov             ah,al
72         mov             al,3
73         mov             dx,3ceH
74         out             dx,ax
75         inc             bx
76         inc             bx
77 L$5:
78         mov             ax,word ptr -2[bp]
79         mov             cx,word ptr -4[bp]
80         cmp             ax,cx
81         jae             L$6
82         inc             bx
83 L$6:
84         shl             bx,1
85         call            word ptr cs:L$1[bx]
86         cmp             byte ptr 6[bp],0
87         je              L$7
88         mov             ax,3
89         mov             dx,3ceH
90         out             dx,ax
91 L$7:
92         xor             ax,ax
93         pop             di
94         pop             si
95         pop             ds
96         mov             sp,bp
97         pop             bp
98         retf            0cH
99 L$8:
100         mov             di,ax
101         mov             si,dx
102         xor             al,al
103         cmp             cx,word ptr cs:MX_CLIPX1
104         jge             L$9
105         or              al,1
106 L$9:
107         cmp             cx,word ptr cs:MX_CLIPX2
108         jle             L$10
109         or              al,2
110 L$10:
111         cmp             si,word ptr cs:MX_CLIPY1
112         jge             L$11
113         or              al,4
114 L$11:
115         cmp             si,word ptr cs:MX_CLIPY2
116         jle             L$12
117         or              al,8
118 L$12:
119         mov             byte ptr -10H[bp],al
120         xor             al,al
121         cmp             di,word ptr cs:MX_CLIPX1
122         jge             L$13
123         or              al,1
124 L$13:
125         cmp             di,word ptr cs:MX_CLIPX2
126         jle             L$14
127         or              al,2
128 L$14:
129         cmp             bx,word ptr cs:MX_CLIPY1
130         jge             L$15
131         or              al,4
132 L$15:
133         cmp             bx,word ptr cs:MX_CLIPY2
134         jle             L$16
135         or              al,8
136 L$16:
137         mov             byte ptr -0eH[bp],al
138         mov             ah,byte ptr -10H[bp]
139         test            ah,al
140         je              L$17
141         jmp             near ptr L$28
142 L$17:
143         or              ah,al
144         jne             L$18
145         jmp             near ptr L$27
146 L$18:
147         mov             ax,cx
148         sub             ax,di
149         mov             word ptr -0aH[bp],ax
150         mov             ax,si
151         sub             ax,bx
152         mov             word ptr -0cH[bp],ax
153         mov             al,byte ptr -0eH[bp]
154 L$19:
155         test            al,al
156         jne             L$20
157         xchg            di,cx
158         xchg            si,bx
159         xchg            byte ptr -10H[bp],al
160 L$20:
161         test            al,1
162         je              L$21
163         mov             ax,word ptr cs:MX_CLIPX1
164         sub             ax,di
165         mov             di,word ptr cs:MX_CLIPX1
166         jmp             L$22
167 L$21:
168         test            al,2
169         je              L$23
170         mov             ax,word ptr cs:MX_CLIPX2
171         sub             ax,di
172         mov             di,word ptr cs:MX_CLIPX2
173 L$22:
174         imul            word ptr -0cH[bp]
175         idiv            word ptr -0aH[bp]
176         add             bx,ax
177         mov             al,8
178         cmp             bx,word ptr cs:MX_CLIPY2
179         jg              L$26
180         mov             al,4
181         cmp             bx,word ptr cs:MX_CLIPY1
182         jl              L$26
183         xor             al,al
184         jmp             L$26
185 L$23:
186         test            al,4
187         je              L$24
188         mov             ax,word ptr cs:MX_CLIPY1
189         sub             ax,bx
190         mov             bx,word ptr cs:MX_CLIPY1
191         jmp             L$25
192 L$24:
193         mov             ax,word ptr cs:MX_CLIPY2
194         sub             ax,bx
195         mov             bx,word ptr cs:MX_CLIPY2
196 L$25:
197         imul            word ptr -0aH[bp]
198         idiv            word ptr -0cH[bp]
199         add             di,ax
200         mov             al,1
201         cmp             di,word ptr cs:MX_CLIPX1
202         jl              L$26
203         mov             al,2
204         cmp             di,word ptr cs:MX_CLIPX2
205         jg              L$26
206         xor             al,al
207 L$26:
208         mov             ah,byte ptr -10H[bp]
209         test            ah,al
210         jne             L$28
211         or              ah,al
212         je              L$27
213         jmp             near ptr L$19
214 L$27:
215         mov             ax,di
216         mov             dx,si
217         clc
218         ret
219 L$28:
220         stc
221         ret
222 L$29:
223         mov             di,ax
224         neg             di
225         shl             cx,1
226         mov             word ptr -6[bp],cx
227         mov             cx,ax
228         shl             ax,1
229         mov             word ptr -8[bp],ax
230         mov             al,2
231         mov             ah,byte ptr -12H[bp]
232         mov             bl,byte ptr 8[bp]
233         mov             dx,3c4H
234         inc             cx
235 L$30:
236         mov             byte ptr [si],bl
237         dec             cx
238         je              L$31
239         rol             ah,1
240         adc             si,0
241         out             dx,ax
242         add             di,word ptr -6[bp]
243         jl              L$30
244         add             si,word ptr -0cH[bp]
245         sub             di,word ptr -8[bp]
246         jmp             L$30
247 L$31:
248         ret
249 L$32:
250         mov             di,cx
251         neg             di
252         shl             ax,1
253         mov             word ptr -6[bp],ax
254         mov             ax,cx
255         shl             ax,1
256         mov             word ptr -8[bp],ax
257         mov             bl,byte ptr 8[bp]
258         mov             ah,byte ptr -12H[bp]
259         mov             al,2
260         mov             dx,3c4H
261         inc             cx
262 L$33:
263         mov             byte ptr [si],bl
264         dec             cx
265         je              L$34
266         add             si,word ptr -0cH[bp]
267         add             di,word ptr -6[bp]
268         jl              L$33
269         rol             ah,1
270         adc             si,0
271         out             dx,ax
272         sub             di,word ptr -8[bp]
273         jmp             L$33
274 L$34:
275         ret
276 L$35:
277         mov             di,ax
278         neg             di
279         shl             cx,1
280         mov             word ptr -6[bp],cx
281         mov             cx,ax
282         shl             ax,1
283         mov             word ptr -8[bp],ax
284         mov             al,2
285         mov             ah,byte ptr -12H[bp]
286         mov             bl,byte ptr 8[bp]
287         mov             dx,3c4H
288         inc             cx
289 L$36:
290         mov             bh,byte ptr [si]
291         mov             byte ptr [si],bl
292         dec             cx
293         je              L$37
294         rol             ah,1
295         adc             si,0
296         out             dx,ax
297         add             di,word ptr -6[bp]
298         jl              L$36
299         add             si,word ptr -0cH[bp]
300         sub             di,word ptr -8[bp]
301         jmp             L$36
302 L$37:
303         ret
304 L$38:
305         mov             di,cx
306         neg             di
307         shl             ax,1
308         mov             word ptr -6[bp],ax
309         mov             ax,cx
310         shl             ax,1
311         mov             word ptr -8[bp],ax
312         mov             bl,byte ptr 8[bp]
313         mov             ah,byte ptr -12H[bp]
314         mov             al,2
315         mov             dx,3c4H
316         inc             cx
317 L$39:
318         mov             bh,byte ptr [si]
319         mov             byte ptr [si],bl
320         dec             cx
321         je              L$40
322         add             si,word ptr -0cH[bp]
323         add             di,word ptr -6[bp]
324         jl              L$39
325         rol             ah,1
326         adc             si,0
327         out             dx,ax
328         sub             di,word ptr -8[bp]
329         jmp             L$39
330 L$40:
331         ret
332 MX_TEXT         ENDS
333                 END