summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authoralekseiplusplus <alekseijeaves@protonmail.com>2023-11-29 17:38:56 +1100
committeralekseiplusplus <alekseijeaves@protonmail.com>2023-11-29 17:38:56 +1100
commit44a1ea6542c812b173fb9685837c0b2fdc6a7c61 (patch)
tree5ca86b97f79c38a07d4c532be6edcc12a887cbc1 /src/video
parent8d3aaacf14997bbac177ae37ccab4618264cf29c (diff)
bug fix apple.c:9 + inconsequential refactoring
Diffstat (limited to 'src/video')
-rw-r--r--src/video/interface.h10
-rw-r--r--src/video/ncurses.c17
-rw-r--r--src/video/signetics.c8
3 files changed, 22 insertions, 13 deletions
diff --git a/src/video/interface.h b/src/video/interface.h
index 5100032..e3244b0 100644
--- a/src/video/interface.h
+++ b/src/video/interface.h
@@ -1,11 +1,19 @@
// interface.h
// Provides the interface with which all video interactions must occur.
+#pragma once
+
+#include "../cpu/core.h"
+#include <stdlib.h>
+
// Common procedure for taking in user input.
char UserInput();
+// Initialization procedure for the terminal
void TerminalInit();
+// Exit procedure for the terminal.
void TerminalClose();
-void TerminalInput(char n);
+// Deliver an Apple ASCII character to the terminal.
+void TerminalInput(char n); \ No newline at end of file
diff --git a/src/video/ncurses.c b/src/video/ncurses.c
index 380c57a..2e3e519 100644
--- a/src/video/ncurses.c
+++ b/src/video/ncurses.c
@@ -2,9 +2,10 @@
// Implements interface.h
// Provides an in-terminal interface to the emulator.
+#include<ncurses.h>
#include"interface.h"
#include"signetics.c"
-#include<ncurses.h>
+#include"../apple.h"
int TermX = 0;
@@ -56,7 +57,6 @@ void TerminalInit()
-
void TerminalClose()
{
free(TerminalShiftRegister);
@@ -64,10 +64,13 @@ void TerminalClose()
endwin();
}
+
+
// Takes an an Apple I ASCII character.
void TerminalInput(char n)
{
- mvwaddch(AppleWindow, TermY,TermX,n);
+ mvwaddch(AppleWindow, TermY, TermX, ' ');
+ mvwaddch(AppleWindow, TermY, TermX, n);
*TerminalShiftRegisterPosition = n;
TerminalShiftRegisterPosition++;
@@ -77,9 +80,9 @@ void TerminalInput(char n)
TermX++;
- if (n == KEY_ENTER) {
- TermY++;
- }
+ //if (n == KEY_ENTER) {
+ // TermY++;
+ //}
if (TermX >= 40) {
TermX = 0;
@@ -100,7 +103,7 @@ void TerminalInput(char n)
if (offset >= (TerminalShiftRegister + 960))
offset -= 960;
- mvwaddch(AppleWindow, i, j, *(offset));
+ mvwaddch(AppleWindow, i, j, ToAscii(*(offset)));
offset++;
}}
diff --git a/src/video/signetics.c b/src/video/signetics.c
index 4a996d8..09e9836 100644
--- a/src/video/signetics.c
+++ b/src/video/signetics.c
@@ -1,8 +1,6 @@
-// signetics.h
+// 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.
-
-#include"../cpu/core.h"
-#include"stdlib.h"
+// Intended to be included during pre-processing into the .c of the used video library.
const byte CharacterROM[0x40] = {
'@' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' , 'M' , 'N' , 'O' ,
@@ -15,4 +13,4 @@ const byte* TerminalShiftRegister;
byte* TerminalShiftRegisterPosition;
-int TerminalShiftRegisterOffset;
+int TerminalShiftRegisterOffset; \ No newline at end of file