Added some character set conversion code

git-svn-id: svn+ssh://svn.phoenixbox.net/svn/apple1/trunk@8 64f78de7-aa59-e511-a0e8-0002a5492df0
This commit is contained in:
Daniel Loffgren 2015-09-14 01:13:08 +00:00
parent 76d6da7302
commit d5b4f0a83b
1 changed files with 14 additions and 2 deletions

View File

@ -12,9 +12,21 @@
#define FIXME_I_SHOULDNT_BE_NULL NULL
char asciiCharFromA1Char(uint8_t c) {
switch (c) {
case 0xDC: return '\\';
case 0x8D: return '\n';
}
return (char)c;
}
void videoWriteCharCallback(struct _v6502_memory *memory, uint16_t offset, uint8_t value, void *context) {
fprintf(stdout, ANSI_COLOR_BRIGHT_GREEN "%c" ANSI_COLOR_RESET, value);
fflush(stdout);
if (value) {
fprintf(stdout, ANSI_COLOR_BRIGHT_GREEN "%c" ANSI_COLOR_RESET, asciiCharFromA1Char(value));
//fprintf(stderr, "I was asked to print (0x%02x)\n", value);
//memory->bytes[offset] = value;
fflush(stdout);
}
}
void videoWriteNewlineCallback(struct _v6502_memory *memory, uint16_t offset, uint8_t value, void *context) {