diff --git a/DEBUGGER.TXT b/DEBUGGER.TXT index f48cdf9..1d7ec4c 100644 --- a/DEBUGGER.TXT +++ b/DEBUGGER.TXT @@ -216,6 +216,18 @@ Toggle a code breakpoint at the cursor position in the Code window. Set the PC to the cursor position. Be careful with this command, you change the execution order of the commands! +- Find + +Search in the mapped CPU address area for an address which contain a PCO (Primitive Code Object) header. The disassembled code of this address is shown in the Code window. + +- Previous PCO + +Search for a PCO before the address shown in the first line of the Code window. + +- Next PCO + +Search for a PCO behind the address shown in the first line of the Code window. + 7.) Register window @@ -270,7 +282,11 @@ The Memory window follow the content of the selected register. - Find... F -Calls the "Find" dialog box, allowing you to search for a data sequence in hexadecimal or ASCII mode. The search area is selected by the memory view Mapping mode described in the following section. When you close the "Find" dialog box, you will loose all saved strings in the data combo box. +Calls the "Find" dialog box, allowing you to search for a data sequence in hexadecimal or ASCII mode. The search area is selected by the memory view Mapping mode described in the following section. If the data sequence is found the Memory window and an opened "RPL Object Viewer" window will be updated. + +With the button "Previous" you can search for the previous and with the button "Next" you can search for the next occurrence of the data sequence. + +When you close the "Find" dialog box, you will loose all saved strings in the data combo box. - Mapping @@ -354,4 +370,4 @@ The Miscellaneous window show you the internal state of the interrupt flag, the You can change the values by pressing the left mouse button over the old content. -05/02/12 (c) by Christoph Gießelink +01/09/13 (c) by Christoph Gießelink diff --git a/EMU48.EXE b/EMU48.EXE deleted file mode 100644 index 2f613a5..0000000 Binary files a/EMU48.EXE and /dev/null differ diff --git a/EMU48.TXT b/EMU48.TXT index 5203c36..ea9ed1f 100644 --- a/EMU48.TXT +++ b/EMU48.TXT @@ -10,7 +10,7 @@ * OPERATING SYSTEM * ******************** -This version of Emu48 should work with all Intel IA32 and x64 platforms. +This version of Emu48 should work with all Intel x86 and x64 platforms. **************** @@ -23,9 +23,9 @@ Emu48 is distributed in 1 archive: To install Emu48, just start the executable file inside the Emu48v15xSetup.zip archive. The installer will guide you through the installation. When you first run Emu48, it will detect the directory in which you installed it, and will -write its configuration to a file named Emu48.ini in your Windows directory. If -you move the Emu48 directory to another place you have to change the directory -path inside the Emu48.ini file manually or have to delete the Emu48.ini file. +write its configuration to the registry HKCU\Software\Emu48. If you move the +Emu48 directory to another place you have to change the directory path inside +the "Choose Your KML Script" dialog. You can also update your current version with the Service Packs: - E48BP5x.ZIP New EXE-File @@ -47,8 +47,8 @@ to convert the ROM files into the Emu48 ROM format. - HP38: To upload the ROM of your HP38G, you will need a special aplet called "ROM -UPLOAD", available at http://www.epita.fr/~avenar_j/hp. Once you've uploaded the -ROM, you have to convert it using the Convert utility. +UPLOAD", available at http://www.hpcalc.org/details.php?id=633. Once you've +uploaded the ROM, you have to convert it using the Convert utility. To do that, start a Command Prompt while running Windows, and type: Convert ROM.38G @@ -64,8 +64,8 @@ the ROM, you have to convert it using the Rom2emu utility. To do that, start a Command Prompt while running Windows, and type: Rom2emu ROM.39G -There's also a HP39G/HP40G beta ROM for emulators at -http://www.epita.fr/~avenar_j/hp/39.htm for download. +There's also a HP39G/HP40G beta ROM for emulators inside an old Emu48 package +available at http://www.hpcalc.org/details.php?id=4272. - HP48: If you have already used another HP48 emulator, you can convert the ROM using @@ -87,13 +87,21 @@ almost automatically get the ROM from your HP48. After the download you may have to convert your dump with the CONVERT utility into the Emu48 format. You can find the latest version of the ROM dump programs on: -ROMUPL.BIN http://www.epita.fr/~avenar_j/hp/calcen.html -ROMDump Wizard http://hp.giesselink.com/index.htm +ROMUPL.BIN http://www.hpcalc.org/details.php?id=3686 +ROMDump Wizard http://hp.giesselink.com/emu48.htm -- HP49: -There's no ROM download program available so far. But you can find a HP49G ROM -for emulators in the YorkeM emulator package or in the HP49G SDK on -http://www.hpcalc.org in the HP49 section. +- HP49G: +There's no ROM download program available so far. But you can create a ROM image +with the UPD49ROM tool available at http://hp.giesselink.com/emu48.htm and a ROM +update file for the HP49G calculator available at +http://www.hpcalc.org/hp49/pc/rom/. I suggested to use version 1.19-6 +(http://www.hpcalc.org/details.php?id=3240). + +To create a HP49G ROM image file, start a Command Prompt while running Windows, +and type: + UPD49ROM -f hp49119-6.flash ROM.49G + +This will create a HP49G ROM image file with an empty User Port 2. **************** @@ -255,9 +263,9 @@ the variable 'Writeable' defined in the Emu48.ini file, section [ROM] to zero. * COPY / PASTE STRING * *********************** -With the menu items "Copy String" and "Paste String" in the "Edit" menu you're -able to copy HP string objects from the stack to the PC clipboard and vice -versa. +With the menu items "Copy Stack" and "Paste Stack" in the "Edit" menu you're +able to copy real and complex numbers and string objects from the stack to the +PC clipboard and vice versa. ********** @@ -296,9 +304,9 @@ emulated calculators the address area #00058-#00076 in System RAM are rewritten with the actual time information. - ************* - * EMU48.INI * - ************* + ******************************** + * Registry HKCU\Software\Emu48 * + ******************************** The section [Timers] in the Emu48.ini file isn't used any more. The variable values are replaced by useful constants. You may delete this section if you @@ -357,6 +365,15 @@ hardware or a resource problem of the serial port. Check this with connecting the HP with a transfer program you like on the same serial port. + ******************************* + * INFRARED PRINTER SIMULATION * + ******************************* + +The emulator has the ability to print decoded data to a HP82240A/B printer +simulation. The data transfer to the printer simulator is done over UDP. You can +the define the IPv4 address and the port the printer simulator is listening. + + **************** * DISASSEMBLER * **************** @@ -435,7 +452,7 @@ have discussed there in different threads for years now. *************** Emu48 - An HP38/39/40/48/49 Emulator -Copyright (C) 2010 Sebastien Carlier & Christoph Gießelink +Copyright (C) 2013 Sebastien Carlier & Christoph Gießelink This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -455,19 +472,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA * The Authors * *************** -Paper Mail: Sebastien Carlier - 10 Allee des bergeronnettes - 35340 LIFFRE - FRANCE - -E-Mail: - sebc@epita.fr - - -Paper Mail: Christoph Giesselink - GERMANY E-Mail: c dot giesselink at gmx dot de diff --git a/EMU48.dll b/EMU48.dll deleted file mode 100644 index 697ea62..0000000 Binary files a/EMU48.dll and /dev/null differ diff --git a/EMU48PLUS.TXT b/EMU48PLUS.TXT index c41e7a9..1199761 100644 --- a/EMU48PLUS.TXT +++ b/EMU48PLUS.TXT @@ -1,4 +1,4 @@ -Emu48 1.52+ (based on Emu48 1.53) +Emu48 1.53+ (based on Emu48 1.55) 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 diff --git a/Emu48.dll b/Emu48.dll new file mode 100644 index 0000000..37129d5 Binary files /dev/null and b/Emu48.dll differ diff --git a/Emu48.exe b/Emu48.exe new file mode 100644 index 0000000..41113dd Binary files /dev/null and b/Emu48.exe differ diff --git a/PROBLEMS.TXT b/PROBLEMS.TXT index 22c63b7..1714efd 100644 --- a/PROBLEMS.TXT +++ b/PROBLEMS.TXT @@ -1,4 +1,4 @@ -Known bugs and restrictions of Emu48 V1.53 +Known bugs and restrictions of Emu48 V1.55 ------------------------------------------ - the following I/O bits aren't emulated (incomplete) @@ -37,9 +37,6 @@ Known bugs and restrictions of Emu48 V1.53 calculators a reset happen after about 4s in deep sleep, in the emulator this happens immediately - no MP interrupt on card control circuit or timer restart -- no beeper support with OUT command -> all programs that aren't - use the "=makebeep" subroutine, like alarm wake up, have no sound -- beeper emulation, ATTN key doesn't work - Shell OS: clock isn't synchronized with real time - HP49G: the flash memory is emulated now with some restrictions - no flash programming times, the flash state machine returns @@ -50,4 +47,4 @@ Known bugs and restrictions of Emu48 V1.53 - quitting the emulator while programming the flash isn't allowed, because the content of flash state machine isn't saved so far -08/07/12 (c) by Christoph Gießelink, c dot giesselink at gmx dot de +05/21/13 (c) by Christoph Gießelink, c dot giesselink at gmx dot de diff --git a/source/source/APPLE.C b/source/APPLE.C similarity index 88% rename from source/source/APPLE.C rename to source/APPLE.C index aca09c2..ddfd2ff 100644 --- a/source/source/APPLE.C +++ b/source/APPLE.C @@ -22,6 +22,34 @@ #include "Ops.h" +// +// ROM buffer access functions +// + +static __inline void WrDirtyPage(DWORD d) +{ + if (pbyRomDirtyPage) // using dirty ROM page table + { + DWORD dwPage = d / ROMPAGESIZE; // this is the page + + _ASSERT(dwPage < dwRomDirtyPageSize); + pbyRomDirtyPage[dwPage] = TRUE; // page is dirty + } + return; +} + +static __inline void EraseBlock(DWORD d,DWORD dwNibSize) +{ + LPBYTE pbyAddr = pbyRom + d; + + while (dwNibSize--) + { + WrDirtyPage(d++); // make page dirty + *pbyAddr++ = 0x0F; // clear address + } + return; +} + static CONST LPBYTE ppReg[] = { w.A, w.B, w.C, w.D }; static QWORD DecodeReg64(LPBYTE R, BYTE byNF) @@ -86,7 +114,7 @@ _ASSERT(FALSE); // not tested so far w.pc+=1; // skip x nibble qwVal = Npack64(w.C,16); // generate 64bit number from C register w.carry = (qwVal == 0) // set carry if field mask = 0 - || (I[5] < 8) || (I[5] > 14); // or x argument not in range 8..15 + || (I[5] < 8) || (I[5] > 14); // or x argument not in range 8..15 if (!w.carry) // field mask and argument are valid { @@ -189,11 +217,11 @@ VOID o80B80(VOID) { w.d0 = dwAddress; // object position w.d1 = (w.d0 + dwC) & 0xFFFFF; // link field of hole - w.carry = FALSE; // no error + w.carry = FALSE; // no error } else { - w.carry = TRUE; // error + w.carry = TRUE; // error } dwC += 6; // desired size + link field @@ -234,7 +262,7 @@ _ASSERT(FALSE); // not tested so far if (byBank == 0) dwStart += _KB(64); // skip boot loader // clear bank - FillMemory(&pbyRom[dwStart],dwStop-dwStart,0x0F); + EraseBlock(dwStart,dwStop-dwStart); w.carry = FALSE; // no error return; @@ -243,7 +271,8 @@ _ASSERT(FALSE); // not tested so far // write bytes to flash VOID o80B24(VOID) { - DWORD dwNib,dwAddr,dwSize; + LPBYTE pbyBuffer; + DWORD dwNib,dwAddr,dwSize; dwNib = Npack(w.C,5) * 2; // no. of nibbles to copy dwAddr = FlashROMAddr(w.d1); // linear addr in flash chip @@ -251,7 +280,20 @@ VOID o80B24(VOID) dwSize = dwRomSize - dwAddr; // remaining memory size in flash if (dwNib > dwSize) dwNib = dwSize; // prevent buffer overflow - Npeek(pbyRom+dwAddr,w.d0,dwNib); // copy data + pbyBuffer = (LPBYTE) malloc(dwNib); // allocate data buffer + if (pbyBuffer != NULL) + { + DWORD i; + + Npeek(pbyBuffer,w.d0,dwNib); // get data + + for (i = 0; i < dwNib; ++i) + { + WrDirtyPage(dwAddr); // make page dirty + pbyRom[dwAddr++] = pbyBuffer[i]; // write data + } + free(pbyBuffer); + } w.d0 += dwNib; // update source register w.d1 += dwNib; // update destination register diff --git a/source/source/APPLE.H b/source/APPLE.H similarity index 100% rename from source/source/APPLE.H rename to source/APPLE.H diff --git a/source/source/CHANGES.TXT b/source/CHANGES.TXT similarity index 94% rename from source/source/CHANGES.TXT rename to source/CHANGES.TXT index a387e22..83182a6 100644 --- a/source/source/CHANGES.TXT +++ b/source/CHANGES.TXT @@ -1,35 +1,155 @@ -------------------------------------------------------------------- Service Pack 53 for Emu48 Version 1.0 +APPLE.C +- added functions WrDirtyPage() and EraseBlock() for access to the + ROM buffer +- changed function o80B14() and o80B24(), changed implementation + using the new ROM buffer access functions + +DDESERV.C +- prepared for C++ compiling + DEBUGGER.C +- prepared for C++ compiling +- added new function OnCodeFindPCO(), search for a PCO object in the + code window +- bugfix in function OnSetCursor(), on "Activation follows mouse" + enabled child dialogs lost focus when cursor moved over parent + debugger dialog +- changed function Debugger(), added context menu commands handler + in the WM_COMMAND section - changed function OnFindOK(), added downwards search direction - changed function Find(), added and changed message handler for the "Previous" and "Next" buttons +DISMEM.C +- prepared for C++ compiling + +DISPLAY.C +- prepared for C++ compiling + +EMU48.C +- prepared for C++ compiling +- replaced global variable lThreadId with local variable dwThreadId +- added global variable with the identifier for the waveform-audio + output device +- added property sheet page handlers SettingsGeneralProc(), + SettingsMemoryProc() and SettingsPeripheralProc() +- bugfix in function SettingsGeneralProc(), on "Activation follows + mouse" enabled debugger dialog maybe get focus even if it's not + the last active one +- removed function SettingsProc(), replaced by the property sheet + page handler functions +- bugfix in function OnViewScript(), ROM image change wasn't handled +- added function PropSheetProc(), callback function for setup the + property sheet +- changed function OnViewSettings(), now creating a propery sheet + instead of a settings dialog +- added function OnCopyData() as WM_COPYDATA message handler + implementation for changing the state file to the given state file + name +- changed function MainWndProc(), added WM_COPYDATA message handler +- changed function WinMain(), expanded single instance case by + transmitting the given state file name to the already opened + program instance + +EMU48.H +- prepared for C++ compiling +- added WM_COPYDATA identifier definition +- added definitions for sound interface +- extern declaration of global variables + EMU48.RC - changed IDD_FIND, added a "Previous" button for previous search, shorten the text of the "Find Next" button to "Next" and changed the ID of the next search button -- changed version +- split IDD_SETTINGS dialog into the property pages IDD_SET_GENERAL, + IDD_SET_MEMORY and IDD_SET_PERIPHERAL and added item + "Single Instance" in the "General" property page +- removed IDD_SETTINGS dialog +- added "Previous PCO" and "Next PCO" menu entries in debugger + "Code" context menu +- changed version and copyright + +EMU48DLL.C +- replaced global variable ThreadId with local variable dwThreadId + +ENGINE.C +- added global variable bEnableSlow for global disabling slowing + down the CPU +- added global variable bSoundSlow slowing down the CPU core at + sound output +- changed function AdjustSpeed() and InitAdjustSpeed, added sound + slow down implementation +- changed function WorkerThread(), added sound engine control + +EXTERNAL.C +- changed PCM sampling frequency and definition name +- bugfix in function BeepWave(), eliminated DC offset from waveform, + use global waveform-audio output device identifier for opening and + made a more general initialization of the waveform-audio output + device FILES.C +- prepared for C++ compiling +- changed function MapRom(), removed using of memory mapped files + which has the major advantage that packed ROM files are also valid + now +- changed function UnmapRom(), adjusted to changed MapRom() function +- changed function MapPort2(), improved file size validation and + freeing of file mapping in error case +- changed function UnmapPort2(), added ability to free incomplete + file mapping - changed function SaveBackup() and RestoreBackup(), improved document available detection and added check at port data copy if port source buffer is allocated +I28F160.C +- added functions WrDirtyPage(), EraseBlock(), WriteByte() and + ReadByte() for access to the ROM buffer +- changed function WrStateE8C(), WrState40D(), WrState20C(), + WrState30C() and RdStateData(), changed implementation using the + new ROM buffer access functions + KML.C +- prepared for C++ compiling - added global variable wKeybLocId to hold the keyboard layout input locale at begin of KML loading +- activated keyword "Locale" in pLexToken[] table - changed function ParseBlocks(), use variable wKeybLocId instead of input locale reading -- changed function KillKML(), added reset of variable wKeybLocId +- bugfix in function KillKML(), key mapping state table wasn't + cleared at the end and added reset of variable wKeybLocId - bugfix in function InitKML(), changed implementation by reading the current keyboard layout and convert the layout data to the - input locale setting + input locale setting + +MRU.C +- prepared for C++ compiling + +OPCODES.C +- changed function o801(), call beeper handler function on beeper + port change RESOURCE.H -- added definitions -- removed IDC_FIND_CASE +- added some definitions +- removed IDD_SETTINGS and IDC_FIND_CASE definition + +RPL.C +- prepared for C++ compiling + +SETTINGS.C +- bugfix in function GetRegistryString(), ignored target buffer size + when copying the default to the target string buffer +- changed function ReadSettings() and WriteSettings(), added item + "WaveDeviceId" in section [Emulator] in the INI-File + +STACK.C +- prepared for C++ compiling + +SYMBFILE.C +- prepared for C++ compiling Service Pack 52 for Emu48 Version 1.0 @@ -48,11 +168,11 @@ EMU48.RC - changed version and copyright EMU48DLL.C -- added function DllMain(), implemented "CEmu48" window class +- added function DllMain(), implemented "CEmu48" window class registration and unregistration in process attach and detach especially for dynamic DLL load with LoadLibrary() and FreeLibrary() -- bugfix in function DLLCreateWnd(), moved "CEmu48" window class +- bugfix in function DLLCreateWnd(), moved "CEmu48" window class registration to DllMain(), so it's now possible to unregister the window class automatically at DLL detach diff --git a/source/source/CHECKBOX.BMP b/source/CHECKBOX.BMP similarity index 100% rename from source/source/CHECKBOX.BMP rename to source/CHECKBOX.BMP diff --git a/source/source/COLOR.H b/source/COLOR.H similarity index 100% rename from source/source/COLOR.H rename to source/COLOR.H diff --git a/source/source/CURSOR.C b/source/CURSOR.C similarity index 100% rename from source/source/CURSOR.C rename to source/CURSOR.C diff --git a/source/source/DBGTOOL.BMP b/source/DBGTOOL.BMP similarity index 100% rename from source/source/DBGTOOL.BMP rename to source/DBGTOOL.BMP diff --git a/source/source/DDESERV.C b/source/DDESERV.C similarity index 92% rename from source/source/DDESERV.C rename to source/DDESERV.C index a2c9e9a..b8d21f8 100644 --- a/source/source/DDESERV.C +++ b/source/DDESERV.C @@ -50,7 +50,7 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv, DdeUnaccessData(hData); // reserve memory - if ((lpData = malloc(dwSize * 2)) == NULL) + if ((lpData = (LPBYTE) malloc(dwSize * 2)) == NULL) return (HDDEDATA) DDE_FNOTPROCESSED; SuspendDebugger(); // suspend debugger @@ -129,16 +129,16 @@ cancel: } dwLoop = dwSize = (RPL_SkipOb(dwAddress) - dwAddress + 1) / 2; - lpHeader = (Chipset.type == 'X' || Chipset.type == 'Q' || Chipset.type == '2') ? BINARYHEADER49 : BINARYHEADER48; + lpHeader = (Chipset.type == 'X' || Chipset.type == 'Q' || Chipset.type == '2') ? (LPBYTE) BINARYHEADER49 : (LPBYTE) BINARYHEADER48; // length of binary header - dwIndex = (DWORD) strlen(lpHeader); + dwIndex = (DWORD) strlen((LPCSTR) lpHeader); // size of objectsize + header + object dwSize += dwIndex + sizeof(DWORD); // reserve memory - if ((lpData = malloc(dwSize)) == NULL) + if ((lpData = (LPBYTE) malloc(dwSize)) == NULL) { SwitchToState(SM_RUN); // run state return NULL; diff --git a/source/source/DEBUGDLL.C b/source/DEBUGDLL.C similarity index 100% rename from source/source/DEBUGDLL.C rename to source/DEBUGDLL.C diff --git a/source/source/DEBUGGER.C b/source/DEBUGGER.C similarity index 95% rename from source/source/DEBUGGER.C rename to source/DEBUGGER.C index 0b8962e..a314198 100644 --- a/source/source/DEBUGGER.C +++ b/source/DEBUGGER.C @@ -1003,6 +1003,37 @@ static BOOL OnCodeSetPcToSelection(HWND hDlg) return OnCodeGoPC(hDlg); } +// +// find PCO object in code window +// +static BOOL OnCodeFindPCO(HWND hDlg,DWORD dwAddr,INT nSearchDir) +{ + DWORD dwCnt; + BOOL bMatch; + + // searching upwards / downwards + _ASSERT(nSearchDir == 1 || nSearchDir == -1); + + dwAddr += nSearchDir; // start address for search + + // scan mapped address area until PCO found + for (dwCnt = 0; dwCnt <= 0xFFFFF; ++dwCnt) + { + // is this a PCO? + bMatch = (Read5(dwAddr & 0xFFFFF) == ((dwAddr + 5) & 0xFFFFF)); + + if (bMatch) + { + // update code window + ViewCodeWnd(GetDlgItem(hDlg,IDC_DEBUG_CODE),dwAddr); + break; + } + + dwAddr += nSearchDir; + } + return 0; +} + // // view from address in memory window // @@ -1393,7 +1424,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; } @@ -1606,7 +1638,7 @@ static __inline BOOL OnDrawCodeWnd(LPDRAWITEMSTRUCT lpdis) { crBkColor = COLOR_WHITE; crTextColor = COLOR_NAVY; - hFont = SelectObject(lpdis->hDC,hFontBold); + hFont = (HFONT) SelectObject(lpdis->hDC,hFontBold); } // write Text @@ -1731,7 +1763,7 @@ static __inline HWND CreateToolbar(HWND hWnd) _ASSERT(pData->wVersion == 1); // toolbar resource version // alloc memory for TBBUTTON stucture - if (!(ptbb = malloc(pData->wItemCount*sizeof(TBBUTTON)))) + if (!(ptbb = (TBBUTTON *) malloc(pData->wItemCount*sizeof(TBBUTTON)))) goto unlock; // fill TBBUTTON stucture with resource data @@ -1834,7 +1866,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 = malloc(INSTRSIZE*sizeof(*pdwInstrArray)); + pdwInstrArray = (DWORD *) malloc(INSTRSIZE*sizeof(*pdwInstrArray)); wInstrSize = INSTRSIZE; // size of last instruction array wInstrWp = wInstrRp = 0; // write/read pointer @@ -1926,6 +1958,8 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM case ID_DEBUG_CODE_GOADR: return OnCodeGoAdr(hDlg); case ID_DEBUG_CODE_GOPC: return OnCodeGoPC(hDlg); case ID_DEBUG_CODE_SETPCTOSELECT: return OnCodeSetPcToSelection(hDlg); + case ID_DEBUG_CODE_PREVPCO: return OnCodeFindPCO(hDlg,dwAdrLine[0],-1); + case ID_DEBUG_CODE_NEXTPCO: return OnCodeFindPCO(hDlg,dwAdrLine[0],1); case ID_BREAKPOINTS_CODEEDIT: return OnEditBreakpoint(hDlg); case ID_BREAKPOINTS_CLEARALL: return OnClearAll(hDlg); case ID_BREAKPOINTS_NOP3: return OnToggleMenuItem(hDlg,LOWORD(wParam),&bDbgNOP3); @@ -2047,9 +2081,9 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM hFont = CreateFont(-MulDiv(8,GetDeviceCaps(hDC, LOGPIXELSY),72),0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,_T("Courier New")); - hFont = SelectObject(hDC,hFont); + hFont = (HFONT) SelectObject(hDC,hFont); GetTextMetrics(hDC,&tm); - hFont = SelectObject(hDC,hFont); + hFont = (HFONT) SelectObject(hDC,hFont); DeleteObject(hFont); ((LPMEASUREITEMSTRUCT) lParam)->itemHeight = tm.tmHeight; @@ -2794,7 +2828,7 @@ static __inline BOOL OnDrawBreakWnd(LPDRAWITEMSTRUCT lpdis) i = (INT) SendMessage(lpdis->hwndItem,LB_GETITEMDATA,lpdis->itemID,0); hdcMem = CreateCompatibleDC(lpdis->hDC); _ASSERT(hBmpCheckBox); - hBmpOld = SelectObject(hdcMem,hBmpCheckBox); + hBmpOld = (HBITMAP) SelectObject(hdcMem,hBmpCheckBox); BitBlt(lpdis->hDC,lpdis->rcItem.left+2,lpdis->rcItem.top+2, 11,lpdis->rcItem.bottom - lpdis->rcItem.top, @@ -3022,9 +3056,9 @@ static INT_PTR CALLBACK EditBreakpoint(HWND hDlg, UINT message, WPARAM wParam, L hFont = CreateFont(-MulDiv(8,GetDeviceCaps(hDC, LOGPIXELSY),72),0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,_T("Courier New")); - hFont = SelectObject(hDC,hFont); + hFont = (HFONT) SelectObject(hDC,hFont); GetTextMetrics(hDC,&tm); - hFont = SelectObject(hDC,hFont); + hFont = (HFONT) SelectObject(hDC,hFont); DeleteObject(hFont); ((LPMEASUREITEMSTRUCT) lParam)->itemHeight = tm.tmHeight; diff --git a/source/source/DEBUGGER.H b/source/DEBUGGER.H similarity index 100% rename from source/source/DEBUGGER.H rename to source/DEBUGGER.H diff --git a/source/source/DISASM.C b/source/DISASM.C similarity index 100% rename from source/source/DISASM.C rename to source/DISASM.C diff --git a/source/source/DISMEM.C b/source/DISMEM.C similarity index 95% rename from source/source/DISMEM.C rename to source/DISMEM.C index 1784c98..d7882e6 100644 --- a/source/source/DISMEM.C +++ b/source/DISMEM.C @@ -11,7 +11,7 @@ typedef struct // type of model memory mapping { - CONST BYTE byType; // calculator type + BYTE byType; // calculator type CONST LPBYTE *ppbyNCE1; // NCE1 data CONST DWORD *pdwNCE1Size; // NCE1 size CONST LPBYTE *ppbyNCE2; // NCE2 data diff --git a/source/source/DISPLAY.C b/source/DISPLAY.C similarity index 95% rename from source/source/DISPLAY.C rename to source/DISPLAY.C index e145149..1c84809 100644 --- a/source/source/DISPLAY.C +++ b/source/DISPLAY.C @@ -137,7 +137,7 @@ VOID CreateLcdBitmap(VOID) hLcdDC = CreateCompatibleDC(hWindowDC); _ASSERT(hLcdDC != NULL); hLcdBitmap = CreateDIBSection(hWindowDC,(BITMAPINFO*)&bmiLcd,DIB_RGB_COLORS,(VOID **)&pbyLcd,NULL,0); - hLcdBitmap = SelectObject(hLcdDC,hLcdBitmap); + hLcdBitmap = (HBITMAP) SelectObject(hLcdDC,hLcdBitmap); _ASSERT(hPalette != NULL); SelectPalette(hLcdDC,hPalette,FALSE); // set palette for LCD DC RealizePalette(hLcdDC); // realize palette @@ -180,7 +180,7 @@ BOOL CreateMainBitmap(LPCTSTR szFilename) hMainDC = NULL; return FALSE; } - hMainBitmap = SelectObject(hMainDC,hMainBitmap); + hMainBitmap = (HBITMAP) SelectObject(hMainDC,hMainBitmap); _ASSERT(hPalette != NULL); hAssertPalette = SelectPalette(hMainDC,hPalette,FALSE); _ASSERT(hAssertPalette != NULL); diff --git a/source/source/EMU48.C b/source/EMU48.C similarity index 83% rename from source/source/EMU48.C rename to source/EMU48.C index aa3beae..8033217 100644 --- a/source/source/EMU48.C +++ b/source/EMU48.C @@ -60,7 +60,6 @@ LARGE_INTEGER lAppStart; // high performance counter value at Appl. start DWORD idDdeInst; // DDE server id UINT uCF_HpObj; // DDE clipboard format HANDLE hThread; -DWORD lThreadId; HANDLE hEventShutdn; // event handle to stop cpu thread HINSTANCE hApp = NULL; @@ -73,6 +72,7 @@ HPALETTE hPalette = NULL; HPALETTE hOldPalette = NULL; // old palette of hWindowDC HCURSOR hCursorArrow = NULL; HCURSOR hCursorHand = NULL; +UINT uWaveDevId = WAVE_MAPPER; // default audio device DWORD dwWakeupDelay = 200; // ON key hold time to switch on calculator BOOL bAutoSave = FALSE; BOOL bAutoSaveOnExit = TRUE; @@ -138,7 +138,7 @@ VOID CopyItemsToClipboard(HWND hWnd) // save selected Listbox Items to Clipboar if ((i = (LONG) SendMessage(hWnd,LB_GETSELCOUNT,0,0)) == 0) return; // no items selected - if ((lpnCount = malloc(i * sizeof(INT))) != NULL) + if ((lpnCount = (LPINT) malloc(i * sizeof(INT))) != NULL) { LPTSTR lpszData; HANDLE hClipObj; @@ -154,7 +154,7 @@ VOID CopyItemsToClipboard(HWND hWnd) // save selected Listbox Items to Clipboar // allocate clipboard data if ((hClipObj = GlobalAlloc(GMEM_MOVEABLE,(lMem + 1) * sizeof(*lpszData))) != NULL) { - if ((lpszData = GlobalLock(hClipObj))) + if ((lpszData = (LPTSTR) GlobalLock(hClipObj))) { for (j = 0;j < i;++j) // scan all selected items { @@ -287,17 +287,11 @@ static VOID SetCommList(HWND hDlg,LPCTSTR szWireSetting,LPCTSTR szIrSetting) return; } -static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +static BOOL CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG lParam) { - TCHAR cPort[8]; - HWND hWndInsertAfter; + HWND hWndInsertAfter; - LPCTSTR szActPort2Filename = _T(""); - - BOOL bPort2CfgChange = FALSE; - BOOL bPort2AttChange = FALSE; - - switch (message) + switch (uMsg) { case WM_INITDIALOG: // init speed checkbox @@ -305,6 +299,12 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA CheckDlgButton(hDlg,IDC_GRAYSCALE,bGrayscale); CheckDlgButton(hDlg,IDC_ALWAYSONTOP,bAlwaysOnTop); CheckDlgButton(hDlg,IDC_ACTFOLLOWSMOUSE,bActFollowsMouse); + #if defined _USRDLL // DLL version + CheckDlgButton(hDlg,IDC_SINGLEINSTANCE,FALSE); + EnableWindow(GetDlgItem(hDlg,IDC_SINGLEINSTANCE),FALSE); + #else + CheckDlgButton(hDlg,IDC_SINGLEINSTANCE,bSingleInstance); + #endif CheckDlgButton(hDlg,IDC_AUTOSAVE,bAutoSave); CheckDlgButton(hDlg,IDC_AUTOSAVEONEXIT,bAutoSaveOnExit); CheckDlgButton(hDlg,IDC_OBJECTLOADWARNING,bLoadObjectWarning); @@ -312,29 +312,59 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA // set disassebler mode CheckDlgButton(hDlg,(disassembler_mode == HP_MNEMONICS) ? IDC_DISASM_HP : IDC_DISASM_CLASS,BST_CHECKED); - - // set sound slider - SendDlgItemMessage(hDlg,IDC_SOUND_SLIDER,TBM_SETRANGE,FALSE,MAKELONG(0,255)); - SendDlgItemMessage(hDlg,IDC_SOUND_SLIDER,TBM_SETTICFREQ,256/8,0); - SendDlgItemMessage(hDlg,IDC_SOUND_SLIDER,TBM_SETPOS,TRUE,dwWaveVol); - - // set sound radio button - CheckDlgButton(hDlg,bWaveBeep ? IDC_SOUND_WAVE : IDC_SOUND_SPEAKER,BST_CHECKED); - EnableWindow(GetDlgItem(hDlg,IDC_SOUND_SLIDER),bWaveBeep); - - // UDP infrared printer settings - SetDlgItemText(hDlg,IDC_IR_ADDR,szUdpServer); - wsprintf(cPort,_T("%u"),wUdpPort); - SetDlgItemText(hDlg,IDC_IR_PORT,cPort); - - // set combobox parameter - SetCommList(hDlg,szSerialWire,szSerialIr); - if (bCommInit) // disable when port open + return TRUE; + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->code) { - EnableWindow(GetDlgItem(hDlg,IDC_WIRE),FALSE); - EnableWindow(GetDlgItem(hDlg,IDC_IR),FALSE); - } + case PSN_KILLACTIVE: + // get speed checkbox value + bRealSpeed = IsDlgButtonChecked(hDlg,IDC_REALSPEED); + bAlwaysOnTop = IsDlgButtonChecked(hDlg,IDC_ALWAYSONTOP); + bActFollowsMouse = IsDlgButtonChecked(hDlg,IDC_ACTFOLLOWSMOUSE); + bSingleInstance = IsDlgButtonChecked(hDlg,IDC_SINGLEINSTANCE); + bAutoSave = IsDlgButtonChecked(hDlg,IDC_AUTOSAVE); + bAutoSaveOnExit = IsDlgButtonChecked(hDlg,IDC_AUTOSAVEONEXIT); + bLoadObjectWarning = IsDlgButtonChecked(hDlg,IDC_OBJECTLOADWARNING); + bAlwaysDisplayLog = IsDlgButtonChecked(hDlg,IDC_ALWAYSDISPLOG); + SetSpeed(bRealSpeed); // set speed + // LCD grayscale checkbox has been changed + if (bGrayscale != (BOOL) IsDlgButtonChecked(hDlg,IDC_GRAYSCALE)) + { + UINT nOldState = SwitchToState(SM_INVALID); + bGrayscale = !bGrayscale; // set new grayscale mode + UpdateContrast(Chipset.contrast); // update LCD color table for new mode + SwitchToState(nOldState); + } + + // set disassembler mode + disassembler_mode = IsDlgButtonChecked(hDlg,IDC_DISASM_HP) ? HP_MNEMONICS : CLASS_MNEMONICS; + + // bAlwaysOnTop maybe changed, so set new window Z order + hWndInsertAfter = bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST; + SetWindowPos(hWnd,hWndInsertAfter,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE); + if (hDlgDebug != NULL) + { + SetWindowPos(GetLastActivePopup(hDlgDebug),hWndInsertAfter,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE); + } + return TRUE; + } + break; + } + return FALSE; + UNREFERENCED_PARAMETER(wParam); +} + +static BOOL CALLBACK SettingsMemoryProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG lParam) +{ + LPCTSTR szActPort2Filename = _T(""); + + BOOL bPort2CfgChange = FALSE; + BOOL bPort2AttChange = FALSE; + + switch (uMsg) + { + case WM_INITDIALOG: // HP48SX/GX if (cCurrentRomType=='S' || cCurrentRomType=='G' || cCurrentRomType==0) { @@ -371,22 +401,11 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA EnableWindow(GetDlgItem(hDlg,IDC_PORT2WR),FALSE); EnableWindow(GetDlgItem(hDlg,IDC_PORT2),FALSE); EnableWindow(GetDlgItem(hDlg,IDC_PORT2LOAD),FALSE); - if (cCurrentRomType=='X' || cCurrentRomType=='2' || cCurrentRomType=='Q') // HP49G/HP48GII/HP49G+ // CdB for HP: add Apples - { - SendDlgItemMessage(hDlg,IDC_IR,CB_RESETCONTENT,0,0); - EnableWindow(GetDlgItem(hDlg,IDC_IR),FALSE); - } } return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { - case IDC_SOUND_SPEAKER: - EnableWindow(GetDlgItem(hDlg,IDC_SOUND_SLIDER),FALSE); - return TRUE; - case IDC_SOUND_WAVE: - EnableWindow(GetDlgItem(hDlg,IDC_SOUND_SLIDER),TRUE); - return TRUE; case IDC_PORT2LOAD: if (GetLoadObjectFilename(_T(BIN_FILTER),_T("BIN"))) { @@ -408,12 +427,17 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA CheckDlgButton(hDlg,IDC_PORT2WR,IsFileWriteable(szBufferFilename)); } return TRUE; - case IDOK: + } + break; + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->code) + { + case PSN_KILLACTIVE: if (Chipset.Port1Size && (cCurrentRomType!='X' || cCurrentRomType!='2' || cCurrentRomType!='Q')) // CdB for HP: add apples { UINT nOldState = SwitchToState(SM_SLEEP); // save old card status - BYTE bCardsStatus = Chipset.cards_status; + BYTE byCardsStatus = Chipset.cards_status; // port1 disabled? Chipset.cards_status &= ~(PORT1_PRESENT | PORT1_WRITE); @@ -425,7 +449,7 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA } // changed card status in slot1? - if ( ((bCardsStatus ^ Chipset.cards_status) & (PORT1_PRESENT | PORT1_WRITE)) != 0 + if ( ((byCardsStatus ^ Chipset.cards_status) & (PORT1_PRESENT | PORT1_WRITE)) != 0 && (Chipset.IORam[CARDCTL] & ECDT) != 0 && (Chipset.IORam[TIMER2_CTRL] & RUN) != 0 ) { @@ -437,7 +461,7 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA SwitchToState(nOldState); } // HP48SX/GX port2 change settings detection - if(cCurrentRomType=='S' || cCurrentRomType=='G' || cCurrentRomType==0) + if (cCurrentRomType=='S' || cCurrentRomType=='G' || cCurrentRomType==0) { TCHAR szFilename[MAX_PATH]; BOOL bOldPort2IsShared = bPort2IsShared; @@ -470,23 +494,7 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA bPort2CfgChange = TRUE; // slot2 configuration changed } } - // get speed checkbox value - bRealSpeed = IsDlgButtonChecked(hDlg,IDC_REALSPEED); - bAlwaysOnTop = IsDlgButtonChecked(hDlg,IDC_ALWAYSONTOP); - bActFollowsMouse = IsDlgButtonChecked(hDlg,IDC_ACTFOLLOWSMOUSE); - bAutoSave = IsDlgButtonChecked(hDlg, IDC_AUTOSAVE); - bAutoSaveOnExit = IsDlgButtonChecked(hDlg, IDC_AUTOSAVEONEXIT); - bLoadObjectWarning = IsDlgButtonChecked(hDlg, IDC_OBJECTLOADWARNING); - bAlwaysDisplayLog = IsDlgButtonChecked(hDlg, IDC_ALWAYSDISPLOG); - SetSpeed(bRealSpeed); // set speed - // LCD grayscale checkbox has been changed - if (bGrayscale != (BOOL) IsDlgButtonChecked(hDlg,IDC_GRAYSCALE)) - { - UINT nOldState = SwitchToState(SM_INVALID); - bGrayscale = !bGrayscale; // set new grayscale mode - UpdateContrast(Chipset.contrast); // update LCD color table for new mode - SwitchToState(nOldState); - } + if (bPort2CfgChange) // slot2 configuration changed { UINT nOldState = SwitchToState(SM_INVALID); @@ -530,8 +538,63 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA } SwitchToState(nOldState); } - // set disassembler mode - disassembler_mode = IsDlgButtonChecked(hDlg,IDC_DISASM_HP) ? HP_MNEMONICS : CLASS_MNEMONICS; + return TRUE; + } + break; + } + return FALSE; +} + +static BOOL CALLBACK SettingsPeripheralProc(HWND hDlg, UINT uMsg, DWORD wParam, LONG lParam) +{ + TCHAR cPort[8]; + + switch (uMsg) + { + case WM_INITDIALOG: + // set sound slider + SendDlgItemMessage(hDlg,IDC_SOUND_SLIDER,TBM_SETRANGE,FALSE,MAKELONG(0,255)); + SendDlgItemMessage(hDlg,IDC_SOUND_SLIDER,TBM_SETTICFREQ,256/8,0); + SendDlgItemMessage(hDlg,IDC_SOUND_SLIDER,TBM_SETPOS,TRUE,dwWaveVol); + + // set sound radio button + CheckDlgButton(hDlg,bWaveBeep ? IDC_SOUND_WAVE : IDC_SOUND_SPEAKER,BST_CHECKED); + EnableWindow(GetDlgItem(hDlg,IDC_SOUND_SLIDER),bWaveBeep); + + // UDP infrared printer settings + SetDlgItemText(hDlg,IDC_IR_ADDR,szUdpServer); + wsprintf(cPort,_T("%u"),wUdpPort); + SetDlgItemText(hDlg,IDC_IR_PORT,cPort); + + // set combobox parameter + SetCommList(hDlg,szSerialWire,szSerialIr); + if (bCommInit) // disable when port open + { + EnableWindow(GetDlgItem(hDlg,IDC_WIRE),FALSE); + EnableWindow(GetDlgItem(hDlg,IDC_IR),FALSE); + } + + if (cCurrentRomType=='X' || cCurrentRomType=='2' || cCurrentRomType=='Q') // HP49G/HP48GII/HP49G+ // CdB for HP: add Apples + { + SendDlgItemMessage(hDlg,IDC_IR,CB_RESETCONTENT,0,0); + EnableWindow(GetDlgItem(hDlg,IDC_IR),FALSE); + } + return TRUE; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_SOUND_SPEAKER: + EnableWindow(GetDlgItem(hDlg,IDC_SOUND_SLIDER),FALSE); + return TRUE; + case IDC_SOUND_WAVE: + EnableWindow(GetDlgItem(hDlg,IDC_SOUND_SLIDER),TRUE); + return TRUE; + } + break; + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->code) + { + case PSN_KILLACTIVE: // set sound data dwWaveVol = (DWORD) SendDlgItemMessage(hDlg,IDC_SOUND_SLIDER,TBM_GETPOS,0,0); bWaveBeep = IsDlgButtonChecked(hDlg,IDC_SOUND_WAVE); @@ -545,24 +608,15 @@ static INT_PTR CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPA // HP49G, 48GII, 49G+ Ir port is not connected if (cCurrentRomType!='X' && cCurrentRomType!='2' && cCurrentRomType!='Q') // HP49G/HP48GII/HP49G+ // CdB for HP: add Apples GetDlgItemText(hDlg,IDC_IR,szSerialIr,ARRAYSIZEOF(szSerialIr)); - // set window Z order - hWndInsertAfter = bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST; - 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); - } - // no break - case IDCANCEL: - EndDialog(hDlg, LOWORD(wParam)); + return TRUE; } break; } return FALSE; - UNREFERENCED_PARAMETER(lParam); } + //################ //# //# Save Helper @@ -770,7 +824,7 @@ static LRESULT OnInitMenu(HMENU hMenu) // // WM_DROPFILES // -static LRESULT OnDropFiles(HANDLE hFilesInfo) +static LRESULT OnDropFiles(HDROP hFilesInfo) { TCHAR szFileName[MAX_PATH]; WORD wNumFiles,wIndex; @@ -993,9 +1047,9 @@ static LRESULT OnViewCopy(VOID) _ASSERT(nLcdZoom == 1 || nLcdZoom == 2 || nLcdZoom == 4); hBmp = CreateCompatibleBitmap(hLcdDC,131*nLcdZoom,SCREENHEIGHT*nLcdZoom); // CdB for HP: add apples display stuff hBmpDC = CreateCompatibleDC(hLcdDC); - hBmp = SelectObject(hBmpDC,hBmp); + hBmp = (HBITMAP) SelectObject(hBmpDC,hBmp); StretchBlt(hBmpDC,0,0,131*nLcdZoom,SCREENHEIGHT*nLcdZoom,hLcdDC,0,0, 131, SCREENHEIGHT, SRCCOPY); // CdB for HP: add apples display stuff - hBmp = SelectObject(hBmpDC,hBmp); + hBmp = (HBITMAP) SelectObject(hBmpDC,hBmp); // fill BITMAP structure for size information GetObject(hBmp, sizeof(bm), &bm); @@ -1024,7 +1078,7 @@ static LRESULT OnViewCopy(VOID) // memory allocation for clipboard data if ((hClipObj = GlobalAlloc(GMEM_MOVEABLE, dwLen)) != NULL) { - lpbi = GlobalLock(hClipObj); + lpbi = (LPBITMAPINFOHEADER ) GlobalLock(hClipObj); // initialize BITMAPINFOHEADER lpbi->biSize = sizeof(BITMAPINFOHEADER); lpbi->biWidth = bm.bmWidth; @@ -1047,7 +1101,7 @@ static LRESULT OnViewCopy(VOID) GetObject(hPalette,sizeof(WORD),&wBits); // memory allocation for temporary palette data - if ((ppal = calloc(sizeof(LOGPALETTE) + wBits * sizeof(PALETTEENTRY),1)) != NULL) + if ((ppal = (PLOGPALETTE) calloc(sizeof(LOGPALETTE) + wBits * sizeof(PALETTEENTRY),1)) != NULL) { ppal->palVersion = PALVERSION; ppal->palNumEntries = wBits; @@ -1098,13 +1152,80 @@ static LRESULT OnViewReset(VOID) // // ID_VIEW_SETTINGS // +static INT_PTR CALLBACK PropSheetProc(HWND hwndPropSheet, UINT uMsg, LPARAM lParam) +{ + switch(uMsg) + { + // called before the dialog is created, hwndPropSheet = NULL, lParam points to dialog resource + case PSCB_PRECREATE: + { + LPDLGTEMPLATE lpTemplate = (LPDLGTEMPLATE) lParam; + if(!(lpTemplate->style & WS_SYSMENU)) + { + lpTemplate->style |= WS_SYSMENU; + } + } + break; + + // called after the dialog is created + case PSCB_INITIALIZED: + break; + } + return 0; + UNREFERENCED_PARAMETER(hwndPropSheet); +} + static LRESULT OnViewSettings(VOID) { + PROPSHEETPAGE psp[3]; + PROPSHEETHEADER psh; + // not in nState = SM_INVALID or port2 file must be closed from document _ASSERT(nState != SM_INVALID || pbyPort2 == NULL); - if (DialogBox(hApp, MAKEINTRESOURCE(IDD_SETTINGS), hWnd, (DLGPROC)SettingsProc) == -1) - AbortMessage(_T("Settings Dialog Creation Error !")); + psp[0].dwSize = sizeof(PROPSHEETPAGE); + psp[0].dwFlags = PSP_DEFAULT; + psp[0].hInstance = hApp; + psp[0].pszTemplate = MAKEINTRESOURCE(IDD_SET_GENERAL); + psp[0].hIcon = NULL; + psp[0].pszTitle = NULL; + psp[0].pfnDlgProc = (DLGPROC) SettingsGeneralProc; + psp[0].lParam = 0; + psp[0].pfnCallback = NULL; + + psp[1].dwSize = sizeof(PROPSHEETPAGE); + psp[1].dwFlags = PSP_DEFAULT; + psp[1].hInstance = hApp; + psp[1].pszTemplate = MAKEINTRESOURCE(IDD_SET_MEMORY); + psp[1].hIcon = NULL; + psp[1].pszTitle = NULL; + psp[1].pfnDlgProc = (DLGPROC) SettingsMemoryProc; + psp[1].lParam = 0; + psp[1].pfnCallback = NULL; + + psp[2].dwSize = sizeof(PROPSHEETPAGE); + psp[2].dwFlags = PSP_DEFAULT; + psp[2].hInstance = hApp; + psp[2].pszTemplate = MAKEINTRESOURCE(IDD_SET_PERIPHERAL); + psp[2].hIcon = NULL; + psp[2].pszTitle = NULL; + psp[2].pfnDlgProc = (DLGPROC) SettingsPeripheralProc; + psp[2].lParam = 0; + psp[2].pfnCallback = NULL; + + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_NOAPPLYNOW; + psh.hwndParent = hWnd; + psh.hInstance = hApp; + psh.hIcon = NULL; + psh.pszCaption = _T("Settings"); + psh.nPages = ARRAYSIZEOF(psp); + psh.nStartPage = 0; + psh.ppsp = (LPCPROPSHEETPAGE) &psp; + psh.pfnCallback = (PFNPROPSHEETCALLBACK) PropSheetProc; + + if (PropertySheet(&psh) == -1) + AbortMessage(_T("Settings Property Sheet Creation Error!")); WriteSettings(); return 0; @@ -1164,6 +1285,13 @@ static LRESULT OnViewScript(VOID) if (bSucc) { + if (Chipset.wRomCrc != wRomCrc) // ROM changed + { + CpuReset(); + Chipset.Shutdn = FALSE; // automatic restart + + Chipset.wRomCrc = wRomCrc; // update current ROM fingerprint + } if (pbyRom) SwitchToState(SM_RUN); // continue emulation } else @@ -1538,6 +1666,64 @@ static LRESULT OnKeyUp(int nVirtKey, LPARAM lKeyData) UNREFERENCED_PARAMETER(lKeyData); } +static LRESULT OnCopyData(PCOPYDATASTRUCT psCDS) +{ + switch (psCDS->dwData) + { + case CDID_FILENAME: + // current instance has document loaded and got a wide-character file name + if (bDocumentAvail && psCDS->cbData > 0 && psCDS->lpData != NULL) + { + TCHAR szActFilename[MAX_PATH]; + LPTSTR lpFilePart; // address of file name in path + + #if defined _UNICODE + { + // get full path file name for requested state file + GetFullPathName((LPCTSTR) psCDS->lpData,ARRAYSIZEOF(szBufferFilename),szBufferFilename,&lpFilePart); + } + #else + { + CHAR szAscFilename[MAX_PATH]; + + WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, + (LPCWSTR) psCDS->lpData, -1, + szAscFilename, ARRAYSIZEOF(szAscFilename), NULL, NULL); + + // get full path file name for requested state file + GetFullPathName(szAscFilename,ARRAYSIZEOF(szBufferFilename),szBufferFilename,&lpFilePart); + } + #endif + + // get full path file name for actual state file + GetFullPathName(szCurrentFilename,ARRAYSIZEOF(szActFilename),szActFilename,&lpFilePart); + + // check if both file names are unequal + if (lstrcmpi(szBufferFilename,szActFilename) != 0) + { + UINT nCurState; + + if (pbyRom) + { + nCurState = SwitchToState(SM_INVALID); + if (IDCANCEL == SaveChanges(bAutoSave)) + goto cancel; + } + if (OpenDocument(szBufferFilename)) // open new file + { + MruAdd(szBufferFilename); + } +cancel: + if (pbyRom) SwitchToState(nCurState); + } + } + break; + default: + return FALSE; // message not processed + } + return TRUE; // message processed +} + LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) @@ -1546,7 +1732,7 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_DESTROY: return OnDestroy(hWindow); case WM_PAINT: return OnPaint(hWindow); case WM_INITMENU: return OnInitMenu((HMENU) wParam); - case WM_DROPFILES: return OnDropFiles((HANDLE) wParam); + case WM_DROPFILES: return OnDropFiles((HDROP) wParam); case WM_ACTIVATE: if (LOWORD(wParam)==WA_INACTIVE) break; case WM_QUERYNEWPALETTE: @@ -1612,12 +1798,15 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar } break; case WM_RBUTTONDOWN: - case WM_LBUTTONDOWN: return OnLButtonDown((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_NCMOUSEMOVE: return OnNcMouseMove((UINT) wParam, LOWORD(lParam), HIWORD(lParam)); - case WM_KEYUP: return OnKeyUp((int)wParam, lParam); - case WM_KEYDOWN: return OnKeyDown((int)wParam, lParam); + case WM_LBUTTONDOWN: return OnLButtonDown((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_NCMOUSEMOVE: return OnNcMouseMove((UINT) wParam, LOWORD(lParam), HIWORD(lParam)); + case WM_KEYUP: return OnKeyUp((int)wParam, lParam); + case WM_KEYDOWN: return OnKeyDown((int)wParam, lParam); + #if !defined _USRDLL // not in DLL version + case WM_COPYDATA: return OnCopyData((PCOPYDATASTRUCT) lParam); + #endif } return DefWindowProc(hWindow, uMsg, wParam, lParam); } @@ -1630,13 +1819,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC RECT rectWindow; HACCEL hAccel; HSZ hszService, hszTopic; // variables for DDE server + DWORD dwThreadId; DWORD_PTR dwAffMask; LPTSTR lpFilePart; hApp = hInst; #if defined _UNICODE { - ppArgv = CommandLineToArgvW(GetCommandLine(),&nArgc); + ppArgv = (LPCTSTR*) CommandLineToArgvW(GetCommandLine(),&nArgc); } #else { @@ -1671,12 +1861,55 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC // running an instance of me? if (bSingleInstance && (hWnd = FindWindow(MAKEINTATOM(classAtom),NULL)) != NULL) { + COPYDATASTRUCT sCDS; + if (IsIconic(hWnd)) // window minimized ShowWindow(hWnd,SW_RESTORE); // show window // put the window into foreground ForceForegroundWindow(GetLastActivePopup(hWnd)); - return 0; // quit + + if (nArgc >= 2) // use decoded parameter line + { + LPTSTR lpFilePart; // address of file name in path + DWORD dwLength; // file name length + + // get full path file name + GetFullPathName(ppArgv[1],ARRAYSIZEOF(szBufferFilename),szBufferFilename,&lpFilePart); + + // size of file name incl. EOS + dwLength = lstrlen(szBufferFilename) + 1; + sCDS.cbData = dwLength * sizeof(WCHAR); + + #if defined _UNICODE + { + sCDS.lpData = szBufferFilename; + } + #else + { + sCDS.lpData = _alloca(sCDS.cbData); + if (sCDS.lpData != NULL) + { + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szBufferFilename, dwLength, + (LPWSTR) sCDS.lpData, sCDS.cbData); + } + else + { + sCDS.cbData = 0; // size of file name + } + } + #endif + } + else + { + sCDS.lpData = NULL; // file name + sCDS.cbData = 0; // size of file name + } + + // fill the COPYDATA structure and send file name to other instance + sCDS.dwData = CDID_FILENAME; // function identifier + SendMessage(hWnd,WM_COPYDATA,(WPARAM) NULL,(LPARAM) &sCDS); + return 0; // quit program } // Create window @@ -1720,7 +1953,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC nState = SM_RUN; // init state must be <> nNextState nNextState = SM_INVALID; // go into invalid state - hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&WorkerThread, NULL, CREATE_SUSPENDED, &lThreadId); + hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&WorkerThread, NULL, CREATE_SUSPENDED, &dwThreadId); if (hThread == NULL) { CloseHandle(hEventShutdn); // close event handle diff --git a/source/source/EMU48.H b/source/EMU48.H similarity index 92% rename from source/source/EMU48.H rename to source/EMU48.H index 5dc3242..c9d650f 100644 --- a/source/source/EMU48.H +++ b/source/EMU48.H @@ -57,6 +57,11 @@ #define DISP_MENUE 0x04 #define DISP_ANNUN 0x08 +#define ROMPAGESIZE (1<<12) // ROM dirty page size in nibbles + +// WM_COPYDATA identifier +#define CDID_FILENAME 1 // send file name + // macro to check for valid calculator model #define isModelValid(m) (m != 0 && strchr(MODELS,m) != NULL) #define isModelApple(m) (m != 0 && strchr(APPLEHARD,m) != NULL) @@ -92,11 +97,12 @@ extern UINT uCF_HpObj; extern HINSTANCE hApp; extern HWND hWnd; extern HWND hDlgDebug; -extern HWND hDlgFind; -extern HWND hDlgProfile; +extern HWND hDlgFind; +extern HWND hDlgProfile; extern HDC hWindowDC; -extern HCURSOR hCursorArrow; -extern HCURSOR hCursorHand; +extern HCURSOR hCursorArrow; +extern HCURSOR hCursorHand; +extern UINT uWaveDevId; extern DWORD dwWakeupDelay; extern BOOL bAutoSave; extern BOOL bAutoSaveOnExit; @@ -106,9 +112,8 @@ extern BOOL bAlwaysDisplayLog; extern BOOL bLoadObjectWarning; extern BOOL bAlwaysOnTop; extern BOOL bActFollowsMouse; -extern BOOL bSingleInstance; +extern BOOL bSingleInstance; extern HANDLE hThread; -extern DWORD lThreadId; extern VOID SetWindowTitle(LPCTSTR szString); extern VOID CopyItemsToClipboard(HWND hWnd); extern VOID ForceForegroundWindow(HWND hWnd); @@ -168,8 +173,10 @@ extern VOID StopDisplay(VOID); extern BOOL bInterrupt; extern UINT nState; extern UINT nNextState; +extern BOOL bEnableSlow; extern BOOL bRealSpeed; extern BOOL bKeySlow; +extern BOOL bSoundSlow; extern UINT nOpcSlow; extern BOOL bCommInit; extern BOOL bGrayscale; @@ -228,6 +235,8 @@ extern LPBYTE Port2; extern LPBYTE pbyRom; extern BOOL bRomWriteable; extern DWORD dwRomSize; +extern LPBYTE pbyRomDirtyPage; +extern DWORD dwRomDirtyPageSize; extern WORD wRomCrc; extern LPBYTE pbyPort2; extern BOOL bPort2Writeable; @@ -344,6 +353,13 @@ extern DWORD dwWaveVol; extern VOID External(CHIPSET* w); extern VOID RCKBp(CHIPSET* w); +// Sound.c +#define SoundAvailable(a) FALSE +#define SoundGetDeviceID(a) FALSE +#define SoundOpen(a) FALSE +#define SoundClose() +#define SoundOut(a,b) + // DDEserv.c extern HDDEDATA CALLBACK DdeCallback(UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD); @@ -401,7 +417,7 @@ static __inline int YesNoCancelMessage(LPCTSTR szMessage,UINT uStyle) {return Me static __inline LPTSTR DuplicateString(LPCTSTR szString) { UINT uLength = lstrlen(szString) + 1; - LPTSTR szDup = malloc(uLength*sizeof(szDup[0])); + LPTSTR szDup = (LPTSTR) malloc(uLength*sizeof(szDup[0])); lstrcpy(szDup,szString); return szDup; } diff --git a/source/source/EMU48.ICO b/source/EMU48.ICO similarity index 100% rename from source/source/EMU48.ICO rename to source/EMU48.ICO diff --git a/source/source/EMU48.RC b/source/EMU48.RC similarity index 87% rename from source/source/EMU48.RC rename to source/EMU48.RC index a615aa1..e67ab05 100644 --- a/source/source/EMU48.RC +++ b/source/EMU48.RC @@ -69,12 +69,40 @@ BEGIN BOTTOMMARGIN, 145 END - IDD_SETTINGS, DIALOG + IDD_SET_GENERAL, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 160 - TOPMARGIN, 4 - BOTTOMMARGIN, 319 + RIGHTMARGIN, 244 + VERTGUIDE, 14 + VERTGUIDE, 161 + VERTGUIDE, 168 + VERTGUIDE, 237 + TOPMARGIN, 7 + BOTTOMMARGIN, 127 + END + + IDD_SET_MEMORY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + VERTGUIDE, 14 + VERTGUIDE, 237 + TOPMARGIN, 7 + BOTTOMMARGIN, 127 + END + + IDD_SET_PERIPHERAL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + VERTGUIDE, 14 + VERTGUIDE, 147 + VERTGUIDE, 154 + VERTGUIDE, 161 + VERTGUIDE, 237 + TOPMARGIN, 7 + BOTTOMMARGIN, 127 + HORZGUIDE, 82 END IDD_CHOOSEKML, DIALOG @@ -250,74 +278,88 @@ 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 © 2012 Christoph Gießelink && Sébastien Carlier", + LTEXT "Copyright © 2013 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 | ES_READONLY END -IDD_SETTINGS DIALOG DISCARDABLE 0, 0, 167, 326 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Settings" +IDD_SET_GENERAL DIALOG DISCARDABLE 0, 0, 251, 134 +STYLE WS_CHILD | WS_VISIBLE | WS_CAPTION +CAPTION "General" FONT 8, "MS Sans Serif" BEGIN CONTROL "Authentic Calculator Speed",IDC_REALSPEED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,13,100,10 + BS_AUTOCHECKBOX | WS_TABSTOP,14,17,133,10 CONTROL "Enable Virtual LCD Delay",IDC_GRAYSCALE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,25,100,10 + BS_AUTOCHECKBOX | WS_TABSTOP,14,28,133,10 CONTROL "Always On Top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,37,65,10 + WS_TABSTOP,14,40,133,10 CONTROL "Activation Follows Mouse",IDC_ACTFOLLOWSMOUSE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,49,100,10 + BS_AUTOCHECKBOX | WS_TABSTOP,14,52,133,10 + CONTROL "Single Instance",IDC_SINGLEINSTANCE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,14,64,133,10 CONTROL "Automatically Save Files",IDC_AUTOSAVE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,61,89,10 + BS_AUTOCHECKBOX | WS_TABSTOP,14,76,133,10 CONTROL "Automatically Save Files On Exit",IDC_AUTOSAVEONEXIT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,73,114,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,88,133,10 CONTROL "Show Load Object Warning",IDC_OBJECTLOADWARNING,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,85,102,10 + BS_AUTOCHECKBOX | WS_TABSTOP,14,100,133,10 CONTROL "Always Show KML Compilation Result",IDC_ALWAYSDISPLOG, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,97,133,10 - GROUPBOX "General",IDC_STATIC,7,4,153,107 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,112,133,10 + GROUPBOX "General",IDC_STATIC,7,7,148,120 CONTROL "HP Mnemonics",IDC_DISASM_HP,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,13,123,65,11 + WS_GROUP | WS_TABSTOP,168,21,69,11 CONTROL "Class Mnemonics",IDC_DISASM_CLASS,"Button", - BS_AUTORADIOBUTTON,84,123,70,11 - GROUPBOX "Disassembler",IDC_STATIC,7,114,153,26 - LTEXT "Volume",IDC_STATIC,13,156,24,8 - CONTROL "Slider1",IDC_SOUND_SLIDER,"msctls_trackbar32", - TBS_AUTOTICKS | WS_TABSTOP,39,151,68,18 - CONTROL "Speaker",IDC_SOUND_SPEAKER,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,111,150,43,10 - CONTROL "Wave",IDC_SOUND_WAVE,"Button",BS_AUTORADIOBUTTON,111, - 161,43,10 - GROUPBOX "Sound",IDC_STATIC,7,142,153,34 + BS_AUTORADIOBUTTON,168,35,69,11 + GROUPBOX "Disassembler",IDC_STATIC,161,7,83,120 +END + +IDD_SET_MEMORY DIALOG DISCARDABLE 0, 0, 251, 134 +STYLE WS_CHILD | WS_VISIBLE | WS_CAPTION +CAPTION "Memory" +FONT 8, "MS Sans Serif" +BEGIN CONTROL "Port 1 is Plugged",IDC_PORT1EN,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,187,67,10 + WS_TABSTOP,14,20,67,10 CONTROL "Port 1 is Writeable",IDC_PORT1WR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,84,187,69,10 + BS_AUTOCHECKBOX | WS_TABSTOP,124,20,69,10 CONTROL "Port 2 is Shared",IDC_PORT2ISSHARED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,199,65,10 + BS_AUTOCHECKBOX | WS_TABSTOP,14,32,65,10 CONTROL "Port 2 is Writeable",IDC_PORT2WR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,84,199,69,10 - LTEXT "Port 2 File :",IDC_STATIC,13,214,37,8 - EDITTEXT IDC_PORT2,51,212,94,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_PORT2LOAD,145,212,10,12 - GROUPBOX "Memory Cards",IDC_STATIC,7,178,153,51 - LTEXT "IP Address:",IDC_STATIC,13,242,37,8 - LTEXT "Port:",IDC_STATIC,126,242,16,8 - EDITTEXT IDC_IR_ADDR,13,252,110,12,ES_AUTOHSCROLL - EDITTEXT IDC_IR_PORT,126,252,28,12,ES_NUMBER - GROUPBOX "Infrared Printer",IDC_STATIC,7,232,153,38 - LTEXT "Wire:",IDC_STATIC,13,284,17,8 - COMBOBOX IDC_WIRE,31,282,48,42,CBS_DROPDOWNLIST | WS_VSCROLL | + BS_AUTOCHECKBOX | WS_TABSTOP,124,32,69,10 + LTEXT "Port 2 File :",IDC_STATIC,14,47,37,8 + EDITTEXT IDC_PORT2,52,45,175,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_PORT2LOAD,227,45,10,12 + GROUPBOX "Memory Cards",IDC_STATIC,7,7,237,58 +END + +IDD_SET_PERIPHERAL DIALOG DISCARDABLE 0, 0, 251, 134 +STYLE WS_CHILD | WS_VISIBLE | WS_CAPTION +CAPTION "Peripheral" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Volume",IDC_STATIC,14,21,24,8 + CONTROL "Slider1",IDC_SOUND_SLIDER,"msctls_trackbar32", + TBS_AUTOTICKS | WS_TABSTOP,40,16,84,18 + CONTROL "Speaker",IDC_SOUND_SPEAKER,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,135,20,43,10 + CONTROL "Wave",IDC_SOUND_WAVE,"Button",BS_AUTORADIOBUTTON,194,20, + 43,10 + GROUPBOX "Sound",IDC_STATIC,7,7,237,34 + LTEXT "IP Address:",IDC_STATIC,14,60,37,8 + LTEXT "Port:",IDC_STATIC,119,60,16,8 + EDITTEXT IDC_IR_ADDR,14,70,101,12,ES_AUTOHSCROLL + EDITTEXT IDC_IR_PORT,119,70,28,12,ES_NUMBER + GROUPBOX "Infrared Printer",IDC_STATIC,7,43,147,50 + LTEXT "Wire:",IDC_STATIC,168,58,17,8 + COMBOBOX IDC_WIRE,189,56,48,42,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "IR:",IDC_STATIC,89,284,9,8 - COMBOBOX IDC_IR,107,282,48,43,CBS_DROPDOWNLIST | WS_VSCROLL | + LTEXT "IR:",IDC_STATIC,168,74,9,8 + COMBOBOX IDC_IR,189,72,48,43,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Serial Ports",IDC_STATIC,7,272,153,27 - DEFPUSHBUTTON "OK",IDOK,9,305,50,14 - PUSHBUTTON "Cancel",IDCANCEL,107,305,50,14 + GROUPBOX "Serial Ports",IDC_STATIC,161,43,83,50 END IDD_CHOOSEKML DIALOG DISCARDABLE 0, 0, 195, 66 @@ -648,7 +690,7 @@ BEGIN VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0" VALUE "FileVersion", "1, 5, 3, 0\0" VALUE "InternalName", "Emu48\0" - VALUE "LegalCopyright", "Copyright © 2012\0" + VALUE "LegalCopyright", "Copyright © 2013\0" VALUE "OriginalFilename", "Emu48.exe\0" VALUE "ProductName", "Emu48\0" VALUE "ProductVersion", "1, 5, 3, 0\0" @@ -779,6 +821,12 @@ BEGIN MENUITEM "Go to &PC", ID_DEBUG_CODE_GOPC MENUITEM "Set &breakpoint\tF2", ID_BREAKPOINTS_SETBREAK MENUITEM "&Set PC to selection", ID_DEBUG_CODE_SETPCTOSELECT + MENUITEM SEPARATOR + POPUP "&Find" + BEGIN + MENUITEM "&Previous PCO", ID_DEBUG_CODE_PREVPCO + MENUITEM "&Next PCO", ID_DEBUG_CODE_NEXTPCO + END END END diff --git a/source/source/EMU48.XML b/source/EMU48.XML similarity index 100% rename from source/source/EMU48.XML rename to source/EMU48.XML diff --git a/source/source/EMU48DLL.C b/source/EMU48DLL.C similarity index 96% rename from source/source/EMU48DLL.C rename to source/EMU48DLL.C index b648362..3c0b975 100644 --- a/source/source/EMU48DLL.C +++ b/source/EMU48DLL.C @@ -79,6 +79,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) BOOL DLLCreateWnd(LPCTSTR lpszFilename, LPCTSTR lpszPort2Name) { RECT rectWindow; + DWORD dwThreadId; BOOL bFileExist = FALSE; // state file don't exist @@ -160,7 +161,7 @@ BOOL DLLCreateWnd(LPCTSTR lpszFilename, LPCTSTR lpszPort2Name) nState = SM_RUN; // init state must be <> nNextState nNextState = SM_INVALID; // go into invalid state - hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&WorkerThread, NULL, CREATE_SUSPENDED, &lThreadId); + hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&WorkerThread, NULL, CREATE_SUSPENDED, &dwThreadId); if (hThread == NULL) { CloseHandle(hEventDebug); // close debugger event handle diff --git a/source/source/EMU48DLL.DSP b/source/EMU48DLL.DSP similarity index 92% rename from source/source/EMU48DLL.DSP rename to source/EMU48DLL.DSP index 954ab40..9538f17 100644 --- a/source/source/EMU48DLL.DSP +++ b/source/EMU48DLL.DSP @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib advapi32.lib ws2_32.lib /nologo /dll /machine:I386 /out:".\Release/Emu48.dll" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib ws2_32.lib /nologo /dll /machine:I386 /out:".\Release/Emu48.dll" !ELSEIF "$(CFG)" == "Emu48 - Win32 Debug" @@ -79,7 +79,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib advapi32.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:".\Debug/Emu48.dll" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:".\Debug/Emu48.dll" !ENDIF diff --git a/source/source/EMU48DLL.DSW b/source/EMU48DLL.DSW similarity index 100% rename from source/source/EMU48DLL.DSW rename to source/EMU48DLL.DSW diff --git a/source/source/EMU48DLL.H b/source/EMU48DLL.H similarity index 100% rename from source/source/EMU48DLL.H rename to source/EMU48DLL.H diff --git a/source/source/ENGINE.C b/source/ENGINE.C similarity index 94% rename from source/source/ENGINE.C rename to source/ENGINE.C index 8f76755..1a6e2d4 100644 --- a/source/source/ENGINE.C +++ b/source/ENGINE.C @@ -17,8 +17,10 @@ BOOL bInterrupt = FALSE; UINT nState = SM_INVALID; UINT nNextState = SM_RUN; +BOOL bEnableSlow = TRUE; // slow down is enabled BOOL bRealSpeed = FALSE; BOOL bKeySlow = FALSE; // slow down for key emulation +BOOL bSoundSlow = FALSE; // slow down for sound emulation UINT nOpcSlow = 0; // no. of opcodes to slow down BOOL bCommInit = FALSE; // COM port not open @@ -278,7 +280,9 @@ static __inline VOID CheckDisp(BOOL bSync) static __inline VOID AdjustSpeed(VOID) // adjust emulation speed { - if (bCpuSlow || bKeySlow || nOpcSlow > 0) // emulation slow down + // emulation slow down + if ( bEnableSlow + && (bCpuSlow || bKeySlow || bSoundSlow || nOpcSlow > 0)) { DWORD dwCycles,dwTicks; @@ -329,7 +333,7 @@ VOID CheckSerial(VOID) VOID InitAdjustSpeed(VOID) { // slow down function not initalized - if (!bCpuSlow && !bKeySlow && nOpcSlow == 0) + if (!bEnableSlow || (!bCpuSlow && !bKeySlow && !bSoundSlow && nOpcSlow == 0)) { LARGE_INTEGER lTime; // sample timer ticks // save reference cycles @@ -563,6 +567,7 @@ loop: QueryPerformanceCounter(&lDummyInt); dwSpeedRef = lDummyInt.LowPart; SetHP48Time(); // update HP48 time & date + SoundOpen(uWaveDevId); // open waveform-audio output device StartTimers(); // start display counter/update engine StartDisplay((BYTE)(((Chipset.IORam[LINECOUNT+1]<<4)|Chipset.IORam[LINECOUNT])&0x3F)); @@ -624,6 +629,7 @@ loop: StopDisplay(); // stop display counter/update StopTimers(); + SoundClose(); // close waveform-audio output device while (nNextState == SM_SLEEP) // go into sleep state { diff --git a/source/source/EXTERNAL.C b/source/EXTERNAL.C similarity index 85% rename from source/source/EXTERNAL.C rename to source/EXTERNAL.C index 44e354b..6c053d8 100644 --- a/source/source/EXTERNAL.C +++ b/source/EXTERNAL.C @@ -10,7 +10,7 @@ #include "Emu48.h" #include "ops.h" -#define MUSIC_FREQ 11025 // this can be adjusted for quality +#define SAMPLES_PER_SEC 44100 // sound sampling rate //| 38G | 39G | 40G | 48SX | 48GX | 49G | Name //#F0E4F #80F0F #80F0F #706D2 #80850 #80F0F =SFLAG53_56 @@ -40,6 +40,7 @@ static __inline VOID BeepWave(DWORD dwFrequency,DWORD dwDuration) WAVEFORMATEX wf; WAVEHDR wh; HANDLE hEventSound; + BYTE byOffset; DWORD i; if (dwFrequency == 0) // this is just a delay @@ -52,30 +53,34 @@ static __inline VOID BeepWave(DWORD dwFrequency,DWORD dwDuration) wf.wFormatTag = WAVE_FORMAT_PCM; wf.nChannels = 1; - wf.nSamplesPerSec = MUSIC_FREQ; - wf.nAvgBytesPerSec = MUSIC_FREQ; - wf.nBlockAlign = 1; + wf.nSamplesPerSec = SAMPLES_PER_SEC; wf.wBitsPerSample = 8; + wf.nBlockAlign = wf.nChannels * wf.wBitsPerSample / 8; + wf.nAvgBytesPerSec = wf.nBlockAlign * wf.nSamplesPerSec; wf.cbSize = 0; - if (waveOutOpen(&hSoundDevice,WAVE_MAPPER,&wf,(DWORD_PTR)hEventSound,0,CALLBACK_EVENT) != 0) + if (waveOutOpen(&hSoundDevice,uWaveDevId,&wf,(DWORD_PTR)hEventSound,0,CALLBACK_EVENT) != MMSYSERR_NOERROR) { CloseHandle(hEventSound); // no sound available return; } // (samp/sec) * msecs * (secs/msec) = samps - wh.dwBufferLength = (DWORD) ((QWORD) MUSIC_FREQ * dwDuration / 1000); - VERIFY(wh.lpData = malloc(wh.dwBufferLength)); + wh.dwBufferLength = (DWORD) ((QWORD) SAMPLES_PER_SEC * dwDuration / 1000); + VERIFY(wh.lpData = (LPSTR) malloc(wh.dwBufferLength)); wh.dwBytesRecorded = 0; wh.dwUser = 0; wh.dwFlags = 0; wh.dwLoops = 0; + // offset for wave + byOffset = 128 - (BYTE) (dwWaveVol / 2); + for (i = 0; i < wh.dwBufferLength; ++i) // generate square wave { - wh.lpData[i] = (BYTE) ((((QWORD) 2 * dwFrequency * i / MUSIC_FREQ) & 1) * dwWaveVol); + wh.lpData[i] = (BYTE) ((((QWORD) 2 * dwFrequency * i / SAMPLES_PER_SEC) & 1) * dwWaveVol + byOffset); } + wh.lpData[wh.dwBufferLength-1] = (BYTE) 128; VERIFY(waveOutPrepareHeader(hSoundDevice,&wh,sizeof(wh)) == MMSYSERR_NOERROR); diff --git a/source/source/Emu48.dsp b/source/Emu48.dsp similarity index 100% rename from source/source/Emu48.dsp rename to source/Emu48.dsp diff --git a/source/source/Emu48.dsw b/source/Emu48.dsw similarity index 100% rename from source/source/Emu48.dsw rename to source/Emu48.dsw diff --git a/source/source/FETCH.C b/source/FETCH.C similarity index 92% rename from source/source/FETCH.C rename to source/FETCH.C index 485566c..2836733 100644 --- a/source/source/FETCH.C +++ b/source/FETCH.C @@ -15,7 +15,7 @@ typedef struct { const VOID *pLnk; const DWORD dwTyp; -} JMPTAB; +} JMPTAB, *PJMPTAB; // jump tables static const JMPTAB oF_[] = @@ -769,7 +769,7 @@ VOID EvalOpcode(LPBYTE I) dwTemp = I[dwIndex]; // table entry _ASSERT(dwTemp <= 0xf); // found packed data dwIndex = pJmpTab[dwTemp].dwTyp; // next pointer type - pJmpTab = pJmpTab[dwTemp].pLnk; // next pointer to table/function + pJmpTab = (PJMPTAB) pJmpTab[dwTemp].pLnk; // next pointer to table/function } while (dwIndex != F); // reference to table? -> again diff --git a/source/source/FILES.C b/source/FILES.C similarity index 88% rename from source/source/FILES.C rename to source/FILES.C index c7cae49..128317d 100644 --- a/source/source/FILES.C +++ b/source/FILES.C @@ -36,6 +36,8 @@ LPBYTE Port2 = NULL; LPBYTE pbyRom = NULL; BOOL bRomWriteable = TRUE; // flag if ROM writeable DWORD dwRomSize = 0; +LPBYTE pbyRomDirtyPage = NULL; +DWORD dwRomDirtyPageSize = 0; WORD wRomCrc = 0; // fingerprint of patched ROM LPBYTE pbyPort2 = NULL; @@ -64,6 +66,7 @@ static CHIPSET BackupChipset; static LPBYTE BackupPort0; static LPBYTE BackupPort1; static LPBYTE BackupPort2; +static BOOL bRomPacked; //################ //# @@ -214,7 +217,7 @@ typedef struct tnode BYTE byPatch; // patched ROM value struct tnode *prev; // previous node struct tnode *next; // next node -} TREENODE; +} TREENODE, *PTREENODE; static TREENODE *nodePatch = NULL; @@ -223,7 +226,7 @@ static BOOL PatchNibble(DWORD dwAddress, BYTE byPatch) TREENODE *p; _ASSERT(pbyRom); // ROM defined - if ((p = malloc(sizeof(TREENODE))) == NULL) + if ((p = (PTREENODE) malloc(sizeof(TREENODE))) == NULL) return TRUE; p->bPatch = TRUE; // address patched @@ -328,7 +331,7 @@ BOOL PatchRom(LPCTSTR szFilename) CloseHandle(hFile); return FALSE; } - lpBuf = malloc(dwFileSizeLow+1); + lpBuf = (PSZ) malloc(dwFileSizeLow+1); if (lpBuf == NULL) { CloseHandle(hFile); @@ -417,34 +420,34 @@ BOOL CrcRom(WORD *pwChk) // calculate fingerprint of ROM BOOL MapRom(LPCTSTR szFilename) { - DWORD dwFileSizeHigh; + DWORD dwSize,dwFileSize,dwRead; // open ROM for writing - BOOL bWrite = (cCurrentRomType == 'X' || cCurrentRomType == 'Q') ? bRomWriteable : FALSE; // CdB for HP: add apples + BOOL bRomRW = (cCurrentRomType == 'X' || cCurrentRomType == 'Q') ? bRomWriteable : FALSE; // CdB for HP: add apples if (pbyRom != NULL) { return FALSE; } SetCurrentDirectory((*szRomDirectory == 0) ? szEmuDirectory : szRomDirectory); - if (bWrite) // ROM writeable + if (bRomRW) // ROM writeable { hRomFile = CreateFile(szFilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, + FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (hRomFile == INVALID_HANDLE_VALUE) { - bWrite = FALSE; // ROM not writeable + bRomRW = FALSE; // ROM not writeable hRomFile = CreateFile(szFilename, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, + FILE_FLAG_SEQUENTIAL_SCAN, NULL); } } @@ -455,7 +458,7 @@ BOOL MapRom(LPCTSTR szFilename) FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, + FILE_FLAG_SEQUENTIAL_SCAN, NULL); } SetCurrentDirectory(szCurrentDirectory); @@ -464,49 +467,135 @@ BOOL MapRom(LPCTSTR szFilename) hRomFile = NULL; return FALSE; } - dwRomSize = GetFileSize(hRomFile, &dwFileSizeHigh); - if (dwFileSizeHigh != 0) - { // file is too large. + dwRomSize = GetFileSize(hRomFile, NULL); + + // read the first 4 bytes + ReadFile(hRomFile,&dwSize,sizeof(dwSize),&dwRead,NULL); + if (dwRead < sizeof(dwSize)) + { // file is too small. CloseHandle(hRomFile); hRomFile = NULL; dwRomSize = 0; return FALSE; } - hRomMap = CreateFileMapping(hRomFile, NULL, bWrite ? PAGE_READWRITE : PAGE_WRITECOPY, 0, dwRomSize, NULL); - if (hRomMap == NULL) - { - CloseHandle(hRomFile); - hRomFile = NULL; - dwRomSize = 0; - return FALSE; - } - if (GetLastError() == ERROR_ALREADY_EXISTS) - { - AbortMessage(_T("Sharing file mapping handle.")); - } - pbyRom = MapViewOfFile(hRomMap, bWrite ? FILE_MAP_WRITE : FILE_MAP_COPY, 0, 0, dwRomSize); + + dwFileSize = dwRomSize; // calculate ROM image buffer size + bRomPacked = (dwSize & 0xF0F0F0F0) != 0; // ROM image packed + if (bRomPacked) dwRomSize *= 2; // unpacked ROM image has double size + + pbyRom = (LPBYTE) malloc(dwRomSize); if (pbyRom == NULL) { - CloseHandle(hRomMap); CloseHandle(hRomFile); - hRomMap = NULL; hRomFile = NULL; dwRomSize = 0; return FALSE; } + + *(DWORD *) pbyRom = dwSize; // save first 4 bytes + + // load rest of file content + ReadFile(hRomFile,&pbyRom[sizeof(dwSize)],dwFileSize - sizeof(dwSize),&dwRead,NULL); + _ASSERT(dwFileSize - sizeof(dwSize) == dwRead); + + if (bRomRW) // ROM is writeable + { + // no. of dirty pages + dwRomDirtyPageSize = dwRomSize / ROMPAGESIZE; + + // alloc dirty page table + pbyRomDirtyPage = (LPBYTE) calloc(dwRomDirtyPageSize,sizeof(*pbyRomDirtyPage)); + if (pbyRomDirtyPage == NULL) + { + free(pbyRom); // free ROM image + CloseHandle(hRomFile); + dwRomDirtyPageSize = 0; + pbyRom = NULL; + hRomFile = NULL; + dwRomSize = 0; + return FALSE; + } + } + else + { + dwRomDirtyPageSize = 0; + CloseHandle(hRomFile); + hRomFile = NULL; + } + + if (bRomPacked) // packed ROM image + { + dwSize = dwRomSize; // destination start address + while (dwFileSize > 0) // unpack source + { + BYTE byValue = pbyRom[--dwFileSize]; + pbyRom[--dwSize] = byValue >> 4; + pbyRom[--dwSize] = byValue & 0xF; + } + } return TRUE; } VOID UnmapRom(VOID) { - if (pbyRom == NULL) return; - RestorePatches(); // restore ROM Patches - UnmapViewOfFile(pbyRom); - CloseHandle(hRomMap); - CloseHandle(hRomFile); + if (pbyRom == NULL) return; // ROM not mapped + RestorePatches(); // restore ROM patches + if (hRomFile) // ROM file still open (only in R/W case) + { + DWORD i; + + _ASSERT(pbyRomDirtyPage != NULL); + + // scan for every dirty page + for (i = 0; i < dwRomDirtyPageSize; ++i) + { + if (pbyRomDirtyPage[i]) // page dirty + { + DWORD dwSize,dwLinPos,dwFilePos,dwWritten; + + dwLinPos = i * ROMPAGESIZE; // position inside emulator memory + + dwSize = ROMPAGESIZE; // bytes to write + while (i+1 < dwRomDirtyPageSize && pbyRomDirtyPage[i+1]) + { + dwSize += ROMPAGESIZE; // next page is also dirty + ++i; // skip next page in outer loop + } + + dwFilePos = dwLinPos; // ROM file position + + if (bRomPacked) // repack data + { + LPBYTE pbySrc,pbyDest; + DWORD j; + + dwSize /= 2; // adjust no. of bytes to write + dwFilePos /= 2; // linear pos in packed file + + // pack data in page + pbySrc = pbyDest = &pbyRom[dwLinPos]; + for (j = 0; j < dwSize; j++) + { + *pbyDest = *pbySrc++; + *pbyDest |= *pbySrc++ << 4; + pbyDest++; + } + } + + SetFilePointer(hRomFile,dwFilePos,NULL,FILE_BEGIN); + WriteFile(hRomFile,&pbyRom[dwLinPos],dwSize,&dwWritten,NULL); + } + } + + free(pbyRomDirtyPage); + CloseHandle(hRomFile); + pbyRomDirtyPage = NULL; + dwRomDirtyPageSize = 0; + hRomFile = NULL; + } + + free(pbyRom); // free ROM image pbyRom = NULL; - hRomMap = NULL; - hRomFile = NULL; dwRomSize = 0; wRomCrc = 0; return; @@ -545,7 +634,7 @@ BOOL CrcPort2(WORD *pwCrc) // calculate fingerprint of port2 BOOL MapPort2(LPCTSTR szFilename) { - DWORD dwFileSizeLo,dwFileSizeHi,dwCount; + DWORD dwFileSizeLo,dwFileSizeHi; if (pbyPort2 != NULL) return FALSE; bPort2Writeable = TRUE; @@ -578,53 +667,32 @@ BOOL MapPort2(LPCTSTR szFilename) } SetCurrentDirectory(szCurrentDirectory); dwFileSizeLo = GetFileSize(hPort2File, &dwFileSizeHi); - if (dwFileSizeHi != 0) - { // file is too large. - CloseHandle(hPort2File); - hPort2File = NULL; - dwPort2Mask = 0; - bPort2Writeable = FALSE; - return FALSE; - } - - // count number of set bits - for (dwCount = 0, dwFileSizeHi = dwFileSizeLo; dwFileSizeHi != 0;dwFileSizeHi >>= 1) - { - if ((dwFileSizeHi & 0x1) != 0) ++dwCount; - } // size not 32, 128, 256, 512, 1024, 2048 or 4096 KB - if (dwCount != 1 || (dwFileSizeLo & 0xFF02FFFF) != 0) + if ( dwFileSizeHi != 0 + || dwFileSizeLo == 0 + || (dwFileSizeLo & (dwFileSizeLo - 1)) != 0 + || (dwFileSizeLo & 0xFF02FFFF) != 0) { - CloseHandle(hPort2File); - hPort2File = NULL; - dwPort2Mask = 0; - bPort2Writeable = FALSE; + UnmapPort2(); return FALSE; } - dwPort2Mask = (dwFileSizeLo - 1) >> 18; // mask for valid address lines of the BS-FF hPort2Map = CreateFileMapping(hPort2File, NULL, bPort2Writeable ? PAGE_READWRITE : PAGE_READONLY, 0, dwFileSizeLo, NULL); if (hPort2Map == NULL) { - CloseHandle(hPort2File); - hPort2File = NULL; - dwPort2Mask = 0; - bPort2Writeable = FALSE; + UnmapPort2(); return FALSE; } - pbyPort2 = MapViewOfFile(hPort2Map, bPort2Writeable ? FILE_MAP_WRITE : FILE_MAP_READ, 0, 0, dwFileSizeLo); + pbyPort2 = (LPBYTE) MapViewOfFile(hPort2Map, bPort2Writeable ? FILE_MAP_WRITE : FILE_MAP_READ, 0, 0, dwFileSizeLo); if (pbyPort2 == NULL) { - CloseHandle(hPort2Map); - CloseHandle(hPort2File); - hPort2Map = NULL; - hPort2File = NULL; - dwPort2Mask = 0; - bPort2Writeable = FALSE; + UnmapPort2(); return FALSE; } + + dwPort2Mask = (dwFileSizeLo - 1) >> 18; // mask for valid address lines of the BS-FF dwPort2Size = dwFileSizeLo / 2048; // mapping size of port2 if (CrcPort2(&wPort2Crc) == FALSE) // calculate fingerprint of port2 @@ -638,13 +706,21 @@ BOOL MapPort2(LPCTSTR szFilename) VOID UnmapPort2(VOID) { - if (pbyPort2 == NULL) return; - UnmapViewOfFile(pbyPort2); - CloseHandle(hPort2Map); - CloseHandle(hPort2File); - pbyPort2 = NULL; - hPort2Map = NULL; - hPort2File = NULL; + if (pbyPort2 != NULL) + { + UnmapViewOfFile(pbyPort2); + pbyPort2 = NULL; + } + if (hPort2Map != NULL) + { + CloseHandle(hPort2Map); + hPort2Map = NULL; + } + if (hPort2File != NULL) + { + CloseHandle(hPort2File); + hPort2File = NULL; + } dwPort2Size = 0; // reset size of port2 dwPort2Mask = 0; bPort2Writeable = FALSE; @@ -662,7 +738,7 @@ VOID UnmapPort2(VOID) static BOOL IsDataPacked(VOID *pMem, DWORD dwSize) { - DWORD *pdwMem = pMem; + DWORD *pdwMem = (DWORD *) pMem; _ASSERT((dwSize % sizeof(DWORD)) == 0); if ((dwSize % sizeof(DWORD)) != 0) return TRUE; @@ -769,17 +845,17 @@ BOOL NewDocument(VOID) // allocate port memory if (Chipset.Port0Size) { - Port0 = calloc(Chipset.Port0Size*2048,sizeof(*Port0)); + Port0 = (LPBYTE) calloc(Chipset.Port0Size*2048,sizeof(*Port0)); _ASSERT(Port0 != NULL); } if (Chipset.Port1Size) { - Port1 = calloc(Chipset.Port1Size*2048,sizeof(*Port1)); + Port1 = (LPBYTE) calloc(Chipset.Port1Size*2048,sizeof(*Port1)); _ASSERT(Port1 != NULL); } if (Chipset.Port2Size) { - Port2 = calloc(Chipset.Port2Size*2048,sizeof(*Port2)); + Port2 = (LPBYTE) calloc(Chipset.Port2Size*2048,sizeof(*Port2)); _ASSERT(Port2 != NULL); } LoadBreakpointList(NULL); // clear debugger breakpoint list @@ -873,7 +949,7 @@ BOOL OpenDocument(LPCTSTR szFilename) if (nLength >= ARRAYSIZEOF(szCurrentKml)) goto read_err; #if defined _UNICODE { - LPSTR szTmp = malloc(nLength); + LPSTR szTmp = (LPSTR) malloc(nLength); if (szTmp == NULL) { AbortMessage(_T("Memory Allocation Failure.")); @@ -949,7 +1025,7 @@ BOOL OpenDocument(LPCTSTR szFilename) if (Chipset.Port0Size) { - Port0 = malloc(Chipset.Port0Size*2048); + Port0 = (LPBYTE) malloc(Chipset.Port0Size*2048); if (Port0 == NULL) { AbortMessage(_T("Memory Allocation Failure.")); @@ -964,7 +1040,7 @@ BOOL OpenDocument(LPCTSTR szFilename) if (Chipset.Port1Size) { - Port1 = malloc(Chipset.Port1Size*2048); + Port1 = (LPBYTE) malloc(Chipset.Port1Size*2048); if (Port1 == NULL) { AbortMessage(_T("Memory Allocation Failure.")); @@ -996,7 +1072,7 @@ BOOL OpenDocument(LPCTSTR szFilename) { if (Chipset.Port2Size) { - Port2 = malloc(Chipset.Port2Size*2048); + Port2 = (LPBYTE) malloc(Chipset.Port2Size*2048); if (Port2 == NULL) { AbortMessage(_T("Memory Allocation Failure.")); @@ -1085,7 +1161,7 @@ BOOL SaveDocument(VOID) WriteFile(hCurrentFile, &nLength, sizeof(nLength), &lBytesWritten, NULL); #if defined _UNICODE { - LPSTR szTmp = malloc(nLength); + LPSTR szTmp = (LPSTR) malloc(nLength); if (szTmp != NULL) { WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, @@ -1448,7 +1524,7 @@ BOOL LoadObject(LPCTSTR szFilename) // separated stack writing part CloseHandle(hFile); return FALSE; } - lpBuf = malloc(dwFileSizeLow*2); + lpBuf = (LPBYTE) malloc(dwFileSizeLow*2); if (lpBuf == NULL) { CloseHandle(hFile); @@ -1496,8 +1572,8 @@ BOOL SaveObject(LPCTSTR szFilename) // separated stack reading part } pbyHeader = ((cCurrentRomType=='X' || cCurrentRomType=='2' || cCurrentRomType=='Q')) - ? BINARYHEADER49 - : BINARYHEADER48; + ? (LPBYTE) BINARYHEADER49 + : (LPBYTE) BINARYHEADER48; WriteFile(hFile, pbyHeader, 8, &lBytesWritten, NULL); @@ -1560,7 +1636,7 @@ static HPALETTE CreateBIPalette(BITMAPINFOHEADER CONST *lpbi) if (wNumColors) { // Allocate for the logical palette structure - pPal = malloc(sizeof(LOGPALETTE) + wNumColors * sizeof(PALETTEENTRY)); + pPal = (PLOGPALETTE) malloc(sizeof(LOGPALETTE) + wNumColors * sizeof(PALETTEENTRY)); if (!pPal) return NULL; pPal->palVersion = 0x300; @@ -1585,7 +1661,7 @@ static HPALETTE CreateBIPalette(BITMAPINFOHEADER CONST *lpbi) // 16, 24 and 32 bitcount DIB's have no color table entries so, set the // number of to the maximum value (256). wNumColors = 256; - pPal = malloc(sizeof(LOGPALETTE) + wNumColors * sizeof(PALETTEENTRY)); + pPal = (PLOGPALETTE) malloc(sizeof(LOGPALETTE) + wNumColors * sizeof(PALETTEENTRY)); if (!pPal) return NULL; pPal->palVersion = 0x300; @@ -2191,7 +2267,7 @@ HBITMAP LoadBitmapFile(LPCTSTR szFilename) CloseHandle(hFile); return NULL; } - Bmp.pbyFile = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0); + Bmp.pbyFile = (LPBYTE) MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0); if (Bmp.pbyFile == NULL) { CloseHandle(hMap); diff --git a/source/source/I28F160.C b/source/I28F160.C similarity index 90% rename from source/source/I28F160.C rename to source/I28F160.C index a119a81..b7175c9 100644 --- a/source/source/I28F160.C +++ b/source/I28F160.C @@ -187,6 +187,51 @@ static CONST BYTE byQueryTab[] = }; +// +// ROM buffer access functions +// + +static __inline void WrDirtyPage(DWORD d) +{ + if (pbyRomDirtyPage) // using dirty ROM page table + { + DWORD dwPage = d / ROMPAGESIZE; // this is the page + + _ASSERT(dwPage < dwRomDirtyPageSize); + pbyRomDirtyPage[dwPage] = TRUE; // page is dirty + } + return; +} + +static __inline void EraseBlock(DWORD d,DWORD dwNibSize) +{ + LPBYTE pbyAddr = pbyRom + d; + + while (dwNibSize--) + { + WrDirtyPage(d++); // make page dirty + *pbyAddr++ = 0x0F; // clear address + } + return; +} + +static __inline void WriteByte(DWORD d,BYTE byData) +{ + WrDirtyPage(d); // make page dirty + + _ASSERT(d+1 < dwRomSize); // address valid? + *(pbyRom+d) &= (byData & 0x0F); // write LSB + *(pbyRom+d+1) &= (byData >> 4); // write MSB + return; +} + +static __inline BYTE ReadByte(DWORD d) +{ + _ASSERT(d+1 < dwRomSize); // address valid? + return *(pbyRom+d)|(*(pbyRom+d+1)<<4); // get byte +} + + // // write state functions // @@ -252,7 +297,7 @@ static VOID WrStateIdle(BYTE a, DWORD d) break; } - if(bFlashRomArray != WSMset.bRomArray) // new access mode + if (bFlashRomArray != WSMset.bRomArray) // new access mode { bFlashRomArray = WSMset.bRomArray; // change register access Map(0x00,0xFF); // update memory mapping @@ -367,8 +412,8 @@ static VOID WrStateE8C(BYTE a, DWORD d) _ASSERT(d+1 < dwRomSize); // address valid? // no error set in BWSLBS, because I could alway program a "0" - *(pbyRom+d++) &= (a & 0x0F); // write LSB - *(pbyRom+d++) &= (a >> 4); // write MSB + WriteByte(d,a); // write byte + d += 2; // next address } } else @@ -395,11 +440,8 @@ static VOID WrState40(DWORD d) // byte/word program data static VOID WrState40D(BYTE a, DWORD d) { - d <<= 1; // nibble start address - _ASSERT(d+1 < dwRomSize); // address valid? // no error set in BWSLBS, because I could alway program a "0" - *(pbyRom+d++) &= (a & 0x0F); // write LSB - *(pbyRom+d) &= (a >> 4); // write MSB + WriteByte(d << 1,a); // write byte WSMset.byStatusReg |= WSMS; // data written WSMset.uWrState = WRS_DATA; return; @@ -433,8 +475,7 @@ static VOID WrState20C(BYTE a, DWORD d) d &= ~(dwBlockSize-1); // start of block dwBlockSize *= 2; // block size in nibbles _ASSERT(d+dwBlockSize <= dwRomSize); // address valid? - // write 128K nibble - FillMemory(pbyRom + (d << 1),dwBlockSize,0x0F); + EraseBlock(d << 1,dwBlockSize); // erase 128K nibble } } else @@ -467,7 +508,7 @@ static VOID WrState30C(BYTE a, DWORD d) WORD wNoOfBlocks = (byQueryTab[0x2E] << 8) | byQueryTab[0x2D]; DWORD dwBlockSize = ((byQueryTab[0x30] << 8) | byQueryTab[0x2F]) * 256; - LPBYTE pbyBlock = pbyRom; + DWORD dwBlockAddr = 0; dwBlockSize *= 2; // block size in nibbles @@ -481,11 +522,11 @@ static VOID WrState30C(BYTE a, DWORD d) // clear block lock bit WSMset.dwLockCnfg &= ~(1<= 32); ZeroMemory(&WSMset,sizeof(WSMset)); - strcpy(WSMset.byType,"WSM"); // Write State Machine header + strcpy((LPSTR) WSMset.byType,"WSM"); // Write State Machine header WSMset.uSize = sizeof(WSMset); // size of this structure WSMset.byVersion = WSMVER; // version of flash implementation structure diff --git a/source/source/I28F160.H b/source/I28F160.H similarity index 100% rename from source/source/I28F160.H rename to source/I28F160.H diff --git a/source/source/IO.H b/source/IO.H similarity index 100% rename from source/source/IO.H rename to source/IO.H diff --git a/source/source/KEYBOARD.C b/source/KEYBOARD.C similarity index 100% rename from source/source/KEYBOARD.C rename to source/KEYBOARD.C diff --git a/source/source/KEYMACRO.C b/source/KEYMACRO.C similarity index 100% rename from source/source/KEYMACRO.C rename to source/KEYMACRO.C diff --git a/source/source/KML.C b/source/KML.C similarity index 95% rename from source/source/KML.C rename to source/KML.C index 6e7afed..00cd3b2 100644 --- a/source/source/KML.C +++ b/source/KML.C @@ -83,7 +83,7 @@ static CONST KmlToken pLexToken[] = {TOK_IFFLAG, 000001, 6,_T("IfFlag")}, {TOK_ONDOWN, 000000, 6,_T("OnDown")}, {TOK_NOHOLD, 000000, 6,_T("NoHold")}, -// {TOK_LOCALE, 000001, 6,_T("Locale")}, + {TOK_LOCALE, 000001, 6,_T("Locale")}, {TOK_TITLE, 000002, 5,_T("Title")}, {TOK_OUTIN, 000011, 5,_T("OutIn")}, {TOK_PATCH, 000002, 5,_T("Patch")}, @@ -378,10 +378,18 @@ static VOID BrowseFolder(HWND hDlg) SetDlgItemText(hDlg,IDC_EMUDIR,szDir); } // free the PIDL allocated by SHBrowseForFolder - pMalloc->lpVtbl->Free(pMalloc,pidl); + #if defined __cplusplus + pMalloc->Free(pidl); + #else + pMalloc->lpVtbl->Free(pMalloc,pidl); + #endif } // release the shell's allocator - pMalloc->lpVtbl->Release(pMalloc); + #if defined __cplusplus + pMalloc->Release(); + #else + pMalloc->lpVtbl->Release(pMalloc); + #endif } return; } @@ -589,7 +597,7 @@ static LPCTSTR GetStringOf(TokenId eId) static VOID SkipWhite(UINT nMode) { - LPTSTR pcDelim; + LPCTSTR pcDelim; while (*szText) { @@ -672,7 +680,7 @@ static LPTSTR ParseString(VOID) if (nLength == nBlock - 1) // ran out of buffer space { nBlock += 256; - lpszString = realloc(lpszString,nBlock * sizeof(lpszString[0])); + lpszString = (LPTSTR) realloc(lpszString,nBlock * sizeof(lpszString[0])); } if (*szText == _T('\\')) // escape char @@ -701,7 +709,7 @@ static LPTSTR ParseString(VOID) lpszString[nLength] = 0; // set EOS // release unnecessary allocated bytes - return realloc(lpszString,(nLength+1) * sizeof(lpszString[0])); + return (LPTSTR) realloc(lpszString,(nLength+1) * sizeof(lpszString[0])); } static TokenId Lex(UINT nMode) @@ -1634,6 +1642,7 @@ VOID KillKML(VOID) ZeroMemory(pButton, sizeof(pButton)); ZeroMemory(pAnnunciator, sizeof(pAnnunciator)); ZeroMemory(pVKey, sizeof(pVKey)); + ZeroMemory(byVKeyMap, sizeof(byVKeyMap)); ClearLog(); nBackgroundX = 0; nBackgroundY = 0; diff --git a/source/source/KML.H b/source/KML.H similarity index 100% rename from source/source/KML.H rename to source/KML.H diff --git a/source/source/MOPS.C b/source/MOPS.C similarity index 100% rename from source/source/MOPS.C rename to source/MOPS.C diff --git a/source/source/MRU.C b/source/MRU.C similarity index 94% rename from source/source/MRU.C rename to source/MRU.C index a7a2f72..c314780 100644 --- a/source/source/MRU.C +++ b/source/MRU.C @@ -73,7 +73,7 @@ BOOL MruInit(INT nNum) if (nEntry > 0) // allocate MRU table { // create MRU table - if ((ppszFiles = malloc(nEntry * sizeof(*ppszFiles))) == NULL) + if ((ppszFiles = (LPTSTR *) malloc(nEntry * sizeof(*ppszFiles))) == NULL) return TRUE; // fill each entry diff --git a/source/source/OPCODES.C b/source/OPCODES.C similarity index 94% rename from source/source/OPCODES.C rename to source/OPCODES.C index 6874c7e..90df305 100644 --- a/source/source/OPCODES.C +++ b/source/OPCODES.C @@ -954,9 +954,13 @@ VOID o800(LPBYTE I) // OUT=CS VOID o801(LPBYTE I) // OUT=C { + WORD wOut; w.cycles+=6; w.pc+=3; - w.out = (WORD)Npack(w.C, 3); + wOut = (WORD) Npack(w.C, 3); + if (((wOut ^ w.out) & 0x800) != 0) // beeper bit OR[11] changed + SoundOut(&w,wOut); + w.out = wOut; ScanKeyboard(FALSE,FALSE); // 1ms keyboard poll return; } diff --git a/source/source/OPCODES.H b/source/OPCODES.H similarity index 100% rename from source/source/OPCODES.H rename to source/OPCODES.H diff --git a/source/source/OPS.H b/source/OPS.H similarity index 100% rename from source/source/OPS.H rename to source/OPS.H diff --git a/source/source/PCH.C b/source/PCH.C similarity index 100% rename from source/source/PCH.C rename to source/PCH.C diff --git a/source/source/PCH.H b/source/PCH.H similarity index 100% rename from source/source/PCH.H rename to source/PCH.H diff --git a/source/source/REDEYE.C b/source/REDEYE.C similarity index 100% rename from source/source/REDEYE.C rename to source/REDEYE.C diff --git a/source/source/RESOURCE.H b/source/RESOURCE.H similarity index 68% rename from source/source/RESOURCE.H rename to source/RESOURCE.H index 38c2dd6..6c922aa 100644 --- a/source/source/RESOURCE.H +++ b/source/RESOURCE.H @@ -12,50 +12,53 @@ #define IDR_DEBUG_STACK 106 #define IDB_CHECKBOX 107 #define IDD_ABOUT 108 -#define IDD_SETTINGS 109 -#define IDD_CHOOSEKML 110 -#define IDD_KMLLOG 111 -#define IDD_DISASM 112 -#define IDD_DEBUG 113 -#define IDD_NEWVALUE 114 -#define IDD_ENTERADR 115 -#define IDD_BREAKEDIT 116 -#define IDD_ENTERBREAK 117 -#define IDD_INSTRUCTIONS 118 -#define IDD_WRITEONLYREG 119 -#define IDD_FIND 120 -#define IDD_PROFILE 121 -#define IDD_MACROSET 122 -#define IDD_DEBUG_MEMSAVE 123 -#define IDD_DEBUG_MEMLOAD 124 -#define IDD_DEBUG_SETTINGS 125 +#define IDD_SET_GENERAL 109 +#define IDD_SET_MEMORY 110 +#define IDD_SET_PERIPHERAL 111 +#define IDD_CHOOSEKML 112 +#define IDD_KMLLOG 113 +#define IDD_DISASM 114 +#define IDD_DEBUG 115 +#define IDD_NEWVALUE 116 +#define IDD_ENTERADR 117 +#define IDD_BREAKEDIT 118 +#define IDD_ENTERBREAK 119 +#define IDD_INSTRUCTIONS 120 +#define IDD_WRITEONLYREG 121 +#define IDD_FIND 122 +#define IDD_PROFILE 123 +#define IDD_MACROSET 124 +#define IDD_DEBUG_MEMSAVE 125 +#define IDD_DEBUG_MEMLOAD 126 +#define IDD_DEBUG_SETTINGS 127 #define IDC_REALSPEED 1000 #define IDC_GRAYSCALE 1001 #define IDC_ALWAYSONTOP 1002 #define IDC_ACTFOLLOWSMOUSE 1003 -#define IDC_AUTOSAVE 1004 -#define IDC_AUTOSAVEONEXIT 1005 -#define IDC_OBJECTLOADWARNING 1006 -#define IDC_ALWAYSDISPLOG 1007 -#define IDC_PORT1EN 1008 -#define IDC_PORT1WR 1009 -#define IDC_PORT2ISSHARED 1010 -#define IDC_PORT2WR 1011 -#define IDC_PORT2 1012 -#define IDC_PORT2LOAD 1013 -#define IDC_IR_ADDR 1014 -#define IDC_IR_PORT 1015 -#define IDC_WIRE 1016 -#define IDC_IR 1017 -#define IDC_EMUDIR 1018 -#define IDC_EMUDIRSEL 1019 -#define IDC_UPDATE 1020 -#define IDC_KMLSCRIPT 1021 -#define IDC_AUTHOR 1022 -#define IDC_TITLE 1023 -#define IDC_KMLLOG 1024 +#define IDC_SINGLEINSTANCE 1004 +#define IDC_AUTOSAVE 1005 +#define IDC_AUTOSAVEONEXIT 1006 +#define IDC_OBJECTLOADWARNING 1007 +#define IDC_ALWAYSDISPLOG 1008 +#define IDC_PORT1EN 1009 +#define IDC_PORT1WR 1010 +#define IDC_PORT2ISSHARED 1011 +#define IDC_PORT2WR 1012 +#define IDC_PORT2 1013 +#define IDC_PORT2LOAD 1014 +#define IDC_IR_ADDR 1015 +#define IDC_IR_PORT 1016 +#define IDC_WIRE 1017 +#define IDC_IR 1018 +#define IDC_EMUDIR 1019 +#define IDC_EMUDIRSEL 1020 +#define IDC_UPDATE 1021 +#define IDC_KMLSCRIPT 1022 +#define IDC_AUTHOR 1023 +#define IDC_TITLE 1024 +#define IDC_KMLLOG 1025 #define IDC_VERSION 1025 -#define IDC_LICENSE 1026 +#define IDC_LICENSE 1027 #define IDC_DISASM_WIN 1028 #define IDC_DISASM_MODE_TEXT 1029 #define IDC_DISASM_MODE 1030 @@ -202,40 +205,42 @@ #define ID_DEBUG_CODE_GOADR 40040 #define ID_DEBUG_CODE_GOPC 40041 #define ID_DEBUG_CODE_SETPCTOSELECT 40042 -#define ID_DEBUG_MEM_GOADR 40043 -#define ID_DEBUG_MEM_GOPC 40044 -#define ID_DEBUG_MEM_GOD0 40045 -#define ID_DEBUG_MEM_GOD1 40046 -#define ID_DEBUG_MEM_GOSTACK 40047 -#define ID_DEBUG_MEM_FNONE 40048 -#define ID_DEBUG_MEM_FADDR 40049 -#define ID_DEBUG_MEM_FPC 40050 -#define ID_DEBUG_MEM_FD0 40051 -#define ID_DEBUG_MEM_FD1 40052 -#define ID_DEBUG_MEM_FIND 40053 -#define ID_DEBUG_MEM_MAP 40054 -#define ID_DEBUG_MEM_NCE1 40055 -#define ID_DEBUG_MEM_NCE2 40056 -#define ID_DEBUG_MEM_CE1 40057 -#define ID_DEBUG_MEM_CE2 40058 -#define ID_DEBUG_MEM_NCE3 40059 -#define ID_DEBUG_MEM_SAVE 40060 -#define ID_DEBUG_MEM_LOAD 40061 -#define ID_DEBUG_STACK_PUSH 40062 -#define ID_DEBUG_STACK_POP 40063 -#define ID_DEBUG_STACK_MODIFY 40064 -#define ID_INTR_STEPOVERINT 40065 -#define ID_INFO_LASTINSTRUCTIONS 40066 -#define ID_INFO_PROFILE 40067 -#define ID_INFO_WRITEONLYREG 40068 +#define ID_DEBUG_CODE_PREVPCO 40043 +#define ID_DEBUG_CODE_NEXTPCO 40044 +#define ID_DEBUG_MEM_GOADR 40045 +#define ID_DEBUG_MEM_GOPC 40046 +#define ID_DEBUG_MEM_GOD0 40047 +#define ID_DEBUG_MEM_GOD1 40048 +#define ID_DEBUG_MEM_GOSTACK 40049 +#define ID_DEBUG_MEM_FNONE 40050 +#define ID_DEBUG_MEM_FADDR 40051 +#define ID_DEBUG_MEM_FPC 40052 +#define ID_DEBUG_MEM_FD0 40053 +#define ID_DEBUG_MEM_FD1 40054 +#define ID_DEBUG_MEM_FIND 40055 +#define ID_DEBUG_MEM_MAP 40056 +#define ID_DEBUG_MEM_NCE1 40057 +#define ID_DEBUG_MEM_NCE2 40058 +#define ID_DEBUG_MEM_CE1 40059 +#define ID_DEBUG_MEM_CE2 40060 +#define ID_DEBUG_MEM_NCE3 40061 +#define ID_DEBUG_MEM_SAVE 40062 +#define ID_DEBUG_MEM_LOAD 40063 +#define ID_DEBUG_STACK_PUSH 40064 +#define ID_DEBUG_STACK_POP 40065 +#define ID_DEBUG_STACK_MODIFY 40066 +#define ID_INTR_STEPOVERINT 40067 +#define ID_INFO_LASTINSTRUCTIONS 40068 +#define ID_INFO_PROFILE 40069 +#define ID_INFO_WRITEONLYREG 40070 #define ID_FILE_MRU_FILE1 40100 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 126 -#define _APS_NEXT_COMMAND_VALUE 40069 +#define _APS_NEXT_RESOURCE_VALUE 128 +#define _APS_NEXT_COMMAND_VALUE 40071 #define _APS_NEXT_CONTROL_VALUE 1134 #define _APS_NEXT_SYMED_VALUE 108 #endif diff --git a/source/source/RPL.C b/source/RPL.C similarity index 95% rename from source/source/RPL.C rename to source/RPL.C index db22e8f..f9cb17c 100644 --- a/source/source/RPL.C +++ b/source/RPL.C @@ -82,11 +82,11 @@ static BOOL Metakernel(VOID) if (cCurrentRomType=='G' && Port1 && Chipset.cards_status & PORT1_PRESENT) { // check for Metakernel string "MDGKER:" - if (!strncmp(&Port1[12],"\xD\x4\x4\x4\x7\x4\xB\x4\x5\x4\x2\x5\xA\x3",14)) + if (!strncmp((LPCSTR) &Port1[12],"\xD\x4\x4\x4\x7\x4\xB\x4\x5\x4\x2\x5\xA\x3",14)) { bMkDetect = TRUE; // Metakernel detected // check for "MK" - if (!strncmp(&Port1[26],"\xD\x4\xB\x4",4)) + if (!strncmp((LPCSTR) &Port1[26],"\xD\x4\xB\x4",4)) { // get version number WORD wVersion = ((Port1[30] * 10) + Port1[34]) * 10 @@ -396,7 +396,7 @@ DWORD RPL_CreateTemp(DWORD l,BOOL bGarbageCol) Write5(TEMPTOP, a+l); // adjust new end of top object Write5(RSKTOP, b+l); // adjust new end of rtn stack Write5(AVMEM, (c-b-l)/5); // calculate free memory (*5 nibbles) - p = malloc(b-a); // move down rtn stack + p = (LPBYTE) malloc(b-a); // move down rtn stack Npeek(p,a,b-a); Nwrite(p,a+l,b-a); free(p); diff --git a/source/source/SERIAL.C b/source/SERIAL.C similarity index 100% rename from source/source/SERIAL.C rename to source/SERIAL.C diff --git a/source/source/SETTINGS.C b/source/SETTINGS.C similarity index 92% rename from source/source/SETTINGS.C rename to source/SETTINGS.C index 88cc139..8377314 100644 --- a/source/source/SETTINGS.C +++ b/source/SETTINGS.C @@ -63,7 +63,7 @@ static VOID ReadReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, LPBYTE lpData, DWORD lstrcat(lpKey, lpSubKey); // full registry key retCode = RegOpenKeyEx(HKEY_CURRENT_USER, - lpKey, + lpKey, 0, KEY_QUERY_VALUE, &hKey); @@ -91,9 +91,9 @@ static BOOL WriteReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, CONST retCode = RegCreateKeyEx(HKEY_CURRENT_USER, lpKey, 0,_T(""), - REG_OPTION_NON_VOLATILE, + REG_OPTION_NON_VOLATILE, KEY_WRITE, - NULL, + NULL, &hKey, &dwDisposition); _ASSERT(retCode == ERROR_SUCCESS); @@ -113,7 +113,7 @@ static BOOL DelReg(LPCTSTR lpSubKey, LPCTSTR lpValueName) lstrcat(lpKey, lpSubKey); // full registry key retCode = RegOpenKeyEx(HKEY_CURRENT_USER, - lpKey, + lpKey, 0, KEY_SET_VALUE, &hKey); @@ -127,16 +127,18 @@ static BOOL DelReg(LPCTSTR lpSubKey, LPCTSTR lpValueName) static DWORD GetRegistryString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpDefault, LPTSTR lpData, DWORD dwSize) { - dwSize *= sizeof(*lpData); // buffer size in bytes - ReadReg(lpszSection,lpszEntry,(LPBYTE) lpData,&dwSize); - if (dwSize == 0) + // buffer size in bytes + DWORD dwBufSize = dwSize * sizeof(*lpData); + + ReadReg(lpszSection,lpszEntry,(LPBYTE) lpData,&dwBufSize); + if (dwBufSize == 0) { - lstrcpy(lpData,lpDefault); + lstrcpyn(lpData,lpDefault,dwSize); dwSize = lstrlen(lpData); } else { - dwSize = (dwSize / sizeof(*lpData)) - 1; + dwSize = (dwBufSize / sizeof(*lpData)) - 1; } return dwSize; } @@ -190,6 +192,7 @@ VOID ReadSettings(VOID) dwWakeupDelay = ReadInt(_T("Emulator"),_T("WakeupDelay"),dwWakeupDelay); bGrayscale = ReadInt(_T("Emulator"),_T("Grayscale"),bGrayscale); bWaveBeep = ReadInt(_T("Emulator"),_T("WaveBeep"),bWaveBeep); + uWaveDevId = ReadInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId); dwWaveVol = ReadInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol); // Macro bMacroRealSpeed = ReadInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed); @@ -237,6 +240,7 @@ VOID WriteSettings(VOID) WriteInt(_T("Emulator"),_T("WakeupDelay"),dwWakeupDelay); WriteInt(_T("Emulator"),_T("Grayscale"),bGrayscale); WriteInt(_T("Emulator"),_T("WaveBeep"),bWaveBeep); + WriteInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId); WriteInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol); // Macro WriteInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed); diff --git a/source/source/STACK.C b/source/STACK.C similarity index 95% rename from source/source/STACK.C rename to source/STACK.C index b0179d4..e48684b 100644 --- a/source/source/STACK.C +++ b/source/STACK.C @@ -461,7 +461,7 @@ static INT DoInt(DWORD dwAddress,LPTSTR cp,INT nSize) if (nIntLen <= 0) return 0; // error in calculator object nLength = 0; - if ((lpbyData = malloc(nIntLen))) + if ((lpbyData = (LPBYTE) malloc(nIntLen))) { // get precisition integer object content and decode it Npeek(lpbyData,dwAddress+5,nIntLen); @@ -659,13 +659,12 @@ LRESULT OnStackPaste(VOID) // paste data to stack LPCTSTR lpstrClipdata; LPBYTE lpbyData; - if ((lpstrClipdata = GlobalLock(hClipObj))) + if ((lpstrClipdata = (LPCTSTR) GlobalLock(hClipObj))) { BYTE byNumber[128]; DWORD dwAddress; INT s; - do { if (bDetectClpObject) // autodetect clipboard object enabled @@ -740,7 +739,7 @@ LRESULT OnStackPaste(VOID) // paste data to stack // any other format { DWORD dwSize = lstrlen(lpstrClipdata); - if ((lpbyData = malloc(dwSize * 2))) + if ((lpbyData = (LPBYTE) malloc(dwSize * 2))) { LPBYTE lpbySrc,lpbyDest; DWORD dwLoop; @@ -749,7 +748,7 @@ LRESULT OnStackPaste(VOID) // paste data to stack // copy data UNICODE -> ASCII WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, lpstrClipdata, dwSize, - lpbyData+dwSize, dwSize, NULL, NULL); + (LPSTR) lpbyData+dwSize, dwSize, NULL, NULL); #else // copy data memcpy(lpbyData+dwSize,lpstrClipdata,dwSize); diff --git a/source/source/SYMBFILE.C b/source/SYMBFILE.C similarity index 88% rename from source/source/SYMBFILE.C rename to source/SYMBFILE.C index f0d609d..8671bd3 100644 --- a/source/source/SYMBFILE.C +++ b/source/SYMBFILE.C @@ -24,14 +24,14 @@ #define HASHENTRIES 199 // size of hash table -typedef struct RefData +typedef struct _REFDATA { LPTSTR lpszName; // symbol name DWORD dwAddr; // resolved address - struct RefData* pNext; -} RefData; + struct _REFDATA* pNext; +} REFDATA, *PREFDATA; -static RefData *ppsBase[HASHENTRIES]; // base of symbol references (initialized with NULL) +static PREFDATA ppsBase[HASHENTRIES]; // base of symbol references (initialized with NULL) static __inline DWORD GetHash(DWORD dwVal) { @@ -151,18 +151,18 @@ BOOL RplLoadTable(LPCTSTR lpszFilename) if (wSymbolType == OS_RESOLVED) // resolved symbol type { TCHAR szSymbolName[36+1],*pcPtr; - RefData *pData; + PREFDATA pData; DWORD dwHash; #if defined _UNICODE { - MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,byPage+dwPageIndex,36, + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,(LPCSTR)byPage+dwPageIndex,36, szSymbolName,ARRAYSIZEOF(szSymbolName)); szSymbolName[36] = 0; // set EOS } #else { - lstrcpyn(szSymbolName,byPage+dwPageIndex,ARRAYSIZEOF(szSymbolName)); + lstrcpyn(szSymbolName,(LPCSTR)byPage+dwPageIndex,ARRAYSIZEOF(szSymbolName)); } #endif @@ -171,7 +171,7 @@ BOOL RplLoadTable(LPCTSTR lpszFilename) *pcPtr = 0; // set EOS // allocate symbol memory - VERIFY(pData = malloc(sizeof(RefData))); + VERIFY(pData = (PREFDATA) malloc(sizeof(*pData))); pData->lpszName = DuplicateString(szSymbolName); pData->dwAddr = GetBigEndian(byPage+dwPageIndex+38,sizeof(DWORD)); @@ -200,8 +200,8 @@ BOOL RplLoadTable(LPCTSTR lpszFilename) // VOID RplDeleteTable(VOID) { - RefData *pData; - DWORD i; + PREFDATA pData; + DWORD i; // clear hash entries for (i = 0; i < ARRAYSIZEOF(ppsBase); ++i) @@ -222,7 +222,7 @@ VOID RplDeleteTable(VOID) // LPCTSTR RplGetName(DWORD dwAddr) { - RefData *pData = ppsBase[GetHash(dwAddr)]; + PREFDATA pData = ppsBase[GetHash(dwAddr)]; // walk through all datasets of hash entry for (; pData != NULL; pData = pData->pNext) @@ -238,8 +238,8 @@ LPCTSTR RplGetName(DWORD dwAddr) // BOOL RplGetAddr(LPCTSTR lpszName, DWORD *pdwAddr) { - RefData *pData; - DWORD i; + PREFDATA pData; + DWORD i; // check for every dataset in hash table for (i = 0; i < ARRAYSIZEOF(ppsBase); ++i) diff --git a/source/source/TIMER.C b/source/TIMER.C similarity index 100% rename from source/source/TIMER.C rename to source/TIMER.C diff --git a/source/source/TYPES.H b/source/TYPES.H similarity index 100% rename from source/source/TYPES.H rename to source/TYPES.H diff --git a/source/source/UDP.C b/source/UDP.C similarity index 100% rename from source/source/UDP.C rename to source/UDP.C diff --git a/source/source/gpl.txt b/source/gpl.txt similarity index 100% rename from source/source/gpl.txt rename to source/gpl.txt diff --git a/source/source/EMU48.sln b/source/source/EMU48.sln deleted file mode 100644 index 9da1601..0000000 --- a/source/source/EMU48.sln +++ /dev/null @@ -1,46 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EMU48DLL", "EMU48DLL.vcxproj", "{D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Emu48", "Emu48.vcxproj", "{D2111396-0ACD-41C3-B286-3E6599A9720A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug Unicode|Win32 = Debug Unicode|Win32 - Debug|Win32 = Debug|Win32 - DebugRegDebug4x|Win32 = DebugRegDebug4x|Win32 - Release Unicode|Win32 = Release Unicode|Win32 - Release|Win32 = Release|Win32 - ReleaseRegDebug4x|Win32 = ReleaseRegDebug4x|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.Debug Unicode|Win32.ActiveCfg = Debug|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.Debug Unicode|Win32.Build.0 = Debug|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.Debug|Win32.ActiveCfg = Debug|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.Debug|Win32.Build.0 = Debug|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.DebugRegDebug4x|Win32.ActiveCfg = Debug|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.DebugRegDebug4x|Win32.Build.0 = Debug|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.Release Unicode|Win32.ActiveCfg = Release|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.Release Unicode|Win32.Build.0 = Release|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.Release|Win32.ActiveCfg = Release|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.Release|Win32.Build.0 = Release|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.ReleaseRegDebug4x|Win32.ActiveCfg = Release|Win32 - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9}.ReleaseRegDebug4x|Win32.Build.0 = Release|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.Debug|Win32.ActiveCfg = Debug|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.Debug|Win32.Build.0 = Debug|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.DebugRegDebug4x|Win32.ActiveCfg = DebugRegDebug4x|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.DebugRegDebug4x|Win32.Build.0 = DebugRegDebug4x|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.Release|Win32.ActiveCfg = Release|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.Release|Win32.Build.0 = Release|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.ReleaseRegDebug4x|Win32.ActiveCfg = ReleaseRegDebug4x|Win32 - {D2111396-0ACD-41C3-B286-3E6599A9720A}.ReleaseRegDebug4x|Win32.Build.0 = ReleaseRegDebug4x|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/source/source/EMU48DLL.vcproj b/source/source/EMU48DLL.vcproj deleted file mode 100644 index 123ca1f..0000000 --- a/source/source/EMU48DLL.vcproj +++ /dev/null @@ -1,808 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/source/EMU48DLL.vcxproj b/source/source/EMU48DLL.vcxproj deleted file mode 100644 index ce536aa..0000000 --- a/source/source/EMU48DLL.vcxproj +++ /dev/null @@ -1,279 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {D698708A-34DA-4FDC-80BC-D3AB2EBC5CA9} - Emu48 - - - - DynamicLibrary - false - MultiByte - - - DynamicLibrary - false - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\Debug\ - .\Debug\ - true - .\Release\ - .\Release\ - false - EMU48 - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug/EMU48DLL.tlb - - - - - /D REGISTRYKEY=\"Software\\Hewlett-Packard\\Debug4x\\Emu48\" %(AdditionalOptions) - Disabled - _DEBUG;WIN32;_WINDOWS;STRICT;_USRDLL;REGISTRY;%(PreprocessorDefinitions) - true - MultiThreadedDebug - Use - pch.h - .\Debug/EMU48DLL.pch - .\Debug/ - .\Debug/ - .\Debug/ - true - Level3 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - winmm.lib;%(AdditionalDependencies) - .\Debug/Emu48.dll - true - true - .\Debug/Emu48.pdb - false - - - .\Debug/Emu48.lib - MachineX86 - - - true - .\Debug/EMU48DLL.bsc - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release/EMU48DLL.tlb - - - - - /D REGISTRYKEY=\"Software\\Hewlett-Packard\\Debug4x\\Emu48\" %(AdditionalOptions) - MaxSpeed - AnySuitable - NDEBUG;WIN32;_WINDOWS;STRICT;_USRDLL;REGISTRY;%(PreprocessorDefinitions) - true - MultiThreaded - true - Use - pch.h - .\Release/EMU48DLL.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - FastCall - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - winmm.lib;Ws2_32.lib;%(AdditionalDependencies) - .\Release/Emu48.dll - true - .\Release/Emu48.pdb - false - - - .\Release/Emu48.lib - MachineX86 - - - true - .\Release/EMU48DLL.bsc - - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - Create - %(PreprocessorDefinitions) - Create - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/source/source/EMU48DLL.vcxproj.filters b/source/source/EMU48DLL.vcxproj.filters deleted file mode 100644 index cfa8063..0000000 --- a/source/source/EMU48DLL.vcxproj.filters +++ /dev/null @@ -1,151 +0,0 @@ - - - - - {036803d0-e5da-4f5d-adf3-bd23b9dd095f} - cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90 - - - {5602a8c2-47f0-4367-bec1-73dd7c524ed4} - h;hpp;hxx;hm;inl;fi;fd - - - {4fd418f4-ad27-4307-92fe-9cecea80086d} - ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/source/source/Emu48.vcproj b/source/source/Emu48.vcproj deleted file mode 100644 index a6e133e..0000000 --- a/source/source/Emu48.vcproj +++ /dev/null @@ -1,1980 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/source/Emu48.vcxproj b/source/source/Emu48.vcxproj deleted file mode 100644 index 0c521ff..0000000 --- a/source/source/Emu48.vcxproj +++ /dev/null @@ -1,631 +0,0 @@ - - - - - Debug Unicode - Win32 - - - DebugRegDebug4x - Win32 - - - Debug - Win32 - - - Release Unicode - Win32 - - - ReleaseRegDebug4x - Win32 - - - Release - Win32 - - - - {D2111396-0ACD-41C3-B286-3E6599A9720A} - Emu48 - - - - Application - false - - - Application - false - - - Application - false - - - Application - false - Unicode - - - Application - false - - - Application - false - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\DebugUnicode\ - .\DebugUnicode\ - true - .\Debug\ - .\Debug\ - true - .\ReleaseUnicode\ - .\ReleaseUnicode\ - false - .\Release\ - .\Release\ - false - .\DebugRegDebug4x\ - .\DebugRegDebug4x\ - true - .\ReleaseRegDebug4x\ - .\ReleaseRegDebug4x\ - false - EMU48 - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\DebugUnicode/Emu48.tlb - - - - - Disabled - _DEBUG;WIN32;_WINDOWS;STRICT;UNICODE;%(PreprocessorDefinitions) - true - MultiThreadedDebug - Use - pch.h - .\DebugUnicode/Emu48.pch - .\DebugUnicode/ - .\DebugUnicode/ - .\DebugUnicode/ - true - Level3 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - winmm.lib;comctl32.lib;%(AdditionalDependencies) - .\DebugUnicode/Emu48.exe - true - true - .\DebugUnicode/Emu48.pdb - Windows - false - - - MachineX86 - - - true - .\DebugUnicode/Emu48.bsc - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug/Emu48.tlb - - - - - Disabled - _DEBUG;WIN32;_WINDOWS;STRICT;%(PreprocessorDefinitions) - true - MultiThreadedDebug - Use - pch.h - .\Debug/Emu48.pch - .\Debug/ - .\Debug/ - .\Debug/ - true - Level3 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - winmm.lib;comctl32.lib;%(AdditionalDependencies) - .\Debug/Emu48.exe - true - true - .\Debug/Emu48.pdb - Windows - false - - - MachineX86 - - - true - .\Debug/Emu48.bsc - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\ReleaseUnicode/Emu48.tlb - - - - - MaxSpeed - AnySuitable - NDEBUG;WIN32;_WINDOWS;STRICT;UNICODE;%(PreprocessorDefinitions) - true - MultiThreaded - true - Use - pch.h - .\ReleaseUnicode/Emu48.pch - .\ReleaseUnicode/ - .\ReleaseUnicode/ - .\ReleaseUnicode/ - Level3 - true - FastCall - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - winmm.lib;comctl32.lib;%(AdditionalDependencies) - .\ReleaseUnicode/Emu48.exe - true - .\ReleaseUnicode/Emu48.pdb - Windows - false - - - MachineX86 - - - true - .\ReleaseUnicode/Emu48.bsc - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release/Emu48.tlb - - - - - MaxSpeed - AnySuitable - NDEBUG;WIN32;_WINDOWS;STRICT;%(PreprocessorDefinitions) - true - MultiThreaded - true - Use - pch.h - .\Release/Emu48.pch - .\Release/ - .\Release/ - .\Release/ - Level3 - true - FastCall - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - winmm.lib;comctl32.lib;Ws2_32.lib;%(AdditionalDependencies) - .\Release/Emu48.exe - true - .\Release/Emu48.pdb - Windows - false - - - MachineX86 - - - - - true - .\Release/Emu48.bsc - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\DebugRegDebug4x/Emu48.tlb - - - - - /D REGISTRYKEY=\"Software\\Hewlett-Packard\\Debug4x\\Emu48\" %(AdditionalOptions) - Disabled - _DEBUG;WIN32;_WINDOWS;STRICT;REGISTRY;%(PreprocessorDefinitions) - true - MultiThreadedDebug - Use - pch.h - .\DebugRegDebug4x/Emu48.pch - .\DebugRegDebug4x/ - .\DebugRegDebug4x/ - .\DebugRegDebug4x/ - true - Level3 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - winmm.lib;comctl32.lib;%(AdditionalDependencies) - .\DebugRegDebug4x/Emu48.exe - true - true - .\DebugRegDebug4x/Emu48.pdb - Windows - false - - - MachineX86 - - - true - .\DebugRegDebug4x/Emu48.bsc - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\ReleaseRegDebug4x/Emu48.tlb - - - - - /D REGISTRYKEY=\"Software\\Hewlett-Packard\\Debug4x\\Emu48\" %(AdditionalOptions) - MaxSpeed - AnySuitable - NDEBUG;WIN32;_WINDOWS;STRICT;REGISTRY;%(PreprocessorDefinitions) - true - MultiThreaded - true - Use - pch.h - .\ReleaseRegDebug4x/Emu48.pch - .\ReleaseRegDebug4x/ - .\ReleaseRegDebug4x/ - .\ReleaseRegDebug4x/ - Level3 - true - FastCall - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - winmm.lib;comctl32.lib;Ws2_32.lib;%(AdditionalDependencies) - .\ReleaseRegDebug4x/Emu48.exe - true - .\ReleaseRegDebug4x/Emu48.pdb - Windows - false - - - MachineX86 - - - true - .\ReleaseRegDebug4x/Emu48.bsc - - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - Create - %(PreprocessorDefinitions) - Create - %(PreprocessorDefinitions) - Create - %(PreprocessorDefinitions) - Create - %(PreprocessorDefinitions) - Create - %(PreprocessorDefinitions) - Create - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/source/source/Emu48.vcxproj.filters b/source/source/Emu48.vcxproj.filters deleted file mode 100644 index 3e2ede3..0000000 --- a/source/source/Emu48.vcxproj.filters +++ /dev/null @@ -1,154 +0,0 @@ - - - - - {42670a15-cd4b-4b80-bd83-7a6798392302} - cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90 - - - {e57a9ce5-70b4-4e91-9635-7e3594bd1342} - h;hpp;hxx;hm;inl;fi;fd - - - {b18143c3-212e-46b8-a5b1-fd6edcf1377d} - ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - Resource Files - - - Resource Files - - - \ No newline at end of file diff --git a/source/source/Emu48Ini.txt b/source/source/Emu48Ini.txt deleted file mode 100644 index 77b154e..0000000 --- a/source/source/Emu48Ini.txt +++ /dev/null @@ -1,348 +0,0 @@ -Emu48 Settings Description --------------------------- - -This is a detailed description of the Emu48 program settings. Some of them can -be controlled over a settings dialog, some of them only manually. The Emu48 -versions use different saving locations. Some of them save there data in a INI -file, some of them in the registry. There are some items which aren't supported -in all versions. - -- Emu48 for IA32 -%WINDIR%\Emu48.ini - -- Emu48+ (from the Debug4x package) -HKCU\Software\Hewlett-Packard\Debug4x\Emu48\ - -- Emu48 for Pocket PC -HKCU\Software\Emu48\ - - -The configuration data is divided into sections. Each section may contain one or -more items. Each item has an argument. The argument is one of following three -types: - -[string] : text string in "" -[integer] : signed integer value -[bool] : special integer type with 0 for FALSE and 1 for TRUE - -Before changing the settings content manually, close all Emu48 instances before! - - -1.) Section [Files] - -- Emu48Directory=[string] - -This item contain the default path for the KML-files and other emulator specific -files which are used without a full path name. - -Default: actual path of Emu48.exe at first start - -- LastDocument=[string] - -This item contain the full path name to the last used state file. - -Default: -empty- - -- AutoSave=[bool] - -This item controls the "Automatically Save Files" state file save. This setting -is used when you change the state file during a session. - -0 = Ask if state file should be saved -1 = Save state file automatically - -Default: 0 - -- AutoSaveOnExit=[bool] - -This item controls the "Automatically Save Files On Exit" state file save at -program exit. - -0 = Ask if state file should be saved -1 = Save state file automatically - -Default: 0 - -- SaveDefaultConfirm=[bool] - -This item controls the default button in the "Do you want to save changes ?" -message box. - -0 = No - Button -1 = Yes - Button - -Default: 1 - -- LoadObjectWarning=[bool] - -This item controls the "Show Load Object Warning" warning. - -0 = no warning -1 = warning - -Default: 1 - -- StartupBackup=[bool] - -This item controls if a state file memory backup (Menu Edit/Backup) should be -made at program start. - -0 = no backup -1 = create backup - -Default: 0 - - -2.) Section [KML] - -- AlwaysDisplayLog=[bool] - -This item controls "Always Show KML Compilation Result" view. - -0 = don't show KML compilation result -1 = show KML compilation result after reading the KML file - -Default: 1 - -- ClassicCursor=[bool] - -Obsolete, can be purged. - - -3.) Section [Emulator] - -- RealSpeed=[bool] - -This item controls "Authentic Calculator Speed" setting. - -0 = disabled -1 = enabled - -Default: 0 - -- SXCycles=[integer] - -This item controls the speed in "Authentic Calculator Speed" mode for -calculators base on the "Clarke" chip. The number are the allowed CPU-cycles in -a 16384Hz time frame. - -Default: 82 - -- GXCycles=[integer] - -This item controls the speed in "Authentic Calculator Speed" mode for -calculators base on the "Yorke" chip. The number are the allowed CPU-cycles in a -16384Hz time frame. - -Default: 123 - -- Grayscale=[bool] - -This item controls "Enable Virtual LCD Delay" setting. - -0 = disabled -1 = enable virtual LCD delay for grayscale simulation - -Default: 0 - -- AlwaysOnTop=[bool] - -This item controls "Always On Top" setting. - -0 = disabled -1 = application windows are always on top - -Default: 0 - -- ActivationFollowsMouse=[bool] - -This item controls "Activation Follows Mouse" setting. - -0 = disabled -1 = if mouse is moved over a Emu48 window, application pops up into foreground - -Default: 0 - -- WaveBeep=[bool] - -This item sets the beeper output device. - -0 = PC Speaker -1 = Wave Output over sound card - -Default: 0 - -- WaveVolume=[integer] - -This item sets the volume for the wave output. The valid value range is 0 - 255. - -0 = quietest -255 = loudest - -Default: 64 - - -4.) Section [Port2] - -This section is only interested for the HP48 emulation. Other calculator -emulations aren't affected by this section. - -- IsShared=[bool] - -This item controls the "Port 2 is Shared" setting. - -0 = file not shared -1 = file shared - -Default: 0 - -- Filename=[string] - -This item contain the "Port 2 File" name. - -Default: SHARED.BIN - - -5.) Section [ROM] - -This section is only interested for the HP49G emulation. - -- Writeable=[bool] - -This item controls if data could be saved in the HP49 ROM image file. In "Read -Only" mode all changes in the Flash memory are discarded at session end. - -0 = Discard changes at session exit -1 = Writeable - -Default: 1 - -- WP#=[bool] - -This item don't exist at must be created manually. It controls the WP# pin state -of 28F160 flash chip. On the original HP49G calculator the pin is controlled by -a solder bridge. - -0 = WP# = low, locked blocks cannot be erased -1 = WP# = high, locked blocks can be erased - -Default: 0 - - -6.) Section [LowBat] - -- Disable=[bool] - -This item controls the low battery simulation. On AC powered devices the low -battery simulation is always disabled. On battery powered devices the simulation -is enabled. In some cases, especially when the battery is quite old, the -operating system may return a wrong battery charging level. This could make the -emulator unusable. - -0 = low battery simulation in auto mode -1 = low battery simulation disabled - -Default: 0 - - -7.) Section [Timers] - -Obsolete, can be purged. - -- AccurateTimer=[bool] - -Obsolete, can be purged. - -- T1Period=[integer] - -Obsolete, can be purged. - - -8.) Section [Serial] - --Wire=[string] - -This item controls the serial port "Wire" setting. The string can contain -"disabled" or the device name of the serial device. - -Default: "disabled" - --Ir=[string] - -This item controls the serial port "IR" setting. The string can contain -"disabled" or the device name of the serial device. - -Default: "disabled" - - -9.) Section [Macro] - -- RealSpeed=[bool] - -This item controls the macro replay speed setting. - -0 = replay with given given speed -1 = replay with recording speed - -Default: 1 - -- ReplayTimeout=[integer] - -This item controls the macro replay delay time in "replay with given given -speed" mode between two keyboard actions. The unit is ms. The range of the -slider control in the settings dialog is 0 - 500. The emulator itself accepts -larger values than 500. - -Default: 0 - - -10.) Section [MRU] - -- FileCount=[integer] - -This item controls the maximum number of items in the "Most Recently Used" file -list. - -0 = disabled ->0 = maximum number of entries - -Default: 4 - -- FileX=[string] (where X is the slot number >= 1) - -This item controls the file name of the slot number. File1 is the topmost slot -in the MRU list. When you reduce the FileCount setting manually you have to -purge the slot numbers above this value manually. - -Default: -empty- - - -11.) Section [Disassembler] - -- Mnemonics=[bool] - -This item sets the disassembly mode. - -0 = HP Mnemonics -1 = Class Mnemonics - -Default: 0 - -- Symbolic:[bool] - -This item enables the use of symbolic names in the debugger disassembly. - -0 = disabled -1 = enabled - -Default: 0 - -- SymbX=[string] (where X is the model character from the KML file) - -This item contain the full path to the symbol file reference for the -corresponding calculator model. - -Default: -not exist- - - -10/13/08 (c) by Christoph Gießelink