From 0df32dbeba27645191bf3161bcea7e320450894c Mon Sep 17 00:00:00 2001 From: Jorj Bauer Date: Sat, 9 Jan 2021 12:15:12 -0500 Subject: [PATCH] improve BIOS about screen --- bios.cpp | 76 ++++++++++++++++++++++++++++++++++++++- globals.h | 3 +- sdl/sdl-display.cpp | 4 +++ teensy/teensy-display.cpp | 4 +++ 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/bios.cpp b/bios.cpp index 181f39f..84735be 100644 --- a/bios.cpp +++ b/bios.cpp @@ -527,6 +527,13 @@ uint16_t BIOS::AboutScreenHandler(bool needsRedraw, bool performAction) if (needsRedraw || localRedraw) { g_display->clrScr(c_darkblue); + // Draw a black area where we're going to "boot" a fake //e for the about screen. Don't put the whole graphic around it so it's obvious it's not a //e. + for (uint8_t y=12; y<12+192; y++) { + for (uint16_t x=20; x<280+20; x++) { + g_display->drawUIPixel( x, y, 0x0000 ); + } + } + /* g_display->drawString(M_SELECTED, 0, 0, @@ -544,13 +551,80 @@ uint16_t BIOS::AboutScreenHandler(bool needsRedraw, bool performAction) 0, 200, "Press return"); - + */ g_display->flush(); localRedraw = false; } + const char *str = + " " + " Aiie! " + " " + " " + " " + " " + " " + " " + " ... an Apple //e emulator " + " written by " + " Jorj Bauer " + " " + " " + " " + " (c) 2017-2021 Jorj Bauer " + " " + " " + " Source code is available at " + " github.com/JorjBauer/aiie/ " + " " + " " + " " + " Press ... " // intentionally short so cursor stays here + ; + + static uint16_t ptr = 0; + static bool didFinish = false; + + if (!didFinish) { + // Draw the next character + bool didOne = false; + while (!didOne || ptr < 35*2) { // draw the first 2 lines in one go, no matter what + char charToDraw = str[ptr]; + didOne = true; + int xpos = ptr % 35; + int ypos = (int)(ptr / 35); + if (charToDraw != ' ') { + // First 2 lines have a blue background on any text; others are black + g_display->drawCharacter(ptr < 70 ? M_NORMAL : M_PLAIN, xpos * 8 + 20, ypos * 8 + 12, charToDraw); + } + ptr++; + if (ptr >= strlen(str)) { + didFinish = true; + } else { + if (charToDraw == ' ') { + // Just blep the spaces to the screen toot-sweet + didOne = false; + } + } + } + } else { + // Flash the cursor until the user exits + static bool cursorOn = false; + static bool flopTime = false; + flopTime = !flopTime; + if (flopTime) { + cursorOn = !cursorOn; + } + int xpos = strlen(str) % 35; + int ypos = (int)(strlen(str) / 35); + g_display->drawCharacter(M_PLAIN, xpos * 8 + 20, ypos * 8 + 12, cursorOn ? 127 : 32); + } + g_display->flush(); + if (performAction) { + ptr = 0; + didFinish = false; return BIOS_AIIE; } diff --git a/globals.h b/globals.h index e995cc2..d8fda9a 100644 --- a/globals.h +++ b/globals.h @@ -19,7 +19,8 @@ enum { M_NORMAL = 0, M_SELECTED = 1, M_DISABLED = 2, - M_SELECTDISABLED = 3 + M_SELECTDISABLED = 3, + M_PLAIN = 4 }; // debug modes diff --git a/sdl/sdl-display.cpp b/sdl/sdl-display.cpp index 3ffbce3..0132751 100644 --- a/sdl/sdl-display.cpp +++ b/sdl/sdl-display.cpp @@ -200,6 +200,10 @@ void SDLDisplay::drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c) onPixel = 0x7BEF; offPixel = 0xFFE0; break; + case M_PLAIN: + onPixel = 0xFFFF; + offPixel = 0x0000; + break; } diff --git a/teensy/teensy-display.cpp b/teensy/teensy-display.cpp index 4f1152f..3d38079 100644 --- a/teensy/teensy-display.cpp +++ b/teensy/teensy-display.cpp @@ -225,6 +225,10 @@ void TeensyDisplay::drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c) onPixel = 0x7BEF; offPixel = 0xFFE0; break; + case M_PLAIN: + onPixel = 0xFFFF; + offPixel = 0x0000; + break; } // This does not scale when drawing, because drawPixel scales.