加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BA4988.cpp 22.82 KB
一键复制 编辑 原始数据 按行查看 历史
BA4988 提交于 2023-09-06 00:21 . update
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
// BA4988.cpp : 定义应用程序的入口点。
//
#include "framework.h"
#include "BA4988.h"
#include "os\startup.h"
#include "os\flash_emu.h"
#include "os\font_emu.h"
#define MAX_LOADSTRING 100
#define SCALING 2
#define LCD_WIDTH 160
#define LCD_HEIGHT 96
#define SCREEN_WIDTH ((LCD_WIDTH+20*2)*SCALING)
#define SCREEN_HEIGHT (LCD_HEIGHT*SCALING)
#define ID_TIMER_REFRESH 1
// 全局变量:
HINSTANCE hInst; // 当前实例
CHAR szTitle[MAX_LOADSTRING]; // 标题栏文本
CHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名
UINT8 KeyTable[0x100];
RECT _0040F6D0[0x60];
UINT8 _0040FCD0[0x60];
RECT _0040FD30; // 屏幕左侧图标区
RECT _0040FD40[0x60]; // 图标在图片资源上的区域
RECT _00410340; // 屏幕右侧图标区
UINT8 pvBitsLcd[1920];
HDC hDC;
HBITMAP hbmLcd;
HDC hdcLcd;
HBITMAP hbmScreen;
HDC hdcScreen;
HBITMAP hbmResource;
HDC hdcResource;
// 此代码模块中包含的函数的前向声明:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
void WndPaint();
void KeybordInit();
BOOL InitLcd();
BOOL LcdDestroy();
void PI_ISR_routine();
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: 在此处放置代码。
hInst = hInstance; // 将实例句柄存储在全局变量中
KeybordInit();
InitLcd();
// 初始化全局字符串
LoadStringA(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringA(hInstance, IDC_BA4988, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// 执行应用程序初始化:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
flash_emu_init();
font_emu_init();
startup_test(NULL);
DWORD ThreadID=0;
HANDLE hThread = CreateThread(NULL, 0, startup, NULL, 0, &ThreadID);
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_BA4988));
static MSG msg;
// 主消息循环:
while (GetMessage(&msg, nullptr, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
if (hThread != NULL)
{
CloseHandle(hThread);
}
flash_emu_release();
LcdDestroy();
return (int) msg.wParam;
}
//
// 函数: MyRegisterClass()
//
// 目标: 注册窗口类。
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEXA wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_BA4988));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = nullptr;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassExA(&wcex);
}
//
// 函数: InitInstance(HINSTANCE, int)
//
// 目标: 保存实例句柄并创建主窗口
//
// 注释:
//
// 在此函数中,我们在全局变量中保存实例句柄并
// 创建和显示主程序窗口。
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
RECT rect = { 0, 0, SCREEN_WIDTH,SCREEN_HEIGHT };
AdjustWindowRectEx(&rect, WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION, FALSE, WS_EX_ACCEPTFILES);
HWND hWnd = CreateWindowExA(WS_EX_ACCEPTFILES, szWindowClass, szTitle,
WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION,
(GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2,
(GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2,
rect.right - rect.left, rect.bottom - rect.top,
nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
hDC = GetDC(hWnd);
return TRUE;
}
//
// 函数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// 目标: 处理主窗口的消息。
//
// WM_COMMAND - 处理应用程序菜单
// WM_PAINT - 绘制主窗口
// WM_DESTROY - 发送退出消息并返回
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
SetTimer(hWnd, ID_TIMER_REFRESH, 100, nullptr);
break;
case WM_PAINT:
WndPaint();
break;
case WM_DESTROY:
KillTimer(hWnd, 1);
PostQuitMessage(0);
break;
case WM_TIMER:
switch (LPARAM(wParam))
{
case ID_TIMER_REFRESH:
WndPaint();
break;
}
case WM_KEYDOWN:
MCU_memory[0x24E] = KeyTable[LOBYTE(wParam)] | 0x80; // 保存按键信息到_KEYCODE
MCU_memory[0x04] |= 0x80; // 标记中断位
PI_ISR_routine();
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
void KeybordInit()
{
memset(KeyTable, 0x2D, sizeof(KeyTable)); // KEY_HELP
// 电脑按键映射到词典按键
KeyTable[VK_BACK] = 0x37; // KEY_LEFT
KeyTable[VK_TAB] = 0x2B; // KEY_SEARCH
KeyTable[VK_RETURN] = 0x2F; // KEY_ENTER
KeyTable[VK_SHIFT] = 0x28; // KEY_ZY
KeyTable[VK_CONTROL] = 0x28; // KEY_ZY
KeyTable[VK_MENU] = 0x01; // KEY_HOME_MENU
KeyTable[VK_CAPITAL] = 0x20; // KEY_INPUT
KeyTable[VK_ESCAPE] = 0x2E; // KEY_EXIT
KeyTable[VK_SPACE] = 0x36; // KEY_SPACE
KeyTable[VK_PRIOR] = 0x3A; // KEY_PGUP
KeyTable[VK_NEXT] = 0x3B; // KEY_PGDN
KeyTable[VK_HOME] = 0x2A; // KEY_MODIFY
KeyTable[VK_LEFT] = 0x37; // KEY_LEFT
KeyTable[VK_UP] = 0x35; // KEY_UP
KeyTable[VK_RIGHT] = 0x39; // KEY_RIGHT
KeyTable[VK_DOWN] = 0x38; // KEY_DOWN
KeyTable[VK_INSERT] = 0x29; // KEY_INSERT
KeyTable[VK_DELETE] = 0x2C; // KEY_DEL
KeyTable[0x30] = 0x31; // KEY_NUM_0
KeyTable[0x31] = 0x08; // KEY_NUM_1
KeyTable[0x32] = 0x09; // KEY_NUM_2
KeyTable[0x33] = 0x0A; // KEY_NUM_3
KeyTable[0x34] = 0x0B; // KEY_NUM_4
KeyTable[0x35] = 0x0C; // KEY_NUM_5
KeyTable[0x36] = 0x0D; // KEY_NUM_6
KeyTable[0x37] = 0x0E; // KEY_NUM_7
KeyTable[0x38] = 0x0F; // KEY_NUM_8
KeyTable[0x39] = 0x30; // KEY_NUM_9
KeyTable[0x41] = 0x18; // KEY_A
KeyTable[0x42] = 0x25; // KEY_B
KeyTable[0x43] = 0x23; // KEY_C
KeyTable[0x44] = 0x1A; // KEY_D
KeyTable[0x45] = 0x12; // KEY_E
KeyTable[0x46] = 0x1B; // KEY_F
KeyTable[0x47] = 0x1C; // KEY_G
KeyTable[0x48] = 0x1D; // KEY_H
KeyTable[0x49] = 0x17; // KEY_I
KeyTable[0x4A] = 0x1E; // KEY_J
KeyTable[0x4B] = 0x1F; // KEY_K
KeyTable[0x4C] = 0x34; // KEY_L
KeyTable[0x4D] = 0x27; // KEY_M
KeyTable[0x4E] = 0x26; // KEY_N
KeyTable[0x4F] = 0x32; // KEY_O
KeyTable[0x50] = 0x33; // KEY_P
KeyTable[0x51] = 0x10; // KEY_Q
KeyTable[0x52] = 0x13; // KEY_R
KeyTable[0x53] = 0x19; // KEY_S
KeyTable[0x54] = 0x14; // KEY_T
KeyTable[0x55] = 0x16; // KEY_U
KeyTable[0x56] = 0x24; // KEY_V
KeyTable[0x57] = 0x11; // KEY_W
KeyTable[0x58] = 0x22; // KEY_X
KeyTable[0x59] = 0x15; // KEY_Y
KeyTable[0x5A] = 0x21; // KEY_Z
KeyTable[VK_NUMPAD0] = 0x31; // KEY_NUM_0
KeyTable[VK_NUMPAD1] = 0x08; // KEY_NUM_1
KeyTable[VK_NUMPAD2] = 0x09; // KEY_NUM_2
KeyTable[VK_NUMPAD3] = 0x0A; // KEY_NUM_3
KeyTable[VK_NUMPAD4] = 0x0B; // KEY_NUM_4
KeyTable[VK_NUMPAD5] = 0x0C; // KEY_NUM_5
KeyTable[VK_NUMPAD6] = 0x0D; // KEY_NUM_6
KeyTable[VK_NUMPAD7] = 0x0E; // KEY_NUM_7
KeyTable[VK_NUMPAD8] = 0x0F; // KEY_NUM_8
KeyTable[VK_NUMPAD9] = 0x30; // KEY_NUM_9
KeyTable[VK_MULTIPLY] = 0x07; // KEY_SPK
KeyTable[VK_ADD] = 0x06; // KEY_DOWNLOAD
KeyTable[VK_SEPARATOR] = 0x05; // KEY_DLG
KeyTable[VK_SUBTRACT] = 0x04; // KEY_CE
KeyTable[VK_DECIMAL] = 0x02; // KEY_EC_SJ
KeyTable[VK_DIVIDE] = 0x03; // KEY_EC_SW
KeyTable[VK_F1] = 0x00; // KEY_ON_OFF
KeyTable[VK_F2] = 0x2D; // KEY_HELP
KeyTable[VK_F3] = 0x2D; // KEY_HELP
KeyTable[VK_F4] = 0x2D; // KEY_HELP
KeyTable[VK_F5] = 0x2D; // KEY_HELP
KeyTable[VK_F6] = 0x2D; // KEY_HELP
KeyTable[VK_F7] = 0x2D; // KEY_HELP
KeyTable[VK_F8] = 0x2D; // KEY_HELP
KeyTable[VK_F9] = 0x2D; // KEY_HELP
KeyTable[VK_F10] = 0x2D; // KEY_HELP
KeyTable[VK_F11] = 0x2D; // KEY_HELP
//KeyTable[VK_F12] = 0x2D; // 别的位置设置为重启键
KeyTable[VK_SCROLL] = 0x00; // KEY_ON_OFF
}
void IconsInit()
{
int ebp_4;
SetRect(&_0040FD30, 0, 0, 41, 192);
SetRect(&_00410340, 359, 0, 400, 192);
for (ebp_4 = 0; ebp_4 < 4; ebp_4++)
{
SetRect(_0040FD40 + (ebp_4 * 8), 1, 0, 5, 1); // 数字上横
SetRect(_0040FD40 + (ebp_4 * 8 + 1), 0, 1, 1, 5); // 数字左上竖
SetRect(_0040FD40 + (ebp_4 * 8 + 2), 5, 1, 6, 5); // 数字右上竖
SetRect(_0040FD40 + (ebp_4 * 8 + 3), 1, 5, 5, 6); // 数字中横
SetRect(_0040FD40 + (ebp_4 * 8 + 4), 0, 6, 1, 10); // 数字左下竖
SetRect(_0040FD40 + (ebp_4 * 8 + 5), 5, 6, 6, 10); // 数字右下竖
SetRect(_0040FD40 + (ebp_4 * 8 + 6), 1, 10, 5, 11); // 数字下横
SetRect(_0040FD40 + (ebp_4 * 8 + 7), 7, 10, 8, 11); // 小数点
}
SetRect(&_0040FD40[0x20], 0, 12, 7, 16); // 上
for (ebp_4 = 0; ebp_4 < 0x26; ebp_4++)
{
SetRect(&_0040FD40[ebp_4 + 0x21], 0, 18, 7, 20); // 横线
}
SetRect(&_0040FD40[0x47], 0, 22, 7, 26); // 下
for (ebp_4 = 0; ebp_4 < 8; ebp_4++)
{
SetRect(&_0040FD40[ebp_4 + 0x48], 36, 0, 51, 9); // 功能指示
}
SetRect(&_0040FD40[0x50], 9, 10, 34, 22); // NUM
SetRect(&_0040FD40[0x51], 9, 22, 34, 34); // CAPS
//
SetRect(&_0040FD40[0x53], 9, 34, 34, 46); // SHIFT
SetRect(&_0040FD40[0x54], 36, 36, 64, 46); // 闹铃
SetRect(&_0040FD40[0x55], 54, 18, 71, 33); // 发音
SetRect(&_0040FD40[0x56], 54, 0, 70, 16); // 闹钟开关
SetRect(&_0040FD40[0x57], 0, 28, 7, 36); // 上翻页
SetRect(&_0040FD40[0x58], 0, 38, 7, 46); // 下翻页
SetRect(&_0040FD40[0x59], 36, 22, 51, 33); // 左
SetRect(&_0040FD40[0x5A], 36, 10, 51, 21); // 右
SetRect(&_0040FD40[0x5B], 9, 0, 28, 8); // 电池电量
SetRect(&_0040FD40[0x5C], 9, 0, 28, 8); // 电池电量
SetRect(&_0040FD40[0x5D], 9, 0, 28, 8); // 电池电量
// x y w h
SetRect(&_0040F6D0[0x00], 112, 119, 116, 120); // 4 11 4 1 (千位)数字上横
SetRect(&_0040F6D0[0x01], 111, 120, 112, 124); // 3 12 1 4 (千位)数字左上竖
SetRect(&_0040F6D0[0x02], 116, 120, 117, 124); // 8 12 1 4 (千位)数字右上竖
SetRect(&_0040F6D0[0x03], 112, 124, 116, 125); // 4 16 4 1 (千位)数字中横
SetRect(&_0040F6D0[0x04], 111, 125, 112, 129); // 3 17 1 4 (千位)数字左下竖
SetRect(&_0040F6D0[0x05], 116, 125, 117, 129); // 8 17 1 4 (千位)数字右下竖
SetRect(&_0040F6D0[0x06], 112, 129, 116, 130); // 4 21 4 1 (千位)数字下横
SetRect(&_0040F6D0[0x07], 118, 129, 119, 130); // 10 21 1 1 小数点
SetRect(&_0040F6D0[0x08], 121, 119, 125, 120); // 13 11 4 1 (百位)数字上横
SetRect(&_0040F6D0[0x09], 120, 120, 121, 124); // 12 12 1 4 (百位)数字左上竖
SetRect(&_0040F6D0[0x0A], 125, 120, 126, 124); // 17 12 1 4 (百位)数字右上竖
SetRect(&_0040F6D0[0x0B], 121, 124, 125, 125); // 13 16 4 1 (百位)数字中横
SetRect(&_0040F6D0[0x0C], 120, 125, 121, 129); // 12 17 1 4 (百位)数字左下竖
SetRect(&_0040F6D0[0x0D], 125, 125, 126, 129); // 17 17 1 4 (百位)数字右下竖
SetRect(&_0040F6D0[0x0E], 121, 129, 125, 130); // 13 21 4 1 (百位)数字下横
SetRect(&_0040F6D0[0x0F], 127, 129, 128, 130); // 19 21 1 1 小数点
SetRect(&_0040F6D0[0x10], 131, 119, 135, 120); // 23 11 4 1 (十位)数字上横
SetRect(&_0040F6D0[0x11], 130, 120, 135, 124); // 22 12 5 4 (十位)数字左上竖
SetRect(&_0040F6D0[0x12], 135, 120, 136, 124); // 27 12 1 4 (十位)数字右上竖
SetRect(&_0040F6D0[0x13], 131, 124, 135, 125); // 23 16 4 1 (十位)数字中横
SetRect(&_0040F6D0[0x14], 130, 125, 131, 129); // 22 17 1 4 (十位)数字左下竖
SetRect(&_0040F6D0[0x15], 135, 125, 136, 129); // 27 17 1 3 (十位)数字右下竖
SetRect(&_0040F6D0[0x16], 131, 129, 135, 130); // 23 21 4 1 (十位)数字下横
SetRect(&_0040F6D0[0x17], 137, 129, 138, 130); // 29 21 1 1 小数点
SetRect(&_0040F6D0[0x18], 140, 119, 144, 120); // 32 11 4 1 (个位)数字上横
SetRect(&_0040F6D0[0x19], 139, 120, 140, 124); // 31 12 1 4 (个位)数字左上竖
SetRect(&_0040F6D0[0x1A], 144, 120, 145, 124); // 36 12 1 4 (个位)数字右上竖
SetRect(&_0040F6D0[0x1B], 140, 124, 144, 125); // 32 16 4 1 (个位)数字中横
SetRect(&_0040F6D0[0x1C], 139, 125, 140, 129); // 31 17 1 4 (个位)数字左下竖
SetRect(&_0040F6D0[0x1D], 144, 125, 145, 129); // 36 17 1 4 (个位)数字右下竖
SetRect(&_0040F6D0[0x1E], 140, 129, 144, 130); // 32 21 4 1 (个位)数字下横
SetRect(&_0040F6D0[0x1F], 127, 122, 129, 127); // 19 14 2 5 小数点 todo数据中间的冒号
SetRect(&_0040F6D0[0x20], 110, 137, 117, 141); // 2 29 7 4 上
for (ebp_4 = 0; ebp_4 < 0x26; ebp_4++)
{
SetRect(&_0040F6D0[ebp_4 + 0x21], 110, ebp_4 * 4 + 143, 117, ebp_4 * 4 + 145); // 2 35+4a 7 2 横线
}
SetRect(&_0040F6D0[0x47], 110, 295, 117, 299); // 2 187 7 4 下
for (ebp_4 = 0; ebp_4 < 8; ebp_4++)
{
SetRect(&_0040F6D0[ebp_4 + 0x48], 481, ebp_4 * 23 + 113, 495, ebp_4 * 23 + 122); // 373 5+23a 14 9 功能指示:释义、例句、例证、习语、复合、派生、用法、同反
}
SetRect(&_0040F6D0[0x50], 121, 144, 146, 156); // 13 36 25 12 NUM
SetRect(&_0040F6D0[0x51], 121, 164, 146, 176); // 13 56 25 12 CAPS
SetRect(&_0040F6D0[0x52], 121, 144, 146, 156); // 13 36 25 12
SetRect(&_0040F6D0[0x53], 121, 184, 146, 196); // 13 76 25 12 SHIFT
SetRect(&_0040F6D0[0x54], 119, 203, 147, 213); // 11 95 28 10 闹铃
SetRect(&_0040F6D0[0x55], 126, 217, 143, 232); // 18 109 17 15 发音
SetRect(&_0040F6D0[0x56], 126, 233, 142, 249); // 18 125 16 16 闹钟开关
SetRect(&_0040F6D0[0x57], 130, 252, 137, 260); // 22 144 7 8 上翻页
SetRect(&_0040F6D0[0x58], 130, 263, 137, 271); // 22 155 7 8 下翻页
SetRect(&_0040F6D0[0x59], 126, 288, 141, 299); // 18 180 15 11 左
SetRect(&_0040F6D0[0x5A], 481, 288, 496, 299); // 373 180 15 11 右
SetRect(&_0040F6D0[0x5B], 124, 278, 143, 286); // 16 170 19 8 电池电量
SetRect(&_0040F6D0[0x5C], 124, 278, 143, 286); // 16 170 19 8 电池电量
SetRect(&_0040F6D0[0x5D], 124, 278, 143, 286); // 16 170 19 8 电池电量
_0040FCD0[0x00] = 0x0B; // (百位)数字中横
_0040FCD0[0x01] = 0x09; // (百位)数字左上竖
_0040FCD0[0x02] = 0x08; // (百位)数字上横
_0040FCD0[0x03] = 0x0A; // (百位)数字右上竖
_0040FCD0[0x04] = 0x1F; // 小数点
_0040FCD0[0x05] = 0x11; // (十位)数字左上竖
_0040FCD0[0x06] = 0x10; // (十位)数字上横
_0040FCD0[0x07] = 0x12; // (十位)数字右上竖
_0040FCD0[0x08] = 0x13; // (十位)数字中横
_0040FCD0[0x09] = 0x19; // (个位)数字左上竖
_0040FCD0[0x0A] = 0x18; // (个位)数字上横
_0040FCD0[0x0B] = 0x1A; // (个位)数字右上竖
_0040FCD0[0x0C] = 0x1B; // (个位)数字中横
_0040FCD0[0x0D] = 0x1D; // (个位)数字右下竖
_0040FCD0[0x0E] = 0x1E; // (个位)数字下横
_0040FCD0[0x0F] = 0x1C; // (个位)数字左下竖
_0040FCD0[0x10] = 0x17; // 小数点
_0040FCD0[0x11] = 0x15; // (十位)数字右下竖
_0040FCD0[0x12] = 0x16; // (十位)数字下横
_0040FCD0[0x13] = 0x14; // (十位)数字左下竖
_0040FCD0[0x14] = 0x0F; // 小数点
_0040FCD0[0x15] = 0x48; // 功能指示
_0040FCD0[0x16] = 0x0D; // (百位)数字右下竖
_0040FCD0[0x17] = 0x0E; // (百位)数字下横
_0040FCD0[0x18] = 0x50; // NUM
_0040FCD0[0x19] = 0x0C; // (百位)数字左下竖
_0040FCD0[0x1A] = 0x09; // (百位)数字左上竖
_0040FCD0[0x1B] = 0x20; // 上
_0040FCD0[0x1C] = 0x05; // (千位)数字右下竖
_0040FCD0[0x1D] = 0x21; // 横线
_0040FCD0[0x1E] = 0x06; // (千位)数字下横
_0040FCD0[0x1F] = 0x49; // 功能指示
_0040FCD0[0x20] = 0x22; // 横线
_0040FCD0[0x21] = 0x04; // (千位)数字左下竖
_0040FCD0[0x22] = 0x51; // CAPS
_0040FCD0[0x23] = 0x23; // 横线
_0040FCD0[0x24] = 0x4A; // 功能指示
_0040FCD0[0x25] = 0x03; // (千位)数字中横
_0040FCD0[0x26] = 0x24; // 横线
_0040FCD0[0x27] = 0x01; // (千位)数字左上竖
_0040FCD0[0x28] = 0x25; // 横线
_0040FCD0[0x29] = 0x26; // 横线
_0040FCD0[0x2A] = 0x4B; // 功能指示
_0040FCD0[0x2B] = 0x27; // 横线
_0040FCD0[0x2C] = 0x28; // 横线
_0040FCD0[0x2D] = 0x53; // SHIFT
_0040FCD0[0x2E] = 0x00; // (千位)数字上横
_0040FCD0[0x2F] = 0x29; // 横线
_0040FCD0[0x30] = 0x02; // (千位)数字右上竖
_0040FCD0[0x31] = 0x4C; // 功能指示
_0040FCD0[0x32] = 0x2A; // 横线
_0040FCD0[0x33] = 0x2B; // 横线
_0040FCD0[0x34] = 0x54; // 闹铃
_0040FCD0[0x35] = 0x2C; // 横线
_0040FCD0[0x36] = 0x2D; // 横线
_0040FCD0[0x37] = 0x2E; // 横线
_0040FCD0[0x38] = 0x2F; // 横线
_0040FCD0[0x39] = 0x00; // (千位)数字上横
_0040FCD0[0x3A] = 0x00; // (千位)数字上横
_0040FCD0[0x3B] = 0x55; // 发音
_0040FCD0[0x3C] = 0x30; // 横线
_0040FCD0[0x3D] = 0x31; // 横线
_0040FCD0[0x3E] = 0x32; // 横线
_0040FCD0[0x3F] = 0x33; // 横线
_0040FCD0[0x40] = 0x34; // 横线
_0040FCD0[0x41] = 0x4D; // 功能指示
_0040FCD0[0x42] = 0x35; // 横线
_0040FCD0[0x43] = 0x36; // 横线
_0040FCD0[0x44] = 0x56; // 闹钟开关
_0040FCD0[0x45] = 0x37; // 横线
_0040FCD0[0x46] = 0x38; // 横线
_0040FCD0[0x47] = 0x39; // 横线
_0040FCD0[0x48] = 0x3A; // 横线
_0040FCD0[0x49] = 0x3B; // 横线
_0040FCD0[0x4A] = 0x3C; // 横线
_0040FCD0[0x4B] = 0x3D; // 横线
_0040FCD0[0x4C] = 0x57; // 上翻页
_0040FCD0[0x4D] = 0x3E; // 横线
_0040FCD0[0x4E] = 0x3F; // 横线
_0040FCD0[0x4F] = 0x3F; // 横线
_0040FCD0[0x50] = 0x40; // 横线
_0040FCD0[0x51] = 0x41; // 横线
_0040FCD0[0x52] = 0x58; // 下翻页
_0040FCD0[0x53] = 0x42; // 横线
_0040FCD0[0x54] = 0x43; // 横线
_0040FCD0[0x55] = 0x44; // 横线
_0040FCD0[0x56] = 0x45; // 横线
_0040FCD0[0x57] = 0x46; // 横线
_0040FCD0[0x58] = 0x47; // 下
_0040FCD0[0x59] = 0x5B; // 电池电量
_0040FCD0[0x5A] = 0x5C; // 电池电量
_0040FCD0[0x5B] = 0x5D; // 电池电量
_0040FCD0[0x5C] = 0x4E; // 功能指示
_0040FCD0[0x5D] = 0x59; // 左
_0040FCD0[0x5E] = 0x4F; // 功能指示
_0040FCD0[0x5F] = 0x5A; // 右
}
BOOL InitLcd()
{
bool ebp_1C;
__try {
hbmLcd = CreateBitmap(160, 96, 1, 1, NULL);
ebp_1C = hbmLcd == NULL;
if (ebp_1C)
{
__leave;
}
hdcLcd = CreateCompatibleDC(NULL);
ebp_1C = hdcLcd == NULL;
if (ebp_1C)
{
__leave;
}
hbmScreen = CreateBitmap(400, 192, 1, 1, NULL);
ebp_1C = hbmScreen == NULL;
if (ebp_1C)
{
__leave;
}
hdcScreen = CreateCompatibleDC(NULL);
ebp_1C = hdcScreen == NULL;
if (ebp_1C)
{
__leave;
}
hbmResource = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP));
ebp_1C = hbmResource == NULL;
if (ebp_1C)
{
__leave;
}
hdcResource = CreateCompatibleDC(NULL);
ebp_1C = hdcResource == NULL;
}
__finally
{
if (ebp_1C)
{
if (hbmLcd)
{
DeleteObject(hbmLcd);
}
if (hdcLcd)
{
DeleteDC(hdcLcd);
}
if (hbmScreen)
{
DeleteObject(hbmScreen);
}
if (hdcScreen)
{
DeleteDC(hdcScreen);
}
if (hbmResource)
{
DeleteObject(hbmResource);
}
if (hdcResource)
{
DeleteDC(hdcResource);
}
}
else
{
SelectObject(hdcLcd, hbmLcd);
SelectObject(hdcResource, hbmResource);
SelectObject(hdcScreen, hbmScreen);
}
}
IconsInit();
return !ebp_1C;
}
BOOL LcdDestroy()
{
if (hdcLcd)
{
DeleteDC(hdcLcd);
}
if (hbmLcd)
{
DeleteObject(hbmLcd);
}
if (hdcScreen)
{
DeleteDC(hdcScreen);
}
if (hbmScreen)
{
DeleteObject(hbmScreen);
}
if (hdcResource)
{
DeleteDC(hdcResource);
}
if (hbmResource)
{
DeleteObject(hbmResource);
}
return TRUE;
}
void WndPaint()
{
// TODO: 在此处添加使用 hdc 的任何绘图代码...
int ebp_4;
int ebp_8;
UINT8* pVideoMemory = MCU_memory + 0x400;
for (ebp_8 = 0; ebp_8 < 0x42; ebp_8++)
{
for (ebp_4 = 0; ebp_4 < 0x13; ebp_4++)
{
pvBitsLcd[(0x41 - ebp_8) * 20 + ebp_4 + 1] = ~pVideoMemory[(ebp_8 << 5) + ebp_4];
}
}
for (ebp_8 = 0x42; ebp_8 < 0x60; ebp_8++)
{
for (ebp_4 = 0; ebp_4 < 0x13; ebp_4++)
{
pvBitsLcd[ebp_8 * 20 + ebp_4 + 1] = ~pVideoMemory[(ebp_8 << 5) + ebp_4];
}
}
for (ebp_8 = 0; ebp_8 < 0x41; ebp_8++)
{
pvBitsLcd[(0x40 - ebp_8) * 20] = ~pVideoMemory[(ebp_8 << 5) + 19];
}
for (ebp_8 = 0x41; ebp_8 < 0x5F; ebp_8++)
{
pvBitsLcd[(ebp_8 + 1) * 20] = ~pVideoMemory[(ebp_8 << 5) + 19];
}
pvBitsLcd[0x514] = ~pVideoMemory[0xBF3];
pvBitsLcd[0x515] = ~pVideoMemory[0xC00];
SetBitmapBits(hbmLcd, 1920, pvBitsLcd);
FillRect(hdcScreen, &_0040FD30, (HBRUSH)GetStockObject(WHITE_BRUSH));
FillRect(hdcScreen, &_00410340, (HBRUSH)GetStockObject(WHITE_BRUSH));
StretchBlt(hdcScreen, 41, 0, 318, 192, hdcLcd, 0, 0, 159, 96, SRCCOPY);
// 判断是否显示屏幕左右的图标
for (ebp_8 = 0; ebp_8 < 0x60; ebp_8++)
{
if ((pvBitsLcd[ebp_8 * 20 + 19] & 0x01) == 0x00)
{
BitBlt(hdcScreen, _0040F6D0[_0040FCD0[ebp_8]].left - 108,
_0040F6D0[_0040FCD0[ebp_8]].top - 108,
_0040F6D0[_0040FCD0[ebp_8]].right - _0040F6D0[_0040FCD0[ebp_8]].left,
_0040F6D0[_0040FCD0[ebp_8]].bottom - _0040F6D0[_0040FCD0[ebp_8]].top,
hdcResource, _0040FD40[_0040FCD0[ebp_8]].left, _0040FD40[_0040FCD0[ebp_8]].top, SRCCOPY);
}
}
BitBlt(hDC, 0, 0, 400, 192, hdcScreen, 0, 0, SRCCOPY);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化