2005-06-14: Updated to version 1.37

Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
Gwenhael Le Moine 2024-03-19 23:33:35 +01:00
parent ad9f53a38b
commit e1230f4415
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
73 changed files with 1338 additions and 517 deletions

0
CARDCOPY.EXE Normal file → Executable file
View file

0
Convert.exe Normal file → Executable file
View file

BIN
EMU48.EXE Normal file → Executable file

Binary file not shown.

View file

@ -19,9 +19,9 @@ recompile the sources to run Emu48 with Windows NT on a DEC Alpha.
**************** ****************
Emu48 is distributed in 1 archive: 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 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 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 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 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 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 the terms of the GNU General Public License as published by the Free Software

2
Emu48.url Normal file
View file

@ -0,0 +1,2 @@
[InternetShortcut]
URL=http://privat.swol.de/ChristophGiesselink/

0
MKE48.EXE Normal file → Executable file
View file

BIN
Macro/Mac2txt.exe Executable file

Binary file not shown.

121
Macro/Mac2txt.txt Normal file
View file

@ -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 <out> <in>
R <out> <in>
T <delay>
1.1) <P>ress key
P <out> <in>
means pressing a key, where <out> is the out and <in> 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) <R>elease key
R <out> <in>
means releasing a key, where <out> is the out and <in> is the in code of the
key.
1.3) <T>ime for delay
T <delay>
means waiting <delay> 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 <P>ress or <R>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 <ON> key, waiting for 70 ms and finally
releasing the <ON> 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 <out> code
Bit 15 - 0 = word with the <in> 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 <Browse> button for the source edit field is
calling a "Open" file dialog, where the <Browse> button for the destination edit
field is calling a "Save As" file dialog.
The button <Src -> 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 <Dest -> 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.

0
MkShared.exe Normal file → Executable file
View file

View file

@ -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) - 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, - quitting the emulator while programming the flash isn't allowed,
because the content of flash state machine isn't saved so far because the content of flash state machine isn't saved so far
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

0
ROMDUMP.EXE Normal file → Executable file
View file

View file

@ -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 Service Pack 35 for Emu48 Version 1.0
DDESERV.C DDESERV.C

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -53,7 +53,6 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,
{ {
// turn on HP // turn on HP
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(200);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
} }
@ -86,7 +85,6 @@ HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,
} }
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(200);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
// wait for sleep mode // wait for sleep mode
while(Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);

View file

@ -1675,7 +1675,7 @@ static BOOL CALLBACK Debugger(HWND hDlg, UINT message, DWORD wParam, LONG lParam
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
SetWindowLocation(hDlg,nDbgPosX,nDbgPosY); 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 hWndToolbar = CreateToolbar(hDlg); // add toolbar
CheckMenuItem(GetMenu(hDlg),ID_BREAKPOINTS_NOP3, bDbgNOP3 ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(GetMenu(hDlg),ID_BREAKPOINTS_NOP3, bDbgNOP3 ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(GetMenu(hDlg),ID_BREAKPOINTS_DOCODE,bDbgCode ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(GetMenu(hDlg),ID_BREAKPOINTS_DOCODE,bDbgCode ? MF_CHECKED : MF_UNCHECKED);

View file

@ -152,10 +152,8 @@ VOID CreateLcdBitmap(VOID)
bmiLcd.Lcd_bmih.biWidth = LCD_ROW * nLcdZoom; bmiLcd.Lcd_bmih.biWidth = LCD_ROW * nLcdZoom;
bmiLcd.Lcd_bmih.biHeight = -64 * nLcdZoom; bmiLcd.Lcd_bmih.biHeight = -64 * nLcdZoom;
_ASSERT(hLcdDC == NULL); _ASSERT(hLcdDC == NULL);
hLcdDC = CreateCompatibleDC(hWindowDC); VERIFY(hLcdDC = CreateCompatibleDC(hWindowDC));
_ASSERT(hLcdDC != NULL); VERIFY(hLcdBitmap = CreateDIBSection(hLcdDC,(BITMAPINFO*)&bmiLcd,DIB_RGB_COLORS,(VOID **)&pbyLcd,NULL,0));
hLcdBitmap = CreateDIBSection(hLcdDC,(BITMAPINFO*)&bmiLcd,DIB_RGB_COLORS,(VOID **)&pbyLcd,NULL,0);
_ASSERT(hLcdBitmap != NULL);
hLcdBitmap = SelectObject(hLcdDC,hLcdBitmap); hLcdBitmap = SelectObject(hLcdDC,hLcdBitmap);
_ASSERT(hPalette != NULL); _ASSERT(hPalette != NULL);
SelectPalette(hLcdDC,hPalette,FALSE); // set palette for LCD DC SelectPalette(hLcdDC,hPalette,FALSE); // set palette for LCD DC
@ -185,11 +183,8 @@ VOID DestroyLcdBitmap(VOID)
BOOL CreateMainBitmap(LPCTSTR szFilename) BOOL CreateMainBitmap(LPCTSTR szFilename)
{ {
HPALETTE hAssertPalette;
_ASSERT(hWindowDC != NULL); _ASSERT(hWindowDC != NULL);
hMainDC = CreateCompatibleDC(hWindowDC); VERIFY(hMainDC = CreateCompatibleDC(hWindowDC));
_ASSERT(hMainDC != NULL);
if (hMainDC == NULL) return FALSE; // quit if failed if (hMainDC == NULL) return FALSE; // quit if failed
hMainBitmap = LoadBitmapFile(szFilename); hMainBitmap = LoadBitmapFile(szFilename);
if (hMainBitmap == NULL) if (hMainBitmap == NULL)
@ -199,8 +194,7 @@ BOOL CreateMainBitmap(LPCTSTR szFilename)
} }
hMainBitmap = SelectObject(hMainDC,hMainBitmap); hMainBitmap = SelectObject(hMainDC,hMainBitmap);
_ASSERT(hPalette != NULL); _ASSERT(hPalette != NULL);
hAssertPalette = SelectPalette(hMainDC,hPalette,FALSE); VERIFY(SelectPalette(hMainDC,hPalette,FALSE));
_ASSERT(hAssertPalette != NULL);
RealizePalette(hMainDC); RealizePalette(hMainDC);
return TRUE; return TRUE;
} }
@ -371,13 +365,15 @@ VOID UpdateMenuDisplay(VOID)
for (y = nLines; y < 64; ++y) for (y = nLines; y < 64; ++y)
{ {
Npeek(Buf,d+Chipset.start2,34); // 34 nibbles are viewed 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]);
DIBPIXEL(p,Pattern[(Buf[x]>>1) & 1]); DIBPIXEL(p,Pattern[(Buf[x]>>1) & 1]);
DIBPIXEL(p,Pattern[(Buf[x]>>2) & 1]); DIBPIXEL(p,Pattern[(Buf[x]>>2) & 1]);
DIBPIXEL(p,Pattern[(Buf[x]>>3) & 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); CopyMemory(p, p-LCD_ROW*4, LCD_ROW*4);
p+=LCD_ROW*4; p+=LCD_ROW*4;
CopyMemory(p, p-LCD_ROW*8, LCD_ROW*8); CopyMemory(p, p-LCD_ROW*8, LCD_ROW*8);
@ -390,11 +386,13 @@ VOID UpdateMenuDisplay(VOID)
for (y = nLines; y < 64; ++y) for (y = nLines; y < 64; ++y)
{ {
Npeek(Buf,d+Chipset.start2,34); // 34 nibbles are viewed 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]&3]);
DIBPIXEL(p,Pattern[Buf[x]>>2]); 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); CopyMemory(p, p-LCD_ROW*2, LCD_ROW*2);
p+=LCD_ROW*2; p+=LCD_ROW*2;
d+=34; d+=34;
@ -405,10 +403,12 @@ VOID UpdateMenuDisplay(VOID)
for (y = nLines; y < 64; ++y) for (y = nLines; y < 64; ++y)
{ {
Npeek(Buf,d+Chipset.start2,34); // 34 nibbles are viewed 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]]); DIBPIXEL(p,Pattern[Buf[x]]);
} }
// adjust pointer to 36 DIBPIXEL drawing calls
p += (36-34) * 1 * sizeof(DWORD);
d+=34; d+=34;
} }
} }
@ -582,23 +582,14 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s)
p=(DWORD*)(pbyLcd+y*LCD_ROW*16); p=(DWORD*)(pbyLcd+y*LCD_ROW*16);
} else p+=4; } else p+=4;
} }
EnterCriticalSection(&csGDILock); // solving NT GDI problems if (y0!=y) // modified more than 1 line
{ {
if (y0!=y) x = 34; // full line
{ x0 = 0; // no offset
y0<<=2; y<<=2;
BitBlt(hWindowDC, nLcdX, nLcdY+y0, 524, y-y0+4, hLcdDC, 0, y0, SRCCOPY);
} }
else x0<<=4; x<<=4; // calculate pixel address
{
x0<<=4; x<<=4;
y0<<=2; y<<=2; y0<<=2; y<<=2;
if (x>524) x=524; if (x>524) x=524;
BitBlt(hWindowDC, nLcdX+x0, nLcdY+y0, x-x0, y-y0+4, hLcdDC, x0, y0, SRCCOPY);
}
GdiFlush();
}
LeaveCriticalSection(&csGDILock);
} }
if (nLcdZoom == 2) if (nLcdZoom == 2)
{ {
@ -620,23 +611,14 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s)
p=(DWORD*)(pbyLcd+y*LCD_ROW*4); p=(DWORD*)(pbyLcd+y*LCD_ROW*4);
} else p+=2; } else p+=2;
} }
EnterCriticalSection(&csGDILock); // solving NT GDI problems if (y0!=y) // modified more than 1 line
{ {
if (y0!=y) x = 34; // full line
{ x0 = 0; // no offset
y0<<=1; y<<=1;
BitBlt(hWindowDC, nLcdX, nLcdY+y0, 262, y-y0+2, hLcdDC, 0, y0, SRCCOPY);
} }
else x0<<=3; x<<=3; // calculate pixel address
{
x0<<=3; x<<=3;
y0<<=1; y<<=1; y0<<=1; y<<=1;
if (x>262) x=262; if (x>262) x=262;
BitBlt(hWindowDC, nLcdX+x0, nLcdY+y0, x-x0, y-y0+2, hLcdDC, x0, y0, SRCCOPY);
}
GdiFlush();
}
LeaveCriticalSection(&csGDILock);
} }
if (nLcdZoom == 1) if (nLcdZoom == 1)
{ {
@ -654,22 +636,21 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s)
p=(DWORD*)(pbyLcd+y*LCD_ROW); p=(DWORD*)(pbyLcd+y*LCD_ROW);
} else p++; } else p++;
} }
if (y0!=y) // modified more than 1 line
{
x = 34; // full line
x0 = 0; // no offset
}
x0<<=2; x<<=2; // calculate pixel address
if (x>131) x=131;
}
EnterCriticalSection(&csGDILock); // solving NT GDI problems EnterCriticalSection(&csGDILock); // solving NT GDI problems
{ {
if (y0!=y) BitBlt(hWindowDC, nLcdX+x0, nLcdY+y0, x-x0, y-y0+nLcdZoom, hLcdDC, x0, y0, SRCCOPY);
{
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(); GdiFlush();
} }
LeaveCriticalSection(&csGDILock); LeaveCriticalSection(&csGDILock);
}
#endif #endif
return; return;
} }
@ -784,8 +765,7 @@ VOID StartDisplay(BYTE byInitial)
// adjust startup counter to get the right VBL value // adjust startup counter to get the right VBL value
lLcdRef.QuadPart -= ((LONGLONG) ((0x7E - byInitial) & 0x3F) * lFreq.QuadPart) >> 12; lLcdRef.QuadPart -= ((LONGLONG) ((0x7E - byInitial) & 0x3F) * lFreq.QuadPart) >> 12;
uLcdTimerId = timeSetEvent(DISPLAY_FREQ,0,(LPTIMECALLBACK)&LcdProc,0,TIME_PERIODIC); VERIFY(uLcdTimerId = timeSetEvent(DISPLAY_FREQ,0,(LPTIMECALLBACK)&LcdProc,0,TIME_PERIODIC));
_ASSERT(uLcdTimerId); // test if display update timer started
} }
return; return;
} }

