/// <summary> /// Simulate releasing of keys /// </summary> /// <param name="trainerKey"></param> public void ReleaseKey(TrainerKeys trainerKey) { // just pull everything high. // we're not monitoring multiple presses anyway Memory[0xC003] = 0xFF; Memory[0xC005] = 0xFF; Memory[0xC006] = 0xFF; switch (trainerKey) { case TrainerKeys.KeyReset: // RESET Emulator.State.Reset = 1; break; } }
/// <summary> /// Simulate keypress through memory-mapped locations C003-C006 /// </summary> /// <param name="trainerKey"></param> public void PressKey(TrainerKeys trainerKey) { switch (trainerKey) { // pull appropriate bit at mem location LOW case TrainerKeys.Key0: Memory[0xC006] &= 0xDF; break; case TrainerKeys.Key1: // 1, ACCA Memory[0xC006] &= 0xEF; break; case TrainerKeys.Key2: // 2 Memory[0xC005] &= 0xEF; break; case TrainerKeys.Key3: // 3 Memory[0xC003] &= 0xEF; break; case TrainerKeys.Key4: // 4, INDEX Memory[0xC006] &= 0xF7; break; case TrainerKeys.Key5: // 5, CC Memory[0xC005] &= 0xF7; break; case TrainerKeys.Key6: // 6 Memory[0xC003] &= 0xF7; break; case TrainerKeys.Key7: // 7, RTI; Memory[0xC006] &= 0xFB; break; case TrainerKeys.Key8: // 8 Memory[0xC005] &= 0xFB; break; case TrainerKeys.Key9: // 9 Memory[0xC003] &= 0xFB; break; case TrainerKeys.KeyA: // A, Auto Memory[0xC006] &= 0xFD; break; case TrainerKeys.KeyB: // B Memory[0xC005] &= 0xFD; break; case TrainerKeys.KeyC: // C Memory[0xC003] &= 0xFD; break; case TrainerKeys.KeyD: // D, Do Memory[0xC006] &= 0xFE; break; case TrainerKeys.KeyE: // E, Exam Memory[0xC005] &= 0xFE; break; case TrainerKeys.KeyF: // F Memory[0xC003] &= 0xFE; break; case TrainerKeys.KeyReset: // RESET Emulator.State.Reset = 0; break; } }