2016-09-11: Updated to version 56

Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
Gwenhael Le Moine 2024-03-20 07:46:28 +01:00
parent 0c6fbb14ef
commit 5b61a0678e
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
23 changed files with 1335 additions and 1206 deletions

View file

@ -1,4 +1,4 @@
Emu48 1.55+ (based on Emu48 1.57) Emu48 1.56+ (based on Emu48 1.58)
Emu48+ is a modified version of Emu48 to add support for the ARM-based Emu48+ is a modified version of Emu48 to add support for the ARM-based
calculators. It does not emulate the ARM CPU, but it enhances the calculators. It does not emulate the ARM CPU, but it enhances the

BIN
Emu48.dll

Binary file not shown.

BIN
Emu48.exe

Binary file not shown.

View file

@ -1,4 +1,4 @@
Known bugs and restrictions of Emu48 V1.57 Known bugs and restrictions of Emu48 V1.58
------------------------------------------ ------------------------------------------
- the following I/O bits aren't emulated (incomplete) - the following I/O bits aren't emulated (incomplete)
@ -47,4 +47,4 @@ Known bugs and restrictions of Emu48 V1.57
- quitting the emulator while programming the flash isn't allowed, - quitting the emulator while programming the flash isn't allowed,
because the content of flash state machine isn't saved so far because the content of flash state machine isn't saved so far
07/14/15 (c) by Christoph Gießelink, c dot giesselink at gmx dot de 08/16/16 (c) by Christoph Gießelink, c dot giesselink at gmx dot de

File diff suppressed because it is too large Load diff

View file

@ -46,13 +46,6 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,
if (*psz != 0 || nStkLvl < 1) // invalid number format if (*psz != 0 || nStkLvl < 1) // invalid number format
return (HDDEDATA) DDE_FNOTPROCESSED; return (HDDEDATA) DDE_FNOTPROCESSED;
DdeAccessData(hData,&dwSize); // fetch data size
DdeUnaccessData(hData);
// reserve memory
if ((lpData = (LPBYTE) malloc(dwSize * 2)) == NULL)
return (HDDEDATA) DDE_FNOTPROCESSED;
SuspendDebugger(); // suspend debugger SuspendDebugger(); // suspend debugger
bDbgAutoStateCtrl = FALSE; // disable automatic debugger state control bDbgAutoStateCtrl = FALSE; // disable automatic debugger state control
@ -66,7 +59,6 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,
if (WaitForSleepState()) // wait for cpu SHUTDN then sleep state if (WaitForSleepState()) // wait for cpu SHUTDN then sleep state
{ {
free(lpData); // free memory
hReturn = DDE_FNOTPROCESSED; hReturn = DDE_FNOTPROCESSED;
goto cancel; goto cancel;
} }
@ -74,13 +66,32 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,
while (nState!=nNextState) Sleep(0); while (nState!=nNextState) Sleep(0);
_ASSERT(nState==SM_SLEEP); _ASSERT(nState==SM_SLEEP);
// fetch data and write to stack bSuccess = FALSE;
DdeGetData(hData,(LPBYTE) &dwIndex,sizeof(DWORD),0L);
if (dwIndex <= dwSize - sizeof(DWORD)) // get data and size
dwSize = dwIndex; lpData = DdeAccessData(hData,&dwSize);
dwSize = DdeGetData(hData,lpData+dwSize,dwSize,sizeof(DWORD));
bSuccess = (WriteStack(nStkLvl,lpData,dwSize) == S_ERR_NO); // has object length header
free(lpData); // free memory if (lpData && dwSize >= sizeof(DWORD))
{
dwIndex = *(LPDWORD) lpData; // object length
if (dwIndex <= dwSize - sizeof(DWORD))
{
// reserve unpacked object length memory
LPBYTE pbyMem = (LPBYTE) malloc(dwIndex * 2);
if (pbyMem != NULL)
{
// copy data and write to stack
CopyMemory(pbyMem+dwIndex,lpData+sizeof(DWORD),dwIndex);
bSuccess = (WriteStack(nStkLvl,pbyMem,dwIndex) == S_ERR_NO);
free(pbyMem); // free memory
}
}
}
DdeUnaccessData(hData);
SwitchToState(SM_RUN); // run state SwitchToState(SM_RUN); // run state
while (nState!=nNextState) Sleep(0); while (nState!=nNextState) Sleep(0);
@ -96,7 +107,7 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,
Sleep(dwWakeupDelay); Sleep(dwWakeupDelay);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
// wait for sleep mode // wait for sleep mode
while(Chipset.Shutdn == FALSE) Sleep(0); while (Chipset.Shutdn == FALSE) Sleep(0);
hReturn = (HDDEDATA) DDE_FACK; hReturn = (HDDEDATA) DDE_FACK;
cancel: cancel:

View file

