2020-09-30: Updated to version 1.63

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

BIN
Emu48.exe

Binary file not shown.

View file

@ -395,19 +395,14 @@ h3 { color:red; font-size:1.1em; }
</ul>
<h3><a name=ss8.6.3>8.6.3 Settings Peripheral</a></h3>
<h4>8.6.3.1 Section Sound</h4>
<p>A new implementation of the sound engine made ROM patches for sound
<p>A new implementation of the sound engine made ROM patches for sound
output obsolete. The new sound engine emulates the behaviour of the
beeper output ports and only work in connection with a sound card.
Using the legacy PC speaker mode isn't possible any more. The old
beeper method with a ROM patch is still working but deprecated, it's
strongly recommended to remove all beep patches from your current KML
scripts to enable the new sound engine. The support of the old sound
implementation by a ROM patch maybe removed in later versions of the
emulator and remaining beep patches will corrupt the ROM with an
illegal opcode then. Actually the program informs you when
detecting ROM beep patches by opening the &quot;KML Script Compilation
Result&quot; dialog. To prevent this, remove the ROM beep patches
from the KML script.
beeper method with a ROM patch has been removed, so you have to remove
the ROM beep patches from your KML scripts. Actually the program
informs you when detecting ROM beep patches by opening the &quot;KML
Script Compilation Result&quot; dialog reporting an error.
</p>
<p>For the sound generation the calculator must know his own CPU strobe
frequency. On the real calculator the speed depends on various settings
@ -601,7 +596,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) 2019 Christoph Gie&szlig;elink</p>
Copyright (C) 2020 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.62
Known bugs and restrictions of Emu48 V1.63
------------------------------------------
- the following I/O bits aren't emulated (incomplete)
@ -47,4 +47,4 @@ Known bugs and restrictions of Emu48 V1.62
- quitting the emulator while programming the flash isn't allowed,
because the content of flash state machine isn't saved so far
10/15/19 (c) by Christoph Gießelink, c dot giesselink at gmx dot de
09/22/20 (c) by Christoph Gießelink, c dot giesselink at gmx dot de

View file

@ -1,3 +1,70 @@
Service Pack 63 for Emu48 Version 1.0
DISPLAY.C
- changed function UpdateAnnunciators(), changed function prototype
with an additional argument to get information which annunciators
have changed, so only the annunciators which have changed are
redrawn now
EMU48.C
- changed function OnPaint(), changed call of function
UpdateAnnunciators() updating all annunciators
EMU48.DSP
- removed external.c sources
EMU48.H
- removed DISP_ANNUN definition
- changed function prototype
- removed extern declaration of global functions
EMU48.RC
- changed version and copyright
ENGINE.C
- changed function CheckDisp(), removed assertion with DISP_ANNUN
definition
- changed function WorkerThread(), changed call of function
UpdateAnnunciators() updating all annunciators
EXTERNAL.C
- file deleted
FETCH.C
- changed table o81B_, replaced beep patch opcode o81B1 by
o_invalid4
FILES.C
- changed function OpenDocument(), when KML script file name is
longer than the file buffer, skip the name heading until the name
remainder fits into the buffer, this cause a KML script error with
the selection of a new KML script instead of a general document
file read error before
KML.C
- changed function InitKML(), changed warning to error at ROM beep
patch detection
LODEPNG.C
- changed implementation file to LodePNG version 20200306 with
unmarked typecast patches for x64 compatibility, Copyright (c)
2005-2020 Lode Vandevenne
LODEPNG.H
- changed header file to LodePNG version 20200306
MOPS.C
- changed function WriteIO(), the annunciator access variable now
contain bit coded the annunciators which have changed and is the
argument for the modified UpdateAnnunciators() function
OPCODES.C
- removed function o81B1() as part of the beep patch
OPCODES.H
- removed extern declaration of function o81B1()
Service Pack 62 for Emu48 Version 1.0
DEBUGGER.C

View file

