2015-08-15: Updated to version 1.57

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

BIN
Emu48.exe

Binary file not shown.

View file

@ -1,6 +1,6 @@
{\rtf1\ansi\ansicpg1252\deff0\deflang1031\deflangfe1031{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fmodern\fprq1\fcharset0 Courier New;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fswiss\fprq2\fcharset0 Arial;}{\f4\froman\fprq2\fcharset2 Symbol;}} {\rtf1\ansi\ansicpg1252\deff0\deflang1031\deflangfe1031{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fmodern\fprq1\fcharset0 Courier New;}{\f2\froman\fprq2\fcharset161{\*\fname Times New Roman;}Times New Roman Greek;}{\f3\fswiss\fprq2\fcharset0 Arial;}{\f4\froman\fprq2\fcharset2 Symbol;}}
{\colortbl ;\red0\green0\blue0;\red0\green0\blue255;} {\colortbl ;\red0\green0\blue0;\red0\green0\blue255;}
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\nowidctlpar\qc\lang1033\f0\fs56 EmuXY and KML 2.0\par {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\nowidctlpar\qc\lang1033\f0\fs56 EmuXY and KML 2.0\par
\pard\nowidctlpar\fs24\par \pard\nowidctlpar\fs24\par
\b\fs28 Introduction\b0\par \b\fs28 Introduction\b0\par
\fs24\par \fs24\par
@ -40,6 +40,7 @@ Basics\b0\par
\tab Rom STRING\par \tab Rom STRING\par
\tab Patch STRING\par \tab Patch STRING\par
\tab Bitmap STRING\par \tab Bitmap STRING\par
\tab Color INTEGER INTEGER INTEGER INTEGER\par
\tab Print STRING\par \tab Print STRING\par
\tab Debug INTEGER\par \tab Debug INTEGER\par
End\par End\par
@ -55,9 +56,9 @@ End\par
\f0\fs24\par \f0\fs24\par
\pard\nowidctlpar\qj Hardware is the emulated calculator hardware. This definition is optional on Emu48. The parameter is necessary to separate the KML scripts from each emulator. Valid entries are\par \pard\nowidctlpar\qj Hardware is the emulated calculator hardware. This definition is optional on Emu48. The parameter is necessary to separate the KML scripts from each emulator. Valid entries are\par
\pard\nowidctlpar Emu10:\par \pard\nowidctlpar Emu10:\par
\f1\fs16\tab\lang1031 Hardware \ldblquote Bert\rdblquote\par \f1\fs16\tab Hardware \ldblquote Bert\rdblquote\par
\f0\fs24 Emu28:\par \f0\fs24 Emu28:\par
\f1\fs16\tab\lang1033 Hardware \ldblquote Centipede\rdblquote\par \f1\fs16\tab Hardware \ldblquote Centipede\rdblquote\par
\f0\fs24 Emu42:\par \f0\fs24 Emu42:\par
\f1\fs16\tab Hardware \ldblquote Lewis\rdblquote\par \f1\fs16\tab Hardware \ldblquote Lewis\rdblquote\par
\f0\fs24 Emu48:\par \f0\fs24 Emu48:\par
@ -87,7 +88,7 @@ Emu10:\par
\ldblquote E\rdblquote = HP39G or HP40G\par \ldblquote E\rdblquote = HP39G or HP40G\par
\ldblquote G\rdblquote = HP48G, HP48G+ or HP48GX\par \ldblquote G\rdblquote = HP48G, HP48G+ or HP48GX\par
\ldblquote S\rdblquote = HP48S or HP48SX\par \ldblquote S\rdblquote = HP48S or HP48SX\par
\lang1031\ldblquote X\rdblquote = HP49G\cf1\par \ldblquote X\rdblquote = HP49G\cf1\par
\pard\nowidctlpar\qj Emu71:\par \pard\nowidctlpar\qj Emu71:\par
\pard\nowidctlpar\fi720\qj\cf0\lang1036\ldblquote T\rdblquote = HP71B\par \pard\nowidctlpar\fi720\qj\cf0\lang1036\ldblquote T\rdblquote = HP71B\par
\pard\nowidctlpar\qj Example:\par \pard\nowidctlpar\qj Example:\par
@ -114,9 +115,14 @@ Bitmap is the bitmap file that will be the \ldblquote faceplate\rdblquote . All
\pard\nowidctlpar Example:\par \pard\nowidctlpar Example:\par
\f1\fs16\tab Bitmap \ldblquote mygx.bmp\rdblquote\par \f1\fs16\tab Bitmap \ldblquote mygx.bmp\rdblquote\par
\pard\nowidctlpar\qj\f0\fs24\par \pard\nowidctlpar\qj\f0\fs24\par
Color is an optional setting to define the transparency color of the background bitmap. It takes effect only when both, title bar and menu bar are not shown. The first integer specifies the maximum tolerance between bitmap pixel and reference for color matching followed by three integers defining the RGB numbers (Red, Green and Blue) of the transparency reference color. Each RGB number range from 0 to 255. The difference between the actual pixel and the transparency color is calculated by the formula:\par
\f2 Difference = |\'c4R| + |\'c4G| + |\'c4B| where the \'c4 are the count differences between the color parts of the pixel and \f0 the transparency reference color. The given tolerance value must be greater or equal to the calculated difference to handle this background bitmap \ul position\ulnone as transparent. Because of setting the bitmap position to transparent it\rquote s quite important that the display area in the background bitmap is not set to transparent, else the complete display area will be transparent even if the colors of the display pixel don\rquote t match with the transparency reference color.\par
\pard\nowidctlpar Example:\par
\f1\fs16\tab Color 0 255 0 0\par
\pard\nowidctlpar\qj\f0\fs24\par
Print will display a string when the KML file is loaded. You can have as many of these as necessary. They are more effective if you put them before the other settings.\par Print will display a string when the KML file is loaded. You can have as many of these as necessary. They are more effective if you put them before the other settings.\par
\pard\nowidctlpar Example:\par \pard\nowidctlpar Example:\par
\f1\fs16\tab Print \ldblquote My homepage is at http://hp.giesselink.com/\rdblquote\par \f1\fs16\tab Print \ldblquote My homepage is at {\field{\*\fldinst{HYPERLINK "http://hp.giesselink.com/"}}{\fldrslt{\ul\cf2 http://hp.giesselink.com/}}}\f1\fs16\rdblquote\par
\pard\nowidctlpar\qj\f0\fs24\par \pard\nowidctlpar\qj\f0\fs24\par
Debug sets the emulator to return an information message box telling the scancode number of the keyboard key pressed when the scancode number isn\rquote t defined. Valid entries are 0 or 1. One is on and Zero is off.\par Debug sets the emulator to return an information message box telling the scancode number of the keyboard key pressed when the scancode number isn\rquote t defined. Valid entries are 0 or 1. One is on and Zero is off.\par
\pard\nowidctlpar Example:\par \pard\nowidctlpar Example:\par
@ -127,13 +133,13 @@ Debug sets the emulator to return an information message box telling the scancod
\tab This section sets where the background bitmap will be placed and the size of the emulator window.\par \tab This section sets where the background bitmap will be placed and the size of the emulator window.\par
\par \par
\par \par
\lang1031\f1\fs16 Background\par \f1\fs16 Background\par
\tab Vga INTEGER\par \tab Vga INTEGER\par
\tab Topbar INTEGER\par \tab Topbar INTEGER\par
\tab Menubar INTEGER\par \tab Menubar INTEGER\par
\tab Offset INTEGER INTEGER\par \tab Offset INTEGER INTEGER\par
\tab Size INTEGER INTEGER\par \tab Size INTEGER INTEGER\par
\lang1033 End\par End\par
\f0\fs24\par \f0\fs24\par
\par \par
\pard\nowidctlpar\qj Offset is how far the top left corner of the bitmap will be offset in the window. Most of the time you should set this to 0 0. The first integer is the amount of pixels to the right and the second is that amount of pixels down.\par \pard\nowidctlpar\qj Offset is how far the top left corner of the bitmap will be offset in the window. Most of the time you should set this to 0 0. The first integer is the amount of pixels to the right and the second is that amount of pixels down.\par
@ -164,10 +170,10 @@ Debug sets the emulator to return an information message box telling the scancod
\lang1031\f1\fs16 Lcd\par \lang1031\f1\fs16 Lcd\par
\tab Zoom INTEGER\par \tab Zoom INTEGER\par
\tab Zoomxy INTEGER INTEGER\par \tab Zoomxy INTEGER INTEGER\par
\tab Vertical INTEGER\par \tab\lang1033 Vertical INTEGER\par
\tab Offset INTEGER INTEGER\par \tab Offset INTEGER INTEGER\par
\tab Color INTEGER INTEGER INTEGER INTEGER\par \tab Color INTEGER INTEGER INTEGER INTEGER\par
\lang1033 End\par End\par
\f0\fs24\par \f0\fs24\par
\par \par
\pard\nowidctlpar\qj Zoom is the size of the pixels in the LCD screen. This command is only valid for Emu28, Emu42 (Lewis) Emu48 and Emu71 and will be ignored on Emu10 and Emu42 (Sacajawea). Valid entries are 1, 2, 3 or 4. Zoom factor two is usually used by the dot matrix LCD types emulated by Emu28, Emu42 (Lewis), Emu48 and Emu71.\par \pard\nowidctlpar\qj Zoom is the size of the pixels in the LCD screen. This command is only valid for Emu28, Emu42 (Lewis) Emu48 and Emu71 and will be ignored on Emu10 and Emu42 (Sacajawea). Valid entries are 1, 2, 3 or 4. Zoom factor two is usually used by the dot matrix LCD types emulated by Emu28, Emu42 (Lewis), Emu48 and Emu71.\par
@ -189,8 +195,8 @@ Emu10:\par
\pard\nowidctlpar\qj Emu42 (Sacajawea), Emu71:\par \pard\nowidctlpar\qj Emu42 (Sacajawea), Emu71:\par
\pard\nowidctlpar\fi720\qj 0-15 = foreground colors (Pixel on), 0 is lightest, 15 is darkest\par \pard\nowidctlpar\fi720\qj 0-15 = foreground colors (Pixel on), 0 is lightest, 15 is darkest\par
16-31 = background colors (Pixel off), 16 corresponds to 0, 17 to 1, \'85\par 16-31 = background colors (Pixel off), 16 corresponds to 0, 17 to 1, \'85\par
\pard\nowidctlpar\qj\lang1031 Emu28, Emu42 (Lewis):\par \pard\nowidctlpar\qj Emu28, Emu42 (Lewis):\par
\pard\nowidctlpar\fi720\qj\lang1033 0-31 = foreground colors (Pixel on), 0 is lightest, 15 is darkest\par \pard\nowidctlpar\fi720\qj 0-31 = foreground colors (Pixel on), 0 is lightest, 15 is darkest\par
32-63 = background colors (Pixel off), 32 corresponds to 0, 33 to 1, \'85\par 32-63 = background colors (Pixel off), 32 corresponds to 0, 33 to 1, \'85\par
\pard\nowidctlpar\qj Emu48:\par \pard\nowidctlpar\qj Emu48:\par
\pard\nowidctlpar\fi720\qj 0-31 = foreground colors (Pixel on), 0 is lightest, 15 is darkest\par \pard\nowidctlpar\fi720\qj 0-31 = foreground colors (Pixel on), 0 is lightest, 15 is darkest\par
@ -787,16 +793,16 @@ or\par
\tab\tab <COMMANDS>\par \tab\tab <COMMANDS>\par
\tab End\par \tab End\par
Or\par Or\par
\tab\lang1031 IfMem INTEGER INTEGER INTEGER\par \tab IfMem INTEGER INTEGER INTEGER\par
\tab\tab\lang1033 <COMMANDS>\par \tab\tab <COMMANDS>\par
\tab Else\par \tab Else\par
\tab\tab <COMMANDS>\par \tab\tab <COMMANDS>\par
\tab End\par \tab End\par
or\par or\par
\tab\lang1031 SetFlag INTEGER\par \tab SetFlag INTEGER\par
or\par or\par
\tab ResetFlag INTEGER\par \tab ResetFlag INTEGER\par
\lang1033 or\par or\par
\tab NotFlag INTEGER\par \tab NotFlag INTEGER\par
or\par or\par
\tab IfFlag INTEGER\par \tab IfFlag INTEGER\par
@ -806,6 +812,8 @@ or\par
\tab End\par \tab End\par
or\par or\par
\tab MenuItem INTEGER\par \tab MenuItem INTEGER\par
or\par
\tab SysItem INTEGER\par
\par \par
\pard\nowidctlpar\qj\f0\fs24 Map <SCANCODE> <BUTTON> will map the state (pressed or released) of the key <SCANCODE> (defined by the "Scancode <SCANCODE>" block) to the button <BUTTON> (defined by the "Button <BUTTON>" block). This means when Map is called in the key pressing state the Button is pressed else, when Map is called in the key releasing state, the Button is released.\par \pard\nowidctlpar\qj\f0\fs24 Map <SCANCODE> <BUTTON> will map the state (pressed or released) of the key <SCANCODE> (defined by the "Scancode <SCANCODE>" block) to the button <BUTTON> (defined by the "Button <BUTTON>" block). This means when Map is called in the key pressing state the Button is pressed else, when Map is called in the key releasing state, the Button is released.\par
\pard\nowidctlpar Example:\par \pard\nowidctlpar Example:\par
@ -854,8 +862,8 @@ Example:\par
\tab\tab Map 51 12\par \tab\tab Map 51 12\par
\tab End\f0\fs24\par \tab End\f0\fs24\par
\par \par
\page MenuItem will open a menu (only if it\rquote s supported). The following values are accepted:\par \pard\nowidctlpar\qj\page MenuItem will open a menu (only if it\rquote s supported). The following values are accepted:\par
\par \pard\nowidctlpar\par
\pard\nowidctlpar\fi720\cf1\f1\fs16 FILE_NEW 1\par \pard\nowidctlpar\fi720\cf1\f1\fs16 FILE_NEW 1\par
FILE_OPEN 2\par FILE_OPEN 2\par
FILE_SAVE 3\par FILE_SAVE 3\par
@ -882,12 +890,21 @@ TOOL_MACRO_RECORD 23\par
TOOL_MACRO_PLAY 24\par TOOL_MACRO_PLAY 24\par
TOOL_MACRO_STOP 25\par TOOL_MACRO_STOP 25\par
TOOL_MACRO_SETTINGS 26\par TOOL_MACRO_SETTINGS 26\par
\pard\nowidctlpar\f0\fs24\par \pard\nowidctlpar\cf0\f0\fs24\par
\cf0\b\fs28\page Conclusion\par \pard\nowidctlpar\sa200\sl276\slmult1\qj SysItem allows to call SYSCOMMAND messages. SYSCOMMAND messages are normally generated by the system or control menu. Interesting as commands inside the KML script are:\par
\pard\nowidctlpar\fi720\cf1\f1\fs16 SC_MOVE 61456\par
SC_MINIMIZE 61472\par
SC_CLOSE 61536\par
\par
\pard\nowidctlpar\qj\cf0\f0\fs24 where SC_MOVE enabling the window to move by the keyboard, SC_MINIMIZE minimizing and SC_CLOSE closing the program window.\par
Example:\par
\pard\nowidctlpar\f1\fs16\tab SysItem 61536 # SC_CLOSE\par
\pard\nowidctlpar\sa200\sl276\slmult1\f0\fs24\par
\pard\nowidctlpar\b\fs28\page Conclusion\par
\b0\fs24\par \b0\fs24\par
\pard\nowidctlpar\qj This document was originally written by Casey Patterson for the Keyboard Macro Language made by S\'e9bastien Carlier and is now maintained by Christoph Gie\'dfelink.\par \pard\nowidctlpar\qj This document was originally written by Casey Patterson for the Keyboard Macro Language made by S\'e9bastien Carlier and is now maintained by Christoph Gie\'dfelink.\par
\pard\nowidctlpar\par \pard\nowidctlpar\par
I\rquote m sorry, the authors can\rquote t give any individual support, try the newsgroup comp.sys.hp48 please.\par I\rquote m sorry, the authors can\rquote t give any individual support, try the forum at {\field{\*\fldinst{HYPERLINK "http://www.hpmuseum.org/"}}{\fldrslt{\ul\cf2 http://www.hpmuseum.org/}}}\f0\fs24 please.\par
\par \par
\par \par
The latest updates are available at:\par The latest updates are available at:\par
@ -896,9 +913,9 @@ The latest updates are available at:\par
\pard\nowidctlpar\fi720\b0 c.giesselink@gmx.de\par \pard\nowidctlpar\fi720\b0 c.giesselink@gmx.de\par
\pard\nowidctlpar\par \pard\nowidctlpar\par
\pard\nowidctlpar\fi720 Christoph Giesselink Main Page\par \pard\nowidctlpar\fi720 Christoph Giesselink Main Page\par
http://hp.giesselink.com/\par \pard\fi720{\field{\*\fldinst{HYPERLINK "http://hp.giesselink.com/"}}{\fldrslt{\ul\cf2 http://hp.giesselink.com/}}}\f0\fs24\par
\pard\nowidctlpar\par \pard\nowidctlpar\par
\par \par
Release 17: October 12th, 2012\par Release 18: May 18th, 2015\par
} }

View file

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

View file

@ -1,3 +1,149 @@
Service Pack 57 for Emu48 Version 1.0
DEBUGGER.C
- bugfix in function OnContextMenu(), when the context menu was
generated from the keyboard it was opened at the wrong position
- bugfix in function Debugger(), use critical section for secure
deletion of the last instruction buffer
DISMEM.C
- changed function SetMemRomType(), fixed signed/unsigned mismatch
DISPLAY.C
- changed function ResizeWindow(), optimized implementation now
works independent from window style and menu bar setting
DISRPL.C
- changed function PutSn(), minor optimization
- changed function DoHexStream(), DoIntStream(), DoBint(), DoReal(),
DoERel(), DoCmp(), DoECmp(), DoChar(), DoCStr(), DoHxs(),
DoIdnt(), DoLam(), DoRomp(), Semi() and DoFlashPtr(), added
UNREFERENCED_PARAMETER statement
- changed function DoERel(), made function static
- changed function Getfp(), fixed signed/unsigned mismatch
EMU48.C
- added global variable dwTColor and dwTColorTol for the background
transparency color matching
- added global variable hRgn to hold a region resource handle for
a transparent background bitmap
- added global variables bTitleBar, bShowTitle, bShowMenu and
bClientWinMove
- added Critical Section initialization
- added function UpdateWindowBars(), helper function to update state
of title and menu bar
- changed function SettingsGeneralProc(), added "Show Title" and
"Show Menu" checkbox handling
- changed function SettingsPeripheralProc(), added
UNREFERENCED_PARAMETER statement
- changed function OnPaint(), added UpdateWindowBars() call
- changed function OnInitMenu(), added MRU list update
- added function OnContextMenu(), context menu implementation
- added function OnNcHitTest(), when no title bar check if mouse
position is in client not over a button area
- changed function MainWndProc(), minor change in WM_PALETTECHANGED
implementation and added WM_CONTEXTMENU, WM_NCRBUTTONUP and
WM_NCHITTEST message handler
- changed function WinMain(), changed method of memory leak
detection by adding _CrtSetDbgFlag() at begin and removing
_CrtDumpMemoryLeaks() at end of program
EMU48.H
- added window styles definition
- changed function prototypes
- extern declaration of global variables and function
EMU48.RC
- changed IDD_SET_GENERAL, added "Show Title" and "Show Menu"
checkbox
- added menu IDM_MENU
- changed version and copyright
ENGINE.C
- bugfix in function SaveInstrAddr(), added critical section to be
sure that last instruction buffer is still available
FETCH.C
- added typecast to all pLnk entries for compatibility with C++
compiling on GCC 4.8.1
FILES.C
- defined abs() and labs() as intrinsic
- changed function DibNumColors(), fixed typecast
- changed function DecodeGif(), changed function prototype by adding
an argument overwritten by the transparent color if found
- changed function LoadBitmapFile(), adjusted to new prototype of
function DecodeGif()
- added function AbsColorCmp() and LabColorCmp(), compare colors
with tolerance
- added function CreateRgnFromBitmap(), create opaque bitmap region
KML.C
- added keyword "SysItem" to pLexToken[] table
- changed function InitGlobal(), added implementation of keyword
"Color"
- changed function RunLine(), added implementation of keyword
"SysItem"
- changed function KillKML(), added reset of variables hRgn,
dwTColor and dwTColorTol
- added function MouseIsButton() to check if mouse over button area
- changed function MouseMovesTo(), changed _ASSERT implementation to
make sure that class cursor is NULL and use function
MouseIsButton() to select cursor type now
KML.H
- added TOK_SYSITEM definition
- changed structure KmlToken, replaced TCHAR array szName[20] with
LPCTSTR szName pointer
- added MouseIsButton() function prototype
MRU.C
- changed all function argument types from INT to UINT
- removed global variables hMruMenu and nMruPos
- removed all update menu calls in this module and made functions
robust against non initialized MRU list and ID index out of range
- changed function GetMenuPosForId(), changed function prototype so
the resulting menu handle and menu position aren't global
variables any more
- changed function MruInit(), changed return value from FALSE to
TRUE for success and changed implementation like used in the PPC
emulator variants
- changed function MruUpdateMenu(), changed function prototype by
adding the HMENU argument for updating the selected menu and added
initialization prior done in function MruInit()
- changed function MruWriteList(), if there are no entries don't
write the "FileCount" setting any more
PCH.H
- added _WINSOCK_DEPRECATED_NO_WARNINGS definition
- added GCLP_HCURSOR, SetClassLongPtr, GetClassLongPtr and ULONG_PTR
definitions for MSVC6.0 SDK and earlier
REDEYE.C
- changed function CreateCorrectionBits(), fixed signed/unsigned
mismatch
RESOURCE.H
- added definitions
SERIAL.C
- changed function CommOpen(), fixed signed/unsigned mismatch
SETTINGS.C
- changed function ReadSettings() and WriteSettings(), added item
"ShowTitle", "ShowMenu" and "ClientWinMove" in section [Emulator]
in the INI-File
STACK.C
- changed function SetBcd(), fixed signed/unsigned mismatch
- bugfix in function RPL_GetComplex(), function arguments nMantLen
and nExpLen hadn't been used
SYMBFILE.C
- changed function RplLoadTable(), made optimizations and added
integrity checks
Service Pack 56 for Emu48 Version 1.0 Service Pack 56 for Emu48 Version 1.0
DEBUGGER.C DEBUGGER.C

View file

@ -1434,6 +1434,16 @@ static VOID OnContextMenu(HWND hDlg, LPARAM lParam, WPARAM wParam)
INT nId; INT nId;
POINTSTOPOINT(pt,MAKEPOINTS(lParam)); // mouse position POINTSTOPOINT(pt,MAKEPOINTS(lParam)); // mouse position
if (pt.x == -1 && pt.y == -1) // VK_APPS
{
RECT rc;
GetWindowRect((HWND) wParam,&rc); // get position of active window
pt.x = rc.left + 5;
pt.y = rc.top + 5;
}
nId = GetDlgCtrlID((HWND) wParam); // control ID of window nId = GetDlgCtrlID((HWND) wParam); // control ID of window
switch(nId) switch(nId)
@ -1453,7 +1463,7 @@ static VOID OnContextMenu(HWND hDlg, LPARAM lParam, WPARAM wParam)
TrackPopupMenu(hMenuMem,0,pt.x,pt.y,0,hDlg,NULL); TrackPopupMenu(hMenuMem,0,pt.x,pt.y,0,hDlg,NULL);
break; break;
case IDC_DEBUG_STACK: // handle code window case IDC_DEBUG_STACK: // handle stack window
TrackPopupMenu(hMenuStack,0,pt.x,pt.y,0,hDlg,NULL); TrackPopupMenu(hMenuStack,0,pt.x,pt.y,0,hDlg,NULL);
break; break;
} }
@ -1943,8 +1953,12 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM
SetEvent(hEventDebug); SetEvent(hEventDebug);
if (pdwInstrArray) // free last instruction circular buffer if (pdwInstrArray) // free last instruction circular buffer
{ {
free(pdwInstrArray); EnterCriticalSection(&csDbgLock);
pdwInstrArray = NULL; {
free(pdwInstrArray);
pdwInstrArray = NULL;
}
LeaveCriticalSection(&csDbgLock);
} }
CloseHandle(hEventDebug); CloseHandle(hEventDebug);
wndpl.length = sizeof(wndpl); // save debugger window position wndpl.length = sizeof(wndpl); // save debugger window position