View file

@ -13,7 +13,7 @@
#include "kml.h" #include "kml.h"
#include "debugger.h" #include "debugger.h"
#define VERSION "1.35" #define VERSION "1.37"
#define CF_HPOBJ "CF_HPOBJ" // clipboard format for DDE #define CF_HPOBJ "CF_HPOBJ" // clipboard format for DDE
#define MAXPORTS 256 // number of COM ports #define MAXPORTS 256 // number of COM ports
@ -139,6 +139,9 @@ VOID UpdateWindowStatus(VOID)
EnableMenuItem(hMenu,ID_VIEW_SCRIPT,uRun); EnableMenuItem(hMenu,ID_VIEW_SCRIPT,uRun);
EnableMenuItem(hMenu,ID_TOOL_DISASM,uRun); EnableMenuItem(hMenu,ID_TOOL_DISASM,uRun);
EnableMenuItem(hMenu,ID_TOOL_DEBUG,(bRun && nDbgState == DBG_OFF) ? MF_ENABLED : MF_GRAYED); 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; return;
} }
@ -162,6 +165,7 @@ VOID CopyItemsToClipboard(HWND hWnd) // save selected Listbox Items to Clipboar
if ((lpnCount = HeapAlloc(hHeap,0,i * sizeof(INT))) != NULL) if ((lpnCount = HeapAlloc(hHeap,0,i * sizeof(INT))) != NULL)
{ {
LPTSTR lpszData;
HANDLE hClipObj; HANDLE hClipObj;
LONG j,lMem = 0; 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); i = SendMessage(hWnd,LB_GETSELITEMS,i,(LPARAM) lpnCount);
for (j = 0;j < i;++j) // scan all selected items 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; lMem += SendMessage(hWnd,LB_GETTEXTLEN,lpnCount[j],0) + 2;
} }
// allocate clipboard data // allocate clipboard data
if ((hClipObj = GlobalAlloc(GMEM_MOVEABLE,lMem + 1)) != NULL) if ((hClipObj = GlobalAlloc(GMEM_MOVEABLE,(lMem + 1) * sizeof(*lpszData))) != NULL)
{ {
LPBYTE lpData; if ((lpszData = GlobalLock(hClipObj)))
if ((lpData = GlobalLock(hClipObj)))
{ {
for (j = 0;j < i;++j) // scan all selected items for (j = 0;j < i;++j) // scan all selected items
{ {
#if defined _UNICODE lpszData += SendMessage(hWnd,LB_GETTEXT,lpnCount[j],(LPARAM) lpszData);
{ *lpszData++ = _T('\r');
INT nLength = SendMessage(hWnd,LB_GETTEXTLEN,lpnCount[j],0) + 1; *lpszData++ = _T('\n');
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;
} }
} *lpszData = 0; // set EOS
#else
{
lpData += SendMessage(hWnd,LB_GETTEXT,lpnCount[j],(LPARAM) lpData);
}
#endif
*lpData++ = '\r';
*lpData++ = '\n';
}
*lpData = 0; // set end of string
GlobalUnlock(hClipObj); // unlock memory GlobalUnlock(hClipObj); // unlock memory
} }
if (OpenClipboard(hWnd)) if (OpenClipboard(hWnd))
{ {
if (EmptyClipboard()) if (EmptyClipboard())
#if defined _UNICODE
SetClipboardData(CF_UNICODETEXT,hClipObj);
#else
SetClipboardData(CF_TEXT,hClipObj); SetClipboardData(CF_TEXT,hClipObj);
#endif
else else
GlobalFree(hClipObj); GlobalFree(hClipObj);
CloseClipboard(); 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); hComm = CreateFile(szBuffer,GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
if(hComm != INVALID_HANDLE_VALUE) if(hComm != INVALID_HANDLE_VALUE)
{ {
BOOL bError = CloseHandle(hComm); VERIFY(CloseHandle(hComm));
_ASSERT(bError);
bAdd = TRUE; bAdd = TRUE;
} }
@ -329,11 +315,30 @@ static BOOL CALLBACK SettingsProc(HWND hDlg, UINT message, DWORD wParam, LONG lP
// hide port2 settings // hide port2 settings
EnableWindow(GetDlgItem(hDlg,IDC_PORT2ISSHARED),FALSE); EnableWindow(GetDlgItem(hDlg,IDC_PORT2ISSHARED),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PORT2),FALSE); EnableWindow(GetDlgItem(hDlg,IDC_PORT2),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PORT2LOAD),FALSE);
} }
return TRUE; return TRUE;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) 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: case IDOK:
if (Chipset.Port1Size && cCurrentRomType!='X') 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.IORam[CARDCTL] & ECDT) != 0 && (Chipset.IORam[TIMER2_CTRL] & RUN) != 0
) )
{ {
Chipset.HST |= MP; // set Module Pulled Chipset.HST |= MP; // set Module Pulled
IOBit(SRQ2,NINT,FALSE); // set NINT to low IOBit(SRQ2,NINT,FALSE); // set NINT to low
Chipset.SoftInt = TRUE; // set interrupt Chipset.SoftInt = TRUE; // set interrupt
@ -569,9 +573,7 @@ static LRESULT OnDropFiles(HANDLE hFilesInfo)
{ {
// turn on HP // turn on HP
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(200);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
Sleep(200);
} }
_ASSERT(nState == SM_RUN); // emulator must be in RUN state _ASSERT(nState == SM_RUN); // emulator must be in RUN state
@ -603,7 +605,6 @@ static LRESULT OnDropFiles(HANDLE hFilesInfo)
goto cancel; goto cancel;
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(200);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
// wait for sleep mode // wait for sleep mode
while(Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);
@ -805,6 +806,13 @@ static LRESULT OnStackPaste(VOID) // paste data to stack
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;
// check if clipboard format is available
if (!IsClipboardFormatAvailable(CF_TEXT))
{
MessageBeep(MB_OK); // error beep
return 0;
}
SuspendDebugger(); // suspend debugger SuspendDebugger(); // suspend debugger
bDbgAutoStateCtrl = FALSE; // disable automatic debugger state control bDbgAutoStateCtrl = FALSE; // disable automatic debugger state control
@ -812,9 +820,8 @@ static LRESULT OnStackPaste(VOID) // paste data to stack
if (!(Chipset.IORam[BITOFFSET]&DON)) if (!(Chipset.IORam[BITOFFSET]&DON))
{ {
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(200);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
Sleep(200);
// wait for sleep mode // wait for sleep mode
while(Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);
} }
@ -829,9 +836,6 @@ static LRESULT OnStackPaste(VOID) // paste data to stack
_ASSERT(nState == SM_SLEEP); _ASSERT(nState == SM_SLEEP);
if (OpenClipboard(hWnd)) if (OpenClipboard(hWnd))
{
if ( IsClipboardFormatAvailable(CF_TEXT)
|| IsClipboardFormatAvailable(CF_OEMTEXT))
{ {
if ((hClipObj = GetClipboardData(CF_TEXT))) if ((hClipObj = GetClipboardData(CF_TEXT)))
{ {
@ -847,11 +851,6 @@ static LRESULT OnStackPaste(VOID) // paste data to stack
GlobalUnlock(hClipObj); GlobalUnlock(hClipObj);
} }
} }
}
else // unknown clipboard format
{
MessageBeep(MB_OK); // error beep
}
CloseClipboard(); CloseClipboard();
} }
@ -863,7 +862,6 @@ static LRESULT OnStackPaste(VOID) // paste data to stack
goto cancel; goto cancel;
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(200);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
// wait for sleep mode // wait for sleep mode
@ -1095,9 +1093,8 @@ static LRESULT OnObjectLoad(VOID)
if (!(Chipset.IORam[BITOFFSET]&DON)) if (!(Chipset.IORam[BITOFFSET]&DON))
{ {
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(200);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
Sleep(200);
// wait for sleep mode // wait for sleep mode
while(Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);
} }
@ -1152,7 +1149,6 @@ static LRESULT OnObjectLoad(VOID)
while (nState!=nNextState) Sleep(0); while (nState!=nNextState) Sleep(0);
_ASSERT(nState == SM_RUN); _ASSERT(nState == SM_RUN);
KeyboardEvent(TRUE,0,0x8000); KeyboardEvent(TRUE,0,0x8000);
Sleep(200);
KeyboardEvent(FALSE,0,0x8000); KeyboardEvent(FALSE,0,0x8000);
while(Chipset.Shutdn == FALSE) Sleep(0); while(Chipset.Shutdn == FALSE) Sleep(0);
@ -1329,24 +1325,28 @@ static LRESULT OnAbout(VOID)
static LRESULT OnLButtonDown(UINT nFlags, WORD x, WORD y) static LRESULT OnLButtonDown(UINT nFlags, WORD x, WORD y)
{ {
if (nMacroState == MACRO_PLAY) return 0; // playing macro
if (nState == SM_RUN) MouseButtonDownAt(nFlags, x,y); if (nState == SM_RUN) MouseButtonDownAt(nFlags, x,y);
return 0; return 0;
} }
static LRESULT OnLButtonUp(UINT nFlags, WORD x, WORD y) 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); if (nState == SM_RUN) MouseButtonUpAt(nFlags, x,y);
return 0; return 0;
} }
static LRESULT OnMouseMove(UINT nFlags, WORD x, WORD y) 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); if (nState == SM_RUN) MouseMovesTo(nFlags, x,y);
return 0; return 0;
} }
static LRESULT OnKeyDown(int nVirtKey, DWORD lKeyData) static LRESULT OnKeyDown(int nVirtKey, DWORD lKeyData)
{ {
if (nMacroState == MACRO_PLAY) return 0; // playing macro
// call RunKey() only once (suppress autorepeat feature) // call RunKey() only once (suppress autorepeat feature)
if (nState == SM_RUN && (lKeyData & 0x40000000) == 0) if (nState == SM_RUN && (lKeyData & 0x40000000) == 0)
RunKey((BYTE)nVirtKey, TRUE); RunKey((BYTE)nVirtKey, TRUE);
@ -1355,6 +1355,7 @@ static LRESULT OnKeyDown(int nVirtKey, DWORD lKeyData)
static LRESULT OnKeyUp(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); if (nState == SM_RUN) RunKey((BYTE)nVirtKey, FALSE);
return 0; return 0;
UNREFERENCED_PARAMETER(lKeyData); UNREFERENCED_PARAMETER(lKeyData);
@ -1415,6 +1416,10 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar
case ID_OBJECT_SAVE: return OnObjectSave(); case ID_OBJECT_SAVE: return OnObjectSave();
case ID_TOOL_DISASM: return OnToolDisasm(); case ID_TOOL_DISASM: return OnToolDisasm();
case ID_TOOL_DEBUG: return OnToolDebug(); 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(); case ID_ABOUT: return OnAbout();
} }
break; break;
@ -1506,6 +1511,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
QueryPerformanceCounter(&lAppStart); QueryPerformanceCounter(&lAppStart);
GetCurrentDirectory(ARRAYSIZEOF(szCurrentDirectory), szCurrentDirectory); GetCurrentDirectory(ARRAYSIZEOF(szCurrentDirectory), szCurrentDirectory);
szCurrentKml[0] = 0; // no KML file selected
ReadSettings(); ReadSettings();

