On 04/07/2016 10:16, Gerd Hoffmann wrote:
- sercon_putchar('\x1b');
- sercon_putchar('c');
- /* clear screen */
- sercon_putchar('\x1b');
- sercon_putchar('[');
- sercon_putchar('2');
- sercon_putchar('J');
+}
+static void sercon_set_color(u8 fg, u8 bg, u8 bold) +{
- sercon_putchar('\x1b');
- sercon_putchar('[');
- sercon_putchar('0');
- if (fg != 7) {
sercon_putchar(';');
sercon_putchar('3');
sercon_putchar(GET_LOW(sercon_cmap[fg & 7]));
- }
- if (bg != 0) {
sercon_putchar(';');
sercon_putchar('4');
sercon_putchar(GET_LOW(sercon_cmap[bg & 7]));
- }
- if (bold) {
sercon_putchar(';');
sercon_putchar('1');
- }
- sercon_putchar('m');
Add a sercon_putstr perhaps?
+/* Read character and attribute at cursor position */
+static void sercon_1008(struct bregs *regs) +{
- regs->ah = 0x07;
- regs->bh = ' ';
+}
FYI, the sgabios code seems to indicate that sercon_1008() needs to be implemented for some programs to work properly. The sgabios code even implements a cache of recent writes to try to get it to work. It's ugly.
Didn't run into any issues yet, but also tested linux bootloaders only.
Maybe we can reuse the output buffer which we have anyway. Logic needs reworked a bit. We can't just clear characters after printing them out if we want be able to read them later, so we need a separate pending-updates bit. Also should be bigger I guess, maybe 80 chars so it can cover a complete line.
80x25 is just 2K... Perhaps it's simpler to just allocate the whole video buffer from the UMB or EBDA when serial console is in use?
(GWBASIC in graphics modes, for one, uses 10/08 from the whole screen. I don't know if it does that in text modes too).
Paolo