public Trainer() { emu = new Cpu6800(); // Set keyboard mapped memory 'high' emu.Memory[0xC003] = 0xFF; emu.Memory[0xC005] = 0xFF; emu.Memory[0xC006] = 0xFF; emu.Reset(); }
/// <summary> /// Simulate keypress through memory-mapped locations C003-C006 /// </summary> /// <param name="key"></param> public void PressKey(Keys key) { switch (key) { // pull appropriate bit at mem location LOW case Keys.Key0: emu.Memory[0xC006] &= 0xDF; break; case Keys.Key1: // 1, ACCA emu.Memory[0xC006] &= 0xEF; break; case Keys.Key2: // 2 emu.Memory[0xC005] &= 0xEF; break; case Keys.Key3: // 3 emu.Memory[0xC003] &= 0xEF; break; case Keys.Key4: // 4, INDEX emu.Memory[0xC006] &= 0xF7; break; case Keys.Key5: // 5, CC emu.Memory[0xC005] &= 0xF7; break; case Keys.Key6: // 6 emu.Memory[0xC003] &= 0xF7; break; case Keys.Key7: // 7, RTI; emu.Memory[0xC006] &= 0xFB; break; case Keys.Key8: // 8 emu.Memory[0xC005] &= 0xFB; break; case Keys.Key9: // 9 emu.Memory[0xC003] &= 0xFB; break; case Keys.KeyA: // A, Auto emu.Memory[0xC006] &= 0xFD; break; case Keys.KeyB: // B emu.Memory[0xC005] &= 0xFD; break; case Keys.KeyC: // C emu.Memory[0xC003] &= 0xFD; break; case Keys.KeyD: // D, Do emu.Memory[0xC006] &= 0xFE; break; case Keys.KeyE: // E, Exam emu.Memory[0xC005] &= 0xFE; break; case Keys.KeyF: // F emu.Memory[0xC003] &= 0xFE; break; case Keys.KeyReset: // RESET emu.Reset(); break; } }