summaryrefslogtreecommitdiff
path: root/src/video/ncurses.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/video/ncurses.c')
-rw-r--r--src/video/ncurses.c64
1 files changed, 16 insertions, 48 deletions
diff --git a/src/video/ncurses.c b/src/video/ncurses.c
index a3ae8a4..1fbc314 100644
--- a/src/video/ncurses.c
+++ b/src/video/ncurses.c
@@ -4,7 +4,6 @@
#include<ncurses.h>
#include"interface.h"
-#include"signetics.c"
#include"../apple.h"
#include"../cpu/6502.h"
@@ -15,49 +14,12 @@ int TermY = 0;
WINDOW *AppleWindow;
-byte UserInput()
-{
- int c = getch();
- byte r;
-
- if (c == 0x08) // If c is backspace
- return 0xDF;
-
- if (c < 0x20) {
- if (c != 0x0D // CR
- && c != 0x1B) // Exit
- return -1;
- }
- //switch(c)
- //{
- // Convert special characters
- /*case KEY_F(1): //backspace
- r = 0xDF;
- break;
- case KEY_F(2): //enter
- r = 0x8D;
- break;
- case KEY_F(3): //exit, for escape. TODO: Figure out if this is Esc or not.
- r = 0x9B;
- break;*/
- // Convert regular characters
- /*default:
- if (c < 0x20 || c >= 0x60)
- return -1;
-
- if (c >= 0x40)
- r = c - 0x40;
- else
- r = c;
-
- break;
- }*/
-
- return c;
-}
+const byte* TerminalShiftRegister;
+byte* TerminalShiftRegisterPosition;
+
+int TerminalShiftRegisterOffset;
-#define FlagVisual(x, c) (getFlag(x)) ? c : '.'
void PrintInfo()
{
@@ -89,7 +51,7 @@ void PrintInfo()
-void TerminalInit()
+void DisplayInit()
{
// ncurses initialization functions.
initscr();
@@ -128,7 +90,7 @@ void TerminalInit()
-void TerminalClose()
+void DisplayClose()
{
free(TerminalShiftRegister);
curs_set(1);
@@ -137,11 +99,17 @@ void TerminalClose()
-void TerminalInput(byte n)
-{
+void DisplayInput(byte n)
+{
+ if (n == BS) {
+ return;
+ }
+
+ n &= 0b01111111;
+
// Place character
mvwaddch(AppleWindow, TermY, TermX, ' ');
- mvwaddch(AppleWindow, TermY, TermX, CharacterROM(n));
+ mvwaddch(AppleWindow, TermY, TermX, n);
// Add character to register
*TerminalShiftRegisterPosition = n;
@@ -174,7 +142,7 @@ void TerminalInput(byte n)
for (int j = 0; j < 40; j++) {
if (offset >= (TerminalShiftRegister + 960))
offset -= TerminalShiftRegister;
- mvwaddch(AppleWindow, i, j, CharacterROM(*offset) );
+ mvwaddch(AppleWindow, i, j, *offset );
offset++;
}}