summaryrefslogtreecommitdiff
path: root/apps/plugins/doom/r_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/doom/r_draw.c')
-rw-r--r--apps/plugins/doom/r_draw.c53
1 files changed, 43 insertions, 10 deletions
diff --git a/apps/plugins/doom/r_draw.c b/apps/plugins/doom/r_draw.c
index a6bc21e420..5f45323a36 100644
--- a/apps/plugins/doom/r_draw.c
+++ b/apps/plugins/doom/r_draw.c
@@ -526,16 +526,48 @@ byte *ds_source IBSS_ATTR;
526 526
527void R_DrawSpan (void) 527void R_DrawSpan (void)
528{ 528{
529 register unsigned count,xfrac = ds_xfrac,yfrac = ds_yfrac; 529#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
530 530 // only slightly faster
531 byte *source; 531 asm volatile (
532 byte *colormap; 532 "tst %[count] \n"
533 byte *dest; 533 "beq endspanloop \n"
534 534 "clr.l %%d4 \n"
535 source = ds_source; 535 "spanloop: \n"
536 colormap = ds_colormap; 536 "move.l %[xfrac], %%d1 \n"
537 dest = topleft + ds_y*SCREENWIDTH + ds_x1; 537 "move.l %[yfrac], %%d2 \n"
538 count = ds_x2 - ds_x1 + 1; 538 "lsr.l #8,%%d1 \n"
539 "lsr.l #8,%%d2 \n"
540 "lsr.l #8,%%d1 \n"
541 "lsr.l #2,%%d2 \n"
542 "and.l #63,%%d1 \n"
543 "and.l #4032,%%d2 \n"
544 "or.l %%d2, %%d1 \n"
545 "move.b (%[source], %%d1), %%d4 \n"
546 "add.l %[ds_xstep], %[xfrac] \n"
547 "add.l %[ds_ystep], %[yfrac] \n"
548 "move.b (%[colormap],%%d4.l), (%[dest])+ \n"
549 "subq.l #1, %[count] \n"
550 "bne spanloop \n"
551 "endspanloop: \n"
552 : /* outputs */
553 : /* inputs */
554 [count] "d" (ds_x2-ds_x1+1),
555 [xfrac] "d" (ds_xfrac),
556 [yfrac] "d" (ds_yfrac),
557 [source] "a" (ds_source),
558 [colormap] "a" (ds_colormap),
559 [dest] "a" (topleft+ds_y*SCREENWIDTH +ds_x1),
560 [ds_xstep] "d" (ds_xstep),
561 [ds_ystep] "d" (ds_ystep)
562 : /* clobbers */
563 "d1", "d2", "d4"
564 );
565#else
566 register unsigned count = ds_x2 - ds_x1 + 1,xfrac = ds_xfrac,yfrac = ds_yfrac;
567
568 register byte *source = ds_source;
569 register byte *colormap = ds_colormap;
570 register byte *dest = topleft + ds_y*SCREENWIDTH + ds_x1;
539 571
540 while (count) 572 while (count)
541 { 573 {
@@ -550,6 +582,7 @@ void R_DrawSpan (void)
550 *dest++ = colormap[source[spot]]; 582 *dest++ = colormap[source[spot]];
551 count--; 583 count--;
552 } 584 }
585#endif
553} 586}
554 587
555// 588//