Revert "2024-09-25: Updated to version 1.67"

This reverts commit 0a4432a193.
This commit is contained in:
Gwenhael Le Moine 2024-10-25 09:28:29 +02:00
parent 0a4432a193
commit c5eb61c8d4
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
67 changed files with 31986 additions and 32277 deletions

View file

@ -342,13 +342,11 @@ NCE3 | nc. | RAM 128KB | nc. | Slt2 32KB-4MB | RAM 128KB
- 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 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.
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.
- 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 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.
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.
- RPL Object Viewer...
@ -395,4 +393,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.
04/19/24 (c) by Christoph Gießelink
08/12/19 (c) by Christoph Gießelink

BIN
Emu48.exe

Binary file not shown.

View file

@ -526,10 +526,10 @@ h3 { color:red; font-size:1.1em; }
"String" object in stack level 1 to the clipboard. On all
other objects, the command will be ignored. This prevents sending
binary objects to the clipboard.</p>
<p>The decimal point of &quot;Real Numbers&quot; in the clipboard is
equal to the calculator setting. This is important when you try to
paste the numbers into a program using the locale settings of the host
operating system.</p>
<p>The decimal point (radix mark) of &quot;Real Numbers&quot; in the
clipboard is equal to the calculator setting. This is important when
you try to paste the numbers into a program using the locale settings
of the host operating system.</p>
<h2><a name=ss9.5>9.5 Paste Stack</a></h2>
<p>This menu item is enabled for the HP48SX, HP48GX and the HP49G
emulation.</p>
@ -539,18 +539,14 @@ h3 { color:red; font-size:1.1em; }
object. Is the content a complex number object, the number will be
saved as &quot;Complex Number&quot; object, otherwise cases as
&quot;String&quot; object.</p>
<p>To import &quot;Real Numbers&quot; from the clipboard, the decimal
point character of the clipboard and calculator <u>must not match</u> any
more. There's an auto detection for decoding the thousands separator and
decimal point character. The thousands separator is removed at decoding.
A real number is detected in the case of valid real number characters in
the clipboard.</p>
<p>&quot;Complex Numbers&quot; must be in the form <i>(a,b)</i> when
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>
<p>To import &quot;Real or Complex Numbers&quot; from the clipboard, the
decimal point (radix mark) of the clipboard and calculator <u>must</u>
match. A real or complex number is only detected in the case of valid
real number characters in the clipboard. Especially heading and tailing
white spaces aren't valid number characters also.</p>
<p>Complex numbers must be in the form <i>(a,b)</i> when using the point
radix mark or in the form <i>(a;b)</i> when using the comma radix mark.
The Cartesian or algebraic form <i>a+bi</i> is not supported.</p>
<h2><a name=ss9.6>9.6 Reset Calculator</a></h2>
<p>This emulates the Reset pin of the internal CPU.</p>
<h2><a name=ss9.7>9.7 Backup</a></h2>
@ -640,7 +636,7 @@ h3 { color:red; font-size:1.1em; }
</table>
<h1><a name=s14>14. License</a></h1>
<p>Emu48 - A HP38G/39G/40G/48SX/48GX/49G Emulator<br>
Copyright (C) 2024 Christoph Gie&szlig;elink</p>
Copyright (C) 2022 Christoph Gie&szlig;elink</p>
<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
Software Foundation; either version 2 of the License, or (at your option)

View file

@ -1,4 +1,4 @@
Known bugs and restrictions of Emu48 V1.67
Known bugs and restrictions of Emu48 V1.66
------------------------------------------
- the following I/O bits aren't emulated (incomplete)
@ -47,4 +47,4 @@ Known bugs and restrictions of Emu48 V1.67
- quitting the emulator while programming the flash isn't allowed,
because the content of flash state machine isn't saved so far
09/23/24 (c) by Christoph Gießelink, c dot giesselink at gmx dot de
06/20/23 (c) by Christoph Gießelink, c dot giesselink at gmx dot de

View file

@ -1,89 +1,3 @@
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
DISRPL.C

View file

@ -303,7 +303,7 @@ FONT 8, "MS Sans Serif"
BEGIN
ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE
LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP
LTEXT "Copyright © 2024 Christoph Gießelink && Sébastien Carlier",
LTEXT "Copyright © 2023 Christoph Gießelink && Sébastien Carlier",
IDC_STATIC,29,18,181,8
DEFPUSHBUTTON "OK",IDOK,215,12,39,14
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
@ -622,11 +622,7 @@ BEGIN
EDITTEXT IDC_DEBUG_DATA_STARTADDR,101,27,37,14
LTEXT "End Address (hexadecimal):",IDC_STATIC,7,46,88,8
EDITTEXT IDC_DEBUG_DATA_ENDADDR,101,44,37,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 "OK",IDOK,207,27,50,14
PUSHBUTTON "Cancel",IDCANCEL,207,44,50,14
END
@ -640,13 +636,7 @@ BEGIN
PUSHBUTTON "Browse",IDC_DEBUG_DATA_BUT,207,7,50,14
LTEXT "Start Address (hexadecimal):",IDC_STATIC,7,30,90,8
EDITTEXT IDC_DEBUG_DATA_STARTADDR,101,27,37,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 "OK",IDOK,207,27,50,14
PUSHBUTTON "Cancel",IDCANCEL,207,44,50,14
END
@ -733,8 +723,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,6,7,0
PRODUCTVERSION 1,6,7,0
FILEVERSION 1,6,6,0
PRODUCTVERSION 1,6,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -751,12 +741,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
VALUE "FileVersion", "1, 6, 7, 0\0"
VALUE "FileVersion", "1, 6, 6, 0\0"
VALUE "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2024\0"
VALUE "LegalCopyright", "Copyright © 2023\0"
VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 6, 7, 0\0"
VALUE "ProductVersion", "1, 6, 6, 0\0"
END
END
BLOCK "VarFileInfo"

