diff --git a/CARDCOPY.EXE b/CARDCOPY.EXE old mode 100644 new mode 100755 diff --git a/Convert.exe b/Convert.exe old mode 100644 new mode 100755 diff --git a/EMU48.EXE b/EMU48.EXE old mode 100644 new mode 100755 index 2b58f95..74a958c Binary files a/EMU48.EXE and b/EMU48.EXE differ diff --git a/EMU48.TXT b/EMU48.TXT index 3891576..3c52496 100644 --- a/EMU48.TXT +++ b/EMU48.TXT @@ -19,9 +19,9 @@ recompile the sources to run Emu48 with Windows NT on a DEC Alpha. **************** Emu48 is distributed in 1 archive: -- Emu48-1_30.zip All files and sources +- Emu48-1_35.zip All files and sources -To install Emu48, just unzip Emu48-1_30.zip into an empty directory. When you +To install Emu48, just unzip Emu48-1_35.zip into an empty directory. When you first run Emu48, it will detect the directory in which you installed it, and will write its configuration to a file named Emu48.ini in your Windows directory. If you move the Emu48 directory to another place you have to change @@ -416,7 +416,7 @@ or on the Emu48 FAQ at *************** Emu48 - An HP38/39/40/48/49 Emulator -Copyright (C) 2003 Sebastien Carlier & Christoph Gießelink +Copyright (C) 2005 Sebastien Carlier & Christoph Gießelink This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/Emu48.url b/Emu48.url new file mode 100644 index 0000000..352cc16 --- /dev/null +++ b/Emu48.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=http://privat.swol.de/ChristophGiesselink/ diff --git a/MKE48.EXE b/MKE48.EXE old mode 100644 new mode 100755 diff --git a/Macro/Mac2txt.exe b/Macro/Mac2txt.exe new file mode 100755 index 0000000..f21f06f Binary files /dev/null and b/Macro/Mac2txt.exe differ diff --git a/Macro/Mac2txt.txt b/Macro/Mac2txt.txt new file mode 100644 index 0000000..c52326d --- /dev/null +++ b/Macro/Mac2txt.txt @@ -0,0 +1,121 @@ +Mac2Txt - Keyboard Macro to Text File Converter +11/09/04 (c) by Christoph Gießelink, c dot giesselink at gmx dot de + + + *********** + * Mac2Txt * + *********** + +Mac2Txt is an emulator keyboard macro file converter for converting macro into +text files and vice versa. This allow to edit the keyboard macro files with a +simple text editor. + +1) Commands + +The text file knows three commands: + +P +R +T + +1.1)

ress key + +P + +means pressing a key, where is the out and is the in code of the key. +Please look into the latest KML description available at +http://privat.swol.de/ChristophGiesselink/ for the calculator dependent keyboard +Out/In codes. + +1.2) elease key + +R + +means releasing a key, where is the out and is the in code of the +key. + +1.3) ime for delay + +T + +means waiting milliseconds. You have delay times between every key state +changing especially when you have recorded them on an emulator. When the time +information is missing behind a