View file

@ -202,6 +202,10 @@ SOURCE=.\keyboard.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\keymacro.c
# End Source File
# Begin Source File
SOURCE=.\kml.c SOURCE=.\kml.c
# End Source File # End Source File
# Begin Source File # Begin Source File

View file

@ -55,6 +55,10 @@
#define VIEW_SHORT FALSE // view of disassembler output #define VIEW_SHORT FALSE // view of disassembler output
#define VIEW_LONG TRUE #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_POINTER 0x01 // defines for display area
#define DISP_MAIN 0x02 #define DISP_MAIN 0x02
#define DISP_MENUE 0x04 #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 ScanKeyboard(BOOL bActive, BOOL bReset);
extern VOID KeyboardEvent(BOOL bPress, UINT out, UINT in); extern VOID KeyboardEvent(BOOL bPress, UINT out, UINT in);
// Keymacro.c
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 // RPL.c
extern DWORD RPL_SkipOb(DWORD d); extern DWORD RPL_SkipOb(DWORD d);
extern DWORD RPL_ObjectSize(BYTE *o); extern DWORD RPL_ObjectSize(BYTE *o);

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -140,6 +140,14 @@ BEGIN
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 162 BOTTOMMARGIN, 162
END END
IDD_MACROSET, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 149
TOPMARGIN, 7
BOTTOMMARGIN, 74
END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
@ -217,7 +225,7 @@ FONT 8, "MS Sans Serif"
BEGIN BEGIN
ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE
LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP
LTEXT "Copyright © 2004 Sébastien Carlier && Christoph Gießelink", LTEXT "Copyright © 2005 Sébastien Carlier && Christoph Gießelink",
IDC_STATIC,29,18,181,8 IDC_STATIC,29,18,181,8
DEFPUSHBUTTON "OK",IDOK,215,12,39,14 DEFPUSHBUTTON "OK",IDOK,215,12,39,14
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL | EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
@ -252,7 +260,8 @@ BEGIN
CONTROL "Port 2 is Shared",IDC_PORT2ISSHARED,"Button", CONTROL "Port 2 is Shared",IDC_PORT2ISSHARED,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,13,131,65,10 BS_AUTOCHECKBOX | WS_TABSTOP,13,131,65,10
LTEXT "Port 2 File :",IDC_STATIC,13,147,37,8 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 GROUPBOX "Memory Cards",IDC_STATIC,7,110,153,51
LTEXT "Wire:",IDC_STATIC,13,176,17,8 LTEXT "Wire:",IDC_STATIC,13,176,17,8
COMBOBOX IDC_WIRE,31,174,48,42,CBS_DROPDOWNLIST | WS_VSCROLL | COMBOBOX IDC_WIRE,31,174,48,42,CBS_DROPDOWNLIST | WS_VSCROLL |
@ -289,7 +298,7 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,86,146,50,14 DEFPUSHBUTTON "OK",IDOK,86,146,50,14
PUSHBUTTON "Cancel",IDCANCEL,164,146,50,14 PUSHBUTTON "Cancel",IDCANCEL,164,146,50,14
CONTROL "Always",IDC_ALWAYSDISPLOG,"Button",BS_AUTOCHECKBOX | 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 GROUPBOX "",IDC_STATIC,7,7,287,36
CTEXT "Title of the Script",IDC_TITLE,71,14,158,8 CTEXT "Title of the Script",IDC_TITLE,71,14,158,8
CTEXT "by",IDC_STATIC,71,22,158,8 CTEXT "by",IDC_STATIC,71,22,158,8
@ -472,6 +481,24 @@ BEGIN
DEFPUSHBUTTON "Cancel",IDCANCEL,129,148,50,14 DEFPUSHBUTTON "Cancel",IDCANCEL,129,148,50,14
END 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 VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,5,0 FILEVERSION 1,3,7,0
PRODUCTVERSION 1,3,5,0 PRODUCTVERSION 1,3,7,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -527,12 +554,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Sebastien Carlier & Christoph Gießelink\0" VALUE "CompanyName", "Sebastien Carlier & Christoph Gießelink\0"
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\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 "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2004\0" VALUE "LegalCopyright", "Copyright © 2005\0"
VALUE "OriginalFilename", "Emu48.exe\0" VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0" VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 3, 5, 0\0" VALUE "ProductVersion", "1, 3, 7, 0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -598,6 +625,17 @@ BEGIN
BEGIN BEGIN
MENUITEM "D&isassembler...", ID_TOOL_DISASM MENUITEM "D&isassembler...", ID_TOOL_DISASM
MENUITEM "&Debugger...", ID_TOOL_DEBUG 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 END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN

