2024-09-25: Updated to version 1.67
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
parent
22744c9772
commit
0a4432a193
67 changed files with 32277 additions and 31986 deletions
|
@ -342,11 +342,13 @@ NCE3 | nc. | RAM 128KB | nc. | Slt2 32KB-4MB | RAM 128KB
|
||||||
|
|
||||||
- Load Memory Data...
|
- Load Memory Data...
|
||||||
|
|
||||||
The "Load Memory Data" dialog box allows loading memory dump files to the specified address inside the Saturn address area. The specified address must point to RAM, writing into ROM areas isn't possible. The memory dump file must be in packed data format, meaning each byte in file contain two Saturn data nibbles with the low nibble containing the even and the high nibble the following odd address. The disadvantage of packed files is that you cannot load memory files with an odd number of data nibbles, but the advantage is that you can directly load an assembler output to memory.
|
The "Load Memory Data" dialog box allows loading memory dump files to the specified address inside the Saturn address area. The specified address must point to RAM, writing into ROM areas isn't possible. The memory dump file maybe in packed data format (8-bit), meaning each byte in file contain two Saturn data nibbles with the low nibble containing the even and the high nibble the following odd address or in unpacked data format (4-bit) with 4-bit in each byte.
|
||||||
|
|
||||||
|
The Auto mode tries to detect the packed or unpacked data format automatically. This may fail, when the memory dump only contain 00-Bytes, then all upper 4 bit are always zero which is an indicator for an unpacked data format. If you're not sure if the Auto detection will work, use the manual data format selection please.
|
||||||
|
|
||||||
- Save Memory Data...
|
- Save Memory Data...
|
||||||
|
|
||||||
The "Save Memory Data" dialog box allows saving the data of the specified Saturn address area into a memory dump file. The memory dump file contain the data in packed data format, meaning each byte in file contain two Saturn data nibbles with the low nibble containing the even and the high nibble the following odd address.
|
The "Save Memory Data" dialog box allows saving the data of the specified Saturn address area into a memory dump file. The memory dump file may contain the data in packed data format (8-bit), meaning each byte in file contain two Saturn data nibbles with the low nibble containing the even and the high nibble the following odd address or in unpacked data format (4-bit) with 4-bit in each byte.
|
||||||
|
|
||||||
- RPL Object Viewer...
|
- RPL Object Viewer...
|
||||||
|
|
||||||
|
@ -393,4 +395,4 @@ The Miscellaneous window show you the internal state of the interrupt flag, the
|
||||||
You can change the values by pressing the left mouse button over the old content.
|
You can change the values by pressing the left mouse button over the old content.
|
||||||
|
|
||||||
|
|
||||||
08/12/19 (c) by Christoph Gießelink
|
04/19/24 (c) by Christoph Gießelink
|
||||||
|
|
BIN
Emu48.exe
BIN
Emu48.exe
Binary file not shown.
30
Emu48.htm
30
Emu48.htm
|
@ -526,10 +526,10 @@ h3 { color:red; font-size:1.1em; }
|
||||||
"String" object in stack level 1 to the clipboard. On all
|
"String" object in stack level 1 to the clipboard. On all
|
||||||
other objects, the command will be ignored. This prevents sending
|
other objects, the command will be ignored. This prevents sending
|
||||||
binary objects to the clipboard.</p>
|
binary objects to the clipboard.</p>
|
||||||
<p>The decimal point (radix mark) of "Real Numbers" in the
|
<p>The decimal point of "Real Numbers" in the clipboard is
|
||||||
clipboard is equal to the calculator setting. This is important when
|
equal to the calculator setting. This is important when you try to
|
||||||
you try to paste the numbers into a program using the locale settings
|
paste the numbers into a program using the locale settings of the host
|
||||||
of the host operating system.</p>
|
operating system.</p>
|
||||||
<h2><a name=ss9.5>9.5 Paste Stack</a></h2>
|
<h2><a name=ss9.5>9.5 Paste Stack</a></h2>
|
||||||
<p>This menu item is enabled for the HP48SX, HP48GX and the HP49G
|
<p>This menu item is enabled for the HP48SX, HP48GX and the HP49G
|
||||||
emulation.</p>
|
emulation.</p>
|
||||||
|
@ -539,14 +539,18 @@ h3 { color:red; font-size:1.1em; }
|
||||||
object. Is the content a complex number object, the number will be
|
object. Is the content a complex number object, the number will be
|
||||||
saved as "Complex Number" object, otherwise cases as
|
saved as "Complex Number" object, otherwise cases as
|
||||||
"String" object.</p>
|
"String" object.</p>
|
||||||
<p>To import "Real or Complex Numbers" from the clipboard, the
|
<p>To import "Real Numbers" from the clipboard, the decimal
|
||||||
decimal point (radix mark) of the clipboard and calculator <u>must</u>
|
point character of the clipboard and calculator <u>must not match</u> any
|
||||||
match. A real or complex number is only detected in the case of valid
|
more. There's an auto detection for decoding the thousands separator and
|
||||||
real number characters in the clipboard. Especially heading and tailing
|
decimal point character. The thousands separator is removed at decoding.
|
||||||
white spaces aren't valid number characters also.</p>
|
A real number is detected in the case of valid real number characters in
|
||||||
<p>Complex numbers must be in the form <i>(a,b)</i> when using the point
|
the clipboard.</p>
|
||||||
radix mark or in the form <i>(a;b)</i> when using the comma radix mark.
|
<p>"Complex Numbers" must be in the form <i>(a,b)</i> when
|
||||||
The Cartesian or algebraic form <i>a+bi</i> is not supported.</p>
|
using the decimal point or in the form <i>(a;b)</i> when using the decimal
|
||||||
|
comma. Using a thousands separator is not allowed in complex number
|
||||||
|
strings because in decimal point mode, the comma is used as separator
|
||||||
|
between real and imaginary part of the number. The Cartesian or algebraic
|
||||||
|
form <i>a+bi</i> is not supported.</p>
|
||||||
<h2><a name=ss9.6>9.6 Reset Calculator</a></h2>
|
<h2><a name=ss9.6>9.6 Reset Calculator</a></h2>
|
||||||
<p>This emulates the Reset pin of the internal CPU.</p>
|
<p>This emulates the Reset pin of the internal CPU.</p>
|
||||||
<h2><a name=ss9.7>9.7 Backup</a></h2>
|
<h2><a name=ss9.7>9.7 Backup</a></h2>
|
||||||
|
@ -636,7 +640,7 @@ h3 { color:red; font-size:1.1em; }
|
||||||
</table>
|
</table>
|
||||||
<h1><a name=s14>14. License</a></h1>
|
<h1><a name=s14>14. License</a></h1>
|
||||||
<p>Emu48 - A HP38G/39G/40G/48SX/48GX/49G Emulator<br>
|
<p>Emu48 - A HP38G/39G/40G/48SX/48GX/49G Emulator<br>
|
||||||
Copyright (C) 2022 Christoph Gießelink</p>
|
Copyright (C) 2024 Christoph Gießelink</p>
|
||||||
<p>This program is free software; you can redistribute it and/or modify it
|
<p>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
|
under the terms of the GNU General Public License as published by the Free
|
||||||
Software Foundation; either version 2 of the License, or (at your option)
|
Software Foundation; either version 2 of the License, or (at your option)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Known bugs and restrictions of Emu48 V1.66
|
Known bugs and restrictions of Emu48 V1.67
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
- the following I/O bits aren't emulated (incomplete)
|
- the following I/O bits aren't emulated (incomplete)
|
||||||
|
@ -47,4 +47,4 @@ Known bugs and restrictions of Emu48 V1.66
|
||||||
- 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
|
||||||
|
|
||||||
06/20/23 (c) by Christoph Gießelink, c dot giesselink at gmx dot de
|
09/23/24 (c) by Christoph Gießelink, c dot giesselink at gmx dot de
|
||||||
|
|
|
@ -1,191 +1,191 @@
|
||||||
/*
|
/*
|
||||||
* cardcopy, (c) 2000 Christoph Giesselink (cgiess@swol.de)
|
* cardcopy, (c) 2000 Christoph Giesselink (cgiess@swol.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
* MA 02111-1307, USA.
|
* MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_EXTRA_LEAN
|
#define WIN32_EXTRA_LEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define VERSION "2.1"
|
#define VERSION "2.1"
|
||||||
|
|
||||||
#define FT_ERR 0 // illegal format
|
#define FT_ERR 0 // illegal format
|
||||||
#define FT_NEW 1 // empty file
|
#define FT_NEW 1 // empty file
|
||||||
#define FT_SXGX 2 // Emu48 HP48SX/GX state file
|
#define FT_SXGX 2 // Emu48 HP48SX/GX state file
|
||||||
|
|
||||||
#define _KB(n) ((n)*1024*2) // KB in state file
|
#define _KB(n) ((n)*1024*2) // KB in state file
|
||||||
#define HP48SIG "Emu48 Document\xFE" // HP48 state file signature
|
#define HP48SIG "Emu48 Document\xFE" // HP48 state file signature
|
||||||
|
|
||||||
|
|
||||||
UINT CheckType(char *lpszFileName)
|
UINT CheckType(char *lpszFileName)
|
||||||
{
|
{
|
||||||
BYTE pbyFileSignature[16];
|
BYTE pbyFileSignature[16];
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
DWORD FileSizeHigh,FileSizeLow;
|
DWORD FileSizeHigh,FileSizeLow;
|
||||||
|
|
||||||
UINT nType = FT_ERR;
|
UINT nType = FT_ERR;
|
||||||
|
|
||||||
hFile = CreateFile(lpszFileName,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
|
hFile = CreateFile(lpszFileName,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
return FT_NEW;
|
return FT_NEW;
|
||||||
|
|
||||||
// check filesize
|
// check filesize
|
||||||
FileSizeLow = GetFileSize(hFile,&FileSizeHigh);
|
FileSizeLow = GetFileSize(hFile,&FileSizeHigh);
|
||||||
if (FileSizeHigh == 0 && (FileSizeLow == _KB(32) || FileSizeLow == _KB(128)))
|
if (FileSizeHigh == 0 && (FileSizeLow == _KB(32) || FileSizeLow == _KB(128)))
|
||||||
nType = FileSizeLow; // return card size
|
nType = FileSizeLow; // return card size
|
||||||
|
|
||||||
// Read and Compare signature
|
// Read and Compare signature
|
||||||
ReadFile(hFile,pbyFileSignature,sizeof(pbyFileSignature),&FileSizeLow,NULL);
|
ReadFile(hFile,pbyFileSignature,sizeof(pbyFileSignature),&FileSizeLow,NULL);
|
||||||
if (FileSizeLow == sizeof(pbyFileSignature) && strcmp(pbyFileSignature,HP48SIG) == 0)
|
if (FileSizeLow == sizeof(pbyFileSignature) && strcmp(pbyFileSignature,HP48SIG) == 0)
|
||||||
nType = FT_SXGX;
|
nType = FT_SXGX;
|
||||||
|
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return nType;
|
return nType;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SeekData(HANDLE hFile,UINT *nPortSize)
|
BOOL SeekData(HANDLE hFile,UINT *nPortSize)
|
||||||
{
|
{
|
||||||
BYTE byBuffer[16];
|
BYTE byBuffer[16];
|
||||||
CHIPSET *pChipset;
|
CHIPSET *pChipset;
|
||||||
UINT i;
|
UINT i;
|
||||||
DWORD lBytes;
|
DWORD lBytes;
|
||||||
|
|
||||||
SetFilePointer(hFile,0,NULL,FILE_BEGIN);
|
SetFilePointer(hFile,0,NULL,FILE_BEGIN);
|
||||||
|
|
||||||
// read and check signature
|
// read and check signature
|
||||||
ReadFile(hFile,byBuffer,sizeof(byBuffer),&lBytes,NULL);
|
ReadFile(hFile,byBuffer,sizeof(byBuffer),&lBytes,NULL);
|
||||||
if (lBytes != sizeof(HP48SIG) || strcmp(byBuffer,HP48SIG) != 0) return TRUE;
|
if (lBytes != sizeof(HP48SIG) || strcmp(byBuffer,HP48SIG) != 0) return TRUE;
|
||||||
|
|
||||||
// read KML file length
|
// read KML file length
|
||||||
ReadFile(hFile,&i,sizeof(i),&lBytes,NULL);
|
ReadFile(hFile,&i,sizeof(i),&lBytes,NULL);
|
||||||
if (lBytes != sizeof(i)) return TRUE;
|
if (lBytes != sizeof(i)) return TRUE;
|
||||||
|
|
||||||
// skip KML file name
|
// skip KML file name
|
||||||
SetFilePointer(hFile,i,NULL,FILE_CURRENT);
|
SetFilePointer(hFile,i,NULL,FILE_CURRENT);
|
||||||
|
|
||||||
// read CHIPSET structure length
|
// read CHIPSET structure length
|
||||||
ReadFile(hFile,&i,sizeof(i),&lBytes,NULL);
|
ReadFile(hFile,&i,sizeof(i),&lBytes,NULL);
|
||||||
if (lBytes != sizeof(i)) return TRUE;
|
if (lBytes != sizeof(i)) return TRUE;
|
||||||
|
|
||||||
// read CHIPSET structure
|
// read CHIPSET structure
|
||||||
if ((pChipset = LocalAlloc(LMEM_FIXED,i)) == NULL)
|
if ((pChipset = LocalAlloc(LMEM_FIXED,i)) == NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
ReadFile(hFile,pChipset,i,&lBytes,NULL);
|
ReadFile(hFile,pChipset,i,&lBytes,NULL);
|
||||||
if (lBytes != i) { LocalFree(pChipset); return TRUE; }
|
if (lBytes != i) { LocalFree(pChipset); return TRUE; }
|
||||||
|
|
||||||
// skip port0
|
// skip port0
|
||||||
SetFilePointer(hFile,_KB(pChipset->Port0Size),NULL,FILE_CURRENT);
|
SetFilePointer(hFile,_KB(pChipset->Port0Size),NULL,FILE_CURRENT);
|
||||||
|
|
||||||
*nPortSize = _KB(pChipset->Port1Size); // expected filesize
|
*nPortSize = _KB(pChipset->Port1Size); // expected filesize
|
||||||
|
|
||||||
LocalFree(pChipset);
|
LocalFree(pChipset);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CopyData(HANDLE hFileSource,HANDLE hFileDest,UINT nSize)
|
BOOL CopyData(HANDLE hFileSource,HANDLE hFileDest,UINT nSize)
|
||||||
{
|
{
|
||||||
BYTE byBuffer[16];
|
BYTE byBuffer[16];
|
||||||
INT i;
|
INT i;
|
||||||
DWORD lBytes;
|
DWORD lBytes;
|
||||||
|
|
||||||
assert(nSize % sizeof(byBuffer) == 0);
|
assert(nSize % sizeof(byBuffer) == 0);
|
||||||
for (i = nSize / sizeof(byBuffer); i > 0; --i)
|
for (i = nSize / sizeof(byBuffer); i > 0; --i)
|
||||||
{
|
{
|
||||||
ReadFile(hFileSource,byBuffer,sizeof(byBuffer),&lBytes,NULL);
|
ReadFile(hFileSource,byBuffer,sizeof(byBuffer),&lBytes,NULL);
|
||||||
if (lBytes != sizeof(byBuffer)) return TRUE;
|
if (lBytes != sizeof(byBuffer)) return TRUE;
|
||||||
|
|
||||||
WriteFile(hFileDest,byBuffer,sizeof(byBuffer),&lBytes,NULL);
|
WriteFile(hFileDest,byBuffer,sizeof(byBuffer),&lBytes,NULL);
|
||||||
if (lBytes != sizeof(byBuffer)) return TRUE;
|
if (lBytes != sizeof(byBuffer)) return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT main(int argc, char *argv[])
|
UINT main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
HANDLE hFileSource,hFileDest;
|
HANDLE hFileSource,hFileDest;
|
||||||
UINT nSourceType,nDestType;
|
UINT nSourceType,nDestType;
|
||||||
UINT nError = 0;
|
UINT nError = 0;
|
||||||
|
|
||||||
printf("HP48 Port1 Import/Export Tool for Emu48 V" VERSION "\n");
|
printf("HP48 Port1 Import/Export Tool for Emu48 V" VERSION "\n");
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
{
|
{
|
||||||
printf("\nUsage:\n\t%s <SourceFile> <DestinationFile>\n\n", argv[0]);
|
printf("\nUsage:\n\t%s <SourceFile> <DestinationFile>\n\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check source file type
|
// check source file type
|
||||||
nSourceType = CheckType(argv[1]);
|
nSourceType = CheckType(argv[1]);
|
||||||
if (nSourceType == FT_ERR || nSourceType == FT_NEW)
|
if (nSourceType == FT_ERR || nSourceType == FT_NEW)
|
||||||
{
|
{
|
||||||
printf("Error: Illegal source file type\n");
|
printf("Error: Illegal source file type\n");
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check destination file type
|
// check destination file type
|
||||||
nDestType = CheckType(argv[2]);
|
nDestType = CheckType(argv[2]);
|
||||||
if (nDestType == FT_ERR)
|
if (nDestType == FT_ERR)
|
||||||
{
|
{
|
||||||
printf("Error: Illegal destination file type\n");
|
printf("Error: Illegal destination file type\n");
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open source file
|
// open source file
|
||||||
hFileSource = CreateFile(argv[1],GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
|
hFileSource = CreateFile(argv[1],GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
|
||||||
if (hFileSource != INVALID_HANDLE_VALUE)
|
if (hFileSource != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
hFileDest = CreateFile(argv[2],GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_ALWAYS,0,NULL);
|
hFileDest = CreateFile(argv[2],GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_ALWAYS,0,NULL);
|
||||||
if (hFileDest != INVALID_HANDLE_VALUE)
|
if (hFileDest != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
BOOL bFormatErr = FALSE;
|
BOOL bFormatErr = FALSE;
|
||||||
|
|
||||||
if (nSourceType == FT_SXGX) bFormatErr |= SeekData(hFileSource,&nSourceType);
|
if (nSourceType == FT_SXGX) bFormatErr |= SeekData(hFileSource,&nSourceType);
|
||||||
if (nDestType == FT_SXGX) bFormatErr |= SeekData(hFileDest,&nDestType);
|
if (nDestType == FT_SXGX) bFormatErr |= SeekData(hFileDest,&nDestType);
|
||||||
|
|
||||||
if (!bFormatErr && (nSourceType == nDestType || nDestType == FT_NEW))
|
if (!bFormatErr && (nSourceType == nDestType || nDestType == FT_NEW))
|
||||||
{
|
{
|
||||||
assert(nSourceType > FT_SXGX);
|
assert(nSourceType > FT_SXGX);
|
||||||
CopyData(hFileSource,hFileDest,nSourceType);
|
CopyData(hFileSource,hFileDest,nSourceType);
|
||||||
puts("Copy successful.");
|
puts("Copy successful.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Error: Non matching file size or format\n");
|
printf("Error: Non matching file size or format\n");
|
||||||
nError = 4;
|
nError = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(hFileDest);
|
CloseHandle(hFileDest);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Error: Can't open destination file %s\n",argv[2]);
|
printf("Error: Can't open destination file %s\n",argv[2]);
|
||||||
nError = 5;
|
nError = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(hFileSource);
|
CloseHandle(hFileSource);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Error: Can't open source file %s\n",argv[1]);
|
printf("Error: Can't open source file %s\n",argv[1]);
|
||||||
nError = 6;
|
nError = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nError;
|
return nError;
|
||||||
}
|
}
|
|
@ -1,103 +1,103 @@
|
||||||
/*
|
/*
|
||||||
* types.h
|
* types.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// HST bits
|
// HST bits
|
||||||
#define XM 1
|
#define XM 1
|
||||||
#define SB 2
|
#define SB 2
|
||||||
#define SR 4
|
#define SR 4
|
||||||
#define MP 8
|
#define MP 8
|
||||||
|
|
||||||
#define SWORD SHORT // signed 16 Bit variable
|
#define SWORD SHORT // signed 16 Bit variable
|
||||||
#define QWORD ULONGLONG // unsigned 64 Bit variable
|
#define QWORD ULONGLONG // unsigned 64 Bit variable
|
||||||
|
|
||||||
#define CHIPSET Chipset_t
|
#define CHIPSET Chipset_t
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
SWORD nPosX; // position of window
|
SWORD nPosX; // position of window
|
||||||
SWORD nPosY;
|
SWORD nPosY;
|
||||||
BYTE type; // calculator type
|
BYTE type; // calculator type
|
||||||
|
|
||||||
DWORD Port0Size; // real size of module in KB
|
DWORD Port0Size; // real size of module in KB
|
||||||
DWORD Port1Size; // real size of module in KB
|
DWORD Port1Size; // real size of module in KB
|
||||||
DWORD Port2Size; // real size of module in KB (HP49G only)
|
DWORD Port2Size; // real size of module in KB (HP49G only)
|
||||||
LPBYTE Port0;
|
LPBYTE Port0;
|
||||||
LPBYTE Port1;
|
LPBYTE Port1;
|
||||||
LPBYTE Port2;
|
LPBYTE Port2;
|
||||||
|
|
||||||
DWORD pc;
|
DWORD pc;
|
||||||
DWORD d0;
|
DWORD d0;
|
||||||
DWORD d1;
|
DWORD d1;
|
||||||
DWORD rstkp;
|
DWORD rstkp;
|
||||||
DWORD rstk[8];
|
DWORD rstk[8];
|
||||||
BYTE A[16];
|
BYTE A[16];
|
||||||
BYTE B[16];
|
BYTE B[16];
|
||||||
BYTE C[16];
|
BYTE C[16];
|
||||||
BYTE D[16];
|
BYTE D[16];
|
||||||
BYTE R0[16];
|
BYTE R0[16];
|
||||||
BYTE R1[16];
|
BYTE R1[16];
|
||||||
BYTE R2[16];
|
BYTE R2[16];
|
||||||
BYTE R3[16];
|
BYTE R3[16];
|
||||||
BYTE R4[16];
|
BYTE R4[16];
|
||||||
BYTE ST[4];
|
BYTE ST[4];
|
||||||
BYTE HST;
|
BYTE HST;
|
||||||
BYTE P;
|
BYTE P;
|
||||||
WORD out;
|
WORD out;
|
||||||
WORD in;
|
WORD in;
|
||||||
BOOL SoftInt;
|
BOOL SoftInt;
|
||||||
BOOL Shutdn;
|
BOOL Shutdn;
|
||||||
BOOL mode_dec;
|
BOOL mode_dec;
|
||||||
BOOL inte; // interrupt status flag (FALSE = int in service)
|
BOOL inte; // interrupt status flag (FALSE = int in service)
|
||||||
BOOL intk; // 1 ms keyboard scan flag (TRUE = enable)
|
BOOL intk; // 1 ms keyboard scan flag (TRUE = enable)
|
||||||
BOOL intd; // keyboard interrupt pending (TRUE = int pending)
|
BOOL intd; // keyboard interrupt pending (TRUE = int pending)
|
||||||
BOOL carry;
|
BOOL carry;
|
||||||
|
|
||||||
WORD crc;
|
WORD crc;
|
||||||
WORD wPort2Crc; // fingerprint of port2
|
WORD wPort2Crc; // fingerprint of port2
|
||||||
WORD wRomCrc; // fingerprint of ROM
|
WORD wRomCrc; // fingerprint of ROM
|
||||||
#if defined _USRDLL // DLL version
|
#if defined _USRDLL // DLL version
|
||||||
QWORD cycles; // oscillator cycles
|
QWORD cycles; // oscillator cycles
|
||||||
#else // EXE version
|
#else // EXE version
|
||||||
DWORD cycles; // oscillator cycles
|
DWORD cycles; // oscillator cycles
|
||||||
DWORD cycles_reserved; // reserved for MSB of oscillator cycles
|
DWORD cycles_reserved; // reserved for MSB of oscillator cycles
|
||||||
#endif
|
#endif
|
||||||
DWORD dwKdnCycles; // cpu cycles at start of 1ms key handler
|
DWORD dwKdnCycles; // cpu cycles at start of 1ms key handler
|
||||||
|
|
||||||
UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF
|
UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF
|
||||||
UINT FlashRomState; // WSM state of flash memory (unused)
|
UINT FlashRomState; // WSM state of flash memory (unused)
|
||||||
BYTE cards_status;
|
BYTE cards_status;
|
||||||
BYTE IORam[64]; // I/O hardware register
|
BYTE IORam[64]; // I/O hardware register
|
||||||
UINT IOBase; // address of I/O modules page
|
UINT IOBase; // address of I/O modules page
|
||||||
BOOL IOCfig; // I/O module configuration flag
|
BOOL IOCfig; // I/O module configuration flag
|
||||||
BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page
|
BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page
|
||||||
BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB
|
BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB
|
||||||
BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page
|
BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page
|
||||||
BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag
|
BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag
|
||||||
BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag
|
BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag
|
||||||
|
|
||||||
BYTE t1;
|
BYTE t1;
|
||||||
DWORD t2;
|
DWORD t2;
|
||||||
|
|
||||||
BOOL bShutdnWake; // flag for wake up from SHUTDN mode
|
BOOL bShutdnWake; // flag for wake up from SHUTDN mode
|
||||||
|
|
||||||
BYTE Keyboard_Row[9];
|
BYTE Keyboard_Row[9];
|
||||||
WORD IR15X;
|
WORD IR15X;
|
||||||
UINT Keyboard_State; // not used
|
UINT Keyboard_State; // not used
|
||||||
|
|
||||||
signed short loffset;
|
signed short loffset;
|
||||||
signed int width;
|
signed int width;
|
||||||
UINT boffset;
|
UINT boffset;
|
||||||
UINT lcounter;
|
UINT lcounter;
|
||||||
UINT sync; // not used
|
UINT sync; // not used
|
||||||
BYTE contrast;
|
BYTE contrast;
|
||||||
BOOL dispon;
|
BOOL dispon;
|
||||||
DWORD start1;
|
DWORD start1;
|
||||||
DWORD start12;
|
DWORD start12;
|
||||||
DWORD end1;
|
DWORD end1;
|
||||||
DWORD start2, end2;
|
DWORD start2, end2;
|
||||||
} Chipset_t;
|
} Chipset_t;
|
|
@ -1,401 +1,401 @@
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_EXTRA_LEAN
|
#define WIN32_EXTRA_LEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define HP38G 0
|
#define HP38G 0
|
||||||
#define HP48S 1
|
#define HP48S 1
|
||||||
#define HP48G 2
|
#define HP48G 2
|
||||||
|
|
||||||
LPBYTE pRom;
|
LPBYTE pRom;
|
||||||
WORD wCRC;
|
WORD wCRC;
|
||||||
WORD wType;
|
WORD wType;
|
||||||
|
|
||||||
static WORD crc_table[16] =
|
static WORD crc_table[16] =
|
||||||
{
|
{
|
||||||
0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
|
0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
|
||||||
0x8408, 0x9489, 0xA50A, 0xB58B, 0xC60C, 0xD68D, 0xE70E, 0xF78F
|
0x8408, 0x9489, 0xA50A, 0xB58B, 0xC60C, 0xD68D, 0xE70E, 0xF78F
|
||||||
};
|
};
|
||||||
static __inline VOID CRC(BYTE nib)
|
static __inline VOID CRC(BYTE nib)
|
||||||
{
|
{
|
||||||
wCRC = (WORD)((wCRC>>4)^crc_table[(wCRC^nib)&0xf]);
|
wCRC = (WORD)((wCRC>>4)^crc_table[(wCRC^nib)&0xf]);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CheckCRC()
|
BOOL CheckCRC()
|
||||||
{
|
{
|
||||||
DWORD dwD0, dwD1;
|
DWORD dwD0, dwD1;
|
||||||
WORD wRomCRC;
|
WORD wRomCRC;
|
||||||
UINT i;
|
UINT i;
|
||||||
DWORD dwBase = 0x00000;
|
DWORD dwBase = 0x00000;
|
||||||
UINT nPass = 0;
|
UINT nPass = 0;
|
||||||
UINT nPasses = (wType != HP48S)?2:1;
|
UINT nPasses = (wType != HP48S)?2:1;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
|
|
||||||
wRomCRC = pRom[dwBase+0x7FFFC]
|
wRomCRC = pRom[dwBase+0x7FFFC]
|
||||||
|(pRom[dwBase+0x7FFFD]<<4)
|
|(pRom[dwBase+0x7FFFD]<<4)
|
||||||
|(pRom[dwBase+0x7FFFE]<<8)
|
|(pRom[dwBase+0x7FFFE]<<8)
|
||||||
|(pRom[dwBase+0x7FFFF]<<12);
|
|(pRom[dwBase+0x7FFFF]<<12);
|
||||||
|
|
||||||
wCRC = 0x0000;
|
wCRC = 0x0000;
|
||||||
dwD0 = dwBase + 0x00000;
|
dwD0 = dwBase + 0x00000;
|
||||||
dwD1 = dwBase + 0x40000;
|
dwD1 = dwBase + 0x40000;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
for (i=0; i<16; i++) CRC(pRom[dwD0+i]);
|
for (i=0; i<16; i++) CRC(pRom[dwD0+i]);
|
||||||
for (i=0; i<16; i++) CRC(pRom[dwD1+i]);
|
for (i=0; i<16; i++) CRC(pRom[dwD1+i]);
|
||||||
dwD0 += 16;
|
dwD0 += 16;
|
||||||
dwD1 += 16;
|
dwD1 += 16;
|
||||||
} while (dwD0&0x3FFFF);
|
} while (dwD0&0x3FFFF);
|
||||||
|
|
||||||
if (wCRC==0xFFFF)
|
if (wCRC==0xFFFF)
|
||||||
{
|
{
|
||||||
printf("CRC%i: %04X Ok\n", nPass, wRomCRC);
|
printf("CRC%i: %04X Ok\n", nPass, wRomCRC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("CRC%i: %04X Failed (%04X)\n", nPass, wRomCRC, wCRC);
|
printf("CRC%i: %04X Failed (%04X)\n", nPass, wRomCRC, wCRC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++nPass == nPasses) return TRUE;
|
if (++nPass == nPasses) return TRUE;
|
||||||
|
|
||||||
dwBase += 0x80000;
|
dwBase += 0x80000;
|
||||||
goto again;
|
goto again;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BYTE Asc2Nib(char c)
|
static BYTE Asc2Nib(char c)
|
||||||
{
|
{
|
||||||
if (c<'0') return 0;
|
if (c<'0') return 0;
|
||||||
if (c<='9') return c-'0';
|
if (c<='9') return c-'0';
|
||||||
if (c<'A') return 0;
|
if (c<'A') return 0;
|
||||||
if (c<='F') return c-'A'+10;
|
if (c<='F') return c-'A'+10;
|
||||||
if (c<'a') return 0;
|
if (c<'a') return 0;
|
||||||
if (c<='f') return c-'a'+10;
|
if (c<='f') return c-'a'+10;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD Asc2Nib5(LPBYTE lpBuf)
|
static DWORD Asc2Nib5(LPBYTE lpBuf)
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
((DWORD)Asc2Nib(lpBuf[0])<<16)
|
((DWORD)Asc2Nib(lpBuf[0])<<16)
|
||||||
|((DWORD)Asc2Nib(lpBuf[1])<<12)
|
|((DWORD)Asc2Nib(lpBuf[1])<<12)
|
||||||
|((DWORD)Asc2Nib(lpBuf[2])<<8)
|
|((DWORD)Asc2Nib(lpBuf[2])<<8)
|
||||||
|((DWORD)Asc2Nib(lpBuf[3])<<4)
|
|((DWORD)Asc2Nib(lpBuf[3])<<4)
|
||||||
|((DWORD)Asc2Nib(lpBuf[4])));
|
|((DWORD)Asc2Nib(lpBuf[4])));
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL IsHP(DWORD dwAddress)
|
static BOOL IsHP(DWORD dwAddress)
|
||||||
{
|
{
|
||||||
char cH = (pRom[dwAddress + 1] << 4) | pRom[dwAddress];
|
char cH = (pRom[dwAddress + 1] << 4) | pRom[dwAddress];
|
||||||
char cP = (pRom[dwAddress + 3] << 4) | pRom[dwAddress + 2];
|
char cP = (pRom[dwAddress + 3] << 4) | pRom[dwAddress + 2];
|
||||||
return cH == 'H' && cP == 'P';
|
return cH == 'H' && cP == 'P';
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT main(int argc, char *argv[])
|
UINT main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
HANDLE hMap;
|
HANDLE hMap;
|
||||||
HANDLE hOut;
|
HANDLE hOut;
|
||||||
LPBYTE pIn;
|
LPBYTE pIn;
|
||||||
DWORD dwSizeLo;
|
DWORD dwSizeLo;
|
||||||
BYTE szVersion[16];
|
BYTE szVersion[16];
|
||||||
UINT i,uLen;
|
UINT i,uLen;
|
||||||
DWORD dwAddress;
|
DWORD dwAddress;
|
||||||
|
|
||||||
DWORD dwAddrOffset = 0x00000;
|
DWORD dwAddrOffset = 0x00000;
|
||||||
|
|
||||||
BOOL bFormatDetected = FALSE;
|
BOOL bFormatDetected = FALSE;
|
||||||
|
|
||||||
BOOL bUnpack = FALSE;
|
BOOL bUnpack = FALSE;
|
||||||
BOOL bSwap = FALSE;
|
BOOL bSwap = FALSE;
|
||||||
BOOL bText = FALSE;
|
BOOL bText = FALSE;
|
||||||
BOOL bDA19 = FALSE;
|
BOOL bDA19 = FALSE;
|
||||||
BOOL bPack = FALSE;
|
BOOL bPack = FALSE;
|
||||||
|
|
||||||
int iArg = 1; // first argument
|
int iArg = 1; // first argument
|
||||||
|
|
||||||
if (argc < 2 || argc > 4)
|
if (argc < 2 || argc > 4)
|
||||||
{
|
{
|
||||||
printf("Usage:\n\t%s [-p] <old-rom-dump> [<new-rom-dump>]\n", argv[0]);
|
printf("Usage:\n\t%s [-p] <old-rom-dump> [<new-rom-dump>]\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*argv[iArg] == '-') // an option
|
while (*argv[iArg] == '-') // an option
|
||||||
{
|
{
|
||||||
if (strcmp(argv[iArg],"-p") == 0) // option "-p", pack result ROM image
|
if (strcmp(argv[iArg],"-p") == 0) // option "-p", pack result ROM image
|
||||||
{
|
{
|
||||||
bPack = TRUE; // pack target ROM image
|
bPack = TRUE; // pack target ROM image
|
||||||
--argc; // option is not an argument
|
--argc; // option is not an argument
|
||||||
}
|
}
|
||||||
++iArg; // first file argument
|
++iArg; // first file argument
|
||||||
}
|
}
|
||||||
|
|
||||||
pRom = (LPBYTE) malloc(512*1024*2);
|
pRom = (LPBYTE) malloc(512*1024*2);
|
||||||
if (pRom == NULL)
|
if (pRom == NULL)
|
||||||
{
|
{
|
||||||
printf("Memory Allocation Failed !");
|
printf("Memory Allocation Failed !");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hFile = CreateFile(argv[iArg],GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
hFile = CreateFile(argv[iArg],GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
free(pRom);
|
free(pRom);
|
||||||
printf("Cannot open file %s.\n", argv[iArg]);
|
printf("Cannot open file %s.\n", argv[iArg]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
dwSizeLo = GetFileSize(hFile, NULL);
|
dwSizeLo = GetFileSize(hFile, NULL);
|
||||||
hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
|
hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
|
||||||
if (hMap == NULL)
|
if (hMap == NULL)
|
||||||
{
|
{
|
||||||
free(pRom);
|
free(pRom);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
puts("CreateFileMapping failed.");
|
puts("CreateFileMapping failed.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
pIn = (LPBYTE) MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
|
pIn = (LPBYTE) MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
|
||||||
if (pIn == NULL)
|
if (pIn == NULL)
|
||||||
{
|
{
|
||||||
free(pRom);
|
free(pRom);
|
||||||
CloseHandle(hMap);
|
CloseHandle(hMap);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
puts("MapViewOfFile failed.\n");
|
puts("MapViewOfFile failed.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 2 && !bFormatDetected; ++i)
|
for (i = 0; i < 2 && !bFormatDetected; ++i)
|
||||||
{
|
{
|
||||||
switch (pIn[0+dwAddrOffset])
|
switch (pIn[0+dwAddrOffset])
|
||||||
{
|
{
|
||||||
case '0':
|
case '0':
|
||||||
if (pIn[1+dwAddrOffset]!='0') break;
|
if (pIn[1+dwAddrOffset]!='0') break;
|
||||||
if (pIn[2+dwAddrOffset]!='0') break;
|
if (pIn[2+dwAddrOffset]!='0') break;
|
||||||
if (pIn[3+dwAddrOffset]!='0') break;
|
if (pIn[3+dwAddrOffset]!='0') break;
|
||||||
if (pIn[4+dwAddrOffset]!='0') break;
|
if (pIn[4+dwAddrOffset]!='0') break;
|
||||||
if (pIn[5+dwAddrOffset]!=':') break;
|
if (pIn[5+dwAddrOffset]!=':') break;
|
||||||
bText = TRUE;
|
bText = TRUE;
|
||||||
bFormatDetected = TRUE;
|
bFormatDetected = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x23:
|
case 0x23:
|
||||||
bUnpack = TRUE;
|
bUnpack = TRUE;
|
||||||
bSwap = TRUE;
|
bSwap = TRUE;
|
||||||
bFormatDetected = TRUE;
|
bFormatDetected = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x32:
|
case 0x32:
|
||||||
bUnpack = TRUE;
|
bUnpack = TRUE;
|
||||||
bFormatDetected = TRUE;
|
bFormatDetected = TRUE;
|
||||||
break;
|
break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
bSwap = TRUE;
|
bSwap = TRUE;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
if (pIn[1+dwAddrOffset] == (bSwap ? 0x02 : 0x03))
|
if (pIn[1+dwAddrOffset] == (bSwap ? 0x02 : 0x03))
|
||||||
{
|
{
|
||||||
bFormatDetected = TRUE;
|
bFormatDetected = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bSwap = FALSE;
|
bSwap = FALSE;
|
||||||
default:
|
default:
|
||||||
dwAddrOffset = dwSizeLo / 2;
|
dwAddrOffset = dwSizeLo / 2;
|
||||||
bDA19 = TRUE;
|
bDA19 = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bFormatDetected)
|
if (!bFormatDetected)
|
||||||
{
|
{
|
||||||
free(pRom);
|
free(pRom);
|
||||||
UnmapViewOfFile(pIn);
|
UnmapViewOfFile(pIn);
|
||||||
CloseHandle(hMap);
|
CloseHandle(hMap);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
printf("Stopped, unknown format.\n");
|
printf("Stopped, unknown format.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bUnpack) printf("Unpacking nibbles.\n");
|
if (bUnpack) printf("Unpacking nibbles.\n");
|
||||||
if (bSwap) printf("Swapping nibbles.\n");
|
if (bSwap) printf("Swapping nibbles.\n");
|
||||||
if (bText) printf("Reading text file.\n");
|
if (bText) printf("Reading text file.\n");
|
||||||
if (bDA19) printf("Swapping banks.\n");
|
if (bDA19) printf("Swapping banks.\n");
|
||||||
|
|
||||||
if (bText)
|
if (bText)
|
||||||
{
|
{
|
||||||
DWORD i = 0;
|
DWORD i = 0;
|
||||||
while (i<dwSizeLo)
|
while (i<dwSizeLo)
|
||||||
{
|
{
|
||||||
DWORD d = Asc2Nib5(pIn+i);
|
DWORD d = Asc2Nib5(pIn+i);
|
||||||
i+=6;
|
i+=6;
|
||||||
pRom[d+0x0] = Asc2Nib(pIn[i+0x0]);
|
pRom[d+0x0] = Asc2Nib(pIn[i+0x0]);
|
||||||
pRom[d+0x1] = Asc2Nib(pIn[i+0x1]);
|
pRom[d+0x1] = Asc2Nib(pIn[i+0x1]);
|
||||||
pRom[d+0x2] = Asc2Nib(pIn[i+0x2]);
|
pRom[d+0x2] = Asc2Nib(pIn[i+0x2]);
|
||||||
pRom[d+0x3] = Asc2Nib(pIn[i+0x3]);
|
pRom[d+0x3] = Asc2Nib(pIn[i+0x3]);
|
||||||
pRom[d+0x4] = Asc2Nib(pIn[i+0x4]);
|
pRom[d+0x4] = Asc2Nib(pIn[i+0x4]);
|
||||||
pRom[d+0x5] = Asc2Nib(pIn[i+0x5]);
|
pRom[d+0x5] = Asc2Nib(pIn[i+0x5]);
|
||||||
pRom[d+0x6] = Asc2Nib(pIn[i+0x6]);
|
pRom[d+0x6] = Asc2Nib(pIn[i+0x6]);
|
||||||
pRom[d+0x7] = Asc2Nib(pIn[i+0x7]);
|
pRom[d+0x7] = Asc2Nib(pIn[i+0x7]);
|
||||||
pRom[d+0x8] = Asc2Nib(pIn[i+0x8]);
|
pRom[d+0x8] = Asc2Nib(pIn[i+0x8]);
|
||||||
pRom[d+0x9] = Asc2Nib(pIn[i+0x9]);
|
pRom[d+0x9] = Asc2Nib(pIn[i+0x9]);
|
||||||
pRom[d+0xA] = Asc2Nib(pIn[i+0xA]);
|
pRom[d+0xA] = Asc2Nib(pIn[i+0xA]);
|
||||||
pRom[d+0xB] = Asc2Nib(pIn[i+0xB]);
|
pRom[d+0xB] = Asc2Nib(pIn[i+0xB]);
|
||||||
pRom[d+0xC] = Asc2Nib(pIn[i+0xC]);
|
pRom[d+0xC] = Asc2Nib(pIn[i+0xC]);
|
||||||
pRom[d+0xD] = Asc2Nib(pIn[i+0xD]);
|
pRom[d+0xD] = Asc2Nib(pIn[i+0xD]);
|
||||||
pRom[d+0xE] = Asc2Nib(pIn[i+0xE]);
|
pRom[d+0xE] = Asc2Nib(pIn[i+0xE]);
|
||||||
pRom[d+0xF] = Asc2Nib(pIn[i+0xF]);
|
pRom[d+0xF] = Asc2Nib(pIn[i+0xF]);
|
||||||
i+=16;
|
i+=16;
|
||||||
while ((i<dwSizeLo)&&((pIn[i]==0x0D)||(pIn[i]==0x0A))) i++;
|
while ((i<dwSizeLo)&&((pIn[i]==0x0D)||(pIn[i]==0x0A))) i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bUnpack)
|
if (bUnpack)
|
||||||
{
|
{
|
||||||
if (bSwap)
|
if (bSwap)
|
||||||
{
|
{
|
||||||
DWORD i;
|
DWORD i;
|
||||||
for (i=0; i<dwSizeLo; i++)
|
for (i=0; i<dwSizeLo; i++)
|
||||||
{
|
{
|
||||||
BYTE byC = pIn[(i+dwAddrOffset)&(dwSizeLo-1)];
|
BYTE byC = pIn[(i+dwAddrOffset)&(dwSizeLo-1)];
|
||||||
pRom[(i<<1) ] = byC>>4;
|
pRom[(i<<1) ] = byC>>4;
|
||||||
pRom[(i<<1)+1] = byC&0xF;
|
pRom[(i<<1)+1] = byC&0xF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD i;
|
DWORD i;
|
||||||
for (i=0; i<dwSizeLo; i++)
|
for (i=0; i<dwSizeLo; i++)
|
||||||
{
|
{
|
||||||
BYTE byC = pIn[(i+dwAddrOffset)&(dwSizeLo-1)];
|
BYTE byC = pIn[(i+dwAddrOffset)&(dwSizeLo-1)];
|
||||||
pRom[(i<<1) ] = byC&0xF;
|
pRom[(i<<1) ] = byC&0xF;
|
||||||
pRom[(i<<1)+1] = byC>>4;
|
pRom[(i<<1)+1] = byC>>4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bSwap)
|
if (bSwap)
|
||||||
{
|
{
|
||||||
DWORD i;
|
DWORD i;
|
||||||
for (i=0; i<dwSizeLo; i+=2)
|
for (i=0; i<dwSizeLo; i+=2)
|
||||||
{
|
{
|
||||||
BYTE a, b;
|
BYTE a, b;
|
||||||
a = pIn[(i+dwAddrOffset)&(dwSizeLo-1)];
|
a = pIn[(i+dwAddrOffset)&(dwSizeLo-1)];
|
||||||
b = pIn[(i+1+dwAddrOffset)&(dwSizeLo-1)];
|
b = pIn[(i+1+dwAddrOffset)&(dwSizeLo-1)];
|
||||||
pRom[i] = b;
|
pRom[i] = b;
|
||||||
pRom[i+1] = a;
|
pRom[i+1] = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(bDA19)
|
if(bDA19)
|
||||||
{
|
{
|
||||||
assert(dwAddrOffset == dwSizeLo/2);
|
assert(dwAddrOffset == dwSizeLo/2);
|
||||||
CopyMemory(&pRom[0] , &pIn[dwAddrOffset], dwAddrOffset);
|
CopyMemory(&pRom[0] , &pIn[dwAddrOffset], dwAddrOffset);
|
||||||
CopyMemory(&pRom[dwAddrOffset], &pIn[0] , dwAddrOffset);
|
CopyMemory(&pRom[dwAddrOffset], &pIn[0] , dwAddrOffset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyMemory(pRom, pIn, dwSizeLo);
|
CopyMemory(pRom, pIn, dwSizeLo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnmapViewOfFile(pIn);
|
UnmapViewOfFile(pIn);
|
||||||
CloseHandle(hMap);
|
CloseHandle(hMap);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
|
|
||||||
if (bText||bUnpack||bSwap||bDA19)
|
if (bText||bUnpack||bSwap||bDA19)
|
||||||
{
|
{
|
||||||
printf("File converted.\n\n");
|
printf("File converted.\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// HP38G
|
// HP38G
|
||||||
wType = HP38G;
|
wType = HP38G;
|
||||||
dwAddress = 0x7FFAF;
|
dwAddress = 0x7FFAF;
|
||||||
uLen = 10;
|
uLen = 10;
|
||||||
if (IsHP(dwAddress)) break;
|
if (IsHP(dwAddress)) break;
|
||||||
|
|
||||||
// HP48SX
|
// HP48SX
|
||||||
wType = HP48S;
|
wType = HP48S;
|
||||||
dwAddress = 0x7FFF0;
|
dwAddress = 0x7FFF0;
|
||||||
uLen = 6;
|
uLen = 6;
|
||||||
if (IsHP(dwAddress)) break;
|
if (IsHP(dwAddress)) break;
|
||||||
|
|
||||||
// HP48GX
|
// HP48GX
|
||||||
wType = HP48G;
|
wType = HP48G;
|
||||||
dwAddress = 0x7FFBF;
|
dwAddress = 0x7FFBF;
|
||||||
uLen = 6;
|
uLen = 6;
|
||||||
if (IsHP(dwAddress)) break;
|
if (IsHP(dwAddress)) break;
|
||||||
|
|
||||||
// unknown
|
// unknown
|
||||||
uLen = 0;
|
uLen = 0;
|
||||||
}
|
}
|
||||||
while (0);
|
while (0);
|
||||||
|
|
||||||
printf("ROM Model Detected : HP%c8%c\n",(wType == HP38G)?'3':'4',(wType != HP48S)?'G':'S');
|
printf("ROM Model Detected : HP%c8%c\n",(wType == HP38G)?'3':'4',(wType != HP48S)?'G':'S');
|
||||||
|
|
||||||
for (i=0; i<uLen; ++i)
|
for (i=0; i<uLen; ++i)
|
||||||
{
|
{
|
||||||
szVersion[i] = pRom[dwAddress + (i<<1) + 1] << 4;
|
szVersion[i] = pRom[dwAddress + (i<<1) + 1] << 4;
|
||||||
szVersion[i] |= pRom[dwAddress + (i<<1)];
|
szVersion[i] |= pRom[dwAddress + (i<<1)];
|
||||||
}
|
}
|
||||||
szVersion[i] = 0;
|
szVersion[i] = 0;
|
||||||
|
|
||||||
printf("ROM Version : %s\n", szVersion);
|
printf("ROM Version : %s\n", szVersion);
|
||||||
|
|
||||||
ZeroMemory(pRom+0x100, 0x40); // clear IO register area
|
ZeroMemory(pRom+0x100, 0x40); // clear IO register area
|
||||||
|
|
||||||
if (CheckCRC())
|
if (CheckCRC())
|
||||||
{
|
{
|
||||||
printf("ROM CRC Test Passed.\n");
|
printf("ROM CRC Test Passed.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("ROM CRC Test FAILED !\n");
|
printf("ROM CRC Test FAILED !\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) // write target file
|
if (argc == 3) // write target file
|
||||||
{
|
{
|
||||||
DWORD dwWritten;
|
DWORD dwWritten;
|
||||||
|
|
||||||
// size of target file
|
// size of target file
|
||||||
DWORD dwRomSize = (wType != HP48S)?(512*1024*2):(256*1024*2);
|
DWORD dwRomSize = (wType != HP48S)?(512*1024*2):(256*1024*2);
|
||||||
|
|
||||||
hOut = CreateFile(argv[iArg+1],GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
|
hOut = CreateFile(argv[iArg+1],GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
free(pRom);
|
free(pRom);
|
||||||
printf("Cannot open file %s.\n", argv[iArg+1]);
|
printf("Cannot open file %s.\n", argv[iArg+1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPack) // pack target ROM image
|
if (bPack) // pack target ROM image
|
||||||
{
|
{
|
||||||
LPBYTE pbySrc,pbyDest;
|
LPBYTE pbySrc,pbyDest;
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
dwRomSize /= 2; // packed image has half of size
|
dwRomSize /= 2; // packed image has half of size
|
||||||
|
|
||||||
// pack data
|
// pack data
|
||||||
pbySrc = pbyDest = pRom;
|
pbySrc = pbyDest = pRom;
|
||||||
for (i = 0; i < dwRomSize; i++)
|
for (i = 0; i < dwRomSize; i++)
|
||||||
{
|
{
|
||||||
*pbyDest = *pbySrc++;
|
*pbyDest = *pbySrc++;
|
||||||
*pbyDest |= *pbySrc++ << 4;
|
*pbyDest |= *pbySrc++ << 4;
|
||||||
pbyDest++;
|
pbyDest++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteFile(hOut,pRom,dwRomSize,&dwWritten,NULL);
|
WriteFile(hOut,pRom,dwRomSize,&dwWritten,NULL);
|
||||||
CloseHandle(hOut);
|
CloseHandle(hOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pRom);
|
free(pRom);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -1,3 +1,89 @@
|
||||||
|
Service Pack 67 for Emu48 Version 1.0
|
||||||
|
|
||||||
|
DEBUGGER.C
|
||||||
|
- changed position of debugger window with a default position marker
|
||||||
|
- changed function Debugger(), in case WM_INITDIALOG set windows
|
||||||
|
position only if given windows position don't contain the default
|
||||||
|
position marker
|
||||||
|
- changed function OnToolDebug(), on dialog creation set main window
|
||||||
|
as parent window
|
||||||
|
- changed function LoadMemData() and SaveMemData(), changed function
|
||||||
|
prototype by adding a bit mode flag to load or save data in 8-bit
|
||||||
|
or 4-bit mode
|
||||||
|
- changed function DebugMemLoad() and DebugMemSave(), added decoding
|
||||||
|
of radio buttons and adjusted to new prototypes of function
|
||||||
|
LoadMemData() and SaveMemData()
|
||||||
|
|
||||||
|
EMU48.C
|
||||||
|
- bugfix in function WinMain(), changed UNICODE command line
|
||||||
|
argument decoding to prevent memory leak and added WSAStartup() /
|
||||||
|
WSACleanup() network stack sequence calling once
|
||||||
|
|
||||||
|
EMU48.H
|
||||||
|
- extern declaration of global variable
|
||||||
|
|
||||||
|
EMU48.RC
|
||||||
|
- changed IDD_DEBUG_MEMSAVE and IDD_DEBUG_MEMLOAD, added radio
|
||||||
|
buttons to select bit width of memory files
|
||||||
|
- changed version and copyright
|
||||||
|
|
||||||
|
FETCH.C
|
||||||
|
- changed all tables, added braces around each table element for
|
||||||
|
Clang compatibility
|
||||||
|
|
||||||
|
LODEPNG.C
|
||||||
|
- changed implementation file to LodePNG version 20230410 with
|
||||||
|
unmarked typecast patches for x64 compatibility, Copyright (c)
|
||||||
|
2005-2023 Lode Vandevenne
|
||||||
|
|
||||||
|
LODEPNG.H
|
||||||
|
- changed header file to LodePNG version 20230410
|
||||||
|
|
||||||
|
MOPS.C
|
||||||
|
- changed function ReadT2Acc(), changed CPU slow down
|
||||||
|
implementation, on SMP systems a CriticalSection is treated as a
|
||||||
|
mutex object which is much slower, so short consecutive
|
||||||
|
CriticalSections of the same object should be avoided
|
||||||
|
- changed function ReadIO(), changed CPU slow down implementation
|
||||||
|
for the TBF bit in the TCS (0x112) register, on SMP systems a
|
||||||
|
CriticalSection is treated as a mutex object which is much slower,
|
||||||
|
so short consecutive CriticalSections of the same object should be
|
||||||
|
avoided
|
||||||
|
|
||||||
|
RESOURCE.H
|
||||||
|
- added definitions
|
||||||
|
|
||||||
|
SERIAL.C
|
||||||
|
- changed function CommOpen(), removed assertion for UART on
|
||||||
|
|
||||||
|
SETTINGS.C
|
||||||
|
- changed function ReadSettings() and WriteSettings(), added item
|
||||||
|
"LocaleDecimalPoint" in section [Emulator] in the INI-File
|
||||||
|
|
||||||
|
STACK.C
|
||||||
|
- added variable bLocaleDecimalPoint for choosing the decimal point
|
||||||
|
given by the calculator or the Windows Locale setting
|
||||||
|
- added function CheckThousandGroup(), check if character is the
|
||||||
|
thousand separator
|
||||||
|
- added function GetClpbrdDecimalPoint(), get decimal point from
|
||||||
|
clipboard
|
||||||
|
- changed function SetBcd(), accept number string with thousand
|
||||||
|
separator now
|
||||||
|
- changed function GetRadix(), added possibility of using the
|
||||||
|
Windows Locale instead of calculator setting
|
||||||
|
- changed function OnStackPaste(), get get decimal point for real
|
||||||
|
and complex numbers from clipboard instead from calculator
|
||||||
|
|
||||||
|
TIMER.C
|
||||||
|
- changed function SetHP48Time(), use one loop for clock and auto
|
||||||
|
off writing, use function UpCRC() for CRC calculation and removed
|
||||||
|
intermediate buffer for writing the CRC
|
||||||
|
|
||||||
|
UDP.C
|
||||||
|
- changed function SendByteUdp(), moved WSAStartup() / WSACleanup()
|
||||||
|
sequence to function WinMain()
|
||||||
|
|
||||||
|
|
||||||
Service Pack 66 for Emu48 Version 1.0
|
Service Pack 66 for Emu48 Version 1.0
|
||||||
|
|
||||||
DISRPL.C
|
DISRPL.C
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
* color.h
|
* color.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Christoph Gießelink
|
* Copyright (C) 1999 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define COLOR_BLACK 0x00000000
|
#define COLOR_BLACK 0x00000000
|
||||||
#define COLOR_MAROON 0x00000080
|
#define COLOR_MAROON 0x00000080
|
||||||
#define COLOR_GREEN 0x00008000
|
#define COLOR_GREEN 0x00008000
|
||||||
#define COLOR_OLIVE 0x00008080
|
#define COLOR_OLIVE 0x00008080
|
||||||
#define COLOR_NAVY 0x00800000
|
#define COLOR_NAVY 0x00800000
|
||||||
#define COLOR_PURPLE 0x00800080
|
#define COLOR_PURPLE 0x00800080
|
||||||
#define COLOR_TEAL 0x00808000
|
#define COLOR_TEAL 0x00808000
|
||||||
#define COLOR_GRAY 0x00808080
|
#define COLOR_GRAY 0x00808080
|
||||||
#define COLOR_SILVER 0x00C0C0C0
|
#define COLOR_SILVER 0x00C0C0C0
|
||||||
#define COLOR_RED 0x000000FF
|
#define COLOR_RED 0x000000FF
|
||||||
#define COLOR_LIME 0x0000FF00
|
#define COLOR_LIME 0x0000FF00
|
||||||
#define COLOR_YELLOW 0x0000FFFF
|
#define COLOR_YELLOW 0x0000FFFF
|
||||||
#define COLOR_BLUE 0x00FF0000
|
#define COLOR_BLUE 0x00FF0000
|
||||||
#define COLOR_FUCHSIA 0x00FF00FF
|
#define COLOR_FUCHSIA 0x00FF00FF
|
||||||
#define COLOR_AQUA 0x00FFFF00
|
#define COLOR_AQUA 0x00FFFF00
|
||||||
#define COLOR_LTGRAY 0x00C0C0C0
|
#define COLOR_LTGRAY 0x00C0C0C0
|
||||||
#define COLOR_DKGRAY 0x00808080
|
#define COLOR_DKGRAY 0x00808080
|
||||||
#define COLOR_WHITE 0x00FFFFFF
|
#define COLOR_WHITE 0x00FFFFFF
|
|
@ -1,89 +1,89 @@
|
||||||
/*
|
/*
|
||||||
* Cursor.c
|
* Cursor.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Christoph Gießelink
|
* Copyright (C) 2004 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
|
|
||||||
// hand cursor AND mask
|
// hand cursor AND mask
|
||||||
static CONST BYTE ANDmaskCursor[] =
|
static CONST BYTE ANDmaskCursor[] =
|
||||||
{
|
{
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xF3, 0xFF, 0xFF, // 1111 1111 1111 0011 1111 1111 1111 1111
|
0xFF, 0xF3, 0xFF, 0xFF, // 1111 1111 1111 0011 1111 1111 1111 1111
|
||||||
0xFF, 0xE1, 0xFF, 0xFF, // 1111 1111 1110 0001 1111 1111 1111 1111
|
0xFF, 0xE1, 0xFF, 0xFF, // 1111 1111 1110 0001 1111 1111 1111 1111
|
||||||
0xFF, 0xE1, 0xFF, 0xFF, // 1111 1111 1110 0001 1111 1111 1111 1111
|
0xFF, 0xE1, 0xFF, 0xFF, // 1111 1111 1110 0001 1111 1111 1111 1111
|
||||||
0xFF, 0xE1, 0xFF, 0xFF, // 1111 1111 1110 0001 1111 1111 1111 1111
|
0xFF, 0xE1, 0xFF, 0xFF, // 1111 1111 1110 0001 1111 1111 1111 1111
|
||||||
0xFF, 0xE1, 0xFF, 0xFF, // 1111 1111 1110 0001 1111 1111 1111 1111
|
0xFF, 0xE1, 0xFF, 0xFF, // 1111 1111 1110 0001 1111 1111 1111 1111
|
||||||
0xFF, 0xE0, 0x7F, 0xFF, // 1111 1111 1110 0000 0111 1111 1111 1111
|
0xFF, 0xE0, 0x7F, 0xFF, // 1111 1111 1110 0000 0111 1111 1111 1111
|
||||||
0xFF, 0xE0, 0x0F, 0xFF, // 1111 1111 1110 0000 0000 1111 1111 1111
|
0xFF, 0xE0, 0x0F, 0xFF, // 1111 1111 1110 0000 0000 1111 1111 1111
|
||||||
0xFF, 0xE0, 0x03, 0xFF, // 1111 1111 1110 0000 0000 0011 1111 1111
|
0xFF, 0xE0, 0x03, 0xFF, // 1111 1111 1110 0000 0000 0011 1111 1111
|
||||||
0xFF, 0xE0, 0x01, 0xFF, // 1111 1111 1110 0000 0000 0001 1111 1111
|
0xFF, 0xE0, 0x01, 0xFF, // 1111 1111 1110 0000 0000 0001 1111 1111
|
||||||
0xFE, 0x20, 0x00, 0xFF, // 1111 1110 0010 0000 0000 0000 1111 1111
|
0xFE, 0x20, 0x00, 0xFF, // 1111 1110 0010 0000 0000 0000 1111 1111
|
||||||
0xFE, 0x00, 0x00, 0xFF, // 1111 1110 0000 0000 0000 0000 1111 1111
|
0xFE, 0x00, 0x00, 0xFF, // 1111 1110 0000 0000 0000 0000 1111 1111
|
||||||
0xFE, 0x00, 0x00, 0xFF, // 1111 1110 0000 0000 0000 0000 1111 1111
|
0xFE, 0x00, 0x00, 0xFF, // 1111 1110 0000 0000 0000 0000 1111 1111
|
||||||
0xFF, 0x00, 0x00, 0xFF, // 1111 1111 0000 0000 0000 0000 1111 1111
|
0xFF, 0x00, 0x00, 0xFF, // 1111 1111 0000 0000 0000 0000 1111 1111
|
||||||
0xFF, 0x80, 0x00, 0xFF, // 1111 1111 1000 0000 0000 0000 1111 1111
|
0xFF, 0x80, 0x00, 0xFF, // 1111 1111 1000 0000 0000 0000 1111 1111
|
||||||
0xFF, 0x80, 0x00, 0xFF, // 1111 1111 1000 0000 0000 0000 1111 1111
|
0xFF, 0x80, 0x00, 0xFF, // 1111 1111 1000 0000 0000 0000 1111 1111
|
||||||
0xFF, 0xC0, 0x00, 0xFF, // 1111 1111 1100 0000 0000 0000 1111 1111
|
0xFF, 0xC0, 0x00, 0xFF, // 1111 1111 1100 0000 0000 0000 1111 1111
|
||||||
0xFF, 0xC0, 0x01, 0xFF, // 1111 1111 1100 0000 0000 0001 1111 1111
|
0xFF, 0xC0, 0x01, 0xFF, // 1111 1111 1100 0000 0000 0001 1111 1111
|
||||||
0xFF, 0xE0, 0x01, 0xFF, // 1111 1111 1110 0000 0000 0001 1111 1111
|
0xFF, 0xE0, 0x01, 0xFF, // 1111 1111 1110 0000 0000 0001 1111 1111
|
||||||
0xFF, 0xE0, 0x01, 0xFF, // 1111 1111 1110 0000 0000 0001 1111 1111
|
0xFF, 0xE0, 0x01, 0xFF, // 1111 1111 1110 0000 0000 0001 1111 1111
|
||||||
0xFF, 0xF0, 0x03, 0xFF, // 1111 1111 1111 0000 0000 0011 1111 1111
|
0xFF, 0xF0, 0x03, 0xFF, // 1111 1111 1111 0000 0000 0011 1111 1111
|
||||||
0xFF, 0xF0, 0x03, 0xFF, // 1111 1111 1111 0000 0000 0011 1111 1111
|
0xFF, 0xF0, 0x03, 0xFF, // 1111 1111 1111 0000 0000 0011 1111 1111
|
||||||
0xFF, 0xF0, 0x03, 0xFF, // 1111 1111 1111 0000 0000 0011 1111 1111
|
0xFF, 0xF0, 0x03, 0xFF, // 1111 1111 1111 0000 0000 0011 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF, // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
0xFF, 0xFF, 0xFF, 0xFF // 1111 1111 1111 1111 1111 1111 1111 1111
|
0xFF, 0xFF, 0xFF, 0xFF // 1111 1111 1111 1111 1111 1111 1111 1111
|
||||||
};
|
};
|
||||||
|
|
||||||
// hand cursor XOR mask
|
// hand cursor XOR mask
|
||||||
static CONST BYTE XORmaskCursor[] =
|
static CONST BYTE XORmaskCursor[] =
|
||||||
{
|
{
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
||||||
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
||||||
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
||||||
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
||||||
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
0x00, 0x0C, 0x00, 0x00, // 0000 0000 0000 1100 0000 0000 0000 0000
|
||||||
0x00, 0x0D, 0x80, 0x00, // 0000 0000 0000 1101 1000 0000 0000 0000
|
0x00, 0x0D, 0x80, 0x00, // 0000 0000 0000 1101 1000 0000 0000 0000
|
||||||
0x00, 0x0D, 0xB0, 0x00, // 0000 0000 0000 1101 1011 0000 0000 0000
|
0x00, 0x0D, 0xB0, 0x00, // 0000 0000 0000 1101 1011 0000 0000 0000
|
||||||
0x00, 0x0D, 0xB4, 0x00, // 0000 0000 0000 1101 1011 0100 0000 0000
|
0x00, 0x0D, 0xB4, 0x00, // 0000 0000 0000 1101 1011 0100 0000 0000
|
||||||
0x00, 0x0D, 0xB6, 0x00, // 0000 0000 0000 1101 1011 0110 0000 0000
|
0x00, 0x0D, 0xB6, 0x00, // 0000 0000 0000 1101 1011 0110 0000 0000
|
||||||
0x00, 0xCF, 0xF6, 0x00, // 0000 0000 1100 1111 1111 0110 0000 0000
|
0x00, 0xCF, 0xF6, 0x00, // 0000 0000 1100 1111 1111 0110 0000 0000
|
||||||
0x00, 0xEF, 0xFE, 0x00, // 0000 0000 1110 1111 1111 1110 0000 0000
|
0x00, 0xEF, 0xFE, 0x00, // 0000 0000 1110 1111 1111 1110 0000 0000
|
||||||
0x00, 0x6F, 0xFE, 0x00, // 0000 0000 0110 1111 1111 1110 0000 0000
|
0x00, 0x6F, 0xFE, 0x00, // 0000 0000 0110 1111 1111 1110 0000 0000
|
||||||
0x00, 0x2F, 0xFE, 0x00, // 0000 0000 0010 1111 1111 1110 0000 0000
|
0x00, 0x2F, 0xFE, 0x00, // 0000 0000 0010 1111 1111 1110 0000 0000
|
||||||
0x00, 0x3F, 0xFE, 0x00, // 0000 0000 0011 1111 1111 1110 0000 0000
|
0x00, 0x3F, 0xFE, 0x00, // 0000 0000 0011 1111 1111 1110 0000 0000
|
||||||
0x00, 0x1F, 0xFE, 0x00, // 0000 0000 0001 1111 1111 1110 0000 0000
|
0x00, 0x1F, 0xFE, 0x00, // 0000 0000 0001 1111 1111 1110 0000 0000
|
||||||
0x00, 0x1F, 0xFC, 0x00, // 0000 0000 0001 1111 1111 1100 0000 0000
|
0x00, 0x1F, 0xFC, 0x00, // 0000 0000 0001 1111 1111 1100 0000 0000
|
||||||
0x00, 0x0F, 0xFC, 0x00, // 0000 0000 0000 1111 1111 1100 0000 0000
|
0x00, 0x0F, 0xFC, 0x00, // 0000 0000 0000 1111 1111 1100 0000 0000
|
||||||
0x00, 0x0F, 0xFC, 0x00, // 0000 0000 0000 1111 1111 1100 0000 0000
|
0x00, 0x0F, 0xFC, 0x00, // 0000 0000 0000 1111 1111 1100 0000 0000
|
||||||
0x00, 0x07, 0xF8, 0x00, // 0000 0000 0000 0111 1111 1000 0000 0000
|
0x00, 0x07, 0xF8, 0x00, // 0000 0000 0000 0111 1111 1000 0000 0000
|
||||||
0x00, 0x07, 0xF8, 0x00, // 0000 0000 0000 0111 1111 1000 0000 0000
|
0x00, 0x07, 0xF8, 0x00, // 0000 0000 0000 0111 1111 1000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00, // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
0x00, 0x00, 0x00, 0x00 // 0000 0000 0000 0000 0000 0000 0000 0000
|
0x00, 0x00, 0x00, 0x00 // 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
};
|
};
|
||||||
|
|
||||||
HCURSOR CreateHandCursor(VOID)
|
HCURSOR CreateHandCursor(VOID)
|
||||||
{
|
{
|
||||||
return CreateCursor(hApp,12,5,32,32,ANDmaskCursor,XORmaskCursor);
|
return CreateCursor(hApp,12,5,32,32,ANDmaskCursor,XORmaskCursor);
|
||||||
}
|
}
|
|
@ -1,182 +1,182 @@
|
||||||
/*
|
/*
|
||||||
* DdeServ.c
|
* DdeServ.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 Christoph Gießelink
|
* Copyright (C) 1998 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,
|
HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,
|
||||||
HSZ hsz1,HSZ hsz2,HDDEDATA hData,
|
HSZ hsz1,HSZ hsz2,HDDEDATA hData,
|
||||||
DWORD dwData1,DWORD dwData2)
|
DWORD dwData1,DWORD dwData2)
|
||||||
{
|
{
|
||||||
TCHAR *psz,szBuffer[32];
|
TCHAR *psz,szBuffer[32];
|
||||||
HDDEDATA hReturn;
|
HDDEDATA hReturn;
|
||||||
LPBYTE lpData,lpHeader;
|
LPBYTE lpData,lpHeader;
|
||||||
DWORD dwAddress,dwSize,dwLoop,dwIndex;
|
DWORD dwAddress,dwSize,dwLoop,dwIndex;
|
||||||
UINT nStkLvl;
|
UINT nStkLvl;
|
||||||
BOOL bSuccess;
|
BOOL bSuccess;
|
||||||
|
|
||||||
// disable stack loading items on HP38G, HP39/40G
|
// disable stack loading items on HP38G, HP39/40G
|
||||||
BOOL bStackEnable = cCurrentRomType!='6' && cCurrentRomType!='A' && cCurrentRomType!='E';
|
BOOL bStackEnable = cCurrentRomType!='6' && cCurrentRomType!='A' && cCurrentRomType!='E';
|
||||||
|
|
||||||
switch (iType)
|
switch (iType)
|
||||||
{
|
{
|
||||||
case XTYP_CONNECT:
|
case XTYP_CONNECT:
|
||||||
// get service name
|
// get service name
|
||||||
DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0);
|
DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0);
|
||||||
if (0 != lstrcmp(szBuffer,szAppName))
|
if (0 != lstrcmp(szBuffer,szAppName))
|
||||||
return (HDDEDATA) FALSE;
|
return (HDDEDATA) FALSE;
|
||||||
// get topic name
|
// get topic name
|
||||||
DdeQueryString(idDdeInst,hsz1,szBuffer,ARRAYSIZEOF(szBuffer),0);
|
DdeQueryString(idDdeInst,hsz1,szBuffer,ARRAYSIZEOF(szBuffer),0);
|
||||||
return (HDDEDATA) (INT_PTR) (0 == lstrcmp(szBuffer,szTopic));
|
return (HDDEDATA) (INT_PTR) (0 == lstrcmp(szBuffer,szTopic));
|
||||||
|
|
||||||
case XTYP_POKE:
|
case XTYP_POKE:
|
||||||
// quit on models without stack or illegal data format or not in running state
|
// quit on models without stack or illegal data format or not in running state
|
||||||
if (!bStackEnable || iFmt != uCF_HpObj || nState != SM_RUN)
|
if (!bStackEnable || iFmt != uCF_HpObj || nState != SM_RUN)
|
||||||
return (HDDEDATA) DDE_FNOTPROCESSED;
|
return (HDDEDATA) DDE_FNOTPROCESSED;
|
||||||
|
|
||||||
// get item name
|
// get item name
|
||||||
DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0);
|
DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0);
|
||||||
nStkLvl = _tcstoul(szBuffer,&psz,10);
|
nStkLvl = _tcstoul(szBuffer,&psz,10);
|
||||||
if (*psz != 0 || nStkLvl < 1) // invalid number format
|
if (*psz != 0 || nStkLvl < 1) // invalid number format
|
||||||
return (HDDEDATA) DDE_FNOTPROCESSED;
|
return (HDDEDATA) DDE_FNOTPROCESSED;
|
||||||
|
|
||||||
SuspendDebugger(); // suspend debugger
|
SuspendDebugger(); // suspend debugger
|
||||||
bDbgAutoStateCtrl = FALSE; // disable automatic debugger state control
|
bDbgAutoStateCtrl = FALSE; // disable automatic debugger state control
|
||||||
|
|
||||||
if (!(Chipset.IORam[BITOFFSET]&DON)) // HP off
|
if (!(Chipset.IORam[BITOFFSET]&DON)) // HP off
|
||||||
{
|
{
|
||||||
// turn on HP
|
// turn on HP
|
||||||
KeyboardEvent(TRUE,0,0x8000);
|
KeyboardEvent(TRUE,0,0x8000);
|
||||||
Sleep(dwWakeupDelay);
|
Sleep(dwWakeupDelay);
|
||||||
KeyboardEvent(FALSE,0,0x8000);
|
KeyboardEvent(FALSE,0,0x8000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForSleepState()) // wait for cpu SHUTDN then sleep state
|
if (WaitForSleepState()) // wait for cpu SHUTDN then sleep state
|
||||||
{
|
{
|
||||||
hReturn = DDE_FNOTPROCESSED;
|
hReturn = DDE_FNOTPROCESSED;
|
||||||
goto cancel;
|
goto cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (nState!=nNextState) Sleep(0);
|
while (nState!=nNextState) Sleep(0);
|
||||||
_ASSERT(nState==SM_SLEEP);
|
_ASSERT(nState==SM_SLEEP);
|
||||||
|
|
||||||
bSuccess = FALSE;
|
bSuccess = FALSE;
|
||||||
|
|
||||||
// get data and size
|
// get data and size
|
||||||
lpData = DdeAccessData(hData,&dwSize);
|
lpData = DdeAccessData(hData,&dwSize);
|
||||||
|
|
||||||
// has object length header
|
// has object length header
|
||||||
if (lpData && dwSize >= sizeof(DWORD))
|
if (lpData && dwSize >= sizeof(DWORD))
|
||||||
{
|
{
|
||||||
dwIndex = *(LPDWORD) lpData; // object length
|
dwIndex = *(LPDWORD) lpData; // object length
|
||||||
|
|
||||||
if (dwIndex <= dwSize - sizeof(DWORD))
|
if (dwIndex <= dwSize - sizeof(DWORD))
|
||||||
{
|
{
|
||||||
// reserve unpacked object length memory
|
// reserve unpacked object length memory
|
||||||
LPBYTE pbyMem = (LPBYTE) malloc(dwIndex * 2);
|
LPBYTE pbyMem = (LPBYTE) malloc(dwIndex * 2);
|
||||||
|
|
||||||
if (pbyMem != NULL)
|
if (pbyMem != NULL)
|
||||||
{
|
{
|
||||||
// copy data and write to stack
|
// copy data and write to stack
|
||||||
CopyMemory(pbyMem+dwIndex,lpData+sizeof(DWORD),dwIndex);
|
CopyMemory(pbyMem+dwIndex,lpData+sizeof(DWORD),dwIndex);
|
||||||
bSuccess = (WriteStack(nStkLvl,pbyMem,dwIndex) == S_ERR_NO);
|
bSuccess = (WriteStack(nStkLvl,pbyMem,dwIndex) == S_ERR_NO);
|
||||||
free(pbyMem); // free memory
|
free(pbyMem); // free memory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DdeUnaccessData(hData);
|
DdeUnaccessData(hData);
|
||||||
|
|
||||||
SwitchToState(SM_RUN); // run state
|
SwitchToState(SM_RUN); // run state
|
||||||
while (nState!=nNextState) Sleep(0);
|
while (nState!=nNextState) Sleep(0);
|
||||||
_ASSERT(nState==SM_RUN);
|
_ASSERT(nState==SM_RUN);
|
||||||
|
|
||||||
if (bSuccess == FALSE)
|
if (bSuccess == FALSE)
|
||||||
{
|
{
|
||||||
hReturn = DDE_FNOTPROCESSED;
|
hReturn = DDE_FNOTPROCESSED;
|
||||||
goto cancel;
|
goto cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardEvent(TRUE,0,0x8000);
|
KeyboardEvent(TRUE,0,0x8000);
|
||||||
Sleep(dwWakeupDelay);
|
Sleep(dwWakeupDelay);
|
||||||
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);
|
||||||
hReturn = (HDDEDATA) DDE_FACK;
|
hReturn = (HDDEDATA) DDE_FACK;
|
||||||
|
|
||||||
cancel:
|
cancel:
|
||||||
bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control
|
bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control
|
||||||
ResumeDebugger();
|
ResumeDebugger();
|
||||||
return hReturn;
|
return hReturn;
|
||||||
|
|
||||||
case XTYP_REQUEST:
|
case XTYP_REQUEST:
|
||||||
// quit on models without stack or illegal data format or not in running state
|
// quit on models without stack or illegal data format or not in running state
|
||||||
if (!bStackEnable || iFmt != uCF_HpObj || nState != SM_RUN)
|
if (!bStackEnable || iFmt != uCF_HpObj || nState != SM_RUN)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// get item name
|
// get item name
|
||||||
DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0);
|
DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0);
|
||||||
nStkLvl = _tcstoul(szBuffer,&psz,10);
|
nStkLvl = _tcstoul(szBuffer,&psz,10);
|
||||||
if (*psz != 0 || nStkLvl < 1) // invalid number format
|
if (*psz != 0 || nStkLvl < 1) // invalid number format
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (WaitForSleepState()) // wait for cpu SHUTDN then sleep state
|
if (WaitForSleepState()) // wait for cpu SHUTDN then sleep state
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while (nState!=nNextState) Sleep(0);
|
while (nState!=nNextState) Sleep(0);
|
||||||
_ASSERT(nState==SM_SLEEP);
|
_ASSERT(nState==SM_SLEEP);
|
||||||
|
|
||||||
dwAddress = RPL_Pick(nStkLvl); // pick address of stack level "item" object
|
dwAddress = RPL_Pick(nStkLvl); // pick address of stack level "item" object
|
||||||
if (dwAddress == 0)
|
if (dwAddress == 0)
|
||||||
{
|
{
|
||||||
SwitchToState(SM_RUN); // run state
|
SwitchToState(SM_RUN); // run state
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
dwLoop = dwSize = (RPL_SkipOb(dwAddress) - dwAddress + 1) / 2;
|
dwLoop = dwSize = (RPL_SkipOb(dwAddress) - dwAddress + 1) / 2;
|
||||||
|
|
||||||
lpHeader = (Chipset.type != 'X') ? (LPBYTE) BINARYHEADER48 : (LPBYTE) BINARYHEADER49;
|
lpHeader = (Chipset.type != 'X') ? (LPBYTE) BINARYHEADER48 : (LPBYTE) BINARYHEADER49;
|
||||||
|
|
||||||
// length of binary header
|
// length of binary header
|
||||||
dwIndex = (DWORD) strlen((LPCSTR) lpHeader);
|
dwIndex = (DWORD) strlen((LPCSTR) lpHeader);
|
||||||
|
|
||||||
// size of objectsize + header + object
|
// size of objectsize + header + object
|
||||||
dwSize += dwIndex + sizeof(DWORD);
|
dwSize += dwIndex + sizeof(DWORD);
|
||||||
|
|
||||||
// reserve memory
|
// reserve memory
|
||||||
if ((lpData = (LPBYTE) malloc(dwSize)) == NULL)
|
if ((lpData = (LPBYTE) malloc(dwSize)) == NULL)
|
||||||
{
|
{
|
||||||
SwitchToState(SM_RUN); // run state
|
SwitchToState(SM_RUN); // run state
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// save data length
|
// save data length
|
||||||
*(DWORD *)lpData = dwLoop + dwIndex;
|
*(DWORD *)lpData = dwLoop + dwIndex;
|
||||||
|
|
||||||
// copy header
|
// copy header
|
||||||
memcpy(lpData + sizeof(DWORD),lpHeader,dwIndex);
|
memcpy(lpData + sizeof(DWORD),lpHeader,dwIndex);
|
||||||
|
|
||||||
// copy data
|
// copy data
|
||||||
for (dwIndex += sizeof(DWORD);dwLoop--;++dwIndex,dwAddress += 2)
|
for (dwIndex += sizeof(DWORD);dwLoop--;++dwIndex,dwAddress += 2)
|
||||||
lpData[dwIndex] = Read2(dwAddress);
|
lpData[dwIndex] = Read2(dwAddress);
|
||||||
|
|
||||||
// write data
|
// write data
|
||||||
hReturn = DdeCreateDataHandle(idDdeInst,lpData,dwSize,0,hsz2,iFmt,0);
|
hReturn = DdeCreateDataHandle(idDdeInst,lpData,dwSize,0,hsz2,iFmt,0);
|
||||||
free(lpData);
|
free(lpData);
|
||||||
|
|
||||||
SwitchToState(SM_RUN); // run state
|
SwitchToState(SM_RUN); // run state
|
||||||
while (nState!=nNextState) Sleep(0);
|
while (nState!=nNextState) Sleep(0);
|
||||||
_ASSERT(nState==SM_RUN);
|
_ASSERT(nState==SM_RUN);
|
||||||
|
|
||||||
return hReturn;
|
return hReturn;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
UNREFERENCED_PARAMETER(hConv);
|
UNREFERENCED_PARAMETER(hConv);
|
||||||
UNREFERENCED_PARAMETER(dwData1);
|
UNREFERENCED_PARAMETER(dwData1);
|
||||||
UNREFERENCED_PARAMETER(dwData2);
|
UNREFERENCED_PARAMETER(dwData2);
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,39 +1,39 @@
|
||||||
/*
|
/*
|
||||||
* debugger.h
|
* debugger.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Christoph Gießelink
|
* Copyright (C) 1999 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// breakpoint type definitions
|
// breakpoint type definitions
|
||||||
#define BP_EXEC 0x01 // code breakpoint
|
#define BP_EXEC 0x01 // code breakpoint
|
||||||
#define BP_READ 0x02 // read memory breakpoint
|
#define BP_READ 0x02 // read memory breakpoint
|
||||||
#define BP_WRITE 0x04 // write memory breakpoint
|
#define BP_WRITE 0x04 // write memory breakpoint
|
||||||
#define BP_RPL 0x08 // RPL breakpoint
|
#define BP_RPL 0x08 // RPL breakpoint
|
||||||
#define BP_ACCESS (BP_READ|BP_WRITE) // read/write memory breakpoint
|
#define BP_ACCESS (BP_READ|BP_WRITE) // read/write memory breakpoint
|
||||||
|
|
||||||
// breakpoint notify definitions
|
// breakpoint notify definitions
|
||||||
#define BN_ASM 0 // ASM breakpoint
|
#define BN_ASM 0 // ASM breakpoint
|
||||||
#define BN_RPL 1 // RPL breakpoint
|
#define BN_RPL 1 // RPL breakpoint
|
||||||
#define BN_ASM_BT 2 // ASM and RPL breakpoint
|
#define BN_ASM_BT 2 // ASM and RPL breakpoint
|
||||||
|
|
||||||
// debugger state definitions
|
// debugger state definitions
|
||||||
#define DBG_SUSPEND -1
|
#define DBG_SUSPEND -1
|
||||||
#define DBG_OFF 0
|
#define DBG_OFF 0
|
||||||
#define DBG_RUN 1
|
#define DBG_RUN 1
|
||||||
#define DBG_STEPINTO 2
|
#define DBG_STEPINTO 2
|
||||||
#define DBG_STEPOVER 3
|
#define DBG_STEPOVER 3
|
||||||
#define DBG_STEPOUT 4
|
#define DBG_STEPOUT 4
|
||||||
|
|
||||||
// debugger.c
|
// debugger.c
|
||||||
extern VOID UpdateDbgCycleCounter(VOID);
|
extern VOID UpdateDbgCycleCounter(VOID);
|
||||||
extern BOOL CheckBreakpoint(DWORD dwAddr, DWORD wRange, UINT nType);
|
extern BOOL CheckBreakpoint(DWORD dwAddr, DWORD wRange, UINT nType);
|
||||||
extern VOID NotifyDebugger(INT nType);
|
extern VOID NotifyDebugger(INT nType);
|
||||||
extern VOID DisableDebugger(VOID);
|
extern VOID DisableDebugger(VOID);
|
||||||
extern LRESULT OnToolDebug(VOID);
|
extern LRESULT OnToolDebug(VOID);
|
||||||
extern VOID LoadBreakpointList(HANDLE hFile);
|
extern VOID LoadBreakpointList(HANDLE hFile);
|
||||||
extern VOID SaveBreakpointList(HANDLE hFile);
|
extern VOID SaveBreakpointList(HANDLE hFile);
|
||||||
extern VOID CreateBackupBreakpointList(VOID);
|
extern VOID CreateBackupBreakpointList(VOID);
|
||||||
extern VOID RestoreBackupBreakpointList(VOID);
|
extern VOID RestoreBackupBreakpointList(VOID);
|
File diff suppressed because it is too large
Load diff
|
@ -1,221 +1,221 @@
|
||||||
/*
|
/*
|
||||||
* dismem.c
|
* dismem.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Christoph Gießelink
|
* Copyright (C) 2012 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
|
|
||||||
typedef struct // type of model memory mapping
|
typedef struct // type of model memory mapping
|
||||||
{
|
{
|
||||||
BYTE byType; // calculator type
|
BYTE byType; // calculator type
|
||||||
CONST LPBYTE *ppbyNCE1; // NCE1 data
|
CONST LPBYTE *ppbyNCE1; // NCE1 data
|
||||||
CONST DWORD *pdwNCE1Size; // NCE1 size
|
CONST DWORD *pdwNCE1Size; // NCE1 size
|
||||||
CONST LPBYTE *ppbyNCE2; // NCE2 data
|
CONST LPBYTE *ppbyNCE2; // NCE2 data
|
||||||
CONST DWORD *pdwNCE2Size; // NCE2 size
|
CONST DWORD *pdwNCE2Size; // NCE2 size
|
||||||
CONST LPBYTE *ppbyCE1; // CE1 data
|
CONST LPBYTE *ppbyCE1; // CE1 data
|
||||||
CONST DWORD *pdwCE1Size; // CE1 size
|
CONST DWORD *pdwCE1Size; // CE1 size
|
||||||
CONST LPBYTE *ppbyCE2; // CE2 data
|
CONST LPBYTE *ppbyCE2; // CE2 data
|
||||||
CONST DWORD *pdwCE2Size; // CE2 size
|
CONST DWORD *pdwCE2Size; // CE2 size
|
||||||
CONST LPBYTE *ppbyNCE3; // NCE3 data
|
CONST LPBYTE *ppbyNCE3; // NCE3 data
|
||||||
CONST DWORD *pdwNCE3Size; // NCE3 size
|
CONST DWORD *pdwNCE3Size; // NCE3 size
|
||||||
} MODEL_MAP_T;
|
} MODEL_MAP_T;
|
||||||
|
|
||||||
static CONST LPBYTE pbyNoMEM = NULL; // no memory module
|
static CONST LPBYTE pbyNoMEM = NULL; // no memory module
|
||||||
|
|
||||||
static CONST MODEL_MAP_T MemMap[] =
|
static CONST MODEL_MAP_T MemMap[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
0, // default
|
0, // default
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&pbyNoMEM, NULL // nc.
|
&pbyNoMEM, NULL // nc.
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'6', // HP38G (64K)
|
'6', // HP38G (64K)
|
||||||
&pbyRom, &dwRomSize, // ROM
|
&pbyRom, &dwRomSize, // ROM
|
||||||
&Port0, &Chipset.Port0Size, // RAM
|
&Port0, &Chipset.Port0Size, // RAM
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&pbyNoMEM, NULL // nc.
|
&pbyNoMEM, NULL // nc.
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'A', // HP38G
|
'A', // HP38G
|
||||||
&pbyRom, &dwRomSize, // ROM
|
&pbyRom, &dwRomSize, // ROM
|
||||||
&Port0, &Chipset.Port0Size, // RAM
|
&Port0, &Chipset.Port0Size, // RAM
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&pbyNoMEM, NULL // nc.
|
&pbyNoMEM, NULL // nc.
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'E', // HP39/40G
|
'E', // HP39/40G
|
||||||
&pbyRom, &dwRomSize, // ROM
|
&pbyRom, &dwRomSize, // ROM
|
||||||
&Port0, &Chipset.Port0Size, // RAM part 1
|
&Port0, &Chipset.Port0Size, // RAM part 1
|
||||||
&pbyNoMEM, NULL, // BS
|
&pbyNoMEM, NULL, // BS
|
||||||
&pbyNoMEM, NULL, // nc.
|
&pbyNoMEM, NULL, // nc.
|
||||||
&Port2, &Chipset.Port2Size // RAM part 2
|
&Port2, &Chipset.Port2Size // RAM part 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'G', // HP48GX
|
'G', // HP48GX
|
||||||
&pbyRom, &dwRomSize, // ROM
|
&pbyRom, &dwRomSize, // ROM
|
||||||
&Port0, &Chipset.Port0Size, // RAM
|
&Port0, &Chipset.Port0Size, // RAM
|
||||||
&pbyNoMEM, NULL, // BS
|
&pbyNoMEM, NULL, // BS
|
||||||
&Port1, &Chipset.Port1Size, // Card slot 1
|
&Port1, &Chipset.Port1Size, // Card slot 1
|
||||||
&pbyPort2, &dwPort2Size // Card slot 2
|
&pbyPort2, &dwPort2Size // Card slot 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'S', // HP48SX
|
'S', // HP48SX
|
||||||
&pbyRom, &dwRomSize, // ROM
|
&pbyRom, &dwRomSize, // ROM
|
||||||
&Port0, &Chipset.Port0Size, // RAM
|
&Port0, &Chipset.Port0Size, // RAM
|
||||||
&Port1, &Chipset.Port1Size, // Card slot 1
|
&Port1, &Chipset.Port1Size, // Card slot 1
|
||||||
&pbyPort2, &dwPort2Size, // Card slot 2
|
&pbyPort2, &dwPort2Size, // Card slot 2
|
||||||
&pbyNoMEM, NULL // nc.
|
&pbyNoMEM, NULL // nc.
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'X', // HP49G
|
'X', // HP49G
|
||||||
&pbyRom, &dwRomSize, // Flash
|
&pbyRom, &dwRomSize, // Flash
|
||||||
&Port0, &Chipset.Port0Size, // RAM
|
&Port0, &Chipset.Port0Size, // RAM
|
||||||
&pbyNoMEM, NULL, // BS
|
&pbyNoMEM, NULL, // BS
|
||||||
&Port1, &Chipset.Port1Size, // Port 1 part 1
|
&Port1, &Chipset.Port1Size, // Port 1 part 1
|
||||||
&Port2, &Chipset.Port2Size // Port 1 part 2
|
&Port2, &Chipset.Port2Size // Port 1 part 2
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static MODEL_MAP_T CONST *pMapping = MemMap; // model specific memory mapping
|
static MODEL_MAP_T CONST *pMapping = MemMap; // model specific memory mapping
|
||||||
static enum MEM_MAPPING eMapType = MEM_MMU; // MMU memory mapping
|
static enum MEM_MAPPING eMapType = MEM_MMU; // MMU memory mapping
|
||||||
|
|
||||||
static LPBYTE pbyMapData = NULL;
|
static LPBYTE pbyMapData = NULL;
|
||||||
static DWORD dwMapDataSize = 0;
|
static DWORD dwMapDataSize = 0;
|
||||||
static DWORD dwMapDataMask = 0;
|
static DWORD dwMapDataMask = 0;
|
||||||
|
|
||||||
BOOL SetMemRomType(BYTE cCurrentRomType)
|
BOOL SetMemRomType(BYTE cCurrentRomType)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
pMapping = MemMap; // init default mapping
|
pMapping = MemMap; // init default mapping
|
||||||
|
|
||||||
// scan for all table entries
|
// scan for all table entries
|
||||||
for (i = 0; i < ARRAYSIZEOF(MemMap); ++i)
|
for (i = 0; i < ARRAYSIZEOF(MemMap); ++i)
|
||||||
{
|
{
|
||||||
if (MemMap[i].byType == cCurrentRomType)
|
if (MemMap[i].byType == cCurrentRomType)
|
||||||
{
|
{
|
||||||
pMapping = &MemMap[i]; // found entry
|
pMapping = &MemMap[i]; // found entry
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SetMemMapType(enum MEM_MAPPING eType)
|
BOOL SetMemMapType(enum MEM_MAPPING eType)
|
||||||
{
|
{
|
||||||
BOOL bSucc = TRUE;
|
BOOL bSucc = TRUE;
|
||||||
|
|
||||||
eMapType = eType;
|
eMapType = eType;
|
||||||
|
|
||||||
switch (eMapType)
|
switch (eMapType)
|
||||||
{
|
{
|
||||||
case MEM_MMU:
|
case MEM_MMU:
|
||||||
pbyMapData = NULL; // data
|
pbyMapData = NULL; // data
|
||||||
dwMapDataSize = 512 * 1024 * 2; // data size
|
dwMapDataSize = 512 * 1024 * 2; // data size
|
||||||
dwMapDataMask = dwMapDataSize - 1; // size mask
|
dwMapDataMask = dwMapDataSize - 1; // size mask
|
||||||
break;
|
break;
|
||||||
case MEM_NCE1:
|
case MEM_NCE1:
|
||||||
pbyMapData = *pMapping->ppbyNCE1;
|
pbyMapData = *pMapping->ppbyNCE1;
|
||||||
dwMapDataSize = *pMapping->pdwNCE1Size; // ROM size is always in nibbles
|
dwMapDataSize = *pMapping->pdwNCE1Size; // ROM size is always in nibbles
|
||||||
dwMapDataMask = dwMapDataSize - 1; // size mask
|
dwMapDataMask = dwMapDataSize - 1; // size mask
|
||||||
break;
|
break;
|
||||||
case MEM_NCE2:
|
case MEM_NCE2:
|
||||||
pbyMapData = *pMapping->ppbyNCE2;
|
pbyMapData = *pMapping->ppbyNCE2;
|
||||||
dwMapDataSize = *pMapping->pdwNCE2Size * 1024 * 2;
|
dwMapDataSize = *pMapping->pdwNCE2Size * 1024 * 2;
|
||||||
dwMapDataMask = dwMapDataSize - 1; // size mask
|
dwMapDataMask = dwMapDataSize - 1; // size mask
|
||||||
break;
|
break;
|
||||||
case MEM_CE1:
|
case MEM_CE1:
|
||||||
pbyMapData = *pMapping->ppbyCE1;
|
pbyMapData = *pMapping->ppbyCE1;
|
||||||
dwMapDataSize = *pMapping->pdwCE1Size * 1024 * 2;
|
dwMapDataSize = *pMapping->pdwCE1Size * 1024 * 2;
|
||||||
dwMapDataMask = dwMapDataSize - 1; // size mask
|
dwMapDataMask = dwMapDataSize - 1; // size mask
|
||||||
break;
|
break;
|
||||||
case MEM_CE2:
|
case MEM_CE2:
|
||||||
pbyMapData = *pMapping->ppbyCE2;
|
pbyMapData = *pMapping->ppbyCE2;
|
||||||
dwMapDataSize = *pMapping->pdwCE2Size * 1024 * 2;
|
dwMapDataSize = *pMapping->pdwCE2Size * 1024 * 2;
|
||||||
dwMapDataMask = dwMapDataSize - 1; // size mask
|
dwMapDataMask = dwMapDataSize - 1; // size mask
|
||||||
break;
|
break;
|
||||||
case MEM_NCE3:
|
case MEM_NCE3:
|
||||||
pbyMapData = *pMapping->ppbyNCE3;
|
pbyMapData = *pMapping->ppbyNCE3;
|
||||||
dwMapDataSize = *pMapping->pdwNCE3Size * 1024 * 2;
|
dwMapDataSize = *pMapping->pdwNCE3Size * 1024 * 2;
|
||||||
dwMapDataMask = dwMapDataSize - 1; // size mask
|
dwMapDataMask = dwMapDataSize - 1; // size mask
|
||||||
break;
|
break;
|
||||||
default: _ASSERT(FALSE);
|
default: _ASSERT(FALSE);
|
||||||
pbyMapData = NULL;
|
pbyMapData = NULL;
|
||||||
dwMapDataSize = 0;
|
dwMapDataSize = 0;
|
||||||
dwMapDataMask = 0;
|
dwMapDataMask = 0;
|
||||||
bSucc = FALSE;
|
bSucc = FALSE;
|
||||||
}
|
}
|
||||||
return bSucc;
|
return bSucc;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MEM_MAPPING GetMemMapType(VOID)
|
enum MEM_MAPPING GetMemMapType(VOID)
|
||||||
{
|
{
|
||||||
return eMapType;
|
return eMapType;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL GetMemAvail(enum MEM_MAPPING eType)
|
BOOL GetMemAvail(enum MEM_MAPPING eType)
|
||||||
{
|
{
|
||||||
switch (eType)
|
switch (eType)
|
||||||
{
|
{
|
||||||
case MEM_MMU: return TRUE;
|
case MEM_MMU: return TRUE;
|
||||||
case MEM_NCE1: return *pMapping->ppbyNCE1 != NULL;
|
case MEM_NCE1: return *pMapping->ppbyNCE1 != NULL;
|
||||||
case MEM_NCE2: return *pMapping->ppbyNCE2 != NULL;
|
case MEM_NCE2: return *pMapping->ppbyNCE2 != NULL;
|
||||||
case MEM_CE1: return *pMapping->ppbyCE1 != NULL;
|
case MEM_CE1: return *pMapping->ppbyCE1 != NULL;
|
||||||
case MEM_CE2: return *pMapping->ppbyCE2 != NULL;
|
case MEM_CE2: return *pMapping->ppbyCE2 != NULL;
|
||||||
case MEM_NCE3: return *pMapping->ppbyNCE3 != NULL;
|
case MEM_NCE3: return *pMapping->ppbyNCE3 != NULL;
|
||||||
default: _ASSERT(FALSE);
|
default: _ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD GetMemDataSize(VOID)
|
DWORD GetMemDataSize(VOID)
|
||||||
{
|
{
|
||||||
return dwMapDataSize;
|
return dwMapDataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD GetMemDataMask(VOID)
|
DWORD GetMemDataMask(VOID)
|
||||||
{
|
{
|
||||||
return dwMapDataMask;
|
return dwMapDataMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE GetMemNib(DWORD *p)
|
BYTE GetMemNib(DWORD *p)
|
||||||
{
|
{
|
||||||
BYTE byVal;
|
BYTE byVal;
|
||||||
|
|
||||||
if (pbyMapData == NULL)
|
if (pbyMapData == NULL)
|
||||||
{
|
{
|
||||||
Npeek(&byVal, *p, 1);
|
Npeek(&byVal, *p, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byVal = pbyMapData[*p];
|
byVal = pbyMapData[*p];
|
||||||
}
|
}
|
||||||
*p = (*p + 1) & dwMapDataMask;
|
*p = (*p + 1) & dwMapDataMask;
|
||||||
return byVal;
|
return byVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID GetMemPeek(BYTE *a, DWORD d, UINT s)
|
VOID GetMemPeek(BYTE *a, DWORD d, UINT s)
|
||||||
{
|
{
|
||||||
if (pbyMapData == NULL)
|
if (pbyMapData == NULL)
|
||||||
{
|
{
|
||||||
Npeek(a, d, s);
|
Npeek(a, d, s);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (; s > 0; --s, ++d)
|
for (; s > 0; --s, ++d)
|
||||||
{
|
{
|
||||||
*a++ = pbyMapData[d & dwMapDataMask];
|
*a++ = pbyMapData[d & dwMapDataMask];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,25 +1,25 @@
|
||||||
/*
|
/*
|
||||||
* disrpl.h
|
* disrpl.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008 Christoph Gießelink
|
* Copyright (C) 2008 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// RPL platform type
|
// RPL platform type
|
||||||
#define RPL_P1 (1<<0) // Clamshell without RRP
|
#define RPL_P1 (1<<0) // Clamshell without RRP
|
||||||
#define RPL_P2 (RPL_P1 | (1<<1)) // Pioneer / Clamshell
|
#define RPL_P2 (RPL_P1 | (1<<1)) // Pioneer / Clamshell
|
||||||
#define RPL_P3 (RPL_P2 | (1<<2)) // Charlemagne
|
#define RPL_P3 (RPL_P2 | (1<<2)) // Charlemagne
|
||||||
#define RPL_P4 (RPL_P3 | (1<<3)) // Alcuin
|
#define RPL_P4 (RPL_P3 | (1<<3)) // Alcuin
|
||||||
#define RPL_P5 (RPL_P4 | (1<<4)) // V'ger
|
#define RPL_P5 (RPL_P4 | (1<<4)) // V'ger
|
||||||
|
|
||||||
extern DWORD dwRplPlatform; // RPL platform
|
extern DWORD dwRplPlatform; // RPL platform
|
||||||
extern BOOL bRplViewName; // show entry point name
|
extern BOOL bRplViewName; // show entry point name
|
||||||
extern BOOL bRplViewAddr; // show adress
|
extern BOOL bRplViewAddr; // show adress
|
||||||
extern BOOL bRplViewBin; // show binary data
|
extern BOOL bRplViewBin; // show binary data
|
||||||
extern BOOL bRplViewAsm; // show ASM code instead of hex data
|
extern BOOL bRplViewAsm; // show ASM code instead of hex data
|
||||||
extern BYTE (*RplReadNibble)(DWORD *p); // read nibble function pointer
|
extern BYTE (*RplReadNibble)(DWORD *p); // read nibble function pointer
|
||||||
extern DWORD RplSkipObject(DWORD dwAddr);
|
extern DWORD RplSkipObject(DWORD dwAddr);
|
||||||
extern LPTSTR RplDecodeObject(DWORD dwAddr, DWORD *pdwNxtAddr);
|
extern LPTSTR RplDecodeObject(DWORD dwAddr, DWORD *pdwNxtAddr);
|
||||||
extern LPTSTR RplCreateObjView(DWORD dwStartAddr, DWORD dwEndAddr, BOOL bSingleObj);
|
extern LPTSTR RplCreateObjView(DWORD dwStartAddr, DWORD dwEndAddr, BOOL bSingleObj);
|
File diff suppressed because it is too large
Load diff
|
@ -1,454 +1,455 @@
|
||||||
/*
|
/*
|
||||||
* emu48.h
|
* Emu48.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define _KB(a) ((a)*2*1024)
|
#define _KB(a) ((a)*2*1024)
|
||||||
|
|
||||||
#define HARDWARE "Yorke" // emulator hardware
|
#define HARDWARE "Yorke" // emulator hardware
|
||||||
#define MODELS "6AEGSX" // valid calculator models
|
#define MODELS "6AEGSX" // valid calculator models
|
||||||
|
|
||||||
#define ARRAYSIZEOF(a) (sizeof(a) / sizeof(a[0]))
|
#define ARRAYSIZEOF(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
// cards status
|
// cards status
|
||||||
#define PORT1_PRESENT ((cCurrentRomType=='S')?P1C:P2C)
|
#define PORT1_PRESENT ((cCurrentRomType=='S')?P1C:P2C)
|
||||||
#define PORT1_WRITE ((cCurrentRomType=='S')?P1W:P2W)
|
#define PORT1_WRITE ((cCurrentRomType=='S')?P1W:P2W)
|
||||||
#define PORT2_PRESENT ((cCurrentRomType=='S')?P2C:P1C)
|
#define PORT2_PRESENT ((cCurrentRomType=='S')?P2C:P1C)
|
||||||
#define PORT2_WRITE ((cCurrentRomType=='S')?P2W:P1W)
|
#define PORT2_WRITE ((cCurrentRomType=='S')?P2W:P1W)
|
||||||
|
|
||||||
#define BINARYHEADER48 "HPHP48-W"
|
#define BINARYHEADER48 "HPHP48-W"
|
||||||
#define BINARYHEADER49 "HPHP49-W"
|
#define BINARYHEADER49 "HPHP49-W"
|
||||||
|
|
||||||
#define BIN_FILTER "Port Data File (*.BIN)\0*.BIN\0All Files (*.*)\0*.*\0"
|
#define BIN_FILTER "Port Data File (*.BIN)\0*.BIN\0All Files (*.*)\0*.*\0"
|
||||||
#define HP_FILTER "HP Binary Object (*.HP;*.LIB)\0*.HP;*.LIB\0All Files (*.*)\0*.*\0"
|
#define HP_FILTER "HP Binary Object (*.HP;*.LIB)\0*.HP;*.LIB\0All Files (*.*)\0*.*\0"
|
||||||
|
|
||||||
#define CF_HPOBJ "CF_HPOBJ" // clipboard format for DDE
|
#define CF_HPOBJ "CF_HPOBJ" // clipboard format for DDE
|
||||||
|
|
||||||
// CPU cycles in 16384 Hz time frame
|
// CPU cycles in 16384 Hz time frame
|
||||||
#define T2CYCLES ((cCurrentRomType=='S')?dwSXCycles:dwGXCycles)
|
#define T2CYCLES ((cCurrentRomType=='S')?dwSXCycles:dwGXCycles)
|
||||||
|
|
||||||
#define SM_RUN 0 // states of cpu emulation thread
|
#define SM_RUN 0 // states of cpu emulation thread
|
||||||
#define SM_INVALID 1
|
#define SM_INVALID 1
|
||||||
#define SM_RETURN 2
|
#define SM_RETURN 2
|
||||||
#define SM_SLEEP 3
|
#define SM_SLEEP 3
|
||||||
|
|
||||||
#define S_ERR_NO 0 // stack errorcodes
|
#define S_ERR_NO 0 // stack errorcodes
|
||||||
#define S_ERR_OBJECT 1
|
#define S_ERR_OBJECT 1
|
||||||
#define S_ERR_BINARY 2
|
#define S_ERR_BINARY 2
|
||||||
#define S_ERR_ASCII 3
|
#define S_ERR_ASCII 3
|
||||||
|
|
||||||
#define BAD_OB (0xFFFFFFFF) // bad object
|
#define BAD_OB (0xFFFFFFFF) // bad object
|
||||||
|
|
||||||
#define NO_SERIAL "disabled" // port not open
|
#define NO_SERIAL "disabled" // port not open
|
||||||
|
|
||||||
#define HP_MNEMONICS FALSE // disassembler mnenomics mode
|
#define HP_MNEMONICS FALSE // disassembler mnenomics mode
|
||||||
#define CLASS_MNEMONICS TRUE
|
#define CLASS_MNEMONICS TRUE
|
||||||
|
|
||||||
#define MACRO_OFF 0 // macro recorder off
|
#define MACRO_OFF 0 // macro recorder off
|
||||||
#define MACRO_NEW 1
|
#define MACRO_NEW 1
|
||||||
#define MACRO_PLAY 2
|
#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
|
||||||
|
|
||||||
#define ROMPAGESIZE (1<<12) // ROM dirty page size in nibbles
|
#define ROMPAGESIZE (1<<12) // ROM dirty page size in nibbles
|
||||||
|
|
||||||
// window styles
|
// window styles
|
||||||
#define STYLE_TITLE (WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED)
|
#define STYLE_TITLE (WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED)
|
||||||
#define STYLE_NOTITLE (WS_POPUP|WS_SYSMENU|WS_MINIMIZEBOX|WS_CLIPSIBLINGS)
|
#define STYLE_NOTITLE (WS_POPUP|WS_SYSMENU|WS_MINIMIZEBOX|WS_CLIPSIBLINGS)
|
||||||
|
|
||||||
// WM_COPYDATA identifier
|
// WM_COPYDATA identifier
|
||||||
#define CDID_FILENAME 1 // send file name
|
#define CDID_FILENAME 1 // send file name
|
||||||
|
|
||||||
// macro to check for valid calculator model
|
// macro to check for valid calculator model
|
||||||
#define isModelValid(m) (m != 0 && strchr(MODELS,m) != NULL)
|
#define isModelValid(m) (m != 0 && strchr(MODELS,m) != NULL)
|
||||||
|
|
||||||
// values for mapping area
|
// values for mapping area
|
||||||
enum MMUMAP { M_IO, M_ROM, M_RAM, M_P1, M_P2, M_BS };
|
enum MMUMAP { M_IO, M_ROM, M_RAM, M_P1, M_P2, M_BS };
|
||||||
|
|
||||||
// values for disassembler memory mapping modes
|
// values for disassembler memory mapping modes
|
||||||
enum MEM_MAPPING { MEM_MMU, MEM_NCE1, MEM_NCE2, MEM_CE1, MEM_CE2, MEM_NCE3 };
|
enum MEM_MAPPING { MEM_MMU, MEM_NCE1, MEM_NCE2, MEM_CE1, MEM_CE2, MEM_NCE3 };
|
||||||
|
|
||||||
// Kermit CRC calculation
|
// Kermit CRC calculation
|
||||||
static __inline WORD UpCRC(WORD wCRC, BYTE nib) { return (wCRC >> 4) ^ (((wCRC ^ nib) & 0xf) * 0x1081); }
|
static __inline WORD UpCRC(WORD wCRC, BYTE nib) { return (wCRC >> 4) ^ (((wCRC ^ nib) & 0xf) * 0x1081); }
|
||||||
|
|
||||||
// Emu48.c
|
// Emu48.c
|
||||||
extern HPALETTE hPalette;
|
extern HPALETTE hPalette;
|
||||||
extern HPALETTE hOldPalette;
|
extern HPALETTE hOldPalette;
|
||||||
extern HANDLE hEventShutdn;
|
extern HANDLE hEventShutdn;
|
||||||
extern LPTSTR szAppName;
|
extern LPTSTR szAppName;
|
||||||
extern LPTSTR szTopic;
|
extern LPTSTR szTopic;
|
||||||
extern LPTSTR szTitle;
|
extern LPTSTR szTitle;
|
||||||
extern CRITICAL_SECTION csGDILock;
|
extern CRITICAL_SECTION csGDILock;
|
||||||
extern CRITICAL_SECTION csLcdLock;
|
extern CRITICAL_SECTION csLcdLock;
|
||||||
extern CRITICAL_SECTION csKeyLock;
|
extern CRITICAL_SECTION csKeyLock;
|
||||||
extern CRITICAL_SECTION csIOLock;
|
extern CRITICAL_SECTION csIOLock;
|
||||||
extern CRITICAL_SECTION csT1Lock;
|
extern CRITICAL_SECTION csT1Lock;
|
||||||
extern CRITICAL_SECTION csT2Lock;
|
extern CRITICAL_SECTION csT2Lock;
|
||||||
extern CRITICAL_SECTION csTxdLock;
|
extern CRITICAL_SECTION csTxdLock;
|
||||||
extern CRITICAL_SECTION csRecvLock;
|
extern CRITICAL_SECTION csRecvLock;
|
||||||
extern CRITICAL_SECTION csSlowLock;
|
extern CRITICAL_SECTION csSlowLock;
|
||||||
extern CRITICAL_SECTION csDbgLock;
|
extern CRITICAL_SECTION csDbgLock;
|
||||||
extern INT nArgc;
|
extern INT nArgc;
|
||||||
extern LPCTSTR *ppArgv;
|
extern LPCTSTR *ppArgv;
|
||||||
extern LARGE_INTEGER lFreq;
|
extern LARGE_INTEGER lFreq;
|
||||||
extern LARGE_INTEGER lAppStart;
|
extern LARGE_INTEGER lAppStart;
|
||||||
extern DWORD idDdeInst;
|
extern DWORD idDdeInst;
|
||||||
extern UINT uCF_HpObj;
|
extern UINT uCF_HpObj;
|
||||||
extern HINSTANCE hApp;
|
extern HINSTANCE hApp;
|
||||||
extern HWND hWnd;
|
extern HWND hWnd;
|
||||||
extern HWND hDlgDebug;
|
extern HWND hDlgDebug;
|
||||||
extern HWND hDlgFind;
|
extern HWND hDlgFind;
|
||||||
extern HWND hDlgProfile;
|
extern HWND hDlgProfile;
|
||||||
extern HWND hDlgRplObjView;
|
extern HWND hDlgRplObjView;
|
||||||
extern HDC hWindowDC;
|
extern HDC hWindowDC;
|
||||||
extern DWORD dwTColor;
|
extern DWORD dwTColor;
|
||||||
extern DWORD dwTColorTol;
|
extern DWORD dwTColorTol;
|
||||||
extern HRGN hRgn;
|
extern HRGN hRgn;
|
||||||
extern HCURSOR hCursorArrow;
|
extern HCURSOR hCursorArrow;
|
||||||
extern HCURSOR hCursorHand;
|
extern HCURSOR hCursorHand;
|
||||||
extern UINT uWaveDevId;
|
extern UINT uWaveDevId;
|
||||||
extern DWORD dwWakeupDelay;
|
extern DWORD dwWakeupDelay;
|
||||||
extern BOOL bAutoSave;
|
extern BOOL bAutoSave;
|
||||||
extern BOOL bAutoSaveOnExit;
|
extern BOOL bAutoSaveOnExit;
|
||||||
extern BOOL bSaveDefConfirm;
|
extern BOOL bSaveDefConfirm;
|
||||||
extern BOOL bStartupBackup;
|
extern BOOL bStartupBackup;
|
||||||
extern BOOL bAlwaysDisplayLog;
|
extern BOOL bAlwaysDisplayLog;
|
||||||
extern BOOL bLoadObjectWarning;
|
extern BOOL bLoadObjectWarning;
|
||||||
extern BOOL bShowTitle;
|
extern BOOL bShowTitle;
|
||||||
extern BOOL bShowMenu;
|
extern BOOL bShowMenu;
|
||||||
extern BOOL bAlwaysOnTop;
|
extern BOOL bAlwaysOnTop;
|
||||||
extern BOOL bActFollowsMouse;
|
extern BOOL bActFollowsMouse;
|
||||||
extern BOOL bClientWinMove;
|
extern BOOL bClientWinMove;
|
||||||
extern BOOL bSingleInstance;
|
extern BOOL bSingleInstance;
|
||||||
extern HANDLE hThread;
|
extern HANDLE hThread;
|
||||||
extern VOID SetWindowTitle(LPCTSTR szString);
|
extern VOID SetWindowTitle(LPCTSTR szString);
|
||||||
extern VOID ForceForegroundWindow(HWND hWnd);
|
extern VOID ForceForegroundWindow(HWND hWnd);
|
||||||
extern VOID CopyItemsToClipboard(HWND hWnd);
|
extern VOID CopyItemsToClipboard(HWND hWnd);
|
||||||
|
|
||||||
// mru.c
|
// mru.c
|
||||||
extern BOOL MruInit(UINT nNum);
|
extern BOOL MruInit(UINT nNum);
|
||||||
extern VOID MruCleanup(VOID);
|
extern VOID MruCleanup(VOID);
|
||||||
extern VOID MruAdd(LPCTSTR lpszEntry);
|
extern VOID MruAdd(LPCTSTR lpszEntry);
|
||||||
extern VOID MruRemove(UINT nIndex);
|
extern VOID MruRemove(UINT nIndex);
|
||||||
extern VOID MruMoveTop(UINT nIndex);
|
extern VOID MruMoveTop(UINT nIndex);
|
||||||
extern UINT MruEntries(VOID);
|
extern UINT MruEntries(VOID);
|
||||||
extern UINT MruID(LPCTSTR lpszEntry);
|
extern UINT MruID(LPCTSTR lpszEntry);
|
||||||
extern VOID MruFilename(UINT nIndex, LPTSTR szFilename, UINT nBuffersize);
|
extern VOID MruFilename(UINT nIndex, LPTSTR szFilename, UINT nBuffersize);
|
||||||
extern VOID MruUpdateMenu(HMENU hMenu);
|
extern VOID MruUpdateMenu(HMENU hMenu);
|
||||||
extern VOID MruWriteList(VOID);
|
extern VOID MruWriteList(VOID);
|
||||||
extern VOID MruReadList(VOID);
|
extern VOID MruReadList(VOID);
|
||||||
|
|
||||||
// Settings.c
|
// Settings.c
|
||||||
extern VOID ReadSettings(VOID);
|
extern VOID ReadSettings(VOID);
|
||||||
extern VOID WriteSettings(VOID);
|
extern VOID WriteSettings(VOID);
|
||||||
extern VOID ReadLastDocument(LPTSTR szFileName, DWORD nSize);
|
extern VOID ReadLastDocument(LPTSTR szFileName, DWORD nSize);
|
||||||
extern VOID WriteLastDocument(LPCTSTR szFilename);
|
extern VOID WriteLastDocument(LPCTSTR szFilename);
|
||||||
extern VOID ReadSettingsString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpDefault, LPTSTR lpData, DWORD dwSize);
|
extern VOID ReadSettingsString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpDefault, LPTSTR lpData, DWORD dwSize);
|
||||||
extern VOID WriteSettingsString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPTSTR lpData);
|
extern VOID WriteSettingsString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPTSTR lpData);
|
||||||
extern INT ReadSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nDefault);
|
extern INT ReadSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nDefault);
|
||||||
extern VOID WriteSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nValue);
|
extern VOID WriteSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nValue);
|
||||||
extern VOID DelSettingsKey(LPCTSTR lpszSection, LPCTSTR lpszEntry);
|
extern VOID DelSettingsKey(LPCTSTR lpszSection, LPCTSTR lpszEntry);
|
||||||
|
|
||||||
// Display.c
|
// Display.c
|
||||||
extern BOOL bGrayscale;
|
extern BOOL bGrayscale;
|
||||||
extern UINT nBackgroundX;
|
extern UINT nBackgroundX;
|
||||||
extern UINT nBackgroundY;
|
extern UINT nBackgroundY;
|
||||||
extern UINT nBackgroundW;
|
extern UINT nBackgroundW;
|
||||||
extern UINT nBackgroundH;
|
extern UINT nBackgroundH;
|
||||||
extern UINT nLcdX;
|
extern UINT nLcdX;
|
||||||
extern UINT nLcdY;
|
extern UINT nLcdY;
|
||||||
extern UINT nLcdZoom;
|
extern UINT nLcdZoom;
|
||||||
extern UINT nGdiXZoom;
|
extern UINT nGdiXZoom;
|
||||||
extern UINT nGdiYZoom;
|
extern UINT nGdiYZoom;
|
||||||
extern HDC hLcdDC;
|
extern HDC hLcdDC;
|
||||||
extern HDC hMainDC;
|
extern HDC hMainDC;
|
||||||
extern HDC hAnnunDC;
|
extern HDC hAnnunDC;
|
||||||
extern BYTE (*GetLineCounter)(VOID);
|
extern BYTE (*GetLineCounter)(VOID);
|
||||||
extern VOID (*StartDisplay)(BYTE byInitial);
|
extern VOID (*StartDisplay)(BYTE byInitial);
|
||||||
extern VOID (*StopDisplay)(VOID);
|
extern VOID (*StopDisplay)(VOID);
|
||||||
extern VOID UpdateContrast(BYTE byContrast);
|
extern VOID UpdateContrast(BYTE byContrast);
|
||||||
extern VOID SetLcdColor(UINT nId, UINT nRed, UINT nGreen, UINT nBlue);
|
extern VOID SetLcdColor(UINT nId, UINT nRed, UINT nGreen, UINT nBlue);
|
||||||
extern VOID SetLcdMode(BOOL bMode);
|
extern VOID SetLcdMode(BOOL bMode);
|
||||||
extern VOID CreateLcdBitmap(VOID);
|
extern VOID CreateLcdBitmap(VOID);
|
||||||
extern VOID DestroyLcdBitmap(VOID);
|
extern VOID DestroyLcdBitmap(VOID);
|
||||||
extern BOOL CreateMainBitmap(LPCTSTR szFilename);
|
extern BOOL CreateMainBitmap(LPCTSTR szFilename);
|
||||||
extern VOID DestroyMainBitmap(VOID);
|
extern VOID DestroyMainBitmap(VOID);
|
||||||
extern BOOL CreateAnnunBitmap(LPCTSTR szFilename);
|
extern BOOL CreateAnnunBitmap(LPCTSTR szFilename);
|
||||||
extern VOID DestroyAnnunBitmap(VOID);
|
extern VOID DestroyAnnunBitmap(VOID);
|
||||||
extern VOID UpdateDisplayPointers(VOID);
|
extern VOID UpdateDisplayPointers(VOID);
|
||||||
extern VOID UpdateMainDisplay(VOID);
|
extern VOID UpdateMainDisplay(VOID);
|
||||||
extern VOID UpdateMenuDisplay(VOID);
|
extern VOID UpdateMenuDisplay(VOID);
|
||||||
extern VOID WriteToMainDisplay(LPBYTE a, DWORD d, UINT s);
|
extern VOID WriteToMainDisplay(LPBYTE a, DWORD d, UINT s);
|
||||||
extern VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s);
|
extern VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s);
|
||||||
extern VOID UpdateAnnunciators(DWORD dwUpdateMask);
|
extern VOID UpdateAnnunciators(DWORD dwUpdateMask);
|
||||||
extern VOID ResizeWindow(VOID);
|
extern VOID ResizeWindow(VOID);
|
||||||
|
|
||||||
// Engine.c
|
// Engine.c
|
||||||
extern BOOL bInterrupt;
|
extern BOOL bInterrupt;
|
||||||
extern UINT nState;
|
extern UINT nState;
|
||||||
extern UINT nNextState;
|
extern UINT nNextState;
|
||||||
extern BOOL bEnableSlow;
|
extern BOOL bEnableSlow;
|
||||||
extern BOOL bRealSpeed;
|
extern BOOL bRealSpeed;
|
||||||
extern BOOL bKeySlow;
|
extern BOOL bKeySlow;
|
||||||
extern BOOL bSoundSlow;
|
extern BOOL bSoundSlow;
|
||||||
extern UINT nOpcSlow;
|
extern UINT nOpcSlow;
|
||||||
extern CHIPSET Chipset;
|
extern CHIPSET Chipset;
|
||||||
extern TCHAR szSerialWire[16];
|
extern TCHAR szSerialWire[16];
|
||||||
extern TCHAR szSerialIr[16];
|
extern TCHAR szSerialIr[16];
|
||||||
extern DWORD dwSXCycles;
|
extern DWORD dwSXCycles;
|
||||||
extern DWORD dwGXCycles;
|
extern DWORD dwGXCycles;
|
||||||
extern HANDLE hEventDebug;
|
extern HANDLE hEventDebug;
|
||||||
extern BOOL bDbgAutoStateCtrl;
|
extern BOOL bDbgAutoStateCtrl;
|
||||||
extern INT nDbgState;
|
extern INT nDbgState;
|
||||||
extern BOOL bDbgNOP3;
|
extern BOOL bDbgNOP3;
|
||||||
extern BOOL bDbgCode;
|
extern BOOL bDbgCode;
|
||||||
extern BOOL bDbgRPL;
|
extern BOOL bDbgRPL;
|
||||||
extern BOOL bDbgSkipInt;
|
extern BOOL bDbgSkipInt;
|
||||||
extern DWORD dwDbgStopPC;
|
extern DWORD dwDbgStopPC;
|
||||||
extern DWORD dwDbgRplPC;
|
extern DWORD dwDbgRplPC;
|
||||||
extern DWORD dwDbgRstkp;
|
extern DWORD dwDbgRstkp;
|
||||||
extern DWORD dwDbgRstk;
|
extern DWORD dwDbgRstk;
|
||||||
extern DWORD *pdwInstrArray;
|
extern DWORD *pdwInstrArray;
|
||||||
extern WORD wInstrSize;
|
extern WORD wInstrSize;
|
||||||
extern WORD wInstrWp;
|
extern WORD wInstrWp;
|
||||||
extern WORD wInstrRp;
|
extern WORD wInstrRp;
|
||||||
extern VOID (*fnOutTrace)(VOID);
|
extern VOID (*fnOutTrace)(VOID);
|
||||||
extern VOID SuspendDebugger(VOID);
|
extern VOID SuspendDebugger(VOID);
|
||||||
extern VOID ResumeDebugger(VOID);
|
extern VOID ResumeDebugger(VOID);
|
||||||
extern VOID CheckSerial(VOID);
|
extern VOID CheckSerial(VOID);
|
||||||
extern VOID InitAdjustSpeed(VOID);
|
extern VOID InitAdjustSpeed(VOID);
|
||||||
extern VOID AdjKeySpeed(VOID);
|
extern VOID AdjKeySpeed(VOID);
|
||||||
extern VOID SetSpeed(BOOL bAdjust);
|
extern VOID SetSpeed(BOOL bAdjust);
|
||||||
extern VOID UpdateKdnBit(VOID);
|
extern VOID UpdateKdnBit(VOID);
|
||||||
extern BOOL WaitForSleepState(VOID);
|
extern BOOL WaitForSleepState(VOID);
|
||||||
extern UINT SwitchToState(UINT nNewState);
|
extern UINT SwitchToState(UINT nNewState);
|
||||||
extern UINT WorkerThread(LPVOID pParam);
|
extern UINT WorkerThread(LPVOID pParam);
|
||||||
|
|
||||||
// Fetch.c
|
// Fetch.c
|
||||||
extern VOID EvalOpcode(LPBYTE I);
|
extern VOID EvalOpcode(LPBYTE I);
|
||||||
|
|
||||||
// Files.c
|
// Files.c
|
||||||
extern TCHAR szEmuDirectory[MAX_PATH];
|
extern TCHAR szEmuDirectory[MAX_PATH];
|
||||||
extern TCHAR szCurrentDirectory[MAX_PATH];
|
extern TCHAR szCurrentDirectory[MAX_PATH];
|
||||||
extern TCHAR szCurrentKml[MAX_PATH];
|
extern TCHAR szCurrentKml[MAX_PATH];
|
||||||
extern TCHAR szBackupKml[MAX_PATH];
|
extern TCHAR szBackupKml[MAX_PATH];
|
||||||
extern TCHAR szCurrentFilename[MAX_PATH];
|
extern TCHAR szCurrentFilename[MAX_PATH];
|
||||||
extern TCHAR szBackupFilename[MAX_PATH];
|
extern TCHAR szBackupFilename[MAX_PATH];
|
||||||
extern TCHAR szBufferFilename[MAX_PATH];
|
extern TCHAR szBufferFilename[MAX_PATH];
|
||||||
extern TCHAR szPort2Filename[MAX_PATH];
|
extern TCHAR szPort2Filename[MAX_PATH];
|
||||||
extern BOOL bDocumentAvail;
|
extern BOOL bDocumentAvail;
|
||||||
extern BYTE cCurrentRomType;
|
extern BYTE cCurrentRomType;
|
||||||
extern UINT nCurrentClass;
|
extern UINT nCurrentClass;
|
||||||
extern LPBYTE Port0;
|
extern LPBYTE Port0;
|
||||||
extern LPBYTE Port1;
|
extern LPBYTE Port1;
|
||||||
extern LPBYTE Port2;
|
extern LPBYTE Port2;
|
||||||
extern LPBYTE pbyRom;
|
extern LPBYTE pbyRom;
|
||||||
extern BOOL bRomWriteable;
|
extern BOOL bRomWriteable;
|
||||||
extern DWORD dwRomSize;
|
extern DWORD dwRomSize;
|
||||||
extern LPBYTE pbyRomDirtyPage;
|
extern LPBYTE pbyRomDirtyPage;
|
||||||
extern DWORD dwRomDirtyPageSize;
|
extern DWORD dwRomDirtyPageSize;
|
||||||
extern WORD wRomCrc;
|
extern WORD wRomCrc;
|
||||||
extern BOOL bRomCrcCorrection;
|
extern BOOL bRomCrcCorrection;
|
||||||
extern LPBYTE pbyPort2;
|
extern LPBYTE pbyPort2;
|
||||||
extern BOOL bPort2Writeable;
|
extern BOOL bPort2Writeable;
|
||||||
extern BOOL bPort2IsShared;
|
extern BOOL bPort2IsShared;
|
||||||
extern DWORD dwPort2Size;
|
extern DWORD dwPort2Size;
|
||||||
extern DWORD dwPort2Mask;
|
extern DWORD dwPort2Mask;
|
||||||
extern WORD wPort2Crc;
|
extern WORD wPort2Crc;
|
||||||
extern BOOL bBackup;
|
extern BOOL bBackup;
|
||||||
extern VOID SetWindowLocation(HWND hWnd,INT nPosX,INT nPosY);
|
extern VOID SetWindowLocation(HWND hWnd,INT nPosX,INT nPosY);
|
||||||
extern DWORD GetCutPathName(LPCTSTR szFileName,LPTSTR szBuffer,DWORD dwBufferLength,INT nCutLength);
|
extern DWORD GetCutPathName(LPCTSTR szFileName,LPTSTR szBuffer,DWORD dwBufferLength,INT nCutLength);
|
||||||
extern VOID SetWindowPathTitle(LPCTSTR szFileName);
|
extern VOID SetWindowPathTitle(LPCTSTR szFileName);
|
||||||
extern BOOL CheckForBeepPatch(VOID);
|
extern BOOL CheckForBeepPatch(VOID);
|
||||||
extern BOOL PatchNibble(DWORD dwAddress, BYTE byPatch);
|
extern BOOL PatchNibble(DWORD dwAddress, BYTE byPatch);
|
||||||
extern VOID UpdatePatches(BOOL bPatch);
|
extern VOID UpdatePatches(BOOL bPatch);
|
||||||
extern BOOL PatchRom(LPCTSTR szFilename);
|
extern BOOL PatchRom(LPCTSTR szFilename);
|
||||||
extern BOOL CrcRom(WORD *pwChk);
|
extern BOOL CrcRom(WORD *pwChk);
|
||||||
extern BOOL MapRom(LPCTSTR szFilename);
|
extern BOOL MapRom(LPCTSTR szFilename);
|
||||||
extern VOID UnmapRom(VOID);
|
extern VOID UnmapRom(VOID);
|
||||||
extern BOOL MapPort2(LPCTSTR szFilename);
|
extern BOOL MapPort2(LPCTSTR szFilename);
|
||||||
extern VOID UnmapPort2(VOID);
|
extern VOID UnmapPort2(VOID);
|
||||||
extern VOID ResetDocument(VOID);
|
extern VOID ResetDocument(VOID);
|
||||||
extern BOOL NewDocument(VOID);
|
extern BOOL NewDocument(VOID);
|
||||||
extern BOOL OpenDocument(LPCTSTR szFilename);
|
extern BOOL OpenDocument(LPCTSTR szFilename);
|
||||||
extern BOOL SaveDocument(VOID);
|
extern BOOL SaveDocument(VOID);
|
||||||
extern BOOL SaveDocumentAs(LPCTSTR szFilename);
|
extern BOOL SaveDocumentAs(LPCTSTR szFilename);
|
||||||
extern BOOL SaveBackup(VOID);
|
extern BOOL SaveBackup(VOID);
|
||||||
extern BOOL RestoreBackup(VOID);
|
extern BOOL RestoreBackup(VOID);
|
||||||
extern BOOL ResetBackup(VOID);
|
extern BOOL ResetBackup(VOID);
|
||||||
extern BOOL GetOpenFilename(VOID);
|
extern BOOL GetOpenFilename(VOID);
|
||||||
extern BOOL GetSaveAsFilename(VOID);
|
extern BOOL GetSaveAsFilename(VOID);
|
||||||
extern BOOL GetLoadObjectFilename(LPCTSTR lpstrFilter,LPCTSTR lpstrDefExt);
|
extern BOOL GetLoadObjectFilename(LPCTSTR lpstrFilter,LPCTSTR lpstrDefExt);
|
||||||
extern BOOL GetSaveObjectFilename(LPCTSTR lpstrFilter,LPCTSTR lpstrDefExt);
|
extern BOOL GetSaveObjectFilename(LPCTSTR lpstrFilter,LPCTSTR lpstrDefExt);
|
||||||
extern WORD WriteStack(UINT nStkLevel,LPBYTE lpBuf,DWORD dwSize);
|
extern WORD WriteStack(UINT nStkLevel,LPBYTE lpBuf,DWORD dwSize);
|
||||||
extern BOOL LoadObject(LPCTSTR szFilename);
|
extern BOOL LoadObject(LPCTSTR szFilename);
|
||||||
extern BOOL SaveObject(LPCTSTR szFilename);
|
extern BOOL SaveObject(LPCTSTR szFilename);
|
||||||
extern BOOL LoadIconFromFile(LPCTSTR szFilename);
|
extern BOOL LoadIconFromFile(LPCTSTR szFilename);
|
||||||
extern VOID LoadIconDefault(VOID);
|
extern VOID LoadIconDefault(VOID);
|
||||||
extern HBITMAP LoadBitmapFile(LPCTSTR szFilename,BOOL bPalette);
|
extern HBITMAP LoadBitmapFile(LPCTSTR szFilename,BOOL bPalette);
|
||||||
extern HRGN CreateRgnFromBitmap(HBITMAP hBmp,COLORREF color,DWORD dwTol);
|
extern HRGN CreateRgnFromBitmap(HBITMAP hBmp,COLORREF color,DWORD dwTol);
|
||||||
|
|
||||||
// Romcrc.c
|
// Romcrc.c
|
||||||
extern VOID RebuildRomCrc(VOID);
|
extern VOID RebuildRomCrc(VOID);
|
||||||
|
|
||||||
// Timer.c
|
// Timer.c
|
||||||
extern VOID SetHP48Time(VOID);
|
extern VOID SetHP48Time(VOID);
|
||||||
extern VOID StartTimers(VOID);
|
extern VOID StartTimers(VOID);
|
||||||
extern VOID StopTimers(VOID);
|
extern VOID StopTimers(VOID);
|
||||||
extern DWORD ReadT2(VOID);
|
extern DWORD ReadT2(VOID);
|
||||||
extern VOID SetT2(DWORD dwValue);
|
extern VOID SetT2(DWORD dwValue);
|
||||||
extern BYTE ReadT1(VOID);
|
extern BYTE ReadT1(VOID);
|
||||||
extern VOID SetT1(BYTE byValue);
|
extern VOID SetT1(BYTE byValue);
|
||||||
|
|
||||||
// Mops.c
|
// Mops.c
|
||||||
extern BOOL bFlashRomArray;
|
extern BOOL bFlashRomArray;
|
||||||
extern BYTE disp;
|
extern BYTE disp;
|
||||||
extern LPBYTE RMap[256];
|
extern LPBYTE RMap[256];
|
||||||
extern LPBYTE WMap[256];
|
extern LPBYTE WMap[256];
|
||||||
extern VOID Map(BYTE a, BYTE b);
|
extern VOID Map(BYTE a, BYTE b);
|
||||||
extern VOID RomSwitch(DWORD adr);
|
extern VOID RomSwitch(DWORD adr);
|
||||||
extern VOID Config(VOID);
|
extern VOID Config(VOID);
|
||||||
extern VOID Uncnfg(VOID);
|
extern VOID Uncnfg(VOID);
|
||||||
extern VOID Reset(VOID);
|
extern VOID Reset(VOID);
|
||||||
extern VOID C_Eq_Id(VOID);
|
extern VOID C_Eq_Id(VOID);
|
||||||
extern enum MMUMAP MapData(DWORD d);
|
extern enum MMUMAP MapData(DWORD d);
|
||||||
extern VOID CpuReset(VOID);
|
extern VOID CpuReset(VOID);
|
||||||
extern VOID Npeek(BYTE *a, DWORD d, UINT s);
|
extern VOID Npeek(BYTE *a, DWORD d, UINT s);
|
||||||
extern VOID Nread(BYTE *a, DWORD d, UINT s);
|
extern VOID Nread(BYTE *a, DWORD d, UINT s);
|
||||||
extern VOID Nwrite(BYTE *a, DWORD d, UINT s);
|
extern VOID Nwrite(BYTE *a, DWORD d, UINT s);
|
||||||
extern BYTE Read2(DWORD d);
|
extern BYTE Read2(DWORD d);
|
||||||
extern DWORD Read5(DWORD d);
|
extern DWORD Read5(DWORD d);
|
||||||
extern VOID Write5(DWORD d, DWORD n);
|
extern VOID Write5(DWORD d, DWORD n);
|
||||||
extern VOID Write2(DWORD d, BYTE n);
|
extern VOID Write2(DWORD d, BYTE n);
|
||||||
extern VOID IOBit(DWORD d, BYTE b, BOOL s);
|
extern VOID IOBit(DWORD d, BYTE b, BOOL s);
|
||||||
extern VOID ReadIO(BYTE *a, DWORD b, DWORD s, BOOL bUpdate);
|
extern VOID ReadIO(BYTE *a, DWORD b, DWORD s, BOOL bUpdate);
|
||||||
extern VOID WriteIO(BYTE *a, DWORD b, DWORD s);
|
extern VOID WriteIO(BYTE *a, DWORD b, DWORD s);
|
||||||
|
|
||||||
// Lowbat.c
|
// Lowbat.c
|
||||||
extern BOOL bLowBatDisable;
|
extern BOOL bLowBatDisable;
|
||||||
extern VOID StartBatMeasure(VOID);
|
extern VOID StartBatMeasure(VOID);
|
||||||
extern VOID StopBatMeasure(VOID);
|
extern VOID StopBatMeasure(VOID);
|
||||||
extern VOID GetBatteryState(BOOL *pbLBI, BOOL *pbVLBI);
|
extern VOID GetBatteryState(BOOL *pbLBI, BOOL *pbVLBI);
|
||||||
|
|
||||||
// Keyboard.c
|
// Keyboard.c
|
||||||
extern DWORD dwKeyMinDelay;
|
extern DWORD dwKeyMinDelay;
|
||||||
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
|
// Keymacro.c
|
||||||
extern INT nMacroState;
|
extern INT nMacroState;
|
||||||
extern INT nMacroTimeout;
|
extern INT nMacroTimeout;
|
||||||
extern BOOL bMacroRealSpeed;
|
extern BOOL bMacroRealSpeed;
|
||||||
extern DWORD dwMacroMinDelay;
|
extern DWORD dwMacroMinDelay;
|
||||||
extern VOID KeyMacroRecord(BOOL bPress, UINT out, UINT in);
|
extern VOID KeyMacroRecord(BOOL bPress, UINT out, UINT in);
|
||||||
extern LRESULT OnToolMacroNew(VOID);
|
extern LRESULT OnToolMacroNew(VOID);
|
||||||
extern LRESULT OnToolMacroPlay(VOID);
|
extern LRESULT OnToolMacroPlay(VOID);
|
||||||
extern LRESULT OnToolMacroStop(VOID);
|
extern LRESULT OnToolMacroStop(VOID);
|
||||||
extern LRESULT OnToolMacroSettings(VOID);
|
extern LRESULT OnToolMacroSettings(VOID);
|
||||||
|
|
||||||
// Redeye.c
|
// Redeye.c
|
||||||
extern VOID IrPrinter(BYTE c);
|
extern VOID IrPrinter(BYTE c);
|
||||||
|
|
||||||
// Udp.c
|
// Udp.c
|
||||||
extern TCHAR szUdpServer[1024];
|
extern TCHAR szUdpServer[1024];
|
||||||
extern WORD wUdpPort;
|
extern WORD wUdpPort;
|
||||||
extern VOID ResetUdp(VOID);
|
extern VOID ResetUdp(VOID);
|
||||||
extern BOOL SendByteUdp(BYTE byData);
|
extern BOOL SendByteUdp(BYTE byData);
|
||||||
|
|
||||||
// Stack.c
|
// Stack.c
|
||||||
extern BOOL bDetectClpObject;
|
extern BOOL bDetectClpObject;
|
||||||
extern LRESULT OnStackCopy(VOID);
|
extern BOOL bLocaleDecimalPoint;
|
||||||
extern LRESULT OnStackPaste(VOID);
|
extern LRESULT OnStackCopy(VOID);
|
||||||
|
extern LRESULT OnStackPaste(VOID);
|
||||||
// RPL.c
|
|
||||||
extern BOOL RPL_GetSystemFlag(INT nFlag);
|
// RPL.c
|
||||||
extern DWORD RPL_SkipOb(DWORD d);
|
extern BOOL RPL_GetSystemFlag(INT nFlag);
|
||||||
extern DWORD RPL_ObjectSize(BYTE *o,DWORD s);
|
extern DWORD RPL_SkipOb(DWORD d);
|
||||||
extern DWORD RPL_CreateTemp(DWORD l);
|
extern DWORD RPL_ObjectSize(BYTE *o,DWORD s);
|
||||||
extern UINT RPL_Depth(VOID);
|
extern DWORD RPL_CreateTemp(DWORD l);
|
||||||
extern DWORD RPL_Pick(UINT l);
|
extern UINT RPL_Depth(VOID);
|
||||||
extern VOID RPL_Replace(DWORD n);
|
extern DWORD RPL_Pick(UINT l);
|
||||||
extern VOID RPL_Push(UINT l,DWORD n);
|
extern VOID RPL_Replace(DWORD n);
|
||||||
|
extern VOID RPL_Push(UINT l,DWORD n);
|
||||||
// SndEnum.c
|
|
||||||
extern VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID);
|
// SndEnum.c
|
||||||
|
extern VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID);
|
||||||
// Sound.c
|
|
||||||
extern DWORD dwWaveVol;
|
// Sound.c
|
||||||
extern DWORD dwWaveTime;
|
extern DWORD dwWaveVol;
|
||||||
extern BOOL SoundAvailable(UINT uDeviceID);
|
extern DWORD dwWaveTime;
|
||||||
extern BOOL SoundGetDeviceID(UINT *puDeviceID);
|
extern BOOL SoundAvailable(UINT uDeviceID);
|
||||||
extern BOOL SoundOpen(UINT uDeviceID);
|
extern BOOL SoundGetDeviceID(UINT *puDeviceID);
|
||||||
extern VOID SoundClose(VOID);
|
extern BOOL SoundOpen(UINT uDeviceID);
|
||||||
extern VOID SoundOut(CHIPSET* w, WORD wOut);
|
extern VOID SoundClose(VOID);
|
||||||
extern VOID SoundBeep(DWORD dwFrequency, DWORD dwDuration);
|
extern VOID SoundOut(CHIPSET* w, WORD wOut);
|
||||||
|
extern VOID SoundBeep(DWORD dwFrequency, DWORD dwDuration);
|
||||||
// DDEserv.c
|
|
||||||
extern HDDEDATA CALLBACK DdeCallback(UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD);
|
// DDEserv.c
|
||||||
|
extern HDDEDATA CALLBACK DdeCallback(UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD);
|
||||||
// Dismem.c
|
|
||||||
extern BOOL SetMemRomType(BYTE cCurrentRomType);
|
// Dismem.c
|
||||||
extern BOOL SetMemMapType(enum MEM_MAPPING eType);
|
extern BOOL SetMemRomType(BYTE cCurrentRomType);
|
||||||
extern enum MEM_MAPPING GetMemMapType(VOID);
|
extern BOOL SetMemMapType(enum MEM_MAPPING eType);
|
||||||
extern BOOL GetMemAvail(enum MEM_MAPPING eType);
|
extern enum MEM_MAPPING GetMemMapType(VOID);
|
||||||
extern DWORD GetMemDataSize(VOID);
|
extern BOOL GetMemAvail(enum MEM_MAPPING eType);
|
||||||
extern DWORD GetMemDataMask(VOID);
|
extern DWORD GetMemDataSize(VOID);
|
||||||
extern BYTE GetMemNib(DWORD *p);
|
extern DWORD GetMemDataMask(VOID);
|
||||||
extern VOID GetMemPeek(BYTE *a, DWORD d, UINT s);
|
extern BYTE GetMemNib(DWORD *p);
|
||||||
|
extern VOID GetMemPeek(BYTE *a, DWORD d, UINT s);
|
||||||
// Disasm.c
|
|
||||||
extern BOOL disassembler_mode;
|
// Disasm.c
|
||||||
extern BOOL disassembler_symb;
|
extern BOOL disassembler_mode;
|
||||||
extern DWORD disassemble(DWORD addr, LPTSTR out);
|
extern BOOL disassembler_symb;
|
||||||
|
extern DWORD disassemble(DWORD addr, LPTSTR out);
|
||||||
// Symbfile.c
|
|
||||||
extern BOOL RplTableEmpty(VOID);
|
// Symbfile.c
|
||||||
extern BOOL RplLoadTable(LPCTSTR lpszFilename);
|
extern BOOL RplTableEmpty(VOID);
|
||||||
extern VOID RplDeleteTable(VOID);
|
extern BOOL RplLoadTable(LPCTSTR lpszFilename);
|
||||||
extern LPCTSTR RplGetName(DWORD dwAddr);
|
extern VOID RplDeleteTable(VOID);
|
||||||
extern BOOL RplGetAddr(LPCTSTR lpszName, DWORD *pdwAddr);
|
extern LPCTSTR RplGetName(DWORD dwAddr);
|
||||||
|
extern BOOL RplGetAddr(LPCTSTR lpszName, DWORD *pdwAddr);
|
||||||
// Serial.c
|
|
||||||
extern BOOL CommIsOpen(VOID);
|
// Serial.c
|
||||||
extern BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort);
|
extern BOOL CommIsOpen(VOID);
|
||||||
extern VOID CommClose(VOID);
|
extern BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort);
|
||||||
extern VOID CommSetBaud(VOID);
|
extern VOID CommClose(VOID);
|
||||||
extern BOOL UpdateUSRQ(VOID);
|
extern VOID CommSetBaud(VOID);
|
||||||
extern VOID CommTxBRK(VOID);
|
extern BOOL UpdateUSRQ(VOID);
|
||||||
extern VOID CommTransmit(VOID);
|
extern VOID CommTxBRK(VOID);
|
||||||
extern VOID CommReceive(VOID);
|
extern VOID CommTransmit(VOID);
|
||||||
|
extern VOID CommReceive(VOID);
|
||||||
// Cursor.c
|
|
||||||
extern HCURSOR CreateHandCursor(VOID);
|
// Cursor.c
|
||||||
|
extern HCURSOR CreateHandCursor(VOID);
|
||||||
#if defined _USRDLL // DLL version
|
|
||||||
// Emu48dll.c
|
#if defined _USRDLL // DLL version
|
||||||
extern VOID (CALLBACK *pEmuDocumentNotify)(LPCTSTR lpszFilename);
|
// Emu48dll.c
|
||||||
extern BOOL DLLCreateWnd(LPCTSTR lpszFilename, LPCTSTR lpszPort2Name);
|
extern VOID (CALLBACK *pEmuDocumentNotify)(LPCTSTR lpszFilename);
|
||||||
extern BOOL DLLDestroyWnd(VOID);
|
extern BOOL DLLCreateWnd(LPCTSTR lpszFilename, LPCTSTR lpszPort2Name);
|
||||||
|
extern BOOL DLLDestroyWnd(VOID);
|
||||||
// Symbfile.c
|
|
||||||
#define RplGetName(a) NULL // for linking
|
// Symbfile.c
|
||||||
#endif
|
#define RplGetName(a) NULL // for linking
|
||||||
|
#endif
|
||||||
// Message Boxes
|
|
||||||
static __inline int InfoMessage(LPCTSTR szMessage) {return MessageBox(hWnd, szMessage, szTitle, MB_APPLMODAL|MB_OK|MB_ICONINFORMATION|MB_SETFOREGROUND);}
|
// Message Boxes
|
||||||
static __inline int AbortMessage(LPCTSTR szMessage) {return MessageBox(hWnd, szMessage, szTitle, MB_APPLMODAL|MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);}
|
static __inline int InfoMessage(LPCTSTR szMessage) {return MessageBox(hWnd, szMessage, szTitle, MB_APPLMODAL|MB_OK|MB_ICONINFORMATION|MB_SETFOREGROUND);}
|
||||||
static __inline int YesNoMessage(LPCTSTR szMessage) {return MessageBox(hWnd, szMessage, szTitle, MB_APPLMODAL|MB_YESNO|MB_ICONEXCLAMATION|MB_SETFOREGROUND);}
|
static __inline int AbortMessage(LPCTSTR szMessage) {return MessageBox(hWnd, szMessage, szTitle, MB_APPLMODAL|MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);}
|
||||||
static __inline int YesNoCancelMessage(LPCTSTR szMessage,UINT uStyle) {return MessageBox(hWnd, szMessage, szTitle, MB_APPLMODAL|MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_SETFOREGROUND|uStyle);}
|
static __inline int YesNoMessage(LPCTSTR szMessage) {return MessageBox(hWnd, szMessage, szTitle, MB_APPLMODAL|MB_YESNO|MB_ICONEXCLAMATION|MB_SETFOREGROUND);}
|
||||||
|
static __inline int YesNoCancelMessage(LPCTSTR szMessage,UINT uStyle) {return MessageBox(hWnd, szMessage, szTitle, MB_APPLMODAL|MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_SETFOREGROUND|uStyle);}
|
||||||
// Missing Win32 API calls
|
|
||||||
static __inline LPTSTR DuplicateString(LPCTSTR szString)
|
// Missing Win32 API calls
|
||||||
{
|
static __inline LPTSTR DuplicateString(LPCTSTR szString)
|
||||||
UINT uLength = lstrlen(szString) + 1;
|
{
|
||||||
LPTSTR szDup = (LPTSTR) malloc(uLength*sizeof(szDup[0]));
|
UINT uLength = lstrlen(szString) + 1;
|
||||||
lstrcpy(szDup,szString);
|
LPTSTR szDup = (LPTSTR) malloc(uLength*sizeof(szDup[0]));
|
||||||
return szDup;
|
lstrcpy(szDup,szString);
|
||||||
}
|
return szDup;
|
||||||
|
}
|
|
@ -303,7 +303,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 © 2023 Christoph Gießelink && Sébastien Carlier",
|
LTEXT "Copyright © 2024 Christoph Gießelink && Sébastien Carlier",
|
||||||
IDC_STATIC,29,18,181,8
|
IDC_STATIC,29,18,181,8
|
||||||
DEFPUSHBUTTON "OK",IDOK,215,12,39,14
|
DEFPUSHBUTTON "OK",IDOK,215,12,39,14
|
||||||
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
|
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
|
||||||
|
@ -622,7 +622,11 @@ BEGIN
|
||||||
EDITTEXT IDC_DEBUG_DATA_STARTADDR,101,27,37,14
|
EDITTEXT IDC_DEBUG_DATA_STARTADDR,101,27,37,14
|
||||||
LTEXT "End Address (hexadecimal):",IDC_STATIC,7,46,88,8
|
LTEXT "End Address (hexadecimal):",IDC_STATIC,7,46,88,8
|
||||||
EDITTEXT IDC_DEBUG_DATA_ENDADDR,101,44,37,14
|
EDITTEXT IDC_DEBUG_DATA_ENDADDR,101,44,37,14
|
||||||
PUSHBUTTON "OK",IDOK,207,27,50,14
|
CONTROL "8-bit",IDC_DEBUG_DATA_SAVE_8BIT,"Button",
|
||||||
|
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,158,30,29,10
|
||||||
|
CONTROL "4-bit",IDC_DEBUG_DATA_SAVE_4BIT,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,214,30,29,10
|
||||||
|
PUSHBUTTON "OK",IDOK,151,44,50,14
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,207,44,50,14
|
PUSHBUTTON "Cancel",IDCANCEL,207,44,50,14
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -636,7 +640,13 @@ BEGIN
|
||||||
PUSHBUTTON "Browse",IDC_DEBUG_DATA_BUT,207,7,50,14
|
PUSHBUTTON "Browse",IDC_DEBUG_DATA_BUT,207,7,50,14
|
||||||
LTEXT "Start Address (hexadecimal):",IDC_STATIC,7,30,90,8
|
LTEXT "Start Address (hexadecimal):",IDC_STATIC,7,30,90,8
|
||||||
EDITTEXT IDC_DEBUG_DATA_STARTADDR,101,27,37,14
|
EDITTEXT IDC_DEBUG_DATA_STARTADDR,101,27,37,14
|
||||||
PUSHBUTTON "OK",IDOK,207,27,50,14
|
CONTROL "Auto",IDC_DEBUG_DATA_LOAD_ABIT,"Button",
|
||||||
|
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,155,29,29,10
|
||||||
|
CONTROL "8-bit",IDC_DEBUG_DATA_LOAD_8BIT,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,189,29,29,10
|
||||||
|
CONTROL "4-bit",IDC_DEBUG_DATA_LOAD_4BIT,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,223,29,29,10
|
||||||
|
PUSHBUTTON "OK",IDOK,151,44,50,14
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,207,44,50,14
|
PUSHBUTTON "Cancel",IDCANCEL,207,44,50,14
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -723,8 +733,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,6,6,0
|
FILEVERSION 1,6,7,0
|
||||||
PRODUCTVERSION 1,6,6,0
|
PRODUCTVERSION 1,6,7,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -741,12 +751,12 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
|
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
|
||||||
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
|
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
|
||||||
VALUE "FileVersion", "1, 6, 6, 0\0"
|
VALUE "FileVersion", "1, 6, 7, 0\0"
|
||||||
VALUE "InternalName", "Emu48\0"
|
VALUE "InternalName", "Emu48\0"
|
||||||
VALUE "LegalCopyright", "Copyright © 2023\0"
|
VALUE "LegalCopyright", "Copyright © 2024\0"
|
||||||
VALUE "OriginalFilename", "Emu48.exe\0"
|
VALUE "OriginalFilename", "Emu48.exe\0"
|
||||||
VALUE "ProductName", "Emu48\0"
|
VALUE "ProductName", "Emu48\0"
|
||||||
VALUE "ProductVersion", "1, 6, 6, 0\0"
|
VALUE "ProductVersion", "1, 6, 7, 0\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.32510.428
|
VisualStudioVersion = 17.2.32505.173
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Emu48", "Emu48.vcxproj", "{D259D821-B668-408E-B5DF-F0C7B42E6726}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Emu48", "Emu48.vcxproj", "{D259D821-B668-408E-B5DF-F0C7B42E6726}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,24 +27,24 @@
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
|
778
Sources/Emu48/FETCH.C
Normal file
778
Sources/Emu48/FETCH.C
Normal file
|
@ -0,0 +1,778 @@
|
||||||
|
/*
|
||||||
|
* fetch.c
|
||||||
|
*
|
||||||
|
* This file is part of Emu48
|
||||||
|
*
|
||||||
|
* Copyright (C) 1999 Christoph Gießelink
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "pch.h"
|
||||||
|
#include "Opcodes.h"
|
||||||
|
|
||||||
|
#define F 0xFF // F = function
|
||||||
|
|
||||||
|
typedef const struct
|
||||||
|
{
|
||||||
|
LPCVOID pLnk;
|
||||||
|
const DWORD dwTyp;
|
||||||
|
} JMPTAB, *PJMPTAB;
|
||||||
|
|
||||||
|
// jump tables
|
||||||
|
static JMPTAB oF_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oF0, F },
|
||||||
|
{ (LPCVOID) oF1, F },
|
||||||
|
{ (LPCVOID) oF2, F },
|
||||||
|
{ (LPCVOID) oF3, F },
|
||||||
|
{ (LPCVOID) oF4, F },
|
||||||
|
{ (LPCVOID) oF5, F },
|
||||||
|
{ (LPCVOID) oF6, F },
|
||||||
|
{ (LPCVOID) oF7, F },
|
||||||
|
{ (LPCVOID) oF8, F },
|
||||||
|
{ (LPCVOID) oF9, F },
|
||||||
|
{ (LPCVOID) oFA, F },
|
||||||
|
{ (LPCVOID) oFB, F },
|
||||||
|
{ (LPCVOID) oFC, F },
|
||||||
|
{ (LPCVOID) oFD, F },
|
||||||
|
{ (LPCVOID) oFE, F },
|
||||||
|
{ (LPCVOID) oFF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oE_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oE0, F },
|
||||||
|
{ (LPCVOID) oE1, F },
|
||||||
|
{ (LPCVOID) oE2, F },
|
||||||
|
{ (LPCVOID) oE3, F },
|
||||||
|
{ (LPCVOID) oE4, F },
|
||||||
|
{ (LPCVOID) oE5, F },
|
||||||
|
{ (LPCVOID) oE6, F },
|
||||||
|
{ (LPCVOID) oE7, F },
|
||||||
|
{ (LPCVOID) oE8, F },
|
||||||
|
{ (LPCVOID) oE9, F },
|
||||||
|
{ (LPCVOID) oEA, F },
|
||||||
|
{ (LPCVOID) oEB, F },
|
||||||
|
{ (LPCVOID) oEC, F },
|
||||||
|
{ (LPCVOID) oED, F },
|
||||||
|
{ (LPCVOID) oEE, F },
|
||||||
|
{ (LPCVOID) oEF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oD_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oD0, F },
|
||||||
|
{ (LPCVOID) oD1, F },
|
||||||
|
{ (LPCVOID) oD2, F },
|
||||||
|
{ (LPCVOID) oD3, F },
|
||||||
|
{ (LPCVOID) oD4, F },
|
||||||
|
{ (LPCVOID) oD5, F },
|
||||||
|
{ (LPCVOID) oD6, F },
|
||||||
|
{ (LPCVOID) oD7, F },
|
||||||
|
{ (LPCVOID) oD8, F },
|
||||||
|
{ (LPCVOID) oD9, F },
|
||||||
|
{ (LPCVOID) oDA, F },
|
||||||
|
{ (LPCVOID) oDB, F },
|
||||||
|
{ (LPCVOID) oDC, F },
|
||||||
|
{ (LPCVOID) oDD, F },
|
||||||
|
{ (LPCVOID) oDE, F },
|
||||||
|
{ (LPCVOID) oDF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oC_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oC0, F },
|
||||||
|
{ (LPCVOID) oC1, F },
|
||||||
|
{ (LPCVOID) oC2, F },
|
||||||
|
{ (LPCVOID) oC3, F },
|
||||||
|
{ (LPCVOID) oC4, F },
|
||||||
|
{ (LPCVOID) oC5, F },
|
||||||
|
{ (LPCVOID) oC6, F },
|
||||||
|
{ (LPCVOID) oC7, F },
|
||||||
|
{ (LPCVOID) oC8, F },
|
||||||
|
{ (LPCVOID) oC9, F },
|
||||||
|
{ (LPCVOID) oCA, F },
|
||||||
|
{ (LPCVOID) oCB, F },
|
||||||
|
{ (LPCVOID) oCC, F },
|
||||||
|
{ (LPCVOID) oCD, F },
|
||||||
|
{ (LPCVOID) oCE, F },
|
||||||
|
{ (LPCVOID) oCF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oBb_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oBb0, F },
|
||||||
|
{ (LPCVOID) oBb1, F },
|
||||||
|
{ (LPCVOID) oBb2, F },
|
||||||
|
{ (LPCVOID) oBb3, F },
|
||||||
|
{ (LPCVOID) oBb4, F },
|
||||||
|
{ (LPCVOID) oBb5, F },
|
||||||
|
{ (LPCVOID) oBb6, F },
|
||||||
|
{ (LPCVOID) oBb7, F },
|
||||||
|
{ (LPCVOID) oBb8, F },
|
||||||
|
{ (LPCVOID) oBb9, F },
|
||||||
|
{ (LPCVOID) oBbA, F },
|
||||||
|
{ (LPCVOID) oBbB, F },
|
||||||
|
{ (LPCVOID) oBbC, F },
|
||||||
|
{ (LPCVOID) oBbD, F },
|
||||||
|
{ (LPCVOID) oBbE, F },
|
||||||
|
{ (LPCVOID) oBbF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oBa_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oBa0, F },
|
||||||
|
{ (LPCVOID) oBa1, F },
|
||||||
|
{ (LPCVOID) oBa2, F },
|
||||||
|
{ (LPCVOID) oBa3, F },
|
||||||
|
{ (LPCVOID) oBa4, F },
|
||||||
|
{ (LPCVOID) oBa5, F },
|
||||||
|
{ (LPCVOID) oBa6, F },
|
||||||
|
{ (LPCVOID) oBa7, F },
|
||||||
|
{ (LPCVOID) oBa8, F },
|
||||||
|
{ (LPCVOID) oBa9, F },
|
||||||
|
{ (LPCVOID) oBaA, F },
|
||||||
|
{ (LPCVOID) oBaB, F },
|
||||||
|
{ (LPCVOID) oBaC, F },
|
||||||
|
{ (LPCVOID) oBaD, F },
|
||||||
|
{ (LPCVOID) oBaE, F },
|
||||||
|
{ (LPCVOID) oBaF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oB_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oBa_, 2 },
|
||||||
|
{ (LPCVOID) oBa_, 2 },
|
||||||
|
{ (LPCVOID) oBa_, 2 },
|
||||||
|
{ (LPCVOID) oBa_, 2 },
|
||||||
|
{ (LPCVOID) oBa_, 2 },
|
||||||
|
{ (LPCVOID) oBa_, 2 },
|
||||||
|
{ (LPCVOID) oBa_, 2 },
|
||||||
|
{ (LPCVOID) oBa_, 2 },
|
||||||
|
{ (LPCVOID) oBb_, 2 },
|
||||||
|
{ (LPCVOID) oBb_, 2 },
|
||||||
|
{ (LPCVOID) oBb_, 2 },
|
||||||
|
{ (LPCVOID) oBb_, 2 },
|
||||||
|
{ (LPCVOID) oBb_, 2 },
|
||||||
|
{ (LPCVOID) oBb_, 2 },
|
||||||
|
{ (LPCVOID) oBb_, 2 },
|
||||||
|
{ (LPCVOID) oBb_, 2 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oAb_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oAb0, F },
|
||||||
|
{ (LPCVOID) oAb1, F },
|
||||||
|
{ (LPCVOID) oAb2, F },
|
||||||
|
{ (LPCVOID) oAb3, F },
|
||||||
|
{ (LPCVOID) oAb4, F },
|
||||||
|
{ (LPCVOID) oAb5, F },
|
||||||
|
{ (LPCVOID) oAb6, F },
|
||||||
|
{ (LPCVOID) oAb7, F },
|
||||||
|
{ (LPCVOID) oAb8, F },
|
||||||
|
{ (LPCVOID) oAb9, F },
|
||||||
|
{ (LPCVOID) oAbA, F },
|
||||||
|
{ (LPCVOID) oAbB, F },
|
||||||
|
{ (LPCVOID) oAbC, F },
|
||||||
|
{ (LPCVOID) oAbD, F },
|
||||||
|
{ (LPCVOID) oAbE, F },
|
||||||
|
{ (LPCVOID) oAbF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oAa_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oAa0, F },
|
||||||
|
{ (LPCVOID) oAa1, F },
|
||||||
|
{ (LPCVOID) oAa2, F },
|
||||||
|
{ (LPCVOID) oAa3, F },
|
||||||
|
{ (LPCVOID) oAa4, F },
|
||||||
|
{ (LPCVOID) oAa5, F },
|
||||||
|
{ (LPCVOID) oAa6, F },
|
||||||
|
{ (LPCVOID) oAa7, F },
|
||||||
|
{ (LPCVOID) oAa8, F },
|
||||||
|
{ (LPCVOID) oAa9, F },
|
||||||
|
{ (LPCVOID) oAaA, F },
|
||||||
|
{ (LPCVOID) oAaB, F },
|
||||||
|
{ (LPCVOID) oAaC, F },
|
||||||
|
{ (LPCVOID) oAaD, F },
|
||||||
|
{ (LPCVOID) oAaE, F },
|
||||||
|
{ (LPCVOID) oAaF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB oA_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) oAa_, 2 },
|
||||||
|
{ (LPCVOID) oAa_, 2 },
|
||||||
|
{ (LPCVOID) oAa_, 2 },
|
||||||
|
{ (LPCVOID) oAa_, 2 },
|
||||||
|
{ (LPCVOID) oAa_, 2 },
|
||||||
|
{ (LPCVOID) oAa_, 2 },
|
||||||
|
{ (LPCVOID) oAa_, 2 },
|
||||||
|
{ (LPCVOID) oAa_, 2 },
|
||||||
|
{ (LPCVOID) oAb_, 2 },
|
||||||
|
{ (LPCVOID) oAb_, 2 },
|
||||||
|
{ (LPCVOID) oAb_, 2 },
|
||||||
|
{ (LPCVOID) oAb_, 2 },
|
||||||
|
{ (LPCVOID) oAb_, 2 },
|
||||||
|
{ (LPCVOID) oAb_, 2 },
|
||||||
|
{ (LPCVOID) oAb_, 2 },
|
||||||
|
{ (LPCVOID) oAb_, 2 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o9b_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o9b0, F },
|
||||||
|
{ (LPCVOID) o9b1, F },
|
||||||
|
{ (LPCVOID) o9b2, F },
|
||||||
|
{ (LPCVOID) o9b3, F },
|
||||||
|
{ (LPCVOID) o9b4, F },
|
||||||
|
{ (LPCVOID) o9b5, F },
|
||||||
|
{ (LPCVOID) o9b6, F },
|
||||||
|
{ (LPCVOID) o9b7, F },
|
||||||
|
{ (LPCVOID) o9b8, F },
|
||||||
|
{ (LPCVOID) o9b9, F },
|
||||||
|
{ (LPCVOID) o9bA, F },
|
||||||
|
{ (LPCVOID) o9bB, F },
|
||||||
|
{ (LPCVOID) o9bC, F },
|
||||||
|
{ (LPCVOID) o9bD, F },
|
||||||
|
{ (LPCVOID) o9bE, F },
|
||||||
|
{ (LPCVOID) o9bF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o9a_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o9a0, F },
|
||||||
|
{ (LPCVOID) o9a1, F },
|
||||||
|
{ (LPCVOID) o9a2, F },
|
||||||
|
{ (LPCVOID) o9a3, F },
|
||||||
|
{ (LPCVOID) o9a4, F },
|
||||||
|
{ (LPCVOID) o9a5, F },
|
||||||
|
{ (LPCVOID) o9a6, F },
|
||||||
|
{ (LPCVOID) o9a7, F },
|
||||||
|
{ (LPCVOID) o9a8, F },
|
||||||
|
{ (LPCVOID) o9a9, F },
|
||||||
|
{ (LPCVOID) o9aA, F },
|
||||||
|
{ (LPCVOID) o9aB, F },
|
||||||
|
{ (LPCVOID) o9aC, F },
|
||||||
|
{ (LPCVOID) o9aD, F },
|
||||||
|
{ (LPCVOID) o9aE, F },
|
||||||
|
{ (LPCVOID) o9aF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o9_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o9a_, 2 },
|
||||||
|
{ (LPCVOID) o9a_, 2 },
|
||||||
|
{ (LPCVOID) o9a_, 2 },
|
||||||
|
{ (LPCVOID) o9a_, 2 },
|
||||||
|
{ (LPCVOID) o9a_, 2 },
|
||||||
|
{ (LPCVOID) o9a_, 2 },
|
||||||
|
{ (LPCVOID) o9a_, 2 },
|
||||||
|
{ (LPCVOID) o9a_, 2 },
|
||||||
|
{ (LPCVOID) o9b_, 2 },
|
||||||
|
{ (LPCVOID) o9b_, 2 },
|
||||||
|
{ (LPCVOID) o9b_, 2 },
|
||||||
|
{ (LPCVOID) o9b_, 2 },
|
||||||
|
{ (LPCVOID) o9b_, 2 },
|
||||||
|
{ (LPCVOID) o9b_, 2 },
|
||||||
|
{ (LPCVOID) o9b_, 2 },
|
||||||
|
{ (LPCVOID) o9b_, 2 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o8B_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o8B0, F },
|
||||||
|
{ (LPCVOID) o8B1, F },
|
||||||
|
{ (LPCVOID) o8B2, F },
|
||||||
|
{ (LPCVOID) o8B3, F },
|
||||||
|
{ (LPCVOID) o8B4, F },
|
||||||
|
{ (LPCVOID) o8B5, F },
|
||||||
|
{ (LPCVOID) o8B6, F },
|
||||||
|
{ (LPCVOID) o8B7, F },
|
||||||
|
{ (LPCVOID) o8B8, F },
|
||||||
|
{ (LPCVOID) o8B9, F },
|
||||||
|
{ (LPCVOID) o8BA, F },
|
||||||
|
{ (LPCVOID) o8BB, F },
|
||||||
|
{ (LPCVOID) o8BC, F },
|
||||||
|
{ (LPCVOID) o8BD, F },
|
||||||
|
{ (LPCVOID) o8BE, F },
|
||||||
|
{ (LPCVOID) o8BF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o8A_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o8A0, F },
|
||||||
|
{ (LPCVOID) o8A1, F },
|
||||||
|
{ (LPCVOID) o8A2, F },
|
||||||
|
{ (LPCVOID) o8A3, F },
|
||||||
|
{ (LPCVOID) o8A4, F },
|
||||||
|
{ (LPCVOID) o8A5, F },
|
||||||
|
{ (LPCVOID) o8A6, F },
|
||||||
|
{ (LPCVOID) o8A7, F },
|
||||||
|
{ (LPCVOID) o8A8, F },
|
||||||
|
{ (LPCVOID) o8A9, F },
|
||||||
|
{ (LPCVOID) o8AA, F },
|
||||||
|
{ (LPCVOID) o8AB, F },
|
||||||
|
{ (LPCVOID) o8AC, F },
|
||||||
|
{ (LPCVOID) o8AD, F },
|
||||||
|
{ (LPCVOID) o8AE, F },
|
||||||
|
{ (LPCVOID) o8AF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o81B_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o81B2, F },
|
||||||
|
{ (LPCVOID) o81B3, F },
|
||||||
|
{ (LPCVOID) o81B4, F },
|
||||||
|
{ (LPCVOID) o81B5, F },
|
||||||
|
{ (LPCVOID) o81B6, F },
|
||||||
|
{ (LPCVOID) o81B7, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F },
|
||||||
|
{ (LPCVOID) o_invalid4, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o81Af2_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o81Af20, F },
|
||||||
|
{ (LPCVOID) o81Af21, F },
|
||||||
|
{ (LPCVOID) o81Af22, F },
|
||||||
|
{ (LPCVOID) o81Af23, F },
|
||||||
|
{ (LPCVOID) o81Af24, F },
|
||||||
|
{ (LPCVOID) o81Af21, F },
|
||||||
|
{ (LPCVOID) o81Af22, F },
|
||||||
|
{ (LPCVOID) o81Af23, F },
|
||||||
|
{ (LPCVOID) o81Af28, F },
|
||||||
|
{ (LPCVOID) o81Af29, F },
|
||||||
|
{ (LPCVOID) o81Af2A, F },
|
||||||
|
{ (LPCVOID) o81Af2B, F },
|
||||||
|
{ (LPCVOID) o81Af2C, F },
|
||||||
|
{ (LPCVOID) o81Af29, F },
|
||||||
|
{ (LPCVOID) o81Af2A, F },
|
||||||
|
{ (LPCVOID) o81Af2B, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o81Af1_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o81Af10, F },
|
||||||
|
{ (LPCVOID) o81Af11, F },
|
||||||
|
{ (LPCVOID) o81Af12, F },
|
||||||
|
{ (LPCVOID) o81Af13, F },
|
||||||
|
{ (LPCVOID) o81Af14, F },
|
||||||
|
{ (LPCVOID) o81Af11, F },
|
||||||
|
{ (LPCVOID) o81Af12, F },
|
||||||
|
{ (LPCVOID) o81Af13, F },
|
||||||
|
{ (LPCVOID) o81Af18, F },
|
||||||
|
{ (LPCVOID) o81Af19, F },
|
||||||
|
{ (LPCVOID) o81Af1A, F },
|
||||||
|
{ (LPCVOID) o81Af1B, F },
|
||||||
|
{ (LPCVOID) o81Af1C, F },
|
||||||
|
{ (LPCVOID) o81Af19, F },
|
||||||
|
{ (LPCVOID) o81Af1A, F },
|
||||||
|
{ (LPCVOID) o81Af1B, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o81Af0_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o81Af00, F },
|
||||||
|
{ (LPCVOID) o81Af01, F },
|
||||||
|
{ (LPCVOID) o81Af02, F },
|
||||||
|
{ (LPCVOID) o81Af03, F },
|
||||||
|
{ (LPCVOID) o81Af04, F },
|
||||||
|
{ (LPCVOID) o81Af01, F },
|
||||||
|
{ (LPCVOID) o81Af02, F },
|
||||||
|
{ (LPCVOID) o81Af03, F },
|
||||||
|
{ (LPCVOID) o81Af08, F },
|
||||||
|
{ (LPCVOID) o81Af09, F },
|
||||||
|
{ (LPCVOID) o81Af0A, F },
|
||||||
|
{ (LPCVOID) o81Af0B, F },
|
||||||
|
{ (LPCVOID) o81Af0C, F },
|
||||||
|
{ (LPCVOID) o81Af09, F },
|
||||||
|
{ (LPCVOID) o81Af0A, F },
|
||||||
|
{ (LPCVOID) o81Af0B, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o81A_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o81Af0_, 5 },
|
||||||
|
{ (LPCVOID) o81Af1_, 5 },
|
||||||
|
{ (LPCVOID) o81Af2_, 5 },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o819_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o819f0, F },
|
||||||
|
{ (LPCVOID) o819f1, F },
|
||||||
|
{ (LPCVOID) o819f2, F },
|
||||||
|
{ (LPCVOID) o819f3, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o818_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o818f0x, F },
|
||||||
|
{ (LPCVOID) o818f1x, F },
|
||||||
|
{ (LPCVOID) o818f2x, F },
|
||||||
|
{ (LPCVOID) o818f3x, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o818f8x, F },
|
||||||
|
{ (LPCVOID) o818f9x, F },
|
||||||
|
{ (LPCVOID) o818fAx, F },
|
||||||
|
{ (LPCVOID) o818fBx, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F },
|
||||||
|
{ (LPCVOID) o_invalid6, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o81_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o810, F },
|
||||||
|
{ (LPCVOID) o811, F },
|
||||||
|
{ (LPCVOID) o812, F },
|
||||||
|
{ (LPCVOID) o813, F },
|
||||||
|
{ (LPCVOID) o814, F },
|
||||||
|
{ (LPCVOID) o815, F },
|
||||||
|
{ (LPCVOID) o816, F },
|
||||||
|
{ (LPCVOID) o817, F },
|
||||||
|
{ (LPCVOID) o818_, 4 },
|
||||||
|
{ (LPCVOID) o819_, 4 },
|
||||||
|
{ (LPCVOID) o81A_, 4 },
|
||||||
|
{ (LPCVOID) o81B_, 3 },
|
||||||
|
{ (LPCVOID) o81C, F },
|
||||||
|
{ (LPCVOID) o81D, F },
|
||||||
|
{ (LPCVOID) o81E, F },
|
||||||
|
{ (LPCVOID) o81F, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o8081_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o80810, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F },
|
||||||
|
{ (LPCVOID) o_invalid5, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o808_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o8080, F },
|
||||||
|
{ (LPCVOID) o8081_, 4 },
|
||||||
|
{ (LPCVOID) o8082X, F },
|
||||||
|
{ (LPCVOID) o8083, F },
|
||||||
|
{ (LPCVOID) o8084n, F },
|
||||||
|
{ (LPCVOID) o8085n, F },
|
||||||
|
{ (LPCVOID) o8086n, F },
|
||||||
|
{ (LPCVOID) o8087n, F },
|
||||||
|
{ (LPCVOID) o8088n, F },
|
||||||
|
{ (LPCVOID) o8089n, F },
|
||||||
|
{ (LPCVOID) o808An, F },
|
||||||
|
{ (LPCVOID) o808Bn, F },
|
||||||
|
{ (LPCVOID) o808C, F },
|
||||||
|
{ (LPCVOID) o808D, F },
|
||||||
|
{ (LPCVOID) o808E, F },
|
||||||
|
{ (LPCVOID) o808F, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o80_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o800, F },
|
||||||
|
{ (LPCVOID) o801, F },
|
||||||
|
{ (LPCVOID) o802, F },
|
||||||
|
{ (LPCVOID) o803, F },
|
||||||
|
{ (LPCVOID) o804, F },
|
||||||
|
{ (LPCVOID) o805, F },
|
||||||
|
{ (LPCVOID) o806, F },
|
||||||
|
{ (LPCVOID) o807, F },
|
||||||
|
{ (LPCVOID) o808_, 3 },
|
||||||
|
{ (LPCVOID) o809, F },
|
||||||
|
{ (LPCVOID) o80A, F },
|
||||||
|
{ (LPCVOID) o80B, F },
|
||||||
|
{ (LPCVOID) o80Cn, F },
|
||||||
|
{ (LPCVOID) o80Dn, F },
|
||||||
|
{ (LPCVOID) o80E, F },
|
||||||
|
{ (LPCVOID) o80Fn, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o8_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o80_, 2 },
|
||||||
|
{ (LPCVOID) o81_, 2 },
|
||||||
|
{ (LPCVOID) o82n, F },
|
||||||
|
{ (LPCVOID) o83n, F },
|
||||||
|
{ (LPCVOID) o84n, F },
|
||||||
|
{ (LPCVOID) o85n, F },
|
||||||
|
{ (LPCVOID) o86n, F },
|
||||||
|
{ (LPCVOID) o87n, F },
|
||||||
|
{ (LPCVOID) o88n, F },
|
||||||
|
{ (LPCVOID) o89n, F },
|
||||||
|
{ (LPCVOID) o8A_, 2 },
|
||||||
|
{ (LPCVOID) o8B_, 2 },
|
||||||
|
{ (LPCVOID) o8Cd4, F },
|
||||||
|
{ (LPCVOID) o8Dd5, F },
|
||||||
|
{ (LPCVOID) o8Ed4, F },
|
||||||
|
{ (LPCVOID) o8Fd5, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o15_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o150a, F },
|
||||||
|
{ (LPCVOID) o151a, F },
|
||||||
|
{ (LPCVOID) o152a, F },
|
||||||
|
{ (LPCVOID) o153a, F },
|
||||||
|
{ (LPCVOID) o154a, F },
|
||||||
|
{ (LPCVOID) o155a, F },
|
||||||
|
{ (LPCVOID) o156a, F },
|
||||||
|
{ (LPCVOID) o157a, F },
|
||||||
|
{ (LPCVOID) o158x, F },
|
||||||
|
{ (LPCVOID) o159x, F },
|
||||||
|
{ (LPCVOID) o15Ax, F },
|
||||||
|
{ (LPCVOID) o15Bx, F },
|
||||||
|
{ (LPCVOID) o15Cx, F },
|
||||||
|
{ (LPCVOID) o15Dx, F },
|
||||||
|
{ (LPCVOID) o15Ex, F },
|
||||||
|
{ (LPCVOID) o15Fx, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o14_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o140, F },
|
||||||
|
{ (LPCVOID) o141, F },
|
||||||
|
{ (LPCVOID) o142, F },
|
||||||
|
{ (LPCVOID) o143, F },
|
||||||
|
{ (LPCVOID) o144, F },
|
||||||
|
{ (LPCVOID) o145, F },
|
||||||
|
{ (LPCVOID) o146, F },
|
||||||
|
{ (LPCVOID) o147, F },
|
||||||
|
{ (LPCVOID) o148, F },
|
||||||
|
{ (LPCVOID) o149, F },
|
||||||
|
{ (LPCVOID) o14A, F },
|
||||||
|
{ (LPCVOID) o14B, F },
|
||||||
|
{ (LPCVOID) o14C, F },
|
||||||
|
{ (LPCVOID) o14D, F },
|
||||||
|
{ (LPCVOID) o14E, F },
|
||||||
|
{ (LPCVOID) o14F, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o13_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o130, F },
|
||||||
|
{ (LPCVOID) o131, F },
|
||||||
|
{ (LPCVOID) o132, F },
|
||||||
|
{ (LPCVOID) o133, F },
|
||||||
|
{ (LPCVOID) o134, F },
|
||||||
|
{ (LPCVOID) o135, F },
|
||||||
|
{ (LPCVOID) o136, F },
|
||||||
|
{ (LPCVOID) o137, F },
|
||||||
|
{ (LPCVOID) o138, F },
|
||||||
|
{ (LPCVOID) o139, F },
|
||||||
|
{ (LPCVOID) o13A, F },
|
||||||
|
{ (LPCVOID) o13B, F },
|
||||||
|
{ (LPCVOID) o13C, F },
|
||||||
|
{ (LPCVOID) o13D, F },
|
||||||
|
{ (LPCVOID) o13E, F },
|
||||||
|
{ (LPCVOID) o13F, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o12_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o120, F },
|
||||||
|
{ (LPCVOID) o121, F },
|
||||||
|
{ (LPCVOID) o122, F },
|
||||||
|
{ (LPCVOID) o123, F },
|
||||||
|
{ (LPCVOID) o124, F },
|
||||||
|
{ (LPCVOID) o121, F },
|
||||||
|
{ (LPCVOID) o122, F },
|
||||||
|
{ (LPCVOID) o123, F },
|
||||||
|
{ (LPCVOID) o128, F },
|
||||||
|
{ (LPCVOID) o129, F },
|
||||||
|
{ (LPCVOID) o12A, F },
|
||||||
|
{ (LPCVOID) o12B, F },
|
||||||
|
{ (LPCVOID) o12C, F },
|
||||||
|
{ (LPCVOID) o129, F },
|
||||||
|
{ (LPCVOID) o12A, F },
|
||||||
|
{ (LPCVOID) o12B, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o11_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o110, F },
|
||||||
|
{ (LPCVOID) o111, F },
|
||||||
|
{ (LPCVOID) o112, F },
|
||||||
|
{ (LPCVOID) o113, F },
|
||||||
|
{ (LPCVOID) o114, F },
|
||||||
|
{ (LPCVOID) o111, F },
|
||||||
|
{ (LPCVOID) o112, F },
|
||||||
|
{ (LPCVOID) o113, F },
|
||||||
|
{ (LPCVOID) o118, F },
|
||||||
|
{ (LPCVOID) o119, F },
|
||||||
|
{ (LPCVOID) o11A, F },
|
||||||
|
{ (LPCVOID) o11B, F },
|
||||||
|
{ (LPCVOID) o11C, F },
|
||||||
|
{ (LPCVOID) o119, F },
|
||||||
|
{ (LPCVOID) o11A, F },
|
||||||
|
{ (LPCVOID) o11B, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o10_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o100, F },
|
||||||
|
{ (LPCVOID) o101, F },
|
||||||
|
{ (LPCVOID) o102, F },
|
||||||
|
{ (LPCVOID) o103, F },
|
||||||
|
{ (LPCVOID) o104, F },
|
||||||
|
{ (LPCVOID) o101, F },
|
||||||
|
{ (LPCVOID) o102, F },
|
||||||
|
{ (LPCVOID) o103, F },
|
||||||
|
{ (LPCVOID) o108, F },
|
||||||
|
{ (LPCVOID) o109, F },
|
||||||
|
{ (LPCVOID) o10A, F },
|
||||||
|
{ (LPCVOID) o10B, F },
|
||||||
|
{ (LPCVOID) o10C, F },
|
||||||
|
{ (LPCVOID) o109, F },
|
||||||
|
{ (LPCVOID) o10A, F },
|
||||||
|
{ (LPCVOID) o10B, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o1_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o10_, 2 },
|
||||||
|
{ (LPCVOID) o11_, 2 },
|
||||||
|
{ (LPCVOID) o12_, 2 },
|
||||||
|
{ (LPCVOID) o13_, 2 },
|
||||||
|
{ (LPCVOID) o14_, 2 },
|
||||||
|
{ (LPCVOID) o15_, 2 },
|
||||||
|
{ (LPCVOID) o16x, F },
|
||||||
|
{ (LPCVOID) o17x, F },
|
||||||
|
{ (LPCVOID) o18x, F },
|
||||||
|
{ (LPCVOID) o19d2, F },
|
||||||
|
{ (LPCVOID) o1Ad4, F },
|
||||||
|
{ (LPCVOID) o1Bd5, F },
|
||||||
|
{ (LPCVOID) o1Cx, F },
|
||||||
|
{ (LPCVOID) o1Dd2, F },
|
||||||
|
{ (LPCVOID) o1Ed4, F },
|
||||||
|
{ (LPCVOID) o1Fd5, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o0E_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o0Ef0, F },
|
||||||
|
{ (LPCVOID) o0Ef1, F },
|
||||||
|
{ (LPCVOID) o0Ef2, F },
|
||||||
|
{ (LPCVOID) o0Ef3, F },
|
||||||
|
{ (LPCVOID) o0Ef4, F },
|
||||||
|
{ (LPCVOID) o0Ef5, F },
|
||||||
|
{ (LPCVOID) o0Ef6, F },
|
||||||
|
{ (LPCVOID) o0Ef7, F },
|
||||||
|
{ (LPCVOID) o0Ef8, F },
|
||||||
|
{ (LPCVOID) o0Ef9, F },
|
||||||
|
{ (LPCVOID) o0EfA, F },
|
||||||
|
{ (LPCVOID) o0EfB, F },
|
||||||
|
{ (LPCVOID) o0EfC, F },
|
||||||
|
{ (LPCVOID) o0EfD, F },
|
||||||
|
{ (LPCVOID) o0EfE, F },
|
||||||
|
{ (LPCVOID) o0EfF, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o0_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o00, F },
|
||||||
|
{ (LPCVOID) o01, F },
|
||||||
|
{ (LPCVOID) o02, F },
|
||||||
|
{ (LPCVOID) o03, F },
|
||||||
|
{ (LPCVOID) o04, F },
|
||||||
|
{ (LPCVOID) o05, F },
|
||||||
|
{ (LPCVOID) o06, F },
|
||||||
|
{ (LPCVOID) o07, F },
|
||||||
|
{ (LPCVOID) o08, F },
|
||||||
|
{ (LPCVOID) o09, F },
|
||||||
|
{ (LPCVOID) o0A, F },
|
||||||
|
{ (LPCVOID) o0B, F },
|
||||||
|
{ (LPCVOID) o0C, F },
|
||||||
|
{ (LPCVOID) o0D, F },
|
||||||
|
{ (LPCVOID) o0E_, 3 },
|
||||||
|
{ (LPCVOID) o0F, F }
|
||||||
|
};
|
||||||
|
|
||||||
|
static JMPTAB o_[] =
|
||||||
|
{
|
||||||
|
{ (LPCVOID) o0_, 1 },
|
||||||
|
{ (LPCVOID) o1_, 1 },
|
||||||
|
{ (LPCVOID) o2n, F },
|
||||||
|
{ (LPCVOID) o3X, F },
|
||||||
|
{ (LPCVOID) o4d2, F },
|
||||||
|
{ (LPCVOID) o5d2, F },
|
||||||
|
{ (LPCVOID) o6d3, F },
|
||||||
|
{ (LPCVOID) o7d3, F },
|
||||||
|
{ (LPCVOID) o8_, 1 },
|
||||||
|
{ (LPCVOID) o9_, 1 },
|
||||||
|
{ (LPCVOID) oA_, 1 },
|
||||||
|
{ (LPCVOID) oB_, 1 },
|
||||||
|
{ (LPCVOID) oC_, 1 },
|
||||||
|
{ (LPCVOID) oD_, 1 },
|
||||||
|
{ (LPCVOID) oE_, 1 },
|
||||||
|
{ (LPCVOID) oF_, 1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
// opcode dispatcher
|
||||||
|
VOID EvalOpcode(LPBYTE I)
|
||||||
|
{
|
||||||
|
DWORD dwIndex = 0;
|
||||||
|
PJMPTAB pJmpTab = o_;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
_ASSERT(I[dwIndex] <= 0xf); // found packed data
|
||||||
|
pJmpTab = &pJmpTab[I[dwIndex]]; // table entry by opcode
|
||||||
|
dwIndex = pJmpTab->dwTyp; // next pointer type
|
||||||
|
pJmpTab = (PJMPTAB) pJmpTab->pLnk; // next pointer to table/function
|
||||||
|
}
|
||||||
|
while (dwIndex != F); // reference to table? -> again
|
||||||
|
|
||||||
|
((VOID (*)(LPBYTE)) pJmpTab)(I); // call function
|
||||||
|
return;
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,40 +1,40 @@
|
||||||
/*
|
/*
|
||||||
* i28f160.h
|
* i28f160.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 Christoph Gießelink
|
* Copyright (C) 2000 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WSMVER 0 // version of flash implementation structure
|
#define WSMVER 0 // version of flash implementation structure
|
||||||
|
|
||||||
#define WSMSET WSMset_t
|
#define WSMSET WSMset_t
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
BYTE byType[4]; // "WSM"
|
BYTE byType[4]; // "WSM"
|
||||||
UINT uSize; // size of this structure
|
UINT uSize; // size of this structure
|
||||||
BYTE byVersion; // WSM version
|
BYTE byVersion; // WSM version
|
||||||
|
|
||||||
BOOL bRomArray; // copy of bFlashRomArray
|
BOOL bRomArray; // copy of bFlashRomArray
|
||||||
DWORD dwLockCnfg; // block lock table (32 entries)
|
DWORD dwLockCnfg; // block lock table (32 entries)
|
||||||
UINT uWrState; // state of write function WSM
|
UINT uWrState; // state of write function WSM
|
||||||
UINT uRdState; // state of read function WSM
|
UINT uRdState; // state of read function WSM
|
||||||
BYTE byStatusReg; // status register
|
BYTE byStatusReg; // status register
|
||||||
BYTE byExStatusReg; // extended status register
|
BYTE byExStatusReg; // extended status register
|
||||||
BYTE byWrite1No; // no. of written data in write buffer1
|
BYTE byWrite1No; // no. of written data in write buffer1
|
||||||
BYTE byWrite1Size; // no. of valid data in write buffer1
|
BYTE byWrite1Size; // no. of valid data in write buffer1
|
||||||
DWORD dwWrite1Addr; // destination address of buffer1
|
DWORD dwWrite1Addr; // destination address of buffer1
|
||||||
BYTE pbyWrite1[32]; // write buffer1
|
BYTE pbyWrite1[32]; // write buffer1
|
||||||
// BYTE byWrite2No; // no. of written data in write buffer2
|
// BYTE byWrite2No; // no. of written data in write buffer2
|
||||||
// BYTE byWrite2Size; // no. of valid data in write buffer2
|
// BYTE byWrite2Size; // no. of valid data in write buffer2
|
||||||
// DWORD dwWrite2Addr; // destination address of buffer2
|
// DWORD dwWrite2Addr; // destination address of buffer2
|
||||||
// BYTE pbyWrite2[32]; // write buffer2
|
// BYTE pbyWrite2[32]; // write buffer2
|
||||||
} WSMset_t;
|
} WSMset_t;
|
||||||
|
|
||||||
// i28f160.h
|
// i28f160.h
|
||||||
extern WSMSET WSMset;
|
extern WSMSET WSMset;
|
||||||
extern BOOL bWP;
|
extern BOOL bWP;
|
||||||
extern VOID FlashInit(VOID);
|
extern VOID FlashInit(VOID);
|
||||||
extern VOID FlashRead(BYTE *a, DWORD d, UINT s);
|
extern VOID FlashRead(BYTE *a, DWORD d, UINT s);
|
||||||
extern VOID FlashWrite(BYTE *a, DWORD d, UINT s);
|
extern VOID FlashWrite(BYTE *a, DWORD d, UINT s);
|
|
@ -1,154 +1,154 @@
|
||||||
/*
|
/*
|
||||||
* io.h
|
* io.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Christoph Gießelink
|
* Copyright (C) 1999 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// I/O addresses without mapping offset
|
// I/O addresses without mapping offset
|
||||||
#define BITOFFSET 0x00 // Display bit offset and DON
|
#define BITOFFSET 0x00 // Display bit offset and DON
|
||||||
#define CRC 0x04 // Crc (16 bit, LSB first)
|
#define CRC 0x04 // Crc (16 bit, LSB first)
|
||||||
#define LPD 0x08 // Low Power Detection
|
#define LPD 0x08 // Low Power Detection
|
||||||
#define LPE 0x09 // Low Power detection Enable
|
#define LPE 0x09 // Low Power detection Enable
|
||||||
#define ANNCTRL 0x0b // Annunciator Control (2 nibble)
|
#define ANNCTRL 0x0b // Annunciator Control (2 nibble)
|
||||||
#define BAUD 0x0d // Baudrate (Bit 2-0)
|
#define BAUD 0x0d // Baudrate (Bit 2-0)
|
||||||
#define CARDCTL 0x0e // card control
|
#define CARDCTL 0x0e // card control
|
||||||
#define CARDSTAT 0x0f // card status
|
#define CARDSTAT 0x0f // card status
|
||||||
#define IOC 0x10 // IO CONTROL
|
#define IOC 0x10 // IO CONTROL
|
||||||
#define RCS 0x11 // RCS
|
#define RCS 0x11 // RCS
|
||||||
#define TCS 0x12 // TCS
|
#define TCS 0x12 // TCS
|
||||||
#define CRER 0x13 // CRER
|
#define CRER 0x13 // CRER
|
||||||
#define RBR_LSB 0x14 // RBR low nibble
|
#define RBR_LSB 0x14 // RBR low nibble
|
||||||
#define RBR_MSB 0x15 // RBR high nibble
|
#define RBR_MSB 0x15 // RBR high nibble
|
||||||
#define TBR_LSB 0x16 // TBR low nibble
|
#define TBR_LSB 0x16 // TBR low nibble
|
||||||
#define TBR_MSB 0x17 // TBR high nibble
|
#define TBR_MSB 0x17 // TBR high nibble
|
||||||
#define SRQ1 0x18 // SRQ1
|
#define SRQ1 0x18 // SRQ1
|
||||||
#define SRQ2 0x19 // SRQ2
|
#define SRQ2 0x19 // SRQ2
|
||||||
#define IR_CTRL 0x1a // IR CONTROL
|
#define IR_CTRL 0x1a // IR CONTROL
|
||||||
#define LCR 0x1c // Led Control Register
|
#define LCR 0x1c // Led Control Register
|
||||||
#define LBR 0x1d // Led Buffer Register
|
#define LBR 0x1d // Led Buffer Register
|
||||||
#define DISP1CTL 0x20 // Display Start Address
|
#define DISP1CTL 0x20 // Display Start Address
|
||||||
#define LINENIBS 0x25 // Display Line Offset
|
#define LINENIBS 0x25 // Display Line Offset
|
||||||
#define LINECOUNT 0x28 // Display Line Counter
|
#define LINECOUNT 0x28 // Display Line Counter
|
||||||
#define TIMER1_CTRL 0x2e // Timer1 Control
|
#define TIMER1_CTRL 0x2e // Timer1 Control
|
||||||
#define TIMER2_CTRL 0x2f // Timer2 Control
|
#define TIMER2_CTRL 0x2f // Timer2 Control
|
||||||
#define DISP2CTL 0x30 // Display Secondary Start Address
|
#define DISP2CTL 0x30 // Display Secondary Start Address
|
||||||
#define TIMER1 0x37 // Timer1 (4 bit)
|
#define TIMER1 0x37 // Timer1 (4 bit)
|
||||||
#define TIMER2 0x38 // Timer2 (32 bit, LSB first)
|
#define TIMER2 0x38 // Timer2 (32 bit, LSB first)
|
||||||
|
|
||||||
// 0x00 Display bit offset and DON [DON OFF2 OFF1 OFF0]
|
// 0x00 Display bit offset and DON [DON OFF2 OFF1 OFF0]
|
||||||
#define DON 0x08 // Display On
|
#define DON 0x08 // Display On
|
||||||
#define OFF2 0x04 // Display OFFset Bit2
|
#define OFF2 0x04 // Display OFFset Bit2
|
||||||
#define OFF1 0x02 // Display OFFset Bit1
|
#define OFF1 0x02 // Display OFFset Bit1
|
||||||
#define OFF0 0x01 // Display OFFset Bit0
|
#define OFF0 0x01 // Display OFFset Bit0
|
||||||
|
|
||||||
// 0x08 Low Power Detection [LB2 LB1 LB0 VLBI]
|
// 0x08 Low Power Detection [LB2 LB1 LB0 VLBI]
|
||||||
#define LB2 0x08 // Low Battery indicator memory port 2
|
#define LB2 0x08 // Low Battery indicator memory port 2
|
||||||
#define LB1 0x04 // Low Battery indicator memory port 1
|
#define LB1 0x04 // Low Battery indicator memory port 1
|
||||||
#define LB0 0x02 // Low Battery indicator system battery
|
#define LB0 0x02 // Low Battery indicator system battery
|
||||||
#define VLBI 0x01 // Very Low Battery Indicator
|
#define VLBI 0x01 // Very Low Battery Indicator
|
||||||
|
|
||||||
// 0x09 Low Power detection Enable [ELBI EVLBI GRAM RST]
|
// 0x09 Low Power detection Enable [ELBI EVLBI GRAM RST]
|
||||||
#define ELBI 0x08 // Enable Low Battery Indicator
|
#define ELBI 0x08 // Enable Low Battery Indicator
|
||||||
#define EVLBI 0x04 // Enable Very Low Battery Indicator
|
#define EVLBI 0x04 // Enable Very Low Battery Indicator
|
||||||
#define GRAM 0x02 // Glitch sensitive RAM
|
#define GRAM 0x02 // Glitch sensitive RAM
|
||||||
#define RST 0x01 // ReSeT
|
#define RST 0x01 // ReSeT
|
||||||
|
|
||||||
// 0x0b Annunciator Control [AON XTRA LA6 LA5] [LA4 LA3 LA2 LA1]
|
// 0x0b Annunciator Control [AON XTRA LA6 LA5] [LA4 LA3 LA2 LA1]
|
||||||
#define AON 0x80 // Annunciators on
|
#define AON 0x80 // Annunciators on
|
||||||
#define LXTRA 0x40 // does nothing
|
#define LXTRA 0x40 // does nothing
|
||||||
#define LA6 0x20 // LA6 - Transmitting
|
#define LA6 0x20 // LA6 - Transmitting
|
||||||
#define LA5 0x10 // LA5 - Busy
|
#define LA5 0x10 // LA5 - Busy
|
||||||
#define LA4 0x08 // LA4 - Alert
|
#define LA4 0x08 // LA4 - Alert
|
||||||
#define LA3 0x04 // LA3 - Alpha
|
#define LA3 0x04 // LA3 - Alpha
|
||||||
#define LA2 0x02 // LA2 - ALT Shift
|
#define LA2 0x02 // LA2 - ALT Shift
|
||||||
#define LA1 0x01 // LA1 - Shift
|
#define LA1 0x01 // LA1 - Shift
|
||||||
|
|
||||||
// 0x0d SERIAL Baud Rate [UCK BD2 BD1 BD0]
|
// 0x0d SERIAL Baud Rate [UCK BD2 BD1 BD0]
|
||||||
#define UCK 0x08 // Uart ClocK
|
#define UCK 0x08 // Uart ClocK
|
||||||
#define BD2 0x04 // BauDrate Bit2
|
#define BD2 0x04 // BauDrate Bit2
|
||||||
#define BD1 0x02 // BauDrate Bit1
|
#define BD1 0x02 // BauDrate Bit1
|
||||||
#define BD0 0x01 // BauDrate Bit0
|
#define BD0 0x01 // BauDrate Bit0
|
||||||
|
|
||||||
// 0x0e Card Control [ECDT RCDT SMP SWINT]
|
// 0x0e Card Control [ECDT RCDT SMP SWINT]
|
||||||
#define ECDT 0x08 // Enable Card Detect
|
#define ECDT 0x08 // Enable Card Detect
|
||||||
#define RCDT 0x04 // Run Card Detect
|
#define RCDT 0x04 // Run Card Detect
|
||||||
#define SMP 0x02 // Set module pulled
|
#define SMP 0x02 // Set module pulled
|
||||||
#define SWINT 0x01 // Software Interrupt
|
#define SWINT 0x01 // Software Interrupt
|
||||||
|
|
||||||
// 0x0f Card Status [P2W P1W P2C P1C]
|
// 0x0f Card Status [P2W P1W P2C P1C]
|
||||||
#define P2W 0x08 // High when Port2 writeable
|
#define P2W 0x08 // High when Port2 writeable
|
||||||
#define P1W 0x04 // High when Port1 writeable
|
#define P1W 0x04 // High when Port1 writeable
|
||||||
#define P2C 0x02 // High when Card in Port2 inserted
|
#define P2C 0x02 // High when Card in Port2 inserted
|
||||||
#define P1C 0x01 // High when Card in Port1 inserted
|
#define P1C 0x01 // High when Card in Port1 inserted
|
||||||
|
|
||||||
// 0x10 Serial I/O Control [SON ETBE ERBF ERBZ]
|
// 0x10 Serial I/O Control [SON ETBE ERBF ERBZ]
|
||||||
#define SON 0x08 // Serial on
|
#define SON 0x08 // Serial on
|
||||||
#define ETBE 0x04 // Interrupt on transmit buffer empty
|
#define ETBE 0x04 // Interrupt on transmit buffer empty
|
||||||
#define ERBF 0x02 // Interrupt on receive buffer full
|
#define ERBF 0x02 // Interrupt on receive buffer full
|
||||||
#define ERBZ 0x01 // Interrupt on receiver busy
|
#define ERBZ 0x01 // Interrupt on receiver busy
|
||||||
|
|
||||||
// 0x11 Serial Receive Control/Status [RX RER RBZ RBF]
|
// 0x11 Serial Receive Control/Status [RX RER RBZ RBF]
|
||||||
#define RX 0x08 // Rx pin state (read-only)
|
#define RX 0x08 // Rx pin state (read-only)
|
||||||
#define RER 0x04 // Receiver error
|
#define RER 0x04 // Receiver error
|
||||||
#define RBZ 0x02 // Receiver busy
|
#define RBZ 0x02 // Receiver busy
|
||||||
#define RBF 0x01 // Receive buffer full
|
#define RBF 0x01 // Receive buffer full
|
||||||
|
|
||||||
// 0x12 Serial Transmit Control/Status [BRK LPB TBZ TBF]
|
// 0x12 Serial Transmit Control/Status [BRK LPB TBZ TBF]
|
||||||
#define BRK 0x08 // Break
|
#define BRK 0x08 // Break
|
||||||
#define LPB 0x04 // Loopback
|
#define LPB 0x04 // Loopback
|
||||||
#define TBZ 0x02 // Transmitter busy
|
#define TBZ 0x02 // Transmitter busy
|
||||||
#define TBF 0x01 // Transmit buffer full
|
#define TBF 0x01 // Transmit buffer full
|
||||||
|
|
||||||
// 0x18 Service Request Register 1 [ISRQ TSRQ USRQ VSRQ]
|
// 0x18 Service Request Register 1 [ISRQ TSRQ USRQ VSRQ]
|
||||||
#define ISRQ 0x08 // IR receiver pulls NINT2
|
#define ISRQ 0x08 // IR receiver pulls NINT2
|
||||||
#define TSRQ 0x04 // Timer pulls NINT2
|
#define TSRQ 0x04 // Timer pulls NINT2
|
||||||
#define USRQ 0x02 // UART pulls NINT2
|
#define USRQ 0x02 // UART pulls NINT2
|
||||||
#define VSRQ 0x01 // VLBI pulls NINT2
|
#define VSRQ 0x01 // VLBI pulls NINT2
|
||||||
|
|
||||||
// 0x19 Service Request Register 2 [KDN NINT2 NINT LSRQ]
|
// 0x19 Service Request Register 2 [KDN NINT2 NINT LSRQ]
|
||||||
#define KDN 0x08 // Bit set when ON Key or Key Interrupt
|
#define KDN 0x08 // Bit set when ON Key or Key Interrupt
|
||||||
#define NINT2 0x04 // State of NINT2
|
#define NINT2 0x04 // State of NINT2
|
||||||
#define NINT 0x02 // State of NINT
|
#define NINT 0x02 // State of NINT
|
||||||
#define LSRQ 0x01 // LED driver pulls NINT2
|
#define LSRQ 0x01 // LED driver pulls NINT2
|
||||||
|
|
||||||
// 0x1a IR Control Register [IRI EIRU EIRI IRE]
|
// 0x1a IR Control Register [IRI EIRU EIRI IRE]
|
||||||
#define IRI 0x08 // IR input (read-only)
|
#define IRI 0x08 // IR input (read-only)
|
||||||
#define EIRU 0x04 // Enable IR UART mode
|
#define EIRU 0x04 // Enable IR UART mode
|
||||||
#define EIRI 0x02 // Enable IR interrupt
|
#define EIRI 0x02 // Enable IR interrupt
|
||||||
#define IRE 0x01 // IR event
|
#define IRE 0x01 // IR event
|
||||||
|
|
||||||
// 0x1c Led Control Register [LED ELBE LBZ LBF]
|
// 0x1c Led Control Register [LED ELBE LBZ LBF]
|
||||||
#define LED 0x08 // Turn on LED
|
#define LED 0x08 // Turn on LED
|
||||||
#define ELBE 0x04 // Enable Interrupt on Led Buffer empty
|
#define ELBE 0x04 // Enable Interrupt on Led Buffer empty
|
||||||
#define LBZ 0x02 // Led Port Busy
|
#define LBZ 0x02 // Led Port Busy
|
||||||
#define LBF 0x01 // Led Buffer Full
|
#define LBF 0x01 // Led Buffer Full
|
||||||
|
|
||||||
// 0x1d Led Buffer Register [0 0 0 LBO] (bits 1-3 read zero)
|
// 0x1d Led Buffer Register [0 0 0 LBO] (bits 1-3 read zero)
|
||||||
#define LBO 0x01
|
#define LBO 0x01
|
||||||
|
|
||||||
// 0x28 Display Line Counter LSB [LC3 LC2 LC1 LC0]
|
// 0x28 Display Line Counter LSB [LC3 LC2 LC1 LC0]
|
||||||
#define LC3 0x08 // LC3 - Line Counter Bit3
|
#define LC3 0x08 // LC3 - Line Counter Bit3
|
||||||
#define LC2 0x04 // LC2 - Line Counter Bit2
|
#define LC2 0x04 // LC2 - Line Counter Bit2
|
||||||
#define LC1 0x02 // LC1 - Line Counter Bit1
|
#define LC1 0x02 // LC1 - Line Counter Bit1
|
||||||
#define LC0 0x01 // LC0 - Line Counter Bit0
|
#define LC0 0x01 // LC0 - Line Counter Bit0
|
||||||
|
|
||||||
// 0x29 Display Line Counter MSB [DA19 M32 LC5 LC4]
|
// 0x29 Display Line Counter MSB [DA19 M32 LC5 LC4]
|
||||||
#define DA19 0x08 // Drive A[19]
|
#define DA19 0x08 // Drive A[19]
|
||||||
#define M32 0x04 // Multiplex 32 way
|
#define M32 0x04 // Multiplex 32 way
|
||||||
#define LC5 0x02 // LC5 - Line Counter Bit5
|
#define LC5 0x02 // LC5 - Line Counter Bit5
|
||||||
#define LC4 0x01 // LC4 - Line Counter Bit4
|
#define LC4 0x01 // LC4 - Line Counter Bit4
|
||||||
|
|
||||||
// 0x2e Timer1 Control [SRQ WKE INT XTRA]
|
// 0x2e Timer1 Control [SRQ WKE INT XTRA]
|
||||||
#define SRQ 0x08 // Service request
|
#define SRQ 0x08 // Service request
|
||||||
#define WKE 0x04 // Wake up
|
#define WKE 0x04 // Wake up
|
||||||
#define INTR 0x02 // Interrupt
|
#define INTR 0x02 // Interrupt
|
||||||
#define XTRA 0x01 // Extra function
|
#define XTRA 0x01 // Extra function
|
||||||
|
|
||||||
// 0x2f Timer2 Control [SRQ WKE INT RUN]
|
// 0x2f Timer2 Control [SRQ WKE INT RUN]
|
||||||
#define SRQ 0x08 // Service request
|
#define SRQ 0x08 // Service request
|
||||||
#define WKE 0x04 // Wake up
|
#define WKE 0x04 // Wake up
|
||||||
#define INTR 0x02 // Interrupt
|
#define INTR 0x02 // Interrupt
|
||||||
#define RUN 0x01 // Timer run
|
#define RUN 0x01 // Timer run
|
|
@ -1,131 +1,131 @@
|
||||||
/*
|
/*
|
||||||
* keyboard.c
|
* keyboard.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "io.h" // I/O definitions
|
#include "io.h" // I/O definitions
|
||||||
|
|
||||||
DWORD dwKeyMinDelay = 50; // minimum time for key hold
|
DWORD dwKeyMinDelay = 50; // minimum time for key hold
|
||||||
|
|
||||||
static WORD Keyboard_GetIR(VOID)
|
static WORD Keyboard_GetIR(VOID)
|
||||||
{
|
{
|
||||||
WORD r = 0;
|
WORD r = 0;
|
||||||
|
|
||||||
// OR[0:8] are wired on Clarke/Yorke chip
|
// OR[0:8] are wired on Clarke/Yorke chip
|
||||||
if (Chipset.out==0) return 0;
|
if (Chipset.out==0) return 0;
|
||||||
if (Chipset.out&0x001) r|=Chipset.Keyboard_Row[0];
|
if (Chipset.out&0x001) r|=Chipset.Keyboard_Row[0];
|
||||||
if (Chipset.out&0x002) r|=Chipset.Keyboard_Row[1];
|
if (Chipset.out&0x002) r|=Chipset.Keyboard_Row[1];
|
||||||
if (Chipset.out&0x004) r|=Chipset.Keyboard_Row[2];
|
if (Chipset.out&0x004) r|=Chipset.Keyboard_Row[2];
|
||||||
if (Chipset.out&0x008) r|=Chipset.Keyboard_Row[3];
|
if (Chipset.out&0x008) r|=Chipset.Keyboard_Row[3];
|
||||||
if (Chipset.out&0x010) r|=Chipset.Keyboard_Row[4];
|
if (Chipset.out&0x010) r|=Chipset.Keyboard_Row[4];
|
||||||
if (Chipset.out&0x020) r|=Chipset.Keyboard_Row[5];
|
if (Chipset.out&0x020) r|=Chipset.Keyboard_Row[5];
|
||||||
if (Chipset.out&0x040) r|=Chipset.Keyboard_Row[6];
|
if (Chipset.out&0x040) r|=Chipset.Keyboard_Row[6];
|
||||||
if (Chipset.out&0x080) r|=Chipset.Keyboard_Row[7];
|
if (Chipset.out&0x080) r|=Chipset.Keyboard_Row[7];
|
||||||
if (Chipset.out&0x100) r|=Chipset.Keyboard_Row[8];
|
if (Chipset.out&0x100) r|=Chipset.Keyboard_Row[8];
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ScanKeyboard(BOOL bActive, BOOL bReset)
|
VOID ScanKeyboard(BOOL bActive, BOOL bReset)
|
||||||
{
|
{
|
||||||
// bActive = TRUE -> function called by direct read (A=IN, C=IN, RSI)
|
// bActive = TRUE -> function called by direct read (A=IN, C=IN, RSI)
|
||||||
// FALSE -> function called by 1ms keyboard poll simulation
|
// FALSE -> function called by 1ms keyboard poll simulation
|
||||||
// bReset = TRUE -> Reset Chipset.in interrupt state register
|
// bReset = TRUE -> Reset Chipset.in interrupt state register
|
||||||
// FALSE -> generate interrupt only for new pressed keys
|
// FALSE -> generate interrupt only for new pressed keys
|
||||||
|
|
||||||
// keyboard read not active?
|
// keyboard read not active?
|
||||||
if (!( bActive || Chipset.Shutdn || Chipset.IR15X
|
if (!( bActive || Chipset.Shutdn || Chipset.IR15X
|
||||||
|| (Chipset.intk && (Chipset.IORam[TIMER2_CTRL]&RUN) != 0)))
|
|| (Chipset.intk && (Chipset.IORam[TIMER2_CTRL]&RUN) != 0)))
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csKeyLock);
|
EnterCriticalSection(&csKeyLock);
|
||||||
{
|
{
|
||||||
Chipset.in &= ~0x8000; // remove ON key
|
Chipset.in &= ~0x8000; // remove ON key
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&csKeyLock);
|
LeaveCriticalSection(&csKeyLock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnterCriticalSection(&csKeyLock); // synchronize
|
EnterCriticalSection(&csKeyLock); // synchronize
|
||||||
{
|
{
|
||||||
BOOL bKbdInt;
|
BOOL bKbdInt;
|
||||||
|
|
||||||
WORD wOldIn = Chipset.in; // save old Chipset.in state
|
WORD wOldIn = Chipset.in; // save old Chipset.in state
|
||||||
|
|
||||||
UpdateKdnBit(); // update KDN bit
|
UpdateKdnBit(); // update KDN bit
|
||||||
Chipset.dwKdnCycles = (DWORD) (Chipset.cycles & 0xFFFFFFFF);
|
Chipset.dwKdnCycles = (DWORD) (Chipset.cycles & 0xFFFFFFFF);
|
||||||
|
|
||||||
Chipset.in = Keyboard_GetIR(); // update Chipset.in register
|
Chipset.in = Keyboard_GetIR(); // update Chipset.in register
|
||||||
Chipset.in |= Chipset.IR15X; // add ON key
|
Chipset.in |= Chipset.IR15X; // add ON key
|
||||||
|
|
||||||
// interrupt for any new pressed keys?
|
// interrupt for any new pressed keys?
|
||||||
bKbdInt = (Chipset.in && (wOldIn & 0x1FF) == 0) || Chipset.IR15X || bReset;
|
bKbdInt = (Chipset.in && (wOldIn & 0x1FF) == 0) || Chipset.IR15X || bReset;
|
||||||
|
|
||||||
// update keyboard interrupt pending flag when 1ms keyboard scan is disabled
|
// update keyboard interrupt pending flag when 1ms keyboard scan is disabled
|
||||||
Chipset.intd = Chipset.intd || (bKbdInt && !Chipset.intk);
|
Chipset.intd = Chipset.intd || (bKbdInt && !Chipset.intk);
|
||||||
|
|
||||||
// keyboard interrupt enabled?
|
// keyboard interrupt enabled?
|
||||||
bKbdInt = bKbdInt && Chipset.intk;
|
bKbdInt = bKbdInt && Chipset.intk;
|
||||||
|
|
||||||
// interrupt at ON key pressed
|
// interrupt at ON key pressed
|
||||||
bKbdInt = bKbdInt || Chipset.IR15X != 0;
|
bKbdInt = bKbdInt || Chipset.IR15X != 0;
|
||||||
|
|
||||||
// no interrupt if still inside interrupt service routine
|
// no interrupt if still inside interrupt service routine
|
||||||
bKbdInt = bKbdInt && Chipset.inte;
|
bKbdInt = bKbdInt && Chipset.inte;
|
||||||
|
|
||||||
if (Chipset.in != 0) // any key pressed
|
if (Chipset.in != 0) // any key pressed
|
||||||
{
|
{
|
||||||
if (bKbdInt) // interrupt enabled
|
if (bKbdInt) // interrupt enabled
|
||||||
{
|
{
|
||||||
Chipset.SoftInt = TRUE; // interrupt request
|
Chipset.SoftInt = TRUE; // interrupt request
|
||||||
bInterrupt = TRUE; // exit emulation loop
|
bInterrupt = TRUE; // exit emulation loop
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Chipset.Shutdn) // cpu sleeping
|
if (Chipset.Shutdn) // cpu sleeping
|
||||||
{
|
{
|
||||||
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
||||||
SetEvent(hEventShutdn); // wake up emulation thread
|
SetEvent(hEventShutdn); // wake up emulation thread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Chipset.intd = FALSE; // no keyboard interrupt pending
|
Chipset.intd = FALSE; // no keyboard interrupt pending
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&csKeyLock);
|
LeaveCriticalSection(&csKeyLock);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID KeyboardEvent(BOOL bPress, UINT out, UINT in)
|
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
|
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
|
// "out" is outside Keyboard_Row
|
||||||
if (out >= ARRAYSIZEOF(Chipset.Keyboard_Row)) return;
|
if (out >= ARRAYSIZEOF(Chipset.Keyboard_Row)) return;
|
||||||
|
|
||||||
// in &= 0x1FF; // only IR[0:8] are wired on Clarke/Yorke chip
|
// in &= 0x1FF; // only IR[0:8] are wired on Clarke/Yorke chip
|
||||||
|
|
||||||
_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
|
||||||
else
|
else
|
||||||
Chipset.Keyboard_Row[out] &= (~in); // clear key marker in keyboard row
|
Chipset.Keyboard_Row[out] &= (~in); // clear key marker in keyboard row
|
||||||
}
|
}
|
||||||
AdjKeySpeed(); // adjust key repeat speed
|
AdjKeySpeed(); // adjust key repeat speed
|
||||||
ScanKeyboard(FALSE,FALSE); // update Chipset.in register by 1ms keyboard poll
|
ScanKeyboard(FALSE,FALSE); // update Chipset.in register by 1ms keyboard poll
|
||||||
Sleep(dwKeyMinDelay); // hold key state for a definite time
|
Sleep(dwKeyMinDelay); // hold key state for a definite time
|
||||||
return;
|
return;
|
||||||
}
|
}
|
|
@ -1,337 +1,337 @@
|
||||||
/*
|
/*
|
||||||
* Keymacro.c
|
* Keymacro.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Christoph Gießelink
|
* Copyright (C) 2004 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "kml.h"
|
#include "kml.h"
|
||||||
|
|
||||||
#define KEYMACROHEAD "Emu-KeyMacro" // macro signature
|
#define KEYMACROHEAD "Emu-KeyMacro" // macro signature
|
||||||
|
|
||||||
#define MIN_SPEED 0
|
#define MIN_SPEED 0
|
||||||
#define MAX_SPEED 500
|
#define MAX_SPEED 500
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
DWORD dwTime; // elapsed time
|
DWORD dwTime; // elapsed time
|
||||||
DWORD dwKeyEvent; // key code
|
DWORD dwKeyEvent; // key code
|
||||||
} KeyData;
|
} KeyData;
|
||||||
|
|
||||||
INT nMacroState = MACRO_OFF;
|
INT nMacroState = MACRO_OFF;
|
||||||
INT nMacroTimeout = MIN_SPEED;
|
INT nMacroTimeout = MIN_SPEED;
|
||||||
BOOL bMacroRealSpeed = TRUE;
|
BOOL bMacroRealSpeed = TRUE;
|
||||||
DWORD dwMacroMinDelay = 0; // minimum macro play key hold time in ms
|
DWORD dwMacroMinDelay = 0; // minimum macro play key hold time in ms
|
||||||
|
|
||||||
static DWORD dwTimeRef;
|
static DWORD dwTimeRef;
|
||||||
|
|
||||||
static HANDLE hMacroFile = INVALID_HANDLE_VALUE;
|
static HANDLE hMacroFile = INVALID_HANDLE_VALUE;
|
||||||
static HANDLE hEventPlay = NULL;
|
static HANDLE hEventPlay = NULL;
|
||||||
static HANDLE hThreadEv = NULL;
|
static HANDLE hThreadEv = NULL;
|
||||||
|
|
||||||
static VOID InitializeOFN(LPOPENFILENAME ofn)
|
static VOID InitializeOFN(LPOPENFILENAME ofn)
|
||||||
{
|
{
|
||||||
ZeroMemory((LPVOID)ofn, sizeof(OPENFILENAME));
|
ZeroMemory((LPVOID)ofn, sizeof(OPENFILENAME));
|
||||||
ofn->lStructSize = sizeof(OPENFILENAME);
|
ofn->lStructSize = sizeof(OPENFILENAME);
|
||||||
ofn->hwndOwner = hWnd;
|
ofn->hwndOwner = hWnd;
|
||||||
ofn->Flags = OFN_EXPLORER|OFN_HIDEREADONLY;
|
ofn->Flags = OFN_EXPLORER|OFN_HIDEREADONLY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// thread playing keys
|
// thread playing keys
|
||||||
//
|
//
|
||||||
static DWORD WINAPI EventThread(LPVOID pParam)
|
static DWORD WINAPI EventThread(LPVOID pParam)
|
||||||
{
|
{
|
||||||
DWORD dwRead = 0;
|
DWORD dwRead = 0;
|
||||||
DWORD dwData = 0,dwTime = 0;
|
DWORD dwData = 0,dwTime = 0;
|
||||||
|
|
||||||
while (WaitForSingleObject(hEventPlay,dwTime) == WAIT_TIMEOUT)
|
while (WaitForSingleObject(hEventPlay,dwTime) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
if (dwRead != 0) // data read
|
if (dwRead != 0) // data read
|
||||||
{
|
{
|
||||||
UINT nIn = (dwData >> 0) & 0xFFFF;
|
UINT nIn = (dwData >> 0) & 0xFFFF;
|
||||||
UINT nOut = (dwData >> 16) & 0xFF;
|
UINT nOut = (dwData >> 16) & 0xFF;
|
||||||
BOOL bPress = (dwData >> 24) & 0xFF;
|
BOOL bPress = (dwData >> 24) & 0xFF;
|
||||||
|
|
||||||
PlayKey(nOut,nIn,bPress);
|
PlayKey(nOut,nIn,bPress);
|
||||||
}
|
}
|
||||||
|
|
||||||
dwTime = nMacroTimeout; // set default speed
|
dwTime = nMacroTimeout; // set default speed
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
// read next data element
|
// read next data element
|
||||||
if ( !ReadFile(hMacroFile,&dwData,sizeof(dwData),&dwRead,NULL)
|
if ( !ReadFile(hMacroFile,&dwData,sizeof(dwData),&dwRead,NULL)
|
||||||
|| dwRead != sizeof(dwData))
|
|| dwRead != sizeof(dwData))
|
||||||
{
|
{
|
||||||
// play record empty -> quit
|
// play record empty -> quit
|
||||||
PostMessage(hWnd,WM_COMMAND,ID_TOOL_MACRO_STOP,0);
|
PostMessage(hWnd,WM_COMMAND,ID_TOOL_MACRO_STOP,0);
|
||||||
return 0; // exit on file end
|
return 0; // exit on file end
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dwData & 0x80000000) != 0) // time information
|
if ((dwData & 0x80000000) != 0) // time information
|
||||||
{
|
{
|
||||||
if (bMacroRealSpeed) // realspeed from data
|
if (bMacroRealSpeed) // realspeed from data
|
||||||
{
|
{
|
||||||
dwTime = dwData & 0x7FFFFFFF;
|
dwTime = dwData & 0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold the key state the minimum macro play key hold time
|
// hold the key state the minimum macro play key hold time
|
||||||
if (dwTime < dwMacroMinDelay) dwTime = dwMacroMinDelay;
|
if (dwTime < dwMacroMinDelay) dwTime = dwMacroMinDelay;
|
||||||
|
|
||||||
dwTime -= dwKeyMinDelay; // remove the actual key hold time
|
dwTime -= dwKeyMinDelay; // remove the actual key hold time
|
||||||
// set negative number to zero
|
// set negative number to zero
|
||||||
if ((dwTime & 0x80000000) != 0) dwTime = 0;
|
if ((dwTime & 0x80000000) != 0) dwTime = 0;
|
||||||
break; // got key information
|
break; // got key information
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; // exit on stop
|
return 0; // exit on stop
|
||||||
UNREFERENCED_PARAMETER(pParam);
|
UNREFERENCED_PARAMETER(pParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// callback function for recording keys
|
// callback function for recording keys
|
||||||
//
|
//
|
||||||
VOID KeyMacroRecord(BOOL bPress, UINT out, UINT in)
|
VOID KeyMacroRecord(BOOL bPress, UINT out, UINT in)
|
||||||
{
|
{
|
||||||
if (nMacroState == MACRO_NEW) // save key event
|
if (nMacroState == MACRO_NEW) // save key event
|
||||||
{
|
{
|
||||||
KeyData Data;
|
KeyData Data;
|
||||||
DWORD dwWritten;
|
DWORD dwWritten;
|
||||||
|
|
||||||
dwWritten = GetTickCount(); // time reference
|
dwWritten = GetTickCount(); // time reference
|
||||||
Data.dwTime = (dwWritten - dwTimeRef);
|
Data.dwTime = (dwWritten - dwTimeRef);
|
||||||
Data.dwTime |= 0x80000000; // set time marker
|
Data.dwTime |= 0x80000000; // set time marker
|
||||||
dwTimeRef = dwWritten;
|
dwTimeRef = dwWritten;
|
||||||
|
|
||||||
Data.dwKeyEvent = (bPress & 0xFF);
|
Data.dwKeyEvent = (bPress & 0xFF);
|
||||||
Data.dwKeyEvent = (Data.dwKeyEvent << 8) | (out & 0xFF);
|
Data.dwKeyEvent = (Data.dwKeyEvent << 8) | (out & 0xFF);
|
||||||
Data.dwKeyEvent = (Data.dwKeyEvent << 16) | (in & 0xFFFF);
|
Data.dwKeyEvent = (Data.dwKeyEvent << 16) | (in & 0xFFFF);
|
||||||
|
|
||||||
// save key event in file
|
// save key event in file
|
||||||
WriteFile(hMacroFile,&Data,sizeof(Data),&dwWritten,NULL);
|
WriteFile(hMacroFile,&Data,sizeof(Data),&dwWritten,NULL);
|
||||||
_ASSERT(dwWritten == sizeof(Data));
|
_ASSERT(dwWritten == sizeof(Data));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// message handler for save new keyboard macro
|
// message handler for save new keyboard macro
|
||||||
//
|
//
|
||||||
LRESULT OnToolMacroNew(VOID)
|
LRESULT OnToolMacroNew(VOID)
|
||||||
{
|
{
|
||||||
TCHAR szMacroFile[MAX_PATH];
|
TCHAR szMacroFile[MAX_PATH];
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
DWORD dwExtensionLength,dwWritten;
|
DWORD dwExtensionLength,dwWritten;
|
||||||
|
|
||||||
// get filename for saving
|
// get filename for saving
|
||||||
InitializeOFN(&ofn);
|
InitializeOFN(&ofn);
|
||||||
ofn.lpstrFilter =
|
ofn.lpstrFilter =
|
||||||
_T("Keyboard Macro Files (*.MAC)\0*.MAC\0")
|
_T("Keyboard Macro Files (*.MAC)\0*.MAC\0")
|
||||||
_T("All Files (*.*)\0*.*\0");
|
_T("All Files (*.*)\0*.*\0");
|
||||||
ofn.lpstrDefExt = _T("MAC");
|
ofn.lpstrDefExt = _T("MAC");
|
||||||
ofn.nFilterIndex = 1;
|
ofn.nFilterIndex = 1;
|
||||||
ofn.lpstrFile = szMacroFile;
|
ofn.lpstrFile = szMacroFile;
|
||||||
ofn.lpstrFile[0] = 0;
|
ofn.lpstrFile[0] = 0;
|
||||||
ofn.nMaxFile = ARRAYSIZEOF(szMacroFile);
|
ofn.nMaxFile = ARRAYSIZEOF(szMacroFile);
|
||||||
ofn.Flags |= OFN_CREATEPROMPT|OFN_OVERWRITEPROMPT;
|
ofn.Flags |= OFN_CREATEPROMPT|OFN_OVERWRITEPROMPT;
|
||||||
if (GetSaveFileName(&ofn) == FALSE) return 0;
|
if (GetSaveFileName(&ofn) == FALSE) return 0;
|
||||||
|
|
||||||
// open file for writing
|
// open file for writing
|
||||||
hMacroFile = CreateFile(szMacroFile,
|
hMacroFile = CreateFile(szMacroFile,
|
||||||
GENERIC_READ|GENERIC_WRITE,
|
GENERIC_READ|GENERIC_WRITE,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
CREATE_ALWAYS,
|
CREATE_ALWAYS,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL);
|
NULL);
|
||||||
if (hMacroFile == INVALID_HANDLE_VALUE) return 0;
|
if (hMacroFile == INVALID_HANDLE_VALUE) return 0;
|
||||||
|
|
||||||
// write header
|
// write header
|
||||||
WriteFile(hMacroFile,KEYMACROHEAD,sizeof(KEYMACROHEAD) - 1,&dwWritten,NULL);
|
WriteFile(hMacroFile,KEYMACROHEAD,sizeof(KEYMACROHEAD) - 1,&dwWritten,NULL);
|
||||||
_ASSERT(dwWritten == (DWORD) strlen(KEYMACROHEAD));
|
_ASSERT(dwWritten == (DWORD) strlen(KEYMACROHEAD));
|
||||||
|
|
||||||
// write extension length
|
// write extension length
|
||||||
dwExtensionLength = 0; // no extension
|
dwExtensionLength = 0; // no extension
|
||||||
WriteFile(hMacroFile,&dwExtensionLength,sizeof(dwExtensionLength),&dwWritten,NULL);
|
WriteFile(hMacroFile,&dwExtensionLength,sizeof(dwExtensionLength),&dwWritten,NULL);
|
||||||
_ASSERT(dwWritten == sizeof(dwExtensionLength));
|
_ASSERT(dwWritten == sizeof(dwExtensionLength));
|
||||||
|
|
||||||
nMacroState = MACRO_NEW;
|
nMacroState = MACRO_NEW;
|
||||||
|
|
||||||
MessageBox(hWnd,
|
MessageBox(hWnd,
|
||||||
_T("Press OK to begin to record the Macro."),
|
_T("Press OK to begin to record the Macro."),
|
||||||
_T("Macro Recorder"),
|
_T("Macro Recorder"),
|
||||||
MB_OK|MB_ICONINFORMATION);
|
MB_OK|MB_ICONINFORMATION);
|
||||||
|
|
||||||
dwTimeRef = GetTickCount(); // time reference
|
dwTimeRef = GetTickCount(); // time reference
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// message handler for play keyboard macro
|
// message handler for play keyboard macro
|
||||||
//
|
//
|
||||||
LRESULT OnToolMacroPlay(VOID)
|
LRESULT OnToolMacroPlay(VOID)
|
||||||
{
|
{
|
||||||
BYTE byHeader[sizeof(KEYMACROHEAD)-1];
|
BYTE byHeader[sizeof(KEYMACROHEAD)-1];
|
||||||
TCHAR szMacroFile[MAX_PATH];
|
TCHAR szMacroFile[MAX_PATH];
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
DWORD dwExtensionLength,dwRead,dwThreadId;
|
DWORD dwExtensionLength,dwRead,dwThreadId;
|
||||||
|
|
||||||
InitializeOFN(&ofn);
|
InitializeOFN(&ofn);
|
||||||
ofn.lpstrFilter =
|
ofn.lpstrFilter =
|
||||||
_T("Keyboard Macro Files (*.MAC)\0*.MAC\0")
|
_T("Keyboard Macro Files (*.MAC)\0*.MAC\0")
|
||||||
_T("All Files (*.*)\0*.*\0");
|
_T("All Files (*.*)\0*.*\0");
|
||||||
ofn.lpstrDefExt = _T("MAC");
|
ofn.lpstrDefExt = _T("MAC");
|
||||||
ofn.nFilterIndex = 1;
|
ofn.nFilterIndex = 1;
|
||||||
ofn.lpstrFile = szMacroFile;
|
ofn.lpstrFile = szMacroFile;
|
||||||
ofn.lpstrFile[0] = 0;
|
ofn.lpstrFile[0] = 0;
|
||||||
ofn.nMaxFile = ARRAYSIZEOF(szMacroFile);
|
ofn.nMaxFile = ARRAYSIZEOF(szMacroFile);
|
||||||
ofn.Flags |= OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST;
|
ofn.Flags |= OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST;
|
||||||
if (GetOpenFileName(&ofn) == FALSE) return 0;
|
if (GetOpenFileName(&ofn) == FALSE) return 0;
|
||||||
|
|
||||||
// open file for Reading
|
// open file for Reading
|
||||||
hMacroFile = CreateFile(szMacroFile,
|
hMacroFile = CreateFile(szMacroFile,
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
FILE_SHARE_READ,
|
FILE_SHARE_READ,
|
||||||
NULL,
|
NULL,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL);
|
NULL);
|
||||||
if (hMacroFile == INVALID_HANDLE_VALUE) return 0;
|
if (hMacroFile == INVALID_HANDLE_VALUE) return 0;
|
||||||
|
|
||||||
// read header
|
// read header
|
||||||
ReadFile(hMacroFile,byHeader,sizeof(byHeader),&dwRead,NULL);
|
ReadFile(hMacroFile,byHeader,sizeof(byHeader),&dwRead,NULL);
|
||||||
if ( dwRead != sizeof(byHeader)
|
if ( dwRead != sizeof(byHeader)
|
||||||
|| memcmp(byHeader,KEYMACROHEAD,dwRead) != 0)
|
|| memcmp(byHeader,KEYMACROHEAD,dwRead) != 0)
|
||||||
{
|
{
|
||||||
MessageBox(hWnd,
|
MessageBox(hWnd,
|
||||||
_T("Wrong keyboard macro file format."),
|
_T("Wrong keyboard macro file format."),
|
||||||
_T("Macro Recorder"),
|
_T("Macro Recorder"),
|
||||||
MB_OK|MB_ICONSTOP);
|
MB_OK|MB_ICONSTOP);
|
||||||
CloseHandle(hMacroFile);
|
CloseHandle(hMacroFile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read extension length
|
// read extension length
|
||||||
ReadFile(hMacroFile,&dwExtensionLength,sizeof(dwExtensionLength),&dwRead,NULL);
|
ReadFile(hMacroFile,&dwExtensionLength,sizeof(dwExtensionLength),&dwRead,NULL);
|
||||||
if (dwRead != sizeof(dwExtensionLength))
|
if (dwRead != sizeof(dwExtensionLength))
|
||||||
{
|
{
|
||||||
CloseHandle(hMacroFile);
|
CloseHandle(hMacroFile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read extension
|
// read extension
|
||||||
while (dwExtensionLength-- > 0)
|
while (dwExtensionLength-- > 0)
|
||||||
{
|
{
|
||||||
BYTE byData;
|
BYTE byData;
|
||||||
|
|
||||||
ReadFile(hMacroFile,&byData,sizeof(byData),&dwRead,NULL);
|
ReadFile(hMacroFile,&byData,sizeof(byData),&dwRead,NULL);
|
||||||
if (dwRead != sizeof(byData))
|
if (dwRead != sizeof(byData))
|
||||||
{
|
{
|
||||||
CloseHandle(hMacroFile);
|
CloseHandle(hMacroFile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// event for quit playing
|
// event for quit playing
|
||||||
hEventPlay = CreateEvent(NULL,FALSE,FALSE,NULL);
|
hEventPlay = CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||||
|
|
||||||
nMacroState = MACRO_PLAY;
|
nMacroState = MACRO_PLAY;
|
||||||
|
|
||||||
// start playing thread
|
// start playing thread
|
||||||
VERIFY(hThreadEv = CreateThread(NULL,0,&EventThread,NULL,0,&dwThreadId));
|
VERIFY(hThreadEv = CreateThread(NULL,0,&EventThread,NULL,0,&dwThreadId));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// message handler for stop recording/playing
|
// message handler for stop recording/playing
|
||||||
//
|
//
|
||||||
LRESULT OnToolMacroStop(VOID)
|
LRESULT OnToolMacroStop(VOID)
|
||||||
{
|
{
|
||||||
if (nMacroState != MACRO_OFF)
|
if (nMacroState != MACRO_OFF)
|
||||||
{
|
{
|
||||||
if (hEventPlay) // playing keys
|
if (hEventPlay) // playing keys
|
||||||
{
|
{
|
||||||
// stop playing thread
|
// stop playing thread
|
||||||
SetEvent(hEventPlay); // quit play loop
|
SetEvent(hEventPlay); // quit play loop
|
||||||
|
|
||||||
WaitForSingleObject(hThreadEv,INFINITE);
|
WaitForSingleObject(hThreadEv,INFINITE);
|
||||||
CloseHandle(hThreadEv);
|
CloseHandle(hThreadEv);
|
||||||
hThreadEv = NULL;
|
hThreadEv = NULL;
|
||||||
|
|
||||||
CloseHandle(hEventPlay); // close playing keys event
|
CloseHandle(hEventPlay); // close playing keys event
|
||||||
hEventPlay = NULL;
|
hEventPlay = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// macro file open
|
// macro file open
|
||||||
if (hMacroFile != INVALID_HANDLE_VALUE) CloseHandle(hMacroFile);
|
if (hMacroFile != INVALID_HANDLE_VALUE) CloseHandle(hMacroFile);
|
||||||
|
|
||||||
nMacroState = MACRO_OFF;
|
nMacroState = MACRO_OFF;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// activate/deactivate slider
|
// activate/deactivate slider
|
||||||
//
|
//
|
||||||
static VOID SliderEnable(HWND hDlg,BOOL bEnable)
|
static VOID SliderEnable(HWND hDlg,BOOL bEnable)
|
||||||
{
|
{
|
||||||
EnableWindow(GetDlgItem(hDlg,IDC_MACRO_SLOW),bEnable);
|
EnableWindow(GetDlgItem(hDlg,IDC_MACRO_SLOW),bEnable);
|
||||||
EnableWindow(GetDlgItem(hDlg,IDC_MACRO_FAST),bEnable);
|
EnableWindow(GetDlgItem(hDlg,IDC_MACRO_FAST),bEnable);
|
||||||
EnableWindow(GetDlgItem(hDlg,IDC_MACRO_SLIDER),bEnable);
|
EnableWindow(GetDlgItem(hDlg,IDC_MACRO_SLIDER),bEnable);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Macro settings dialog
|
// Macro settings dialog
|
||||||
//
|
//
|
||||||
static INT_PTR CALLBACK MacroProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
static INT_PTR CALLBACK MacroProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
// set slider
|
// set slider
|
||||||
SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_SETRANGE,FALSE,MAKELONG(0,MAX_SPEED-MIN_SPEED));
|
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_SETTICFREQ,MAX_SPEED/10,0);
|
||||||
SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_SETPOS,TRUE,MAX_SPEED-nMacroTimeout);
|
SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_SETPOS,TRUE,MAX_SPEED-nMacroTimeout);
|
||||||
|
|
||||||
// set button
|
// set button
|
||||||
CheckDlgButton(hDlg,bMacroRealSpeed ? IDC_MACRO_REAL : IDC_MACRO_MANUAL,BST_CHECKED);
|
CheckDlgButton(hDlg,bMacroRealSpeed ? IDC_MACRO_REAL : IDC_MACRO_MANUAL,BST_CHECKED);
|
||||||
SliderEnable(hDlg,!bMacroRealSpeed);
|
SliderEnable(hDlg,!bMacroRealSpeed);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDC_MACRO_REAL:
|
case IDC_MACRO_REAL:
|
||||||
SliderEnable(hDlg,FALSE);
|
SliderEnable(hDlg,FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDC_MACRO_MANUAL:
|
case IDC_MACRO_MANUAL:
|
||||||
SliderEnable(hDlg,TRUE);
|
SliderEnable(hDlg,TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
// get macro data
|
// get macro data
|
||||||
nMacroTimeout = MAX_SPEED - (INT) SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_GETPOS,0,0);
|
nMacroTimeout = MAX_SPEED - (INT) SendDlgItemMessage(hDlg,IDC_MACRO_SLIDER,TBM_GETPOS,0,0);
|
||||||
bMacroRealSpeed = IsDlgButtonChecked(hDlg,IDC_MACRO_REAL);
|
bMacroRealSpeed = IsDlgButtonChecked(hDlg,IDC_MACRO_REAL);
|
||||||
// no break
|
// no break
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hDlg, LOWORD(wParam));
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
UNREFERENCED_PARAMETER(lParam);
|
UNREFERENCED_PARAMETER(lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnToolMacroSettings(VOID)
|
LRESULT OnToolMacroSettings(VOID)
|
||||||
{
|
{
|
||||||
if (DialogBox(hApp, MAKEINTRESOURCE(IDD_MACROSET), hWnd, (DLGPROC)MacroProc) == -1)
|
if (DialogBox(hApp, MAKEINTRESOURCE(IDD_MACROSET), hWnd, (DLGPROC)MacroProc) == -1)
|
||||||
AbortMessage(_T("Macro Dialog Box Creation Error !"));
|
AbortMessage(_T("Macro Dialog Box Creation Error !"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,133 +1,133 @@
|
||||||
/*
|
/*
|
||||||
* kml.h
|
* kml.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LEX_BLOCK 0
|
#define LEX_BLOCK 0
|
||||||
#define LEX_COMMAND 1
|
#define LEX_COMMAND 1
|
||||||
#define LEX_PARAM 2
|
#define LEX_PARAM 2
|
||||||
|
|
||||||
typedef enum eTokenId
|
typedef enum eTokenId
|
||||||
{
|
{
|
||||||
TOK_NONE, //0
|
TOK_NONE, //0
|
||||||
TOK_ANNUNCIATOR, //1
|
TOK_ANNUNCIATOR, //1
|
||||||
TOK_BACKGROUND, //2
|
TOK_BACKGROUND, //2
|
||||||
TOK_IFPRESSED, //3
|
TOK_IFPRESSED, //3
|
||||||
TOK_RESETFLAG, //4
|
TOK_RESETFLAG, //4
|
||||||
TOK_SCANCODE, //5
|
TOK_SCANCODE, //5
|
||||||
TOK_HARDWARE, //6
|
TOK_HARDWARE, //6
|
||||||
TOK_MENUITEM, //7
|
TOK_MENUITEM, //7
|
||||||
TOK_SYSITEM, //8
|
TOK_SYSITEM, //8
|
||||||
TOK_INTEGER, //9
|
TOK_INTEGER, //9
|
||||||
TOK_SETFLAG, //10
|
TOK_SETFLAG, //10
|
||||||
TOK_RELEASE, //11
|
TOK_RELEASE, //11
|
||||||
TOK_VIRTUAL, //12
|
TOK_VIRTUAL, //12
|
||||||
TOK_INCLUDE, //13
|
TOK_INCLUDE, //13
|
||||||
TOK_NOTFLAG, //14
|
TOK_NOTFLAG, //14
|
||||||
TOK_STRING, //15
|
TOK_STRING, //15
|
||||||
TOK_GLOBAL, //16
|
TOK_GLOBAL, //16
|
||||||
TOK_AUTHOR, //17
|
TOK_AUTHOR, //17
|
||||||
TOK_BITMAP, //18
|
TOK_BITMAP, //18
|
||||||
TOK_ZOOMXY, //19
|
TOK_ZOOMXY, //19
|
||||||
TOK_OFFSET, //20
|
TOK_OFFSET, //20
|
||||||
TOK_BUTTON, //21
|
TOK_BUTTON, //21
|
||||||
TOK_IFFLAG, //22
|
TOK_IFFLAG, //22
|
||||||
TOK_ONDOWN, //23
|
TOK_ONDOWN, //23
|
||||||
TOK_NOHOLD, //24
|
TOK_NOHOLD, //24
|
||||||
TOK_LOCALE, //25
|
TOK_LOCALE, //25
|
||||||
TOK_TOPBAR, //26
|
TOK_TOPBAR, //26
|
||||||
TOK_MENUBAR, //27
|
TOK_MENUBAR, //27
|
||||||
TOK_TITLE, //28
|
TOK_TITLE, //28
|
||||||
TOK_OUTIN, //29
|
TOK_OUTIN, //29
|
||||||
TOK_PATCH, //30
|
TOK_PATCH, //30
|
||||||
TOK_PRINT, //31
|
TOK_PRINT, //31
|
||||||
TOK_DEBUG, //32
|
TOK_DEBUG, //32
|
||||||
TOK_COLOR, //33
|
TOK_COLOR, //33
|
||||||
TOK_MODEL, //34
|
TOK_MODEL, //34
|
||||||
TOK_CLASS, //35
|
TOK_CLASS, //35
|
||||||
TOK_PRESS, //36
|
TOK_PRESS, //36
|
||||||
TOK_IFMEM, //37
|
TOK_IFMEM, //37
|
||||||
TOK_SCALE, //38
|
TOK_SCALE, //38
|
||||||
TOK_TYPE, //39
|
TOK_TYPE, //39
|
||||||
TOK_SIZE, //40
|
TOK_SIZE, //40
|
||||||
TOK_DOWN, //41
|
TOK_DOWN, //41
|
||||||
TOK_ZOOM, //42
|
TOK_ZOOM, //42
|
||||||
TOK_ELSE, //43
|
TOK_ELSE, //43
|
||||||
TOK_ONUP, //44
|
TOK_ONUP, //44
|
||||||
TOK_ICON, //45
|
TOK_ICON, //45
|
||||||
TOK_EOL, //46
|
TOK_EOL, //46
|
||||||
TOK_MAP, //47
|
TOK_MAP, //47
|
||||||
TOK_ROM, //48
|
TOK_ROM, //48
|
||||||
TOK_VGA, //49
|
TOK_VGA, //49
|
||||||
TOK_LCD, //50
|
TOK_LCD, //50
|
||||||
TOK_END //51
|
TOK_END //51
|
||||||
} TokenId;
|
} TokenId;
|
||||||
|
|
||||||
#define TYPE_NONE 00
|
#define TYPE_NONE 00
|
||||||
#define TYPE_INTEGER 01
|
#define TYPE_INTEGER 01
|
||||||
#define TYPE_STRING 02
|
#define TYPE_STRING 02
|
||||||
|
|
||||||
typedef struct KmlToken
|
typedef struct KmlToken
|
||||||
{
|
{
|
||||||
TokenId eId;
|
TokenId eId;
|
||||||
DWORD nParams;
|
DWORD nParams;
|
||||||
DWORD nLen;
|
DWORD nLen;
|
||||||
LPCTSTR szName;
|
LPCTSTR szName;
|
||||||
} KmlToken;
|
} KmlToken;
|
||||||
|
|
||||||
typedef struct KmlLine
|
typedef struct KmlLine
|
||||||
{
|
{
|
||||||
struct KmlLine* pNext;
|
struct KmlLine* pNext;
|
||||||
TokenId eCommand;
|
TokenId eCommand;
|
||||||
DWORD_PTR nParam[6];
|
DWORD_PTR nParam[6];
|
||||||
} KmlLine;
|
} KmlLine;
|
||||||
|
|
||||||
typedef struct KmlBlock
|
typedef struct KmlBlock
|
||||||
{
|
{
|
||||||
TokenId eType;
|
TokenId eType;
|
||||||
DWORD nId;
|
DWORD nId;
|
||||||
struct KmlLine* pFirstLine;
|
struct KmlLine* pFirstLine;
|
||||||
struct KmlBlock* pNext;
|
struct KmlBlock* pNext;
|
||||||
} KmlBlock;
|
} KmlBlock;
|
||||||
|
|
||||||
#define BUTTON_NOHOLD 0x0001
|
#define BUTTON_NOHOLD 0x0001
|
||||||
#define BUTTON_VIRTUAL 0x0002
|
#define BUTTON_VIRTUAL 0x0002
|
||||||
typedef struct KmlButton
|
typedef struct KmlButton
|
||||||
{
|
{
|
||||||
UINT nId;
|
UINT nId;
|
||||||
BOOL bDown;
|
BOOL bDown;
|
||||||
UINT nType;
|
UINT nType;
|
||||||
DWORD dwFlags;
|
DWORD dwFlags;
|
||||||
UINT nOx, nOy;
|
UINT nOx, nOy;
|
||||||
UINT nDx, nDy;
|
UINT nDx, nDy;
|
||||||
UINT nCx, nCy;
|
UINT nCx, nCy;
|
||||||
UINT nOut, nIn;
|
UINT nOut, nIn;
|
||||||
KmlLine* pOnDown;
|
KmlLine* pOnDown;
|
||||||
KmlLine* pOnUp;
|
KmlLine* pOnUp;
|
||||||
} KmlButton;
|
} KmlButton;
|
||||||
|
|
||||||
typedef struct KmlAnnunciator
|
typedef struct KmlAnnunciator
|
||||||
{
|
{
|
||||||
UINT nOx, nOy;
|
UINT nOx, nOy;
|
||||||
UINT nDx, nDy;
|
UINT nDx, nDy;
|
||||||
UINT nCx, nCy;
|
UINT nCx, nCy;
|
||||||
} KmlAnnunciator;
|
} KmlAnnunciator;
|
||||||
|
|
||||||
extern KmlBlock* pKml;
|
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 ReloadButtons(BYTE *Keyboard_Row, UINT nSize);
|
||||||
extern VOID RefreshButtons(RECT *rc);
|
extern VOID RefreshButtons(RECT *rc);
|
||||||
extern BOOL MouseIsButton(DWORD x, DWORD y);
|
extern BOOL MouseIsButton(DWORD x, DWORD y);
|
||||||
extern VOID MouseButtonDownAt(UINT nFlags, DWORD x, DWORD y);
|
extern VOID MouseButtonDownAt(UINT nFlags, DWORD x, DWORD y);
|
||||||
extern VOID MouseButtonUpAt(UINT nFlags, DWORD x, DWORD y);
|
extern VOID MouseButtonUpAt(UINT nFlags, DWORD x, DWORD y);
|
||||||
extern VOID MouseMovesTo(UINT nFlags, DWORD x, DWORD y);
|
extern VOID MouseMovesTo(UINT nFlags, DWORD x, DWORD y);
|
||||||
extern VOID RunKey(BYTE nId, BOOL bPressed);
|
extern VOID RunKey(BYTE nId, BOOL bPressed);
|
||||||
extern VOID PlayKey(UINT nOut, UINT nIn, 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);
|
|
@ -664,7 +664,7 @@ which is possible in case of only 0 or 1 present symbols. */
|
||||||
static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
|
static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
|
||||||
static const unsigned headsize = 1u << FIRSTBITS; /*size of the first table*/
|
static const unsigned headsize = 1u << FIRSTBITS; /*size of the first table*/
|
||||||
static const unsigned mask = (1u << FIRSTBITS) /*headsize*/ - 1u;
|
static const unsigned mask = (1u << FIRSTBITS) /*headsize*/ - 1u;
|
||||||
unsigned i, numpresent, pointer, size; /*total table size*/
|
size_t i, numpresent, pointer, size; /*total table size*/
|
||||||
unsigned* maxlens = (unsigned*)lodepng_malloc(headsize * sizeof(unsigned));
|
unsigned* maxlens = (unsigned*)lodepng_malloc(headsize * sizeof(unsigned));
|
||||||
if(!maxlens) return 83; /*alloc fail*/
|
if(!maxlens) return 83; /*alloc fail*/
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
|
||||||
size = headsize;
|
size = headsize;
|
||||||
for(i = 0; i < headsize; ++i) {
|
for(i = 0; i < headsize; ++i) {
|
||||||
unsigned l = maxlens[i];
|
unsigned l = maxlens[i];
|
||||||
if(l > FIRSTBITS) size += (1u << (l - FIRSTBITS));
|
if(l > FIRSTBITS) size += (((size_t)1) << (l - FIRSTBITS));
|
||||||
}
|
}
|
||||||
tree->table_len = (unsigned char*)lodepng_malloc(size * sizeof(*tree->table_len));
|
tree->table_len = (unsigned char*)lodepng_malloc(size * sizeof(*tree->table_len));
|
||||||
tree->table_value = (unsigned short*)lodepng_malloc(size * sizeof(*tree->table_value));
|
tree->table_value = (unsigned short*)lodepng_malloc(size * sizeof(*tree->table_value));
|
||||||
|
@ -701,8 +701,8 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
|
||||||
unsigned l = maxlens[i];
|
unsigned l = maxlens[i];
|
||||||
if(l <= FIRSTBITS) continue;
|
if(l <= FIRSTBITS) continue;
|
||||||
tree->table_len[i] = l;
|
tree->table_len[i] = l;
|
||||||
tree->table_value[i] = pointer;
|
tree->table_value[i] = (unsigned short)pointer;
|
||||||
pointer += (1u << (l - FIRSTBITS));
|
pointer += (((size_t)1) << (l - FIRSTBITS));
|
||||||
}
|
}
|
||||||
lodepng_free(maxlens);
|
lodepng_free(maxlens);
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
|
||||||
unsigned index = reverse | (j << l);
|
unsigned index = reverse | (j << l);
|
||||||
if(tree->table_len[index] != 16) return 55; /*invalid tree: long symbol shares prefix with short symbol*/
|
if(tree->table_len[index] != 16) return 55; /*invalid tree: long symbol shares prefix with short symbol*/
|
||||||
tree->table_len[index] = l;
|
tree->table_len[index] = l;
|
||||||
tree->table_value[index] = i;
|
tree->table_value[index] = (unsigned short)i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*long symbol, shares prefix with other long symbols in first lookup table, needs second lookup*/
|
/*long symbol, shares prefix with other long symbols in first lookup table, needs second lookup*/
|
||||||
|
@ -743,7 +743,7 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
|
||||||
unsigned reverse2 = reverse >> FIRSTBITS; /* l - FIRSTBITS bits */
|
unsigned reverse2 = reverse >> FIRSTBITS; /* l - FIRSTBITS bits */
|
||||||
unsigned index2 = start + (reverse2 | (j << (l - FIRSTBITS)));
|
unsigned index2 = start + (reverse2 | (j << (l - FIRSTBITS)));
|
||||||
tree->table_len[index2] = l;
|
tree->table_len[index2] = l;
|
||||||
tree->table_value[index2] = i;
|
tree->table_value[index2] = (unsigned short)i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2886,7 +2886,7 @@ static unsigned lodepng_chunk_createv(ucvector* out,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize,
|
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize,
|
||||||
unsigned length, const char* type, const unsigned char* data) {
|
size_t length, const char* type, const unsigned char* data) {
|
||||||
ucvector v = ucvector_init(*out, *outsize);
|
ucvector v = ucvector_init(*out, *outsize);
|
||||||
unsigned error = lodepng_chunk_createv(&v, length, type, data);
|
unsigned error = lodepng_chunk_createv(&v, length, type, data);
|
||||||
*out = v.data;
|
*out = v.data;
|
||||||
|
@ -3363,7 +3363,7 @@ unsigned lodepng_info_copy(LodePNGInfo* dest, const LodePNGInfo* source) {
|
||||||
static void addColorBits(unsigned char* out, size_t index, unsigned bits, unsigned in) {
|
static void addColorBits(unsigned char* out, size_t index, unsigned bits, unsigned in) {
|
||||||
unsigned m = bits == 1 ? 7 : bits == 2 ? 3 : 1; /*8 / bits - 1*/
|
unsigned m = bits == 1 ? 7 : bits == 2 ? 3 : 1; /*8 / bits - 1*/
|
||||||
/*p = the partial index in the byte, e.g. with 4 palettebits it is 0 for first half or 1 for second half*/
|
/*p = the partial index in the byte, e.g. with 4 palettebits it is 0 for first half or 1 for second half*/
|
||||||
unsigned p = (unsigned)index & m;
|
unsigned p = (unsigned) index & m;
|
||||||
in &= (1u << bits) - 1u; /*filter out any other bits of the input value*/
|
in &= (1u << bits) - 1u; /*filter out any other bits of the input value*/
|
||||||
in = in << (bits * (m - p));
|
in = in << (bits * (m - p));
|
||||||
if(p == 0) out[index * bits / 8u] = in;
|
if(p == 0) out[index * bits / 8u] = in;
|
||||||
|
@ -5889,7 +5889,7 @@ static size_t ilog2i(size_t i) {
|
||||||
l = ilog2(i);
|
l = ilog2(i);
|
||||||
/* approximate i*log2(i): l is integer logarithm, ((i - (1u << l)) << 1u)
|
/* approximate i*log2(i): l is integer logarithm, ((i - (1u << l)) << 1u)
|
||||||
linearly approximates the missing fractional part multiplied by i */
|
linearly approximates the missing fractional part multiplied by i */
|
||||||
return i * l + ((i - ((size_t) 1u << l)) << 1u);
|
return i * l + ((i - (((size_t)1) << l)) << 1u);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h,
|
static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h,
|
|
@ -1001,7 +1001,7 @@ and data separately. The type is a 4-letter string.
|
||||||
The out variable and outsize are updated to reflect the new reallocated buffer.
|
The out variable and outsize are updated to reflect the new reallocated buffer.
|
||||||
Returne error code (0 if it went ok)
|
Returne error code (0 if it went ok)
|
||||||
*/
|
*/
|
||||||
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize, unsigned length,
|
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize, size_t length,
|
||||||
const char* type, const unsigned char* data);
|
const char* type, const unsigned char* data);
|
||||||
|
|
||||||
|
|
|
@ -1,122 +1,122 @@
|
||||||
/*
|
/*
|
||||||
* lowbat.c
|
* lowbat.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 Christoph Gießelink
|
* Copyright (C) 2006 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "io.h" // I/O definitions
|
#include "io.h" // I/O definitions
|
||||||
|
|
||||||
// #define BAT_SIMULATION // switch low bat simulation
|
// #define BAT_SIMULATION // switch low bat simulation
|
||||||
|
|
||||||
#define BAT_FREQ (60*1000) // bat update time in ms (real machine = 60us, HP28C = 60s)
|
#define BAT_FREQ (60*1000) // bat update time in ms (real machine = 60us, HP28C = 60s)
|
||||||
|
|
||||||
BOOL bLowBatDisable = FALSE;
|
BOOL bLowBatDisable = FALSE;
|
||||||
|
|
||||||
static HANDLE hCThreadBat = NULL;
|
static HANDLE hCThreadBat = NULL;
|
||||||
static HANDLE hEventBat;
|
static HANDLE hEventBat;
|
||||||
|
|
||||||
static DWORD WINAPI LowBatThread(LPVOID pParam)
|
static DWORD WINAPI LowBatThread(LPVOID pParam)
|
||||||
{
|
{
|
||||||
BOOL bLBI,bVLBI;
|
BOOL bLBI,bVLBI;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
GetBatteryState(&bLBI,&bVLBI); // get battery state
|
GetBatteryState(&bLBI,&bVLBI); // get battery state
|
||||||
|
|
||||||
// very low bat detection
|
// very low bat detection
|
||||||
bVLBI = bVLBI && (Chipset.IORam[LPE] & EVLBI) != 0;
|
bVLBI = bVLBI && (Chipset.IORam[LPE] & EVLBI) != 0;
|
||||||
|
|
||||||
IOBit(LPD,VLBI,bVLBI); // set VLBI
|
IOBit(LPD,VLBI,bVLBI); // set VLBI
|
||||||
IOBit(SRQ1,VSRQ,bVLBI); // and service bit
|
IOBit(SRQ1,VSRQ,bVLBI); // and service bit
|
||||||
|
|
||||||
if (bVLBI) // VLBI detected
|
if (bVLBI) // VLBI detected
|
||||||
{
|
{
|
||||||
Chipset.SoftInt = TRUE;
|
Chipset.SoftInt = TRUE;
|
||||||
bInterrupt = TRUE;
|
bInterrupt = TRUE;
|
||||||
|
|
||||||
if (Chipset.Shutdn) // CPU shut down
|
if (Chipset.Shutdn) // CPU shut down
|
||||||
{
|
{
|
||||||
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
||||||
SetEvent(hEventShutdn); // wake up emulation thread
|
SetEvent(hEventShutdn); // wake up emulation thread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (WaitForSingleObject(hEventBat,BAT_FREQ) == WAIT_TIMEOUT);
|
while (WaitForSingleObject(hEventBat,BAT_FREQ) == WAIT_TIMEOUT);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
UNREFERENCED_PARAMETER(pParam);
|
UNREFERENCED_PARAMETER(pParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID StartBatMeasure(VOID)
|
VOID StartBatMeasure(VOID)
|
||||||
{
|
{
|
||||||
DWORD dwThreadId;
|
DWORD dwThreadId;
|
||||||
|
|
||||||
if (hCThreadBat) // Bat measuring thread running
|
if (hCThreadBat) // Bat measuring thread running
|
||||||
return; // -> quit
|
return; // -> quit
|
||||||
|
|
||||||
// event to cancel Bat refresh loop
|
// event to cancel Bat refresh loop
|
||||||
hEventBat = CreateEvent(NULL,FALSE,FALSE,NULL);
|
hEventBat = CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||||
|
|
||||||
VERIFY(hCThreadBat = CreateThread(NULL,0,&LowBatThread,NULL,0,&dwThreadId));
|
VERIFY(hCThreadBat = CreateThread(NULL,0,&LowBatThread,NULL,0,&dwThreadId));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID StopBatMeasure(VOID)
|
VOID StopBatMeasure(VOID)
|
||||||
{
|
{
|
||||||
if (hCThreadBat == NULL) // thread stopped
|
if (hCThreadBat == NULL) // thread stopped
|
||||||
return; // -> quit
|
return; // -> quit
|
||||||
|
|
||||||
SetEvent(hEventBat); // leave Bat update thread
|
SetEvent(hEventBat); // leave Bat update thread
|
||||||
WaitForSingleObject(hCThreadBat,INFINITE);
|
WaitForSingleObject(hCThreadBat,INFINITE);
|
||||||
CloseHandle(hCThreadBat);
|
CloseHandle(hCThreadBat);
|
||||||
hCThreadBat = NULL; // set flag Bat update stopped
|
hCThreadBat = NULL; // set flag Bat update stopped
|
||||||
CloseHandle(hEventBat); // close Bat event
|
CloseHandle(hEventBat); // close Bat event
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID GetBatteryState(BOOL *pbLBI, BOOL *pbVLBI)
|
VOID GetBatteryState(BOOL *pbLBI, BOOL *pbVLBI)
|
||||||
{
|
{
|
||||||
#if defined BAT_SIMULATION
|
#if defined BAT_SIMULATION
|
||||||
switch (GetPrivateProfileInt(_T("LowBat"),_T("Level"),2,_T(".\\Lowbat.ini")))
|
switch (GetPrivateProfileInt(_T("LowBat"),_T("Level"),2,_T(".\\Lowbat.ini")))
|
||||||
{
|
{
|
||||||
case 0: // empty
|
case 0: // empty
|
||||||
*pbLBI = TRUE;
|
*pbLBI = TRUE;
|
||||||
*pbVLBI = TRUE;
|
*pbVLBI = TRUE;
|
||||||
break;
|
break;
|
||||||
case 1: // low
|
case 1: // low
|
||||||
*pbLBI = TRUE;
|
*pbLBI = TRUE;
|
||||||
*pbVLBI = FALSE;
|
*pbVLBI = FALSE;
|
||||||
break;
|
break;
|
||||||
default: // full
|
default: // full
|
||||||
*pbLBI = FALSE;
|
*pbLBI = FALSE;
|
||||||
*pbVLBI = FALSE;
|
*pbVLBI = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
SYSTEM_POWER_STATUS sSps;
|
SYSTEM_POWER_STATUS sSps;
|
||||||
|
|
||||||
*pbLBI = FALSE; // no battery warning
|
*pbLBI = FALSE; // no battery warning
|
||||||
*pbVLBI = FALSE;
|
*pbVLBI = FALSE;
|
||||||
|
|
||||||
VERIFY(GetSystemPowerStatus(&sSps));
|
VERIFY(GetSystemPowerStatus(&sSps));
|
||||||
|
|
||||||
// low bat emulation enabled and battery powered
|
// low bat emulation enabled and battery powered
|
||||||
if (!bLowBatDisable && sSps.ACLineStatus == AC_LINE_OFFLINE)
|
if (!bLowBatDisable && sSps.ACLineStatus == AC_LINE_OFFLINE)
|
||||||
{
|
{
|
||||||
// on critical battery state make sure that lowbat flag is also set
|
// on critical battery state make sure that lowbat flag is also set
|
||||||
if ((sSps.BatteryFlag & BATTERY_FLAG_CRITICAL) != 0)
|
if ((sSps.BatteryFlag & BATTERY_FLAG_CRITICAL) != 0)
|
||||||
sSps.BatteryFlag |= BATTERY_FLAG_LOW;
|
sSps.BatteryFlag |= BATTERY_FLAG_LOW;
|
||||||
|
|
||||||
// low bat detection
|
// low bat detection
|
||||||
*pbLBI = ((sSps.BatteryFlag & BATTERY_FLAG_LOW) != 0);
|
*pbLBI = ((sSps.BatteryFlag & BATTERY_FLAG_LOW) != 0);
|
||||||
|
|
||||||
// very low bat detection
|
// very low bat detection
|
||||||
*pbVLBI = ((sSps.BatteryFlag & BATTERY_FLAG_CRITICAL) != 0);
|
*pbVLBI = ((sSps.BatteryFlag & BATTERY_FLAG_CRITICAL) != 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,380 +1,380 @@
|
||||||
/*
|
/*
|
||||||
* mru.c
|
* mru.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Christoph Gießelink
|
* Copyright (C) 2007 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
|
|
||||||
static TCHAR szOriginal[MAX_PATH] = _T("");
|
static TCHAR szOriginal[MAX_PATH] = _T("");
|
||||||
|
|
||||||
static LPTSTR *ppszFiles = NULL; // pointer to MRU table
|
static LPTSTR *ppszFiles = NULL; // pointer to MRU table
|
||||||
static UINT nEntry = 0; // no. of MRU entries
|
static UINT nEntry = 0; // no. of MRU entries
|
||||||
|
|
||||||
static BOOL GetMenuPosForId(HMENU hMenu, UINT nItem, HMENU *phMruMenu, UINT *pnMruPos)
|
static BOOL GetMenuPosForId(HMENU hMenu, UINT nItem, HMENU *phMruMenu, UINT *pnMruPos)
|
||||||
{
|
{
|
||||||
HMENU hSubMenu;
|
HMENU hSubMenu;
|
||||||
UINT i,nID,nMaxID;
|
UINT i,nID,nMaxID;
|
||||||
|
|
||||||
nMaxID = GetMenuItemCount(hMenu);
|
nMaxID = GetMenuItemCount(hMenu);
|
||||||
for (i = 0; i < nMaxID; ++i)
|
for (i = 0; i < nMaxID; ++i)
|
||||||
{
|
{
|
||||||
nID = GetMenuItemID(hMenu,i); // get ID
|
nID = GetMenuItemID(hMenu,i); // get ID
|
||||||
|
|
||||||
if (nID == 0) continue; // separator or invalid command
|
if (nID == 0) continue; // separator or invalid command
|
||||||
|
|
||||||
if (nID == (UINT)-1) // possibly a popup menu
|
if (nID == (UINT)-1) // possibly a popup menu
|
||||||
{
|
{
|
||||||
hSubMenu = GetSubMenu(hMenu,i); // try to get handle to popup menu
|
hSubMenu = GetSubMenu(hMenu,i); // try to get handle to popup menu
|
||||||
if (hSubMenu != NULL) // it's a popup menu
|
if (hSubMenu != NULL) // it's a popup menu
|
||||||
{
|
{
|
||||||
// recursive search
|
// recursive search
|
||||||
if (GetMenuPosForId(hSubMenu,nItem,phMruMenu,pnMruPos))
|
if (GetMenuPosForId(hSubMenu,nItem,phMruMenu,pnMruPos))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nID == nItem) // found ID
|
if (nID == nItem) // found ID
|
||||||
{
|
{
|
||||||
*phMruMenu = hMenu; // remember menu and position
|
*phMruMenu = hMenu; // remember menu and position
|
||||||
*pnMruPos = i;
|
*pnMruPos = i;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL MruInit(UINT nNum)
|
BOOL MruInit(UINT nNum)
|
||||||
{
|
{
|
||||||
HMENU hMenu = GetMenu(hWnd); // main menu
|
HMENU hMenu = GetMenu(hWnd); // main menu
|
||||||
if (hMenu == NULL) return FALSE; // failed, no menu bar
|
if (hMenu == NULL) return FALSE; // failed, no menu bar
|
||||||
|
|
||||||
_ASSERT(ppszFiles == NULL); // MRU already initialized
|
_ASSERT(ppszFiles == NULL); // MRU already initialized
|
||||||
|
|
||||||
// no. of files in MRU list
|
// no. of files in MRU list
|
||||||
nEntry = ReadSettingsInt(_T("MRU"),_T("FileCount"),nNum);
|
nEntry = ReadSettingsInt(_T("MRU"),_T("FileCount"),nNum);
|
||||||
|
|
||||||
if (nEntry > 0) // allocate MRU table
|
if (nEntry > 0) // allocate MRU table
|
||||||
{
|
{
|
||||||
// create MRU table
|
// create MRU table
|
||||||
if ((ppszFiles = (LPTSTR *) malloc(nEntry * sizeof(*ppszFiles))) == NULL)
|
if ((ppszFiles = (LPTSTR *) malloc(nEntry * sizeof(*ppszFiles))) == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// fill each entry
|
// fill each entry
|
||||||
for (nNum = 0; nNum < nEntry; ++nNum)
|
for (nNum = 0; nNum < nEntry; ++nNum)
|
||||||
ppszFiles[nNum] = NULL;
|
ppszFiles[nNum] = NULL;
|
||||||
|
|
||||||
MruReadList(); // read actual MRU list
|
MruReadList(); // read actual MRU list
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MruCleanup(VOID)
|
VOID MruCleanup(VOID)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
MruWriteList(); // write actual MRU list
|
MruWriteList(); // write actual MRU list
|
||||||
|
|
||||||
if (ppszFiles != NULL) // table defined
|
if (ppszFiles != NULL) // table defined
|
||||||
{
|
{
|
||||||
for (i = 0; i < nEntry; ++i) // cleanup each entry
|
for (i = 0; i < nEntry; ++i) // cleanup each entry
|
||||||
{
|
{
|
||||||
if (ppszFiles[i] != NULL) // valid entry
|
if (ppszFiles[i] != NULL) // valid entry
|
||||||
free(ppszFiles[i]); // cleanup entry
|
free(ppszFiles[i]); // cleanup entry
|
||||||
}
|
}
|
||||||
|
|
||||||
free(ppszFiles); // free table
|
free(ppszFiles); // free table
|
||||||
ppszFiles = NULL;
|
ppszFiles = NULL;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MruAdd(LPCTSTR lpszEntry)
|
VOID MruAdd(LPCTSTR lpszEntry)
|
||||||
{
|
{
|
||||||
TCHAR szFilename[MAX_PATH];
|
TCHAR szFilename[MAX_PATH];
|
||||||
LPTSTR lpFilePart;
|
LPTSTR lpFilePart;
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
if (ppszFiles != NULL) // MRU initialized
|
if (ppszFiles != NULL) // MRU initialized
|
||||||
{
|
{
|
||||||
_ASSERT(nEntry > 0); // must have entries
|
_ASSERT(nEntry > 0); // must have entries
|
||||||
|
|
||||||
// get full path name
|
// get full path name
|
||||||
GetFullPathName(lpszEntry,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart);
|
GetFullPathName(lpszEntry,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart);
|
||||||
|
|
||||||
// look if entry is already in table
|
// look if entry is already in table
|
||||||
for (i = 0; i < nEntry; ++i)
|
for (i = 0; i < nEntry; ++i)
|
||||||
{
|
{
|
||||||
// already in table -> quit
|
// already in table -> quit
|
||||||
if ( ppszFiles[i] != NULL // valid entry
|
if ( ppszFiles[i] != NULL // valid entry
|
||||||
&& lstrcmpi(ppszFiles[i],szFilename) == 0)
|
&& lstrcmpi(ppszFiles[i],szFilename) == 0)
|
||||||
{
|
{
|
||||||
MruMoveTop(i); // move to top and update menu
|
MruMoveTop(i); // move to top and update menu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = nEntry - 1; // last index
|
i = nEntry - 1; // last index
|
||||||
if (ppszFiles[i] != NULL) // valid entry
|
if (ppszFiles[i] != NULL) // valid entry
|
||||||
free(ppszFiles[i]); // free oldest entry
|
free(ppszFiles[i]); // free oldest entry
|
||||||
|
|
||||||
for (; i > 0; --i) // move old entries 1 line down
|
for (; i > 0; --i) // move old entries 1 line down
|
||||||
{
|
{
|
||||||
ppszFiles[i] = ppszFiles[i-1];
|
ppszFiles[i] = ppszFiles[i-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// add new entry to top
|
// add new entry to top
|
||||||
ppszFiles[0] = DuplicateString(szFilename);
|
ppszFiles[0] = DuplicateString(szFilename);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MruRemove(UINT nIndex)
|
VOID MruRemove(UINT nIndex)
|
||||||
{
|
{
|
||||||
// MRU initialized and index inside valid range
|
// MRU initialized and index inside valid range
|
||||||
if (ppszFiles != NULL && nIndex < nEntry)
|
if (ppszFiles != NULL && nIndex < nEntry)
|
||||||
{
|
{
|
||||||
free(ppszFiles[nIndex]); // free entry
|
free(ppszFiles[nIndex]); // free entry
|
||||||
|
|
||||||
for (; nIndex < nEntry - 1; ++nIndex) // move below entries 1 line up
|
for (; nIndex < nEntry - 1; ++nIndex) // move below entries 1 line up
|
||||||
{
|
{
|
||||||
ppszFiles[nIndex] = ppszFiles[nIndex+1];
|
ppszFiles[nIndex] = ppszFiles[nIndex+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
ppszFiles[nIndex] = NULL; // clear last line
|
ppszFiles[nIndex] = NULL; // clear last line
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MruMoveTop(UINT nIndex)
|
VOID MruMoveTop(UINT nIndex)
|
||||||
{
|
{
|
||||||
// MRU initialized and index inside valid range
|
// MRU initialized and index inside valid range
|
||||||
if (ppszFiles != NULL && nIndex < nEntry)
|
if (ppszFiles != NULL && nIndex < nEntry)
|
||||||
{
|
{
|
||||||
LPTSTR lpszEntry = ppszFiles[nIndex];// remember selected entry
|
LPTSTR lpszEntry = ppszFiles[nIndex];// remember selected entry
|
||||||
|
|
||||||
for (; nIndex > 0; --nIndex) // move above entries 1 line down
|
for (; nIndex > 0; --nIndex) // move above entries 1 line down
|
||||||
{
|
{
|
||||||
ppszFiles[nIndex] = ppszFiles[nIndex-1];
|
ppszFiles[nIndex] = ppszFiles[nIndex-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
ppszFiles[0] = lpszEntry; // insert entry on top
|
ppszFiles[0] = lpszEntry; // insert entry on top
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT MruEntries(VOID)
|
UINT MruEntries(VOID)
|
||||||
{
|
{
|
||||||
return nEntry;
|
return nEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT MruID(LPCTSTR lpszEntry)
|
UINT MruID(LPCTSTR lpszEntry)
|
||||||
{
|
{
|
||||||
TCHAR szFilename[MAX_PATH];
|
TCHAR szFilename[MAX_PATH];
|
||||||
LPTSTR lpFilePart;
|
LPTSTR lpFilePart;
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
if (ppszFiles != NULL) // MRU initialized
|
if (ppszFiles != NULL) // MRU initialized
|
||||||
{
|
{
|
||||||
_ASSERT(nEntry > 0); // must have entries
|
_ASSERT(nEntry > 0); // must have entries
|
||||||
|
|
||||||
// get full path name
|
// get full path name
|
||||||
GetFullPathName(lpszEntry,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart);
|
GetFullPathName(lpszEntry,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart);
|
||||||
|
|
||||||
// look if entry is already in table
|
// look if entry is already in table
|
||||||
for (i = 0; i < nEntry; ++i)
|
for (i = 0; i < nEntry; ++i)
|
||||||
{
|
{
|
||||||
if ( ppszFiles[i] != NULL // valid entry
|
if ( ppszFiles[i] != NULL // valid entry
|
||||||
&& lstrcmpi(ppszFiles[i],szFilename) == 0)
|
&& lstrcmpi(ppszFiles[i],szFilename) == 0)
|
||||||
{
|
{
|
||||||
return i; // return ID
|
return i; // return ID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (UINT) -1; // not found
|
return (UINT) -1; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MruFilename(UINT nIndex, LPTSTR szFilename, UINT nBuffersize)
|
VOID MruFilename(UINT nIndex, LPTSTR szFilename, UINT nBuffersize)
|
||||||
{
|
{
|
||||||
*szFilename = 0; // not found
|
*szFilename = 0; // not found
|
||||||
|
|
||||||
// MRU initialized and index inside valid range
|
// MRU initialized and index inside valid range
|
||||||
if (ppszFiles != NULL && nIndex < nEntry)
|
if (ppszFiles != NULL && nIndex < nEntry)
|
||||||
{
|
{
|
||||||
_ASSERT(ppszFiles[nIndex] != NULL); // valid entry
|
_ASSERT(ppszFiles[nIndex] != NULL); // valid entry
|
||||||
lstrcpyn(szFilename,ppszFiles[nIndex],nBuffersize);
|
lstrcpyn(szFilename,ppszFiles[nIndex],nBuffersize);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MruUpdateMenu(HMENU hMenu)
|
VOID MruUpdateMenu(HMENU hMenu)
|
||||||
{
|
{
|
||||||
TCHAR szCurPath[MAX_PATH];
|
TCHAR szCurPath[MAX_PATH];
|
||||||
BOOL bEmpty;
|
BOOL bEmpty;
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
if (hMenu != NULL) // have menu
|
if (hMenu != NULL) // have menu
|
||||||
{
|
{
|
||||||
HMENU hMruMenu; // menu handle for MRU list
|
HMENU hMruMenu; // menu handle for MRU list
|
||||||
UINT nMruPos; // insert position for MRU list
|
UINT nMruPos; // insert position for MRU list
|
||||||
|
|
||||||
_ASSERT(IsMenu(hMenu)); // validate menu handle
|
_ASSERT(IsMenu(hMenu)); // validate menu handle
|
||||||
|
|
||||||
// search for menu position of ID_FILE_MRU_FILE1
|
// search for menu position of ID_FILE_MRU_FILE1
|
||||||
if (GetMenuPosForId(hMenu,ID_FILE_MRU_FILE1,&hMruMenu,&nMruPos))
|
if (GetMenuPosForId(hMenu,ID_FILE_MRU_FILE1,&hMruMenu,&nMruPos))
|
||||||
{
|
{
|
||||||
if (*szOriginal == 0) // get orginal value of first MRU entry
|
if (*szOriginal == 0) // get orginal value of first MRU entry
|
||||||
{
|
{
|
||||||
VERIFY(GetMenuString(hMruMenu,nMruPos,szOriginal,ARRAYSIZEOF(szOriginal),MF_BYPOSITION));
|
VERIFY(GetMenuString(hMruMenu,nMruPos,szOriginal,ARRAYSIZEOF(szOriginal),MF_BYPOSITION));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nEntry == 0) // kill MRU menu entry
|
if (nEntry == 0) // kill MRU menu entry
|
||||||
{
|
{
|
||||||
// delete MRU menu
|
// delete MRU menu
|
||||||
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
|
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
|
||||||
|
|
||||||
// delete the following separator
|
// delete the following separator
|
||||||
_ASSERT((GetMenuState(hMruMenu,nMruPos,MF_BYPOSITION) & MF_SEPARATOR) != 0);
|
_ASSERT((GetMenuState(hMruMenu,nMruPos,MF_BYPOSITION) & MF_SEPARATOR) != 0);
|
||||||
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
|
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppszFiles != NULL) // MRU initialized
|
if (ppszFiles != NULL) // MRU initialized
|
||||||
{
|
{
|
||||||
_ASSERT(nEntry > 0); // must have entries
|
_ASSERT(nEntry > 0); // must have entries
|
||||||
|
|
||||||
// delete all menu entries
|
// delete all menu entries
|
||||||
for (i = 0; DeleteMenu(hMenu,ID_FILE_MRU_FILE1+i,MF_BYCOMMAND) != FALSE; ++i) { }
|
for (i = 0; DeleteMenu(hMenu,ID_FILE_MRU_FILE1+i,MF_BYCOMMAND) != FALSE; ++i) { }
|
||||||
|
|
||||||
// check if MRU list is empty
|
// check if MRU list is empty
|
||||||
for (bEmpty = TRUE, i = 0; bEmpty && i < nEntry; ++i)
|
for (bEmpty = TRUE, i = 0; bEmpty && i < nEntry; ++i)
|
||||||
{
|
{
|
||||||
bEmpty = (ppszFiles[i] == NULL);
|
bEmpty = (ppszFiles[i] == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bEmpty) // MRU list is empty
|
if (bEmpty) // MRU list is empty
|
||||||
{
|
{
|
||||||
// fill with orginal string
|
// fill with orginal string
|
||||||
VERIFY(InsertMenu(hMruMenu,nMruPos,MF_STRING|MF_BYPOSITION|MF_GRAYED,ID_FILE_MRU_FILE1,szOriginal));
|
VERIFY(InsertMenu(hMruMenu,nMruPos,MF_STRING|MF_BYPOSITION|MF_GRAYED,ID_FILE_MRU_FILE1,szOriginal));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// current directory
|
// current directory
|
||||||
GetCurrentDirectory(ARRAYSIZEOF(szCurPath),szCurPath);
|
GetCurrentDirectory(ARRAYSIZEOF(szCurPath),szCurPath);
|
||||||
|
|
||||||
for (i = 0; i < nEntry; ++i) // add menu entries
|
for (i = 0; i < nEntry; ++i) // add menu entries
|
||||||
{
|
{
|
||||||
if (ppszFiles[i] != NULL) // valid entry
|
if (ppszFiles[i] != NULL) // valid entry
|
||||||
{
|
{
|
||||||
TCHAR szMenuname[2*MAX_PATH+3];
|
TCHAR szMenuname[2*MAX_PATH+3];
|
||||||
TCHAR szFilename[MAX_PATH];
|
TCHAR szFilename[MAX_PATH];
|
||||||
LPTSTR lpFilePart,lpszPtr;
|
LPTSTR lpFilePart,lpszPtr;
|
||||||
|
|
||||||
// check if file path and current path is identical
|
// check if file path and current path is identical
|
||||||
if (GetFullPathName(ppszFiles[i],ARRAYSIZEOF(szFilename),szFilename,&lpFilePart))
|
if (GetFullPathName(ppszFiles[i],ARRAYSIZEOF(szFilename),szFilename,&lpFilePart))
|
||||||
{
|
{
|
||||||
TCHAR szCutname[MAX_PATH];
|
TCHAR szCutname[MAX_PATH];
|
||||||
|
|
||||||
*(lpFilePart-1) = 0; // devide path and name
|
*(lpFilePart-1) = 0; // devide path and name
|
||||||
|
|
||||||
// name is current directory -> use only name
|
// name is current directory -> use only name
|
||||||
if (lstrcmpi(szCurPath,szFilename) == 0)
|
if (lstrcmpi(szCurPath,szFilename) == 0)
|
||||||
{
|
{
|
||||||
// short name view
|
// short name view
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// full name view
|
// full name view
|
||||||
lpFilePart = ppszFiles[i];
|
lpFilePart = ppszFiles[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// cut filename to fit into menu
|
// cut filename to fit into menu
|
||||||
GetCutPathName(lpFilePart,szCutname,ARRAYSIZEOF(szCutname),36);
|
GetCutPathName(lpFilePart,szCutname,ARRAYSIZEOF(szCutname),36);
|
||||||
lpFilePart = szCutname;
|
lpFilePart = szCutname;
|
||||||
|
|
||||||
// adding accelerator key
|
// adding accelerator key
|
||||||
lpszPtr = szMenuname;
|
lpszPtr = szMenuname;
|
||||||
*lpszPtr++ = _T('&');
|
*lpszPtr++ = _T('&');
|
||||||
*lpszPtr++ = _T('0') + ((i + 1) % 10);
|
*lpszPtr++ = _T('0') + ((i + 1) % 10);
|
||||||
*lpszPtr++ = _T(' ');
|
*lpszPtr++ = _T(' ');
|
||||||
|
|
||||||
// copy file to view buffer and expand & to &&
|
// copy file to view buffer and expand & to &&
|
||||||
while (*lpFilePart != 0)
|
while (*lpFilePart != 0)
|
||||||
{
|
{
|
||||||
if (*lpFilePart == _T('&'))
|
if (*lpFilePart == _T('&'))
|
||||||
{
|
{
|
||||||
*lpszPtr++ = *lpFilePart;
|
*lpszPtr++ = *lpFilePart;
|
||||||
}
|
}
|
||||||
*lpszPtr++ = *lpFilePart++;
|
*lpszPtr++ = *lpFilePart++;
|
||||||
}
|
}
|
||||||
*lpszPtr = 0;
|
*lpszPtr = 0;
|
||||||
|
|
||||||
VERIFY(InsertMenu(hMruMenu,nMruPos+i,
|
VERIFY(InsertMenu(hMruMenu,nMruPos+i,
|
||||||
MF_STRING|MF_BYPOSITION,ID_FILE_MRU_FILE1+i,
|
MF_STRING|MF_BYPOSITION,ID_FILE_MRU_FILE1+i,
|
||||||
szMenuname));
|
szMenuname));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MruWriteList(VOID)
|
VOID MruWriteList(VOID)
|
||||||
{
|
{
|
||||||
TCHAR szItemname[32];
|
TCHAR szItemname[32];
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
if (nEntry > 0)
|
if (nEntry > 0)
|
||||||
{
|
{
|
||||||
// no. of files in MRU list
|
// no. of files in MRU list
|
||||||
WriteSettingsInt(_T("MRU"),_T("FileCount"),nEntry);
|
WriteSettingsInt(_T("MRU"),_T("FileCount"),nEntry);
|
||||||
|
|
||||||
for (i = 0; i < nEntry; ++i) // add menu entries
|
for (i = 0; i < nEntry; ++i) // add menu entries
|
||||||
{
|
{
|
||||||
_ASSERT(ppszFiles != NULL); // MRU not initialized
|
_ASSERT(ppszFiles != NULL); // MRU not initialized
|
||||||
wsprintf(szItemname,_T("File%d"),i+1);
|
wsprintf(szItemname,_T("File%d"),i+1);
|
||||||
if (ppszFiles[i] != NULL) // valid entry
|
if (ppszFiles[i] != NULL) // valid entry
|
||||||
{
|
{
|
||||||
WriteSettingsString(_T("MRU"),szItemname,ppszFiles[i]);
|
WriteSettingsString(_T("MRU"),szItemname,ppszFiles[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DelSettingsKey(_T("MRU"),szItemname);
|
DelSettingsKey(_T("MRU"),szItemname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID MruReadList(VOID)
|
VOID MruReadList(VOID)
|
||||||
{
|
{
|
||||||
TCHAR szFilename[MAX_PATH];
|
TCHAR szFilename[MAX_PATH];
|
||||||
TCHAR szItemname[32];
|
TCHAR szItemname[32];
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
for (i = 0; i < nEntry; ++i) // add menu entries
|
for (i = 0; i < nEntry; ++i) // add menu entries
|
||||||
{
|
{
|
||||||
_ASSERT(ppszFiles != NULL); // MRU not initialized
|
_ASSERT(ppszFiles != NULL); // MRU not initialized
|
||||||
|
|
||||||
wsprintf(szItemname,_T("File%d"),i+1);
|
wsprintf(szItemname,_T("File%d"),i+1);
|
||||||
ReadSettingsString(_T("MRU"),szItemname,_T(""),szFilename,ARRAYSIZEOF(szFilename));
|
ReadSettingsString(_T("MRU"),szItemname,_T(""),szFilename,ARRAYSIZEOF(szFilename));
|
||||||
|
|
||||||
if (ppszFiles[i] != NULL) // valid entry
|
if (ppszFiles[i] != NULL) // valid entry
|
||||||
{
|
{
|
||||||
free(ppszFiles[i]); // free entry
|
free(ppszFiles[i]); // free entry
|
||||||
ppszFiles[i] = NULL; // clear last line
|
ppszFiles[i] = NULL; // clear last line
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*szFilename) // read a valid entry
|
if (*szFilename) // read a valid entry
|
||||||
{
|
{
|
||||||
ppszFiles[i] = DuplicateString(szFilename);
|
ppszFiles[i] = DuplicateString(szFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,443 +1,443 @@
|
||||||
/*
|
/*
|
||||||
* opcodes.h
|
* opcodes.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Christoph Gießelink
|
* Copyright (C) 1999 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PCHANGED ((void)(F_s[0]=Chipset.P,F_l[1]=Chipset.P+1))
|
#define PCHANGED ((void)(F_s[0]=Chipset.P,F_l[1]=Chipset.P+1))
|
||||||
#define INTERRUPT ((void)(Chipset.SoftInt=TRUE,bInterrupt=TRUE))
|
#define INTERRUPT ((void)(Chipset.SoftInt=TRUE,bInterrupt=TRUE))
|
||||||
|
|
||||||
extern UINT F_s[16];
|
extern UINT F_s[16];
|
||||||
extern UINT F_l[16];
|
extern UINT F_l[16];
|
||||||
|
|
||||||
extern VOID o00(LPBYTE I); // RTNSXM
|
extern VOID o00(LPBYTE I); // RTNSXM
|
||||||
extern VOID o01(LPBYTE I); // RTN
|
extern VOID o01(LPBYTE I); // RTN
|
||||||
extern VOID o02(LPBYTE I); // RTNSC
|
extern VOID o02(LPBYTE I); // RTNSC
|
||||||
extern VOID o03(LPBYTE I); // RTNCC
|
extern VOID o03(LPBYTE I); // RTNCC
|
||||||
extern VOID o04(LPBYTE I); // SETHEX
|
extern VOID o04(LPBYTE I); // SETHEX
|
||||||
extern VOID o05(LPBYTE I); // SETDEC
|
extern VOID o05(LPBYTE I); // SETDEC
|
||||||
extern VOID o06(LPBYTE I); // RSTK=C
|
extern VOID o06(LPBYTE I); // RSTK=C
|
||||||
extern VOID o07(LPBYTE I); // C=RSTK
|
extern VOID o07(LPBYTE I); // C=RSTK
|
||||||
extern VOID o08(LPBYTE I); // CLRST
|
extern VOID o08(LPBYTE I); // CLRST
|
||||||
extern VOID o09(LPBYTE I); // C=ST
|
extern VOID o09(LPBYTE I); // C=ST
|
||||||
extern VOID o0A(LPBYTE I); // ST=C
|
extern VOID o0A(LPBYTE I); // ST=C
|
||||||
extern VOID o0B(LPBYTE I); // CSTEX
|
extern VOID o0B(LPBYTE I); // CSTEX
|
||||||
extern VOID o0C(LPBYTE I); // P=P+1
|
extern VOID o0C(LPBYTE I); // P=P+1
|
||||||
extern VOID o0D(LPBYTE I); // P=P-1
|
extern VOID o0D(LPBYTE I); // P=P-1
|
||||||
extern VOID o0Ef0(LPBYTE I); // A=A&B f
|
extern VOID o0Ef0(LPBYTE I); // A=A&B f
|
||||||
extern VOID o0Ef1(LPBYTE I); // B=B&C f
|
extern VOID o0Ef1(LPBYTE I); // B=B&C f
|
||||||
extern VOID o0Ef2(LPBYTE I); // C=C&A f
|
extern VOID o0Ef2(LPBYTE I); // C=C&A f
|
||||||
extern VOID o0Ef3(LPBYTE I); // D=D&C f
|
extern VOID o0Ef3(LPBYTE I); // D=D&C f
|
||||||
extern VOID o0Ef4(LPBYTE I); // B=B&A f
|
extern VOID o0Ef4(LPBYTE I); // B=B&A f
|
||||||
extern VOID o0Ef5(LPBYTE I); // C=C&B f
|
extern VOID o0Ef5(LPBYTE I); // C=C&B f
|
||||||
extern VOID o0Ef6(LPBYTE I); // A=A&C f
|
extern VOID o0Ef6(LPBYTE I); // A=A&C f
|
||||||
extern VOID o0Ef7(LPBYTE I); // C=C&D f
|
extern VOID o0Ef7(LPBYTE I); // C=C&D f
|
||||||
extern VOID o0Ef8(LPBYTE I); // A=A!B f
|
extern VOID o0Ef8(LPBYTE I); // A=A!B f
|
||||||
extern VOID o0Ef9(LPBYTE I); // B=B!C f
|
extern VOID o0Ef9(LPBYTE I); // B=B!C f
|
||||||
extern VOID o0EfA(LPBYTE I); // C=C!A f
|
extern VOID o0EfA(LPBYTE I); // C=C!A f
|
||||||
extern VOID o0EfB(LPBYTE I); // D=D!C f
|
extern VOID o0EfB(LPBYTE I); // D=D!C f
|
||||||
extern VOID o0EfC(LPBYTE I); // B=B!A f
|
extern VOID o0EfC(LPBYTE I); // B=B!A f
|
||||||
extern VOID o0EfD(LPBYTE I); // C=C!B f
|
extern VOID o0EfD(LPBYTE I); // C=C!B f
|
||||||
extern VOID o0EfE(LPBYTE I); // A=A!C f
|
extern VOID o0EfE(LPBYTE I); // A=A!C f
|
||||||
extern VOID o0EfF(LPBYTE I); // C=C!D f
|
extern VOID o0EfF(LPBYTE I); // C=C!D f
|
||||||
extern VOID o0F(LPBYTE I); // RTI
|
extern VOID o0F(LPBYTE I); // RTI
|
||||||
extern VOID o100(LPBYTE I); // R0=A W
|
extern VOID o100(LPBYTE I); // R0=A W
|
||||||
extern VOID o101(LPBYTE I); // R1=A W
|
extern VOID o101(LPBYTE I); // R1=A W
|
||||||
extern VOID o102(LPBYTE I); // R2=A W
|
extern VOID o102(LPBYTE I); // R2=A W
|
||||||
extern VOID o103(LPBYTE I); // R3=A W
|
extern VOID o103(LPBYTE I); // R3=A W
|
||||||
extern VOID o104(LPBYTE I); // R4=A W
|
extern VOID o104(LPBYTE I); // R4=A W
|
||||||
extern VOID o108(LPBYTE I); // R0=C W
|
extern VOID o108(LPBYTE I); // R0=C W
|
||||||
extern VOID o109(LPBYTE I); // R1=C W
|
extern VOID o109(LPBYTE I); // R1=C W
|
||||||
extern VOID o10A(LPBYTE I); // R2=C W
|
extern VOID o10A(LPBYTE I); // R2=C W
|
||||||
extern VOID o10B(LPBYTE I); // R3=C W
|
extern VOID o10B(LPBYTE I); // R3=C W
|
||||||
extern VOID o10C(LPBYTE I); // R4=C W
|
extern VOID o10C(LPBYTE I); // R4=C W
|
||||||
extern VOID o110(LPBYTE I); // A=R0 W
|
extern VOID o110(LPBYTE I); // A=R0 W
|
||||||
extern VOID o111(LPBYTE I); // A=R1 W
|
extern VOID o111(LPBYTE I); // A=R1 W
|
||||||
extern VOID o112(LPBYTE I); // A=R2 W
|
extern VOID o112(LPBYTE I); // A=R2 W
|
||||||
extern VOID o113(LPBYTE I); // A=R3 W
|
extern VOID o113(LPBYTE I); // A=R3 W
|
||||||
extern VOID o114(LPBYTE I); // A=R4 W
|
extern VOID o114(LPBYTE I); // A=R4 W
|
||||||
extern VOID o118(LPBYTE I); // C=R0 W
|
extern VOID o118(LPBYTE I); // C=R0 W
|
||||||
extern VOID o119(LPBYTE I); // C=R1 W
|
extern VOID o119(LPBYTE I); // C=R1 W
|
||||||
extern VOID o11A(LPBYTE I); // C=R2 W
|
extern VOID o11A(LPBYTE I); // C=R2 W
|
||||||
extern VOID o11B(LPBYTE I); // C=R3 W
|
extern VOID o11B(LPBYTE I); // C=R3 W
|
||||||
extern VOID o11C(LPBYTE I); // C=R4 W
|
extern VOID o11C(LPBYTE I); // C=R4 W
|
||||||
extern VOID o120(LPBYTE I); // AR0EX W
|
extern VOID o120(LPBYTE I); // AR0EX W
|
||||||
extern VOID o121(LPBYTE I); // AR1EX W
|
extern VOID o121(LPBYTE I); // AR1EX W
|
||||||
extern VOID o122(LPBYTE I); // AR2EX W
|
extern VOID o122(LPBYTE I); // AR2EX W
|
||||||
extern VOID o123(LPBYTE I); // AR3EX W
|
extern VOID o123(LPBYTE I); // AR3EX W
|
||||||
extern VOID o124(LPBYTE I); // AR4EX W
|
extern VOID o124(LPBYTE I); // AR4EX W
|
||||||
extern VOID o128(LPBYTE I); // CR0EX W
|
extern VOID o128(LPBYTE I); // CR0EX W
|
||||||
extern VOID o129(LPBYTE I); // CR1EX W
|
extern VOID o129(LPBYTE I); // CR1EX W
|
||||||
extern VOID o12A(LPBYTE I); // CR2EX W
|
extern VOID o12A(LPBYTE I); // CR2EX W
|
||||||
extern VOID o12B(LPBYTE I); // CR3EX W
|
extern VOID o12B(LPBYTE I); // CR3EX W
|
||||||
extern VOID o12C(LPBYTE I); // CR4EX W
|
extern VOID o12C(LPBYTE I); // CR4EX W
|
||||||
extern VOID o130(LPBYTE I); // D0=A
|
extern VOID o130(LPBYTE I); // D0=A
|
||||||
extern VOID o131(LPBYTE I); // D1=A
|
extern VOID o131(LPBYTE I); // D1=A
|
||||||
extern VOID o132(LPBYTE I); // AD0EX
|
extern VOID o132(LPBYTE I); // AD0EX
|
||||||
extern VOID o133(LPBYTE I); // AD1EX
|
extern VOID o133(LPBYTE I); // AD1EX
|
||||||
extern VOID o134(LPBYTE I); // D0=C
|
extern VOID o134(LPBYTE I); // D0=C
|
||||||
extern VOID o135(LPBYTE I); // D1=C
|
extern VOID o135(LPBYTE I); // D1=C
|
||||||
extern VOID o136(LPBYTE I); // CD0EX
|
extern VOID o136(LPBYTE I); // CD0EX
|
||||||
extern VOID o137(LPBYTE I); // CD1EX
|
extern VOID o137(LPBYTE I); // CD1EX
|
||||||
extern VOID o138(LPBYTE I); // D0=AS
|
extern VOID o138(LPBYTE I); // D0=AS
|
||||||
extern VOID o139(LPBYTE I); // D1=AS
|
extern VOID o139(LPBYTE I); // D1=AS
|
||||||
extern VOID o13A(LPBYTE I); // AD0XS
|
extern VOID o13A(LPBYTE I); // AD0XS
|
||||||
extern VOID o13B(LPBYTE I); // AD1XS
|
extern VOID o13B(LPBYTE I); // AD1XS
|
||||||
extern VOID o13C(LPBYTE I); // D0=CS
|
extern VOID o13C(LPBYTE I); // D0=CS
|
||||||
extern VOID o13D(LPBYTE I); // D1=CS
|
extern VOID o13D(LPBYTE I); // D1=CS
|
||||||
extern VOID o13E(LPBYTE I); // CD0XS
|
extern VOID o13E(LPBYTE I); // CD0XS
|
||||||
extern VOID o13F(LPBYTE I); // CD1XS
|
extern VOID o13F(LPBYTE I); // CD1XS
|
||||||
extern VOID o140(LPBYTE I); // DAT0=A A
|
extern VOID o140(LPBYTE I); // DAT0=A A
|
||||||
extern VOID o141(LPBYTE I); // DAT0=A A
|
extern VOID o141(LPBYTE I); // DAT0=A A
|
||||||
extern VOID o144(LPBYTE I); // DAT0=C A
|
extern VOID o144(LPBYTE I); // DAT0=C A
|
||||||
extern VOID o145(LPBYTE I); // DAT1=C A
|
extern VOID o145(LPBYTE I); // DAT1=C A
|
||||||
extern VOID o148(LPBYTE I); // DAT0=A B
|
extern VOID o148(LPBYTE I); // DAT0=A B
|
||||||
extern VOID o149(LPBYTE I); // DAT1=A B
|
extern VOID o149(LPBYTE I); // DAT1=A B
|
||||||
extern VOID o14C(LPBYTE I); // DAT0=C B
|
extern VOID o14C(LPBYTE I); // DAT0=C B
|
||||||
extern VOID o14D(LPBYTE I); // DAT1=C B
|
extern VOID o14D(LPBYTE I); // DAT1=C B
|
||||||
extern VOID o142(LPBYTE I); // A=DAT0 A
|
extern VOID o142(LPBYTE I); // A=DAT0 A
|
||||||
extern VOID o143(LPBYTE I); // A=DAT1 A
|
extern VOID o143(LPBYTE I); // A=DAT1 A
|
||||||
extern VOID o146(LPBYTE I); // C=DAT0 A
|
extern VOID o146(LPBYTE I); // C=DAT0 A
|
||||||
extern VOID o147(LPBYTE I); // C=DAT1 A
|
extern VOID o147(LPBYTE I); // C=DAT1 A
|
||||||
extern VOID o14A(LPBYTE I); // A=DAT0 B
|
extern VOID o14A(LPBYTE I); // A=DAT0 B
|
||||||
extern VOID o14B(LPBYTE I); // A=DAT1 B
|
extern VOID o14B(LPBYTE I); // A=DAT1 B
|
||||||
extern VOID o14E(LPBYTE I); // C=DAT0 B
|
extern VOID o14E(LPBYTE I); // C=DAT0 B
|
||||||
extern VOID o14F(LPBYTE I); // C=DAT0 B
|
extern VOID o14F(LPBYTE I); // C=DAT0 B
|
||||||
extern VOID o150a(LPBYTE I); // DAT0=A a
|
extern VOID o150a(LPBYTE I); // DAT0=A a
|
||||||
extern VOID o151a(LPBYTE I); // DAT1=A a
|
extern VOID o151a(LPBYTE I); // DAT1=A a
|
||||||
extern VOID o154a(LPBYTE I); // DAT0=C a
|
extern VOID o154a(LPBYTE I); // DAT0=C a
|
||||||
extern VOID o155a(LPBYTE I); // DAT1=C a
|
extern VOID o155a(LPBYTE I); // DAT1=C a
|
||||||
extern VOID o152a(LPBYTE I); // A=DAT0 a
|
extern VOID o152a(LPBYTE I); // A=DAT0 a
|
||||||
extern VOID o153a(LPBYTE I); // A=DAT1 a
|
extern VOID o153a(LPBYTE I); // A=DAT1 a
|
||||||
extern VOID o156a(LPBYTE I); // C=DAT0 a
|
extern VOID o156a(LPBYTE I); // C=DAT0 a
|
||||||
extern VOID o157a(LPBYTE I); // C=DAT1 a
|
extern VOID o157a(LPBYTE I); // C=DAT1 a
|
||||||
extern VOID o158x(LPBYTE I); // DAT0=A x
|
extern VOID o158x(LPBYTE I); // DAT0=A x
|
||||||
extern VOID o159x(LPBYTE I); // DAT1=A x
|
extern VOID o159x(LPBYTE I); // DAT1=A x
|
||||||
extern VOID o15Cx(LPBYTE I); // DAT0=C x
|
extern VOID o15Cx(LPBYTE I); // DAT0=C x
|
||||||
extern VOID o15Dx(LPBYTE I); // DAT1=C x
|
extern VOID o15Dx(LPBYTE I); // DAT1=C x
|
||||||
extern VOID o15Ax(LPBYTE I); // A=DAT0 x
|
extern VOID o15Ax(LPBYTE I); // A=DAT0 x
|
||||||
extern VOID o15Bx(LPBYTE I); // A=DAT1 x
|
extern VOID o15Bx(LPBYTE I); // A=DAT1 x
|
||||||
extern VOID o15Ex(LPBYTE I); // C=DAT0 x
|
extern VOID o15Ex(LPBYTE I); // C=DAT0 x
|
||||||
extern VOID o15Fx(LPBYTE I); // C=DAT1 x
|
extern VOID o15Fx(LPBYTE I); // C=DAT1 x
|
||||||
extern VOID o16x(LPBYTE I); // D0=D0+ (n+1)
|
extern VOID o16x(LPBYTE I); // D0=D0+ (n+1)
|
||||||
extern VOID o17x(LPBYTE I); // D1=D1+ (n+1)
|
extern VOID o17x(LPBYTE I); // D1=D1+ (n+1)
|
||||||
extern VOID o18x(LPBYTE I); // D0=D0- (n+1)
|
extern VOID o18x(LPBYTE I); // D0=D0- (n+1)
|
||||||
extern VOID o19d2(LPBYTE I); // D0=(2) #dd
|
extern VOID o19d2(LPBYTE I); // D0=(2) #dd
|
||||||
extern VOID o1Ad4(LPBYTE I); // D0=(4) #dddd
|
extern VOID o1Ad4(LPBYTE I); // D0=(4) #dddd
|
||||||
extern VOID o1Bd5(LPBYTE I); // D0=(5) #ddddd
|
extern VOID o1Bd5(LPBYTE I); // D0=(5) #ddddd
|
||||||
extern VOID o1Cx(LPBYTE I); // D1=D1- (n+1)
|
extern VOID o1Cx(LPBYTE I); // D1=D1- (n+1)
|
||||||
extern VOID o1Dd2(LPBYTE I); // D1=(2) #dd
|
extern VOID o1Dd2(LPBYTE I); // D1=(2) #dd
|
||||||
extern VOID o1Ed4(LPBYTE I); // D1=(4) #dddd
|
extern VOID o1Ed4(LPBYTE I); // D1=(4) #dddd
|
||||||
extern VOID o1Fd5(LPBYTE I); // D1=(5) #ddddd
|
extern VOID o1Fd5(LPBYTE I); // D1=(5) #ddddd
|
||||||
extern VOID o2n(LPBYTE I); // P= n
|
extern VOID o2n(LPBYTE I); // P= n
|
||||||
extern VOID o3X(LPBYTE I); // LCHEX
|
extern VOID o3X(LPBYTE I); // LCHEX
|
||||||
extern VOID o4d2(LPBYTE I); // GOC #dd
|
extern VOID o4d2(LPBYTE I); // GOC #dd
|
||||||
extern VOID o5d2(LPBYTE I); // GONC
|
extern VOID o5d2(LPBYTE I); // GONC
|
||||||
extern VOID o6d3(LPBYTE I); // GOTO
|
extern VOID o6d3(LPBYTE I); // GOTO
|
||||||
extern VOID o7d3(LPBYTE I); // GOSUB
|
extern VOID o7d3(LPBYTE I); // GOSUB
|
||||||
extern VOID o800(LPBYTE I); // OUT=CS
|
extern VOID o800(LPBYTE I); // OUT=CS
|
||||||
extern VOID o801(LPBYTE I); // OUT=C
|
extern VOID o801(LPBYTE I); // OUT=C
|
||||||
extern VOID o802(LPBYTE I); // A=IN
|
extern VOID o802(LPBYTE I); // A=IN
|
||||||
extern VOID o803(LPBYTE I); // C=IN
|
extern VOID o803(LPBYTE I); // C=IN
|
||||||
extern VOID o804(LPBYTE I); // UNCNFG
|
extern VOID o804(LPBYTE I); // UNCNFG
|
||||||
extern VOID o805(LPBYTE I); // CONFIG
|
extern VOID o805(LPBYTE I); // CONFIG
|
||||||
extern VOID o806(LPBYTE I); // C=ID
|
extern VOID o806(LPBYTE I); // C=ID
|
||||||
extern VOID o807(LPBYTE I); // SHUTDN
|
extern VOID o807(LPBYTE I); // SHUTDN
|
||||||
extern VOID o8080(LPBYTE I); // INTON
|
extern VOID o8080(LPBYTE I); // INTON
|
||||||
extern VOID o80810(LPBYTE I); // RSI
|
extern VOID o80810(LPBYTE I); // RSI
|
||||||
extern VOID o8082X(LPBYTE I); // LA
|
extern VOID o8082X(LPBYTE I); // LA
|
||||||
extern VOID o8083(LPBYTE I); // BUSCB
|
extern VOID o8083(LPBYTE I); // BUSCB
|
||||||
extern VOID o8084n(LPBYTE I); // ABIT=0 n
|
extern VOID o8084n(LPBYTE I); // ABIT=0 n
|
||||||
extern VOID o8085n(LPBYTE I); // ABIT=1 n
|
extern VOID o8085n(LPBYTE I); // ABIT=1 n
|
||||||
extern VOID o8086n(LPBYTE I); // ?ABIT=0 n
|
extern VOID o8086n(LPBYTE I); // ?ABIT=0 n
|
||||||
extern VOID o8087n(LPBYTE I); // ?ABIT=1 n
|
extern VOID o8087n(LPBYTE I); // ?ABIT=1 n
|
||||||
extern VOID o8088n(LPBYTE I); // CBIT=0 n
|
extern VOID o8088n(LPBYTE I); // CBIT=0 n
|
||||||
extern VOID o8089n(LPBYTE I); // CBIT=1 n
|
extern VOID o8089n(LPBYTE I); // CBIT=1 n
|
||||||
extern VOID o808An(LPBYTE I); // ?CBIT=0 n
|
extern VOID o808An(LPBYTE I); // ?CBIT=0 n
|
||||||
extern VOID o808Bn(LPBYTE I); // ?CBIT=1 n
|
extern VOID o808Bn(LPBYTE I); // ?CBIT=1 n
|
||||||
extern VOID o808C(LPBYTE I); // PC=(A)
|
extern VOID o808C(LPBYTE I); // PC=(A)
|
||||||
extern VOID o808D(LPBYTE I); // BUSCD
|
extern VOID o808D(LPBYTE I); // BUSCD
|
||||||
extern VOID o808E(LPBYTE I); // PC=(C)
|
extern VOID o808E(LPBYTE I); // PC=(C)
|
||||||
extern VOID o808F(LPBYTE I); // INTOFF
|
extern VOID o808F(LPBYTE I); // INTOFF
|
||||||
extern VOID o809(LPBYTE I); // C+P+1 - HEX MODE
|
extern VOID o809(LPBYTE I); // C+P+1 - HEX MODE
|
||||||
extern VOID o80A(LPBYTE I); // RESET
|
extern VOID o80A(LPBYTE I); // RESET
|
||||||
extern VOID o80B(LPBYTE I); // BUSCC
|
extern VOID o80B(LPBYTE I); // BUSCC
|
||||||
extern VOID o80Cn(LPBYTE I); // C=P n
|
extern VOID o80Cn(LPBYTE I); // C=P n
|
||||||
extern VOID o80Dn(LPBYTE I); // P=C n
|
extern VOID o80Dn(LPBYTE I); // P=C n
|
||||||
extern VOID o80E(LPBYTE I); // SREQ?
|
extern VOID o80E(LPBYTE I); // SREQ?
|
||||||
extern VOID o80Fn(LPBYTE I); // CPEX n
|
extern VOID o80Fn(LPBYTE I); // CPEX n
|
||||||
extern VOID o810(LPBYTE I); // ASLC
|
extern VOID o810(LPBYTE I); // ASLC
|
||||||
extern VOID o811(LPBYTE I); // BSLC
|
extern VOID o811(LPBYTE I); // BSLC
|
||||||
extern VOID o812(LPBYTE I); // CSLC
|
extern VOID o812(LPBYTE I); // CSLC
|
||||||
extern VOID o813(LPBYTE I); // DSLC
|
extern VOID o813(LPBYTE I); // DSLC
|
||||||
extern VOID o814(LPBYTE I); // ASRC
|
extern VOID o814(LPBYTE I); // ASRC
|
||||||
extern VOID o815(LPBYTE I); // BSRC
|
extern VOID o815(LPBYTE I); // BSRC
|
||||||
extern VOID o816(LPBYTE I); // CSRC
|
extern VOID o816(LPBYTE I); // CSRC
|
||||||
extern VOID o817(LPBYTE I); // DSRC
|
extern VOID o817(LPBYTE I); // DSRC
|
||||||
extern VOID o818f0x(LPBYTE I); // A=A+x+1 f
|
extern VOID o818f0x(LPBYTE I); // A=A+x+1 f
|
||||||
extern VOID o818f1x(LPBYTE I); // B=B+x+1 f
|
extern VOID o818f1x(LPBYTE I); // B=B+x+1 f
|
||||||
extern VOID o818f2x(LPBYTE I); // C=C+x+1 f
|
extern VOID o818f2x(LPBYTE I); // C=C+x+1 f
|
||||||
extern VOID o818f3x(LPBYTE I); // D=D+x+1 f
|
extern VOID o818f3x(LPBYTE I); // D=D+x+1 f
|
||||||
extern VOID o818f8x(LPBYTE I); // A=A-x-1 f
|
extern VOID o818f8x(LPBYTE I); // A=A-x-1 f
|
||||||
extern VOID o818f9x(LPBYTE I); // B=B-x-1 f
|
extern VOID o818f9x(LPBYTE I); // B=B-x-1 f
|
||||||
extern VOID o818fAx(LPBYTE I); // C=C-x-1 f
|
extern VOID o818fAx(LPBYTE I); // C=C-x-1 f
|
||||||
extern VOID o818fBx(LPBYTE I); // D=D-x-1 f
|
extern VOID o818fBx(LPBYTE I); // D=D-x-1 f
|
||||||
extern VOID o819f0(LPBYTE I); // ASRB.F
|
extern VOID o819f0(LPBYTE I); // ASRB.F
|
||||||
extern VOID o819f1(LPBYTE I); // BSRB.F
|
extern VOID o819f1(LPBYTE I); // BSRB.F
|
||||||
extern VOID o819f2(LPBYTE I); // CSRB.F
|
extern VOID o819f2(LPBYTE I); // CSRB.F
|
||||||
extern VOID o819f3(LPBYTE I); // DSRB.F
|
extern VOID o819f3(LPBYTE I); // DSRB.F
|
||||||
extern VOID o81Af00(LPBYTE I); // R0=A.F f
|
extern VOID o81Af00(LPBYTE I); // R0=A.F f
|
||||||
extern VOID o81Af01(LPBYTE I); // R1=A.F f
|
extern VOID o81Af01(LPBYTE I); // R1=A.F f
|
||||||
extern VOID o81Af02(LPBYTE I); // R2=A.F f
|
extern VOID o81Af02(LPBYTE I); // R2=A.F f
|
||||||
extern VOID o81Af03(LPBYTE I); // R3=A.F f
|
extern VOID o81Af03(LPBYTE I); // R3=A.F f
|
||||||
extern VOID o81Af04(LPBYTE I); // R4=A.F f
|
extern VOID o81Af04(LPBYTE I); // R4=A.F f
|
||||||
extern VOID o81Af08(LPBYTE I); // R0=C.F f
|
extern VOID o81Af08(LPBYTE I); // R0=C.F f
|
||||||
extern VOID o81Af09(LPBYTE I); // R1=C.F f
|
extern VOID o81Af09(LPBYTE I); // R1=C.F f
|
||||||
extern VOID o81Af0A(LPBYTE I); // R2=C.F f
|
extern VOID o81Af0A(LPBYTE I); // R2=C.F f
|
||||||
extern VOID o81Af0B(LPBYTE I); // R3=C.F f
|
extern VOID o81Af0B(LPBYTE I); // R3=C.F f
|
||||||
extern VOID o81Af0C(LPBYTE I); // R4=C.F f
|
extern VOID o81Af0C(LPBYTE I); // R4=C.F f
|
||||||
extern VOID o81Af10(LPBYTE I); // A=R0.F f
|
extern VOID o81Af10(LPBYTE I); // A=R0.F f
|
||||||
extern VOID o81Af11(LPBYTE I); // A=R1.F f
|
extern VOID o81Af11(LPBYTE I); // A=R1.F f
|
||||||
extern VOID o81Af12(LPBYTE I); // A=R2.F f
|
extern VOID o81Af12(LPBYTE I); // A=R2.F f
|
||||||
extern VOID o81Af13(LPBYTE I); // A=R3.F f
|
extern VOID o81Af13(LPBYTE I); // A=R3.F f
|
||||||
extern VOID o81Af14(LPBYTE I); // A=R4.F f
|
extern VOID o81Af14(LPBYTE I); // A=R4.F f
|
||||||
extern VOID o81Af18(LPBYTE I); // C=R0.F f
|
extern VOID o81Af18(LPBYTE I); // C=R0.F f
|
||||||
extern VOID o81Af19(LPBYTE I); // C=R1.F f
|
extern VOID o81Af19(LPBYTE I); // C=R1.F f
|
||||||
extern VOID o81Af1A(LPBYTE I); // C=R2.F f
|
extern VOID o81Af1A(LPBYTE I); // C=R2.F f
|
||||||
extern VOID o81Af1B(LPBYTE I); // C=R3.F f
|
extern VOID o81Af1B(LPBYTE I); // C=R3.F f
|
||||||
extern VOID o81Af1C(LPBYTE I); // C=R4.F f
|
extern VOID o81Af1C(LPBYTE I); // C=R4.F f
|
||||||
extern VOID o81Af20(LPBYTE I); // AR0EX.F f
|
extern VOID o81Af20(LPBYTE I); // AR0EX.F f
|
||||||
extern VOID o81Af21(LPBYTE I); // AR1EX.F f
|
extern VOID o81Af21(LPBYTE I); // AR1EX.F f
|
||||||
extern VOID o81Af22(LPBYTE I); // AR2EX.F f
|
extern VOID o81Af22(LPBYTE I); // AR2EX.F f
|
||||||
extern VOID o81Af23(LPBYTE I); // AR3EX.F f
|
extern VOID o81Af23(LPBYTE I); // AR3EX.F f
|
||||||
extern VOID o81Af24(LPBYTE I); // AR4EX.F f
|
extern VOID o81Af24(LPBYTE I); // AR4EX.F f
|
||||||
extern VOID o81Af28(LPBYTE I); // CR0EX.F f
|
extern VOID o81Af28(LPBYTE I); // CR0EX.F f
|
||||||
extern VOID o81Af29(LPBYTE I); // CR1EX.F f
|
extern VOID o81Af29(LPBYTE I); // CR1EX.F f
|
||||||
extern VOID o81Af2A(LPBYTE I); // CR2EX.F f
|
extern VOID o81Af2A(LPBYTE I); // CR2EX.F f
|
||||||
extern VOID o81Af2B(LPBYTE I); // CR3EX.F f
|
extern VOID o81Af2B(LPBYTE I); // CR3EX.F f
|
||||||
extern VOID o81Af2C(LPBYTE I); // CR4EX.F f
|
extern VOID o81Af2C(LPBYTE I); // CR4EX.F f
|
||||||
extern VOID o81B2(LPBYTE I); // PC=A
|
extern VOID o81B2(LPBYTE I); // PC=A
|
||||||
extern VOID o81B3(LPBYTE I); // PC=C
|
extern VOID o81B3(LPBYTE I); // PC=C
|
||||||
extern VOID o81B4(LPBYTE I); // A=PC
|
extern VOID o81B4(LPBYTE I); // A=PC
|
||||||
extern VOID o81B5(LPBYTE I); // C=PC
|
extern VOID o81B5(LPBYTE I); // C=PC
|
||||||
extern VOID o81B6(LPBYTE I); // APCEX
|
extern VOID o81B6(LPBYTE I); // APCEX
|
||||||
extern VOID o81B7(LPBYTE I); // CPCEX
|
extern VOID o81B7(LPBYTE I); // CPCEX
|
||||||
extern VOID o81C(LPBYTE I); // ASRB
|
extern VOID o81C(LPBYTE I); // ASRB
|
||||||
extern VOID o81D(LPBYTE I); // BSRB
|
extern VOID o81D(LPBYTE I); // BSRB
|
||||||
extern VOID o81E(LPBYTE I); // CSRB
|
extern VOID o81E(LPBYTE I); // CSRB
|
||||||
extern VOID o81F(LPBYTE I); // DSRB
|
extern VOID o81F(LPBYTE I); // DSRB
|
||||||
extern VOID o82n(LPBYTE I); // HST=0 m
|
extern VOID o82n(LPBYTE I); // HST=0 m
|
||||||
extern VOID o83n(LPBYTE I); // ?HST=0 m
|
extern VOID o83n(LPBYTE I); // ?HST=0 m
|
||||||
extern VOID o84n(LPBYTE I); // ST=0 n
|
extern VOID o84n(LPBYTE I); // ST=0 n
|
||||||
extern VOID o85n(LPBYTE I); // ST=1 n
|
extern VOID o85n(LPBYTE I); // ST=1 n
|
||||||
extern VOID o86n(LPBYTE I); // ?ST=0 n
|
extern VOID o86n(LPBYTE I); // ?ST=0 n
|
||||||
extern VOID o87n(LPBYTE I); // ?ST=1 n
|
extern VOID o87n(LPBYTE I); // ?ST=1 n
|
||||||
extern VOID o88n(LPBYTE I); // ?P# n
|
extern VOID o88n(LPBYTE I); // ?P# n
|
||||||
extern VOID o89n(LPBYTE I); // ?P= n
|
extern VOID o89n(LPBYTE I); // ?P= n
|
||||||
extern VOID o8A0(LPBYTE I); // ?A=B A
|
extern VOID o8A0(LPBYTE I); // ?A=B A
|
||||||
extern VOID o8A1(LPBYTE I); // ?B=C A
|
extern VOID o8A1(LPBYTE I); // ?B=C A
|
||||||
extern VOID o8A2(LPBYTE I); // ?C=A A
|
extern VOID o8A2(LPBYTE I); // ?C=A A
|
||||||
extern VOID o8A3(LPBYTE I); // ?D=C A
|
extern VOID o8A3(LPBYTE I); // ?D=C A
|
||||||
extern VOID o8A4(LPBYTE I); // ?A#B A
|
extern VOID o8A4(LPBYTE I); // ?A#B A
|
||||||
extern VOID o8A5(LPBYTE I); // ?B#C A
|
extern VOID o8A5(LPBYTE I); // ?B#C A
|
||||||
extern VOID o8A6(LPBYTE I); // ?C#A A
|
extern VOID o8A6(LPBYTE I); // ?C#A A
|
||||||
extern VOID o8A7(LPBYTE I); // ?D#C A
|
extern VOID o8A7(LPBYTE I); // ?D#C A
|
||||||
extern VOID o8A8(LPBYTE I); // ?A=0 A
|
extern VOID o8A8(LPBYTE I); // ?A=0 A
|
||||||
extern VOID o8A9(LPBYTE I); // ?B=0 A
|
extern VOID o8A9(LPBYTE I); // ?B=0 A
|
||||||
extern VOID o8AA(LPBYTE I); // ?C=0 A
|
extern VOID o8AA(LPBYTE I); // ?C=0 A
|
||||||
extern VOID o8AB(LPBYTE I); // ?D=0 A
|
extern VOID o8AB(LPBYTE I); // ?D=0 A
|
||||||
extern VOID o8AC(LPBYTE I); // ?A#0 A
|
extern VOID o8AC(LPBYTE I); // ?A#0 A
|
||||||
extern VOID o8AD(LPBYTE I); // ?B#0 A
|
extern VOID o8AD(LPBYTE I); // ?B#0 A
|
||||||
extern VOID o8AE(LPBYTE I); // ?C#0 A
|
extern VOID o8AE(LPBYTE I); // ?C#0 A
|
||||||
extern VOID o8AF(LPBYTE I); // ?D#0 A
|
extern VOID o8AF(LPBYTE I); // ?D#0 A
|
||||||
extern VOID o8B0(LPBYTE I); // ?A>B A
|
extern VOID o8B0(LPBYTE I); // ?A>B A
|
||||||
extern VOID o8B1(LPBYTE I); // ?B>C A
|
extern VOID o8B1(LPBYTE I); // ?B>C A
|
||||||
extern VOID o8B2(LPBYTE I); // ?C>A A
|
extern VOID o8B2(LPBYTE I); // ?C>A A
|
||||||
extern VOID o8B3(LPBYTE I); // ?D>C A
|
extern VOID o8B3(LPBYTE I); // ?D>C A
|
||||||
extern VOID o8B4(LPBYTE I); // ?A<B A
|
extern VOID o8B4(LPBYTE I); // ?A<B A
|
||||||
extern VOID o8B5(LPBYTE I); // ?B<C A
|
extern VOID o8B5(LPBYTE I); // ?B<C A
|
||||||
extern VOID o8B6(LPBYTE I); // ?C<A A
|
extern VOID o8B6(LPBYTE I); // ?C<A A
|
||||||
extern VOID o8B7(LPBYTE I); // ?D<C A
|
extern VOID o8B7(LPBYTE I); // ?D<C A
|
||||||
extern VOID o8B8(LPBYTE I); // ?A>=B A
|
extern VOID o8B8(LPBYTE I); // ?A>=B A
|
||||||
extern VOID o8B9(LPBYTE I); // ?B>=C A
|
extern VOID o8B9(LPBYTE I); // ?B>=C A
|
||||||
extern VOID o8BA(LPBYTE I); // ?C>=A A
|
extern VOID o8BA(LPBYTE I); // ?C>=A A
|
||||||
extern VOID o8BB(LPBYTE I); // ?D>=C A
|
extern VOID o8BB(LPBYTE I); // ?D>=C A
|
||||||
extern VOID o8BC(LPBYTE I); // ?A<=B A
|
extern VOID o8BC(LPBYTE I); // ?A<=B A
|
||||||
extern VOID o8BD(LPBYTE I); // ?B<=C A
|
extern VOID o8BD(LPBYTE I); // ?B<=C A
|
||||||
extern VOID o8BE(LPBYTE I); // ?C<=A A
|
extern VOID o8BE(LPBYTE I); // ?C<=A A
|
||||||
extern VOID o8BF(LPBYTE I); // ?D<=C A
|
extern VOID o8BF(LPBYTE I); // ?D<=C A
|
||||||
extern VOID o8Cd4(LPBYTE I); // GOLONG #dddd
|
extern VOID o8Cd4(LPBYTE I); // GOLONG #dddd
|
||||||
extern VOID o8Dd5(LPBYTE I); // GOVLNG #ddddd
|
extern VOID o8Dd5(LPBYTE I); // GOVLNG #ddddd
|
||||||
extern VOID o8Ed4(LPBYTE I); // GOSUBL #dddd
|
extern VOID o8Ed4(LPBYTE I); // GOSUBL #dddd
|
||||||
extern VOID o8Fd5(LPBYTE I); // GOSBVL #ddddd
|
extern VOID o8Fd5(LPBYTE I); // GOSBVL #ddddd
|
||||||
extern VOID o9a0(LPBYTE I); // ?A=B f
|
extern VOID o9a0(LPBYTE I); // ?A=B f
|
||||||
extern VOID o9a1(LPBYTE I); // ?B=C f
|
extern VOID o9a1(LPBYTE I); // ?B=C f
|
||||||
extern VOID o9a2(LPBYTE I); // ?C=A f
|
extern VOID o9a2(LPBYTE I); // ?C=A f
|
||||||
extern VOID o9a3(LPBYTE I); // ?D=C f
|
extern VOID o9a3(LPBYTE I); // ?D=C f
|
||||||
extern VOID o9a4(LPBYTE I); // ?A#B f
|
extern VOID o9a4(LPBYTE I); // ?A#B f
|
||||||
extern VOID o9a5(LPBYTE I); // ?B#C f
|
extern VOID o9a5(LPBYTE I); // ?B#C f
|
||||||
extern VOID o9a6(LPBYTE I); // ?C#A f
|
extern VOID o9a6(LPBYTE I); // ?C#A f
|
||||||
extern VOID o9a7(LPBYTE I); // ?D#C f
|
extern VOID o9a7(LPBYTE I); // ?D#C f
|
||||||
extern VOID o9a8(LPBYTE I); // ?A=0 f
|
extern VOID o9a8(LPBYTE I); // ?A=0 f
|
||||||
extern VOID o9a9(LPBYTE I); // ?B=0 f
|
extern VOID o9a9(LPBYTE I); // ?B=0 f
|
||||||
extern VOID o9aA(LPBYTE I); // ?C=0 f
|
extern VOID o9aA(LPBYTE I); // ?C=0 f
|
||||||
extern VOID o9aB(LPBYTE I); // ?D=0 f
|
extern VOID o9aB(LPBYTE I); // ?D=0 f
|
||||||
extern VOID o9aC(LPBYTE I); // ?A#0 f
|
extern VOID o9aC(LPBYTE I); // ?A#0 f
|
||||||
extern VOID o9aD(LPBYTE I); // ?B#0 f
|
extern VOID o9aD(LPBYTE I); // ?B#0 f
|
||||||
extern VOID o9aE(LPBYTE I); // ?C#0 f
|
extern VOID o9aE(LPBYTE I); // ?C#0 f
|
||||||
extern VOID o9aF(LPBYTE I); // ?D#0 f
|
extern VOID o9aF(LPBYTE I); // ?D#0 f
|
||||||
extern VOID o9b0(LPBYTE I); // ?A>B f
|
extern VOID o9b0(LPBYTE I); // ?A>B f
|
||||||
extern VOID o9b1(LPBYTE I); // ?B>C f
|
extern VOID o9b1(LPBYTE I); // ?B>C f
|
||||||
extern VOID o9b2(LPBYTE I); // ?C>A f
|
extern VOID o9b2(LPBYTE I); // ?C>A f
|
||||||
extern VOID o9b3(LPBYTE I); // ?D>C f
|
extern VOID o9b3(LPBYTE I); // ?D>C f
|
||||||
extern VOID o9b4(LPBYTE I); // ?A<B f
|
extern VOID o9b4(LPBYTE I); // ?A<B f
|
||||||
extern VOID o9b5(LPBYTE I); // ?B<C f
|
extern VOID o9b5(LPBYTE I); // ?B<C f
|
||||||
extern VOID o9b6(LPBYTE I); // ?C<A f
|
extern VOID o9b6(LPBYTE I); // ?C<A f
|
||||||
extern VOID o9b7(LPBYTE I); // ?D<C f
|
extern VOID o9b7(LPBYTE I); // ?D<C f
|
||||||
extern VOID o9b8(LPBYTE I); // ?A>=B f
|
extern VOID o9b8(LPBYTE I); // ?A>=B f
|
||||||
extern VOID o9b9(LPBYTE I); // ?B>=C f
|
extern VOID o9b9(LPBYTE I); // ?B>=C f
|
||||||
extern VOID o9bA(LPBYTE I); // ?C>=A f
|
extern VOID o9bA(LPBYTE I); // ?C>=A f
|
||||||
extern VOID o9bB(LPBYTE I); // ?D>=C f
|
extern VOID o9bB(LPBYTE I); // ?D>=C f
|
||||||
extern VOID o9bC(LPBYTE I); // ?A<=B f
|
extern VOID o9bC(LPBYTE I); // ?A<=B f
|
||||||
extern VOID o9bD(LPBYTE I); // ?B<=C f
|
extern VOID o9bD(LPBYTE I); // ?B<=C f
|
||||||
extern VOID o9bE(LPBYTE I); // ?C<=A f
|
extern VOID o9bE(LPBYTE I); // ?C<=A f
|
||||||
extern VOID o9bF(LPBYTE I); // ?D<=C f
|
extern VOID o9bF(LPBYTE I); // ?D<=C f
|
||||||
extern VOID oAa0(LPBYTE I); // A=A+B f
|
extern VOID oAa0(LPBYTE I); // A=A+B f
|
||||||
extern VOID oAa1(LPBYTE I); // B=B+C f
|
extern VOID oAa1(LPBYTE I); // B=B+C f
|
||||||
extern VOID oAa2(LPBYTE I); // C=C+A f
|
extern VOID oAa2(LPBYTE I); // C=C+A f
|
||||||
extern VOID oAa3(LPBYTE I); // D=D+C f
|
extern VOID oAa3(LPBYTE I); // D=D+C f
|
||||||
extern VOID oAa4(LPBYTE I); // A=A+A f
|
extern VOID oAa4(LPBYTE I); // A=A+A f
|
||||||
extern VOID oAa5(LPBYTE I); // B=B+B f
|
extern VOID oAa5(LPBYTE I); // B=B+B f
|
||||||
extern VOID oAa6(LPBYTE I); // C=C+C f
|
extern VOID oAa6(LPBYTE I); // C=C+C f
|
||||||
extern VOID oAa7(LPBYTE I); // D=D+D f
|
extern VOID oAa7(LPBYTE I); // D=D+D f
|
||||||
extern VOID oAa8(LPBYTE I); // B=B+A f
|
extern VOID oAa8(LPBYTE I); // B=B+A f
|
||||||
extern VOID oAa9(LPBYTE I); // C=C+B f
|
extern VOID oAa9(LPBYTE I); // C=C+B f
|
||||||
extern VOID oAaA(LPBYTE I); // A=A+C f
|
extern VOID oAaA(LPBYTE I); // A=A+C f
|
||||||
extern VOID oAaB(LPBYTE I); // C=C+D f
|
extern VOID oAaB(LPBYTE I); // C=C+D f
|
||||||
extern VOID oAaC(LPBYTE I); // A=A-1 f
|
extern VOID oAaC(LPBYTE I); // A=A-1 f
|
||||||
extern VOID oAaD(LPBYTE I); // B=B-1 f
|
extern VOID oAaD(LPBYTE I); // B=B-1 f
|
||||||
extern VOID oAaE(LPBYTE I); // C=C-1 f
|
extern VOID oAaE(LPBYTE I); // C=C-1 f
|
||||||
extern VOID oAaF(LPBYTE I); // D=D-1 f
|
extern VOID oAaF(LPBYTE I); // D=D-1 f
|
||||||
extern VOID oAb0(LPBYTE I); // A=0 f
|
extern VOID oAb0(LPBYTE I); // A=0 f
|
||||||
extern VOID oAb1(LPBYTE I); // B=0 f
|
extern VOID oAb1(LPBYTE I); // B=0 f
|
||||||
extern VOID oAb2(LPBYTE I); // C=0 f
|
extern VOID oAb2(LPBYTE I); // C=0 f
|
||||||
extern VOID oAb3(LPBYTE I); // D=0 f
|
extern VOID oAb3(LPBYTE I); // D=0 f
|
||||||
extern VOID oAb4(LPBYTE I); // A=B f
|
extern VOID oAb4(LPBYTE I); // A=B f
|
||||||
extern VOID oAb5(LPBYTE I); // B=C f
|
extern VOID oAb5(LPBYTE I); // B=C f
|
||||||
extern VOID oAb6(LPBYTE I); // C=A f
|
extern VOID oAb6(LPBYTE I); // C=A f
|
||||||
extern VOID oAb7(LPBYTE I); // D=C f
|
extern VOID oAb7(LPBYTE I); // D=C f
|
||||||
extern VOID oAb8(LPBYTE I); // B=A f
|
extern VOID oAb8(LPBYTE I); // B=A f
|
||||||
extern VOID oAb9(LPBYTE I); // C=B f
|
extern VOID oAb9(LPBYTE I); // C=B f
|
||||||
extern VOID oAbA(LPBYTE I); // A=C f
|
extern VOID oAbA(LPBYTE I); // A=C f
|
||||||
extern VOID oAbB(LPBYTE I); // C=D f
|
extern VOID oAbB(LPBYTE I); // C=D f
|
||||||
extern VOID oAbC(LPBYTE I); // ABEX f
|
extern VOID oAbC(LPBYTE I); // ABEX f
|
||||||
extern VOID oAbD(LPBYTE I); // BCEX f
|
extern VOID oAbD(LPBYTE I); // BCEX f
|
||||||
extern VOID oAbE(LPBYTE I); // CAEX f
|
extern VOID oAbE(LPBYTE I); // CAEX f
|
||||||
extern VOID oAbF(LPBYTE I); // DCEX f
|
extern VOID oAbF(LPBYTE I); // DCEX f
|
||||||
extern VOID oBa0(LPBYTE I); // A=A-B f
|
extern VOID oBa0(LPBYTE I); // A=A-B f
|
||||||
extern VOID oBa1(LPBYTE I); // B=B-C f
|
extern VOID oBa1(LPBYTE I); // B=B-C f
|
||||||
extern VOID oBa2(LPBYTE I); // C=C-A f
|
extern VOID oBa2(LPBYTE I); // C=C-A f
|
||||||
extern VOID oBa3(LPBYTE I); // D=D-C f
|
extern VOID oBa3(LPBYTE I); // D=D-C f
|
||||||
extern VOID oBa4(LPBYTE I); // A=A+1 f
|
extern VOID oBa4(LPBYTE I); // A=A+1 f
|
||||||
extern VOID oBa5(LPBYTE I); // B=B+1 f
|
extern VOID oBa5(LPBYTE I); // B=B+1 f
|
||||||
extern VOID oBa6(LPBYTE I); // C=C+1 f
|
extern VOID oBa6(LPBYTE I); // C=C+1 f
|
||||||
extern VOID oBa7(LPBYTE I); // D=D+1 f
|
extern VOID oBa7(LPBYTE I); // D=D+1 f
|
||||||
extern VOID oBa8(LPBYTE I); // B=B-A f
|
extern VOID oBa8(LPBYTE I); // B=B-A f
|
||||||
extern VOID oBa9(LPBYTE I); // C=C-B f
|
extern VOID oBa9(LPBYTE I); // C=C-B f
|
||||||
extern VOID oBaA(LPBYTE I); // A=A-C f
|
extern VOID oBaA(LPBYTE I); // A=A-C f
|
||||||
extern VOID oBaB(LPBYTE I); // C=C-D f
|
extern VOID oBaB(LPBYTE I); // C=C-D f
|
||||||
extern VOID oBaC(LPBYTE I); // A=B-A f
|
extern VOID oBaC(LPBYTE I); // A=B-A f
|
||||||
extern VOID oBaD(LPBYTE I); // B=C-B f
|
extern VOID oBaD(LPBYTE I); // B=C-B f
|
||||||
extern VOID oBaE(LPBYTE I); // C=A-C f
|
extern VOID oBaE(LPBYTE I); // C=A-C f
|
||||||
extern VOID oBaF(LPBYTE I); // D=C-D f
|
extern VOID oBaF(LPBYTE I); // D=C-D f
|
||||||
extern VOID oBb0(LPBYTE I); // ASL f
|
extern VOID oBb0(LPBYTE I); // ASL f
|
||||||
extern VOID oBb1(LPBYTE I); // BSL f
|
extern VOID oBb1(LPBYTE I); // BSL f
|
||||||
extern VOID oBb2(LPBYTE I); // CSL f
|
extern VOID oBb2(LPBYTE I); // CSL f
|
||||||
extern VOID oBb3(LPBYTE I); // DSL f
|
extern VOID oBb3(LPBYTE I); // DSL f
|
||||||
extern VOID oBb4(LPBYTE I); // ASR f
|
extern VOID oBb4(LPBYTE I); // ASR f
|
||||||
extern VOID oBb5(LPBYTE I); // BSR f
|
extern VOID oBb5(LPBYTE I); // BSR f
|
||||||
extern VOID oBb6(LPBYTE I); // CSR f
|
extern VOID oBb6(LPBYTE I); // CSR f
|
||||||
extern VOID oBb7(LPBYTE I); // DSR f
|
extern VOID oBb7(LPBYTE I); // DSR f
|
||||||
extern VOID oBb8(LPBYTE I); // A=-A f
|
extern VOID oBb8(LPBYTE I); // A=-A f
|
||||||
extern VOID oBb9(LPBYTE I); // B=-B f
|
extern VOID oBb9(LPBYTE I); // B=-B f
|
||||||
extern VOID oBbA(LPBYTE I); // C=-C f
|
extern VOID oBbA(LPBYTE I); // C=-C f
|
||||||
extern VOID oBbB(LPBYTE I); // D=-D f
|
extern VOID oBbB(LPBYTE I); // D=-D f
|
||||||
extern VOID oBbC(LPBYTE I); // A=-A-1 f
|
extern VOID oBbC(LPBYTE I); // A=-A-1 f
|
||||||
extern VOID oBbD(LPBYTE I); // B=-B-1 f
|
extern VOID oBbD(LPBYTE I); // B=-B-1 f
|
||||||
extern VOID oBbE(LPBYTE I); // C=-C-1 f
|
extern VOID oBbE(LPBYTE I); // C=-C-1 f
|
||||||
extern VOID oBbF(LPBYTE I); // D=-D-1 f
|
extern VOID oBbF(LPBYTE I); // D=-D-1 f
|
||||||
extern VOID oC0(LPBYTE I); // A=A+B A
|
extern VOID oC0(LPBYTE I); // A=A+B A
|
||||||
extern VOID oC1(LPBYTE I); // B=B+C A
|
extern VOID oC1(LPBYTE I); // B=B+C A
|
||||||
extern VOID oC2(LPBYTE I); // C=C+A A
|
extern VOID oC2(LPBYTE I); // C=C+A A
|
||||||
extern VOID oC3(LPBYTE I); // D=D+C A
|
extern VOID oC3(LPBYTE I); // D=D+C A
|
||||||
extern VOID oC4(LPBYTE I); // A=A+A A
|
extern VOID oC4(LPBYTE I); // A=A+A A
|
||||||
extern VOID oC5(LPBYTE I); // B=B+B A
|
extern VOID oC5(LPBYTE I); // B=B+B A
|
||||||
extern VOID oC6(LPBYTE I); // C=C+C A
|
extern VOID oC6(LPBYTE I); // C=C+C A
|
||||||
extern VOID oC7(LPBYTE I); // D=D+D A
|
extern VOID oC7(LPBYTE I); // D=D+D A
|
||||||
extern VOID oC8(LPBYTE I); // B=B+A A
|
extern VOID oC8(LPBYTE I); // B=B+A A
|
||||||
extern VOID oC9(LPBYTE I); // C=C+B A
|
extern VOID oC9(LPBYTE I); // C=C+B A
|
||||||
extern VOID oCA(LPBYTE I); // A=A+C A
|
extern VOID oCA(LPBYTE I); // A=A+C A
|
||||||
extern VOID oCB(LPBYTE I); // C=C+D A
|
extern VOID oCB(LPBYTE I); // C=C+D A
|
||||||
extern VOID oCC(LPBYTE I); // A=A-1 A
|
extern VOID oCC(LPBYTE I); // A=A-1 A
|
||||||
extern VOID oCD(LPBYTE I); // B=B-1 A
|
extern VOID oCD(LPBYTE I); // B=B-1 A
|
||||||
extern VOID oCE(LPBYTE I); // C=C-1 A
|
extern VOID oCE(LPBYTE I); // C=C-1 A
|
||||||
extern VOID oCF(LPBYTE I); // D=D-1 A
|
extern VOID oCF(LPBYTE I); // D=D-1 A
|
||||||
extern VOID oD0(LPBYTE I); // A=0 A
|
extern VOID oD0(LPBYTE I); // A=0 A
|
||||||
extern VOID oD1(LPBYTE I); // B=0 A
|
extern VOID oD1(LPBYTE I); // B=0 A
|
||||||
extern VOID oD2(LPBYTE I); // C=0 A
|
extern VOID oD2(LPBYTE I); // C=0 A
|
||||||
extern VOID oD3(LPBYTE I); // D=0 A
|
extern VOID oD3(LPBYTE I); // D=0 A
|
||||||
extern VOID oD4(LPBYTE I); // A=B A
|
extern VOID oD4(LPBYTE I); // A=B A
|
||||||
extern VOID oD5(LPBYTE I); // B=C A
|
extern VOID oD5(LPBYTE I); // B=C A
|
||||||
extern VOID oD6(LPBYTE I); // C=A A
|
extern VOID oD6(LPBYTE I); // C=A A
|
||||||
extern VOID oD7(LPBYTE I); // D=C A
|
extern VOID oD7(LPBYTE I); // D=C A
|
||||||
extern VOID oD8(LPBYTE I); // B=A A
|
extern VOID oD8(LPBYTE I); // B=A A
|
||||||
extern VOID oD9(LPBYTE I); // C=B A
|
extern VOID oD9(LPBYTE I); // C=B A
|
||||||
extern VOID oDA(LPBYTE I); // A=C A
|
extern VOID oDA(LPBYTE I); // A=C A
|
||||||
extern VOID oDB(LPBYTE I); // C=D A
|
extern VOID oDB(LPBYTE I); // C=D A
|
||||||
extern VOID oDC(LPBYTE I); // ABEX
|
extern VOID oDC(LPBYTE I); // ABEX
|
||||||
extern VOID oDD(LPBYTE I); // BCEX
|
extern VOID oDD(LPBYTE I); // BCEX
|
||||||
extern VOID oDE(LPBYTE I); // CAEX
|
extern VOID oDE(LPBYTE I); // CAEX
|
||||||
extern VOID oDF(LPBYTE I); // DCEX
|
extern VOID oDF(LPBYTE I); // DCEX
|
||||||
extern VOID oE0(LPBYTE I); // A=A-B A
|
extern VOID oE0(LPBYTE I); // A=A-B A
|
||||||
extern VOID oE1(LPBYTE I); // B=B-C A
|
extern VOID oE1(LPBYTE I); // B=B-C A
|
||||||
extern VOID oE2(LPBYTE I); // C=C-A A
|
extern VOID oE2(LPBYTE I); // C=C-A A
|
||||||
extern VOID oE3(LPBYTE I); // D=D-C A
|
extern VOID oE3(LPBYTE I); // D=D-C A
|
||||||
extern VOID oE4(LPBYTE I); // A=A+1 A
|
extern VOID oE4(LPBYTE I); // A=A+1 A
|
||||||
extern VOID oE5(LPBYTE I); // B=B+1 A
|
extern VOID oE5(LPBYTE I); // B=B+1 A
|
||||||
extern VOID oE6(LPBYTE I); // C=C+1 A
|
extern VOID oE6(LPBYTE I); // C=C+1 A
|
||||||
extern VOID oE7(LPBYTE I); // D=D+1 A
|
extern VOID oE7(LPBYTE I); // D=D+1 A
|
||||||
extern VOID oE8(LPBYTE I); // B=B-A A
|
extern VOID oE8(LPBYTE I); // B=B-A A
|
||||||
extern VOID oE9(LPBYTE I); // C=C-B A
|
extern VOID oE9(LPBYTE I); // C=C-B A
|
||||||
extern VOID oEA(LPBYTE I); // A=A-C A
|
extern VOID oEA(LPBYTE I); // A=A-C A
|
||||||
extern VOID oEB(LPBYTE I); // C=C-D A
|
extern VOID oEB(LPBYTE I); // C=C-D A
|
||||||
extern VOID oEC(LPBYTE I); // A=B-A A
|
extern VOID oEC(LPBYTE I); // A=B-A A
|
||||||
extern VOID oED(LPBYTE I); // B=C-B A
|
extern VOID oED(LPBYTE I); // B=C-B A
|
||||||
extern VOID oEE(LPBYTE I); // C=A-C A
|
extern VOID oEE(LPBYTE I); // C=A-C A
|
||||||
extern VOID oEF(LPBYTE I); // D=C-D A
|
extern VOID oEF(LPBYTE I); // D=C-D A
|
||||||
extern VOID oF0(LPBYTE I); // ASL A
|
extern VOID oF0(LPBYTE I); // ASL A
|
||||||
extern VOID oF1(LPBYTE I); // BSL A
|
extern VOID oF1(LPBYTE I); // BSL A
|
||||||
extern VOID oF2(LPBYTE I); // CSL A
|
extern VOID oF2(LPBYTE I); // CSL A
|
||||||
extern VOID oF3(LPBYTE I); // DSL A
|
extern VOID oF3(LPBYTE I); // DSL A
|
||||||
extern VOID oF4(LPBYTE I); // ASR A
|
extern VOID oF4(LPBYTE I); // ASR A
|
||||||
extern VOID oF5(LPBYTE I); // BSR A
|
extern VOID oF5(LPBYTE I); // BSR A
|
||||||
extern VOID oF6(LPBYTE I); // CSR A
|
extern VOID oF6(LPBYTE I); // CSR A
|
||||||
extern VOID oF7(LPBYTE I); // DSR A
|
extern VOID oF7(LPBYTE I); // DSR A
|
||||||
extern VOID oF8(LPBYTE I); // A=-A A
|
extern VOID oF8(LPBYTE I); // A=-A A
|
||||||
extern VOID oF9(LPBYTE I); // B=-B A
|
extern VOID oF9(LPBYTE I); // B=-B A
|
||||||
extern VOID oFA(LPBYTE I); // C=-C A
|
extern VOID oFA(LPBYTE I); // C=-C A
|
||||||
extern VOID oFB(LPBYTE I); // D=-D A
|
extern VOID oFB(LPBYTE I); // D=-D A
|
||||||
extern VOID oFC(LPBYTE I); // A=-A-1 A
|
extern VOID oFC(LPBYTE I); // A=-A-1 A
|
||||||
extern VOID oFD(LPBYTE I); // B=-B-1 A
|
extern VOID oFD(LPBYTE I); // B=-B-1 A
|
||||||
extern VOID oFE(LPBYTE I); // C=-C-1 A
|
extern VOID oFE(LPBYTE I); // C=-C-1 A
|
||||||
extern VOID oFF(LPBYTE I); // D=-D-1 A
|
extern VOID oFF(LPBYTE I); // D=-D-1 A
|
||||||
|
|
||||||
extern VOID o_invalid3(LPBYTE I);
|
extern VOID o_invalid3(LPBYTE I);
|
||||||
extern VOID o_invalid4(LPBYTE I);
|
extern VOID o_invalid4(LPBYTE I);
|
||||||
extern VOID o_invalid5(LPBYTE I);
|
extern VOID o_invalid5(LPBYTE I);
|
||||||
extern VOID o_invalid6(LPBYTE I);
|
extern VOID o_invalid6(LPBYTE I);
|
||||||
|
|
||||||
extern VOID o_goyes3(LPBYTE I);
|
extern VOID o_goyes3(LPBYTE I);
|
||||||
extern VOID o_goyes5(LPBYTE I);
|
extern VOID o_goyes5(LPBYTE I);
|
|
@ -1,462 +1,462 @@
|
||||||
/*
|
/*
|
||||||
* ops.h
|
* ops.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NFunpack(a, b, f) Nunpack((a)+F_s[f], b, F_l[f])
|
#define NFunpack(a, b, f) Nunpack((a)+F_s[f], b, F_l[f])
|
||||||
#define NFread(a, b, f) Nread((a)+F_s[f], b, F_l[f])
|
#define NFread(a, b, f) Nread((a)+F_s[f], b, F_l[f])
|
||||||
#define NFwrite(a, b, f) Nwrite((a)+F_s[f], b, F_l[f])
|
#define NFwrite(a, b, f) Nwrite((a)+F_s[f], b, F_l[f])
|
||||||
#define NFcopy(a, b, f) memcpy((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define NFcopy(a, b, f) memcpy((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define NFxchg(a, b, f) Nxchg((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define NFxchg(a, b, f) Nxchg((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define NFadd(a, b, f) Nadd((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define NFadd(a, b, f) Nadd((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define NFsub(a, b, f) Nsub((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define NFsub(a, b, f) Nsub((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define NFrsub(a, b, f) Nrsub((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define NFrsub(a, b, f) Nrsub((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define NFand(a, b, f) Nand((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define NFand(a, b, f) Nand((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define NFor(a, b, f) Nor((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define NFor(a, b, f) Nor((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define NFzero(a,f) memset((a)+F_s[f], 0, F_l[f])
|
#define NFzero(a,f) memset((a)+F_s[f], 0, F_l[f])
|
||||||
#define NFpack(a, f) Npack((a)+F_s[f], F_l[f])
|
#define NFpack(a, f) Npack((a)+F_s[f], F_l[f])
|
||||||
#define NFinc(a, f) Ninc(a, F_l[f], F_s[f])
|
#define NFinc(a, f) Ninc(a, F_l[f], F_s[f])
|
||||||
#define NFdec(a, f) Ndec(a, F_l[f], F_s[f])
|
#define NFdec(a, f) Ndec(a, F_l[f], F_s[f])
|
||||||
#define NFnot(a, f) Nnot((a)+F_s[f], F_l[f])
|
#define NFnot(a, f) Nnot((a)+F_s[f], F_l[f])
|
||||||
#define NFneg(a, f) Nneg((a)+F_s[f], F_l[f])
|
#define NFneg(a, f) Nneg((a)+F_s[f], F_l[f])
|
||||||
#define NFsl(a, f) Nsl((a)+F_s[f], F_l[f])
|
#define NFsl(a, f) Nsl((a)+F_s[f], F_l[f])
|
||||||
#define NFsr(a, f) Nsr((a)+F_s[f], F_l[f])
|
#define NFsr(a, f) Nsr((a)+F_s[f], F_l[f])
|
||||||
#define NFsrb(a, f) Nsrb((a)+F_s[f], F_l[f])
|
#define NFsrb(a, f) Nsrb((a)+F_s[f], F_l[f])
|
||||||
#define TFe(a, b, f) Te((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define TFe(a, b, f) Te((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define TFa(a, b, f) Ta((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define TFa(a, b, f) Ta((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define TFb(a, b, f) Tb((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define TFb(a, b, f) Tb((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define TFz(a, f) Tz((a)+F_s[f], F_l[f])
|
#define TFz(a, f) Tz((a)+F_s[f], F_l[f])
|
||||||
#define TFne(a, b, f) Tne((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define TFne(a, b, f) Tne((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define TFae(a, b, f) Tae((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define TFae(a, b, f) Tae((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define TFbe(a, b, f) Tbe((a)+F_s[f], (b)+F_s[f], F_l[f])
|
#define TFbe(a, b, f) Tbe((a)+F_s[f], (b)+F_s[f], F_l[f])
|
||||||
#define TFnz(a, f) Tnz((a)+F_s[f], F_l[f])
|
#define TFnz(a, f) Tnz((a)+F_s[f], F_l[f])
|
||||||
|
|
||||||
static __inline LPBYTE FASTPTR(DWORD d)
|
static __inline LPBYTE FASTPTR(DWORD d)
|
||||||
{
|
{
|
||||||
static BYTE pbyNULL[21];
|
static BYTE pbyNULL[21];
|
||||||
LPBYTE lpbyPage;
|
LPBYTE lpbyPage;
|
||||||
DWORD u, v;
|
DWORD u, v;
|
||||||
|
|
||||||
d &= 0xFFFFF; // handle address overflows
|
d &= 0xFFFFF; // handle address overflows
|
||||||
|
|
||||||
u = d >> 12; // page
|
u = d >> 12; // page
|
||||||
v = d & 0xFFF; // offset
|
v = d & 0xFFF; // offset
|
||||||
|
|
||||||
if ( !(Chipset.IOCfig && ((d & 0xFFFC0) == Chipset.IOBase))
|
if ( !(Chipset.IOCfig && ((d & 0xFFFC0) == Chipset.IOBase))
|
||||||
&& RMap[u] != NULL // page valid
|
&& RMap[u] != NULL // page valid
|
||||||
&& ( v < 0x1000 - ARRAYSIZEOF(pbyNULL) // complete opcode inside page
|
&& ( v < 0x1000 - ARRAYSIZEOF(pbyNULL) // complete opcode inside page
|
||||||
// or next page continue linear addressing
|
// or next page continue linear addressing
|
||||||
|| (RMap[u] + 0x1000 == RMap[(u+1) & (ARRAYSIZEOF(RMap)-1)])
|
|| (RMap[u] + 0x1000 == RMap[(u+1) & (ARRAYSIZEOF(RMap)-1)])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
lpbyPage = RMap[u] + v; // full address
|
lpbyPage = RMap[u] + v; // full address
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lpbyPage = pbyNULL; // memory allocation
|
lpbyPage = pbyNULL; // memory allocation
|
||||||
Npeek(lpbyPage, d, ARRAYSIZEOF(pbyNULL)); // fill with data (LAHEX + 16 digits = longest opcode)
|
Npeek(lpbyPage, d, ARRAYSIZEOF(pbyNULL)); // fill with data (LAHEX + 16 digits = longest opcode)
|
||||||
}
|
}
|
||||||
return lpbyPage;
|
return lpbyPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void rstkpush(DWORD d)
|
static __inline void rstkpush(DWORD d)
|
||||||
{
|
{
|
||||||
Chipset.rstk[Chipset.rstkp] = d;
|
Chipset.rstk[Chipset.rstkp] = d;
|
||||||
Chipset.rstkp=(Chipset.rstkp+1)&7;
|
Chipset.rstkp=(Chipset.rstkp+1)&7;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline DWORD rstkpop(VOID)
|
static __inline DWORD rstkpop(VOID)
|
||||||
{
|
{
|
||||||
DWORD r;
|
DWORD r;
|
||||||
|
|
||||||
Chipset.rstkp=(Chipset.rstkp-1)&7;
|
Chipset.rstkp=(Chipset.rstkp-1)&7;
|
||||||
r = Chipset.rstk[Chipset.rstkp];
|
r = Chipset.rstk[Chipset.rstkp];
|
||||||
Chipset.rstk[Chipset.rstkp] = 0;
|
Chipset.rstk[Chipset.rstkp] = 0;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline DWORD Npack(BYTE *a, UINT s)
|
static __inline DWORD Npack(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
DWORD r = 0;
|
DWORD r = 0;
|
||||||
|
|
||||||
while (s--) r = (r<<4)|a[s];
|
while (s--) r = (r<<4)|a[s];
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline VOID Nunpack(BYTE *a, DWORD b, UINT s)
|
static __inline VOID Nunpack(BYTE *a, DWORD b, UINT s)
|
||||||
{
|
{
|
||||||
for (; s>0; --s) { *a++ = (BYTE)(b&0xf); b>>=4; }
|
for (; s>0; --s) { *a++ = (BYTE)(b&0xf); b>>=4; }
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nxchg(BYTE *a, BYTE *b, UINT s)
|
static __inline void Nxchg(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
BYTE X[16];
|
BYTE X[16];
|
||||||
|
|
||||||
memcpy(X, b, s);
|
memcpy(X, b, s);
|
||||||
memcpy(b, a, s);
|
memcpy(b, a, s);
|
||||||
memcpy(a, X, s);
|
memcpy(a, X, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Ninc(BYTE *a, UINT s, UINT d)
|
static __inline void Ninc(BYTE *a, UINT s, UINT d)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
if (Chipset.mode_dec)
|
if (Chipset.mode_dec)
|
||||||
{
|
{
|
||||||
BYTE c = 1;
|
BYTE c = 1;
|
||||||
for (i=d; i<s+d; ++i)
|
for (i=d; i<s+d; ++i)
|
||||||
{
|
{
|
||||||
// no register wrap
|
// no register wrap
|
||||||
_ASSERT(i < ARRAYSIZEOF(((CHIPSET *) NULL)->A));
|
_ASSERT(i < ARRAYSIZEOF(((CHIPSET *) NULL)->A));
|
||||||
|
|
||||||
// illegal number in dec mode
|
// illegal number in dec mode
|
||||||
if (a[i] >= 10) a[i] &= 0x7;
|
if (a[i] >= 10) a[i] &= 0x7;
|
||||||
|
|
||||||
a[i] += c;
|
a[i] += c;
|
||||||
c = (a[i] >= 10);
|
c = (a[i] >= 10);
|
||||||
if (c) a[i] -= 10;
|
if (c) a[i] -= 10;
|
||||||
}
|
}
|
||||||
Chipset.carry = (c==1);
|
Chipset.carry = (c==1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i=d; i<s+d; ++i)
|
for (i=d; i<s+d; ++i)
|
||||||
{
|
{
|
||||||
// no register wrap
|
// no register wrap
|
||||||
_ASSERT(i < ARRAYSIZEOF(((CHIPSET *) NULL)->A));
|
_ASSERT(i < ARRAYSIZEOF(((CHIPSET *) NULL)->A));
|
||||||
|
|
||||||
a[i]++;
|
a[i]++;
|
||||||
if (a[i] < 16)
|
if (a[i] < 16)
|
||||||
{
|
{
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a[i] -= 16;
|
a[i] -= 16;
|
||||||
}
|
}
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Ninc16(BYTE *a, UINT s, UINT d)
|
static __inline void Ninc16(BYTE *a, UINT s, UINT d)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
for (i=d; i<s+d; ++i)
|
for (i=d; i<s+d; ++i)
|
||||||
{
|
{
|
||||||
a[i&0xf]++;
|
a[i&0xf]++;
|
||||||
if (a[i&0xf] < 16)
|
if (a[i&0xf] < 16)
|
||||||
{
|
{
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a[i&0xf] -= 16;
|
a[i&0xf] -= 16;
|
||||||
}
|
}
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nincx(BYTE *a, UINT s)
|
static __inline void Nincx(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
for (i=0; i<s; ++i)
|
for (i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
a[i]++;
|
a[i]++;
|
||||||
if (a[i] < 16)
|
if (a[i] < 16)
|
||||||
{
|
{
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a[i] -= 16;
|
a[i] -= 16;
|
||||||
}
|
}
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Ndec(BYTE *a, UINT s, UINT d)
|
static __inline void Ndec(BYTE *a, UINT s, UINT d)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
BYTE cBase = Chipset.mode_dec ? 10 : 16;
|
BYTE cBase = Chipset.mode_dec ? 10 : 16;
|
||||||
|
|
||||||
for (i=d; i<s+d; ++i)
|
for (i=d; i<s+d; ++i)
|
||||||
{
|
{
|
||||||
// no register wrap
|
// no register wrap
|
||||||
_ASSERT(i < ARRAYSIZEOF(((CHIPSET *) NULL)->A));
|
_ASSERT(i < ARRAYSIZEOF(((CHIPSET *) NULL)->A));
|
||||||
|
|
||||||
a[i]--;
|
a[i]--;
|
||||||
if ((a[i] & 0xF0) == 0) // check overflow
|
if ((a[i] & 0xF0) == 0) // check overflow
|
||||||
{
|
{
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a[i] += cBase;
|
a[i] += cBase;
|
||||||
}
|
}
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Ndec16(BYTE *a, UINT s, UINT d)
|
static __inline void Ndec16(BYTE *a, UINT s, UINT d)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
for (i=d; i<s+d; ++i)
|
for (i=d; i<s+d; ++i)
|
||||||
{
|
{
|
||||||
a[i&0xf]--;
|
a[i&0xf]--;
|
||||||
if (a[i&0xf] < 16)
|
if (a[i&0xf] < 16)
|
||||||
{
|
{
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a[i&0xf] += 16;
|
a[i&0xf] += 16;
|
||||||
}
|
}
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nadd(BYTE *a, BYTE *b, UINT s)
|
static __inline void Nadd(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
BYTE c = 0;
|
BYTE c = 0;
|
||||||
BYTE cBase = Chipset.mode_dec ? 10 : 16;
|
BYTE cBase = Chipset.mode_dec ? 10 : 16;
|
||||||
|
|
||||||
for (i=0; i<s; ++i)
|
for (i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
// illegal number in dec mode
|
// illegal number in dec mode
|
||||||
if (a[i] >= cBase) a[i] &= 0x7;
|
if (a[i] >= cBase) a[i] &= 0x7;
|
||||||
|
|
||||||
a[i] += b[i] + c;
|
a[i] += b[i] + c;
|
||||||
if (a[i] >= cBase)
|
if (a[i] >= cBase)
|
||||||
{
|
{
|
||||||
a[i] -= cBase;
|
a[i] -= cBase;
|
||||||
c = 1;
|
c = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c = 0;
|
c = 0;
|
||||||
}
|
}
|
||||||
Chipset.carry = (c==1);
|
Chipset.carry = (c==1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nsub(BYTE *a, BYTE *b, UINT s)
|
static __inline void Nsub(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
BYTE c = 0;
|
BYTE c = 0;
|
||||||
BYTE cBase = Chipset.mode_dec ? 10 : 16;
|
BYTE cBase = Chipset.mode_dec ? 10 : 16;
|
||||||
|
|
||||||
for (i=0; i<s; ++i)
|
for (i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
a[i] = a[i] - b[i] - c;
|
a[i] = a[i] - b[i] - c;
|
||||||
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
|
// illegal number in dec mode
|
||||||
if ((a[i] & 0xF0) != 0) a[i] &= 0x7;
|
if ((a[i] & 0xF0) != 0) a[i] &= 0x7;
|
||||||
c = 1;
|
c = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c = 0;
|
c = 0;
|
||||||
}
|
}
|
||||||
Chipset.carry = (c==1);
|
Chipset.carry = (c==1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nrsub(BYTE *a, BYTE *b, UINT s)
|
static __inline void Nrsub(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
BYTE c = 0;
|
BYTE c = 0;
|
||||||
BYTE cBase = Chipset.mode_dec ? 10 : 16;
|
BYTE cBase = Chipset.mode_dec ? 10 : 16;
|
||||||
|
|
||||||
for (i=0; i<s; ++i)
|
for (i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
a[i] = b[i] - a[i] - c;
|
a[i] = b[i] - a[i] - c;
|
||||||
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
|
// illegal number in dec mode
|
||||||
if ((a[i] & 0xF0) != 0) a[i] &= 0x7;
|
if ((a[i] & 0xF0) != 0) a[i] &= 0x7;
|
||||||
c = 1;
|
c = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c = 0;
|
c = 0;
|
||||||
}
|
}
|
||||||
Chipset.carry = (c==1);
|
Chipset.carry = (c==1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nand(BYTE *a, BYTE *b, UINT s)
|
static __inline void Nand(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
while (s--) a[s] &= b[s];
|
while (s--) a[s] &= b[s];
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nor(BYTE *a, BYTE *b, UINT s)
|
static __inline void Nor(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
while (s--) a[s] |= b[s];
|
while (s--) a[s] |= b[s];
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nnot(BYTE *a, UINT s)
|
static __inline void Nnot(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
BYTE cBase = Chipset.mode_dec ? 9 : 15;
|
BYTE cBase = Chipset.mode_dec ? 9 : 15;
|
||||||
|
|
||||||
while (s--)
|
while (s--)
|
||||||
{
|
{
|
||||||
a[s] = cBase - a[s];
|
a[s] = cBase - a[s];
|
||||||
if ((a[s] & 0xF0) != 0) // check overflow (dec mode only)
|
if ((a[s] & 0xF0) != 0) // check overflow (dec mode only)
|
||||||
a[s] &= 0x7;
|
a[s] &= 0x7;
|
||||||
}
|
}
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nneg(BYTE *a, UINT s)
|
static __inline void Nneg(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
for (i=0; i<s && a[i]==0; ++i) { } // search for non-zero digit
|
for (i=0; i<s && a[i]==0; ++i) { } // search for non-zero digit
|
||||||
if ((Chipset.carry = (i!=s))) // value was non-zero
|
if ((Chipset.carry = (i!=s))) // value was non-zero
|
||||||
{
|
{
|
||||||
BYTE cBase = Chipset.mode_dec ? 9 : 15;
|
BYTE cBase = Chipset.mode_dec ? 9 : 15;
|
||||||
|
|
||||||
_ASSERT(a[i] > 0); // check for non-zero digit
|
_ASSERT(a[i] > 0); // check for non-zero digit
|
||||||
for (--a[i]; i<s; ++i)
|
for (--a[i]; i<s; ++i)
|
||||||
{
|
{
|
||||||
a[i] = cBase - a[i];
|
a[i] = cBase - a[i];
|
||||||
if ((a[i] & 0xF0) != 0) // check overflow (dec mode only)
|
if ((a[i] & 0xF0) != 0) // check overflow (dec mode only)
|
||||||
a[i] &= 0x7;
|
a[i] &= 0x7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nsl(BYTE *a, UINT s)
|
static __inline void Nsl(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
while (--s) a[s] = a[s-1];
|
while (--s) a[s] = a[s-1];
|
||||||
*a = 0;
|
*a = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nslc(BYTE *a, UINT s)
|
static __inline void Nslc(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
BYTE c = a[s-1];
|
BYTE c = a[s-1];
|
||||||
|
|
||||||
while (--s) a[s] = a[s-1];
|
while (--s) a[s] = a[s-1];
|
||||||
*a = c;
|
*a = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nsr(BYTE *a, UINT s)
|
static __inline void Nsr(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
if (*a) Chipset.HST |= SB;
|
if (*a) Chipset.HST |= SB;
|
||||||
while (--s) { *a = a[1]; a++; }
|
while (--s) { *a = a[1]; a++; }
|
||||||
*a = 0;
|
*a = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nsrc(BYTE *a, UINT s)
|
static __inline void Nsrc(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
BYTE c = *a;
|
BYTE c = *a;
|
||||||
|
|
||||||
if (c) Chipset.HST |= SB;
|
if (c) Chipset.HST |= SB;
|
||||||
while (--s) { *a = a[1]; a++; }
|
while (--s) { *a = a[1]; a++; }
|
||||||
*a = c;
|
*a = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nsrb(BYTE *a, UINT s)
|
static __inline void Nsrb(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
if (*a & 1) Chipset.HST |= SB;
|
if (*a & 1) Chipset.HST |= SB;
|
||||||
while (--s)
|
while (--s)
|
||||||
{
|
{
|
||||||
*a >>= 1;
|
*a >>= 1;
|
||||||
*a |= ((a[1] & 1) << 3);
|
*a |= ((a[1] & 1) << 3);
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
*a >>= 1;
|
*a >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nbit0(BYTE *a, UINT b)
|
static __inline void Nbit0(BYTE *a, UINT b)
|
||||||
{
|
{
|
||||||
a[b>>2] &= ~(1<<(b&3));
|
a[b>>2] &= ~(1<<(b&3));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Nbit1(BYTE *a, UINT b)
|
static __inline void Nbit1(BYTE *a, UINT b)
|
||||||
{
|
{
|
||||||
a[b>>2] |= 1<<(b&3);
|
a[b>>2] |= 1<<(b&3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Tbit0(BYTE *a, UINT b)
|
static __inline void Tbit0(BYTE *a, UINT b)
|
||||||
{
|
{
|
||||||
Chipset.carry = ((a[b>>2] & (1<<(b&3))) == 0);
|
Chipset.carry = ((a[b>>2] & (1<<(b&3))) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Tbit1(BYTE *a, UINT b)
|
static __inline void Tbit1(BYTE *a, UINT b)
|
||||||
{
|
{
|
||||||
Chipset.carry = ((a[b>>2] & (1<<(b&3))) != 0);
|
Chipset.carry = ((a[b>>2] & (1<<(b&3))) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Te(BYTE *a, BYTE *b, UINT s)
|
static __inline void Te(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
while (s--)
|
while (s--)
|
||||||
{
|
{
|
||||||
if (a[s]!=b[s])
|
if (a[s]!=b[s])
|
||||||
{
|
{
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Tne(BYTE *a, BYTE *b, UINT s)
|
static __inline void Tne(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
while (s--)
|
while (s--)
|
||||||
{
|
{
|
||||||
if (a[s]!=b[s])
|
if (a[s]!=b[s])
|
||||||
{
|
{
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Tz(BYTE *a, UINT s)
|
static __inline void Tz(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
while (s--)
|
while (s--)
|
||||||
{
|
{
|
||||||
if (a[s]!=0)
|
if (a[s]!=0)
|
||||||
{
|
{
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Tnz(BYTE *a, UINT s)
|
static __inline void Tnz(BYTE *a, UINT s)
|
||||||
{
|
{
|
||||||
while (s--)
|
while (s--)
|
||||||
{
|
{
|
||||||
if (a[s]!=0)
|
if (a[s]!=0)
|
||||||
{
|
{
|
||||||
Chipset.carry = TRUE;
|
Chipset.carry = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Chipset.carry = FALSE;
|
Chipset.carry = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Ta(BYTE *a, BYTE *b, UINT s)
|
static __inline void Ta(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
while (--s) if (a[s]!=b[s]) break;
|
while (--s) if (a[s]!=b[s]) break;
|
||||||
Chipset.carry = (a[s]>b[s]);
|
Chipset.carry = (a[s]>b[s]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Tb(BYTE *a, BYTE *b, UINT s)
|
static __inline void Tb(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
while (--s) if (a[s]!=b[s]) break;
|
while (--s) if (a[s]!=b[s]) break;
|
||||||
Chipset.carry = (a[s]<b[s]);
|
Chipset.carry = (a[s]<b[s]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Tae(BYTE *a, BYTE *b, UINT s)
|
static __inline void Tae(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
while (--s) if (a[s]!=b[s]) break;
|
while (--s) if (a[s]!=b[s]) break;
|
||||||
Chipset.carry = (a[s]>=b[s]);
|
Chipset.carry = (a[s]>=b[s]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void Tbe(BYTE *a, BYTE *b, UINT s)
|
static __inline void Tbe(BYTE *a, BYTE *b, UINT s)
|
||||||
{
|
{
|
||||||
while (--s) if (a[s]!=b[s]) break;
|
while (--s) if (a[s]!=b[s]) break;
|
||||||
Chipset.carry = (a[s]<=b[s]);
|
Chipset.carry = (a[s]<=b[s]);
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// PCH.C
|
// PCH.C
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
|
@ -1,112 +1,112 @@
|
||||||
//
|
//
|
||||||
// PCH.H
|
// PCH.H
|
||||||
//
|
//
|
||||||
|
|
||||||
#define _WIN32_IE 0x0200
|
#define _WIN32_IE 0x0200
|
||||||
#define _CRT_SECURE_NO_DEPRECATE
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
#define _CRTDBG_MAP_ALLOC
|
#define _CRTDBG_MAP_ALLOC
|
||||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||||
|
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
|
|
||||||
#if !defined VERIFY
|
#if !defined VERIFY
|
||||||
#if defined _DEBUG
|
#if defined _DEBUG
|
||||||
#define VERIFY(f) _ASSERT(f)
|
#define VERIFY(f) _ASSERT(f)
|
||||||
#else // _DEBUG
|
#else // _DEBUG
|
||||||
#define VERIFY(f) ((VOID)(f))
|
#define VERIFY(f) ((VOID)(f))
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
#endif // _VERIFY
|
#endif // _VERIFY
|
||||||
|
|
||||||
#if !defined INVALID_SET_FILE_POINTER
|
#if !defined INVALID_SET_FILE_POINTER
|
||||||
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
|
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined INVALID_FILE_ATTRIBUTES
|
#if !defined INVALID_FILE_ATTRIBUTES
|
||||||
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined GWLP_USERDATA
|
#if !defined GWLP_USERDATA
|
||||||
#define GWLP_USERDATA GWL_USERDATA
|
#define GWLP_USERDATA GWL_USERDATA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined GCLP_HCURSOR
|
#if !defined GCLP_HCURSOR
|
||||||
#define GCLP_HCURSOR GCL_HCURSOR
|
#define GCLP_HCURSOR GCL_HCURSOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined IDC_HAND // Win2k specific definition
|
#if !defined IDC_HAND // Win2k specific definition
|
||||||
#define IDC_HAND MAKEINTRESOURCE(32649)
|
#define IDC_HAND MAKEINTRESOURCE(32649)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER <= 1200 // missing type definition in the MSVC6.0 SDK and earlier
|
#if _MSC_VER <= 1200 // missing type definition in the MSVC6.0 SDK and earlier
|
||||||
#define __unaligned
|
#define __unaligned
|
||||||
#define SetWindowLongPtr SetWindowLong
|
#define SetWindowLongPtr SetWindowLong
|
||||||
#define GetWindowLongPtr GetWindowLong
|
#define GetWindowLongPtr GetWindowLong
|
||||||
#define SetClassLongPtr SetClassLong
|
#define SetClassLongPtr SetClassLong
|
||||||
#define GetClassLongPtr GetClassLong
|
#define GetClassLongPtr GetClassLong
|
||||||
typedef SIZE_T DWORD_PTR, *PDWORD_PTR;
|
typedef SIZE_T DWORD_PTR, *PDWORD_PTR;
|
||||||
typedef ULONG ULONG_PTR, *PULONG_PTR;
|
typedef ULONG ULONG_PTR, *PULONG_PTR;
|
||||||
typedef LONG LONG_PTR, *PLONG_PTR;
|
typedef LONG LONG_PTR, *PLONG_PTR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined PROCESS_POWER_THROTTLING_CURRENT_VERSION
|
#if !defined PROCESS_POWER_THROTTLING_CURRENT_VERSION
|
||||||
#define PROCESS_POWER_THROTTLING_CURRENT_VERSION 1
|
#define PROCESS_POWER_THROTTLING_CURRENT_VERSION 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION
|
#if !defined PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION
|
||||||
#define PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION 0x04
|
#define PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION 0x04
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER <= 1900 // add until VS2015 from processthreadsapi.h
|
#if _MSC_VER <= 1900 // add until VS2015 from processthreadsapi.h
|
||||||
enum { ProcessPowerThrottling = 4 };
|
enum { ProcessPowerThrottling = 4 };
|
||||||
|
|
||||||
typedef struct _PROCESS_POWER_THROTTLING_STATE {
|
typedef struct _PROCESS_POWER_THROTTLING_STATE {
|
||||||
ULONG Version;
|
ULONG Version;
|
||||||
ULONG ControlMask;
|
ULONG ControlMask;
|
||||||
ULONG StateMask;
|
ULONG StateMask;
|
||||||
} PROCESS_POWER_THROTTLING_STATE, * PPROCESS_POWER_THROTTLING_STATE;
|
} PROCESS_POWER_THROTTLING_STATE, * PPROCESS_POWER_THROTTLING_STATE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER >= 1400 // valid for VS2005 and later
|
#if _MSC_VER >= 1400 // valid for VS2005 and later
|
||||||
#if defined _M_IX86
|
#if defined _M_IX86
|
||||||
#pragma comment(linker,"/manifestdependency:\" \
|
#pragma comment(linker,"/manifestdependency:\" \
|
||||||
type='win32' \
|
type='win32' \
|
||||||
name='Microsoft.Windows.Common-Controls' \
|
name='Microsoft.Windows.Common-Controls' \
|
||||||
version='6.0.0.0' processorArchitecture='x86' \
|
version='6.0.0.0' processorArchitecture='x86' \
|
||||||
publicKeyToken='6595b64144ccf1df' \
|
publicKeyToken='6595b64144ccf1df' \
|
||||||
language='*'\"")
|
language='*'\"")
|
||||||
#elif defined _M_IA64
|
#elif defined _M_IA64
|
||||||
#pragma comment(linker,"/manifestdependency:\" \
|
#pragma comment(linker,"/manifestdependency:\" \
|
||||||
type='win32' \
|
type='win32' \
|
||||||
name='Microsoft.Windows.Common-Controls' \
|
name='Microsoft.Windows.Common-Controls' \
|
||||||
version='6.0.0.0' processorArchitecture='ia64' \
|
version='6.0.0.0' processorArchitecture='ia64' \
|
||||||
publicKeyToken='6595b64144ccf1df' \
|
publicKeyToken='6595b64144ccf1df' \
|
||||||
language='*'\"")
|
language='*'\"")
|
||||||
#elif defined _M_X64
|
#elif defined _M_X64
|
||||||
#pragma comment(linker,"/manifestdependency:\" \
|
#pragma comment(linker,"/manifestdependency:\" \
|
||||||
type='win32' \
|
type='win32' \
|
||||||
name='Microsoft.Windows.Common-Controls' \
|
name='Microsoft.Windows.Common-Controls' \
|
||||||
version='6.0.0.0' processorArchitecture='amd64' \
|
version='6.0.0.0' processorArchitecture='amd64' \
|
||||||
publicKeyToken='6595b64144ccf1df' \
|
publicKeyToken='6595b64144ccf1df' \
|
||||||
language='*'\"")
|
language='*'\"")
|
||||||
#else
|
#else
|
||||||
#pragma comment(linker,"/manifestdependency:\" \
|
#pragma comment(linker,"/manifestdependency:\" \
|
||||||
type='win32' \
|
type='win32' \
|
||||||
name='Microsoft.Windows.Common-Controls' \
|
name='Microsoft.Windows.Common-Controls' \
|
||||||
version='6.0.0.0' processorArchitecture='*' \
|
version='6.0.0.0' processorArchitecture='*' \
|
||||||
publicKeyToken='6595b64144ccf1df' \
|
publicKeyToken='6595b64144ccf1df' \
|
||||||
language='*'\"")
|
language='*'\"")
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
|
@ -1,57 +1,57 @@
|
||||||
/*
|
/*
|
||||||
* pngcrc.c
|
* pngcrc.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2023 Christoph Gießelink
|
* Copyright (C) 2023 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
/* CRC polynomial: 0xedb88320 */
|
/* CRC polynomial: 0xedb88320 */
|
||||||
static const unsigned lodepng_crc32_table[256] =
|
static const unsigned lodepng_crc32_table[256] =
|
||||||
{
|
{
|
||||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
||||||
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
|
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
|
||||||
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
||||||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
|
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
|
||||||
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
|
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
|
||||||
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
||||||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
|
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
|
||||||
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
|
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
|
||||||
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
||||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
|
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
|
||||||
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
|
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
|
||||||
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
||||||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
|
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
|
||||||
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
|
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
|
||||||
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
||||||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
|
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
|
||||||
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
|
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
|
||||||
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
||||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
|
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
|
||||||
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
|
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
|
||||||
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
||||||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
|
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
|
||||||
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
|
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
|
||||||
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
||||||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
|
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
|
||||||
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
|
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
|
||||||
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
||||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
|
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
|
||||||
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
|
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
|
||||||
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
||||||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
|
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
|
||||||
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
|
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Return the CRC of the bytes buf[0..len-1].*/
|
/*Return the CRC of the bytes buf[0..len-1].*/
|
||||||
unsigned lodepng_crc32(const unsigned char* data, size_t length)
|
unsigned lodepng_crc32(const unsigned char* data, size_t length)
|
||||||
{
|
{
|
||||||
unsigned r = 0xffffffffu;
|
unsigned r = 0xffffffffu;
|
||||||
while (length--)
|
while (length--)
|
||||||
{
|
{
|
||||||
r = lodepng_crc32_table[(r ^ *data++) & 0xffu] ^ (r >> 8u);
|
r = lodepng_crc32_table[(r ^ *data++) & 0xffu] ^ (r >> 8u);
|
||||||
}
|
}
|
||||||
return ~r;
|
return ~r;
|
||||||
}
|
}
|
|
@ -1,177 +1,177 @@
|
||||||
/*
|
/*
|
||||||
* redeye.c
|
* redeye.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Christoph Gießelink
|
* Copyright (C) 2011 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
#define ERR_CHAR 127 // character for transfer error
|
#define ERR_CHAR 127 // character for transfer error
|
||||||
|
|
||||||
#define H1 0x78
|
#define H1 0x78
|
||||||
#define H2 0xE6
|
#define H2 0xE6
|
||||||
#define H3 0xD5
|
#define H3 0xD5
|
||||||
#define H4 0x8B
|
#define H4 0x8B
|
||||||
|
|
||||||
// HP redeye correction masks
|
// HP redeye correction masks
|
||||||
static CONST BYTE byEmask[] = { H1, H2, H3, H4 };
|
static CONST BYTE byEmask[] = { H1, H2, H3, H4 };
|
||||||
|
|
||||||
static __inline UINT MAX(UINT a, UINT b)
|
static __inline UINT MAX(UINT a, UINT b)
|
||||||
{
|
{
|
||||||
return (a>b)?a:b;
|
return (a>b)?a:b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline BYTE Parity(BYTE b)
|
static __inline BYTE Parity(BYTE b)
|
||||||
{
|
{
|
||||||
b ^= (b >> 4);
|
b ^= (b >> 4);
|
||||||
b ^= (b >> 2);
|
b ^= (b >> 2);
|
||||||
b ^= (b >> 1);
|
b ^= (b >> 1);
|
||||||
return b & 1;
|
return b & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline BYTE CreateCorrectionBits(BYTE b)
|
static __inline BYTE CreateCorrectionBits(BYTE b)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
BYTE byVal = 0;
|
BYTE byVal = 0;
|
||||||
|
|
||||||
for (i = 0; i < ARRAYSIZEOF(byEmask);++i)
|
for (i = 0; i < ARRAYSIZEOF(byEmask);++i)
|
||||||
{
|
{
|
||||||
byVal <<= 1;
|
byVal <<= 1;
|
||||||
byVal |= Parity((BYTE) (b & byEmask[i]));
|
byVal |= Parity((BYTE) (b & byEmask[i]));
|
||||||
}
|
}
|
||||||
return byVal;
|
return byVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline WORD CorrectData(WORD wData,WORD wMissed)
|
static __inline WORD CorrectData(WORD wData,WORD wMissed)
|
||||||
{
|
{
|
||||||
while ((wMissed & 0xFF) != 0) // clear every missed bit in data area
|
while ((wMissed & 0xFF) != 0) // clear every missed bit in data area
|
||||||
{
|
{
|
||||||
BYTE byBitMask;
|
BYTE byBitMask;
|
||||||
|
|
||||||
// detect valid H(i) mask
|
// detect valid H(i) mask
|
||||||
WORD wMi = 0x800; // first M(i) bit
|
WORD wMi = 0x800; // first M(i) bit
|
||||||
INT i = 0; // index to first H(i) mask
|
INT i = 0; // index to first H(i) mask
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
if ((wMissed & wMi) == 0) // possible valid mask
|
if ((wMissed & wMi) == 0) // possible valid mask
|
||||||
{
|
{
|
||||||
_ASSERT(i < ARRAYSIZEOF(byEmask));
|
_ASSERT(i < ARRAYSIZEOF(byEmask));
|
||||||
|
|
||||||
// select bit to correct
|
// select bit to correct
|
||||||
byBitMask = wMissed & byEmask[i];
|
byBitMask = wMissed & byEmask[i];
|
||||||
|
|
||||||
if (Parity(byBitMask)) // only one bit set (parity odd)
|
if (Parity(byBitMask)) // only one bit set (parity odd)
|
||||||
break; // -> valid H(i) mask
|
break; // -> valid H(i) mask
|
||||||
}
|
}
|
||||||
|
|
||||||
wMi >>= 1; // next M(i) bit
|
wMi >>= 1; // next M(i) bit
|
||||||
i++; // next H(i) mask
|
i++; // next H(i) mask
|
||||||
}
|
}
|
||||||
|
|
||||||
// correct bit with H(i) mask
|
// correct bit with H(i) mask
|
||||||
wMissed ^= byBitMask; // clear this missed bit
|
wMissed ^= byBitMask; // clear this missed bit
|
||||||
|
|
||||||
// parity odd -> wrong data value
|
// parity odd -> wrong data value
|
||||||
if (Parity((BYTE) ((wData & byEmask[i]) ^ ((wData & wMi) >> 8))))
|
if (Parity((BYTE) ((wData & byEmask[i]) ^ ((wData & wMi) >> 8))))
|
||||||
wData ^= byBitMask; // correct value
|
wData ^= byBitMask; // correct value
|
||||||
}
|
}
|
||||||
return wData & 0xFF; // only data byte is correct
|
return wData & 0xFF; // only data byte is correct
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID IrPrinter(BYTE c)
|
VOID IrPrinter(BYTE c)
|
||||||
{
|
{
|
||||||
static INT nFrame = 0; // frame counter
|
static INT nFrame = 0; // frame counter
|
||||||
static DWORD dwData = 0; // half bit data container
|
static DWORD dwData = 0; // half bit data container
|
||||||
static INT nStart = 0; // frame counter disabled
|
static INT nStart = 0; // frame counter disabled
|
||||||
|
|
||||||
BOOL bLSRQ;
|
BOOL bLSRQ;
|
||||||
|
|
||||||
dwData = (dwData << 1) | (c & LBO); // grab the last 32 bit send through IR
|
dwData = (dwData << 1) | (c & LBO); // grab the last 32 bit send through IR
|
||||||
|
|
||||||
// Led Service ReQuest on Led Buffer Empty enabled
|
// Led Service ReQuest on Led Buffer Empty enabled
|
||||||
bLSRQ = (Chipset.IORam[LCR] & ELBE) != 0;
|
bLSRQ = (Chipset.IORam[LCR] & ELBE) != 0;
|
||||||
|
|
||||||
IOBit(SRQ2,LSRQ,bLSRQ); // update LSRQ bit
|
IOBit(SRQ2,LSRQ,bLSRQ); // update LSRQ bit
|
||||||
if (bLSRQ) // interrupt on Led Buffer Empty enabled
|
if (bLSRQ) // interrupt on Led Buffer Empty enabled
|
||||||
{
|
{
|
||||||
Chipset.SoftInt = TRUE; // execute interrupt
|
Chipset.SoftInt = TRUE; // execute interrupt
|
||||||
bInterrupt = TRUE;
|
bInterrupt = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HP40G and HP49G have no IR transmitter Led
|
// HP40G and HP49G have no IR transmitter Led
|
||||||
if ((cCurrentRomType == 'E' && nCurrentClass == 40) || cCurrentRomType == 'X')
|
if ((cCurrentRomType == 'E' && nCurrentClass == 40) || cCurrentRomType == 'X')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (nFrame == 0) // waiting for start bit condition
|
if (nFrame == 0) // waiting for start bit condition
|
||||||
{
|
{
|
||||||
if ((dwData & 0x3F) == 0x07) // start bit condition (000111 pattern)
|
if ((dwData & 0x3F) == 0x07) // start bit condition (000111 pattern)
|
||||||
{
|
{
|
||||||
nStart = 1; // enable frame counter
|
nStart = 1; // enable frame counter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nFrame == 24) // 24 half bit received
|
if (nFrame == 24) // 24 half bit received
|
||||||
{
|
{
|
||||||
INT i;
|
INT i;
|
||||||
|
|
||||||
WORD wData = 0; // data container
|
WORD wData = 0; // data container
|
||||||
WORD wMissed = 0; // missed bit container
|
WORD wMissed = 0; // missed bit container
|
||||||
INT nCount = 0; // no. of missed bits
|
INT nCount = 0; // no. of missed bits
|
||||||
|
|
||||||
nFrame = 0; // reset for next character
|
nFrame = 0; // reset for next character
|
||||||
nStart = 0; // disable frame counter
|
nStart = 0; // disable frame counter
|
||||||
|
|
||||||
// separate to data and missed bits
|
// separate to data and missed bits
|
||||||
for (i = 0; i < 12; ++i) // 12 bit frames
|
for (i = 0; i < 12; ++i) // 12 bit frames
|
||||||
{
|
{
|
||||||
BYTE b = (BYTE) (dwData & 3); // last 2 half bits
|
BYTE b = (BYTE) (dwData & 3); // last 2 half bits
|
||||||
|
|
||||||
if (b == 0x0 || b == 0x3) // illegal half bit combination
|
if (b == 0x0 || b == 0x3) // illegal half bit combination
|
||||||
{
|
{
|
||||||
wMissed |= (1 << i); // this is a missed bit
|
wMissed |= (1 << i); // this is a missed bit
|
||||||
++nCount; // incr. number of missed bits
|
++nCount; // incr. number of missed bits
|
||||||
}
|
}
|
||||||
else // valid data bit
|
else // valid data bit
|
||||||
{
|
{
|
||||||
wData |= ((b >> 1) << i); // add data bit
|
wData |= ((b >> 1) << i); // add data bit
|
||||||
}
|
}
|
||||||
dwData >>= 2; // next 2 half bits
|
dwData >>= 2; // next 2 half bits
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nCount <= 2) // error can be fixed
|
if (nCount <= 2) // error can be fixed
|
||||||
{
|
{
|
||||||
BYTE byOrgParity,byNewParity;
|
BYTE byOrgParity,byNewParity;
|
||||||
|
|
||||||
byOrgParity = wData >> 8; // the original parity information with missed bits
|
byOrgParity = wData >> 8; // the original parity information with missed bits
|
||||||
byNewParity = ~(wMissed >> 8); // missed bit mask for recalculated parity
|
byNewParity = ~(wMissed >> 8); // missed bit mask for recalculated parity
|
||||||
|
|
||||||
if (nCount > 0) // error correction
|
if (nCount > 0) // error correction
|
||||||
{
|
{
|
||||||
wData = CorrectData(wData,wMissed);
|
wData = CorrectData(wData,wMissed);
|
||||||
}
|
}
|
||||||
|
|
||||||
wData &= 0xFF; // remove parity information
|
wData &= 0xFF; // remove parity information
|
||||||
|
|
||||||
// recalculate parity data
|
// recalculate parity data
|
||||||
byNewParity &= CreateCorrectionBits((BYTE) wData);
|
byNewParity &= CreateCorrectionBits((BYTE) wData);
|
||||||
|
|
||||||
// wrong parity
|
// wrong parity
|
||||||
if (byOrgParity != byNewParity)
|
if (byOrgParity != byNewParity)
|
||||||
wData = ERR_CHAR; // character for transfer error
|
wData = ERR_CHAR; // character for transfer error
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wData = ERR_CHAR; // character for transfer error
|
wData = ERR_CHAR; // character for transfer error
|
||||||
}
|
}
|
||||||
|
|
||||||
SendByteUdp((BYTE) wData); // send data byte
|
SendByteUdp((BYTE) wData); // send data byte
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nFrame += nStart; // next frame
|
nFrame += nStart; // next frame
|
||||||
return;
|
return;
|
||||||
}
|
}
|
|
@ -1,263 +1,268 @@
|
||||||
//{{NO_DEPENDENCIES}}
|
//{{NO_DEPENDENCIES}}
|
||||||
// Microsoft Developer Studio generated include file.
|
// Microsoft Developer Studio generated include file.
|
||||||
// Used by Emu48.rc
|
// Used by Emu48.rc
|
||||||
//
|
//
|
||||||
#define IDM_DEBUG_SETTINGS 0x0010
|
#define IDM_DEBUG_SETTINGS 0x0010
|
||||||
#define IDI_EMU48 100
|
#define IDI_EMU48 100
|
||||||
#define IDR_MENU 101
|
#define IDR_MENU 101
|
||||||
#define IDM_MENU 102
|
#define IDM_MENU 102
|
||||||
#define IDR_DEBUG 103
|
#define IDR_DEBUG 103
|
||||||
#define IDR_DEBUG_TOOLBAR 104
|
#define IDR_DEBUG_TOOLBAR 104
|
||||||
#define IDR_DEBUG_CODE 105
|
#define IDR_DEBUG_CODE 105
|
||||||
#define IDR_DEBUG_MEM 106
|
#define IDR_DEBUG_MEM 106
|
||||||
#define IDR_DEBUG_STACK 107
|
#define IDR_DEBUG_STACK 107
|
||||||
#define IDB_CHECKBOX 108
|
#define IDB_CHECKBOX 108
|
||||||
#define IDD_ABOUT 109
|
#define IDD_ABOUT 109
|
||||||
#define IDD_SET_GENERAL 110
|
#define IDD_SET_GENERAL 110
|
||||||
#define IDD_SET_MEMORY 111
|
#define IDD_SET_MEMORY 111
|
||||||
#define IDD_SET_PERIPHERAL 112
|
#define IDD_SET_PERIPHERAL 112
|
||||||
#define IDD_CHOOSEKML 113
|
#define IDD_CHOOSEKML 113
|
||||||
#define IDD_KMLLOG 114
|
#define IDD_KMLLOG 114
|
||||||
#define IDD_DISASM 115
|
#define IDD_DISASM 115
|
||||||
#define IDD_DEBUG 116
|
#define IDD_DEBUG 116
|
||||||
#define IDD_NEWVALUE 117
|
#define IDD_NEWVALUE 117
|
||||||
#define IDD_ENTERADR 118
|
#define IDD_ENTERADR 118
|
||||||
#define IDD_BREAKEDIT 119
|
#define IDD_BREAKEDIT 119
|
||||||
#define IDD_ENTERBREAK 120
|
#define IDD_ENTERBREAK 120
|
||||||
#define IDD_INSTRUCTIONS 121
|
#define IDD_INSTRUCTIONS 121
|
||||||
#define IDD_WRITEONLYREG 122
|
#define IDD_WRITEONLYREG 122
|
||||||
#define IDD_FIND 123
|
#define IDD_FIND 123
|
||||||
#define IDD_PROFILE 124
|
#define IDD_PROFILE 124
|
||||||
#define IDD_RPLVIEW 125
|
#define IDD_RPLVIEW 125
|
||||||
#define IDD_MACROSET 126
|
#define IDD_MACROSET 126
|
||||||
#define IDD_DEBUG_MEMSAVE 127
|
#define IDD_DEBUG_MEMSAVE 127
|
||||||
#define IDD_DEBUG_MEMLOAD 128
|
#define IDD_DEBUG_MEMLOAD 128
|
||||||
#define IDD_DEBUG_SETTINGS 129
|
#define IDD_DEBUG_SETTINGS 129
|
||||||
#define IDD_TRACE 130
|
#define IDD_TRACE 130
|
||||||
#define IDC_REALSPEED 1000
|
#define IDC_REALSPEED 1000
|
||||||
#define IDC_GRAYSCALE 1001
|
#define IDC_GRAYSCALE 1001
|
||||||
#define IDC_ALWAYSONTOP 1002
|
#define IDC_ALWAYSONTOP 1002
|
||||||
#define IDC_ACTFOLLOWSMOUSE 1003
|
#define IDC_ACTFOLLOWSMOUSE 1003
|
||||||
#define IDC_SINGLEINSTANCE 1004
|
#define IDC_SINGLEINSTANCE 1004
|
||||||
#define IDC_AUTOSAVE 1005
|
#define IDC_AUTOSAVE 1005
|
||||||
#define IDC_AUTOSAVEONEXIT 1006
|
#define IDC_AUTOSAVEONEXIT 1006
|
||||||
#define IDC_OBJECTLOADWARNING 1007
|
#define IDC_OBJECTLOADWARNING 1007
|
||||||
#define IDC_SHOWTITLE 1008
|
#define IDC_SHOWTITLE 1008
|
||||||
#define IDC_SHOWMENU 1009
|
#define IDC_SHOWMENU 1009
|
||||||
#define IDC_ALWAYSDISPLOG 1010
|
#define IDC_ALWAYSDISPLOG 1010
|
||||||
#define IDC_PORT1EN 1011
|
#define IDC_PORT1EN 1011
|
||||||
#define IDC_PORT1WR 1012
|
#define IDC_PORT1WR 1012
|
||||||
#define IDC_PORT2ISSHARED 1013
|
#define IDC_PORT2ISSHARED 1013
|
||||||
#define IDC_PORT2WR 1014
|
#define IDC_PORT2WR 1014
|
||||||
#define IDC_PORT2 1015
|
#define IDC_PORT2 1015
|
||||||
#define IDC_PORT2LOAD 1016
|
#define IDC_PORT2LOAD 1016
|
||||||
#define IDC_IR_ADDR 1017
|
#define IDC_IR_ADDR 1017
|
||||||
#define IDC_IR_PORT 1018
|
#define IDC_IR_PORT 1018
|
||||||
#define IDC_WIRE 1019
|
#define IDC_WIRE 1019
|
||||||
#define IDC_IR 1020
|
#define IDC_IR 1020
|
||||||
#define IDC_EMUDIR 1021
|
#define IDC_EMUDIR 1021
|
||||||
#define IDC_EMUDIRSEL 1022
|
#define IDC_EMUDIRSEL 1022
|
||||||
#define IDC_UPDATE 1023
|
#define IDC_UPDATE 1023
|
||||||
#define IDC_KMLSCRIPT 1024
|
#define IDC_KMLSCRIPT 1024
|
||||||
#define IDC_AUTHOR 1025
|
#define IDC_AUTHOR 1025
|
||||||
#define IDC_TITLE 1026
|
#define IDC_TITLE 1026
|
||||||
#define IDC_KMLLOG 1027
|
#define IDC_KMLLOG 1027
|
||||||
#define IDC_VERSION 1028
|
#define IDC_VERSION 1028
|
||||||
#define IDC_LICENSE 1029
|
#define IDC_LICENSE 1029
|
||||||
#define IDC_DISASM_WIN 1030
|
#define IDC_DISASM_WIN 1030
|
||||||
#define IDC_DISASM_MODE_TEXT 1031
|
#define IDC_DISASM_MODE_TEXT 1031
|
||||||
#define IDC_DISASM_MODE 1032
|
#define IDC_DISASM_MODE 1032
|
||||||
#define IDC_DISASM_MODULE 1033
|
#define IDC_DISASM_MODULE 1033
|
||||||
#define IDC_DISASM_HP 1034
|
#define IDC_DISASM_HP 1034
|
||||||
#define IDC_DISASM_CLASS 1035
|
#define IDC_DISASM_CLASS 1035
|
||||||
#define IDC_ADDRESS 1036
|
#define IDC_ADDRESS 1036
|
||||||
#define IDC_DISASM_ADR 1037
|
#define IDC_DISASM_ADR 1037
|
||||||
#define IDC_DISASM_NEXT 1038
|
#define IDC_DISASM_NEXT 1038
|
||||||
#define IDC_DISASM_COPY 1039
|
#define IDC_DISASM_COPY 1039
|
||||||
#define IDC_DEBUG_CODE 1040
|
#define IDC_DEBUG_CODE 1040
|
||||||
#define IDC_STATIC_CODE 1041
|
#define IDC_STATIC_CODE 1041
|
||||||
#define IDC_STATIC_REGISTERS 1042
|
#define IDC_STATIC_REGISTERS 1042
|
||||||
#define IDC_STATIC_MEMORY 1043
|
#define IDC_STATIC_MEMORY 1043
|
||||||
#define IDC_STATIC_STACK 1044
|
#define IDC_STATIC_STACK 1044
|
||||||
#define IDC_REG_A 1045
|
#define IDC_REG_A 1045
|
||||||
#define IDC_REG_B 1046
|
#define IDC_REG_B 1046
|
||||||
#define IDC_REG_C 1047
|
#define IDC_REG_C 1047
|
||||||
#define IDC_REG_D 1048
|
#define IDC_REG_D 1048
|
||||||
#define IDC_REG_R0 1049
|
#define IDC_REG_R0 1049
|
||||||
#define IDC_REG_R1 1050
|
#define IDC_REG_R1 1050
|
||||||
#define IDC_REG_R2 1051
|
#define IDC_REG_R2 1051
|
||||||
#define IDC_REG_R3 1052
|
#define IDC_REG_R3 1052
|
||||||
#define IDC_REG_R4 1053
|
#define IDC_REG_R4 1053
|
||||||
#define IDC_REG_D0 1054
|
#define IDC_REG_D0 1054
|
||||||
#define IDC_REG_D1 1055
|
#define IDC_REG_D1 1055
|
||||||
#define IDC_REG_P 1056
|
#define IDC_REG_P 1056
|
||||||
#define IDC_REG_PC 1057
|
#define IDC_REG_PC 1057
|
||||||
#define IDC_REG_OUT 1058
|
#define IDC_REG_OUT 1058
|
||||||
#define IDC_REG_IN 1059
|
#define IDC_REG_IN 1059
|
||||||
#define IDC_REG_ST 1060
|
#define IDC_REG_ST 1060
|
||||||
#define IDC_REG_CY 1061
|
#define IDC_REG_CY 1061
|
||||||
#define IDC_REG_MODE 1062
|
#define IDC_REG_MODE 1062
|
||||||
#define IDC_REG_MP 1063
|
#define IDC_REG_MP 1063
|
||||||
#define IDC_REG_SR 1064
|
#define IDC_REG_SR 1064
|
||||||
#define IDC_REG_SB 1065
|
#define IDC_REG_SB 1065
|
||||||
#define IDC_REG_XM 1066
|
#define IDC_REG_XM 1066
|
||||||
#define IDC_MISC_INT 1067
|
#define IDC_MISC_INT 1067
|
||||||
#define IDC_MISC_KEY 1068
|
#define IDC_MISC_KEY 1068
|
||||||
#define IDC_MISC_BS 1069
|
#define IDC_MISC_BS 1069
|
||||||
#define IDC_NEWVALUE 1070
|
#define IDC_NEWVALUE 1070
|
||||||
#define IDC_ENTERADR 1071
|
#define IDC_ENTERADR 1071
|
||||||
#define IDC_DEBUG_MEM 1072
|
#define IDC_DEBUG_MEM 1072
|
||||||
#define IDC_DEBUG_MEM_ADDR 1073
|
#define IDC_DEBUG_MEM_ADDR 1073
|
||||||
#define IDC_DEBUG_MEM_COL0 1074
|
#define IDC_DEBUG_MEM_COL0 1074
|
||||||
#define IDC_DEBUG_MEM_COL1 1075
|
#define IDC_DEBUG_MEM_COL1 1075
|
||||||
#define IDC_DEBUG_MEM_COL2 1076
|
#define IDC_DEBUG_MEM_COL2 1076
|
||||||
#define IDC_DEBUG_MEM_COL3 1077
|
#define IDC_DEBUG_MEM_COL3 1077
|
||||||
#define IDC_DEBUG_MEM_COL4 1078
|
#define IDC_DEBUG_MEM_COL4 1078
|
||||||
#define IDC_DEBUG_MEM_COL5 1079
|
#define IDC_DEBUG_MEM_COL5 1079
|
||||||
#define IDC_DEBUG_MEM_COL6 1080
|
#define IDC_DEBUG_MEM_COL6 1080
|
||||||
#define IDC_DEBUG_MEM_COL7 1081
|
#define IDC_DEBUG_MEM_COL7 1081
|
||||||
#define IDC_DEBUG_MEM_TEXT 1082
|
#define IDC_DEBUG_MEM_TEXT 1082
|
||||||
#define IDC_DEBUG_DATA_FILE 1083
|
#define IDC_DEBUG_DATA_FILE 1083
|
||||||
#define IDC_DEBUG_DATA_BUT 1084
|
#define IDC_DEBUG_DATA_BUT 1084
|
||||||
#define IDC_DEBUG_DATA_STARTADDR 1085
|
#define IDC_DEBUG_DATA_STARTADDR 1085
|
||||||
#define IDC_DEBUG_DATA_ENDADDR 1086
|
#define IDC_DEBUG_DATA_ENDADDR 1086
|
||||||
#define IDC_DEBUG_SET_SYMB 1087
|
#define IDC_DEBUG_DATA_SAVE_8BIT 1087
|
||||||
#define IDC_DEBUG_SET_MODEL 1088
|
#define IDC_DEBUG_DATA_SAVE_4BIT 1088
|
||||||
#define IDC_DEBUG_SET_FILE 1089
|
#define IDC_DEBUG_DATA_LOAD_8BIT 1089
|
||||||
#define IDC_DEBUG_SET_BROWSE 1090
|
#define IDC_DEBUG_DATA_LOAD_4BIT 1090
|
||||||
#define IDC_DEBUG_STACK 1091
|
#define IDC_DEBUG_DATA_LOAD_ABIT 1091
|
||||||
#define IDC_STATIC_BREAKPOINT 1092
|
#define IDC_DEBUG_SET_SYMB 1092
|
||||||
#define IDC_BREAKEDIT_ADD 1093
|
#define IDC_DEBUG_SET_MODEL 1093
|
||||||
#define IDC_BREAKEDIT_DELETE 1094
|
#define IDC_DEBUG_SET_FILE 1094
|
||||||
#define IDC_BREAKEDIT_WND 1095
|
#define IDC_DEBUG_SET_BROWSE 1095
|
||||||
#define IDC_STATIC_MMU 1096
|
#define IDC_DEBUG_STACK 1096
|
||||||
#define IDC_MMU_IO_A 1097
|
#define IDC_STATIC_BREAKPOINT 1097
|
||||||
#define IDC_MMU_NCE2_A 1098
|
#define IDC_BREAKEDIT_ADD 1098
|
||||||
#define IDC_MMU_CE1_A 1099
|
#define IDC_BREAKEDIT_DELETE 1099
|
||||||
#define IDC_MMU_CE2_A 1100
|
#define IDC_BREAKEDIT_WND 1100
|
||||||
#define IDC_MMU_NCE3_A 1101
|
#define IDC_STATIC_MMU 1101
|
||||||
#define IDC_MMU_IO_S 1102
|
#define IDC_MMU_IO_A 1102
|
||||||
#define IDC_MMU_CE1_S 1103
|
#define IDC_MMU_NCE2_A 1103
|
||||||
#define IDC_MMU_CE2_S 1104
|
#define IDC_MMU_CE1_A 1104
|
||||||
#define IDC_MMU_NCE2_S 1105
|
#define IDC_MMU_CE2_A 1105
|
||||||
#define IDC_MMU_NCE3_S 1106
|
#define IDC_MMU_NCE3_A 1106
|
||||||
#define IDC_STATIC_MISC 1107
|
#define IDC_MMU_IO_S 1107
|
||||||
#define IDC_MISC_BS_TXT 1108
|
#define IDC_MMU_CE1_S 1108
|
||||||
#define IDC_INSTR_TEXT 1109
|
#define IDC_MMU_CE2_S 1109
|
||||||
#define IDC_INSTR_CODE 1110
|
#define IDC_MMU_NCE2_S 1110
|
||||||
#define IDC_INSTR_COPY 1111
|
#define IDC_MMU_NCE3_S 1111
|
||||||
#define IDC_INSTR_CLEAR 1112
|
#define IDC_STATIC_MISC 1112
|
||||||
#define IDC_PROFILE_LASTCYCLES 1113
|
#define IDC_MISC_BS_TXT 1113
|
||||||
#define IDC_PROFILE_LASTTIME 1114
|
#define IDC_INSTR_TEXT 1114
|
||||||
#define IDC_BPCODE 1115
|
#define IDC_INSTR_CODE 1115
|
||||||
#define IDC_BPRPL 1116
|
#define IDC_INSTR_COPY 1116
|
||||||
#define IDC_BPACCESS 1117
|
#define IDC_INSTR_CLEAR 1117
|
||||||
#define IDC_BPREAD 1118
|
#define IDC_PROFILE_LASTCYCLES 1118
|
||||||
#define IDC_BPWRITE 1119
|
#define IDC_PROFILE_LASTTIME 1119
|
||||||
#define IDC_FIND_DATA 1120
|
#define IDC_BPCODE 1120
|
||||||
#define IDC_FIND_PREV 1121
|
#define IDC_BPRPL 1121
|
||||||
#define IDC_FIND_NEXT 1122
|
#define IDC_BPACCESS 1122
|
||||||
#define IDC_FIND_ASCII 1123
|
#define IDC_BPREAD 1123
|
||||||
#define IDC_ADDR20_24 1124
|
#define IDC_BPWRITE 1124
|
||||||
#define IDC_ADDR25_27 1125
|
#define IDC_FIND_DATA 1125
|
||||||
#define IDC_ADDR28_29 1126
|
#define IDC_FIND_PREV 1126
|
||||||
#define IDC_ADDR30_34 1127
|
#define IDC_FIND_NEXT 1127
|
||||||
#define IDC_RPLVIEW_DATA 1128
|
#define IDC_FIND_ASCII 1128
|
||||||
#define IDC_MACRO_SLOW 1129
|
#define IDC_ADDR20_24 1129
|
||||||
#define IDC_MACRO_FAST 1130
|
#define IDC_ADDR25_27 1130
|
||||||
#define IDC_MACRO_SLIDER 1131
|
#define IDC_ADDR28_29 1131
|
||||||
#define IDC_MACRO_REAL 1132
|
#define IDC_ADDR30_34 1132
|
||||||
#define IDC_MACRO_MANUAL 1133
|
#define IDC_RPLVIEW_DATA 1133
|
||||||
#define IDC_SOUND_SLIDER 1134
|
#define IDC_MACRO_SLOW 1134
|
||||||
#define IDC_SOUND_DEVICE 1135
|
#define IDC_MACRO_FAST 1135
|
||||||
#define IDC_TRACE_FILE 1136
|
#define IDC_MACRO_SLIDER 1136
|
||||||
#define IDC_TRACE_BROWSE 1137
|
#define IDC_MACRO_REAL 1137
|
||||||
#define IDC_TRACE_NEW 1138
|
#define IDC_MACRO_MANUAL 1138
|
||||||
#define IDC_TRACE_APPEND 1139
|
#define IDC_SOUND_SLIDER 1139
|
||||||
#define IDC_TRACE_REGISTER 1140
|
#define IDC_SOUND_DEVICE 1140
|
||||||
#define IDC_TRACE_MMU 1141
|
#define IDC_TRACE_FILE 1141
|
||||||
#define IDC_TRACE_OPCODE 1142
|
#define IDC_TRACE_BROWSE 1142
|
||||||
#define ID_FILE_NEW 40001
|
#define IDC_TRACE_NEW 1143
|
||||||
#define ID_FILE_OPEN 40002
|
#define IDC_TRACE_APPEND 1144
|
||||||
#define ID_FILE_SAVE 40003
|
#define IDC_TRACE_REGISTER 1145
|
||||||
#define ID_FILE_SAVEAS 40004
|
#define IDC_TRACE_MMU 1146
|
||||||
#define ID_FILE_EXIT 40005
|
#define IDC_TRACE_OPCODE 1147
|
||||||
#define ID_VIEW_COPY 40006
|
#define ID_FILE_NEW 40001
|
||||||
#define ID_VIEW_SETTINGS 40007
|
#define ID_FILE_OPEN 40002
|
||||||
#define ID_VIEW_RESET 40008
|
#define ID_FILE_SAVE 40003
|
||||||
#define ID_OBJECT_LOAD 40009
|
#define ID_FILE_SAVEAS 40004
|
||||||
#define ID_OBJECT_SAVE 40010
|
#define ID_FILE_EXIT 40005
|
||||||
#define ID_ABOUT 40011
|
#define ID_VIEW_COPY 40006
|
||||||
#define ID_HELP_TOPICS 40012
|
#define ID_VIEW_SETTINGS 40007
|
||||||
#define ID_FILE_CLOSE 40013
|
#define ID_VIEW_RESET 40008
|
||||||
#define ID_BACKUP_SAVE 40014
|
#define ID_OBJECT_LOAD 40009
|
||||||
#define ID_BACKUP_RESTORE 40015
|
#define ID_OBJECT_SAVE 40010
|
||||||
#define ID_BACKUP_DELETE 40016
|
#define ID_ABOUT 40011
|
||||||
#define ID_VIEW_SCRIPT 40017
|
#define ID_HELP_TOPICS 40012
|
||||||
#define ID_STACK_COPY 40019
|
#define ID_FILE_CLOSE 40013
|
||||||
#define ID_STACK_PASTE 40020
|
#define ID_BACKUP_SAVE 40014
|
||||||
#define ID_TOOL_DISASM 40021
|
#define ID_BACKUP_RESTORE 40015
|
||||||
#define ID_TOOL_DEBUG 40022
|
#define ID_BACKUP_DELETE 40016
|
||||||
#define ID_TOOL_MACRO_RECORD 40023
|
#define ID_VIEW_SCRIPT 40017
|
||||||
#define ID_TOOL_MACRO_PLAY 40024
|
#define ID_STACK_COPY 40019
|
||||||
#define ID_TOOL_MACRO_STOP 40025
|
#define ID_STACK_PASTE 40020
|
||||||
#define ID_TOOL_MACRO_SETTINGS 40026
|
#define ID_TOOL_DISASM 40021
|
||||||
#define ID_DEBUG_RUN 40027
|
#define ID_TOOL_DEBUG 40022
|
||||||
#define ID_DEBUG_RUNCURSOR 40028
|
#define ID_TOOL_MACRO_RECORD 40023
|
||||||
#define ID_DEBUG_STEP 40029
|
#define ID_TOOL_MACRO_PLAY 40024
|
||||||
#define ID_DEBUG_STEPOVER 40030
|
#define ID_TOOL_MACRO_STOP 40025
|
||||||
#define ID_DEBUG_BREAK 40031
|
#define ID_TOOL_MACRO_SETTINGS 40026
|
||||||
#define ID_DEBUG_STEPOUT 40032
|
#define ID_DEBUG_RUN 40027
|
||||||
#define ID_DEBUG_CANCEL 40033
|
#define ID_DEBUG_RUNCURSOR 40028
|
||||||
#define ID_BREAKPOINTS_SETBREAK 40034
|
#define ID_DEBUG_STEP 40029
|
||||||
#define ID_BREAKPOINTS_CODEEDIT 40035
|
#define ID_DEBUG_STEPOVER 40030
|
||||||
#define ID_BREAKPOINTS_CLEARALL 40036
|
#define ID_DEBUG_BREAK 40031
|
||||||
#define ID_BREAKPOINTS_NOP3 40037
|
#define ID_DEBUG_STEPOUT 40032
|
||||||
#define ID_BREAKPOINTS_DOCODE 40038
|
#define ID_DEBUG_CANCEL 40033
|
||||||
#define ID_BREAKPOINTS_RPL 40039
|
#define ID_BREAKPOINTS_SETBREAK 40034
|
||||||
#define ID_DEBUG_CODE_GOADR 40040
|
#define ID_BREAKPOINTS_CODEEDIT 40035
|
||||||
#define ID_DEBUG_CODE_GOPC 40041
|
#define ID_BREAKPOINTS_CLEARALL 40036
|
||||||
#define ID_DEBUG_CODE_SETPCTOSELECT 40042
|
#define ID_BREAKPOINTS_NOP3 40037
|
||||||
#define ID_DEBUG_CODE_PREVPCO 40043
|
#define ID_BREAKPOINTS_DOCODE 40038
|
||||||
#define ID_DEBUG_CODE_NEXTPCO 40044
|
#define ID_BREAKPOINTS_RPL 40039
|
||||||
#define ID_DEBUG_MEM_GOADR 40045
|
#define ID_DEBUG_CODE_GOADR 40040
|
||||||
#define ID_DEBUG_MEM_GOPC 40046
|
#define ID_DEBUG_CODE_GOPC 40041
|
||||||
#define ID_DEBUG_MEM_GOD0 40047
|
#define ID_DEBUG_CODE_SETPCTOSELECT 40042
|
||||||
#define ID_DEBUG_MEM_GOD1 40048
|
#define ID_DEBUG_CODE_PREVPCO 40043
|
||||||
#define ID_DEBUG_MEM_GOSTACK 40049
|
#define ID_DEBUG_CODE_NEXTPCO 40044
|
||||||
#define ID_DEBUG_MEM_FNONE 40050
|
#define ID_DEBUG_MEM_GOADR 40045
|
||||||
#define ID_DEBUG_MEM_FADDR 40051
|
#define ID_DEBUG_MEM_GOPC 40046
|
||||||
#define ID_DEBUG_MEM_FPC 40052
|
#define ID_DEBUG_MEM_GOD0 40047
|
||||||
#define ID_DEBUG_MEM_FD0 40053
|
#define ID_DEBUG_MEM_GOD1 40048
|
||||||
#define ID_DEBUG_MEM_FD1 40054
|
#define ID_DEBUG_MEM_GOSTACK 40049
|
||||||
#define ID_DEBUG_MEM_FIND 40055
|
#define ID_DEBUG_MEM_FNONE 40050
|
||||||
#define ID_DEBUG_MEM_MAP 40056
|
#define ID_DEBUG_MEM_FADDR 40051
|
||||||
#define ID_DEBUG_MEM_NCE1 40057
|
#define ID_DEBUG_MEM_FPC 40052
|
||||||
#define ID_DEBUG_MEM_NCE2 40058
|
#define ID_DEBUG_MEM_FD0 40053
|
||||||
#define ID_DEBUG_MEM_CE1 40059
|
#define ID_DEBUG_MEM_FD1 40054
|
||||||
#define ID_DEBUG_MEM_CE2 40060
|
#define ID_DEBUG_MEM_FIND 40055
|
||||||
#define ID_DEBUG_MEM_NCE3 40061
|
#define ID_DEBUG_MEM_MAP 40056
|
||||||
#define ID_DEBUG_MEM_SAVE 40062
|
#define ID_DEBUG_MEM_NCE1 40057
|
||||||
#define ID_DEBUG_MEM_LOAD 40063
|
#define ID_DEBUG_MEM_NCE2 40058
|
||||||
#define ID_DEBUG_MEM_RPLVIEW 40064
|
#define ID_DEBUG_MEM_CE1 40059
|
||||||
#define ID_DEBUG_STACK_PUSH 40065
|
#define ID_DEBUG_MEM_CE2 40060
|
||||||
#define ID_DEBUG_STACK_POP 40066
|
#define ID_DEBUG_MEM_NCE3 40061
|
||||||
#define ID_DEBUG_STACK_MODIFY 40067
|
#define ID_DEBUG_MEM_SAVE 40062
|
||||||
#define ID_INTR_STEPOVERINT 40068
|
#define ID_DEBUG_MEM_LOAD 40063
|
||||||
#define ID_INFO_LASTINSTRUCTIONS 40069
|
#define ID_DEBUG_MEM_RPLVIEW 40064
|
||||||
#define ID_INFO_PROFILE 40070
|
#define ID_DEBUG_STACK_PUSH 40065
|
||||||
#define ID_INFO_WRITEONLYREG 40071
|
#define ID_DEBUG_STACK_POP 40066
|
||||||
#define ID_TRACE_SETTINGS 40072
|
#define ID_DEBUG_STACK_MODIFY 40067
|
||||||
#define ID_TRACE_ENABLE 40073
|
#define ID_INTR_STEPOVERINT 40068
|
||||||
#define ID_FILE_MRU_FILE1 40100
|
#define ID_INFO_LASTINSTRUCTIONS 40069
|
||||||
|
#define ID_INFO_PROFILE 40070
|
||||||
// Next default values for new objects
|
#define ID_INFO_WRITEONLYREG 40071
|
||||||
//
|
#define ID_TRACE_SETTINGS 40072
|
||||||
#ifdef APSTUDIO_INVOKED
|
#define ID_TRACE_ENABLE 40073
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#define ID_FILE_MRU_FILE1 40100
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40074
|
// Next default values for new objects
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1143
|
//
|
||||||
#define _APS_NEXT_SYMED_VALUE 109
|
#ifdef APSTUDIO_INVOKED
|
||||||
#endif
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#endif
|
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40074
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1148
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 109
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -1,250 +1,250 @@
|
||||||
/*
|
/*
|
||||||
* romcrc.c
|
* romcrc.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2022 Christoph Gießelink
|
* Copyright (C) 2022 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
|
|
||||||
// flash page types
|
// flash page types
|
||||||
#define BOOT 0x86
|
#define BOOT 0x86
|
||||||
#define FS 0x18
|
#define FS 0x18
|
||||||
#define SYSTEM 0x32
|
#define SYSTEM 0x32
|
||||||
#define ROM 0x0F
|
#define ROM 0x0F
|
||||||
#define RAM 0xF0
|
#define RAM 0xF0
|
||||||
|
|
||||||
//################
|
//################
|
||||||
//#
|
//#
|
||||||
//# Restore HP38G/HP48GX/SX ROM CRC
|
//# Restore HP38G/HP48GX/SX ROM CRC
|
||||||
//#
|
//#
|
||||||
//################
|
//################
|
||||||
|
|
||||||
// Clarke/Yorke CRC for HP38G and HP48GX/SX
|
// Clarke/Yorke CRC for HP38G and HP48GX/SX
|
||||||
#define a0 0x0 // Start Address
|
#define a0 0x0 // Start Address
|
||||||
#define d0 (n0*16) // Address offset
|
#define d0 (n0*16) // Address offset
|
||||||
#define n0 0x4000 // Reads/Half-Sector
|
#define n0 0x4000 // Reads/Half-Sector
|
||||||
#define s0 1 // #Sectors (Sector Size=2*d)
|
#define s0 1 // #Sectors (Sector Size=2*d)
|
||||||
|
|
||||||
// rebuild of the calculator =CHECKSUM function for the Clarke and the Yorke chip ROM
|
// rebuild of the calculator =CHECKSUM function for the Clarke and the Yorke chip ROM
|
||||||
static WORD Checksum(LPBYTE pbyROM, DWORD dwStart, DWORD dwOffset, INT nReads, INT nSector)
|
static WORD Checksum(LPBYTE pbyROM, DWORD dwStart, DWORD dwOffset, INT nReads, INT nSector)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
WORD wCrc = 0;
|
WORD wCrc = 0;
|
||||||
|
|
||||||
for (;nSector > 0; --nSector) // evaluate each sector
|
for (;nSector > 0; --nSector) // evaluate each sector
|
||||||
{
|
{
|
||||||
LPBYTE pbyAddr1 = pbyROM + dwStart;
|
LPBYTE pbyAddr1 = pbyROM + dwStart;
|
||||||
LPBYTE pbyAddr2 = pbyAddr1 + dwOffset;
|
LPBYTE pbyAddr2 = pbyAddr1 + dwOffset;
|
||||||
|
|
||||||
for (i = 0; i < nReads; ++i) // no. of reads in sector
|
for (i = 0; i < nReads; ++i) // no. of reads in sector
|
||||||
{
|
{
|
||||||
for (j = 0; j < 16; ++j) wCrc = UpCRC(wCrc,*pbyAddr1++);
|
for (j = 0; j < 16; ++j) wCrc = UpCRC(wCrc,*pbyAddr1++);
|
||||||
for (j = 0; j < 16; ++j) wCrc = UpCRC(wCrc,*pbyAddr2++);
|
for (j = 0; j < 16; ++j) wCrc = UpCRC(wCrc,*pbyAddr2++);
|
||||||
}
|
}
|
||||||
|
|
||||||
dwStart += 2 * dwOffset; // next start page
|
dwStart += 2 * dwOffset; // next start page
|
||||||
}
|
}
|
||||||
return wCrc;
|
return wCrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate proper checksum to produce final CRC of FFFF
|
// calculate proper checksum to produce final CRC of FFFF
|
||||||
static __inline WORD CalcChksum(WORD wCrc, WORD wChksum)
|
static __inline WORD CalcChksum(WORD wCrc, WORD wChksum)
|
||||||
{
|
{
|
||||||
WORD q, r = wCrc, s = wChksum;
|
WORD q, r = wCrc, s = wChksum;
|
||||||
|
|
||||||
// first take the last 4-nib back out of the CRC
|
// first take the last 4-nib back out of the CRC
|
||||||
r = (((r >> 12) * 0x811) ^ (r << 4) ^ (s & 0xf));
|
r = (((r >> 12) * 0x811) ^ (r << 4) ^ (s & 0xf));
|
||||||
s >>= 4;
|
s >>= 4;
|
||||||
r = (((r >> 12) * 0x811) ^ (r << 4) ^ (s & 0xf));
|
r = (((r >> 12) * 0x811) ^ (r << 4) ^ (s & 0xf));
|
||||||
s >>= 4;
|
s >>= 4;
|
||||||
r = (((r >> 12) * 0x811) ^ (r << 4) ^ (s & 0xf));
|
r = (((r >> 12) * 0x811) ^ (r << 4) ^ (s & 0xf));
|
||||||
s >>= 4;
|
s >>= 4;
|
||||||
r = (((r >> 12) * 0x811) ^ (r << 4) ^ (s & 0xf));
|
r = (((r >> 12) * 0x811) ^ (r << 4) ^ (s & 0xf));
|
||||||
|
|
||||||
// calculate new checksum to correct the CRC
|
// calculate new checksum to correct the CRC
|
||||||
s = 0xf831; // required MSNs to make goal
|
s = 0xf831; // required MSNs to make goal
|
||||||
q = (q<<4) | ((r ^ s) & 0xf); // get 1st (least sig) nib
|
q = (q<<4) | ((r ^ s) & 0xf); // get 1st (least sig) nib
|
||||||
r = (r>>4) ^ ((s & 0xf) * 0x1081);
|
r = (r>>4) ^ ((s & 0xf) * 0x1081);
|
||||||
s >>= 4;
|
s >>= 4;
|
||||||
q = (q<<4) | ((r ^ s) & 0xf);
|
q = (q<<4) | ((r ^ s) & 0xf);
|
||||||
r = (r>>4) ^ ((s & 0xf) * 0x1081);
|
r = (r>>4) ^ ((s & 0xf) * 0x1081);
|
||||||
s >>= 4;
|
s >>= 4;
|
||||||
q = (q<<4) | ((r ^ s) & 0xf);
|
q = (q<<4) | ((r ^ s) & 0xf);
|
||||||
r = (r>>4) ^ ((s & 0xf) * 0x1081);
|
r = (r>>4) ^ ((s & 0xf) * 0x1081);
|
||||||
s >>= 4;
|
s >>= 4;
|
||||||
q = (q<<4) | ((r ^ s) & 0xf);
|
q = (q<<4) | ((r ^ s) & 0xf);
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID CorrectCrc(DWORD dwAddrCrc, WORD wCrc)
|
static VOID CorrectCrc(DWORD dwAddrCrc, WORD wCrc)
|
||||||
{
|
{
|
||||||
if (wCrc != 0xFFFF) // wrong crc result
|
if (wCrc != 0xFFFF) // wrong crc result
|
||||||
{
|
{
|
||||||
INT s;
|
INT s;
|
||||||
|
|
||||||
// get actual crc correction value
|
// get actual crc correction value
|
||||||
const WORD wChkAct = (pbyRom[dwAddrCrc+0] << 12)
|
const WORD wChkAct = (pbyRom[dwAddrCrc+0] << 12)
|
||||||
| (pbyRom[dwAddrCrc+1] << 8)
|
| (pbyRom[dwAddrCrc+1] << 8)
|
||||||
| (pbyRom[dwAddrCrc+2] << 4)
|
| (pbyRom[dwAddrCrc+2] << 4)
|
||||||
| (pbyRom[dwAddrCrc+3]);
|
| (pbyRom[dwAddrCrc+3]);
|
||||||
|
|
||||||
wCrc = CalcChksum(wCrc,wChkAct); // calculate new checksum
|
wCrc = CalcChksum(wCrc,wChkAct); // calculate new checksum
|
||||||
|
|
||||||
for (s = 3; s >= 0; --s) // write new checksum
|
for (s = 3; s >= 0; --s) // write new checksum
|
||||||
{
|
{
|
||||||
PatchNibble(dwAddrCrc + s,(BYTE) (wCrc & 0xf));
|
PatchNibble(dwAddrCrc + s,(BYTE) (wCrc & 0xf));
|
||||||
wCrc >>= 4;
|
wCrc >>= 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//################
|
//################
|
||||||
//#
|
//#
|
||||||
//# Restore HP49G ROM CRC
|
//# Restore HP49G ROM CRC
|
||||||
//#
|
//#
|
||||||
//################
|
//################
|
||||||
|
|
||||||
static VOID CorrectFlashCrc(LPBYTE pbyMem, DWORD dwSize, DWORD dwOffset, DWORD dwLength)
|
static VOID CorrectFlashCrc(LPBYTE pbyMem, DWORD dwSize, DWORD dwOffset, DWORD dwLength)
|
||||||
{
|
{
|
||||||
// address overflow (data length + 4 nibble CRC)
|
// address overflow (data length + 4 nibble CRC)
|
||||||
if (dwOffset + dwLength + 4 <= dwSize)
|
if (dwOffset + dwLength + 4 <= dwSize)
|
||||||
{
|
{
|
||||||
WORD wRefCrc,wCrc = 0;
|
WORD wRefCrc,wCrc = 0;
|
||||||
|
|
||||||
pbyMem += dwOffset; // start address
|
pbyMem += dwOffset; // start address
|
||||||
|
|
||||||
for (; dwLength > 0; --dwLength) // update CRC
|
for (; dwLength > 0; --dwLength) // update CRC
|
||||||
{
|
{
|
||||||
wCrc = UpCRC(wCrc,*pbyMem++);
|
wCrc = UpCRC(wCrc,*pbyMem++);
|
||||||
}
|
}
|
||||||
|
|
||||||
wRefCrc = (WORD) Npack(pbyMem,4); // read reference CRC
|
wRefCrc = (WORD) Npack(pbyMem,4); // read reference CRC
|
||||||
|
|
||||||
if(wRefCrc != wCrc) // wrong page CRC
|
if(wRefCrc != wCrc) // wrong page CRC
|
||||||
{
|
{
|
||||||
INT s;
|
INT s;
|
||||||
|
|
||||||
// linear CRC address in ROM
|
// linear CRC address in ROM
|
||||||
DWORD dwAddrCrc = (DWORD) (pbyMem - pbyRom);
|
DWORD dwAddrCrc = (DWORD) (pbyMem - pbyRom);
|
||||||
|
|
||||||
wRefCrc = wCrc; // working copy of CRC
|
wRefCrc = wCrc; // working copy of CRC
|
||||||
for (s = 0; s < 4; ++s) // write new checksum
|
for (s = 0; s < 4; ++s) // write new checksum
|
||||||
{
|
{
|
||||||
PatchNibble(dwAddrCrc++,(BYTE) (wRefCrc & 0xf));
|
PatchNibble(dwAddrCrc++,(BYTE) (wRefCrc & 0xf));
|
||||||
wRefCrc >>= 4;
|
wRefCrc >>= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ASSERT(wCrc == (WORD) Npack(pbyMem,4));
|
_ASSERT(wCrc == (WORD) Npack(pbyMem,4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline VOID CorrectFlashRom(LPBYTE pbyMem, DWORD dwSize)
|
static __inline VOID CorrectFlashRom(LPBYTE pbyMem, DWORD dwSize)
|
||||||
{
|
{
|
||||||
CorrectFlashCrc(pbyMem,dwSize,0x20A,Npack(pbyMem+0x20A,5));
|
CorrectFlashCrc(pbyMem,dwSize,0x20A,Npack(pbyMem+0x20A,5));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline VOID CorrectFlashSystem(LPBYTE pbyMem, DWORD dwSize)
|
static __inline VOID CorrectFlashSystem(LPBYTE pbyMem, DWORD dwSize)
|
||||||
{
|
{
|
||||||
CorrectFlashCrc(pbyMem,dwSize,0x20A,Npack(pbyMem+0x100,5));
|
CorrectFlashCrc(pbyMem,dwSize,0x20A,Npack(pbyMem+0x100,5));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline VOID CorrectFlashPage(LPBYTE pbyMem, DWORD dwSize, DWORD dwPage)
|
static __inline VOID CorrectFlashPage(LPBYTE pbyMem, DWORD dwSize, DWORD dwPage)
|
||||||
{
|
{
|
||||||
_ASSERT(dwPage >= 0 && dwPage < 16);
|
_ASSERT(dwPage >= 0 && dwPage < 16);
|
||||||
|
|
||||||
dwPage *= _KB(128); // convert page no. to data offset
|
dwPage *= _KB(128); // convert page no. to data offset
|
||||||
if (dwPage + _KB(128) <= dwSize) // page inside flash chip
|
if (dwPage + _KB(128) <= dwSize) // page inside flash chip
|
||||||
{
|
{
|
||||||
BYTE byType;
|
BYTE byType;
|
||||||
|
|
||||||
pbyMem += dwPage; // page address
|
pbyMem += dwPage; // page address
|
||||||
dwPage = _KB(128); // page size
|
dwPage = _KB(128); // page size
|
||||||
|
|
||||||
// get bank type
|
// get bank type
|
||||||
byType = (BYTE) Npack(pbyMem+0x200,2);
|
byType = (BYTE) Npack(pbyMem+0x200,2);
|
||||||
if (byType == BOOT) // 1st half of page is the boot bank
|
if (byType == BOOT) // 1st half of page is the boot bank
|
||||||
{
|
{
|
||||||
pbyMem += _KB(64); // 2nd half of page
|
pbyMem += _KB(64); // 2nd half of page
|
||||||
dwPage = _KB(64); // page size
|
dwPage = _KB(64); // page size
|
||||||
|
|
||||||
// get bank type
|
// get bank type
|
||||||
byType = (BYTE) Npack(pbyMem+0x200,2);
|
byType = (BYTE) Npack(pbyMem+0x200,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ASSERT(dwPage == _KB(64) || dwPage == _KB(128));
|
_ASSERT(dwPage == _KB(64) || dwPage == _KB(128));
|
||||||
|
|
||||||
switch (byType)
|
switch (byType)
|
||||||
{
|
{
|
||||||
case FS: // FRBankFileSystem
|
case FS: // FRBankFileSystem
|
||||||
case ROM: // FRBankRom
|
case ROM: // FRBankRom
|
||||||
CorrectFlashRom(pbyMem,dwPage);
|
CorrectFlashRom(pbyMem,dwPage);
|
||||||
break;
|
break;
|
||||||
case SYSTEM: // FRBankSystem
|
case SYSTEM: // FRBankSystem
|
||||||
CorrectFlashSystem(pbyMem,dwPage);
|
CorrectFlashSystem(pbyMem,dwPage);
|
||||||
break;
|
break;
|
||||||
case RAM: // FRBankRam
|
case RAM: // FRBankRam
|
||||||
default: // illegal bank identifier
|
default: // illegal bank identifier
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline VOID CorrectAllFlashPages(VOID)
|
static __inline VOID CorrectAllFlashPages(VOID)
|
||||||
{
|
{
|
||||||
DWORD dwPage;
|
DWORD dwPage;
|
||||||
|
|
||||||
// check CRC of all pages
|
// check CRC of all pages
|
||||||
CONST DWORD dwLastPage = dwRomSize / _KB(128);
|
CONST DWORD dwLastPage = dwRomSize / _KB(128);
|
||||||
for (dwPage = 0; dwPage < dwLastPage; ++dwPage)
|
for (dwPage = 0; dwPage < dwLastPage; ++dwPage)
|
||||||
{
|
{
|
||||||
// correct CRC of page
|
// correct CRC of page
|
||||||
CorrectFlashPage(pbyRom,dwRomSize,dwPage);
|
CorrectFlashPage(pbyRom,dwRomSize,dwPage);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//################
|
//################
|
||||||
//#
|
//#
|
||||||
//# Restore ROM CRC
|
//# Restore ROM CRC
|
||||||
//#
|
//#
|
||||||
//################
|
//################
|
||||||
|
|
||||||
VOID RebuildRomCrc(VOID)
|
VOID RebuildRomCrc(VOID)
|
||||||
{
|
{
|
||||||
// HP38G, HP48GX, HP48SX
|
// HP38G, HP48GX, HP48SX
|
||||||
if ((strchr("6AGS",cCurrentRomType)) && dwRomSize >= _KB(256))
|
if ((strchr("6AGS",cCurrentRomType)) && dwRomSize >= _KB(256))
|
||||||
{
|
{
|
||||||
// first 256KB
|
// first 256KB
|
||||||
CorrectCrc(0x7FFFC,Checksum(pbyRom,a0,d0,n0,s0));
|
CorrectCrc(0x7FFFC,Checksum(pbyRom,a0,d0,n0,s0));
|
||||||
}
|
}
|
||||||
// HP38G, HP48GX
|
// HP38G, HP48GX
|
||||||
if ((strchr("6AG",cCurrentRomType)) && dwRomSize == _KB(512))
|
if ((strchr("6AG",cCurrentRomType)) && dwRomSize == _KB(512))
|
||||||
{
|
{
|
||||||
// second 256KB
|
// second 256KB
|
||||||
CorrectCrc(0xFFFFC,Checksum(pbyRom,a0+_KB(256),d0,n0,s0));
|
CorrectCrc(0xFFFFC,Checksum(pbyRom,a0+_KB(256),d0,n0,s0));
|
||||||
}
|
}
|
||||||
// HP39G/40G
|
// HP39G/40G
|
||||||
if (cCurrentRomType == 'E')
|
if (cCurrentRomType == 'E')
|
||||||
{
|
{
|
||||||
// has no Crc
|
// has no Crc
|
||||||
}
|
}
|
||||||
// HP49G
|
// HP49G
|
||||||
if (cCurrentRomType == 'X' && dwRomSize == _KB(2048))
|
if (cCurrentRomType == 'X' && dwRomSize == _KB(2048))
|
||||||
{
|
{
|
||||||
CorrectAllFlashPages(); // go through all pages
|
CorrectAllFlashPages(); // go through all pages
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
|
@ -1,453 +1,453 @@
|
||||||
/*
|
/*
|
||||||
* rpl.c
|
* rpl.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
//| 38G | 39G | 40G | 48SX | 48GX | 49G | Name
|
//| 38G | 39G | 40G | 48SX | 48GX | 49G | Name
|
||||||
//#F0688 #806E9 #806E9 #7056A #806E9 #806E9 =TEMPOB
|
//#F0688 #806E9 #806E9 #7056A #806E9 #806E9 =TEMPOB
|
||||||
//#F068D #806EE #806EE #7056F #806EE #806EE =TEMPTOP
|
//#F068D #806EE #806EE #7056F #806EE #806EE =TEMPTOP
|
||||||
//#F0692 #806F3 #806F3 #70574 #806F3 #806F3 =RSKTOP (B)
|
//#F0692 #806F3 #806F3 #70574 #806F3 #806F3 =RSKTOP (B)
|
||||||
//#F0697 #806F8 #806F8 #70579 #806F8 #806F8 =DSKTOP (D1)
|
//#F0697 #806F8 #806F8 #70579 #806F8 #806F8 =DSKTOP (D1)
|
||||||
//#F069C #806FD #806FD #7057E #806FD #806FD =EDITLINE
|
//#F069C #806FD #806FD #7057E #806FD #806FD =EDITLINE
|
||||||
//#F0DEA #80E9B #80E9B #7066E #807ED #80E9B =AVMEM (D)
|
//#F0DEA #80E9B #80E9B #7066E #807ED #80E9B =AVMEM (D)
|
||||||
//#F0705 #8076B #8076B #705B0 #8072F #8076B =INTRPPTR (D0)
|
//#F0705 #8076B #8076B #705B0 #8072F #8076B =INTRPPTR (D0)
|
||||||
//#F0E42 #80F02 #80F02 #706C5 #80843 #80F02 =SystemFlags
|
//#F0E42 #80F02 #80F02 #706C5 #80843 #80F02 =SystemFlags
|
||||||
|
|
||||||
#define TEMPOB ((cCurrentRomType=='S')?0x7056A:0x806E9)
|
#define TEMPOB ((cCurrentRomType=='S')?0x7056A:0x806E9)
|
||||||
#define TEMPTOP ((cCurrentRomType=='S')?0x7056F:0x806EE)
|
#define TEMPTOP ((cCurrentRomType=='S')?0x7056F:0x806EE)
|
||||||
#define RSKTOP ((cCurrentRomType=='S')?0x70574:0x806F3)
|
#define RSKTOP ((cCurrentRomType=='S')?0x70574:0x806F3)
|
||||||
#define DSKTOP ((cCurrentRomType=='S')?0x70579:0x806F8)
|
#define DSKTOP ((cCurrentRomType=='S')?0x70579:0x806F8)
|
||||||
#define EDITLINE ((cCurrentRomType=='S')?0x7057E:0x806FD)
|
#define EDITLINE ((cCurrentRomType=='S')?0x7057E:0x806FD)
|
||||||
#define AVMEM ((cCurrentRomType!='X')?((cCurrentRomType=='S')?0x7066E:0x807ED):0x80E9B)
|
#define AVMEM ((cCurrentRomType!='X')?((cCurrentRomType=='S')?0x7066E:0x807ED):0x80E9B)
|
||||||
#define INTRPPTR ((cCurrentRomType!='X')?((cCurrentRomType=='S')?0x705B0:0x8072F):0x8076B)
|
#define INTRPPTR ((cCurrentRomType!='X')?((cCurrentRomType=='S')?0x705B0:0x8072F):0x8076B)
|
||||||
#define SYSTEMFLAGS ((cCurrentRomType!='X')?((cCurrentRomType=='S')?0x706C5:0x80843):0x80F02)
|
#define SYSTEMFLAGS ((cCurrentRomType!='X')?((cCurrentRomType=='S')?0x706C5:0x80843):0x80F02)
|
||||||
|
|
||||||
#define DOINT 0x02614 // Precision Integer (HP49G)
|
#define DOINT 0x02614 // Precision Integer (HP49G)
|
||||||
#define DOLNGREAL 0x0263A // Precision Real (HP49G)
|
#define DOLNGREAL 0x0263A // Precision Real (HP49G)
|
||||||
#define DOLNGCMP 0x02660 // Precision Complex (HP49G)
|
#define DOLNGCMP 0x02660 // Precision Complex (HP49G)
|
||||||
#define DOMATRIX 0x02686 // Symbolic matrix (HP49G)
|
#define DOMATRIX 0x02686 // Symbolic matrix (HP49G)
|
||||||
#define DOFLASHP 0x026AC // Flash PTR (HP49G)
|
#define DOFLASHP 0x026AC // Flash PTR (HP49G)
|
||||||
#define DOAPLET 0x026D5 // Aplet (HP49G)
|
#define DOAPLET 0x026D5 // Aplet (HP49G)
|
||||||
#define DOMINIFONT 0x026FE // Mini Font (HP49G)
|
#define DOMINIFONT 0x026FE // Mini Font (HP49G)
|
||||||
#define DOBINT 0x02911 // System Binary
|
#define DOBINT 0x02911 // System Binary
|
||||||
#define DOREAL 0x02933 // Real
|
#define DOREAL 0x02933 // Real
|
||||||
#define DOEREL 0x02955 // Long Real
|
#define DOEREL 0x02955 // Long Real
|
||||||
#define DOCMP 0x02977 // Complex
|
#define DOCMP 0x02977 // Complex
|
||||||
#define DOECMP 0x0299D // Long Complex
|
#define DOECMP 0x0299D // Long Complex
|
||||||
#define DOCHAR 0x029BF // Character
|
#define DOCHAR 0x029BF // Character
|
||||||
#define DOARRY 0x029E8 // Array
|
#define DOARRY 0x029E8 // Array
|
||||||
#define DOLNKARRY 0x02A0A // Linked Array
|
#define DOLNKARRY 0x02A0A // Linked Array
|
||||||
#define DOCSTR 0x02A2C // String
|
#define DOCSTR 0x02A2C // String
|
||||||
#define DOHSTR 0x02A4E // Binary Integer
|
#define DOHSTR 0x02A4E // Binary Integer
|
||||||
#define DOLIST 0x02A74 // List
|
#define DOLIST 0x02A74 // List
|
||||||
#define DORRP 0x02A96 // Directory
|
#define DORRP 0x02A96 // Directory
|
||||||
#define DOSYMB 0x02AB8 // Algebraic
|
#define DOSYMB 0x02AB8 // Algebraic
|
||||||
#define DOEXT 0x02ADA // Unit
|
#define DOEXT 0x02ADA // Unit
|
||||||
#define DOTAG 0x02AFC // Tagged
|
#define DOTAG 0x02AFC // Tagged
|
||||||
#define DOGROB 0x02B1E // Graphic
|
#define DOGROB 0x02B1E // Graphic
|
||||||
#define DOLIB 0x02B40 // Library
|
#define DOLIB 0x02B40 // Library
|
||||||
#define DOBAK 0x02B62 // Backup
|
#define DOBAK 0x02B62 // Backup
|
||||||
#define DOEXT0 0x02B88 // Library Data
|
#define DOEXT0 0x02B88 // Library Data
|
||||||
#define DOEXT1 0x02BAA // Reserved 1, ACcess PoinTeR (HP48GX and later)
|
#define DOEXT1 0x02BAA // Reserved 1, ACcess PoinTeR (HP48GX and later)
|
||||||
#define DOEXT2 0x02BCC // Reserved 2, Font (HP49G)
|
#define DOEXT2 0x02BCC // Reserved 2, Font (HP49G)
|
||||||
#define DOEXT3 0x02BEE // Reserved 3
|
#define DOEXT3 0x02BEE // Reserved 3
|
||||||
#define DOEXT4 0x02C10 // Reserved 4
|
#define DOEXT4 0x02C10 // Reserved 4
|
||||||
#define DOCOL 0x02D9D // Program
|
#define DOCOL 0x02D9D // Program
|
||||||
#define DOCODE 0x02DCC // Code
|
#define DOCODE 0x02DCC // Code
|
||||||
#define DOIDNT 0x02E48 // Global Name
|
#define DOIDNT 0x02E48 // Global Name
|
||||||
#define DOLAM 0x02E6D // Local Name
|
#define DOLAM 0x02E6D // Local Name
|
||||||
#define DOROMP 0x02E92 // XLIB Name
|
#define DOROMP 0x02E92 // XLIB Name
|
||||||
#define SEMI 0x0312B // ;
|
#define SEMI 0x0312B // ;
|
||||||
|
|
||||||
#define GARBAGECOL 0x0613E // =GARBAGECOL entry for HP48S/G and HP49G
|
#define GARBAGECOL 0x0613E // =GARBAGECOL entry for HP48S/G and HP49G
|
||||||
|
|
||||||
// check for Metakernel version
|
// check for Metakernel version
|
||||||
#define METAKERNEL Metakernel()
|
#define METAKERNEL Metakernel()
|
||||||
|
|
||||||
// search for "MDGKER:MK2.30" or "MDGKER:PREVIE" in port1 of a HP48GX
|
// search for "MDGKER:MK2.30" or "MDGKER:PREVIE" in port1 of a HP48GX
|
||||||
static BOOL Metakernel(VOID)
|
static BOOL Metakernel(VOID)
|
||||||
{
|
{
|
||||||
BOOL bMkDetect = FALSE;
|
BOOL bMkDetect = FALSE;
|
||||||
|
|
||||||
// card in slot1 of a HP48GX enabled
|
// card in slot1 of a HP48GX enabled
|
||||||
if (cCurrentRomType=='G' && Port1 && Chipset.cards_status & PORT1_PRESENT)
|
if (cCurrentRomType=='G' && Port1 && Chipset.cards_status & PORT1_PRESENT)
|
||||||
{
|
{
|
||||||
// check for Metakernel string "MDGKER:"
|
// check for Metakernel string "MDGKER:"
|
||||||
if (!strncmp((LPCSTR) &Port1[12],"\xD\x4\x4\x4\x7\x4\xB\x4\x5\x4\x2\x5\xA\x3",14))
|
if (!strncmp((LPCSTR) &Port1[12],"\xD\x4\x4\x4\x7\x4\xB\x4\x5\x4\x2\x5\xA\x3",14))
|
||||||
{
|
{
|
||||||
bMkDetect = TRUE; // Metakernel detected
|
bMkDetect = TRUE; // Metakernel detected
|
||||||
// check for "MK"
|
// check for "MK"
|
||||||
if (!strncmp((LPCSTR) &Port1[26],"\xD\x4\xB\x4",4))
|
if (!strncmp((LPCSTR) &Port1[26],"\xD\x4\xB\x4",4))
|
||||||
{
|
{
|
||||||
// get version number
|
// get version number
|
||||||
WORD wVersion = ((Port1[30] * 10) + Port1[34]) * 10
|
WORD wVersion = ((Port1[30] * 10) + Port1[34]) * 10
|
||||||
+ Port1[36];
|
+ Port1[36];
|
||||||
|
|
||||||
// version newer then V2.30, then compatible with HP OS
|
// version newer then V2.30, then compatible with HP OS
|
||||||
bMkDetect = (wVersion <= 230);
|
bMkDetect = (wVersion <= 230);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bMkDetect;
|
return bMkDetect;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD RPL_GarbageCol(VOID) // RPL variables must be in system RAM
|
static DWORD RPL_GarbageCol(VOID) // RPL variables must be in system RAM
|
||||||
{
|
{
|
||||||
CHIPSET OrgChipset;
|
CHIPSET OrgChipset;
|
||||||
DWORD dwAVMEM;
|
DWORD dwAVMEM;
|
||||||
|
|
||||||
// only for HP48SX, HP48GX and HP49G
|
// only for HP48SX, HP48GX and HP49G
|
||||||
_ASSERT(cCurrentRomType == 'S' || cCurrentRomType == 'G' || cCurrentRomType == 'X');
|
_ASSERT(cCurrentRomType == 'S' || cCurrentRomType == 'G' || cCurrentRomType == 'X');
|
||||||
|
|
||||||
OrgChipset = Chipset; // save original chipset
|
OrgChipset = Chipset; // save original chipset
|
||||||
|
|
||||||
// entry for =GARBAGECOL
|
// entry for =GARBAGECOL
|
||||||
Chipset.P = 0; // P=0
|
Chipset.P = 0; // P=0
|
||||||
Chipset.mode_dec = FALSE; // hex mode
|
Chipset.mode_dec = FALSE; // hex mode
|
||||||
Chipset.pc = GARBAGECOL; // =GARBAGECOL entry
|
Chipset.pc = GARBAGECOL; // =GARBAGECOL entry
|
||||||
rstkpush(0xFFFFF); // return address for stopping
|
rstkpush(0xFFFFF); // return address for stopping
|
||||||
|
|
||||||
while (Chipset.pc != 0xFFFFF) // wait for stop address
|
while (Chipset.pc != 0xFFFFF) // wait for stop address
|
||||||
{
|
{
|
||||||
EvalOpcode(FASTPTR(Chipset.pc)); // execute opcode
|
EvalOpcode(FASTPTR(Chipset.pc)); // execute opcode
|
||||||
}
|
}
|
||||||
|
|
||||||
dwAVMEM = Npack(Chipset.C,5); // available AVMEM
|
dwAVMEM = Npack(Chipset.C,5); // available AVMEM
|
||||||
Chipset = OrgChipset; // restore original chipset
|
Chipset = OrgChipset; // restore original chipset
|
||||||
return dwAVMEM;
|
return dwAVMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL RPL_GetSystemFlag(INT nFlag)
|
BOOL RPL_GetSystemFlag(INT nFlag)
|
||||||
{
|
{
|
||||||
DWORD dwAddr;
|
DWORD dwAddr;
|
||||||
BYTE byMask,byFlag;
|
BYTE byMask,byFlag;
|
||||||
|
|
||||||
_ASSERT(nFlag > 0); // first flag is 1
|
_ASSERT(nFlag > 0); // first flag is 1
|
||||||
|
|
||||||
// calculate memory address and bit mask
|
// calculate memory address and bit mask
|
||||||
dwAddr = SYSTEMFLAGS + (nFlag - 1) / 4;
|
dwAddr = SYSTEMFLAGS + (nFlag - 1) / 4;
|
||||||
byMask = 1 << ((nFlag - 1) & 0x3);
|
byMask = 1 << ((nFlag - 1) & 0x3);
|
||||||
|
|
||||||
Npeek(&byFlag,dwAddr,sizeof(byFlag));
|
Npeek(&byFlag,dwAddr,sizeof(byFlag));
|
||||||
return (byFlag & byMask) != 0;
|
return (byFlag & byMask) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD RPL_SkipOb(DWORD d)
|
DWORD RPL_SkipOb(DWORD d)
|
||||||
{
|
{
|
||||||
BYTE X[8];
|
BYTE X[8];
|
||||||
DWORD n, l;
|
DWORD n, l;
|
||||||
|
|
||||||
Npeek(X,d,5);
|
Npeek(X,d,5);
|
||||||
n = Npack(X, 5); // read prolog
|
n = Npack(X, 5); // read prolog
|
||||||
switch (n)
|
switch (n)
|
||||||
{
|
{
|
||||||
case DOFLASHP: l = (cCurrentRomType!='X') ? 5 : 12; break; // Flash PTR (HP49G)
|
case DOFLASHP: l = (cCurrentRomType!='X') ? 5 : 12; break; // Flash PTR (HP49G)
|
||||||
case DOBINT: l = 10; break; // System Binary
|
case DOBINT: l = 10; break; // System Binary
|
||||||
case DOREAL: l = 21; break; // Real
|
case DOREAL: l = 21; break; // Real
|
||||||
case DOEREL: l = 26; break; // Long Real
|
case DOEREL: l = 26; break; // Long Real
|
||||||
case DOCMP: l = 37; break; // Complex
|
case DOCMP: l = 37; break; // Complex
|
||||||
case DOECMP: l = 47; break; // Long Complex
|
case DOECMP: l = 47; break; // Long Complex
|
||||||
case DOCHAR: l = 7; break; // Character
|
case DOCHAR: l = 7; break; // Character
|
||||||
case DOROMP: l = 11; break; // XLIB Name
|
case DOROMP: l = 11; break; // XLIB Name
|
||||||
case DOMATRIX: // Symbolic matrix (HP49G)
|
case DOMATRIX: // Symbolic matrix (HP49G)
|
||||||
if (cCurrentRomType!='X')
|
if (cCurrentRomType!='X')
|
||||||
{
|
{
|
||||||
l = 5;
|
l = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOLIST: // List
|
case DOLIST: // List
|
||||||
case DOSYMB: // Algebraic
|
case DOSYMB: // Algebraic
|
||||||
case DOEXT: // Unit
|
case DOEXT: // Unit
|
||||||
case DOCOL: // Program
|
case DOCOL: // Program
|
||||||
n=d+5;
|
n=d+5;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
d=n; n=RPL_SkipOb(d);
|
d=n; n=RPL_SkipOb(d);
|
||||||
} while (d!=n);
|
} while (d!=n);
|
||||||
return n+5;
|
return n+5;
|
||||||
case SEMI: return d; // SEMI
|
case SEMI: return d; // SEMI
|
||||||
case DOIDNT: // Global Name
|
case DOIDNT: // Global Name
|
||||||
case DOLAM: // Local Name
|
case DOLAM: // Local Name
|
||||||
case DOTAG: // Tagged
|
case DOTAG: // Tagged
|
||||||
Npeek(X,d+5,2); n = 7 + Npack(X,2)*2;
|
Npeek(X,d+5,2); n = 7 + Npack(X,2)*2;
|
||||||
return RPL_SkipOb(d+n);
|
return RPL_SkipOb(d+n);
|
||||||
case DORRP: // Directory
|
case DORRP: // Directory
|
||||||
d+=8;
|
d+=8;
|
||||||
n = Read5(d);
|
n = Read5(d);
|
||||||
if (n==0)
|
if (n==0)
|
||||||
{
|
{
|
||||||
return d+5;
|
return d+5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d+=n;
|
d+=n;
|
||||||
Npeek(X,d,2);
|
Npeek(X,d,2);
|
||||||
n = Npack(X,2)*2 + 4;
|
n = Npack(X,2)*2 + 4;
|
||||||
return RPL_SkipOb(d+n);
|
return RPL_SkipOb(d+n);
|
||||||
}
|
}
|
||||||
case DOINT: // Precision Integer (HP49G)
|
case DOINT: // Precision Integer (HP49G)
|
||||||
case DOAPLET: // Aplet (HP49G)
|
case DOAPLET: // Aplet (HP49G)
|
||||||
case DOMINIFONT: // Mini Font (HP49G)
|
case DOMINIFONT: // Mini Font (HP49G)
|
||||||
if (cCurrentRomType!='X')
|
if (cCurrentRomType!='X')
|
||||||
{
|
{
|
||||||
l = 5;
|
l = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOARRY: // Array
|
case DOARRY: // Array
|
||||||
case DOLNKARRY: // Linked Array
|
case DOLNKARRY: // Linked Array
|
||||||
case DOCSTR: // String
|
case DOCSTR: // String
|
||||||
case DOHSTR: // Binary Integer
|
case DOHSTR: // Binary Integer
|
||||||
case DOGROB: // Graphic
|
case DOGROB: // Graphic
|
||||||
case DOLIB: // Library
|
case DOLIB: // Library
|
||||||
case DOBAK: // Backup
|
case DOBAK: // Backup
|
||||||
case DOEXT0: // Library Data
|
case DOEXT0: // Library Data
|
||||||
case DOEXT1: // Reserved 1
|
case DOEXT1: // Reserved 1
|
||||||
if (n == DOEXT1 && cCurrentRomType != 'S')
|
if (n == DOEXT1 && cCurrentRomType != 'S')
|
||||||
{
|
{
|
||||||
// on HP48G series and later interpreted as DOACPTR
|
// on HP48G series and later interpreted as DOACPTR
|
||||||
l = 15; break; // ACcess PoinTeR
|
l = 15; break; // ACcess PoinTeR
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOEXT2: // Reserved 2, Font (HP49G)
|
case DOEXT2: // Reserved 2, Font (HP49G)
|
||||||
case DOEXT3: // Reserved 3
|
case DOEXT3: // Reserved 3
|
||||||
case DOEXT4: // Reserved 4
|
case DOEXT4: // Reserved 4
|
||||||
case DOCODE: // Code
|
case DOCODE: // Code
|
||||||
l = 5+Read5(d+5);
|
l = 5+Read5(d+5);
|
||||||
break;
|
break;
|
||||||
case DOLNGREAL: // Precision Real (HP49G)
|
case DOLNGREAL: // Precision Real (HP49G)
|
||||||
l = 5;
|
l = 5;
|
||||||
if (cCurrentRomType=='X')
|
if (cCurrentRomType=='X')
|
||||||
{
|
{
|
||||||
l += Read5(d+l);
|
l += Read5(d+l);
|
||||||
l += Read5(d+l);
|
l += Read5(d+l);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DOLNGCMP: // Precision Complex (HP49G)
|
case DOLNGCMP: // Precision Complex (HP49G)
|
||||||
l = 5;
|
l = 5;
|
||||||
if (cCurrentRomType=='X')
|
if (cCurrentRomType=='X')
|
||||||
{
|
{
|
||||||
l += Read5(d+l);
|
l += Read5(d+l);
|
||||||
l += Read5(d+l);
|
l += Read5(d+l);
|
||||||
l += Read5(d+l);
|
l += Read5(d+l);
|
||||||
l += Read5(d+l);
|
l += Read5(d+l);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: return d+5;
|
default: return d+5;
|
||||||
}
|
}
|
||||||
return d+l;
|
return d+l;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD RPL_ObjectSize(BYTE *o,DWORD s)
|
DWORD RPL_ObjectSize(BYTE *o,DWORD s)
|
||||||
{
|
{
|
||||||
DWORD n, l = 0;
|
DWORD n, l = 0;
|
||||||
|
|
||||||
if (s < 5) return BAD_OB; // size too small for prolog
|
if (s < 5) return BAD_OB; // size too small for prolog
|
||||||
n = Npack(o,5); // read prolog
|
n = Npack(o,5); // read prolog
|
||||||
switch (n)
|
switch (n)
|
||||||
{
|
{
|
||||||
case DOFLASHP: l = (cCurrentRomType!='X') ? 5 : 12; break; // Flash PTR (HP49G)
|
case DOFLASHP: l = (cCurrentRomType!='X') ? 5 : 12; break; // Flash PTR (HP49G)
|
||||||
case DOBINT: l = 10; break; // System Binary
|
case DOBINT: l = 10; break; // System Binary
|
||||||
case DOREAL: l = 21; break; // Real
|
case DOREAL: l = 21; break; // Real
|
||||||
case DOEREL: l = 26; break; // Long Real
|
case DOEREL: l = 26; break; // Long Real
|
||||||
case DOCMP: l = 37; break; // Complex
|
case DOCMP: l = 37; break; // Complex
|
||||||
case DOECMP: l = 47; break; // Long Complex
|
case DOECMP: l = 47; break; // Long Complex
|
||||||
case DOCHAR: l = 7; break; // Character
|
case DOCHAR: l = 7; break; // Character
|
||||||
case DOROMP: l = 11; break; // XLIB Name
|
case DOROMP: l = 11; break; // XLIB Name
|
||||||
case DOMATRIX: // Symbolic matrix (HP49G)
|
case DOMATRIX: // Symbolic matrix (HP49G)
|
||||||
if (cCurrentRomType!='X')
|
if (cCurrentRomType!='X')
|
||||||
{
|
{
|
||||||
l = 5;
|
l = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOLIST: // List
|
case DOLIST: // List
|
||||||
case DOSYMB: // Algebraic
|
case DOSYMB: // Algebraic
|
||||||
case DOEXT: // Unit
|
case DOEXT: // Unit
|
||||||
case DOCOL: // Program
|
case DOCOL: // Program
|
||||||
n = 5; // prolog length
|
n = 5; // prolog length
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
l += n;
|
l += n;
|
||||||
if (l > s) return BAD_OB; // prevent negative size argument
|
if (l > s) return BAD_OB; // prevent negative size argument
|
||||||
n = RPL_ObjectSize(o+l,s-l); // get new object
|
n = RPL_ObjectSize(o+l,s-l); // get new object
|
||||||
if (n == BAD_OB) return BAD_OB; // buffer overflow
|
if (n == BAD_OB) return BAD_OB; // buffer overflow
|
||||||
}
|
}
|
||||||
while (n);
|
while (n);
|
||||||
l += 5;
|
l += 5;
|
||||||
break;
|
break;
|
||||||
case SEMI: l = 0; break; // SEMI
|
case SEMI: l = 0; break; // SEMI
|
||||||
case DOIDNT: // Global Name
|
case DOIDNT: // Global Name
|
||||||
case DOLAM: // Local Name
|
case DOLAM: // Local Name
|
||||||
case DOTAG: // Tagged
|
case DOTAG: // Tagged
|
||||||
if (s < 5 + 2) return BAD_OB;
|
if (s < 5 + 2) return BAD_OB;
|
||||||
l = 7 + Npack(o+5,2) * 2; // prolog + name length
|
l = 7 + Npack(o+5,2) * 2; // prolog + name length
|
||||||
if (l > s) return BAD_OB; // prevent negative size argument
|
if (l > s) return BAD_OB; // prevent negative size argument
|
||||||
n = RPL_ObjectSize(o+l,s-l); // get new object
|
n = RPL_ObjectSize(o+l,s-l); // get new object
|
||||||
if (n == BAD_OB) return BAD_OB; // buffer overflow
|
if (n == BAD_OB) return BAD_OB; // buffer overflow
|
||||||
l += n;
|
l += n;
|
||||||
break;
|
break;
|
||||||
case DORRP: // Directory
|
case DORRP: // Directory
|
||||||
if (s < 8 + 5) return BAD_OB;
|
if (s < 8 + 5) return BAD_OB;
|
||||||
n = Npack(o+8,5);
|
n = Npack(o+8,5);
|
||||||
if (n == 0) // empty dir
|
if (n == 0) // empty dir
|
||||||
{
|
{
|
||||||
l = 13;
|
l = 13;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
l = 8 + n;
|
l = 8 + n;
|
||||||
if (s < l + 2) return BAD_OB;
|
if (s < l + 2) return BAD_OB;
|
||||||
n = Npack(o+l,2) * 2 + 4;
|
n = Npack(o+l,2) * 2 + 4;
|
||||||
l += n;
|
l += n;
|
||||||
if (l > s) return BAD_OB; // prevent negative size argument
|
if (l > s) return BAD_OB; // prevent negative size argument
|
||||||
n = RPL_ObjectSize(o+l,s-l); // next rrp
|
n = RPL_ObjectSize(o+l,s-l); // next rrp
|
||||||
if (n == BAD_OB) return BAD_OB; // buffer overflow
|
if (n == BAD_OB) return BAD_OB; // buffer overflow
|
||||||
l += n;
|
l += n;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DOINT: // Precision Integer (HP49G)
|
case DOINT: // Precision Integer (HP49G)
|
||||||
case DOAPLET: // Aplet (HP49G)
|
case DOAPLET: // Aplet (HP49G)
|
||||||
case DOMINIFONT: // Mini Font (HP49G)
|
case DOMINIFONT: // Mini Font (HP49G)
|
||||||
if (cCurrentRomType!='X')
|
if (cCurrentRomType!='X')
|
||||||
{
|
{
|
||||||
l = 5;
|
l = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOARRY: // Array
|
case DOARRY: // Array
|
||||||
case DOLNKARRY: // Linked Array
|
case DOLNKARRY: // Linked Array
|
||||||
case DOCSTR: // String
|
case DOCSTR: // String
|
||||||
case DOHSTR: // Binary Integer
|
case DOHSTR: // Binary Integer
|
||||||
case DOGROB: // Graphic
|
case DOGROB: // Graphic
|
||||||
case DOLIB: // Library
|
case DOLIB: // Library
|
||||||
case DOBAK: // Backup
|
case DOBAK: // Backup
|
||||||
case DOEXT0: // Library Data
|
case DOEXT0: // Library Data
|
||||||
case DOEXT1: // Reserved 1
|
case DOEXT1: // Reserved 1
|
||||||
if (n == DOEXT1 && cCurrentRomType != 'S')
|
if (n == DOEXT1 && cCurrentRomType != 'S')
|
||||||
{
|
{
|
||||||
// on HP48G series and later interpreted as DOACPTR
|
// on HP48G series and later interpreted as DOACPTR
|
||||||
l = 15; break; // ACcess PoinTeR
|
l = 15; break; // ACcess PoinTeR
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOEXT2: // Reserved 2, Font (HP49G)
|
case DOEXT2: // Reserved 2, Font (HP49G)
|
||||||
case DOEXT3: // Reserved 3
|
case DOEXT3: // Reserved 3
|
||||||
case DOEXT4: // Reserved 4
|
case DOEXT4: // Reserved 4
|
||||||
case DOCODE: // Code
|
case DOCODE: // Code
|
||||||
if (s < 5 + 5) return BAD_OB;
|
if (s < 5 + 5) return BAD_OB;
|
||||||
l = 5 + Npack(o+5,5);
|
l = 5 + Npack(o+5,5);
|
||||||
break;
|
break;
|
||||||
case DOLNGREAL: // Precision Real (HP49G)
|
case DOLNGREAL: // Precision Real (HP49G)
|
||||||
l = 5;
|
l = 5;
|
||||||
if (cCurrentRomType=='X')
|
if (cCurrentRomType=='X')
|
||||||
{
|
{
|
||||||
if (s < l + 5) return BAD_OB;
|
if (s < l + 5) return BAD_OB;
|
||||||
l += Npack(o+l,5);
|
l += Npack(o+l,5);
|
||||||
if (s < l + 5) return BAD_OB;
|
if (s < l + 5) return BAD_OB;
|
||||||
l += Npack(o+l,5);
|
l += Npack(o+l,5);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DOLNGCMP: // Precision Complex (HP49G)
|
case DOLNGCMP: // Precision Complex (HP49G)
|
||||||
l = 5;
|
l = 5;
|
||||||
if (cCurrentRomType=='X')
|
if (cCurrentRomType=='X')
|
||||||
{
|
{
|
||||||
if (s < l + 5) return BAD_OB;
|
if (s < l + 5) return BAD_OB;
|
||||||
l += Npack(o+l,5);
|
l += Npack(o+l,5);
|
||||||
if (s < l + 5) return BAD_OB;
|
if (s < l + 5) return BAD_OB;
|
||||||
l += Npack(o+l,5);
|
l += Npack(o+l,5);
|
||||||
if (s < l + 5) return BAD_OB;
|
if (s < l + 5) return BAD_OB;
|
||||||
l += Npack(o+l,5);
|
l += Npack(o+l,5);
|
||||||
if (s < l + 5) return BAD_OB;
|
if (s < l + 5) return BAD_OB;
|
||||||
l += Npack(o+l,5);
|
l += Npack(o+l,5);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: l = 5;
|
default: l = 5;
|
||||||
}
|
}
|
||||||
return (s >= l) ? l : BAD_OB;
|
return (s >= l) ? l : BAD_OB;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD RPL_CreateTemp(DWORD l)
|
DWORD RPL_CreateTemp(DWORD l)
|
||||||
{
|
{
|
||||||
DWORD a, b, c;
|
DWORD a, b, c;
|
||||||
BYTE *p;
|
BYTE *p;
|
||||||
|
|
||||||
l += 6; // memory for link field (5) + marker (1) and end
|
l += 6; // memory for link field (5) + marker (1) and end
|
||||||
b = Read5(RSKTOP); // tail address of rtn stack
|
b = Read5(RSKTOP); // tail address of rtn stack
|
||||||
c = Read5(DSKTOP); // top of data stack
|
c = Read5(DSKTOP); // top of data stack
|
||||||
if ((b+l)>c) // there's not enough memory to move DSKTOP
|
if ((b+l)>c) // there's not enough memory to move DSKTOP
|
||||||
{
|
{
|
||||||
RPL_GarbageCol(); // do a garbage collection
|
RPL_GarbageCol(); // do a garbage collection
|
||||||
b = Read5(RSKTOP); // reload tail address of rtn stack
|
b = Read5(RSKTOP); // reload tail address of rtn stack
|
||||||
c = Read5(DSKTOP); // reload top of data stack
|
c = Read5(DSKTOP); // reload top of data stack
|
||||||
}
|
}
|
||||||
if ((b+l)>c) return 0; // check if now there's enough memory to move DSKTOP
|
if ((b+l)>c) return 0; // check if now there's enough memory to move DSKTOP
|
||||||
a = Read5(TEMPTOP); // tail address of top object
|
a = Read5(TEMPTOP); // tail address of top object
|
||||||
Write5(TEMPTOP, a+l); // adjust new end of top object
|
Write5(TEMPTOP, a+l); // adjust new end of top object
|
||||||
Write5(RSKTOP, b+l); // adjust new end of rtn stack
|
Write5(RSKTOP, b+l); // adjust new end of rtn stack
|
||||||
Write5(AVMEM, (c-b-l)/5); // calculate free memory (*5 nibbles)
|
Write5(AVMEM, (c-b-l)/5); // calculate free memory (*5 nibbles)
|
||||||
p = (LPBYTE) malloc(b-a); // move down rtn stack
|
p = (LPBYTE) malloc(b-a); // move down rtn stack
|
||||||
Npeek(p,a,b-a);
|
Npeek(p,a,b-a);
|
||||||
Nwrite(p,a+l,b-a);
|
Nwrite(p,a+l,b-a);
|
||||||
free(p);
|
free(p);
|
||||||
Write5(a+l-5,l); // set object length field
|
Write5(a+l-5,l); // set object length field
|
||||||
return (a+1); // return base address of new object
|
return (a+1); // return base address of new object
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT RPL_Depth(VOID)
|
UINT RPL_Depth(VOID)
|
||||||
{
|
{
|
||||||
return (Read5(EDITLINE) - Read5(DSKTOP)) / 5 - 1;
|
return (Read5(EDITLINE) - Read5(DSKTOP)) / 5 - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD RPL_Pick(UINT l)
|
DWORD RPL_Pick(UINT l)
|
||||||
{
|
{
|
||||||
DWORD stkp;
|
DWORD stkp;
|
||||||
|
|
||||||
_ASSERT(l > 0); // first stack element is one
|
_ASSERT(l > 0); // first stack element is one
|
||||||
if (l == 0) return 0;
|
if (l == 0) return 0;
|
||||||
if (METAKERNEL) ++l; // Metakernel support
|
if (METAKERNEL) ++l; // Metakernel support
|
||||||
if (RPL_Depth() < l) return 0; // not enough elements on stack
|
if (RPL_Depth() < l) return 0; // not enough elements on stack
|
||||||
stkp = Read5(DSKTOP) + (l-1)*5;
|
stkp = Read5(DSKTOP) + (l-1)*5;
|
||||||
return Read5(stkp); // return object address
|
return Read5(stkp); // return object address
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID RPL_Replace(DWORD n)
|
VOID RPL_Replace(DWORD n)
|
||||||
{
|
{
|
||||||
DWORD stkp;
|
DWORD stkp;
|
||||||
|
|
||||||
stkp = Read5(DSKTOP);
|
stkp = Read5(DSKTOP);
|
||||||
if (METAKERNEL) stkp+=5; // Metakernel support
|
if (METAKERNEL) stkp+=5; // Metakernel support
|
||||||
Write5(stkp,n);
|
Write5(stkp,n);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID RPL_Push(UINT l,DWORD n)
|
VOID RPL_Push(UINT l,DWORD n)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
DWORD stkp, avmem;
|
DWORD stkp, avmem;
|
||||||
|
|
||||||
if (l > RPL_Depth() + 1) return; // invalid stack level
|
if (l > RPL_Depth() + 1) return; // invalid stack level
|
||||||
|
|
||||||
avmem = Read5(AVMEM); // amount of free memory
|
avmem = Read5(AVMEM); // amount of free memory
|
||||||
if (avmem == 0) return; // no memory free
|
if (avmem == 0) return; // no memory free
|
||||||
avmem--; // fetch memory
|
avmem--; // fetch memory
|
||||||
Write5(AVMEM,avmem); // save new amount of free memory
|
Write5(AVMEM,avmem); // save new amount of free memory
|
||||||
|
|
||||||
if (METAKERNEL) ++l; // Metakernel, save MK object on stack level 1
|
if (METAKERNEL) ++l; // Metakernel, save MK object on stack level 1
|
||||||
|
|
||||||
stkp = Read5(DSKTOP) - 5; // get pointer of new stack level 1
|
stkp = Read5(DSKTOP) - 5; // get pointer of new stack level 1
|
||||||
Write5(DSKTOP,stkp); // save it
|
Write5(DSKTOP,stkp); // save it
|
||||||
|
|
||||||
for (i = 1; i < l; ++i) // move down stack level entries before insert pos
|
for (i = 1; i < l; ++i) // move down stack level entries before insert pos
|
||||||
{
|
{
|
||||||
Write5(stkp,Read5(stkp+5)); // move down stack level entry
|
Write5(stkp,Read5(stkp+5)); // move down stack level entry
|
||||||
stkp += 5; // next stack entry
|
stkp += 5; // next stack entry
|
||||||
}
|
}
|
||||||
|
|
||||||
Write5(stkp,n); // save pointer of new object on given stack level
|
Write5(stkp,n); // save pointer of new object on given stack level
|
||||||
return;
|
return;
|
||||||
}
|
}
|
|
@ -1,401 +1,400 @@
|
||||||
/*
|
/*
|
||||||
* Serial.c
|
* Serial.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 Christoph Gießelink
|
* Copyright (C) 1998 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
#define INTERRUPT ((void)(Chipset.SoftInt=TRUE,bInterrupt=TRUE))
|
#define INTERRUPT ((void)(Chipset.SoftInt=TRUE,bInterrupt=TRUE))
|
||||||
|
|
||||||
// state of USRQ
|
// state of USRQ
|
||||||
#define NINT2ERBZ ((Chipset.IORam[IOC] & (SON | ERBZ)) == (SON | ERBZ) && (Chipset.IORam[RCS] & RBZ) != 0)
|
#define NINT2ERBZ ((Chipset.IORam[IOC] & (SON | ERBZ)) == (SON | ERBZ) && (Chipset.IORam[RCS] & RBZ) != 0)
|
||||||
#define NINT2ERBF ((Chipset.IORam[IOC] & (SON | ERBF)) == (SON | ERBF) && (Chipset.IORam[RCS] & RBF) != 0)
|
#define NINT2ERBF ((Chipset.IORam[IOC] & (SON | ERBF)) == (SON | ERBF) && (Chipset.IORam[RCS] & RBF) != 0)
|
||||||
#define NINT2ETBE ((Chipset.IORam[IOC] & (SON | ETBE)) == (SON | ETBE) && (Chipset.IORam[TCS] & TBF) == 0)
|
#define NINT2ETBE ((Chipset.IORam[IOC] & (SON | ETBE)) == (SON | ETBE) && (Chipset.IORam[TCS] & TBF) == 0)
|
||||||
|
|
||||||
#define NINT2USRQ (NINT2ERBZ || NINT2ERBF || NINT2ETBE)
|
#define NINT2USRQ (NINT2ERBZ || NINT2ERBF || NINT2ETBE)
|
||||||
|
|
||||||
static HANDLE hComm = NULL;
|
static HANDLE hComm = NULL;
|
||||||
|
|
||||||
static HANDLE hCThreadTxd;
|
static HANDLE hCThreadTxd;
|
||||||
static HANDLE hCThreadEv;
|
static HANDLE hCThreadEv;
|
||||||
|
|
||||||
static HANDLE hEventTxd;
|
static HANDLE hEventTxd;
|
||||||
static BOOL bWriting;
|
static BOOL bWriting;
|
||||||
static BYTE tbr;
|
static BYTE tbr;
|
||||||
|
|
||||||
static BOOL bReading;
|
static BOOL bReading;
|
||||||
static BYTE cBuffer[32];
|
static BYTE cBuffer[32];
|
||||||
static WORD nRp;
|
static WORD nRp;
|
||||||
static DWORD dwBytesRead;
|
static DWORD dwBytesRead;
|
||||||
|
|
||||||
static DWORD WINAPI TransmitThread(LPVOID pParam)
|
static DWORD WINAPI TransmitThread(LPVOID pParam)
|
||||||
{
|
{
|
||||||
OVERLAPPED osWr = { 0 };
|
OVERLAPPED osWr = { 0 };
|
||||||
|
|
||||||
osWr.hEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
|
osWr.hEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
|
||||||
|
|
||||||
while (bWriting)
|
while (bWriting)
|
||||||
{
|
{
|
||||||
WaitForSingleObject(hEventTxd,INFINITE);
|
WaitForSingleObject(hEventTxd,INFINITE);
|
||||||
if (bWriting)
|
if (bWriting)
|
||||||
{
|
{
|
||||||
DWORD dwWritten;
|
DWORD dwWritten;
|
||||||
if (!WriteFile(hComm,(LPCVOID) &tbr,1,&dwWritten,&osWr))
|
if (!WriteFile(hComm,(LPCVOID) &tbr,1,&dwWritten,&osWr))
|
||||||
if (GetLastError() == ERROR_IO_PENDING)
|
if (GetLastError() == ERROR_IO_PENDING)
|
||||||
GetOverlappedResult(hComm,&osWr,&dwWritten,TRUE);
|
GetOverlappedResult(hComm,&osWr,&dwWritten,TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(osWr.hEvent); // close write event handle
|
CloseHandle(osWr.hEvent); // close write event handle
|
||||||
return 0;
|
return 0;
|
||||||
UNREFERENCED_PARAMETER(pParam);
|
UNREFERENCED_PARAMETER(pParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI EventThread(LPVOID pParam)
|
static DWORD WINAPI EventThread(LPVOID pParam)
|
||||||
{
|
{
|
||||||
DWORD dwEvent;
|
DWORD dwEvent;
|
||||||
|
|
||||||
bReading = TRUE; // flag for SerialThread started
|
bReading = TRUE; // flag for SerialThread started
|
||||||
while (bReading)
|
while (bReading)
|
||||||
{
|
{
|
||||||
_ASSERT(hComm != NULL);
|
_ASSERT(hComm != NULL);
|
||||||
WaitCommEvent(hComm,&dwEvent,NULL); // wait for serial event
|
WaitCommEvent(hComm,&dwEvent,NULL); // wait for serial event
|
||||||
if (dwEvent & EV_RXCHAR) // signal char received
|
if (dwEvent & EV_RXCHAR) // signal char received
|
||||||
{
|
{
|
||||||
CommReceive(); // get data
|
CommReceive(); // get data
|
||||||
// interrupt request and emulation thread down
|
// interrupt request and emulation thread down
|
||||||
if (Chipset.SoftInt && Chipset.Shutdn)
|
if (Chipset.SoftInt && Chipset.Shutdn)
|
||||||
{
|
{
|
||||||
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
||||||
SetEvent(hEventShutdn); // wake up emulation thread
|
SetEvent(hEventShutdn); // wake up emulation thread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dwEvent & EV_TXEMPTY) // signal transmit buffer empty
|
if (dwEvent & EV_TXEMPTY) // signal transmit buffer empty
|
||||||
{
|
{
|
||||||
IOBit(TCS,TBZ,FALSE); // clear transmitter busy bit
|
IOBit(TCS,TBZ,FALSE); // clear transmitter busy bit
|
||||||
CommTransmit(); // check for new char to transmit
|
CommTransmit(); // check for new char to transmit
|
||||||
}
|
}
|
||||||
if (dwEvent & EV_ERR) // signal error received
|
if (dwEvent & EV_ERR) // signal error received
|
||||||
{
|
{
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
ClearCommError(hComm,&dwError,NULL);
|
ClearCommError(hComm,&dwError,NULL);
|
||||||
if (dwError & (CE_FRAME | CE_OVERRUN | CE_BREAK))
|
if (dwError & (CE_FRAME | CE_OVERRUN | CE_BREAK))
|
||||||
IOBit(RCS,RER,TRUE); // receiver error
|
IOBit(RCS,RER,TRUE); // receiver error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
UNREFERENCED_PARAMETER(pParam);
|
UNREFERENCED_PARAMETER(pParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CommIsOpen(VOID)
|
BOOL CommIsOpen(VOID)
|
||||||
{
|
{
|
||||||
return hComm != NULL; // have COM port handle
|
return hComm != NULL; // have COM port handle
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort)
|
BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort)
|
||||||
{
|
{
|
||||||
COMMTIMEOUTS CommTimeouts = { MAXDWORD, 0L, 0L, 0L, 0L };
|
COMMTIMEOUTS CommTimeouts = { MAXDWORD, 0L, 0L, 0L, 0L };
|
||||||
|
|
||||||
LPCTSTR strPort = (Chipset.IORam[IR_CTRL] & EIRU) ? strIrPort : strWirePort;
|
LPCTSTR strPort = (Chipset.IORam[IR_CTRL] & EIRU) ? strIrPort : strWirePort;
|
||||||
|
|
||||||
_ASSERT(Chipset.IORam[IOC] & SON); // UART on
|
CommClose(); // close port if already open
|
||||||
CommClose(); // close port if already open
|
|
||||||
|
dwBytesRead = 0L; // no bytes received
|
||||||
dwBytesRead = 0L; // no bytes received
|
|
||||||
|
if (lstrcmp(strPort, _T(NO_SERIAL))) // port defined
|
||||||
if (lstrcmp(strPort, _T(NO_SERIAL))) // port defined
|
{
|
||||||
{
|
TCHAR szDevice[256] = _T("\\\\.\\");
|
||||||
TCHAR szDevice[256] = _T("\\\\.\\");
|
|
||||||
|
// check if device buffer is big enough
|
||||||
// check if device buffer is big enough
|
_ASSERT(lstrlen(szDevice) + lstrlen(strPort) < (INT) ARRAYSIZEOF(szDevice));
|
||||||
_ASSERT(lstrlen(szDevice) + lstrlen(strPort) < (INT) ARRAYSIZEOF(szDevice));
|
if (lstrlen(szDevice) + lstrlen(strPort) >= (INT) ARRAYSIZEOF(szDevice))
|
||||||
if (lstrlen(szDevice) + lstrlen(strPort) >= (INT) ARRAYSIZEOF(szDevice))
|
return hComm != NULL;
|
||||||
return hComm != NULL;
|
|
||||||
|
_tcscat(szDevice,strPort); // device name
|
||||||
_tcscat(szDevice,strPort); // device name
|
hComm = CreateFile(szDevice,
|
||||||
hComm = CreateFile(szDevice,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
0,
|
||||||
0,
|
NULL,
|
||||||
NULL,
|
OPEN_EXISTING,
|
||||||
OPEN_EXISTING,
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
|
||||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
|
NULL);
|
||||||
NULL);
|
|
||||||
|
if (hComm != INVALID_HANDLE_VALUE)
|
||||||
if (hComm != INVALID_HANDLE_VALUE)
|
{
|
||||||
{
|
DWORD dwThreadId;
|
||||||
DWORD dwThreadId;
|
|
||||||
|
nRp = 0; // reset receiver state
|
||||||
nRp = 0; // reset receiver state
|
|
||||||
|
SetCommTimeouts(hComm,&CommTimeouts);
|
||||||
SetCommTimeouts(hComm,&CommTimeouts);
|
CommSetBaud();
|
||||||
CommSetBaud();
|
|
||||||
|
CommTxBRK(); // update BRK condition
|
||||||
CommTxBRK(); // update BRK condition
|
|
||||||
|
// event to transmit character
|
||||||
// event to transmit character
|
hEventTxd = CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||||
hEventTxd = CreateEvent(NULL,FALSE,FALSE,NULL);
|
|
||||||
|
// create char transmit handler
|
||||||
// create char transmit handler
|
bWriting = TRUE;
|
||||||
bWriting = TRUE;
|
hCThreadTxd = CreateThread(NULL,0,&TransmitThread,NULL,CREATE_SUSPENDED,&dwThreadId);
|
||||||
hCThreadTxd = CreateThread(NULL,0,&TransmitThread,NULL,CREATE_SUSPENDED,&dwThreadId);
|
_ASSERT(hCThreadTxd);
|
||||||
_ASSERT(hCThreadTxd);
|
SetThreadPriority(hCThreadTxd,THREAD_PRIORITY_ABOVE_NORMAL);
|
||||||
SetThreadPriority(hCThreadTxd,THREAD_PRIORITY_ABOVE_NORMAL);
|
ResumeThread(hCThreadTxd); // start thread
|
||||||
ResumeThread(hCThreadTxd); // start thread
|
|
||||||
|
// create Comm event handler
|
||||||
// create Comm event handler
|
bReading = FALSE;
|
||||||
bReading = FALSE;
|
SetCommMask(hComm,EV_RXCHAR | EV_TXEMPTY | EV_ERR); // event on RX, TX, error
|
||||||
SetCommMask(hComm,EV_RXCHAR | EV_TXEMPTY | EV_ERR); // event on RX, TX, error
|
hCThreadEv = CreateThread(NULL,0,&EventThread,NULL,CREATE_SUSPENDED,&dwThreadId);
|
||||||
hCThreadEv = CreateThread(NULL,0,&EventThread,NULL,CREATE_SUSPENDED,&dwThreadId);
|
_ASSERT(hCThreadEv);
|
||||||
_ASSERT(hCThreadEv);
|
SetThreadPriority(hCThreadEv,THREAD_PRIORITY_ABOVE_NORMAL);
|
||||||
SetThreadPriority(hCThreadEv,THREAD_PRIORITY_ABOVE_NORMAL);
|
ResumeThread(hCThreadEv); // start thread
|
||||||
ResumeThread(hCThreadEv); // start thread
|
while (!bReading) Sleep(0); // wait for SerialThread started
|
||||||
while (!bReading) Sleep(0); // wait for SerialThread started
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
hComm = NULL;
|
||||||
hComm = NULL;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#if defined DEBUG_SERIAL
|
||||||
#if defined DEBUG_SERIAL
|
{
|
||||||
{
|
TCHAR buffer[256];
|
||||||
TCHAR buffer[256];
|
wsprintf(buffer,_T("COM port %s.\n"),hComm ? _T("opened"): _T("open error"));
|
||||||
wsprintf(buffer,_T("COM port %s.\n"),hComm ? _T("opened"): _T("open error"));
|
OutputDebugString(buffer);
|
||||||
OutputDebugString(buffer);
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
return hComm != NULL;
|
||||||
return hComm != NULL;
|
}
|
||||||
}
|
|
||||||
|
VOID CommClose(VOID)
|
||||||
VOID CommClose(VOID)
|
{
|
||||||
{
|
if (hComm != NULL) // port open
|
||||||
if (hComm != NULL) // port open
|
{
|
||||||
{
|
// workaround to fix problems with some Kermit server programs
|
||||||
// workaround to fix problems with some Kermit server programs
|
// reason: on one hand we have the character transmitting time base on the
|
||||||
// reason: on one hand we have the character transmitting time base on the
|
// selected baudrate, on the other hand the time between sending the last
|
||||||
// selected baudrate, on the other hand the time between sending the last
|
// character and closing the port. The last time is much longer on the real
|
||||||
// character and closing the port. The last time is much longer on the real
|
// calculator than on the emulator running at full speed, therefore the
|
||||||
// calculator than on the emulator running at full speed, therefore the
|
// slow down time on the emulator
|
||||||
// slow down time on the emulator
|
Sleep(25); // slow down time
|
||||||
Sleep(25); // slow down time
|
|
||||||
|
bReading = FALSE; // kill event thread
|
||||||
bReading = FALSE; // kill event thread
|
SetCommMask(hComm,0L); // clear all events and force WaitCommEvent to return
|
||||||
SetCommMask(hComm,0L); // clear all events and force WaitCommEvent to return
|
WaitForSingleObject(hCThreadEv,INFINITE);
|
||||||
WaitForSingleObject(hCThreadEv,INFINITE);
|
CloseHandle(hCThreadEv);
|
||||||
CloseHandle(hCThreadEv);
|
|
||||||
|
bWriting = FALSE; // kill write thread
|
||||||
bWriting = FALSE; // kill write thread
|
SetEvent(hEventTxd); // continue write thread
|
||||||
SetEvent(hEventTxd); // continue write thread
|
WaitForSingleObject(hCThreadTxd,INFINITE);
|
||||||
WaitForSingleObject(hCThreadTxd,INFINITE);
|
CloseHandle(hCThreadTxd);
|
||||||
CloseHandle(hCThreadTxd);
|
|
||||||
|
CloseHandle(hEventTxd); // close Txd event
|
||||||
CloseHandle(hEventTxd); // close Txd event
|
CloseHandle(hComm); // close port
|
||||||
CloseHandle(hComm); // close port
|
hComm = NULL;
|
||||||
hComm = NULL;
|
#if defined DEBUG_SERIAL
|
||||||
#if defined DEBUG_SERIAL
|
OutputDebugString(_T("COM port closed.\n"));
|
||||||
OutputDebugString(_T("COM port closed.\n"));
|
#endif
|
||||||
#endif
|
}
|
||||||
}
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
VOID CommSetBaud(VOID)
|
||||||
VOID CommSetBaud(VOID)
|
{
|
||||||
{
|
if (hComm != NULL)
|
||||||
if (hComm != NULL)
|
{
|
||||||
{
|
const DWORD dwBaudrates[] = { 1200, 1920, 2400, 3840, 4800, 7680, 9600, 15360 };
|
||||||
const DWORD dwBaudrates[] = { 1200, 1920, 2400, 3840, 4800, 7680, 9600, 15360 };
|
|
||||||
|
DCB dcb;
|
||||||
DCB dcb;
|
|
||||||
|
ZeroMemory(&dcb,sizeof(dcb));
|
||||||
ZeroMemory(&dcb,sizeof(dcb));
|
dcb.DCBlength = sizeof(dcb);
|
||||||
dcb.DCBlength = sizeof(dcb);
|
dcb.BaudRate = dwBaudrates[Chipset.IORam[BAUD] & 0x7];
|
||||||
dcb.BaudRate = dwBaudrates[Chipset.IORam[BAUD] & 0x7];
|
dcb.fBinary = TRUE;
|
||||||
dcb.fBinary = TRUE;
|
dcb.fParity = TRUE;
|
||||||
dcb.fParity = TRUE;
|
dcb.fOutxCtsFlow = FALSE;
|
||||||
dcb.fOutxCtsFlow = FALSE;
|
dcb.fOutxDsrFlow = FALSE;
|
||||||
dcb.fOutxDsrFlow = FALSE;
|
dcb.fDtrControl = DTR_CONTROL_DISABLE;
|
||||||
dcb.fDtrControl = DTR_CONTROL_DISABLE;
|
dcb.fDsrSensitivity = FALSE;
|
||||||
dcb.fDsrSensitivity = FALSE;
|
dcb.fOutX = FALSE;
|
||||||
dcb.fOutX = FALSE;
|
dcb.fErrorChar = FALSE;
|
||||||
dcb.fErrorChar = FALSE;
|
dcb.fNull = FALSE;
|
||||||
dcb.fNull = FALSE;
|
dcb.fRtsControl = RTS_CONTROL_DISABLE;
|
||||||
dcb.fRtsControl = RTS_CONTROL_DISABLE;
|
dcb.fAbortOnError = FALSE; // may changed in further implementations
|
||||||
dcb.fAbortOnError = FALSE; // may changed in further implementations
|
dcb.ByteSize = 8;
|
||||||
dcb.ByteSize = 8;
|
dcb.Parity = NOPARITY; // no parity check, emulated by software
|
||||||
dcb.Parity = NOPARITY; // no parity check, emulated by software
|
dcb.StopBits = TWOSTOPBITS;
|
||||||
dcb.StopBits = TWOSTOPBITS;
|
|
||||||
|
#if defined DEBUG_SERIAL
|
||||||
#if defined DEBUG_SERIAL
|
{
|
||||||
{
|
TCHAR buffer[256];
|
||||||
TCHAR buffer[256];
|
wsprintf(buffer,_T("CommsetBaud: %ld\n"),dcb.BaudRate);
|
||||||
wsprintf(buffer,_T("CommsetBaud: %ld\n"),dcb.BaudRate);
|
OutputDebugString(buffer);
|
||||||
OutputDebugString(buffer);
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
|
||||||
|
SetCommState(hComm,&dcb);
|
||||||
SetCommState(hComm,&dcb);
|
}
|
||||||
}
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
BOOL UpdateUSRQ(VOID) // USRQ handling
|
||||||
BOOL UpdateUSRQ(VOID) // USRQ handling
|
{
|
||||||
{
|
BOOL bUSRQ = NINT2USRQ;
|
||||||
BOOL bUSRQ = NINT2USRQ;
|
IOBit(SRQ1,USRQ,bUSRQ); // update USRQ bit
|
||||||
IOBit(SRQ1,USRQ,bUSRQ); // update USRQ bit
|
return bUSRQ;
|
||||||
return bUSRQ;
|
}
|
||||||
}
|
|
||||||
|
VOID CommTxBRK(VOID)
|
||||||
VOID CommTxBRK(VOID)
|
{
|
||||||
{
|
if (Chipset.IORam[TCS] & BRK) // BRK condition
|
||||||
if (Chipset.IORam[TCS] & BRK) // BRK condition
|
{
|
||||||
{
|
if (hComm != NULL) // com port open
|
||||||
if (hComm != NULL) // com port open
|
{
|
||||||
{
|
// abort data transfer
|
||||||
// abort data transfer
|
PurgeComm(hComm,PURGE_TXABORT | PURGE_TXCLEAR);
|
||||||
PurgeComm(hComm,PURGE_TXABORT | PURGE_TXCLEAR);
|
SetCommBreak(hComm); // set into BRK state
|
||||||
SetCommBreak(hComm); // set into BRK state
|
}
|
||||||
}
|
|
||||||
|
// TBF and TBZ bits of TCS are undefined
|
||||||
// TBF and TBZ bits of TCS are undefined
|
|
||||||
|
if (Chipset.IORam[TCS] & LPB) // is loopback bit set
|
||||||
if (Chipset.IORam[TCS] & LPB) // is loopback bit set
|
{
|
||||||
{
|
dwBytesRead = nRp = 0; // clear receive buffer
|
||||||
dwBytesRead = nRp = 0; // clear receive buffer
|
cBuffer[dwBytesRead++] = 0; // save character in receive buffer
|
||||||
cBuffer[dwBytesRead++] = 0; // save character in receive buffer
|
|
||||||
|
CommReceive(); // receive available byte
|
||||||
CommReceive(); // receive available byte
|
IOBit(RCS,RER,TRUE); // receiver error (no stop bit)
|
||||||
IOBit(RCS,RER,TRUE); // receiver error (no stop bit)
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
if (hComm != NULL) // com port open
|
||||||
if (hComm != NULL) // com port open
|
{
|
||||||
{
|
ClearCommBreak(hComm); // clear BRK state
|
||||||
ClearCommBreak(hComm); // clear BRK state
|
}
|
||||||
}
|
}
|
||||||
}
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
VOID CommTransmit(VOID)
|
||||||
VOID CommTransmit(VOID)
|
{
|
||||||
{
|
BOOL bTxChar = FALSE;
|
||||||
BOOL bTxChar = FALSE;
|
|
||||||
|
EnterCriticalSection(&csTxdLock);
|
||||||
EnterCriticalSection(&csTxdLock);
|
if ( (Chipset.IORam[TCS] & TBZ) == 0 // transmitter not busy
|
||||||
if ( (Chipset.IORam[TCS] & TBZ) == 0 // transmitter not busy
|
&& (Chipset.IORam[TCS] & TBF) != 0) // transmit buffer full
|
||||||
&& (Chipset.IORam[TCS] & TBF) != 0) // transmit buffer full
|
{
|
||||||
{
|
tbr = (Chipset.IORam[TBR_MSB] << 4) | Chipset.IORam[TBR_LSB];
|
||||||
tbr = (Chipset.IORam[TBR_MSB] << 4) | Chipset.IORam[TBR_LSB];
|
|
||||||
|
IOBit(TCS,TBF,FALSE); // clear transmit buffer full bit
|
||||||
IOBit(TCS,TBF,FALSE); // clear transmit buffer full bit
|
IOBit(TCS,TBZ,TRUE); // set transmitter busy bit
|
||||||
IOBit(TCS,TBZ,TRUE); // set transmitter busy bit
|
|
||||||
|
bTxChar = TRUE;
|
||||||
bTxChar = TRUE;
|
}
|
||||||
}
|
LeaveCriticalSection(&csTxdLock);
|
||||||
LeaveCriticalSection(&csTxdLock);
|
|
||||||
|
if (bTxChar) // character to transmit
|
||||||
if (bTxChar) // character to transmit
|
{
|
||||||
{
|
#if defined DEBUG_SERIAL
|
||||||
#if defined DEBUG_SERIAL
|
{
|
||||||
{
|
TCHAR buffer[256];
|
||||||
TCHAR buffer[256];
|
if (isprint(tbr))
|
||||||
if (isprint(tbr))
|
wsprintf(buffer,_T("-> '%c'\n"),tbr);
|
||||||
wsprintf(buffer,_T("-> '%c'\n"),tbr);
|
else
|
||||||
else
|
wsprintf(buffer,_T("-> %02X\n"),tbr);
|
||||||
wsprintf(buffer,_T("-> %02X\n"),tbr);
|
OutputDebugString(buffer);
|
||||||
OutputDebugString(buffer);
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
|
||||||
|
if (Chipset.IORam[TCS] & LPB) // is loopback bit set
|
||||||
if (Chipset.IORam[TCS] & LPB) // is loopback bit set
|
{
|
||||||
{
|
if (dwBytesRead == 0) nRp = 0; // no character received, reset read pointer
|
||||||
if (dwBytesRead == 0) nRp = 0; // no character received, reset read pointer
|
cBuffer[nRp+dwBytesRead] = tbr; // save character in receive buffer
|
||||||
cBuffer[nRp+dwBytesRead] = tbr; // save character in receive buffer
|
++dwBytesRead;
|
||||||
++dwBytesRead;
|
|
||||||
|
CommReceive(); // receive available byte
|
||||||
CommReceive(); // receive available byte
|
}
|
||||||
}
|
|
||||||
|
if (hComm != NULL) // com port open
|
||||||
if (hComm != NULL) // com port open
|
{
|
||||||
{
|
SetEvent(hEventTxd); // write TBR byte
|
||||||
SetEvent(hEventTxd); // write TBR byte
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
IOBit(TCS,TBZ,FALSE); // clear transmitter busy bit
|
||||||
IOBit(TCS,TBZ,FALSE); // clear transmitter busy bit
|
}
|
||||||
}
|
}
|
||||||
}
|
if (UpdateUSRQ()) // update USRQ bit
|
||||||
if (UpdateUSRQ()) // update USRQ bit
|
INTERRUPT;
|
||||||
INTERRUPT;
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
VOID CommReceive(VOID)
|
||||||
VOID CommReceive(VOID)
|
{
|
||||||
{
|
OVERLAPPED os = { 0 };
|
||||||
OVERLAPPED os = { 0 };
|
|
||||||
|
if (!(Chipset.IORam[IOC] & SON)) // UART off
|
||||||
if (!(Chipset.IORam[IOC] & SON)) // UART off
|
{
|
||||||
{
|
dwBytesRead = 0L; // no bytes received
|
||||||
dwBytesRead = 0L; // no bytes received
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
EnterCriticalSection(&csRecvLock);
|
||||||
EnterCriticalSection(&csRecvLock);
|
do
|
||||||
do
|
{
|
||||||
{
|
if (Chipset.IORam[RCS] & RBF) // receive buffer full
|
||||||
if (Chipset.IORam[RCS] & RBF) // receive buffer full
|
break;
|
||||||
break;
|
|
||||||
|
// reject reading if com port is closed and not whole operation
|
||||||
// reject reading if com port is closed and not whole operation
|
if (hComm) // com port open
|
||||||
if (hComm) // com port open
|
{
|
||||||
{
|
UINT uCnt = 0; // retry counter
|
||||||
UINT uCnt = 0; // retry counter
|
|
||||||
|
while (dwBytesRead == 0L) // buffer empty
|
||||||
while (dwBytesRead == 0L) // buffer empty
|
{
|
||||||
{
|
if (ReadFile(hComm,cBuffer,sizeof(cBuffer),&dwBytesRead,&os) == FALSE)
|
||||||
if (ReadFile(hComm,cBuffer,sizeof(cBuffer),&dwBytesRead,&os) == FALSE)
|
dwBytesRead = 0L;
|
||||||
dwBytesRead = 0L;
|
else // bytes received
|
||||||
else // bytes received
|
nRp = 0; // reset read pointer
|
||||||
nRp = 0; // reset read pointer
|
|
||||||
|
// something received or passed 1st retry
|
||||||
// something received or passed 1st retry
|
if (dwBytesRead != 0L || ++uCnt > 1)
|
||||||
if (dwBytesRead != 0L || ++uCnt > 1)
|
break; // quit
|
||||||
break; // quit
|
|
||||||
|
Sleep(1); // workaround, retry 1ms later
|
||||||
Sleep(1); // workaround, retry 1ms later
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (dwBytesRead == 0L) // receive buffer empty
|
||||||
if (dwBytesRead == 0L) // receive buffer empty
|
break;
|
||||||
break;
|
|
||||||
|
#if defined DEBUG_SERIAL
|
||||||
#if defined DEBUG_SERIAL
|
{
|
||||||
{
|
TCHAR buffer[256];
|
||||||
TCHAR buffer[256];
|
if (isprint(cBuffer[nRp]))
|
||||||
if (isprint(cBuffer[nRp]))
|
wsprintf(buffer,_T("<- '%c'\n"),cBuffer[nRp]);
|
||||||
wsprintf(buffer,_T("<- '%c'\n"),cBuffer[nRp]);
|
else
|
||||||
else
|
wsprintf(buffer,_T("<- %02X\n"),cBuffer[nRp]);
|
||||||
wsprintf(buffer,_T("<- %02X\n"),cBuffer[nRp]);
|
OutputDebugString(buffer);
|
||||||
OutputDebugString(buffer);
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
|
||||||
|
Chipset.IORam[RBR_MSB] = (cBuffer[nRp] >> 4);
|
||||||
Chipset.IORam[RBR_MSB] = (cBuffer[nRp] >> 4);
|
Chipset.IORam[RBR_LSB] = (cBuffer[nRp] & 0x0f);
|
||||||
Chipset.IORam[RBR_LSB] = (cBuffer[nRp] & 0x0f);
|
++nRp;
|
||||||
++nRp;
|
--dwBytesRead;
|
||||||
--dwBytesRead;
|
|
||||||
|
Chipset.IORam[RCS] |= RBF; // receive buffer full
|
||||||
Chipset.IORam[RCS] |= RBF; // receive buffer full
|
if (UpdateUSRQ()) // update USRQ bit
|
||||||
if (UpdateUSRQ()) // update USRQ bit
|
INTERRUPT;
|
||||||
INTERRUPT;
|
}
|
||||||
}
|
while (FALSE);
|
||||||
while (FALSE);
|
LeaveCriticalSection(&csRecvLock);
|
||||||
LeaveCriticalSection(&csRecvLock);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
|
@ -1,308 +1,310 @@
|
||||||
/*
|
/*
|
||||||
* settings.c
|
* settings.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 Christoph Gießelink
|
* Copyright (C) 2000 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "i28f160.h"
|
#include "i28f160.h"
|
||||||
|
|
||||||
// #define REGISTRY // use registry instead of *.ini file
|
// #define REGISTRY // use registry instead of *.ini file
|
||||||
|
|
||||||
//################
|
//################
|
||||||
//#
|
//#
|
||||||
//# Low level subroutines
|
//# Low level subroutines
|
||||||
//#
|
//#
|
||||||
//################
|
//################
|
||||||
|
|
||||||
#if !defined REGISTRY
|
#if !defined REGISTRY
|
||||||
|
|
||||||
// INI-file handling
|
// INI-file handling
|
||||||
|
|
||||||
#if !defined EMU48_INI
|
#if !defined EMU48_INI
|
||||||
#define EMU48_INI "Emu48.ini"
|
#define EMU48_INI "Emu48.ini"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ReadString(sec,key,dv,v,sv) GetPrivateProfileString(sec,key,dv,v,sv,_T(EMU48_INI))
|
#define ReadString(sec,key,dv,v,sv) GetPrivateProfileString(sec,key,dv,v,sv,_T(EMU48_INI))
|
||||||
#define ReadInt(sec,key,dv) GetPrivateProfileInt(sec,key,dv,_T(EMU48_INI));
|
#define ReadInt(sec,key,dv) GetPrivateProfileInt(sec,key,dv,_T(EMU48_INI));
|
||||||
#define WriteString(sec,key,v) WritePrivateProfileString(sec,key,v,_T(EMU48_INI))
|
#define WriteString(sec,key,v) WritePrivateProfileString(sec,key,v,_T(EMU48_INI))
|
||||||
#define WriteInt(sec,key,v) WritePrivateProfileInt(sec,key,v,_T(EMU48_INI))
|
#define WriteInt(sec,key,v) WritePrivateProfileInt(sec,key,v,_T(EMU48_INI))
|
||||||
#define DelKey(sec,key) WritePrivateProfileString(sec,key,NULL,_T(EMU48_INI))
|
#define DelKey(sec,key) WritePrivateProfileString(sec,key,NULL,_T(EMU48_INI))
|
||||||
|
|
||||||
static BOOL WritePrivateProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue, LPCTSTR lpszFilename)
|
static BOOL WritePrivateProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue, LPCTSTR lpszFilename)
|
||||||
{
|
{
|
||||||
TCHAR s[16];
|
TCHAR s[16];
|
||||||
wsprintf(s,_T("%i"),nValue);
|
wsprintf(s,_T("%i"),nValue);
|
||||||
return WritePrivateProfileString(lpszSection, lpszEntry, s, lpszFilename);
|
return WritePrivateProfileString(lpszSection, lpszEntry, s, lpszFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// registry handling
|
// registry handling
|
||||||
|
|
||||||
#if !defined REGISTRYKEY
|
#if !defined REGISTRYKEY
|
||||||
#define REGISTRYKEY "Software\\Emu48"
|
#define REGISTRYKEY "Software\\Emu48"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ReadString(sec,key,dv,v,sv) GetRegistryString(sec,key,dv,v,sv)
|
#define ReadString(sec,key,dv,v,sv) GetRegistryString(sec,key,dv,v,sv)
|
||||||
#define ReadInt(sec,key,dv) GetRegistryInt(sec,key,dv)
|
#define ReadInt(sec,key,dv) GetRegistryInt(sec,key,dv)
|
||||||
#define WriteString(sec,key,v) WriteReg(sec,key,REG_SZ,(BYTE *) v,(lstrlen(v)+1) * sizeof(*v))
|
#define WriteString(sec,key,v) WriteReg(sec,key,REG_SZ,(BYTE *) v,(lstrlen(v)+1) * sizeof(*v))
|
||||||
#define WriteInt(sec,key,v) WriteReg(sec,key,REG_DWORD,(BYTE *) &v,sizeof(int))
|
#define WriteInt(sec,key,v) WriteReg(sec,key,REG_DWORD,(BYTE *) &v,sizeof(int))
|
||||||
#define DelKey(sec,key) DelReg(sec,key)
|
#define DelKey(sec,key) DelReg(sec,key)
|
||||||
|
|
||||||
static VOID ReadReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, LPBYTE lpData, DWORD *pdwSize)
|
static VOID ReadReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, LPBYTE lpData, DWORD *pdwSize)
|
||||||
{
|
{
|
||||||
TCHAR lpKey[256] = _T(REGISTRYKEY) _T("\\");
|
TCHAR lpKey[256] = _T(REGISTRYKEY) _T("\\");
|
||||||
|
|
||||||
DWORD retCode,dwType;
|
DWORD retCode,dwType;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
|
|
||||||
lstrcat(lpKey, lpSubKey); // full registry key
|
lstrcat(lpKey, lpSubKey); // full registry key
|
||||||
|
|
||||||
retCode = RegOpenKeyEx(HKEY_CURRENT_USER,
|
retCode = RegOpenKeyEx(HKEY_CURRENT_USER,
|
||||||
lpKey,
|
lpKey,
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey);
|
&hKey);
|
||||||
if (retCode == ERROR_SUCCESS)
|
if (retCode == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
retCode = RegQueryValueEx(hKey,lpValueName,NULL,&dwType,lpData,pdwSize);
|
retCode = RegQueryValueEx(hKey,lpValueName,NULL,&dwType,lpData,pdwSize);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retCode != ERROR_SUCCESS) // registry entry not found
|
if (retCode != ERROR_SUCCESS) // registry entry not found
|
||||||
*pdwSize = 0; // return zero size
|
*pdwSize = 0; // return zero size
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WriteReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
|
static BOOL WriteReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
|
||||||
{
|
{
|
||||||
TCHAR lpKey[256] = _T(REGISTRYKEY) _T("\\");
|
TCHAR lpKey[256] = _T(REGISTRYKEY) _T("\\");
|
||||||
|
|
||||||
DWORD retCode;
|
DWORD retCode;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
DWORD dwDisposition;
|
DWORD dwDisposition;
|
||||||
|
|
||||||
lstrcat(lpKey, lpSubKey); // full registry key
|
lstrcat(lpKey, lpSubKey); // full registry key
|
||||||
|
|
||||||
retCode = RegCreateKeyEx(HKEY_CURRENT_USER,
|
retCode = RegCreateKeyEx(HKEY_CURRENT_USER,
|
||||||
lpKey,
|
lpKey,
|
||||||
0,_T(""),
|
0,_T(""),
|
||||||
REG_OPTION_NON_VOLATILE,
|
REG_OPTION_NON_VOLATILE,
|
||||||
KEY_WRITE,
|
KEY_WRITE,
|
||||||
NULL,
|
NULL,
|
||||||
&hKey,
|
&hKey,
|
||||||
&dwDisposition);
|
&dwDisposition);
|
||||||
_ASSERT(retCode == ERROR_SUCCESS);
|
_ASSERT(retCode == ERROR_SUCCESS);
|
||||||
|
|
||||||
RegSetValueEx(hKey,lpValueName,0,dwType,lpData,cbData);
|
RegSetValueEx(hKey,lpValueName,0,dwType,lpData,cbData);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
return retCode == ERROR_SUCCESS;
|
return retCode == ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL DelReg(LPCTSTR lpSubKey, LPCTSTR lpValueName)
|
static BOOL DelReg(LPCTSTR lpSubKey, LPCTSTR lpValueName)
|
||||||
{
|
{
|
||||||
TCHAR lpKey[256] = _T(REGISTRYKEY) _T("\\");
|
TCHAR lpKey[256] = _T(REGISTRYKEY) _T("\\");
|
||||||
|
|
||||||
DWORD retCode;
|
DWORD retCode;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
|
|
||||||
lstrcat(lpKey, lpSubKey); // full registry key
|
lstrcat(lpKey, lpSubKey); // full registry key
|
||||||
|
|
||||||
retCode = RegOpenKeyEx(HKEY_CURRENT_USER,
|
retCode = RegOpenKeyEx(HKEY_CURRENT_USER,
|
||||||
lpKey,
|
lpKey,
|
||||||
0,
|
0,
|
||||||
KEY_SET_VALUE,
|
KEY_SET_VALUE,
|
||||||
&hKey);
|
&hKey);
|
||||||
if (retCode == ERROR_SUCCESS)
|
if (retCode == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
retCode = RegDeleteValue(hKey,lpValueName);
|
retCode = RegDeleteValue(hKey,lpValueName);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
return retCode == ERROR_SUCCESS;
|
return retCode == ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD GetRegistryString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpDefault, LPTSTR lpData, DWORD dwSize)
|
static DWORD GetRegistryString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpDefault, LPTSTR lpData, DWORD dwSize)
|
||||||
{
|
{
|
||||||
// buffer size in bytes
|
// buffer size in bytes
|
||||||
DWORD dwBufSize = dwSize * sizeof(*lpData);
|
DWORD dwBufSize = dwSize * sizeof(*lpData);
|
||||||
|
|
||||||
ReadReg(lpszSection,lpszEntry,(LPBYTE) lpData,&dwBufSize);
|
ReadReg(lpszSection,lpszEntry,(LPBYTE) lpData,&dwBufSize);
|
||||||
if (dwBufSize == 0)
|
if (dwBufSize == 0)
|
||||||
{
|
{
|
||||||
lstrcpyn(lpData,lpDefault,dwSize);
|
lstrcpyn(lpData,lpDefault,dwSize);
|
||||||
dwSize = lstrlen(lpData);
|
dwSize = lstrlen(lpData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dwSize = (dwBufSize / sizeof(*lpData)) - 1;
|
dwSize = (dwBufSize / sizeof(*lpData)) - 1;
|
||||||
}
|
}
|
||||||
return dwSize;
|
return dwSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT GetRegistryInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nDefault)
|
static UINT GetRegistryInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nDefault)
|
||||||
{
|
{
|
||||||
UINT nValue;
|
UINT nValue;
|
||||||
DWORD dwSize = sizeof(nValue);
|
DWORD dwSize = sizeof(nValue);
|
||||||
|
|
||||||
ReadReg(lpszSection,lpszEntry,(LPBYTE) &nValue,&dwSize);
|
ReadReg(lpszSection,lpszEntry,(LPBYTE) &nValue,&dwSize);
|
||||||
return dwSize ? nValue : nDefault;
|
return dwSize ? nValue : nDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//################
|
//################
|
||||||
//#
|
//#
|
||||||
//# Public functions
|
//# Public functions
|
||||||
//#
|
//#
|
||||||
//################
|
//################
|
||||||
|
|
||||||
VOID ReadSettings(VOID)
|
VOID ReadSettings(VOID)
|
||||||
{
|
{
|
||||||
// Files
|
// Files
|
||||||
ReadString(_T("Files"),_T("Emu48Directory"),szCurrentDirectory,szEmuDirectory,ARRAYSIZEOF(szEmuDirectory));
|
ReadString(_T("Files"),_T("Emu48Directory"),szCurrentDirectory,szEmuDirectory,ARRAYSIZEOF(szEmuDirectory));
|
||||||
bAutoSave = ReadInt(_T("Files"),_T("AutoSave"),bAutoSave);
|
bAutoSave = ReadInt(_T("Files"),_T("AutoSave"),bAutoSave);
|
||||||
bAutoSaveOnExit = ReadInt(_T("Files"),_T("AutoSaveOnExit"),bAutoSaveOnExit);
|
bAutoSaveOnExit = ReadInt(_T("Files"),_T("AutoSaveOnExit"),bAutoSaveOnExit);
|
||||||
bSaveDefConfirm = ReadInt(_T("Files"),_T("SaveDefaultConfirm"),bSaveDefConfirm);
|
bSaveDefConfirm = ReadInt(_T("Files"),_T("SaveDefaultConfirm"),bSaveDefConfirm);
|
||||||
bStartupBackup = ReadInt(_T("Files"),_T("StartupBackup"),bStartupBackup);
|
bStartupBackup = ReadInt(_T("Files"),_T("StartupBackup"),bStartupBackup);
|
||||||
bLoadObjectWarning = ReadInt(_T("Files"),_T("LoadObjectWarning"),bLoadObjectWarning);
|
bLoadObjectWarning = ReadInt(_T("Files"),_T("LoadObjectWarning"),bLoadObjectWarning);
|
||||||
// Port2
|
// Port2
|
||||||
bPort2IsShared = ReadInt(_T("Port2"),_T("IsShared"),bPort2IsShared);
|
bPort2IsShared = ReadInt(_T("Port2"),_T("IsShared"),bPort2IsShared);
|
||||||
ReadString(_T("Port2"),_T("Filename"),_T("SHARED.BIN"),szPort2Filename,ARRAYSIZEOF(szPort2Filename));
|
ReadString(_T("Port2"),_T("Filename"),_T("SHARED.BIN"),szPort2Filename,ARRAYSIZEOF(szPort2Filename));
|
||||||
// KML
|
// KML
|
||||||
bAlwaysDisplayLog = ReadInt(_T("KML"),_T("AlwaysDisplayLog"),bAlwaysDisplayLog);
|
bAlwaysDisplayLog = ReadInt(_T("KML"),_T("AlwaysDisplayLog"),bAlwaysDisplayLog);
|
||||||
// Debugger
|
// Debugger
|
||||||
wInstrSize = ReadInt(_T("Debugger"),_T("LastInstrBufSize"),wInstrSize);
|
wInstrSize = ReadInt(_T("Debugger"),_T("LastInstrBufSize"),wInstrSize);
|
||||||
// Disassembler
|
// Disassembler
|
||||||
disassembler_mode = ReadInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode);
|
disassembler_mode = ReadInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode);
|
||||||
disassembler_symb = ReadInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb);
|
disassembler_symb = ReadInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb);
|
||||||
// Emulator
|
// Emulator
|
||||||
bShowTitle = ReadInt(_T("Emulator"),_T("ShowTitle"),bShowTitle);
|
bShowTitle = ReadInt(_T("Emulator"),_T("ShowTitle"),bShowTitle);
|
||||||
bShowMenu = ReadInt(_T("Emulator"),_T("ShowMenu"),bShowMenu);
|
bShowMenu = ReadInt(_T("Emulator"),_T("ShowMenu"),bShowMenu);
|
||||||
bAlwaysOnTop = ReadInt(_T("Emulator"),_T("AlwaysOnTop"),bAlwaysOnTop);
|
bAlwaysOnTop = ReadInt(_T("Emulator"),_T("AlwaysOnTop"),bAlwaysOnTop);
|
||||||
bActFollowsMouse = ReadInt(_T("Emulator"),_T("ActivationFollowsMouse"),bActFollowsMouse);
|
bActFollowsMouse = ReadInt(_T("Emulator"),_T("ActivationFollowsMouse"),bActFollowsMouse);
|
||||||
bClientWinMove = ReadInt(_T("Emulator"),_T("ClientWinMove"),bClientWinMove);
|
bClientWinMove = ReadInt(_T("Emulator"),_T("ClientWinMove"),bClientWinMove);
|
||||||
bSingleInstance = ReadInt(_T("Emulator"),_T("SingleInstance"),bSingleInstance);
|
bSingleInstance = ReadInt(_T("Emulator"),_T("SingleInstance"),bSingleInstance);
|
||||||
bRealSpeed = ReadInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed);
|
bRealSpeed = ReadInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed);
|
||||||
dwSXCycles = ReadInt(_T("Emulator"),_T("SXCycles"),dwSXCycles);
|
dwSXCycles = ReadInt(_T("Emulator"),_T("SXCycles"),dwSXCycles);
|
||||||
dwGXCycles = ReadInt(_T("Emulator"),_T("GXCycles"),dwGXCycles);
|
dwGXCycles = ReadInt(_T("Emulator"),_T("GXCycles"),dwGXCycles);
|
||||||
dwKeyMinDelay = ReadInt(_T("Emulator"),_T("KeyMinDelay"),dwKeyMinDelay);
|
dwKeyMinDelay = ReadInt(_T("Emulator"),_T("KeyMinDelay"),dwKeyMinDelay);
|
||||||
dwWakeupDelay = ReadInt(_T("Emulator"),_T("WakeupDelay"),dwWakeupDelay);
|
dwWakeupDelay = ReadInt(_T("Emulator"),_T("WakeupDelay"),dwWakeupDelay);
|
||||||
bGrayscale = ReadInt(_T("Emulator"),_T("Grayscale"),bGrayscale);
|
bGrayscale = ReadInt(_T("Emulator"),_T("Grayscale"),bGrayscale);
|
||||||
uWaveDevId = ReadInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId);
|
uWaveDevId = ReadInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId);
|
||||||
dwWaveVol = ReadInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol);
|
dwWaveVol = ReadInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol);
|
||||||
dwWaveTime = ReadInt(_T("Emulator"),_T("WaveTime"),dwWaveTime);
|
dwWaveTime = ReadInt(_T("Emulator"),_T("WaveTime"),dwWaveTime);
|
||||||
// LowBat
|
bLocaleDecimalPoint = ReadInt(_T("Emulator"),_T("LocaleDecimalPoint"),bLocaleDecimalPoint);
|
||||||
bLowBatDisable = ReadInt(_T("LowBat"),_T("Disable"),bLowBatDisable);
|
// LowBat
|
||||||
// Macro
|
bLowBatDisable = ReadInt(_T("LowBat"),_T("Disable"),bLowBatDisable);
|
||||||
bMacroRealSpeed = ReadInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed);
|
// Macro
|
||||||
nMacroTimeout = ReadInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout);
|
bMacroRealSpeed = ReadInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed);
|
||||||
dwMacroMinDelay = ReadInt(_T("Macro"),_T("KeyMinDelay"),dwMacroMinDelay);
|
nMacroTimeout = ReadInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout);
|
||||||
// IrPrinter
|
dwMacroMinDelay = ReadInt(_T("Macro"),_T("KeyMinDelay"),dwMacroMinDelay);
|
||||||
ReadString(_T("IrPrinter"),_T("Address"),szUdpServer,szUdpServer,ARRAYSIZEOF(szUdpServer));
|
// IrPrinter
|
||||||
wUdpPort = ReadInt(_T("IrPrinter"),_T("Port"),wUdpPort);
|
ReadString(_T("IrPrinter"),_T("Address"),szUdpServer,szUdpServer,ARRAYSIZEOF(szUdpServer));
|
||||||
// Serial
|
wUdpPort = ReadInt(_T("IrPrinter"),_T("Port"),wUdpPort);
|
||||||
ReadString(_T("Serial"),_T("Wire"),_T(NO_SERIAL),szSerialWire,ARRAYSIZEOF(szSerialWire));
|
// Serial
|
||||||
ReadString(_T("Serial"),_T("Ir"),_T(NO_SERIAL),szSerialIr,ARRAYSIZEOF(szSerialIr));
|
ReadString(_T("Serial"),_T("Wire"),_T(NO_SERIAL),szSerialWire,ARRAYSIZEOF(szSerialWire));
|
||||||
// ROM
|
ReadString(_T("Serial"),_T("Ir"),_T(NO_SERIAL),szSerialIr,ARRAYSIZEOF(szSerialIr));
|
||||||
bRomWriteable = ReadInt(_T("ROM"),_T("Writeable"),bRomWriteable);
|
// ROM
|
||||||
bWP = ReadInt(_T("ROM"),_T("WP#"),bWP);
|
bRomWriteable = ReadInt(_T("ROM"),_T("Writeable"),bRomWriteable);
|
||||||
return;
|
bWP = ReadInt(_T("ROM"),_T("WP#"),bWP);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
VOID WriteSettings(VOID)
|
|
||||||
{
|
VOID WriteSettings(VOID)
|
||||||
// Files
|
{
|
||||||
WriteString(_T("Files"),_T("Emu48Directory"),szEmuDirectory);
|
// Files
|
||||||
WriteInt(_T("Files"),_T("AutoSave"),bAutoSave);
|
WriteString(_T("Files"),_T("Emu48Directory"),szEmuDirectory);
|
||||||
WriteInt(_T("Files"),_T("AutoSaveOnExit"),bAutoSaveOnExit);
|
WriteInt(_T("Files"),_T("AutoSave"),bAutoSave);
|
||||||
WriteInt(_T("Files"),_T("SaveDefaultConfirm"),bSaveDefConfirm);
|
WriteInt(_T("Files"),_T("AutoSaveOnExit"),bAutoSaveOnExit);
|
||||||
WriteInt(_T("Files"),_T("StartupBackup"),bStartupBackup);
|
WriteInt(_T("Files"),_T("SaveDefaultConfirm"),bSaveDefConfirm);
|
||||||
WriteInt(_T("Files"),_T("LoadObjectWarning"),bLoadObjectWarning);
|
WriteInt(_T("Files"),_T("StartupBackup"),bStartupBackup);
|
||||||
// Port2
|
WriteInt(_T("Files"),_T("LoadObjectWarning"),bLoadObjectWarning);
|
||||||
WriteInt(_T("Port2"),_T("IsShared"),bPort2IsShared);
|
// Port2
|
||||||
WriteString(_T("Port2"),_T("Filename"),szPort2Filename);
|
WriteInt(_T("Port2"),_T("IsShared"),bPort2IsShared);
|
||||||
// KML
|
WriteString(_T("Port2"),_T("Filename"),szPort2Filename);
|
||||||
WriteInt(_T("KML"),_T("AlwaysDisplayLog"),bAlwaysDisplayLog);
|
// KML
|
||||||
// Debugger
|
WriteInt(_T("KML"),_T("AlwaysDisplayLog"),bAlwaysDisplayLog);
|
||||||
WriteInt(_T("Debugger"),_T("LastInstrBufSize"),wInstrSize);
|
// Debugger
|
||||||
// Disassembler
|
WriteInt(_T("Debugger"),_T("LastInstrBufSize"),wInstrSize);
|
||||||
WriteInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode);
|
// Disassembler
|
||||||
WriteInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb);
|
WriteInt(_T("Disassembler"),_T("Mnemonics"),disassembler_mode);
|
||||||
// Emulator
|
WriteInt(_T("Disassembler"),_T("Symbolic"),disassembler_symb);
|
||||||
WriteInt(_T("Emulator"),_T("ShowTitle"),bShowTitle);
|
// Emulator
|
||||||
WriteInt(_T("Emulator"),_T("ShowMenu"),bShowMenu);
|
WriteInt(_T("Emulator"),_T("ShowTitle"),bShowTitle);
|
||||||
WriteInt(_T("Emulator"),_T("AlwaysOnTop"),bAlwaysOnTop);
|
WriteInt(_T("Emulator"),_T("ShowMenu"),bShowMenu);
|
||||||
WriteInt(_T("Emulator"),_T("ActivationFollowsMouse"),bActFollowsMouse);
|
WriteInt(_T("Emulator"),_T("AlwaysOnTop"),bAlwaysOnTop);
|
||||||
WriteInt(_T("Emulator"),_T("ClientWinMove"),bClientWinMove);
|
WriteInt(_T("Emulator"),_T("ActivationFollowsMouse"),bActFollowsMouse);
|
||||||
WriteInt(_T("Emulator"),_T("SingleInstance"),bSingleInstance);
|
WriteInt(_T("Emulator"),_T("ClientWinMove"),bClientWinMove);
|
||||||
WriteInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed);
|
WriteInt(_T("Emulator"),_T("SingleInstance"),bSingleInstance);
|
||||||
WriteInt(_T("Emulator"),_T("SXCycles"),dwSXCycles);
|
WriteInt(_T("Emulator"),_T("RealSpeed"),bRealSpeed);
|
||||||
WriteInt(_T("Emulator"),_T("GXCycles"),dwGXCycles);
|
WriteInt(_T("Emulator"),_T("SXCycles"),dwSXCycles);
|
||||||
WriteInt(_T("Emulator"),_T("KeyMinDelay"),dwKeyMinDelay);
|
WriteInt(_T("Emulator"),_T("GXCycles"),dwGXCycles);
|
||||||
WriteInt(_T("Emulator"),_T("WakeupDelay"),dwWakeupDelay);
|
WriteInt(_T("Emulator"),_T("KeyMinDelay"),dwKeyMinDelay);
|
||||||
WriteInt(_T("Emulator"),_T("Grayscale"),bGrayscale);
|
WriteInt(_T("Emulator"),_T("WakeupDelay"),dwWakeupDelay);
|
||||||
WriteInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId);
|
WriteInt(_T("Emulator"),_T("Grayscale"),bGrayscale);
|
||||||
WriteInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol);
|
WriteInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId);
|
||||||
WriteInt(_T("Emulator"),_T("WaveTime"),dwWaveTime);
|
WriteInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol);
|
||||||
// LowBat
|
WriteInt(_T("Emulator"),_T("WaveTime"),dwWaveTime);
|
||||||
WriteInt(_T("LowBat"),_T("Disable"),bLowBatDisable);
|
WriteInt(_T("Emulator"),_T("LocaleDecimalPoint"),bLocaleDecimalPoint);
|
||||||
// Macro
|
// LowBat
|
||||||
WriteInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed);
|
WriteInt(_T("LowBat"),_T("Disable"),bLowBatDisable);
|
||||||
WriteInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout);
|
// Macro
|
||||||
WriteInt(_T("Macro"),_T("KeyMinDelay"),dwMacroMinDelay);
|
WriteInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed);
|
||||||
// IrPrinter
|
WriteInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout);
|
||||||
WriteString(_T("IrPrinter"),_T("Address"),szUdpServer);
|
WriteInt(_T("Macro"),_T("KeyMinDelay"),dwMacroMinDelay);
|
||||||
WriteInt(_T("IrPrinter"),_T("Port"),wUdpPort);
|
// IrPrinter
|
||||||
// Serial
|
WriteString(_T("IrPrinter"),_T("Address"),szUdpServer);
|
||||||
WriteString(_T("Serial"),_T("Wire"),szSerialWire);
|
WriteInt(_T("IrPrinter"),_T("Port"),wUdpPort);
|
||||||
WriteString(_T("Serial"),_T("Ir"),szSerialIr);
|
// Serial
|
||||||
// ROM
|
WriteString(_T("Serial"),_T("Wire"),szSerialWire);
|
||||||
WriteInt(_T("ROM"),_T("Writeable"),bRomWriteable);
|
WriteString(_T("Serial"),_T("Ir"),szSerialIr);
|
||||||
return;
|
// ROM
|
||||||
}
|
WriteInt(_T("ROM"),_T("Writeable"),bRomWriteable);
|
||||||
|
return;
|
||||||
VOID ReadLastDocument(LPTSTR szFilename, DWORD nSize)
|
}
|
||||||
{
|
|
||||||
ReadString(_T("Files"),_T("LastDocument"),_T(""),szFilename,nSize);
|
VOID ReadLastDocument(LPTSTR szFilename, DWORD nSize)
|
||||||
return;
|
{
|
||||||
}
|
ReadString(_T("Files"),_T("LastDocument"),_T(""),szFilename,nSize);
|
||||||
|
return;
|
||||||
VOID WriteLastDocument(LPCTSTR szFilename)
|
}
|
||||||
{
|
|
||||||
WriteString(_T("Files"),_T("LastDocument"),szFilename);
|
VOID WriteLastDocument(LPCTSTR szFilename)
|
||||||
return;
|
{
|
||||||
}
|
WriteString(_T("Files"),_T("LastDocument"),szFilename);
|
||||||
|
return;
|
||||||
VOID ReadSettingsString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpDefault, LPTSTR lpData, DWORD dwSize)
|
}
|
||||||
{
|
|
||||||
ReadString(lpszSection,lpszEntry,lpDefault,lpData,dwSize);
|
VOID ReadSettingsString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpDefault, LPTSTR lpData, DWORD dwSize)
|
||||||
return;
|
{
|
||||||
}
|
ReadString(lpszSection,lpszEntry,lpDefault,lpData,dwSize);
|
||||||
|
return;
|
||||||
VOID WriteSettingsString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPTSTR lpData)
|
}
|
||||||
{
|
|
||||||
WriteString(lpszSection,lpszEntry,lpData);
|
VOID WriteSettingsString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPTSTR lpData)
|
||||||
return;
|
{
|
||||||
}
|
WriteString(lpszSection,lpszEntry,lpData);
|
||||||
|
return;
|
||||||
INT ReadSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nDefault)
|
}
|
||||||
{
|
|
||||||
return ReadInt(lpszSection,lpszEntry,nDefault);
|
INT ReadSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nDefault)
|
||||||
}
|
{
|
||||||
|
return ReadInt(lpszSection,lpszEntry,nDefault);
|
||||||
VOID WriteSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nValue)
|
}
|
||||||
{
|
|
||||||
WriteInt(lpszSection,lpszEntry,nValue);
|
VOID WriteSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nValue)
|
||||||
return;
|
{
|
||||||
}
|
WriteInt(lpszSection,lpszEntry,nValue);
|
||||||
|
return;
|
||||||
VOID DelSettingsKey(LPCTSTR lpszSection, LPCTSTR lpszEntry)
|
}
|
||||||
{
|
|
||||||
DelKey(lpszSection,lpszEntry);
|
VOID DelSettingsKey(LPCTSTR lpszSection, LPCTSTR lpszEntry)
|
||||||
return;
|
{
|
||||||
}
|
DelKey(lpszSection,lpszEntry);
|
||||||
|
return;
|
||||||
|
}
|
|
@ -1,102 +1,102 @@
|
||||||
/*
|
/*
|
||||||
* snddef.h
|
* snddef.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Christoph Gießelink
|
* Copyright (C) 2015 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <initguid.h>
|
#include <initguid.h>
|
||||||
|
|
||||||
#if _MSC_VER >= 1600 // valid for VS2010 and later
|
#if _MSC_VER >= 1600 // valid for VS2010 and later
|
||||||
|
|
||||||
#include <DSound.h>
|
#include <DSound.h>
|
||||||
#include <Dsconf.h>
|
#include <Dsconf.h>
|
||||||
|
|
||||||
#else // create the necessary definitions manually
|
#else // create the necessary definitions manually
|
||||||
|
|
||||||
//
|
//
|
||||||
// IKsPropertySet
|
// IKsPropertySet
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef _IKsPropertySet_
|
#ifndef _IKsPropertySet_
|
||||||
#define _IKsPropertySet_
|
#define _IKsPropertySet_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
struct IKsPropertySet;
|
struct IKsPropertySet;
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
typedef struct IKsPropertySet *LPKSPROPERTYSET;
|
typedef struct IKsPropertySet *LPKSPROPERTYSET;
|
||||||
|
|
||||||
DEFINE_GUID(IID_IKsPropertySet, 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93);
|
DEFINE_GUID(IID_IKsPropertySet, 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93);
|
||||||
|
|
||||||
#undef INTERFACE
|
#undef INTERFACE
|
||||||
#define INTERFACE IKsPropertySet
|
#define INTERFACE IKsPropertySet
|
||||||
|
|
||||||
DECLARE_INTERFACE_(IKsPropertySet, IUnknown)
|
DECLARE_INTERFACE_(IKsPropertySet, IUnknown)
|
||||||
{
|
{
|
||||||
// IUnknown methods
|
// IUnknown methods
|
||||||
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID*) PURE;
|
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID*) PURE;
|
||||||
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
|
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
|
||||||
STDMETHOD_(ULONG,Release) (THIS) PURE;
|
STDMETHOD_(ULONG,Release) (THIS) PURE;
|
||||||
|
|
||||||
// IKsPropertySet methods
|
// IKsPropertySet methods
|
||||||
STDMETHOD(Get) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength,
|
STDMETHOD(Get) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength,
|
||||||
LPVOID pPropertyData, ULONG ulDataLength, PULONG pulBytesReturned) PURE;
|
LPVOID pPropertyData, ULONG ulDataLength, PULONG pulBytesReturned) PURE;
|
||||||
STDMETHOD(Set) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength,
|
STDMETHOD(Set) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength,
|
||||||
LPVOID pPropertyData, ULONG ulDataLength) PURE;
|
LPVOID pPropertyData, ULONG ulDataLength) PURE;
|
||||||
STDMETHOD(QuerySupport) (THIS_ REFGUID rguidPropSet, ULONG ulId, PULONG pulTypeSupport) PURE;
|
STDMETHOD(QuerySupport) (THIS_ REFGUID rguidPropSet, ULONG ulId, PULONG pulTypeSupport) PURE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _IKsPropertySet_
|
#endif // _IKsPropertySet_
|
||||||
|
|
||||||
// DirectSound Configuration Component GUID {11AB3EC0-25EC-11d1-A4D8-00C04FC28ACA}
|
// DirectSound Configuration Component GUID {11AB3EC0-25EC-11d1-A4D8-00C04FC28ACA}
|
||||||
DEFINE_GUID(CLSID_DirectSoundPrivate, 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca);
|
DEFINE_GUID(CLSID_DirectSoundPrivate, 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca);
|
||||||
|
|
||||||
// DirectSound Device Properties {84624F82-25EC-11d1-A4D8-00C04FC28ACA}
|
// DirectSound Device Properties {84624F82-25EC-11d1-A4D8-00C04FC28ACA}
|
||||||
DEFINE_GUID(DSPROPSETID_DirectSoundDevice, 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca);
|
DEFINE_GUID(DSPROPSETID_DirectSoundDevice, 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A = 1,
|
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A = 1,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 = 2,
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 = 2,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 = 3,
|
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 = 3,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W = 4,
|
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W = 4,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A = 5,
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A = 5,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W = 6,
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W = 6,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A = 7,
|
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A = 7,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W = 8,
|
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W = 8,
|
||||||
} DSPROPERTY_DIRECTSOUNDDEVICE;
|
} DSPROPERTY_DIRECTSOUNDDEVICE;
|
||||||
|
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W
|
#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W
|
||||||
#else // UNICODE
|
#else // UNICODE
|
||||||
#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A
|
#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A
|
||||||
#endif // UNICODE
|
#endif // UNICODE
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
DIRECTSOUNDDEVICE_TYPE_EMULATED,
|
DIRECTSOUNDDEVICE_TYPE_EMULATED,
|
||||||
DIRECTSOUNDDEVICE_TYPE_VXD,
|
DIRECTSOUNDDEVICE_TYPE_VXD,
|
||||||
DIRECTSOUNDDEVICE_TYPE_WDM
|
DIRECTSOUNDDEVICE_TYPE_WDM
|
||||||
} DIRECTSOUNDDEVICE_TYPE;
|
} DIRECTSOUNDDEVICE_TYPE;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
DIRECTSOUNDDEVICE_DATAFLOW_RENDER,
|
DIRECTSOUNDDEVICE_DATAFLOW_RENDER,
|
||||||
DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
|
DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE
|
||||||
} DIRECTSOUNDDEVICE_DATAFLOW;
|
} DIRECTSOUNDDEVICE_DATAFLOW;
|
||||||
|
|
||||||
typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA
|
typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA
|
||||||
{
|
{
|
||||||
DIRECTSOUNDDEVICE_TYPE Type; // Device type
|
DIRECTSOUNDDEVICE_TYPE Type; // Device type
|
||||||
DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow
|
DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow
|
||||||
GUID DeviceId; // DirectSound device id
|
GUID DeviceId; // DirectSound device id
|
||||||
LPTSTR Description; // Device description
|
LPTSTR Description; // Device description
|
||||||
LPTSTR Module; // Device driver module
|
LPTSTR Module; // Device driver module
|
||||||
LPTSTR Interface; // Device interface
|
LPTSTR Interface; // Device interface
|
||||||
ULONG WaveDeviceId; // Wave device id
|
ULONG WaveDeviceId; // Wave device id
|
||||||
} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA;
|
} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,256 +1,256 @@
|
||||||
/*
|
/*
|
||||||
* SndEnum.c
|
* SndEnum.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Christoph Gießelink
|
* Copyright (C) 2015 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "snddef.h"
|
#include "snddef.h"
|
||||||
|
|
||||||
typedef HRESULT (WINAPI *LPFNDLLGETCLASSOBJECT)(REFCLSID,REFIID,LPVOID *);
|
typedef HRESULT (WINAPI *LPFNDLLGETCLASSOBJECT)(REFCLSID,REFIID,LPVOID *);
|
||||||
static LPFNDLLGETCLASSOBJECT pfnDllGetClassObject = NULL;
|
static LPFNDLLGETCLASSOBJECT pfnDllGetClassObject = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// create a IKsPropertySet interface
|
// create a IKsPropertySet interface
|
||||||
//
|
//
|
||||||
static __inline HRESULT DirectSoundPrivateCreate(LPKSPROPERTYSET *ppKsPropertySet)
|
static __inline HRESULT DirectSoundPrivateCreate(LPKSPROPERTYSET *ppKsPropertySet)
|
||||||
{
|
{
|
||||||
LPCLASSFACTORY pClassFactory = NULL;
|
LPCLASSFACTORY pClassFactory = NULL;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
// create a class factory object
|
// create a class factory object
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
hr = pfnDllGetClassObject(CLSID_DirectSoundPrivate,IID_IClassFactory,(LPVOID *) &pClassFactory);
|
hr = pfnDllGetClassObject(CLSID_DirectSoundPrivate,IID_IClassFactory,(LPVOID *) &pClassFactory);
|
||||||
#else
|
#else
|
||||||
hr = pfnDllGetClassObject(&CLSID_DirectSoundPrivate,&IID_IClassFactory,(LPVOID *) &pClassFactory);
|
hr = pfnDllGetClassObject(&CLSID_DirectSoundPrivate,&IID_IClassFactory,(LPVOID *) &pClassFactory);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// create the DirectSoundPrivate object and query for an IKsPropertySet interface
|
// create the DirectSoundPrivate object and query for an IKsPropertySet interface
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
hr = pClassFactory->CreateInstance(NULL,IID_IKsPropertySet,(LPVOID *) ppKsPropertySet);
|
hr = pClassFactory->CreateInstance(NULL,IID_IKsPropertySet,(LPVOID *) ppKsPropertySet);
|
||||||
#else
|
#else
|
||||||
hr = pClassFactory->lpVtbl->CreateInstance(pClassFactory,NULL,&IID_IKsPropertySet,(LPVOID *) ppKsPropertySet);
|
hr = pClassFactory->lpVtbl->CreateInstance(pClassFactory,NULL,&IID_IKsPropertySet,(LPVOID *) ppKsPropertySet);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pClassFactory) // release the class factory object
|
if (pClassFactory) // release the class factory object
|
||||||
{
|
{
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
pClassFactory->Release();
|
pClassFactory->Release();
|
||||||
#else
|
#else
|
||||||
pClassFactory->lpVtbl->Release(pClassFactory);
|
pClassFactory->lpVtbl->Release(pClassFactory);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr) && *ppKsPropertySet) // handle failure
|
if (FAILED(hr) && *ppKsPropertySet) // handle failure
|
||||||
{
|
{
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
(*ppKsPropertySet)->Release();
|
(*ppKsPropertySet)->Release();
|
||||||
#else
|
#else
|
||||||
(*ppKsPropertySet)->lpVtbl->Release(*ppKsPropertySet);
|
(*ppKsPropertySet)->lpVtbl->Release(*ppKsPropertySet);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get the device information about a DirectSound GUID.
|
// get the device information about a DirectSound GUID.
|
||||||
//
|
//
|
||||||
static BOOL GetInfoFromDSoundGUID(CONST GUID *lpGUID, UINT *puWaveDeviceID)
|
static BOOL GetInfoFromDSoundGUID(CONST GUID *lpGUID, UINT *puWaveDeviceID)
|
||||||
{
|
{
|
||||||
LPKSPROPERTYSET pKsPropertySet = NULL;
|
LPKSPROPERTYSET pKsPropertySet = NULL;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
BOOL bSuccess = FALSE;
|
BOOL bSuccess = FALSE;
|
||||||
|
|
||||||
hr = DirectSoundPrivateCreate(&pKsPropertySet);
|
hr = DirectSoundPrivateCreate(&pKsPropertySet);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
ULONG ulBytesReturned = 0;
|
ULONG ulBytesReturned = 0;
|
||||||
|
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA sDirectSoundDeviceDescription;
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA sDirectSoundDeviceDescription;
|
||||||
|
|
||||||
ZeroMemory(&sDirectSoundDeviceDescription,sizeof(sDirectSoundDeviceDescription));
|
ZeroMemory(&sDirectSoundDeviceDescription,sizeof(sDirectSoundDeviceDescription));
|
||||||
sDirectSoundDeviceDescription.DeviceId = *lpGUID;
|
sDirectSoundDeviceDescription.DeviceId = *lpGUID;
|
||||||
|
|
||||||
// get the size of the direct sound device description
|
// get the size of the direct sound device description
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
hr = pKsPropertySet->Get(
|
hr = pKsPropertySet->Get(
|
||||||
DSPROPSETID_DirectSoundDevice,
|
DSPROPSETID_DirectSoundDevice,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&sDirectSoundDeviceDescription,
|
&sDirectSoundDeviceDescription,
|
||||||
sizeof(sDirectSoundDeviceDescription),
|
sizeof(sDirectSoundDeviceDescription),
|
||||||
&ulBytesReturned
|
&ulBytesReturned
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
hr = pKsPropertySet->lpVtbl->Get(pKsPropertySet,
|
hr = pKsPropertySet->lpVtbl->Get(pKsPropertySet,
|
||||||
&DSPROPSETID_DirectSoundDevice,
|
&DSPROPSETID_DirectSoundDevice,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&sDirectSoundDeviceDescription,
|
&sDirectSoundDeviceDescription,
|
||||||
sizeof(sDirectSoundDeviceDescription),
|
sizeof(sDirectSoundDeviceDescription),
|
||||||
&ulBytesReturned
|
&ulBytesReturned
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SUCCEEDED(hr) && ulBytesReturned)
|
if (SUCCEEDED(hr) && ulBytesReturned)
|
||||||
{
|
{
|
||||||
PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA psDirectSoundDeviceDescription = NULL;
|
PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA psDirectSoundDeviceDescription = NULL;
|
||||||
|
|
||||||
// fetch the direct sound device description
|
// fetch the direct sound device description
|
||||||
psDirectSoundDeviceDescription = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA) malloc(ulBytesReturned);
|
psDirectSoundDeviceDescription = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA) malloc(ulBytesReturned);
|
||||||
if (psDirectSoundDeviceDescription != NULL)
|
if (psDirectSoundDeviceDescription != NULL)
|
||||||
{
|
{
|
||||||
// init structure with data from length request
|
// init structure with data from length request
|
||||||
*psDirectSoundDeviceDescription = sDirectSoundDeviceDescription;
|
*psDirectSoundDeviceDescription = sDirectSoundDeviceDescription;
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
hr = pKsPropertySet->Get(
|
hr = pKsPropertySet->Get(
|
||||||
DSPROPSETID_DirectSoundDevice,
|
DSPROPSETID_DirectSoundDevice,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
psDirectSoundDeviceDescription,
|
psDirectSoundDeviceDescription,
|
||||||
ulBytesReturned,
|
ulBytesReturned,
|
||||||
&ulBytesReturned
|
&ulBytesReturned
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
hr = pKsPropertySet->lpVtbl->Get(pKsPropertySet,
|
hr = pKsPropertySet->lpVtbl->Get(pKsPropertySet,
|
||||||
&DSPROPSETID_DirectSoundDevice,
|
&DSPROPSETID_DirectSoundDevice,
|
||||||
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
|
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
psDirectSoundDeviceDescription,
|
psDirectSoundDeviceDescription,
|
||||||
ulBytesReturned,
|
ulBytesReturned,
|
||||||
&ulBytesReturned
|
&ulBytesReturned
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((bSuccess = SUCCEEDED(hr)))
|
if ((bSuccess = SUCCEEDED(hr)))
|
||||||
{
|
{
|
||||||
// the requested device ID
|
// the requested device ID
|
||||||
*puWaveDeviceID = psDirectSoundDeviceDescription->WaveDeviceId;
|
*puWaveDeviceID = psDirectSoundDeviceDescription->WaveDeviceId;
|
||||||
}
|
}
|
||||||
free(psDirectSoundDeviceDescription);
|
free(psDirectSoundDeviceDescription);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
pKsPropertySet->Release();
|
pKsPropertySet->Release();
|
||||||
#else
|
#else
|
||||||
pKsPropertySet->lpVtbl->Release(pKsPropertySet);
|
pKsPropertySet->lpVtbl->Release(pKsPropertySet);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// callback function for DirectSoundEnumerate()
|
// callback function for DirectSoundEnumerate()
|
||||||
//
|
//
|
||||||
static BOOL CALLBACK DSEnumProc(LPGUID lpGUID,LPCTSTR lpszDesc,LPCTSTR lpszDrvName,LPVOID lpContext)
|
static BOOL CALLBACK DSEnumProc(LPGUID lpGUID,LPCTSTR lpszDesc,LPCTSTR lpszDrvName,LPVOID lpContext)
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) lpContext; // window handle of the combo box
|
HWND hWnd = (HWND) lpContext; // window handle of the combo box
|
||||||
|
|
||||||
if (lpGUID != NULL) // NULL only for "Primary Sound Driver"
|
if (lpGUID != NULL) // NULL only for "Primary Sound Driver"
|
||||||
{
|
{
|
||||||
UINT uDevID;
|
UINT uDevID;
|
||||||
|
|
||||||
if (GetInfoFromDSoundGUID(lpGUID,&uDevID))
|
if (GetInfoFromDSoundGUID(lpGUID,&uDevID))
|
||||||
{
|
{
|
||||||
WAVEOUTCAPS woc;
|
WAVEOUTCAPS woc;
|
||||||
|
|
||||||
// has device the necessary capabilities?
|
// has device the necessary capabilities?
|
||||||
if ( waveOutGetDevCaps(uDevID,&woc,sizeof(woc)) == MMSYSERR_NOERROR
|
if ( waveOutGetDevCaps(uDevID,&woc,sizeof(woc)) == MMSYSERR_NOERROR
|
||||||
&& (woc.dwFormats & WAVE_FORMAT_4M08) != 0)
|
&& (woc.dwFormats & WAVE_FORMAT_4M08) != 0)
|
||||||
{
|
{
|
||||||
// copy product name and wave device ID to combo box
|
// copy product name and wave device ID to combo box
|
||||||
LONG i = (LONG) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) lpszDesc);
|
LONG i = (LONG) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) lpszDesc);
|
||||||
SendMessage(hWnd,CB_SETITEMDATA,i,uDevID);
|
SendMessage(hWnd,CB_SETITEMDATA,i,uDevID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
UNREFERENCED_PARAMETER(lpszDrvName);
|
UNREFERENCED_PARAMETER(lpszDrvName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set listfield for sound device combo box
|
// set listfield for sound device combo box
|
||||||
VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID)
|
VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID)
|
||||||
{
|
{
|
||||||
typedef BOOL (CALLBACK *LPDSENUMCALLBACK)(LPGUID, LPCTSTR, LPCTSTR, LPVOID);
|
typedef BOOL (CALLBACK *LPDSENUMCALLBACK)(LPGUID, LPCTSTR, LPCTSTR, LPVOID);
|
||||||
typedef HRESULT (WINAPI *LPFN_SDE)(LPDSENUMCALLBACK lpDSEnumCallback,LPVOID lpContext);
|
typedef HRESULT (WINAPI *LPFN_SDE)(LPDSENUMCALLBACK lpDSEnumCallback,LPVOID lpContext);
|
||||||
LPFN_SDE pfnDirectSoundEnumerate = NULL;
|
LPFN_SDE pfnDirectSoundEnumerate = NULL;
|
||||||
|
|
||||||
UINT uSelectDevice,uDevID,uDevNo;
|
UINT uSelectDevice,uDevID,uDevNo;
|
||||||
|
|
||||||
HMODULE hDSound = LoadLibrary(_T("dsound.dll"));
|
HMODULE hDSound = LoadLibrary(_T("dsound.dll"));
|
||||||
|
|
||||||
if (hDSound != NULL) // direct sound dll found
|
if (hDSound != NULL) // direct sound dll found
|
||||||
{
|
{
|
||||||
#if defined _UNICODE
|
#if defined _UNICODE
|
||||||
pfnDirectSoundEnumerate = (LPFN_SDE) GetProcAddress(hDSound,"DirectSoundEnumerateW");
|
pfnDirectSoundEnumerate = (LPFN_SDE) GetProcAddress(hDSound,"DirectSoundEnumerateW");
|
||||||
#else
|
#else
|
||||||
pfnDirectSoundEnumerate = (LPFN_SDE) GetProcAddress(hDSound,"DirectSoundEnumerateA");
|
pfnDirectSoundEnumerate = (LPFN_SDE) GetProcAddress(hDSound,"DirectSoundEnumerateA");
|
||||||
#endif
|
#endif
|
||||||
pfnDllGetClassObject = (LPFNDLLGETCLASSOBJECT) GetProcAddress(hDSound,"DllGetClassObject");
|
pfnDllGetClassObject = (LPFNDLLGETCLASSOBJECT) GetProcAddress(hDSound,"DllGetClassObject");
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(hWnd,CB_RESETCONTENT,0,0);
|
SendMessage(hWnd,CB_RESETCONTENT,0,0);
|
||||||
|
|
||||||
// preset selector
|
// preset selector
|
||||||
uSelectDevice = (UINT) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) _T("Standard Audio"));
|
uSelectDevice = (UINT) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) _T("Standard Audio"));
|
||||||
SendMessage(hWnd,CB_SETITEMDATA,uSelectDevice,WAVE_MAPPER);
|
SendMessage(hWnd,CB_SETITEMDATA,uSelectDevice,WAVE_MAPPER);
|
||||||
|
|
||||||
// check for direct sound interface functions
|
// check for direct sound interface functions
|
||||||
if (pfnDirectSoundEnumerate != NULL && pfnDllGetClassObject != NULL)
|
if (pfnDirectSoundEnumerate != NULL && pfnDllGetClassObject != NULL)
|
||||||
{
|
{
|
||||||
// copy product name and wave device ID to combo box
|
// copy product name and wave device ID to combo box
|
||||||
if (SUCCEEDED(pfnDirectSoundEnumerate((LPDSENUMCALLBACK) DSEnumProc,hWnd)))
|
if (SUCCEEDED(pfnDirectSoundEnumerate((LPDSENUMCALLBACK) DSEnumProc,hWnd)))
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
uDevNo = (UINT) SendMessage(hWnd,CB_GETCOUNT,0,0);
|
uDevNo = (UINT) SendMessage(hWnd,CB_GETCOUNT,0,0);
|
||||||
for (i = 0; i < uDevNo; ++i)
|
for (i = 0; i < uDevNo; ++i)
|
||||||
{
|
{
|
||||||
// translate device ID to combo box position
|
// translate device ID to combo box position
|
||||||
uDevID = (UINT) SendMessage(hWnd,CB_GETITEMDATA,i,0);
|
uDevID = (UINT) SendMessage(hWnd,CB_GETITEMDATA,i,0);
|
||||||
|
|
||||||
if (uDevID == uDeviceID) uSelectDevice = i;
|
if (uDevID == uDeviceID) uSelectDevice = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // direct sound not available, detect over wave capabilities
|
else // direct sound not available, detect over wave capabilities
|
||||||
{
|
{
|
||||||
WAVEOUTCAPS woc;
|
WAVEOUTCAPS woc;
|
||||||
|
|
||||||
uDevNo = waveOutGetNumDevs();
|
uDevNo = waveOutGetNumDevs();
|
||||||
for (uDevID = 0; uDevID < uDevNo; ++uDevID)
|
for (uDevID = 0; uDevID < uDevNo; ++uDevID)
|
||||||
{
|
{
|
||||||
if ( waveOutGetDevCaps(uDevID,&woc,sizeof(woc)) == MMSYSERR_NOERROR
|
if ( waveOutGetDevCaps(uDevID,&woc,sizeof(woc)) == MMSYSERR_NOERROR
|
||||||
&& (woc.dwFormats & WAVE_FORMAT_4M08) != 0)
|
&& (woc.dwFormats & WAVE_FORMAT_4M08) != 0)
|
||||||
{
|
{
|
||||||
// copy product name and wave device ID to combo box
|
// copy product name and wave device ID to combo box
|
||||||
LONG i = (LONG) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) woc.szPname);
|
LONG i = (LONG) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) woc.szPname);
|
||||||
SendMessage(hWnd,CB_SETITEMDATA,i,uDevID);
|
SendMessage(hWnd,CB_SETITEMDATA,i,uDevID);
|
||||||
|
|
||||||
if (uDevID == uDeviceID) uSelectDevice = i;
|
if (uDevID == uDeviceID) uSelectDevice = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// activate last selected combo box item
|
// activate last selected combo box item
|
||||||
SendMessage(hWnd,CB_SETCURSEL,uSelectDevice,0L);
|
SendMessage(hWnd,CB_SETCURSEL,uSelectDevice,0L);
|
||||||
|
|
||||||
if (hDSound != NULL) // direct sound dll loaded
|
if (hDSound != NULL) // direct sound dll loaded
|
||||||
{
|
{
|
||||||
pfnDllGetClassObject = NULL;
|
pfnDllGetClassObject = NULL;
|
||||||
VERIFY(FreeLibrary(hDSound));
|
VERIFY(FreeLibrary(hDSound));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,257 +1,257 @@
|
||||||
/*
|
/*
|
||||||
* symbfile.c
|
* symbfile.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008 Christoph Gießelink
|
* Copyright (C) 2008 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
|
|
||||||
//################
|
//################
|
||||||
//#
|
//#
|
||||||
//# Saturn Object File Reading
|
//# Saturn Object File Reading
|
||||||
//#
|
//#
|
||||||
//################
|
//################
|
||||||
|
|
||||||
#define RECORD_BLOCK 256 // block size
|
#define RECORD_BLOCK 256 // block size
|
||||||
#define OS_RESOLVED 0x8000 // resolved symbol
|
#define OS_RESOLVED 0x8000 // resolved symbol
|
||||||
#define OS_RELOCATABLE 0x4000 // relocatable symbol
|
#define OS_RELOCATABLE 0x4000 // relocatable symbol
|
||||||
|
|
||||||
#define SAT_ID "Saturn3" // saturn block header
|
#define SAT_ID "Saturn3" // saturn block header
|
||||||
#define SYMB_ID "Symb" // symbol block header
|
#define SYMB_ID "Symb" // symbol block header
|
||||||
|
|
||||||
#define HASHENTRIES 199 // size of hash table
|
#define HASHENTRIES 199 // size of hash table
|
||||||
|
|
||||||
typedef struct _REFDATA
|
typedef struct _REFDATA
|
||||||
{
|
{
|
||||||
LPTSTR lpszName; // symbol name
|
LPTSTR lpszName; // symbol name
|
||||||
DWORD dwAddr; // resolved address
|
DWORD dwAddr; // resolved address
|
||||||
struct _REFDATA* pNext;
|
struct _REFDATA* pNext;
|
||||||
} REFDATA, *PREFDATA;
|
} REFDATA, *PREFDATA;
|
||||||
|
|
||||||
static PREFDATA ppsBase[HASHENTRIES]; // base of symbol references (initialized with NULL)
|
static PREFDATA ppsBase[HASHENTRIES]; // base of symbol references (initialized with NULL)
|
||||||
|
|
||||||
static __inline DWORD GetHash(DWORD dwVal)
|
static __inline DWORD GetHash(DWORD dwVal)
|
||||||
{
|
{
|
||||||
return dwVal % HASHENTRIES; // hash function
|
return dwVal % HASHENTRIES; // hash function
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD GetBigEndian(LPBYTE pbyData, INT nSize)
|
static DWORD GetBigEndian(LPBYTE pbyData, INT nSize)
|
||||||
{
|
{
|
||||||
DWORD dwVal = 0;
|
DWORD dwVal = 0;
|
||||||
|
|
||||||
while (nSize-- > 0)
|
while (nSize-- > 0)
|
||||||
{
|
{
|
||||||
dwVal <<= 8;
|
dwVal <<= 8;
|
||||||
dwVal += *pbyData++;
|
dwVal += *pbyData++;
|
||||||
}
|
}
|
||||||
return dwVal;
|
return dwVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// check if entry table is empty
|
// check if entry table is empty
|
||||||
//
|
//
|
||||||
BOOL RplTableEmpty(VOID)
|
BOOL RplTableEmpty(VOID)
|
||||||
{
|
{
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
BOOL bEmpty = TRUE;
|
BOOL bEmpty = TRUE;
|
||||||
|
|
||||||
// check if hash table is empty
|
// check if hash table is empty
|
||||||
for (i = 0; bEmpty && i < ARRAYSIZEOF(ppsBase); ++i)
|
for (i = 0; bEmpty && i < ARRAYSIZEOF(ppsBase); ++i)
|
||||||
{
|
{
|
||||||
bEmpty = (ppsBase[i] == NULL); // check if empty
|
bEmpty = (ppsBase[i] == NULL); // check if empty
|
||||||
}
|
}
|
||||||
return bEmpty;
|
return bEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// load entry table
|
// load entry table
|
||||||
//
|
//
|
||||||
BOOL RplLoadTable(LPCTSTR lpszFilename)
|
BOOL RplLoadTable(LPCTSTR lpszFilename)
|
||||||
{
|
{
|
||||||
BYTE byPage[RECORD_BLOCK]; // record page size
|
BYTE byPage[RECORD_BLOCK]; // record page size
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
DWORD dwFileLength,dwCodeLength,dwNoSymbols,dwNoReferences;
|
DWORD dwFileLength,dwCodeLength,dwNoSymbols,dwNoReferences;
|
||||||
DWORD dwFilePos,dwBytesRead,dwSymb,dwPageIndex,dwResolvedSymb;
|
DWORD dwFilePos,dwBytesRead,dwSymb,dwPageIndex,dwResolvedSymb;
|
||||||
BOOL bSymbol,bSucc;
|
BOOL bSymbol,bSucc;
|
||||||
|
|
||||||
bSucc = FALSE;
|
bSucc = FALSE;
|
||||||
|
|
||||||
hFile = CreateFile(lpszFilename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,NULL);
|
hFile = CreateFile(lpszFilename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,NULL);
|
||||||
if (hFile != INVALID_HANDLE_VALUE)
|
if (hFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
dwResolvedSymb = 0; // no resolved symbols added
|
dwResolvedSymb = 0; // no resolved symbols added
|
||||||
bSymbol = TRUE; // next set is a symbol
|
bSymbol = TRUE; // next set is a symbol
|
||||||
|
|
||||||
// read first page
|
// read first page
|
||||||
ReadFile(hFile,byPage,sizeof(byPage),&dwBytesRead,NULL);
|
ReadFile(hFile,byPage,sizeof(byPage),&dwBytesRead,NULL);
|
||||||
if (dwBytesRead == sizeof(byPage) && memcmp(byPage,SAT_ID,7) == 0)
|
if (dwBytesRead == sizeof(byPage) && memcmp(byPage,SAT_ID,7) == 0)
|
||||||
{
|
{
|
||||||
// file length in bytes
|
// file length in bytes
|
||||||
dwFileLength = GetBigEndian(byPage+7,sizeof(WORD)) * sizeof(byPage);
|
dwFileLength = GetBigEndian(byPage+7,sizeof(WORD)) * sizeof(byPage);
|
||||||
|
|
||||||
// code area in nibbles
|
// code area in nibbles
|
||||||
dwCodeLength = GetBigEndian(byPage+9,sizeof(DWORD));
|
dwCodeLength = GetBigEndian(byPage+9,sizeof(DWORD));
|
||||||
|
|
||||||
// no. of symbols & references
|
// no. of symbols & references
|
||||||
dwNoSymbols = GetBigEndian(byPage+13,sizeof(WORD));
|
dwNoSymbols = GetBigEndian(byPage+13,sizeof(WORD));
|
||||||
|
|
||||||
// no. of references
|
// no. of references
|
||||||
dwNoReferences = GetBigEndian(byPage+15,sizeof(WORD));
|
dwNoReferences = GetBigEndian(byPage+15,sizeof(WORD));
|
||||||
|
|
||||||
// convert code area length into no. of pages
|
// convert code area length into no. of pages
|
||||||
dwPageIndex = (dwCodeLength + (2 * sizeof(byPage) - 1)) / (2 * sizeof(byPage));
|
dwPageIndex = (dwCodeLength + (2 * sizeof(byPage) - 1)) / (2 * sizeof(byPage));
|
||||||
|
|
||||||
// calculate no. of code pages
|
// calculate no. of code pages
|
||||||
dwFilePos = dwPageIndex * sizeof(byPage);
|
dwFilePos = dwPageIndex * sizeof(byPage);
|
||||||
|
|
||||||
// jump to begin of symbols by skipping no. of code pages
|
// jump to begin of symbols by skipping no. of code pages
|
||||||
bSucc = SetFilePointer(hFile,dwFilePos,NULL,FILE_CURRENT) != INVALID_SET_FILE_POINTER;
|
bSucc = SetFilePointer(hFile,dwFilePos,NULL,FILE_CURRENT) != INVALID_SET_FILE_POINTER;
|
||||||
|
|
||||||
dwFilePos += sizeof(byPage); // actual file position
|
dwFilePos += sizeof(byPage); // actual file position
|
||||||
}
|
}
|
||||||
|
|
||||||
// read all symbol pages
|
// read all symbol pages
|
||||||
for (dwPageIndex = 256, dwSymb = 0; bSucc && dwSymb < dwNoSymbols; dwPageIndex += 42)
|
for (dwPageIndex = 256, dwSymb = 0; bSucc && dwSymb < dwNoSymbols; dwPageIndex += 42)
|
||||||
{
|
{
|
||||||
if (dwPageIndex >= 256) // read complete page
|
if (dwPageIndex >= 256) // read complete page
|
||||||
{
|
{
|
||||||
// read new symbol page
|
// read new symbol page
|
||||||
ReadFile(hFile,byPage,sizeof(byPage),&dwBytesRead,NULL);
|
ReadFile(hFile,byPage,sizeof(byPage),&dwBytesRead,NULL);
|
||||||
dwFilePos += dwBytesRead; // update file position
|
dwFilePos += dwBytesRead; // update file position
|
||||||
if ( dwFilePos > dwFileLength
|
if ( dwFilePos > dwFileLength
|
||||||
|| dwBytesRead != sizeof(byPage)
|
|| dwBytesRead != sizeof(byPage)
|
||||||
|| memcmp(byPage,SYMB_ID,4) != 0)
|
|| memcmp(byPage,SYMB_ID,4) != 0)
|
||||||
{
|
{
|
||||||
bSucc = FALSE;
|
bSucc = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwPageIndex = 4; // begin of new symbol
|
dwPageIndex = 4; // begin of new symbol
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bSymbol) // this is the 42 byte symbol set
|
if (bSymbol) // this is the 42 byte symbol set
|
||||||
{
|
{
|
||||||
WORD wSymbolType = (WORD) GetBigEndian(byPage+dwPageIndex+36,sizeof(WORD));
|
WORD wSymbolType = (WORD) GetBigEndian(byPage+dwPageIndex+36,sizeof(WORD));
|
||||||
|
|
||||||
// check if it's a resolved or relocatable symbol
|
// check if it's a resolved or relocatable symbol
|
||||||
bSymbol = (wSymbolType & OS_RESOLVED) != 0;
|
bSymbol = (wSymbolType & OS_RESOLVED) != 0;
|
||||||
|
|
||||||
if (bSymbol) ++dwResolvedSymb; // added resolved symbol
|
if (bSymbol) ++dwResolvedSymb; // added resolved symbol
|
||||||
|
|
||||||
if (wSymbolType == OS_RESOLVED) // resolved symbol type
|
if (wSymbolType == OS_RESOLVED) // resolved symbol type
|
||||||
{
|
{
|
||||||
TCHAR szSymbolName[36+1],*pcPtr;
|
TCHAR szSymbolName[36+1],*pcPtr;
|
||||||
PREFDATA pData;
|
PREFDATA pData;
|
||||||
DWORD dwHash;
|
DWORD dwHash;
|
||||||
|
|
||||||
#if defined _UNICODE
|
#if defined _UNICODE
|
||||||
{
|
{
|
||||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,(LPCSTR)byPage+dwPageIndex,36,
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,(LPCSTR)byPage+dwPageIndex,36,
|
||||||
szSymbolName,ARRAYSIZEOF(szSymbolName));
|
szSymbolName,ARRAYSIZEOF(szSymbolName));
|
||||||
szSymbolName[36] = 0; // set EOS
|
szSymbolName[36] = 0; // set EOS
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
lstrcpyn(szSymbolName,(LPCSTR)byPage+dwPageIndex,ARRAYSIZEOF(szSymbolName));
|
lstrcpyn(szSymbolName,(LPCSTR)byPage+dwPageIndex,ARRAYSIZEOF(szSymbolName));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// cut symbol name at first space character
|
// cut symbol name at first space character
|
||||||
if ((pcPtr = _tcschr(szSymbolName,_T(' '))) != NULL)
|
if ((pcPtr = _tcschr(szSymbolName,_T(' '))) != NULL)
|
||||||
*pcPtr = 0; // set EOS
|
*pcPtr = 0; // set EOS
|
||||||
|
|
||||||
// allocate symbol memory
|
// allocate symbol memory
|
||||||
VERIFY(pData = (PREFDATA) malloc(sizeof(*pData)));
|
VERIFY(pData = (PREFDATA) malloc(sizeof(*pData)));
|
||||||
pData->lpszName = DuplicateString(szSymbolName);
|
pData->lpszName = DuplicateString(szSymbolName);
|
||||||
pData->dwAddr = GetBigEndian(byPage+dwPageIndex+38,sizeof(DWORD));
|
pData->dwAddr = GetBigEndian(byPage+dwPageIndex+38,sizeof(DWORD));
|
||||||
|
|
||||||
// add to hash table
|
// add to hash table
|
||||||
dwHash = GetHash(pData->dwAddr);
|
dwHash = GetHash(pData->dwAddr);
|
||||||
pData->pNext = ppsBase[dwHash];
|
pData->pNext = ppsBase[dwHash];
|
||||||
ppsBase[dwHash] = pData;
|
ppsBase[dwHash] = pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
++dwSymb; // got symbol
|
++dwSymb; // got symbol
|
||||||
}
|
}
|
||||||
else // 42 byte fill reference
|
else // 42 byte fill reference
|
||||||
{
|
{
|
||||||
bSymbol = TRUE; // nothing to do, next is a symbol set
|
bSymbol = TRUE; // nothing to do, next is a symbol set
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bSucc = bSucc && (dwFilePos <= dwFileLength)
|
bSucc = bSucc && (dwFilePos <= dwFileLength)
|
||||||
&& (dwNoSymbols == (dwResolvedSymb + dwNoReferences));
|
&& (dwNoSymbols == (dwResolvedSymb + dwNoReferences));
|
||||||
|
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bSucc) RplDeleteTable(); // delete current table
|
if (!bSucc) RplDeleteTable(); // delete current table
|
||||||
return bSucc;
|
return bSucc;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// delete entry table
|
// delete entry table
|
||||||
//
|
//
|
||||||
VOID RplDeleteTable(VOID)
|
VOID RplDeleteTable(VOID)
|
||||||
{
|
{
|
||||||
PREFDATA pData;
|
PREFDATA pData;
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
// clear hash entries
|
// clear hash entries
|
||||||
for (i = 0; i < ARRAYSIZEOF(ppsBase); ++i)
|
for (i = 0; i < ARRAYSIZEOF(ppsBase); ++i)
|
||||||
{
|
{
|
||||||
while (ppsBase[i] != NULL) // walk through all datasets
|
while (ppsBase[i] != NULL) // walk through all datasets
|
||||||
{
|
{
|
||||||
pData = ppsBase[i]->pNext;
|
pData = ppsBase[i]->pNext;
|
||||||
free(ppsBase[i]->lpszName);
|
free(ppsBase[i]->lpszName);
|
||||||
free(ppsBase[i]);
|
free(ppsBase[i]);
|
||||||
ppsBase[i] = pData;
|
ppsBase[i] = pData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// return name for given entry address
|
// return name for given entry address
|
||||||
//
|
//
|
||||||
LPCTSTR RplGetName(DWORD dwAddr)
|
LPCTSTR RplGetName(DWORD dwAddr)
|
||||||
{
|
{
|
||||||
PREFDATA pData = ppsBase[GetHash(dwAddr)];
|
PREFDATA pData = ppsBase[GetHash(dwAddr)];
|
||||||
|
|
||||||
// walk through all datasets of hash entry
|
// walk through all datasets of hash entry
|
||||||
for (; pData != NULL; pData = pData->pNext)
|
for (; pData != NULL; pData = pData->pNext)
|
||||||
{
|
{
|
||||||
if (pData->dwAddr == dwAddr) // found address
|
if (pData->dwAddr == dwAddr) // found address
|
||||||
return pData->lpszName; // return symbol name
|
return pData->lpszName; // return symbol name
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// return entry address for given name
|
// return entry address for given name
|
||||||
//
|
//
|
||||||
BOOL RplGetAddr(LPCTSTR lpszName, DWORD *pdwAddr)
|
BOOL RplGetAddr(LPCTSTR lpszName, DWORD *pdwAddr)
|
||||||
{
|
{
|
||||||
PREFDATA pData;
|
PREFDATA pData;
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
// check for every dataset in hash table
|
// check for every dataset in hash table
|
||||||
for (i = 0; i < ARRAYSIZEOF(ppsBase); ++i)
|
for (i = 0; i < ARRAYSIZEOF(ppsBase); ++i)
|
||||||
{
|
{
|
||||||
// walk through all datasets of hash entry
|
// walk through all datasets of hash entry
|
||||||
for (pData = ppsBase[i]; pData != NULL; pData = pData->pNext)
|
for (pData = ppsBase[i]; pData != NULL; pData = pData->pNext)
|
||||||
{
|
{
|
||||||
// found symbol name
|
// found symbol name
|
||||||
if (lstrcmp(lpszName,pData->lpszName) == 0)
|
if (lstrcmp(lpszName,pData->lpszName) == 0)
|
||||||
{
|
{
|
||||||
*pdwAddr = pData->dwAddr; // return address
|
*pdwAddr = pData->dwAddr; // return address
|
||||||
return FALSE; // found
|
return FALSE; // found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE; // not found
|
return TRUE; // not found
|
||||||
}
|
}
|
|
@ -1,435 +1,429 @@
|
||||||
/*
|
/*
|
||||||
* timer.c
|
* timer.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
#include "io.h" // I/O definitions
|
#include "io.h" // I/O definitions
|
||||||
|
|
||||||
#define AUTO_OFF 10 // Time in minutes for 'auto off'
|
#define AUTO_OFF 10 // Time in minutes for 'auto off'
|
||||||
|
|
||||||
// Ticks for 'auto off'
|
// Ticks for 'auto off'
|
||||||
#define OFF_TIME ((ULONGLONG) (AUTO_OFF * 60) << 13)
|
#define OFF_TIME ((ULONGLONG) (AUTO_OFF * 60) << 13)
|
||||||
|
|
||||||
// memory address for clock and auto off
|
// memory address for clock and auto off
|
||||||
// S(X) = 0x70052-0x70070, G(X) = 0x80058-0x80076, 49G = 0x80058-0x80076
|
// S(X) = 0x70052-0x70070, G(X) = 0x80058-0x80076, 49G = 0x80058-0x80076
|
||||||
#define RPLTIME ((cCurrentRomType=='S')?0x52:0x58)
|
#define RPLTIME ((cCurrentRomType=='S')?0x52:0x58)
|
||||||
|
|
||||||
#define T1_FREQ 62 // Timer1 1/frequency in ms
|
#define T1_FREQ 62 // Timer1 1/frequency in ms
|
||||||
#define T2_FREQ 8192 // Timer2 frequency
|
#define T2_FREQ 8192 // Timer2 frequency
|
||||||
|
|
||||||
static BOOL bStarted = FALSE;
|
static BOOL bStarted = FALSE;
|
||||||
static BOOL bOutRange = FALSE; // flag if timer value out of range
|
static BOOL bOutRange = FALSE; // flag if timer value out of range
|
||||||
static UINT uT1TimerId = 0;
|
static UINT uT1TimerId = 0;
|
||||||
static UINT uT2TimerId = 0;
|
static UINT uT2TimerId = 0;
|
||||||
|
|
||||||
static BOOL bNINT2T1 = FALSE; // state of NINT2 affected from timer1
|
static BOOL bNINT2T1 = FALSE; // state of NINT2 affected from timer1
|
||||||
static BOOL bNINT2T2 = FALSE; // state of NINT2 affected from timer2
|
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 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 void CALLBACK TimeProc(UINT uEventId, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
static void CALLBACK TimeProc(UINT uEventId, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
||||||
|
|
||||||
static DWORD CalcT2(VOID) // calculate timer2 value
|
static DWORD CalcT2(VOID) // calculate timer2 value
|
||||||
{
|
{
|
||||||
DWORD dwT2 = Chipset.t2; // get value from chipset
|
DWORD dwT2 = Chipset.t2; // get value from chipset
|
||||||
if (bStarted) // timer2 running
|
if (bStarted) // timer2 running
|
||||||
{
|
{
|
||||||
LARGE_INTEGER lT2Act;
|
LARGE_INTEGER lT2Act;
|
||||||
DWORD dwT2Dif;
|
DWORD dwT2Dif;
|
||||||
|
|
||||||
// timer should run a little bit faster (10%) than maschine in authentic speed mode
|
// timer should run a little bit faster (10%) than maschine in authentic speed mode
|
||||||
DWORD dwCycPerTick = (9 * T2CYCLES) / 5;
|
DWORD dwCycPerTick = (9 * T2CYCLES) / 5;
|
||||||
|
|
||||||
QueryPerformanceCounter(&lT2Act); // actual time
|
QueryPerformanceCounter(&lT2Act); // actual time
|
||||||
// calculate realtime timer2 ticks since reference point
|
// calculate realtime timer2 ticks since reference point
|
||||||
dwT2 -= (DWORD)
|
dwT2 -= (DWORD)
|
||||||
(((lT2Act.QuadPart - lT2Ref.QuadPart) * T2_FREQ)
|
(((lT2Act.QuadPart - lT2Ref.QuadPart) * T2_FREQ)
|
||||||
/ lFreq.QuadPart);
|
/ lFreq.QuadPart);
|
||||||
|
|
||||||
dwT2Dif = dwT2Ref - dwT2; // timer2 ticks since last request
|
dwT2Dif = dwT2Ref - dwT2; // timer2 ticks since last request
|
||||||
|
|
||||||
// checking if the MSB of dwT2Dif can be used as sign flag
|
// checking if the MSB of dwT2Dif can be used as sign flag
|
||||||
_ASSERT((DWORD) tc.wPeriodMax < ((1<<(sizeof(dwT2Dif)*8-1))/8192)*1000);
|
_ASSERT((DWORD) tc.wPeriodMax < ((1<<(sizeof(dwT2Dif)*8-1))/8192)*1000);
|
||||||
|
|
||||||
// 2nd timer call in a 32ms time frame or elapsed time is negative (Win2k bug)
|
// 2nd timer call in a 32ms time frame or elapsed time is negative (Win2k bug)
|
||||||
if (!Chipset.Shutdn && ((dwT2Dif > 0x01 && dwT2Dif <= 0x100) || (dwT2Dif & 0x80000000) != 0))
|
if (!Chipset.Shutdn && ((dwT2Dif > 0x01 && dwT2Dif <= 0x100) || (dwT2Dif & 0x80000000) != 0))
|
||||||
{
|
{
|
||||||
DWORD dwT2Ticks = ((DWORD) (Chipset.cycles & 0xFFFFFFFF) - dwT2Cyc) / dwCycPerTick;
|
DWORD dwT2Ticks = ((DWORD) (Chipset.cycles & 0xFFFFFFFF) - dwT2Cyc) / dwCycPerTick;
|
||||||
|
|
||||||
// estimated < real elapsed timer2 ticks or negative time
|
// estimated < real elapsed timer2 ticks or negative time
|
||||||
if (dwT2Ticks < dwT2Dif || (dwT2Dif & 0x80000000) != 0)
|
if (dwT2Ticks < dwT2Dif || (dwT2Dif & 0x80000000) != 0)
|
||||||
{
|
{
|
||||||
// real time too long or got negative time elapsed
|
// real time too long or got negative time elapsed
|
||||||
dwT2 = dwT2Ref - dwT2Ticks; // estimated timer2 value from CPU cycles
|
dwT2 = dwT2Ref - dwT2Ticks; // estimated timer2 value from CPU cycles
|
||||||
dwT2Cyc += dwT2Ticks * dwCycPerTick; // estimated CPU cycles for the timer2 ticks
|
dwT2Cyc += dwT2Ticks * dwCycPerTick; // estimated CPU cycles for the timer2 ticks
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// reached actual time -> new synchronizing
|
// reached actual time -> new synchronizing
|
||||||
dwT2Cyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF) - dwCycPerTick;
|
dwT2Cyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF) - dwCycPerTick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// valid actual time -> new synchronizing
|
// valid actual time -> new synchronizing
|
||||||
dwT2Cyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF) - dwCycPerTick;
|
dwT2Cyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF) - dwCycPerTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if timer2 interrupt is active -> no timer2 value below 0xFFFFFFFF
|
// check if timer2 interrupt is active -> no timer2 value below 0xFFFFFFFF
|
||||||
if ( Chipset.inte
|
if ( Chipset.inte
|
||||||
&& (dwT2 & 0x80000000) != 0
|
&& (dwT2 & 0x80000000) != 0
|
||||||
&& (!Chipset.Shutdn || (Chipset.IORam[TIMER2_CTRL]&WKE))
|
&& (!Chipset.Shutdn || (Chipset.IORam[TIMER2_CTRL]&WKE))
|
||||||
&& (Chipset.IORam[TIMER2_CTRL]&INTR)
|
&& (Chipset.IORam[TIMER2_CTRL]&INTR)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
dwT2 = 0xFFFFFFFF;
|
dwT2 = 0xFFFFFFFF;
|
||||||
dwT2Cyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF) - dwCycPerTick;
|
dwT2Cyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF) - dwCycPerTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwT2Ref = dwT2; // new reference time
|
dwT2Ref = dwT2; // new reference time
|
||||||
}
|
}
|
||||||
return dwT2;
|
return dwT2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID CheckT1(BYTE nT1)
|
static VOID CheckT1(BYTE nT1)
|
||||||
{
|
{
|
||||||
// implementation of TSRQ
|
// implementation of TSRQ
|
||||||
bNINT2T1 = (Chipset.IORam[TIMER1_CTRL]&INTR) != 0 && (nT1&8) != 0;
|
bNINT2T1 = (Chipset.IORam[TIMER1_CTRL]&INTR) != 0 && (nT1&8) != 0;
|
||||||
IOBit(SRQ1,TSRQ,bNINT2T1 || bNINT2T2);
|
IOBit(SRQ1,TSRQ,bNINT2T1 || bNINT2T2);
|
||||||
|
|
||||||
if ((nT1&8) == 0) // timer1 MSB not set
|
if ((nT1&8) == 0) // timer1 MSB not set
|
||||||
{
|
{
|
||||||
Chipset.IORam[TIMER1_CTRL] &= ~SRQ; // clear SRQ bit
|
Chipset.IORam[TIMER1_CTRL] &= ~SRQ; // clear SRQ bit
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ASSERT((nT1&8) != 0); // timer1 MSB set
|
_ASSERT((nT1&8) != 0); // timer1 MSB set
|
||||||
|
|
||||||
// timer MSB and INT or WAKE bit is set
|
// timer MSB and INT or WAKE bit is set
|
||||||
if ((Chipset.IORam[TIMER1_CTRL]&(WKE|INTR)) != 0)
|
if ((Chipset.IORam[TIMER1_CTRL]&(WKE|INTR)) != 0)
|
||||||
Chipset.IORam[TIMER1_CTRL] |= SRQ; // set SRQ
|
Chipset.IORam[TIMER1_CTRL] |= SRQ; // set SRQ
|
||||||
// cpu not sleeping and T1 -> Interrupt
|
// cpu not sleeping and T1 -> Interrupt
|
||||||
if ( (!Chipset.Shutdn || (Chipset.IORam[TIMER1_CTRL]&WKE))
|
if ( (!Chipset.Shutdn || (Chipset.IORam[TIMER1_CTRL]&WKE))
|
||||||
&& (Chipset.IORam[TIMER1_CTRL]&INTR))
|
&& (Chipset.IORam[TIMER1_CTRL]&INTR))
|
||||||
{
|
{
|
||||||
Chipset.SoftInt = TRUE;
|
Chipset.SoftInt = TRUE;
|
||||||
bInterrupt = TRUE;
|
bInterrupt = TRUE;
|
||||||
}
|
}
|
||||||
// cpu sleeping and T1 -> Wake Up
|
// cpu sleeping and T1 -> Wake Up
|
||||||
if (Chipset.Shutdn && (Chipset.IORam[TIMER1_CTRL]&WKE))
|
if (Chipset.Shutdn && (Chipset.IORam[TIMER1_CTRL]&WKE))
|
||||||
{
|
{
|
||||||
Chipset.IORam[TIMER1_CTRL] &= ~WKE; // clear WKE bit
|
Chipset.IORam[TIMER1_CTRL] &= ~WKE; // clear WKE bit
|
||||||
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
||||||
SetEvent(hEventShutdn); // wake up emulation thread
|
SetEvent(hEventShutdn); // wake up emulation thread
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID CheckT2(DWORD dwT2)
|
static VOID CheckT2(DWORD dwT2)
|
||||||
{
|
{
|
||||||
// implementation of TSRQ
|
// implementation of TSRQ
|
||||||
bNINT2T2 = (Chipset.IORam[TIMER2_CTRL]&INTR) != 0 && (dwT2&0x80000000) != 0;
|
bNINT2T2 = (Chipset.IORam[TIMER2_CTRL]&INTR) != 0 && (dwT2&0x80000000) != 0;
|
||||||
IOBit(SRQ1,TSRQ,bNINT2T1 || bNINT2T2);
|
IOBit(SRQ1,TSRQ,bNINT2T1 || bNINT2T2);
|
||||||
|
|
||||||
if ((dwT2&0x80000000) == 0) // timer2 MSB not set
|
if ((dwT2&0x80000000) == 0) // timer2 MSB not set
|
||||||
{
|
{
|
||||||
Chipset.IORam[TIMER2_CTRL] &= ~SRQ; // clear SRQ bit
|
Chipset.IORam[TIMER2_CTRL] &= ~SRQ; // clear SRQ bit
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ASSERT((dwT2&0x80000000) != 0); // timer2 MSB set
|
_ASSERT((dwT2&0x80000000) != 0); // timer2 MSB set
|
||||||
|
|
||||||
// timer MSB and INT or WAKE bit is set
|
// timer MSB and INT or WAKE bit is set
|
||||||
if ((Chipset.IORam[TIMER2_CTRL]&(WKE|INTR)) != 0)
|
if ((Chipset.IORam[TIMER2_CTRL]&(WKE|INTR)) != 0)
|
||||||
Chipset.IORam[TIMER2_CTRL] |= SRQ; // set SRQ
|
Chipset.IORam[TIMER2_CTRL] |= SRQ; // set SRQ
|
||||||
// cpu not sleeping and T2 -> Interrupt
|
// cpu not sleeping and T2 -> Interrupt
|
||||||
if ( (!Chipset.Shutdn || (Chipset.IORam[TIMER2_CTRL]&WKE))
|
if ( (!Chipset.Shutdn || (Chipset.IORam[TIMER2_CTRL]&WKE))
|
||||||
&& (Chipset.IORam[TIMER2_CTRL]&INTR))
|
&& (Chipset.IORam[TIMER2_CTRL]&INTR))
|
||||||
{
|
{
|
||||||
Chipset.SoftInt = TRUE;
|
Chipset.SoftInt = TRUE;
|
||||||
bInterrupt = TRUE;
|
bInterrupt = TRUE;
|
||||||
}
|
}
|
||||||
// cpu sleeping and T2 -> Wake Up
|
// cpu sleeping and T2 -> Wake Up
|
||||||
if (Chipset.Shutdn && (Chipset.IORam[TIMER2_CTRL]&WKE))
|
if (Chipset.Shutdn && (Chipset.IORam[TIMER2_CTRL]&WKE))
|
||||||
{
|
{
|
||||||
Chipset.IORam[TIMER2_CTRL] &= ~WKE; // clear WKE bit
|
Chipset.IORam[TIMER2_CTRL] &= ~WKE; // clear WKE bit
|
||||||
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode
|
||||||
SetEvent(hEventShutdn); // wake up emulation thread
|
SetEvent(hEventShutdn); // wake up emulation thread
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID RescheduleT2(BOOL bRefPoint)
|
static VOID RescheduleT2(BOOL bRefPoint)
|
||||||
{
|
{
|
||||||
UINT uDelay;
|
UINT uDelay;
|
||||||
_ASSERT(uT2TimerId == 0); // timer2 must stopped
|
_ASSERT(uT2TimerId == 0); // timer2 must stopped
|
||||||
if (bRefPoint) // save reference time
|
if (bRefPoint) // save reference time
|
||||||
{
|
{
|
||||||
dwT2Ref = Chipset.t2; // timer2 value at last timer2 access
|
dwT2Ref = Chipset.t2; // timer2 value at last timer2 access
|
||||||
dwT2Cyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF); // cpu cycle counter at last timer2 access
|
dwT2Cyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF); // cpu cycle counter at last timer2 access
|
||||||
QueryPerformanceCounter(&lT2Ref); // time of corresponding Chipset.t2 value
|
QueryPerformanceCounter(&lT2Ref); // time of corresponding Chipset.t2 value
|
||||||
uDelay = Chipset.t2; // timer value for delay
|
uDelay = Chipset.t2; // timer value for delay
|
||||||
}
|
}
|
||||||
else // called without new refpoint, restart t2 with actual value
|
else // called without new refpoint, restart t2 with actual value
|
||||||
{
|
{
|
||||||
uDelay = CalcT2(); // actual timer value for delay
|
uDelay = CalcT2(); // actual timer value for delay
|
||||||
}
|
}
|
||||||
if ((bOutRange = uDelay > uT2MaxTicks)) // delay greater maximum delay
|
if ((bOutRange = uDelay > uT2MaxTicks)) // delay greater maximum delay
|
||||||
uDelay = uT2MaxTicks; // wait maximum delay time
|
uDelay = uT2MaxTicks; // wait maximum delay time
|
||||||
uDelay = (uDelay * 125 + 1023) / 1024; // timer delay in ms (1000/8192 = 125/1024)
|
uDelay = (uDelay * 125 + 1023) / 1024; // timer delay in ms (1000/8192 = 125/1024)
|
||||||
uDelay = __max(tc.wPeriodMin,uDelay); // wait minimum delay of timer
|
uDelay = __max(tc.wPeriodMin,uDelay); // wait minimum delay of timer
|
||||||
_ASSERT(uDelay <= tc.wPeriodMax); // inside maximum event delay
|
_ASSERT(uDelay <= tc.wPeriodMax); // inside maximum event delay
|
||||||
// start timer2; schedule event, when Chipset.t2 will be zero
|
// start timer2; schedule event, when Chipset.t2 will be zero
|
||||||
VERIFY(uT2TimerId = timeSetEvent(uDelay,0,&TimeProc,2,TIME_ONESHOT));
|
VERIFY(uT2TimerId = timeSetEvent(uDelay,0,&TimeProc,2,TIME_ONESHOT));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID AbortT2(VOID)
|
static VOID AbortT2(VOID)
|
||||||
{
|
{
|
||||||
_ASSERT(uT2TimerId);
|
_ASSERT(uT2TimerId);
|
||||||
timeKillEvent(uT2TimerId); // kill event
|
timeKillEvent(uT2TimerId); // kill event
|
||||||
uT2TimerId = 0; // then reset var
|
uT2TimerId = 0; // then reset var
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CALLBACK TimeProc(UINT uEventId, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
|
static void CALLBACK TimeProc(UINT uEventId, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
|
||||||
{
|
{
|
||||||
if (uEventId == 0) return; // illegal EventId
|
if (uEventId == 0) return; // illegal EventId
|
||||||
|
|
||||||
if (uEventId == uT1TimerId) // called from timer1 event (default period 16 Hz)
|
if (uEventId == uT1TimerId) // called from timer1 event (default period 16 Hz)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csT1Lock);
|
EnterCriticalSection(&csT1Lock);
|
||||||
{
|
{
|
||||||
Chipset.t1 = (Chipset.t1-1)&0xF;// decrement timer value
|
Chipset.t1 = (Chipset.t1-1)&0xF;// decrement timer value
|
||||||
CheckT1(Chipset.t1); // test timer1 control bits
|
CheckT1(Chipset.t1); // test timer1 control bits
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&csT1Lock);
|
LeaveCriticalSection(&csT1Lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (uEventId == uT2TimerId) // called from timer2 event, Chipset.t2 should be zero
|
if (uEventId == uT2TimerId) // called from timer2 event, Chipset.t2 should be zero
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csT2Lock);
|
EnterCriticalSection(&csT2Lock);
|
||||||
{
|
{
|
||||||
uT2TimerId = 0; // single shot timer timer2 stopped
|
uT2TimerId = 0; // single shot timer timer2 stopped
|
||||||
if (!bOutRange) // timer event elapsed
|
if (!bOutRange) // timer event elapsed
|
||||||
{
|
{
|
||||||
// timer2 overrun, test timer2 control bits else restart timer2
|
// timer2 overrun, test timer2 control bits else restart timer2
|
||||||
Chipset.t2 = CalcT2(); // calculate new timer2 value
|
Chipset.t2 = CalcT2(); // calculate new timer2 value
|
||||||
CheckT2(Chipset.t2); // test timer2 control bits
|
CheckT2(Chipset.t2); // test timer2 control bits
|
||||||
}
|
}
|
||||||
RescheduleT2(!bOutRange); // restart timer2
|
RescheduleT2(!bOutRange); // restart timer2
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&csT2Lock);
|
LeaveCriticalSection(&csT2Lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
UNREFERENCED_PARAMETER(uMsg);
|
UNREFERENCED_PARAMETER(uMsg);
|
||||||
UNREFERENCED_PARAMETER(dwUser);
|
UNREFERENCED_PARAMETER(dwUser);
|
||||||
UNREFERENCED_PARAMETER(dw1);
|
UNREFERENCED_PARAMETER(dw1);
|
||||||
UNREFERENCED_PARAMETER(dw2);
|
UNREFERENCED_PARAMETER(dw2);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SetHP48Time(VOID) // set date and time
|
VOID SetHP48Time(VOID) // set date and time
|
||||||
{
|
{
|
||||||
SYSTEMTIME ts;
|
SYSTEMTIME ts;
|
||||||
ULONGLONG ticks, time;
|
ULONGLONG ticks, time;
|
||||||
DWORD dw;
|
DWORD dw;
|
||||||
WORD crc, i;
|
WORD crc, i;
|
||||||
BYTE p[4];
|
LPBYTE pbyTime;
|
||||||
|
|
||||||
_ASSERT(sizeof(ULONGLONG) == 8); // check size of datatype
|
_ASSERT(sizeof(ULONGLONG) == 8); // check size of datatype
|
||||||
|
|
||||||
GetLocalTime(&ts); // local time, _ftime() cause memory/resource leaks
|
GetLocalTime(&ts); // local time, _ftime() cause memory/resource leaks
|
||||||
|
|
||||||
// calculate days until 01.01.0000 (Erlang BIF localtime/0)
|
// calculate days until 01.01.0000 (Erlang BIF localtime/0)
|
||||||
dw = (DWORD) ts.wMonth;
|
dw = (DWORD) ts.wMonth;
|
||||||
if (dw > 2)
|
if (dw > 2)
|
||||||
dw -= 3L;
|
dw -= 3L;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dw += 9L;
|
dw += 9L;
|
||||||
--ts.wYear;
|
--ts.wYear;
|
||||||
}
|
}
|
||||||
dw = (DWORD) ts.wDay + (153L * dw + 2L) / 5L;
|
dw = (DWORD) ts.wDay + (153L * dw + 2L) / 5L;
|
||||||
dw += (146097L * (((DWORD) ts.wYear) / 100L)) / 4L;
|
dw += (146097L * (((DWORD) ts.wYear) / 100L)) / 4L;
|
||||||
dw += (1461L * (((DWORD) ts.wYear) % 100L)) / 4L;
|
dw += (1461L * (((DWORD) ts.wYear) % 100L)) / 4L;
|
||||||
dw += (-719469L + 719528L); // days from year 0
|
dw += (-719469L + 719528L); // days from year 0
|
||||||
|
|
||||||
ticks = (ULONGLONG) dw; // convert to 64 bit
|
ticks = (ULONGLONG) dw; // convert to 64 bit
|
||||||
|
|
||||||
// convert into seconds and add time
|
// convert into seconds and add time
|
||||||
ticks = ticks * 24L + (ULONGLONG) ts.wHour;
|
ticks = ticks * 24L + (ULONGLONG) ts.wHour;
|
||||||
ticks = ticks * 60L + (ULONGLONG) ts.wMinute;
|
ticks = ticks * 60L + (ULONGLONG) ts.wMinute;
|
||||||
ticks = ticks * 60L + (ULONGLONG) ts.wSecond;
|
ticks = ticks * 60L + (ULONGLONG) ts.wSecond;
|
||||||
|
|
||||||
// create timerticks = (s + ms) * 8192
|
// create timerticks = (s + ms) * 8192
|
||||||
ticks = (ticks << 13) | (((ULONGLONG) ts.wMilliseconds << 10) / 125);
|
ticks = (ticks << 13) | (((ULONGLONG) ts.wMilliseconds << 10) / 125);
|
||||||
|
|
||||||
ticks += Chipset.t2; // add actual timer2 value
|
ticks += Chipset.t2; // add actual timer2 value
|
||||||
|
|
||||||
time = ticks; // save for calc. timeout
|
time = ticks; // save for calc. timeout
|
||||||
time += OFF_TIME; // add 10 min for auto off
|
time += OFF_TIME; // add 10 min for auto off
|
||||||
|
|
||||||
dw = RPLTIME; // HP addresses for clock in port0
|
pbyTime = Port0 + RPLTIME; // HP addresses for clock in port0
|
||||||
|
|
||||||
crc = 0x0; // reset crc value
|
crc = 0x0; // reset crc value
|
||||||
for (i = 0; i < 13; ++i, ++dw) // write date and time
|
for (i = 0; i < 13; ++i) // write date and time
|
||||||
{
|
{
|
||||||
*p = (BYTE) ticks & 0xf;
|
*pbyTime = (BYTE) ticks & 0xf; // time
|
||||||
crc = (crc >> 4) ^ (((crc ^ ((WORD) *p)) & 0xf) * 0x1081);
|
crc = UpCRC(crc,*pbyTime);
|
||||||
Port0[dw] = *p; // always store in port0
|
ticks >>= 4;
|
||||||
ticks >>= 4;
|
|
||||||
}
|
pbyTime[13+4] = (BYTE) time & 0xf; // auto off
|
||||||
|
time >>= 4;
|
||||||
Nunpack(p,crc,4); // write crc
|
++pbyTime;
|
||||||
memcpy(Port0+dw,p,4); // always store in port0
|
}
|
||||||
|
|
||||||
dw += 4; // HP addresses for timeout
|
Nunpack(pbyTime,crc,4); // write crc
|
||||||
|
|
||||||
for (i = 0; i < 13; ++i, ++dw) // write time for auto off
|
pbyTime[13+4] = 0xf;
|
||||||
{
|
return;
|
||||||
Port0[dw] = (BYTE) time & 0xf; // always store in port0
|
}
|
||||||
time >>= 4;
|
|
||||||
}
|
VOID StartTimers(VOID)
|
||||||
|
{
|
||||||
Port0[dw] = 0xf; // always store in port0
|
if (bStarted) // timer running
|
||||||
return;
|
return; // -> quit
|
||||||
}
|
if (Chipset.IORam[TIMER2_CTRL]&RUN) // start timer1 and timer2 ?
|
||||||
|
{
|
||||||
VOID StartTimers(VOID)
|
bStarted = TRUE; // flag timer running
|
||||||
{
|
// initialisation of NINT2 lines
|
||||||
if (bStarted) // timer running
|
bNINT2T1 = (Chipset.IORam[TIMER1_CTRL]&INTR) != 0 && (Chipset.t1 & 8) != 0;
|
||||||
return; // -> quit
|
bNINT2T2 = (Chipset.IORam[TIMER2_CTRL]&INTR) != 0 && (Chipset.t2 & 0x80000000) != 0;
|
||||||
if (Chipset.IORam[TIMER2_CTRL]&RUN) // start timer1 and timer2 ?
|
timeGetDevCaps(&tc,sizeof(tc)); // get timer resolution
|
||||||
{
|
|
||||||
bStarted = TRUE; // flag timer running
|
// max. timer2 ticks that can be handled by one timer event
|
||||||
// initialisation of NINT2 lines
|
uT2MaxTicks = __min((0xFFFFFFFF / 1024),tc.wPeriodMax);
|
||||||
bNINT2T1 = (Chipset.IORam[TIMER1_CTRL]&INTR) != 0 && (Chipset.t1 & 8) != 0;
|
uT2MaxTicks = __min((0xFFFFFFFF - 1023) / 125,uT2MaxTicks * 1024 / 125);
|
||||||
bNINT2T2 = (Chipset.IORam[TIMER2_CTRL]&INTR) != 0 && (Chipset.t2 & 0x80000000) != 0;
|
|
||||||
timeGetDevCaps(&tc,sizeof(tc)); // get timer resolution
|
CheckT1(Chipset.t1); // check for timer1 interrupts
|
||||||
|
CheckT2(Chipset.t2); // check for timer2 interrupts
|
||||||
// max. timer2 ticks that can be handled by one timer event
|
// set timer resolution to greatest possible one
|
||||||
uT2MaxTicks = __min((0xFFFFFFFF / 1024),tc.wPeriodMax);
|
bAccurateTimer = (timeBeginPeriod(tc.wPeriodMin) == TIMERR_NOERROR);
|
||||||
uT2MaxTicks = __min((0xFFFFFFFF - 1023) / 125,uT2MaxTicks * 1024 / 125);
|
// set timer1 with given period
|
||||||
|
VERIFY(uT1TimerId = timeSetEvent(T1_FREQ,0,&TimeProc,1,TIME_PERIODIC));
|
||||||
CheckT1(Chipset.t1); // check for timer1 interrupts
|
RescheduleT2(TRUE); // start timer2
|
||||||
CheckT2(Chipset.t2); // check for timer2 interrupts
|
}
|
||||||
// set timer resolution to greatest possible one
|
return;
|
||||||
bAccurateTimer = (timeBeginPeriod(tc.wPeriodMin) == TIMERR_NOERROR);
|
}
|
||||||
// set timer1 with given period
|
|
||||||
VERIFY(uT1TimerId = timeSetEvent(T1_FREQ,0,&TimeProc,1,TIME_PERIODIC));
|
VOID StopTimers(VOID)
|
||||||
RescheduleT2(TRUE); // start timer2
|
{
|
||||||
}
|
if (!bStarted) // timer stopped
|
||||||
return;
|
return; // -> quit
|
||||||
}
|
if (uT1TimerId != 0) // timer1 running
|
||||||
|
{
|
||||||
VOID StopTimers(VOID)
|
// Critical Section handler may cause a dead lock
|
||||||
{
|
timeKillEvent(uT1TimerId); // stop timer1
|
||||||
if (!bStarted) // timer stopped
|
uT1TimerId = 0; // set flag timer1 stopped
|
||||||
return; // -> quit
|
}
|
||||||
if (uT1TimerId != 0) // timer1 running
|
if (uT2TimerId != 0) // timer2 running
|
||||||
{
|
{
|
||||||
// Critical Section handler may cause a dead lock
|
EnterCriticalSection(&csT2Lock);
|
||||||
timeKillEvent(uT1TimerId); // stop timer1
|
{
|
||||||
uT1TimerId = 0; // set flag timer1 stopped
|
Chipset.t2 = CalcT2(); // update chipset timer2 value
|
||||||
}
|
}
|
||||||
if (uT2TimerId != 0) // timer2 running
|
LeaveCriticalSection(&csT2Lock);
|
||||||
{
|
AbortT2(); // stop timer2 outside critical section
|
||||||
EnterCriticalSection(&csT2Lock);
|
}
|
||||||
{
|
bStarted = FALSE;
|
||||||
Chipset.t2 = CalcT2(); // update chipset timer2 value
|
if (bAccurateTimer) // "Accurate timer" running
|
||||||
}
|
{
|
||||||
LeaveCriticalSection(&csT2Lock);
|
timeEndPeriod(tc.wPeriodMin); // finish service
|
||||||
AbortT2(); // stop timer2 outside critical section
|
}
|
||||||
}
|
return;
|
||||||
bStarted = FALSE;
|
}
|
||||||
if (bAccurateTimer) // "Accurate timer" running
|
|
||||||
{
|
DWORD ReadT2(VOID)
|
||||||
timeEndPeriod(tc.wPeriodMin); // finish service
|
{
|
||||||
}
|
DWORD dwT2;
|
||||||
return;
|
EnterCriticalSection(&csT2Lock);
|
||||||
}
|
{
|
||||||
|
dwT2 = CalcT2(); // calculate timer2 value or if stopped last timer value
|
||||||
DWORD ReadT2(VOID)
|
CheckT2(dwT2); // update timer2 control bits
|
||||||
{
|
}
|
||||||
DWORD dwT2;
|
LeaveCriticalSection(&csT2Lock);
|
||||||
EnterCriticalSection(&csT2Lock);
|
return dwT2;
|
||||||
{
|
}
|
||||||
dwT2 = CalcT2(); // calculate timer2 value or if stopped last timer value
|
|
||||||
CheckT2(dwT2); // update timer2 control bits
|
VOID SetT2(DWORD dwValue)
|
||||||
}
|
{
|
||||||
LeaveCriticalSection(&csT2Lock);
|
// calling AbortT2() inside Critical Section handler may cause a dead lock
|
||||||
return dwT2;
|
if (uT2TimerId != 0) // timer2 running
|
||||||
}
|
AbortT2(); // stop timer2
|
||||||
|
EnterCriticalSection(&csT2Lock);
|
||||||
VOID SetT2(DWORD dwValue)
|
{
|
||||||
{
|
Chipset.t2 = dwValue; // set new value
|
||||||
// calling AbortT2() inside Critical Section handler may cause a dead lock
|
CheckT2(Chipset.t2); // test timer2 control bits
|
||||||
if (uT2TimerId != 0) // timer2 running
|
if (bStarted) // timer running
|
||||||
AbortT2(); // stop timer2
|
RescheduleT2(TRUE); // restart timer2
|
||||||
EnterCriticalSection(&csT2Lock);
|
}
|
||||||
{
|
LeaveCriticalSection(&csT2Lock);
|
||||||
Chipset.t2 = dwValue; // set new value
|
return;
|
||||||
CheckT2(Chipset.t2); // test timer2 control bits
|
}
|
||||||
if (bStarted) // timer running
|
|
||||||
RescheduleT2(TRUE); // restart timer2
|
BYTE ReadT1(VOID)
|
||||||
}
|
{
|
||||||
LeaveCriticalSection(&csT2Lock);
|
BYTE nT1;
|
||||||
return;
|
EnterCriticalSection(&csT1Lock);
|
||||||
}
|
{
|
||||||
|
nT1 = Chipset.t1; // read timer1 value
|
||||||
BYTE ReadT1(VOID)
|
CheckT1(nT1); // update timer1 control bits
|
||||||
{
|
}
|
||||||
BYTE nT1;
|
LeaveCriticalSection(&csT1Lock);
|
||||||
EnterCriticalSection(&csT1Lock);
|
return nT1;
|
||||||
{
|
}
|
||||||
nT1 = Chipset.t1; // read timer1 value
|
|
||||||
CheckT1(nT1); // update timer1 control bits
|
VOID SetT1(BYTE byValue)
|
||||||
}
|
{
|
||||||
LeaveCriticalSection(&csT1Lock);
|
BOOL bEqual;
|
||||||
return nT1;
|
|
||||||
}
|
_ASSERT(byValue < 0x10); // timer1 is only a 4bit counter
|
||||||
|
|
||||||
VOID SetT1(BYTE byValue)
|
EnterCriticalSection(&csT1Lock);
|
||||||
{
|
{
|
||||||
BOOL bEqual;
|
bEqual = (Chipset.t1 == byValue); // check for same value
|
||||||
|
}
|
||||||
_ASSERT(byValue < 0x10); // timer1 is only a 4bit counter
|
LeaveCriticalSection(&csT1Lock);
|
||||||
|
if (bEqual) return; // same value doesn't restart timer period
|
||||||
EnterCriticalSection(&csT1Lock);
|
|
||||||
{
|
if (uT1TimerId != 0) // timer1 running
|
||||||
bEqual = (Chipset.t1 == byValue); // check for same value
|
{
|
||||||
}
|
timeKillEvent(uT1TimerId); // stop timer1
|
||||||
LeaveCriticalSection(&csT1Lock);
|
uT1TimerId = 0; // set flag timer1 stopped
|
||||||
if (bEqual) return; // same value doesn't restart timer period
|
}
|
||||||
|
EnterCriticalSection(&csT1Lock);
|
||||||
if (uT1TimerId != 0) // timer1 running
|
{
|
||||||
{
|
Chipset.t1 = byValue; // set new timer1 value
|
||||||
timeKillEvent(uT1TimerId); // stop timer1
|
CheckT1(Chipset.t1); // test timer1 control bits
|
||||||
uT1TimerId = 0; // set flag timer1 stopped
|
}
|
||||||
}
|
LeaveCriticalSection(&csT1Lock);
|
||||||
EnterCriticalSection(&csT1Lock);
|
if (bStarted) // timer running
|
||||||
{
|
{
|
||||||
Chipset.t1 = byValue; // set new timer1 value
|
// restart timer1 to get full period of frequency
|
||||||
CheckT1(Chipset.t1); // test timer1 control bits
|
VERIFY(uT1TimerId = timeSetEvent(T1_FREQ,0,&TimeProc,1,TIME_PERIODIC));
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&csT1Lock);
|
return;
|
||||||
if (bStarted) // timer running
|
}
|
||||||
{
|
|
||||||
// restart timer1 to get full period of frequency
|
|
||||||
VERIFY(uT1TimerId = timeSetEvent(T1_FREQ,0,&TimeProc,1,TIME_PERIODIC));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
|
@ -1,103 +1,103 @@
|
||||||
/*
|
/*
|
||||||
* types.h
|
* types.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// HST bits
|
// HST bits
|
||||||
#define XM 1
|
#define XM 1
|
||||||
#define SB 2
|
#define SB 2
|
||||||
#define SR 4
|
#define SR 4
|
||||||
#define MP 8
|
#define MP 8
|
||||||
|
|
||||||
#define SWORD SHORT // signed 16 Bit variable
|
#define SWORD SHORT // signed 16 Bit variable
|
||||||
#define QWORD ULONGLONG // unsigned 64 Bit variable
|
#define QWORD ULONGLONG // unsigned 64 Bit variable
|
||||||
|
|
||||||
#define CHIPSET Chipset_t
|
#define CHIPSET Chipset_t
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
SWORD nPosX; // position of window
|
SWORD nPosX; // position of window
|
||||||
SWORD nPosY;
|
SWORD nPosY;
|
||||||
BYTE type; // calculator type
|
BYTE type; // calculator type
|
||||||
|
|
||||||
DWORD Port0Size; // real size of module in KB
|
DWORD Port0Size; // real size of module in KB
|
||||||
DWORD Port1Size; // real size of module in KB
|
DWORD Port1Size; // real size of module in KB
|
||||||
DWORD Port2Size; // real size of module in KB (HP49G only)
|
DWORD Port2Size; // real size of module in KB (HP49G only)
|
||||||
DWORD dwUnused0; // not used, was memory pointer Port0
|
DWORD dwUnused0; // not used, was memory pointer Port0
|
||||||
DWORD dwUnused1; // not used, was memory pointer Port1
|
DWORD dwUnused1; // not used, was memory pointer Port1
|
||||||
DWORD dwUnused2; // not used, was memory pointer Port2
|
DWORD dwUnused2; // not used, was memory pointer Port2
|
||||||
|
|
||||||
DWORD pc;
|
DWORD pc;
|
||||||
DWORD d0;
|
DWORD d0;
|
||||||
DWORD d1;
|
DWORD d1;
|
||||||
DWORD rstkp;
|
DWORD rstkp;
|
||||||
DWORD rstk[8];
|
DWORD rstk[8];
|
||||||
BYTE A[16];
|
BYTE A[16];
|
||||||
BYTE B[16];
|
BYTE B[16];
|
||||||
BYTE C[16];
|
BYTE C[16];
|
||||||
BYTE D[16];
|
BYTE D[16];
|
||||||
BYTE R0[16];
|
BYTE R0[16];
|
||||||
BYTE R1[16];
|
BYTE R1[16];
|
||||||
BYTE R2[16];
|
BYTE R2[16];
|
||||||
BYTE R3[16];
|
BYTE R3[16];
|
||||||
BYTE R4[16];
|
BYTE R4[16];
|
||||||
BYTE ST[4];
|
BYTE ST[4];
|
||||||
BYTE HST;
|
BYTE HST;
|
||||||
BYTE P;
|
BYTE P;
|
||||||
WORD out;
|
WORD out;
|
||||||
WORD in;
|
WORD in;
|
||||||
BOOL SoftInt;
|
BOOL SoftInt;
|
||||||
BOOL Shutdn;
|
BOOL Shutdn;
|
||||||
BOOL mode_dec;
|
BOOL mode_dec;
|
||||||
BOOL inte; // interrupt status flag (FALSE = int in service)
|
BOOL inte; // interrupt status flag (FALSE = int in service)
|
||||||
BOOL intk; // 1 ms keyboard scan flag (TRUE = enable)
|
BOOL intk; // 1 ms keyboard scan flag (TRUE = enable)
|
||||||
BOOL intd; // keyboard interrupt pending (TRUE = int pending)
|
BOOL intd; // keyboard interrupt pending (TRUE = int pending)
|
||||||
BOOL carry;
|
BOOL carry;
|
||||||
|
|
||||||
WORD crc;
|
WORD crc;
|
||||||
WORD wPort2Crc; // fingerprint of port2
|
WORD wPort2Crc; // fingerprint of port2
|
||||||
WORD wRomCrc; // fingerprint of ROM
|
WORD wRomCrc; // fingerprint of ROM
|
||||||
#if defined _USRDLL // DLL version
|
#if defined _USRDLL // DLL version
|
||||||
QWORD cycles; // oscillator cycles
|
QWORD cycles; // oscillator cycles
|
||||||
#else // EXE version
|
#else // EXE version
|
||||||
DWORD cycles; // oscillator cycles
|
DWORD cycles; // oscillator cycles
|
||||||
DWORD cycles_reserved; // reserved for MSB of oscillator cycles
|
DWORD cycles_reserved; // reserved for MSB of oscillator cycles
|
||||||
#endif
|
#endif
|
||||||
DWORD dwKdnCycles; // cpu cycles at start of 1ms key handler
|
DWORD dwKdnCycles; // cpu cycles at start of 1ms key handler
|
||||||
|
|
||||||
UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF
|
UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF
|
||||||
UINT FlashRomState; // WSM state of flash memory (unused)
|
UINT FlashRomState; // WSM state of flash memory (unused)
|
||||||
BYTE cards_status;
|
BYTE cards_status;
|
||||||
BYTE IORam[64]; // I/O hardware register
|
BYTE IORam[64]; // I/O hardware register
|
||||||
UINT IOBase; // address of I/O modules page
|
UINT IOBase; // address of I/O modules page
|
||||||
BOOL IOCfig; // I/O module configuration flag
|
BOOL IOCfig; // I/O module configuration flag
|
||||||
BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page
|
BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page
|
||||||
BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB
|
BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB
|
||||||
BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page
|
BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page
|
||||||
BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag
|
BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag
|
||||||
BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag
|
BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag
|
||||||
|
|
||||||
BYTE t1;
|
BYTE t1;
|
||||||
DWORD t2;
|
DWORD t2;
|
||||||
|
|
||||||
BOOL bShutdnWake; // flag for wake up from SHUTDN mode
|
BOOL bShutdnWake; // flag for wake up from SHUTDN mode
|
||||||
|
|
||||||
BYTE Keyboard_Row[9];
|
BYTE Keyboard_Row[9];
|
||||||
WORD IR15X;
|
WORD IR15X;
|
||||||
UINT Keyboard_State; // not used
|
UINT Keyboard_State; // not used
|
||||||
|
|
||||||
signed short loffset;
|
signed short loffset;
|
||||||
signed int width;
|
signed int width;
|
||||||
UINT boffset;
|
UINT boffset;
|
||||||
UINT lcounter;
|
UINT lcounter;
|
||||||
UINT sync; // not used
|
UINT sync; // not used
|
||||||
BYTE contrast;
|
BYTE contrast;
|
||||||
BOOL dispon; // not used
|
BOOL dispon; // not used
|
||||||
DWORD start1;
|
DWORD start1;
|
||||||
DWORD start12;
|
DWORD start12;
|
||||||
DWORD end1;
|
DWORD end1;
|
||||||
DWORD start2, end2;
|
DWORD start2, end2;
|
||||||
} Chipset_t;
|
} Chipset_t;
|
|
@ -1,78 +1,73 @@
|
||||||
/*
|
/*
|
||||||
* udp.c
|
* udp.c
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Christoph Gießelink
|
* Copyright (C) 2011 Christoph Gießelink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "emu48.h"
|
#include "Emu48.h"
|
||||||
|
|
||||||
TCHAR szUdpServer[1024] = _T("localhost");
|
TCHAR szUdpServer[1024] = _T("localhost");
|
||||||
WORD wUdpPort = 5025; // scpi-raw
|
WORD wUdpPort = 5025; // scpi-raw
|
||||||
|
|
||||||
static SOCKADDR_IN sServer = { AF_INET, 0, { 255, 255, 255, 255 } };
|
static SOCKADDR_IN sServer = { AF_INET, 0, { 255, 255, 255, 255 } };
|
||||||
|
|
||||||
VOID ResetUdp(VOID)
|
VOID ResetUdp(VOID)
|
||||||
{
|
{
|
||||||
sServer.sin_addr.s_addr = INADDR_NONE; // invalidate saved UDP address
|
sServer.sin_addr.s_addr = INADDR_NONE; // invalidate saved UDP address
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SendByteUdp(BYTE byData)
|
BOOL SendByteUdp(BYTE byData)
|
||||||
{
|
{
|
||||||
WSADATA wsd;
|
SOCKET sClient;
|
||||||
SOCKET sClient;
|
|
||||||
|
BOOL bErr = TRUE;
|
||||||
BOOL bErr = TRUE;
|
|
||||||
|
// IP address not specified
|
||||||
VERIFY(WSAStartup(MAKEWORD(1,1),&wsd) == 0);
|
if (sServer.sin_addr.s_addr == INADDR_NONE)
|
||||||
|
{
|
||||||
// IP address not specified
|
LPSTR lpszIpAddr;
|
||||||
if (sServer.sin_addr.s_addr == INADDR_NONE)
|
|
||||||
{
|
#if defined _UNICODE
|
||||||
LPSTR lpszIpAddr;
|
DWORD dwLength = lstrlen(szUdpServer) + 1;
|
||||||
|
|
||||||
#if defined _UNICODE
|
if ((lpszIpAddr = (LPSTR) _alloca(dwLength)) == NULL)
|
||||||
DWORD dwLength = lstrlen(szUdpServer) + 1;
|
return TRUE; // server ip address not found
|
||||||
|
|
||||||
if ((lpszIpAddr = (LPSTR) _alloca(dwLength)) == NULL)
|
WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK,
|
||||||
return TRUE; // server ip address not found
|
szUdpServer, dwLength,
|
||||||
|
lpszIpAddr, dwLength, NULL, NULL);
|
||||||
WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK,
|
#else
|
||||||
szUdpServer, dwLength,
|
lpszIpAddr = szUdpServer;
|
||||||
lpszIpAddr, dwLength, NULL, NULL);
|
#endif
|
||||||
#else
|
|
||||||
lpszIpAddr = szUdpServer;
|
// try to interpret string as IPv4 address
|
||||||
#endif
|
sServer.sin_addr.s_addr = inet_addr(lpszIpAddr);
|
||||||
|
|
||||||
// try to interpret string as IPv4 address
|
// not a valid ip address -> try to get ip address from name server
|
||||||
sServer.sin_addr.s_addr = inet_addr(lpszIpAddr);
|
if (sServer.sin_addr.s_addr == INADDR_NONE)
|
||||||
|
{
|
||||||
// not a valid ip address -> try to get ip address from name server
|
PHOSTENT host = gethostbyname(lpszIpAddr);
|
||||||
if (sServer.sin_addr.s_addr == INADDR_NONE)
|
if (host == NULL)
|
||||||
{
|
{
|
||||||
PHOSTENT host = gethostbyname(lpszIpAddr);
|
return TRUE; // server ip address not found
|
||||||
if (host == NULL)
|
}
|
||||||
{
|
|
||||||
return TRUE; // server ip address not found
|
sServer.sin_addr.s_addr = ((PIN_ADDR) host->h_addr_list[0])->s_addr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
sServer.sin_addr.s_addr = ((PIN_ADDR) host->h_addr_list[0])->s_addr;
|
|
||||||
}
|
// create UDP socket
|
||||||
}
|
if ((sClient = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET)
|
||||||
|
{
|
||||||
// create UDP socket
|
sServer.sin_port = htons(wUdpPort);
|
||||||
if ((sClient = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET)
|
|
||||||
{
|
// transmit data byte
|
||||||
sServer.sin_port = htons(wUdpPort);
|
bErr = sendto(sClient, (LPCCH) &byData, sizeof(byData), 0, (LPSOCKADDR) &sServer, sizeof(sServer)) == SOCKET_ERROR;
|
||||||
|
closesocket(sClient);
|
||||||
// transmit data byte
|
}
|
||||||
bErr = sendto(sClient, (LPCCH) &byData, sizeof(byData), 0, (LPSOCKADDR) &sServer, sizeof(sServer)) == SOCKET_ERROR;
|
return bErr;
|
||||||
closesocket(sClient);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
WSACleanup(); // cleanup network stack
|
|
||||||
return bErr;
|
|
||||||
}
|
|
|
@ -1,778 +0,0 @@
|
||||||
/*
|
|
||||||
* fetch.c
|
|
||||||
*
|
|
||||||
* This file is part of Emu48
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 Christoph Gießelink
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include "pch.h"
|
|
||||||
#include "opcodes.h"
|
|
||||||
|
|
||||||
#define F 0xFF // F = function
|
|
||||||
|
|
||||||
typedef const struct
|
|
||||||
{
|
|
||||||
LPCVOID pLnk;
|
|
||||||
const DWORD dwTyp;
|
|
||||||
} JMPTAB, *PJMPTAB;
|
|
||||||
|
|
||||||
// jump tables
|
|
||||||
static JMPTAB oF_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oF0, F,
|
|
||||||
(LPCVOID) oF1, F,
|
|
||||||
(LPCVOID) oF2, F,
|
|
||||||
(LPCVOID) oF3, F,
|
|
||||||
(LPCVOID) oF4, F,
|
|
||||||
(LPCVOID) oF5, F,
|
|
||||||
(LPCVOID) oF6, F,
|
|
||||||
(LPCVOID) oF7, F,
|
|
||||||
(LPCVOID) oF8, F,
|
|
||||||
(LPCVOID) oF9, F,
|
|
||||||
(LPCVOID) oFA, F,
|
|
||||||
(LPCVOID) oFB, F,
|
|
||||||
(LPCVOID) oFC, F,
|
|
||||||
(LPCVOID) oFD, F,
|
|
||||||
(LPCVOID) oFE, F,
|
|
||||||
(LPCVOID) oFF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oE_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oE0, F,
|
|
||||||
(LPCVOID) oE1, F,
|
|
||||||
(LPCVOID) oE2, F,
|
|
||||||
(LPCVOID) oE3, F,
|
|
||||||
(LPCVOID) oE4, F,
|
|
||||||
(LPCVOID) oE5, F,
|
|
||||||
(LPCVOID) oE6, F,
|
|
||||||
(LPCVOID) oE7, F,
|
|
||||||
(LPCVOID) oE8, F,
|
|
||||||
(LPCVOID) oE9, F,
|
|
||||||
(LPCVOID) oEA, F,
|
|
||||||
(LPCVOID) oEB, F,
|
|
||||||
(LPCVOID) oEC, F,
|
|
||||||
(LPCVOID) oED, F,
|
|
||||||
(LPCVOID) oEE, F,
|
|
||||||
(LPCVOID) oEF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oD_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oD0, F,
|
|
||||||
(LPCVOID) oD1, F,
|
|
||||||
(LPCVOID) oD2, F,
|
|
||||||
(LPCVOID) oD3, F,
|
|
||||||
(LPCVOID) oD4, F,
|
|
||||||
(LPCVOID) oD5, F,
|
|
||||||
(LPCVOID) oD6, F,
|
|
||||||
(LPCVOID) oD7, F,
|
|
||||||
(LPCVOID) oD8, F,
|
|
||||||
(LPCVOID) oD9, F,
|
|
||||||
(LPCVOID) oDA, F,
|
|
||||||
(LPCVOID) oDB, F,
|
|
||||||
(LPCVOID) oDC, F,
|
|
||||||
(LPCVOID) oDD, F,
|
|
||||||
(LPCVOID) oDE, F,
|
|
||||||
(LPCVOID) oDF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oC_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oC0, F,
|
|
||||||
(LPCVOID) oC1, F,
|
|
||||||
(LPCVOID) oC2, F,
|
|
||||||
(LPCVOID) oC3, F,
|
|
||||||
(LPCVOID) oC4, F,
|
|
||||||
(LPCVOID) oC5, F,
|
|
||||||
(LPCVOID) oC6, F,
|
|
||||||
(LPCVOID) oC7, F,
|
|
||||||
(LPCVOID) oC8, F,
|
|
||||||
(LPCVOID) oC9, F,
|
|
||||||
(LPCVOID) oCA, F,
|
|
||||||
(LPCVOID) oCB, F,
|
|
||||||
(LPCVOID) oCC, F,
|
|
||||||
(LPCVOID) oCD, F,
|
|
||||||
(LPCVOID) oCE, F,
|
|
||||||
(LPCVOID) oCF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oBb_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oBb0, F,
|
|
||||||
(LPCVOID) oBb1, F,
|
|
||||||
(LPCVOID) oBb2, F,
|
|
||||||
(LPCVOID) oBb3, F,
|
|
||||||
(LPCVOID) oBb4, F,
|
|
||||||
(LPCVOID) oBb5, F,
|
|
||||||
(LPCVOID) oBb6, F,
|
|
||||||
(LPCVOID) oBb7, F,
|
|
||||||
(LPCVOID) oBb8, F,
|
|
||||||
(LPCVOID) oBb9, F,
|
|
||||||
(LPCVOID) oBbA, F,
|
|
||||||
(LPCVOID) oBbB, F,
|
|
||||||
(LPCVOID) oBbC, F,
|
|
||||||
(LPCVOID) oBbD, F,
|
|
||||||
(LPCVOID) oBbE, F,
|
|
||||||
(LPCVOID) oBbF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oBa_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oBa0, F,
|
|
||||||
(LPCVOID) oBa1, F,
|
|
||||||
(LPCVOID) oBa2, F,
|
|
||||||
(LPCVOID) oBa3, F,
|
|
||||||
(LPCVOID) oBa4, F,
|
|
||||||
(LPCVOID) oBa5, F,
|
|
||||||
(LPCVOID) oBa6, F,
|
|
||||||
(LPCVOID) oBa7, F,
|
|
||||||
(LPCVOID) oBa8, F,
|
|
||||||
(LPCVOID) oBa9, F,
|
|
||||||
(LPCVOID) oBaA, F,
|
|
||||||
(LPCVOID) oBaB, F,
|
|
||||||
(LPCVOID) oBaC, F,
|
|
||||||
(LPCVOID) oBaD, F,
|
|
||||||
(LPCVOID) oBaE, F,
|
|
||||||
(LPCVOID) oBaF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oB_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oBa_, 2,
|
|
||||||
(LPCVOID) oBa_, 2,
|
|
||||||
(LPCVOID) oBa_, 2,
|
|
||||||
(LPCVOID) oBa_, 2,
|
|
||||||
(LPCVOID) oBa_, 2,
|
|
||||||
(LPCVOID) oBa_, 2,
|
|
||||||
(LPCVOID) oBa_, 2,
|
|
||||||
(LPCVOID) oBa_, 2,
|
|
||||||
(LPCVOID) oBb_, 2,
|
|
||||||
(LPCVOID) oBb_, 2,
|
|
||||||
(LPCVOID) oBb_, 2,
|
|
||||||
(LPCVOID) oBb_, 2,
|
|
||||||
(LPCVOID) oBb_, 2,
|
|
||||||
(LPCVOID) oBb_, 2,
|
|
||||||
(LPCVOID) oBb_, 2,
|
|
||||||
(LPCVOID) oBb_, 2
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oAb_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oAb0, F,
|
|
||||||
(LPCVOID) oAb1, F,
|
|
||||||
(LPCVOID) oAb2, F,
|
|
||||||
(LPCVOID) oAb3, F,
|
|
||||||
(LPCVOID) oAb4, F,
|
|
||||||
(LPCVOID) oAb5, F,
|
|
||||||
(LPCVOID) oAb6, F,
|
|
||||||
(LPCVOID) oAb7, F,
|
|
||||||
(LPCVOID) oAb8, F,
|
|
||||||
(LPCVOID) oAb9, F,
|
|
||||||
(LPCVOID) oAbA, F,
|
|
||||||
(LPCVOID) oAbB, F,
|
|
||||||
(LPCVOID) oAbC, F,
|
|
||||||
(LPCVOID) oAbD, F,
|
|
||||||
(LPCVOID) oAbE, F,
|
|
||||||
(LPCVOID) oAbF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oAa_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oAa0, F,
|
|
||||||
(LPCVOID) oAa1, F,
|
|
||||||
(LPCVOID) oAa2, F,
|
|
||||||
(LPCVOID) oAa3, F,
|
|
||||||
(LPCVOID) oAa4, F,
|
|
||||||
(LPCVOID) oAa5, F,
|
|
||||||
(LPCVOID) oAa6, F,
|
|
||||||
(LPCVOID) oAa7, F,
|
|
||||||
(LPCVOID) oAa8, F,
|
|
||||||
(LPCVOID) oAa9, F,
|
|
||||||
(LPCVOID) oAaA, F,
|
|
||||||
(LPCVOID) oAaB, F,
|
|
||||||
(LPCVOID) oAaC, F,
|
|
||||||
(LPCVOID) oAaD, F,
|
|
||||||
(LPCVOID) oAaE, F,
|
|
||||||
(LPCVOID) oAaF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB oA_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) oAa_, 2,
|
|
||||||
(LPCVOID) oAa_, 2,
|
|
||||||
(LPCVOID) oAa_, 2,
|
|
||||||
(LPCVOID) oAa_, 2,
|
|
||||||
(LPCVOID) oAa_, 2,
|
|
||||||
(LPCVOID) oAa_, 2,
|
|
||||||
(LPCVOID) oAa_, 2,
|
|
||||||
(LPCVOID) oAa_, 2,
|
|
||||||
(LPCVOID) oAb_, 2,
|
|
||||||
(LPCVOID) oAb_, 2,
|
|
||||||
(LPCVOID) oAb_, 2,
|
|
||||||
(LPCVOID) oAb_, 2,
|
|
||||||
(LPCVOID) oAb_, 2,
|
|
||||||
(LPCVOID) oAb_, 2,
|
|
||||||
(LPCVOID) oAb_, 2,
|
|
||||||
(LPCVOID) oAb_, 2
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o9b_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o9b0, F,
|
|
||||||
(LPCVOID) o9b1, F,
|
|
||||||
(LPCVOID) o9b2, F,
|
|
||||||
(LPCVOID) o9b3, F,
|
|
||||||
(LPCVOID) o9b4, F,
|
|
||||||
(LPCVOID) o9b5, F,
|
|
||||||
(LPCVOID) o9b6, F,
|
|
||||||
(LPCVOID) o9b7, F,
|
|
||||||
(LPCVOID) o9b8, F,
|
|
||||||
(LPCVOID) o9b9, F,
|
|
||||||
(LPCVOID) o9bA, F,
|
|
||||||
(LPCVOID) o9bB, F,
|
|
||||||
(LPCVOID) o9bC, F,
|
|
||||||
(LPCVOID) o9bD, F,
|
|
||||||
(LPCVOID) o9bE, F,
|
|
||||||
(LPCVOID) o9bF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o9a_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o9a0, F,
|
|
||||||
(LPCVOID) o9a1, F,
|
|
||||||
(LPCVOID) o9a2, F,
|
|
||||||
(LPCVOID) o9a3, F,
|
|
||||||
(LPCVOID) o9a4, F,
|
|
||||||
(LPCVOID) o9a5, F,
|
|
||||||
(LPCVOID) o9a6, F,
|
|
||||||
(LPCVOID) o9a7, F,
|
|
||||||
(LPCVOID) o9a8, F,
|
|
||||||
(LPCVOID) o9a9, F,
|
|
||||||
(LPCVOID) o9aA, F,
|
|
||||||
(LPCVOID) o9aB, F,
|
|
||||||
(LPCVOID) o9aC, F,
|
|
||||||
(LPCVOID) o9aD, F,
|
|
||||||
(LPCVOID) o9aE, F,
|
|
||||||
(LPCVOID) o9aF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o9_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o9a_, 2,
|
|
||||||
(LPCVOID) o9a_, 2,
|
|
||||||
(LPCVOID) o9a_, 2,
|
|
||||||
(LPCVOID) o9a_, 2,
|
|
||||||
(LPCVOID) o9a_, 2,
|
|
||||||
(LPCVOID) o9a_, 2,
|
|
||||||
(LPCVOID) o9a_, 2,
|
|
||||||
(LPCVOID) o9a_, 2,
|
|
||||||
(LPCVOID) o9b_, 2,
|
|
||||||
(LPCVOID) o9b_, 2,
|
|
||||||
(LPCVOID) o9b_, 2,
|
|
||||||
(LPCVOID) o9b_, 2,
|
|
||||||
(LPCVOID) o9b_, 2,
|
|
||||||
(LPCVOID) o9b_, 2,
|
|
||||||
(LPCVOID) o9b_, 2,
|
|
||||||
(LPCVOID) o9b_, 2
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o8B_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o8B0, F,
|
|
||||||
(LPCVOID) o8B1, F,
|
|
||||||
(LPCVOID) o8B2, F,
|
|
||||||
(LPCVOID) o8B3, F,
|
|
||||||
(LPCVOID) o8B4, F,
|
|
||||||
(LPCVOID) o8B5, F,
|
|
||||||
(LPCVOID) o8B6, F,
|
|
||||||
(LPCVOID) o8B7, F,
|
|
||||||
(LPCVOID) o8B8, F,
|
|
||||||
(LPCVOID) o8B9, F,
|
|
||||||
(LPCVOID) o8BA, F,
|
|
||||||
(LPCVOID) o8BB, F,
|
|
||||||
(LPCVOID) o8BC, F,
|
|
||||||
(LPCVOID) o8BD, F,
|
|
||||||
(LPCVOID) o8BE, F,
|
|
||||||
(LPCVOID) o8BF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o8A_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o8A0, F,
|
|
||||||
(LPCVOID) o8A1, F,
|
|
||||||
(LPCVOID) o8A2, F,
|
|
||||||
(LPCVOID) o8A3, F,
|
|
||||||
(LPCVOID) o8A4, F,
|
|
||||||
(LPCVOID) o8A5, F,
|
|
||||||
(LPCVOID) o8A6, F,
|
|
||||||
(LPCVOID) o8A7, F,
|
|
||||||
(LPCVOID) o8A8, F,
|
|
||||||
(LPCVOID) o8A9, F,
|
|
||||||
(LPCVOID) o8AA, F,
|
|
||||||
(LPCVOID) o8AB, F,
|
|
||||||
(LPCVOID) o8AC, F,
|
|
||||||
(LPCVOID) o8AD, F,
|
|
||||||
(LPCVOID) o8AE, F,
|
|
||||||
(LPCVOID) o8AF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o81B_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o81B2, F,
|
|
||||||
(LPCVOID) o81B3, F,
|
|
||||||
(LPCVOID) o81B4, F,
|
|
||||||
(LPCVOID) o81B5, F,
|
|
||||||
(LPCVOID) o81B6, F,
|
|
||||||
(LPCVOID) o81B7, F,
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o_invalid4, F,
|
|
||||||
(LPCVOID) o_invalid4, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o81Af2_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o81Af20, F,
|
|
||||||
(LPCVOID) o81Af21, F,
|
|
||||||
(LPCVOID) o81Af22, F,
|
|
||||||
(LPCVOID) o81Af23, F,
|
|
||||||
(LPCVOID) o81Af24, F,
|
|
||||||
(LPCVOID) o81Af21, F,
|
|
||||||
(LPCVOID) o81Af22, F,
|
|
||||||
(LPCVOID) o81Af23, F,
|
|
||||||
(LPCVOID) o81Af28, F,
|
|
||||||
(LPCVOID) o81Af29, F,
|
|
||||||
(LPCVOID) o81Af2A, F,
|
|
||||||
(LPCVOID) o81Af2B, F,
|
|
||||||
(LPCVOID) o81Af2C, F,
|
|
||||||
(LPCVOID) o81Af29, F,
|
|
||||||
(LPCVOID) o81Af2A, F,
|
|
||||||
(LPCVOID) o81Af2B, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o81Af1_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o81Af10, F,
|
|
||||||
(LPCVOID) o81Af11, F,
|
|
||||||
(LPCVOID) o81Af12, F,
|
|
||||||
(LPCVOID) o81Af13, F,
|
|
||||||
(LPCVOID) o81Af14, F,
|
|
||||||
(LPCVOID) o81Af11, F,
|
|
||||||
(LPCVOID) o81Af12, F,
|
|
||||||
(LPCVOID) o81Af13, F,
|
|
||||||
(LPCVOID) o81Af18, F,
|
|
||||||
(LPCVOID) o81Af19, F,
|
|
||||||
(LPCVOID) o81Af1A, F,
|
|
||||||
(LPCVOID) o81Af1B, F,
|
|
||||||
(LPCVOID) o81Af1C, F,
|
|
||||||
(LPCVOID) o81Af19, F,
|
|
||||||
(LPCVOID) o81Af1A, F,
|
|
||||||
(LPCVOID) o81Af1B, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o81Af0_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o81Af00, F,
|
|
||||||
(LPCVOID) o81Af01, F,
|
|
||||||
(LPCVOID) o81Af02, F,
|
|
||||||
(LPCVOID) o81Af03, F,
|
|
||||||
(LPCVOID) o81Af04, F,
|
|
||||||
(LPCVOID) o81Af01, F,
|
|
||||||
(LPCVOID) o81Af02, F,
|
|
||||||
(LPCVOID) o81Af03, F,
|
|
||||||
(LPCVOID) o81Af08, F,
|
|
||||||
(LPCVOID) o81Af09, F,
|
|
||||||
(LPCVOID) o81Af0A, F,
|
|
||||||
(LPCVOID) o81Af0B, F,
|
|
||||||
(LPCVOID) o81Af0C, F,
|
|
||||||
(LPCVOID) o81Af09, F,
|
|
||||||
(LPCVOID) o81Af0A, F,
|
|
||||||
(LPCVOID) o81Af0B, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o81A_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o81Af0_, 5,
|
|
||||||
(LPCVOID) o81Af1_, 5,
|
|
||||||
(LPCVOID) o81Af2_, 5,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o819_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o819f0, F,
|
|
||||||
(LPCVOID) o819f1, F,
|
|
||||||
(LPCVOID) o819f2, F,
|
|
||||||
(LPCVOID) o819f3, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o818_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o818f0x, F,
|
|
||||||
(LPCVOID) o818f1x, F,
|
|
||||||
(LPCVOID) o818f2x, F,
|
|
||||||
(LPCVOID) o818f3x, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o818f8x, F,
|
|
||||||
(LPCVOID) o818f9x, F,
|
|
||||||
(LPCVOID) o818fAx, F,
|
|
||||||
(LPCVOID) o818fBx, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F,
|
|
||||||
(LPCVOID) o_invalid6, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o81_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o810, F,
|
|
||||||
(LPCVOID) o811, F,
|
|
||||||
(LPCVOID) o812, F,
|
|
||||||
(LPCVOID) o813, F,
|
|
||||||
(LPCVOID) o814, F,
|
|
||||||
(LPCVOID) o815, F,
|
|
||||||
(LPCVOID) o816, F,
|
|
||||||
(LPCVOID) o817, F,
|
|
||||||
(LPCVOID) o818_, 4,
|
|
||||||
(LPCVOID) o819_, 4,
|
|
||||||
(LPCVOID) o81A_, 4,
|
|
||||||
(LPCVOID) o81B_, 3,
|
|
||||||
(LPCVOID) o81C, F,
|
|
||||||
(LPCVOID) o81D, F,
|
|
||||||
(LPCVOID) o81E, F,
|
|
||||||
(LPCVOID) o81F, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o8081_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o80810, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F,
|
|
||||||
(LPCVOID) o_invalid5, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o808_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o8080, F,
|
|
||||||
(LPCVOID) o8081_, 4,
|
|
||||||
(LPCVOID) o8082X, F,
|
|
||||||
(LPCVOID) o8083, F,
|
|
||||||
(LPCVOID) o8084n, F,
|
|
||||||
(LPCVOID) o8085n, F,
|
|
||||||
(LPCVOID) o8086n, F,
|
|
||||||
(LPCVOID) o8087n, F,
|
|
||||||
(LPCVOID) o8088n, F,
|
|
||||||
(LPCVOID) o8089n, F,
|
|
||||||
(LPCVOID) o808An, F,
|
|
||||||
(LPCVOID) o808Bn, F,
|
|
||||||
(LPCVOID) o808C, F,
|
|
||||||
(LPCVOID) o808D, F,
|
|
||||||
(LPCVOID) o808E, F,
|
|
||||||
(LPCVOID) o808F, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o80_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o800, F,
|
|
||||||
(LPCVOID) o801, F,
|
|
||||||
(LPCVOID) o802, F,
|
|
||||||
(LPCVOID) o803, F,
|
|
||||||
(LPCVOID) o804, F,
|
|
||||||
(LPCVOID) o805, F,
|
|
||||||
(LPCVOID) o806, F,
|
|
||||||
(LPCVOID) o807, F,
|
|
||||||
(LPCVOID) o808_, 3,
|
|
||||||
(LPCVOID) o809, F,
|
|
||||||
(LPCVOID) o80A, F,
|
|
||||||
(LPCVOID) o80B, F,
|
|
||||||
(LPCVOID) o80Cn, F,
|
|
||||||
(LPCVOID) o80Dn, F,
|
|
||||||
(LPCVOID) o80E, F,
|
|
||||||
(LPCVOID) o80Fn, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o8_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o80_, 2,
|
|
||||||
(LPCVOID) o81_, 2,
|
|
||||||
(LPCVOID) o82n, F,
|
|
||||||
(LPCVOID) o83n, F,
|
|
||||||
(LPCVOID) o84n, F,
|
|
||||||
(LPCVOID) o85n, F,
|
|
||||||
(LPCVOID) o86n, F,
|
|
||||||
(LPCVOID) o87n, F,
|
|
||||||
(LPCVOID) o88n, F,
|
|
||||||
(LPCVOID) o89n, F,
|
|
||||||
(LPCVOID) o8A_, 2,
|
|
||||||
(LPCVOID) o8B_, 2,
|
|
||||||
(LPCVOID) o8Cd4, F,
|
|
||||||
(LPCVOID) o8Dd5, F,
|
|
||||||
(LPCVOID) o8Ed4, F,
|
|
||||||
(LPCVOID) o8Fd5, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o15_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o150a, F,
|
|
||||||
(LPCVOID) o151a, F,
|
|
||||||
(LPCVOID) o152a, F,
|
|
||||||
(LPCVOID) o153a, F,
|
|
||||||
(LPCVOID) o154a, F,
|
|
||||||
(LPCVOID) o155a, F,
|
|
||||||
(LPCVOID) o156a, F,
|
|
||||||
(LPCVOID) o157a, F,
|
|
||||||
(LPCVOID) o158x, F,
|
|
||||||
(LPCVOID) o159x, F,
|
|
||||||
(LPCVOID) o15Ax, F,
|
|
||||||
(LPCVOID) o15Bx, F,
|
|
||||||
(LPCVOID) o15Cx, F,
|
|
||||||
(LPCVOID) o15Dx, F,
|
|
||||||
(LPCVOID) o15Ex, F,
|
|
||||||
(LPCVOID) o15Fx, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o14_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o140, F,
|
|
||||||
(LPCVOID) o141, F,
|
|
||||||
(LPCVOID) o142, F,
|
|
||||||
(LPCVOID) o143, F,
|
|
||||||
(LPCVOID) o144, F,
|
|
||||||
(LPCVOID) o145, F,
|
|
||||||
(LPCVOID) o146, F,
|
|
||||||
(LPCVOID) o147, F,
|
|
||||||
(LPCVOID) o148, F,
|
|
||||||
(LPCVOID) o149, F,
|
|
||||||
(LPCVOID) o14A, F,
|
|
||||||
(LPCVOID) o14B, F,
|
|
||||||
(LPCVOID) o14C, F,
|
|
||||||
(LPCVOID) o14D, F,
|
|
||||||
(LPCVOID) o14E, F,
|
|
||||||
(LPCVOID) o14F, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o13_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o130, F,
|
|
||||||
(LPCVOID) o131, F,
|
|
||||||
(LPCVOID) o132, F,
|
|
||||||
(LPCVOID) o133, F,
|
|
||||||
(LPCVOID) o134, F,
|
|
||||||
(LPCVOID) o135, F,
|
|
||||||
(LPCVOID) o136, F,
|
|
||||||
(LPCVOID) o137, F,
|
|
||||||
(LPCVOID) o138, F,
|
|
||||||
(LPCVOID) o139, F,
|
|
||||||
(LPCVOID) o13A, F,
|
|
||||||
(LPCVOID) o13B, F,
|
|
||||||
(LPCVOID) o13C, F,
|
|
||||||
(LPCVOID) o13D, F,
|
|
||||||
(LPCVOID) o13E, F,
|
|
||||||
(LPCVOID) o13F, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o12_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o120, F,
|
|
||||||
(LPCVOID) o121, F,
|
|
||||||
(LPCVOID) o122, F,
|
|
||||||
(LPCVOID) o123, F,
|
|
||||||
(LPCVOID) o124, F,
|
|
||||||
(LPCVOID) o121, F,
|
|
||||||
(LPCVOID) o122, F,
|
|
||||||
(LPCVOID) o123, F,
|
|
||||||
(LPCVOID) o128, F,
|
|
||||||
(LPCVOID) o129, F,
|
|
||||||
(LPCVOID) o12A, F,
|
|
||||||
(LPCVOID) o12B, F,
|
|
||||||
(LPCVOID) o12C, F,
|
|
||||||
(LPCVOID) o129, F,
|
|
||||||
(LPCVOID) o12A, F,
|
|
||||||
(LPCVOID) o12B, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o11_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o110, F,
|
|
||||||
(LPCVOID) o111, F,
|
|
||||||
(LPCVOID) o112, F,
|
|
||||||
(LPCVOID) o113, F,
|
|
||||||
(LPCVOID) o114, F,
|
|
||||||
(LPCVOID) o111, F,
|
|
||||||
(LPCVOID) o112, F,
|
|
||||||
(LPCVOID) o113, F,
|
|
||||||
(LPCVOID) o118, F,
|
|
||||||
(LPCVOID) o119, F,
|
|
||||||
(LPCVOID) o11A, F,
|
|
||||||
(LPCVOID) o11B, F,
|
|
||||||
(LPCVOID) o11C, F,
|
|
||||||
(LPCVOID) o119, F,
|
|
||||||
(LPCVOID) o11A, F,
|
|
||||||
(LPCVOID) o11B, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o10_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o100, F,
|
|
||||||
(LPCVOID) o101, F,
|
|
||||||
(LPCVOID) o102, F,
|
|
||||||
(LPCVOID) o103, F,
|
|
||||||
(LPCVOID) o104, F,
|
|
||||||
(LPCVOID) o101, F,
|
|
||||||
(LPCVOID) o102, F,
|
|
||||||
(LPCVOID) o103, F,
|
|
||||||
(LPCVOID) o108, F,
|
|
||||||
(LPCVOID) o109, F,
|
|
||||||
(LPCVOID) o10A, F,
|
|
||||||
(LPCVOID) o10B, F,
|
|
||||||
(LPCVOID) o10C, F,
|
|
||||||
(LPCVOID) o109, F,
|
|
||||||
(LPCVOID) o10A, F,
|
|
||||||
(LPCVOID) o10B, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o1_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o10_, 2,
|
|
||||||
(LPCVOID) o11_, 2,
|
|
||||||
(LPCVOID) o12_, 2,
|
|
||||||
(LPCVOID) o13_, 2,
|
|
||||||
(LPCVOID) o14_, 2,
|
|
||||||
(LPCVOID) o15_, 2,
|
|
||||||
(LPCVOID) o16x, F,
|
|
||||||
(LPCVOID) o17x, F,
|
|
||||||
(LPCVOID) o18x, F,
|
|
||||||
(LPCVOID) o19d2, F,
|
|
||||||
(LPCVOID) o1Ad4, F,
|
|
||||||
(LPCVOID) o1Bd5, F,
|
|
||||||
(LPCVOID) o1Cx, F,
|
|
||||||
(LPCVOID) o1Dd2, F,
|
|
||||||
(LPCVOID) o1Ed4, F,
|
|
||||||
(LPCVOID) o1Fd5, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o0E_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o0Ef0, F,
|
|
||||||
(LPCVOID) o0Ef1, F,
|
|
||||||
(LPCVOID) o0Ef2, F,
|
|
||||||
(LPCVOID) o0Ef3, F,
|
|
||||||
(LPCVOID) o0Ef4, F,
|
|
||||||
(LPCVOID) o0Ef5, F,
|
|
||||||
(LPCVOID) o0Ef6, F,
|
|
||||||
(LPCVOID) o0Ef7, F,
|
|
||||||
(LPCVOID) o0Ef8, F,
|
|
||||||
(LPCVOID) o0Ef9, F,
|
|
||||||
(LPCVOID) o0EfA, F,
|
|
||||||
(LPCVOID) o0EfB, F,
|
|
||||||
(LPCVOID) o0EfC, F,
|
|
||||||
(LPCVOID) o0EfD, F,
|
|
||||||
(LPCVOID) o0EfE, F,
|
|
||||||
(LPCVOID) o0EfF, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o0_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o00, F,
|
|
||||||
(LPCVOID) o01, F,
|
|
||||||
(LPCVOID) o02, F,
|
|
||||||
(LPCVOID) o03, F,
|
|
||||||
(LPCVOID) o04, F,
|
|
||||||
(LPCVOID) o05, F,
|
|
||||||
(LPCVOID) o06, F,
|
|
||||||
(LPCVOID) o07, F,
|
|
||||||
(LPCVOID) o08, F,
|
|
||||||
(LPCVOID) o09, F,
|
|
||||||
(LPCVOID) o0A, F,
|
|
||||||
(LPCVOID) o0B, F,
|
|
||||||
(LPCVOID) o0C, F,
|
|
||||||
(LPCVOID) o0D, F,
|
|
||||||
(LPCVOID) o0E_, 3,
|
|
||||||
(LPCVOID) o0F, F
|
|
||||||
};
|
|
||||||
|
|
||||||
static JMPTAB o_[] =
|
|
||||||
{
|
|
||||||
(LPCVOID) o0_, 1,
|
|
||||||
(LPCVOID) o1_, 1,
|
|
||||||
(LPCVOID) o2n, F,
|
|
||||||
(LPCVOID) o3X, F,
|
|
||||||
(LPCVOID) o4d2, F,
|
|
||||||
(LPCVOID) o5d2, F,
|
|
||||||
(LPCVOID) o6d3, F,
|
|
||||||
(LPCVOID) o7d3, F,
|
|
||||||
(LPCVOID) o8_, 1,
|
|
||||||
(LPCVOID) o9_, 1,
|
|
||||||
(LPCVOID) oA_, 1,
|
|
||||||
(LPCVOID) oB_, 1,
|
|
||||||
(LPCVOID) oC_, 1,
|
|
||||||
(LPCVOID) oD_, 1,
|
|
||||||
(LPCVOID) oE_, 1,
|
|
||||||
(LPCVOID) oF_, 1
|
|
||||||
};
|
|
||||||
|
|
||||||
// opcode dispatcher
|
|
||||||
VOID EvalOpcode(LPBYTE I)
|
|
||||||
{
|
|
||||||
DWORD dwIndex = 0;
|
|
||||||
PJMPTAB pJmpTab = o_;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
_ASSERT(I[dwIndex] <= 0xf); // found packed data
|
|
||||||
pJmpTab = &pJmpTab[I[dwIndex]]; // table entry by opcode
|
|
||||||
dwIndex = pJmpTab->dwTyp; // next pointer type
|
|
||||||
pJmpTab = (PJMPTAB) pJmpTab->pLnk; // next pointer to table/function
|
|
||||||
}
|
|
||||||
while (dwIndex != F); // reference to table? -> again
|
|
||||||
|
|
||||||
((VOID (*)(LPBYTE)) pJmpTab)(I); // call function
|
|
||||||
return;
|
|
||||||
}
|
|
|
@ -303,7 +303,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 © 2023 Christoph Gießelink && Sébastien Carlier",
|
LTEXT "Copyright © 2024 Christoph Gießelink && Sébastien Carlier",
|
||||||
IDC_STATIC,29,18,181,8
|
IDC_STATIC,29,18,181,8
|
||||||
DEFPUSHBUTTON "OK",IDOK,215,12,39,14
|
DEFPUSHBUTTON "OK",IDOK,215,12,39,14
|
||||||
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
|
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
|
||||||
|
@ -752,8 +752,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,6,6,0
|
FILEVERSION 1,6,7,0
|
||||||
PRODUCTVERSION 1,6,6,0
|
PRODUCTVERSION 1,6,7,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -770,12 +770,12 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
|
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
|
||||||
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
|
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
|
||||||
VALUE "FileVersion", "1, 6, 6, 0\0"
|
VALUE "FileVersion", "1, 6, 7, 0\0"
|
||||||
VALUE "InternalName", "Emu48\0"
|
VALUE "InternalName", "Emu48\0"
|
||||||
VALUE "LegalCopyright", "Copyright © 2023\0"
|
VALUE "LegalCopyright", "Copyright © 2024\0"
|
||||||
VALUE "OriginalFilename", "Emu48.exe\0"
|
VALUE "OriginalFilename", "Emu48.exe\0"
|
||||||
VALUE "ProductName", "Emu48\0"
|
VALUE "ProductName", "Emu48\0"
|
||||||
VALUE "ProductVersion", "1, 6, 6, 0\0"
|
VALUE "ProductVersion", "1, 6, 7, 0\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -1,63 +1,63 @@
|
||||||
//
|
//
|
||||||
// PCH.H (MinGW version)
|
// PCH.H (MinGW version)
|
||||||
//
|
//
|
||||||
|
|
||||||
#define _WIN32_IE 0x0200
|
#define _WIN32_IE 0x0200
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
// #include <crtdbg.h> // missing file
|
// #include <crtdbg.h> // missing file
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
#define __unaligned
|
#define __unaligned
|
||||||
|
|
||||||
// normally defined in STDLIB.H
|
// normally defined in STDLIB.H
|
||||||
#if !defined __max
|
#if !defined __max
|
||||||
#define __max(a,b) (((a) > (b)) ? (a) : (b))
|
#define __max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
#if !defined __min
|
#if !defined __min
|
||||||
#define __min(a,b) (((a) < (b)) ? (a) : (b))
|
#define __min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// normally defined in missing CRTDBG.H
|
// normally defined in missing CRTDBG.H
|
||||||
#if !defined _ASSERT
|
#if !defined _ASSERT
|
||||||
#define _ASSERT(a)
|
#define _ASSERT(a)
|
||||||
#endif
|
#endif
|
||||||
#define _CrtSetDbgFlag(f)
|
#define _CrtSetDbgFlag(f)
|
||||||
|
|
||||||
#if !defined VERIFY
|
#if !defined VERIFY
|
||||||
#if defined _DEBUG
|
#if defined _DEBUG
|
||||||
#define VERIFY(f) _ASSERT(f)
|
#define VERIFY(f) _ASSERT(f)
|
||||||
#else // _DEBUG
|
#else // _DEBUG
|
||||||
#define VERIFY(f) ((VOID)(f))
|
#define VERIFY(f) ((VOID)(f))
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
#endif // VERIFY
|
#endif // VERIFY
|
||||||
|
|
||||||
#if !defined PROCESS_POWER_THROTTLING_CURRENT_VERSION
|
#if !defined PROCESS_POWER_THROTTLING_CURRENT_VERSION
|
||||||
#define PROCESS_POWER_THROTTLING_CURRENT_VERSION 1
|
#define PROCESS_POWER_THROTTLING_CURRENT_VERSION 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION
|
#if !defined PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION
|
||||||
#define PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION 0x04
|
#define PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION 0x04
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum { ProcessPowerThrottling = 4 };
|
enum { ProcessPowerThrottling = 4 };
|
||||||
|
|
||||||
typedef struct _PROCESS_POWER_THROTTLING_STATE {
|
typedef struct _PROCESS_POWER_THROTTLING_STATE {
|
||||||
ULONG Version;
|
ULONG Version;
|
||||||
ULONG ControlMask;
|
ULONG ControlMask;
|
||||||
ULONG StateMask;
|
ULONG StateMask;
|
||||||
} PROCESS_POWER_THROTTLING_STATE, * PPROCESS_POWER_THROTTLING_STATE;
|
} PROCESS_POWER_THROTTLING_STATE, * PPROCESS_POWER_THROTTLING_STATE;
|
|
@ -67,4 +67,4 @@ Many thanks to Pedro A. Arranda Guti
|
||||||
compatible.
|
compatible.
|
||||||
|
|
||||||
|
|
||||||
04/18/23 (c) by Christoph Gießelink
|
09/23/24 (c) by Christoph Gießelink
|
||||||
|
|
|
@ -1,266 +1,266 @@
|
||||||
/*
|
/*
|
||||||
* MkShared, (c) 2006 Christoph Giesselink (c.giesselink@gmx.de)
|
* MkShared, (c) 2006 Christoph Giesselink (c.giesselink@gmx.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
* MA 02111-1307, USA.
|
* MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_EXTRA_LEAN
|
#define WIN32_EXTRA_LEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#if _MSC_VER >= 1400 // valid for VS2005 and later
|
#if _MSC_VER >= 1400 // valid for VS2005 and later
|
||||||
#if defined _M_IX86
|
#if defined _M_IX86
|
||||||
#pragma comment(linker,"/manifestdependency:\" \
|
#pragma comment(linker,"/manifestdependency:\" \
|
||||||
type='win32' \
|
type='win32' \
|
||||||
name='Microsoft.Windows.Common-Controls' \
|
name='Microsoft.Windows.Common-Controls' \
|
||||||
version='6.0.0.0' processorArchitecture='x86' \
|
version='6.0.0.0' processorArchitecture='x86' \
|
||||||
publicKeyToken='6595b64144ccf1df' \
|
publicKeyToken='6595b64144ccf1df' \
|
||||||
language='*'\"")
|
language='*'\"")
|
||||||
#elif defined _M_IA64
|
#elif defined _M_IA64
|
||||||
#pragma comment(linker,"/manifestdependency:\" \
|
#pragma comment(linker,"/manifestdependency:\" \
|
||||||
type='win32' \
|
type='win32' \
|
||||||
name='Microsoft.Windows.Common-Controls' \
|
name='Microsoft.Windows.Common-Controls' \
|
||||||
version='6.0.0.0' processorArchitecture='ia64' \
|
version='6.0.0.0' processorArchitecture='ia64' \
|
||||||
publicKeyToken='6595b64144ccf1df' \
|
publicKeyToken='6595b64144ccf1df' \
|
||||||
language='*'\"")
|
language='*'\"")
|
||||||
#elif defined _M_X64
|
#elif defined _M_X64
|
||||||
#pragma comment(linker,"/manifestdependency:\" \
|
#pragma comment(linker,"/manifestdependency:\" \
|
||||||
type='win32' \
|
type='win32' \
|
||||||
name='Microsoft.Windows.Common-Controls' \
|
name='Microsoft.Windows.Common-Controls' \
|
||||||
version='6.0.0.0' processorArchitecture='amd64' \
|
version='6.0.0.0' processorArchitecture='amd64' \
|
||||||
publicKeyToken='6595b64144ccf1df' \
|
publicKeyToken='6595b64144ccf1df' \
|
||||||
language='*'\"")
|
language='*'\"")
|
||||||
#else
|
#else
|
||||||
#pragma comment(linker,"/manifestdependency:\" \
|
#pragma comment(linker,"/manifestdependency:\" \
|
||||||
type='win32' \
|
type='win32' \
|
||||||
name='Microsoft.Windows.Common-Controls' \
|
name='Microsoft.Windows.Common-Controls' \
|
||||||
version='6.0.0.0' processorArchitecture='*' \
|
version='6.0.0.0' processorArchitecture='*' \
|
||||||
publicKeyToken='6595b64144ccf1df' \
|
publicKeyToken='6595b64144ccf1df' \
|
||||||
language='*'\"")
|
language='*'\"")
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _KB(n) (2*(n)*1024)
|
#define _KB(n) (2*(n)*1024)
|
||||||
|
|
||||||
#define ARRAYSIZEOF(a) (sizeof(a) / sizeof(a[0]))
|
#define ARRAYSIZEOF(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
#define DEFAULTFILE "SHARED.BIN"
|
#define DEFAULTFILE "SHARED.BIN"
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
STATE_UNKOWN,
|
STATE_UNKOWN,
|
||||||
STATE_GOOD,
|
STATE_GOOD,
|
||||||
STATE_FAIL
|
STATE_FAIL
|
||||||
} CheckState;
|
} CheckState;
|
||||||
|
|
||||||
static HBRUSH hBrushGreen;
|
static HBRUSH hBrushGreen;
|
||||||
static HBRUSH hBrushRed;
|
static HBRUSH hBrushRed;
|
||||||
|
|
||||||
static CheckState eState = STATE_UNKOWN;
|
static CheckState eState = STATE_UNKOWN;
|
||||||
|
|
||||||
static VOID SetInformation(HWND hWnd,LPCTSTR strSize,LPCTSTR strNoOfPorts,LPCTSTR strPorts)
|
static VOID SetInformation(HWND hWnd,LPCTSTR strSize,LPCTSTR strNoOfPorts,LPCTSTR strPorts)
|
||||||
{
|
{
|
||||||
SetDlgItemText(hWnd,IDC_FILE_SIZE,strSize);
|
SetDlgItemText(hWnd,IDC_FILE_SIZE,strSize);
|
||||||
SetDlgItemText(hWnd,IDC_NO_OF_PORTS,strNoOfPorts);
|
SetDlgItemText(hWnd,IDC_NO_OF_PORTS,strNoOfPorts);
|
||||||
SetDlgItemText(hWnd,IDC_PORT_NO,strPorts);
|
SetDlgItemText(hWnd,IDC_PORT_NO,strPorts);
|
||||||
eState = STATE_UNKOWN;
|
eState = STATE_UNKOWN;
|
||||||
SetDlgItemText(hWnd,IDC_RESULT,_T(""));
|
SetDlgItemText(hWnd,IDC_RESULT,_T(""));
|
||||||
InvalidateRect(GetDlgItem(hWnd,IDC_RESULT),NULL,TRUE);
|
InvalidateRect(GetDlgItem(hWnd,IDC_RESULT),NULL,TRUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WriteCardFile(LPCTSTR strFilename,INT nBlocks)
|
static BOOL WriteCardFile(LPCTSTR strFilename,INT nBlocks)
|
||||||
{
|
{
|
||||||
HANDLE hFile = CreateFile(strFilename,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
|
HANDLE hFile = CreateFile(strFilename,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
|
||||||
if (hFile != INVALID_HANDLE_VALUE)
|
if (hFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DWORD dwWritten;
|
DWORD dwWritten;
|
||||||
|
|
||||||
LPBYTE pbyBuffer = (LPBYTE) calloc(1,_KB(1));
|
LPBYTE pbyBuffer = (LPBYTE) calloc(1,_KB(1));
|
||||||
|
|
||||||
while (nBlocks--) WriteFile(hFile, pbyBuffer, _KB(1), &dwWritten, NULL);
|
while (nBlocks--) WriteFile(hFile, pbyBuffer, _KB(1), &dwWritten, NULL);
|
||||||
|
|
||||||
free(pbyBuffer);
|
free(pbyBuffer);
|
||||||
|
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static WORD wSize;
|
static WORD wSize;
|
||||||
|
|
||||||
TCHAR szFilename[MAX_PATH];
|
TCHAR szFilename[MAX_PATH];
|
||||||
HCURSOR hCursor;
|
HCURSOR hCursor;
|
||||||
|
|
||||||
switch (iMsg)
|
switch (iMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
// filename
|
// filename
|
||||||
SetDlgItemText(hWnd,IDC_FILENAME,_T(DEFAULTFILE));
|
SetDlgItemText(hWnd,IDC_FILENAME,_T(DEFAULTFILE));
|
||||||
|
|
||||||
// set to 32kb
|
// set to 32kb
|
||||||
SendDlgItemMessage(hWnd,IDC_CARD32,BM_SETCHECK,1,0);
|
SendDlgItemMessage(hWnd,IDC_CARD32,BM_SETCHECK,1,0);
|
||||||
PostMessage(hWnd,WM_COMMAND,IDC_CARD32,0);
|
PostMessage(hWnd,WM_COMMAND,IDC_CARD32,0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDC_CARD32:
|
case IDC_CARD32:
|
||||||
wSize = 32;
|
wSize = 32;
|
||||||
SetInformation(hWnd,_T("64kb"),_T("1"),_T("2"));
|
SetInformation(hWnd,_T("64kb"),_T("1"),_T("2"));
|
||||||
return 0;
|
return 0;
|
||||||
case IDC_CARD128:
|
case IDC_CARD128:
|
||||||
wSize = 128;
|
wSize = 128;
|
||||||
SetInformation(hWnd,_T("256kb"),_T("1"),_T("2"));
|
SetInformation(hWnd,_T("256kb"),_T("1"),_T("2"));
|
||||||
return 0;
|
return 0;
|
||||||
case IDC_CARD256:
|
case IDC_CARD256:
|
||||||
wSize = 256;
|
wSize = 256;
|
||||||
SetInformation(hWnd,_T("512kb"),_T("2"),_T("2,3"));
|
SetInformation(hWnd,_T("512kb"),_T("2"),_T("2,3"));
|
||||||
return 0;
|
return 0;
|
||||||
case IDC_CARD512:
|
case IDC_CARD512:
|
||||||
wSize = 512;
|
wSize = 512;
|
||||||
SetInformation(hWnd,_T("1mb"),_T("4"),_T("2 through 5"));
|
SetInformation(hWnd,_T("1mb"),_T("4"),_T("2 through 5"));
|
||||||
return 0;
|
return 0;
|
||||||
case IDC_CARD1024:
|
case IDC_CARD1024:
|
||||||
wSize = 1024;
|
wSize = 1024;
|
||||||
SetInformation(hWnd,_T("2mb"),_T("8"),_T("2 through 9"));
|
SetInformation(hWnd,_T("2mb"),_T("8"),_T("2 through 9"));
|
||||||
return 0;
|
return 0;
|
||||||
case IDC_CARD2048:
|
case IDC_CARD2048:
|
||||||
wSize = 2048;
|
wSize = 2048;
|
||||||
SetInformation(hWnd,_T("4mb"),_T("16"),_T("2 through 17"));
|
SetInformation(hWnd,_T("4mb"),_T("16"),_T("2 through 17"));
|
||||||
return 0;
|
return 0;
|
||||||
case IDC_CARD4096:
|
case IDC_CARD4096:
|
||||||
wSize = 4096;
|
wSize = 4096;
|
||||||
SetInformation(hWnd,_T("8mb"),_T("32"),_T("2 through 33"));
|
SetInformation(hWnd,_T("8mb"),_T("32"),_T("2 through 33"));
|
||||||
return 0;
|
return 0;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
GetDlgItemText(hWnd,IDC_FILENAME,szFilename,ARRAYSIZEOF(szFilename));
|
GetDlgItemText(hWnd,IDC_FILENAME,szFilename,ARRAYSIZEOF(szFilename));
|
||||||
hCursor = SetCursor(LoadCursor(NULL,IDC_WAIT));
|
hCursor = SetCursor(LoadCursor(NULL,IDC_WAIT));
|
||||||
|
|
||||||
// create file
|
// create file
|
||||||
if (WriteCardFile(szFilename,wSize))
|
if (WriteCardFile(szFilename,wSize))
|
||||||
{
|
{
|
||||||
eState = STATE_FAIL;
|
eState = STATE_FAIL;
|
||||||
SetDlgItemText(hWnd,IDC_RESULT,_T("Fail!"));
|
SetDlgItemText(hWnd,IDC_RESULT,_T("Fail!"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eState = STATE_GOOD;
|
eState = STATE_GOOD;
|
||||||
SetDlgItemText(hWnd,IDC_RESULT,_T("Done!"));
|
SetDlgItemText(hWnd,IDC_RESULT,_T("Done!"));
|
||||||
}
|
}
|
||||||
InvalidateRect(GetDlgItem(hWnd,IDC_RESULT),NULL,TRUE);
|
InvalidateRect(GetDlgItem(hWnd,IDC_RESULT),NULL,TRUE);
|
||||||
SetCursor(hCursor); // restore cursor
|
SetCursor(hCursor); // restore cursor
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
if (GetDlgCtrlID((HWND) lParam) == IDC_RESULT)
|
if (GetDlgCtrlID((HWND) lParam) == IDC_RESULT)
|
||||||
{
|
{
|
||||||
switch (eState)
|
switch (eState)
|
||||||
{
|
{
|
||||||
case STATE_GOOD:
|
case STATE_GOOD:
|
||||||
SetTextColor((HDC) wParam,(COLORREF) 0xFFFFFF); // white
|
SetTextColor((HDC) wParam,(COLORREF) 0xFFFFFF); // white
|
||||||
SetBkMode((HDC) wParam,TRANSPARENT);
|
SetBkMode((HDC) wParam,TRANSPARENT);
|
||||||
return (LRESULT) hBrushGreen;
|
return (LRESULT) hBrushGreen;
|
||||||
case STATE_FAIL:
|
case STATE_FAIL:
|
||||||
SetTextColor((HDC) wParam,(COLORREF) 0xFFFFFF); // white
|
SetTextColor((HDC) wParam,(COLORREF) 0xFFFFFF); // white
|
||||||
SetBkMode((HDC) wParam,TRANSPARENT);
|
SetBkMode((HDC) wParam,TRANSPARENT);
|
||||||
return (LRESULT) hBrushRed;
|
return (LRESULT) hBrushRed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break; // default handler for all other windows
|
break; // default handler for all other windows
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hWnd,iMsg,wParam,lParam);
|
return DefWindowProc(hWnd,iMsg,wParam,lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR lpszCmdLine,INT nCmdShow)
|
INT WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR lpszCmdLine,INT nCmdShow)
|
||||||
{
|
{
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
// RECT rc;
|
// RECT rc;
|
||||||
HFONT hFont;
|
HFONT hFont;
|
||||||
|
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
|
||||||
// create background brushes
|
// create background brushes
|
||||||
hBrushGreen = CreateSolidBrush(0x008000);
|
hBrushGreen = CreateSolidBrush(0x008000);
|
||||||
hBrushRed = CreateSolidBrush(0x0000FF);
|
hBrushRed = CreateSolidBrush(0x0000FF);
|
||||||
|
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
wc.lpfnWndProc = WndProc;
|
wc.lpfnWndProc = WndProc;
|
||||||
wc.cbClsExtra = 0;
|
wc.cbClsExtra = 0;
|
||||||
wc.cbWndExtra = DLGWINDOWEXTRA;
|
wc.cbWndExtra = DLGWINDOWEXTRA;
|
||||||
wc.hInstance = hInst;
|
wc.hInstance = hInst;
|
||||||
wc.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MKSHARED));
|
wc.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MKSHARED));
|
||||||
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||||
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
||||||
wc.lpszMenuName = NULL;
|
wc.lpszMenuName = NULL;
|
||||||
wc.lpszClassName = _T("CMkShared");
|
wc.lpszClassName = _T("CMkShared");
|
||||||
RegisterClass(&wc);
|
RegisterClass(&wc);
|
||||||
|
|
||||||
hWnd = CreateDialog(hInst,MAKEINTRESOURCE(IDD_MAIN),0,(DLGPROC) WndProc);
|
hWnd = CreateDialog(hInst,MAKEINTRESOURCE(IDD_MAIN),0,(DLGPROC) WndProc);
|
||||||
_ASSERT(hWnd);
|
_ASSERT(hWnd);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// center window
|
// center window
|
||||||
GetWindowRect(hWnd, &rc);
|
GetWindowRect(hWnd, &rc);
|
||||||
SetWindowPos(hWnd, HWND_TOP,
|
SetWindowPos(hWnd, HWND_TOP,
|
||||||
((GetSystemMetrics(SM_CXSCREEN) - (rc.right - rc.left)) / 2),
|
((GetSystemMetrics(SM_CXSCREEN) - (rc.right - rc.left)) / 2),
|
||||||
((GetSystemMetrics(SM_CYSCREEN) - (rc.bottom - rc.top)) / 2),
|
((GetSystemMetrics(SM_CYSCREEN) - (rc.bottom - rc.top)) / 2),
|
||||||
0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
|
0, 0, SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// initialization
|
// initialization
|
||||||
hFont = CreateFont(20,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
|
hFont = CreateFont(20,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
|
||||||
OUT_DEVICE_PRECIS,CLIP_DEFAULT_PRECIS,
|
OUT_DEVICE_PRECIS,CLIP_DEFAULT_PRECIS,
|
||||||
PROOF_QUALITY,DEFAULT_PITCH|TMPF_TRUETYPE|FF_ROMAN,
|
PROOF_QUALITY,DEFAULT_PITCH|TMPF_TRUETYPE|FF_ROMAN,
|
||||||
_T("Times New Roman"));
|
_T("Times New Roman"));
|
||||||
_ASSERT(hFont);
|
_ASSERT(hFont);
|
||||||
SendDlgItemMessage(hWnd,IDC_STATIC_TITLE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
|
SendDlgItemMessage(hWnd,IDC_STATIC_TITLE,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
|
||||||
SendDlgItemMessage(hWnd,IDC_RESULT,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
|
SendDlgItemMessage(hWnd,IDC_RESULT,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(TRUE,0));
|
||||||
|
|
||||||
while(GetMessage(&msg,NULL,0,0))
|
while(GetMessage(&msg,NULL,0,0))
|
||||||
{
|
{
|
||||||
if(!IsDialogMessage(hWnd,&msg))
|
if(!IsDialogMessage(hWnd,&msg))
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteObject(hFont);
|
DeleteObject(hFont);
|
||||||
DeleteObject(hBrushGreen);
|
DeleteObject(hBrushGreen);
|
||||||
DeleteObject(hBrushRed);
|
DeleteObject(hBrushRed);
|
||||||
|
|
||||||
return msg.wParam;
|
return msg.wParam;
|
||||||
UNREFERENCED_PARAMETER(hPrev);
|
UNREFERENCED_PARAMETER(hPrev);
|
||||||
UNREFERENCED_PARAMETER(lpszCmdLine);
|
UNREFERENCED_PARAMETER(lpszCmdLine);
|
||||||
UNREFERENCED_PARAMETER(nCmdShow);
|
UNREFERENCED_PARAMETER(nCmdShow);
|
||||||
}
|
}
|
|
@ -1,32 +1,32 @@
|
||||||
//{{NO_DEPENDENCIES}}
|
//{{NO_DEPENDENCIES}}
|
||||||
// Microsoft Developer Studio generated include file.
|
// Microsoft Developer Studio generated include file.
|
||||||
// Used by MKSHARED.RC
|
// Used by MKSHARED.RC
|
||||||
//
|
//
|
||||||
#define IDD_MAIN 100
|
#define IDD_MAIN 100
|
||||||
#define IDI_MKSHARED 101
|
#define IDI_MKSHARED 101
|
||||||
#define IDC_CARD32 1000
|
#define IDC_CARD32 1000
|
||||||
#define IDC_CARD128 1001
|
#define IDC_CARD128 1001
|
||||||
#define IDC_CARD256 1002
|
#define IDC_CARD256 1002
|
||||||
#define IDC_CARD512 1003
|
#define IDC_CARD512 1003
|
||||||
#define IDC_CARD1024 1004
|
#define IDC_CARD1024 1004
|
||||||
#define IDC_CARD2048 1005
|
#define IDC_CARD2048 1005
|
||||||
#define IDC_CARD4096 1006
|
#define IDC_CARD4096 1006
|
||||||
#define IDC_STATIC_TITLE 1007
|
#define IDC_STATIC_TITLE 1007
|
||||||
#define IDC_FILENAME 1008
|
#define IDC_FILENAME 1008
|
||||||
#define IDC_FILE_SIZE 1009
|
#define IDC_FILE_SIZE 1009
|
||||||
#define IDC_NO_OF_PORTS 1010
|
#define IDC_NO_OF_PORTS 1010
|
||||||
#define IDC_PORT_NO 1011
|
#define IDC_PORT_NO 1011
|
||||||
#define IDC_RESULT 1012
|
#define IDC_RESULT 1012
|
||||||
#define IDC_STATIC -1
|
#define IDC_STATIC -1
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NO_MFC 1
|
#define _APS_NO_MFC 1
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1013
|
#define _APS_NEXT_CONTROL_VALUE 1013
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
|
@ -1,120 +1,120 @@
|
||||||
/*
|
/*
|
||||||
* T48G, (c) 2000 Christoph Giesselink (cgiess@swol.de)
|
* T48G, (c) 2000 Christoph Giesselink (cgiess@swol.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
* MA 02111-1307, USA.
|
* MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_EXTRA_LEAN
|
#define WIN32_EXTRA_LEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define VERSION "1.0"
|
#define VERSION "1.0"
|
||||||
|
|
||||||
#define _KB(n) (n*1024*2) // KB emulator block
|
#define _KB(n) (n*1024*2) // KB emulator block
|
||||||
|
|
||||||
#define HP48SIG "Emu48 Document\xFE" // HP49 state file signature
|
#define HP48SIG "Emu48 Document\xFE" // HP49 state file signature
|
||||||
|
|
||||||
VOID MakeTemplate(FILE *hFile,BYTE type,DWORD Port0Size,DWORD Port1Size)
|
VOID MakeTemplate(FILE *hFile,BYTE type,DWORD Port0Size,DWORD Port1Size)
|
||||||
{
|
{
|
||||||
CHIPSET Chipset;
|
CHIPSET Chipset;
|
||||||
DWORD dwBytesWritten;
|
DWORD dwBytesWritten;
|
||||||
UINT nVar;
|
UINT nVar;
|
||||||
BYTE byZ;
|
BYTE byZ;
|
||||||
|
|
||||||
// file signature
|
// file signature
|
||||||
WriteFile(hFile,HP48SIG,sizeof(HP48SIG),&dwBytesWritten,NULL);
|
WriteFile(hFile,HP48SIG,sizeof(HP48SIG),&dwBytesWritten,NULL);
|
||||||
assert(dwBytesWritten == sizeof(HP48SIG));
|
assert(dwBytesWritten == sizeof(HP48SIG));
|
||||||
|
|
||||||
// KML filename length
|
// KML filename length
|
||||||
nVar = 0; // no name
|
nVar = 0; // no name
|
||||||
WriteFile(hFile,&nVar,sizeof(nVar),&dwBytesWritten,NULL);
|
WriteFile(hFile,&nVar,sizeof(nVar),&dwBytesWritten,NULL);
|
||||||
assert(dwBytesWritten == sizeof(nVar));
|
assert(dwBytesWritten == sizeof(nVar));
|
||||||
|
|
||||||
// KML filename
|
// KML filename
|
||||||
|
|
||||||
// Chipset Size
|
// Chipset Size
|
||||||
nVar = sizeof(Chipset); // length, no name
|
nVar = sizeof(Chipset); // length, no name
|
||||||
WriteFile(hFile,&nVar,sizeof(nVar),&dwBytesWritten,NULL);
|
WriteFile(hFile,&nVar,sizeof(nVar),&dwBytesWritten,NULL);
|
||||||
assert(dwBytesWritten == sizeof(nVar));
|
assert(dwBytesWritten == sizeof(nVar));
|
||||||
|
|
||||||
// Chipset
|
// Chipset
|
||||||
ZeroMemory(&Chipset,sizeof(Chipset));
|
ZeroMemory(&Chipset,sizeof(Chipset));
|
||||||
Chipset.type = type;
|
Chipset.type = type;
|
||||||
Chipset.Port0Size = Port0Size;
|
Chipset.Port0Size = Port0Size;
|
||||||
Chipset.Port1Size = Port1Size;
|
Chipset.Port1Size = Port1Size;
|
||||||
Chipset.Port2Size = 0;
|
Chipset.Port2Size = 0;
|
||||||
Chipset.cards_status = 0x0;
|
Chipset.cards_status = 0x0;
|
||||||
|
|
||||||
WriteFile(hFile,&Chipset,sizeof(Chipset),&dwBytesWritten,NULL);
|
WriteFile(hFile,&Chipset,sizeof(Chipset),&dwBytesWritten,NULL);
|
||||||
assert(dwBytesWritten == sizeof(Chipset));
|
assert(dwBytesWritten == sizeof(Chipset));
|
||||||
|
|
||||||
byZ = 0; // fill with zero nibble
|
byZ = 0; // fill with zero nibble
|
||||||
|
|
||||||
// write port0 memory content
|
// write port0 memory content
|
||||||
for (nVar = 0; nVar < _KB(Chipset.Port0Size); ++nVar)
|
for (nVar = 0; nVar < _KB(Chipset.Port0Size); ++nVar)
|
||||||
{
|
{
|
||||||
WriteFile(hFile,&byZ,1,&dwBytesWritten,NULL);
|
WriteFile(hFile,&byZ,1,&dwBytesWritten,NULL);
|
||||||
assert(dwBytesWritten == 1);
|
assert(dwBytesWritten == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write port1 memory content
|
// write port1 memory content
|
||||||
for (nVar = 0; nVar < _KB(Chipset.Port1Size); ++nVar)
|
for (nVar = 0; nVar < _KB(Chipset.Port1Size); ++nVar)
|
||||||
{
|
{
|
||||||
WriteFile(hFile,&byZ,1,&dwBytesWritten,NULL);
|
WriteFile(hFile,&byZ,1,&dwBytesWritten,NULL);
|
||||||
assert(dwBytesWritten == 1);
|
assert(dwBytesWritten == 1);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT main(int argc, char *argv[])
|
UINT main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
|
|
||||||
BYTE type;
|
BYTE type;
|
||||||
DWORD Port0Size;
|
DWORD Port0Size;
|
||||||
DWORD Port1Size;
|
DWORD Port1Size;
|
||||||
|
|
||||||
printf("HP48 State File Template for Emu48 V" VERSION "\n");
|
printf("HP48 State File Template for Emu48 V" VERSION "\n");
|
||||||
if (argc != 5 || (*argv[2] != 'S' && *argv[2] != 'G'))
|
if (argc != 5 || (*argv[2] != 'S' && *argv[2] != 'G'))
|
||||||
{
|
{
|
||||||
printf("\nUsage:\n\t%s <E48-File> <Model[S|G]> <Port0-Size> <Port1-Size>\n\n", argv[0]);
|
printf("\nUsage:\n\t%s <E48-File> <Model[S|G]> <Port0-Size> <Port1-Size>\n\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = *argv[2];
|
type = *argv[2];
|
||||||
Port0Size = atoi(argv[3]);
|
Port0Size = atoi(argv[3]);
|
||||||
Port1Size = atoi(argv[4]);
|
Port1Size = atoi(argv[4]);
|
||||||
|
|
||||||
hFile = CreateFile(argv[1],GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
|
hFile = CreateFile(argv[1],GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
|
||||||
if (hFile != INVALID_HANDLE_VALUE)
|
if (hFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
// write template
|
// write template
|
||||||
MakeTemplate(hFile,type,Port0Size,Port1Size);
|
MakeTemplate(hFile,type,Port0Size,Port1Size);
|
||||||
puts("Generation successful.");
|
puts("Generation successful.");
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Cannot open file %s.\n", argv[1]);
|
printf("Cannot open file %s.\n", argv[1]);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
|
@ -1,103 +1,103 @@
|
||||||
/*
|
/*
|
||||||
* types.h
|
* types.h
|
||||||
*
|
*
|
||||||
* This file is part of Emu48
|
* This file is part of Emu48
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Sebastien Carlier
|
* Copyright (C) 1995 Sebastien Carlier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// HST bits
|
// HST bits
|
||||||
#define XM 1
|
#define XM 1
|
||||||
#define SB 2
|
#define SB 2
|
||||||
#define SR 4
|
#define SR 4
|
||||||
#define MP 8
|
#define MP 8
|
||||||
|
|
||||||
#define SWORD SHORT // signed 16 Bit variable
|
#define SWORD SHORT // signed 16 Bit variable
|
||||||
#define QWORD ULONGLONG // unsigned 64 Bit variable
|
#define QWORD ULONGLONG // unsigned 64 Bit variable
|
||||||
|
|
||||||
#define CHIPSET Chipset_t
|
#define CHIPSET Chipset_t
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
SWORD nPosX; // position of window
|
SWORD nPosX; // position of window
|
||||||
SWORD nPosY;
|
SWORD nPosY;
|
||||||
BYTE type; // calculator type
|
BYTE type; // calculator type
|
||||||
|
|
||||||
DWORD Port0Size; // real size of module in KB
|
DWORD Port0Size; // real size of module in KB
|
||||||
DWORD Port1Size; // real size of module in KB
|
DWORD Port1Size; // real size of module in KB
|
||||||
DWORD Port2Size; // real size of module in KB (HP49G only)
|
DWORD Port2Size; // real size of module in KB (HP49G only)
|
||||||
LPBYTE Port0;
|
LPBYTE Port0;
|
||||||
LPBYTE Port1;
|
LPBYTE Port1;
|
||||||
LPBYTE Port2;
|
LPBYTE Port2;
|
||||||
|
|
||||||
DWORD pc;
|
DWORD pc;
|
||||||
DWORD d0;
|
DWORD d0;
|
||||||
DWORD d1;
|
DWORD d1;
|
||||||
DWORD rstkp;
|
DWORD rstkp;
|
||||||
DWORD rstk[8];
|
DWORD rstk[8];
|
||||||
BYTE A[16];
|
BYTE A[16];
|
||||||
BYTE B[16];
|
BYTE B[16];
|
||||||
BYTE C[16];
|
BYTE C[16];
|
||||||
BYTE D[16];
|
BYTE D[16];
|
||||||
BYTE R0[16];
|
BYTE R0[16];
|
||||||
BYTE R1[16];
|
BYTE R1[16];
|
||||||
BYTE R2[16];
|
BYTE R2[16];
|
||||||
BYTE R3[16];
|
BYTE R3[16];
|
||||||
BYTE R4[16];
|
BYTE R4[16];
|
||||||
BYTE ST[4];
|
BYTE ST[4];
|
||||||
BYTE HST;
|
BYTE HST;
|
||||||
BYTE P;
|
BYTE P;
|
||||||
WORD out;
|
WORD out;
|
||||||
WORD in;
|
WORD in;
|
||||||
BOOL SoftInt;
|
BOOL SoftInt;
|
||||||
BOOL Shutdn;
|
BOOL Shutdn;
|
||||||
BOOL mode_dec;
|
BOOL mode_dec;
|
||||||
BOOL inte; // interrupt status flag (FALSE = int in service)
|
BOOL inte; // interrupt status flag (FALSE = int in service)
|
||||||
BOOL intk; // 1 ms keyboard scan flag (TRUE = enable)
|
BOOL intk; // 1 ms keyboard scan flag (TRUE = enable)
|
||||||
BOOL intd; // keyboard interrupt pending (TRUE = int pending)
|
BOOL intd; // keyboard interrupt pending (TRUE = int pending)
|
||||||
BOOL carry;
|
BOOL carry;
|
||||||
|
|
||||||
WORD crc;
|
WORD crc;
|
||||||
WORD wPort2Crc; // fingerprint of port2
|
WORD wPort2Crc; // fingerprint of port2
|
||||||
WORD wRomCrc; // fingerprint of ROM
|
WORD wRomCrc; // fingerprint of ROM
|
||||||
#if defined _USRDLL // DLL version
|
#if defined _USRDLL // DLL version
|
||||||
QWORD cycles; // oscillator cycles
|
QWORD cycles; // oscillator cycles
|
||||||
#else // EXE version
|
#else // EXE version
|
||||||
DWORD cycles; // oscillator cycles
|
DWORD cycles; // oscillator cycles
|
||||||
DWORD cycles_reserved; // reserved for MSB of oscillator cycles
|
DWORD cycles_reserved; // reserved for MSB of oscillator cycles
|
||||||
#endif
|
#endif
|
||||||
DWORD dwKdnCycles; // cpu cycles at start of 1ms key handler
|
DWORD dwKdnCycles; // cpu cycles at start of 1ms key handler
|
||||||
|
|
||||||
UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF
|
UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF
|
||||||
UINT FlashRomState; // WSM state of flash memory (unused)
|
UINT FlashRomState; // WSM state of flash memory (unused)
|
||||||
BYTE cards_status;
|
BYTE cards_status;
|
||||||
BYTE IORam[64]; // I/O hardware register
|
BYTE IORam[64]; // I/O hardware register
|
||||||
UINT IOBase; // address of I/O modules page
|
UINT IOBase; // address of I/O modules page
|
||||||
BOOL IOCfig; // I/O module configuration flag
|
BOOL IOCfig; // I/O module configuration flag
|
||||||
BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page
|
BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page
|
||||||
BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB
|
BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB
|
||||||
BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page
|
BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page
|
||||||
BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag
|
BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag
|
||||||
BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag
|
BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag
|
||||||
|
|
||||||
BYTE t1;
|
BYTE t1;
|
||||||
DWORD t2;
|
DWORD t2;
|
||||||
|
|
||||||
BOOL bShutdnWake; // flag for wake up from SHUTDN mode
|
BOOL bShutdnWake; // flag for wake up from SHUTDN mode
|
||||||
|
|
||||||
BYTE Keyboard_Row[9];
|
BYTE Keyboard_Row[9];
|
||||||
WORD IR15X;
|
WORD IR15X;
|
||||||
UINT Keyboard_State; // not used
|
UINT Keyboard_State; // not used
|
||||||
|
|
||||||
signed short loffset;
|
signed short loffset;
|
||||||
signed int width;
|
signed int width;
|
||||||
UINT boffset;
|
UINT boffset;
|
||||||
UINT lcounter;
|
UINT lcounter;
|
||||||
UINT sync; // not used
|
UINT sync; // not used
|
||||||
BYTE contrast;
|
BYTE contrast;
|
||||||
BOOL dispon;
|
BOOL dispon;
|
||||||
DWORD start1;
|
DWORD start1;
|
||||||
DWORD start12;
|
DWORD start12;
|
||||||
DWORD end1;
|
DWORD end1;
|
||||||
DWORD start2, end2;
|
DWORD start2, end2;
|
||||||
} Chipset_t;
|
} Chipset_t;
|
BIN
uninst.exe
BIN
uninst.exe
Binary file not shown.
Loading…
Reference in a new issue