Merged from cm630 branch for "Pravets" clone support

This commit is contained in:
tomch 2008-06-20 23:47:25 +00:00
parent da57609f87
commit 6016fcc12a
31 changed files with 789 additions and 144 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="Windows-1252"?>
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
@ -385,6 +385,14 @@
RelativePath=".\source\Speaker.h"
>
</File>
<File
RelativePath=".\source\Tape.cpp"
>
</File>
<File
RelativePath=".\source\Tape.h"
>
</File>
<File
RelativePath=".\source\Util_MemoryTextFile.cpp"
>
@ -680,6 +688,10 @@
RelativePath=".\resource\Parallel.rom"
>
</File>
<File
RelativePath=".\resource\Pravets8C.rom"
>
</File>
<File
RelativePath="RESOURCE\RUN.BMP"
>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="Windows-1252"?>
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
@ -393,6 +393,14 @@
RelativePath=".\source\Speaker.h"
>
</File>
<File
RelativePath=".\source\Tape.cpp"
>
</File>
<File
RelativePath=".\source\Tape.h"
>
</File>
<File
RelativePath=".\source\Util_MemoryTextFile.cpp"
>
@ -604,14 +612,42 @@
RelativePath="RESOURCE\CAPSON.BMP"
>
</File>
<File
RelativePath=".\resource\CHARIDNICATOR_82.BMP"
>
</File>
<File
RelativePath=".\resource\CHARIDNICATOR_8C.BMP"
>
</File>
<File
RelativePath=".\resource\CHARIDNICATOR_APPLE.BMP"
>
</File>
<File
RelativePath="RESOURCE\CHARSET4.BMP"
>
</File>
<File
RelativePath=".\resource\CHARSET82.bmp"
>
</File>
<File
RelativePath=".\resource\CHARSET8C.bmp"
>
</File>
<File
RelativePath="RESOURCE\COLOR.BMP"
>
</File>
<File
RelativePath=".\resource\CYROFF.BMP"
>
</File>
<File
RelativePath=".\resource\CYRON.BMP"
>
</File>
<File
RelativePath="RESOURCE\DEBUG.BMP"
>
@ -672,6 +708,10 @@
RelativePath="RESOURCE\RUN.BMP"
>
</File>
<File
RelativePath=".\resource\RUNP.BMP"
>
</File>
<File
RelativePath="RESOURCE\SETUP.BMP"
>

View File

@ -17,6 +17,15 @@ Restrictions/bugs:
- SSI263 emulation is very basic: there is no attempt to emulate rate, inflection or filters.
- During Mockingboard playback, Speaker emulation isn't precise
1.14.1.2 PR - 20 Apr 2008
----------------------------
. Support for Pravets 82. Caps Lock serves as Lat/Cyr lock. The charset still needs a little fix (all characters have to be one row down).
. Some partial support for Pravets 8A. Caps Lock serves as Lat/Cyr lock, and F10 serves as Caps Lock.
In Pravets 8A mode the former behaviour of the F10 key is preserved as Ctrl+F10 (see Help/Keyboard for details).
Extended Basic and Miniassembler work, but there are still problems with the 8 bit charset (Ïàðèñ [Parris] does not switch to latin characters).
Some keys have to be remapped, because currently they are not available (i.e. Ý). There is still the problem that there is not enough space for this key on the keyboard.
. Added Send to CiderPress function via the popup menu of the drive buttons.
1.14.1.2 - 2 Dec 2007 (beta)
----------------------------
. Change: Removed crosshairs in mouse-mode

View File

