static BYTE __stdcall IORead_C06x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft) { static byte CurrentKestroke = 0; CurrentKestroke = KeybGetKeycode(); switch (addr & 0xf) { //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); case 0xB: return IO_Null(pc, addr, bWrite, d, nCyclesLeft); case 0xC: return IO_Null(pc, addr, bWrite, d, nCyclesLeft); case 0xD: return IO_Null(pc, addr, bWrite, d, nCyclesLeft); case 0xE: return IO_Null(pc, addr, bWrite, d, nCyclesLeft); case 0xF: return IO_Null(pc, addr, bWrite, d, nCyclesLeft); } return 0; }
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); }
BYTE __stdcall TapeRead(WORD, WORD address, BYTE, BYTE, ULONG nCyclesLeft) { /* 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 nCyclesLeft) shall become BYTE __stdcall TapeRead (WORD, WORD address, BYTE, BYTE, ULONG nCyclesLeft, BYTE uCurrentKeystroke) */ if (g_Apple2Type == A2TYPE_PRAVETS8A) { const BYTE uCurrentKeystroke = KeybGetKeycode(); BYTE C060 = MemReadFloatingBus(nCyclesLeft); 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 (1<<7) | (MemReadFloatingBus(nCyclesLeft) & 0x7F); // Keep high-bit fixed (since TAPEIN isn't supported) }