2020-09-30: Updated to version 62
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
parent
b29959b1f3
commit
20ce3f59ed
22 changed files with 3031 additions and 2994 deletions
BIN
Emu48.dll
BIN
Emu48.dll
Binary file not shown.
BIN
Emu48.exe
BIN
Emu48.exe
Binary file not shown.
|
@ -83,7 +83,8 @@ h3 { color:red; font-size:1.1em; }
|
|||
<a href="#ss12.2">12.2 About Emu48...</a>
|
||||
</span></p>
|
||||
<p><a class="nav1" href="#s13">13. DDE Server</a></p>
|
||||
<p><a class="nav1" href="#s14">14. License</a></p>
|
||||
<p><a class="nav1" href="#s14">14. Emu48+ Changes</a></p>
|
||||
<p><a class="nav1" href="#s15">15. License</a></p>
|
||||
</div>
|
||||
<div id="main">
|
||||
<h1><a name=s1>1. General</a></h1>
|
||||
|
@ -395,19 +396,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 "KML Script Compilation
|
||||
Result" 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 "KML
|
||||
Script Compilation Result" 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
|
||||
|
@ -599,9 +595,51 @@ h3 { color:red; font-size:1.1em; }
|
|||
<td width="66%" align="center">HP object (normal HP object)</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1><a name=s14>14. License</a></h1>
|
||||
<h1><a name=s14>14. Emu48+ Changes</a></h1>
|
||||
<p>Emu48+ is a modified version of Emu48 to add support for the ARM-based
|
||||
calculators. It does not emulate the ARM CPU, but it enhances the
|
||||
Saturn emulation to more closely match the emulation provided by the
|
||||
Saturn emulator on the ARM-based calculators.</p>
|
||||
<p>Emu48+ adds support for many of the Saturn+ instructions, including
|
||||
some of the BUSCC instructions, and it also adds support for the 80-line
|
||||
display used on the 49g+ and 50g.</p>
|
||||
<p>At present, the additional calculators supported in Emu48+ are the
|
||||
49g+, 48gII (hardware revision 1), 50g, and 39g+/39gs/40gs.</p>
|
||||
<p>To create KML scripts for the additional calculator models, use the
|
||||
following model codes:</p>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="651" summary="DDE settings">
|
||||
<tr>
|
||||
<td width="111">39g+/39gs:</td>
|
||||
<td width="536">Model "P"<br>
|
||||
Class 39</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="111">40gs:</td>
|
||||
<td width="536">Model "P"<br>
|
||||
Class 40</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="111">48gII:</td>
|
||||
<td width="536">Model "2"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="111">49g+:</td>
|
||||
<td width="536">Model "Q"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="111">50g:</td>
|
||||
<td width="536">Model "Q"<br>
|
||||
Class 50</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Most of the code that was changed in Emu48+ over Emu48 was provided by
|
||||
Cyrille de Brebisson of Hewlett-Packard.</p>
|
||||
<h1><a name=s15>15. License</a></h1>
|
||||
<p>Emu48 - A HP38G/39G/40G/48SX/48GX/49G Emulator<br>
|
||||
Copyright (C) 2019 Christoph Gießelink</p>
|
||||
Copyright (C) 2020 Christoph Gießelink</p>
|
||||
<p>Emu48+ - A 39g+/39gs/40gs/48gII/49g+/50g Emulator<br>
|
||||
Copyright (C) 2020 Cyrille de Brebisson<br>
|
||||
Additional changes by Bill Graves and Eric Rechlin</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)
|
50
PROBLEMS.TXT
50
PROBLEMS.TXT
|
@ -1,50 +0,0 @@
|
|||
Known bugs and restrictions of Emu48 V1.62
|
||||
------------------------------------------
|
||||
|
||||
- the following I/O bits aren't emulated (incomplete)
|
||||
DTEST (0x102) [VDIG LID TRIM]
|
||||
DSPCTL (0x103) [LRT LRTD LRTC BIN]
|
||||
LPD (0x108) [LB2 LB1]
|
||||
LPE (0x109) [GRST RST]
|
||||
CMODE (0x10A) Mode register
|
||||
IOC (0x110) [ERBZ]
|
||||
RCS (0x111) [RX RER RBZ]
|
||||
SRQ1 (0x118) [ISQR]
|
||||
SRQ2 (0x119) [LSRQ]
|
||||
IRC (0x11A) [IRI EIRU EIRI IRE]
|
||||
LCR (0x11C) [LBZ LBF]
|
||||
- the baudrates 1920, 3840, 7680 and 15360 aren't emulated on most
|
||||
operating systems
|
||||
Windows 95a 1920, 3840, 7680 work, 15360 fail
|
||||
Windows 98, NT4.0, 2000, XP all baudrates fail
|
||||
- problems when receiving a break signal on the serial port
|
||||
Windows 98, NT4.0 SP4 no retrigger on port open
|
||||
Windows 98 timing problems setting the RER bit
|
||||
Windows 2000 SP2 no known problems
|
||||
- System-RPL commands VERYVERYSLOW, VERYSLOW and SLOW depends on PC
|
||||
speed (are realized as simple down counter in ROM)
|
||||
- display updating differs from the real machine
|
||||
- screen VBL counter values may skip after large display operations
|
||||
like turning on or updating the whole display
|
||||
- read on an unconfigured address (open data bus) will not show the
|
||||
same value like a real calculator
|
||||
- the Yorke hardware signals BEN and DA19 aren't fully supported,
|
||||
because the emulator don't use a multiplexed AR18 / NCE3 data line
|
||||
-> all programs that run on a real calculator will run as well,
|
||||
programs with incorrect DA19 / BEN handling may run on the
|
||||
emulator but will crash on a real calculator
|
||||
- incomplete reset logic of the bank switcher FF, on real
|
||||
calculators a reset happen after about 4s in deep sleep, in the
|
||||
emulator this happens immediately
|
||||
- no MP interrupt on card control circuit or timer restart
|
||||
- Shell OS: clock isn't synchronized with real time
|
||||
- HP49G: the flash memory is emulated now with some restrictions
|
||||
- no flash programming times, the flash state machine returns
|
||||
immediately the ready signal
|
||||
- only one write buffer, second not needed because of prior reason
|
||||
- not fully tested, especially the status byte may return
|
||||
incorrect values (error bits)
|
||||
- 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
|
|
@ -158,6 +158,35 @@ VOID o80B40(VOID)
|
|||
return;
|
||||
}
|
||||
|
||||
// BEEP2
|
||||
VOID o80B50(CHIPSET* w)
|
||||
{
|
||||
BYTE fbeep;
|
||||
DWORD freq,dur;
|
||||
|
||||
freq = Npack(w->D,5); // frequency in Hz
|
||||
dur = Npack(w->C,5); // duration in ms
|
||||
Nread(&fbeep,0x80F0F,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 (4MHz)
|
||||
w->cycles += dur * 4000;
|
||||
|
||||
// original routine return with...
|
||||
w->P = 0; // P=0
|
||||
w->intk = TRUE; // INTON
|
||||
w->carry = FALSE; // RTNCC
|
||||
}
|
||||
w->pc = rstkpop();
|
||||
return;
|
||||
}
|
||||
|
||||
// MOVEDOWN
|
||||
VOID o80B60(VOID)
|
||||
{
|
||||
|
@ -230,6 +259,38 @@ VOID o80B80(VOID)
|
|||
return;
|
||||
}
|
||||
|
||||
// RCKBp
|
||||
VOID o80B90(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
|
||||
|
||||
// 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 (4MHz)
|
||||
w->cycles += dur * 4000;
|
||||
|
||||
w->P = 0; // P=0
|
||||
w->carry = FALSE; // RTNCC
|
||||
w->pc = rstkpop();
|
||||
return;
|
||||
}
|
||||
|
||||
// setup basic memory configuration
|
||||
VOID o80B04(VOID)
|
||||
{
|
||||
|
@ -327,11 +388,11 @@ VOID o80BExt(LPBYTE I) // Saturnator extentions
|
|||
case 0x00: o80B00(); break; // RPL2 (preserve Carry)
|
||||
case 0x03: o80B30(); break; // FALSE
|
||||
case 0x04: o80B40(); break; // DOFALSE
|
||||
case 0x05: External(&w); PCHANGED; break; // BEEP2 implemented using Emu48's beep
|
||||
case 0x05: o80B50(&w); PCHANGED; break; // BEEP2 implemented using Emu48's beep
|
||||
case 0x06: o80B60(); break; // MOVEDOWN
|
||||
case 0x07: o80B70(); break; // MOVEUP
|
||||
case 0x08: o80B80(); break; // CREATETEMP
|
||||
case 0x09: RCKBp(&w); PCHANGED; break; // RCKBp
|
||||
case 0x09: o80B90(&w); PCHANGED; break; // RCKBp (ROM Check Beep patch)
|
||||
case 0x0A: break; // KEYDN not implemented
|
||||
case 0x0B: break; // no doslow implemented
|
||||
case 0x10: // simulate off function
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
extern VOID o80B00(VOID);
|
||||
extern VOID o80B30(VOID);
|
||||
extern VOID o80B40(VOID);
|
||||
extern VOID o80B50(CHIPSET* w);
|
||||
extern VOID o80B60(VOID);
|
||||
extern VOID o80B70(VOID);
|
||||
extern VOID o80B80(VOID);
|
||||
extern VOID o80B90(CHIPSET* w);
|
||||
extern VOID o80B04(VOID);
|
||||
extern VOID o80B14(VOID);
|
||||
extern VOID o80B24(VOID);
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
Service Pack 61+ based on Emu48 Service Pack 62
|
||||
Service Pack 62+ based on Emu48 Service Pack 63
|
||||
|
||||
See CHANGES.TXT in Emu48 for full history.
|
||||
Only changes specifically made to Emu48+ are shown below.
|
||||
|
||||
APPLE.C
|
||||
APPLE.H
|
||||
- Moved BEEP2 and RCKBp here to match other Apple opcodes
|
||||
|
||||
Service Pack 60+ for Emu48 Version 1.0
|
||||
|
||||
DISPLAY.C
|
||||
|
|
|
@ -589,21 +589,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "kml.h"
|
||||
#include "debugger.h"
|
||||
|
||||
#define VERSION "1.61+"
|
||||
#define VERSION "1.62+"
|
||||
|
||||
#ifdef _DEBUG
|
||||
LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug");
|
||||
|
@ -904,7 +904,7 @@ static LRESULT OnPaint(HWND hWindow)
|
|||
GdiFlush();
|
||||
}
|
||||
LeaveCriticalSection(&csGDILock);
|
||||
UpdateAnnunciators();
|
||||
UpdateAnnunciators(0x3F);
|
||||
RefreshButtons(&rcMainPaint);
|
||||
}
|
||||
EndPaint(hWindow, &Paint);
|
||||
|
|
|
@ -253,10 +253,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
|
||||
|
|
|
@ -52,7 +52,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 UpdateMenuDisplay(VOID);
|
|||
extern VOID RefreshDisp0(); // CdB for HP: add apples display management
|
||||
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
|
||||
|
@ -374,10 +373,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);
|
||||
|
||||
|
|
|
@ -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,1,0
|
||||
PRODUCTVERSION 1,6,1,0
|
||||
FILEVERSION 1,6,2,0
|
||||
PRODUCTVERSION 1,6,2,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/50 Emulator\0"
|
||||
VALUE "FileVersion", "1, 6, 1, 0\0"
|
||||
VALUE "InternalName", "Emu48\0"
|
||||
VALUE "LegalCopyright", "Copyright © 2019\0"
|
||||
VALUE "FileVersion", "1, 6, 2, 0\0"
|
||||
VALUE "InternalName", "Emu48+\0"
|
||||
VALUE "LegalCopyright", "Copyright © 2020\0"
|
||||
VALUE "OriginalFilename", "Emu48.exe\0"
|
||||
VALUE "ProductName", "Emu48\0"
|
||||
VALUE "ProductVersion", "1, 6, 1, 0\0"
|
||||
VALUE "ProductName", "Emu48+\0"
|
||||
VALUE "ProductVersion", "1, 6, 2, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -140,10 +140,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
|
||||
|
|
|
@ -285,7 +285,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;
|
||||
}
|
||||
|
@ -599,7 +598,7 @@ loop:
|
|||
UpdateMainDisplay();
|
||||
UpdateMenuDisplay();
|
||||
RefreshDisp0(); // CdB for HP: add apples display management
|
||||
UpdateAnnunciators();
|
||||
UpdateAnnunciators(0x3F);
|
||||
// init speed reference
|
||||
dwOldCyc = (DWORD) (Chipset.cycles & 0xFFFFFFFF);
|
||||
QueryPerformanceCounter(&lDummyInt);
|
||||
|
|
|
@ -1,100 +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
|
||||
// CdB for HP: add apples beep management
|
||||
#define SFLAG53_56 ( (cCurrentRomType=='6') \
|
||||
? 0xE0E4F \
|
||||
: ( (cCurrentRomType=='A') \
|
||||
? 0xF0E4F \
|
||||
: ( (cCurrentRomType!='E' && cCurrentRomType!='X' && cCurrentRomType!='P' && cCurrentRomType!='2' && cCurrentRomType!='Q') \
|
||||
? ( (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;
|
||||
}
|
|
@ -321,7 +321,7 @@ static JMPTAB o8A_[] =
|
|||
static JMPTAB o81B_[] =
|
||||
{
|
||||
(LPCVOID) o_invalid4, F,
|
||||
(LPCVOID) o81B1, F, // normally o_invalid4, beep patch, Apple: LOOP
|
||||
(LPCVOID) o81B1, F, // normally o_invalid4, Apple: LOOP
|
||||
(LPCVOID) o81B2, F,
|
||||
(LPCVOID) o81B3, F,
|
||||
(LPCVOID) o81B4, F,
|
||||
|
|
|
@ -1017,8 +1017,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);
|
||||
|
|
|
@ -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
|
||||
|
|
1738
source/LODEPNG.C
1738
source/LODEPNG.C
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
LodePNG version 20190914
|
||||
LodePNG version 20200306
|
||||
|
||||
Copyright (c) 2005-2019 Lode Vandevenne
|
||||
Copyright (c) 2005-2020 Lode Vandevenne
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -335,17 +335,19 @@ typedef struct LodePNGColorMode {
|
|||
palette (PLTE and tRNS)
|
||||
|
||||
Dynamically allocated with the colors of the palette, including alpha.
|
||||
When encoding a PNG, to store your colors in the palette of the LodePNGColorMode, first use
|
||||
lodepng_palette_clear, then for each color use lodepng_palette_add.
|
||||
If you encode an image without alpha with palette, don't forget to put value 255 in each A byte of the palette.
|
||||
This field may not be allocated directly, use lodepng_color_mode_init first,
|
||||
then lodepng_palette_add per color to correctly initialize it (to ensure size
|
||||
of exactly 1024 bytes).
|
||||
|
||||
The alpha channels must be set as well, set them to 255 for opaque images.
|
||||
|
||||
When decoding, by default you can ignore this palette, since LodePNG already
|
||||
fills the palette colors in the pixels of the raw RGBA output.
|
||||
|
||||
The palette is only supported for color type 3.
|
||||
*/
|
||||
unsigned char* palette; /*palette in RGBARGBA... order. When allocated, must be either 0, or have size 1024*/
|
||||
size_t palettesize; /*palette size in number of colors (amount of bytes is 4 * palettesize)*/
|
||||
unsigned char* palette; /*palette in RGBARGBA... order. Must be either 0, or when allocated must have 1024 bytes*/
|
||||
size_t palettesize; /*palette size in number of colors (amount of used bytes is 4 * palettesize)*/
|
||||
|
||||
/*
|
||||
transparent color key (tRNS)
|
||||
|
@ -691,20 +693,11 @@ typedef struct LodePNGColorStats {
|
|||
|
||||
void lodepng_color_stats_init(LodePNGColorStats* stats);
|
||||
|
||||
/*Get a LodePNGColorStats of the image. The stats must already have been inited.*/
|
||||
void lodepng_compute_color_stats(LodePNGColorStats* stats,
|
||||
const unsigned char* image, unsigned w, unsigned h,
|
||||
const LodePNGColorMode* mode_in);
|
||||
/*Computes a minimal PNG color model that can contain all colors as indicated by the stats and it settings.
|
||||
The stats should be computed with lodepng_compute_color_stats.
|
||||
mode_in is raw color profile of the image the stats were computed on, to copy palette order from when relevant.
|
||||
Minimal PNG color model means the color type and bit depth that gives smallest amount of bits in the output image,
|
||||
e.g. gray if only grayscale pixels, palette if less than 256 colors, color key if only single transparent color, ...
|
||||
LodePNG uses this function internally if auto_convert is enabled (it is by default).
|
||||
*/
|
||||
unsigned lodepng_auto_choose_color(LodePNGColorMode* mode_out,
|
||||
const LodePNGColorMode* mode_in,
|
||||
const LodePNGColorMode* stats);
|
||||
/*Get a LodePNGColorStats of the image. The stats must already have been inited.
|
||||
Returns error code (e.g. alloc fail) or 0 if ok.*/
|
||||
unsigned lodepng_compute_color_stats(LodePNGColorStats* stats,
|
||||
const unsigned char* image, unsigned w, unsigned h,
|
||||
const LodePNGColorMode* mode_in);
|
||||
|
||||
/*Settings for the encoder.*/
|
||||
typedef struct LodePNGEncoderSettings {
|
||||
|
@ -753,10 +746,6 @@ typedef struct LodePNGState {
|
|||
LodePNGColorMode info_raw; /*specifies the format in which you would like to get the raw pixel buffer*/
|
||||
LodePNGInfo info_png; /*info of the PNG image obtained after decoding*/
|
||||
unsigned error;
|
||||
#ifdef LODEPNG_COMPILE_CPP
|
||||
/* For the lodepng::State subclass. */
|
||||
virtual ~LodePNGState(){}
|
||||
#endif
|
||||
} LodePNGState;
|
||||
|
||||
/*init, cleanup and copy functions to use with this struct*/
|
||||
|
@ -868,32 +857,32 @@ Input must be at the beginning of a chunk (result of a previous lodepng_chunk_ne
|
|||
or the 8th byte of a PNG file which always has the first chunk), or alternatively may
|
||||
point to the first byte of the PNG file (which is not a chunk but the magic header, the
|
||||
function will then skip over it and return the first real chunk).
|
||||
Expects at least 8 readable bytes of memory in the input pointer.
|
||||
Will output pointer to the start of the next chunk or the end of the file if there
|
||||
is no more chunk after this. Start this process at the 8th byte of the PNG file.
|
||||
Will output pointer to the start of the next chunk, or at or beyond end of the file if there
|
||||
is no more chunk after this or possibly if the chunk is corrupt.
|
||||
Start this process at the 8th byte of the PNG file.
|
||||
In a non-corrupt PNG file, the last chunk should have name "IEND".
|
||||
*/
|
||||
unsigned char* lodepng_chunk_next(unsigned char* chunk);
|
||||
const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk);
|
||||
unsigned char* lodepng_chunk_next(unsigned char* chunk, unsigned char* end);
|
||||
const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk, const unsigned char* end);
|
||||
|
||||
/*Finds the first chunk with the given type in the range [chunk, end), or returns NULL if not found.*/
|
||||
unsigned char* lodepng_chunk_find(unsigned char* chunk, const unsigned char* end, const char type[5]);
|
||||
unsigned char* lodepng_chunk_find(unsigned char* chunk, unsigned char* end, const char type[5]);
|
||||
const unsigned char* lodepng_chunk_find_const(const unsigned char* chunk, const unsigned char* end, const char type[5]);
|
||||
|
||||
/*
|
||||
Appends chunk to the data in out. The given chunk should already have its chunk header.
|
||||
The out variable and outlength are updated to reflect the new reallocated buffer.
|
||||
The out variable and outsize are updated to reflect the new reallocated buffer.
|
||||
Returns error code (0 if it went ok)
|
||||
*/
|
||||
unsigned lodepng_chunk_append(unsigned char** out, size_t* outlength, const unsigned char* chunk);
|
||||
unsigned lodepng_chunk_append(unsigned char** out, size_t* outsize, const unsigned char* chunk);
|
||||
|
||||
/*
|
||||
Appends new chunk to out. The chunk to append is given by giving its length, type
|
||||
and data separately. The type is a 4-letter string.
|
||||
The out variable and outlength 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)
|
||||
*/
|
||||
unsigned lodepng_chunk_create(unsigned char** out, size_t* outlength, unsigned length,
|
||||
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize, unsigned length,
|
||||
const char* type, const unsigned char* data);
|
||||
|
||||
|
||||
|
@ -983,7 +972,7 @@ class State : public LodePNGState {
|
|||
public:
|
||||
State();
|
||||
State(const State& other);
|
||||
virtual ~State();
|
||||
~State();
|
||||
State& operator=(const State& other);
|
||||
};
|
||||
|
||||
|
@ -1065,8 +1054,7 @@ TODO:
|
|||
[ ] let the C++ wrapper catch exceptions coming from the standard library and return LodePNG error codes
|
||||
[ ] allow user to provide custom color conversion functions, e.g. for premultiplied alpha, padding bits or not, ...
|
||||
[ ] allow user to give data (void*) to custom allocator
|
||||
[ ] provide alternatives for C library functions not present on some platforms (memcpy, ...)
|
||||
[ ] rename "grey" to "gray" everywhere since "color" also uses US spelling (keep "grey" copies for backwards compatibility)
|
||||
[X] provide alternatives for C library functions not present on some platforms (memcpy, ...)
|
||||
*/
|
||||
|
||||
#endif /*LODEPNG_H inclusion guard*/
|
||||
|
@ -1582,12 +1570,12 @@ Iterate to the next chunk. This works if you have a buffer with consecutive chun
|
|||
functions do no boundary checking of the allocated data whatsoever, so make sure there is enough
|
||||
data available in the buffer to be able to go to the next chunk.
|
||||
|
||||
unsigned lodepng_chunk_append(unsigned char** out, size_t* outlength, const unsigned char* chunk):
|
||||
unsigned lodepng_chunk_create(unsigned char** out, size_t* outlength, unsigned length,
|
||||
unsigned lodepng_chunk_append(unsigned char** out, size_t* outsize, const unsigned char* chunk):
|
||||
unsigned lodepng_chunk_create(unsigned char** out, size_t* outsize, unsigned length,
|
||||
const char* type, const unsigned char* data):
|
||||
|
||||
These functions are used to create new chunks that are appended to the data in *out that has
|
||||
length *outlength. The append function appends an existing chunk to the new data. The create
|
||||
length *outsize. The append function appends an existing chunk to the new data. The create
|
||||
function creates a new chunk with the given parameters and appends it. Type is the 4-letter
|
||||
name of the chunk.
|
||||
|
||||
|
@ -1787,14 +1775,18 @@ symbol.
|
|||
Not all changes are listed here, the commit history in github lists more:
|
||||
https://github.com/lvandeve/lodepng
|
||||
|
||||
*) 06 mar 2020: simplified some of the dynamic memory allocations.
|
||||
*) 12 jan 2020: (!) added 'end' argument to lodepng_chunk_next to allow correct
|
||||
overflow checks.
|
||||
*) 14 aug 2019: around 25% faster decoding thanks to huffman lookup tables.
|
||||
*) 15 jun 2019 (!): auto_choose_color API changed (for bugfix: don't use palette
|
||||
if gray ICC profile) and non-ICC LodePNGColorProfile renamed to LodePNGColorStats.
|
||||
*) 15 jun 2019: (!) auto_choose_color API changed (for bugfix: don't use palette
|
||||
if gray ICC profile) and non-ICC LodePNGColorProfile renamed to
|
||||
LodePNGColorStats.
|
||||
*) 30 dec 2018: code style changes only: removed newlines before opening braces.
|
||||
*) 10 sep 2018: added way to inspect metadata chunks without full decoding.
|
||||
*) 19 aug 2018 (!): fixed color mode bKGD is encoded with and made it use
|
||||
*) 19 aug 2018: (!) fixed color mode bKGD is encoded with and made it use
|
||||
palette index in case of palette.
|
||||
*) 10 aug 2018 (!): added support for gAMA, cHRM, sRGB and iCCP chunks. This
|
||||
*) 10 aug 2018: (!) added support for gAMA, cHRM, sRGB and iCCP chunks. This
|
||||
change is backwards compatible unless you relied on unknown_chunks for those.
|
||||
*) 11 jun 2018: less restrictive check for pixel size integer overflow
|
||||
*) 14 jan 2018: allow optionally ignoring a few more recoverable errors
|
||||
|
@ -1814,25 +1806,25 @@ https://github.com/lvandeve/lodepng
|
|||
*) 22 dec 2013: Power of two windowsize required for optimization.
|
||||
*) 15 apr 2013: Fixed bug with LAC_ALPHA and color key.
|
||||
*) 25 mar 2013: Added an optional feature to ignore some PNG errors (fix_png).
|
||||
*) 11 mar 2013 (!): Bugfix with custom free. Changed from "my" to "lodepng_"
|
||||
*) 11 mar 2013: (!) Bugfix with custom free. Changed from "my" to "lodepng_"
|
||||
prefix for the custom allocators and made it possible with a new #define to
|
||||
use custom ones in your project without needing to change lodepng's code.
|
||||
*) 28 jan 2013: Bugfix with color key.
|
||||
*) 27 okt 2012: Tweaks in text chunk keyword length error handling.
|
||||
*) 8 okt 2012 (!): Added new filter strategy (entropy) and new auto color mode.
|
||||
*) 8 okt 2012: (!) Added new filter strategy (entropy) and new auto color mode.
|
||||
(no palette). Better deflate tree encoding. New compression tweak settings.
|
||||
Faster color conversions while decoding. Some internal cleanups.
|
||||
*) 23 sep 2012: Reduced warnings in Visual Studio a little bit.
|
||||
*) 1 sep 2012 (!): Removed #define's for giving custom (de)compression functions
|
||||
*) 1 sep 2012: (!) Removed #define's for giving custom (de)compression functions
|
||||
and made it work with function pointers instead.
|
||||
*) 23 jun 2012: Added more filter strategies. Made it easier to use custom alloc
|
||||
and free functions and toggle #defines from compiler flags. Small fixes.
|
||||
*) 6 may 2012 (!): Made plugging in custom zlib/deflate functions more flexible.
|
||||
*) 22 apr 2012 (!): Made interface more consistent, renaming a lot. Removed
|
||||
*) 6 may 2012: (!) Made plugging in custom zlib/deflate functions more flexible.
|
||||
*) 22 apr 2012: (!) Made interface more consistent, renaming a lot. Removed
|
||||
redundant C++ codec classes. Reduced amount of structs. Everything changed,
|
||||
but it is cleaner now imho and functionality remains the same. Also fixed
|
||||
several bugs and shrunk the implementation code. Made new samples.
|
||||
*) 6 nov 2011 (!): By default, the encoder now automatically chooses the best
|
||||
*) 6 nov 2011: (!) By default, the encoder now automatically chooses the best
|
||||
PNG color model and bit depth, based on the amount and type of colors of the
|
||||
raw image. For this, autoLeaveOutAlphaChannel replaced by auto_choose_color.
|
||||
*) 9 okt 2011: simpler hash chain implementation for the encoder.
|
||||
|
@ -1841,7 +1833,7 @@ https://github.com/lvandeve/lodepng
|
|||
A bug with the PNG filtertype heuristic was fixed, so that it chooses much
|
||||
better ones (it's quite significant). A setting to do an experimental, slow,
|
||||
brute force search for PNG filter types is added.
|
||||
*) 17 aug 2011 (!): changed some C zlib related function names.
|
||||
*) 17 aug 2011: (!) changed some C zlib related function names.
|
||||
*) 16 aug 2011: made the code less wide (max 120 characters per line).
|
||||
*) 17 apr 2011: code cleanup. Bugfixes. Convert low to 16-bit per sample colors.
|
||||
*) 21 feb 2011: fixed compiling for C90. Fixed compiling with sections disabled.
|
||||
|
@ -1949,5 +1941,5 @@ Domain: gmail dot com.
|
|||
Account: lode dot vandevenne.
|
||||
|
||||
|
||||
Copyright (c) 2005-2019 Lode Vandevenne
|
||||
Copyright (c) 2005-2020 Lode Vandevenne
|
||||
*/
|
||||
|
|
|
@ -1307,6 +1307,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
|
||||
{
|
||||
|
@ -1412,7 +1413,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;
|
||||
|
@ -1425,11 +1427,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
|
||||
|
@ -1759,7 +1759,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
|
||||
|
@ -1842,10 +1842,9 @@ finish:
|
|||
disp &= ~DISP_POINTER; // display pointer updated
|
||||
UpdateDisplayPointers();
|
||||
}
|
||||
if (disp & DISP_ANNUN)
|
||||
if (dwAnnunciator)
|
||||
{
|
||||
disp &= ~DISP_ANNUN; // annunciators updated
|
||||
UpdateAnnunciators();
|
||||
UpdateAnnunciators(dwAnnunciator);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2444,7 +2444,7 @@ VOID o_goyes5(LPBYTE I)
|
|||
}
|
||||
|
||||
//////// EXTENSIONS ////////
|
||||
VOID o81B1(LPBYTE I) // beep patch
|
||||
VOID o81B1(LPBYTE I)
|
||||
{
|
||||
if (cCurrentRomType=='Q' || cCurrentRomType=='2' || cCurrentRomType=='P')
|
||||
{
|
||||
|
@ -2454,9 +2454,8 @@ VOID o81B1(LPBYTE I) // beep patch
|
|||
}
|
||||
else
|
||||
{
|
||||
// Emu48 borrows this opcode for the beep patch on the non-ARM-based calculators
|
||||
External(&w); // beep patch
|
||||
PCHANGED; // update field select table
|
||||
// this opcode was used for the beep patch on the non-ARM-based calculators, not used any more
|
||||
o_invalid4(I);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue