summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/doom/i_video.c204
1 files changed, 127 insertions, 77 deletions
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index fe2f91b699..16024d8aee 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -495,102 +495,152 @@ static void I_UploadNewPalette(int pal)
495 495
496void I_FinishUpdate (void) 496void I_FinishUpdate (void)
497{ 497{
498 int count;
499 byte *src = d_screens[0];
498#if (CONFIG_LCD == LCD_H300) && !defined(SIMULATOR) 500#if (CONFIG_LCD == LCD_H300) && !defined(SIMULATOR)
499 501 count = SCREENWIDTH*SCREENHEIGHT;
500#if 1 502
501 /* ASM screen update (drops 200 tics (100 asm)) */ 503 /* ASM screen update (drops ~300 tics) */
502 asm ( 504 asm volatile (
503 "move.w #33,(%[LCD]) \n" /* Setup the LCD controller */ 505 "move.w #33, (%[LCD]) \n" /* Setup the LCD controller */
504 "clr.w (%[LCD2]) \n" 506 "nop \n"
505 "move.w #34,(%[LCD]) \n" /* End LCD controller setup */ 507 "clr.w (%[LCD2]) \n"
506 "clr.l %%d1 \n" 508 "nop \n"
507 "clr.l %%d0 \n" 509 "move.w #34, (%[LCD]) \n" /* End LCD controller setup */
508 "widthloop: \n" 510 "clr.l %%d1 \n"
509 "move.l (%[screenptr])+, %%d0 \n" 511 ".loop: \n"
510 "swap.w %%d0 \n" 512 "move.l (%[scrp])+, %%d0 \n"
511 "move.w %%d0, %%d1 \n" 513 "swap.w %%d0 \n"
512 "lsr.l #8,%%d1 \n" 514 "move.w %%d0, %%d1 \n"
513 "move.w (%[palette], %%d1.l:2), (%[LCD2]) \n" 515 "lsr.l #8,%%d1 \n"
514 "move.b %%d0,%%d1 \n" 516 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n"
515 "move.w (%[palette], %%d1.l:2), (%[LCD2]) \n" 517 "move.b %%d0,%%d1 \n"
516 "swap.w %%d0 \n" 518 "swap.w %%d0 \n"
517 "move.w %%d0, %%d1 \n" 519 "nop \n"
518 "lsr.l #8,%%d1 \n" 520 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n"
519 "move.w (%[palette], %%d1.l:2), (%[LCD2]) \n" 521 "move.w %%d0, %%d1 \n"
520 "move.b %%d0,%%d1 \n" 522 "lsr.l #8,%%d1 \n"
521 "move.w (%[palette], %%d1.l:2), (%[LCD2]) \n" 523 "nop \n"
522 "subq.l #4,%[WIDTH] \n" 524 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n"
523 "bne widthloop \n" 525 "move.b %%d0,%%d1 \n"
524 "move.w #220,%[WIDTH] \n" 526 "nop \n"
525 "subq.l #1,%[HEIGHT] \n" 527 "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n"
526 "bne widthloop \n" 528 "subq.l #4,%[cnt] \n"
527 : /* outputs */ 529 "bne.b .loop \n"
528 : /* inputs */ 530 : /* outputs */
529 [screenptr] "a" (d_screens[0]), 531 [scrp]"+a"(src),
530 [palette] "a" (palette), 532 [cnt] "+d"(count)
531 [LCD] "a" (0xf0000000), 533 : /* inputs */
532 [LCD2] "a" (0xf0000002), 534 [pal] "a" (palette),
533 [WIDTH] "d" (220), 535 [LCD] "a" (0xf0000000),
534 [HEIGHT] "d" (176) 536 [LCD2]"a" (0xf0000002)
535 : /* clobbers */ 537 : /* clobbers */
536 "d0", "d1" 538 "d0", "d1"
539 );
540#elif (CONFIG_LCD == LCD_X5) && !defined(SIMULATOR)
541 count = SCREENWIDTH*SCREENHEIGHT;
542
543 /* ASM screen update (drops ~230 tics) */
544 asm volatile (
545 "clr.w (%[LCD]) \n" /* Setup the LCD controller */
546 "move.w #(33<<1), (%[LCD]) \n"
547 "clr.w (%[LCD2]) \n"
548 "clr.w (%[LCD2]) \n"
549 "clr.w (%[LCD]) \n" /* End LCD controller setup */
550 "move.w #(34<<1), (%[LCD]) \n"
551 "clr.l %%d1 \n"
552 ".loop: \n"
553 "move.l (%[scrp])+, %%d0 \n"
554 "swap.w %%d0 \n"
555 "move.w %%d0, %%d1 \n"
556 "lsr.l #8,%%d1 \n"
557 "move.w (%[pal], %%d1.l:2), %%d2 \n"
558 "move.l %%d2, %%d3 \n"
559 "lsr.l #7, %%d3 \n"
560 "move.w %%d3, (%[LCD2]) \n"
561 "lsl.l #1, %%d2 \n"
562 "move.w %%d2, (%[LCD2]) \n"
563 "move.b %%d0,%%d1 \n"
564 "move.w (%[pal], %%d1.l:2), %%d2 \n"
565 "move.l %%d2, %%d3 \n"
566 "lsr.l #7, %%d3 \n"
567 "move.w %%d3, (%[LCD2]) \n"
568 "lsl.l #1, %%d2 \n"
569 "move.w %%d2, (%[LCD2]) \n"
570 "swap.w %%d0 \n"
571 "move.w %%d0, %%d1 \n"
572 "lsr.l #8,%%d1 \n"
573 "move.w (%[pal], %%d1.l:2), %%d2 \n"
574 "move.l %%d2, %%d3 \n"
575 "lsr.l #7, %%d3 \n"
576 "move.w %%d3, (%[LCD2]) \n"
577 "lsl.l #1, %%d2 \n"
578 "move.w %%d2, (%[LCD2]) \n"
579 "move.b %%d0,%%d1 \n"
580 "move.w (%[pal], %%d1.l:2), %%d2 \n"
581 "move.l %%d2, %%d3 \n"
582 "lsr.l #7, %%d3 \n"
583 "move.w %%d3, (%[LCD2]) \n"
584 "lsl.l #1, %%d2 \n"
585 "move.w %%d2, (%[LCD2]) \n"
586 "subq.l #4,%[cnt] \n"
587 "bne.b .loop \n"
588 : /* outputs */
589 [scrp]"+a"(src),
590 [cnt] "+d"(count)
591 : /* inputs */
592 [pal] "a" (palette),
593 [LCD] "a" (0xf0008000),
594 [LCD2]"a" (0xf0008002)
595 : /* clobbers */
596 "d0", "d1", "d2", "d3"
537 ); 597 );
538#else 598#else
539 /* C version of above (drops 100 tics) */
540
541 // Start the write
542 *(volatile unsigned short *) 0xf0000000 = 0x21; // register
543 *(volatile unsigned short *) 0xf0000002 = 0; // value
544 *(volatile unsigned short *) 0xf0000000 = 0x22; // GRAM
545
546 unsigned char *screenptr=d_screens[0];
547 int hcnt=LCD_HEIGHT*LCD_WIDTH;
548
549 while(hcnt--)
550 {
551 *(volatile unsigned short *)0xf0000002 = palette[*screenptr];
552 screenptr++;
553 }
554#endif
555
556#else
557 unsigned char paletteIndex;
558 int y;
559
560#ifdef HAVE_LCD_COLOR 599#ifdef HAVE_LCD_COLOR
561#if(LCD_HEIGHT>LCD_WIDTH) 600#if(LCD_HEIGHT>LCD_WIDTH)
562 if(rotate_screen) 601 if(rotate_screen)
563 { 602 {
564 int x; 603 int y;
565 for (y=0; y<LCD_HEIGHT; y++) 604
605 for (y = 0; y < SCREENHEIGHT; y++)
566 { 606 {
567 for (x=0; x < LCD_WIDTH; x++) 607 fb_data *dst = rb->lcd_framebuffer + LCD_WIDTH - y;
608 count = SCREENWIDTH;
609
610 do
568 { 611 {
569 paletteIndex = d_screens[0][SCREENWIDTH*(SCREENHEIGHT-1-x) + y]; 612 *dst = palette[*src++];
570 rb->lcd_framebuffer[y*LCD_WIDTH + x] = palette[paletteIndex]; 613 dst += LCD_WIDTH;
571 } 614 }
615 while (--count);
572 } 616 }
573 } 617 }
574 else 618 else
575#endif 619#endif
576 for (y = 0; y < LCD_HEIGHT *LCD_WIDTH; y++)
577 { 620 {
578 paletteIndex = d_screens[0][y]; 621 fb_data *dst = rb->lcd_framebuffer;
579 rb->lcd_framebuffer[y] = palette[paletteIndex]; 622 count = SCREENWIDTH*SCREENHEIGHT;
623
624 do
625 *dst++ = palette[*src++];
626 while (--count);
580 } 627 }
581 rb->lcd_update(); 628 rb->lcd_update();
582#else /* !HAVE_LCD_COLOR */ 629#else /* !HAVE_LCD_COLOR */
583 int x; 630 unsigned char *dst;
631 int y;
584 632
585 for (y = 0; y < SCREENHEIGHT; y++) 633 for (y = 0; y < SCREENHEIGHT; y++)
586 { 634 {
587 for (x = 0; x < SCREENWIDTH; x++) 635 dst = greybuffer;
588 { 636 count = SCREENWIDTH;
589 paletteIndex = d_screens[0][y*SCREENWIDTH + x]; 637
590 greybuffer[x]=palette[paletteIndex]; 638 do
591 } 639 *dst++ = palette[*src++];
592 grey_ub_gray_bitmap(greybuffer, 0, y, SCREENWIDTH, 1); 640 while (--count);
593 } 641
642 grey_ub_gray_bitmap(greybuffer, 0, y, SCREENWIDTH, 1);
643 }
594#endif /* !HAVE_LCD_COLOR */ 644#endif /* !HAVE_LCD_COLOR */
595#endif 645#endif
596} 646}