@ -850,21 +850,26 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s)
return;
}
VOID UpdateAnnunciators(VOID)
VOID UpdateAnnunciators(DWORD dwUpdateMask)
{
BYTE c;
UINT i;
c = (BYTE)(Chipset.IORam[ANNCTRL] | (Chipset.IORam[ANNCTRL+1]<<4));
// switch annunciators off if timer stopped
if ((c & AON) == 0 || (Chipset.IORam[TIMER2_CTRL] & RUN) == 0)
c = 0;
DrawAnnunciator(1,c&LA1);
DrawAnnunciator(2,c&LA2);
DrawAnnunciator(3,c&LA3);
DrawAnnunciator(4,c&LA4);
DrawAnnunciator(5,c&LA5);
DrawAnnunciator(6,c&LA6);
for (i = 1; i <= 6; ++i)
{
if ((dwUpdateMask & 0x1) != 0) // annunciator changed?
{
DrawAnnunciator(i,c & 0x1);
}
dwUpdateMask >>= 1;
c >>= 1;
}
_ASSERT(dwUpdateMask == 0);
return;
}

View file

@ -13,7 +13,7 @@
#include "kml.h"
#include "debugger.h"
#define VERSION "1.62"
#define VERSION "1.63"
#ifdef _DEBUG
LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug");
@ -898,7 +898,7 @@ static LRESULT OnPaint(HWND hWindow)
GdiFlush();
}
LeaveCriticalSection(&csGDILock);
UpdateAnnunciators();
UpdateAnnunciators(0x3F);
RefreshButtons(&rcMainPaint);
}
EndPaint(hWindow, &Paint);

View file

@ -191,10 +191,6 @@ SOURCE=.\engine.c
# End Source File
# Begin Source File
SOURCE=.\external.c
# End Source File
# Begin Source File
SOURCE=.\fetch.c
# End Source File
# Begin Source File

View file

@ -54,7 +54,6 @@
#define DISP_POINTER 0x01 // defines for display area
#define DISP_MAIN 0x02
#define DISP_MENUE 0x04
#define DISP_ANNUN 0x08
#define ROMPAGESIZE (1<<12) // ROM dirty page size in nibbles
@ -182,7 +181,7 @@ extern VOID UpdateMainDisplay(VOID);
extern VOID UpdateMenuDisplay(VOID);
extern VOID WriteToMainDisplay(LPBYTE a, DWORD d, UINT s);
extern VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s);
extern VOID UpdateAnnunciators(VOID);
extern VOID UpdateAnnunciators(DWORD dwUpdateMask);
extern VOID ResizeWindow(VOID);
// Engine.c
@ -369,10 +368,6 @@ extern DWORD RPL_Pick(UINT l);
extern VOID RPL_Replace(DWORD n);
extern VOID RPL_Push(UINT l,DWORD n);
// External.c
extern VOID External(CHIPSET* w);
extern VOID RCKBp(CHIPSET* w);
// SndEnum.c
extern VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID);

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 © 2019 Christoph Gießelink && Sébastien Carlier",
LTEXT "Copyright © 2020 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 |
@ -723,8 +723,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,6,2,0
PRODUCTVERSION 1,6,2,0
FILEVERSION 1,6,3,0
PRODUCTVERSION 1,6,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -741,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, 2, 0\0"
VALUE "FileVersion", "1, 6, 3, 0\0"
VALUE "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2019\0"
VALUE "LegalCopyright", "Copyright © 2020\0"
VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 6, 2, 0\0"
VALUE "ProductVersion", "1, 6, 3, 0\0"
END
END
BLOCK "VarFileInfo"

View file

@ -281,7 +281,6 @@ static __inline VOID CheckDisp(BOOL bSync)
_ASSERT((disp & DISP_POINTER) == 0); // display pointer already updated
if (disp & DISP_MAIN) UpdateMainDisplay();
if (disp & DISP_MENUE) UpdateMenuDisplay();
_ASSERT((disp & DISP_ANNUN) == 0); // annunciators already updated
disp = 0; // display updated
return;
}
@ -568,7 +567,7 @@ loop:
UpdateDisplayPointers();
UpdateMainDisplay();
UpdateMenuDisplay();
UpdateAnnunciators();
UpdateAnnunciators(0x3F);
// init speed reference
dwOldCyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF);
QueryPerformanceCounter(&lDummyInt);