View file

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32505.173
# Visual Studio Version 16
VisualStudioVersion = 16.0.32510.428
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Emu48", "Emu48.vcxproj", "{D259D821-B668-408E-B5DF-F0C7B42E6726}"
EndProject

View file

@ -27,24 +27,24 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

View file

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

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
// hand cursor AND mask
static CONST BYTE ANDmaskCursor[] =

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "io.h"
HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv,

View file

@ -8,8 +8,8 @@
*/
#include "pch.h"
#include "resource.h"
#include "Emu48.h"
#include "Opcodes.h"
#include "emu48.h"
#include "opcodes.h"
#include "ops.h"
#include "color.h"
#include "disrpl.h"
@ -65,8 +65,8 @@ static CONST TCHAR cHex[] = { _T('0'),_T('1'),_T('2'),_T('3'),
_T('8'),_T('9'),_T('A'),_T('B'),
_T('C'),_T('D'),_T('E'),_T('F') };
static INT nDbgPosX = CW_USEDEFAULT; // position of debugger window
static INT nDbgPosY = CW_USEDEFAULT;
static INT nDbgPosX = 0; // position of debugger window
static INT nDbgPosY = 0;
static WORD wBreakpointCount = 0; // number of breakpoints
static BP_T sBreakpoint[MAXBREAKPOINTS]; // breakpoint table
@ -1885,10 +1885,7 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM
switch (message)
{
case WM_INITDIALOG:
if (nDbgPosX != CW_USEDEFAULT) // not default window position
{
SetWindowLocation(hDlg,nDbgPosX,nDbgPosY);
}
if (bAlwaysOnTop) SetWindowPos(hDlg,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
SendMessage(hDlg,WM_SETICON,ICON_BIG,(LPARAM) LoadIcon(hApp,MAKEINTRESOURCE(IDI_EMU48)));
@ -2204,7 +2201,7 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM
LRESULT OnToolDebug(VOID) // debugger dialogbox call
{
if ((hDlgDebug = CreateDialog(hApp,MAKEINTRESOURCE(IDD_DEBUG),hWnd,
if ((hDlgDebug = CreateDialog(hApp,MAKEINTRESOURCE(IDD_DEBUG),NULL,
(DLGPROC)Debugger)) == NULL)
AbortMessage(_T("Debugger Dialog Box Creation Error !"));
return 0;
@ -3496,92 +3493,46 @@ static BOOL OnBrowseSaveMem(HWND hDlg)
//
// write file to memory
//
static BOOL LoadMemData(LPCTSTR lpszFilename,DWORD dwStartAddr,UINT uBitMode)
static BOOL LoadMemData(LPCTSTR lpszFilename,DWORD dwStartAddr)
{
HANDLE hFile;
DWORD dwFileSize,dwRead;
LPBYTE pbyData;
DWORD dwRead;
BYTE byData;
hFile = CreateFile(lpszFilename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,NULL);
if (hFile == INVALID_HANDLE_VALUE) // error, couldn't create a new file
return FALSE;
dwFileSize = GetFileSize(hFile, NULL);
if ((pbyData = (LPBYTE) malloc(dwFileSize)) != NULL)
while (dwStartAddr <= 0xFFFFF) // read until EOF or end of Saturn address space
{
ReadFile(hFile,pbyData,dwFileSize,&dwRead,NULL);
ReadFile(hFile,&byData,sizeof(byData),&dwRead,NULL);
if (dwRead == 0) break; // EOF
if (uBitMode == 2) // auto mode (0=8-bit, 1=4-bit, 2=auto)
if (dwStartAddr < 0xFFFFF)
{
BOOL bPacked = FALSE; // data not packed
DWORD dwIndex;
for (dwIndex = 0; !bPacked && dwIndex < dwFileSize; ++dwIndex)
{
bPacked = ((pbyData[dwIndex] & 0xF0) != 0);
Write2(dwStartAddr,byData); // write byte in map mode
dwStartAddr += 2;
}
uBitMode = bPacked ? 0 : 1; // 0=8-bit, 1=4-bit
}
if (uBitMode == 0) // 0=8-bit
else // special handling to avoid address wrap around
{
LPBYTE pbyDataNew = (LPBYTE) realloc(pbyData,2*dwFileSize);
if (pbyDataNew)
{
LPBYTE pbySrc,pbyDest;
pbyData = pbyDataNew;
// source start address
pbySrc = pbyData + dwFileSize;
dwFileSize *= 2; // new filesize
// destination start address
pbyDest = pbyData + dwFileSize;
while (pbySrc != pbyDest) // unpack source
{
CONST BYTE byValue = *(--pbySrc);
*(--pbyDest) = byValue >> 4;
*(--pbyDest) = byValue & 0xF;
}
_ASSERT(pbySrc == pbyData);
_ASSERT(pbyDest == pbyData);
}
else
{
free(pbyData);
pbyData = NULL;
byData &= 0xF;
Nwrite(&byData,dwStartAddr,1); // write nibble in map mode
++dwStartAddr;
}
}
if (pbyData) // have data to save
{
LPBYTE p = pbyData;
// read data size or end of Saturn address space
while (dwFileSize > 0 && dwStartAddr <= 0xFFFFF)
{
// write nibble in map mode
Nwrite(p++,dwStartAddr++,1);
--dwFileSize;
}
}
free(pbyData);
}
CloseHandle(hFile);
return pbyData != NULL;
return TRUE;
}
//
// write memory data to file
//
static BOOL SaveMemData(LPCTSTR lpszFilename,DWORD dwStartAddr,DWORD dwEndAddr,UINT uBitMode)
static BOOL SaveMemData(LPCTSTR lpszFilename,DWORD dwStartAddr,DWORD dwEndAddr)
{
HANDLE hFile;
DWORD dwAddr,dwSend,dwWritten;
BYTE byData[2];
DWORD dwAddr,dwWritten;
BYTE byData;
hFile = CreateFile(lpszFilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE) // error, couldn't create a new file
@ -3590,16 +3541,8 @@ static BOOL SaveMemData(LPCTSTR lpszFilename,DWORD dwStartAddr,DWORD dwEndAddr,U
for (dwAddr = dwStartAddr; dwAddr <= dwEndAddr; dwAddr += 2)
{
_ASSERT(dwAddr <= 0xFFFFF);
Npeek(byData,dwAddr,2); // read two nibble in map mode
dwSend = 2; // send 2 nibble
if (uBitMode == 0) // (0=8-bit, 1=4-bit)
{
byData[0] = byData[0]|(byData[1]<<4);
dwSend = 1; // send 1 byte
}
WriteFile(hFile,&byData,dwSend,&dwWritten,NULL);
byData = Read2(dwAddr); // read byte in map mode
WriteFile(hFile,&byData,sizeof(byData),&dwWritten,NULL);
}
CloseHandle(hFile);
@ -3613,14 +3556,9 @@ static INT_PTR CALLBACK DebugMemLoad(HWND hDlg, UINT message, WPARAM wParam, LPA
{
TCHAR szFilename[MAX_PATH];
DWORD dwStartAddr;
int nButton;
UINT uBitMode;
switch (message)
{
case WM_INITDIALOG:
CheckDlgButton(hDlg,IDC_DEBUG_DATA_LOAD_ABIT,BST_CHECKED);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
@ -3640,16 +3578,8 @@ static INT_PTR CALLBACK DebugMemLoad(HWND hDlg, UINT message, WPARAM wParam, LPA
_ASSERT(dwStartAddr <= 0xFFFFF);
// load as 8-bit or 4-bit data (0=8-bit, 1=4-bit, 2=auto)
for (nButton = IDC_DEBUG_DATA_LOAD_8BIT; nButton <= IDC_DEBUG_DATA_LOAD_ABIT; ++nButton)
{
if (IsDlgButtonChecked(hDlg,nButton) == BST_CHECKED)
break;
}
uBitMode = (UINT) (nButton - IDC_DEBUG_DATA_LOAD_8BIT);
// load memory dump file
if (!LoadMemData(szFilename,dwStartAddr,uBitMode))
if (!LoadMemData(szFilename,dwStartAddr))
return FALSE;
// update memory window
@ -3679,13 +3609,9 @@ static INT_PTR CALLBACK DebugMemSave(HWND hDlg, UINT message, WPARAM wParam, LPA
{
TCHAR szFilename[MAX_PATH];
DWORD dwStartAddr,dwEndAddr;
UINT uBitMode;
switch (message)
{
case WM_INITDIALOG:
CheckDlgButton(hDlg,IDC_DEBUG_DATA_SAVE_8BIT,BST_CHECKED);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
@ -3709,11 +3635,8 @@ static INT_PTR CALLBACK DebugMemSave(HWND hDlg, UINT message, WPARAM wParam, LPA
_ASSERT(dwStartAddr <= 0xFFFFF);
_ASSERT(dwEndAddr <= 0xFFFFF);
// save as 8-bit or 4-bit data (0=8-bit, 1=4-bit)
uBitMode = IsDlgButtonChecked(hDlg,IDC_DEBUG_DATA_SAVE_4BIT);
// save memory dump file
if (!SaveMemData(szFilename,dwStartAddr,dwEndAddr,uBitMode))
if (!SaveMemData(szFilename,dwStartAddr,dwEndAddr))
return FALSE;
// no break

View file

@ -8,7 +8,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#pragma inline_depth(0)

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
typedef struct // type of model memory mapping
{

View file

@ -9,7 +9,7 @@
*/
#include "pch.h"
#include "resource.h"
#include "Emu48.h"
#include "emu48.h"
#include "io.h"
#include "kml.h"

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "disrpl.h"
DWORD dwRplPlatform = RPL_P3; // current RPL platform

View file

@ -8,12 +8,12 @@
*/
#include "pch.h"
#include "resource.h"
#include "Emu48.h"
#include "emu48.h"
#include "io.h"
#include "kml.h"
#include "debugger.h"
#define VERSION "1.67"
#define VERSION "1.66"
#ifdef _DEBUG
LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug");
@ -1740,7 +1740,7 @@ static LRESULT OnToolDisasm(VOID) // disasm dialogbox call
static LRESULT OnTopics(VOID)
{
ShellExecute(hWnd,_T("open"),_T("Emu48.htm"),NULL,szEmuDirectory,SW_SHOWNORMAL);
ShellExecute(hWnd,_T("open"),_T("emu48.htm"),NULL,szEmuDirectory,SW_SHOWNORMAL);
return 0;
}
@ -2034,7 +2034,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
MSG msg;
WNDCLASS wc;
ATOM classAtom;
WSADATA wsd;
RECT rectWindow;
HACCEL hAccel;
DWORD dwThreadId;
@ -2049,8 +2048,16 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
hApp = hInst;
#if defined _UNICODE
{
ppArgv = (LPCTSTR*) CommandLineToArgvW(GetCommandLine(),&nArgc);
}
#else
{
nArgc = __argc; // no. of command line arguments
ppArgv = (LPCTSTR *) __targv; // command line arguments
ppArgv = (LPCTSTR*) __argv; // command line arguments
}
#endif
wc.style = CS_BYTEALIGNCLIENT;
wc.lpfnWndProc = (WNDPROC)MainWndProc;
@ -2280,8 +2287,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
if (NewDocument()) SetWindowTitle(_T("Untitled"));
start:
VERIFY(WSAStartup(MAKEWORD(1,1),&wsd) == 0);
if (bStartupBackup) SaveBackup(); // make a RAM backup at startup
if (pbyRom) SwitchToState(SM_RUN);
@ -2298,8 +2303,6 @@ start:
}
}
WSACleanup(); // cleanup network stack
// clean up DDE server
DdeNameService(idDdeInst, hszService, NULL, DNS_UNREGISTER);
DdeFreeStringHandle(idDdeInst, hszService);

View file

@ -1,5 +1,5 @@
/*
* Emu48.h
* emu48.h
*
* This file is part of Emu48
*
@ -364,7 +364,6 @@ extern BOOL SendByteUdp(BYTE byData);
// Stack.c
extern BOOL bDetectClpObject;
extern BOOL bLocaleDecimalPoint;
extern LRESULT OnStackCopy(VOID);
extern LRESULT OnStackPaste(VOID);

View file

@ -7,8 +7,8 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "Opcodes.h"
#include "emu48.h"
#include "opcodes.h"
#include "io.h"
#include "debugger.h"
@ -68,7 +68,7 @@ static DWORD dwOldCyc; // cpu cycles at last event
static DWORD dwSpeedRef; // timer value at last event
static DWORD dwTickRef; // sample timer ticks
#include "Ops.h"
#include "ops.h"
// save last instruction in circular instruction buffer
static __inline VOID SaveInstrAddr(DWORD dwAddr)

778
Sources/Emu48/fetch.c Normal file
View 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;
}

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "ops.h"
#include "io.h" // I/O register definitions
#include "kml.h"

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "i28f160.h"
#define ARRAYSIZEOF(a) (sizeof(a) / sizeof(a[0]))

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "io.h" // I/O definitions
DWORD dwKeyMinDelay = 50; // minimum time for key hold

View file

@ -8,7 +8,7 @@
*/
#include "pch.h"
#include "resource.h"
#include "Emu48.h"
#include "emu48.h"
#include "kml.h"
#define KEYMACROHEAD "Emu-KeyMacro" // macro signature

View file

@ -8,7 +8,7 @@
*/
#include "pch.h"
#include "resource.h"
#include "Emu48.h"
#include "emu48.h"
#include "kml.h"
static VOID InitLex(LPCTSTR szScript);

View file

@ -664,7 +664,7 @@ which is possible in case of only 0 or 1 present symbols. */
static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
static const unsigned headsize = 1u << FIRSTBITS; /*size of the first table*/
static const unsigned mask = (1u << FIRSTBITS) /*headsize*/ - 1u;
size_t i, numpresent, pointer, size; /*total table size*/
unsigned i, numpresent, pointer, size; /*total table size*/
unsigned* maxlens = (unsigned*)lodepng_malloc(headsize * sizeof(unsigned));
if(!maxlens) return 83; /*alloc fail*/
@ -683,7 +683,7 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
size = headsize;
for(i = 0; i < headsize; ++i) {
unsigned l = maxlens[i];
if(l > FIRSTBITS) size += (((size_t)1) << (l - FIRSTBITS));
if(l > FIRSTBITS) size += (1u << (l - FIRSTBITS));
}
tree->table_len = (unsigned char*)lodepng_malloc(size * sizeof(*tree->table_len));
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];
if(l <= FIRSTBITS) continue;
tree->table_len[i] = l;
tree->table_value[i] = (unsigned short)pointer;
pointer += (((size_t)1) << (l - FIRSTBITS));
tree->table_value[i] = pointer;
pointer += (1u << (l - FIRSTBITS));
}
lodepng_free(maxlens);
@ -726,7 +726,7 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
unsigned index = reverse | (j << l);
if(tree->table_len[index] != 16) return 55; /*invalid tree: long symbol shares prefix with short symbol*/
tree->table_len[index] = l;
tree->table_value[index] = (unsigned short)i;
tree->table_value[index] = i;
}
} else {
/*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 index2 = start + (reverse2 | (j << (l - FIRSTBITS)));
tree->table_len[index2] = l;
tree->table_value[index2] = (unsigned short)i;
tree->table_value[index2] = i;
}
}
}
@ -2886,7 +2886,7 @@ static unsigned lodepng_chunk_createv(ucvector* out,
}
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize,
size_t length, const char* type, const unsigned char* data) {
unsigned length, const char* type, const unsigned char* data) {
ucvector v = ucvector_init(*out, *outsize);
unsigned error = lodepng_chunk_createv(&v, length, type, data);
*out = v.data;
@ -5889,7 +5889,7 @@ static size_t ilog2i(size_t i) {
l = ilog2(i);
/* approximate i*log2(i): l is integer logarithm, ((i - (1u << l)) << 1u)
linearly approximates the missing fractional part multiplied by i */
return i * l + ((i - (((size_t)1) << l)) << 1u);
return i * l + ((i - ((size_t) 1u << l)) << 1u);
}
static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h,

View file

@ -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.
Returne error code (0 if it went ok)
*/
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize, size_t length,
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize, unsigned length,
const char* type, const unsigned char* data);

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "io.h" // I/O definitions
// #define BAT_SIMULATION // switch low bat simulation

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "ops.h"
#include "opcodes.h"
#include "io.h"
@ -995,9 +995,9 @@ static DWORD ReadT2Acc(VOID)
// maybe CPU speed measurement, slow down the next 10 CPU opcodes
if (dwCycDif < 150)
{
InitAdjustSpeed(); // init variables if necessary
EnterCriticalSection(&csSlowLock);
{
InitAdjustSpeed(); // init variables if necessary
nOpcSlow = 10; // slow down next 10 opcodes
}
LeaveCriticalSection(&csSlowLock);
@ -1125,9 +1125,9 @@ VOID ReadIO(BYTE *a, DWORD d, DWORD s, BOOL bUpdate)
// CPU running with max. speed we may get a timeout overflow
// -> to avoid this slow down CPU speed on transmit buffer full
InitAdjustSpeed(); // init variables if necessary
EnterCriticalSection(&csSlowLock);
{
InitAdjustSpeed(); // init variables if necessary
nOpcSlow = 10; // slow down next 10 opcodes
}
LeaveCriticalSection(&csSlowLock);

View file

@ -8,7 +8,7 @@
*/
#include "pch.h"
#include "resource.h"
#include "Emu48.h"
#include "emu48.h"
static TCHAR szOriginal[MAX_PATH] = _T("");

View file

@ -8,8 +8,8 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "Opcodes.h"
#include "emu48.h"
#include "opcodes.h"
#include "io.h" // I/O register definitions
#define w Chipset
@ -24,7 +24,7 @@
#pragma intrinsic(memset,memcpy)
#include "Ops.h"
#include "ops.h"
// Fields start and length
UINT F_s[16] = {0/*P*/,0,2,0,15,3,0,0,0,0,0,0,0,0,0,0};

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "io.h"
#define ERR_CHAR 127 // character for transfer error

View file

@ -121,67 +121,62 @@
#define IDC_DEBUG_DATA_BUT 1084
#define IDC_DEBUG_DATA_STARTADDR 1085
#define IDC_DEBUG_DATA_ENDADDR 1086
#define IDC_DEBUG_DATA_SAVE_8BIT 1087
#define IDC_DEBUG_DATA_SAVE_4BIT 1088
#define IDC_DEBUG_DATA_LOAD_8BIT 1089
#define IDC_DEBUG_DATA_LOAD_4BIT 1090
#define IDC_DEBUG_DATA_LOAD_ABIT 1091
#define IDC_DEBUG_SET_SYMB 1092
#define IDC_DEBUG_SET_MODEL 1093
#define IDC_DEBUG_SET_FILE 1094
#define IDC_DEBUG_SET_BROWSE 1095
#define IDC_DEBUG_STACK 1096
#define IDC_STATIC_BREAKPOINT 1097
#define IDC_BREAKEDIT_ADD 1098
#define IDC_BREAKEDIT_DELETE 1099
#define IDC_BREAKEDIT_WND 1100
#define IDC_STATIC_MMU 1101
#define IDC_MMU_IO_A 1102
#define IDC_MMU_NCE2_A 1103
#define IDC_MMU_CE1_A 1104
#define IDC_MMU_CE2_A 1105
#define IDC_MMU_NCE3_A 1106
#define IDC_MMU_IO_S 1107
#define IDC_MMU_CE1_S 1108
#define IDC_MMU_CE2_S 1109
#define IDC_MMU_NCE2_S 1110
#define IDC_MMU_NCE3_S 1111
#define IDC_STATIC_MISC 1112
#define IDC_MISC_BS_TXT 1113
#define IDC_INSTR_TEXT 1114
#define IDC_INSTR_CODE 1115
#define IDC_INSTR_COPY 1116
#define IDC_INSTR_CLEAR 1117
#define IDC_PROFILE_LASTCYCLES 1118
#define IDC_PROFILE_LASTTIME 1119
#define IDC_BPCODE 1120
#define IDC_BPRPL 1121
#define IDC_BPACCESS 1122
#define IDC_BPREAD 1123
#define IDC_BPWRITE 1124
#define IDC_FIND_DATA 1125
#define IDC_FIND_PREV 1126
#define IDC_FIND_NEXT 1127
#define IDC_FIND_ASCII 1128
#define IDC_ADDR20_24 1129
#define IDC_ADDR25_27 1130
#define IDC_ADDR28_29 1131
#define IDC_ADDR30_34 1132
#define IDC_RPLVIEW_DATA 1133
#define IDC_MACRO_SLOW 1134
#define IDC_MACRO_FAST 1135
#define IDC_MACRO_SLIDER 1136
#define IDC_MACRO_REAL 1137
#define IDC_MACRO_MANUAL 1138
#define IDC_SOUND_SLIDER 1139
#define IDC_SOUND_DEVICE 1140
#define IDC_TRACE_FILE 1141
#define IDC_TRACE_BROWSE 1142
#define IDC_TRACE_NEW 1143
#define IDC_TRACE_APPEND 1144
#define IDC_TRACE_REGISTER 1145
#define IDC_TRACE_MMU 1146
#define IDC_TRACE_OPCODE 1147
#define IDC_DEBUG_SET_SYMB 1087
#define IDC_DEBUG_SET_MODEL 1088
#define IDC_DEBUG_SET_FILE 1089
#define IDC_DEBUG_SET_BROWSE 1090
#define IDC_DEBUG_STACK 1091
#define IDC_STATIC_BREAKPOINT 1092
#define IDC_BREAKEDIT_ADD 1093
#define IDC_BREAKEDIT_DELETE 1094
#define IDC_BREAKEDIT_WND 1095
#define IDC_STATIC_MMU 1096
#define IDC_MMU_IO_A 1097
#define IDC_MMU_NCE2_A 1098
#define IDC_MMU_CE1_A 1099
#define IDC_MMU_CE2_A 1100
#define IDC_MMU_NCE3_A 1101
#define IDC_MMU_IO_S 1102
#define IDC_MMU_CE1_S 1103
#define IDC_MMU_CE2_S 1104
#define IDC_MMU_NCE2_S 1105
#define IDC_MMU_NCE3_S 1106
#define IDC_STATIC_MISC 1107
#define IDC_MISC_BS_TXT 1108
#define IDC_INSTR_TEXT 1109
#define IDC_INSTR_CODE 1110
#define IDC_INSTR_COPY 1111
#define IDC_INSTR_CLEAR 1112
#define IDC_PROFILE_LASTCYCLES 1113
#define IDC_PROFILE_LASTTIME 1114
#define IDC_BPCODE 1115
#define IDC_BPRPL 1116
#define IDC_BPACCESS 1117
#define IDC_BPREAD 1118
#define IDC_BPWRITE 1119
#define IDC_FIND_DATA 1120
#define IDC_FIND_PREV 1121
#define IDC_FIND_NEXT 1122
#define IDC_FIND_ASCII 1123
#define IDC_ADDR20_24 1124
#define IDC_ADDR25_27 1125
#define IDC_ADDR28_29 1126
#define IDC_ADDR30_34 1127
#define IDC_RPLVIEW_DATA 1128
#define IDC_MACRO_SLOW 1129
#define IDC_MACRO_FAST 1130
#define IDC_MACRO_SLIDER 1131
#define IDC_MACRO_REAL 1132
#define IDC_MACRO_MANUAL 1133
#define IDC_SOUND_SLIDER 1134
#define IDC_SOUND_DEVICE 1135
#define IDC_TRACE_FILE 1136
#define IDC_TRACE_BROWSE 1137
#define IDC_TRACE_NEW 1138
#define IDC_TRACE_APPEND 1139
#define IDC_TRACE_REGISTER 1140
#define IDC_TRACE_MMU 1141
#define IDC_TRACE_OPCODE 1142
#define ID_FILE_NEW 40001
#define ID_FILE_OPEN 40002
#define ID_FILE_SAVE 40003
@ -262,7 +257,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 40074
#define _APS_NEXT_CONTROL_VALUE 1148
#define _APS_NEXT_CONTROL_VALUE 1143
#define _APS_NEXT_SYMED_VALUE 109
#endif
#endif

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "ops.h"
// flash page types

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "ops.h"
#include "io.h"

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "io.h"
#define INTERRUPT ((void)(Chipset.SoftInt=TRUE,bInterrupt=TRUE))
@ -104,6 +104,7 @@ BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort)
LPCTSTR strPort = (Chipset.IORam[IR_CTRL] & EIRU) ? strIrPort : strWirePort;
_ASSERT(Chipset.IORam[IOC] & SON); // UART on
CommClose(); // close port if already open
dwBytesRead = 0L; // no bytes received

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "i28f160.h"
// #define REGISTRY // use registry instead of *.ini file
@ -196,7 +196,6 @@ VOID ReadSettings(VOID)
uWaveDevId = ReadInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId);
dwWaveVol = ReadInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol);
dwWaveTime = ReadInt(_T("Emulator"),_T("WaveTime"),dwWaveTime);
bLocaleDecimalPoint = ReadInt(_T("Emulator"),_T("LocaleDecimalPoint"),bLocaleDecimalPoint);
// LowBat
bLowBatDisable = ReadInt(_T("LowBat"),_T("Disable"),bLowBatDisable);
// Macro
@ -250,7 +249,6 @@ VOID WriteSettings(VOID)
WriteInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId);
WriteInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol);
WriteInt(_T("Emulator"),_T("WaveTime"),dwWaveTime);
WriteInt(_T("Emulator"),_T("LocaleDecimalPoint"),bLocaleDecimalPoint);
// LowBat
WriteInt(_T("LowBat"),_T("Disable"),bLowBatDisable);
// Macro

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "snddef.h"
typedef HRESULT (WINAPI *LPFNDLLGETCLASSOBJECT)(REFCLSID,REFIID,LPVOID *);

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
// #define DEBUG_SOUND // switch for sound debug purpose
// #define SINE_APPROX // sine signal approximation

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "io.h"
#define fnRadix 51 // fraction mark
@ -19,7 +19,6 @@
#define DOCSTR 0x02A2C // String
BOOL bDetectClpObject = TRUE; // try to detect clipboard object
BOOL bLocaleDecimalPoint = FALSE; // use decimal point character from calculator
//################
//#
@ -27,100 +26,6 @@ BOOL bLocaleDecimalPoint = FALSE; // use decimal point character from calculat
//#
//################
//
// check if cGroup character is thousands separator
//
static BOOL CheckThousandGroup(LPCTSTR cp,TCHAR cGroup)
{
UINT uLastPos;
UINT i;
// get decimal point
CONST TCHAR cDecimalPoint = cGroup ^ (_T('.') ^ _T(','));
BOOL bFound = FALSE; // 1st separator not found
BOOL bPosOK = TRUE;
for (i = 0; bPosOK && cp[i] != cDecimalPoint && cp[i] != 0; ++i)
{
if (cp[i] == cGroup) // found separator
{
if (bFound)
{
// verify separator position
bPosOK = (uLastPos + 4 == i);
}
uLastPos = i; // last position of separator
bFound = TRUE; // separator found
}
}
// check last grouping
return bPosOK && bFound && (uLastPos + 4 == i);
}
//
// get decimal point from clipboard
//
static TCHAR GetClpbrdDecimalPoint(LPCTSTR cp)
{
TCHAR cDec = 0; // default for invalid decimal point detection
TCHAR cLast = 0; // last decimal point
UINT uPoint = 0; // no. of points
UINT uComma = 0; // no. of commas
LPCTSTR p;
for (p = cp; *p; ++p) // count '.' and ',' characters
{
if (*p == _T('.'))
{
cLast = *p; // last occurance
++uPoint;
}
if (*p == _T(','))
{
cLast = *p; // last occurance
++uComma;
}
}
if (uComma == 0 && uPoint == 0) // none of both
{
cDec = _T('.');
}
else if (uComma == 1 && uPoint == 0) // one single ','
{
cDec = _T(',');
}
else if (uComma == 0 && uPoint == 1) // one single '.'
{
cDec = _T('.');
}
else if (uComma == 1 && uPoint == 1) // one single ',' and '.'
{
// change from ',' to '.' or vice versa
const TCHAR cFirst = cLast ^ (_T('.') ^ _T(','));
if (CheckThousandGroup(cp,cFirst)) // check if 1st character is grouped
{
cDec = cLast;
}
}
// multiple grouped ',' and single '.'
else if (uComma > 1 && uPoint == 1 && CheckThousandGroup(cp,_T(',')))
{
cDec = _T('.');
}
// multiple grouped '.' and single ','
else if (uComma == 1 && uPoint > 1 && CheckThousandGroup(cp,_T('.')))
{
cDec = _T(',');
}
return cDec;
}
static LPTSTR Trim(LPCTSTR cp)
{
LPCTSTR pcWs = _T(" \t\n\r"); // valid whitespace characters
@ -333,23 +238,22 @@ static INT RPL_GetBcd(BYTE CONST *pbyNum,INT nMantLen,INT nExpLen,CONST TCHAR cD
static __inline INT SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,LPBYTE pbyNum,INT nSize)
{
TCHAR cVc[] = _T(",.0123456789eE+-");
TCHAR cVc[] = _T(".0123456789eE+-");
BYTE byNum[80];
INT i,nIp,nDp,nMaxExp;
LONG lExp;
// get thousand separator
const TCHAR cThousand = cDec ^ (_T('.') ^ _T(','));
cVc[0] = cDec; // replace decimal char
if ( nMantLen + nExpLen >= nSize // destination buffer too small
|| !*cp // empty string
|| _tcsspn(cp,cVc) != (SIZE_T) lstrlen(cp) // real doesn't contain only these numbers
|| _tcsspn(cp,cVc) != (SIZE_T) lstrlen(cp) // real contain only these numbers
|| (SIZE_T) lstrlen(cp) >= ARRAYSIZEOF(byNum)) // ignore too long reals
return 0;
byNum[0] = (*cp != _T('-')) ? 0 : 9; // set sign nibble
if (*cp == _T('-') || *cp == _T('+')) // skip sign nibble
if (*cp == _T('-') || *cp == _T('+')) // skip sign character
cp++;
// only '.', '0' .. '9' are valid here
@ -360,13 +264,8 @@ static __inline INT SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,
if (*cp != cDec) // no decimal point
{
// count integer part
for (; (*cp >= _T('0') && *cp <= _T('9')) || *cp == cThousand; ++cp)
{
if (*cp != cThousand) // not thousand separator
{
byNum[++nIp] = *cp - _T('0');
}
}
while (*cp >= _T('0') && *cp <= _T('9'))
byNum[++nIp] = *cp++ - _T('0');
if (!nIp) return 0;
}
@ -477,8 +376,8 @@ static INT RPL_GetComplex(BYTE CONST *pbyNum,INT nMantLen,INT nExpLen,CONST TCHA
TCHAR cSep;
cSep = (cDec == _T('.')) // current separator
? _T(',') // decimal point '.' -> ',' separator
: _T(';'); // decimal comma ',' -> ';' separator
? _T(',') // radix mark '.' -> ',' separator
: _T(';'); // radix mark ',' -> ';' separator
nPos = 0; // write buffer position
@ -521,8 +420,8 @@ static INT RPL_SetComplex(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,L
nLen = 0; // read data length
cSep = (cDec == _T('.')) // current separator
? _T(',') // decimal point '.' -> ',' separator
: _T(';'); // decimal comma ',' -> ';' separator
? _T(',') // radix mark '.' -> ',' separator
: _T(';'); // radix mark ',' -> ';' separator
if ((pszData = Trim(cp)) != NULL) // create a trimmed working copy of the string
{
@ -569,14 +468,8 @@ static INT RPL_SetComplex(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec,L
static TCHAR GetRadix(VOID)
{
if (bLocaleDecimalPoint) // use Windows Locale decimal point character
{
TCHAR cDecimal[2];
// get locale decimal point with zero terminator
GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SDECIMAL,cDecimal,2);
return cDecimal[0];
}
// get locale decimal point
// GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SDECIMAL,&cDecimal,1);
return RPL_GetSystemFlag(fnRadix) ? _T(',') : _T('.');
}
@ -790,11 +683,9 @@ LRESULT OnStackPaste(VOID) // paste data to stack
if ((lpstrClipdata = (LPCTSTR) GlobalLock(hClipObj)))
{
TCHAR cDec;
BYTE byNumber[128];
DWORD dwAddress;
INT s = 0; // no valid object
INT s;
do
{
@ -823,14 +714,9 @@ LRESULT OnStackPaste(VOID) // paste data to stack
}
}
cDec = GetClpbrdDecimalPoint(lpstrClipdata);
if (cDec) // valid decimal point
{
// try to convert string to real format
_ASSERT(16 <= ARRAYSIZEOF(byNumber));
s = RPL_SetBcd(lpstrClipdata,12,3,cDec,byNumber,sizeof(byNumber));
}
s = RPL_SetBcd(lpstrClipdata,12,3,GetRadix(),byNumber,sizeof(byNumber));
if (s > 0) // is a real number
{
@ -849,14 +735,9 @@ LRESULT OnStackPaste(VOID) // paste data to stack
break;
}
// search for ';' as separator
cDec = (_tcschr(lpstrClipdata,_T(';')) != NULL)
? _T(',') // decimal comma
: _T('.'); // decimal point
// try to convert string to complex format
_ASSERT(32 <= ARRAYSIZEOF(byNumber));
s = RPL_SetComplex(lpstrClipdata,12,3,cDec,byNumber,sizeof(byNumber));
s = RPL_SetComplex(lpstrClipdata,12,3,GetRadix(),byNumber,sizeof(byNumber));
if (s > 0) // is a real complex
{

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
//################
//#

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
#include "ops.h"
#include "io.h" // I/O definitions
@ -247,7 +247,7 @@ VOID SetHP48Time(VOID) // set date and time
ULONGLONG ticks, time;
DWORD dw;
WORD crc, i;
LPBYTE pbyTime;
BYTE p[4];
_ASSERT(sizeof(ULONGLONG) == 8); // check size of datatype
@ -282,23 +282,29 @@ VOID SetHP48Time(VOID) // set date and time
time = ticks; // save for calc. timeout
time += OFF_TIME; // add 10 min for auto off
pbyTime = Port0 + RPLTIME; // HP addresses for clock in port0
dw = RPLTIME; // HP addresses for clock in port0
crc = 0x0; // reset crc value
for (i = 0; i < 13; ++i) // write date and time
for (i = 0; i < 13; ++i, ++dw) // write date and time
{
*pbyTime = (BYTE) ticks & 0xf; // time
crc = UpCRC(crc,*pbyTime);
*p = (BYTE) ticks & 0xf;
crc = (crc >> 4) ^ (((crc ^ ((WORD) *p)) & 0xf) * 0x1081);
Port0[dw] = *p; // always store in port0
ticks >>= 4;
pbyTime[13+4] = (BYTE) time & 0xf; // auto off
time >>= 4;
++pbyTime;
}
Nunpack(pbyTime,crc,4); // write crc
Nunpack(p,crc,4); // write crc
memcpy(Port0+dw,p,4); // always store in port0
pbyTime[13+4] = 0xf;
dw += 4; // HP addresses for timeout
for (i = 0; i < 13; ++i, ++dw) // write time for auto off
{
Port0[dw] = (BYTE) time & 0xf; // always store in port0
time >>= 4;
}
Port0[dw] = 0xf; // always store in port0
return;
}

View file

@ -7,7 +7,7 @@
*
*/
#include "pch.h"
#include "Emu48.h"
#include "emu48.h"
TCHAR szUdpServer[1024] = _T("localhost");
WORD wUdpPort = 5025; // scpi-raw
@ -22,10 +22,13 @@ VOID ResetUdp(VOID)
BOOL SendByteUdp(BYTE byData)
{
WSADATA wsd;
SOCKET sClient;
BOOL bErr = TRUE;
VERIFY(WSAStartup(MAKEWORD(1,1),&wsd) == 0);
// IP address not specified
if (sServer.sin_addr.s_addr == INADDR_NONE)
{
@ -69,5 +72,7 @@ BOOL SendByteUdp(BYTE byData)
bErr = sendto(sClient, (LPCCH) &byData, sizeof(byData), 0, (LPSOCKADDR) &sServer, sizeof(sServer)) == SOCKET_ERROR;
closesocket(sClient);
}
WSACleanup(); // cleanup network stack
return bErr;
}

View file

@ -303,7 +303,7 @@ FONT 8, "MS Sans Serif"
BEGIN
ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE
LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP
LTEXT "Copyright © 2024 Christoph Gießelink && Sébastien Carlier",
LTEXT "Copyright © 2023 Christoph Gießelink && Sébastien Carlier",
IDC_STATIC,29,18,181,8
DEFPUSHBUTTON "OK",IDOK,215,12,39,14
EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL |
@ -752,8 +752,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,6,7,0
PRODUCTVERSION 1,6,7,0
FILEVERSION 1,6,6,0
PRODUCTVERSION 1,6,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -770,12 +770,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0"
VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0"
VALUE "FileVersion", "1, 6, 7, 0\0"
VALUE "FileVersion", "1, 6, 6, 0\0"
VALUE "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2024\0"
VALUE "LegalCopyright", "Copyright © 2023\0"
VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 6, 7, 0\0"
VALUE "ProductVersion", "1, 6, 6, 0\0"
END
END
BLOCK "VarFileInfo"

View file

@ -67,4 +67,4 @@ Many thanks to Pedro A. Arranda Guti
compatible.
09/23/24 (c) by Christoph Gießelink
04/18/23 (c) by Christoph Gießelink

Binary file not shown.