ress or elease command, the emulator is +using the default time of the keyboard macro settings in macro replay mode. So +it's a good idea to use "T 0" if you want to have no delay. In the other case, +if you don't want to switch between 'Real' and 'Manual' Replay speed and want to +have always 'Manual' speed it's a good idea to remove all time information in +the text file. The "T" command is alway ignored on 'Manual' Replay speed. + +Example + +T 821 +P 0 32767 +T 70 +R 0 32767 + +for waiting 821 ms, pressing the key, waiting for 70 ms and finally +releasing the key again. + + +2) Keyboard macro file format (MAC) + +All numbers are coded in the little endian format (LSB first). + +2.1) Header + +Every keyboard macro file begins with the string "Emu-KeyMacro". + +2.2) Extended Header + +The string header is followed by a reserved 4 byte length information number for +the extended header length and the extended header data. At this time the +extended header length information must be zero followed by no data. + +2.3) Data + +Each data field is coded in a 32 bit number. + +2.3.1) Time data + +Bit 31 = 1 +Bit 30 - 0 = time information in ms (2^31 ms ~ 25 days) + +2.3.2) Key data + +Bit 31 = 0 +Bit 30 - 24 = 0000000 = Release key +Bit 30 - 24 = 0000001 = Press key +Bit 23 - 16 = byte with the code +Bit 15 - 0 = word with the code + +All other not listed bit combinations of Bit 30 - 24 are forbidden and reserved +for further use. + + +3) Program description + +You have a source and destination edit field for holding the source and +destination file names. So the button for the source edit field is +calling a "Open" file dialog, where the button for the destination edit +field is calling a "Save As" file dialog. + +The button Dest> now converts the file in "source" to the opposite +format and save the result in "destination". For converting back to the original +format you can use the button Src>. This method is very flexible for +any conversation, for your own convenience you should only remember that there's +an "Open" file dialog behind Source-Browse button and a "Save As" file dialog +behind Destination-Browse button. + +Be careful, both convert buttons work without request and will overwrite the +destination immediately! + + + *************** + * LEGAL STUFF * + *************** + +Mac2Txt - Keyboard Macro to Text File Converter +Copyright (c) 2004 Christoph Gießelink + +This program is freeware. Use it at your own risk. diff --git a/MkShared.exe b/MkShared.exe old mode 100644 new mode 100755 diff --git a/PROBLEMS.TXT b/PROBLEMS.TXT index 19b419a..23ba718 100644 --- a/PROBLEMS.TXT +++ b/PROBLEMS.TXT @@ -1,4 +1,4 @@ -Known bugs and restrictions of Emu48 V1.35 +Known bugs and restrictions of Emu48 V1.37 ------------------------------------------ - the following I/O bits aren't emulated (incomplete) @@ -55,4 +55,4 @@ Known bugs and restrictions of Emu48 V1.35 - quitting the emulator while programming the flash isn't allowed, because the content of flash state machine isn't saved so far -08/31/04 (c) by Christoph Gießelink, c dot giesselink at gmx dot de +06/14/04 (c) by Christoph Gießelink, c dot giesselink at gmx dot de diff --git a/ROMDUMP.EXE b/ROMDUMP.EXE old mode 100644 new mode 100755 diff --git a/sources/Cardcopy/CARDCOPY.C b/Sources/Cardcopy/CARDCOPY.C similarity index 100% rename from sources/Cardcopy/CARDCOPY.C rename to Sources/Cardcopy/CARDCOPY.C diff --git a/sources/Cardcopy/CARDCOPY.DSP b/Sources/Cardcopy/CARDCOPY.DSP similarity index 100% rename from sources/Cardcopy/CARDCOPY.DSP rename to Sources/Cardcopy/CARDCOPY.DSP diff --git a/sources/Cardcopy/CARDCOPY.DSW b/Sources/Cardcopy/CARDCOPY.DSW similarity index 100% rename from sources/Cardcopy/CARDCOPY.DSW rename to Sources/Cardcopy/CARDCOPY.DSW diff --git a/sources/Cardcopy/TYPES.H b/Sources/Cardcopy/TYPES.H similarity index 100% rename from sources/Cardcopy/TYPES.H rename to Sources/Cardcopy/TYPES.H diff --git a/sources/Convert/CONVERT.MAK b/Sources/Convert/CONVERT.MAK similarity index 100% rename from sources/Convert/CONVERT.MAK rename to Sources/Convert/CONVERT.MAK diff --git a/sources/Convert/CONVERT.MDP b/Sources/Convert/CONVERT.MDP similarity index 100% rename from sources/Convert/CONVERT.MDP rename to Sources/Convert/CONVERT.MDP diff --git a/sources/Convert/MAIN.C b/Sources/Convert/MAIN.C similarity index 100% rename from sources/Convert/MAIN.C rename to Sources/Convert/MAIN.C diff --git a/sources/Emu48/CHANGES.TXT b/Sources/Emu48/CHANGES.TXT similarity index 91% rename from sources/Emu48/CHANGES.TXT rename to Sources/Emu48/CHANGES.TXT index e8bf2ca..adc64e6 100644 --- a/sources/Emu48/CHANGES.TXT +++ b/Sources/Emu48/CHANGES.TXT @@ -1,3 +1,167 @@ +Service Pack 37 for Emu48 Version 1.0 + +DDESERV.C +- changed function DdeCallback(), removed delays after ON key state + change + +EMU48.C +- changed function SettingsProc(), added IDC_PORT2LOAD button + handling +- changed function OnStackPaste(), minor code optimization +- changed function OnDropFiles(), OnStackPaste() and OnObjectLoad(), + removed delays after ON key state change +- bugfix in function WinMain(), szCurrentKml wasn't initialized + +EMU48.RC +- added "..." button Settings dialog +- changed version + +ENGINE.C +- bugfix in function UpdateKdnBit(), wrong DWORD truncation of + Chipset.cycles variable + +FILES.C +- changed function WriteStack(), minor optimization when saving as + string +- bugfix in function OpenDocument(), check for empty KML file name + was wrong, so the error handler of the following InitKML() was + always called in this case +- changed function LoadObject(), file access is now shared +- changed function DibNumColors() and CreateBIPalette(), changed + argument qualifier + +KML.C +- changed variable qualifier of eIsBlock[] table and removed + TOK_NONE item from it +- bugfix, global variables pKml and pKmlList hadn't be initialized +- removed usage of global variables bKmlLogOkEnabled and nKmlFiles +- changed function AddToLog(), changed argument qualifier and minor + code optimization +- changed function PrintfToLog(), use a local buffer instead of the + heap for the output buffer of the wvsprintf() function, this helps + to reduce fragmentation of the heap +- changed function KMLLogProc(), minor code optimization and removed + use of global variable bKmlLogOkEnabled and windows redraw in the + WM_INITDIALOG case +- changed function DisplayKMLLog(), removed use of global variable + bKmlLogOkEnabled and transfer state of bOkEnabled over the lParam + argument to the dialog box procedure +- bugfix in function CreateKmlList(), fixed a memory leak in the + case of no title +- changed function ChooseKMLProc(), minor code optimization +- changed function IsBlock(), minor code optimization +- bugfix in function ParseString(), fixed memory leak in error case + and optimized implementation +- changed function IncludeLines(), IncludeBlocks(), LoadKMLGlobal() + and InitKML(), file access is now shared + +OPS.H +- bugfix in function Nsub() and Nrsub(), in some situations wrong + results in dec mode with illegal decimal number entry as 2nd + operator + +RESOURCE.H +- added definition + +TIMER.C +- bugfix in function RescheduleT2(), better accuracy on conversation + of timer2 ticks into multimedia timer ms +- changed function StartTimers(), added calculation of maximum + timer2 ticks that can be handled by one timer event +- changed function StartTimers() and StopTimers(), changed + multimedia timer to best possible timer resolution instead of + risking to fail with 1 ms resolution preset + + +Service Pack 36 for Emu48 Version 1.0 + +CHECKBOX.BMP +- fixed one pixel with wrong color + +DEBUGGER.C +- bugfix in function Debugger(), used function to set icon which + hasn't worked properly under WinXP + +DISPLAY.C +- changed function UpdateMenuDisplay(), minor code optimizations +- changed function WriteToMenuDisplay(), code optimizations + +EMU48.C +- changed function UpdateWindowStatus(), added macro specific menu + control +- changed function CopyItemsToClipboard(), simplified implementation + in UNICODE mode by saving the data in the CF_UNICODETEXT format +- changed function OnLButtonDown(), OnLButtonUp(), OnMouseMove(), + OnKeyDown() and OnKeyUp(), disable function handling when in macro + play mode +- changed function MainWndProc(), added some macro handler functions + +EMU48.DSP +- added keymacro.c sources + +EMU48.H +- extern declaration of global variables and functions + +EMU48.RC +- changed "Always" checkbox in "KML Script Compilation Result" + dialog from a pushlike to normal one for better readability under + WinXP style +- added "Macro Settings" dialog +- added Menuitem Tools "Macro..." +- changed version and copyright + +ENGINE.C +- bugfix in function AdjustSpeed(), on large operations the + workaround condition for Win2k was detected and the following + synchronizing failed because the CPU didn't got the free running + cycles for the waited time +- changed function WorkerThread(), close running keyboard macros + when switching into invalid state + +FILES.C +- changed function MapRom(), added detection for packed ROM images +- bugfix in function OpenDocument(), reload KML button state from + last document close + +KEYBOARD.C +- changed function KeyboardEvent(), added call to key recording + function KeyMacroRecord() +- bugfix in function KeyboardEvent(), prevent buffer overflow with + too big out codes on Chipset.Keyboard_Row array + +KEYMACRO.C +- new modul supporting keyboard macro functions + +KML.C +- added function ReloadButtons(), update internal button state from + chip keyboard matrix content +- added function PlayKey(), handle button with OutIn code + +KML.H +- added ReloadButtons() and PlayKey() function prototype + +MOPS.C +- bugfix in function WriteIO(), writing to timer2 failed if first + writing address was before the timer2 address area +- changed function WriteIO(), changing the CONTRLSB (0x101) or the + DISPTEST (0x102) register doesn't effect any display pointer, so + update request for recalculating the pointers removed + +OPCODES.C +- bugfix in function o802() and o803(), the r=IN opcodes work also + on odd addresses in the IO register memory mapping area + +PCH.H +- added VERIFY macro + +RESOURCE.H +- added several definitions + +SETTINGS.C +- changed function ReadSettings() and WriteSettings(), added section + [Macro] in INI-File + + Service Pack 35 for Emu48 Version 1.0 DDESERV.C diff --git a/sources/Emu48/CHECKBOX.BMP b/Sources/Emu48/CHECKBOX.BMP similarity index 76% rename from sources/Emu48/CHECKBOX.BMP rename to Sources/Emu48/CHECKBOX.BMP index b3945ec..d7cfb44 100644 Binary files a/sources/Emu48/CHECKBOX.BMP and b/Sources/Emu48/CHECKBOX.BMP differ diff --git a/sources/Emu48/COLOR.H b/Sources/Emu48/COLOR.H similarity index 100% rename from sources/Emu48/COLOR.H rename to Sources/Emu48/COLOR.H diff --git a/sources/Emu48/CURSOR.C b/Sources/Emu48/CURSOR.C similarity index 100% rename from sources/Emu48/CURSOR.C rename to Sources/Emu48/CURSOR.C diff --git a/sources/Emu48/DBGTOOL.BMP b/Sources/Emu48/DBGTOOL.BMP similarity index 100% rename from sources/Emu48/DBGTOOL.BMP rename to Sources/Emu48/DBGTOOL.BMP diff --git a/sources/Emu48/DDESERV.C b/Sources/Emu48/DDESERV.C similarity index 95% rename from sources/Emu48/DDESERV.C rename to Sources/Emu48/DDESERV.C index 77dfd73..55a985c 100644 --- a/sources/Emu48/DDESERV.C +++ b/Sources/Emu48/DDESERV.C @@ -53,7 +53,6 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv, { // turn on HP KeyboardEvent(TRUE,0,0x8000); - Sleep(200); KeyboardEvent(FALSE,0,0x8000); } @@ -86,7 +85,6 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv, } KeyboardEvent(TRUE,0,0x8000); - Sleep(200); KeyboardEvent(FALSE,0,0x8000); // wait for sleep mode while(Chipset.Shutdn == FALSE) Sleep(0); diff --git a/sources/Emu48/DEBUGGER.C b/Sources/Emu48/DEBUGGER.C similarity index 96% rename from sources/Emu48/DEBUGGER.C rename to Sources/Emu48/DEBUGGER.C index 70ec702..cdae778 100644 --- a/sources/Emu48/DEBUGGER.C +++ b/Sources/Emu48/DEBUGGER.C @@ -1675,7 +1675,7 @@ static BOOL CALLBACK Debugger(HWND hDlg, UINT message, DWORD wParam, LONG lParam { case WM_INITDIALOG: SetWindowLocation(hDlg,nDbgPosX,nDbgPosY); - SetClassLong(hDlg,GCL_HICON,(LONG) LoadIcon(hApp,MAKEINTRESOURCE(IDI_EMU48))); + SendMessage(hDlg,WM_SETICON,ICON_BIG,(LPARAM) LoadIcon(hApp,MAKEINTRESOURCE(IDI_EMU48))); hWndToolbar = CreateToolbar(hDlg); // add toolbar CheckMenuItem(GetMenu(hDlg),ID_BREAKPOINTS_NOP3, bDbgNOP3 ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(GetMenu(hDlg),ID_BREAKPOINTS_DOCODE,bDbgCode ? MF_CHECKED : MF_UNCHECKED); diff --git a/sources/Emu48/DEBUGGER.H b/Sources/Emu48/DEBUGGER.H similarity index 100% rename from sources/Emu48/DEBUGGER.H rename to Sources/Emu48/DEBUGGER.H diff --git a/sources/Emu48/DISASM.C b/Sources/Emu48/DISASM.C similarity index 100% rename from sources/Emu48/DISASM.C rename to Sources/Emu48/DISASM.C diff --git a/sources/Emu48/DISPLAY.C b/Sources/Emu48/DISPLAY.C similarity index 87% rename from sources/Emu48/DISPLAY.C rename to Sources/Emu48/DISPLAY.C index 0ff2b56..cb147e9 100644 --- a/sources/Emu48/DISPLAY.C +++ b/Sources/Emu48/DISPLAY.C @@ -152,10 +152,8 @@ VOID CreateLcdBitmap(VOID) bmiLcd.Lcd_bmih.biWidth = LCD_ROW * nLcdZoom; bmiLcd.Lcd_bmih.biHeight = -64 * nLcdZoom; _ASSERT(hLcdDC == NULL); - hLcdDC = CreateCompatibleDC(hWindowDC); - _ASSERT(hLcdDC != NULL); - hLcdBitmap = CreateDIBSection(hLcdDC,(BITMAPINFO*)&bmiLcd,DIB_RGB_COLORS,(VOID **)&pbyLcd,NULL,0); - _ASSERT(hLcdBitmap != NULL); + VERIFY(hLcdDC = CreateCompatibleDC(hWindowDC)); + VERIFY(hLcdBitmap = CreateDIBSection(hLcdDC,(BITMAPINFO*)&bmiLcd,DIB_RGB_COLORS,(VOID **)&pbyLcd,NULL,0)); hLcdBitmap = SelectObject(hLcdDC,hLcdBitmap); _ASSERT(hPalette != NULL); SelectPalette(hLcdDC,hPalette,FALSE); // set palette for LCD DC @@ -185,11 +183,8 @@ VOID DestroyLcdBitmap(VOID) BOOL CreateMainBitmap(LPCTSTR szFilename) { - HPALETTE hAssertPalette; - _ASSERT(hWindowDC != NULL); - hMainDC = CreateCompatibleDC(hWindowDC); - _ASSERT(hMainDC != NULL); + VERIFY(hMainDC = CreateCompatibleDC(hWindowDC)); if (hMainDC == NULL) return FALSE; // quit if failed hMainBitmap = LoadBitmapFile(szFilename); if (hMainBitmap == NULL) @@ -199,8 +194,7 @@ BOOL CreateMainBitmap(LPCTSTR szFilename) } hMainBitmap = SelectObject(hMainDC,hMainBitmap); _ASSERT(hPalette != NULL); - hAssertPalette = SelectPalette(hMainDC,hPalette,FALSE); - _ASSERT(hAssertPalette != NULL); + VERIFY(SelectPalette(hMainDC,hPalette,FALSE)); RealizePalette(hMainDC); return TRUE; } @@ -371,13 +365,15 @@ VOID UpdateMenuDisplay(VOID) for (y = nLines; y < 64; ++y) { Npeek(Buf,d+Chipset.start2,34); // 34 nibbles are viewed - for (x = 0; x < 36; ++x) // every 4 pixel + for (x = 0; x < 34; ++x) // every 4 pixel { DIBPIXEL(p,Pattern[Buf[x]&1]); DIBPIXEL(p,Pattern[(Buf[x]>>1) & 1]); DIBPIXEL(p,Pattern[(Buf[x]>>2) & 1]); DIBPIXEL(p,Pattern[(Buf[x]>>3) & 1]); } + // adjust pointer to 36 DIBPIXEL drawing calls + p += (36-34) * 4 * sizeof(DWORD); CopyMemory(p, p-LCD_ROW*4, LCD_ROW*4); p+=LCD_ROW*4; CopyMemory(p, p-LCD_ROW*8, LCD_ROW*8); @@ -390,11 +386,13 @@ VOID UpdateMenuDisplay(VOID) for (y = nLines; y < 64; ++y) { Npeek(Buf,d+Chipset.start2,34); // 34 nibbles are viewed - for (x = 0; x < 36; ++x) // every 4 pixel + for (x = 0; x < 34; ++x) // every 4 pixel { DIBPIXEL(p,Pattern[Buf[x]&3]); DIBPIXEL(p,Pattern[Buf[x]>>2]); } + // adjust pointer to 36 DIBPIXEL drawing calls + p += (36-34) * 2 * sizeof(DWORD); CopyMemory(p, p-LCD_ROW*2, LCD_ROW*2); p+=LCD_ROW*2; d+=34; @@ -405,10 +403,12 @@ VOID UpdateMenuDisplay(VOID) for (y = nLines; y < 64; ++y) { Npeek(Buf,d+Chipset.start2,34); // 34 nibbles are viewed - for (x = 0; x < 36; ++x) // every 4 pixel + for (x = 0; x < 34; ++x) // every 4 pixel { DIBPIXEL(p,Pattern[Buf[x]]); } + // adjust pointer to 36 DIBPIXEL drawing calls + p += (36-34) * 1 * sizeof(DWORD); d+=34; } } @@ -582,23 +582,14 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s) p=(DWORD*)(pbyLcd+y*LCD_ROW*16); } else p+=4; } - EnterCriticalSection(&csGDILock); // solving NT GDI problems + if (y0!=y) // modified more than 1 line { - if (y0!=y) - { - y0<<=2; y<<=2; - BitBlt(hWindowDC, nLcdX, nLcdY+y0, 524, y-y0+4, hLcdDC, 0, y0, SRCCOPY); - } - else - { - x0<<=4; x<<=4; - y0<<=2; y<<=2; - if (x>524) x=524; - BitBlt(hWindowDC, nLcdX+x0, nLcdY+y0, x-x0, y-y0+4, hLcdDC, x0, y0, SRCCOPY); - } - GdiFlush(); + x = 34; // full line + x0 = 0; // no offset } - LeaveCriticalSection(&csGDILock); + x0<<=4; x<<=4; // calculate pixel address + y0<<=2; y<<=2; + if (x>524) x=524; } if (nLcdZoom == 2) { @@ -620,23 +611,14 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s) p=(DWORD*)(pbyLcd+y*LCD_ROW*4); } else p+=2; } - EnterCriticalSection(&csGDILock); // solving NT GDI problems + if (y0!=y) // modified more than 1 line { - if (y0!=y) - { - y0<<=1; y<<=1; - BitBlt(hWindowDC, nLcdX, nLcdY+y0, 262, y-y0+2, hLcdDC, 0, y0, SRCCOPY); - } - else - { - x0<<=3; x<<=3; - y0<<=1; y<<=1; - if (x>262) x=262; - BitBlt(hWindowDC, nLcdX+x0, nLcdY+y0, x-x0, y-y0+2, hLcdDC, x0, y0, SRCCOPY); - } - GdiFlush(); + x = 34; // full line + x0 = 0; // no offset } - LeaveCriticalSection(&csGDILock); + x0<<=3; x<<=3; // calculate pixel address + y0<<=1; y<<=1; + if (x>262) x=262; } if (nLcdZoom == 1) { @@ -654,22 +636,21 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s) p=(DWORD*)(pbyLcd+y*LCD_ROW); } else p++; } - EnterCriticalSection(&csGDILock); // solving NT GDI problems + if (y0!=y) // modified more than 1 line { - if (y0!=y) - { - BitBlt(hWindowDC, nLcdX, nLcdY+y0, 131, y-y0+1, hLcdDC, 0, y0, SRCCOPY); - } - else - { - x0<<=2; x<<=2; - if (x>131) x=131; - BitBlt(hWindowDC, nLcdX+x0, nLcdY+y0, x-x0, y-y0+1, hLcdDC, x0, y0, SRCCOPY); - } - GdiFlush(); + x = 34; // full line + x0 = 0; // no offset } - LeaveCriticalSection(&csGDILock); + x0<<=2; x<<=2; // calculate pixel address + if (x>131) x=131; } + + EnterCriticalSection(&csGDILock); // solving NT GDI problems + { + BitBlt(hWindowDC, nLcdX+x0, nLcdY+y0, x-x0, y-y0+nLcdZoom, hLcdDC, x0, y0, SRCCOPY); + GdiFlush(); + } + LeaveCriticalSection(&csGDILock); #endif return; } @@ -784,8 +765,7 @@ VOID StartDisplay(BYTE byInitial) // adjust startup counter to get the right VBL value lLcdRef.QuadPart -= ((LONGLONG) ((0x7E - byInitial) & 0x3F) * lFreq.QuadPart) >> 12; - uLcdTimerId = timeSetEvent(DISPLAY_FREQ,0,(LPTIMECALLBACK)&LcdProc,0,TIME_PERIODIC); - _ASSERT(uLcdTimerId); // test if display update timer started + VERIFY(uLcdTimerId = timeSetEvent(DISPLAY_FREQ,0,(LPTIMECALLBACK)&LcdProc,0,TIME_PERIODIC)); } return; } diff --git a/sources/Emu48/EMU48.C b/Sources/Emu48/EMU48.C similarity index 88% rename from sources/Emu48/EMU48.C rename to Sources/Emu48/EMU48.C index e4c4030..66891c1 100644 --- a/sources/Emu48/EMU48.C +++ b/Sources/Emu48/EMU48.C @@ -13,7 +13,7 @@ #include "kml.h" #include "debugger.h" -#define VERSION "1.35" +#define VERSION "1.37" #define CF_HPOBJ "CF_HPOBJ" // clipboard format for DDE #define MAXPORTS 256 // number of COM ports @@ -139,6 +139,9 @@ VOID UpdateWindowStatus(VOID) EnableMenuItem(hMenu,ID_VIEW_SCRIPT,uRun); EnableMenuItem(hMenu,ID_TOOL_DISASM,uRun); EnableMenuItem(hMenu,ID_TOOL_DEBUG,(bRun && nDbgState == DBG_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_STOP,(bRun && nMacroState != MACRO_OFF) ? MF_ENABLED : MF_GRAYED); } return; } @@ -162,6 +165,7 @@ VOID CopyItemsToClipboard(HWND hWnd) // save selected Listbox Items to Clipboar if ((lpnCount = HeapAlloc(hHeap,0,i * sizeof(INT))) != NULL) { + LPTSTR lpszData; HANDLE hClipObj; LONG j,lMem = 0; @@ -169,49 +173,32 @@ VOID CopyItemsToClipboard(HWND hWnd) // save selected Listbox Items to Clipboar i = SendMessage(hWnd,LB_GETSELITEMS,i,(LPARAM) lpnCount); for (j = 0;j < i;++j) // scan all selected items { - // calculate total amount of needed memory + // calculate total amount of characters lMem += SendMessage(hWnd,LB_GETTEXTLEN,lpnCount[j],0) + 2; } // allocate clipboard data - if ((hClipObj = GlobalAlloc(GMEM_MOVEABLE,lMem + 1)) != NULL) + if ((hClipObj = GlobalAlloc(GMEM_MOVEABLE,(lMem + 1) * sizeof(*lpszData))) != NULL) { - LPBYTE lpData; - - if ((lpData = GlobalLock(hClipObj))) + if ((lpszData = GlobalLock(hClipObj))) { for (j = 0;j < i;++j) // scan all selected items { - #if defined _UNICODE - { - INT nLength = SendMessage(hWnd,LB_GETTEXTLEN,lpnCount[j],0) + 1; - - LPTSTR szTmp = HeapAlloc(hHeap,0,nLength * sizeof(szTmp[0])); - if (szTmp != NULL) - { - SendMessage(hWnd,LB_GETTEXT,lpnCount[j],(LPARAM) szTmp); - WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, - szTmp, nLength, - lpData, nLength, NULL, NULL); - HeapFree(hHeap,0,szTmp); - lpData += nLength - 1; - } - } - #else - { - lpData += SendMessage(hWnd,LB_GETTEXT,lpnCount[j],(LPARAM) lpData); - } - #endif - *lpData++ = '\r'; - *lpData++ = '\n'; + lpszData += SendMessage(hWnd,LB_GETTEXT,lpnCount[j],(LPARAM) lpszData); + *lpszData++ = _T('\r'); + *lpszData++ = _T('\n'); } - *lpData = 0; // set end of string + *lpszData = 0; // set EOS GlobalUnlock(hClipObj); // unlock memory } if (OpenClipboard(hWnd)) { if (EmptyClipboard()) - SetClipboardData(CF_TEXT,hClipObj); + #if defined _UNICODE + SetClipboardData(CF_UNICODETEXT,hClipObj); + #else + SetClipboardData(CF_TEXT,hClipObj); + #endif else GlobalFree(hClipObj); CloseClipboard(); @@ -255,8 +242,7 @@ static VOID SetCommList(HWND hDlg,int nIDDlgItem,LPCTSTR szSetting) hComm = CreateFile(szBuffer,GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL); if(hComm != INVALID_HANDLE_VALUE) { - BOOL bError = CloseHandle(hComm); - _ASSERT(bError); + VERIFY(CloseHandle(hComm)); bAdd = TRUE; } @@ -329,11 +315,30 @@ static BOOL CALLBACK SettingsProc(HWND hDlg, UINT message, DWORD wParam, LONG lP // hide port2 settings EnableWindow(GetDlgItem(hDlg,IDC_PORT2ISSHARED),FALSE); EnableWindow(GetDlgItem(hDlg,IDC_PORT2),FALSE); + EnableWindow(GetDlgItem(hDlg,IDC_PORT2LOAD),FALSE); } return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { + case IDC_PORT2LOAD: + if (GetLoadObjectFilename()) + { + TCHAR szFilename[MAX_PATH]; + LPTSTR lpFilePart; + + // check if file path and Emu48 directory path is identical + if (GetFullPathName(szBufferFilename,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart)) + { + *(lpFilePart-1) = 0; // devide path and name + + // name is in the Emu48 directory -> use only name + if (lstrcmpi(szEmuDirectory,szFilename) == 0) + lstrcpy(szBufferFilename,lpFilePart); + } + SetDlgItemText(hDlg,IDC_PORT2,szBufferFilename); + } + return TRUE; case IDOK: if (Chipset.Port1Size && cCurrentRomType!='X') { @@ -355,7 +360,6 @@ static BOOL CALLBACK SettingsProc(HWND hDlg, UINT message, DWORD wParam, LONG lP && (Chipset.IORam[CARDCTL] & ECDT) != 0 && (Chipset.IORam[TIMER2_CTRL] & RUN) != 0 ) { - Chipset.HST |= MP; // set Module Pulled IOBit(SRQ2,NINT,FALSE); // set NINT to low Chipset.SoftInt = TRUE; // set interrupt @@ -569,9 +573,7 @@ static LRESULT OnDropFiles(HANDLE hFilesInfo) { // turn on HP KeyboardEvent(TRUE,0,0x8000); - Sleep(200); KeyboardEvent(FALSE,0,0x8000); - Sleep(200); } _ASSERT(nState == SM_RUN); // emulator must be in RUN state @@ -603,7 +605,6 @@ static LRESULT OnDropFiles(HANDLE hFilesInfo) goto cancel; KeyboardEvent(TRUE,0,0x8000); - Sleep(200); KeyboardEvent(FALSE,0,0x8000); // wait for sleep mode while(Chipset.Shutdn == FALSE) Sleep(0); @@ -805,6 +806,13 @@ static LRESULT OnStackPaste(VOID) // paste data to stack BOOL bSuccess = FALSE; + // check if clipboard format is available + if (!IsClipboardFormatAvailable(CF_TEXT)) + { + MessageBeep(MB_OK); // error beep + return 0; + } + SuspendDebugger(); // suspend debugger bDbgAutoStateCtrl = FALSE; // disable automatic debugger state control @@ -812,9 +820,8 @@ static LRESULT OnStackPaste(VOID) // paste data to stack if (!(Chipset.IORam[BITOFFSET]&DON)) { KeyboardEvent(TRUE,0,0x8000); - Sleep(200); KeyboardEvent(FALSE,0,0x8000); - Sleep(200); + // wait for sleep mode while(Chipset.Shutdn == FALSE) Sleep(0); } @@ -830,28 +837,20 @@ static LRESULT OnStackPaste(VOID) // paste data to stack if (OpenClipboard(hWnd)) { - if ( IsClipboardFormatAvailable(CF_TEXT) - || IsClipboardFormatAvailable(CF_OEMTEXT)) + if ((hClipObj = GetClipboardData(CF_TEXT))) { - if ((hClipObj = GetClipboardData(CF_TEXT))) + if ((lpClipdata = GlobalLock(hClipObj))) { - if ((lpClipdata = GlobalLock(hClipObj))) + DWORD dwSize = strlen(lpClipdata); + if ((lpData = HeapAlloc(hHeap,0,dwSize * 2))) { - DWORD dwSize = strlen(lpClipdata); - if ((lpData = HeapAlloc(hHeap,0,dwSize * 2))) - { - memcpy(lpData+dwSize,lpClipdata,dwSize); // copy data - bSuccess = (WriteStack(lpData,dwSize) == S_ERR_NO); - HeapFree(hHeap,0,lpData); - } - GlobalUnlock(hClipObj); + memcpy(lpData+dwSize,lpClipdata,dwSize); // copy data + bSuccess = (WriteStack(lpData,dwSize) == S_ERR_NO); + HeapFree(hHeap,0,lpData); } + GlobalUnlock(hClipObj); } } - else // unknown clipboard format - { - MessageBeep(MB_OK); // error beep - } CloseClipboard(); } @@ -863,7 +862,6 @@ static LRESULT OnStackPaste(VOID) // paste data to stack goto cancel; KeyboardEvent(TRUE,0,0x8000); - Sleep(200); KeyboardEvent(FALSE,0,0x8000); // wait for sleep mode @@ -1095,9 +1093,8 @@ static LRESULT OnObjectLoad(VOID) if (!(Chipset.IORam[BITOFFSET]&DON)) { KeyboardEvent(TRUE,0,0x8000); - Sleep(200); KeyboardEvent(FALSE,0,0x8000); - Sleep(200); + // wait for sleep mode while(Chipset.Shutdn == FALSE) Sleep(0); } @@ -1152,7 +1149,6 @@ static LRESULT OnObjectLoad(VOID) while (nState!=nNextState) Sleep(0); _ASSERT(nState == SM_RUN); KeyboardEvent(TRUE,0,0x8000); - Sleep(200); KeyboardEvent(FALSE,0,0x8000); while(Chipset.Shutdn == FALSE) Sleep(0); @@ -1329,24 +1325,28 @@ static LRESULT OnAbout(VOID) static LRESULT OnLButtonDown(UINT nFlags, WORD x, WORD y) { + if (nMacroState == MACRO_PLAY) return 0; // playing macro if (nState == SM_RUN) MouseButtonDownAt(nFlags, x,y); return 0; } static LRESULT OnLButtonUp(UINT nFlags, WORD x, WORD y) { + if (nMacroState == MACRO_PLAY) return 0; // playing macro if (nState == SM_RUN) MouseButtonUpAt(nFlags, x,y); return 0; } static LRESULT OnMouseMove(UINT nFlags, WORD x, WORD y) { + if (nMacroState == MACRO_PLAY) return 0; // playing macro if (nState == SM_RUN) MouseMovesTo(nFlags, x,y); return 0; } static LRESULT OnKeyDown(int nVirtKey, DWORD lKeyData) { + if (nMacroState == MACRO_PLAY) return 0; // playing macro // call RunKey() only once (suppress autorepeat feature) if (nState == SM_RUN && (lKeyData & 0x40000000) == 0) RunKey((BYTE)nVirtKey, TRUE); @@ -1355,6 +1355,7 @@ static LRESULT OnKeyDown(int nVirtKey, DWORD lKeyData) static LRESULT OnKeyUp(int nVirtKey, DWORD lKeyData) { + if (nMacroState == MACRO_PLAY) return 0; // playing macro if (nState == SM_RUN) RunKey((BYTE)nVirtKey, FALSE); return 0; UNREFERENCED_PARAMETER(lKeyData); @@ -1396,26 +1397,30 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_COMMAND: switch (LOWORD(wParam)) { - case ID_FILE_NEW: return OnFileNew(); - case ID_FILE_OPEN: return OnFileOpen(); - case ID_FILE_SAVE: return OnFileSave(); - case ID_FILE_SAVEAS: return OnFileSaveAs(); - case ID_FILE_CLOSE: return OnFileClose(); - case ID_FILE_EXIT: return OnFileExit(); - case ID_STACK_COPY: return OnStackCopy(); - case ID_STACK_PASTE: return OnStackPaste(); - case ID_VIEW_COPY: return OnViewCopy(); - case ID_VIEW_RESET: return OnViewReset(); - case ID_VIEW_SETTINGS: return OnViewSettings(); - case ID_VIEW_SCRIPT: return OnViewScript(); - case ID_BACKUP_SAVE: return OnBackupSave(); - case ID_BACKUP_RESTORE:return OnBackupRestore(); - case ID_BACKUP_DELETE: return OnBackupDelete(); - case ID_OBJECT_LOAD: return OnObjectLoad(); - case ID_OBJECT_SAVE: return OnObjectSave(); - case ID_TOOL_DISASM: return OnToolDisasm(); - case ID_TOOL_DEBUG: return OnToolDebug(); - case ID_ABOUT: return OnAbout(); + case ID_FILE_NEW: return OnFileNew(); + case ID_FILE_OPEN: return OnFileOpen(); + case ID_FILE_SAVE: return OnFileSave(); + case ID_FILE_SAVEAS: return OnFileSaveAs(); + case ID_FILE_CLOSE: return OnFileClose(); + case ID_FILE_EXIT: return OnFileExit(); + case ID_STACK_COPY: return OnStackCopy(); + case ID_STACK_PASTE: return OnStackPaste(); + case ID_VIEW_COPY: return OnViewCopy(); + case ID_VIEW_RESET: return OnViewReset(); + case ID_VIEW_SETTINGS: return OnViewSettings(); + case ID_VIEW_SCRIPT: return OnViewScript(); + case ID_BACKUP_SAVE: return OnBackupSave(); + case ID_BACKUP_RESTORE: return OnBackupRestore(); + case ID_BACKUP_DELETE: return OnBackupDelete(); + case ID_OBJECT_LOAD: return OnObjectLoad(); + case ID_OBJECT_SAVE: return OnObjectSave(); + case ID_TOOL_DISASM: return OnToolDisasm(); + case ID_TOOL_DEBUG: return OnToolDebug(); + case ID_TOOL_MACRO_RECORD: return OnToolMacroNew(); + case ID_TOOL_MACRO_PLAY: return OnToolMacroPlay(); + case ID_TOOL_MACRO_STOP: return OnToolMacroStop(); + case ID_TOOL_MACRO_SETTINGS: return OnToolMacroSettings(); + case ID_ABOUT: return OnAbout(); } break; case WM_SYSCOMMAND: @@ -1506,6 +1511,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC QueryPerformanceCounter(&lAppStart); GetCurrentDirectory(ARRAYSIZEOF(szCurrentDirectory), szCurrentDirectory); + szCurrentKml[0] = 0; // no KML file selected ReadSettings(); diff --git a/sources/Emu48/EMU48.DSP b/Sources/Emu48/EMU48.DSP similarity index 95% rename from sources/Emu48/EMU48.DSP rename to Sources/Emu48/EMU48.DSP index 9b50aab..dcdb6e8 100644 --- a/sources/Emu48/EMU48.DSP +++ b/Sources/Emu48/EMU48.DSP @@ -7,21 +7,21 @@ CFG=Emu48 - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "Emu48.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "Emu48.mak" CFG="Emu48 - Win32 Release" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "Emu48 - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Release Unicode" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Debug Unicode" (based on "Win32 (x86) Application") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -137,7 +137,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 -!ENDIF +!ENDIF # Begin Target @@ -202,6 +202,10 @@ SOURCE=.\keyboard.c # End Source File # Begin Source File +SOURCE=.\keymacro.c +# End Source File +# Begin Source File + SOURCE=.\kml.c # End Source File # Begin Source File diff --git a/sources/Emu48/EMU48.DSW b/Sources/Emu48/EMU48.DSW similarity index 100% rename from sources/Emu48/EMU48.DSW rename to Sources/Emu48/EMU48.DSW diff --git a/sources/Emu48/EMU48.H b/Sources/Emu48/EMU48.H similarity index 93% rename from sources/Emu48/EMU48.H rename to Sources/Emu48/EMU48.H index c2efde0..d1846a4 100644 --- a/sources/Emu48/EMU48.H +++ b/Sources/Emu48/EMU48.H @@ -55,6 +55,10 @@ #define VIEW_SHORT FALSE // view of disassembler output #define VIEW_LONG TRUE +#define MACRO_OFF 0 // macro recorder off +#define MACRO_NEW 1 +#define MACRO_PLAY 2 + #define DISP_POINTER 0x01 // defines for display area #define DISP_MAIN 0x02 #define DISP_MENUE 0x04 @@ -260,6 +264,16 @@ extern VOID WriteIO(BYTE *a, DWORD b, DWORD s); extern VOID ScanKeyboard(BOOL bActive, BOOL bReset); extern VOID KeyboardEvent(BOOL bPress, UINT out, UINT in); +// Keymacro.c +extern INT nMacroState; +extern INT nMacroTimeout; +extern BOOL bMacroRealSpeed; +extern VOID KeyMacroRecord(BOOL bPress, UINT out, UINT in); +extern LRESULT OnToolMacroNew(VOID); +extern LRESULT OnToolMacroPlay(VOID); +extern LRESULT OnToolMacroStop(VOID); +extern LRESULT OnToolMacroSettings(VOID); + // RPL.c extern DWORD RPL_SkipOb(DWORD d); extern DWORD RPL_ObjectSize(BYTE *o); diff --git a/sources/Emu48/EMU48.ICO b/Sources/Emu48/EMU48.ICO similarity index 100% rename from sources/Emu48/EMU48.ICO rename to Sources/Emu48/EMU48.ICO diff --git a/sources/Emu48/EMU48.RC b/Sources/Emu48/EMU48.RC similarity index 90% rename from sources/Emu48/EMU48.RC rename to Sources/Emu48/EMU48.RC index a1fb3b6..064f8b4 100644 --- a/sources/Emu48/EMU48.RC +++ b/Sources/Emu48/EMU48.RC @@ -140,6 +140,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 162 END + + IDD_MACROSET, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 149 + TOPMARGIN, 7 + BOTTOMMARGIN, 74 + END END #endif // APSTUDIO_INVOKED @@ -217,7 +225,7 @@ FONT 8, "MS Sans Serif" BEGIN ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP - LTEXT "Copyright © 2004 Sébastien Carlier && Christoph Gießelink", + LTEXT "Copyright © 2005 Sébastien Carlier && Christoph Gießelink", IDC_STATIC,29,18,181,8 DEFPUSHBUTTON "OK",IDOK,215,12,39,14 EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL | @@ -252,7 +260,8 @@ BEGIN CONTROL "Port 2 is Shared",IDC_PORT2ISSHARED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,13,131,65,10 LTEXT "Port 2 File :",IDC_STATIC,13,147,37,8 - EDITTEXT IDC_PORT2,51,144,104,12,ES_AUTOHSCROLL + EDITTEXT IDC_PORT2,51,144,94,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_PORT2LOAD,145,144,10,12 GROUPBOX "Memory Cards",IDC_STATIC,7,110,153,51 LTEXT "Wire:",IDC_STATIC,13,176,17,8 COMBOBOX IDC_WIRE,31,174,48,42,CBS_DROPDOWNLIST | WS_VSCROLL | @@ -289,7 +298,7 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,86,146,50,14 PUSHBUTTON "Cancel",IDCANCEL,164,146,50,14 CONTROL "Always",IDC_ALWAYSDISPLOG,"Button",BS_AUTOCHECKBOX | - BS_PUSHLIKE | WS_TABSTOP,263,147,31,13,WS_EX_STATICEDGE + WS_TABSTOP,258,146,36,14 GROUPBOX "",IDC_STATIC,7,7,287,36 CTEXT "Title of the Script",IDC_TITLE,71,14,158,8 CTEXT "by",IDC_STATIC,71,22,158,8 @@ -472,6 +481,24 @@ BEGIN DEFPUSHBUTTON "Cancel",IDCANCEL,129,148,50,14 END +IDD_MACROSET DIALOG DISCARDABLE 0, 0, 156, 81 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Macro Settings" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Slow",IDC_MACRO_SLOW,12,16,16,8,WS_DISABLED + LTEXT "Fast",IDC_MACRO_FAST,78,16,14,8,WS_DISABLED + CONTROL "Slider1",IDC_MACRO_SLIDER,"msctls_trackbar32", + TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,12,26,82,21 + CONTROL "&Real",IDC_MACRO_REAL,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,103,18,39,10 + CONTROL "&Manual",IDC_MACRO_MANUAL,"Button",BS_AUTORADIOBUTTON, + 103,32,39,10 + GROUPBOX "Replay Speed",IDC_STATIC,7,3,142,49 + DEFPUSHBUTTON "OK",IDOK,13,60,50,14 + PUSHBUTTON "Cancel",IDCANCEL,93,60,50,14 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -509,8 +536,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,5,0 - PRODUCTVERSION 1,3,5,0 + FILEVERSION 1,3,7,0 + PRODUCTVERSION 1,3,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -527,12 +554,12 @@ BEGIN BEGIN VALUE "CompanyName", "Sebastien Carlier & Christoph Gießelink\0" VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0" - VALUE "FileVersion", "1, 3, 5, 0\0" + VALUE "FileVersion", "1, 3, 7, 0\0" VALUE "InternalName", "Emu48\0" - VALUE "LegalCopyright", "Copyright © 2004\0" + VALUE "LegalCopyright", "Copyright © 2005\0" VALUE "OriginalFilename", "Emu48.exe\0" VALUE "ProductName", "Emu48\0" - VALUE "ProductVersion", "1, 3, 5, 0\0" + VALUE "ProductVersion", "1, 3, 7, 0\0" END END BLOCK "VarFileInfo" @@ -598,6 +625,17 @@ BEGIN 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 diff --git a/sources/Emu48/EMU48.XML b/Sources/Emu48/EMU48.XML similarity index 100% rename from sources/Emu48/EMU48.XML rename to Sources/Emu48/EMU48.XML diff --git a/sources/Emu48/ENGINE.C b/Sources/Emu48/ENGINE.C similarity index 92% rename from sources/Emu48/ENGINE.C rename to Sources/Emu48/ENGINE.C index a61dbfd..cca617a 100644 --- a/sources/Emu48/ENGINE.C +++ b/Sources/Emu48/ENGINE.C @@ -287,25 +287,16 @@ static __inline VOID AdjustSpeed(VOID) // adjust emulation speed LARGE_INTEGER lAct; do { - BOOL bErr = QueryPerformanceCounter(&lAct); - _ASSERT(bErr); // no high-resolution performance counter - } - while((dwTicks = lAct.LowPart-dwSpeedRef) <= dwTickRef); + VERIFY(QueryPerformanceCounter(&lAct)); - // workaround for QueryPerformanceCounter() in Win2k, - // if last command sequence took over 50ms -> synchronize - if(dwTicks > 819 * dwTickRef) // time for last commands > 50ms (819 / 16384Hz) - { - // new synchronizing - dwOldCyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF); - QueryPerformanceCounter(&lAct); // get timer ticks - dwSpeedRef = lAct.LowPart; // save reference time - } - else - { - dwOldCyc += T2CYCLES; // adjust cycles reference - dwSpeedRef += dwTickRef; // adjust reference time + // get time difference + dwTicks = lAct.LowPart - dwSpeedRef; } + // ticks elapsed or negative number (workaround for QueryPerformanceCounter() in Win2k) + while(dwTicks <= dwTickRef || (dwTicks & 0x80000000) != 0); + + dwOldCyc += T2CYCLES; // adjust cycles reference + dwSpeedRef += dwTickRef; // adjust reference time } } LeaveCriticalSection(&csSlowLock); @@ -379,7 +370,7 @@ VOID UpdateKdnBit(VOID) // update KDN bit { if ( Chipset.intk && (Chipset.IORam[TIMER2_CTRL]&RUN) != 0 - && (DWORD) (Chipset.cycles & 0xFFFFFFFFF) - Chipset.dwKdnCycles > (DWORD) T2CYCLES * 16) + && (DWORD) (Chipset.cycles & 0xFFFFFFFF) - Chipset.dwKdnCycles > (DWORD) T2CYCLES * 16) IOBit(SRQ2,KDN,Chipset.in != 0); return; } @@ -517,6 +508,7 @@ UINT WorkerThread(LPVOID pParam) loop: while (nNextState == SM_INVALID) // go into invalid state { + OnToolMacroStop(); // close open keyboard macro handler CommClose(); // close COM port bCommInit = FALSE; // COM port not open nState = SM_INVALID; // in invalid state diff --git a/sources/Emu48/EXTERNAL.C b/Sources/Emu48/EXTERNAL.C similarity index 100% rename from sources/Emu48/EXTERNAL.C rename to Sources/Emu48/EXTERNAL.C diff --git a/sources/Emu48/FETCH.C b/Sources/Emu48/FETCH.C similarity index 100% rename from sources/Emu48/FETCH.C rename to Sources/Emu48/FETCH.C diff --git a/sources/Emu48/FILES.C b/Sources/Emu48/FILES.C similarity index 93% rename from sources/Emu48/FILES.C rename to Sources/Emu48/FILES.C index a076bdd..47b3961 100644 --- a/sources/Emu48/FILES.C +++ b/Sources/Emu48/FILES.C @@ -87,15 +87,11 @@ WORD WriteStack(LPBYTE lpBuf,DWORD dwSize) // separated from LoadObject() } else { // load as string - BYTE lpHead[5]; dwSize *= 2; dwAddress = RPL_CreateTemp(dwSize+10); if (dwAddress == 0) return S_ERR_ASCII; - - Nunpack(lpHead,0x02A2C,5); // String - Nwrite(lpHead,dwAddress,5); - Nunpack(lpHead,dwSize+5,5); // length of String - Nwrite(lpHead,dwAddress+5,5); + Write5(dwAddress,0x02A2C); // String + Write5(dwAddress+5,dwSize+5); // length of String Nwrite(lpBuf,dwAddress+10,dwSize); // data } RPL_Push(dwAddress); @@ -394,6 +390,13 @@ BOOL MapRom(LPCTSTR szFilename) dwRomSize = 0; return FALSE; } + // check for packed ROM image + if ((*(DWORD *) pbyRom & 0xF0F0F0F0) != 0) + { + UnmapRom(); // free memory + AbortMessage(_T("Packed ROM image detected!")); + return FALSE; + } return TRUE; } @@ -774,23 +777,23 @@ BOOL OpenDocument(LPCTSTR szFilename) SetWindowLocation(hWnd,Chipset.nPosX,Chipset.nPosY); - if (szCurrentKml == NULL) - { - if (!DisplayChooseKml(Chipset.type)) - goto restore; - } while (TRUE) { - BOOL bOK; + if (szCurrentKml[0]) // KML file name + { + BOOL bOK; - bOK = InitKML(szCurrentKml,FALSE); - bOK = bOK && (cCurrentRomType == Chipset.type); - if (bOK) break; + bOK = InitKML(szCurrentKml,FALSE); + bOK = bOK && (cCurrentRomType == Chipset.type); + if (bOK) break; - KillKML(); + KillKML(); + } if (!DisplayChooseKml(Chipset.type)) goto restore; } + // reload old button state + ReloadButtons(Chipset.Keyboard_Row,sizeof(Chipset.Keyboard_Row)); FlashInit(); // init flash structure @@ -1242,7 +1245,13 @@ BOOL LoadObject(LPCTSTR szFilename) // separated stack writing part LPBYTE lpBuf; WORD wError; - hFile = CreateFile(szFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + hFile = CreateFile(szFilename, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, + NULL); if (hFile == INVALID_HANDLE_VALUE) return FALSE; dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh); if (dwFileSizeHigh != 0) @@ -1315,7 +1324,7 @@ BOOL SaveObject(LPCTSTR szFilename) // separated stack reading part //# //################ -static __inline UINT DibNumColors(LPBITMAPINFOHEADER lpbi) +static __inline UINT DibNumColors(BITMAPINFOHEADER CONST *lpbi) { if (lpbi->biClrUsed != 0) return (UINT)lpbi->biClrUsed; @@ -1323,7 +1332,7 @@ static __inline UINT DibNumColors(LPBITMAPINFOHEADER lpbi) return (lpbi->biBitCount <= 8) ? (1 << lpbi->biBitCount) : 0; } -static HPALETTE CreateBIPalette(LPBITMAPINFOHEADER lpbi) +static HPALETTE CreateBIPalette(BITMAPINFOHEADER CONST *lpbi) { LOGPALETTE* pPal; HPALETTE hpal = NULL; diff --git a/sources/Emu48/I28F160.C b/Sources/Emu48/I28F160.C similarity index 100% rename from sources/Emu48/I28F160.C rename to Sources/Emu48/I28F160.C diff --git a/sources/Emu48/I28F160.H b/Sources/Emu48/I28F160.H similarity index 100% rename from sources/Emu48/I28F160.H rename to Sources/Emu48/I28F160.H diff --git a/sources/Emu48/IO.H b/Sources/Emu48/IO.H similarity index 100% rename from sources/Emu48/IO.H rename to Sources/Emu48/IO.H diff --git a/sources/Emu48/KEYBOARD.C b/Sources/Emu48/KEYBOARD.C similarity index 92% rename from sources/Emu48/KEYBOARD.C rename to Sources/Emu48/KEYBOARD.C index 7d014f2..c4c82b6 100644 --- a/sources/Emu48/KEYBOARD.C +++ b/Sources/Emu48/KEYBOARD.C @@ -94,12 +94,18 @@ VOID KeyboardEvent(BOOL bPress, UINT out, UINT in) { if (nState != SM_RUN) // not in running state return; // ignore key + + KeyMacroRecord(bPress,out,in); // save all keyboard events + if (in == 0x8000) // ON key ? { Chipset.IR15X = bPress?0x8000:0x0000; // refresh special ON key flag } else { + // "out" is outside Keyboard_Row + if (out >= ARRAYSIZEOF(Chipset.Keyboard_Row)) return; + _ASSERT(out < ARRAYSIZEOF(Chipset.Keyboard_Row)); if (bPress) // key pressed Chipset.Keyboard_Row[out] |= in; // set key marker in keyboard row diff --git a/Sources/Emu48/KEYMACRO.C b/Sources/Emu48/KEYMACRO.C new file mode 100644 index 0000000..dc41644 --- /dev/null +++ b/Sources/Emu48/KEYMACRO.C @@ -0,0 +1,339 @@ +/* + * Keymacro.c + * + * This file is part of Emu48 + * + * Copyright (C) 2004 Christoph Gießelink + * + */ +#include "pch.h" +#include "resource.h" +#include "Emu48.h" +#include "kml.h" + +#define KEYMACROHEAD "Emu-KeyMacro" // macro signature + +#define KEYHOLDTIME 50 + +#define MIN_SPEED 0 +#define MAX_SPEED 500 + +typedef struct +{ + DWORD dwTime; // elapsed time + DWORD dwKeyEvent; // key code +} KeyData; + +INT nMacroState = MACRO_OFF; +INT nMacroTimeout = MIN_SPEED; +BOOL bMacroRealSpeed = TRUE; + +static DWORD dwTimeRef; + +static HANDLE hMacroFile = INVALID_HANDLE_VALUE; +static HANDLE hEventPlay = NULL; +static HANDLE hThreadEv = NULL; + +static VOID InitializeOFN(LPOPENFILENAME ofn) +{ + ZeroMemory((LPVOID)ofn, sizeof(OPENFILENAME)); + ofn->lStructSize = sizeof(OPENFILENAME); + ofn->hwndOwner = hWnd; + ofn->Flags = OFN_EXPLORER|OFN_HIDEREADONLY; + return; +} + +// +// thread playing keys +// +static DWORD WINAPI EventThread(LPVOID pParam) +{ + DWORD dwRead = 0; + DWORD dwData,dwTime = 0; + + while (WaitForSingleObject(hEventPlay,dwTime) == WAIT_TIMEOUT) + { + if (dwRead != 0) // data read + { + UINT nIn = (dwData >> 0) & 0xFFFF; + UINT nOut = (dwData >> 16) & 0xFF; + BOOL bPress = (dwData >> 24) & 0xFF; + + PlayKey(nOut,nIn,bPress); +// KeyboardEvent(bPress,nOut,nIn); + } + + dwTime = nMacroTimeout; // set default speed + + while (TRUE) + { + // read next data element + if ( !ReadFile(hMacroFile,&dwData,sizeof(dwData),&dwRead,NULL) + || dwRead != sizeof(dwData)) + { + // play record empty -> quit + PostMessage(hWnd,WM_COMMAND,ID_TOOL_MACRO_STOP,0); + return 0; // exit on file end + } + + if ((dwData & 0x80000000) != 0) // time information + { + if (bMacroRealSpeed) // realspeed from data + { + dwTime = dwData & 0x7FFFFFFF; + } + continue; + } + break; // got key information + } + } + return 0; // exit on stop + UNREFERENCED_PARAMETER(pParam); +} + +// +// callback function for recording keys +// +VOID KeyMacroRecord(BOOL bPress, UINT out, UINT in) +{ + if (nMacroState == MACRO_NEW) // save key event + { + KeyData Data; + DWORD dwWritten; + + dwWritten = GetTickCount(); // time reference + Data.dwTime = (dwWritten - dwTimeRef - KEYHOLDTIME); + // set negative number to zero + if ((Data.dwTime & 0x80000000) != 0) Data.dwTime = 0; + Data.dwTime |= 0x80000000; // set time marker + dwTimeRef = dwWritten; + + Data.dwKeyEvent = (bPress & 0xFF); + Data.dwKeyEvent = (Data.dwKeyEvent << 8) | (out & 0xFF); + Data.dwKeyEvent = (Data.dwKeyEvent << 16) | (in & 0xFFFF); + + // save key event in file + WriteFile(hMacroFile,&Data,sizeof(Data),&dwWritten,NULL); + _ASSERT(dwWritten == sizeof(Data)); + } + return; +} + +// +// message handler for save new keyboard macro +// +LRESULT OnToolMacroNew(VOID) +{ + TCHAR szMacroFile[MAX_PATH]; + OPENFILENAME ofn; + DWORD dwExtensionLength,dwWritten; + + // get filename for saving + InitializeOFN(&ofn); + ofn.lpstrFilter = + _T("Keyboard Macro Files (*.MAC)\0*.MAC\0") + _T("All Files (*.*)\0*.*\0") + _T("\0\0"); + ofn.lpstrDefExt = _T("MAC"); + ofn.nFilterIndex = 1; + ofn.lpstrFile = szMacroFile; + ofn.lpstrFile[0] = 0; + ofn.nMaxFile = ARRAYSIZEOF(szMacroFile); + ofn.Flags |= OFN_CREATEPROMPT|OFN_OVERWRITEPROMPT; + if (GetSaveFileName(&ofn) == FALSE) return 0; + + // open file for writing + hMacroFile = CreateFile(szMacroFile, + GENERIC_READ|GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (hMacroFile == INVALID_HANDLE_VALUE) return 0; + + // write header + WriteFile(hMacroFile,KEYMACROHEAD,strlen(KEYMACROHEAD),&dwWritten,NULL); + _ASSERT(dwWritten == (DWORD) strlen(KEYMACROHEAD)); + + // write extension length + dwExtensionLength = 0; // no extension + WriteFile(hMacroFile,&dwExtensionLength,sizeof(dwExtensionLength),&dwWritten,NULL); + _ASSERT(dwWritten == sizeof(dwExtensionLength)); + + nMacroState = MACRO_NEW; + UpdateWindowStatus(); + + MessageBox(hWnd, + _T("Press OK to begin to record the Macro."), + _T("Macro Recorder"), + MB_OK|MB_ICONINFORMATION); + + dwTimeRef = GetTickCount() + KEYHOLDTIME; // time reference + return 0; +} + +// +// message handler for play keyboard macro +// +LRESULT OnToolMacroPlay(VOID) +{ + BYTE byHeader[sizeof(KEYMACROHEAD)-1]; + TCHAR szMacroFile[MAX_PATH]; + OPENFILENAME ofn; + DWORD dwExtensionLength,dwRead,dwThreadId; + + InitializeOFN(&ofn); + ofn.lpstrFilter = + _T("Keyboard Macro Files (*.MAC)\0*.MAC\0") + _T("All Files (*.*)\0*.*\0") + _T("\0\0"); + ofn.lpstrDefExt = _T("MAC"); + ofn.nFilterIndex = 1; + ofn.lpstrFile = szMacroFile; + ofn.lpstrFile[0] = 0; + ofn.nMaxFile = ARRAYSIZEOF(szMacroFile); + ofn.Flags |= OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST; + if (GetOpenFileName(&ofn) == FALSE) return 0; + + // open file for Reading + hMacroFile = CreateFile(szMacroFile, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (hMacroFile == INVALID_HANDLE_VALUE) return 0; + + // read header + ReadFile(hMacroFile,byHeader,sizeof(byHeader),&dwRead,NULL); + if ( dwRead != sizeof(byHeader) + || memcmp(byHeader,KEYMACROHEAD,dwRead) != 0) + { + MessageBox(hWnd, + _T("Wrong keyboard macro file format."), + _T("Macro Recorder"), + MB_OK|MB_ICONSTOP); + CloseHandle(hMacroFile); + return 0; + } + + // read extension length + ReadFile(hMacroFile,&dwExtensionLength,sizeof(dwExtensionLength),&dwRead,NULL); + if (dwRead != sizeof(dwExtensionLength)) + { + CloseHandle(hMacroFile); + return 0; + } + + // read extension + while (dwExtensionLength-- > 0) + { + BYTE byData; + + ReadFile(hMacroFile,&byData,sizeof(byData),&dwRead,NULL); + if (dwRead != sizeof(byData)) + { + CloseHandle(hMacroFile); + return 0; + } + } + + // event for quit playing + hEventPlay = CreateEvent(NULL,FALSE,FALSE,NULL); + + nMacroState = MACRO_PLAY; + UpdateWindowStatus(); + + // start playing thread + VERIFY(hThreadEv = CreateThread(NULL,0,&EventThread,NULL,0,&dwThreadId)); + return 0; +} + +// +// message handler for stop recording/playing +// +LRESULT OnToolMacroStop(VOID) +{ + if (nMacroState != MACRO_OFF) + { + if (hEventPlay) // playing keys + { + // stop playing thread + SetEvent(hEventPlay); // quit play loop + + WaitForSingleObject(hThreadEv,INFINITE); + CloseHandle(hThreadEv); + hThreadEv = NULL; + + CloseHandle(hEventPlay); // close playing keys event + hEventPlay = NULL; + } + + // macro file open + if (hMacroFile != INVALID_HANDLE_VALUE) CloseHandle(hMacroFile); + + nMacroState = MACRO_OFF; + UpdateWindowStatus(); + } + return 0; +} + +// +// activate/deactivate slider +// +static VOID SliderEnable(HWND hDlg,BOOL bEnable) +{ + EnableWindow(GetDlgItem(hDlg,IDC_MACRO_SLOW),bEnable); + EnableWindow(GetDlgItem(hDlg,IDC_MACRO_FAST),bEnable); + EnableWindow(GetDlgItem(hDlg,IDC_MACRO_SLIDER),bEnable); + return; +} + +// +// Macro settings dialog +// +static BOOL CALLBACK MacroProc(HWND hDlg, UINT message, DWORD wParam, LONG lParam) +{ + switch (message) + { + case WM_INITDIALOG: + // set slider + SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_SETRANGE,FALSE,MAKELONG(0,MAX_SPEED-MIN_SPEED)); + SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_SETTICFREQ,MAX_SPEED/10,0); + SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_SETPOS,TRUE,MAX_SPEED-nMacroTimeout); + + // set button + CheckDlgButton(hDlg,bMacroRealSpeed ? IDC_MACRO_REAL : IDC_MACRO_MANUAL,BST_CHECKED); + SliderEnable(hDlg,!bMacroRealSpeed); + return TRUE; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_MACRO_REAL: + SliderEnable(hDlg,FALSE); + return TRUE; + case IDC_MACRO_MANUAL: + SliderEnable(hDlg,TRUE); + return TRUE; + case IDOK: + // get macro data + nMacroTimeout = MAX_SPEED - SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_GETPOS,0,0); + bMacroRealSpeed = IsDlgButtonChecked(hDlg,IDC_MACRO_REAL); + // no break + case IDCANCEL: + EndDialog(hDlg, LOWORD(wParam)); + } + break; + } + return FALSE; + UNREFERENCED_PARAMETER(lParam); +} + +LRESULT OnToolMacroSettings(VOID) +{ + if (DialogBox(hApp, MAKEINTRESOURCE(IDD_MACROSET), hWnd, (DLGPROC)MacroProc) == -1) + AbortMessage(_T("Macro Dialog Box Creation Error !")); + return 0; +} diff --git a/sources/Emu48/KML.C b/Sources/Emu48/KML.C similarity index 89% rename from sources/Emu48/KML.C rename to Sources/Emu48/KML.C index 8b391ef..ca657b6 100644 --- a/sources/Emu48/KML.C +++ b/Sources/Emu48/KML.C @@ -37,7 +37,7 @@ static KmlLine* If(KmlLine* pLine, BOOL bCondition); static KmlLine* RunLine(KmlLine* pLine); static KmlBlock* LoadKMLGlobal(LPCTSTR szFilename); -KmlBlock* pKml; +KmlBlock* pKml = NULL; static KmlBlock* pVKey[256]; static BYTE byVKeyMap[256]; static KmlButton pButton[256]; @@ -105,13 +105,12 @@ static KmlToken pLexToken[] = {0, 000000, 0,_T("")}, }; -static TokenId eIsBlock[] = +static CONST TokenId eIsBlock[] = { TOK_IFFLAG, TOK_IFPRESSED, TOK_ONDOWN, - TOK_ONUP, - TOK_NONE + TOK_ONUP }; static BOOL bClicking = FALSE; @@ -128,7 +127,6 @@ static UINT uLastPressedKey = 0; // var for last pressed key static UINT nLogLength = 0; static LPTSTR szLog = NULL; -static BOOL bKmlLogOkEnabled = FALSE; static VOID ClearLog() { @@ -141,12 +139,12 @@ static VOID ClearLog() return; } -static VOID AddToLog(LPTSTR szString) +static VOID AddToLog(LPCTSTR szString) { - UINT nLength = lstrlen(szString); + UINT nLength = lstrlen(szString) + 2; // CR+LF if (szLog == NULL) { - nLogLength = nLength + 3; // CR+LF+\0 + nLogLength = nLength + 1; // \0 szLog = HeapAlloc(hHeap,0,nLogLength*sizeof(szLog[0])); if (szLog==NULL) { @@ -157,7 +155,7 @@ static VOID AddToLog(LPTSTR szString) } else { - LPTSTR szLogTmp = HeapReAlloc(hHeap,0,szLog,(nLogLength+nLength+2)*sizeof(szLog[0])); + LPTSTR szLogTmp = HeapReAlloc(hHeap,0,szLog,(nLogLength+nLength)*sizeof(szLog[0])); if (szLogTmp == NULL) { ClearLog(); @@ -165,7 +163,7 @@ static VOID AddToLog(LPTSTR szString) } szLog = szLogTmp; lstrcpy(&szLog[nLogLength-1],szString); - nLogLength += nLength + 2; // CR+LF + nLogLength += nLength; } szLog[nLogLength-3] = _T('\r'); szLog[nLogLength-2] = _T('\n'); @@ -175,27 +173,25 @@ static VOID AddToLog(LPTSTR szString) static VOID __cdecl PrintfToLog(LPCTSTR lpFormat, ...) { - LPTSTR lpOutput; + TCHAR cOutput[1024]; va_list arglist; va_start(arglist,lpFormat); - lpOutput = HeapAlloc(hHeap,0,1024 * sizeof(lpOutput[0])); - wvsprintf(lpOutput,lpFormat,arglist); - AddToLog(lpOutput); - HeapFree(hHeap,0,lpOutput); + wvsprintf(cOutput,lpFormat,arglist); + AddToLog(cOutput); va_end(arglist); return; } static BOOL CALLBACK KMLLogProc(HWND hDlg, UINT message, DWORD wParam, LONG lParam) { - LPTSTR szString; + LPCTSTR szString; switch (message) { case WM_INITDIALOG: // set OK - EnableWindow(GetDlgItem(hDlg,IDOK),bKmlLogOkEnabled); + EnableWindow(GetDlgItem(hDlg,IDOK),lParam); // set IDC_TITLE szString = GetStringParam(pKml, TOK_GLOBAL, TOK_TITLE, 0); if (szString == NULL) szString = _T("Untitled"); @@ -205,14 +201,11 @@ static BOOL CALLBACK KMLLogProc(HWND hDlg, UINT message, DWORD wParam, LONG lPar if (szString == NULL) szString = _T(""); SetDlgItemText(hDlg,IDC_AUTHOR,szString); // set IDC_KMLLOG - if (szLog == NULL) - SetDlgItemText(hDlg,IDC_KMLLOG,_T("Memory Allocation Failure.")); - else - SetDlgItemText(hDlg,IDC_KMLLOG,szLog); + szString = szLog; + if (szString == NULL) szString = _T("Memory Allocation Failure."); + SetDlgItemText(hDlg,IDC_KMLLOG,szString); // set IDC_ALWAYSDISPLOG CheckDlgButton(hDlg,IDC_ALWAYSDISPLOG,bAlwaysDisplayLog); - // redraw window - InvalidateRect(hDlg, NULL, TRUE); return TRUE; case WM_COMMAND: wParam = LOWORD(wParam); @@ -225,16 +218,15 @@ static BOOL CALLBACK KMLLogProc(HWND hDlg, UINT message, DWORD wParam, LONG lPar break; } return FALSE; - UNREFERENCED_PARAMETER(lParam); - UNREFERENCED_PARAMETER(hDlg); } BOOL DisplayKMLLog(BOOL bOkEnabled) { - BOOL bResult; - bKmlLogOkEnabled = bOkEnabled; - bResult = DialogBox(hApp, MAKEINTRESOURCE(IDD_KMLLOG), hWnd, (DLGPROC)KMLLogProc); - return (bResult == IDOK); + return IDOK == DialogBoxParam(hApp, + MAKEINTRESOURCE(IDD_KMLLOG), + hWnd, + (DLGPROC)KMLLogProc, + bOkEnabled); } @@ -249,12 +241,11 @@ typedef struct _KmlScript { LPTSTR szFilename; LPTSTR szTitle; - DWORD nId; + DWORD nId; struct _KmlScript* pNext; } KmlScript; -static UINT nKmlFiles; -static KmlScript* pKmlList; +static KmlScript* pKmlList = NULL; static CHAR cKmlType; static VOID DestroyKmlList(VOID) @@ -269,7 +260,6 @@ static VOID DestroyKmlList(VOID) HeapFree(hHeap,0,pKmlList); pKmlList = pList; } - nKmlFiles = 0; return; } @@ -277,12 +267,14 @@ static VOID CreateKmlList(VOID) { HANDLE hFindFile; WIN32_FIND_DATA pFindFileData; + UINT nKmlFiles; + _ASSERT(pKmlList == NULL); // KML file list must be empty SetCurrentDirectory(szEmuDirectory); hFindFile = FindFirstFile(_T("*.KML"),&pFindFileData); SetCurrentDirectory(szCurrentDirectory); - nKmlFiles = 0; if (hFindFile == INVALID_HANDLE_VALUE) return; + nKmlFiles = 0; do { KmlScript* pScript; @@ -307,10 +299,10 @@ static VOID CreateKmlList(VOID) continue; } } - pScript = HeapAlloc(hHeap,0,sizeof(KmlScript)); + VERIFY(pScript = HeapAlloc(hHeap,0,sizeof(KmlScript))); pScript->szFilename = DuplicateString(pFindFileData.cFileName); szTitle = GetStringParam(pBlock,TOK_GLOBAL,TOK_TITLE,0); - if (szTitle == NULL) szTitle = DuplicateString(pScript->szFilename); + if (szTitle == NULL) szTitle = pScript->szFilename; pScript->szTitle = DuplicateString(szTitle); FreeBlocks(pBlock); pScript->nId = nKmlFiles; @@ -429,14 +421,14 @@ static BOOL CALLBACK ChooseKMLProc(HWND hDlg, UINT message, DWORD wParam, LONG l pList = pKmlList; while (pList) { - if (pList->nId == nIndex) break; + if (pList->nId == nIndex) + { + lstrcpy(szCurrentKml, pList->szFilename); + EndDialog(hDlg, IDOK); + break; + } pList = pList->pNext; } - if (pList) - { - lstrcpy(szCurrentKml, pList->szFilename); - EndDialog(hDlg, IDOK); - } return TRUE; case IDCANCEL: EndDialog(hDlg, IDCANCEL); @@ -542,19 +534,17 @@ static VOID CleanLex(VOID) return; } -// TODO: Change this poor (and slow!) code static BOOL IsBlock(TokenId eId) { - UINT uBlock = 0; - while (eIsBlock[uBlock] != TOK_NONE) + UINT i; + + for (i = 0; i < ARRAYSIZEOF(eIsBlock); ++i) { - if (eId == eIsBlock[uBlock]) return TRUE; - uBlock++; + if (eId == eIsBlock[i]) return TRUE; } return FALSE; } - static LPCTSTR GetStringOf(TokenId eId) { UINT i = 0; @@ -649,38 +639,37 @@ static DWORD ParseInteger(VOID) static LPTSTR ParseString(VOID) { - LPTSTR szString; - LPTSTR szBuffer; + LPTSTR lpszString; UINT nLength; UINT nBlock; - szText++; + szText++; // skip leading '"' nLength = 0; - nBlock = 255; - szBuffer = HeapAlloc(hHeap,0,(nBlock+1) * sizeof(szBuffer[0])); + nBlock = 256; + lpszString = HeapAlloc(hHeap,0,nBlock * sizeof(lpszString[0])); while (*szText != _T('"')) { - if (*szText == _T('\\')) szText++; - if (*szText == 0) + if (nLength == nBlock - 1) // ran out of buffer space { + nBlock += 256; + lpszString = HeapReAlloc(hHeap,0,lpszString,nBlock * sizeof(lpszString[0])); + } + + if (*szText == _T('\\')) szText++; // skip '\' escape char + if (*szText == 0) // EOS found inside string + { + HeapFree(hHeap,0,lpszString); FatalError(); return NULL; } - szBuffer[nLength] = *szText; - nLength++; - if (nLength == nBlock) - { - nBlock += 256; - szBuffer = HeapReAlloc(hHeap,0,szBuffer,(nBlock+1) * sizeof(szBuffer[0])); - } - szText++; + lpszString[nLength++] = *szText++; // save char } - szText++; - szBuffer[nLength] = 0; - szString = DuplicateString(szBuffer); - HeapFree(hHeap,0,szBuffer); - return szString; -} + szText++; // skip ending '"' + lpszString[nLength] = 0; // set EOS + + // release unnecessary allocated bytes + return HeapReAlloc(hHeap,0,lpszString,(nLength+1) * sizeof(lpszString[0])); +} static TokenId Lex(UINT nMode) { @@ -783,7 +772,13 @@ static KmlLine* IncludeLines(LPCTSTR szFilename) KmlLine* pLine; SetCurrentDirectory(szEmuDirectory); - hFile = CreateFile(szFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + hFile = CreateFile(szFilename, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, + NULL); SetCurrentDirectory(szCurrentDirectory); if (hFile == INVALID_HANDLE_VALUE) { @@ -951,7 +946,13 @@ static KmlBlock* IncludeBlocks(LPCTSTR szFilename) KmlBlock* pFirst; SetCurrentDirectory(szEmuDirectory); - hFile = CreateFile(szFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + hFile = CreateFile(szFilename, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, + NULL); SetCurrentDirectory(szCurrentDirectory); if (hFile == INVALID_HANDLE_VALUE) { @@ -1786,6 +1787,19 @@ static VOID ReleaseAllButtons(VOID) // release all buttons uButtonClicked = 0; // set var to default } +VOID ReloadButtons(BYTE *Keyboard_Row, UINT nSize) +{ + UINT i; + for (i=0; i= 0) + { + if (pButton[i].nOut == nOut && pButton[i].nIn == nIn) + { + if (bPressed) + PressButton(i); + else + ReleaseButton(i); + return; + } + } + return; +} + + + //################ //# //# Load and Initialize Script @@ -2022,7 +2062,13 @@ static KmlBlock* LoadKMLGlobal(LPCTSTR szFilename) DWORD eToken; SetCurrentDirectory(szEmuDirectory); - hFile = CreateFile(szFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + hFile = CreateFile(szFilename, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, + NULL); SetCurrentDirectory(szCurrentDirectory); if (hFile == INVALID_HANDLE_VALUE) return NULL; if ((lpBuf = MapKMLFile(hFile)) == NULL) @@ -2042,7 +2088,6 @@ static KmlBlock* LoadKMLGlobal(LPCTSTR szFilename) return pBlock; } - BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog) { HANDLE hFile; @@ -2055,7 +2100,13 @@ BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog) nBlocksIncludeLevel = 0; PrintfToLog(_T("Reading %s"), szFilename); SetCurrentDirectory(szEmuDirectory); - hFile = CreateFile(szFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + hFile = CreateFile(szFilename, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_FLAG_SEQUENTIAL_SCAN, + NULL); SetCurrentDirectory(szCurrentDirectory); if (hFile == INVALID_HANDLE_VALUE) { diff --git a/sources/Emu48/KML.H b/Sources/Emu48/KML.H similarity index 90% rename from sources/Emu48/KML.H rename to Sources/Emu48/KML.H index 72716ab..07ed190 100644 --- a/sources/Emu48/KML.H +++ b/Sources/Emu48/KML.H @@ -112,10 +112,12 @@ extern KmlBlock* pKml; extern BOOL DisplayChooseKml(CHAR cType); extern VOID FreeBlocks(KmlBlock* pBlock); extern VOID DrawAnnunciator(UINT nId, BOOL bOn); +extern VOID ReloadButtons(BYTE *Keyboard_Row, UINT nSize); extern VOID RefreshButtons(RECT *rc); extern VOID MouseButtonDownAt(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 RunKey(BYTE nId, BOOL bPressed); +extern VOID PlayKey(UINT nOut, UINT nIn, BOOL bPressed); extern BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog); extern VOID KillKML(VOID); diff --git a/sources/Emu48/MOPS.C b/Sources/Emu48/MOPS.C similarity index 95% rename from sources/Emu48/MOPS.C rename to Sources/Emu48/MOPS.C index 6b7ef3b..2628da6 100644 --- a/sources/Emu48/MOPS.C +++ b/Sources/Emu48/MOPS.C @@ -1242,13 +1242,6 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s) } #endif - if (d>=0x38) - { - Nunpack(Chipset.IORam+0x38, ReadT2(), 8); - memcpy(Chipset.IORam+d,a,s); - SetT2(Npack(Chipset.IORam+0x38,8)); - return; - } do { c = *a; @@ -1294,7 +1287,7 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s) Chipset.IORam[d]=c; Chipset.contrast = (Chipset.contrast&0x10)|c; UpdateContrast(Chipset.contrast); - disp |= (DISP_POINTER | DISP_MAIN | DISP_MENUE); + disp |= (DISP_MAIN | DISP_MENUE); } break; @@ -1307,7 +1300,7 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s) Chipset.IORam[d]=c; Chipset.contrast = (Chipset.contrast&0x0f)|((c&1)<<4); UpdateContrast(Chipset.contrast); - disp |= (DISP_POINTER | DISP_MAIN | DISP_MENUE); + disp |= (DISP_MAIN | DISP_MENUE); } break; @@ -1683,11 +1676,21 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s) // 00138 @ hardware timer (38-3F), decremented 8192 times/s // nothing - fall through to default - default: Chipset.IORam[d]=c; + default: + Chipset.IORam[d]=c; // write data + + if (d >= TIMER2) // timer2 update + { + Nunpack(Chipset.IORam+TIMER2,ReadT2(),8); + memcpy(Chipset.IORam+d,a,s); + SetT2(Npack(Chipset.IORam+TIMER2,8)); + goto finish; + } } a++; d++; } while (--s); +finish: if (bDISPADDR) // 0x120-0x124 changed { b = Npack(Chipset.IORam+0x20,5)&0xFFFFE; diff --git a/sources/Emu48/OPCODES.C b/Sources/Emu48/OPCODES.C similarity index 94% rename from sources/Emu48/OPCODES.C rename to Sources/Emu48/OPCODES.C index 1e8b52e..d94aa24 100644 --- a/sources/Emu48/OPCODES.C +++ b/Sources/Emu48/OPCODES.C @@ -962,7 +962,9 @@ VOID o801(LPBYTE I) // OUT=C VOID o802(LPBYTE I) // A=IN { w.cycles+=7; - if ((w.pc&1)==0) w.pc+=3; // emulate saturn bug + // emulate Clarke/Yorke bug + if ((w.pc & 1) == 0 || MapData(w.pc) == M_IO) + w.pc+=3; ScanKeyboard(TRUE,FALSE); // update Chipset.in register (direct) IOBit(0x19,8,w.in != 0); // update KDN bit in the SRQ register Nunpack(w.A, w.in, 4); @@ -972,7 +974,9 @@ VOID o802(LPBYTE I) // A=IN VOID o803(LPBYTE I) // C=IN { w.cycles+=7; - if ((w.pc&1)==0) w.pc+=3; // emulate saturn bug + // emulate Clarke/Yorke bug + if ((w.pc & 1) == 0 || MapData(w.pc) == M_IO) + w.pc+=3; ScanKeyboard(TRUE,FALSE); // update Chipset.in register (direct) IOBit(0x19,8,w.in != 0); // update KDN bit in the SRQ register Nunpack(w.C, w.in, 4); diff --git a/sources/Emu48/OPCODES.H b/Sources/Emu48/OPCODES.H similarity index 100% rename from sources/Emu48/OPCODES.H rename to Sources/Emu48/OPCODES.H diff --git a/sources/Emu48/OPS.H b/Sources/Emu48/OPS.H similarity index 93% rename from sources/Emu48/OPS.H rename to Sources/Emu48/OPS.H index 37f3fff..b30c56e 100644 --- a/sources/Emu48/OPS.H +++ b/Sources/Emu48/OPS.H @@ -243,6 +243,8 @@ static __inline void Nsub(BYTE *a, BYTE *b, UINT s) if ((a[i] & 0xF0) != 0) // check overflow { a[i] += cBase; + // illegal number in dec mode + if ((a[i] & 0xF0) != 0) a[i] &= 0x7; c = 1; } else @@ -263,6 +265,8 @@ static __inline void Nrsub(BYTE *a, BYTE *b, UINT s) if ((a[i] & 0xF0) != 0) // check overflow { a[i] += cBase; + // illegal number in dec mode + if ((a[i] & 0xF0) != 0) a[i] &= 0x7; c = 1; } else diff --git a/sources/Emu48/PCH.C b/Sources/Emu48/PCH.C similarity index 100% rename from sources/Emu48/PCH.C rename to Sources/Emu48/PCH.C diff --git a/sources/Emu48/PCH.H b/Sources/Emu48/PCH.H similarity index 65% rename from sources/Emu48/PCH.H rename to Sources/Emu48/PCH.H index 4c6517f..5dfe309 100644 --- a/sources/Emu48/PCH.H +++ b/Sources/Emu48/PCH.H @@ -15,6 +15,14 @@ #include #include +#if !defined VERIFY +#if defined _DEBUG +#define VERIFY(f) _ASSERT(f) +#else // _DEBUG +#define VERIFY(f) ((VOID)(f)) +#endif // _DEBUG +#endif // _VERIFY + #if !defined IDC_HAND // Win2k specific definition #define IDC_HAND MAKEINTRESOURCE(32649) #endif diff --git a/Sources/Emu48/RESOURCE.H b/Sources/Emu48/RESOURCE.H new file mode 100644 index 0000000..a8723d4 --- /dev/null +++ b/Sources/Emu48/RESOURCE.H @@ -0,0 +1,217 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Emu48.rc +// +#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 +#define RT_MANIFEST 24 +#define IDI_EMU48 100 +#define IDR_MENU 101 +#define IDR_DEBUG 102 +#define IDR_DEBUG_TOOLBAR 103 +#define IDR_DEBUG_CODE 104 +#define IDR_DEBUG_MEM 105 +#define IDR_DEBUG_STACK 106 +#define IDB_CHECKBOX 107 +#define IDD_ABOUT 108 +#define IDD_SETTINGS 109 +#define IDD_CHOOSEKML 110 +#define IDD_KMLLOG 111 +#define IDD_DISASM 112 +#define IDD_DEBUG 113 +#define IDD_NEWVALUE 114 +#define IDD_ENTERADR 115 +#define IDD_BREAKEDIT 116 +#define IDD_ENTERBREAK 117 +#define IDD_INSTRUCTIONS 118 +#define IDD_WRITEONLYREG 119 +#define IDD_FIND 120 +#define IDD_PROFILE 121 +#define IDD_MACROSET 122 +#define IDC_REALSPEED 1000 +#define IDC_AUTOSAVE 1001 +#define IDC_AUTOSAVEONEXIT 1002 +#define IDC_OBJECTLOADWARNING 1003 +#define IDC_ALWAYSDISPLOG 1004 +#define IDC_PORT1EN 1005 +#define IDC_PORT1WR 1006 +#define IDC_PORT2ISSHARED 1007 +#define IDC_PORT2 1008 +#define IDC_PORT2LOAD 1009 +#define IDC_WIRE 1010 +#define IDC_IR 1011 +#define IDC_EMUDIR 1012 +#define IDC_EMUDIRSEL 1013 +#define IDC_UPDATE 1014 +#define IDC_KMLSCRIPT 1015 +#define IDC_AUTHOR 1016 +#define IDC_TITLE 1017 +#define IDC_KMLLOG 1018 +#define IDC_VERSION 1019 +#define IDC_LICENSE 1020 +#define IDC_DISASM_WIN 1021 +#define IDC_DISASM_MAP 1022 +#define IDC_DISASM_ROM 1023 +#define IDC_DISASM_RAM 1024 +#define IDC_DISASM_PORT1 1025 +#define IDC_DISASM_PORT2 1026 +#define IDC_DISASM_MODULE 1027 +#define IDC_DISASM_HP 1028 +#define IDC_DISASM_CLASS 1029 +#define IDC_ADDRESS 1030 +#define IDC_DISASM_ADR 1031 +#define IDC_DISASM_NEXT 1032 +#define IDC_DISASM_COPY 1033 +#define IDC_DEBUG_CODE 1034 +#define IDC_STATIC_CODE 1035 +#define IDC_STATIC_REGISTERS 1036 +#define IDC_STATIC_MEMORY 1037 +#define IDC_STATIC_STACK 1038 +#define IDC_REG_A 1039 +#define IDC_REG_B 1040 +#define IDC_REG_C 1041 +#define IDC_REG_D 1042 +#define IDC_REG_R0 1043 +#define IDC_REG_R1 1044 +#define IDC_REG_R2 1045 +#define IDC_REG_R3 1046 +#define IDC_REG_R4 1047 +#define IDC_REG_D0 1048 +#define IDC_REG_D1 1049 +#define IDC_REG_P 1050 +#define IDC_REG_PC 1051 +#define IDC_REG_OUT 1052 +#define IDC_REG_IN 1053 +#define IDC_REG_ST 1054 +#define IDC_REG_CY 1055 +#define IDC_REG_MODE 1056 +#define IDC_REG_MP 1057 +#define IDC_REG_SR 1058 +#define IDC_REG_SB 1059 +#define IDC_REG_XM 1060 +#define IDC_MISC_INT 1061 +#define IDC_MISC_KEY 1062 +#define IDC_MISC_BS 1063 +#define IDC_NEWVALUE 1064 +#define IDC_ENTERADR 1065 +#define IDC_DEBUG_MEM 1066 +#define IDC_DEBUG_MEM_ADDR 1067 +#define IDC_DEBUG_MEM_COL0 1068 +#define IDC_DEBUG_MEM_COL1 1069 +#define IDC_DEBUG_MEM_COL2 1070 +#define IDC_DEBUG_MEM_COL3 1071 +#define IDC_DEBUG_MEM_COL4 1072 +#define IDC_DEBUG_MEM_COL5 1073 +#define IDC_DEBUG_MEM_COL6 1074 +#define IDC_DEBUG_MEM_COL7 1075 +#define IDC_DEBUG_MEM_TEXT 1076 +#define IDC_DEBUG_STACK 1077 +#define IDC_STATIC_BREAKPOINT 1078 +#define IDC_BREAKEDIT_ADD 1079 +#define IDC_BREAKEDIT_DELETE 1080 +#define IDC_BREAKEDIT_WND 1081 +#define IDC_STATIC_MMU 1082 +#define IDC_MMU_IO_A 1083 +#define IDC_MMU_NCE2_A 1084 +#define IDC_MMU_CE1_A 1085 +#define IDC_MMU_CE2_A 1086 +#define IDC_MMU_NCE3_A 1087 +#define IDC_MMU_IO_S 1088 +#define IDC_MMU_CE1_S 1089 +#define IDC_MMU_CE2_S 1090 +#define IDC_MMU_NCE2_S 1091 +#define IDC_MMU_NCE3_S 1092 +#define IDC_STATIC_MISC 1093 +#define IDC_MISC_BS_TXT 1094 +#define IDC_INSTR_TEXT 1095 +#define IDC_INSTR_CODE 1096 +#define IDC_INSTR_COPY 1097 +#define IDC_INSTR_CLEAR 1098 +#define IDC_PROFILE_LASTCYCLES 1099 +#define IDC_PROFILE_LASTTIME 1100 +#define IDC_BPCODE 1101 +#define IDC_BPRPL 1102 +#define IDC_BPACCESS 1103 +#define IDC_BPREAD 1104 +#define IDC_BPWRITE 1105 +#define IDC_FIND_DATA 1106 +#define IDC_FIND_ASCII 1107 +#define IDC_FIND_CASE 1108 +#define IDC_ADDR20_24 1109 +#define IDC_ADDR25_27 1110 +#define IDC_ADDR28_29 1111 +#define IDC_ADDR30_34 1112 +#define IDC_MACRO_SLOW 1113 +#define IDC_MACRO_FAST 1114 +#define IDC_MACRO_SLIDER 1115 +#define IDC_MACRO_REAL 1116 +#define IDC_MACRO_MANUAL 1117 +#define ID_FILE_NEW 40001 +#define ID_FILE_OPEN 40002 +#define ID_FILE_SAVE 40003 +#define ID_FILE_SAVEAS 40004 +#define ID_FILE_EXIT 40005 +#define ID_VIEW_COPY 40006 +#define ID_VIEW_SETTINGS 40007 +#define ID_VIEW_RESET 40008 +#define ID_OBJECT_LOAD 40009 +#define ID_OBJECT_SAVE 40010 +#define ID_ABOUT 40011 +#define ID_FILE_CLOSE 40013 +#define ID_BACKUP_SAVE 40014 +#define ID_BACKUP_RESTORE 40015 +#define ID_BACKUP_DELETE 40016 +#define ID_VIEW_SCRIPT 40017 +#define ID_STACK_COPY 40019 +#define ID_STACK_PASTE 40020 +#define ID_TOOL_DISASM 40021 +#define ID_TOOL_DEBUG 40022 +#define ID_TOOL_MACRO_RECORD 40023 +#define ID_TOOL_MACRO_PLAY 40024 +#define ID_TOOL_MACRO_STOP 40025 +#define ID_TOOL_MACRO_SETTINGS 40026 +#define ID_DEBUG_RUN 40027 +#define ID_DEBUG_RUNCURSOR 40028 +#define ID_DEBUG_STEP 40029 +#define ID_DEBUG_STEPOVER 40030 +#define ID_DEBUG_BREAK 40031 +#define ID_DEBUG_STEPOUT 40032 +#define ID_DEBUG_CANCEL 40033 +#define ID_BREAKPOINTS_SETBREAK 40034 +#define ID_BREAKPOINTS_CODEEDIT 40035 +#define ID_BREAKPOINTS_CLEARALL 40036 +#define ID_BREAKPOINTS_NOP3 40037 +#define ID_BREAKPOINTS_DOCODE 40038 +#define ID_BREAKPOINTS_RPL 40039 +#define ID_DEBUG_CODE_GOADR 40040 +#define ID_DEBUG_CODE_GOPC 40041 +#define ID_DEBUG_CODE_SETPCTOSELECT 40042 +#define ID_DEBUG_MEM_GOADR 40043 +#define ID_DEBUG_MEM_GOPC 40044 +#define ID_DEBUG_MEM_GOD0 40045 +#define ID_DEBUG_MEM_GOD1 40046 +#define ID_DEBUG_MEM_GOSTACK 40047 +#define ID_DEBUG_MEM_FIND 40048 +#define ID_DEBUG_MEM_MAP 40049 +#define ID_DEBUG_MEM_NCE1 40050 +#define ID_DEBUG_MEM_NCE2 40051 +#define ID_DEBUG_MEM_CE1 40052 +#define ID_DEBUG_MEM_CE2 40053 +#define ID_DEBUG_MEM_NCE3 40054 +#define ID_DEBUG_STACK_PUSH 40055 +#define ID_DEBUG_STACK_POP 40056 +#define ID_DEBUG_STACK_MODIFY 40057 +#define ID_INTR_STEPOVERINT 40058 +#define ID_INFO_LASTINSTRUCTIONS 40059 +#define ID_INFO_PROFILE 40060 +#define ID_INFO_WRITEONLYREG 40061 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 123 +#define _APS_NEXT_COMMAND_VALUE 40062 +#define _APS_NEXT_CONTROL_VALUE 1118 +#define _APS_NEXT_SYMED_VALUE 108 +#endif +#endif diff --git a/sources/Emu48/RPL.C b/Sources/Emu48/RPL.C similarity index 100% rename from sources/Emu48/RPL.C rename to Sources/Emu48/RPL.C diff --git a/sources/Emu48/SERIAL.C b/Sources/Emu48/SERIAL.C similarity index 100% rename from sources/Emu48/SERIAL.C rename to Sources/Emu48/SERIAL.C diff --git a/sources/Emu48/SETTINGS.C b/Sources/Emu48/SETTINGS.C similarity index 92% rename from sources/Emu48/SETTINGS.C rename to Sources/Emu48/SETTINGS.C index 05f84cb..6ca9da9 100644 --- a/sources/Emu48/SETTINGS.C +++ b/Sources/Emu48/SETTINGS.C @@ -155,6 +155,9 @@ VOID ReadSettings(VOID) dwSXCycles = ReadInt(_T("Emulator"),_T("SXCycles"),dwSXCycles); dwGXCycles = ReadInt(_T("Emulator"),_T("GXCycles"),dwGXCycles); SetSpeed(bRealSpeed); // set speed + // Macro + bMacroRealSpeed = ReadInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed); + nMacroTimeout = ReadInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout); // Serial ReadString(_T("Serial"),_T("Wire"),_T(NO_SERIAL),szSerialWire,ARRAYSIZEOF(szSerialWire)); ReadString(_T("Serial"),_T("Ir"),_T(NO_SERIAL),szSerialIr,ARRAYSIZEOF(szSerialIr)); @@ -183,6 +186,9 @@ VOID WriteSettings(VOID) WriteInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed); WriteInt(_T("Emulator"),_T("SXCycles"),dwSXCycles); WriteInt(_T("Emulator"),_T("GXCycles"),dwGXCycles); + // Macro + WriteInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed); + WriteInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout); // Serial WriteString(_T("Serial"),_T("Wire"),szSerialWire); WriteString(_T("Serial"),_T("Ir"),szSerialIr); diff --git a/sources/Emu48/TIMER.C b/Sources/Emu48/TIMER.C similarity index 88% rename from sources/Emu48/TIMER.C rename to Sources/Emu48/TIMER.C index 86e38a4..d357893 100644 --- a/sources/Emu48/TIMER.C +++ b/Sources/Emu48/TIMER.C @@ -37,12 +37,11 @@ static BOOL bNINT2T2 = FALSE; // state of NINT2 affected from timer2 static BOOL bAccurateTimer; // flag if accurate timer is used static LARGE_INTEGER lT2Ref; // counter value at timer2 start static TIMECAPS tc; // timer information +static UINT uT2MaxTicks; // max. timer2 ticks handled by one timer event static DWORD dwT2Ref; // timer2 value at last timer2 access static DWORD dwT2Cyc; // cpu cycle counter at last timer2 access -static __inline int MAX(int a, int b) {return (a>b)?a:b;} - static void CALLBACK TimeProc(UINT uEventId, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2); static DWORD CalcT2(VOID) // calculate timer2 value @@ -180,14 +179,13 @@ static VOID RescheduleT2(BOOL bRefPoint) { uDelay = CalcT2(); // actual timer value for delay } - uDelay &= 0x7FFFFFFF; // execute timer2 event when MSB change - uDelay = (uDelay + 7) >> 3; // timer delay in ms - uDelay = MAX(tc.wPeriodMin,uDelay); // wait minimum delay of timer - if ((bOutRange = uDelay > tc.wPeriodMax)) // delay greater maximum delay - uDelay = tc.wPeriodMax; // wait maximum delay time - // start timer2; schedule event, when Chipset.t2 will be zero (Chipset.t2 / 8 = time in ms) - uT2TimerId = timeSetEvent(uDelay,0,(LPTIMECALLBACK)&TimeProc,2,TIME_ONESHOT); - _ASSERT(uT2TimerId); // test if timer2 started + if ((bOutRange = uDelay > uT2MaxTicks)) // delay greater maximum delay + uDelay = uT2MaxTicks; // wait maximum delay time + uDelay = (uDelay * 125 + 1023) / 1024; // timer delay in ms (1000/8192 = 125/1024) + uDelay = __max(tc.wPeriodMin,uDelay); // wait minimum delay of timer + _ASSERT(uDelay <= tc.wPeriodMax); // inside maximum event delay + // start timer2; schedule event, when Chipset.t2 will be zero + VERIFY(uT2TimerId = timeSetEvent(uDelay,0,(LPTIMECALLBACK)&TimeProc,2,TIME_ONESHOT)); return; } @@ -315,13 +313,17 @@ VOID StartTimers(VOID) bNINT2T1 = (Chipset.IORam[TIMER1_CTRL]&INTR) != 0 && (Chipset.t1 & 8) != 0; bNINT2T2 = (Chipset.IORam[TIMER2_CTRL]&INTR) != 0 && (Chipset.t2 & 0x80000000) != 0; timeGetDevCaps(&tc,sizeof(tc)); // get timer resolution + + // max. timer2 ticks that can be handled by one timer event + uT2MaxTicks = __min((0xFFFFFFFF / 1024),tc.wPeriodMax); + uT2MaxTicks = __min((0xFFFFFFFF - 1023) / 125,uT2MaxTicks * 1024 / 125); + CheckT1(Chipset.t1); // check for timer1 interrupts CheckT2(Chipset.t2); // check for timer2 interrupts - // set timer resolution to 1 ms, if failed don't use "Accurate timer" - bAccurateTimer = (timeBeginPeriod(1) == TIMERR_NOERROR); + // set timer resolution to greatest possible one + bAccurateTimer = (timeBeginPeriod(tc.wPeriodMin) == TIMERR_NOERROR); // set timer1 with given period - uT1TimerId = timeSetEvent(T1_FREQ,0,(LPTIMECALLBACK)&TimeProc,1,TIME_PERIODIC); - _ASSERT(uT1TimerId); // test if timer1 started + VERIFY(uT1TimerId = timeSetEvent(T1_FREQ,0,(LPTIMECALLBACK)&TimeProc,1,TIME_PERIODIC)); RescheduleT2(TRUE); // start timer2 } return; @@ -349,7 +351,7 @@ VOID StopTimers(VOID) bStarted = FALSE; if (bAccurateTimer) // "Accurate timer" running { - timeEndPeriod(1); // finish service + timeEndPeriod(tc.wPeriodMin); // finish service } return; } @@ -410,7 +412,6 @@ VOID SetT1(BYTE byValue) } LeaveCriticalSection(&csT1Lock); // restart timer1 to get full period of frequency - uT1TimerId = timeSetEvent(T1_FREQ,0,(LPTIMECALLBACK)&TimeProc,1,TIME_PERIODIC); - _ASSERT(uT1TimerId); // test if timer1 started + VERIFY(uT1TimerId = timeSetEvent(T1_FREQ,0,(LPTIMECALLBACK)&TimeProc,1,TIME_PERIODIC)); return; } diff --git a/sources/Emu48/TYPES.H b/Sources/Emu48/TYPES.H similarity index 100% rename from sources/Emu48/TYPES.H rename to Sources/Emu48/TYPES.H diff --git a/sources/GCCPatch/EMU48GCC.RC b/Sources/GCCPatch/EMU48GCC.RC similarity index 90% rename from sources/GCCPatch/EMU48GCC.RC rename to Sources/GCCPatch/EMU48GCC.RC index f293a12..17a4e2a 100644 --- a/sources/GCCPatch/EMU48GCC.RC +++ b/Sources/GCCPatch/EMU48GCC.RC @@ -140,6 +140,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 162 END + + IDD_MACROSET, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 149 + TOPMARGIN, 7 + BOTTOMMARGIN, 74 + END END #endif // APSTUDIO_INVOKED @@ -217,7 +225,7 @@ FONT 8, "MS Sans Serif" BEGIN ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP - LTEXT "Copyright © 2004 Sébastien Carlier && Christoph Gießelink", + LTEXT "Copyright © 2005 Sébastien Carlier && Christoph Gießelink", IDC_STATIC,29,18,181,8 DEFPUSHBUTTON "OK",IDOK,215,12,39,14 EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL | @@ -252,7 +260,8 @@ BEGIN CONTROL "Port 2 is Shared",IDC_PORT2ISSHARED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,13,131,65,10 LTEXT "Port 2 File :",IDC_STATIC,13,147,37,8 - EDITTEXT IDC_PORT2,51,144,104,12,ES_AUTOHSCROLL + EDITTEXT IDC_PORT2,51,144,94,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_PORT2LOAD,145,144,10,12 GROUPBOX "Memory Cards",IDC_STATIC,7,110,153,51 LTEXT "Wire:",IDC_STATIC,13,176,17,8 COMBOBOX IDC_WIRE,31,174,48,42,CBS_DROPDOWNLIST | WS_VSCROLL | @@ -289,7 +298,7 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,86,146,50,14 PUSHBUTTON "Cancel",IDCANCEL,164,146,50,14 CONTROL "Always",IDC_ALWAYSDISPLOG,"Button",BS_AUTOCHECKBOX | - BS_PUSHLIKE | WS_TABSTOP,263,147,31,13,WS_EX_STATICEDGE + WS_TABSTOP,258,146,36,14 GROUPBOX "",IDC_STATIC,7,7,287,36 CTEXT "Title of the Script",IDC_TITLE,71,14,158,8 CTEXT "by",IDC_STATIC,71,22,158,8 @@ -472,6 +481,24 @@ BEGIN DEFPUSHBUTTON "Cancel",IDCANCEL,129,148,50,14 END +IDD_MACROSET DIALOG DISCARDABLE 0, 0, 156, 81 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Macro Settings" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Slow",IDC_MACRO_SLOW,12,16,16,8,WS_DISABLED + LTEXT "Fast",IDC_MACRO_FAST,78,16,14,8,WS_DISABLED + CONTROL "Slider1",IDC_MACRO_SLIDER,"msctls_trackbar32", + TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,12,26,82,21 + CONTROL "&Real",IDC_MACRO_REAL,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,103,18,39,10 + CONTROL "&Manual",IDC_MACRO_MANUAL,"Button",BS_AUTORADIOBUTTON, + 103,32,39,10 + GROUPBOX "Replay Speed",IDC_STATIC,7,3,142,49 + DEFPUSHBUTTON "OK",IDOK,13,60,50,14 + PUSHBUTTON "Cancel",IDCANCEL,93,60,50,14 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -537,8 +564,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,5,0 - PRODUCTVERSION 1,3,5,0 + FILEVERSION 1,3,7,0 + PRODUCTVERSION 1,3,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -555,12 +582,12 @@ BEGIN BEGIN VALUE "CompanyName", "Sebastien Carlier & Christoph Gießelink\0" VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0" - VALUE "FileVersion", "1, 3, 5, 0\0" + VALUE "FileVersion", "1, 3, 7, 0\0" VALUE "InternalName", "Emu48\0" - VALUE "LegalCopyright", "Copyright © 2004\0" + VALUE "LegalCopyright", "Copyright © 2005\0" VALUE "OriginalFilename", "Emu48.exe\0" VALUE "ProductName", "Emu48\0" - VALUE "ProductVersion", "1, 3, 5, 0\0" + VALUE "ProductVersion", "1, 3, 7, 0\0" END END BLOCK "VarFileInfo" @@ -626,6 +653,17 @@ BEGIN 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 diff --git a/sources/GCCPatch/Makefile b/Sources/GCCPatch/Makefile similarity index 91% rename from sources/GCCPatch/Makefile rename to Sources/GCCPatch/Makefile index ada303c..fa073c3 100644 --- a/sources/GCCPatch/Makefile +++ b/Sources/GCCPatch/Makefile @@ -24,7 +24,7 @@ RSRCOBJ=$(PRJ).o OBJS=cursor.o disasm.o display.o debugger.o ddeserv.o \ emu48.o engine.o external.o fetch.o files.o i28f160.o keyboard.o \ - kml.o mops.o opcodes.o rpl.o serial.o settings.o timer.o \ + keymacro.o kml.o mops.o opcodes.o rpl.o serial.o settings.o timer.o \ $(RSRCOBJ) LIBS=-lwinmm -lcomctl32 @@ -85,6 +85,9 @@ i28f160.o: i28f160.c pch.h emu48.h types.h i28f160.h keyboard.o: keyboard.c pch.h emu48.h types.h io.h $(CC) $(CFLAGS) $(DEFINES) -c -o keyboard.o keyboard.c +keymacro.o: keymacro.c pch.h resource.h Emu48.h kml.h + $(CC) $(CFLAGS) $(DEFINES) -c -o keymacro.o keymacro.c + kml.o: kml.c pch.h resource.h emu48.h types.h kml.h $(CC) $(CFLAGS) $(DEFINES) -c -o kml.o kml.c diff --git a/sources/GCCPatch/PCH.H b/Sources/GCCPatch/PCH.H similarity index 50% rename from sources/GCCPatch/PCH.H rename to Sources/GCCPatch/PCH.H index eb9c052..698e95b 100644 --- a/sources/GCCPatch/PCH.H +++ b/Sources/GCCPatch/PCH.H @@ -15,10 +15,27 @@ #include // #include // missing file +#if !defined VERIFY +#if defined _DEBUG +#define VERIFY(f) _ASSERT(f) +#else // _DEBUG +#define VERIFY(f) ((VOID)(f)) +#endif // _DEBUG +#endif // _VERIFY + #if !defined IDC_HAND // Win2k specific definition #define IDC_HAND MAKEINTRESOURCE(32649) #endif -#if !defined _ASSERT - #define _ASSERT(a) // normally defined in missing CRTDBG.H +// normally defined in STDLIB.H +#if !defined __max + #define __max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#if !defined __min + #define __min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +// normally defined in missing CRTDBG.H +#if !defined _ASSERT + #define _ASSERT(a) #endif diff --git a/sources/GCCPatch/README.TXT b/Sources/GCCPatch/README.TXT similarity index 92% rename from sources/GCCPatch/README.TXT rename to Sources/GCCPatch/README.TXT index ed86f6b..4018795 100644 --- a/sources/GCCPatch/README.TXT +++ b/Sources/GCCPatch/README.TXT @@ -35,4 +35,4 @@ Many thanks to Pedro A. Arranda Guti compatible. -08/30/04 (c) by Christoph Gießelink +06/13/05 (c) by Christoph Gießelink diff --git a/sources/MkShared/MKSHARED.C b/Sources/MkShared/MKSHARED.C similarity index 100% rename from sources/MkShared/MKSHARED.C rename to Sources/MkShared/MKSHARED.C diff --git a/sources/MkShared/MKSHARED.DSP b/Sources/MkShared/MKSHARED.DSP similarity index 100% rename from sources/MkShared/MKSHARED.DSP rename to Sources/MkShared/MKSHARED.DSP diff --git a/sources/MkShared/MKSHARED.DSW b/Sources/MkShared/MKSHARED.DSW similarity index 100% rename from sources/MkShared/MKSHARED.DSW rename to Sources/MkShared/MKSHARED.DSW diff --git a/sources/MkShared/MKSHARED.ICO b/Sources/MkShared/MKSHARED.ICO similarity index 100% rename from sources/MkShared/MKSHARED.ICO rename to Sources/MkShared/MKSHARED.ICO diff --git a/sources/MkShared/MKSHARED.RC b/Sources/MkShared/MKSHARED.RC similarity index 100% rename from sources/MkShared/MKSHARED.RC rename to Sources/MkShared/MKSHARED.RC diff --git a/sources/MkShared/RESOURCE.H b/Sources/MkShared/RESOURCE.H similarity index 100% rename from sources/MkShared/RESOURCE.H rename to Sources/MkShared/RESOURCE.H diff --git a/sources/Mke48/MKE48.C b/Sources/Mke48/MKE48.C similarity index 100% rename from sources/Mke48/MKE48.C rename to Sources/Mke48/MKE48.C diff --git a/sources/Mke48/MKE48.DSP b/Sources/Mke48/MKE48.DSP similarity index 100% rename from sources/Mke48/MKE48.DSP rename to Sources/Mke48/MKE48.DSP diff --git a/sources/Mke48/TYPES.H b/Sources/Mke48/TYPES.H similarity index 100% rename from sources/Mke48/TYPES.H rename to Sources/Mke48/TYPES.H diff --git a/sources/Emu48/RESOURCE.H b/sources/Emu48/RESOURCE.H deleted file mode 100644 index 02e93b0..0000000 --- a/sources/Emu48/RESOURCE.H +++ /dev/null @@ -1,206 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Emu48.rc -// -#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 -#define RT_MANIFEST 24 -#define IDI_EMU48 100 -#define IDR_MENU 101 -#define IDR_DEBUG 102 -#define IDR_DEBUG_TOOLBAR 103 -#define IDR_DEBUG_CODE 104 -#define IDR_DEBUG_MEM 105 -#define IDR_DEBUG_STACK 106 -#define IDB_CHECKBOX 107 -#define IDD_ABOUT 108 -#define IDD_SETTINGS 109 -#define IDD_CHOOSEKML 110 -#define IDD_KMLLOG 111 -#define IDD_DISASM 112 -#define IDD_DEBUG 113 -#define IDD_NEWVALUE 114 -#define IDD_ENTERADR 115 -#define IDD_BREAKEDIT 116 -#define IDD_ENTERBREAK 117 -#define IDD_INSTRUCTIONS 118 -#define IDD_WRITEONLYREG 119 -#define IDD_FIND 120 -#define IDD_PROFILE 121 -#define IDC_REALSPEED 1000 -#define IDC_AUTOSAVE 1001 -#define IDC_AUTOSAVEONEXIT 1002 -#define IDC_OBJECTLOADWARNING 1003 -#define IDC_ALWAYSDISPLOG 1004 -#define IDC_PORT1EN 1005 -#define IDC_PORT1WR 1006 -#define IDC_PORT2ISSHARED 1007 -#define IDC_PORT2 1008 -#define IDC_WIRE 1009 -#define IDC_IR 1010 -#define IDC_EMUDIR 1011 -#define IDC_EMUDIRSEL 1012 -#define IDC_UPDATE 1013 -#define IDC_KMLSCRIPT 1014 -#define IDC_AUTHOR 1015 -#define IDC_TITLE 1016 -#define IDC_KMLLOG 1017 -#define IDC_VERSION 1018 -#define IDC_LICENSE 1019 -#define IDC_DISASM_WIN 1020 -#define IDC_DISASM_MAP 1021 -#define IDC_DISASM_ROM 1022 -#define IDC_DISASM_RAM 1023 -#define IDC_DISASM_PORT1 1024 -#define IDC_DISASM_PORT2 1025 -#define IDC_DISASM_MODULE 1026 -#define IDC_DISASM_HP 1027 -#define IDC_DISASM_CLASS 1028 -#define IDC_ADDRESS 1029 -#define IDC_DISASM_ADR 1030 -#define IDC_DISASM_NEXT 1031 -#define IDC_DISASM_COPY 1032 -#define IDC_DEBUG_CODE 1033 -#define IDC_STATIC_CODE 1034 -#define IDC_STATIC_REGISTERS 1035 -#define IDC_STATIC_MEMORY 1036 -#define IDC_STATIC_STACK 1037 -#define IDC_REG_A 1038 -#define IDC_REG_B 1039 -#define IDC_REG_C 1040 -#define IDC_REG_D 1041 -#define IDC_REG_R0 1042 -#define IDC_REG_R1 1043 -#define IDC_REG_R2 1044 -#define IDC_REG_R3 1045 -#define IDC_REG_R4 1046 -#define IDC_REG_D0 1047 -#define IDC_REG_D1 1048 -#define IDC_REG_P 1049 -#define IDC_REG_PC 1050 -#define IDC_REG_OUT 1051 -#define IDC_REG_IN 1052 -#define IDC_REG_ST 1053 -#define IDC_REG_CY 1054 -#define IDC_REG_MODE 1055 -#define IDC_REG_MP 1056 -#define IDC_REG_SR 1057 -#define IDC_REG_SB 1058 -#define IDC_REG_XM 1059 -#define IDC_MISC_INT 1060 -#define IDC_MISC_KEY 1061 -#define IDC_MISC_BS 1062 -#define IDC_NEWVALUE 1063 -#define IDC_ENTERADR 1064 -#define IDC_DEBUG_MEM 1065 -#define IDC_DEBUG_MEM_ADDR 1066 -#define IDC_DEBUG_MEM_COL0 1067 -#define IDC_DEBUG_MEM_COL1 1068 -#define IDC_DEBUG_MEM_COL2 1069 -#define IDC_DEBUG_MEM_COL3 1070 -#define IDC_DEBUG_MEM_COL4 1071 -#define IDC_DEBUG_MEM_COL5 1072 -#define IDC_DEBUG_MEM_COL6 1073 -#define IDC_DEBUG_MEM_COL7 1074 -#define IDC_DEBUG_MEM_TEXT 1075 -#define IDC_DEBUG_STACK 1076 -#define IDC_STATIC_BREAKPOINT 1077 -#define IDC_BREAKEDIT_ADD 1078 -#define IDC_BREAKEDIT_DELETE 1079 -#define IDC_BREAKEDIT_WND 1080 -#define IDC_STATIC_MMU 1081 -#define IDC_MMU_IO_A 1082 -#define IDC_MMU_NCE2_A 1083 -#define IDC_MMU_CE1_A 1084 -#define IDC_MMU_CE2_A 1085 -#define IDC_MMU_NCE3_A 1086 -#define IDC_MMU_IO_S 1087 -#define IDC_MMU_CE1_S 1088 -#define IDC_MMU_CE2_S 1089 -#define IDC_MMU_NCE2_S 1090 -#define IDC_MMU_NCE3_S 1091 -#define IDC_STATIC_MISC 1092 -#define IDC_MISC_BS_TXT 1093 -#define IDC_INSTR_TEXT 1094 -#define IDC_INSTR_CODE 1095 -#define IDC_INSTR_COPY 1096 -#define IDC_INSTR_CLEAR 1097 -#define IDC_PROFILE_LASTCYCLES 1098 -#define IDC_PROFILE_LASTTIME 1099 -#define IDC_BPCODE 1100 -#define IDC_BPRPL 1101 -#define IDC_BPACCESS 1102 -#define IDC_BPREAD 1103 -#define IDC_BPWRITE 1104 -#define IDC_FIND_DATA 1105 -#define IDC_FIND_ASCII 1106 -#define IDC_FIND_CASE 1107 -#define IDC_ADDR20_24 1108 -#define IDC_ADDR25_27 1109 -#define IDC_ADDR28_29 1110 -#define IDC_ADDR30_34 1111 -#define ID_FILE_NEW 40001 -#define ID_FILE_OPEN 40002 -#define ID_FILE_SAVE 40003 -#define ID_FILE_SAVEAS 40004 -#define ID_FILE_EXIT 40005 -#define ID_VIEW_COPY 40006 -#define ID_VIEW_SETTINGS 40007 -#define ID_VIEW_RESET 40008 -#define ID_OBJECT_LOAD 40009 -#define ID_OBJECT_SAVE 40010 -#define ID_ABOUT 40011 -#define ID_FILE_CLOSE 40013 -#define ID_BACKUP_SAVE 40014 -#define ID_BACKUP_RESTORE 40015 -#define ID_BACKUP_DELETE 40016 -#define ID_VIEW_SCRIPT 40017 -#define ID_STACK_COPY 40019 -#define ID_STACK_PASTE 40020 -#define ID_TOOL_DISASM 40021 -#define ID_TOOL_DEBUG 40022 -#define ID_DEBUG_RUN 40023 -#define ID_DEBUG_RUNCURSOR 40024 -#define ID_DEBUG_STEP 40025 -#define ID_DEBUG_STEPOVER 40026 -#define ID_DEBUG_BREAK 40027 -#define ID_DEBUG_STEPOUT 40028 -#define ID_DEBUG_CANCEL 40029 -#define ID_BREAKPOINTS_SETBREAK 40030 -#define ID_BREAKPOINTS_CODEEDIT 40031 -#define ID_BREAKPOINTS_CLEARALL 40032 -#define ID_BREAKPOINTS_NOP3 40033 -#define ID_BREAKPOINTS_DOCODE 40034 -#define ID_BREAKPOINTS_RPL 40035 -#define ID_DEBUG_CODE_GOADR 40036 -#define ID_DEBUG_CODE_GOPC 40037 -#define ID_DEBUG_CODE_SETPCTOSELECT 40038 -#define ID_DEBUG_MEM_GOADR 40039 -#define ID_DEBUG_MEM_GOPC 40040 -#define ID_DEBUG_MEM_GOD0 40041 -#define ID_DEBUG_MEM_GOD1 40042 -#define ID_DEBUG_MEM_GOSTACK 40043 -#define ID_DEBUG_MEM_FIND 40044 -#define ID_DEBUG_MEM_MAP 40045 -#define ID_DEBUG_MEM_NCE1 40046 -#define ID_DEBUG_MEM_NCE2 40047 -#define ID_DEBUG_MEM_CE1 40048 -#define ID_DEBUG_MEM_CE2 40049 -#define ID_DEBUG_MEM_NCE3 40050 -#define ID_DEBUG_STACK_PUSH 40051 -#define ID_DEBUG_STACK_POP 40052 -#define ID_DEBUG_STACK_MODIFY 40053 -#define ID_INTR_STEPOVERINT 40054 -#define ID_INFO_LASTINSTRUCTIONS 40055 -#define ID_INFO_PROFILE 40056 -#define ID_INFO_WRITEONLYREG 40057 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 122 -#define _APS_NEXT_COMMAND_VALUE 40058 -#define _APS_NEXT_CONTROL_VALUE 1112 -#define _APS_NEXT_SYMED_VALUE 108 -#endif -#endif diff --git a/uninst.exe b/uninst.exe new file mode 100755 index 0000000..bbec58e Binary files /dev/null and b/uninst.exe differ