00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <extgraph.h>
00025
00026 #include "AdvDialogs.h"
00027 #include "Internal.h"
00028
00029
00030 #ifndef OSdequeue
00031 #define OSdequeue _rom_call(short,(__pushort,void*),3AA)
00032 #endif
00033
00034
00035
00036 void ClearKbdQueue(void)
00037 {
00038 while (_rowread(0)) continue;
00039 }
00040
00041
00042
00043 void GetKey(void *kbq, short *key)
00044 {
00045
00046 while (OSdequeue(key, kbq)) continue;
00047 *key &= 0xF7FF;
00048 }
00049
00050
00051
00052 void GrayDrawColorString(short x, short y, const char *str, uchar color, uchar mode)
00053 {
00054 if (color == COLOR_WHITE)
00055 {
00056 GraySetAMSPlane(LIGHT_PLANE);
00057 DrawStr((mode == TXT_CENTERED ? (LCD_WIDTH - DrawStrWidth(str, F_4x6)) >> 1 : x), y, str, A_XOR);
00058 }
00059 else
00060 {
00061 GrayDrawStrExt(x, y, str, A_NORMAL | (mode == TXT_CENTERED ? A_CENTERED : 0), F_4x6);
00062 }
00063 }
00064
00065
00066
00067 void SaveScreen(void)
00068 {
00069 if (tscr == NULL)
00070 {
00071
00072 if ((tscr = malloc(sizeof(LCD_BUFFER)*2)) == NULL)
00073 {
00074 return;
00075 }
00076
00077
00078 FastCopyScreen_R(GrayGetPlane(LIGHT_PLANE), tscr);
00079 FastCopyScreen_R(GrayGetPlane(DARK_PLANE), tscr+sizeof(LCD_BUFFER));
00080 }
00081 }
00082
00083
00084
00085 void RestoreScreen(void)
00086 {
00087 if (tscr)
00088 {
00089 FastCopyScreen_R(tscr, GrayGetPlane(LIGHT_PLANE));
00090 FastCopyScreen_R(tscr+sizeof(LCD_BUFFER), GrayGetPlane(DARK_PLANE));
00091 free(tscr);
00092 tscr = NULL;
00093 }
00094 }
00095