1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
|
/* $XConsortium: fLineH.s,v 1.1 94/10/05 13:50:07 kaleb Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/vga256/enhanced/fLineH.s,v 3.2 1994/09/21 10:59:43 dawes Exp $ */
/* Copyright 1992 by James Tsillas, Arlignton, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation.
JAMES TSILLAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "assyntax.h"
#include "vgaAsm.h"
FILE("fLineH.s")
AS_BEGIN
#define rop REGOFF(8,EBP)
#define andv EBX
#define andvb BL
#define andvw BX
#define xorv EDX
#define xorvb DL
#define xorvw DX
#define addrl EDI
#define nlwidth REGOFF(24,EBP)
#define x1 REGOFF(28,EBP)
#define y1 REGOFF(32,EBP)
#define len ESI
#define count ECX
#define tmp EAX
#define GXcopy CONST(3)
#define GXxor CONST(6)
SEG_TEXT
ALIGNTEXT4
GLOBL GLNAME(fastvga256HorzS)
GLNAME(fastvga256HorzS):
PUSH_L (EBP)
MOV_L (ESP,EBP)
PUSH_L (ESI)
PUSH_L (EDI)
PUSH_L (EBX)
MOV_L (REGOFF(16,EBP),xorv)
MOV_L (REGOFF(20,EBP),addrl)
MOV_L (REGOFF(36,EBP),len)
CLD
MOV_L (nlwidth,tmp)
SHL_L (CONST(2),tmp)
IMUL_L (y1,tmp)
ADD_L (x1,tmp)
ADD_L (tmp,addrl)
CMP_L (VGABASE,addrl)
JB (.noClongL)
PUSH_L (addrl)
CALL (GLNAME(vgaSetReadWrite))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp)
SUB_L (addrl,tmp)
CMP_L (len,tmp)
JAE (.noClongL)
.ClongL:
CMP_L (GXcopy,rop)
JNE (.XlongL)
CMP_L (CONST(2),len)
JE (.L14)
JB (.L15)
.L13: TEST_L (CONST(3),addrl)
JZ (.L8)
MOV_B (xorvb,REGIND(addrl))
INC_L (addrl)
DEC_L (len)
.L14: TEST_L (CONST(3),addrl)
JZ (.L8A)
MOV_B (xorvb,REGIND(addrl))
INC_L (addrl)
DEC_L (len)
.L15: TEST_L (CONST(3),addrl)
JZ (.L8A)
MOV_B (xorvb,REGIND(addrl))
INC_L (addrl)
DEC_L (len)
.L8A: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl)
JB (.L8)
PUSH_L (addrl)
CALL (GLNAME(vgaWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
.L8: MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp)
SUB_L (addrl,tmp)
CMP_L (tmp,count)
JBE (.L16)
MOV_L (tmp,count)
.L16: SUB_L (count,len)
SHR_L (CONST(2),count)
JZ (.L10)
MOV_L (xorv,tmp)
REPZ
STOS_L
CMP_L (CONST(3),len)
JBE (.L17)
PUSH_L (addrl)
CALL (GLNAME(vgaWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
SUB_L (count,len)
SHR_L (CONST(2),count)
MOV_L (xorv,tmp)
REPZ
STOS_L
.L17: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl)
JB (.L10)
PUSH_L (addrl)
CALL (GLNAME(vgaWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
.L10: CMP_L (CONST(2),len)
JA (.L11)
JE (.L12)
CMP_L (CONST(0),len)
JE (.allfinish)
MOV_B (xorvb,REGIND(addrl))
JMP (.allfinish)
.L11: MOV_W (xorvw,REGIND(addrl))
MOV_B (xorvb,REGOFF(2,addrl)) /**/
JMP (.allfinish)
.L12: MOV_W (xorvw,REGIND(addrl)) /**/
.allfinish:
POP_L (EBX)
POP_L (EDI)
POP_L (ESI)
LEAVE
RET
.XlongL:
MOV_L (REGOFF(12,EBP),andv)
CMP_L (GXxor,rop)
JNE (.SlongL)
CMP_L (CONST(2),len)
JE (.LX14)
JB (.LX15)
.LX13: TEST_L (CONST(3),addrl)
JZ (.LX8)
XOR_B (xorvb,REGIND(addrl)) /**/
INC_L (addrl)
DEC_L (len)
.LX14: TEST_L (CONST(3),addrl)
JZ (.LX8A)
XOR_B (xorvb,REGIND(addrl)) /**/
INC_L (addrl)
DEC_L (len)
.LX15: TEST_L (CONST(3),addrl)
JZ (.LX8A)
XOR_B (xorvb,REGIND(addrl)) /**/
INC_L (addrl)
DEC_L (len)
.LX8A: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl)
JB (.LX8)
PUSH_L (addrl)
CALL (GLNAME(vgaReadWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
.LX8: MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp)
SUB_L (addrl,tmp)
CMP_L (tmp,count)
JBE (.LX16)
MOV_L (tmp,count)
.LX16: SUB_L (count,len)
SHR_L (CONST(2),count)
JZ (.LX10)
.LX9: XOR_L (xorv,REGIND(addrl)) /**/
ADD_L (CONST(4),addrl)
DEC_L (ECX)
JNZ (.LX9)
CMP_L (CONST(3),len)
JBE (.LX17)
PUSH_L (addrl)
CALL (GLNAME(vgaReadWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
SUB_L (count,len)
SHR_L (CONST(2),count)
.LX18: XOR_L (xorv,REGIND(addrl)) /**/
ADD_L (CONST(4),addrl)
DEC_L (ECX)
JNZ (.LX18)
.LX17: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl)
JB (.LX10)
PUSH_L (addrl)
CALL (GLNAME(vgaReadWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
.LX10: CMP_L (CONST(2),len)
JA (.LX11)
JE (.LX12)
CMP_L (CONST(0),len)
JE (.allfinish)
XOR_B (xorvb,REGIND(addrl)) /**/
JMP (.allfinish)
.LX11: XOR_W (xorvw,REGIND(addrl)) /**/
XOR_B (xorvb,REGOFF(2,addrl)) /**/
JMP (.allfinish)
.LX12: XOR_W (xorvw,REGIND(addrl)) /**/
JMP (.allfinish)
.SlongL:
CMP_L (CONST(2),len)
JE (.LS14)
JB (.LS15)
.LS13: TEST_L (CONST(3),addrl)
JZ (.LS8)
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
STOS_B
DEC_L (len)
.LS14: TEST_L (CONST(3),addrl)
JZ (.LS8A)
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
STOS_B
DEC_L (len)
.LS15: TEST_L (CONST(3),addrl)
JZ (.LS8A)
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
STOS_B
DEC_L (len)
.LS8A: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl)
JB (.LS8)
PUSH_L (addrl)
CALL (GLNAME(vgaReadWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
.LS8: MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
MOV_L (CONTENT(GLNAME(vgaWriteTop)),tmp)
SUB_L (addrl,tmp)
CMP_L (tmp,count)
JBE (.LS16)
MOV_L (tmp,count)
.LS16: SUB_L (count,len)
SHR_L (CONST(2),count)
JZ (.LS10)
.LS9: MOV_L (REGIND(addrl),tmp)
AND_L (andv,tmp)
XOR_L (xorv,tmp) /**/
STOS_L
DEC_L (ECX)
JNZ (.LS9)
CMP_L (CONST(3),len)
JBE (.LS17)
PUSH_L (addrl)
CALL (GLNAME(vgaReadWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
SUB_L (count,len)
SHR_L (CONST(2),count)
.LS18: MOV_L (REGIND(addrl),tmp)
AND_L (andv,tmp)
XOR_L (xorv,tmp) /**/
STOS_L
DEC_L (ECX)
JNZ (.LS18)
.LS17: CMP_L (CONTENT(GLNAME(vgaWriteTop)),addrl)
JB (.LS10)
PUSH_L (addrl)
CALL (GLNAME(vgaReadWriteNext))
MOV_L (tmp,addrl)
ADD_L (CONST(4),ESP)
.LS10: CMP_L (CONST(2),len)
JA (.LS11)
JE (.LS12)
CMP_L (CONST(0),len)
JE (.allfinish)
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
MOV_B (AL,REGIND(addrl))
JMP (.allfinish)
.LS11: MOV_W (REGIND(addrl),AX)
AND_W (andvw,AX)
XOR_W (xorvw,AX) /**/
STOS_W
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
MOV_B (AL,REGIND(addrl))
JMP (.allfinish)
.LS12: MOV_W (REGIND(addrl),AX)
AND_W (andvw,AX)
XOR_W (xorvw,AX) /**/
MOV_W (AX,REGIND(addrl))
JMP (.allfinish)
.noClongL:
CMP_L (GXcopy,rop)
JNE (.noXlongL)
CMP_L (CONST(2),len)
JE (.LC6)
JB (.LC7)
.LC5: TEST_L (CONST(3),addrl)
JZ (.LC0)
MOV_B (xorvb,REGIND(addrl))
INC_L (addrl)
DEC_L (len)
.LC6: TEST_L (CONST(3),addrl)
JZ (.LC0)
MOV_B (xorvb,REGIND(addrl))
INC_L (addrl)
DEC_L (len)
.LC7: TEST_L (CONST(3),addrl)
JZ (.LC0)
MOV_B (xorvb,REGIND(addrl))
INC_L (addrl)
DEC_L (len)
.LC0: MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
SUB_L (count,len)
SHR_L (CONST(2),count)
JZ (.LC2)
MOV_L (xorv,tmp)
CLD
REPZ
STOS_L
.LC2: CMP_L (CONST(2),len)
JA (.LC3)
JE (.LC4)
CMP_L (CONST(0),len)
JE (.allfinish)
MOV_B (xorvb,REGIND(addrl)) /**/
JMP (.allfinish)
.LC3: MOV_W (xorvw,REGIND(addrl)) /**/
MOV_B (xorvb,REGOFF(2,addrl)) /**/
JMP (.allfinish)
.LC4: MOV_W (xorvw,REGIND(addrl)) /**/
JMP (.allfinish)
.noXlongL:
MOV_L (REGOFF(12,EBP),andv)
CMP_L (GXxor,rop)
JNE (.noSlongL)
CMP_L (CONST(2),len)
JE (.LX6)
JB (.LX7)
.LX5: TEST_L (CONST(3),addrl)
JZ (.LX0)
XOR_B (xorvb,REGIND(addrl)) /**/
INC_L (addrl)
DEC_L (len)
.LX6: TEST_L (CONST(3),addrl)
JZ (.LX0)
XOR_B (xorvb,REGIND(addrl)) /**/
INC_L (addrl)
DEC_L (len)
.LX7: TEST_L (CONST(3),addrl)
JZ (.LX0)
XOR_B (xorvb,REGIND(addrl)) /**/
INC_L (addrl)
DEC_L (len)
.LX0: MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
SUB_L (count,len)
SHR_L (CONST(2),count)
JZ (.LX2)
.LX1: XOR_L (xorv,REGIND(addrl)) /**/
ADD_L (CONST(4),addrl)
DEC_L (ECX)
JNZ (.LX1)
.LX2: CMP_L (CONST(2),len)
JA (.LX3)
JE (.LX4)
CMP_L (CONST(0),len)
JE (.allfinish)
XOR_B (xorvb,REGIND(addrl)) /**/
JMP (.allfinish)
.LX3: XOR_W (xorvw,REGIND(addrl)) /**/
XOR_B (xorvb,REGOFF(2,addrl)) /**/
JMP (.allfinish)
.LX4: XOR_W (xorvw,REGIND(addrl)) /**/
JMP (.allfinish)
.noSlongL:
CMP_L (CONST(2),len)
JE (.LS6)
JB (.LS7)
.LS5: TEST_L (CONST(3),addrl)
JZ (.LS0)
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
STOS_B
DEC_L (len)
.LS6: TEST_L (CONST(3),addrl)
JZ (.LS0)
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
STOS_B
DEC_L (len)
.LS7: TEST_L (CONST(3),addrl)
JZ (.LS0)
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
STOS_B
DEC_L (len)
.LS0: MOV_L (len,count)
AND_L (CONST(0xfffffffc),count)
SUB_L (count,len)
SHR_L (CONST(2),count)
JZ (.LS2)
.LS1: MOV_L (REGIND(addrl),tmp)
AND_L (andv,tmp)
XOR_L (xorv,tmp) /**/
STOS_L
DEC_L (ECX)
JNZ (.LS1)
.LS2: CMP_L (CONST(2),len)
JA (.LS3)
JE (.LS4)
CMP_L (CONST(0),len)
JE (.allfinish)
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
MOV_B (AL,REGIND(addrl))
JMP (.allfinish)
.LS3: MOV_W (REGIND(addrl),AX)
AND_W (andvw,AX)
XOR_W (xorvw,AX) /**/
STOS_W
MOV_B (REGIND(addrl),AL)
AND_B (andvb,AL)
XOR_B (xorvb,AL) /**/
MOV_B (AL,REGIND(addrl))
JMP (.allfinish)
.LS4: MOV_W (REGIND(addrl),AX)
AND_W (andvw,AX)
XOR_W (xorvw,AX) /**/
MOV_W (AX,REGIND(addrl))
JMP (.allfinish)
|