@ -237,7 +237,14 @@ DECLSPEC BOOL CALLBACK EmuInitLastInstr(
DWORD *pdwArray) // @parm pointer to linear array DWORD *pdwArray) // @parm pointer to linear array
{ {
if (pdwInstrArray) // circular buffer defined if (pdwInstrArray) // circular buffer defined
free(pdwInstrArray); // free memory {
EnterCriticalSection(&csDbgLock);
{
free(pdwInstrArray); // free memory
pdwInstrArray = NULL;
}
LeaveCriticalSection(&csDbgLock);
}
if (wNoInstr) // new size if (wNoInstr) // new size
{ {

View file

@ -156,50 +156,6 @@ static VOID DisableMenuKeys(HWND hDlg)
return; return;
} }
//
// read edit control and decode content as hex number or if enabled as symbol name
//
static BOOL GetAddr(HWND hDlg,INT nID,DWORD *pdwAddr,DWORD dwMaxAddr,BOOL bSymbEnable)
{
TCHAR szBuffer[48];
INT i;
BOOL bSucc = TRUE;
HWND hWnd = GetDlgItem(hDlg,nID);
GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer));
if (*szBuffer != 0)
{
// if address is not a symbol name decode number
if ( !bSymbEnable || szBuffer[0] != _T('=')
|| RplGetAddr(&szBuffer[1],pdwAddr))
{
// test if valid hex address
for (i = 0; bSucc && i < (LONG) lstrlen(szBuffer); ++i)
{
bSucc = (_istxdigit(szBuffer[i]) != 0);
}
if (bSucc) // valid characters
{
// convert string to number
*pdwAddr = _tcstoul(szBuffer,NULL,16);
}
}
// inside address range?
bSucc = bSucc && (*pdwAddr <= dwMaxAddr);
if (!bSucc) // invalid address
{
SendMessage(hWnd,EM_SETSEL,0,-1);
SetFocus(hWnd); // focus to edit control
}
}
return bSucc;
}
// //
// set mapping menu // set mapping menu
// //
@ -256,6 +212,50 @@ static VOID SetMappingMenu(HWND hDlg,UINT uID)
return; return;
}; };
//
// read edit control and decode content as hex number or if enabled as symbol name
//
static BOOL GetAddr(HWND hDlg,INT nID,DWORD *pdwAddr,DWORD dwMaxAddr,BOOL bSymbEnable)
{
TCHAR szBuffer[48];
INT i;
BOOL bSucc = TRUE;
HWND hWnd = GetDlgItem(hDlg,nID);
GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer));
if (*szBuffer != 0)
{
// if address is not a symbol name decode number
if ( !bSymbEnable || szBuffer[0] != _T('=')
|| RplGetAddr(&szBuffer[1],pdwAddr))
{
// test if valid hex address
for (i = 0; bSucc && i < (LONG) lstrlen(szBuffer); ++i)
{
bSucc = (_istxdigit(szBuffer[i]) != 0);
}
if (bSucc) // valid characters
{
// convert string to number
*pdwAddr = _tcstoul(szBuffer,NULL,16);
}
}
// inside address range?
bSucc = bSucc && (*pdwAddr <= dwMaxAddr);
if (!bSucc) // invalid address
{
SendMessage(hWnd,EM_SETSEL,0,-1);
SetFocus(hWnd); // focus to edit control
}
}
return bSucc;
}
// //
// get address of cursor in memory window // get address of cursor in memory window
// //
@ -713,7 +713,7 @@ static VOID UpdateMemoryWnd(HWND hDlg)
// //
static VOID UpdateStackWnd(HWND hDlg) static VOID UpdateStackWnd(HWND hDlg)
{ {
INT i; UINT i;
LONG nPos; LONG nPos;
TCHAR szBuffer[64]; TCHAR szBuffer[64];
@ -1143,7 +1143,7 @@ static BOOL OnClearAll(HWND hDlg)
// //
static BOOL OnToggleMenuItem(HWND hDlg,UINT uIDCheckItem,BOOL *bCheck) static BOOL OnToggleMenuItem(HWND hDlg,UINT uIDCheckItem,BOOL *bCheck)
{ {
*bCheck = !*bCheck; // toggle flag *bCheck = !*bCheck; // toggle flag
CheckMenuItem(GetMenu(hDlg),uIDCheckItem,*bCheck ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(GetMenu(hDlg),uIDCheckItem,*bCheck ? MF_CHECKED : MF_UNCHECKED);
return 0; return 0;
} }
@ -1168,15 +1168,15 @@ static BOOL OnStackPush(HWND hDlg)
TCHAR szBuffer[] = _T("00000"); TCHAR szBuffer[] = _T("00000");
DWORD dwAddr; DWORD dwAddr;
HWND hWnd; HWND hWnd;
INT i,j; UINT i,j;
if (nDbgState != DBG_STEPINTO) // not in single step mode if (nDbgState != DBG_STEPINTO) // not in single step mode
return TRUE; return TRUE;
hWnd = GetDlgItem(hDlg,IDC_DEBUG_STACK); hWnd = GetDlgItem(hDlg,IDC_DEBUG_STACK);
i = (INT) SendMessage(hWnd,LB_GETCURSEL,0,0); i = (UINT) SendMessage(hWnd,LB_GETCURSEL,0,0);
if (LB_ERR == i) return TRUE; // no selection if (LB_ERR == (INT) i) return TRUE; // no selection
if (IDOK != OnNewValue(szBuffer)) // canceled function if (IDOK != OnNewValue(szBuffer)) // canceled function
return TRUE; return TRUE;
@ -1200,15 +1200,15 @@ static BOOL OnStackPush(HWND hDlg)
static BOOL OnStackPop(HWND hDlg) static BOOL OnStackPop(HWND hDlg)
{ {
HWND hWnd; HWND hWnd;
INT i,j; UINT i,j;
if (nDbgState != DBG_STEPINTO) // not in single step mode if (nDbgState != DBG_STEPINTO) // not in single step mode
return TRUE; return TRUE;
hWnd = GetDlgItem(hDlg,IDC_DEBUG_STACK); hWnd = GetDlgItem(hDlg,IDC_DEBUG_STACK);
i = (INT) SendMessage(hWnd,LB_GETCURSEL,0,0); i = (UINT) SendMessage(hWnd,LB_GETCURSEL,0,0);
if (LB_ERR == i) return TRUE; // no selection if (LB_ERR == (INT) i) return TRUE; // no selection
// pop stack element // pop stack element
for (j = i + 1; j < ARRAYSIZEOF(Chipset.rstk); ++j) for (j = i + 1; j < ARRAYSIZEOF(Chipset.rstk); ++j)
@ -1263,7 +1263,7 @@ static BOOL OnLButtonUp(HWND hDlg, LPARAM lParam)
// handle of selected window // handle of selected window
hWnd = ChildWindowFromPointEx(hDlg,pt,CWP_SKIPDISABLED); hWnd = ChildWindowFromPointEx(hDlg,pt,CWP_SKIPDISABLED);
nId = GetDlgCtrlID(hWnd); // control ID of window nId = GetDlgCtrlID(hWnd); // control ID of window
GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer)); GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer));
switch (nId) switch (nId)
@ -1324,11 +1324,11 @@ static BOOL OnLButtonUp(HWND hDlg, LPARAM lParam)
break; break;
case IDC_REG_OUT: // OUT case IDC_REG_OUT: // OUT
OnNewValue(&szBuffer[4]); OnNewValue(&szBuffer[4]);
_stscanf(&szBuffer[4],_T("%3X"),&Chipset.out); Chipset.out = (WORD) _tcstoul(&szBuffer[4],NULL,16);
break; break;
case IDC_REG_IN: // IN case IDC_REG_IN: // IN
OnNewValue(&szBuffer[3]); OnNewValue(&szBuffer[3]);
_stscanf(&szBuffer[3],_T("%4X"),&Chipset.in); Chipset.in = (WORD) _tcstoul(&szBuffer[3],NULL,16);
break; break;
case IDC_REG_ST: // ST case IDC_REG_ST: // ST
OnNewValue(&szBuffer[3]); OnNewValue(&szBuffer[3]);
@ -1362,7 +1362,7 @@ static BOOL OnLButtonUp(HWND hDlg, LPARAM lParam)
break; break;
case IDC_MISC_BS: // Bank switcher setting case IDC_MISC_BS: // Bank switcher setting
OnNewValue(szBuffer); OnNewValue(szBuffer);
_stscanf(szBuffer,_T("%2X"),&Chipset.Bank_FF); Chipset.Bank_FF = _tcstoul(szBuffer,NULL,16);
Chipset.Bank_FF &= 0x7F; Chipset.Bank_FF &= 0x7F;
RomSwitch(Chipset.Bank_FF); // update memory mapping RomSwitch(Chipset.Bank_FF); // update memory mapping
@ -1423,6 +1423,7 @@ static BOOL OnDblClick(HWND hWnd, WORD wId)
ViewMemWnd(hDlg,dwAdrMem); // update memory window ViewMemWnd(hDlg,dwAdrMem); // update memory window
SendMessage(hWnd,LB_SETCURSEL,i,0); SendMessage(hWnd,LB_SETCURSEL,i,0);
return FALSE; return FALSE;
return FALSE;
} }
// //
@ -1444,7 +1445,7 @@ static VOID OnContextMenu(HWND hDlg, LPARAM lParam, WPARAM wParam)
pt.y = rc.top + 5; pt.y = rc.top + 5;
} }
nId = GetDlgCtrlID((HWND) wParam); // control ID of window nId = GetDlgCtrlID((HWND) wParam); // control ID of window
switch(nId) switch(nId)
{ {
@ -1499,7 +1500,7 @@ static __inline BOOL OnKeyRightLeft(HWND hWnd, WPARAM wParam)
WORD wX; WORD wX;
INT nId; INT nId;
nId = GetDlgCtrlID(hWnd); // control ID of window nId = GetDlgCtrlID(hWnd); // control ID of window
for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's
if (nCol[wX] == nId) // found ID if (nCol[wX] == nId) // found ID
@ -1522,10 +1523,10 @@ static __inline BOOL OnKeyRightLeft(HWND hWnd, WPARAM wParam)
// //
static __inline BOOL OnKeyUpDown(HWND hWnd, WPARAM wParam) static __inline BOOL OnKeyUpDown(HWND hWnd, WPARAM wParam)
{ {
INT wX, wY; INT wX, wY;
INT nId; INT nId;
nId = GetDlgCtrlID(hWnd); // control ID of window nId = GetDlgCtrlID(hWnd); // control ID of window
for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's
if (nCol[wX] == nId) // found ID if (nCol[wX] == nId) // found ID
@ -1577,10 +1578,10 @@ static __inline BOOL OnKeyUpDown(HWND hWnd, WPARAM wParam)
// //
static __inline BOOL OnKeyPlusMinus(HWND hWnd, WPARAM wParam) static __inline BOOL OnKeyPlusMinus(HWND hWnd, WPARAM wParam)
{ {
INT wX, wY; INT wX, wY;
INT nId; INT nId;
nId = GetDlgCtrlID(hWnd); // control ID of window nId = GetDlgCtrlID(hWnd); // control ID of window
for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's
if (nCol[wX] == nId) // found ID if (nCol[wX] == nId) // found ID
@ -1873,6 +1874,7 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM
// add Settings item to sysmenu // add Settings item to sysmenu
_ASSERT((IDM_DEBUG_SETTINGS & 0xFFF0) == IDM_DEBUG_SETTINGS); _ASSERT((IDM_DEBUG_SETTINGS & 0xFFF0) == IDM_DEBUG_SETTINGS);
_ASSERT(IDM_DEBUG_SETTINGS < 0xF000); _ASSERT(IDM_DEBUG_SETTINGS < 0xF000);
if ((hSysMenu = GetSystemMenu(hDlg,FALSE)) != NULL) if ((hSysMenu = GetSystemMenu(hDlg,FALSE)) != NULL)
{ {
VERIFY(AppendMenu(hSysMenu,MF_SEPARATOR,0,NULL)); VERIFY(AppendMenu(hSysMenu,MF_SEPARATOR,0,NULL));
@ -2059,10 +2061,10 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM
{ {
case VK_F2: return OnKeyF2(hDlg); // toggle breakpoint case VK_F2: return OnKeyF2(hDlg); // toggle breakpoint
case VK_F5: return OnKeyF5(hDlg); // key run case VK_F5: return OnKeyF5(hDlg); // key run
case VK_F6: return OnKeyF6(hDlg); // key step cursor case VK_F6: return OnKeyF6(hDlg); // key step cursor
case VK_F7: return OnKeyF7(hDlg); // key step into case VK_F7: return OnKeyF7(hDlg); // key step into
case VK_F8: return OnKeyF8(hDlg); // key step over case VK_F8: return OnKeyF8(hDlg); // key step over
case VK_F9: return OnKeyF9(hDlg); // key step out case VK_F9: return OnKeyF9(hDlg); // key step out
case VK_F11: return OnKeyF11(hDlg); // key break case VK_F11: return OnKeyF11(hDlg); // key break
} }
@ -2120,7 +2122,7 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM
case WM_NOTIFY: case WM_NOTIFY:
// tooltip for toolbar // tooltip for toolbar
if (((LPNMHDR) lParam)->code == TTN_GETDISPINFO) if(((LPNMHDR) lParam)->code == TTN_GETDISPINFO)
{ {
((LPTOOLTIPTEXT) lParam)->hinst = hApp; ((LPTOOLTIPTEXT) lParam)->hinst = hApp;
((LPTOOLTIPTEXT) lParam)->lpszText = MAKEINTRESOURCE(((LPTOOLTIPTEXT) lParam)->hdr.idFrom); ((LPTOOLTIPTEXT) lParam)->lpszText = MAKEINTRESOURCE(((LPTOOLTIPTEXT) lParam)->hdr.idFrom);
@ -2357,7 +2359,7 @@ static VOID UpdateProfileWnd(HWND hDlg)
QWORD lVar; QWORD lVar;
TCHAR szBuffer[64]; TCHAR szBuffer[64];
INT i; UINT i;
DWORD dwFreq, dwEndFreq; DWORD dwFreq, dwEndFreq;
if (hDlg == NULL) return; // dialog not open if (hDlg == NULL) return; // dialog not open
@ -2379,10 +2381,9 @@ static VOID UpdateProfileWnd(HWND hDlg)
} }
dwEndFreq = ((999 * 2 - 1) * dwFreq) / (2 * 1000); dwEndFreq = ((999 * 2 - 1) * dwFreq) / (2 * 1000);
// search for unit // search for ENG unit
for (i = 0; i < ARRAYSIZEOF(pcUnit) - 1; ++i) for (i = 0; i < ARRAYSIZEOF(pcUnit) - 1 && lVar <= dwEndFreq; ++i)
{ {
if (lVar > dwEndFreq) break; // found ENG unit
lVar *= 1000; // next ENG unit lVar *= 1000; // next ENG unit
} }
@ -2858,7 +2859,7 @@ static VOID OnEnterAddress(HWND hDlg, DWORD *dwValue)
static INT_PTR CALLBACK EnterBreakpoint(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK EnterBreakpoint(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
static BP_T *sBp; static BP_T *sBp;
DWORD dwAddr; DWORD dwAddr;
switch (message) switch (message)
@ -2982,8 +2983,8 @@ static BOOL ToggleBreakpointItem(HWND hWnd, INT nItem)
// //
static VOID DrawBreakpoint(HWND hWnd, INT i) static VOID DrawBreakpoint(HWND hWnd, INT i)
{ {
TCHAR *szText,szBuffer[32]; TCHAR *szText,szBuffer[32];
INT nItem; LPARAM nItem;
switch(sBreakpoint[i].nType) switch(sBreakpoint[i].nType)
{ {
@ -3019,11 +3020,11 @@ static INT_PTR CALLBACK EditBreakpoint(HWND hDlg, UINT message, WPARAM wParam, L
{ {
TEXTMETRIC tm; TEXTMETRIC tm;
HWND hWnd; HWND hWnd;
HDC hDC; HDC hDC;
HFONT hFont; HFONT hFont;
BP_T sBp; BP_T sBp;
INT i,nItem; INT i,nItem;
switch (message) switch (message)
{ {
@ -3149,7 +3150,7 @@ static INT_PTR CALLBACK EditBreakpoint(HWND hDlg, UINT message, WPARAM wParam, L
} }
case WM_VKEYTOITEM: case WM_VKEYTOITEM:
if (LOWORD(wParam) == VK_SPACE) if(LOWORD(wParam) == VK_SPACE)
{ {
hWnd = GetDlgItem(hDlg,IDC_BREAKEDIT_WND); hWnd = GetDlgItem(hDlg,IDC_BREAKEDIT_WND);
for (nItem = 0; nItem < wBreakpointCount; ++nItem) for (nItem = 0; nItem < wBreakpointCount; ++nItem)
@ -3277,7 +3278,7 @@ static BOOL OnInfoIntr(HWND hDlg)
// //
// view write only I/O registers // view write only I/O registers
// //
static BOOL CALLBACK InfoWoRegister(HWND hDlg, UINT message, DWORD wParam, LONG lParam) static INT_PTR CALLBACK InfoWoRegister(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
TCHAR szBuffer[8]; TCHAR szBuffer[8];

View file

@ -39,7 +39,7 @@ static CONST MODEL_MAP_T MemMap[] =
{ {
'6', // HP38G (64K) '6', // HP38G (64K)
&pbyRom, &dwRomSize, // ROM &pbyRom, &dwRomSize, // ROM
&Port0, &Chipset.Port0Size, // RAM &Port0, &Chipset.Port0Size, // RAM
&pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL, // nc.
&pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL, // nc.
&pbyNoMEM, NULL // nc. &pbyNoMEM, NULL // nc.
@ -47,7 +47,7 @@ static CONST MODEL_MAP_T MemMap[] =
{ {
'A', // HP38G 'A', // HP38G
&pbyRom, &dwRomSize, // ROM &pbyRom, &dwRomSize, // ROM
&Port0, &Chipset.Port0Size, // RAM &Port0, &Chipset.Port0Size, // RAM
&pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL, // nc.
&pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL, // nc.
&pbyNoMEM, NULL // nc. &pbyNoMEM, NULL // nc.
@ -58,21 +58,21 @@ static CONST MODEL_MAP_T MemMap[] =
&Port0, &Chipset.Port0Size, // RAM part 1 &Port0, &Chipset.Port0Size, // RAM part 1
&pbyNoMEM, NULL, // BS &pbyNoMEM, NULL, // BS
&pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL, // nc.
&Port2, &Chipset.Port2Size // RAM part 2 &Port2, &Chipset.Port2Size // RAM part 2
}, },
{ {
'G', // HP48GX 'G', // HP48GX
&pbyRom, &dwRomSize, // ROM &pbyRom, &dwRomSize, // ROM
&Port0, &Chipset.Port0Size, // RAM &Port0, &Chipset.Port0Size, // RAM
&pbyNoMEM, NULL, // BS &pbyNoMEM, NULL, // BS
&Port1, &Chipset.Port1Size, // Card slot 1 &Port1, &Chipset.Port1Size, // Card slot 1
&pbyPort2, &dwPort2Size // Card slot 2 &pbyPort2, &dwPort2Size // Card slot 2
}, },
{ {
'S', // HP48SX 'S', // HP48SX
&pbyRom, &dwRomSize, // ROM &pbyRom, &dwRomSize, // ROM
&Port0, &Chipset.Port0Size, // RAM &Port0, &Chipset.Port0Size, // RAM
&Port1, &Chipset.Port1Size, // Card slot 1 &Port1, &Chipset.Port1Size, // Card slot 1
&pbyPort2, &dwPort2Size, // Card slot 2 &pbyPort2, &dwPort2Size, // Card slot 2
&pbyNoMEM, NULL // nc. &pbyNoMEM, NULL // nc.
}, },

View file

@ -15,9 +15,8 @@
// #define DEBUG_DISPLAY // switch for DISPLAY debug purpose // #define DEBUG_DISPLAY // switch for DISPLAY debug purpose
#define NOCOLORSGRAY 8 // no. of colors in gray scale mode #define NOCOLORSGRAY 8
#define NOCOLORSBW 2 // no. of colors in black and white mode #define NOCOLORSBW 2
#define B 0x00000000 // black #define B 0x00000000 // black
#define W 0x00FFFFFF // white #define W 0x00FFFFFF // white
@ -43,7 +42,7 @@ UINT nLcdZoom = 1;
HDC hLcdDC = NULL; HDC hLcdDC = NULL;
HDC hMainDC = NULL; HDC hMainDC = NULL;
static LPBYTE pbyLcd; static LPBYTE pbyLcd;
static HBITMAP hLcdBitmap; static HBITMAP hLcdBitmap;
static HBITMAP hMainBitmap; static HBITMAP hMainBitmap;
@ -64,7 +63,7 @@ static DWORD dwKMLColor[64] = // color table loaded by KML script
static struct static struct
{ {
BITMAPINFOHEADER Lcd_bmih; BITMAPINFOHEADER Lcd_bmih;
RGBQUAD bmiColors[NOCOLORSGRAY]; RGBQUAD bmiColors[NOCOLORSGRAY];
} bmiLcd = } bmiLcd =
{ {
{0x28,0/*x*/,0/*y*/,1,8,BI_RGB,0,0,0,NOCOLORSGRAY,0} {0x28,0/*x*/,0/*y*/,1,8,BI_RGB,0,0,0,NOCOLORSGRAY,0}
@ -152,8 +151,8 @@ VOID DestroyLcdBitmap(VOID)
{ {
// set contrast palette to startup colors // set contrast palette to startup colors
WORD i = 0; dwKMLColor[i++] = W; WORD i = 0; dwKMLColor[i++] = W;
while (i < 32) dwKMLColor[i++] = B; while(i < 32) dwKMLColor[i++] = B;
while (i < 64) dwKMLColor[i++] = I; while(i < 64) dwKMLColor[i++] = I;
if (hLcdDC != NULL) if (hLcdDC != NULL)
{ {
@ -290,8 +289,8 @@ VOID UpdateMainDisplay(VOID)
VOID UpdateMenuDisplay(VOID) VOID UpdateMenuDisplay(VOID)
{ {
UINT x, y; UINT x, y;
BYTE *p; BYTE *p;
DWORD d = Chipset.start2; DWORD d = Chipset.start2;
#if defined DEBUG_DISPLAY #if defined DEBUG_DISPLAY
@ -541,7 +540,7 @@ VOID ResizeWindow(VOID)
AdjustWindowRect(&rectWindow, AdjustWindowRect(&rectWindow,
(DWORD) GetWindowLongPtr(hWnd,GWL_STYLE), (DWORD) GetWindowLongPtr(hWnd,GWL_STYLE),
GetMenu(hWnd) != NULL); GetMenu(hWnd) != NULL || IsRectEmpty(&rectWindow));
SetWindowPos(hWnd, bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, SetWindowPos(hWnd, bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0,
rectWindow.right - rectWindow.left, rectWindow.right - rectWindow.left,
rectWindow.bottom - rectWindow.top, rectWindow.bottom - rectWindow.top,

View file

@ -13,7 +13,7 @@
#include "kml.h" #include "kml.h"
#include "debugger.h" #include "debugger.h"
#define VERSION "1.55+" #define VERSION "1.56+"
#ifdef _DEBUG #ifdef _DEBUG
LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug"); LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug");
@ -35,9 +35,9 @@ static const LPCTSTR szLicence =
_T("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r\n") _T("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r\n")
_T("See the GNU General Public License for more details.\r\n") _T("See the GNU General Public License for more details.\r\n")
_T("\r\n") _T("\r\n")
_T("You should have received a copy of the GNU General Public License\r\n") _T("You should have received a copy of the GNU General Public License along\r\n")
_T("along with this program; if not, write to the Free Software Foundation,\r\n") _T("with this program; if not, write to the Free Software Foundation, Inc.,\r\n")
_T("Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"); _T("51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.");
static BOOL bOwnCursor = FALSE; static BOOL bOwnCursor = FALSE;
static BOOL bTitleBar = TRUE; static BOOL bTitleBar = TRUE;
@ -394,7 +394,7 @@ static VOID SetCommList(HWND hDlg,LPCTSTR szWireSetting,LPCTSTR szIrSetting)
// test if COM port is valid // test if COM port is valid
hComm = CreateFile(szBuffer,GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL); hComm = CreateFile(szBuffer,GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
if (hComm != INVALID_HANDLE_VALUE) if(hComm != INVALID_HANDLE_VALUE)
{ {
VERIFY(CloseHandle(hComm)); VERIFY(CloseHandle(hComm));
bAddWire = bAddIr = TRUE; bAddWire = bAddIr = TRUE;
@ -423,7 +423,7 @@ static VOID SetCommList(HWND hDlg,LPCTSTR szWireSetting,LPCTSTR szIrSetting)
return; return;
} }
static BOOL CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG lParam) static INT_PTR CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
HWND hWndInsertAfter; HWND hWndInsertAfter;
@ -496,7 +496,7 @@ static BOOL CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, DWORD wParam, LON
UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(wParam);
} }
static BOOL CALLBACK SettingsMemoryProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG lParam) static INT_PTR CALLBACK SettingsMemoryProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
LPCTSTR szActPort2Filename = _T(""); LPCTSTR szActPort2Filename = _T("");
@ -594,9 +594,9 @@ static BOOL CALLBACK SettingsMemoryProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG
&& (Chipset.IORam[CARDCTL] & ECDT) != 0 && (Chipset.IORam[TIMER2_CTRL] & RUN) != 0 && (Chipset.IORam[CARDCTL] & ECDT) != 0 && (Chipset.IORam[TIMER2_CTRL] & RUN) != 0
) )
{ {
Chipset.HST |= MP; // set Module Pulled Chipset.HST |= MP; // set Module Pulled
IOBit(SRQ2,NINT,FALSE); // set NINT to low IOBit(SRQ2,NINT,FALSE); // set NINT to low
Chipset.SoftInt = TRUE; // set interrupt Chipset.SoftInt = TRUE; // set interrupt
bInterrupt = TRUE; bInterrupt = TRUE;
} }
SwitchToState(nOldState); SwitchToState(nOldState);
@ -686,7 +686,7 @@ static BOOL CALLBACK SettingsMemoryProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG
return FALSE; return FALSE;
} }
static BOOL CALLBACK SettingsPeripheralProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG lParam) static INT_PTR CALLBACK SettingsPeripheralProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
TCHAR cPort[8]; TCHAR cPort[8];
LONG i; LONG i;
@ -893,6 +893,8 @@ static LRESULT OnPaint(HWND hWindow)
PAINTSTRUCT Paint; PAINTSTRUCT Paint;
HDC hPaintDC; HDC hPaintDC;
UpdateWindowBars(); // update visibility of title and menu bar
hPaintDC = BeginPaint(hWindow, &Paint); hPaintDC = BeginPaint(hWindow, &Paint);
if (hMainDC != NULL) if (hMainDC != NULL)
{ {
@ -967,7 +969,7 @@ static LRESULT OnInitMenu(HMENU hMenu)
EnableMenuItem(hMenu,ID_TOOL_MACRO_RECORD,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(hMenu,ID_TOOL_MACRO_RECORD,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(hMenu,ID_TOOL_MACRO_PLAY,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(hMenu,ID_TOOL_MACRO_PLAY,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(hMenu,ID_TOOL_MACRO_STOP,(bRun && nMacroState != MACRO_OFF) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(hMenu,ID_TOOL_MACRO_STOP,(bRun && nMacroState != MACRO_OFF) ? MF_ENABLED : MF_GRAYED);
MruUpdateMenu(hMenu); // update MRU list MruUpdateMenu(hMenu); // update MRU list
return 0; return 0;
} }
@ -979,7 +981,7 @@ static LRESULT OnDropFiles(HDROP hFilesInfo)
{ {
TCHAR szFileName[MAX_PATH]; TCHAR szFileName[MAX_PATH];
WORD wNumFiles,wIndex; WORD wNumFiles,wIndex;
BOOL bSuccess = FALSE; BOOL bSuccess;
// get number of files dropped // get number of files dropped
wNumFiles = DragQueryFile (hFilesInfo,(UINT)-1,NULL,0); wNumFiles = DragQueryFile (hFilesInfo,(UINT)-1,NULL,0);
@ -1028,7 +1030,7 @@ static LRESULT OnDropFiles(HDROP hFilesInfo)
Sleep(dwWakeupDelay); Sleep(dwWakeupDelay);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
// wait for sleep mode // wait for sleep mode
while (Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);
cancel: cancel:
bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control
@ -1327,7 +1329,7 @@ static LRESULT OnViewSettings(VOID)
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_SET_GENERAL); psp[0].pszTemplate = MAKEINTRESOURCE(IDD_SET_GENERAL);
psp[0].hIcon = NULL; psp[0].hIcon = NULL;
psp[0].pszTitle = NULL; psp[0].pszTitle = NULL;
psp[0].pfnDlgProc = (DLGPROC) SettingsGeneralProc; psp[0].pfnDlgProc = SettingsGeneralProc;
psp[0].lParam = 0; psp[0].lParam = 0;
psp[0].pfnCallback = NULL; psp[0].pfnCallback = NULL;
@ -1337,7 +1339,7 @@ static LRESULT OnViewSettings(VOID)
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_SET_MEMORY); psp[1].pszTemplate = MAKEINTRESOURCE(IDD_SET_MEMORY);
psp[1].hIcon = NULL; psp[1].hIcon = NULL;
psp[1].pszTitle = NULL; psp[1].pszTitle = NULL;
psp[1].pfnDlgProc = (DLGPROC) SettingsMemoryProc; psp[1].pfnDlgProc = SettingsMemoryProc;
psp[1].lParam = 0; psp[1].lParam = 0;
psp[1].pfnCallback = NULL; psp[1].pfnCallback = NULL;
@ -1347,7 +1349,7 @@ static LRESULT OnViewSettings(VOID)
psp[2].pszTemplate = MAKEINTRESOURCE(IDD_SET_PERIPHERAL); psp[2].pszTemplate = MAKEINTRESOURCE(IDD_SET_PERIPHERAL);
psp[2].hIcon = NULL; psp[2].hIcon = NULL;
psp[2].pszTitle = NULL; psp[2].pszTitle = NULL;
psp[2].pfnDlgProc = (DLGPROC) SettingsPeripheralProc; psp[2].pfnDlgProc = SettingsPeripheralProc;
psp[2].lParam = 0; psp[2].lParam = 0;
psp[2].pfnCallback = NULL; psp[2].pfnCallback = NULL;
@ -1489,7 +1491,7 @@ static LRESULT OnObjectLoad(VOID)
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
// wait for sleep mode // wait for sleep mode
while (Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);
} }
if (nState != SM_RUN) if (nState != SM_RUN)
@ -1544,7 +1546,7 @@ static LRESULT OnObjectLoad(VOID)
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(dwWakeupDelay); Sleep(dwWakeupDelay);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
while (Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);
cancel: cancel:
bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control
@ -1735,7 +1737,7 @@ static LRESULT OnToolDisasm(VOID) // disasm dialogbox call
{ {
if (pbyRom) SwitchToState(SM_SLEEP); if (pbyRom) SwitchToState(SM_SLEEP);
if (DialogBox(hApp, MAKEINTRESOURCE(IDD_DISASM), hWnd, (DLGPROC)Disasm) == -1) if (DialogBox(hApp, MAKEINTRESOURCE(IDD_DISASM), hWnd, (DLGPROC)Disasm) == -1)
AbortMessage(_T("Disassembler Dialog Box Creation Error!")); AbortMessage(_T("Disassembler Dialog Box Creation Error !"));
if (pbyRom) SwitchToState(SM_RUN); if (pbyRom) SwitchToState(SM_RUN);
return 0; return 0;
} }
@ -1743,7 +1745,7 @@ static LRESULT OnToolDisasm(VOID) // disasm dialogbox call
static LRESULT OnAbout(VOID) static LRESULT OnAbout(VOID)
{ {
if (DialogBox(hApp, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)About) == -1) if (DialogBox(hApp, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)About) == -1)
AbortMessage(_T("About Dialog Box Creation Error!")); AbortMessage(_T("About Dialog Box Creation Error !"));
return 0; return 0;
} }
@ -2002,8 +2004,8 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_LBUTTONUP: return OnLButtonUp((UINT) wParam, LOWORD(lParam), HIWORD(lParam)); case WM_LBUTTONUP: return OnLButtonUp((UINT) wParam, LOWORD(lParam), HIWORD(lParam));
case WM_MOUSEMOVE: return OnMouseMove((UINT) wParam, LOWORD(lParam), HIWORD(lParam)); case WM_MOUSEMOVE: return OnMouseMove((UINT) wParam, LOWORD(lParam), HIWORD(lParam));
case WM_NCMOUSEMOVE: return OnNcMouseMove((UINT) wParam, LOWORD(lParam), HIWORD(lParam)); case WM_NCMOUSEMOVE: return OnNcMouseMove((UINT) wParam, LOWORD(lParam), HIWORD(lParam));
case WM_KEYUP: return OnKeyUp((int) wParam, lParam); case WM_KEYUP: return OnKeyUp((int)wParam, lParam);
case WM_KEYDOWN: return OnKeyDown((int) wParam, lParam); case WM_KEYDOWN: return OnKeyDown((int)wParam, lParam);
#if !defined _USRDLL // not in DLL version #if !defined _USRDLL // not in DLL version
case WM_COPYDATA: return OnCopyData((PCOPYDATASTRUCT) lParam); case WM_COPYDATA: return OnCopyData((PCOPYDATASTRUCT) lParam);
#endif #endif
@ -2123,10 +2125,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
rectWindow.top = 0; rectWindow.top = 0;
rectWindow.right = 256; rectWindow.right = 256;
rectWindow.bottom = 0; rectWindow.bottom = 0;
AdjustWindowRect(&rectWindow, STYLE_TITLE, TRUE); AdjustWindowRect(&rectWindow, WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED, TRUE);
hWnd = CreateWindow(MAKEINTATOM(classAtom),_T("Emu48"), hWnd = CreateWindow(MAKEINTATOM(classAtom),_T("Emu48"),
STYLE_TITLE, WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
rectWindow.right - rectWindow.left, rectWindow.right - rectWindow.left,
rectWindow.bottom - rectWindow.top, rectWindow.bottom - rectWindow.top,
@ -2240,11 +2242,11 @@ start:
while (GetMessage(&msg, NULL, 0, 0)) while (GetMessage(&msg, NULL, 0, 0))
{ {
if ( !TranslateAccelerator(hWnd, hAccel, &msg) if( !TranslateAccelerator(hWnd, hAccel, &msg)
&& (hDlgDebug == NULL || !IsDialogMessage(hDlgDebug, &msg)) && (hDlgDebug == NULL || !IsDialogMessage(hDlgDebug, &msg))
&& (hDlgFind == NULL || !IsDialogMessage(hDlgFind, &msg)) && (hDlgFind == NULL || !IsDialogMessage(hDlgFind, &msg))
&& (hDlgProfile == NULL || !IsDialogMessage(hDlgProfile, &msg)) && (hDlgProfile == NULL || !IsDialogMessage(hDlgProfile, &msg))
&& (hDlgRplObjView == NULL || !IsDialogMessage(hDlgRplObjView, &msg))) && (hDlgRplObjView == NULL || !IsDialogMessage(hDlgRplObjView, &msg)))
{ {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);

View file

@ -20,8 +20,8 @@
#define PORT2_PRESENT ((cCurrentRomType=='S')?P2C:P1C) #define PORT2_PRESENT ((cCurrentRomType=='S')?P2C:P1C)
#define PORT2_WRITE ((cCurrentRomType=='S')?P2W:P1W) #define PORT2_WRITE ((cCurrentRomType=='S')?P2W:P1W)
#define BINARYHEADER48 "HPHP48-W" #define BINARYHEADER48 "HPHP48-W"
#define BINARYHEADER49 "HPHP49-W" #define BINARYHEADER49 "HPHP49-W"
#define BIN_FILTER "Port Data File (*.BIN)\0*.BIN\0All Files (*.*)\0*.*\0" #define BIN_FILTER "Port Data File (*.BIN)\0*.BIN\0All Files (*.*)\0*.*\0"
#define HP_FILTER "HP Binary Object (*.HP;*.LIB)\0*.HP;*.LIB\0All Files (*.*)\0*.*\0" #define HP_FILTER "HP Binary Object (*.HP;*.LIB)\0*.HP;*.LIB\0All Files (*.*)\0*.*\0"
@ -36,14 +36,14 @@
#define SM_RETURN 2 #define SM_RETURN 2
#define SM_SLEEP 3 #define SM_SLEEP 3
#define S_ERR_NO 0 // stack errorcodes #define S_ERR_NO 0 // stack errorcodes
#define S_ERR_OBJECT 1 #define S_ERR_OBJECT 1
#define S_ERR_BINARY 2 #define S_ERR_BINARY 2
#define S_ERR_ASCII 3 #define S_ERR_ASCII 3
#define BAD_OB (0xFFFFFFFF) // bad object #define BAD_OB (0xFFFFFFFF) // bad object
#define NO_SERIAL "disabled" // port not open #define NO_SERIAL "disabled" // port not open
#define HP_MNEMONICS FALSE // disassembler mnenomics mode #define HP_MNEMONICS FALSE // disassembler mnenomics mode
#define CLASS_MNEMONICS TRUE #define CLASS_MNEMONICS TRUE
@ -322,8 +322,8 @@ extern VOID WriteIO(BYTE *a, DWORD b, DWORD s);
// Keyboard.c // Keyboard.c
extern DWORD dwKeyMinDelay; extern DWORD dwKeyMinDelay;
extern VOID ScanKeyboard(BOOL bActive, BOOL bReset); extern VOID ScanKeyboard(BOOL bActive, BOOL bReset);
extern VOID KeyboardEvent(BOOL bPress, UINT out, UINT in); extern VOID KeyboardEvent(BOOL bPress, UINT out, UINT in);
// Keymacro.c // Keymacro.c
extern INT nMacroState; extern INT nMacroState;
@ -336,10 +336,10 @@ extern LRESULT OnToolMacroPlay(VOID);
extern LRESULT OnToolMacroStop(VOID); extern LRESULT OnToolMacroStop(VOID);
extern LRESULT OnToolMacroSettings(VOID); extern LRESULT OnToolMacroSettings(VOID);
// Redeye.c // Redeye.c
extern VOID IrPrinter(BYTE c); extern VOID IrPrinter(BYTE c);
// Udp.c // Udp.c
extern TCHAR szUdpServer[1024]; extern TCHAR szUdpServer[1024];
extern WORD wUdpPort; extern WORD wUdpPort;
extern VOID ResetUdp(VOID); extern VOID ResetUdp(VOID);

View file

@ -242,7 +242,7 @@ BEGIN
LTEXT "Find &what:",IDC_STATIC,7,9,34,8 LTEXT "Find &what:",IDC_STATIC,7,9,34,8
COMBOBOX IDC_FIND_DATA,46,7,88,41,CBS_DROPDOWN | CBS_AUTOHSCROLL | COMBOBOX IDC_FIND_DATA,46,7,88,41,CBS_DROPDOWN | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
CONTROL "Find &ASCII",IDC_FIND_ASCII,"Button",BS_AUTOCHECKBOX | CONTROL "Find &ASCII",IDC_FIND_ASCII,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,141,9,49,10 WS_TABSTOP,141,9,49,10
PUSHBUTTON "&Previous",IDC_FIND_PREV,6,26,50,14 PUSHBUTTON "&Previous",IDC_FIND_PREV,6,26,50,14
DEFPUSHBUTTON "&Next",IDC_FIND_NEXT,74,26,50,14 DEFPUSHBUTTON "&Next",IDC_FIND_NEXT,74,26,50,14
@ -365,9 +365,9 @@ FONT 8, "MS Sans Serif"
BEGIN BEGIN
LTEXT "Volume",IDC_STATIC,14,21,24,8 LTEXT "Volume",IDC_STATIC,14,21,24,8
CONTROL "Slider1",IDC_SOUND_SLIDER,"msctls_trackbar32", CONTROL "Slider1",IDC_SOUND_SLIDER,"msctls_trackbar32",
TBS_AUTOTICKS | WS_TABSTOP,44,16,118,18 TBS_AUTOTICKS | WS_TABSTOP,44,16,193,18
LTEXT "Device",IDC_STATIC,13,42,24,8 LTEXT "Device",IDC_STATIC,13,42,24,8
COMBOBOX IDC_SOUND_DEVICE,44,40,118,87,CBS_DROPDOWNLIST | COMBOBOX IDC_SOUND_DEVICE,44,40,193,87,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
GROUPBOX "Sound",IDC_STATIC,7,7,237,54 GROUPBOX "Sound",IDC_STATIC,7,7,237,54
LTEXT "IP Address:",IDC_STATIC,14,81,37,8 LTEXT "IP Address:",IDC_STATIC,14,81,37,8
@ -692,8 +692,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,5,0 FILEVERSION 1,5,6,0
PRODUCTVERSION 1,5,5,0 PRODUCTVERSION 1,5,6,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -710,12 +710,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0" VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0" VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
VALUE "FileVersion", "1, 5, 5, 0\0" VALUE "FileVersion", "1, 5, 6, 0\0"
VALUE "InternalName", "Emu48\0" VALUE "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2015\0" VALUE "LegalCopyright", "Copyright © 2015\0"
VALUE "OriginalFilename", "Emu48.exe\0" VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0" VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 5, 5, 0\0" VALUE "ProductVersion", "1, 5, 6, 0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -7,23 +7,23 @@
CFG=Emu48 - Win32 DebugRegDebug4x CFG=Emu48 - Win32 DebugRegDebug4x
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "Emu48.mak". !MESSAGE NMAKE /f "Emu48.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "Emu48.mak" CFG="Emu48 - Win32 DebugRegDebug4x" !MESSAGE NMAKE /f "Emu48.mak" CFG="Emu48 - Win32 DebugRegDebug4x"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "Emu48 - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Emu48 - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "Emu48 - Win32 Release Unicode" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Release Unicode" (based on "Win32 (x86) Application")
!MESSAGE "Emu48 - Win32 Debug Unicode" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Debug Unicode" (based on "Win32 (x86) Application")
!MESSAGE "Emu48 - Win32 DebugRegDebug4x" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 DebugRegDebug4x" (based on "Win32 (x86) Application")
!MESSAGE "Emu48 - Win32 ReleaseRegDebug4x" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 ReleaseRegDebug4x" (based on "Win32 (x86) Application")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
@ -37,13 +37,13 @@ RSC=rc.exe
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release" # PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir ".\Release" # PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release" # PROP Output_Dir "Release"
# PROP Intermediate_Dir ".\Release" # PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
@ -63,13 +63,13 @@ LINK32=link.exe
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug" # PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir ".\Debug" # PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug" # PROP Output_Dir "Debug"
# PROP Intermediate_Dir ".\Debug" # PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
@ -89,14 +89,14 @@ LINK32=link.exe
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Emu48___" # PROP BASE Output_Dir "ReleaseUnicode"
# PROP BASE Intermediate_Dir "Emu48___" # PROP BASE Intermediate_Dir "ReleaseUnicode"
# PROP BASE Ignore_Export_Lib 0 # PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\ReleaseUnicode" # PROP Output_Dir "ReleaseUnicode"
# PROP Intermediate_Dir ".\ReleaseUnicode" # PROP Intermediate_Dir "ReleaseUnicode"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /Yu"pch.h" /FD /c # ADD BASE CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /Yu"pch.h" /FD /c
@ -116,14 +116,14 @@ LINK32=link.exe
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Emu48__0" # PROP BASE Output_Dir "DebugUnicode"
# PROP BASE Intermediate_Dir "Emu48__0" # PROP BASE Intermediate_Dir "DebugUnicode"
# PROP BASE Ignore_Export_Lib 0 # PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\DebugUnicode" # PROP Output_Dir "DebugUnicode"
# PROP Intermediate_Dir ".\DebugUnicode" # PROP Intermediate_Dir "DebugUnicode"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /FR /Yu"pch.h" /FD /c # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /FR /Yu"pch.h" /FD /c
@ -143,14 +143,14 @@ LINK32=link.exe
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1 # PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Emu48___Win32_DebugRegDebug4x" # PROP BASE Output_Dir "DebugRegDebug4x"
# PROP BASE Intermediate_Dir "Emu48___Win32_DebugRegDebug4x" # PROP BASE Intermediate_Dir "DebugRegDebug4x"
# PROP BASE Ignore_Export_Lib 0 # PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\DebugRegDebug4x" # PROP Output_Dir "DebugRegDebug4x"
# PROP Intermediate_Dir ".\DebugRegDebug4x" # PROP Intermediate_Dir "DebugRegDebug4x"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /FR /Yu"pch.h" /FD /c # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /FR /Yu"pch.h" /FD /c
@ -170,14 +170,14 @@ LINK32=link.exe
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Emu48___Win32_ReleaseRegDebug4x" # PROP BASE Output_Dir "ReleaseRegDebug4x"
# PROP BASE Intermediate_Dir "Emu48___Win32_ReleaseRegDebug4x" # PROP BASE Intermediate_Dir "ReleaseRegDebug4x"
# PROP BASE Ignore_Export_Lib 0 # PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\ReleaseRegDebug4x" # PROP Output_Dir "ReleaseRegDebug4x"
# PROP Intermediate_Dir ".\ReleaseRegDebug4x" # PROP Intermediate_Dir "ReleaseRegDebug4x"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /Yu"pch.h" /FD /c # ADD BASE CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /Yu"pch.h" /FD /c
@ -193,7 +193,7 @@ LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib ws2_32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib ws2_32.lib /nologo /subsystem:windows /machine:I386
!ENDIF !ENDIF
# Begin Target # Begin Target

View file

@ -675,7 +675,7 @@ BOOL MapPort2(LPCTSTR szFilename)
dwFileSizeLo = GetFileSize(hPort2File, &dwFileSizeHi); dwFileSizeLo = GetFileSize(hPort2File, &dwFileSizeHi);
// size not 32, 128, 256, 512, 1024, 2048 or 4096 KB // size not 32, 128, 256, 512, 1024, 2048 or 4096 KB
if ( dwFileSizeHi != 0 if ( dwFileSizeHi != 0
|| dwFileSizeLo == 0 || dwFileSizeLo == 0
|| (dwFileSizeLo & (dwFileSizeLo - 1)) != 0 || (dwFileSizeLo & (dwFileSizeLo - 1)) != 0
|| (dwFileSizeLo & 0xFF02FFFF) != 0) || (dwFileSizeLo & 0xFF02FFFF) != 0)
@ -873,7 +873,7 @@ restore:
ResetBackup(); ResetBackup();
// HP48SX/GX // HP48SX/GX
if (Chipset.type == 'S' || Chipset.type == 'G') if(Chipset.type == 'S' || Chipset.type == 'G')
{ {
// use 2nd command line argument if defined // use 2nd command line argument if defined
MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]); MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]);
@ -1060,7 +1060,7 @@ BOOL OpenDocument(LPCTSTR szFilename)
} }
// HP48SX/GX // HP48SX/GX
if (cCurrentRomType=='S' || cCurrentRomType=='G') if(cCurrentRomType=='S' || cCurrentRomType=='G')
{ {
MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]); MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]);
// port2 changed and card detection enabled // port2 changed and card detection enabled
@ -1097,7 +1097,7 @@ BOOL OpenDocument(LPCTSTR szFilename)
RomSwitch(Chipset.Bank_FF); // reload ROM view of HP49G and map memory RomSwitch(Chipset.Bank_FF); // reload ROM view of HP49G and map memory
if (Chipset.wRomCrc != wRomCrc) // ROM changed if (Chipset.wRomCrc != wRomCrc) // ROM changed
{ {
CpuReset(); CpuReset();
Chipset.Shutdn = FALSE; // automatic restart Chipset.Shutdn = FALSE; // automatic restart
@ -1128,7 +1128,7 @@ restore:
ResetBackup(); ResetBackup();
// HP48SX/GX // HP48SX/GX
if (cCurrentRomType=='S' || cCurrentRomType=='G') if(cCurrentRomType=='S' || cCurrentRomType=='G')
{ {
// use 2nd command line argument if defined // use 2nd command line argument if defined
MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]); MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]);
@ -1732,7 +1732,7 @@ static HBITMAP DecodeBmp(LPBMPFILE pBmp)
else else
{ {
dwFileSize += WIDTHBYTES(pBmi->bmiHeader.biWidth * pBmi->bmiHeader.biBitCount) dwFileSize += WIDTHBYTES(pBmi->bmiHeader.biWidth * pBmi->bmiHeader.biBitCount)
* labs(pBmi->bmiHeader.biHeight); * labs(pBmi->bmiHeader.biHeight);
} }
if (pBmp->dwFileSize < dwFileSize) return NULL; if (pBmp->dwFileSize < dwFileSize) return NULL;
@ -2325,7 +2325,7 @@ HBITMAP LoadBitmapFile(LPCTSTR szFilename)
if ( Bmp.dwFileSize >= 6 if ( Bmp.dwFileSize >= 6
&& (memcmp(Bmp.pbyFile,"GIF87a",6) == 0 || memcmp(Bmp.pbyFile,"GIF89a",6) == 0)) && (memcmp(Bmp.pbyFile,"GIF87a",6) == 0 || memcmp(Bmp.pbyFile,"GIF89a",6) == 0))
{ {
hBitmap = DecodeGif(&Bmp,&dwTColor); hBitmap = DecodeGif(&Bmp,NULL);
break; break;
} }

View file

@ -76,7 +76,6 @@ static CONST KmlToken pLexToken[] =
{TOK_VIRTUAL, 000000, 7,_T("Virtual")}, {TOK_VIRTUAL, 000000, 7,_T("Virtual")},
{TOK_INCLUDE, 000002, 7,_T("Include")}, {TOK_INCLUDE, 000002, 7,_T("Include")},
{TOK_NOTFLAG, 000001, 7,_T("NotFlag")}, {TOK_NOTFLAG, 000001, 7,_T("NotFlag")},
{TOK_MENUBAR, 000001, 7,_T("Menubar")}, // for PPC compatibility reasons
{TOK_GLOBAL, 000000, 6,_T("Global")}, {TOK_GLOBAL, 000000, 6,_T("Global")},
{TOK_AUTHOR, 000002, 6,_T("Author")}, {TOK_AUTHOR, 000002, 6,_T("Author")},
{TOK_BITMAP, 000002, 6,_T("Bitmap")}, {TOK_BITMAP, 000002, 6,_T("Bitmap")},
@ -86,7 +85,6 @@ static CONST KmlToken pLexToken[] =
{TOK_ONDOWN, 000000, 6,_T("OnDown")}, {TOK_ONDOWN, 000000, 6,_T("OnDown")},
{TOK_NOHOLD, 000000, 6,_T("NoHold")}, {TOK_NOHOLD, 000000, 6,_T("NoHold")},
{TOK_LOCALE, 000001, 6,_T("Locale")}, {TOK_LOCALE, 000001, 6,_T("Locale")},
{TOK_TOPBAR, 000001, 6,_T("Topbar")}, // for PPC compatibility reasons
{TOK_TITLE, 000002, 5,_T("Title")}, {TOK_TITLE, 000002, 5,_T("Title")},
{TOK_OUTIN, 000011, 5,_T("OutIn")}, {TOK_OUTIN, 000011, 5,_T("OutIn")},
{TOK_PATCH, 000002, 5,_T("Patch")}, {TOK_PATCH, 000002, 5,_T("Patch")},
@ -105,7 +103,6 @@ static CONST KmlToken pLexToken[] =
{TOK_ONUP, 000000, 4,_T("OnUp")}, {TOK_ONUP, 000000, 4,_T("OnUp")},
{TOK_MAP, 000011, 3,_T("Map")}, {TOK_MAP, 000011, 3,_T("Map")},
{TOK_ROM, 000002, 3,_T("Rom")}, {TOK_ROM, 000002, 3,_T("Rom")},
{TOK_VGA, 000001, 3,_T("Vga")}, // for PPC compatibility reasons
{TOK_LCD, 000000, 3,_T("Lcd")}, {TOK_LCD, 000000, 3,_T("Lcd")},
{TOK_END, 000000, 3,_T("End")}, {TOK_END, 000000, 3,_T("End")},
{TOK_NONE, 000000, 0,_T("")} {TOK_NONE, 000000, 0,_T("")}
@ -1335,8 +1332,7 @@ static KmlLine* InitLcd(KmlBlock* pBlock)
nLcdY = (UINT) pLine->nParam[1]; nLcdY = (UINT) pLine->nParam[1];
break; break;
case TOK_ZOOM: case TOK_ZOOM:
nLcdZoom = (UINT) pLine->nParam[0]; if ((nLcdZoom = (UINT) pLine->nParam[0]) == 0)
if (!(nLcdZoom >= 1 && nLcdZoom <= 4))
nLcdZoom = 1; nLcdZoom = 1;
break; break;
case TOK_COLOR: case TOK_COLOR:
@ -1740,20 +1736,21 @@ static DWORD GetIntegerParam(KmlBlock* pBlock, TokenId eBlock, TokenId eCommand,
//# //#
//################ //################
static INT iSqrt(INT nNumber) // integer y=sqrt(x) function static UINT iSqrt(UINT nNumber) // integer y=sqrt(x) function
{ {
INT m, b = 0, t = nNumber; UINT b, t;
do b = t = nNumber;
if (nNumber > 0)
{ {
m = (b + t + 1) / 2; // median number do
if (m * m - nNumber > 0) // calculate x^2-y {
t = m; // adjust upper border b = t;
else t = (t + nNumber / t) / 2; // Heron's method
b = m; // adjust lower border }
while (t < b);
} }
while (t - b > 1);
return b; return b;
} }

View file

@ -39,29 +39,28 @@ typedef enum eTokenId
TOK_NOHOLD, //23 TOK_NOHOLD, //23
TOK_LOCALE, //24 TOK_LOCALE, //24
TOK_TOPBAR, //25 TOK_TOPBAR, //25
TOK_MENUBAR, //26 TOK_TITLE, //26
TOK_TITLE, //27 TOK_OUTIN, //27
TOK_OUTIN, //28 TOK_PATCH, //28
TOK_PATCH, //29 TOK_PRINT, //29
TOK_PRINT, //30 TOK_DEBUG, //30
TOK_DEBUG, //31 TOK_COLOR, //31
TOK_COLOR, //32 TOK_MODEL, //32
TOK_MODEL, //33 TOK_CLASS, //33
TOK_CLASS, //34 TOK_PRESS, //34
TOK_PRESS, //35 TOK_IFMEM, //35
TOK_IFMEM, //36 TOK_TYPE, //36
TOK_TYPE, //37 TOK_SIZE, //37
TOK_SIZE, //38 TOK_DOWN, //38
TOK_DOWN, //39 TOK_ZOOM, //39
TOK_ZOOM, //40 TOK_ELSE, //40
TOK_ELSE, //41 TOK_ONUP, //41
TOK_ONUP, //42 TOK_EOL, //42
TOK_EOL, //43 TOK_MAP, //43
TOK_MAP, //44 TOK_ROM, //44
TOK_ROM, //45 TOK_VGA, //45
TOK_VGA, //46 TOK_LCD, //46
TOK_LCD, //47 TOK_END //47
TOK_END //48
} TokenId; } TokenId;
#define TYPE_NONE 00 #define TYPE_NONE 00

View file

@ -1,55 +1,55 @@
// //
// PCH.H // PCH.H
// //
#define _WIN32_IE 0x0200 #define _WIN32_IE 0x0200
#define _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#define _WINSOCK_DEPRECATED_NO_WARNINGS #define _WINSOCK_DEPRECATED_NO_WARNINGS
#include <winsock2.h>
#include <windows.h>
#include <tchar.h>
#include <shellapi.h>
#include <commctrl.h>
#include <shlobj.h>
#include <stdlib.h>
#include <malloc.h>
#include <stddef.h>
#include <ctype.h>
#include <stdio.h>
#include <direct.h>
#include <conio.h>
#include <crtdbg.h>
#if !defined VERIFY
#if defined _DEBUG
#define VERIFY(f) _ASSERT(f)
#else // _DEBUG
#define VERIFY(f) ((VOID)(f))
#endif // _DEBUG
#endif // _VERIFY
#if !defined INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif
#if !defined INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif
#include <winsock2.h> #if !defined GWLP_USERDATA
#include <windows.h> #define GWLP_USERDATA GWL_USERDATA
#include <tchar.h> #endif
#include <shellapi.h>
#include <commctrl.h>
#include <shlobj.h>
#include <stdlib.h>
#include <malloc.h>
#include <stddef.h>
#include <ctype.h>
#include <stdio.h>
#include <direct.h>
#include <conio.h>
#include <crtdbg.h>
#if !defined VERIFY
#if defined _DEBUG
#define VERIFY(f) _ASSERT(f)
#else // _DEBUG
#define VERIFY(f) ((VOID)(f))
#endif // _DEBUG
#endif // _VERIFY
#if !defined INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif
#if !defined INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif
#if !defined GWLP_USERDATA
#define GWLP_USERDATA GWL_USERDATA
#endif
#if !defined GCLP_HCURSOR #if !defined GCLP_HCURSOR
#define GCLP_HCURSOR GCL_HCURSOR #define GCLP_HCURSOR GCL_HCURSOR
#endif #endif
#if !defined IDC_HAND // Win2k specific definition #if !defined IDC_HAND // Win2k specific definition
#define IDC_HAND MAKEINTRESOURCE(32649) #define IDC_HAND MAKEINTRESOURCE(32649)
#endif #endif
#if _MSC_VER <= 1200 // missing type definition in the MSVC6.0 SDK and earlier #if _MSC_VER <= 1200 // missing type definition in the MSVC6.0 SDK and earlier
#define SetWindowLongPtr SetWindowLong #define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong #define GetWindowLongPtr GetWindowLong
@ -58,36 +58,36 @@
typedef SIZE_T DWORD_PTR, *PDWORD_PTR; typedef SIZE_T DWORD_PTR, *PDWORD_PTR;
typedef ULONG ULONG_PTR, *PULONG_PTR; typedef ULONG ULONG_PTR, *PULONG_PTR;
typedef LONG LONG_PTR, *PLONG_PTR; typedef LONG LONG_PTR, *PLONG_PTR;
#endif #endif
#if _MSC_VER >= 1400 // valid for VS2005 and later #if _MSC_VER >= 1400 // valid for VS2005 and later
#if defined _M_IX86 #if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\" \ #pragma comment(linker,"/manifestdependency:\" \
type='win32' \ type='win32' \
name='Microsoft.Windows.Common-Controls' \ name='Microsoft.Windows.Common-Controls' \
version='6.0.0.0' processorArchitecture='x86' \ version='6.0.0.0' processorArchitecture='x86' \
publicKeyToken='6595b64144ccf1df' \ publicKeyToken='6595b64144ccf1df' \
language='*'\"") language='*'\"")
#elif defined _M_IA64 #elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\" \ #pragma comment(linker,"/manifestdependency:\" \
type='win32' \ type='win32' \
name='Microsoft.Windows.Common-Controls' \ name='Microsoft.Windows.Common-Controls' \
version='6.0.0.0' processorArchitecture='ia64' \ version='6.0.0.0' processorArchitecture='ia64' \
publicKeyToken='6595b64144ccf1df' \ publicKeyToken='6595b64144ccf1df' \
language='*'\"") language='*'\"")
#elif defined _M_X64 #elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\" \ #pragma comment(linker,"/manifestdependency:\" \
type='win32' \ type='win32' \
name='Microsoft.Windows.Common-Controls' \ name='Microsoft.Windows.Common-Controls' \
version='6.0.0.0' processorArchitecture='amd64' \ version='6.0.0.0' processorArchitecture='amd64' \
publicKeyToken='6595b64144ccf1df' \ publicKeyToken='6595b64144ccf1df' \
language='*'\"") language='*'\"")
#else #else
#pragma comment(linker,"/manifestdependency:\" \ #pragma comment(linker,"/manifestdependency:\" \
type='win32' \ type='win32' \
name='Microsoft.Windows.Common-Controls' \ name='Microsoft.Windows.Common-Controls' \
version='6.0.0.0' processorArchitecture='*' \ version='6.0.0.0' processorArchitecture='*' \
publicKeyToken='6595b64144ccf1df' \ publicKeyToken='6595b64144ccf1df' \
language='*'\"") language='*'\"")
#endif #endif
#endif #endif

View file

@ -12,7 +12,7 @@
#define ERR_CHAR 127 // character for transfer error #define ERR_CHAR 127 // character for transfer error
#define H1 0x78 #define H1 0x78
#define H2 0xE6 #define H2 0xE6
#define H3 0xD5 #define H3 0xD5
#define H4 0x8B #define H4 0x8B

View file

@ -241,12 +241,12 @@
#define ID_FILE_MRU_FILE1 40100 #define ID_FILE_MRU_FILE1 40100
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 132 #define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 40072 #define _APS_NEXT_COMMAND_VALUE 40072
#define _APS_NEXT_CONTROL_VALUE 1136 #define _APS_NEXT_CONTROL_VALUE 1136
#define _APS_NEXT_SYMED_VALUE 109 #define _APS_NEXT_SYMED_VALUE 108
#endif #endif
#endif #endif

View file

@ -113,14 +113,14 @@ BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort)
_tcscat(szDevice,strPort); // device name _tcscat(szDevice,strPort); // device name
hComm = CreateFile(szDevice, hComm = CreateFile(szDevice,
GENERIC_READ | GENERIC_WRITE, GENERIC_READ | GENERIC_WRITE,
0, 0,
NULL, NULL,
OPEN_EXISTING, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL); NULL);
if (hComm != INVALID_HANDLE_VALUE) if(hComm != INVALID_HANDLE_VALUE)
{ {
DWORD dwThreadId; DWORD dwThreadId;
@ -140,7 +140,7 @@ BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort)
hCThreadTxd = CreateThread(NULL,0,&TransmitThread,NULL,CREATE_SUSPENDED,&dwThreadId); hCThreadTxd = CreateThread(NULL,0,&TransmitThread,NULL,CREATE_SUSPENDED,&dwThreadId);
_ASSERT(hCThreadTxd); _ASSERT(hCThreadTxd);
SetThreadPriority(hCThreadTxd,THREAD_PRIORITY_ABOVE_NORMAL); SetThreadPriority(hCThreadTxd,THREAD_PRIORITY_ABOVE_NORMAL);
ResumeThread(hCThreadTxd); // start thread ResumeThread(hCThreadTxd); // start thread
// create Comm event handler // create Comm event handler
bReading = FALSE; bReading = FALSE;
@ -148,7 +148,7 @@ BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort)
hCThreadEv = CreateThread(NULL,0,&EventThread,NULL,CREATE_SUSPENDED,&dwThreadId); hCThreadEv = CreateThread(NULL,0,&EventThread,NULL,CREATE_SUSPENDED,&dwThreadId);
_ASSERT(hCThreadEv); _ASSERT(hCThreadEv);
SetThreadPriority(hCThreadEv,THREAD_PRIORITY_ABOVE_NORMAL); SetThreadPriority(hCThreadEv,THREAD_PRIORITY_ABOVE_NORMAL);
ResumeThread(hCThreadEv); // start thread ResumeThread(hCThreadEv); // start thread
while (!bReading) Sleep(0); // wait for SerialThread started while (!bReading) Sleep(0); // wait for SerialThread started
} }
else else
@ -353,13 +353,13 @@ VOID CommReceive(VOID)
// reject reading if com port is closed and not whole operation // reject reading if com port is closed and not whole operation
if (hComm && dwBytesRead == 0L) // com port open and buffer empty if (hComm && dwBytesRead == 0L) // com port open and buffer empty
{ {
if (ReadFile(hComm,&cBuffer,sizeof(cBuffer),&dwBytesRead,&os) == FALSE) if(ReadFile(hComm,&cBuffer,sizeof(cBuffer),&dwBytesRead,&os) == FALSE)
dwBytesRead = 0L; dwBytesRead = 0L;
else // bytes received else // bytes received
nRp = 0; // reset read pointer nRp = 0; // reset read pointer
} }
if (dwBytesRead == 0L) // receive buffer empty if(dwBytesRead == 0L) // receive buffer empty
break; break;
#if defined DEBUG_SERIAL #if defined DEBUG_SERIAL
@ -379,7 +379,7 @@ VOID CommReceive(VOID)
--dwBytesRead; --dwBytesRead;
Chipset.IORam[RCS] |= RBF; // receive buffer full Chipset.IORam[RCS] |= RBF; // receive buffer full
if (UpdateUSRQ()) // update USRQ bit if(UpdateUSRQ()) // update USRQ bit
INTERRUPT; INTERRUPT;
} }
while(0); while(0);

View file

@ -67,7 +67,7 @@ static VOID ReadReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, LPBYTE lpData, DWORD
0, 0,
KEY_QUERY_VALUE, KEY_QUERY_VALUE,
&hKey); &hKey);
if (retCode == ERROR_SUCCESS) if (retCode == ERROR_SUCCESS)
{ {
retCode = RegQueryValueEx(hKey,lpValueName,NULL,&dwType,lpData,pdwSize); retCode = RegQueryValueEx(hKey,lpValueName,NULL,&dwType,lpData,pdwSize);
RegCloseKey(hKey); RegCloseKey(hKey);
@ -117,7 +117,7 @@ static BOOL DelReg(LPCTSTR lpSubKey, LPCTSTR lpValueName)
0, 0,
KEY_SET_VALUE, KEY_SET_VALUE,
&hKey); &hKey);
if (retCode == ERROR_SUCCESS) if (retCode == ERROR_SUCCESS)
{ {
retCode = RegDeleteValue(hKey,lpValueName); retCode = RegDeleteValue(hKey,lpValueName);
RegCloseKey(hKey); RegCloseKey(hKey);

View file

@ -113,7 +113,7 @@ static __inline INT SetZInt(LPCTSTR cp,LPBYTE pbyNum,INT nSize)
} }
// nStrLen = no. of digits without sign // nStrLen = no. of digits without sign
if (nStrLen >= nSize) // destination buffer too small if (nStrLen >= nSize) // destination buffer too small
return 0; return 0;
nNumSize = nStrLen + 1; // no. of written data nNumSize = nStrLen + 1; // no. of written data
@ -126,7 +126,7 @@ static __inline INT SetZInt(LPCTSTR cp,LPBYTE pbyNum,INT nSize)
if (!((c >= _T('0')) || (c <= _T('9')))) if (!((c >= _T('0')) || (c <= _T('9'))))
return 0; return 0;
c -= _T('0'); c -= _T('0');
*pbyNum++ = (BYTE) c; *pbyNum++ = (BYTE) c;
} }
*pbyNum = bySign; // add sign *pbyNum = bySign; // add sign
@ -296,7 +296,7 @@ static __inline INT SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,
byNum[j] = byNum[j + i]; byNum[j] = byNum[j + i];
} }
if (byNum[1] == 0) // number is 0 if(byNum[1] == 0) // number is 0
{ {
ZeroMemory(pbyNum,nMantLen + nExpLen + 1); ZeroMemory(pbyNum,nMantLen + nExpLen + 1);
return nMantLen + nExpLen + 1; return nMantLen + nExpLen + 1;
@ -326,7 +326,7 @@ static __inline INT SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,
while (*cp >= _T('0') && *cp <= _T('9')) while (*cp >= _T('0') && *cp <= _T('9'))
lExp = lExp * 10 + *cp++ - _T('0'); lExp = lExp * 10 + *cp++ - _T('0');
if (i) lExp = -lExp; if(i) lExp = -lExp;
} }
if (*cp != 0) return 0; if (*cp != 0) return 0;
@ -805,7 +805,7 @@ LRESULT OnStackPaste(VOID) // paste data to stack
} }
} }
} }
while (FALSE); while(FALSE);
GlobalUnlock(hClipObj); GlobalUnlock(hClipObj);
} }
@ -825,7 +825,7 @@ LRESULT OnStackPaste(VOID) // paste data to stack
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
// wait for sleep mode // wait for sleep mode
while (Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);
cancel: cancel:
bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control