View file

@ -287,27 +287,18 @@ static __inline VOID AdjustSpeed(VOID) // adjust emulation speed
LARGE_INTEGER lAct; LARGE_INTEGER lAct;
do do
{ {
BOOL bErr = QueryPerformanceCounter(&lAct); VERIFY(QueryPerformanceCounter(&lAct));
_ASSERT(bErr); // no high-resolution performance counter
}
while((dwTicks = lAct.LowPart-dwSpeedRef) <= dwTickRef);
// workaround for QueryPerformanceCounter() in Win2k, // get time difference
// if last command sequence took over 50ms -> synchronize dwTicks = lAct.LowPart - dwSpeedRef;
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 // ticks elapsed or negative number (workaround for QueryPerformanceCounter() in Win2k)
{ while(dwTicks <= dwTickRef || (dwTicks & 0x80000000) != 0);
dwOldCyc += T2CYCLES; // adjust cycles reference dwOldCyc += T2CYCLES; // adjust cycles reference
dwSpeedRef += dwTickRef; // adjust reference time dwSpeedRef += dwTickRef; // adjust reference time
} }
} }
}
LeaveCriticalSection(&csSlowLock); LeaveCriticalSection(&csSlowLock);
} }
return; return;
@ -379,7 +370,7 @@ VOID UpdateKdnBit(VOID) // update KDN bit
{ {
if ( Chipset.intk if ( Chipset.intk
&& (Chipset.IORam[TIMER2_CTRL]&RUN) != 0 && (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); IOBit(SRQ2,KDN,Chipset.in != 0);
return; return;
} }
@ -517,6 +508,7 @@ UINT WorkerThread(LPVOID pParam)
loop: loop:
while (nNextState == SM_INVALID) // go into invalid state while (nNextState == SM_INVALID) // go into invalid state
{ {
OnToolMacroStop(); // close open keyboard macro handler
CommClose(); // close COM port CommClose(); // close COM port
bCommInit = FALSE; // COM port not open bCommInit = FALSE; // COM port not open
nState = SM_INVALID; // in invalid state nState = SM_INVALID; // in invalid state

View file

@ -87,15 +87,11 @@ WORD WriteStack(LPBYTE lpBuf,DWORD dwSize) // separated from LoadObject()
} }
else else
{ // load as string { // load as string
BYTE lpHead[5];
dwSize *= 2; dwSize *= 2;
dwAddress = RPL_CreateTemp(dwSize+10); dwAddress = RPL_CreateTemp(dwSize+10);
if (dwAddress == 0) return S_ERR_ASCII; if (dwAddress == 0) return S_ERR_ASCII;
Write5(dwAddress,0x02A2C); // String
Nunpack(lpHead,0x02A2C,5); // String Write5(dwAddress+5,dwSize+5); // length of String
Nwrite(lpHead,dwAddress,5);
Nunpack(lpHead,dwSize+5,5); // length of String
Nwrite(lpHead,dwAddress+5,5);
Nwrite(lpBuf,dwAddress+10,dwSize); // data Nwrite(lpBuf,dwAddress+10,dwSize); // data
} }
RPL_Push(dwAddress); RPL_Push(dwAddress);
@ -394,6 +390,13 @@ BOOL MapRom(LPCTSTR szFilename)
dwRomSize = 0; dwRomSize = 0;
return FALSE; 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; return TRUE;
} }
@ -774,12 +777,9 @@ BOOL OpenDocument(LPCTSTR szFilename)
SetWindowLocation(hWnd,Chipset.nPosX,Chipset.nPosY); SetWindowLocation(hWnd,Chipset.nPosX,Chipset.nPosY);
if (szCurrentKml == NULL)
{
if (!DisplayChooseKml(Chipset.type))
goto restore;
}
while (TRUE) while (TRUE)
{
if (szCurrentKml[0]) // KML file name
{ {
BOOL bOK; BOOL bOK;
@ -788,9 +788,12 @@ BOOL OpenDocument(LPCTSTR szFilename)
if (bOK) break; if (bOK) break;
KillKML(); KillKML();
}
if (!DisplayChooseKml(Chipset.type)) if (!DisplayChooseKml(Chipset.type))
goto restore; goto restore;
} }
// reload old button state
ReloadButtons(Chipset.Keyboard_Row,sizeof(Chipset.Keyboard_Row));
FlashInit(); // init flash structure FlashInit(); // init flash structure
@ -1242,7 +1245,13 @@ BOOL LoadObject(LPCTSTR szFilename) // separated stack writing part
LPBYTE lpBuf; LPBYTE lpBuf;
WORD wError; 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; if (hFile == INVALID_HANDLE_VALUE) return FALSE;
dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh); dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh);
if (dwFileSizeHigh != 0) 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; 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; return (lpbi->biBitCount <= 8) ? (1 << lpbi->biBitCount) : 0;
} }
static HPALETTE CreateBIPalette(LPBITMAPINFOHEADER lpbi) static HPALETTE CreateBIPalette(BITMAPINFOHEADER CONST *lpbi)
{ {
LOGPALETTE* pPal; LOGPALETTE* pPal;
HPALETTE hpal = NULL; HPALETTE hpal = NULL;

View file

@ -94,12 +94,18 @@ VOID KeyboardEvent(BOOL bPress, UINT out, UINT in)
{ {
if (nState != SM_RUN) // not in running state if (nState != SM_RUN) // not in running state
return; // ignore key return; // ignore key
KeyMacroRecord(bPress,out,in); // save all keyboard events
if (in == 0x8000) // ON key ? if (in == 0x8000) // ON key ?
{ {
Chipset.IR15X = bPress?0x8000:0x0000; // refresh special ON key flag Chipset.IR15X = bPress?0x8000:0x0000; // refresh special ON key flag
} }
else else
{ {
// "out" is outside Keyboard_Row
if (out >= ARRAYSIZEOF(Chipset.Keyboard_Row)) return;
_ASSERT(out < ARRAYSIZEOF(Chipset.Keyboard_Row)); _ASSERT(out < ARRAYSIZEOF(Chipset.Keyboard_Row));
if (bPress) // key pressed if (bPress) // key pressed
Chipset.Keyboard_Row[out] |= in; // set key marker in keyboard row Chipset.Keyboard_Row[out] |= in; // set key marker in keyboard row

339
Sources/Emu48/KEYMACRO.C Normal file
View file

@ -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;
}

View file

@ -37,7 +37,7 @@ static KmlLine* If(KmlLine* pLine, BOOL bCondition);
static KmlLine* RunLine(KmlLine* pLine); static KmlLine* RunLine(KmlLine* pLine);
static KmlBlock* LoadKMLGlobal(LPCTSTR szFilename); static KmlBlock* LoadKMLGlobal(LPCTSTR szFilename);
KmlBlock* pKml; KmlBlock* pKml = NULL;
static KmlBlock* pVKey[256]; static KmlBlock* pVKey[256];
static BYTE byVKeyMap[256]; static BYTE byVKeyMap[256];
static KmlButton pButton[256]; static KmlButton pButton[256];
@ -105,13 +105,12 @@ static KmlToken pLexToken[] =
{0, 000000, 0,_T("")}, {0, 000000, 0,_T("")},
}; };
static TokenId eIsBlock[] = static CONST TokenId eIsBlock[] =
{ {
TOK_IFFLAG, TOK_IFFLAG,
TOK_IFPRESSED, TOK_IFPRESSED,
TOK_ONDOWN, TOK_ONDOWN,
TOK_ONUP, TOK_ONUP
TOK_NONE
}; };
static BOOL bClicking = FALSE; static BOOL bClicking = FALSE;
@ -128,7 +127,6 @@ static UINT uLastPressedKey = 0; // var for last pressed key
static UINT nLogLength = 0; static UINT nLogLength = 0;
static LPTSTR szLog = NULL; static LPTSTR szLog = NULL;
static BOOL bKmlLogOkEnabled = FALSE;
static VOID ClearLog() static VOID ClearLog()
{ {
@ -141,12 +139,12 @@ static VOID ClearLog()
return; 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) if (szLog == NULL)
{ {
nLogLength = nLength + 3; // CR+LF+\0 nLogLength = nLength + 1; // \0
szLog = HeapAlloc(hHeap,0,nLogLength*sizeof(szLog[0])); szLog = HeapAlloc(hHeap,0,nLogLength*sizeof(szLog[0]));
if (szLog==NULL) if (szLog==NULL)
{ {
@ -157,7 +155,7 @@ static VOID AddToLog(LPTSTR szString)
} }
else 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) if (szLogTmp == NULL)
{ {
ClearLog(); ClearLog();
@ -165,7 +163,7 @@ static VOID AddToLog(LPTSTR szString)
} }
szLog = szLogTmp; szLog = szLogTmp;
lstrcpy(&szLog[nLogLength-1],szString); lstrcpy(&szLog[nLogLength-1],szString);
nLogLength += nLength + 2; // CR+LF nLogLength += nLength;
} }
szLog[nLogLength-3] = _T('\r'); szLog[nLogLength-3] = _T('\r');
szLog[nLogLength-2] = _T('\n'); szLog[nLogLength-2] = _T('\n');
@ -175,27 +173,25 @@ static VOID AddToLog(LPTSTR szString)
static VOID __cdecl PrintfToLog(LPCTSTR lpFormat, ...) static VOID __cdecl PrintfToLog(LPCTSTR lpFormat, ...)
{ {
LPTSTR lpOutput; TCHAR cOutput[1024];
va_list arglist; va_list arglist;
va_start(arglist,lpFormat); va_start(arglist,lpFormat);
lpOutput = HeapAlloc(hHeap,0,1024 * sizeof(lpOutput[0])); wvsprintf(cOutput,lpFormat,arglist);
wvsprintf(lpOutput,lpFormat,arglist); AddToLog(cOutput);
AddToLog(lpOutput);
HeapFree(hHeap,0,lpOutput);
va_end(arglist); va_end(arglist);
return; return;
} }
static BOOL CALLBACK KMLLogProc(HWND hDlg, UINT message, DWORD wParam, LONG lParam) static BOOL CALLBACK KMLLogProc(HWND hDlg, UINT message, DWORD wParam, LONG lParam)
{ {
LPTSTR szString; LPCTSTR szString;
switch (message) switch (message)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
// set OK // set OK
EnableWindow(GetDlgItem(hDlg,IDOK),bKmlLogOkEnabled); EnableWindow(GetDlgItem(hDlg,IDOK),lParam);
// set IDC_TITLE // set IDC_TITLE
szString = GetStringParam(pKml, TOK_GLOBAL, TOK_TITLE, 0); szString = GetStringParam(pKml, TOK_GLOBAL, TOK_TITLE, 0);
if (szString == NULL) szString = _T("Untitled"); 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("<Unknown Author>"); if (szString == NULL) szString = _T("<Unknown Author>");
SetDlgItemText(hDlg,IDC_AUTHOR,szString); SetDlgItemText(hDlg,IDC_AUTHOR,szString);
// set IDC_KMLLOG // set IDC_KMLLOG
if (szLog == NULL) szString = szLog;
SetDlgItemText(hDlg,IDC_KMLLOG,_T("Memory Allocation Failure.")); if (szString == NULL) szString = _T("Memory Allocation Failure.");
else SetDlgItemText(hDlg,IDC_KMLLOG,szString);
SetDlgItemText(hDlg,IDC_KMLLOG,szLog);
// set IDC_ALWAYSDISPLOG // set IDC_ALWAYSDISPLOG
CheckDlgButton(hDlg,IDC_ALWAYSDISPLOG,bAlwaysDisplayLog); CheckDlgButton(hDlg,IDC_ALWAYSDISPLOG,bAlwaysDisplayLog);
// redraw window
InvalidateRect(hDlg, NULL, TRUE);
return TRUE; return TRUE;
case WM_COMMAND: case WM_COMMAND:
wParam = LOWORD(wParam); wParam = LOWORD(wParam);
@ -225,16 +218,15 @@ static BOOL CALLBACK KMLLogProc(HWND hDlg, UINT message, DWORD wParam, LONG lPar
break; break;
} }
return FALSE; return FALSE;
UNREFERENCED_PARAMETER(lParam);
UNREFERENCED_PARAMETER(hDlg);
} }
BOOL DisplayKMLLog(BOOL bOkEnabled) BOOL DisplayKMLLog(BOOL bOkEnabled)
{ {
BOOL bResult; return IDOK == DialogBoxParam(hApp,
bKmlLogOkEnabled = bOkEnabled; MAKEINTRESOURCE(IDD_KMLLOG),
bResult = DialogBox(hApp, MAKEINTRESOURCE(IDD_KMLLOG), hWnd, (DLGPROC)KMLLogProc); hWnd,
return (bResult == IDOK); (DLGPROC)KMLLogProc,
bOkEnabled);
} }
@ -253,8 +245,7 @@ typedef struct _KmlScript
struct _KmlScript* pNext; struct _KmlScript* pNext;
} KmlScript; } KmlScript;
static UINT nKmlFiles; static KmlScript* pKmlList = NULL;
static KmlScript* pKmlList;
static CHAR cKmlType; static CHAR cKmlType;
static VOID DestroyKmlList(VOID) static VOID DestroyKmlList(VOID)
@ -269,7 +260,6 @@ static VOID DestroyKmlList(VOID)
HeapFree(hHeap,0,pKmlList); HeapFree(hHeap,0,pKmlList);
pKmlList = pList; pKmlList = pList;
} }
nKmlFiles = 0;
return; return;
} }
@ -277,12 +267,14 @@ static VOID CreateKmlList(VOID)
{ {
HANDLE hFindFile; HANDLE hFindFile;
WIN32_FIND_DATA pFindFileData; WIN32_FIND_DATA pFindFileData;
UINT nKmlFiles;
_ASSERT(pKmlList == NULL); // KML file list must be empty
SetCurrentDirectory(szEmuDirectory); SetCurrentDirectory(szEmuDirectory);
hFindFile = FindFirstFile(_T("*.KML"),&pFindFileData); hFindFile = FindFirstFile(_T("*.KML"),&pFindFileData);
SetCurrentDirectory(szCurrentDirectory); SetCurrentDirectory(szCurrentDirectory);
nKmlFiles = 0;
if (hFindFile == INVALID_HANDLE_VALUE) return; if (hFindFile == INVALID_HANDLE_VALUE) return;
nKmlFiles = 0;
do do
{ {
KmlScript* pScript; KmlScript* pScript;
@ -307,10 +299,10 @@ static VOID CreateKmlList(VOID)
continue; continue;
} }
} }
pScript = HeapAlloc(hHeap,0,sizeof(KmlScript)); VERIFY(pScript = HeapAlloc(hHeap,0,sizeof(KmlScript)));
pScript->szFilename = DuplicateString(pFindFileData.cFileName); pScript->szFilename = DuplicateString(pFindFileData.cFileName);
szTitle = GetStringParam(pBlock,TOK_GLOBAL,TOK_TITLE,0); 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); pScript->szTitle = DuplicateString(szTitle);
FreeBlocks(pBlock); FreeBlocks(pBlock);
pScript->nId = nKmlFiles; pScript->nId = nKmlFiles;
@ -429,13 +421,13 @@ static BOOL CALLBACK ChooseKMLProc(HWND hDlg, UINT message, DWORD wParam, LONG l
pList = pKmlList; pList = pKmlList;
while (pList) while (pList)
{ {
if (pList->nId == nIndex) break; if (pList->nId == nIndex)
pList = pList->pNext;
}
if (pList)
{ {
lstrcpy(szCurrentKml, pList->szFilename); lstrcpy(szCurrentKml, pList->szFilename);
EndDialog(hDlg, IDOK); EndDialog(hDlg, IDOK);
break;
}
pList = pList->pNext;
} }
return TRUE; return TRUE;
case IDCANCEL: case IDCANCEL:
@ -542,19 +534,17 @@ static VOID CleanLex(VOID)
return; return;
} }
// TODO: Change this poor (and slow!) code
static BOOL IsBlock(TokenId eId) static BOOL IsBlock(TokenId eId)
{ {
UINT uBlock = 0; UINT i;
while (eIsBlock[uBlock] != TOK_NONE)
for (i = 0; i < ARRAYSIZEOF(eIsBlock); ++i)
{ {
if (eId == eIsBlock[uBlock]) return TRUE; if (eId == eIsBlock[i]) return TRUE;
uBlock++;
} }
return FALSE; return FALSE;
} }
static LPCTSTR GetStringOf(TokenId eId) static LPCTSTR GetStringOf(TokenId eId)
{ {
UINT i = 0; UINT i = 0;
@ -649,37 +639,36 @@ static DWORD ParseInteger(VOID)
static LPTSTR ParseString(VOID) static LPTSTR ParseString(VOID)
{ {
LPTSTR szString; LPTSTR lpszString;
LPTSTR szBuffer;
UINT nLength; UINT nLength;
UINT nBlock; UINT nBlock;
szText++; szText++; // skip leading '"'
nLength = 0; nLength = 0;
nBlock = 255; nBlock = 256;
szBuffer = HeapAlloc(hHeap,0,(nBlock+1) * sizeof(szBuffer[0])); lpszString = HeapAlloc(hHeap,0,nBlock * sizeof(lpszString[0]));
while (*szText != _T('"')) while (*szText != _T('"'))
{ {
if (*szText == _T('\\')) szText++; if (nLength == nBlock - 1) // ran out of buffer space
if (*szText == 0)
{ {
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(); FatalError();
return NULL; return NULL;
} }
szBuffer[nLength] = *szText; lpszString[nLength++] = *szText++; // save char
nLength++;
if (nLength == nBlock)
{
nBlock += 256;
szBuffer = HeapReAlloc(hHeap,0,szBuffer,(nBlock+1) * sizeof(szBuffer[0]));
} }
szText++; szText++; // skip ending '"'
} lpszString[nLength] = 0; // set EOS
szText++;
szBuffer[nLength] = 0; // release unnecessary allocated bytes
szString = DuplicateString(szBuffer); return HeapReAlloc(hHeap,0,lpszString,(nLength+1) * sizeof(lpszString[0]));
HeapFree(hHeap,0,szBuffer);
return szString;
} }
static TokenId Lex(UINT nMode) static TokenId Lex(UINT nMode)
@ -783,7 +772,13 @@ static KmlLine* IncludeLines(LPCTSTR szFilename)
KmlLine* pLine; KmlLine* pLine;
SetCurrentDirectory(szEmuDirectory); 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); SetCurrentDirectory(szCurrentDirectory);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {
@ -951,7 +946,13 @@ static KmlBlock* IncludeBlocks(LPCTSTR szFilename)
KmlBlock* pFirst; KmlBlock* pFirst;
SetCurrentDirectory(szEmuDirectory); 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); SetCurrentDirectory(szCurrentDirectory);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {
@ -1786,6 +1787,19 @@ static VOID ReleaseAllButtons(VOID) // release all buttons
uButtonClicked = 0; // set var to default uButtonClicked = 0; // set var to default
} }
VOID ReloadButtons(BYTE *Keyboard_Row, UINT nSize)
{
UINT i;
for (i=0; i<nButtons; i++) // scan all buttons
{
if (pButton[i].nOut < nSize) // valid out code
{
// get state of button from keyboard matrix
pButton[i].bDown = ((Keyboard_Row[pButton[i].nOut] & pButton[i].nIn) != 0);
}
}
}
VOID RefreshButtons(RECT *rc) VOID RefreshButtons(RECT *rc)
{ {
UINT i; UINT i;
@ -2008,6 +2022,32 @@ VOID RunKey(BYTE nId, BOOL bPressed)
//################
//#
//# Macro player
//#
//################
VOID PlayKey(UINT nOut, UINT nIn, BOOL bPressed)
{
// scan from last buttons because LCD buttons mostly defined first
INT i = nButtons;
while (--i >= 0)
{
if (pButton[i].nOut == nOut && pButton[i].nIn == nIn)
{
if (bPressed)
PressButton(i);
else
ReleaseButton(i);
return;
}
}
return;
}
//################ //################
//# //#
//# Load and Initialize Script //# Load and Initialize Script
@ -2022,7 +2062,13 @@ static KmlBlock* LoadKMLGlobal(LPCTSTR szFilename)
DWORD eToken; DWORD eToken;
SetCurrentDirectory(szEmuDirectory); 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); SetCurrentDirectory(szCurrentDirectory);
if (hFile == INVALID_HANDLE_VALUE) return NULL; if (hFile == INVALID_HANDLE_VALUE) return NULL;
if ((lpBuf = MapKMLFile(hFile)) == NULL) if ((lpBuf = MapKMLFile(hFile)) == NULL)
@ -2042,7 +2088,6 @@ static KmlBlock* LoadKMLGlobal(LPCTSTR szFilename)
return pBlock; return pBlock;
} }
BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog) BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog)
{ {
HANDLE hFile; HANDLE hFile;
@ -2055,7 +2100,13 @@ BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog)
nBlocksIncludeLevel = 0; nBlocksIncludeLevel = 0;
PrintfToLog(_T("Reading %s"), szFilename); PrintfToLog(_T("Reading %s"), szFilename);
SetCurrentDirectory(szEmuDirectory); 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); SetCurrentDirectory(szCurrentDirectory);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {

View file

@ -112,10 +112,12 @@ extern KmlBlock* pKml;
extern BOOL DisplayChooseKml(CHAR cType); extern BOOL DisplayChooseKml(CHAR cType);
extern VOID FreeBlocks(KmlBlock* pBlock); extern VOID FreeBlocks(KmlBlock* pBlock);
extern VOID DrawAnnunciator(UINT nId, BOOL bOn); extern VOID DrawAnnunciator(UINT nId, BOOL bOn);
extern VOID ReloadButtons(BYTE *Keyboard_Row, UINT nSize);
extern VOID RefreshButtons(RECT *rc); extern VOID RefreshButtons(RECT *rc);
extern VOID MouseButtonDownAt(UINT nFlags, DWORD x, DWORD y); extern VOID MouseButtonDownAt(UINT nFlags, DWORD x, DWORD y);
extern VOID MouseButtonUpAt(UINT nFlags, DWORD x, DWORD y); extern VOID MouseButtonUpAt(UINT nFlags, DWORD x, DWORD y);
extern VOID MouseMovesTo(UINT nFlags, DWORD x, DWORD y); extern VOID MouseMovesTo(UINT nFlags, DWORD x, DWORD y);
extern VOID RunKey(BYTE nId, BOOL bPressed); extern VOID RunKey(BYTE nId, BOOL bPressed);
extern VOID PlayKey(UINT nOut, UINT nIn, BOOL bPressed);
extern BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog); extern BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog);
extern VOID KillKML(VOID); extern VOID KillKML(VOID);