View file

@ -1,99 +0,0 @@
/*
* external.c
*
* This file is part of Emu48
*
* Copyright (C) 1995 Sebastien Carlier
* Copyright (C) 2005 Christoph Gießelink
*
*/
#include "pch.h"
#include "Emu48.h"
#include "ops.h"
//| 38G | 39G | 40G | 48SX | 48GX | 49G | Name
//#F0E4F #80F0F #80F0F #706D2 #80850 #80F0F =SFLAG53_56
// memory address for flags -53 to -56
#define SFLAG53_56 ( (cCurrentRomType=='6') \
? 0xE0E4F \
: ( (cCurrentRomType=='A') \
? 0xF0E4F \
: ( (cCurrentRomType!='E' && cCurrentRomType!='X') \
? ( (cCurrentRomType=='S') \
? 0x706D2 \
: 0x80850 \
) \
: 0x80F0F \
) \
) \
)
VOID External(CHIPSET* w) // Beep patch
{
BYTE fbeep;
DWORD freq,dur;
freq = Npack(w->D,5); // frequency in Hz
dur = Npack(w->C,5); // duration in ms
Nread(&fbeep,SFLAG53_56,1); // fetch system flags -53 to -56
w->carry = TRUE; // setting of no beep
if (!(fbeep & 0x8) && freq) // bit -56 clear and frequency > 0 Hz
{
if (freq > 4400) freq = 4400; // high limit of HP (SX)
SoundBeep(freq,dur); // beeping
// estimate cpu cycles for beeping time (2MHz / 4MHz)
w->cycles += dur * ((cCurrentRomType=='S') ? 2000 : 4000);
// original routine return with...
w->P = 0; // P=0
w->intk = TRUE; // INTON
w->carry = FALSE; // RTNCC
}
w->pc = rstkpop();
return;
}
VOID RCKBp(CHIPSET* w) // ROM Check Beep patch
{
DWORD dw2F,dwCpuFreq;
DWORD freq,dur;
BYTE f,d;
f = w->C[1]; // f = freq ctl
d = w->C[0]; // d = duration ctl
if (cCurrentRomType == 'S') // Clarke chip with 48S ROM
{
// CPU strobe frequency @ RATE 14 = 1.97MHz
dwCpuFreq = ((14 + 1) * 524288) >> 2;
dw2F = f * 126 + 262; // F=f*63+131
}
else // York chip with 48G and later ROM
{
// CPU strobe frequency @ RATE 27 = 3.67MHz
// CPU strobe frequency @ RATE 29 = 3.93MHz
dwCpuFreq = ((27 + 1) * 524288) >> 2;
dw2F = f * 180 + 367; // F=f*90+183.5
}
freq = dwCpuFreq / dw2F;
dur = (dw2F * (256 - 16 * d)) * 1000 / 2 / dwCpuFreq;
if (freq > 4400) freq = 4400; // high limit of HP
SoundBeep(freq,dur); // beeping
// estimate cpu cycles for beeping time (2MHz / 4MHz)
w->cycles += dur * ((cCurrentRomType=='S') ? 2000 : 4000);
w->P = 0; // P=0
w->carry = FALSE; // RTNCC
w->pc = rstkpop();
return;
}

View file