View file

@ -95,7 +95,7 @@ static DWORD dwMapDataMask = 0;
BOOL SetMemRomType(BYTE cCurrentRomType) BOOL SetMemRomType(BYTE cCurrentRomType)
{ {
INT i; UINT i;
pMapping = MemMap; // init default mapping pMapping = MemMap; // init default mapping

View file

@ -828,34 +828,39 @@ VOID UpdateAnnunciators(VOID)
VOID ResizeWindow(VOID) VOID ResizeWindow(VOID)
{ {
RECT rectWindow; if (hWnd != NULL) // if window created
RECT rectClient;
if (hWnd == NULL) return; // return if window closed
rectWindow.left = 0;
rectWindow.top = 0;
rectWindow.right = nBackgroundW;
rectWindow.bottom = nBackgroundH;
AdjustWindowRect(&rectWindow, WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED, TRUE);
SetWindowPos(hWnd, bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0,
rectWindow.right - rectWindow.left,
rectWindow.bottom - rectWindow.top,
SWP_NOMOVE);
GetClientRect(hWnd, &rectClient);
AdjustWindowRect(&rectClient, WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED, TRUE);
if (rectClient.bottom < rectWindow.bottom)
{ {
rectWindow.bottom += (rectWindow.bottom - rectClient.bottom); RECT rectWindow;
SetWindowPos (hWnd, NULL, 0, 0, RECT rectClient;
rectWindow.left = 0;
rectWindow.top = 0;
rectWindow.right = nBackgroundW;
rectWindow.bottom = nBackgroundH;
AdjustWindowRect(&rectWindow,
(DWORD) GetWindowLongPtr(hWnd,GWL_STYLE),
GetMenu(hWnd) != NULL);
SetWindowPos(hWnd, bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0,
rectWindow.right - rectWindow.left, rectWindow.right - rectWindow.left,
rectWindow.bottom - rectWindow.top, rectWindow.bottom - rectWindow.top,
SWP_NOMOVE | SWP_NOZORDER); SWP_NOMOVE);
}
_ASSERT(hWindowDC); // move destination window // check if menu bar wrapped to two or more rows
SetWindowOrgEx(hWindowDC, nBackgroundX, nBackgroundY, NULL); GetClientRect(hWnd, &rectClient);
InvalidateRect(hWnd,NULL,TRUE); if (rectClient.bottom < (LONG) nBackgroundH)
{
rectWindow.bottom += (nBackgroundH - rectClient.bottom);
SetWindowPos (hWnd, NULL, 0, 0,
rectWindow.right - rectWindow.left,
rectWindow.bottom - rectWindow.top,
SWP_NOMOVE | SWP_NOZORDER);
}
_ASSERT(hWindowDC); // move destination window
SetWindowOrgEx(hWindowDC, nBackgroundX, nBackgroundY, NULL);
InvalidateRect(hWnd,NULL,TRUE);
}
return; return;
} }

View file

@ -43,7 +43,7 @@ static VOID PutSn(String *str, LPCTSTR szVal, DWORD dwLen)
if (dwLen > 0) // actual string length if (dwLen > 0) // actual string length
{ {
// string buffer to small // string buffer to small
if (str->dwPos + dwLen - 1 >= str->dwSize) if (str->dwPos + dwLen > str->dwSize)
{ {
DWORD dwMinSize; DWORD dwMinSize;
dwMinSize = dwLen + str->dwSize - str->dwPos; dwMinSize = dwLen + str->dwSize - str->dwPos;
@ -273,6 +273,7 @@ static BOOL DoHexStream(DWORD *pdwAddr,String *str,UINT *pnLevel)
PutC(str,cHex[RplReadNibble(pdwAddr)]); // write digit PutC(str,cHex[RplReadNibble(pdwAddr)]); // write digit
} }
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(pnLevel);
} }
// SEMI stream helper function // SEMI stream helper function
@ -346,6 +347,7 @@ static BOOL DoIntStream(DWORD *pdwAddr,String *str,UINT *pnLevel)
free(pbyData); free(pbyData);
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(pnLevel);
} }
@ -359,6 +361,7 @@ static BOOL DoBint(DWORD *pdwAddr,String *str,UINT *pnLevel)
{ {
PutS(str,_T("# ")); PutS(str,_T("# "));
return BINx(pdwAddr,5,str); // BIN5 return BINx(pdwAddr,5,str); // BIN5
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoReal(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoReal(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -373,9 +376,10 @@ static BOOL DoReal(DWORD *pdwAddr,String *str,UINT *pnLevel)
byNumber[i] = RplReadNibble(pdwAddr); byNumber[i] = RplReadNibble(pdwAddr);
return BCDx(byNumber,12,3,str); return BCDx(byNumber,12,3,str);
UNREFERENCED_PARAMETER(pnLevel);
} }
BOOL DoERel(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoERel(DWORD *pdwAddr,String *str,UINT *pnLevel)
{ {
BYTE byNumber[21]; BYTE byNumber[21];
DWORD i; DWORD i;
@ -387,6 +391,7 @@ BOOL DoERel(DWORD *pdwAddr,String *str,UINT *pnLevel)
byNumber[i] = RplReadNibble(pdwAddr); byNumber[i] = RplReadNibble(pdwAddr);
return BCDx(byNumber,15,5,str); return BCDx(byNumber,15,5,str);
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoCmp(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoCmp(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -409,6 +414,7 @@ static BOOL DoCmp(DWORD *pdwAddr,String *str,UINT *pnLevel)
byNumber[i] = RplReadNibble(pdwAddr); byNumber[i] = RplReadNibble(pdwAddr);
return BCDx(byNumber,12,3,str); return BCDx(byNumber,12,3,str);
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoECmp(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoECmp(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -431,6 +437,7 @@ static BOOL DoECmp(DWORD *pdwAddr,String *str,UINT *pnLevel)
byNumber[i] = RplReadNibble(pdwAddr); byNumber[i] = RplReadNibble(pdwAddr);
return BCDx(byNumber,15,5,str); return BCDx(byNumber,15,5,str);
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoChar(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoChar(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -464,6 +471,7 @@ static BOOL DoChar(DWORD *pdwAddr,String *str,UINT *pnLevel)
PutC(str,(TCHAR) dwChar); // print character PutC(str,(TCHAR) dwChar); // print character
} }
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoArry(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoArry(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -646,6 +654,7 @@ static BOOL DoCStr(DWORD *pdwAddr,String *str,UINT *pnLevel)
PutC(str,_T('"')); PutC(str,_T('"'));
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoHxs(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoHxs(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -681,6 +690,7 @@ static BOOL DoHxs(DWORD *pdwAddr,String *str,UINT *pnLevel)
bRemove = FALSE; // got non zero digit bRemove = FALSE; // got non zero digit
} }
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoList(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoList(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -720,12 +730,14 @@ static BOOL DoIdnt(DWORD *pdwAddr,String *str,UINT *pnLevel)
{ {
PutS(str,_T("ID ")); PutS(str,_T("ID "));
return ASCIC(pdwAddr,str); return ASCIC(pdwAddr,str);
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoLam(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoLam(DWORD *pdwAddr,String *str,UINT *pnLevel)
{ {
PutS(str,_T("LAM ")); PutS(str,_T("LAM "));
return ASCIC(pdwAddr,str); return ASCIC(pdwAddr,str);
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoRomp(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoRomp(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -735,6 +747,7 @@ static BOOL DoRomp(DWORD *pdwAddr,String *str,UINT *pnLevel)
PutC(str,_T(' ')); PutC(str,_T(' '));
BINx(pdwAddr,3,str); // BIN3 BINx(pdwAddr,3,str); // BIN3
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL Semi(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL Semi(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -748,6 +761,7 @@ static BOOL Semi(DWORD *pdwAddr,String *str,UINT *pnLevel)
PutC(str,_T(';')); // write standard semi PutC(str,_T(';')); // write standard semi
} }
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(pdwAddr);
} }
static BOOL DoRrp(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoRrp(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -1103,6 +1117,7 @@ static BOOL DoFlashPtr(DWORD *pdwAddr,String *str,UINT *pnLevel)
str->dwPos = dwBufferPos; // throw out all output str->dwPos = dwBufferPos; // throw out all output
} }
return bErr; return bErr;
UNREFERENCED_PARAMETER(pnLevel);
} }
static BOOL DoAplet(DWORD *pdwAddr,String *str,UINT *pnLevel) static BOOL DoAplet(DWORD *pdwAddr,String *str,UINT *pnLevel)
@ -1206,7 +1221,7 @@ static struct ObjHandler
static BOOL (*Getfp(LPCTSTR lpszObject))(DWORD *,String *,UINT *) static BOOL (*Getfp(LPCTSTR lpszObject))(DWORD *,String *,UINT *)
{ {
INT i; UINT i;
for (i = 0; i < ARRAYSIZEOF(ObjDecode); ++i) for (i = 0; i < ARRAYSIZEOF(ObjDecode); ++i)
{ {

View file

@ -13,7 +13,7 @@
#include "kml.h" #include "kml.h"
#include "debugger.h" #include "debugger.h"
#define VERSION "1.56" #define VERSION "1.57"
#ifdef _DEBUG #ifdef _DEBUG
LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug"); LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug");
@ -24,8 +24,6 @@ LPTSTR szAppName = _T("Emu48"); // application name for DDE server
LPTSTR szTopic = _T("Stack"); // topic for DDE server LPTSTR szTopic = _T("Stack"); // topic for DDE server
LPTSTR szTitle = NULL; LPTSTR szTitle = NULL;
static BOOL bOwnCursor = FALSE;
static const LPCTSTR szLicence = static const LPCTSTR szLicence =
_T("This program is free software; you can redistribute it and/or modify\r\n") _T("This program is free software; you can redistribute it and/or modify\r\n")
_T("it under the terms of the GNU General Public License as published by\r\n") _T("it under the terms of the GNU General Public License as published by\r\n")
@ -41,6 +39,9 @@ static const LPCTSTR szLicence =
_T("along with this program; if not, write to the Free Software Foundation,\r\n") _T("along with this program; if not, write to the Free Software Foundation,\r\n")
_T("Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"); _T("Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA");
static BOOL bOwnCursor = FALSE;
static BOOL bTitleBar = TRUE;
CRITICAL_SECTION csGDILock; // critical section for hWindowDC CRITICAL_SECTION csGDILock; // critical section for hWindowDC
CRITICAL_SECTION csLcdLock; // critical section for display update CRITICAL_SECTION csLcdLock; // critical section for display update
@ -51,6 +52,7 @@ CRITICAL_SECTION csT2Lock; // critical section for timer2 access
CRITICAL_SECTION csTxdLock; // critical section for transmit byte CRITICAL_SECTION csTxdLock; // critical section for transmit byte
CRITICAL_SECTION csRecvLock; // critical section for receive byte CRITICAL_SECTION csRecvLock; // critical section for receive byte
CRITICAL_SECTION csSlowLock; // critical section for speed slow down CRITICAL_SECTION csSlowLock; // critical section for speed slow down
CRITICAL_SECTION csDbgLock; // critical section for debugger purpose
INT nArgc; // no. of command line arguments INT nArgc; // no. of command line arguments
LPCTSTR *ppArgv; // command line arguments LPCTSTR *ppArgv; // command line arguments
LARGE_INTEGER lFreq; // high performance counter frequency LARGE_INTEGER lFreq; // high performance counter frequency
@ -69,6 +71,9 @@ HWND hDlgRplObjView = NULL; // handle for debugger rpl object viewe
HDC hWindowDC = NULL; HDC hWindowDC = NULL;
HPALETTE hPalette = NULL; HPALETTE hPalette = NULL;
HPALETTE hOldPalette = NULL; // old palette of hWindowDC HPALETTE hOldPalette = NULL; // old palette of hWindowDC
DWORD dwTColor = (DWORD) -1; // transparency color
DWORD dwTColorTol = 0; // transparency color tolerance
HRGN hRgn = NULL;
HCURSOR hCursorArrow = NULL; HCURSOR hCursorArrow = NULL;
HCURSOR hCursorHand = NULL; HCURSOR hCursorHand = NULL;
UINT uWaveDevId = WAVE_MAPPER; // default audio device UINT uWaveDevId = WAVE_MAPPER; // default audio device
@ -79,8 +84,11 @@ BOOL bSaveDefConfirm = TRUE; // yes
BOOL bStartupBackup = FALSE; BOOL bStartupBackup = FALSE;
BOOL bAlwaysDisplayLog = TRUE; BOOL bAlwaysDisplayLog = TRUE;
BOOL bLoadObjectWarning = TRUE; BOOL bLoadObjectWarning = TRUE;
BOOL bShowTitle = TRUE; // show main window title bar
BOOL bShowMenu = TRUE; // show main window menu bar
BOOL bAlwaysOnTop = FALSE; // emulator window always on top BOOL bAlwaysOnTop = FALSE; // emulator window always on top
BOOL bActFollowsMouse = FALSE; // emulator window activation follows mouse BOOL bActFollowsMouse = FALSE; // emulator window activation follows mouse
BOOL bClientWinMove = FALSE; // emulator window can be moved over client area
BOOL bSingleInstance = FALSE; // multiple emulator instances allowed BOOL bSingleInstance = FALSE; // multiple emulator instances allowed
@ -120,6 +128,106 @@ VOID ForceForegroundWindow(HWND hWnd)
return; return;
} }
static __inline VOID UpdateWindowBars(VOID)
{
DWORD dwStyle;
HMENU hMenu;
BOOL bUpdate = FALSE; // no update
// get current title bar style
dwStyle = (DWORD) GetWindowLongPtr(hWnd,GWL_STYLE);
if ((bTitleBar = (bShowTitle || bDocumentAvail == FALSE)))
{
// title bar off
if ((dwStyle & STYLE_TITLE) != STYLE_TITLE)
{
SetWindowLongPtr(hWnd,GWL_STYLE,(dwStyle & ~STYLE_NOTITLE) | STYLE_TITLE);
bUpdate = TRUE;
}
}
else
{
// title bar on
if ((dwStyle & STYLE_NOTITLE) != STYLE_NOTITLE)
{
SetWindowLongPtr(hWnd,GWL_STYLE,(dwStyle & ~STYLE_TITLE) | STYLE_NOTITLE);
bUpdate = TRUE;
}
}
hMenu = GetMenu(hWnd); // get system menu
if (bShowMenu || bDocumentAvail == FALSE)
{
if (hMenu == NULL) // menu off
{
// restore menu bar
SetMenu(hWnd,LoadMenu(hApp,MAKEINTRESOURCE(IDR_MENU)));
bUpdate = TRUE;
}
}
else
{
if (hMenu != NULL) // menu on
{
// close menu bar
SetMenu(hWnd,NULL);
VERIFY(DestroyMenu(hMenu));
bUpdate = TRUE;
}
}
if (dwTColor != (DWORD) -1) // prepare background bitmap with transparency
{
if (!bTitleBar && GetMenu(hWnd) == NULL)
{
if (hRgn == NULL)
{
EnterCriticalSection(&csGDILock); // solving NT GDI problems
{
// enable background bitmap transparency
hRgn = CreateRgnFromBitmap((HBITMAP) GetCurrentObject(hMainDC,OBJ_BITMAP),
dwTColor,
dwTColorTol);
if (hRgn != NULL) // region definition successful
{
OffsetRgn(hRgn,-(INT) nBackgroundX,-(INT) nBackgroundY);
SetWindowRgn(hWnd,hRgn,TRUE);
}
else // region definition failed
{
// disable transparency
dwTColor = (DWORD) -1;
}
GdiFlush();
}
LeaveCriticalSection(&csGDILock);
}
}
else
{
if (hRgn != NULL) // region active
{
EnterCriticalSection(&csGDILock); // solving NT GDI problems
{
// disable background bitmap transparency
SetWindowRgn(hWnd,NULL,TRUE);
hRgn = NULL;
GdiFlush();
}
LeaveCriticalSection(&csGDILock);
}
}
}
if (bUpdate) // changed state of title or menu bar
{
ResizeWindow(); // resize & redraw window
}
return;
}
//################ //################
@ -325,6 +433,8 @@ static BOOL CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, DWORD wParam, LON
// init speed checkbox // init speed checkbox
CheckDlgButton(hDlg,IDC_REALSPEED,bRealSpeed); CheckDlgButton(hDlg,IDC_REALSPEED,bRealSpeed);
CheckDlgButton(hDlg,IDC_GRAYSCALE,bGrayscale); CheckDlgButton(hDlg,IDC_GRAYSCALE,bGrayscale);
CheckDlgButton(hDlg,IDC_SHOWTITLE,bShowTitle);
CheckDlgButton(hDlg,IDC_SHOWMENU,bShowMenu);
CheckDlgButton(hDlg,IDC_ALWAYSONTOP,bAlwaysOnTop); CheckDlgButton(hDlg,IDC_ALWAYSONTOP,bAlwaysOnTop);
CheckDlgButton(hDlg,IDC_ACTFOLLOWSMOUSE,bActFollowsMouse); CheckDlgButton(hDlg,IDC_ACTFOLLOWSMOUSE,bActFollowsMouse);
#if defined _USRDLL // DLL version #if defined _USRDLL // DLL version
@ -338,7 +448,7 @@ static BOOL CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, DWORD wParam, LON
CheckDlgButton(hDlg,IDC_OBJECTLOADWARNING,bLoadObjectWarning); CheckDlgButton(hDlg,IDC_OBJECTLOADWARNING,bLoadObjectWarning);
CheckDlgButton(hDlg,IDC_ALWAYSDISPLOG,bAlwaysDisplayLog); CheckDlgButton(hDlg,IDC_ALWAYSDISPLOG,bAlwaysDisplayLog);
// set disassebler mode // set disassembler mode
CheckDlgButton(hDlg,(disassembler_mode == HP_MNEMONICS) ? IDC_DISASM_HP : IDC_DISASM_CLASS,BST_CHECKED); CheckDlgButton(hDlg,(disassembler_mode == HP_MNEMONICS) ? IDC_DISASM_HP : IDC_DISASM_CLASS,BST_CHECKED);
return TRUE; return TRUE;
case WM_NOTIFY: case WM_NOTIFY:
@ -347,6 +457,8 @@ static BOOL CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, DWORD wParam, LON
case PSN_KILLACTIVE: case PSN_KILLACTIVE:
// get speed checkbox value // get speed checkbox value
bRealSpeed = IsDlgButtonChecked(hDlg,IDC_REALSPEED); bRealSpeed = IsDlgButtonChecked(hDlg,IDC_REALSPEED);
bShowTitle = IsDlgButtonChecked(hDlg,IDC_SHOWTITLE);
bShowMenu = IsDlgButtonChecked(hDlg,IDC_SHOWMENU);
bAlwaysOnTop = IsDlgButtonChecked(hDlg,IDC_ALWAYSONTOP); bAlwaysOnTop = IsDlgButtonChecked(hDlg,IDC_ALWAYSONTOP);
bActFollowsMouse = IsDlgButtonChecked(hDlg,IDC_ACTFOLLOWSMOUSE); bActFollowsMouse = IsDlgButtonChecked(hDlg,IDC_ACTFOLLOWSMOUSE);
bSingleInstance = IsDlgButtonChecked(hDlg,IDC_SINGLEINSTANCE); bSingleInstance = IsDlgButtonChecked(hDlg,IDC_SINGLEINSTANCE);
@ -374,6 +486,7 @@ static BOOL CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, DWORD wParam, LON
{ {
SetWindowPos(GetLastActivePopup(hDlgDebug),hWndInsertAfter,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(GetLastActivePopup(hDlgDebug),hWndInsertAfter,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
} }
InvalidateRect(hWnd,NULL,TRUE);
return TRUE; return TRUE;
} }
break; break;
@ -644,6 +757,7 @@ static BOOL CALLBACK SettingsPeripheralProc(HWND hDlg, UINT uMsg, DWORD wParam,
break; break;
} }
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(wParam);
} }
@ -715,6 +829,7 @@ static LRESULT OnCreate(HWND hWindow)
InitializeCriticalSection(&csTxdLock); InitializeCriticalSection(&csTxdLock);
InitializeCriticalSection(&csRecvLock); InitializeCriticalSection(&csRecvLock);
InitializeCriticalSection(&csSlowLock); InitializeCriticalSection(&csSlowLock);
InitializeCriticalSection(&csDbgLock);
// load cursors // load cursors
hCursorArrow = LoadCursor(NULL,IDC_ARROW); hCursorArrow = LoadCursor(NULL,IDC_ARROW);
@ -757,6 +872,7 @@ static LRESULT OnDestroy(HWND hWindow)
DeleteCriticalSection(&csTxdLock); DeleteCriticalSection(&csTxdLock);
DeleteCriticalSection(&csRecvLock); DeleteCriticalSection(&csRecvLock);
DeleteCriticalSection(&csSlowLock); DeleteCriticalSection(&csSlowLock);
DeleteCriticalSection(&csDbgLock);
#if defined _USRDLL // DLL version #if defined _USRDLL // DLL version
DLLDestroyWnd(); // cleanup system DLLDestroyWnd(); // cleanup system
@ -775,6 +891,8 @@ static LRESULT OnPaint(HWND hWindow)
PAINTSTRUCT Paint; PAINTSTRUCT Paint;
HDC hPaintDC; HDC hPaintDC;
UpdateWindowBars(); // update visibility of title and menu bar
hPaintDC = BeginPaint(hWindow, &Paint); hPaintDC = BeginPaint(hWindow, &Paint);
if (hMainDC != NULL) if (hMainDC != NULL)
{ {
@ -846,6 +964,8 @@ static LRESULT OnInitMenu(HMENU hMenu)
EnableMenuItem(hMenu,ID_TOOL_MACRO_RECORD,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(hMenu,ID_TOOL_MACRO_RECORD,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(hMenu,ID_TOOL_MACRO_PLAY,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(hMenu,ID_TOOL_MACRO_PLAY,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(hMenu,ID_TOOL_MACRO_STOP,(bRun && nMacroState != MACRO_OFF) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(hMenu,ID_TOOL_MACRO_STOP,(bRun && nMacroState != MACRO_OFF) ? MF_ENABLED : MF_GRAYED);
MruUpdateMenu(hMenu); // update MRU list
return 0; return 0;
} }
@ -1624,6 +1744,61 @@ static LRESULT OnAbout(VOID)
return 0; return 0;
} }
static VOID OnContextMenu(LPARAM lParam)
{
HMENU hMenu;
POINT pt,ptc;
if (GetMenu(hWnd) == NULL) // no main window menu
{
POINTSTOPOINT(pt,MAKEPOINTS(lParam)); // mouse position
if (pt.x == -1 && pt.y == -1) // VK_APPS
{
pt.x = 15; // open context help at client position 15,15
pt.y = 15;
VERIFY(ClientToScreen(hWnd,&pt));
}
ptc = pt;
VERIFY(ScreenToClient(hWnd,&ptc)); // convert mouse into client position
// in client area not over a button
if (ptc.y >= 0 && !MouseIsButton(ptc.x,ptc.y))
{
// load the popup menu resource
if ((hMenu = LoadMenu(hApp,MAKEINTRESOURCE(IDM_MENU))) != NULL)
{
// display the popup menu
TrackPopupMenu(GetSubMenu(hMenu,0),
TPM_LEFTALIGN | TPM_LEFTBUTTON,
pt.x, pt.y, 0, hWnd, NULL);
DestroyMenu(hMenu); // destroy the menu
}
}
}
return;
}
static BOOL OnNcHitTest(LPARAM lParam)
{
if (!bTitleBar || bClientWinMove) // no title bar or window movement over client enabled
{
POINT pt;
POINTSTOPOINT(pt,MAKEPOINTS(lParam)); // mouse position
VERIFY(ScreenToClient(hWnd,&pt)); // convert mouse into client position
if (pt.y >= 0) // client area
{
// hit area not over a button
return !MouseIsButton(pt.x,pt.y);
}
}
return FALSE;
}
static LRESULT OnLButtonDown(UINT nFlags, WORD x, WORD y) static LRESULT OnLButtonDown(UINT nFlags, WORD x, WORD y)
{ {
if (nMacroState == MACRO_PLAY) return 0; // playing macro if (nMacroState == MACRO_PLAY) return 0; // playing macro
@ -1769,7 +1944,7 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar
if (RealizePalette(hWindowDC)) if (RealizePalette(hWindowDC))
{ {
// UpdateColors(hWindowDC); // UpdateColors(hWindowDC);
InvalidateRect (hWnd, (LPRECT) (NULL), 1); InvalidateRect(hWindow,NULL,TRUE);
} }
} }
return FALSE; return FALSE;
@ -1812,6 +1987,13 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar
case SC_CLOSE: return OnFileExit(); case SC_CLOSE: return OnFileExit();
} }
break; break;
case WM_CONTEXTMENU:
case WM_NCRBUTTONUP:
OnContextMenu(lParam);
break;
case WM_NCHITTEST:
if (OnNcHitTest(lParam)) return HTCAPTION;
break;
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
case WM_LBUTTONDOWN: return OnLButtonDown((UINT) wParam, LOWORD(lParam), HIWORD(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_LBUTTONUP: return OnLButtonUp((UINT) wParam, LOWORD(lParam), HIWORD(lParam));
@ -1841,6 +2023,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
HSZ hszService, hszTopic; // variables for DDE server HSZ hszService, hszTopic; // variables for DDE server
LPTSTR lpFilePart; LPTSTR lpFilePart;
// enable memory leak detection
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
hApp = hInst; hApp = hInst;
#if defined _UNICODE #if defined _UNICODE
{ {
@ -1935,10 +2120,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
rectWindow.top = 0; rectWindow.top = 0;
rectWindow.right = 256; rectWindow.right = 256;
rectWindow.bottom = 0; rectWindow.bottom = 0;
AdjustWindowRect(&rectWindow, WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED, TRUE); AdjustWindowRect(&rectWindow, STYLE_TITLE, TRUE);
hWnd = CreateWindow(MAKEINTATOM(classAtom),_T("Emu48"), hWnd = CreateWindow(MAKEINTATOM(classAtom),_T("Emu48"),
WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED, STYLE_TITLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
rectWindow.right - rectWindow.left, rectWindow.right - rectWindow.left,
rectWindow.bottom - rectWindow.top, rectWindow.bottom - rectWindow.top,
@ -2089,7 +2274,6 @@ start:
_ASSERT(pKml == NULL); // KML script not closed _ASSERT(pKml == NULL); // KML script not closed
_ASSERT(szTitle == NULL); // freed allocated memory _ASSERT(szTitle == NULL); // freed allocated memory
_ASSERT(hPalette == NULL); // freed resource memory _ASSERT(hPalette == NULL); // freed resource memory
_CrtDumpMemoryLeaks(); // show memory leaks
return (int) msg.wParam; return (int) msg.wParam;
UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(lpCmdLine);

View file

@ -58,6 +58,10 @@
#define ROMPAGESIZE (1<<12) // ROM dirty page size in nibbles #define ROMPAGESIZE (1<<12) // ROM dirty page size in nibbles
// window styles
#define STYLE_TITLE (WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED)
#define STYLE_NOTITLE (WS_POPUP|WS_CLIPSIBLINGS)
// WM_COPYDATA identifier // WM_COPYDATA identifier
#define CDID_FILENAME 1 // send file name #define CDID_FILENAME 1 // send file name
@ -86,6 +90,7 @@ extern CRITICAL_SECTION csT2Lock;
extern CRITICAL_SECTION csTxdLock; extern CRITICAL_SECTION csTxdLock;
extern CRITICAL_SECTION csRecvLock; extern CRITICAL_SECTION csRecvLock;
extern CRITICAL_SECTION csSlowLock; extern CRITICAL_SECTION csSlowLock;
extern CRITICAL_SECTION csDbgLock;
extern INT nArgc; extern INT nArgc;
extern LPCTSTR *ppArgv; extern LPCTSTR *ppArgv;
extern LARGE_INTEGER lFreq; extern LARGE_INTEGER lFreq;
@ -99,6 +104,9 @@ extern HWND hDlgFind;
extern HWND hDlgProfile; extern HWND hDlgProfile;
extern HWND hDlgRplObjView; extern HWND hDlgRplObjView;
extern HDC hWindowDC; extern HDC hWindowDC;
extern DWORD dwTColor;
extern DWORD dwTColorTol;
extern HRGN hRgn;
extern HCURSOR hCursorArrow; extern HCURSOR hCursorArrow;
extern HCURSOR hCursorHand; extern HCURSOR hCursorHand;
extern UINT uWaveDevId; extern UINT uWaveDevId;
@ -109,23 +117,26 @@ extern BOOL bSaveDefConfirm;
extern BOOL bStartupBackup; extern BOOL bStartupBackup;
extern BOOL bAlwaysDisplayLog; extern BOOL bAlwaysDisplayLog;
extern BOOL bLoadObjectWarning; extern BOOL bLoadObjectWarning;
extern BOOL bShowTitle;
extern BOOL bShowMenu;
extern BOOL bAlwaysOnTop; extern BOOL bAlwaysOnTop;
extern BOOL bActFollowsMouse; extern BOOL bActFollowsMouse;
extern BOOL bClientWinMove;
extern BOOL bSingleInstance; extern BOOL bSingleInstance;
extern HANDLE hThread; extern HANDLE hThread;
extern VOID SetWindowTitle(LPCTSTR szString); extern VOID SetWindowTitle(LPCTSTR szString);
extern VOID CopyItemsToClipboard(HWND hWnd);
extern VOID ForceForegroundWindow(HWND hWnd); extern VOID ForceForegroundWindow(HWND hWnd);
extern VOID CopyItemsToClipboard(HWND hWnd);
// mru.c // mru.c
extern BOOL MruInit(INT nNum); extern BOOL MruInit(UINT nNum);
extern VOID MruCleanup(VOID); extern VOID MruCleanup(VOID);
extern VOID MruAdd(LPCTSTR lpszEntry); extern VOID MruAdd(LPCTSTR lpszEntry);
extern VOID MruRemove(INT nIndex); extern VOID MruRemove(UINT nIndex);
extern VOID MruMoveTop(INT nIndex); extern VOID MruMoveTop(UINT nIndex);
extern INT MruEntries(VOID); extern UINT MruEntries(VOID);
extern LPCTSTR MruFilename(INT nIndex); extern LPCTSTR MruFilename(UINT nIndex);
extern VOID MruUpdateMenu(VOID); extern VOID MruUpdateMenu(HMENU hMenu);
extern VOID MruWriteList(VOID); extern VOID MruWriteList(VOID);
extern VOID MruReadList(VOID); extern VOID MruReadList(VOID);
@ -268,6 +279,7 @@ extern WORD WriteStack(UINT nStkLevel,LPBYTE lpBuf,DWORD dwSize);
extern BOOL LoadObject(LPCTSTR szFilename); extern BOOL LoadObject(LPCTSTR szFilename);
extern BOOL SaveObject(LPCTSTR szFilename); extern BOOL SaveObject(LPCTSTR szFilename);
extern HBITMAP LoadBitmapFile(LPCTSTR szFilename); extern HBITMAP LoadBitmapFile(LPCTSTR szFilename);
extern HRGN CreateRgnFromBitmap(HBITMAP hBmp,COLORREF color,DWORD dwTol);
// Timer.c // Timer.c
extern VOID SetHP48Time(VOID); extern VOID SetHP48Time(VOID);

View file

@ -296,7 +296,7 @@ FONT 8, "MS Sans Serif"
BEGIN BEGIN
ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE
LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP
LTEXT "Copyright © 2014 Christoph Gießelink && Sébastien Carlier", LTEXT "Copyright © 2015 Christoph Gießelink && Sébastien Carlier",
IDC_STATIC,29,18,181,8 IDC_STATIC,29,18,181,8
DEFPUSHBUTTON "OK",IDOK,215,12,39,14 DEFPUSHBUTTON "OK",IDOK,215,12,39,14
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL | EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
@ -327,11 +327,16 @@ BEGIN
CONTROL "Always Show KML Compilation Result",IDC_ALWAYSDISPLOG, CONTROL "Always Show KML Compilation Result",IDC_ALWAYSDISPLOG,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,112,133,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,112,133,10
GROUPBOX "General",IDC_STATIC,7,7,148,120 GROUPBOX "General",IDC_STATIC,7,7,148,120
CONTROL "Show Title",IDC_SHOWTITLE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,17,69,10
CONTROL "Show Menu",IDC_SHOWMENU,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,28,69,10
GROUPBOX "Style",IDC_STATIC,161,7,83,70
CONTROL "HP Mnemonics",IDC_DISASM_HP,"Button",BS_AUTORADIOBUTTON | CONTROL "HP Mnemonics",IDC_DISASM_HP,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,168,21,69,11 WS_GROUP | WS_TABSTOP,168,94,69,11
CONTROL "Class Mnemonics",IDC_DISASM_CLASS,"Button", CONTROL "Class Mnemonics",IDC_DISASM_CLASS,"Button",
BS_AUTORADIOBUTTON,168,35,69,11 BS_AUTORADIOBUTTON,168,108,69,11
GROUPBOX "Disassembler",IDC_STATIC,161,7,83,120 GROUPBOX "Disassembler",IDC_STATIC,161,80,83,47
END END
IDD_SET_MEMORY DIALOG DISCARDABLE 0, 0, 251, 134 IDD_SET_MEMORY DIALOG DISCARDABLE 0, 0, 251, 134
@ -687,8 +692,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,6,0 FILEVERSION 1,5,7,0
PRODUCTVERSION 1,5,6,0 PRODUCTVERSION 1,5,7,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -705,12 +710,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0" VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0" VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
VALUE "FileVersion", "1, 5, 6, 0\0" VALUE "FileVersion", "1, 5, 7, 0\0"
VALUE "InternalName", "Emu48\0" VALUE "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2014\0" VALUE "LegalCopyright", "Copyright © 2015\0"
VALUE "OriginalFilename", "Emu48.exe\0" VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0" VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 5, 6, 0\0" VALUE "ProductVersion", "1, 5, 7, 0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -796,6 +801,72 @@ BEGIN
END END
END END
IDM_MENU MENU DISCARDABLE
BEGIN
POPUP ""
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New...", ID_FILE_NEW
MENUITEM "&Open...", ID_FILE_OPEN
MENUITEM "&Save", ID_FILE_SAVE, GRAYED
MENUITEM "Save &As...", ID_FILE_SAVEAS, GRAYED
MENUITEM "&Close", ID_FILE_CLOSE, GRAYED
MENUITEM SEPARATOR
MENUITEM "S&ettings...", ID_VIEW_SETTINGS
MENUITEM SEPARATOR
MENUITEM "Recent File List", ID_FILE_MRU_FILE1
, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Load Object...", ID_OBJECT_LOAD
MENUITEM "&Save Object...", ID_OBJECT_SAVE
MENUITEM SEPARATOR
MENUITEM "C&opy Screen", ID_VIEW_COPY
MENUITEM "&Copy Stack", ID_STACK_COPY
MENUITEM "&Paste Stack", ID_STACK_PASTE
MENUITEM SEPARATOR
MENUITEM "&Reset Calculator", ID_VIEW_RESET, GRAYED
POPUP "&Backup"
BEGIN
MENUITEM "&Save", ID_BACKUP_SAVE
, GRAYED
MENUITEM "&Restore", ID_BACKUP_RESTORE
, GRAYED
MENUITEM "&Delete", ID_BACKUP_DELETE
, GRAYED
END
END
POPUP "&View"
BEGIN
MENUITEM "Change &KML Script...", ID_VIEW_SCRIPT
END
POPUP "&Tools"
BEGIN
MENUITEM "D&isassembler...", ID_TOOL_DISASM
MENUITEM "&Debugger...", ID_TOOL_DEBUG
MENUITEM SEPARATOR
POPUP "&Macro"
BEGIN
MENUITEM "&Record...", ID_TOOL_MACRO_RECORD
, GRAYED
MENUITEM "&Play...", ID_TOOL_MACRO_PLAY
, GRAYED
MENUITEM "&Stop", ID_TOOL_MACRO_STOP
, GRAYED
MENUITEM "S&ettings...", ID_TOOL_MACRO_SETTINGS
END
END
POPUP "&Help"
BEGIN
MENUITEM "&About Emu48...", ID_ABOUT
END
END
END
IDR_DEBUG MENU DISCARDABLE IDR_DEBUG MENU DISCARDABLE
BEGIN BEGIN
POPUP "&Debug" POPUP "&Debug"

View file

@ -72,13 +72,17 @@ static DWORD dwTickRef; // sample timer ticks
// save last instruction in circular instruction buffer // save last instruction in circular instruction buffer
static __inline VOID SaveInstrAddr(DWORD dwAddr) static __inline VOID SaveInstrAddr(DWORD dwAddr)
{ {
if (pdwInstrArray) // circular buffer allocated EnterCriticalSection(&csDbgLock);
{ {
pdwInstrArray[wInstrWp] = dwAddr; if (pdwInstrArray) // circular buffer allocated
wInstrWp = (wInstrWp + 1) % wInstrSize; {
if (wInstrWp == wInstrRp) pdwInstrArray[wInstrWp] = dwAddr;
wInstrRp = (wInstrRp + 1) % wInstrSize; wInstrWp = (wInstrWp + 1) % wInstrSize;
if (wInstrWp == wInstrRp)
wInstrRp = (wInstrRp + 1) % wInstrSize;
}
} }
LeaveCriticalSection(&csDbgLock);
return; return;
} }

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,8 @@
#include "i28f160.h" // flash support #include "i28f160.h" // flash support
#include "debugger.h" #include "debugger.h"
#pragma intrinsic(abs,labs)
TCHAR szEmuDirectory[MAX_PATH]; TCHAR szEmuDirectory[MAX_PATH];
TCHAR szCurrentDirectory[MAX_PATH]; TCHAR szCurrentDirectory[MAX_PATH];
TCHAR szCurrentKml[MAX_PATH]; TCHAR szCurrentKml[MAX_PATH];
@ -671,7 +673,7 @@ BOOL MapPort2(LPCTSTR szFilename)
dwFileSizeLo = GetFileSize(hPort2File, &dwFileSizeHi); dwFileSizeLo = GetFileSize(hPort2File, &dwFileSizeHi);
// size not 32, 128, 256, 512, 1024, 2048 or 4096 KB // size not 32, 128, 256, 512, 1024, 2048 or 4096 KB
if ( dwFileSizeHi != 0 if ( dwFileSizeHi != 0
|| dwFileSizeLo == 0 || dwFileSizeLo == 0
|| (dwFileSizeLo & (dwFileSizeLo - 1)) != 0 || (dwFileSizeLo & (dwFileSizeLo - 1)) != 0
|| (dwFileSizeLo & 0xFF02FFFF) != 0) || (dwFileSizeLo & 0xFF02FFFF) != 0)
@ -1601,7 +1603,7 @@ typedef struct _BmpFile
static __inline WORD DibNumColors(BITMAPINFOHEADER CONST *lpbi) static __inline WORD DibNumColors(BITMAPINFOHEADER CONST *lpbi)
{ {
if (lpbi->biClrUsed != 0) return (UINT)lpbi->biClrUsed; if (lpbi->biClrUsed != 0) return (WORD) lpbi->biClrUsed;
/* a 24 bitcount DIB has no color table */ /* a 24 bitcount DIB has no color table */
return (lpbi->biBitCount <= 8) ? (1 << lpbi->biBitCount) : 0; return (lpbi->biBitCount <= 8) ? (1 << lpbi->biBitCount) : 0;
@ -1764,7 +1766,7 @@ static BOOL ReadGifWord(LPBMPFILE pGif, INT *n)
return FALSE; return FALSE;
} }
static HBITMAP DecodeGif(LPBMPFILE pBmp) static HBITMAP DecodeGif(LPBMPFILE pBmp,DWORD *pdwTransparentColor)
{ {
// this implementation base on the GIF image file // this implementation base on the GIF image file
// decoder engine of Free42 (c) by Thomas Okken // decoder engine of Free42 (c) by Thomas Okken
@ -2204,14 +2206,45 @@ static HBITMAP DecodeGif(LPBMPFILE pBmp)
if (ReadGifByte(pBmp,&nFunctionCode)) goto quit; if (ReadGifByte(pBmp,&nFunctionCode)) goto quit;
if (ReadGifByte(pBmp,&nByteCount)) goto quit; if (ReadGifByte(pBmp,&nByteCount)) goto quit;
while (nByteCount != 0) // Graphic Control Label & correct Block Size
if (nFunctionCode == 0xF9 && nByteCount == 0x04)
{ {
for (i = 0; i < nByteCount; ++i) INT nPackedFields,nColorIndex;
// packed fields
if (ReadGifByte(pBmp,&nPackedFields)) goto quit;
// delay time
if (ReadGifWord(pBmp,&nDummy)) goto quit;
// transparent color index
if (ReadGifByte(pBmp,&nColorIndex)) goto quit;
// transparent color flag set
if ((nPackedFields & 0x1) != 0)
{ {
if (ReadGifByte(pBmp,&nDummy)) goto quit; if (pdwTransparentColor != NULL)
{
*pdwTransparentColor = RGB(sGlb.bmiColors[nColorIndex].rgbRed,
sGlb.bmiColors[nColorIndex].rgbGreen,
sGlb.bmiColors[nColorIndex].rgbBlue);
}
} }
if (ReadGifByte(pBmp,&nByteCount)) goto quit; // block terminator (0 byte)
if (!(!ReadGifByte(pBmp,&nDummy) && nDummy == 0)) goto quit;
}
else // other function
{
while (nByteCount != 0)
{
for (i = 0; i < nByteCount; ++i)
{
if (ReadGifByte(pBmp,&nDummy)) goto quit;
}
if (ReadGifByte(pBmp,&nByteCount)) goto quit;
}
} }
} }
break; break;
@ -2283,7 +2316,7 @@ HBITMAP LoadBitmapFile(LPCTSTR szFilename)
if ( Bmp.dwFileSize >= 6 if ( Bmp.dwFileSize >= 6
&& (memcmp(Bmp.pbyFile,"GIF87a",6) == 0 || memcmp(Bmp.pbyFile,"GIF89a",6) == 0)) && (memcmp(Bmp.pbyFile,"GIF87a",6) == 0 || memcmp(Bmp.pbyFile,"GIF89a",6) == 0))
{ {
hBitmap = DecodeGif(&Bmp); hBitmap = DecodeGif(&Bmp,&dwTColor);
break; break;
} }
@ -2297,3 +2330,217 @@ HBITMAP LoadBitmapFile(LPCTSTR szFilename)
CloseHandle(hFile); CloseHandle(hFile);
return hBitmap; return hBitmap;
} }
static BOOL AbsColorCmp(DWORD dwColor1,DWORD dwColor2,DWORD dwTol)
{
DWORD dwDiff;
dwDiff = (DWORD) abs((INT) (dwColor1 & 0xFF) - (INT) (dwColor2 & 0xFF));
dwColor1 >>= 8;
dwColor2 >>= 8;
dwDiff += (DWORD) abs((INT) (dwColor1 & 0xFF) - (INT) (dwColor2 & 0xFF));
dwColor1 >>= 8;
dwColor2 >>= 8;
dwDiff += (DWORD) abs((INT) (dwColor1 & 0xFF) - (INT) (dwColor2 & 0xFF));
return dwDiff > dwTol; // FALSE = colors match
}
static BOOL LabColorCmp(DWORD dwColor1,DWORD dwColor2,DWORD dwTol)
{
DWORD dwDiff;
INT nDiffCol;
nDiffCol = (INT) (dwColor1 & 0xFF) - (INT) (dwColor2 & 0xFF);
dwDiff = (DWORD) (nDiffCol * nDiffCol);
dwColor1 >>= 8;
dwColor2 >>= 8;
nDiffCol = (INT) (dwColor1 & 0xFF) - (INT) (dwColor2 & 0xFF);
dwDiff += (DWORD) (nDiffCol * nDiffCol);
dwColor1 >>= 8;
dwColor2 >>= 8;
nDiffCol = (INT) (dwColor1 & 0xFF) - (INT) (dwColor2 & 0xFF);
dwDiff += (DWORD) (nDiffCol * nDiffCol);
dwTol *= dwTol;
return dwDiff > dwTol; // FALSE = colors match
}
HRGN CreateRgnFromBitmap(HBITMAP hBmp,COLORREF color,DWORD dwTol)
{
#define ADD_RECTS_COUNT 256
BOOL (*fnColorCmp)(DWORD dwColor1,DWORD dwColor2,DWORD dwTol);
HRGN hRgn;
LPRGNDATA pRgnData;
BITMAP bm;
LPBITMAPINFO bi;
LPBYTE pbyBits;
LPBYTE pbyColor;
DWORD dwAlignedWidthBytes;
DWORD dwBpp;
DWORD dwRectsCount;
LONG x,y,xleft;
BOOL bFoundLeft;
BOOL bIsMask;
HDC hDC;
if (dwTol >= 1000) // use CIE L*a*b compare
{
fnColorCmp = LabColorCmp;
dwTol -= 1000; // remove L*a*b compare selector
}
else // use Abs summation compare
{
fnColorCmp = AbsColorCmp;
}
// get image properties
GetObject(hBmp,sizeof(bm),&bm);
// allocate memory for extended image information incl. RGBQUAD color table
bi = (LPBITMAPINFO) calloc(1,sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
bi->bmiHeader.biSize = sizeof(bi->bmiHeader);
// get information about image
hDC = CreateCompatibleDC(hWindowDC);
GetDIBits(hDC,hBmp,0,bm.bmHeight,NULL,bi,DIB_RGB_COLORS);
// DWORD aligned bitmap width in BYTES
dwAlignedWidthBytes = WIDTHBYTES( bi->bmiHeader.biWidth
* bi->bmiHeader.biPlanes
* bi->bmiHeader.biBitCount);
// biSizeImage is empty
if (bi->bmiHeader.biSizeImage == 0 && bi->bmiHeader.biCompression == BI_RGB)
{
bi->bmiHeader.biSizeImage = dwAlignedWidthBytes * bi->bmiHeader.biHeight;
}
// allocate memory for image data (colors)
pbyBits = (LPBYTE) malloc(bi->bmiHeader.biSizeImage);
// fill bits buffer
GetDIBits(hDC,hBmp,0,bi->bmiHeader.biHeight,pbyBits,bi,DIB_RGB_COLORS);
DeleteDC(hDC);
// convert color if current DC is 16-bit RGB coded
if (bi->bmiHeader.biBitCount == 16)
{
// for 15 bit (5:5:5)
color = ((color & 0xF80000) >> 19)
| ((color & 0x00F800) >> 6)
| ((color & 0x0000F8) << 7);
}
else
{
// convert COLORREF to RGBQUAD color
color = ((color & 0xFF0000) >> 16)
| ((color & 0x00FF00) >> 0)
| ((color & 0x0000FF) << 16);
}
dwBpp = bi->bmiHeader.biBitCount >> 3; // bytes per pixel
// DIB is bottom up image so we begin with the last scanline
pbyColor = pbyBits + (bi->bmiHeader.biHeight - 1) * dwAlignedWidthBytes;
dwRectsCount = bi->bmiHeader.biHeight; // number of rects in allocated buffer
bFoundLeft = FALSE; // set when mask has been found in current scan line
// allocate memory for region data
pRgnData = (PRGNDATA) malloc(sizeof(RGNDATAHEADER) + dwRectsCount * sizeof(RECT));
// fill it by default
ZeroMemory(&pRgnData->rdh,sizeof(pRgnData->rdh));
pRgnData->rdh.dwSize = sizeof(pRgnData->rdh);
pRgnData->rdh.iType = RDH_RECTANGLES;
SetRect(&pRgnData->rdh.rcBound,MAXLONG,MAXLONG,0,0);
for (y = 0; y < bi->bmiHeader.biHeight; ++y)
{
LPBYTE pbyLineStart = pbyColor;
for (x = 0; x < bi->bmiHeader.biWidth; ++x)
{
// get color
switch (bi->bmiHeader.biBitCount)
{
case 8:
bIsMask = fnColorCmp(*(LPDWORD)(&bi->bmiColors)[*pbyColor],color,dwTol);
break;
case 16:
// it makes no sense to allow a tolerance here
bIsMask = (*(LPWORD)pbyColor != (WORD) color);
break;
case 24:
bIsMask = fnColorCmp((*(LPDWORD)pbyColor & 0x00ffffff),color,dwTol);
break;
case 32:
bIsMask = fnColorCmp(*(LPDWORD)pbyColor,color,dwTol);
}
pbyColor += dwBpp; // shift pointer to next color
if (!bFoundLeft && bIsMask) // non transparent color found
{
xleft = x;
bFoundLeft = TRUE;
}
if (bFoundLeft) // found non transparent color in scanline
{
// transparent color or last column
if (!bIsMask || x + 1 == bi->bmiHeader.biWidth)
{
// non transparent color and last column
if (bIsMask && x + 1 == bi->bmiHeader.biWidth)
++x;
// save current RECT
((LPRECT) pRgnData->Buffer)[pRgnData->rdh.nCount].left = xleft;
((LPRECT) pRgnData->Buffer)[pRgnData->rdh.nCount].top = y;
((LPRECT) pRgnData->Buffer)[pRgnData->rdh.nCount].right = x;
((LPRECT) pRgnData->Buffer)[pRgnData->rdh.nCount].bottom = y + 1;
pRgnData->rdh.nCount++;
if (xleft < pRgnData->rdh.rcBound.left)
pRgnData->rdh.rcBound.left = xleft;
if (y < pRgnData->rdh.rcBound.top)
pRgnData->rdh.rcBound.top = y;
if (x > pRgnData->rdh.rcBound.right)
pRgnData->rdh.rcBound.right = x;
if (y + 1 > pRgnData->rdh.rcBound.bottom)
pRgnData->rdh.rcBound.bottom = y + 1;
// if buffer full reallocate it with more room
if (pRgnData->rdh.nCount >= dwRectsCount)
{
dwRectsCount += ADD_RECTS_COUNT;
pRgnData = (LPRGNDATA) realloc(pRgnData,sizeof(RGNDATAHEADER) + dwRectsCount * sizeof(RECT));
}
bFoundLeft = FALSE;
}
}
}
// previous scanline
pbyColor = pbyLineStart - dwAlignedWidthBytes;
}
// release image data
free(pbyBits);
free(bi);
// create region
hRgn = ExtCreateRegion(NULL,sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount * sizeof(RECT),pRgnData);
free(pRgnData);
return hRgn;
#undef ADD_RECTS_COUNT
}

View file

@ -70,6 +70,7 @@ static CONST KmlToken pLexToken[] =
{TOK_SCANCODE, 000001, 8,_T("Scancode")}, {TOK_SCANCODE, 000001, 8,_T("Scancode")},
{TOK_HARDWARE, 000002, 8,_T("Hardware")}, {TOK_HARDWARE, 000002, 8,_T("Hardware")},
{TOK_MENUITEM, 000001, 8,_T("MenuItem")}, {TOK_MENUITEM, 000001, 8,_T("MenuItem")},
{TOK_SYSITEM, 000001, 7,_T("SysItem")},
{TOK_SETFLAG, 000001, 7,_T("SetFlag")}, {TOK_SETFLAG, 000001, 7,_T("SetFlag")},
{TOK_RELEASE, 000001, 7,_T("Release")}, {TOK_RELEASE, 000001, 7,_T("Release")},
{TOK_VIRTUAL, 000000, 7,_T("Virtual")}, {TOK_VIRTUAL, 000000, 7,_T("Virtual")},
@ -1285,6 +1286,10 @@ static VOID InitGlobal(KmlBlock* pBlock)
} }
PrintfToLog(_T("Bitmap %s loaded."), (LPTSTR)pLine->nParam[0]); PrintfToLog(_T("Bitmap %s loaded."), (LPTSTR)pLine->nParam[0]);
break; break;
case TOK_COLOR:
dwTColorTol = (DWORD) pLine->nParam[0];
dwTColor = RGB((BYTE) pLine->nParam[1],(BYTE) pLine->nParam[2],(BYTE) pLine->nParam[3]);
break;
default: default:
PrintfToLog(_T("Command %s Ignored in Block %s"), GetStringOf(pLine->eCommand), GetStringOf(pBlock->eType)); PrintfToLog(_T("Command %s Ignored in Block %s"), GetStringOf(pLine->eCommand), GetStringOf(pBlock->eType));
} }
@ -1542,6 +1547,9 @@ static KmlLine* RunLine(KmlLine* pLine)
case TOK_MENUITEM: case TOK_MENUITEM:
PostMessage(hWnd, WM_COMMAND, 0x19C40+(pLine->nParam[0]&0xFF), 0); PostMessage(hWnd, WM_COMMAND, 0x19C40+(pLine->nParam[0]&0xFF), 0);
break; break;
case TOK_SYSITEM:
PostMessage(hWnd, WM_SYSCOMMAND, pLine->nParam[0], 0);
break;
case TOK_SETFLAG: case TOK_SETFLAG:
nKMLFlags |= 1<<(pLine->nParam[0]&0x1F); nKMLFlags |= 1<<(pLine->nParam[0]&0x1F);
break; break;
@ -1631,6 +1639,20 @@ VOID KillKML(VOID)
VERIFY(DeleteObject(hPalette)); VERIFY(DeleteObject(hPalette));
hPalette = NULL; hPalette = NULL;
} }
if (hRgn != NULL) // region defined
{
if (hWnd != NULL) // window available
{
EnterCriticalSection(&csGDILock);
{
// deletes the region resource
SetWindowRgn(hWnd,NULL,FALSE);
GdiFlush();
}
LeaveCriticalSection(&csGDILock);
}
hRgn = NULL;
}
bClicking = FALSE; bClicking = FALSE;
uButtonClicked = 0; uButtonClicked = 0;
FreeBlocks(pKml); FreeBlocks(pKml);
@ -1652,6 +1674,8 @@ VOID KillKML(VOID)
nBackgroundW = 256; nBackgroundW = 256;
nBackgroundH = 0; nBackgroundH = 0;
nLcdZoom = 1; nLcdZoom = 1;
dwTColor = (DWORD) -1;
dwTColorTol = 0;
cCurrentRomType = 0; cCurrentRomType = 0;
nCurrentClass = 0; nCurrentClass = 0;
ResizeWindow(); ResizeWindow();
@ -2091,6 +2115,19 @@ static BOOL ClipButton(UINT x, UINT y, UINT nId)
&&(y<(pButton[nId].nOy+pButton[nId].nCy)); &&(y<(pButton[nId].nOy+pButton[nId].nCy));
} }
BOOL MouseIsButton(DWORD x, DWORD y)
{
UINT i;
for (i = 0; i < nButtons; i++) // scan all buttons
{
if (ClipButton(x,y,i)) // cursor over button?
{
return TRUE;
}
}
return FALSE;
}
VOID MouseButtonDownAt(UINT nFlags, DWORD x, DWORD y) VOID MouseButtonDownAt(UINT nFlags, DWORD x, DWORD y)
{ {
UINT i; UINT i;
@ -2149,28 +2186,13 @@ VOID MouseButtonUpAt(UINT nFlags, DWORD x, DWORD y)
VOID MouseMovesTo(UINT nFlags, DWORD x, DWORD y) VOID MouseMovesTo(UINT nFlags, DWORD x, DWORD y)
{ {
UINT i;
HCURSOR hCursor;
// set cursor // set cursor
_ASSERT(hCursorArrow); _ASSERT(hCursorArrow != NULL && hCursorHand != NULL);
_ASSERT(hCursorHand);
hCursor = hCursorArrow; // normal arrow cursor
for (i = 0; i < nButtons; i++) // scan all buttons
{
if (ClipButton(x,y,i)) // cursor over button?
{
hCursor = hCursorHand; // hand cursor
break;
}
}
// make sure that class cursor is NULL // make sure that class cursor is NULL
#if defined _WIN64 _ASSERT(GetClassLongPtr(hWnd,GCLP_HCURSOR) == 0);
_ASSERT(GetClassLong(hWnd,GCLP_HCURSOR) == 0);
#else // cursor over button -> hand cursor else normal arrow cursor
_ASSERT(GetClassLong(hWnd,GCL_HCURSOR) == 0); SetCursor(MouseIsButton(x,y) ? hCursorHand : hCursorArrow);
#endif
SetCursor(hCursor);
if (!(nFlags&MK_LBUTTON)) return; // left mouse key not pressed -> quit if (!(nFlags&MK_LBUTTON)) return; // left mouse key not pressed -> quit
if (bKeyPressed && !ClipButton(x,y,uLastKeyPressed)) // not on last pressed key if (bKeyPressed && !ClipButton(x,y,uLastKeyPressed)) // not on last pressed key

View file

@ -21,46 +21,47 @@ typedef enum eTokenId
TOK_SCANCODE, //5 TOK_SCANCODE, //5
TOK_HARDWARE, //6 TOK_HARDWARE, //6
TOK_MENUITEM, //7 TOK_MENUITEM, //7
TOK_INTEGER, //8 TOK_SYSITEM, //8
TOK_SETFLAG, //9 TOK_INTEGER, //9
TOK_RELEASE, //10 TOK_SETFLAG, //10
TOK_VIRTUAL, //11 TOK_RELEASE, //11
TOK_INCLUDE, //12 TOK_VIRTUAL, //12
TOK_STRING, //13 TOK_INCLUDE, //13
TOK_GLOBAL, //14 TOK_NOTFLAG, //14
TOK_AUTHOR, //15 TOK_STRING, //15
TOK_BITMAP, //16 TOK_GLOBAL, //16
TOK_OFFSET, //17 TOK_AUTHOR, //17
TOK_BUTTON, //18 TOK_BITMAP, //18
TOK_IFFLAG, //19 TOK_OFFSET, //19
TOK_ONDOWN, //20 TOK_BUTTON, //20
TOK_NOHOLD, //21 TOK_IFFLAG, //21
TOK_LOCALE, //22 TOK_ONDOWN, //22
TOK_TOPBAR, //23 TOK_NOHOLD, //23
TOK_MENUBAR, // 24 TOK_LOCALE, //24
TOK_TITLE, //25 TOK_TOPBAR, //25
TOK_OUTIN, //26 TOK_MENUBAR, //26
TOK_PATCH, //27 TOK_TITLE, //27
TOK_PRINT, //28 TOK_OUTIN, //28
TOK_DEBUG, //29 TOK_PATCH, //29
TOK_COLOR, //30 TOK_PRINT, //30
TOK_MODEL, //31 TOK_DEBUG, //31
TOK_CLASS, //32 TOK_COLOR, //32
TOK_PRESS, //33 TOK_MODEL, //33
TOK_IFMEM, //34 TOK_CLASS, //34
TOK_TYPE, //35 TOK_PRESS, //35
TOK_SIZE, //36 TOK_IFMEM, //36
TOK_DOWN, //37 TOK_TYPE, //37
TOK_ZOOM, //38 TOK_SIZE, //38
TOK_ELSE, //39 TOK_DOWN, //39
TOK_ONUP, //40 TOK_ZOOM, //40
TOK_EOL, //41 TOK_ELSE, //41
TOK_MAP, //42 TOK_ONUP, //42
TOK_ROM, //43 TOK_EOL, //43
TOK_VGA, //44 TOK_MAP, //44
TOK_LCD, //45 TOK_ROM, //45
TOK_NOTFLAG, //46 TOK_VGA, //46
TOK_END //47 TOK_LCD, //47
TOK_END //48
} TokenId; } TokenId;
#define TYPE_NONE 00 #define TYPE_NONE 00
@ -70,9 +71,9 @@ typedef enum eTokenId
typedef struct KmlToken typedef struct KmlToken
{ {
TokenId eId; TokenId eId;
DWORD nParams; DWORD nParams;
DWORD nLen; DWORD nLen;
TCHAR szName[20]; LPCTSTR szName;
} KmlToken; } KmlToken;
typedef struct KmlLine typedef struct KmlLine
@ -119,6 +120,7 @@ extern VOID FreeBlocks(KmlBlock* pBlock);
extern VOID DrawAnnunciator(UINT nId, BOOL bOn); extern VOID DrawAnnunciator(UINT nId, BOOL bOn);
extern VOID ReloadButtons(BYTE *Keyboard_Row, UINT nSize); extern VOID ReloadButtons(BYTE *Keyboard_Row, UINT nSize);
extern VOID RefreshButtons(RECT *rc); extern VOID RefreshButtons(RECT *rc);
extern BOOL MouseIsButton(DWORD x, DWORD y);
extern VOID MouseButtonDownAt(UINT nFlags, DWORD x, DWORD y); extern VOID MouseButtonDownAt(UINT nFlags, DWORD x, DWORD y);
extern VOID MouseButtonUpAt(UINT nFlags, DWORD x, DWORD y); extern VOID MouseButtonUpAt(UINT nFlags, DWORD x, DWORD y);
extern VOID MouseMovesTo(UINT nFlags, DWORD x, DWORD y); extern VOID MouseMovesTo(UINT nFlags, DWORD x, DWORD y);

View file

@ -13,17 +13,13 @@
static TCHAR szOriginal[MAX_PATH] = _T(""); static TCHAR szOriginal[MAX_PATH] = _T("");
static LPTSTR *ppszFiles = NULL; // pointer to MRU table static LPTSTR *ppszFiles = NULL; // pointer to MRU table
static INT nEntry = 0; // no. of MRU entries static UINT nEntry = 0; // no. of MRU entries
static HMENU hMruMenu = NULL; // menu handle for MRU list static BOOL GetMenuPosForId(HMENU hMenu, UINT nItem, HMENU *phMruMenu, UINT *pnMruPos)
static INT nMruPos; // insert position for MRU list
static BOOL GetMenuPosForId(HMENU hMenu, UINT nItem)
{ {
HMENU hSubMenu; HMENU hSubMenu;
UINT nID; UINT i,nID,nMaxID;
INT i,nMaxID;
nMaxID = GetMenuItemCount(hMenu); nMaxID = GetMenuItemCount(hMenu);
for (i = 0; i < nMaxID; ++i) for (i = 0; i < nMaxID; ++i)
{ {
@ -36,8 +32,8 @@ static BOOL GetMenuPosForId(HMENU hMenu, UINT nItem)
hSubMenu = GetSubMenu(hMenu,i); // try to get handle to popup menu hSubMenu = GetSubMenu(hMenu,i); // try to get handle to popup menu
if (hSubMenu != NULL) // it's a popup menu if (hSubMenu != NULL) // it's a popup menu
{ {
// recursive search // recursive search
if (GetMenuPosForId(hSubMenu,nItem)) if (GetMenuPosForId(hSubMenu,nItem,phMruMenu,pnMruPos))
return TRUE; return TRUE;
} }
continue; continue;
@ -45,70 +41,53 @@ static BOOL GetMenuPosForId(HMENU hMenu, UINT nItem)
if (nID == nItem) // found ID if (nID == nItem) // found ID
{ {
hMruMenu = hMenu; // remember menu and position *phMruMenu = hMenu; // remember menu and position
nMruPos = i; *pnMruPos = i;
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
} }
BOOL MruInit(INT nNum) BOOL MruInit(UINT nNum)
{ {
HMENU hMenu = GetMenu(hWnd); // main menu HMENU hMenu = GetMenu(hWnd); // main menu
if (hMenu == NULL) return FALSE; // failed, no menu bar
_ASSERT(ppszFiles == NULL); // MRU already initialized _ASSERT(ppszFiles == NULL); // MRU already initialized
if (*szOriginal == 0) // get orginal value of first MRU entry
{
VERIFY(GetMenuString(hMenu,ID_FILE_MRU_FILE1,szOriginal,ARRAYSIZEOF(szOriginal),MF_BYCOMMAND));
}
// no. of files in MRU list // no. of files in MRU list
nEntry = ReadSettingsInt(_T("MRU"),_T("FileCount"),nNum); nEntry = ReadSettingsInt(_T("MRU"),_T("FileCount"),nNum);
// look for menu position of ID_FILE_MRU_FILE1
VERIFY(GetMenuPosForId(hMenu,ID_FILE_MRU_FILE1));
if (nEntry > 0) // allocate MRU table if (nEntry > 0) // allocate MRU table
{ {
// create MRU table // create MRU table
if ((ppszFiles = (LPTSTR *) malloc(nEntry * sizeof(*ppszFiles))) == NULL) if ((ppszFiles = (LPTSTR *) malloc(nEntry * sizeof(*ppszFiles))) == NULL)
return TRUE; return FALSE;
// fill each entry // fill each entry
for (nNum = 0; nNum < nEntry; ++nNum) for (nNum = 0; nNum < nEntry; ++nNum)
ppszFiles[nNum] = NULL; ppszFiles[nNum] = NULL;
MruReadList(); // read actual MRU list MruReadList(); // read actual MRU list
MruUpdateMenu(); // update menu
} }
else // kill MRU menu entries return TRUE;
{
// delete MRU menu
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
// delete following separator
_ASSERT((GetMenuState(hMruMenu,nMruPos,MF_BYPOSITION) & MF_SEPARATOR) != 0);
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
}
return FALSE;
} }
VOID MruCleanup(VOID) VOID MruCleanup(VOID)
{ {
INT i; UINT i;
MruWriteList(); // write actual MRU list MruWriteList(); // write actual MRU list
for (i = 0; i < nEntry; ++i) // cleanup each entry
{
if (ppszFiles[i] != NULL)
free(ppszFiles[i]); // cleanup entry
}
if (ppszFiles != NULL) // table defined if (ppszFiles != NULL) // table defined
{ {
for (i = 0; i < nEntry; ++i) // cleanup each entry
{
if (ppszFiles[i] != NULL)
free(ppszFiles[i]); // cleanup entry
}
free(ppszFiles); // free table free(ppszFiles); // free table
ppszFiles = NULL; ppszFiles = NULL;
} }
@ -119,162 +98,200 @@ VOID MruAdd(LPCTSTR lpszEntry)
{ {
TCHAR szFilename[MAX_PATH]; TCHAR szFilename[MAX_PATH];
LPTSTR lpFilePart; LPTSTR lpFilePart;
INT i; UINT i;
if (nEntry == 0) return; // no entries if (ppszFiles != NULL) // MRU initialized
// get full path name
GetFullPathName(lpszEntry,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart);
// look if entry is already in table
for (i = 0; i < nEntry; ++i)
{ {
// already in table -> quit _ASSERT(nEntry > 0); // must have entries
if ( ppszFiles[i] != NULL
&& lstrcmpi(ppszFiles[i],szFilename) == 0) // get full path name
GetFullPathName(lpszEntry,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart);
// look if entry is already in table
for (i = 0; i < nEntry; ++i)
{ {
MruMoveTop(i); // move to top and update menu // already in table -> quit
return; if ( ppszFiles[i] != NULL
&& lstrcmpi(ppszFiles[i],szFilename) == 0)
{
MruMoveTop(i); // move to top and update menu
return;
}
} }
i = nEntry - 1; // last index
if (ppszFiles[i] != NULL)
free(ppszFiles[i]); // free oldest entry
for (; i > 0; --i) // move old entries 1 line down
{
ppszFiles[i] = ppszFiles[i-1];
}
// add new entry to top
ppszFiles[0] = DuplicateString(szFilename);
} }
i = nEntry - 1; // last index
if (ppszFiles[i] != NULL)
free(ppszFiles[i]); // free oldest entry
for (; i > 0; --i) // move old entries 1 line down
{
ppszFiles[i] = ppszFiles[i-1];
}
// add new entry to top
ppszFiles[0] = DuplicateString(szFilename);
MruUpdateMenu(); // update menu
return; return;
} }
VOID MruRemove(INT nIndex) VOID MruRemove(UINT nIndex)
{ {
free(ppszFiles[nIndex]); // free entry // MRU initialized and index inside valid range
if (ppszFiles != NULL && nIndex < nEntry)
for (; nIndex < nEntry - 1; ++nIndex) // move below entries 1 line up
{ {
ppszFiles[nIndex] = ppszFiles[nIndex+1]; free(ppszFiles[nIndex]); // free entry
for (; nIndex < nEntry - 1; ++nIndex) // move below entries 1 line up
{
ppszFiles[nIndex] = ppszFiles[nIndex+1];
}
ppszFiles[nIndex] = NULL; // clear last line
} }
ppszFiles[nIndex] = NULL; // clear last line
MruUpdateMenu(); // update menu
return; return;
} }
VOID MruMoveTop(INT nIndex) VOID MruMoveTop(UINT nIndex)
{ {
LPTSTR lpszEntry = ppszFiles[nIndex]; // remember selected entry // MRU initialized and index inside valid range
if (ppszFiles != NULL && nIndex < nEntry)
for (; nIndex > 0; --nIndex) // move above entries 1 line down
{ {
ppszFiles[nIndex] = ppszFiles[nIndex-1]; LPTSTR lpszEntry = ppszFiles[nIndex];// remember selected entry
for (; nIndex > 0; --nIndex) // move above entries 1 line down
{
ppszFiles[nIndex] = ppszFiles[nIndex-1];
}
ppszFiles[0] = lpszEntry; // insert entry on top
} }
ppszFiles[0] = lpszEntry; // insert entry on top
MruUpdateMenu(); // update menu
return; return;
} }
INT MruEntries(VOID) UINT MruEntries(VOID)
{ {
return nEntry; return nEntry;
} }
LPCTSTR MruFilename(INT nIndex) LPCTSTR MruFilename(UINT nIndex)
{ {
_ASSERT(ppszFiles != NULL); // MRU not initialized LPCTSTR lpszName = _T("");
_ASSERT(nIndex >= 0 && nIndex < nEntry); // inside range
return ppszFiles[nIndex]; // MRU initialized and index inside valid range
if (ppszFiles != NULL && nIndex < nEntry)
{
lpszName = ppszFiles[nIndex];
}
return lpszName;
} }
VOID MruUpdateMenu(VOID) VOID MruUpdateMenu(HMENU hMenu)
{ {
TCHAR szCurPath[MAX_PATH]; TCHAR szCurPath[MAX_PATH];
HMENU hMenu;
BOOL bEmpty; BOOL bEmpty;
INT i; UINT i;
if (nEntry == 0) return; // no entries if (hMenu != NULL) // have menu
_ASSERT(ppszFiles != NULL); // MRU not initialized
_ASSERT(hWnd != NULL);
VERIFY(hMenu = GetMenu(hWnd)); // main menu
bEmpty = TRUE; // MRU list empty
for (i = 0; i < nEntry; ++i) // delete all menu entries
{ {
DeleteMenu(hMenu,ID_FILE_MRU_FILE1+i,MF_BYCOMMAND); HMENU hMruMenu; // menu handle for MRU list
UINT nMruPos; // insert position for MRU list
if (ppszFiles[i] != NULL) // valid entry _ASSERT(IsMenu(hMenu)); // validate menu handle
bEmpty = FALSE; // MRU list not empty
}
if (bEmpty) // empty MRU list // search for menu position of ID_FILE_MRU_FILE1
{ if (GetMenuPosForId(hMenu,ID_FILE_MRU_FILE1,&hMruMenu,&nMruPos))
// fill with orginal string
VERIFY(InsertMenu(hMruMenu,nMruPos,MF_STRING|MF_BYPOSITION|MF_GRAYED,ID_FILE_MRU_FILE1,szOriginal));
return;
}
// current directory
GetCurrentDirectory(ARRAYSIZEOF(szCurPath),szCurPath);
for (i = 0; i < nEntry; ++i) // add menu entries
{
if (ppszFiles[i] != NULL) // valid entry
{ {
TCHAR szMenuname[2*MAX_PATH+3]; if (*szOriginal == 0) // get orginal value of first MRU entry
TCHAR szFilename[MAX_PATH];
LPTSTR lpFilePart,lpszPtr;
// check if file path and current path is identical
if (GetFullPathName(ppszFiles[i],ARRAYSIZEOF(szFilename),szFilename,&lpFilePart))
{ {
TCHAR szCutname[MAX_PATH]; VERIFY(GetMenuString(hMruMenu,nMruPos,szOriginal,ARRAYSIZEOF(szOriginal),MF_BYPOSITION));
}
*(lpFilePart-1) = 0; // devide path and name if (nEntry == 0) // kill MRU menu entry
{
// delete MRU menu
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
// name is current directory -> use only name // delete the following separator
if (lstrcmpi(szCurPath,szFilename) == 0) _ASSERT((GetMenuState(hMruMenu,nMruPos,MF_BYPOSITION) & MF_SEPARATOR) != 0);
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
}
if (ppszFiles != NULL) // MRU initialized
{
_ASSERT(nEntry > 0); // must have entries
// delete all menu entries
for (i = 0; DeleteMenu(hMenu,ID_FILE_MRU_FILE1+i,MF_BYCOMMAND) != FALSE; ++i) { }
// check if MRU list is empty
for (bEmpty = TRUE, i = 0; bEmpty && i < nEntry; ++i)
{ {
// short name view bEmpty = (ppszFiles[i] == NULL);
}
else
{
// full name view
lpFilePart = ppszFiles[i];
} }
// cut filename to fit into menu if (bEmpty) // MRU list is empty
GetCutPathName(lpFilePart,szCutname,ARRAYSIZEOF(szCutname),36);
lpFilePart = szCutname;
lpszPtr = szMenuname; // adding accelerator key
*lpszPtr++ = _T('&');
*lpszPtr++ = _T('0') + ((i + 1) % 10);
*lpszPtr++ = _T(' ');
// copy file to view buffer and expand & to &&
while (*lpFilePart != 0)
{ {
if (*lpFilePart == _T('&')) // fill with orginal string
VERIFY(InsertMenu(hMruMenu,nMruPos,MF_STRING|MF_BYPOSITION|MF_GRAYED,ID_FILE_MRU_FILE1,szOriginal));
return;
}
// current directory
GetCurrentDirectory(ARRAYSIZEOF(szCurPath),szCurPath);
for (i = 0; i < nEntry; ++i) // add menu entries
{
if (ppszFiles[i] != NULL) // valid entry
{ {
*lpszPtr++ = *lpFilePart; TCHAR szMenuname[2*MAX_PATH+3];
} TCHAR szFilename[MAX_PATH];
*lpszPtr++ = *lpFilePart++; LPTSTR lpFilePart,lpszPtr;
}
*lpszPtr = 0;
VERIFY(InsertMenu(hMruMenu,nMruPos+i,MF_STRING|MF_BYPOSITION,ID_FILE_MRU_FILE1+i,szMenuname)); // check if file path and current path is identical
if (GetFullPathName(ppszFiles[i],ARRAYSIZEOF(szFilename),szFilename,&lpFilePart))
{
TCHAR szCutname[MAX_PATH];
*(lpFilePart-1) = 0; // devide path and name
// name is current directory -> use only name
if (lstrcmpi(szCurPath,szFilename) == 0)
{
// short name view
}
else
{
// full name view
lpFilePart = ppszFiles[i];
}
// cut filename to fit into menu
GetCutPathName(lpFilePart,szCutname,ARRAYSIZEOF(szCutname),36);
lpFilePart = szCutname;
// adding accelerator key
lpszPtr = szMenuname;
*lpszPtr++ = _T('&');
*lpszPtr++ = _T('0') + ((i + 1) % 10);
*lpszPtr++ = _T(' ');
// copy file to view buffer and expand & to &&
while (*lpFilePart != 0)
{
if (*lpFilePart == _T('&'))
{
*lpszPtr++ = *lpFilePart;
}
*lpszPtr++ = *lpFilePart++;
}
*lpszPtr = 0;
VERIFY(InsertMenu(hMruMenu,nMruPos+i,
MF_STRING|MF_BYPOSITION,ID_FILE_MRU_FILE1+i,
szMenuname));
}
}
}
} }
} }
} }
@ -284,22 +301,25 @@ VOID MruUpdateMenu(VOID)
VOID MruWriteList(VOID) VOID MruWriteList(VOID)
{ {
TCHAR szItemname[32]; TCHAR szItemname[32];
INT i; UINT i;
// no. of files in MRU list if (nEntry > 0)
WriteSettingsInt(_T("MRU"),_T("FileCount"),nEntry);
for (i = 0; i < nEntry; ++i) // add menu entries
{ {
_ASSERT(ppszFiles != NULL); // MRU not initialized // no. of files in MRU list
wsprintf(szItemname,_T("File%d"),i+1); WriteSettingsInt(_T("MRU"),_T("FileCount"),nEntry);
if (ppszFiles[i] != NULL)
for (i = 0; i < nEntry; ++i) // add menu entries
{ {
WriteSettingsString(_T("MRU"),szItemname,ppszFiles[i]); _ASSERT(ppszFiles != NULL); // MRU not initialized
} wsprintf(szItemname,_T("File%d"),i+1);
else if (ppszFiles[i] != NULL)
{ {
DelSettingsKey(_T("MRU"),szItemname); WriteSettingsString(_T("MRU"),szItemname,ppszFiles[i]);
}
else
{
DelSettingsKey(_T("MRU"),szItemname);
}
} }
} }
return; return;
@ -307,14 +327,14 @@ VOID MruWriteList(VOID)
VOID MruReadList(VOID) VOID MruReadList(VOID)
{ {
TCHAR szFilename[MAX_PATH]; TCHAR szFilename[MAX_PATH];
TCHAR szItemname[32]; TCHAR szItemname[32];
INT i; UINT i;
_ASSERT(ppszFiles != NULL); // MRU not initialized
for (i = 0; i < nEntry; ++i) // add menu entries for (i = 0; i < nEntry; ++i) // add menu entries
{ {
_ASSERT(ppszFiles != NULL); // MRU not initialized
wsprintf(szItemname,_T("File%d"),i+1); wsprintf(szItemname,_T("File%d"),i+1);
ReadSettingsString(_T("MRU"),szItemname,_T(""),szFilename,ARRAYSIZEOF(szFilename)); ReadSettingsString(_T("MRU"),szItemname,_T(""),szFilename,ARRAYSIZEOF(szFilename));
@ -323,7 +343,7 @@ VOID MruReadList(VOID)
free(ppszFiles[i]); // free entry free(ppszFiles[i]); // free entry
ppszFiles[i] = NULL; // clear last line ppszFiles[i] = NULL; // clear last line
} }
if (*szFilename) // read a valid entry if (*szFilename) // read a valid entry
{ {
ppszFiles[i] = DuplicateString(szFilename); ppszFiles[i] = DuplicateString(szFilename);

View file

@ -5,6 +5,7 @@
#define _WIN32_IE 0x0200 #define _WIN32_IE 0x0200
#define _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#include <winsock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>
@ -29,7 +30,7 @@
#endif // _DEBUG #endif // _DEBUG
#endif // _VERIFY #endif // _VERIFY
#if !defined INVALID_SET_FILE_POINTER #if !defined INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1) #define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif #endif
@ -41,6 +42,10 @@
#define GWLP_USERDATA GWL_USERDATA #define GWLP_USERDATA GWL_USERDATA
#endif #endif
#if !defined GCLP_HCURSOR
#define GCLP_HCURSOR GCL_HCURSOR
#endif
#if !defined IDC_HAND // Win2k specific definition #if !defined IDC_HAND // Win2k specific definition
#define IDC_HAND MAKEINTRESOURCE(32649) #define IDC_HAND MAKEINTRESOURCE(32649)
#endif #endif
@ -48,7 +53,10 @@
#if _MSC_VER <= 1200 // missing type definition in the MSVC6.0 SDK and earlier #if _MSC_VER <= 1200 // missing type definition in the MSVC6.0 SDK and earlier
#define SetWindowLongPtr SetWindowLong #define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong #define GetWindowLongPtr GetWindowLong
#define SetClassLongPtr SetClassLong
#define GetClassLongPtr GetClassLong
typedef SIZE_T DWORD_PTR, *PDWORD_PTR; typedef SIZE_T DWORD_PTR, *PDWORD_PTR;
typedef ULONG ULONG_PTR, *PULONG_PTR;
typedef LONG LONG_PTR, *PLONG_PTR; typedef LONG LONG_PTR, *PLONG_PTR;
#endif #endif

View file

@ -35,7 +35,7 @@ static __inline BYTE Parity(BYTE b)
static __inline BYTE CreateCorrectionBits(BYTE b) static __inline BYTE CreateCorrectionBits(BYTE b)
{ {
INT i; UINT i;
BYTE byVal = 0; BYTE byVal = 0;
for (i = 0; i < ARRAYSIZEOF(byEmask);++i) for (i = 0; i < ARRAYSIZEOF(byEmask);++i)

View file

@ -5,33 +5,34 @@
#define IDM_DEBUG_SETTINGS 0x0010 #define IDM_DEBUG_SETTINGS 0x0010
#define IDI_EMU48 100 #define IDI_EMU48 100
#define IDR_MENU 101 #define IDR_MENU 101
#define IDR_DEBUG 102 #define IDM_MENU 102
#define IDR_DEBUG_TOOLBAR 103 #define IDR_DEBUG 103
#define IDR_DEBUG_CODE 104 #define IDR_DEBUG_TOOLBAR 104
#define IDR_DEBUG_MEM 105 #define IDR_DEBUG_CODE 105
#define IDR_DEBUG_STACK 106 #define IDR_DEBUG_MEM 106
#define IDB_CHECKBOX 107 #define IDR_DEBUG_STACK 107
#define IDD_ABOUT 108 #define IDB_CHECKBOX 108
#define IDD_SET_GENERAL 109 #define IDD_ABOUT 109
#define IDD_SET_MEMORY 110 #define IDD_SET_GENERAL 110
#define IDD_SET_PERIPHERAL 111 #define IDD_SET_MEMORY 111
#define IDD_CHOOSEKML 112 #define IDD_SET_PERIPHERAL 112
#define IDD_KMLLOG 113 #define IDD_CHOOSEKML 113
#define IDD_DISASM 114 #define IDD_KMLLOG 114
#define IDD_DEBUG 115 #define IDD_DISASM 115
#define IDD_NEWVALUE 116 #define IDD_DEBUG 116
#define IDD_ENTERADR 117 #define IDD_NEWVALUE 117
#define IDD_BREAKEDIT 118 #define IDD_ENTERADR 118
#define IDD_ENTERBREAK 119 #define IDD_BREAKEDIT 119
#define IDD_INSTRUCTIONS 120 #define IDD_ENTERBREAK 120
#define IDD_WRITEONLYREG 121 #define IDD_INSTRUCTIONS 121
#define IDD_FIND 122 #define IDD_WRITEONLYREG 122
#define IDD_PROFILE 123 #define IDD_FIND 123
#define IDD_RPLVIEW 124 #define IDD_PROFILE 124
#define IDD_MACROSET 125 #define IDD_RPLVIEW 125
#define IDD_DEBUG_MEMSAVE 126 #define IDD_MACROSET 126
#define IDD_DEBUG_MEMLOAD 127 #define IDD_DEBUG_MEMSAVE 127
#define IDD_DEBUG_SETTINGS 128 #define IDD_DEBUG_MEMLOAD 128
#define IDD_DEBUG_SETTINGS 129
#define IDC_REALSPEED 1000 #define IDC_REALSPEED 1000
#define IDC_GRAYSCALE 1001 #define IDC_GRAYSCALE 1001
#define IDC_ALWAYSONTOP 1002 #define IDC_ALWAYSONTOP 1002
@ -40,132 +41,134 @@
#define IDC_AUTOSAVE 1005 #define IDC_AUTOSAVE 1005
#define IDC_AUTOSAVEONEXIT 1006 #define IDC_AUTOSAVEONEXIT 1006
#define IDC_OBJECTLOADWARNING 1007 #define IDC_OBJECTLOADWARNING 1007
#define IDC_ALWAYSDISPLOG 1008 #define IDC_SHOWTITLE 1008
#define IDC_PORT1EN 1009 #define IDC_SHOWMENU 1009
#define IDC_PORT1WR 1010 #define IDC_ALWAYSDISPLOG 1010
#define IDC_PORT2ISSHARED 1011 #define IDC_PORT1EN 1011
#define IDC_PORT2WR 1012 #define IDC_PORT1WR 1012
#define IDC_PORT2 1013 #define IDC_PORT2ISSHARED 1013
#define IDC_PORT2LOAD 1014 #define IDC_PORT2WR 1014
#define IDC_IR_ADDR 1015 #define IDC_PORT2 1015
#define IDC_IR_PORT 1016 #define IDC_PORT2LOAD 1016
#define IDC_WIRE 1017 #define IDC_IR_ADDR 1017
#define IDC_IR 1018 #define IDC_IR_PORT 1018
#define IDC_EMUDIR 1019 #define IDC_WIRE 1019
#define IDC_EMUDIRSEL 1020 #define IDC_IR 1020
#define IDC_UPDATE 1021 #define IDC_EMUDIR 1021
#define IDC_KMLSCRIPT 1022 #define IDC_EMUDIRSEL 1022
#define IDC_AUTHOR 1023 #define IDC_UPDATE 1023
#define IDC_TITLE 1024 #define IDC_KMLSCRIPT 1024
#define IDC_KMLLOG 1025 #define IDC_AUTHOR 1025
#define IDC_VERSION 1026 #define IDC_TITLE 1026
#define IDC_LICENSE 1027 #define IDC_KMLLOG 1027
#define IDC_DISASM_WIN 1028 #define IDC_VERSION 1028
#define IDC_DISASM_MODE_TEXT 1029 #define IDC_LICENSE 1029
#define IDC_DISASM_MODE 1030 #define IDC_DISASM_WIN 1030
#define IDC_DISASM_MODULE 1031 #define IDC_DISASM_MODE_TEXT 1031
#define IDC_DISASM_HP 1032 #define IDC_DISASM_MODE 1032
#define IDC_DISASM_CLASS 1033 #define IDC_DISASM_MODULE 1033
#define IDC_ADDRESS 1034 #define IDC_DISASM_HP 1034
#define IDC_DISASM_ADR 1035 #define IDC_DISASM_CLASS 1035
#define IDC_DISASM_NEXT 1036 #define IDC_ADDRESS 1036
#define IDC_DISASM_COPY 1037 #define IDC_DISASM_ADR 1037
#define IDC_DEBUG_CODE 1038 #define IDC_DISASM_NEXT 1038
#define IDC_STATIC_CODE 1039 #define IDC_DISASM_COPY 1039
#define IDC_STATIC_REGISTERS 1040 #define IDC_DEBUG_CODE 1040
#define IDC_STATIC_MEMORY 1041 #define IDC_STATIC_CODE 1041
#define IDC_STATIC_STACK 1042 #define IDC_STATIC_REGISTERS 1042
#define IDC_REG_A 1043 #define IDC_STATIC_MEMORY 1043
#define IDC_REG_B 1044 #define IDC_STATIC_STACK 1044
#define IDC_REG_C 1045 #define IDC_REG_A 1045
#define IDC_REG_D 1046 #define IDC_REG_B 1046
#define IDC_REG_R0 1047 #define IDC_REG_C 1047
#define IDC_REG_R1 1048 #define IDC_REG_D 1048
#define IDC_REG_R2 1049 #define IDC_REG_R0 1049
#define IDC_REG_R3 1050 #define IDC_REG_R1 1050
#define IDC_REG_R4 1051 #define IDC_REG_R2 1051
#define IDC_REG_D0 1052 #define IDC_REG_R3 1052
#define IDC_REG_D1 1053 #define IDC_REG_R4 1053
#define IDC_REG_P 1054 #define IDC_REG_D0 1054
#define IDC_REG_PC 1055 #define IDC_REG_D1 1055
#define IDC_REG_OUT 1056 #define IDC_REG_P 1056
#define IDC_REG_IN 1057 #define IDC_REG_PC 1057
#define IDC_REG_ST 1058 #define IDC_REG_OUT 1058
#define IDC_REG_CY 1059 #define IDC_REG_IN 1059
#define IDC_REG_MODE 1060 #define IDC_REG_ST 1060
#define IDC_REG_MP 1061 #define IDC_REG_CY 1061
#define IDC_REG_SR 1062 #define IDC_REG_MODE 1062
#define IDC_REG_SB 1063 #define IDC_REG_MP 1063
#define IDC_REG_XM 1064 #define IDC_REG_SR 1064
#define IDC_MISC_INT 1065 #define IDC_REG_SB 1065
#define IDC_MISC_KEY 1066 #define IDC_REG_XM 1066
#define IDC_MISC_BS 1067 #define IDC_MISC_INT 1067
#define IDC_NEWVALUE 1068 #define IDC_MISC_KEY 1068
#define IDC_ENTERADR 1069 #define IDC_MISC_BS 1069
#define IDC_DEBUG_MEM 1070 #define IDC_NEWVALUE 1070
#define IDC_DEBUG_MEM_ADDR 1071 #define IDC_ENTERADR 1071
#define IDC_DEBUG_MEM_COL0 1072 #define IDC_DEBUG_MEM 1072
#define IDC_DEBUG_MEM_COL1 1073 #define IDC_DEBUG_MEM_ADDR 1073
#define IDC_DEBUG_MEM_COL2 1074 #define IDC_DEBUG_MEM_COL0 1074
#define IDC_DEBUG_MEM_COL3 1075 #define IDC_DEBUG_MEM_COL1 1075
#define IDC_DEBUG_MEM_COL4 1076 #define IDC_DEBUG_MEM_COL2 1076
#define IDC_DEBUG_MEM_COL5 1077 #define IDC_DEBUG_MEM_COL3 1077
#define IDC_DEBUG_MEM_COL6 1078 #define IDC_DEBUG_MEM_COL4 1078
#define IDC_DEBUG_MEM_COL7 1079 #define IDC_DEBUG_MEM_COL5 1079
#define IDC_DEBUG_MEM_TEXT 1080 #define IDC_DEBUG_MEM_COL6 1080
#define IDC_DEBUG_DATA_FILE 1081 #define IDC_DEBUG_MEM_COL7 1081
#define IDC_DEBUG_DATA_BUT 1082 #define IDC_DEBUG_MEM_TEXT 1082
#define IDC_DEBUG_DATA_STARTADDR 1083 #define IDC_DEBUG_DATA_FILE 1083
#define IDC_DEBUG_DATA_ENDADDR 1084 #define IDC_DEBUG_DATA_BUT 1084
#define IDC_DEBUG_SET_SYMB 1085 #define IDC_DEBUG_DATA_STARTADDR 1085
#define IDC_DEBUG_SET_MODEL 1086 #define IDC_DEBUG_DATA_ENDADDR 1086
#define IDC_DEBUG_SET_FILE 1087 #define IDC_DEBUG_SET_SYMB 1087
#define IDC_DEBUG_SET_BROWSE 1088 #define IDC_DEBUG_SET_MODEL 1088
#define IDC_DEBUG_STACK 1089 #define IDC_DEBUG_SET_FILE 1089
#define IDC_STATIC_BREAKPOINT 1090 #define IDC_DEBUG_SET_BROWSE 1090
#define IDC_BREAKEDIT_ADD 1091 #define IDC_DEBUG_STACK 1091
#define IDC_BREAKEDIT_DELETE 1092 #define IDC_STATIC_BREAKPOINT 1092
#define IDC_BREAKEDIT_WND 1093 #define IDC_BREAKEDIT_ADD 1093
#define IDC_STATIC_MMU 1094 #define IDC_BREAKEDIT_DELETE 1094
#define IDC_MMU_IO_A 1095 #define IDC_BREAKEDIT_WND 1095
#define IDC_MMU_NCE2_A 1096 #define IDC_STATIC_MMU 1096
#define IDC_MMU_CE1_A 1097 #define IDC_MMU_IO_A 1097
#define IDC_MMU_CE2_A 1098 #define IDC_MMU_NCE2_A 1098
#define IDC_MMU_NCE3_A 1099 #define IDC_MMU_CE1_A 1099
#define IDC_MMU_IO_S 1100 #define IDC_MMU_CE2_A 1100
#define IDC_MMU_CE1_S 1101 #define IDC_MMU_NCE3_A 1101
#define IDC_MMU_CE2_S 1102 #define IDC_MMU_IO_S 1102
#define IDC_MMU_NCE2_S 1103 #define IDC_MMU_CE1_S 1103
#define IDC_MMU_NCE3_S 1104 #define IDC_MMU_CE2_S 1104
#define IDC_STATIC_MISC 1105 #define IDC_MMU_NCE2_S 1105
#define IDC_MISC_BS_TXT 1106 #define IDC_MMU_NCE3_S 1106
#define IDC_INSTR_TEXT 1107 #define IDC_STATIC_MISC 1107
#define IDC_INSTR_CODE 1108 #define IDC_MISC_BS_TXT 1108
#define IDC_INSTR_COPY 1109 #define IDC_INSTR_TEXT 1109
#define IDC_INSTR_CLEAR 1110 #define IDC_INSTR_CODE 1110
#define IDC_PROFILE_LASTCYCLES 1111 #define IDC_INSTR_COPY 1111
#define IDC_PROFILE_LASTTIME 1112 #define IDC_INSTR_CLEAR 1112
#define IDC_BPCODE 1113 #define IDC_PROFILE_LASTCYCLES 1113
#define IDC_BPRPL 1114 #define IDC_PROFILE_LASTTIME 1114
#define IDC_BPACCESS 1115 #define IDC_BPCODE 1115
#define IDC_BPREAD 1116 #define IDC_BPRPL 1116
#define IDC_BPWRITE 1117 #define IDC_BPACCESS 1117
#define IDC_FIND_DATA 1118 #define IDC_BPREAD 1118
#define IDC_FIND_PREV 1119 #define IDC_BPWRITE 1119
#define IDC_FIND_NEXT 1120 #define IDC_FIND_DATA 1120
#define IDC_FIND_ASCII 1121 #define IDC_FIND_PREV 1121
#define IDC_ADDR20_24 1122 #define IDC_FIND_NEXT 1122
#define IDC_ADDR25_27 1123 #define IDC_FIND_ASCII 1123
#define IDC_ADDR28_29 1124 #define IDC_ADDR20_24 1124
#define IDC_ADDR30_34 1125 #define IDC_ADDR25_27 1125
#define IDC_RPLVIEW_DATA 1126 #define IDC_ADDR28_29 1126
#define IDC_MACRO_SLOW 1127 #define IDC_ADDR30_34 1127
#define IDC_MACRO_FAST 1128 #define IDC_RPLVIEW_DATA 1128
#define IDC_MACRO_SLIDER 1129 #define IDC_MACRO_SLOW 1129
#define IDC_MACRO_REAL 1130 #define IDC_MACRO_FAST 1130
#define IDC_MACRO_MANUAL 1131 #define IDC_MACRO_SLIDER 1131
#define IDC_SOUND_SLIDER 1132 #define IDC_MACRO_REAL 1132
#define IDC_SOUND_DEVICE 1133 #define IDC_MACRO_MANUAL 1133
#define IDC_SOUND_SLIDER 1134
#define IDC_SOUND_DEVICE 1135
#define ID_FILE_NEW 40001 #define ID_FILE_NEW 40001
#define ID_FILE_OPEN 40002 #define ID_FILE_OPEN 40002
#define ID_FILE_SAVE 40003 #define ID_FILE_SAVE 40003
@ -238,12 +241,12 @@
#define ID_FILE_MRU_FILE1 40100 #define ID_FILE_MRU_FILE1 40100
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 132 #define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 40072 #define _APS_NEXT_COMMAND_VALUE 40072
#define _APS_NEXT_CONTROL_VALUE 1134 #define _APS_NEXT_CONTROL_VALUE 1136
#define _APS_NEXT_SYMED_VALUE 108 #define _APS_NEXT_SYMED_VALUE 109
#endif #endif
#endif #endif

View file

@ -107,8 +107,8 @@ BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort)
TCHAR szDevice[256] = _T("\\\\.\\"); TCHAR szDevice[256] = _T("\\\\.\\");
// check if device buffer is big enough // check if device buffer is big enough
_ASSERT(lstrlen(szDevice) + lstrlen(strPort) < ARRAYSIZEOF(szDevice)); _ASSERT(lstrlen(szDevice) + lstrlen(strPort) < (INT) ARRAYSIZEOF(szDevice));
if (lstrlen(szDevice) + lstrlen(strPort) >= ARRAYSIZEOF(szDevice)) if (lstrlen(szDevice) + lstrlen(strPort) >= (INT) ARRAYSIZEOF(szDevice))
return hComm != NULL; return hComm != NULL;
_tcscat(szDevice,strPort); // device name _tcscat(szDevice,strPort); // device name

View file

@ -67,7 +67,7 @@ static VOID ReadReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, LPBYTE lpData, DWORD
0, 0,
KEY_QUERY_VALUE, KEY_QUERY_VALUE,
&hKey); &hKey);
if (retCode == ERROR_SUCCESS) if (retCode == ERROR_SUCCESS)
{ {
retCode = RegQueryValueEx(hKey,lpValueName,NULL,&dwType,lpData,pdwSize); retCode = RegQueryValueEx(hKey,lpValueName,NULL,&dwType,lpData,pdwSize);
RegCloseKey(hKey); RegCloseKey(hKey);
@ -76,7 +76,7 @@ static VOID ReadReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, LPBYTE lpData, DWORD
if (retCode != ERROR_SUCCESS) // registry entry not found if (retCode != ERROR_SUCCESS) // registry entry not found
*pdwSize = 0; // return zero size *pdwSize = 0; // return zero size
return; return;
} }
static BOOL WriteReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, CONST BYTE *lpData, DWORD cbData) static BOOL WriteReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
{ {
@ -117,7 +117,7 @@ static BOOL DelReg(LPCTSTR lpSubKey, LPCTSTR lpValueName)
0, 0,
KEY_SET_VALUE, KEY_SET_VALUE,
&hKey); &hKey);
if (retCode == ERROR_SUCCESS) if (retCode == ERROR_SUCCESS)
{ {
retCode = RegDeleteValue(hKey,lpValueName); retCode = RegDeleteValue(hKey,lpValueName);
RegCloseKey(hKey); RegCloseKey(hKey);
@ -181,8 +181,11 @@ VOID ReadSettings(VOID)
disassembler_mode = ReadInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode); disassembler_mode = ReadInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode);
disassembler_symb = ReadInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb); disassembler_symb = ReadInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb);
// Emulator // Emulator
bShowTitle = ReadInt(_T("Emulator"),_T("ShowTitle"),bShowTitle);
bShowMenu = ReadInt(_T("Emulator"),_T("ShowMenu"),bShowMenu);
bAlwaysOnTop = ReadInt(_T("Emulator"),_T("AlwaysOnTop"),bAlwaysOnTop); bAlwaysOnTop = ReadInt(_T("Emulator"),_T("AlwaysOnTop"),bAlwaysOnTop);
bActFollowsMouse = ReadInt(_T("Emulator"),_T("ActivationFollowsMouse"),bActFollowsMouse); bActFollowsMouse = ReadInt(_T("Emulator"),_T("ActivationFollowsMouse"),bActFollowsMouse);
bClientWinMove = ReadInt(_T("Emulator"),_T("ClientWinMove"),bClientWinMove);
bSingleInstance = ReadInt(_T("Emulator"),_T("SingleInstance"),bSingleInstance); bSingleInstance = ReadInt(_T("Emulator"),_T("SingleInstance"),bSingleInstance);
bRealSpeed = ReadInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed); bRealSpeed = ReadInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed);
dwSXCycles = ReadInt(_T("Emulator"),_T("SXCycles"),dwSXCycles); dwSXCycles = ReadInt(_T("Emulator"),_T("SXCycles"),dwSXCycles);
@ -231,8 +234,11 @@ VOID WriteSettings(VOID)
WriteInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode); WriteInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode);
WriteInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb); WriteInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb);
// Emulator // Emulator
WriteInt(_T("Emulator"),_T("ShowTitle"),bShowTitle);
WriteInt(_T("Emulator"),_T("ShowMenu"),bShowMenu);
WriteInt(_T("Emulator"),_T("AlwaysOnTop"),bAlwaysOnTop); WriteInt(_T("Emulator"),_T("AlwaysOnTop"),bAlwaysOnTop);
WriteInt(_T("Emulator"),_T("ActivationFollowsMouse"),bActFollowsMouse); WriteInt(_T("Emulator"),_T("ActivationFollowsMouse"),bActFollowsMouse);
WriteInt(_T("Emulator"),_T("ClientWinMove"),bClientWinMove);
WriteInt(_T("Emulator"),_T("SingleInstance"),bSingleInstance); WriteInt(_T("Emulator"),_T("SingleInstance"),bSingleInstance);
WriteInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed); WriteInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed);
WriteInt(_T("Emulator"),_T("SXCycles"),dwSXCycles); WriteInt(_T("Emulator"),_T("SXCycles"),dwSXCycles);

View file

@ -250,7 +250,7 @@ static __inline INT SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,
if ( nMantLen + nExpLen >= nSize // destination buffer too small if ( nMantLen + nExpLen >= nSize // destination buffer too small
|| !*cp // empty string || !*cp // empty string
|| _tcsspn(cp,cVc) != (SIZE_T) lstrlen(cp) // real contain only these numbers || _tcsspn(cp,cVc) != (SIZE_T) lstrlen(cp) // real contain only these numbers
|| lstrlen(cp) >= ARRAYSIZEOF(byNum)) // ignore too long reals || (SIZE_T) lstrlen(cp) >= ARRAYSIZEOF(byNum)) // ignore too long reals
return 0; return 0;
byNum[0] = (*cp != _T('-')) ? 0 : 9; // set sign nibble byNum[0] = (*cp != _T('-')) ? 0 : 9; // set sign nibble
@ -388,7 +388,7 @@ static INT RPL_GetComplex(BYTE CONST *pbyNum,INT nMantLen,INT nExpLen,CONST TCHA
cp[nPos++] = _T('('); // start of complex number cp[nPos++] = _T('('); // start of complex number
// real part // real part
nLen = RPL_GetBcd(pbyNum,12,3,cDec,&cp[1],nSize); nLen = RPL_GetBcd(pbyNum,nMantLen,nExpLen,cDec,&cp[1],nSize);
if (nLen == 0) return 0; // target buffer to small if (nLen == 0) return 0; // target buffer to small
_ASSERT(nLen <= nSize); _ASSERT(nLen <= nSize);
@ -399,7 +399,7 @@ static INT RPL_GetComplex(BYTE CONST *pbyNum,INT nMantLen,INT nExpLen,CONST TCHA
cp[nPos++] = cSep; // write of complex number seperator cp[nPos++] = cSep; // write of complex number seperator
// imaginary part // imaginary part
nLen = RPL_GetBcd(&pbyNum[16],12,3,cDec,&cp[nPos],nSize); nLen = RPL_GetBcd(&pbyNum[16],nMantLen,nExpLen,cDec,&cp[nPos],nSize);
if (nLen == 0) return 0; // target buffer to small if (nLen == 0) return 0; // target buffer to small
nPos += nLen; // actual buffer postion nPos += nLen; // actual buffer postion

View file

@ -75,124 +75,122 @@ BOOL RplLoadTable(LPCTSTR lpszFilename)
BYTE byPage[RECORD_BLOCK]; // record page size BYTE byPage[RECORD_BLOCK]; // record page size
HANDLE hFile; HANDLE hFile;
DWORD dwFileLength,dwCodeLength,dwNoSymbols,dwNoReferences; DWORD dwFileLength,dwCodeLength,dwNoSymbols,dwNoReferences;
DWORD dwBytesRead,dwSymb,dwPageIndex,dwResolvedSymb; DWORD dwFilePos,dwBytesRead,dwSymb,dwPageIndex,dwResolvedSymb;
BOOL bSymbol; BOOL bSymbol,bSucc;
bSucc = FALSE;
hFile = CreateFile(lpszFilename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,NULL); hFile = CreateFile(lpszFilename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,NULL);
if (hFile == INVALID_HANDLE_VALUE) if (hFile != INVALID_HANDLE_VALUE)
{ {
RplDeleteTable(); // delete current table dwResolvedSymb = 0; // no resolved symbols added
return FALSE; bSymbol = TRUE; // next set is a symbol
}
// read first page // read first page
ReadFile(hFile,byPage,sizeof(byPage),&dwBytesRead,NULL); ReadFile(hFile,byPage,sizeof(byPage),&dwBytesRead,NULL);
if ( dwBytesRead != sizeof(byPage) if (dwBytesRead == sizeof(byPage) && memcmp(byPage,SAT_ID,7) == 0)
|| memcmp(byPage,SAT_ID,7) != 0)
{
RplDeleteTable(); // delete current table
CloseHandle(hFile);
return FALSE;
}
// file length in bytes
dwFileLength = GetBigEndian(byPage+7,sizeof(WORD)) * sizeof(byPage);
// code area in nibbles
dwCodeLength = GetBigEndian(byPage+9,sizeof(DWORD));
// no. of symbols & references
dwNoSymbols = GetBigEndian(byPage+13,sizeof(WORD));
// no. of references
dwNoReferences = GetBigEndian(byPage+15,sizeof(WORD));
// convert code area length into no. of pages
dwPageIndex = (dwCodeLength + (2 * sizeof(byPage) - 1)) / (2 * sizeof(byPage));
// jump to begin of symbols by skipping no. of code pages
if (SetFilePointer(hFile,dwPageIndex*sizeof(byPage),NULL,FILE_CURRENT) == INVALID_SET_FILE_POINTER)
{
RplDeleteTable(); // delete current table
CloseHandle(hFile);
return FALSE;
}
dwResolvedSymb = 0; // no resolved symbols added
bSymbol = TRUE; // next set is a symbol
// read all symbol pages
for (dwPageIndex = 256, dwSymb = 0; dwSymb < dwNoSymbols; dwPageIndex += 42)
{
if (dwPageIndex >= 256) // read complete page
{ {
// read new symbol page // file length in bytes
ReadFile(hFile,byPage,sizeof(byPage),&dwBytesRead,NULL); dwFileLength = GetBigEndian(byPage+7,sizeof(WORD)) * sizeof(byPage);
if ( dwBytesRead != sizeof(byPage)
|| memcmp(byPage,SYMB_ID,4) != 0) // code area in nibbles
dwCodeLength = GetBigEndian(byPage+9,sizeof(DWORD));
// no. of symbols & references
dwNoSymbols = GetBigEndian(byPage+13,sizeof(WORD));
// no. of references
dwNoReferences = GetBigEndian(byPage+15,sizeof(WORD));
// convert code area length into no. of pages
dwPageIndex = (dwCodeLength + (2 * sizeof(byPage) - 1)) / (2 * sizeof(byPage));
// calculate no. of code pages
dwFilePos = dwPageIndex * sizeof(byPage);
// jump to begin of symbols by skipping no. of code pages
bSucc = SetFilePointer(hFile,dwFilePos,NULL,FILE_CURRENT) != INVALID_SET_FILE_POINTER;
dwFilePos += sizeof(byPage); // actual file position
}
// read all symbol pages
for (dwPageIndex = 256, dwSymb = 0; bSucc && dwSymb < dwNoSymbols; dwPageIndex += 42)
{
if (dwPageIndex >= 256) // read complete page
{ {
RplDeleteTable(); // delete current table // read new symbol page
CloseHandle(hFile); ReadFile(hFile,byPage,sizeof(byPage),&dwBytesRead,NULL);
return FALSE; dwFilePos += dwBytesRead; // update file position
if ( dwFilePos > dwFileLength
|| dwBytesRead != sizeof(byPage)
|| memcmp(byPage,SYMB_ID,4) != 0)
{
bSucc = FALSE;
break;
}
dwPageIndex = 4; // begin of new symbol
} }
dwPageIndex = 4; // begin of new symbol if (bSymbol) // this is the 42 byte symbol set
}
if (bSymbol) // this is the 42 byte symbol set
{
WORD wSymbolType = (WORD) GetBigEndian(byPage+dwPageIndex+36,sizeof(WORD));
// check if it's a resolved or relocatable symbol
bSymbol = (wSymbolType & OS_RESOLVED) != 0;
if (bSymbol) ++dwResolvedSymb; // added resolved symbol
if (wSymbolType == OS_RESOLVED) // resolved symbol type
{ {
TCHAR szSymbolName[36+1],*pcPtr; WORD wSymbolType = (WORD) GetBigEndian(byPage+dwPageIndex+36,sizeof(WORD));
PREFDATA pData;
DWORD dwHash;
#if defined _UNICODE // check if it's a resolved or relocatable symbol
bSymbol = (wSymbolType & OS_RESOLVED) != 0;
if (bSymbol) ++dwResolvedSymb; // added resolved symbol
if (wSymbolType == OS_RESOLVED) // resolved symbol type
{ {
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,(LPCSTR)byPage+dwPageIndex,36, TCHAR szSymbolName[36+1],*pcPtr;
szSymbolName,ARRAYSIZEOF(szSymbolName)); PREFDATA pData;
szSymbolName[36] = 0; // set EOS DWORD dwHash;
#if defined _UNICODE
{
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,(LPCSTR)byPage+dwPageIndex,36,
szSymbolName,ARRAYSIZEOF(szSymbolName));
szSymbolName[36] = 0; // set EOS
}
#else
{
lstrcpyn(szSymbolName,(LPCSTR)byPage+dwPageIndex,ARRAYSIZEOF(szSymbolName));
}
#endif
// cut symbol name at first space character
if ((pcPtr = _tcschr(szSymbolName,_T(' '))) != NULL)
*pcPtr = 0; // set EOS
// allocate symbol memory
VERIFY(pData = (PREFDATA) malloc(sizeof(*pData)));
pData->lpszName = DuplicateString(szSymbolName);
pData->dwAddr = GetBigEndian(byPage+dwPageIndex+38,sizeof(DWORD));
// add to hash table
dwHash = GetHash(pData->dwAddr);
pData->pNext = ppsBase[dwHash];
ppsBase[dwHash] = pData;
} }
#else
{
lstrcpyn(szSymbolName,(LPCSTR)byPage+dwPageIndex,ARRAYSIZEOF(szSymbolName));
}
#endif
// cut symbol name at first space character ++dwSymb; // got symbol
if ((pcPtr = _tcschr(szSymbolName,_T(' '))) != NULL)
*pcPtr = 0; // set EOS
// allocate symbol memory
VERIFY(pData = (PREFDATA) malloc(sizeof(*pData)));
pData->lpszName = DuplicateString(szSymbolName);
pData->dwAddr = GetBigEndian(byPage+dwPageIndex+38,sizeof(DWORD));
// add to hash table
dwHash = GetHash(pData->dwAddr);
pData->pNext = ppsBase[dwHash];
ppsBase[dwHash] = pData;
} }
else // 42 byte fill reference
{
bSymbol = TRUE; // nothing to do, next is a symbol set
}
}
++dwSymb; // got symbol bSucc = bSucc && (dwFilePos <= dwFileLength)
} && (dwNoSymbols == (dwResolvedSymb + dwNoReferences));
else // 42 byte fill reference
{ CloseHandle(hFile);
bSymbol = TRUE; // nothing to do, next is a symbol set
}
} }
_ASSERT(dwResolvedSymb == (dwNoSymbols - dwNoReferences)); if (!bSucc) RplDeleteTable(); // delete current table
return bSucc;
CloseHandle(hFile);
return TRUE;
} }
// //

View file

@ -296,7 +296,7 @@ FONT 8, "MS Sans Serif"
BEGIN BEGIN
ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE
LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP
LTEXT "Copyright © 2014 Christoph Gießelink && Sébastien Carlier", LTEXT "Copyright © 2015 Christoph Gießelink && Sébastien Carlier",
IDC_STATIC,29,18,181,8 IDC_STATIC,29,18,181,8
DEFPUSHBUTTON "OK",IDOK,215,12,39,14 DEFPUSHBUTTON "OK",IDOK,215,12,39,14
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL | EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
@ -327,11 +327,16 @@ BEGIN
CONTROL "Always Show KML Compilation Result",IDC_ALWAYSDISPLOG, CONTROL "Always Show KML Compilation Result",IDC_ALWAYSDISPLOG,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,112,133,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,112,133,10
GROUPBOX "General",IDC_STATIC,7,7,148,120 GROUPBOX "General",IDC_STATIC,7,7,148,120
CONTROL "Show Title",IDC_SHOWTITLE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,17,69,10
CONTROL "Show Menu",IDC_SHOWMENU,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,28,69,10
GROUPBOX "Style",IDC_STATIC,161,7,83,70
CONTROL "HP Mnemonics",IDC_DISASM_HP,"Button",BS_AUTORADIOBUTTON | CONTROL "HP Mnemonics",IDC_DISASM_HP,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,168,21,69,11 WS_GROUP | WS_TABSTOP,168,94,69,11
CONTROL "Class Mnemonics",IDC_DISASM_CLASS,"Button", CONTROL "Class Mnemonics",IDC_DISASM_CLASS,"Button",
BS_AUTORADIOBUTTON,168,35,69,11 BS_AUTORADIOBUTTON,168,108,69,11
GROUPBOX "Disassembler",IDC_STATIC,161,7,83,120 GROUPBOX "Disassembler",IDC_STATIC,161,80,83,47
END END
IDD_SET_MEMORY DIALOG DISCARDABLE 0, 0, 251, 134 IDD_SET_MEMORY DIALOG DISCARDABLE 0, 0, 251, 134
@ -715,8 +720,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,6,0 FILEVERSION 1,5,7,0
PRODUCTVERSION 1,5,6,0 PRODUCTVERSION 1,5,7,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -733,12 +738,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0" VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0" VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
VALUE "FileVersion", "1, 5, 6, 0\0" VALUE "FileVersion", "1, 5, 7, 0\0"
VALUE "InternalName", "Emu48\0" VALUE "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2014\0" VALUE "LegalCopyright", "Copyright © 2015\0"
VALUE "OriginalFilename", "Emu48.exe\0" VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0" VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 5, 6, 0\0" VALUE "ProductVersion", "1, 5, 7, 0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -824,6 +829,72 @@ BEGIN
END END
END END
IDM_MENU MENU DISCARDABLE
BEGIN
POPUP ""
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New...", ID_FILE_NEW
MENUITEM "&Open...", ID_FILE_OPEN
MENUITEM "&Save", ID_FILE_SAVE, GRAYED
MENUITEM "Save &As...", ID_FILE_SAVEAS, GRAYED
MENUITEM "&Close", ID_FILE_CLOSE, GRAYED
MENUITEM SEPARATOR
MENUITEM "S&ettings...", ID_VIEW_SETTINGS
MENUITEM SEPARATOR
MENUITEM "Recent File List", ID_FILE_MRU_FILE1
, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Load Object...", ID_OBJECT_LOAD
MENUITEM "&Save Object...", ID_OBJECT_SAVE
MENUITEM SEPARATOR
MENUITEM "C&opy Screen", ID_VIEW_COPY
MENUITEM "&Copy Stack", ID_STACK_COPY
MENUITEM "&Paste Stack", ID_STACK_PASTE
MENUITEM SEPARATOR
MENUITEM "&Reset Calculator", ID_VIEW_RESET, GRAYED
POPUP "&Backup"
BEGIN
MENUITEM "&Save", ID_BACKUP_SAVE
, GRAYED
MENUITEM "&Restore", ID_BACKUP_RESTORE
, GRAYED
MENUITEM "&Delete", ID_BACKUP_DELETE
, GRAYED
END
END
POPUP "&View"
BEGIN
MENUITEM "Change &KML Script...", ID_VIEW_SCRIPT
END
POPUP "&Tools"
BEGIN
MENUITEM "D&isassembler...", ID_TOOL_DISASM
MENUITEM "&Debugger...", ID_TOOL_DEBUG
MENUITEM SEPARATOR
POPUP "&Macro"
BEGIN
MENUITEM "&Record...", ID_TOOL_MACRO_RECORD
, GRAYED
MENUITEM "&Play...", ID_TOOL_MACRO_PLAY
, GRAYED
MENUITEM "&Stop", ID_TOOL_MACRO_STOP
, GRAYED
MENUITEM "S&ettings...", ID_TOOL_MACRO_SETTINGS
END
END
POPUP "&Help"
BEGIN
MENUITEM "&About Emu48...", ID_ABOUT
END
END
END
IDR_DEBUG MENU DISCARDABLE IDR_DEBUG MENU DISCARDABLE
BEGIN BEGIN
POPUP "&Debug" POPUP "&Debug"

View file

@ -5,8 +5,8 @@ LD=gcc
# This is to make GCC not bitch at things M$ allows # This is to make GCC not bitch at things M$ allows
CFLAGS= -Wall -Wno-missing-braces -Wno-format -Wno-uninitialized \ CFLAGS= -x c -O3 -Wall -Wno-missing-braces -Wno-format -Wno-uninitialized \
-Wno-strict-aliasing -Wno-unused-function -O3 -Wno-strict-aliasing -Wno-unused-function -Wno-unknown-pragmas
DEFINES= -DIDC_STATIC=-1 \ DEFINES= -DIDC_STATIC=-1 \
-DREGISTRY -DREGISTRY

View file

@ -34,7 +34,7 @@
#if !defined _ASSERT #if !defined _ASSERT
#define _ASSERT(a) #define _ASSERT(a)
#endif #endif
#define _CrtDumpMemoryLeaks() #define _CrtSetDbgFlag(f)
#if !defined VERIFY #if !defined VERIFY
#if defined _DEBUG #if defined _DEBUG

View file

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

Binary file not shown.