View file

@ -1242,13 +1242,6 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s)
} }
#endif #endif
if (d>=0x38)
{
Nunpack(Chipset.IORam+0x38, ReadT2(), 8);
memcpy(Chipset.IORam+d,a,s);
SetT2(Npack(Chipset.IORam+0x38,8));
return;
}
do do
{ {
c = *a; c = *a;
@ -1294,7 +1287,7 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s)
Chipset.IORam[d]=c; Chipset.IORam[d]=c;
Chipset.contrast = (Chipset.contrast&0x10)|c; Chipset.contrast = (Chipset.contrast&0x10)|c;
UpdateContrast(Chipset.contrast); UpdateContrast(Chipset.contrast);
disp |= (DISP_POINTER | DISP_MAIN | DISP_MENUE); disp |= (DISP_MAIN | DISP_MENUE);
} }
break; break;
@ -1307,7 +1300,7 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s)
Chipset.IORam[d]=c; Chipset.IORam[d]=c;
Chipset.contrast = (Chipset.contrast&0x0f)|((c&1)<<4); Chipset.contrast = (Chipset.contrast&0x0f)|((c&1)<<4);
UpdateContrast(Chipset.contrast); UpdateContrast(Chipset.contrast);
disp |= (DISP_POINTER | DISP_MAIN | DISP_MENUE); disp |= (DISP_MAIN | DISP_MENUE);
} }
break; break;
@ -1683,11 +1676,21 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s)
// 00138 @ hardware timer (38-3F), decremented 8192 times/s // 00138 @ hardware timer (38-3F), decremented 8192 times/s
// nothing - fall through to default // 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++; a++; d++;
} while (--s); } while (--s);
finish:
if (bDISPADDR) // 0x120-0x124 changed if (bDISPADDR) // 0x120-0x124 changed
{ {
b = Npack(Chipset.IORam+0x20,5)&0xFFFFE; b = Npack(Chipset.IORam+0x20,5)&0xFFFFE;

View file

@ -962,7 +962,9 @@ VOID o801(LPBYTE I) // OUT=C
VOID o802(LPBYTE I) // A=IN VOID o802(LPBYTE I) // A=IN
{ {
w.cycles+=7; 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) ScanKeyboard(TRUE,FALSE); // update Chipset.in register (direct)
IOBit(0x19,8,w.in != 0); // update KDN bit in the SRQ register IOBit(0x19,8,w.in != 0); // update KDN bit in the SRQ register
Nunpack(w.A, w.in, 4); Nunpack(w.A, w.in, 4);
@ -972,7 +974,9 @@ VOID o802(LPBYTE I) // A=IN
VOID o803(LPBYTE I) // C=IN VOID o803(LPBYTE I) // C=IN
{ {
w.cycles+=7; 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) ScanKeyboard(TRUE,FALSE); // update Chipset.in register (direct)
IOBit(0x19,8,w.in != 0); // update KDN bit in the SRQ register IOBit(0x19,8,w.in != 0); // update KDN bit in the SRQ register
Nunpack(w.C, w.in, 4); Nunpack(w.C, w.in, 4);

View file

@ -243,6 +243,8 @@ static __inline void Nsub(BYTE *a, BYTE *b, UINT s)
if ((a[i] & 0xF0) != 0) // check overflow if ((a[i] & 0xF0) != 0) // check overflow
{ {
a[i] += cBase; a[i] += cBase;
// illegal number in dec mode
if ((a[i] & 0xF0) != 0) a[i] &= 0x7;
c = 1; c = 1;
} }
else else
@ -263,6 +265,8 @@ static __inline void Nrsub(BYTE *a, BYTE *b, UINT s)
if ((a[i] & 0xF0) != 0) // check overflow if ((a[i] & 0xF0) != 0) // check overflow
{ {
a[i] += cBase; a[i] += cBase;
// illegal number in dec mode
if ((a[i] & 0xF0) != 0) a[i] &= 0x7;
c = 1; c = 1;
} }
else else

View file

@ -15,6 +15,14 @@
#include <direct.h> #include <direct.h>
#include <crtdbg.h> #include <crtdbg.h>
#if !defined VERIFY
#if defined _DEBUG
#define VERIFY(f) _ASSERT(f)
#else // _DEBUG
#define VERIFY(f) ((VOID)(f))
#endif // _DEBUG
#endif // _VERIFY
#if !defined IDC_HAND // Win2k specific definition #if !defined IDC_HAND // Win2k specific definition
#define IDC_HAND MAKEINTRESOURCE(32649) #define IDC_HAND MAKEINTRESOURCE(32649)
#endif #endif

217
Sources/Emu48/RESOURCE.H Normal file
View file

@ -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

View file

@ -155,6 +155,9 @@ VOID ReadSettings(VOID)
dwSXCycles = ReadInt(_T("Emulator"),_T("SXCycles"),dwSXCycles); dwSXCycles = ReadInt(_T("Emulator"),_T("SXCycles"),dwSXCycles);
dwGXCycles = ReadInt(_T("Emulator"),_T("GXCycles"),dwGXCycles); dwGXCycles = ReadInt(_T("Emulator"),_T("GXCycles"),dwGXCycles);
SetSpeed(bRealSpeed); // set speed SetSpeed(bRealSpeed); // set speed
// Macro
bMacroRealSpeed = ReadInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed);
nMacroTimeout = ReadInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout);
// Serial // Serial
ReadString(_T("Serial"),_T("Wire"),_T(NO_SERIAL),szSerialWire,ARRAYSIZEOF(szSerialWire)); ReadString(_T("Serial"),_T("Wire"),_T(NO_SERIAL),szSerialWire,ARRAYSIZEOF(szSerialWire));
ReadString(_T("Serial"),_T("Ir"),_T(NO_SERIAL),szSerialIr,ARRAYSIZEOF(szSerialIr)); 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("RealSpeed"),bRealSpeed);
WriteInt(_T("Emulator"),_T("SXCycles"),dwSXCycles); WriteInt(_T("Emulator"),_T("SXCycles"),dwSXCycles);
WriteInt(_T("Emulator"),_T("GXCycles"),dwGXCycles); WriteInt(_T("Emulator"),_T("GXCycles"),dwGXCycles);
// Macro
WriteInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed);
WriteInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout);
// Serial // Serial
WriteString(_T("Serial"),_T("Wire"),szSerialWire); WriteString(_T("Serial"),_T("Wire"),szSerialWire);
WriteString(_T("Serial"),_T("Ir"),szSerialIr); WriteString(_T("Serial"),_T("Ir"),szSerialIr);

