mirror of
https://github.com/RyuKojiro/apple1.git
synced 2025-01-01 06:29:24 +00:00
This character encoding should be correct now
git-svn-id: svn+ssh://svn.phoenixbox.net/svn/apple1/trunk@26 64f78de7-aa59-e511-a0e8-0002a5492df0
This commit is contained in:
parent
229d04b9cd
commit
d2a680bdf7
29
apple1/pia.c
29
apple1/pia.c
@ -32,31 +32,16 @@ void saveFreeze(v6502_memory *mem, const char *fname) {
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
char asciiCharFromA1Char(uint8_t c) {
|
char asciiCharFromCursesKey(int key) {
|
||||||
switch (c) {
|
return (char)key;
|
||||||
case 0xDC: return '\\';
|
}
|
||||||
case 0x8D: return '\r';
|
|
||||||
case 0xDF: return 0x7F; // Backspace
|
|
||||||
case 0x9B: return '\e'; // Escape
|
|
||||||
}
|
|
||||||
|
|
||||||
return (char)c;
|
char asciiCharFromA1Char(uint8_t c) {
|
||||||
|
return (char)c & ~0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t a1CharFromAsciiChar(char c) {
|
uint8_t a1CharFromAsciiChar(char c) {
|
||||||
switch (c) {
|
return (char)c | 0x80;
|
||||||
case '\\': return 0xDC;
|
|
||||||
case '\r': return 0x8D;
|
|
||||||
case 0x7F: return 0xDF; // Backspace
|
|
||||||
case '\e': return 0x9B; // Escape
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c >= 'a' && c <= 'z') {
|
|
||||||
return (char)c & ~0x20;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (char)c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void videoWriteCharCallback(struct _v6502_memory *memory, uint16_t offset, uint8_t value, a1pia *context) {
|
void videoWriteCharCallback(struct _v6502_memory *memory, uint16_t offset, uint8_t value, a1pia *context) {
|
||||||
@ -100,7 +85,7 @@ uint8_t keyboardReadReadyCallback(struct _v6502_memory *memory, uint16_t offset,
|
|||||||
int c = getch();
|
int c = getch();
|
||||||
|
|
||||||
if (c != ERR) {
|
if (c != ERR) {
|
||||||
context->buf = c;
|
context->buf = asciiCharFromCursesKey(c);
|
||||||
return KEYBOARD_READY;
|
return KEYBOARD_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user