@ -1,78 +1,79 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Using the Keyboard</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body style="FONT-FAMILY: verdana; BACKGROUND-COLOR: rgb(255,255,255)" alink="#008000"
link="#008000" vlink="#008000">
<h2 style="COLOR: rgb(0,128,0)">Using the Keyboard</h2>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>Using the Keyboard</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></head>
<body style="font-family: verdana; background-color: rgb(255, 255, 255);" alink="#008000" link="#008000" vlink="#008000">
<h2 style="color: rgb(0, 128, 0);">Using the Keyboard</h2>
<hr size="4">
<p>The Apple //e keyboard was very similar to the PC keyboard, and most keys
correspond directly between the two keyboards. However, there were a few keys
on the Apple //e that are not on the PC; these are described below:</p>
<p><span style="FONT-WEIGHT: bold">Reset</span>:<br>
<p><span style="font-weight: bold;">Reset</span>:<br>
On the Apple //e, you could usually press Control+Reset to interrupt a running
program. With the Apple //e Emulator, you may emulate this key sequence with
<span style="FONT-STYLE: italic">Ctrl+Break</span>.
<span style="font-style: italic;">Ctrl+Break</span>.
</p>
<p><span style="FONT-WEIGHT: bold">Open Apple:</span><br>
<p><span style="font-weight: bold;">Open Apple:</span><br>
The Open Apple key was first introduced in the Apple //e, and was later renamed
to the Apple key. It was similar to
<span style="FONT-STYLE: italic">Ctrl</span>
<span style="font-style: italic;">Ctrl</span>
and
<span style="FONT-STYLE: italic">Alt</span>
<span style="font-style: italic;">Alt</span>
on a PC, in that it was used in conjunction with other keys. This key is
emulated with the PC's left
<span style="FONT-STYLE: italic">Alt</span>
<span style="font-style: italic;">Alt</span>
key, which is in the same position as the Open Apple key on the original //e.
</p>
<p><span style="FONT-WEIGHT: bold">Solid Apple:</span><br>
<p><span style="font-weight: bold;">Solid Apple:</span><br>
The Solid Apple key was introduced on the Apple //e and later renamed to the
Option key. This key is emulated with the PC's right
<span style="FONT-STYLE: italic">Alt</span>
<span style="font-style: italic;">Alt</span>
key, which is in the same position as the Solid Apple key on the original //e.
</p>
<p><span style="FONT-WEIGHT: bold">Numeric Keypad:</span><br>
<p><span style="font-weight: bold;">Numeric Keypad:</span><br>
The numeric keypad, introduced on the Extended Keyboard //e, is emulated
through the PC's numeric keypad. To enable this feature, turn on
<span style="FONT-STYLE: italic">Num Lock </span>and make sure the joystick
<span style="font-style: italic;">Num Lock </span>and make sure the joystick
emulation is configured to use something other than the keyboard.
</p>
<p><span style="FONT-WEIGHT: bold">Pause:</span><br>
<p><span style="font-weight: bold;">Pause:</span><br>
Pressing the PC's
<span style="FONT-STYLE: italic">Pause</span>
<span style="font-style: italic;">Pause</span>
key will pause emulation. Press
<span style="FONT-STYLE: italic">Pause</span>
<span style="font-style: italic;">Pause</span>
again to resume emulation.</p>
<p><span style="FONT-WEIGHT: bold">Scroll Lock:</span><br>
<p><span style="font-weight: bold;">Scroll Lock:</span><br>
Holding down the PC's
<span style="FONT-STYLE: italic">Scroll
<span style="font-style: italic;">Scroll
Lock</span>
key temporarily sets the emulation to full speed (i.e. unthrottled).<br>
NOTE:&nbsp; The status of the PC's
<span style="FONT-STYLE: italic">Scroll Lock</span>
<span style="font-style: italic;">Scroll Lock</span>
LED is meaningless.&nbsp; The emulator will only run full-speed while the
<span style="FONT-STYLE: italic">Scroll Lock</span>
<span style="font-style: italic;">Scroll Lock</span>
key is pressed down.</p>
<P><SPAN style="FONT-WEIGHT: bold">Shift+Insert:</SPAN><BR>
<p><span style="font-weight: bold;">Shift+Insert:</span><br>
Paste text from Windows' clipboard. Text gets fed a character at a time to the
Apple's keyboard hardware. The 'CR+LF' combination&nbsp;gets converted to CR.</P>
<P>
<span style="FONT-WEIGHT: bold">Function Keys
Apple's keyboard hardware. The 'CR+LF' combination&nbsp;gets converted to CR.</p>
<p>
<span style="font-weight: bold;">Function Keys
F1-F8:</span><br>
These PC function keys correspond to buttons on the <a href="toolbar.html">toolbar</a>.</P>
<p><span style="FONT-WEIGHT: bold">Function Key F9:</span><br>
These PC function keys correspond to buttons on the <a href="toolbar.html">toolbar</a>.</p>
<p><span style="font-weight: bold;">Function Key F9:</span><br>
This PC function key will cycle through AppleWin's display modes:&nbsp;
monochrome (custom), color (normal), color (text optimized), color (TV
emulation), etc. This shortcut allows you to switch display modes without going
through the configuration dialog.</p>
<p><span style="FONT-WEIGHT: bold">Function Key F10 (or
through the configuration dialog.</p><span style="font-weight: bold;">Function Key F9 + Ctrl:<br></span>This
PC function key will cycle through AppleWin's character sets:&nbsp;
original Apple II charsets and clones' charsets. This shortcut allows
you to override the default character sets of the Apple II model or clone.
<p><span style="font-weight: bold;">Function Key F10 (or
Ctrl+left mouse button):</span><br>
This PC function key will stop emulating an Apple joystick with the PC's mouse.</p>
<p><span style="FONT-WEIGHT: bold">Function Keys
This PC function key will stop emulating an Apple joystick with the PC's mouse.<br>In
Pravets 8A emulation mode it servers as Caps Lock and Ctrl+ F10 shall
be used to stop emulating an Apple joystick with the PC's mouse.</p>
<p><span style="font-weight: bold;">Function Keys
F11-F12:</span><br>
These PC function keys correspond to saving/loading a <a href="savestate.html">save-state</a>
file.</p>
</body>
</html>
</body></html>

View File

@ -54,17 +54,26 @@ END
FULLSCR_BUTTON BITMAP "FULLSCR.BMP"
RUN_BUTTON BITMAP "RUN.BMP"
RUNP_BUTTON BITMAP "RUNP.BMP"
DEBUG_BUTTON BITMAP "DEBUG.BMP"
DRIVE1_BUTTON BITMAP "DRIVE1.BMP"
DRIVE2_BUTTON BITMAP "DRIVE2.BMP"
SETUP_BUTTON BITMAP "SETUP.BMP"
CHARSET40 BITMAP "CHARSET4.BMP"
CHARSET8C BITMAP "CHARSET8C.BMP"
CHARSET82 BITMAP "CHARSET82.BMP"
DISKOFF_BITMAP BITMAP "DISKOFF.BMP"
DISKREAD_BITMAP BITMAP "DISKREAD.BMP"
DISKWRITE_BITMAP BITMAP "DISKWRIT.BMP"
DISKPROT_BITMAP BITMAP "DISKPROT.BMP"
CAPSOFF_BITMAP BITMAP "CAPSOFF.BMP"
CAPSON_BITMAP BITMAP "CAPSON.BMP"
//Pravets8 appendices
LATOFF_BITMAP BITMAP "LATOFF.BMP"
LATON_BITMAP BITMAP "LATON.BMP"
CAPSOFF_P8_BITMAP BITMAP "CAPSOFF_P8.BMP"
CAPSON_P8_BITMAP BITMAP "CAPSON_P8.BMP"
///////////////////////////////////////////////////////////////////////////
HELP_BUTTON BITMAP "HELP.BMP"
DRIVESWAP_BUTTON BITMAP "DRIVESWAP.BMP"
IDB_APPLEWIN BITMAP "Applewin.bmp"
@ -164,6 +173,9 @@ BEGIN
CONTROL "Enable harddisk in slot 7",IDC_HDD_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,126,120,10
GROUPBOX "Floppy Controller",IDC_STATIC,2,21,206,73
GROUPBOX "Harddisk Controller",IDC_STATIC,2,113,205,71
LTEXT "Path to CiderPress:",IDC_STATIC,5,190,74,8
EDITTEXT IDC_CIDERPRESS_FILENAME,5,200,143,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_CIDERPRESS_BROWSE,154,200,50,14
END
IDD_TFE_SETTINGS_DIALOG DIALOG 0, 0, 270, 100
@ -281,10 +293,12 @@ IDR_MOUSEINTERFACE_FW FIRMWARE "MouseInterface.rom"
// ROM
//
IDR_APPLE2_ROM ROM "Apple2.rom"
IDR_APPLE2_PLUS_ROM ROM "Apple2_Plus.rom"
IDR_APPLE2E_ROM ROM "Apple2e.rom"
IDR_APPLE2E_ENHANCED_ROM ROM "Apple2e_Enhanced.rom"
IDR_APPLE2_ROM ROM "Apple2.rom"
IDR_APPLE2_PLUS_ROM ROM "Apple2_Plus.rom"
IDR_APPLE2E_ROM ROM "Apple2e.rom"
IDR_APPLE2E_ENHANCED_ROM ROM "Apple2e_Enhanced.rom"
IDR_PRAVETS_82_ROM ROM "Pravets82.rom"
IDR_PRAVETS_8C_ROM ROM "Pravets8C.rom"
IDR_FREEZES_F8_ROM ROM "FREEZES_NON-AUTOSTART_F8_ROM.rom"
/////////////////////////////////////////////////////////////////////////////
@ -312,6 +326,7 @@ BEGIN
MENUITEM "&Eject", ID_DISKMENU_EJECT
MENUITEM "Read / &Write", ID_DISKMENU_WRITEPROTECTION_OFF
MENUITEM "&Read only", ID_DISKMENU_WRITEPROTECTION_ON
MENUITEM "Send to &CiderPress", ID_DISKMENU_SENDTO_CIDERPRESS
END
END
@ -349,3 +364,4 @@ END
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

BIN
AppleWin/resource/LATON.BMP Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Binary file not shown.

BIN
AppleWin/resource/RUNP.BMP Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -31,6 +31,8 @@
#define IDR_APPLE2_PLUS_ROM 127
#define IDR_APPLE2E_ROM 128
#define IDR_APPLE2E_ENHANCED_ROM 129
#define IDR_PRAVETS_82_ROM 149
#define IDR_PRAVETS_8C_ROM 150
#define IDC_MB_ENABLE 130
#define IDD_TFE_SETTINGS_DIALOG 131
#define IDR_PRINTDRVR_FW 132
@ -77,15 +79,19 @@
#define IDC_SCROLLLOCK_TOGGLE 1043
#define IDC_MOUSE_IN_SLOT4 1044
#define IDC_THE_FREEZES_F8_ROM_FW 1045
#define IDC_MOUSE_CROSSHAIR 1045
#define IDC_CLONETYPE 1046
#define IDC_MOUSE_RESTRICT_TO_WINDOW 1046
#define IDC_MOUSE_CROSSHAIR 1046
#define IDC_CLONETYPE 1047
#define IDC_MOUSE_RESTRICT_TO_WINDOW 1048
#define IDC_CIDERPRESS_BROWSE 1049
#define IDC_CIDERPRESS_FILENAME 1050
#define IDM_EXIT 40001
#define IDM_HELP 40002
#define IDM_ABOUT 40003
#define ID_DISKMENU_EJECT 40004
#define ID_DISKMENU_WRITEPROTECTION_ON 40005
#define ID_DISKMENU_WRITEPROTECTION_OFF 40006
#define ID_DISKMENU_SENDTO_CIDERPRESS 40007
// Next default values for new objects
//

View File

@ -44,6 +44,11 @@ DWORD emulmsec = 0;
static DWORD emulmsec_frac = 0;
bool g_bFullSpeed = false;
//Pravets 8A/C variables
bool P8CAPS_ON = false;
bool P8Shift = false;
//=================================================
// Win32
HINSTANCE g_hInstance = (HINSTANCE)0;
@ -359,22 +364,37 @@ void GetProgramDirectory () {
}
//===========================================================================
//Reads configuration from the registry entries
void LoadConfiguration ()
{
DWORD dwComputerType;
if (LOAD(TEXT(REGVALUE_APPLE2_TYPE),&dwComputerType))
{
if (dwComputerType >= A2TYPE_MAX)
LOAD(TEXT(REGVALUE_CLONETYPE),&g_uCloneType);
if ((dwComputerType >= A2TYPE_MAX) || (dwComputerType >= A2TYPE_UNDEFINED && dwComputerType < A2TYPE_CLONE))
dwComputerType = A2TYPE_APPLE2EEHANCED;
g_Apple2Type = (eApple2Type) dwComputerType;
if (dwComputerType == A2TYPE_CLONE)
{
switch (g_uCloneType)
{
case 0: g_Apple2Type = A2TYPE_PRAVETS82; break;
case 1: g_Apple2Type = A2TYPE_PRAVETS8A; break;
default: g_Apple2Type = A2TYPE_APPLE2EEHANCED; break;
}
}
else
{
g_Apple2Type = (eApple2Type) dwComputerType;
}
}
else
else // Support older AppleWin registry entries
{
LOAD(TEXT("Computer Emulation"),&dwComputerType);
switch (dwComputerType)
{
// NB. No A2TYPE_APPLE2E
// NB. No A2TYPE_APPLE2E (this is correct)
case 0: g_Apple2Type = A2TYPE_APPLE2;
case 1: g_Apple2Type = A2TYPE_APPLE2PLUS;
case 2: g_Apple2Type = A2TYPE_APPLE2EEHANCED;
@ -382,7 +402,16 @@ void LoadConfiguration ()
}
}
LOAD(TEXT(REGVALUE_CLONETYPE), &g_uCloneType);
switch (g_Apple2Type) //Sets the character set for the Apple model/clone
{
case A2TYPE_APPLE2: g_nCharsetType = 0; break;
case A2TYPE_APPLE2PLUS: g_nCharsetType = 0; break;
case A2TYPE_APPLE2E: g_nCharsetType = 0; break;
case A2TYPE_APPLE2EEHANCED: g_nCharsetType = 0; break;
case A2TYPE_PRAVETS82: g_nCharsetType = 1; break;
case A2TYPE_PRAVETS8A: g_nCharsetType = 2; break;
}
LOAD(TEXT("Joystick 0 Emulation"),&joytype[0]);
LOAD(TEXT("Joystick 1 Emulation"),&joytype[1]);

View File

@ -12,6 +12,11 @@ extern DWORD cyclenum;
extern DWORD emulmsec;
extern bool g_bFullSpeed;
//Pravets 8A/C only variables
extern bool P8CAPS_ON;
extern bool P8Shift;
//===========================================
// Win32
extern HINSTANCE g_hInstance;

View File

@ -52,14 +52,15 @@ enum AppMode_e
#define BTN_FULLSCR 5
#define BTN_DEBUG 6
#define BTN_SETUP 7
//#define MAXIMAGES 16
#define BTN_P8CAPS 9
// TODO: Move to StringTable.h
#define TITLE_APPLE_2 TEXT("Apple ][ Emulator")
#define TITLE_APPLE_2_PLUS TEXT("Apple ][+ Emulator")
#define TITLE_APPLE_2E TEXT("Apple //e Emulator")
#define TITLE_APPLE_2E_ENHANCED TEXT("Enhanced Apple //e Emulator")
#define TITLE_PRAVETS_82 TEXT("Pravets 82 Emulator")
#define TITLE_PRAVETS_8A TEXT("Pravets 8A Emulator")
#define TITLE_PAUSED TEXT(" Paused ")
#define TITLE_STEPPING TEXT("Stepping")
@ -85,15 +86,17 @@ enum AppMode_e
#define REGVALUE_MOUSE_RESTRICT_TO_WINDOW "Mouse restrict to window"
#define REGVALUE_THE_FREEZES_F8_ROM "The Freeze's F8 Rom"
#define REGVALUE_CLONETYPE "Clone Type"
#define REGVALUE_CIDERPRESSLOC "CiderPress Location"
// Preferences
#define REGVALUE_PREF_START_DIR TEXT("Starting Directory")
#define REGVALUE_PREF_START_DIR "Starting Directory"
#define WM_USER_BENCHMARK WM_USER+1
#define WM_USER_RESTART WM_USER+2
#define WM_USER_SAVESTATE WM_USER+3
#define WM_USER_LOADSTATE WM_USER+4
enum eSOUNDCARDTYPE {SC_UNINIT=0, SC_NONE, SC_MOCKINGBOARD, SC_PHASOR}; // Apple soundcard type
typedef BYTE (__stdcall *iofunction)(WORD nPC, WORD nAddr, BYTE nWriteFlag, BYTE nWriteValue, ULONG nCyclesLeft);
@ -106,6 +109,7 @@ enum eIRQSRC {IS_6522=0, IS_SPEECH, IS_SSC, IS_MOUSE};
#define APPLE2E_MASK 0x10
#define APPLE2C_MASK 0x20
#define APPLECLONE_MASK 0x100
#define IS_APPLE2 ((g_Apple2Type & (APPLE2E_MASK|APPLE2C_MASK)) == 0)
#define IS_APPLE2E (g_Apple2Type & APPLE2E_MASK)
@ -117,9 +121,16 @@ enum eApple2Type {
A2TYPE_APPLE2PLUS,
A2TYPE_APPLE2E=APPLE2E_MASK,
A2TYPE_APPLE2EEHANCED,
A2TYPE_UNDEFINED,
// A2TYPE_APPLE2C=APPLE2C_MASK, // Placeholder
//
// Clones start here:
A2TYPE_CLONE=APPLECLONE_MASK,
A2TYPE_PRAVETS82=APPLECLONE_MASK|APPLE2E_MASK,
A2TYPE_PRAVETS8A,
A2TYPE_MAX
};
enum eBUTTON {BUTTON0=0, BUTTON1};
enum eBUTTONSTATE {BUTTON_UP=0, BUTTON_DOWN};

View File

@ -50,6 +50,7 @@ static BYTE __stdcall DiskSetWriteMode (WORD pc, WORD addr, BYTE bWrite, BYTE d,
// Public _________________________________________________________________________________________
BOOL enhancedisk = 1;
string DiskPathFilename[];
// Private ________________________________________________________________________________________
@ -243,6 +244,7 @@ static void RemoveDisk (int iDrive)
memset( pFloppy->imagename, 0, MAX_DISK_IMAGE_NAME+1 );
memset( pFloppy->fullname , 0, MAX_DISK_FULL_NAME +1 );
DiskPathFilename[iDrive] = "";
}
//===========================================================================
@ -372,6 +374,7 @@ LPCTSTR DiskGetFullName (int drive) {
}
//===========================================================================
void DiskGetLightStatus (int *pDisk1Status_, int *pDisk2Status_)
{
@ -389,6 +392,7 @@ LPCTSTR DiskGetName (int drive) {
return g_aFloppyDisk[drive].imagename;
}
//===========================================================================
BYTE __stdcall Disk_IORead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);
@ -407,19 +411,28 @@ void DiskInitialize ()
}
//===========================================================================
int DiskInsert (int drive, LPCTSTR imagefilename, BOOL writeprotected, BOOL createifnecessary) {
Disk_t * fptr = &g_aFloppyDisk[drive];
if (fptr->imagehandle)
RemoveDisk(drive);
ZeroMemory(fptr,sizeof(Disk_t ));
fptr->writeprotected = writeprotected;
int error = ImageOpen(imagefilename,
&fptr->imagehandle,
&fptr->writeprotected,
createifnecessary);
if (error == IMAGE_ERROR_NONE)
GetImageTitle(imagefilename,fptr);
return error;
int DiskInsert (int drive, LPCTSTR imagefilename, BOOL writeprotected, BOOL createifnecessary)
{
Disk_t * fptr = &g_aFloppyDisk[drive];
if (fptr->imagehandle)
RemoveDisk(drive);
ZeroMemory(fptr,sizeof(Disk_t ));
fptr->writeprotected = writeprotected;
int error = ImageOpen(imagefilename,
&fptr->imagehandle,
&fptr->writeprotected,
createifnecessary);
if (error == IMAGE_ERROR_NONE)
{
GetImageTitle(imagefilename,fptr);
DiskPathFilename[drive]= imagefilename;
}
return error;
}
//===========================================================================
@ -559,6 +572,7 @@ void DiskSelectImage (int drive, LPSTR pszFilename)
int error = DiskInsert(drive,filename,ofn.Flags & OFN_READONLY,1);
if (!error)
{
DiskPathFilename[drive] = filename;
filename[ofn.nFileOffset] = 0;
if (_tcsicmp(directory,filename))
RegSaveString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,filename);

View File

@ -7,7 +7,7 @@
#define TRACKS 35
extern BOOL enhancedisk;
extern string DiskPathFilename[2];
void DiskInitialize (); // DiskManagerStartup()
void DiskDestroy (); // no, doesn't "destroy" the disk image. DiskManagerShutdown()

View File

@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#pragma hdrstop
#include "MouseInterface.h"
#include "..\resource\resource.h"
#include <sys/stat.h>
#define ENABLE_MENU 0
@ -55,6 +56,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define BUTTONS 8
static HBITMAP capsbitmap[2];
//Pravets8 only
static HBITMAP capsbitmapP8[2];
static HBITMAP latbitmap[2];
static HBITMAP charsetbitmap [3];
//===========================
static HBITMAP diskbitmap[ NUM_DISK_STATUS ];
static HBITMAP buttonbitmap[BUTTONS];
@ -81,6 +87,7 @@ static HWND tooltipwindow = (HWND)0;
static BOOL g_bUsingCursor = 0; // 1=AppleWin is using (hiding) the mouse-cursor
static int viewportx = VIEWPORTX; // Default to Normal (non-FullScreen) mode
static int viewporty = VIEWPORTY; // Default to Normal (non-FullScreen) mode
int g_nCharsetType = 0;
static LPDIRECTDRAW directdraw = (LPDIRECTDRAW)0;
static LPDIRECTDRAWSURFACE surface = (LPDIRECTDRAWSURFACE)0;
@ -96,6 +103,7 @@ void ResetMachineState ();
void SetFullScreenMode ();
void SetNormalMode ();
void SetUsingCursor (BOOL);
static bool FileExists(string strFilename);
bool g_bScrollLock_FullSpeed = false;
@ -164,15 +172,34 @@ static void CreateGdiObjects () {
LR_LOADTRANSPARENT);
buttonbitmap[BTN_HELP ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("HELP_BUTTON"));
buttonbitmap[BTN_RUN ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("RUN_BUTTON"));
switch (g_Apple2Type)
{
case A2TYPE_APPLE2: buttonbitmap[BTN_RUN ] =(HBITMAP)LOADBUTTONBITMAP(TEXT("RUN_BUTTON")); break;
case A2TYPE_APPLE2PLUS: buttonbitmap[BTN_RUN ] =(HBITMAP)LOADBUTTONBITMAP(TEXT("RUN_BUTTON")); break;
case A2TYPE_APPLE2E: buttonbitmap[BTN_RUN ] =(HBITMAP)LOADBUTTONBITMAP(TEXT("RUN_BUTTON")); break;
case A2TYPE_APPLE2EEHANCED: buttonbitmap[BTN_RUN ] =(HBITMAP)LOADBUTTONBITMAP(TEXT("RUN_BUTTON")); break;
case A2TYPE_PRAVETS82: buttonbitmap[BTN_RUN ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("RUNP_BUTTON")); break;
case A2TYPE_PRAVETS8A: buttonbitmap[BTN_RUN ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("RUNP_BUTTON")); break;
}
buttonbitmap[BTN_DRIVE1 ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DRIVE1_BUTTON"));
buttonbitmap[BTN_DRIVE2 ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DRIVE2_BUTTON"));
buttonbitmap[BTN_DRIVESWAP] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DRIVESWAP_BUTTON"));
buttonbitmap[BTN_FULLSCR] = (HBITMAP)LOADBUTTONBITMAP(TEXT("FULLSCR_BUTTON"));
buttonbitmap[BTN_DEBUG ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DEBUG_BUTTON"));
buttonbitmap[BTN_SETUP ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("SETUP_BUTTON"));
buttonbitmap[BTN_P8CAPS ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("CAPSON_BITMAP"));
capsbitmap[0] = (HBITMAP)LOADBUTTONBITMAP(TEXT("CAPSOFF_BITMAP"));
capsbitmap[1] = (HBITMAP)LOADBUTTONBITMAP(TEXT("CAPSON_BITMAP"));
//Pravets8 only
capsbitmapP8[0] = (HBITMAP)LOADBUTTONBITMAP(TEXT("CAPSOFF_P8_BITMAP"));
capsbitmapP8[1] = (HBITMAP)LOADBUTTONBITMAP(TEXT("CAPSON_P8_BITMAP"));
latbitmap[0] = (HBITMAP)LOADBUTTONBITMAP(TEXT("LATOFF_BITMAP"));
latbitmap[1] = (HBITMAP)LOADBUTTONBITMAP(TEXT("LATON_BITMAP"));
charsetbitmap[0] = (HBITMAP)LOADBUTTONBITMAP(TEXT("CHARSET_APPLE_BITMAP"));
charsetbitmap[1] = (HBITMAP)LOADBUTTONBITMAP(TEXT("CHARSET_82_BITMAP"));
charsetbitmap[2] = (HBITMAP)LOADBUTTONBITMAP(TEXT("CHARSET_8A_BITMAP"));
//===========================
diskbitmap[ DISK_STATUS_OFF ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DISKOFF_BITMAP"));
diskbitmap[ DISK_STATUS_READ ] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DISKREAD_BITMAP"));
diskbitmap[ DISK_STATUS_WRITE] = (HBITMAP)LOADBUTTONBITMAP(TEXT("DISKWRITE_BITMAP"));
@ -402,6 +429,7 @@ static void DrawStatusArea (HDC passdc, int drawflags)
int iDrive1Status = DISK_STATUS_OFF;
int iDrive2Status = DISK_STATUS_OFF;
bool bCaps = KeybGetCapsStatus();
bool bP8Caps = KeybGetP8CapsStatus();
DiskGetLightStatus(&iDrive1Status,&iDrive2Status);
if (fullscreen)
@ -453,8 +481,28 @@ static void DrawStatusArea (HDC passdc, int drawflags)
if (!IS_APPLE2)
{
RECT rect = {0,0,30,8};
DrawBitmapRect(dc,x+7,y+19,&rect,capsbitmap[bCaps != 0]);
RECT rect = {0,0,31,8};
switch (g_Apple2Type)
{
case A2TYPE_APPLE2: DrawBitmapRect(dc,x+7,y+9,&rect,capsbitmap[bCaps != 0]); break;
case A2TYPE_APPLE2PLUS: DrawBitmapRect(dc,x+7,y+19,&rect,capsbitmap[bCaps != 0]); break;
case A2TYPE_APPLE2E: DrawBitmapRect(dc,x+7,y+19,&rect,capsbitmap[bCaps != 0]); break;
case A2TYPE_APPLE2EEHANCED: DrawBitmapRect(dc,x+7,y+19,&rect,capsbitmap[bCaps != 0]); break;
case A2TYPE_PRAVETS82: DrawBitmapRect(dc,x+15,y+19,&rect,latbitmap[bCaps != 0]); break;
case A2TYPE_PRAVETS8A: DrawBitmapRect(dc,x+2,y+19,&rect,latbitmap[bCaps != 0]); break;
}
if (g_Apple2Type == A2TYPE_PRAVETS8A) //Toggles Pravets 8A/C Caps lock LED
{
RECT rect = {0,0,22,8};
DrawBitmapRect(dc,x+23,y+19,&rect,capsbitmapP8[P8CAPS_ON != 0]);
}
/* if (g_Apple2Type == A2TYPE_PRAVETS8A)
DrawBitmapRect(dc,x+7,y+19,&rect,cyrbitmap[bCaps != 0]);
else
DrawBitmapRect(dc,x+7,y+19,&rect,capsbitmap[bCaps != 0]);
*/
}
}
@ -467,6 +515,8 @@ static void DrawStatusArea (HDC passdc, int drawflags)
case A2TYPE_APPLE2PLUS: _tcscpy(title, TITLE_APPLE_2_PLUS); break;
case A2TYPE_APPLE2E: _tcscpy(title, TITLE_APPLE_2E); break;
case A2TYPE_APPLE2EEHANCED: _tcscpy(title, TITLE_APPLE_2E_ENHANCED); break;
case A2TYPE_PRAVETS82: _tcscpy(title, TITLE_PRAVETS_82); break;
case A2TYPE_PRAVETS8A: _tcscpy(title, TITLE_PRAVETS_8A); break;
}
if (g_hCustomRomF8 != INVALID_HANDLE_VALUE)
@ -653,19 +703,27 @@ LRESULT CALLBACK FrameWndProc (
DrawButton((HDC)0,buttondown);
}
else if (wparam == VK_F9)
{
// Cycle through available video modes
if (GetKeyState(VK_SHIFT) >= 0) // Backwards
{
if (GetKeyState(VK_CONTROL) < 0)
{
if (videotype == 0)
videotype = VT_NUM_MODES;
videotype--;
g_nCharsetType++; // Cycle through available charsets (Ctrl + F9)
if (g_nCharsetType >= 3)
g_nCharsetType = 0;
}
else // Forwards
else // Cycle through available video modes
{
videotype++;
if (videotype >= VT_NUM_MODES)
videotype = 0;
if (GetKeyState(VK_SHIFT) >= 0) // Backwards
{
if (videotype == 0)
videotype = VT_NUM_MODES;
videotype--;
}
else // Forwards
{
videotype++;
if (videotype >= VT_NUM_MODES)
videotype = 0;
}
}
VideoReinitialize();
@ -676,6 +734,7 @@ LRESULT CALLBACK FrameWndProc (
}
RegSaveValue(TEXT("Configuration"),TEXT("Video Emulation"),1,videotype);
}
else if ((wparam == VK_F11) && (GetKeyState(VK_CONTROL) >= 0)) // Save state (F11)
{
SoundCore_SetFade(FADE_OUT);
@ -739,11 +798,17 @@ LRESULT CALLBACK FrameWndProc (
else if (g_nAppMode == MODE_DEBUG)
DebuggerProcessKey(wparam);
if (wparam == VK_F10)
{
SetUsingCursor(0);
return 0;
if ((g_Apple2Type == A2TYPE_PRAVETS8A) && (GetKeyState(VK_CONTROL) >= 0))
{
KeybToggleP8ACapsLock ();//Toggles P8 Capslock
}
else
{
SetUsingCursor(0);
return 0; // TC: Why return early?
}
}
break;
@ -797,7 +862,7 @@ LRESULT CALLBACK FrameWndProc (
{
RevealCursor();
}
else
else if (g_nAppMode == MODE_RUNNING)
{
if (!sg_Mouse.IsEnabled())
{
@ -1186,14 +1251,25 @@ void ProcessButtonClick (int button) {
//===========================================================================
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
{
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/menus/usingmenus.asp
// http://www.codeproject.com/menu/MenusForBeginners.asp?df=100&forumid=67645&exp=0&select=903061
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/menus/usingmenus.asp
// http://www.codeproject.com/menu/MenusForBeginners.asp?df=100&forumid=67645&exp=0&select=903061
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
{
HMENU hmenu; // menu template
HMENU hmenuTrackPopup; // shortcut menu
//This is the default installation path of CiderPress. It shall not be left blank, otherwise an explorer window will be open.
TCHAR PathToCiderPress[MAX_PATH] = "C:\\Program Files\\faddenSoft\\CiderPress\\CiderPress.exe";
RegLoadString(TEXT("Configuration"), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress,MAX_PATH);
//TODO: A directory is open if an empty path to CiderPress is set. This has to be fixed.
string filename1= "\"";
filename1.append (DiskPathFilename[iDrive]);
filename1.append ("\"");
string sFileNameEmpty = "\"";
sFileNameEmpty.append ("\"");
// Load the menu template containing the shortcut menu from the
// application's resources.
hmenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(ID_MENU_DISK_POPUP));
@ -1233,10 +1309,51 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
else
if (iCommand == ID_DISKMENU_WRITEPROTECTION_OFF)
DiskSetProtect( iDrive, false );
else
if (iCommand == ID_DISKMENU_SENDTO_CIDERPRESS)
{
//if(!filename1.compare("\"\"") == false) //Do not use this, for some reason it does not work!!!
if(!filename1.compare(sFileNameEmpty) )
{
int MB_Result = 0;
MB_Result = MessageBox( NULL, "No disk image loaded. Do you want to run CiderPress anyway?" ,"No disk image.", MB_ICONINFORMATION|MB_YESNO );
if (MB_Result == 6) //6= Yes
{
if (FileExists (PathToCiderPress ))
{
HINSTANCE nResult = ShellExecute(NULL, "open", PathToCiderPress, "" , NULL, SW_SHOWNORMAL);
}
else
{
MessageBox( NULL,
"CiderPress not found!\n"
"Please install CiderPress in case it is not \n"
"or set the path to it from Configuration/Disk otherwise."
, "CiderPress not found" ,MB_ICONINFORMATION|MB_OK);
}
}
}
else
{
if (FileExists (PathToCiderPress ))
{
HINSTANCE nResult = ShellExecute(NULL, "open", PathToCiderPress, filename1.c_str() , NULL, SW_SHOWNORMAL);
}
else
{
MessageBox( NULL,
"CiderPress not found!\n"
"Please install CiderPress in case it is not \n"
"or set the path to it from Configuration/Disk otherwise."
, "CiderPress not found" ,MB_ICONINFORMATION|MB_OK);
}
}
// Destroy the menu.
DestroyMenu(hmenu);
}
}
}
//===========================================================================
@ -1381,8 +1498,11 @@ void FrameCreateWindow ()
case A2TYPE_APPLE2PLUS: g_pAppTitle = TITLE_APPLE_2_PLUS; break;
case A2TYPE_APPLE2E: g_pAppTitle = TITLE_APPLE_2E; break;
case A2TYPE_APPLE2EEHANCED: g_pAppTitle = TITLE_APPLE_2E_ENHANCED; break;
case A2TYPE_PRAVETS82: g_pAppTitle = TITLE_PRAVETS_82; break;
case A2TYPE_PRAVETS8A: g_pAppTitle = TITLE_PRAVETS_8A; break;
}
g_hFrameWindow = CreateWindow(
TEXT("APPLE2FRAME"),
g_pAppTitle,
@ -1508,6 +1628,15 @@ void FrameReleaseVideoDC () {
//===========================================================================
static bool FileExists(string strFilename)
{
struct stat stFileInfo;
int intStat = stat(strFilename.c_str(),&stFileInfo);
return (intStat == 0) ? true : false;
}
//===========================================================================
// Called when:
// . Mouse f/w sets abs position
// . UpdateMouseInAppleViewport() is called and inside Apple screen

View File

@ -11,7 +11,6 @@ extern HWND g_hFrameWindow;
extern HDC g_hFrameDC;
extern BOOL fullscreen;
void FrameCreateWindow ();
HDC FrameGetDC ();
HDC FrameGetVideoDC (LPBYTE *,LONG *);
@ -21,6 +20,8 @@ void FrameReleaseDC ();
void FrameReleaseVideoDC ();
void FrameSetCursorPosByMousePos();
extern string PathFilename[2];
LRESULT CALLBACK FrameWndProc (
HWND window,
UINT message,
@ -28,3 +29,4 @@ LRESULT CALLBACK FrameWndProc (
LPARAM lparam );
extern bool g_bScrollLock_FullSpeed;
extern int g_nCharsetType;

View File

@ -41,7 +41,8 @@ static BYTE asciicode[2][10] = {
static bool g_bShiftKey = false;
static bool g_bCtrlKey = false;
static bool g_bAltKey = false;
static bool g_bCapsLock = true;
static bool g_bCapsLock = true; //Caps lock key for Apple2 and Lat/Cyr lock for Pravets8
static bool g_bP8CapsLock = true; //Caps lock key of Pravets 8A/C
static int lastvirtkey = 0; // Current PC keycode
static BYTE keycode = 0; // Current Apple keycode
static DWORD keyboardqueries = 0;
@ -116,7 +117,18 @@ bool KeybGetCapsStatus ()
{
return g_bCapsLock;
}
//===========================================================================
bool KeybGetP8CapsStatus()
{
return g_bP8CapsLock;
}
//===========================================================================
/*
bool KeybGetCapsAllowed() //For Pravets 8A/C only
{
return g_CapsLockAllowed;
}
*/
//===========================================================================
bool KeybGetCtrlStatus ()
{
@ -169,17 +181,82 @@ void KeybQueueKeypress (int key, BOOL bASCII)
if (!IS_APPLE2)
{
P8Shift = false;
if (g_bCapsLock && (key >= 'a') && (key <='z'))
keycode = key - 32;
{
P8Shift = true;
keycode = key - 32;
}
else
keycode = key;
{
keycode = key;
}
//The latter line should be applied for Pravtes 8A/C only, but not for Pravets 82/M !!!
if ((g_bCapsLock == false) && (key >= 'A') && (key <='Z'))
{
P8Shift = true;
if (g_Apple2Type == A2TYPE_PRAVETS8A)
keycode = key + 32;
}
//Remap some keys for Pravets82/M
if (g_Apple2Type == A2TYPE_PRAVETS82)
if (key == 64) keycode = 96;
if (key == '^') keycode = '~';
if (g_bCapsLock == false) //i.e. cyrillic letters
{
if (key == '`') keycode = '^';
if (key == 92) keycode = '@'; // \ to @
}
//Remap some keys for Pravets8A/C, which has a different charset for Pravtes82/M, whose keys MUST NOT be remapped.
if (g_Apple2Type == A2TYPE_PRAVETS8A) //&& (g_bCapsLock == false))
if (g_bCapsLock == false) //i.e. cyrillic letters
{
if (key == '[') keycode = '{';
if (key == ']') keycode = '}';
if (key == '`') keycode = '~';
if (GetCapsLockAllowed ()== true)
{
if ((key == 92) || (key == 124)) keycode = 96; //Ý to Þ
if ((key == '{') || (key == '}') || (key == '~') || (key == 124) || (key == '^'))
P8Shift = true;
}
}
else //i.e. latin letters
{
if (GetCapsLockAllowed() == false)
{
if (key == '{') keycode = '[';
if (key == '}') keycode = ']';
if (key == 124) keycode = 92;
}
else
{
if (key == '{') keycode = 91;
if (key == '}') keycode = 93;
if (key == 124) keycode = 92;
if ((key == '[') || (key == ']') || (key == 92) || (key == '^'))
P8Shift= true;
if (key == 96) keycode = 64; //This line shall generate sth. else i.e. ` In fact. this character is not generateable by the pravets keyboard.
if (key == 126) keycode = 94;
}
}
}
else
{
if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
}
else
{
if (key >= '`')
keycode = key - 32;
else
keycode = key;
}
}
lastvirtkey = LOBYTE(VkKeyScan(key));
}
@ -396,6 +473,15 @@ void KeybToggleCapsLock ()
}
}
//===========================================================================
void KeybToggleP8ACapsLock ()
{
if (g_Apple2Type == A2TYPE_PRAVETS8A)
P8CAPS_ON = !P8CAPS_ON;
FrameRefreshStatus(DRAW_LEDS);
// g_bP8CapsLock= g_bP8CapsLock?false:true; //The same as the upper, but slower
}
//===========================================================================
DWORD KeybGetSnapshot(SS_IO_Keyboard* pSS)

View File

@ -5,15 +5,19 @@ void ClipboardInitiatePaste();
void KeybReset();
bool KeybGetAltStatus();
bool KeybGetCapsStatus();
bool KeybGetP8CapsStatus();
bool KeybGetCtrlStatus();
bool KeybGetShiftStatus();
bool KeybGetCapsAllowed(); //For Pravets8A/C only
void KeybUpdateCtrlShiftStatus();
BYTE KeybGetKeycode ();
DWORD KeybGetNumQueries ();
void KeybQueueKeypress (int,BOOL);
void KeybToggleCapsLock ();
void KeybToggleP8ACapsLock ();
DWORD KeybGetSnapshot(SS_IO_Keyboard* pSS);
DWORD KeybSetSnapshot(SS_IO_Keyboard* pSS);
BYTE __stdcall KeybReadData (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);
BYTE __stdcall KeybReadFlag (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);
BYTE __stdcall KbdAllow8Bit (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft); //For Pravets A/C only

View File

@ -86,11 +86,9 @@ static LPBYTE memimage = NULL;
static LPBYTE pCxRomInternal = NULL;
static LPBYTE pCxRomPeripheral = NULL;
//
static DWORD memmode = MF_BANK2 | MF_SLOTCXROM | MF_WRITERAM;
static BOOL modechanging = 0;
static BOOL Pravets8charmode = 0;
MemoryInitPattern_e g_eMemoryInitPattern = MIP_FF_FF_00_00;
#ifdef RAMWORKS
@ -239,17 +237,23 @@ static BYTE __stdcall IOWrite_C05x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
//-------------------------------------
static BYTE __stdcall IORead_C06x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft)
{
{
static byte CurrentKestroke = 0;
CurrentKestroke = KeybGetKeycode();
switch (addr & 0xf)
{
case 0x0: return IO_Null(pc, addr, bWrite, d, nCyclesLeft);
case 0x1: return JoyReadButton(pc, addr, bWrite, d, nCyclesLeft);
case 0x2: return JoyReadButton(pc, addr, bWrite, d, nCyclesLeft);
case 0x3: return JoyReadButton(pc, addr, bWrite, d, nCyclesLeft);
case 0x4: return JoyReadPosition(pc, addr, bWrite, d, nCyclesLeft);
case 0x5: return JoyReadPosition(pc, addr, bWrite, d, nCyclesLeft);
case 0x6: return JoyReadPosition(pc, addr, bWrite, d, nCyclesLeft);
case 0x7: return JoyReadPosition(pc, addr, bWrite, d, nCyclesLeft);
//In Pravets8A/C if SETMODE (8bit character encoding) is enabled, bit6 in $C060 is 0; Else it is 1
//If (CAPS lOCK of Pravets8A/C is on or Shift is pressed) and (MODE is enabled), bit7 in $C000 is 1; Else it is 0
//Writing into $C060 sets MODE on and off. If bit 0 is 0 the the MODE is set 0, if bit 0 is 1 then MODE is set to 1 (8-bit)
case 0x0: return TapeRead(pc, addr, bWrite, d, nCyclesLeft);
case 0x1: return JoyReadButton(pc, addr, bWrite, d, nCyclesLeft); //$C061 Digital input 0 (If bit 7=1 then JoyButton 0 or OpenApple is pressed)
case 0x2: return JoyReadButton(pc, addr, bWrite, d, nCyclesLeft); //$C062 Digital input 1 (If bit 7=1 then JoyButton 1 or ClosedApple is pressed)
case 0x3: return JoyReadButton(pc, addr, bWrite, d, nCyclesLeft); //$C063 Digital input 2
case 0x4: return JoyReadPosition(pc, addr, bWrite, d, nCyclesLeft); //$C064 Analog input 0
case 0x5: return JoyReadPosition(pc, addr, bWrite, d, nCyclesLeft); //$C065 Analog input 1
case 0x6: return JoyReadPosition(pc, addr, bWrite, d, nCyclesLeft); //$C066 Analog input 2
case 0x7: return JoyReadPosition(pc, addr, bWrite, d, nCyclesLeft); //$C067 Analog input 3
case 0x8: return IO_Null(pc, addr, bWrite, d, nCyclesLeft);
case 0x9: return IO_Null(pc, addr, bWrite, d, nCyclesLeft);
case 0xA: return IO_Null(pc, addr, bWrite, d, nCyclesLeft);
@ -265,7 +269,15 @@ static BYTE __stdcall IORead_C06x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
static BYTE __stdcall IOWrite_C06x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft)
{
return IO_Null(pc, addr, bWrite, d, nCyclesLeft);
switch (addr & 0xf)
{
case 0x0:
if (g_Apple2Type == A2TYPE_PRAVETS8A )
return TapeWrite (pc, addr, bWrite, d, nCyclesLeft);
else
return IO_Null(pc, addr, bWrite, d, nCyclesLeft); //Apple2 value
}
return IO_Null(pc, addr, bWrite, d, nCyclesLeft); //Apple2 value
}
//-------------------------------------
@ -274,7 +286,7 @@ static BYTE __stdcall IORead_C07x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
{
switch (addr & 0xf)
{
case 0x0: return JoyResetPosition(pc, addr, bWrite, d, nCyclesLeft);
case 0x0: return JoyResetPosition(pc, addr, bWrite, d, nCyclesLeft); //$C070 Analog input reset
case 0x1: return IO_Null(pc, addr, bWrite, d, nCyclesLeft);
case 0x2: return IO_Null(pc, addr, bWrite, d, nCyclesLeft);
case 0x3: return IO_Null(pc, addr, bWrite, d, nCyclesLeft);
@ -886,6 +898,8 @@ void MemInitialize()
const UINT CxRomSize = 4*1024;
const UINT Apple2RomSize = 12*1024;
const UINT Apple2eRomSize = Apple2RomSize+CxRomSize;
//const UINT Pravets82RomSize = 12*1024;
//const UINT Pravets8ARomSize = Pravets82RomSize+CxRomSize;
// ALLOCATE MEMORY FOR THE APPLE MEMORY IMAGE AND ASSOCIATED DATA STRUCTURES
memaux = (LPBYTE)VirtualAlloc(NULL,_6502_MEM_END+1,MEM_COMMIT,PAGE_READWRITE);
@ -941,6 +955,8 @@ void MemInitialize()
case A2TYPE_APPLE2PLUS: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2_PLUS_ROM), "ROM"); ROM_SIZE = Apple2RomSize; break;
case A2TYPE_APPLE2E: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2E_ROM), "ROM"); ROM_SIZE = Apple2eRomSize; break;
case A2TYPE_APPLE2EEHANCED: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2E_ENHANCED_ROM), "ROM"); ROM_SIZE = Apple2eRomSize; break;
case A2TYPE_PRAVETS82: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_PRAVETS_82_ROM), "ROM"); ROM_SIZE = Apple2RomSize; break;
case A2TYPE_PRAVETS8A: hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_PRAVETS_8C_ROM), "ROM"); ROM_SIZE = Apple2eRomSize; break;
}
if(hResInfo == NULL)
@ -952,6 +968,8 @@ void MemInitialize()
case A2TYPE_APPLE2PLUS: _tcscpy(sRomFileName, TEXT("APPLE2_PLUS.ROM")); break;
case A2TYPE_APPLE2E: _tcscpy(sRomFileName, TEXT("APPLE2E.ROM")); break;
case A2TYPE_APPLE2EEHANCED: _tcscpy(sRomFileName, TEXT("APPLE2E_ENHANCED.ROM")); break;
case A2TYPE_PRAVETS82: _tcscpy(sRomFileName, TEXT("PRAVETS82.ROM")); break; //Rom to be changed. Currently an Apple 2E Rom is used, because of the lack of a genuine Pravets82 one.
case A2TYPE_PRAVETS8A: _tcscpy(sRomFileName, TEXT("PRAVETS8C.ROM")); break;
}
TCHAR sText[ MAX_PATH ];
@ -1082,6 +1100,8 @@ void MemReset ()
// INITIALIZE & RESET THE CPU
// . Do this after ROM has been copied back to mem[], so that PC is correctly init'ed from 6502's reset vector
CpuInitialize();
//Sets Caps Lock = false (Pravets 8A/C only)
}
//===========================================================================
@ -1092,6 +1112,12 @@ void MemReset ()
void MemResetPaging ()
{
ResetPaging(0);
if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
P8CAPS_ON = false;
TapeWrite (0, 0, 0, 0 ,0);
FrameRefreshStatus(DRAW_LEDS);
}
}
//===========================================================================

