Pravets refactor: move all specialisations into new Pravets class. (PR #914)

Mainly for keyboard & printer specialisations.
This commit is contained in:
TomCh
2021-01-17 10:48:06 +00:00
committed by GitHub
parent fc3a0f57ce
commit daa0675694
15 changed files with 288 additions and 269 deletions
+7 -64
View File
@@ -21,8 +21,7 @@ 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.
/* Description: Tape interface.
*
* Author: Various
*
@@ -31,78 +30,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "StdAfx.h"
#include "Core.h"
#include "Tape.h"
#include "Keyboard.h"
#include "Memory.h"
#include "Pravets.h"
static bool g_CapsLockAllowed = false;
//---------------------------------------------------------------------------
BYTE __stdcall TapeRead(WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles)
BYTE __stdcall TapeRead(WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles) // $C060 TAPEIN
{
/*
If retrieving KeybGetKeycode(); causes problems uCurrentKeystroke 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 nExecutedCycles) shall become
BYTE __stdcall TapeRead (WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles, BYTE uCurrentKeystroke)
*/
if (g_Apple2Type == A2TYPE_PRAVETS8A)
return GetPravets().GetKeycode( MemReadFloatingBus(nExecutedCycles) );
if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
const BYTE uCurrentKeystroke = KeybGetKeycode();
BYTE C060 = MemReadFloatingBus(nExecutedCycles);
if (g_CapsLockAllowed) //8bit keyboard mode
{
if (((P8CAPS_ON == false) && (P8Shift == false)) || ((P8CAPS_ON ) && (P8Shift ))) //LowerCase
{
if ((uCurrentKeystroke<65) //|| ((uCurrentKeystroke>90) && (uCurrentKeystroke<96))
|| ((uCurrentKeystroke>126) && (uCurrentKeystroke<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;
}
return MemReadFloatingBus(1, nExecutedCycles); // TAPEIN has high bit 1 when input is low or not connected (UTAIIe page 7-5, 7-6)
}
/*
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 nExecutedCycles)
BYTE __stdcall TapeWrite(WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles) // $C020 TAPEOUT
{
if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
if (value & 1)
g_CapsLockAllowed = true;
else
g_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;
}
return MemReadFloatingBus(nExecutedCycles);
}
bool GetCapsLockAllowed(void)
{
return g_CapsLockAllowed;
return 0;
}