@ -321,7 +321,7 @@ static JMPTAB o8A_[] =
static JMPTAB o81B_[] =
{
(LPCVOID) o_invalid4, F,
(LPCVOID) o81B1, F, // normally o_invalid4, beep patch
(LPCVOID) o_invalid4, F,
(LPCVOID) o81B2, F,
(LPCVOID) o81B3, F,
(LPCVOID) o81B4, F,

View file

@ -1011,8 +1011,16 @@ BOOL OpenDocument(LPCTSTR szFilename)
case 0xFE: // Win48 2.1 / Emu4x 0.99.x format
// read length of KML script name
ReadFile(hFile,&nLength,sizeof(nLength),&lBytesRead,NULL);
// KML script name too long for file buffer
if (nLength >= ARRAYSIZEOF(szCurrentKml)) goto read_err;
if (nLength >= ARRAYSIZEOF(szCurrentKml))
{
// skip heading KML script name characters until remainder fits into file buffer
UINT nSkip = nLength - (ARRAYSIZEOF(szCurrentKml) - 1);
SetFilePointer(hFile, nSkip, NULL, FILE_CURRENT);
nLength = ARRAYSIZEOF(szCurrentKml) - 1;
}
#if defined _UNICODE
{
LPSTR szTmp = (LPSTR) malloc(nLength);
@ -2566,7 +2574,7 @@ static BOOL LabColorCmp(DWORD dwColor1,DWORD dwColor2,DWORD dwTol)
nDiffCol = (INT) (dwColor1 & 0xFF) - (INT) (dwColor2 & 0xFF);
dwDiff += (DWORD) (nDiffCol * nDiffCol);
dwTol *= dwTol;
return dwDiff > dwTol; // FALSE = colors match
}

View file

@ -2630,9 +2630,8 @@ BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog)
}
if (CheckForBeepPatch()) // check if ROM contain beep patches
{
AddToLog(_T("Warning, ROM beep patch detected. Remove beep patches please."));
bNoLog = FALSE;
bAlwaysDisplayLog = TRUE;
AddToLog(_T("Error, ROM beep patch detected. Remove beep patches please."));
goto quit;
}
ResizeMainBitmap(nScaleMul,nScaleDiv); // resize main picture

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1286,6 +1286,7 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s)
BOOL bDISPADDR = FALSE; // flag addr 0x120-0x124 changed
BOOL bLINEOFFS = FALSE; // flag addr 0x125-0x127 changed
BOOL bMENUADDR = FALSE; // flag addr 0x130-0x134 changed
DWORD dwAnnunciator = 0; // no annunciator write
#if defined DEBUG_IO
{
@ -1391,7 +1392,8 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s)
if (c & RST)
{
CpuReset(); // emulate NRES signal
disp |= (DISP_POINTER | DISP_MAIN | DISP_MENUE | DISP_ANNUN);
disp |= (DISP_POINTER | DISP_MAIN | DISP_MENUE);
dwAnnunciator = 0x3F; // update all annunciators
bInterrupt = TRUE; // SHUTDN
}
break;
@ -1404,11 +1406,9 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s)
// 0010B @ Annunciator control [LA4 LA3 LA2 LA1] = [ alarm alpha -> <- ]
case 0x0B:
case 0x0C:
if (c!=Chipset.IORam[d])
{
Chipset.IORam[d] = c;
disp |= DISP_ANNUN;
}
// annunciator changed
dwAnnunciator |= ((Chipset.IORam[d] ^c) << ((d - 0x0B) * 4)) & 0x3F;
Chipset.IORam[d] = c;
break;
// 0010D = NS:BAUD
@ -1727,7 +1727,7 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s)
StartTimers();
else
StopTimers();
disp |= DISP_ANNUN; // update annunciators
dwAnnunciator = 0x3F; // update all annunciators
break;
// 00130 = NS:MENUADDR
@ -1810,10 +1810,9 @@ finish:
disp &= ~DISP_POINTER; // display pointer updated
UpdateDisplayPointers();
}
if (disp & DISP_ANNUN)
if (dwAnnunciator)
{
disp &= ~DISP_ANNUN; // annunciators updated
UpdateAnnunciators();
UpdateAnnunciators(dwAnnunciator);
}
return;
}

View file

@ -2437,12 +2437,3 @@ VOID o_goyes5(LPBYTE I)
w.pc=rstkpop();
return;
}
//////// EXTENSIONS ////////
VOID o81B1(LPBYTE I) // beep patch
{
External(&w);
PCHANGED; // update field select table
return;
}
////////////////////////////

View file

