📄 lcdmem.lst
字号:
goto WriteBit0;
/*
Write with transparency
*/
WriteTBit0:
if (pixels&(3<<6))
SETPIXEL(x+0, y, *(pTrans+(pixels>>6)));
if (!--xsize)
return;
WriteTBit1:
if (pixels&(3<<4))
SETPIXEL(x+1, y, *(pTrans+(3&(pixels>>4))));
if (!--xsize)
return;
WriteTBit2:
if (pixels&(3<<2))
SETPIXEL(x+2, y, *(pTrans+(3&(pixels>>2))));
if (!--xsize)
return;
WriteTBit3:
if (pixels&(3<<0))
SETPIXEL(x+3, y, *(pTrans+(3&(pixels))));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteTBit0;
}
#endif
966
967 #endif
968
969 /*
970 *********************************************
971 * *
972 * Draw Bitmap 4 BPP *
973 * *
974 *********************************************
975 */
976 #if (LCD_MAX_LOG_COLORS > 4)
977 static void DrawBitLine4BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
978 1 PIXELCOLOR pixels;
979 1 /*
980 1 Jump to right entry point
981 1 */
982 1 pixels = *p;
983 1 if (GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) {
984 2 if ((Diff&1) ==0) {
C51 COMPILER V8.05a LCDMEM 04/11/2008 14:19:25 PAGE 17
985 3 goto WriteBit0;
986 3 } else {
987 3 goto WriteBit1;
988 3 }
989 2 } else {
990 2 if ((Diff&1) ==0) {
991 3 goto WriteTBit0;
992 3 } else {
993 3 goto WriteTBit1;
994 3 }
995 2 }
996 1 /*
997 1 Write without transparency
998 1 */
999 1 WriteBit0:
1000 1 SETPIXEL(x+0, y, *(pTrans+(pixels>>4)));
1001 1 if (!--xsize)
1002 1 return;
1003 1 WriteBit1:
1004 1 SETPIXEL(x+1, y, *(pTrans+(pixels&0xf)));
1005 1 if (!--xsize)
1006 1 return;
1007 1 x+=2;
1008 1 pixels = *(++p);
1009 1 goto WriteBit0;
1010 1 /*
1011 1 Write with transparency
1012 1 */
1013 1 WriteTBit0:
1014 1 if (pixels>>4)
1015 1 SETPIXEL(x+0, y, *(pTrans+(pixels>>4)));
1016 1 if (!--xsize)
1017 1 return;
1018 1 WriteTBit1:
1019 1 if (pixels&0xf)
1020 1 SETPIXEL(x+1, y, *(pTrans+(pixels&0xf)));
1021 1 if (!--xsize)
1022 1 return;
1023 1 x+=2;
1024 1 pixels = *(++p);
1025 1 goto WriteTBit0;
1026 1 }
1027 #endif
1028
1029 /*
1030 *********************************************
1031 * *
1032 * Draw Bitmap 8 BPP (256 colors) *
1033 * *
1034 *********************************************
1035 */
1036
1037
1038 static void DrawBitLine8BPP(int x, int y, U8 const*p, int xsize, const PIXELCOLOR*pTrans) {
1039 1 PIXELCOLOR Pixels;
1040 1 if (pTrans != aID) {
1041 2 do {
1042 3 Pixels = *p;
1043 3 SETPIXEL(x, y, *(pTrans + Pixels));
1044 3 xsize--;
1045 3 x++;
1046 3 p++;
C51 COMPILER V8.05a LCDMEM 04/11/2008 14:19:25 PAGE 18
1047 3 } while (xsize > 0);
1048 2 } else {
1049 2 do {
1050 3 SETPIXEL(x, y, *p);
1051 3 xsize--;
1052 3 x++;
1053 3 p++;
1054 3 } while (xsize > 0);
1055 2
1056 2 }
1057 1 }
1058
1059
1060 /*
1061 *********************************************************
1062 * *
1063 * Universal draw Bitmap routine *
1064 * *
1065 *********************************************************
1066 */
1067
1068 void LCD_L0_DrawBitmap (int x0, int y0,
1069 int xsize, int ysize,
1070 int BitsPerPixel,
1071 int BytesPerLine,
1072 const U8* pData, int Diff,
1073 const LCD_PIXELINDEX* pTrans)
1074 {
1075 1 int i;
1076 1 /* Use aID for bitmaps without palette */
1077 1 if (!pTrans) {
1078 2 pTrans = aID;
1079 2 }
1080 1 /* Use DrawBitLineXBPP */
1081 1 for (i=0; i<ysize; i++) {
1082 2 switch (BitsPerPixel) {
1083 3 case 1:
1084 3 DrawBitLine1BPP(x0, i+y0, pData, Diff, xsize, pTrans);
1085 3 break;
1086 3 #if (LCD_MAX_LOG_COLORS > 2)
1087 3 case 2:
1088 3 DrawBitLine2BPP(x0, i+y0, pData, Diff, xsize, pTrans);
1089 3 break;
1090 3 #endif
1091 3 #if (LCD_MAX_LOG_COLORS > 4)
1092 3 case 4:
1093 3 DrawBitLine4BPP(x0, i+y0, pData, Diff, xsize, pTrans);
1094 3 break;
1095 3 #endif
1096 3 case 8:
1097 3 DrawBitLine8BPP(x0, i+y0, pData, xsize, pTrans);
1098 3 break;
1099 3 }
1100 2 pData += BytesPerLine;
1101 2 }
1102 1 }
1103
1104
1105
1106 /*
1107 *********************************************************
1108 * *
C51 COMPILER V8.05a LCDMEM 04/11/2008 14:19:25 PAGE 19
1109 * LCD_L0_SetOrg *
1110 * *
1111 *********************************************************
1112
1113 Purpose: Sets the original position of the virtual display.
1114 Has no function at this point with the PC-driver.
1115 */
1116
1117 #if LCD_SUPPORT_SETORG
1118 void LCD_L0_SetOrg(int x, int y) {
1119 1 int i;
1120 1 int Off;
1121 1 if (y>(LCD_VYSIZE_PHYS-LCD_YSIZE_PHYS))
1122 1 y = LCD_VYSIZE_PHYS-LCD_YSIZE_PHYS;
1123 1 Off = y*LCD_BYTESPERLINE+(x>>3);
1124 1 for (i=0; i<LCD_BITSPERPIXEL; i++) {
1125 2 LCD__apVRam[i] = & LCD_VRam[i][0] +Off;
1126 2 }
1127 1 }
1128 #endif
1129
1130 /*
1131 *********************************************************
1132 * *
1133 * Support for verification *
1134 * *
1135 *********************************************************
1136
1137 The following routines are implemented, but have no functionility
1138 at this point. The reason is that these functions are supposed
1139 to supervise the hardware, which for obvious reasons can not be
1140 done in a simulation.
1141
1142 */
1143 #if LCD_VERIFY
int LCD_GetErrStat(void) {
return 0;
}
void LCD_ClrErrStat(void) {
}
int LCD_GetErrCnt (void) {
return 0;
}
#endif
1153
1154
1155 /********************************************************
1156 *
1157 * LCD_L0_On
1158 * LCD_L0_Off
1159 *
1160 *********************************************************
1161 These funtions are not implemented for this driver, they
1162 have to be in the external modul which refreshes the LCD
1163 regularily.
1164 */
1165
1166 #ifndef WIN32
1167
1168
1169 void LCD_L0_Off (void) {
1170 1 #ifdef LCD_OFF
C51 COMPILER V8.05a LCDMEM 04/11/2008 14:19:25 PAGE 20
LCD_OFF();
#endif
1173 1 }
1174 #endif
1175
1176 #ifndef WIN32
1177 void LCD_L0_On (void) {
1178 1 #ifdef LCD_ON
LCD_ON();
#endif
1181 1 }
1182 #endif
1183
1184
1185
1186
1187 /*
1188 *********************************************************
1189 * *
1190 * LCD_L0_ReInit : Re-Init the display *
1191 * *
1192 *********************************************************
1193
1194 ReInit contains all of the code that can be re-executed at any point without
1195 changing or even disturbing what can be seen on the LCD.
1196 Note that it is also used as a subroutine by LCD_Init().
1197
1198 */
1199
1200
1201 void LCD_L0_ReInit(void) {}
1202
1203
1204 /*
1205 *********************************************************
1206 * *
1207 * LCD_Init : Init the display *
1208 * *
1209 *********************************************************
1210 */
1211
1212 int LCD_L0_Init(void) {
1213 1 LCD_L0_Off();
1214 1 LCD_L0_ReInit();
1215 1 LCD_L0_SetOrg(0,0);
1216 1 /* Clear entire video RAM */
1217 1 LCD_L0_On();
1218 1 return 0;
1219 1 }
1220
1221 void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR color) {
1222 1 LCD_USE_PARA(Pos);
1223 1 LCD_USE_PARA(color);
1224 1 }
1225
1226 #else
void LCDMem(void) { } /* avoid empty object files */
#endif /*(LCD_CONTROLLER/100 == 13) */
1231
1232
C51 COMPILER V8.05a LCDMEM 04/11/2008 14:19:25 PAGE 21
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 8663 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 9680 144
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -