2014-10-18: Updated to version 1.56

Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
Gwenhael Le Moine 2024-03-19 23:35:30 +01:00
parent 769c17c88a
commit 625fd3f663
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
30 changed files with 1115 additions and 976 deletions

BIN
EMU48.EXE

Binary file not shown.

BIN
Emu48.exe Executable file

Binary file not shown.

View file

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

View file

@ -1,3 +1,114 @@
Service Pack 56 for Emu48 Version 1.0
DEBUGGER.C
- removed INSTRSIZE definition
- changed function GetAddr(), made function more general by adding
address range check and the ability of decoding a symbolic entry
into an address
- bugfix in function OnSetCursor(), on "Activation follows mouse"
enabled child dialogs lost focus when cursor moved over parent
debugger dialog
- changed function Debugger(), removed initialization of global
variable wInstrSize
- changed function EnterAddr(), changed parameter storage from
static variable to window user data and replaced address decoder
code by GetAddr() function call
- changed function EnterBreakpoint(), replaced address decoder code
by GetAddr() function call and so added decoding a symbolic entry
into an address
- bugfix in function LoadMemData(), forgot to check if file content
fit into Saturn address range, loading now stops also after last
Saturn address written
- changed function SaveMemData(), added assertion for Saturn address
verification
- bugfix in function DebugMemLoad() and DebugMemSave(), adjusted to
new prototype of function GetAddr() and so added checking if the
given addresses are in the Saturn address range because Saturn
read/write functions don't do the range check; this also cause a
change in behavior, on empty address fields the operation fails
and the dialog still remains open
EMU48.C
- changed function SetSoundDeviceList(), replaced "Standard Audio"
device ID from constant to definition
- bugfix in function SettingsGeneralProc(), on "Activation follows
mouse" enabled debugger dialog maybe got focus even if it's not
the last active one
- bugfix in function SettingsPeripheralProc(), restart the sound
engine by calling the clean up and initialization functions now
- changed function OnFileNew(), removed call of function
SaveBackup() which is already a part of function NewDocument()
- changed function OnFileNew(), OnFileOpen(), OnFileMruOpen(),
OnFileSave(), OnFileSaveAs() and OnFileClose(), switched detection
of document is available from variable pbyRom (ROM image loaded)
to variable bDocumentAvail
- changed function OnViewCopy(), removed MONOCHROME source code part
- changed function WinMain(), added sound engine initialization and
clean up
EMU48.RC
- changed version and copyright
ENGINE.C
- initialized variable wInstrSize with size of last instruction
array (the circular buffer can hold (wInstrSize-1) instructions)
- bugfix in function WorkerThread(), moved sound engine
initialization and clean up from SM_RUN state to main function,
this prevents a non responding Saturn CPU emulation when changing
from SM_SLEEP to SM_RUN state during sound engine initialization
FETCH.C
- made typedef of jump table struct constant, so the const keyword
was removed from all references of JMPTAB
- changed function EvalOpcode(), minor code optimization
FILES.C
- bugfix in function PatchRom(), removed limitation that patch file
must have 6 characters minimum, fixed a buffer overflow when end
of patch file consists of white space characters, recalculate
CRC's only on address patch written and return failture on syntax
errors now
PCH.H
- added GWLP_USERDATA, SetWindowLongPtr, GetWindowLongPtr and
LONG_PTR definitions for MSVC6.0 SDK and earlier
SETTINGS.C
- changed function ReadSettings() and WriteSettings(), added item
"LastInstrBufSize" in section [Debugger] in the INI-File
SOUND.C
- bugfix in function DestroyWaveThread(), the WM_QUIT message may
failed and so the sound message thread wasn't shut down
- changed function SoundOpen(), added additional check if the sound
device support the necessary audio format
STACK.C
- added function Trim(), create a trimmed copy of the input string
- added function SetZInt(), contain implementation of prior function
RPL_SetZInt()
- changed function RPL_SetZInt(), wrapper for function SetZInt() to
trim data before decoding
- added function SetBcd(), contain implementation of prior function
RPL_SetBcd()
- changed function RPL_SetBcd(), wrapper for function SetBcd() to
trim data before decoding
- changed function RPL_SetComplex(), create a trimmed working copy
before decoding the outline brackets and because of the changed
function RPL_SetBcd() the real number arguments are accepted with
white spaces around now
- removed disabled function IsRealNumber(), it was more or less
functional compatible with actual modified function RPL_SetBcd()
TIMER.C
- removed UNIX_0_TIME definition
UDP.C
- changed function SendByteUdp(), replaced malloc() by _alloca()
call for UNICODE wchar to char string translation to get rid of
freeing the allocated memory manually
Service Pack 55 for Emu48 Version 1.0
DISMEM.C

View file