View file

@ -37,12 +37,11 @@ static BOOL bNINT2T2 = FALSE; // state of NINT2 affected from timer2
static BOOL bAccurateTimer; // flag if accurate timer is used static BOOL bAccurateTimer; // flag if accurate timer is used
static LARGE_INTEGER lT2Ref; // counter value at timer2 start static LARGE_INTEGER lT2Ref; // counter value at timer2 start
static TIMECAPS tc; // timer information 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 dwT2Ref; // timer2 value at last timer2 access
static DWORD dwT2Cyc; // cpu cycle counter 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 void CALLBACK TimeProc(UINT uEventId, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
static DWORD CalcT2(VOID) // calculate timer2 value static DWORD CalcT2(VOID) // calculate timer2 value
@ -180,14 +179,13 @@ static VOID RescheduleT2(BOOL bRefPoint)
{ {
uDelay = CalcT2(); // actual timer value for delay uDelay = CalcT2(); // actual timer value for delay
} }
uDelay &= 0x7FFFFFFF; // execute timer2 event when MSB change if ((bOutRange = uDelay > uT2MaxTicks)) // delay greater maximum delay
uDelay = (uDelay + 7) >> 3; // timer delay in ms uDelay = uT2MaxTicks; // wait maximum delay time
uDelay = MAX(tc.wPeriodMin,uDelay); // wait minimum delay of timer uDelay = (uDelay * 125 + 1023) / 1024; // timer delay in ms (1000/8192 = 125/1024)
if ((bOutRange = uDelay > tc.wPeriodMax)) // delay greater maximum delay uDelay = __max(tc.wPeriodMin,uDelay); // wait minimum delay of timer
uDelay = tc.wPeriodMax; // wait maximum delay time _ASSERT(uDelay <= tc.wPeriodMax); // inside maximum event delay
// start timer2; schedule event, when Chipset.t2 will be zero (Chipset.t2 / 8 = time in ms) // start timer2; schedule event, when Chipset.t2 will be zero
uT2TimerId = timeSetEvent(uDelay,0,(LPTIMECALLBACK)&TimeProc,2,TIME_ONESHOT); VERIFY(uT2TimerId = timeSetEvent(uDelay,0,(LPTIMECALLBACK)&TimeProc,2,TIME_ONESHOT));
_ASSERT(uT2TimerId); // test if timer2 started
return; return;
} }
@ -315,13 +313,17 @@ VOID StartTimers(VOID)
bNINT2T1 = (Chipset.IORam[TIMER1_CTRL]&INTR) != 0 && (Chipset.t1 & 8) != 0; bNINT2T1 = (Chipset.IORam[TIMER1_CTRL]&INTR) != 0 && (Chipset.t1 & 8) != 0;
bNINT2T2 = (Chipset.IORam[TIMER2_CTRL]&INTR) != 0 && (Chipset.t2 & 0x80000000) != 0; bNINT2T2 = (Chipset.IORam[TIMER2_CTRL]&INTR) != 0 && (Chipset.t2 & 0x80000000) != 0;
timeGetDevCaps(&tc,sizeof(tc)); // get timer resolution 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 CheckT1(Chipset.t1); // check for timer1 interrupts
CheckT2(Chipset.t2); // check for timer2 interrupts CheckT2(Chipset.t2); // check for timer2 interrupts
// set timer resolution to 1 ms, if failed don't use "Accurate timer" // set timer resolution to greatest possible one
bAccurateTimer = (timeBeginPeriod(1) == TIMERR_NOERROR); bAccurateTimer = (timeBeginPeriod(tc.wPeriodMin) == TIMERR_NOERROR);
// set timer1 with given period // set timer1 with given period
uT1TimerId = timeSetEvent(T1_FREQ,0,(LPTIMECALLBACK)&TimeProc,1,TIME_PERIODIC); VERIFY(uT1TimerId = timeSetEvent(T1_FREQ,0,(LPTIMECALLBACK)&TimeProc,1,TIME_PERIODIC));
_ASSERT(uT1TimerId); // test if timer1 started
RescheduleT2(TRUE); // start timer2 RescheduleT2(TRUE); // start timer2
} }
return; return;
@ -349,7 +351,7 @@ VOID StopTimers(VOID)
bStarted = FALSE; bStarted = FALSE;
if (bAccurateTimer) // "Accurate timer" running if (bAccurateTimer) // "Accurate timer" running
{ {
timeEndPeriod(1); // finish service timeEndPeriod(tc.wPeriodMin); // finish service
} }
return; return;
} }
@ -410,7 +412,6 @@ VOID SetT1(BYTE byValue)
} }
LeaveCriticalSection(&csT1Lock); LeaveCriticalSection(&csT1Lock);
// restart timer1 to get full period of frequency // restart timer1 to get full period of frequency
uT1TimerId = timeSetEvent(T1_FREQ,0,(LPTIMECALLBACK)&TimeProc,1,TIME_PERIODIC); VERIFY(uT1TimerId = timeSetEvent(T1_FREQ,0,(LPTIMECALLBACK)&TimeProc,1,TIME_PERIODIC));
_ASSERT(uT1TimerId); // test if timer1 started
return; return;
} }

