From 44a1ea6542c812b173fb9685837c0b2fdc6a7c61 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Wed, 29 Nov 2023 17:38:56 +1100 Subject: bug fix apple.c:9 + inconsequential refactoring --- src/video/interface.h | 10 +++++++++- src/video/ncurses.c | 17 ++++++++++------- src/video/signetics.c | 8 +++----- 3 files changed, 22 insertions(+), 13 deletions(-) (limited to 'src/video') 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 + // 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 #include"interface.h" #include"signetics.c" -#include +#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 -- cgit v1.2.3