diff options
Diffstat (limited to 'src/video')
-rw-r--r-- | src/video/ncurses.c | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/src/video/ncurses.c b/src/video/ncurses.c index c7cf3fb..242a3e1 100644 --- a/src/video/ncurses.c +++ b/src/video/ncurses.c @@ -105,31 +105,45 @@ void DisplayInput(byte n) return; } - n &= 0b01111111; - - // Place character + // Clear @ mvwaddch(AppleWindow, TermY, TermX, ' '); - mvwaddch(AppleWindow, TermY, TermX, n); + + if (n == CR) { + // Add spacing characters into VRAM + do { + *VRAM_Position = ' '; + VRAM_Position++; + } while (((int)(VRAM_Position - VRAM) % 40) > 0); + + // Set display to next line + TermX = 0; + TermY++; + } + else { + // Place character + mvwaddch(AppleWindow, TermY, TermX, n & 0x7F); - // Add character to register - *VRAM_Position = n; - VRAM_Position++; - if (VRAM_Position >= (VRAM + 960)) - VRAM_Position = VRAM; - - TermX++; - // If X is past width.. - if (TermX >= 40) { - //.. move to start of next line. - TermX = 0; - TermY++; - } + // Add character to VRAM + *VRAM_Position = n & 0x7f; + VRAM_Position++; + + // Set display to next character/next line + TermX++; + if (TermX >= 40) { + TermX = 0; + TermY++; + } + } + // Reset VRAM_Position if it's value is too great. + if (VRAM_Position >= (VRAM + 960)) + VRAM_Position -= 960; + // If Y is past height.. if (TermY >= 24) { + //.. discard the first line.. VRAM_Offset += 40; - //.. verify the register offset.. if (VRAM_Offset >= 960) VRAM_Offset = VRAM; @@ -141,7 +155,7 @@ void DisplayInput(byte n) for (int i = 0; i < 23; i++) { for (int j = 0; j < 40; j++) { if (offset >= (VRAM + 960)) - offset -= VRAM; + offset -= 960; mvwaddch(AppleWindow, i, j, *offset ); offset++; }} @@ -153,7 +167,7 @@ void DisplayInput(byte n) " "); } - // @ prompt. + // Place @ mvwaddch(AppleWindow, TermY, TermX, '@' | A_BLINK); wrefresh(AppleWindow); } |