View file

@ -140,6 +140,14 @@ BEGIN
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 162 BOTTOMMARGIN, 162
END END
IDD_MACROSET, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 149
TOPMARGIN, 7
BOTTOMMARGIN, 74
END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
@ -217,7 +225,7 @@ FONT 8, "MS Sans Serif"
BEGIN BEGIN
ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE
LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP
LTEXT "Copyright © 2004 Sébastien Carlier && Christoph Gießelink", LTEXT "Copyright © 2005 Sébastien Carlier && Christoph Gießelink",
IDC_STATIC,29,18,181,8 IDC_STATIC,29,18,181,8
DEFPUSHBUTTON "OK",IDOK,215,12,39,14 DEFPUSHBUTTON "OK",IDOK,215,12,39,14
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL | EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
@ -252,7 +260,8 @@ BEGIN
CONTROL "Port 2 is Shared",IDC_PORT2ISSHARED,"Button", CONTROL "Port 2 is Shared",IDC_PORT2ISSHARED,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,13,131,65,10 BS_AUTOCHECKBOX | WS_TABSTOP,13,131,65,10
LTEXT "Port 2 File :",IDC_STATIC,13,147,37,8 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 GROUPBOX "Memory Cards",IDC_STATIC,7,110,153,51
LTEXT "Wire:",IDC_STATIC,13,176,17,8 LTEXT "Wire:",IDC_STATIC,13,176,17,8
COMBOBOX IDC_WIRE,31,174,48,42,CBS_DROPDOWNLIST | WS_VSCROLL | COMBOBOX IDC_WIRE,31,174,48,42,CBS_DROPDOWNLIST | WS_VSCROLL |
@ -289,7 +298,7 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,86,146,50,14 DEFPUSHBUTTON "OK",IDOK,86,146,50,14
PUSHBUTTON "Cancel",IDCANCEL,164,146,50,14 PUSHBUTTON "Cancel",IDCANCEL,164,146,50,14
CONTROL "Always",IDC_ALWAYSDISPLOG,"Button",BS_AUTOCHECKBOX | 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 GROUPBOX "",IDC_STATIC,7,7,287,36
CTEXT "Title of the Script",IDC_TITLE,71,14,158,8 CTEXT "Title of the Script",IDC_TITLE,71,14,158,8
CTEXT "by",IDC_STATIC,71,22,158,8 CTEXT "by",IDC_STATIC,71,22,158,8
@ -472,6 +481,24 @@ BEGIN
DEFPUSHBUTTON "Cancel",IDCANCEL,129,148,50,14 DEFPUSHBUTTON "Cancel",IDCANCEL,129,148,50,14
END 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 VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,5,0 FILEVERSION 1,3,7,0
PRODUCTVERSION 1,3,5,0 PRODUCTVERSION 1,3,7,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -555,12 +582,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Sebastien Carlier & Christoph Gießelink\0" VALUE "CompanyName", "Sebastien Carlier & Christoph Gießelink\0"
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\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 "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2004\0" VALUE "LegalCopyright", "Copyright © 2005\0"
VALUE "OriginalFilename", "Emu48.exe\0" VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0" VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 3, 5, 0\0" VALUE "ProductVersion", "1, 3, 7, 0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -626,6 +653,17 @@ BEGIN
BEGIN BEGIN
MENUITEM "D&isassembler...", ID_TOOL_DISASM MENUITEM "D&isassembler...", ID_TOOL_DISASM
MENUITEM "&Debugger...", ID_TOOL_DEBUG 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 END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN

