From b1c9034b2f91ba8f12ae2308196f4de7fa7359bd Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Fri, 1 Dec 2023 08:42:58 +1100 Subject: changed TerminalShiftRegister to VRAM --- src/video/ncurses.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/video') diff --git a/src/video/ncurses.c b/src/video/ncurses.c index 1fbc314..c7cf3fb 100644 --- a/src/video/ncurses.c +++ b/src/video/ncurses.c @@ -14,11 +14,11 @@ int TermY = 0; WINDOW *AppleWindow; -const byte* TerminalShiftRegister; +const byte* VRAM; -byte* TerminalShiftRegisterPosition; +byte* VRAM_Position; -int TerminalShiftRegisterOffset; +int VRAM_Offset; void PrintInfo() @@ -81,9 +81,9 @@ void DisplayInit() mvwaddch(AppleWindow, TermY, TermX, '@' | A_BLINK); // Initialize the terminal shift register variables. - TerminalShiftRegister = (byte*)malloc(960); - TerminalShiftRegisterPosition = TerminalShiftRegister; - TerminalShiftRegisterOffset = 0; + VRAM = (byte*)malloc(960); + VRAM_Position = VRAM; + VRAM_Offset = 0; refresh(); } @@ -92,7 +92,7 @@ void DisplayInit() void DisplayClose() { - free(TerminalShiftRegister); + free(VRAM); curs_set(1); endwin(); } @@ -112,10 +112,10 @@ void DisplayInput(byte n) mvwaddch(AppleWindow, TermY, TermX, n); // Add character to register - *TerminalShiftRegisterPosition = n; - TerminalShiftRegisterPosition++; - if (TerminalShiftRegisterPosition >= (TerminalShiftRegister + 960)) - TerminalShiftRegisterPosition = TerminalShiftRegister; + *VRAM_Position = n; + VRAM_Position++; + if (VRAM_Position >= (VRAM + 960)) + VRAM_Position = VRAM; TermX++; // If X is past width.. @@ -128,20 +128,20 @@ void DisplayInput(byte n) // If Y is past height.. if (TermY >= 24) { //.. discard the first line.. - TerminalShiftRegisterOffset += 40; + VRAM_Offset += 40; //.. verify the register offset.. - if (TerminalShiftRegisterOffset >= 960) - TerminalShiftRegisterOffset = TerminalShiftRegister; + if (VRAM_Offset >= 960) + VRAM_Offset = VRAM; //.. and create an offset variable to cycle through memory with. - byte *offset = TerminalShiftRegister + TerminalShiftRegisterOffset; + byte *offset = VRAM + VRAM_Offset; // Then, for every cell of the screen, fill with the contents of the video memory. for (int i = 0; i < 23; i++) { for (int j = 0; j < 40; j++) { - if (offset >= (TerminalShiftRegister + 960)) - offset -= TerminalShiftRegister; + if (offset >= (VRAM + 960)) + offset -= VRAM; mvwaddch(AppleWindow, i, j, *offset ); offset++; }} -- cgit v1.2.3