@ -441,5 +441,3 @@ extern VOID o_invalid6(LPBYTE I);
extern VOID o_goyes3(LPBYTE I);
extern VOID o_goyes5(LPBYTE I);
extern VOID o81B1(LPBYTE I); // beep patch

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 © 2019 Christoph Gießelink && Sébastien Carlier",
LTEXT "Copyright © 2020 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 |
@ -374,7 +374,7 @@ BEGIN
CONTROL "Slider1",IDC_SOUND_SLIDER,"msctls_trackbar32",
TBS_AUTOTICKS | WS_TABSTOP,44,16,193,18
LTEXT "Device",IDC_STATIC,13,42,24,8
COMBOBOX IDC_SOUND_DEVICE,44,40,193,87,CBS_DROPDOWNLIST |
COMBOBOX IDC_SOUND_DEVICE,44,40,193,87,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "Sound",IDC_STATIC,7,7,237,54
LTEXT "IP Address:",IDC_STATIC,14,81,37,8
@ -670,16 +670,16 @@ BEGIN
LTEXT "Log File:",IDC_STATIC,7,13,28,8
EDITTEXT IDC_TRACE_FILE,39,11,180,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_TRACE_BROWSE,220,11,20,12
CONTROL "&New",IDC_TRACE_NEW,"Button",BS_AUTORADIOBUTTON |
CONTROL "&New",IDC_TRACE_NEW,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,16,49,41,10
CONTROL "&Append",IDC_TRACE_APPEND,"Button",BS_AUTORADIOBUTTON,
16,64,41,10
GROUPBOX "File Mode",IDC_STATIC,7,32,113,53
CONTROL "&Register",IDC_TRACE_REGISTER,"Button",BS_AUTOCHECKBOX |
CONTROL "&Register",IDC_TRACE_REGISTER,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,140,45,43,10
CONTROL "&MMU",IDC_TRACE_MMU,"Button",BS_AUTOCHECKBOX |
CONTROL "&MMU",IDC_TRACE_MMU,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,140,57,43,10
CONTROL "&Opcode",IDC_TRACE_OPCODE,"Button",BS_AUTOCHECKBOX |
CONTROL "&Opcode",IDC_TRACE_OPCODE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,140,69,43,10
GROUPBOX "Logging",IDC_STATIC,127,32,113,53
DEFPUSHBUTTON "OK",IDOK,62,92,50,14
@ -752,8 +752,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,6,2,0
PRODUCTVERSION 1,6,2,0
FILEVERSION 1,6,3,0
PRODUCTVERSION 1,6,3,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, 2, 0\0"
VALUE "FileVersion", "1, 6, 3, 0\0"
VALUE "InternalName", "Emu48\0"
VALUE "LegalCopyright", "Copyright © 2019\0"
VALUE "LegalCopyright", "Copyright © 2020\0"
VALUE "OriginalFilename", "Emu48.exe\0"
VALUE "ProductName", "Emu48\0"
VALUE "ProductVersion", "1, 6, 2, 0\0"
VALUE "ProductVersion", "1, 6, 3, 0\0"
END
END
BLOCK "VarFileInfo"

View file

@ -29,7 +29,7 @@ RSRC=$(PRJ).rc
RSRCOBJ=$(PRJ).o
OBJS=cursor.o ddeserv.o debugger.o disasm.o dismem.o display.o disrpl.o \
emu48.o engine.o external.o fetch.o files.o i28f160.o keyboard.o \
emu48.o engine.o fetch.o files.o i28f160.o keyboard.o \
keymacro.o kml.o lodepng.o lowbat.o mru.o mops.o opcodes.o \
redeye.o rpl.o serial.o settings.o sndenum.o sound.o stack.o \
symbfile.o timer.o udp.o \
@ -83,9 +83,6 @@ engine.o: engine.c pch.h emu48.h types.h opcodes.h \
io.h debugger.h
$(CC) $(CFLAGS) $(DEFINES) -c -o engine.o engine.c
external.o: external.c pch.h emu48.h types.h ops.h
$(CC) $(CFLAGS) $(DEFINES) -c -o external.o external.c
fetch.o: fetch.c pch.h opcodes.h
$(CC) $(CFLAGS) $(DEFINES) -c -o fetch.o fetch.c

View file

@ -67,4 +67,4 @@ Many thanks to Pedro A. Arranda Guti
compatible.
10/15/19 (c) by Christoph Gießelink
09/17/20 (c) by Christoph Gießelink

Binary file not shown.