View file

@ -24,7 +24,7 @@ RSRCOBJ=$(PRJ).o
OBJS=cursor.o disasm.o display.o debugger.o ddeserv.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 \ 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) $(RSRCOBJ)
LIBS=-lwinmm -lcomctl32 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 keyboard.o: keyboard.c pch.h emu48.h types.h io.h
$(CC) $(CFLAGS) $(DEFINES) -c -o keyboard.o keyboard.c $(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 kml.o: kml.c pch.h resource.h emu48.h types.h kml.h
$(CC) $(CFLAGS) $(DEFINES) -c -o kml.o kml.c $(CC) $(CFLAGS) $(DEFINES) -c -o kml.o kml.c

View file

@ -15,10 +15,27 @@
#include <direct.h> #include <direct.h>
// #include <crtdbg.h> // missing file // #include <crtdbg.h> // missing file
#if !defined VERIFY
#if defined _DEBUG
#define VERIFY(f) _ASSERT(f)
#else // _DEBUG
#define VERIFY(f) ((VOID)(f))
#endif // _DEBUG
#endif // _VERIFY
#if !defined IDC_HAND // Win2k specific definition #if !defined IDC_HAND // Win2k specific definition
#define IDC_HAND MAKEINTRESOURCE(32649) #define IDC_HAND MAKEINTRESOURCE(32649)
#endif #endif
#if !defined _ASSERT // normally defined in STDLIB.H
#define _ASSERT(a) // normally defined in missing CRTDBG.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 #endif

View file

@ -35,4 +35,4 @@ Many thanks to Pedro A. Arranda Guti
compatible. compatible.
08/30/04 (c) by Christoph Gießelink 06/13/05 (c) by Christoph Gießelink

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -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

BIN
uninst.exe Executable file

Binary file not shown.