summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
Diffstat (limited to 'src/video')
-rw-r--r--src/video/interface.h6
-rw-r--r--src/video/ncurses.c64
-rw-r--r--src/video/signetics.c20
3 files changed, 19 insertions, 71 deletions
diff --git a/src/video/interface.h b/src/video/interface.h
index 2443b62..dc074b2 100644
--- a/src/video/interface.h
+++ b/src/video/interface.h
@@ -13,10 +13,10 @@ byte UserInput();
void PrintInfo();
// Initialization procedure for the terminal
-void TerminalInit();
+void DisplayInit();
// Exit procedure for the terminal.
-void TerminalClose();
+void DisplayClose();
// Deliver an Apple ASCII character to the terminal.
-void TerminalInput(byte n);
+void DisplayInput(byte n);
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++;
}}
diff --git a/src/video/signetics.c b/src/video/signetics.c
deleted file mode 100644
index 3dd279b..0000000
--- a/src/video/signetics.c
+++ /dev/null
@@ -1,20 +0,0 @@
-// signetics.c
-// Signetics refers to the various Signetics brand chips which the Apple I came with, including a character ROM, and a shift-register based video memory.
-// Intended to be included during pre-processing into the .c of the used video library.
-
-const byte SigneticsROM[0x40] = {
- '@' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' , 'M' , 'N' , 'O' ,
- 'P' , 'Q' , 'R' , 'S' , 'T' , 'U' , 'V' , 'W' , 'X' , 'Y' , 'Z' , '[' , '\\', ']' , '^' , '_' ,
- ' ' , '!' , '"' , '#' , '$' , '%' , '&' , '\'', '(' , ')' , '*' , '+' , ',' , '-' , '.' , '/' ,
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , ':' , ';' , '<' , '=' , '>' , '?'
-};
-
-byte CharacterROM(byte x) {
- return SigneticsROM[ x & 0b01111111 ];
-}
-
-const byte* TerminalShiftRegister;
-
-byte* TerminalShiftRegisterPosition;
-
-int TerminalShiftRegisterOffset;