@ -20,18 +20,16 @@
#define MAXMEMITEMS 16 // number of address items in a memory window line
#define MAXBREAKPOINTS 256 // max. number of breakpoints
#define REG_START IDC_REG_A // first register in register update table
#define REG_STOP IDC_MISC_BS // last register in register update table
#define REG_START IDC_REG_A // first register in register update table
#define REG_STOP IDC_MISC_BS // last register in register update table
#define REG_SIZE (REG_STOP-REG_START+1) // size of register update table
// assert for register update
#define _ASSERTREG(r) _ASSERT(r >= REG_START && r <= REG_STOP)
#define INSTRSIZE 256 // size of last instruction buffer
#define WM_UPDATE (WM_USER+0x1000) // update debugger dialog box
#define MEMWNDMAX (sizeof(nCol) / sizeof(nCol[0]))
#define MEMWNDMAX (sizeof(nCol) / sizeof(nCol[0]))
#define RT_TOOLBAR MAKEINTRESOURCE(241) // MFC toolbar resource type
@ -158,6 +156,50 @@ static VOID DisableMenuKeys(HWND hDlg)
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
//
@ -1426,7 +1468,8 @@ static BOOL OnSetCursor(HWND hDlg)
// debugger not active but cursor is over debugger window
if (bActFollowsMouse && GetActiveWindow() != hDlg)
{
ForceForegroundWindow(hDlg); // force debugger window to foreground
// force debugger window to foreground
ForceForegroundWindow(GetLastActivePopup(hDlg));
}
return FALSE;
}
@ -1866,8 +1909,7 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM
SendDlgItemMessage(hDlg,IDC_STATIC_MISC, WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),MAKELPARAM(FALSE,0));
// init last instruction circular buffer
pdwInstrArray = (DWORD *) malloc(INSTRSIZE*sizeof(*pdwInstrArray));
wInstrSize = INSTRSIZE; // size of last instruction array
pdwInstrArray = (DWORD *) malloc(wInstrSize*sizeof(*pdwInstrArray));
wInstrWp = wInstrRp = 0; // write/read pointer
// init "Follow" menu entry in debugger "Memory" context menu
@ -2003,10 +2045,10 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM
{
case VK_F2: return OnKeyF2(hDlg); // toggle breakpoint
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_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
}
@ -2749,41 +2791,22 @@ static INT_PTR OnNewValue(LPTSTR lpszValue)
//
static INT_PTR CALLBACK EnterAddr(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static DWORD *pdwAddress;
HWND hWnd;
TCHAR szBuffer[64];
LONG i;
switch (message)
{
case WM_INITDIALOG:
pdwAddress = (DWORD *) lParam;
SetWindowLongPtr(hDlg,GWLP_USERDATA,(LONG_PTR) lParam);
return TRUE;
case WM_COMMAND:
wParam = LOWORD(wParam);
switch(wParam)
{
case IDOK:
hWnd = GetDlgItem(hDlg,IDC_ENTERADR);
GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer));
// if address is not a symbol name decode number
if ( !disassembler_symb || szBuffer[0] != _T('=')
|| RplGetAddr(&szBuffer[1],pdwAddress))
{
// test if valid hex address
for (i = 0; i < (LONG) lstrlen(szBuffer); ++i)
{
if (_istxdigit(szBuffer[i]) == 0)
{
SendMessage(hWnd,EM_SETSEL,0,-1);
SetFocus(hWnd); // focus to edit control
return FALSE;
}
}
if (*szBuffer) _stscanf(szBuffer,_T("%8X"),pdwAddress);
}
if (!GetAddr(hDlg,
IDC_ENTERADR,
(DWORD *) GetWindowLongPtr(hDlg,GWLP_USERDATA),
0xFFFFFFFF,
disassembler_symb))
return FALSE;
// no break
case IDCANCEL:
EndDialog(hDlg,wParam);
@ -2813,10 +2836,8 @@ static VOID OnEnterAddress(HWND hDlg, DWORD *dwValue)
static INT_PTR CALLBACK EnterBreakpoint(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static BP_T *sBp;
HWND hWnd;
TCHAR szBuffer[8];
LONG i;
DWORD dwAddr;
switch (message)
{
@ -2836,19 +2857,9 @@ static INT_PTR CALLBACK EnterBreakpoint(HWND hDlg, UINT message, WPARAM wParam,
case IDC_BPREAD: sBp->nType = BP_READ; return TRUE;
case IDC_BPWRITE: sBp->nType = BP_WRITE; return TRUE;
case IDOK:
hWnd = GetDlgItem(hDlg,IDC_ENTERADR);
GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer));
// test if valid hex address
for (i = 0; i < (LONG) lstrlen(szBuffer); ++i)
{
if (_istxdigit(szBuffer[i]) == 0)
{
SendMessage(hWnd,EM_SETSEL,0,-1);
SetFocus(hWnd);
return FALSE;
}
}
if (*szBuffer) _stscanf(szBuffer,_T("%5X"),&sBp->dwAddr);
if (!GetAddr(hDlg,IDC_ENTERADR,&dwAddr,0xFFFFF,disassembler_symb))
return FALSE;
sBp->dwAddr = dwAddr;
// no break
case IDCANCEL:
EndDialog(hDlg,wParam);
@ -2986,11 +2997,11 @@ static INT_PTR CALLBACK EditBreakpoint(HWND hDlg, UINT message, WPARAM wParam, L
{
TEXTMETRIC tm;
HWND hWnd;
HDC hDC;
HFONT hFont;
BP_T sBp;
INT i,nItem;
HWND hWnd;
HDC hDC;
HFONT hFont;
BP_T sBp;
INT i,nItem;
switch (message)
{
@ -3448,13 +3459,22 @@ static BOOL LoadMemData(LPCTSTR lpszFilename,DWORD dwStartAddr)
if (hFile == INVALID_HANDLE_VALUE) // error, couldn't create a new file
return FALSE;
while (TRUE) // read until EOF
while (dwStartAddr <= 0xFFFFF) // read until EOF or end of Saturn address space
{
ReadFile(hFile,&byData,sizeof(byData),&dwRead,NULL);
if (dwRead == 0) break; // EOF
Write2(dwStartAddr,byData); // write byte in map mode
dwStartAddr += 2;
if (dwStartAddr < 0xFFFFF)
{
Write2(dwStartAddr,byData); // write byte in map mode
dwStartAddr += 2;
}
else // special handling to avoid address wrap around
{
byData &= 0xF;
Nwrite(&byData,dwStartAddr,1); // write nibble in map mode
++dwStartAddr;
}
}
CloseHandle(hFile);
@ -3476,6 +3496,7 @@ static BOOL SaveMemData(LPCTSTR lpszFilename,DWORD dwStartAddr,DWORD dwEndAddr)
for (dwAddr = dwStartAddr; dwAddr <= dwEndAddr; dwAddr += 2)
{
_ASSERT(dwAddr <= 0xFFFFF);
byData = Read2(dwAddr); // read byte in map mode
WriteFile(hFile,&byData,sizeof(byData),&dwWritten,NULL);
}
@ -3484,32 +3505,6 @@ static BOOL SaveMemData(LPCTSTR lpszFilename,DWORD dwStartAddr,DWORD dwEndAddr)
return TRUE;
}
//
// read edit control and decode content as hex number
//
static BOOL GetAddr(HWND hDlg, INT nID, DWORD *pdwAddr)
{
TCHAR szBuffer[8];
INT i;
HWND hWnd = GetDlgItem(hDlg,nID);
GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer));
// test if valid hex address
for (i = 0; i < (LONG) lstrlen(szBuffer); ++i)
{
if (_istxdigit(szBuffer[i]) == 0)
{
SendMessage(hWnd,EM_SETSEL,0,-1);
SetFocus(hWnd); // focus to edit control
return FALSE;
}
}
_stscanf(szBuffer,_T("%6X"),pdwAddr);
return TRUE;
}
//
// memory load data
//
@ -3527,13 +3522,18 @@ static INT_PTR CALLBACK DebugMemLoad(HWND hDlg, UINT message, WPARAM wParam, LPA
return OnBrowseLoadMem(hDlg);
case IDOK:
dwStartAddr = -1; // no address given
// get filename
GetDlgItemText(hDlg,IDC_DEBUG_DATA_FILE,szFilename,ARRAYSIZEOF(szFilename));
// decode address field
if (!GetAddr(hDlg,IDC_DEBUG_DATA_STARTADDR,&dwStartAddr))
if ( !GetAddr(hDlg,IDC_DEBUG_DATA_STARTADDR,&dwStartAddr,0xFFFFF,FALSE)
|| dwStartAddr == -1)
return FALSE;
_ASSERT(dwStartAddr <= 0xFFFFF);
// load memory dump file
if (!LoadMemData(szFilename,dwStartAddr))
return FALSE;
@ -3577,15 +3577,22 @@ static INT_PTR CALLBACK DebugMemSave(HWND hDlg, UINT message, WPARAM wParam, LPA
return OnBrowseSaveMem(hDlg);
case IDOK:
dwStartAddr = dwEndAddr = -1; // no address given
// get filename
GetDlgItemText(hDlg,IDC_DEBUG_DATA_FILE,szFilename,ARRAYSIZEOF(szFilename));
// decode address fields
if (!GetAddr(hDlg,IDC_DEBUG_DATA_STARTADDR,&dwStartAddr))
if ( !GetAddr(hDlg,IDC_DEBUG_DATA_STARTADDR,&dwStartAddr,0xFFFFF,FALSE)
|| dwStartAddr == -1)
return FALSE;
if (!GetAddr(hDlg,IDC_DEBUG_DATA_ENDADDR,&dwEndAddr))
if ( !GetAddr(hDlg,IDC_DEBUG_DATA_ENDADDR,&dwEndAddr,0xFFFFF,FALSE)
|| dwEndAddr == -1)
return FALSE;
_ASSERT(dwStartAddr <= 0xFFFFF);
_ASSERT(dwEndAddr <= 0xFFFFF);
// save memory dump file
if (!SaveMemData(szFilename,dwStartAddr,dwEndAddr))
return FALSE;

View file

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

View file

@ -13,9 +13,7 @@
#include "kml.h"
#include "debugger.h"
#define VERSION "1.55"
// #define MONOCHROME // CF_BITMAP clipboard format
#define VERSION "1.56"
#ifdef _DEBUG
LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug");
@ -222,7 +220,7 @@ static VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID)
// preset selector
uSelectDevice = (UINT) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) _T("Standard Audio"));
SendMessage(hWnd,CB_SETITEMDATA,uSelectDevice,(UINT) -1);
SendMessage(hWnd,CB_SETITEMDATA,uSelectDevice,WAVE_MAPPER);
uDevNo = waveOutGetNumDevs();
for (uDevID = 0; uDevID < uDevNo; ++uDevID)
@ -374,7 +372,7 @@ static BOOL CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, DWORD wParam, LON
SetWindowPos(hWnd,hWndInsertAfter,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
if (hDlgDebug != NULL)
{
SetWindowPos(hDlgDebug,hWndInsertAfter,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos(GetLastActivePopup(hDlgDebug),hWndInsertAfter,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
}
return TRUE;
}
@ -482,9 +480,9 @@ static BOOL CALLBACK SettingsMemoryProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG
&& (Chipset.IORam[CARDCTL] & ECDT) != 0 && (Chipset.IORam[TIMER2_CTRL] & RUN) != 0
)
{
Chipset.HST |= MP; // set Module Pulled
IOBit(SRQ2,NINT,FALSE); // set NINT to low
Chipset.SoftInt = TRUE; // set interrupt
Chipset.HST |= MP; // set Module Pulled
IOBit(SRQ2,NINT,FALSE); // set NINT to low
Chipset.SoftInt = TRUE; // set interrupt
bInterrupt = TRUE;
}
SwitchToState(nOldState);
@ -620,10 +618,17 @@ static BOOL CALLBACK SettingsPeripheralProc(HWND hDlg, UINT uMsg, DWORD wParam,
uDevId = (UINT) SendDlgItemMessage(hDlg,IDC_SOUND_DEVICE,CB_GETITEMDATA,i,0);
if (uWaveDevId != uDevId) // sound device id changed
{
UINT nActState;
uWaveDevId = uDevId; // set new sound device id
nActState = SwitchToState(SM_SLEEP);
// restart sound engine with new device id
SwitchToState(SwitchToState(SM_SLEEP));
SoundClose(); // close waveform-audio output device
SoundOpen(uWaveDevId); // open waveform-audio output device
SwitchToState(nActState);
}
// UDP infrared printer settings
GetDlgItemText(hDlg,IDC_IR_ADDR,szUdpServer,ARRAYSIZEOF(szUdpServer));
@ -913,13 +918,11 @@ cancel:
//
static LRESULT OnFileNew(VOID)
{
if (pbyRom)
if (bDocumentAvail)
{
SwitchToState(SM_INVALID);
if (IDCANCEL == SaveChanges(bAutoSave))
goto cancel;
SaveBackup();
}
if (NewDocument()) SetWindowTitle(_T("Untitled"));
cancel:
@ -932,7 +935,7 @@ cancel:
//
static LRESULT OnFileOpen(VOID)
{
if (pbyRom)
if (bDocumentAvail)
{
SwitchToState(SM_INVALID);
if (IDCANCEL == SaveChanges(bAutoSave))
@ -941,7 +944,7 @@ static LRESULT OnFileOpen(VOID)
if (GetOpenFilename())
{
if (OpenDocument(szBufferFilename))
MruAdd(szCurrentFilename);
MruAdd(szBufferFilename);
}
cancel:
if (pbyRom) SwitchToState(SM_RUN);
@ -959,7 +962,7 @@ static LRESULT OnFileMruOpen(UINT wID)
lpszFilename = MruFilename(wID); // full filename from MRU list
if (lpszFilename == NULL) return 0; // MRU slot not filled
if (pbyRom)
if (bDocumentAvail)
{
SwitchToState(SM_INVALID);
if (IDCANCEL == SaveChanges(bAutoSave))
@ -983,10 +986,12 @@ cancel:
//
static LRESULT OnFileSave(VOID)
{
if (pbyRom == NULL) return 0;
SwitchToState(SM_INVALID);
SaveChanges(TRUE);
SwitchToState(SM_RUN);
if (bDocumentAvail)
{
SwitchToState(SM_INVALID);
SaveChanges(TRUE);
SwitchToState(SM_RUN);
}
return 0;
}
@ -995,16 +1000,16 @@ static LRESULT OnFileSave(VOID)
//
static LRESULT OnFileSaveAs(VOID)
{
if (pbyRom == NULL) return 0;
SwitchToState(SM_INVALID);
if (GetSaveAsFilename())
if (bDocumentAvail)
{
if (SaveDocumentAs(szBufferFilename))
MruAdd(szCurrentFilename);
SwitchToState(SM_INVALID);
if (GetSaveAsFilename())
{
if (SaveDocumentAs(szBufferFilename))
MruAdd(szCurrentFilename);
}
SwitchToState(SM_RUN);
}
SwitchToState(SM_RUN);
return 0;
}
@ -1013,16 +1018,18 @@ static LRESULT OnFileSaveAs(VOID)
//
static LRESULT OnFileClose(VOID)
{
if (pbyRom == NULL) return 0;
SwitchToState(SM_INVALID);
if (SaveChanges(bAutoSave) != IDCANCEL)
if (bDocumentAvail)
{
ResetDocument();
SetWindowTitle(NULL);
}
else
{
SwitchToState(SM_RUN);
SwitchToState(SM_INVALID);
if (SaveChanges(bAutoSave) != IDCANCEL)
{
ResetDocument();
SetWindowTitle(NULL);
}
else
{
SwitchToState(SM_RUN);
}
}
return 0;
}
@ -1053,7 +1060,6 @@ static LRESULT OnViewCopy(VOID)
{
if (EmptyClipboard())
{
#if !defined MONOCHROME
// DIB bitmap
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
#define PALVERSION 0x300
@ -1137,20 +1143,6 @@ static LRESULT OnViewCopy(VOID)
DeleteObject(hBmp);
#undef WIDTHBYTES
#undef PALVERSION
#else
HBITMAP hOldBmp, hBmp;
HDC hBmpDC;
// don't work with background index <> 0
_ASSERT(nLcdZoom == 1 || nLcdZoom == 2 || nLcdZoom == 4);
hBmp = CreateBitmap(131*nLcdZoom,64*nLcdZoom,1,1,NULL);
hBmpDC = CreateCompatibleDC(NULL);
hOldBmp = (HBITMAP)SelectObject(hBmpDC,hBmp);
BitBlt(hBmpDC,0,0,131*nLcdZoom,64*nLcdZoom,hLcdDC,Chipset.boffset*nLcdZoom,0,SRCCOPY);
SetClipboardData(CF_BITMAP,hBmp);
SelectObject(hBmpDC,hOldBmp);
DeleteDC(hBmpDC);
#endif
}
CloseClipboard();
}
@ -1283,7 +1275,7 @@ static LRESULT OnViewScript(VOID)
if (!DisplayChooseKml(cType)) // quit with Cancel
{
if (!bKMLChanged) // KML script not changed
break; // exit loop with current loaded KML script
break; // exit loop with current loaded KML script
// restore KML script file name
lstrcpyn(szCurrentKml,szKmlFile,ARRAYSIZEOF(szCurrentKml));
@ -2021,6 +2013,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
hszTopic = DdeCreateStringHandle(idDdeInst,szTopic,0);
DdeNameService(idDdeInst,hszService,NULL,DNS_REGISTER);
SoundOpen(uWaveDevId); // open waveform-audio output device
_ASSERT(hWnd != NULL);
_ASSERT(hWindowDC != NULL);
@ -2075,6 +2069,8 @@ start:
DdeFreeStringHandle(idDdeInst, hszTopic);
DdeUninitialize(idDdeInst);
SoundClose(); // close waveform-audio output device
// get full path name of szCurrentFilename
if (GetFullPathName(szCurrentFilename,ARRAYSIZEOF(szBufferFilename),szBufferFilename,&lpFilePart) == 0)
szBufferFilename[0] = 0; // no last document name

View file

@ -296,7 +296,7 @@ FONT 8, "MS Sans Serif"
BEGIN
ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE
LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP
LTEXT "Copyright © 2013 Christoph Gießelink && Sébastien Carlier",
LTEXT "Copyright © 2014 Christoph Gießelink && Sébastien Carlier",
IDC_STATIC,29,18,181,8
DEFPUSHBUTTON "OK",IDOK,215,12,39,14
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
@ -687,8 +687,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,5,0
PRODUCTVERSION 1,5,5,0
FILEVERSION 1,5,6,0
PRODUCTVERSION 1,5,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -705,12 +705,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\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 "LegalCopyright", "Copyright © 2013\0"
VALUE "LegalCopyright", "Copyright © 2014\0"
VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 5, 5, 0\0"
VALUE "ProductVersion", "1, 5, 6, 0\0"
END
END
BLOCK "VarFileInfo"

View file

@ -51,7 +51,7 @@ DWORD dwDbgRstkp; // stack recursion level of step over end
DWORD dwDbgRstk; // possible return address
DWORD *pdwInstrArray = NULL; // last instruction array
WORD wInstrSize; // size of last instruction array
WORD wInstrSize = 256; // size of last instruction array
WORD wInstrWp; // write pointer of instruction array
WORD wInstrRp; // read pointer of instruction array
@ -566,7 +566,6 @@ loop:
SetHP48Time(); // update HP48 time & date
// start display counter/update engine
StartDisplay((BYTE)(((Chipset.IORam[LINECOUNT+1]<<4)|Chipset.IORam[LINECOUNT])&0x3F));
SoundOpen(uWaveDevId); // open waveform-audio output device
StartBatMeasure(); // start battery measurement
StartTimers();
}
@ -628,7 +627,6 @@ loop:
StopDisplay(); // stop display counter/update
StopBatMeasure(); // stop battery measurement
StopTimers();
SoundClose(); // close waveform-audio output device
while (nNextState == SM_SLEEP) // go into sleep state
{

View file

@ -16,16 +16,16 @@
// memory address for flags -53 to -56
#define SFLAG53_56 ( (cCurrentRomType=='6') \
? 0xE0E4F \
? 0xE0E4F \
: ( (cCurrentRomType=='A') \
? 0xF0E4F \
: ( (cCurrentRomType!='E' && cCurrentRomType!='X') \
? ( (cCurrentRomType=='S') \
? 0x706D2 \
: 0x80850 \
) \
? 0xF0E4F \
: ( (cCurrentRomType!='E' && cCurrentRomType!='X') \
? ( (cCurrentRomType=='S') \
? 0x706D2 \
: 0x80850 \
) \
: 0x80F0F \
) \
) \
) \
)

File diff suppressed because it is too large Load diff

View file

@ -312,6 +312,7 @@ BOOL PatchRom(LPCTSTR szFilename)
PSZ lpStop,lpBuf = NULL;
DWORD dwAddress = 0;
UINT nPos = 0;
BOOL bSucc = TRUE;
if (pbyRom == NULL) return FALSE;
SetCurrentDirectory(szEmuDirectory);
@ -319,13 +320,8 @@ BOOL PatchRom(LPCTSTR szFilename)
SetCurrentDirectory(szCurrentDirectory);
if (hFile == INVALID_HANDLE_VALUE) return FALSE;
dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh);
if (dwFileSizeLow <= 5)
{ // file is too small.
CloseHandle(hFile);
return FALSE;
}
if (dwFileSizeHigh != 0)
{ // file is too large.
if (dwFileSizeHigh != 0 || dwFileSizeLow == 0)
{ // file is too large or empty
CloseHandle(hFile);
return FALSE;
}
@ -341,20 +337,15 @@ BOOL PatchRom(LPCTSTR szFilename)
nPos = 0;
while (lpBuf[nPos])
{
do // remove blank space
{
if ( (lpBuf[nPos]!=' ')
&&(lpBuf[nPos]!='\n')
&&(lpBuf[nPos]!='\r')
&&(lpBuf[nPos]!='\t')) break;
nPos++;
} while (lpBuf[nPos]);
if (lpBuf[nPos]==';') // comment ?
// skip whitespace characters
nPos += (UINT) strspn(&lpBuf[nPos]," \t\n\r");
if (lpBuf[nPos] == ';') // comment?
{
do
{
nPos++;
if (lpBuf[nPos]=='\n')
if (lpBuf[nPos] == '\n')
{
nPos++;
break;
@ -363,23 +354,36 @@ BOOL PatchRom(LPCTSTR szFilename)
continue;
}
dwAddress = strtoul(&lpBuf[nPos], &lpStop, 16);
nPos += (UINT) (lpStop - &lpBuf[nPos]) + 1;
if (*lpStop != ':' || *lpStop == 0)
continue;
while (lpBuf[nPos])
nPos = (UINT) (lpStop - lpBuf); // position of lpStop
if (*lpStop != 0) // data behind address
{
if (isxdigit(lpBuf[nPos]) == FALSE) break;
if (dwAddress < dwRomSize) // patch ROM
if (*lpStop != ':') // invalid syntax
{
// patch ROM and save original nibble
PatchNibble(dwAddress, Asc2Nib(lpBuf[nPos]));
// skip to end of line
while (lpBuf[nPos] != '\n' && lpBuf[nPos] != 0)
{
++nPos;
}
bSucc = FALSE;
continue;
}
while (lpBuf[++nPos])
{
if (isxdigit(lpBuf[nPos]) == FALSE) break;
if (dwAddress < dwRomSize) // patch ROM
{
// patch ROM and save original nibble
PatchNibble(dwAddress, Asc2Nib(lpBuf[nPos]));
}
++dwAddress;
}
++dwAddress;
++nPos;
}
}
_ASSERT(nPos <= dwFileSizeLow); // buffer overflow?
free(lpBuf);
return TRUE;
return bSucc;
}

View file

@ -14,14 +14,14 @@ typedef struct
{
BYTE byType[4]; // "WSM"
UINT uSize; // size of this structure
BYTE byVersion; // WSM version
BYTE byVersion; // WSM version
BOOL bRomArray; // copy of bFlashRomArray
DWORD dwLockCnfg; // block lock table (32 entries)
BOOL bRomArray; // copy of bFlashRomArray
DWORD dwLockCnfg; // block lock table (32 entries)
UINT uWrState; // state of write function WSM
UINT uRdState; // state of read function WSM
BYTE byStatusReg; // status register
BYTE byExStatusReg; // extended status register
BYTE byStatusReg; // status register
BYTE byExStatusReg; // extended status register
BYTE byWrite1No; // no. of written data in write buffer1
BYTE byWrite1Size; // no. of valid data in write buffer1
DWORD dwWrite1Addr; // destination address of buffer1

View file

@ -1188,7 +1188,7 @@ VOID ReadIO(BYTE *a, DWORD d, DWORD s, BOOL bUpdate)
if (cCurrentRomType=='E') // HP39/40G
{
Chipset.IORam[d] = (nCurrentClass != 40)
? (Chipset.IORam[d] & ~IRI) // HP39G
? (Chipset.IORam[d] & ~IRI) // HP39G
: (Chipset.IORam[d] | IRI); // HP40G
}
*a = Chipset.IORam[d]; // return IR CONTROL value

View file

@ -76,7 +76,7 @@ BOOL MruInit(INT nNum)
if ((ppszFiles = (LPTSTR *) malloc(nEntry * sizeof(*ppszFiles))) == NULL)
return TRUE;
// fill each entry
// fill each entry
for (nNum = 0; nNum < nEntry; ++nNum)
ppszFiles[nNum] = NULL;

View file

@ -37,12 +37,19 @@
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif
#if !defined GWLP_USERDATA
#define GWLP_USERDATA GWL_USERDATA
#endif
#if !defined IDC_HAND // Win2k specific definition
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
#if _MSC_VER <= 1200 // missing type definition in the MSVC6.0 SDK and earlier
#define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong
typedef SIZE_T DWORD_PTR, *PDWORD_PTR;
typedef LONG LONG_PTR, *PLONG_PTR;
#endif
#if _MSC_VER >= 1400 // valid for VS2005 and later

View file

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

View file

@ -89,7 +89,7 @@ static BOOL Metakernel(VOID)
{
// get version number
WORD wVersion = ((Port1[30] * 10) + Port1[34]) * 10
+ Port1[36];
+ Port1[36];
// version newer then V2.30, then compatible with HP OS
bMkDetect = (wVersion <= 230);
@ -208,8 +208,8 @@ DWORD RPL_SkipOb(DWORD d)
case DOGROB: // Graphic
case DOLIB: // Library
case DOBAK: // Backup
case DOEXT0: // Library Data
case DOEXT1: // Reserved 1
case DOEXT0: // Library Data
case DOEXT1: // Reserved 1
if (n == DOEXT1 && cCurrentRomType != 'S')
{
// on HP48G series and later interpreted as DOACPTR
@ -328,7 +328,7 @@ DWORD RPL_ObjectSize(BYTE *o,DWORD s)
case DOLIB: // Library
case DOBAK: // Backup
case DOEXT0: // Library Data
case DOEXT1: // Reserved 1
case DOEXT1: // Reserved 1
if (n == DOEXT1 && cCurrentRomType != 'S')
{
// on HP48G series and later interpreted as DOACPTR
@ -440,7 +440,7 @@ VOID RPL_Push(UINT l,DWORD n)
if (METAKERNEL) ++l; // Metakernel, save MK object on stack level 1
stkp = Read5(DSKTOP) - 5; // get pointer of new stack level 1
Write5(DSKTOP,stkp); // save it
Write5(DSKTOP,stkp); // save it
for (i = 1; i < l; ++i) // move down stack level entries before insert pos
{

View file

@ -175,6 +175,8 @@ VOID ReadSettings(VOID)
ReadString(_T("Port2"),_T("Filename"),_T("SHARED.BIN"),szPort2Filename,ARRAYSIZEOF(szPort2Filename));
// KML
bAlwaysDisplayLog = ReadInt(_T("KML"),_T("AlwaysDisplayLog"),bAlwaysDisplayLog);
// Debugger
wInstrSize = ReadInt(_T("Debugger"),_T("LastInstrBufSize"),wInstrSize);
// Disassembler
disassembler_mode = ReadInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode);
disassembler_symb = ReadInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb);
@ -223,6 +225,8 @@ VOID WriteSettings(VOID)
WriteString(_T("Port2"),_T("Filename"),szPort2Filename);
// KML
WriteInt(_T("KML"),_T("AlwaysDisplayLog"),bAlwaysDisplayLog);
// Debugger
WriteInt(_T("Debugger"),_T("LastInstrBufSize"),wInstrSize);
// Disassembler
WriteInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode);
WriteInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb);

View file

@ -96,7 +96,8 @@ static VOID DestroyWaveThread(VOID)
if (hThreadWave != NULL) // sound message handler thread running
{
// shut down thread
PostThreadMessage(dwThreadWaveId,WM_QUIT,0,0);
while (!PostThreadMessage(dwThreadWaveId,WM_QUIT,0,0))
Sleep(0);
WaitForSingleObject(hThreadWave,INFINITE);
CloseHandle(hThreadWave);
hThreadWave = NULL;
@ -253,7 +254,7 @@ static BOOL AddSamples(DWORD dwSamples, BYTE byLevel)
}
if (dwSamples < dwBufSamples) // free sample buffer is larger then needed
dwBufSamples = dwSamples; // fill only the necessary no. of samples
dwBufSamples = dwSamples; // fill only the necessary no. of samples
dwSamples -= dwBufSamples; // remaining samples after buffer fill
@ -345,7 +346,8 @@ BOOL SoundGetDeviceID(UINT *puDeviceID)
//
BOOL SoundOpen(UINT uDeviceID)
{
if (hWaveDevice == NULL) // no sound device
// check if sound device is already open
if (hWaveDevice == NULL && SoundAvailable(uDeviceID))
{
WAVEFORMATEX wf;
BOOL bSucc;

View file

@ -27,6 +27,31 @@ BOOL bDetectClpObject = TRUE; // try to detect clipboard object
//#
//################
static LPTSTR Trim(LPCTSTR cp)
{
LPCTSTR pcWs = _T(" \t\n\r"); // valid whitespace characters
LPTSTR pc;
DWORD dwFirst,dwLast;
dwLast = lstrlen(cp); // last position in string (EOS)
// trim leading and tailing whitespace characters
dwFirst = (DWORD) _tcsspn(cp,pcWs); // position of 1st non whitespace character
// search for position behind last non whitespace character
while (dwLast > dwFirst && _tcschr(pcWs,cp[dwLast-1]) != NULL)
--dwLast;
dwLast = 1 + dwLast - dwFirst; // calculate buffer length
if ((pc = (LPTSTR) malloc(dwLast * sizeof(*pc))) != NULL)
{
lstrcpyn(pc,&cp[dwFirst],dwLast); // copy relevant data + EOS
}
return pc;
}
static INT RPL_GetZInt(BYTE CONST *pbyNum,INT nIntLen,LPTSTR cp,INT nSize)
{
INT i = 0; // character counter
@ -60,7 +85,7 @@ static INT RPL_GetZInt(BYTE CONST *pbyNum,INT nIntLen,LPTSTR cp,INT nSize)
return i;
}
static INT RPL_SetZInt(LPCTSTR cp,LPBYTE pbyNum,INT nSize)
static __inline INT SetZInt(LPCTSTR cp,LPBYTE pbyNum,INT nSize)
{
BYTE bySign;
INT nStrLen,nNumSize;
@ -109,6 +134,20 @@ static INT RPL_SetZInt(LPCTSTR cp,LPBYTE pbyNum,INT nSize)
return nNumSize;
}
static INT RPL_SetZInt(LPCTSTR cp,LPBYTE pbyNum,INT nSize)
{
LPTSTR pszData;
INT s = 0;
if ((pszData = Trim(cp)) != NULL) // create a trimmed working copy of the string
{
s = SetZInt(pszData,pbyNum,nSize);
free(pszData);
}
return s;
}
static INT RPL_GetBcd(BYTE CONST *pbyNum,INT nMantLen,INT nExpLen,CONST TCHAR cDec,LPTSTR cp,INT nSize)
{
BYTE byNib;
@ -198,7 +237,7 @@ static INT RPL_GetBcd(BYTE CONST *pbyNum,INT nMantLen,INT nExpLen,CONST TCHAR cD
return i;
}
static INT RPL_SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,LPBYTE pbyNum,INT nSize)
static __inline INT SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,LPBYTE pbyNum,INT nSize)
{
TCHAR cVc[] = _T(".0123456789eE+-");
@ -318,6 +357,20 @@ static INT RPL_SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,LPBYT
return nMantLen + nExpLen + 1;
}
static INT RPL_SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,LPBYTE pbyNum,INT nSize)
{
LPTSTR pszData;
INT s = 0;
if ((pszData = Trim(cp)) != NULL) // create a trimmed working copy of the string
{
s = SetBcd(pszData,nMantLen,nExpLen,cDec,pbyNum,nSize);
free(pszData);
}
return s;
}
static INT RPL_GetComplex(BYTE CONST *pbyNum,INT nMantLen,INT nExpLen,CONST TCHAR cDec,LPTSTR cp,INT nSize)
{
INT nLen,nPos;
@ -371,8 +424,7 @@ static INT RPL_SetComplex(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,L
? _T(',') // radix mark '.' -> ',' separator
: _T(';'); // radix mark ',' -> ';' separator
// create a working copy of the string
if ((pszData = DuplicateString(cp)) != NULL)
if ((pszData = Trim(cp)) != NULL) // create a trimmed working copy of the string
{
INT nStrLength = lstrlen(pszData); // string length
@ -415,35 +467,6 @@ static INT RPL_SetComplex(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,L
//#
//################
#if 0
static INT IsRealNumber(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,LPBYTE pbyNum,INT nSize)
{
LPTSTR lpszNumber;
INT nLength = 0;
if ((lpszNumber = DuplicateString(cp)) != NULL)
{
LPTSTR p = lpszNumber;
INT i;
// cut heading whitespaces
for (; *p == _T(' ') || *p == _T('\t'); ++p) { }
// cut tailing whitespaces
for (i = lstrlen(p); --i >= 0;)
{
if (p[i] != _T(' ') && p[i] != _T('\t'))
break;
}
p[++i] = 0; // new EOS
nLength = RPL_SetBcd(p,nMantLen,nExpLen,cDec,pbyNum,nSize);
HeapFree(hHeap,0,lpszNumber);
}
return nLength;
}
#endif
static TCHAR GetRadix(VOID)
{
// get locale decimal point

View file

@ -181,7 +181,7 @@ BOOL RplLoadTable(LPCTSTR lpszFilename)
ppsBase[dwHash] = pData;
}
++dwSymb; // got symbol
++dwSymb; // got symbol
}
else // 42 byte fill reference
{

View file

@ -11,10 +11,7 @@
#include "ops.h"
#include "io.h" // I/O definitions
#define AUTO_OFF 10 // Time in minutes for 'auto off'
// Ticks for 01.01.1970 00:00:00
#define UNIX_0_TIME ((ULONGLONG) 0x0001cf2e8f800000)
#define AUTO_OFF 10 // Time in minutes for 'auto off'
// Ticks for 'auto off'
#define OFF_TIME ((ULONGLONG) (AUTO_OFF * 60) << 13)

View file

@ -26,38 +26,38 @@ typedef struct
DWORD Port0Size; // real size of module in KB
DWORD Port1Size; // real size of module in KB
DWORD Port2Size; // real size of module in KB (HP49G only)
DWORD dwUnused0; // not used, was memory pointer Port0
DWORD dwUnused1; // not used, was memory pointer Port1
DWORD dwUnused2; // not used, was memory pointer Port2
DWORD dwUnused0; // not used, was memory pointer Port0
DWORD dwUnused1; // not used, was memory pointer Port1
DWORD dwUnused2; // not used, was memory pointer Port2
DWORD pc;
DWORD pc;
DWORD d0;
DWORD d1;
DWORD rstkp;
DWORD rstk[8];
BYTE A[16];
BYTE B[16];
BYTE C[16];
BYTE D[16];
BYTE R0[16];
BYTE R1[16];
BYTE R2[16];
BYTE R3[16];
BYTE R4[16];
BYTE ST[4];
BYTE HST;
BYTE P;
WORD out;
BYTE A[16];
BYTE B[16];
BYTE C[16];
BYTE D[16];
BYTE R0[16];
BYTE R1[16];
BYTE R2[16];
BYTE R3[16];
BYTE R4[16];
BYTE ST[4];
BYTE HST;
BYTE P;
WORD out;
WORD in;
BOOL SoftInt;
BOOL Shutdn;
BOOL mode_dec;
BOOL mode_dec;
BOOL inte; // interrupt status flag (FALSE = int in service)
BOOL intk; // 1 ms keyboard scan flag (TRUE = enable)
BOOL intd; // keyboard interrupt pending (TRUE = int pending)
BOOL carry;
WORD crc;
WORD crc;
WORD wPort2Crc; // fingerprint of port2
WORD wRomCrc; // fingerprint of ROM
#if defined _USRDLL // DLL version
@ -68,36 +68,36 @@ typedef struct
#endif
DWORD dwKdnCycles; // cpu cycles at start of 1ms key handler
UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF
UINT FlashRomState; // WSM state of flash memory (unused)
BYTE cards_status;
BYTE IORam[64]; // I/O hardware register
UINT IOBase; // address of I/O modules page
BOOL IOCfig; // I/O module configuration flag
BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page
BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB
BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page
BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag
BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag
UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF
UINT FlashRomState; // WSM state of flash memory (unused)
BYTE cards_status;
BYTE IORam[64]; // I/O hardware register
UINT IOBase; // address of I/O modules page
BOOL IOCfig; // I/O module configuration flag
BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page
BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB
BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page
BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag
BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag
BYTE t1;
DWORD t2;
BYTE t1;
DWORD t2;
BOOL bShutdnWake; // flag for wake up from SHUTDN mode
BOOL bShutdnWake; // flag for wake up from SHUTDN mode
BYTE Keyboard_Row[9];
WORD IR15X;
UINT Keyboard_State; // not used
BYTE Keyboard_Row[9];
WORD IR15X;
UINT Keyboard_State; // not used
signed short loffset;
signed int width;
UINT boffset;
UINT lcounter;
UINT sync; // not used
BYTE contrast;
BOOL dispon; // not used
DWORD start1;
DWORD start12;
DWORD end1;
DWORD start2, end2;
UINT boffset;
UINT lcounter;
UINT sync; // not used
BYTE contrast;
BOOL dispon; // not used
DWORD start1;
DWORD start12;
DWORD end1;
DWORD start2, end2;
} Chipset_t;

View file

@ -37,7 +37,7 @@ BOOL SendByteUdp(BYTE byData)
#if defined _UNICODE
DWORD dwLength = lstrlen(szUdpServer) + 1;
if ((lpszIpAddr = (LPSTR) malloc(dwLength)) == NULL)
if ((lpszIpAddr = (LPSTR) _alloca(dwLength)) == NULL)
return TRUE; // server not found
WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK,
@ -55,17 +55,11 @@ BOOL SendByteUdp(BYTE byData)
PHOSTENT host = gethostbyname(lpszIpAddr);
if (host == NULL)
{
#if defined _UNICODE
free(lpszIpAddr);
#endif
return TRUE; // server not found
}
ip_addr.s_addr = ((PIN_ADDR) host->h_addr_list[0])->s_addr;
}
#if defined _UNICODE
free(lpszIpAddr);
#endif
}
// create UDP socket

View file

@ -296,7 +296,7 @@ FONT 8, "MS Sans Serif"
BEGIN
ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE
LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP
LTEXT "Copyright © 2013 Christoph Gießelink && Sébastien Carlier",
LTEXT "Copyright © 2014 Christoph Gießelink && Sébastien Carlier",
IDC_STATIC,29,18,181,8
DEFPUSHBUTTON "OK",IDOK,215,12,39,14
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
@ -715,8 +715,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,5,0
PRODUCTVERSION 1,5,5,0
FILEVERSION 1,5,6,0
PRODUCTVERSION 1,5,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -733,12 +733,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\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 "LegalCopyright", "Copyright © 2013\0"
VALUE "LegalCopyright", "Copyright © 2014\0"
VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 5, 5, 0\0"
VALUE "ProductVersion", "1, 5, 6, 0\0"
END
END
BLOCK "VarFileInfo"

View file

@ -45,10 +45,10 @@ cleanobj:
cleanexe:
-rm -f $(TARGET)
cursor.o: cursor.c pch.h emu48.h
cursor.o: cursor.c pch.h emu48.h types.h
$(CC) $(CFLAGS) $(DEFINES) -c -o cursor.o cursor.c
ddeserv.o: ddeserv.c pch.h emu48.h types.h
ddeserv.o: ddeserv.c pch.h emu48.h types.h io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o ddeserv.o ddeserv.c
debugger.o: debugger.c pch.h resource.h emu48.h \
@ -65,24 +65,24 @@ display.o: display.c pch.h resource.h emu48.h \
types.h io.h kml.h
$(CC) $(CFLAGS) $(DEFINES) -c -o display.o display.c
disrpl.o: disrpl.c pch.h Emu48.h disrpl.h
disrpl.o: disrpl.c pch.h Emu48.h types.h disrpl.h
$(CC) $(CFLAGS) $(DEFINES) -c -o disrpl.o disrpl.c
emu48.o: emu48.c pch.h resource.h emu48.h types.h \
io.h kml.h debugger.h
$(CC) $(CFLAGS) $(DEFINES) -c -o emu48.o emu48.c
engine.o: engine.c pch.h emu48.h types.h opcodes.h \
io.h debugger.h ops.h
engine.o: engine.c pch.h emu48.h types.h opcodes.h \
io.h debugger.h
$(CC) $(CFLAGS) $(DEFINES) -c -o engine.o engine.c
external.o: external.c pch.h emu48.h types.h
external.o: external.c pch.h emu48.h types.h ops.h
$(CC) $(CFLAGS) $(DEFINES) -c -o external.o external.c
fetch.o: fetch.c pch.h opcodes.h
$(CC) $(CFLAGS) $(DEFINES) -c -o fetch.o fetch.c
files.o: files.c pch.h emu48.h types.h io.h \
files.o: files.c pch.h emu48.h types.h ops.h io.h \
kml.h i28f160.h debugger.h
$(CC) $(CFLAGS) $(DEFINES) -c -o files.o files.c
@ -92,33 +92,33 @@ i28f160.o: i28f160.c pch.h emu48.h types.h i28f160.h
keyboard.o: keyboard.c pch.h emu48.h types.h io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o keyboard.o keyboard.c
keymacro.o: keymacro.c pch.h resource.h Emu48.h kml.h
keymacro.o: keymacro.c pch.h resource.h Emu48.h types.h kml.h
$(CC) $(CFLAGS) $(DEFINES) -c -o keymacro.o keymacro.c
kml.o: kml.c pch.h resource.h emu48.h types.h kml.h
$(CC) $(CFLAGS) $(DEFINES) -c -o kml.o kml.c
lowbat.o: lowbat.c pch.h Emu48.h io.h
lowbat.o: lowbat.c pch.h emu48.h types.h io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o lowbat.o lowbat.c
mops.o: mops.c pch.h emu48.h types.h opcodes.h io.h \
mops.o: mops.c pch.h emu48.h types.h ops.h opcodes.h io.h \
i28f160.h
$(CC) $(CFLAGS) $(DEFINES) -c -o mops.o mops.c
mru.o: mru.c pch.h resource.h emu48.h
mru.o: mru.c pch.h resource.h emu48.h types.h
$(CC) $(CFLAGS) $(DEFINES) -c -o mru.o mru.c
opcodes.o: opcodes.c pch.h emu48.h types.h opcodes.h \
io.h ops.h
io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o opcodes.o opcodes.c
# pch.o: pch.c pch.h
# $(CC) $(CFLAGS) $(DEFINES) -c -o pch.o pch.c
redeye.o: redeye.c pch.h emu48.h io.h
redeye.o: redeye.c pch.h emu48.h types.h io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o redeye.o redeye.c
rpl.o: rpl.c pch.h emu48.h types.h io.h
rpl.o: rpl.c pch.h emu48.h types.h ops.h io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o rpl.o rpl.c
serial.o: serial.c pch.h emu48.h types.h io.h
@ -127,19 +127,19 @@ serial.o: serial.c pch.h emu48.h types.h io.h
settings.o: settings.c pch.h emu48.h types.h i28f160.h
$(CC) $(CFLAGS) $(DEFINES) -c -o settings.o settings.c
sound.o: sound.c pch.h emu48.h
sound.o: sound.c pch.h emu48.h types.h
$(CC) $(CFLAGS) $(DEFINES) -c -o sound.o sound.c
stack.o: stack.c pch.h resource.h emu48.h io.h
stack.o: stack.c pch.h resource.h emu48.h types.h io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o stack.o stack.c
symbfile.o: symbfile.c pch.h emu48.h
symbfile.o: symbfile.c pch.h emu48.h types.h
$(CC) $(CFLAGS) $(DEFINES) -c -o symbfile.o symbfile.c
timer.o: timer.c pch.h emu48.h types.h io.h
timer.o: timer.c pch.h emu48.h types.h ops.h io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o timer.o timer.c
udp.o: udp.c pch.h io.h
udp.o: udp.c pch.h emu48.h types.h
$(CC) $(CFLAGS) $(DEFINES) -c -o udp.o udp.c
$(RSRCOBJ): $(RSRC) resource.h emu48.ico dbgtool.bmp checkbox.bmp Emu48.xml

View file

@ -18,14 +18,6 @@
#include <conio.h>
// #include <crtdbg.h> // missing file
#if !defined VERIFY
#if defined _DEBUG
#define VERIFY(f) _ASSERT(f)
#else // _DEBUG
#define VERIFY(f) ((VOID)(f))
#endif // _DEBUG
#endif // _VERIFY
#if !defined IDC_HAND // Win2k specific definition
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
@ -38,12 +30,16 @@
#define __min(a,b) (((a) < (b)) ? (a) : (b))
#endif
// normally defined in CONIO.H
int __cdecl _inp(unsigned short);
int __cdecl _outp(unsigned short, int);
// normally defined in missing CRTDBG.H
#if !defined _ASSERT
#define _ASSERT(a)
#endif
#define _CrtDumpMemoryLeaks() ((int)0)
#define _CrtDumpMemoryLeaks()
#if !defined VERIFY
#if defined _DEBUG
#define VERIFY(f) _ASSERT(f)
#else // _DEBUG
#define VERIFY(f) ((VOID)(f))
#endif // _DEBUG
#endif // VERIFY

View file

@ -48,4 +48,4 @@ Many thanks to Pedro A. Arranda Guti
compatible.
04/30/13 (c) by Christoph Gießelink
04/29/14 (c) by Christoph Gießelink

Binary file not shown.