summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy/lcd.c')
-rw-r--r--apps/plugins/rockboy/lcd.c113
1 files changed, 108 insertions, 5 deletions
diff --git a/apps/plugins/rockboy/lcd.c b/apps/plugins/rockboy/lcd.c
index 4cd4ddc04c..c1a7a87b6b 100644
--- a/apps/plugins/rockboy/lcd.c
+++ b/apps/plugins/rockboy/lcd.c
@@ -94,7 +94,7 @@ rcvar_t lcd_exports[] =
94 RCV_END 94 RCV_END
95 }; 95 };
96 96
97static byte *vdest; 97fb_data *vdest;
98 98
99#ifdef ALLOW_UNALIGNED_IO /* long long is ok since this is i386-only anyway? */ 99#ifdef ALLOW_UNALIGNED_IO /* long long is ok since this is i386-only anyway? */
100#define MEMCPY8(d, s) ((*(long long *)(d)) = (*(long long *)(s))) 100#define MEMCPY8(d, s) ((*(long long *)(d)) = (*(long long *)(s)))
@@ -532,9 +532,21 @@ void bg_scan(void)
532 if (cnt <= 0) return; 532 if (cnt <= 0) return;
533 while (cnt >= 8) 533 while (cnt >= 8)
534 { 534 {
535#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR)
536 asm volatile (
537 "move.l (%1)+,(%0)+ \n"
538 "move.l (%1)+,(%0)+ \n"
539 : /*outputs*/
540 : /*inputs*/
541 /* %0 */ "a" (dest),
542 /* %1 */ "a" (patpix[*(tile++)][V])
543 //: /* clobbers */
544 );
545#else
535 src = patpix[*(tile++)][V]; 546 src = patpix[*(tile++)][V];
536 MEMCPY8(dest, src); 547 MEMCPY8(dest, src);
537 dest += 8; 548 dest += 8;
549#endif
538 cnt -= 8; 550 cnt -= 8;
539 } 551 }
540 src = patpix[*tile][V]; 552 src = patpix[*tile][V];
@@ -555,9 +567,21 @@ void wnd_scan(void)
555 567
556 while (cnt >= 8) 568 while (cnt >= 8)
557 { 569 {
570#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR)
571 asm volatile (
572 "move.l (%1)+,(%0)+ \n"
573 "move.l (%1)+,(%0)+ \n"
574 : /*outputs*/
575 : /*inputs*/
576 /* %0 */ "a" (dest),
577 /* %1 */ "a" (patpix[*(tile++)][WV])
578 //: /* clobbers */
579 );
580#else
558 src = patpix[*(tile++)][WV]; 581 src = patpix[*(tile++)][WV];
559 MEMCPY8(dest, src); 582 MEMCPY8(dest, src);
560 dest += 8; 583 dest += 8;
584#endif
561 cnt -= 8; 585 cnt -= 8;
562 } 586 }
563 src = patpix[*tile][WV]; 587 src = patpix[*tile][WV];
@@ -651,8 +675,55 @@ void bg_scan_color(void)
651 while (cnt >= 8) 675 while (cnt >= 8)
652 { 676 {
653 src = patpix[*(tile++)][V]; 677 src = patpix[*(tile++)][V];
678#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR)
679 asm volatile (
680 "move.l (%2)+,%%d1 \n"
681
682 "move.b %%d1,%%d2 \n"
683
684 "move.b (%1)+,%%d0 \n"
685 "or.l %%d2,%%d0 \n"
686 "move.b %%d0,(%0)+ \n"
687
688 "move.b (%1)+,%%d0 \n"
689 "or.l %%d1,%%d0 \n"
690 "move.b %%d0,(%0)+ \n"
691
692 "move.b (%1)+,%%d0 \n"
693 "or.l %%d2,%%d0 \n"
694 "move.b %%d0,(%0)+ \n"
695
696 "move.b (%1)+,%%d0 \n"
697 "or.l %%d2,%%d0 \n"
698 "move.b %%d0,(%0)+ \n"
699
700 "move.b (%1)+,%%d0 \n"
701 "or.l %%d2,%%d0 \n"
702 "move.b %%d0,(%0)+ \n"
703
704 "move.b (%1)+,%%d0 \n"
705 "or.l %%d2,%%d0 \n"
706 "move.b %%d0,(%0)+ \n"
707
708 "move.b (%1)+,%%d0 \n"
709 "or.l %%d2,%%d0 \n"
710 "move.b %%d0,(%0)+ \n"
711
712 "move.b (%1)+,%%d0 \n"
713 "or.l %%d2,%%d0 \n"
714 "move.b %%d0,(%0)+ \n"
715 : /*outputs*/
716 : /*inputs*/
717 /* %0 */ "a" (dest),
718 /* %1 */ "a" (src),
719 /* %2 */ "a" (tile)
720 : /* clobbers */
721 "d0", "d1", "d2"
722);
723#else
654 blendcpy(dest, src, *(tile++), 8); 724 blendcpy(dest, src, *(tile++), 8);
655 dest += 8; 725 dest += 8;
726#endif
656 cnt -= 8; 727 cnt -= 8;
657 } 728 }
658 src = patpix[*(tile++)][V]; 729 src = patpix[*(tile++)][V];
@@ -843,14 +914,21 @@ void lcd_begin(void)
843 else pal_expire(); 914 else pal_expire();
844 } 915 }
845 while (scale * 160 > fb.w || scale * 144 > fb.h) scale--; */ 916 while (scale * 160 > fb.w || scale * 144 > fb.h) scale--; */
846 vdest = fb.ptr + ((fb.w*fb.pelsize)>>1) 917 if(options.fullscreen)
847 - (80*fb.pelsize) 918 vdest = fb.ptr;
848 + ((fb.h>>1) - 72) * fb.pitch; 919 else
920 vdest = fb.ptr + ((LCD_HEIGHT-144)/2)*LCD_WIDTH + ((LCD_WIDTH-160)/2);
921
849 WY = R_WY; 922 WY = R_WY;
850} 923}
851 924
925char frameout[25];
852void lcd_refreshline(void) 926void lcd_refreshline(void)
853{ 927{
928#if LCD_HEIGHT>=144
929 int cnt=0, two;
930#endif
931
854 if (!fb.enabled) return; 932 if (!fb.enabled) return;
855 if(!insync) { 933 if(!insync) {
856 if(R_LY!=0) 934 if(R_LY!=0)
@@ -924,7 +1002,32 @@ void lcd_refreshline(void)
924 else 1002 else
925 vid_update(L-((int)(L/9))); 1003 vid_update(L-((int)(L/9)));
926#else 1004#else
927 vid_update(L); 1005
1006 for(two=0;two<( (options.showstats ? (L&0x07)==0x05 : (L&0x07)==0x05 || (L&0x0F)==0x08) && options.fullscreen)+1;two++)
1007 {
1008 while (cnt < 160)
1009 {
1010 *vdest++ = scan.pal2[scan.buf[cnt++]];
1011 if( ((cnt&0x03)==0x03 || (cnt&0x07)==0x06) && options.fullscreen ) *vdest++ = scan.pal2[scan.buf[cnt]];
1012 }
1013
1014 if(!options.fullscreen)
1015 vdest+=(LCD_WIDTH-160);
1016 cnt=0;
1017 }
1018
1019 if(L==143)
1020 {
1021 if(options.showstats) {
1022 snprintf(frameout,sizeof(frameout),"FPS: %d \t %d ",options.fps, options.frameskip);
1023 if(options.fullscreen) rb->lcd_putsxy(0,166,frameout);
1024 else rb->lcd_putsxy((LCD_WIDTH-160)/2,(LCD_HEIGHT-144)/2,frameout);
1025 }
1026 if(options.fullscreen)
1027 rb->lcd_update();
1028 else
1029 rb->lcd_update_rect( (LCD_WIDTH-160)/2, (LCD_HEIGHT-144)/2, 160, 144 );
1030 }
928#endif 1031#endif
929 } 1032 }
930#if LCD_DEPTH == 1 1033#if LCD_DEPTH == 1