View File

@ -37,7 +37,8 @@ TCHAR computerchoices[] =
TEXT("Apple ][ (Original Model)\0")
TEXT("Apple ][+\0")
TEXT("Apple //e\0")
TEXT("Enhanced Apple //e\0");
TEXT("Enhanced Apple //e\0")
TEXT("Clone\0");
TCHAR* szJoyChoice0 = TEXT("Disabled\0");
TCHAR* szJoyChoice1 = TEXT("PC Joystick #1\0");
@ -47,6 +48,11 @@ TCHAR* szJoyChoice4 = TEXT("Keyboard (centering)\0");
TCHAR* szJoyChoice5 = TEXT("Mouse\0");
const int g_nMaxJoyChoiceLen = 40;
bool ConfigRun = false;
//eApple2Type NewApple2Type = 0;
DWORD NewApple2Type = 0;
DWORD NewCloneType = 0;
DWORD NewApple2Combo = 0;
enum JOY0CHOICE {J0C_DISABLED=0, J0C_JOYSTICK1, J0C_KEYBD_STANDARD, J0C_KEYBD_CENTERING, J0C_MOUSE, J0C_MAX};
TCHAR* pszJoy0Choices[J0C_MAX] = { szJoyChoice0,
@ -114,12 +120,15 @@ static UINT g_bEnableFreezeDlgButton = UNDEFINED;
//
enum {CLONETYPE_DISABLED=0, CLONETYPE_PRAVETS82, CLONETYPE_PRAVETS8A, CLONETYPE_NUM};
DWORD g_uCloneType = CLONETYPE_DISABLED;
enum {
CLONETYPE_PRAVETS82=0,
CLONETYPE_PRAVETS8A,
CLONETYPE_NUM
};
DWORD g_uCloneType = CLONETYPE_PRAVETS82 ;
static TCHAR g_CloneChoices[] = TEXT("Disabled\0")
TEXT("Pravets82\0") // Bulgarian
TEXT("Pravets8A\0"); // Bulgarian
static TCHAR g_CloneChoices[] = TEXT("Pravets 82\0") // Bulgarian
TEXT("Pravets 8A\0"); // Bulgarian
//===========================================================================
@ -223,7 +232,7 @@ static void InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue)
//===========================================================================
static eApple2Type GetApple2Type(DWORD NewCompType)
static eApple2Type GetApple2Type(DWORD NewCompType, DWORD NewCloneType)
{
switch (NewCompType)
{
@ -231,6 +240,12 @@ static eApple2Type GetApple2Type(DWORD NewCompType)
case 1: return A2TYPE_APPLE2PLUS;
case 2: return A2TYPE_APPLE2E;
case 3: return A2TYPE_APPLE2EEHANCED;
case 4: // Clone
switch (NewCloneType)
{
case 0: return A2TYPE_PRAVETS82; break;
case 1: return A2TYPE_PRAVETS8A; break;
}
default: return A2TYPE_APPLE2EEHANCED;
}
}
@ -238,12 +253,17 @@ static eApple2Type GetApple2Type(DWORD NewCompType)
static void ConfigDlg_OK(HWND window, UINT afterclose)
{
DWORD NewCompType = (DWORD) SendDlgItemMessage(window,IDC_COMPUTER,CB_GETCURSEL,0,0);
eApple2Type NewApple2Type = GetApple2Type(NewCompType);
DWORD OldApple2Type = g_Apple2Type;//LOAD(TEXT(REGVALUE_APPLE2_TYPE),&OldApple2Type);
eApple2Type NewApple2Type = GetApple2Type(NewCompType, 0 );
DWORD newvidtype = (DWORD)SendDlgItemMessage(window,IDC_VIDEOTYPE,CB_GETCURSEL,0,0);
DWORD newserialport = (DWORD)SendDlgItemMessage(window,IDC_SERIALPORT,CB_GETCURSEL,0,0);
if (NewApple2Type != g_Apple2Type)
if (OldApple2Type > (APPLECLONE_MASK|APPLE2E_MASK))
OldApple2Type = (APPLECLONE_MASK|APPLE2E_MASK);
if (NewApple2Type != OldApple2Type)
{
if ((afterclose == WM_USER_RESTART) || // Eg. Changing 'Freeze ROM' & user has already OK'd the restart for this
MessageBox(window,
@ -277,7 +297,14 @@ static void ConfigDlg_OK(HWND window, UINT afterclose)
SetCurrentCLK6502();
SAVE(TEXT(REGVALUE_APPLE2_TYPE),NewApple2Type);
if (NewApple2Type > A2TYPE_CLONE)
NewCloneType = NewApple2Type - A2TYPE_CLONE;
if ((NewApple2Type == A2TYPE_PRAVETS82) || (NewApple2Type == A2TYPE_PRAVETS8A))
SAVE(TEXT(REGVALUE_APPLE2_TYPE),A2TYPE_CLONE );
else
SAVE(TEXT(REGVALUE_APPLE2_TYPE),NewApple2Type );
SAVE(TEXT("Serial Port") ,sg_SSC.GetSerialPort());
SAVE(TEXT("Custom Speed") ,IsDlgButtonChecked(window,IDC_CUSTOM_SPEED));
SAVE(TEXT("Emulation Speed") ,g_dwSpeed);
@ -313,13 +340,14 @@ static BOOL CALLBACK ConfigDlgProc (HWND window,
// About to stop being active page
{
DWORD NewCompType = (DWORD) SendDlgItemMessage(window, IDC_COMPUTER, CB_GETCURSEL, 0, 0);
g_bEnableFreezeDlgButton = GetApple2Type(NewCompType)<=A2TYPE_APPLE2PLUS ? TRUE : FALSE;
g_bEnableFreezeDlgButton = GetApple2Type(NewCompType,0)<=A2TYPE_APPLE2PLUS ? TRUE : FALSE;
SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid
}
break;
case PSN_APPLY:
SetWindowLong(window, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid
ConfigDlg_OK(window, afterclose);
ConfigRun = true;
break;
case PSN_QUERYCANCEL:
// Can use this to ask user to confirm cancel
@ -394,18 +422,26 @@ static BOOL CALLBACK ConfigDlgProc (HWND window,
case A2TYPE_APPLE2PLUS: iApple2String = 1; break;
case A2TYPE_APPLE2E: iApple2String = 2; break;
case A2TYPE_APPLE2EEHANCED: iApple2String = 3; break;
case A2TYPE_PRAVETS82: iApple2String = 4; break;
case A2TYPE_PRAVETS8A: iApple2String = 5; break;
}
FillComboBox(window,IDC_COMPUTER,computerchoices,iApple2String);
if ((iApple2String == 4) || (iApple2String == 5))
FillComboBox(window,IDC_COMPUTER,computerchoices,4);
else
FillComboBox(window,IDC_COMPUTER,computerchoices,iApple2String);
FillComboBox(window,IDC_VIDEOTYPE,videochoices,videotype);
FillComboBox(window,IDC_SERIALPORT,serialchoices,sg_SSC.GetSerialPort());
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETRANGE,1,MAKELONG(0,40));
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETPAGESIZE,0,5);
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETTICFREQ,10,0);
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETPOS,1,g_dwSpeed);
{
BOOL custom = 1;
if (g_dwSpeed == SPEED_NORMAL) {
if (g_dwSpeed == SPEED_NORMAL)
{
custom = 0;
RegLoadValue(TEXT("Configuration"),TEXT("Custom Speed"),1,(DWORD *)&custom);
}
@ -858,10 +894,12 @@ static BOOL CALLBACK DiskDlgProc (HWND window,
DiskSelect(0);
SendDlgItemMessage(window,IDC_EDIT_DISK1,WM_SETTEXT,0,(LPARAM)DiskGetFullName(0));
break;
case IDC_DISK2:
DiskSelect(1);
SendDlgItemMessage(window,IDC_EDIT_DISK2,WM_SETTEXT,0,(LPARAM)DiskGetFullName(1));
break;
case IDC_HDD1:
if(IsDlgButtonChecked(window, IDC_HDD_ENABLE))
{
@ -869,6 +907,7 @@ static BOOL CALLBACK DiskDlgProc (HWND window,
SendDlgItemMessage(window,IDC_EDIT_HDD1,WM_SETTEXT,0,(LPARAM)HD_GetFullName(0));
}
break;
case IDC_HDD2:
if(IsDlgButtonChecked(window, IDC_HDD_ENABLE))
{
@ -876,9 +915,18 @@ static BOOL CALLBACK DiskDlgProc (HWND window,
SendDlgItemMessage(window,IDC_EDIT_HDD2,WM_SETTEXT,0,(LPARAM)HD_GetFullName(1));
}
break;
case IDC_HDD_ENABLE:
EnableHDD(window, IsDlgButtonChecked(window, IDC_HDD_ENABLE));
break;
case IDC_CIDERPRESS_BROWSE:
{
string CiderPressLoc = BrowseToCiderPress(window, TEXT("Select path to CiderPress"));
RegSaveString(TEXT("Configuration"),REGVALUE_CIDERPRESSLOC,1,CiderPressLoc.c_str());
SendDlgItemMessage(window, IDC_CIDERPRESS_FILENAME, WM_SETTEXT, 0, (LPARAM) CiderPressLoc.c_str());
}
break;
}
break;
@ -894,6 +942,14 @@ static BOOL CALLBACK DiskDlgProc (HWND window,
SendDlgItemMessage(window,IDC_EDIT_HDD1,WM_SETTEXT,0,(LPARAM)HD_GetFullName(0));
SendDlgItemMessage(window,IDC_EDIT_HDD2,WM_SETTEXT,0,(LPARAM)HD_GetFullName(1));
//
TCHAR PathToCiderPress[MAX_PATH] = "";
RegLoadString(TEXT("Configuration"), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress,MAX_PATH);
SendDlgItemMessage(window,IDC_CIDERPRESS_FILENAME ,WM_SETTEXT,0,(LPARAM)PathToCiderPress);
//
CheckDlgButton(window, IDC_HDD_ENABLE, HD_CardIsEnabled() ? BST_CHECKED : BST_UNCHECKED);
EnableHDD(window, IsDlgButtonChecked(window, IDC_HDD_ENABLE));
@ -987,9 +1043,8 @@ static void InitFreezeDlgButton(HWND window)
static void AdvancedDlg_OK(HWND window, UINT afterclose)
{
char szFilename[MAX_PATH];
memset(szFilename, 0, sizeof(szFilename));
* ((USHORT*) szFilename) = sizeof(szFilename);
* (USHORT*) szFilename = sizeof(szFilename);
UINT nLineLength = SendDlgItemMessage(window,IDC_SAVESTATE_FILENAME,EM_LINELENGTH,0,0);
@ -1006,11 +1061,48 @@ static void AdvancedDlg_OK(HWND window, UINT afterclose)
//
g_uCloneType = (DWORD)SendDlgItemMessage(window, IDC_CLONETYPE, CB_GETCURSEL, 0, 0);
DWORD NewCloneType = (DWORD)SendDlgItemMessage(window, IDC_CLONETYPE, CB_GETCURSEL, 0, 0);
SAVE(TEXT(REGVALUE_CLONETYPE), g_uCloneType);
SAVE(TEXT(REGVALUE_CLONETYPE), NewCloneType);
SAVE(TEXT(REGVALUE_THE_FREEZES_F8_ROM),g_uTheFreezesF8Rom); // NB. Can also be disabled on Config page (when Apple2Type changes)
eApple2Type NewApple2Clone = GetApple2Type(4, NewCloneType);
if (g_Apple2Type >= A2TYPE_CLONE)
{
if (NewApple2Clone != g_Apple2Type)
{
if ((afterclose == WM_USER_RESTART) || // Eg. Changing 'Freeze ROM' & user has already OK'd the restart for this
MessageBox(window,
TEXT(
"You have changed the emulated computer "
"type. This change will not take effect\n"
"until the next time you restart the "
"emulator.\n\n"
"Would you like to restart the emulator now?"),
TEXT("Configuration"),
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND) == IDYES)
{
afterclose = WM_USER_RESTART;
}
}
}
else
{
if (NewApple2Clone != (g_uCloneType + APPLECLONE_MASK|APPLE2E_MASK))
MessageBox(window,
TEXT(
"You have changed the emulated clone type "
"but in order for the changes to take effect\n"
"you shall set the emulated computer type "
"to Clone from the Configuration tab.\n\n"),
TEXT("Clone type changed"),
MB_ICONQUESTION | MB_OK | MB_SETFOREGROUND) ;
}
if (NewApple2Type > A2TYPE_APPLE2PLUS)
g_uTheFreezesF8Rom = false;
//
if (afterclose)
@ -1104,21 +1196,19 @@ static BOOL CALLBACK AdvancedDlgProc (HWND window,
case WM_INITDIALOG:
{
g_nLastPage = PG_ADVANCED;
g_nLastPage = PG_ADVANCED;
SendDlgItemMessage(window,IDC_SAVESTATE_FILENAME,WM_SETTEXT,0,(LPARAM)Snapshot_GetFilename());
SendDlgItemMessage(window,IDC_SAVESTATE_FILENAME,WM_SETTEXT,0,(LPARAM)Snapshot_GetFilename());
CheckDlgButton(window, IDC_SAVESTATE_ON_EXIT, g_bSaveStateOnExit ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(window, IDC_SAVESTATE_ON_EXIT, g_bSaveStateOnExit ? BST_CHECKED : BST_UNCHECKED);
g_szNewDirectory[0] = 0x00;
FillComboBox(window, IDC_CLONETYPE, g_CloneChoices, g_uCloneType);
InitFreezeDlgButton(window);
//
g_szNewDirectory[0] = 0x00;
FillComboBox(window, IDC_CLONETYPE, g_CloneChoices, g_uCloneType);
InitFreezeDlgButton(window);
afterclose = 0;
break;
afterclose = 0;
break;
}
}
@ -1367,6 +1457,7 @@ void ui_tfe_settings_dialog(HWND hwnd)
//===========================================================================
//Setup
void PSP_Init()
{
PROPSHEETPAGE PropSheetPages[PG_NUM_SHEETS];
@ -1411,8 +1502,10 @@ void PSP_Init()
PropSheetHeader.nStartPage = g_nLastPage;
PropSheetHeader.ppsp = PropSheetPages;
DWORD g_Apple2Type = 0;
g_bEnableFreezeDlgButton = UNDEFINED;
int i = PropertySheet(&PropSheetHeader); // Result: 0=Cancel, 1=OK
}
DWORD PSP_GetVolumeMax()
@ -1435,3 +1528,47 @@ bool PSP_SaveStateSelectImage(HWND hWindow, bool bSave)
return false; // Cancelled
}
}
string BrowseToCiderPress (HWND hWindow, TCHAR* pszTitle)
{
TCHAR szDirectory[MAX_PATH] = TEXT("");
TCHAR szCPFilename[MAX_PATH];
strcpy(szCPFilename, "");
RegLoadString(TEXT("Configuration"), REGVALUE_CIDERPRESSLOC, 1, szCPFilename ,MAX_PATH);
string PathName = szCPFilename;
OPENFILENAME ofn;
ZeroMemory(&ofn,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWindow;
ofn.hInstance = g_hInstance;
ofn.lpstrFilter = TEXT("Applications (*.exe)\0*.exe\0")
TEXT("All Files\0*.*\0");
ofn.lpstrFile = szCPFilename;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = szDirectory;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrTitle = pszTitle;
int nRes = GetOpenFileName(&ofn);
if(nRes) //Okay is pressed
{
strcpy(g_szNewFilename, &szCPFilename[ofn.nFileOffset]);
szCPFilename[ofn.nFileOffset] = 0;
if (_tcsicmp(szDirectory, szCPFilename))
strcpy(g_szNewDirectory, szCPFilename);
PathName = szCPFilename;
PathName.append (g_szNewFilename);
}
else //Cancel is pressed.
{
RegLoadString(TEXT("Configuration"), REGVALUE_CIDERPRESSLOC, 1, szCPFilename,MAX_PATH);
PathName = szCPFilename;
}
return PathName;
}

View File

@ -6,6 +6,7 @@ bool PSP_SaveStateSelectImage(HWND hWindow, bool bSave);
void ui_tfe_settings_dialog(HWND hwnd);
void * get_tfe_interface(void);
void get_tfe_enabled(int *tfe_enabled);
string BrowseToCiderPress (HWND hWindow, TCHAR* pszTitle);
extern UINT g_uScrollLockToggle;
extern UINT g_uMouseInSlot4;
@ -13,3 +14,5 @@ extern UINT g_uMouseShowCrosshair;
extern UINT g_uMouseRestrictToWindow;
extern UINT g_uTheFreezesF8Rom;
extern DWORD g_uCloneType;
extern HWND hwConfigTab;
extern HWND hwAdvancedTab;

View File

@ -53,5 +53,6 @@
#include "SerialComms.h"
#include "SoundCore.h"
#include "Speaker.h"
#include "Tape.h"
#include "Tfe/Tfe.h"
#include "Video.h"

99
AppleWin/source/Tape.cpp Normal file
View File

@ -0,0 +1,99 @@
/*
AppleWin : An Apple //e emulator for Windows
Copyright (C) 1994-1996, Michael O'Brien
Copyright (C) 1999-2001, Oliver Schmidt
Copyright (C) 2002-2005, Tom Charlesworth
Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski
AppleWin 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) any later version.
AppleWin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with AppleWin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Description: This module is created for emulation of the 8bit character mode (mode 1) switch,
* which is located in $c060, and so far does not intend to emulate a tape device.
*
*
* Author: Various
*/
#include "StdAfx.h"
#pragma hdrstop
static BYTE C060 = 255;
static bool CapsLockAllowed = false;
//---------------------------------------------------------------------------
BYTE __stdcall TapeRead (WORD, WORD address, BYTE, BYTE, ULONG nCyclesLeft)
{
/*
If retrieving KeybGetKeycode(); causes problems CurrentKestroke shall be added
in the submission variables and it shall be added by the TapeRead caller
i.e. BYTE __stdcall TapeRead (WORD, WORD address, BYTE, BYTE, ULONG nCyclesLeft) shall become
BYTE __stdcall TapeRead (WORD, WORD address, BYTE, BYTE, ULONG nCyclesLeft, byte CurrentKeystroke)
*/
static byte CurrentKestroke = 0;
CurrentKestroke = KeybGetKeycode();
if (g_Apple2Type == A2TYPE_PRAVETS8A )
{
C060= MemReadFloatingBus(nCyclesLeft); //IO_Null(pc, addr, bWrite, d, nCyclesLeft);
if (CapsLockAllowed) //8bit keyboard mode
{
if (((P8CAPS_ON == false) && (P8Shift == false)) || ((P8CAPS_ON ) && (P8Shift ))) //LowerCase
if ((CurrentKestroke<65) //|| ((CurrentKestroke>90) && (CurrentKestroke<96))
|| ((CurrentKestroke>126) && (CurrentKestroke<193)))
C060 |= 1 << 7; //Sets bit 7 to 1 for special keys (arrows, return, etc) and for control+ key combinations.
else
C060 &= 127; //sets bit 7 to 0
else //UpperCase
C060 |= 1 << 7;
}
else //7bit keyboard mode
{
C060 &= 191; //Sets bit 6 to 0; I am not sure if this shall be done, because its value is disregarded in this case.
C060 |= 1 << 7; //Sets bit 7 to 1
}
return C060;
}
else return MemReadFloatingBus(nCyclesLeft); //IO_Null(pc, addr, bWrite, d, nCyclesLeft);
}
/*
In case s.o. decides to develop tape device emulation, this function may be renamed,
because tape is not written in $C060
*/
BYTE __stdcall TapeWrite(WORD programcounter, WORD address, BYTE write, BYTE value, ULONG nCyclesLeft)
{
if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
if (value & 1)
CapsLockAllowed = true;
else
CapsLockAllowed = false;
//If bit0 of the input byte is 0, it will forbid 8-bit characters (Default)
//If bit0 of the input byte is 1, it will allow 8-bit characters
return 0;
}
else
{
return MemReadFloatingBus(nCyclesLeft);
}
}
bool __stdcall GetCapsLockAllowed ()
{
return CapsLockAllowed;
}

5
AppleWin/source/Tape.h Normal file
View File

@ -0,0 +1,5 @@
#pragma once
extern BYTE __stdcall TapeRead (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);
extern BYTE __stdcall TapeWrite (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft);
extern bool __stdcall GetCapsLockAllowed ();

View File

@ -931,8 +931,13 @@ void DrawMonoLoResSource () {
//===========================================================================
void DrawMonoTextSource (HDC hDstDC)
{
static HBITMAP hCharBitmap[3];
HDC hSrcDC = CreateCompatibleDC(hDstDC);
HBITMAP hBitmap = LoadBitmap(g_hInstance,TEXT("CHARSET40"));
hCharBitmap[0] = LoadBitmap(g_hInstance,TEXT("CHARSET40"));
hCharBitmap[1] = LoadBitmap(g_hInstance,TEXT("CHARSET82"));
hCharBitmap[2] = LoadBitmap(g_hInstance,TEXT("CHARSET8C"));
HBRUSH hBrush;
switch (videotype)
{
@ -941,7 +946,8 @@ void DrawMonoTextSource (HDC hDstDC)
case VT_MONO_WHITE: hBrush = CreateSolidBrush(RGB(0xFF,0xFF,0xFF)); break;
default : hBrush = CreateSolidBrush(monochrome); break;
}
SelectObject(hSrcDC,hBitmap);
SelectObject(hSrcDC,hCharBitmap[g_nCharsetType]);
SelectObject(hDstDC,hBrush);
// TODO: Update with APPLE_FONT_Y_ values
@ -951,15 +957,19 @@ void DrawMonoTextSource (HDC hDstDC)
SelectObject(hDstDC,GetStockObject(NULL_BRUSH));
DeleteObject(hBrush);
DeleteDC(hSrcDC);
DeleteObject(hBitmap);
DeleteObject(hCharBitmap);
}
//===========================================================================
void DrawTextSource (HDC dc)
{
HDC memdc = CreateCompatibleDC(dc);
HBITMAP bitmap = LoadBitmap(g_hInstance,TEXT("CHARSET40"));
SelectObject(memdc,bitmap);
static HBITMAP hCharBitmap[3];
//The charset is set below
hCharBitmap[0] = LoadBitmap(g_hInstance,TEXT("CHARSET40"));
hCharBitmap[1] = LoadBitmap(g_hInstance,TEXT("CHARSET82"));
hCharBitmap[2] = LoadBitmap(g_hInstance,TEXT("CHARSET8C"));
SelectObject(memdc,hCharBitmap[g_nCharsetType]);
BitBlt(
dc // hdcDest
@ -974,9 +984,9 @@ void DrawTextSource (HDC dc)
// Chars for 80 col mode
StretchBlt(dc,SRCOFFS_80COL,0,128,512,memdc,0,0,256,512,SRCCOPY);
DeleteDC(memdc);
DeleteObject(bitmap);
DeleteObject(hCharBitmap);
}
//===========================================================================