summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authoralekseiplusplus <alekseijeaves@protonmail.com>2023-11-30 14:36:15 +1100
committeralekseiplusplus <alekseijeaves@protonmail.com>2023-11-30 14:36:15 +1100
commitd0f5e175f713a52d76d102780e0b899f3984c416 (patch)
treecfb4b030b186bf3dd4a155a78a9b232e4d971139 /src/video
parent401a2171b1fa2bcc077934191cc609208368152e (diff)
overall progress
Diffstat (limited to 'src/video')
-rw-r--r--src/video/interface.h3
-rw-r--r--src/video/ncurses.c63
2 files changed, 47 insertions, 19 deletions
diff --git a/src/video/interface.h b/src/video/interface.h
index 048aa25..2443b62 100644
--- a/src/video/interface.h
+++ b/src/video/interface.h
@@ -9,6 +9,9 @@
// Common procedure for taking in user input.
byte UserInput();
+// Common way to print processor information.
+void PrintInfo();
+
// Initialization procedure for the terminal
void TerminalInit();
diff --git a/src/video/ncurses.c b/src/video/ncurses.c
index d584088..2827ff7 100644
--- a/src/video/ncurses.c
+++ b/src/video/ncurses.c
@@ -6,6 +6,7 @@
#include"interface.h"
#include"signetics.c"
#include"../apple.h"
+#include"../cpu/6502.h"
int TermX = 0;
@@ -17,29 +18,65 @@ WINDOW *AppleWindow;
byte UserInput()
{
int c = getch();
+ byte C;
switch(c)
{
// Convert special characters
case KEY_BACKSPACE:
- return 0xDF;
+ C = 0xDF;
case KEY_ENTER:
- return 0x8D;
+ C = 0x8D;
case KEY_EXIT: //TODO: Figure out if this is Esc or not.
- return 0x9B;
+ C = 0x9B;
// Convert regular characters
default:
if (c < 0x20 || c >= 0x60)
return -1;
+
if (c >= 0x40)
- c -= 0x40;
+ C = c - 0x40;
+ else
+ C = c;
+
break;
}
+ SetMemory(KBD, C);
+
+ TerminalInput(c);
+
+
return c;
}
+#define FlagVisual(x, c) (getFlag(x)) ? c : '.'
+
+void PrintInfo()
+{
+ move(2, 43);
+ printf("acc : %x", acc);
+ move(3, 43);
+ printf(" X : %x", X );
+ move(4, 43);
+ printf(" Y : %x", Y );
+ move(5, 43);
+ printf(" PC : %x", PC);
+ move(6, 43);
+ printf("Flags : %c%c_%c%c%c%c%c",
+ getFlag(flag_N) ? 'N':'.' ,
+ getFlag(flag_V) ? 'V':'.' ,
+ getFlag(flag_B) ? 'B':'.' ,
+ getFlag(flag_D) ? 'D':'.' ,
+ getFlag(flag_I) ? 'I':'.' ,
+ getFlag(flag_Z) ? 'Z':'.' ,
+ getFlag(flag_C) ? 'C':'.'
+ );
+ refresh();
+}
+
+
void TerminalInit()
{
@@ -90,22 +127,10 @@ void TerminalClose()
void TerminalInput(byte n)
-{
- // Handle special characters and conversion.
- switch (n)
- {
- case 0xDF: // Backslash
- case 0x8D: // Enter
- case 0x9B: // Escape
- return;
- default:
- // Convert to ASCII
- if (n < 0x20) n += 0x40;
- }
-
+{
// Place character
mvwaddch(AppleWindow, TermY, TermX, ' ');
- mvwaddch(AppleWindow, TermY, TermX, n);
+ mvwaddch(AppleWindow, TermY, TermX, CharacterROM[n]);
// Add character to register
*TerminalShiftRegisterPosition = n;
@@ -138,7 +163,7 @@ void TerminalInput(byte n)
for (int j = 0; j < 40; j++) {
if (offset >= (TerminalShiftRegister + 960))
offset -= TerminalShiftRegister;
- mvwaddch(AppleWindow, i, j, (*offset < 0x20) ? *offset + 0x40 : *offset );
+ mvwaddch(AppleWindow, i, j, CharacterROM[*offset] );
offset++;
}}