diff options
Diffstat (limited to 'src/apple.c')
-rw-r--r-- | src/apple.c | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src/apple.c b/src/apple.c index 6c977a2..ba2cfb6 100644 --- a/src/apple.c +++ b/src/apple.c @@ -1,5 +1,6 @@ #include"apple.h" +// The Incredible Wozmon! const byte ROM[256] = { 0xd8, 0x58, 0xa0, 0x7f, 0x8c, 0x12, 0xd0, 0xa9, 0xa7, 0x8d, 0x11, 0xd0, 0x8d, 0x13, 0xd0, 0xc9, @@ -61,23 +62,6 @@ void AppleReset(){ Memory = calloc(MEMORY_SIZE, sizeof(byte)); } -/*byte ToAppleAscii(char x) -{ - if (x < 0x20 || x >= 0x60) - return -1; - if (x >= 0x40) - x -= 0x40; - return x; -} - -byte ToAscii(char x) -{ - if (x < 0x20) - x += 0x40; - return x; -}*/ - - byte GetMemory(address x){ switch(x) { @@ -108,9 +92,38 @@ void SetMemory(address x, byte y){ switch(x) { case DSP: - TerminalInput(y); + DisplayInput(y); } if (x < MEMORY_SIZE) { Memory[x] = y; } } + + + +byte UserInput() +{ + #ifdef GRAPHICAL + + #else + int c = getch(); + #endif + + switch(c) + { + case 0x08: + return BS; + case 0x0A: + return CR; + case 0x1B: + return ESC; + } + + if (c < 0x20) + return -1; + + if (c >= 0x60) + return -1; + + return c; +} |