-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keyboard and character drawing tweaks
- Loading branch information
Showing
4 changed files
with
74 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Source: | ||
https://mirrors.apple2.org.za/ftp.apple.asimov.net/emulators/rom_images/ | ||
apple_2e_unenhanced_rom.zip |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,27 @@ | ||
use crate::keyboard::apple::AppleKeys; | ||
use crate::keyboard::{KeyAdapter, KeyState, KeySymbol}; | ||
|
||
/// The keyboard matrix found on a Commodore 64. | ||
/// Source: <https://www.c64-wiki.com/wiki/Keyboard>. | ||
pub const KEYBOARD_MAPPING: [[AppleKeys; 10]; 8] = { | ||
use AppleKeys::*; | ||
pub struct AppleIISymbolAdapter; | ||
|
||
[ | ||
[ | ||
Esc, Digit1, Digit2, Digit3, Digit4, Digit6, Digit5, Digit7, Digit8, Digit9, | ||
], | ||
[Tab, Q, W, E, R, Y, T, U, I, O], | ||
[A, D, S, H, F, G, J, K, Semicolon, L], | ||
[Z, X, C, V, B, N, M, Comma, Period, Backslash], | ||
[ | ||
NumDivide, NumLeft, Num0, Num1, Num2, Num3, Slash, Equals, Digit0, Minus, | ||
], | ||
[ | ||
NumRightParen, | ||
NumEsc, | ||
Num4, | ||
Num5, | ||
Num6, | ||
Num7, | ||
Grave, | ||
P, | ||
LeftBracket, | ||
RightBracket, | ||
], | ||
[ | ||
NumMultiply, | ||
NumRight, | ||
Digit8, | ||
Digit9, | ||
NumPeriod, | ||
NumPlus, | ||
Return, | ||
UpArrow, | ||
Space, | ||
Apostrophe, | ||
], | ||
[ | ||
NumPrint, | ||
NumSpace, | ||
NumLeftParen, | ||
NumMinus, | ||
NumReturn, | ||
NumComma, | ||
Del, | ||
DownArrow, | ||
LeftArrow, | ||
RightArrow, | ||
], | ||
] | ||
}; | ||
impl KeyAdapter<KeySymbol, u8> for AppleIISymbolAdapter { | ||
fn map(state: &KeyState<KeySymbol>) -> KeyState<u8> { | ||
let mut mapped = KeyState::new(); | ||
|
||
for symbol in state.pressed() { | ||
use KeySymbol::*; | ||
|
||
let mapped_symbol = match symbol { | ||
&Char(c) => Some(c as u8), | ||
Return => Some(0x0D), // Carriage Return | ||
Backspace => Some(0x08), | ||
Escape => Some(0x1B), | ||
_ => None, | ||
}; | ||
|
||
if let Some(symbol) = mapped_symbol { | ||
mapped.press(symbol); | ||
} | ||
} | ||
|
||
mapped | ||
} | ||
} |
Oops, something went wrong.