|
|
1.1 root 1: /* These are optimized x86 assembly versions of pfield_linetoscr.
2: * Feel free to send me Sparc/PPC/Alpha versions of this... :)
3: */
4:
5: #ifdef __DOS__
6: #define SYM(NAME) _##NAME
7: #define _color_regs _bpl_info
8: #else
9: #define SYM(NAME) NAME
10: #endif
11:
12: /* Urgl... */
13: #define color_regs bpl_info
14:
15: #ifndef __DOS__
16: .local lastcolor
17: .comm lastcolor,2
18: .align 16
19: #else
20: .comm lastcolor,2
21: .align 8
22: #endif
23:
24: .globl pfield_linetoscr_full8
25: pfield_linetoscr_full8:
26: pushl %ebp
27: pushl %edi
28: pushl %esi
29: pushl %ebx
30: movl 20(%esp),%esi
31: movl 24(%esp),%edi
32:
33: xorl %edx,%edx
34: movl SYM(diwfirstword),%eax
35: cmpl $4,%eax
36: jc .Loops1
37: movl %edx,SYM(pixdata)-4(%eax)
38: movl %edx,SYM(spixstate)-4(%eax)
39: .Loops1:
40: movl SYM(diwlastword),%eax
41: movl %edx,SYM(pixdata)(%eax)
42: movl %edx,SYM(spixstate)(%eax)
43:
44: movl SYM(acolors),%edx
45: movb %dl,%dh
46: movw %dx,%ax
47: bswapl %eax
48: movw %dx,%ax
49:
50: movl SYM(xlinebuffer),%ecx
51: leal 4(%esi),%edx
52: cmpl %edx,SYM(diwfirstword)
53: jle .La_start_ok
54: .La_start_line:
55: cmpl %edi,%esi
56: jge .La_start_ok
57: movl %eax,(%ecx)
58: addl $4,%ecx
59: movl %edx,%esi
60:
61: leal 4(%esi),%edx
62: cmpl %edx,SYM(diwfirstword)
63: jg .La_start_line
64: .La_start_ok:
65: movl %ecx,SYM(xlinebuffer)
66:
67: cmpl $0,SYM(bplham)
68: je .La_noham
69: cmpl $6,SYM(bplplanecnt)
70: jne .La_noham
71:
72: /* HAM 6 */
73: movl SYM(xlinebuffer),%ebp
74: xorl %edx,%edx
75: .La_hamloop:
76: cmpl %esi,SYM(diwlastword)
77: jle .La_hamend
78: cmpl %edi,%esi
79: jge .La_hamend
80:
81: movl SYM(ham_linebuf)+12(,%esi,4),%eax
82: movb SYM(xcolors)(,%eax,4),%bl
83: movl SYM(ham_linebuf)+8(,%esi,4),%eax
84: movb SYM(xcolors)(,%eax,4),%bh
85: bswapl %ebx
86: movl SYM(ham_linebuf)+4(,%esi,4),%eax
87: movb SYM(xcolors)(,%eax,4),%bh
88: movl SYM(ham_linebuf)(,%esi,4),%eax
89: movb SYM(xcolors)(,%eax,4),%bl
90: movl %ebx,(%ebp)
91: addl $4,%ebp
92: addl $4,%esi
93: jmp .La_hamloop
94:
95: .La_hamend:
96: movl %ebp,SYM(xlinebuffer)
97: jmp .La_finish_line
98:
99: .La_noham:
100: cmpl $0,SYM(bpldualpf)
101: je .La_normal
102:
103: /* Dual Playfield */
104:
105: xorl %edx,%edx
106:
107: movl $SYM(dblpf_ind1),%ebp
108: cmpl $0,SYM(bpldualpfpri)
109: je .La_dp_loop
110: movl $SYM(dblpf_ind2),%ebp
111: .La_dp_loop:
112: cmpl %esi,SYM(diwlastword)
113: jle .La_finish_line
114:
115: cmpl %edi,%esi
116: jge .La_finish_line
117:
118: xorl %edx,%edx
119: movl SYM(pixdata)(%esi),%eax
120: movl SYM(spixstate)(%esi),%ebx
121: testl %ebx,%ebx
122: jne .La_dp_sprites
123:
124: /* no sprites */
125:
126: movb %al,%dl
127: movb (%ebp,%edx,4),%dl
128: movb SYM(acolors)(,%edx,4),%cl
129: movb %ah,%dl
130: movb (%ebp,%edx,4),%dl
131: movb SYM(acolors)(,%edx,4),%ch
132: bswapl %eax
133: bswapl %ecx
134: movb %al,%dl
135: movb (%ebp,%edx,4),%dl
136: movb SYM(acolors)(,%edx,4),%cl
137: movb %ah,%dl
138: movb (%ebp,%edx,4),%dl
139: movb SYM(acolors)(,%edx,4),%ch
140: bswapl %ecx
141:
142: movl SYM(xlinebuffer),%eax
143: movl %ecx,(%eax)
144: addl $4,SYM(xlinebuffer)
145: addl $4,%esi
146: jmp .La_dp_loop
147:
148: .La_dp_sprites:
149:
150: /* dual playfield with sprites */
151:
152: movb %al,%dl
153: testb %bl,%bl
154: je .La3
155: movb SYM(acolors)(,%edx,4),%cl
156: jmp .La1
157: .La3:
158: movb (%ebp,%edx,4),%dl
159: movb SYM(acolors)(,%edx,4),%cl
160: .La1:
161:
162: movb %ah,%dl
163: testb %bh,%bh
164: je .La6
165: movb SYM(acolors)(,%edx,4),%ch
166: jmp .La4
167: .La6:
168: movb (%ebp,%edx,4),%dl
169: movb SYM(acolors)(,%edx,4),%ch
170: .La4:
171: bswapl %ecx
172: bswapl %eax
173: bswapl %ebx
174:
175: movb %al,%dl
176: testb %bl,%bl
177: je .La9
178: movb SYM(acolors)(,%edx,4),%cl
179: jmp .La7
180: .La9:
181: movb (%ebp,%edx,4),%dl
182: movb SYM(acolors)(,%edx,4),%cl
183: .La7:
184:
185: movb %ah,%dl
186: testb %bh,%bh
187: je .La12
188: movb SYM(acolors)(,%edx,4),%ch
189: jmp .La10
190: .La12:
191: movb (%ebp,%edx,4),%dl
192: movb SYM(acolors)(,%edx,4),%ch
193: .La10:
194: addl $4,%esi
195:
196: bswapl %ecx
197: movl SYM(xlinebuffer),%eax
198: movl %ecx,(%eax)
199: addl $4,SYM(xlinebuffer)
200:
201: jmp .La_dp_loop
202:
203: /* normal case */
204: .La_normal:
205: xorl %edx,%edx
206: movl SYM(xlinebuffer),%ebx
207: .La_normal_loop:
208: cmpl %esi,SYM(diwlastword)
209: jle .La_normal_end
210: cmpl %edi,%esi
211: jge .La_normal_end
212:
213: movl SYM(pixdata)(%esi),%eax
214:
215: movb %al,%dl
216: movb SYM(acolors)(,%edx,4),%cl
217: movb %ah,%dl
218: movb SYM(acolors)(,%edx,4),%ch
219: bswapl %eax
220: bswapl %ecx
221: movb %al,%dl
222: movb SYM(acolors)(,%edx,4),%cl
223: movb %ah,%dl
224: movb SYM(acolors)(,%edx,4),%ch
225: bswapl %ecx
226:
227: movl %ecx,(%ebx)
228: addl $4,%ebx
229: addl $4,%esi
230: jmp .La_normal_loop
231:
232: .La_normal_end:
233: movl %ebx,SYM(xlinebuffer)
234:
235: .La_finish_line:
236: /* Finish off the line */
237:
238: movl SYM(acolors),%edx
239: movb %dl,%dh
240: movw %dx,%ax
241: bswapl %eax
242: movw %dx,%ax
243:
244: movl SYM(xlinebuffer),%ecx
245: .La_fin_loop:
246: cmpl %edi,%esi
247: jge .La_fin_end
248:
249: movl %eax,(%ecx)
250: addl $4,%ecx
251: addl $4,%esi
252: jmp .La_fin_loop
253:
254: .La_fin_end:
255: movl %ecx,SYM(xlinebuffer)
256:
257: popl %ebx
258: popl %esi
259: popl %edi
260: popl %ebp
261: ret
262:
263: #ifndef __DOS__
264: .align 16
265: #else
266: .align 8
267: #endif
268: .globl pfield_linetoscr_full16
269: pfield_linetoscr_full16:
270: pushl %ebp
271: pushl %edi
272: pushl %esi
273: pushl %ebx
274:
275: movl 20(%esp),%esi
276: movl 24(%esp),%edi
277:
278: xorl %edx,%edx
279: movl SYM(diwfirstword),%eax
280: cmpl $4,%eax
281: jc .Lboops1
282: movl %edx,SYM(pixdata)-4(%eax)
283: movl %edx,SYM(spixstate)-4(%eax)
284: .Lboops1:
285: movl SYM(diwlastword),%eax
286: movl %edx,SYM(pixdata)(%eax)
287: movl %edx,SYM(spixstate)(%eax)
288:
289: movl SYM(acolors),%edx
290: movw %dx,%ax
291: sall $16,%eax
292: movw %dx,%ax
293:
294: movl SYM(xlinebuffer),%ecx
295: leal 4(%esi),%edx
296: cmpl %edx,SYM(diwfirstword)
297: jle .Lb_start_ok
298: .Lb_start_line:
299: cmpl %edi,%esi
300: jge .Lb_start_ok
301: movl %eax,(%ecx)
302: movl %eax,4(%ecx)
303: addl $8,%ecx
304: movl %edx,%esi
305:
306: leal 4(%esi),%edx
307: cmpl %edx,SYM(diwfirstword)
308: jg .Lb_start_line
309: .Lb_start_ok:
310: movl %ecx,SYM(xlinebuffer)
311:
312: cmpl $0,SYM(bplham)
313: je .Lb_noham
314: cmpl $6,SYM(bplplanecnt)
315: jne .Lb_noham
316:
317: /* HAM 6 */
318: movl SYM(xlinebuffer),%ebp
319: xorl %edx,%edx
320: .Lb_hamloop:
321: cmpl %esi,SYM(diwlastword)
322: jle .Lb_hamend
323: cmpl %edi,%esi
324: jge .Lb_hamend
325:
326: movl SYM(ham_linebuf)+4(,%esi,4),%eax
327: movw SYM(xcolors)(,%eax,4),%bx
328: sall $16,%ebx
329: movl SYM(ham_linebuf)(,%esi,4),%eax
330: movw SYM(xcolors)(,%eax,4),%bx
331: movl %ebx,(%ebp)
332:
333: movl SYM(ham_linebuf)+12(,%esi,4),%eax
334: movw SYM(xcolors)(,%eax,4),%bx
335: sall $16,%ebx
336: movl SYM(ham_linebuf)+8(,%esi,4),%eax
337: movw SYM(xcolors)(,%eax,4),%bx
338: movl %ebx,4(%ebp)
339: addl $8,%ebp
340: addl $4,%esi
341: jmp .Lb_hamloop
342:
343: .Lb_hamend:
344: movl %ebp,SYM(xlinebuffer)
345: jmp .Lb_finish_line
346:
347: .Lb_noham:
348: cmpl $0,SYM(bpldualpf)
349: je .Lb_normal
350:
351: /* Dual Playfield */
352:
353: xorl %edx,%edx
354: movl $SYM(dblpf_ind1),%ebp
355: cmpl $0,SYM(bpldualpfpri)
356: je .Lb_dp_loop
357: movl $SYM(dblpf_ind2),%ebp
358: .Lb_dp_loop:
359: cmpl %esi,SYM(diwlastword)
360: jle .Lb_finish_line
361:
362: cmpl %edi,%esi
363: jge .Lb_finish_line
364:
365: xorl %edx,%edx
366: movl SYM(pixdata)(%esi),%eax
367: movl SYM(spixstate)(%esi),%ebx
368: testl %ebx,%ebx
369: jne .Lb_dp_sprites
370:
371: /* no sprites */
372:
373: movl SYM(xlinebuffer),%ebx
374:
375: movb %ah,%dl
376: movb (%ebp,%edx,4),%dl
377: movw SYM(acolors)(,%edx,4),%cx
378: sall $16,%ecx
379: movb %al,%dl
380: movb (%ebp,%edx,4),%dl
381: movw SYM(acolors)(,%edx,4),%cx
382:
383: movl %ecx,(%ebx)
384:
385: bswapl %eax
386:
387: movb %al,%dl
388: movb (%ebp,%edx,4),%dl
389: movw SYM(acolors)(,%edx,4),%cx
390: sall $16,%ecx
391: movb %ah,%dl
392: movb (%ebp,%edx,4),%dl
393: movw SYM(acolors)(,%edx,4),%cx
394:
395: movl %ecx,4(%ebx)
396: addl $8,SYM(xlinebuffer)
397: addl $4,%esi
398: jmp .Lb_dp_loop
399:
400: .Lb_dp_sprites:
401:
402: /* dual playfield with sprites */
403:
404: movb %ah,%dl
405: testb %bh,%bh
406: je .Lb3
407: movw SYM(acolors)(,%edx,4),%cx
408: jmp .Lb1
409: .Lb3:
410: movb (%ebp,%edx,4),%dl
411: movw SYM(acolors)(,%edx,4),%cx
412: .Lb1:
413: sall $16,%ecx
414:
415: movb %al,%dl
416: testb %bl,%bl
417: je .Lb6
418: movw SYM(acolors)(,%edx,4),%cx
419: jmp .Lb4
420: .Lb6:
421: movb (%ebp,%edx,4),%dl
422: mov SYM(acolors)(,%edx,4),%cx
423: .Lb4:
424: movl SYM(xlinebuffer),%edx
425: movl %ecx,(%edx)
426: xorl %edx,%edx
427:
428: bswapl %eax
429: bswapl %ebx
430:
431: movb %al,%dl
432: testb %bl,%bl
433: je .Lb9
434: movw SYM(acolors)(,%edx,4),%cx
435: jmp .Lb7
436: .Lb9:
437: movb (%ebp,%edx,4),%dl
438: movw SYM(acolors)(,%edx,4),%cx
439: .Lb7:
440: sall $16,%ecx
441:
442: movb %ah,%dl
443: testb %bh,%bh
444: je .Lb12
445: movw SYM(acolors)(,%edx,4),%cx
446: jmp .Lb10
447: .Lb12:
448: movb (%ebp,%edx,4),%dl
449: movw SYM(acolors)(,%edx,4),%cx
450: .Lb10:
451: addl $4,%esi
452:
453: movl SYM(xlinebuffer),%eax
454: movl %ecx,4(%eax)
455: addl $8,SYM(xlinebuffer)
456:
457: jmp .Lb_dp_loop
458:
459: /* normal case */
460: .Lb_normal:
461: xorl %edx,%edx
462: movl SYM(xlinebuffer),%ebx
463: .Lb_normal_loop:
464: cmpl %esi,SYM(diwlastword)
465: jle .Lb_normal_end
466: cmpl %edi,%esi
467: jge .Lb_normal_end
468:
469: movl SYM(pixdata)(%esi),%eax
470:
471: movb %ah,%dl
472: movw SYM(acolors)(,%edx,4),%cx
473: sall $16,%ecx
474: movb %al,%dl
475: movw SYM(acolors)(,%edx,4),%cx
476: movl %ecx,(%ebx)
477: bswapl %eax
478: movb %al,%dl
479: movw SYM(acolors)(,%edx,4),%cx
480: sall $16,%ecx
481: movb %ah,%dl
482: movw SYM(acolors)(,%edx,4),%cx
483: movl %ecx,4(%ebx)
484:
485: addl $8,%ebx
486: addl $4,%esi
487: jmp .Lb_normal_loop
488:
489: .Lb_normal_end:
490: movl %ebx,SYM(xlinebuffer)
491:
492: .Lb_finish_line:
493: /* Finish off the line */
494:
495: movw SYM(acolors),%edx
496: movw %dx,%ax
497: sall $16,%eax
498: movw %dx,%ax
499:
500: movl SYM(xlinebuffer),%ecx
501: .Lb_fin_loop:
502: cmpl %edi,%esi
503: jge .Lb_fin_end
504:
505: movl %eax,(%ecx)
506: movl %eax,4(%ecx)
507: addl $8,%ecx
508: addl $4,%esi
509: jmp .Lb_fin_loop
510:
511: .Lb_fin_end:
512: movl %ecx,SYM(xlinebuffer)
513:
514: popl %ebx
515: popl %esi
516: popl %edi
517: popl %ebp
518: ret
519:
520: .ident "Crux CC 3.14.15"
521:
522: #ifndef __DOS__
523: .align 16
524: .globl DitherLine
525: .type DitherLine,@function
526: #else
527: .align 8
528: .globl DitherLine
529: #endif
530: DitherLine:
531: pushl %ebp
532: pushl %edi
533: pushl %esi
534: pushl %ebx
535: movl 20(%esp),%edi
536: xorl %ebx,%ebx
537: movw 36(%esp),%bx
538: movl 32(%esp),%edx
539: andl $3,%edx
540: sall $15,%edx
541: movl 28(%esp),%eax
542: andl $3,%eax
543: sall $12,%eax
544: leal SYM(cidx)(%edx,%eax),%ebp
545: xorb %dl,%dl
546: movl $8,%ecx
547: testl %ebx,%ebx
548: je .Li_end
549: cmpl $8,40(%esp)
550: je .Li_fast
551:
552: movl 24(%esp),%esi
553: .Li_loop:
554: movzwl (%esi),%eax
555: movzbl (%eax,%ebp),%eax
556: subl 40(%esp),%ecx
557: sall %cl,%eax
558: orb %al,%dl
559: testl %ecx,%ecx
560: jne .Li_1
561: movb %dl,(%edi)
562: incl %edi
563: movl $8,%ecx
564: xorb %dl,%dl
565: .Li_1:
566: movzwl 2(%esi),%eax
567: movzbl 4096(%ebp,%eax),%eax
568: subl 40(%esp),%ecx
569: sall %cl,%eax
570: orb %al,%dl
571: testl %ecx,%ecx
572: jne .Li_2
573: movb %dl,(%edi)
574: incl %edi
575: movl $8,%ecx
576: xorb %dl,%dl
577: .Li_2:
578: movzwl 4(%esi),%eax
579: movzbl 8192(%ebp,%eax),%eax
580: subl 40(%esp),%ecx
581: sall %cl,%eax
582: orb %al,%dl
583: testl %ecx,%ecx
584: jne .Li_3
585: movb %dl,(%edi)
586: incl %edi
587: movl $8,%ecx
588: xorb %dl,%dl
589: .Li_3:
590: movzwl 6(%esi),%eax
591: movzbl 12288(%ebp,%eax),%eax
592: addl $8,%esi
593: subl 40(%esp),%ecx
594: sall %cl,%eax
595: orb %al,%dl
596: testl %ecx,%ecx
597: jne .Li_4
598: movb %dl,(%edi)
599: incl %edi
600: movl $8,%ecx
601: xorb %dl,%dl
602: .Li_4:
603: subl $4,%ebx
604: jne .Li_loop
605: jmp .Li_end
606:
607: /* Fast 8-bit version */
608: .Li_fast:
609: movl 24(%esp),%esi
610: xorl %edx,%edx
611: .Li_fast_loop:
612: movl (%esi),%ecx
613: movw %cx,%dx
614: movb (%edx,%ebp),%al
615:
616: sarl $16,%ecx
617: movw %cx,%dx
618: movb 4096(%ebp,%edx),%ah
619: bswapl %eax
620:
621: movl 4(%esi),%ecx
622: movw %cx,%dx
623: movb 8192(%ebp,%edx),%ah
624:
625: sarl $16,%ecx
626: movw %cx,%dx
627: movb 12288(%ebp,%edx),%al
628:
629: bswapl %eax
630: movl %eax,(%edi)
631: addl $4,%edi
632: addl $8,%esi
633:
634: subl $4,%ebx
635: jne .Li_fast_loop
636:
637: .Li_end:
638: popl %ebx
639: popl %esi
640: popl %edi
641: popl %ebp
642: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.