Fix CGA graphics-mode text and native keyboard input
authorRobert Pengelly <robertapengelly@hotmail.com>
Thu, 29 Oct 2026 21:41:50 +0000 (21:41 +0000)
committerRobert Pengelly <robertapengelly@hotmail.com>
Thu, 29 Oct 2026 21:41:50 +0000 (21:41 +0000)
bios_cga_font.h [new file with mode: 0644]
interrupts.c

diff --git a/bios_cga_font.h b/bios_cga_font.h
new file mode 100644 (file)
index 0000000..6080ec2
--- /dev/null
@@ -0,0 +1,141 @@
+/******************************************************************************
+ * @file            bios_cga_font.h
+ *****************************************************************************/
+#ifndef     _BIOS_CGA_FONT_H
+#define     _BIOS_CGA_FONT_H
+
+/* Eight-scanline glyph bitmaps rendered from DejaVu Sans Mono for CGA BIOS graphics text. */
+static const uint8_t bios_cga_font[128][8] = {
+
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 0 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 1 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 2 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 3 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 4 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 5 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 6 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 7 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 8 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 9 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 10 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 11 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 12 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 13 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 14 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 15 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 16 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 17 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 18 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 19 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 20 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 21 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 22 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 23 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 24 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 25 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 26 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 27 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 28 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 29 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 30 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 31 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 32 */
+    { 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20 }, /* 33 */
+    { 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 34 */
+    { 0x00, 0x30, 0x50, 0xF8, 0x50, 0xF8, 0x60, 0xA0 }, /* 35 */
+    { 0x00, 0x10, 0x3C, 0x50, 0x70, 0x1C, 0x14, 0x78 }, /* 36 */
+    { 0x00, 0xE0, 0xA0, 0xE8, 0x30, 0x78, 0x28, 0x38 }, /* 37 */
+    { 0x00, 0x38, 0x20, 0x20, 0x30, 0x58, 0x50, 0x38 }, /* 38 */
+    { 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 39 */
+    { 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10 }, /* 40 */
+    { 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20 }, /* 41 */
+    { 0x00, 0xA8, 0x70, 0x70, 0xA8, 0x00, 0x00, 0x00 }, /* 42 */
+    { 0x00, 0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20 }, /* 43 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 }, /* 44 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00 }, /* 45 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 }, /* 46 */
+    { 0x00, 0x10, 0x20, 0x20, 0x60, 0x40, 0x40, 0x80 }, /* 47 */
+    { 0x00, 0x30, 0x48, 0x48, 0x58, 0x48, 0x48, 0x30 }, /* 48 */
+    { 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38 }, /* 49 */
+    { 0x00, 0x30, 0x48, 0x08, 0x18, 0x30, 0x60, 0x78 }, /* 50 */
+    { 0x00, 0x30, 0x48, 0x08, 0x30, 0x08, 0x08, 0x70 }, /* 51 */
+    { 0x00, 0x10, 0x10, 0x30, 0x30, 0x50, 0x78, 0x10 }, /* 52 */
+    { 0x00, 0x78, 0x40, 0x40, 0x70, 0x08, 0x08, 0x70 }, /* 53 */
+    { 0x00, 0x38, 0x60, 0x40, 0x78, 0x48, 0x48, 0x30 }, /* 54 */
+    { 0x00, 0x78, 0x08, 0x10, 0x10, 0x10, 0x30, 0x20 }, /* 55 */
+    { 0x00, 0x30, 0x48, 0x48, 0x30, 0x48, 0x48, 0x30 }, /* 56 */
+    { 0x00, 0x30, 0x48, 0x48, 0x78, 0x08, 0x18, 0x70 }, /* 57 */
+    { 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20 }, /* 58 */
+    { 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20 }, /* 59 */
+    { 0x00, 0x00, 0x00, 0x04, 0x38, 0x70, 0x0C, 0x00 }, /* 60 */
+    { 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x00 }, /* 61 */
+    { 0x00, 0x00, 0x00, 0x40, 0x38, 0x1C, 0x60, 0x00 }, /* 62 */
+    { 0x00, 0x78, 0x08, 0x10, 0x20, 0x20, 0x00, 0x20 }, /* 63 */
+    { 0x00, 0x00, 0x30, 0x48, 0x58, 0x58, 0x58, 0x60 }, /* 64 */
+    { 0x00, 0x30, 0x30, 0x30, 0x48, 0x48, 0x78, 0x48 }, /* 65 */
+    { 0x00, 0x70, 0x48, 0x48, 0x70, 0x48, 0x48, 0x78 }, /* 66 */
+    { 0x00, 0x38, 0x40, 0x40, 0x40, 0x40, 0x40, 0x38 }, /* 67 */
+    { 0x00, 0x70, 0x48, 0x48, 0x48, 0x48, 0x48, 0x70 }, /* 68 */
+    { 0x00, 0x78, 0x40, 0x40, 0x78, 0x40, 0x40, 0x78 }, /* 69 */
+    { 0x00, 0x78, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40 }, /* 70 */
+    { 0x00, 0x38, 0x40, 0x40, 0x58, 0x48, 0x48, 0x38 }, /* 71 */
+    { 0x00, 0x48, 0x48, 0x48, 0x78, 0x48, 0x48, 0x48 }, /* 72 */
+    { 0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70 }, /* 73 */
+    { 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78 }, /* 74 */
+    { 0x00, 0x48, 0x50, 0x60, 0x60, 0x50, 0x50, 0x48 }, /* 75 */
+    { 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x78 }, /* 76 */
+    { 0x00, 0x48, 0x78, 0x78, 0x78, 0x78, 0x48, 0x48 }, /* 77 */
+    { 0x00, 0x48, 0x68, 0x68, 0x58, 0x58, 0x58, 0x48 }, /* 78 */
+    { 0x00, 0x30, 0x48, 0x48, 0x48, 0x48, 0x48, 0x30 }, /* 79 */
+    { 0x00, 0x70, 0x48, 0x48, 0x70, 0x40, 0x40, 0x40 }, /* 80 */
+    { 0x00, 0x30, 0x48, 0x48, 0x48, 0x48, 0x48, 0x30 }, /* 81 */
+    { 0x00, 0x70, 0x48, 0x48, 0x70, 0x58, 0x48, 0x44 }, /* 82 */
+    { 0x00, 0x30, 0x48, 0x40, 0x38, 0x08, 0x48, 0x30 }, /* 83 */
+    { 0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }, /* 84 */
+    { 0x00, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x30 }, /* 85 */
+    { 0x00, 0x48, 0x48, 0x30, 0x30, 0x30, 0x30, 0x30 }, /* 86 */
+    { 0x00, 0x88, 0x88, 0xA8, 0xD8, 0x50, 0x50, 0x50 }, /* 87 */
+    { 0x00, 0x48, 0x48, 0x30, 0x30, 0x30, 0x48, 0x48 }, /* 88 */
+    { 0x00, 0x88, 0x50, 0x50, 0x20, 0x20, 0x20, 0x20 }, /* 89 */
+    { 0x00, 0x78, 0x08, 0x10, 0x10, 0x20, 0x40, 0x78 }, /* 90 */
+    { 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30 }, /* 91 */
+    { 0x00, 0x80, 0x40, 0x40, 0x60, 0x20, 0x20, 0x10 }, /* 92 */
+    { 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x30 }, /* 93 */
+    { 0x00, 0x20, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 94 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 95 */
+    { 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 96 */
+    { 0x00, 0x00, 0x00, 0x70, 0x08, 0x78, 0x48, 0x78 }, /* 97 */
+    { 0x40, 0x40, 0x40, 0x70, 0x48, 0x48, 0x48, 0x70 }, /* 98 */
+    { 0x00, 0x00, 0x00, 0x38, 0x40, 0x40, 0x40, 0x38 }, /* 99 */
+    { 0x08, 0x08, 0x08, 0x38, 0x48, 0x48, 0x48, 0x38 }, /* 100 */
+    { 0x00, 0x00, 0x00, 0x30, 0x48, 0x78, 0x40, 0x38 }, /* 101 */
+    { 0x18, 0x20, 0x20, 0x78, 0x20, 0x20, 0x20, 0x20 }, /* 102 */
+    { 0x00, 0x00, 0x00, 0x38, 0x48, 0x48, 0x48, 0x38 }, /* 103 */
+    { 0x40, 0x40, 0x40, 0x78, 0x48, 0x48, 0x48, 0x48 }, /* 104 */
+    { 0x20, 0x00, 0x00, 0x60, 0x20, 0x20, 0x20, 0xF8 }, /* 105 */
+    { 0x10, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10 }, /* 106 */
+    { 0x40, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48 }, /* 107 */
+    { 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x18 }, /* 108 */
+    { 0x00, 0x00, 0x00, 0x7C, 0x54, 0x54, 0x54, 0x54 }, /* 109 */
+    { 0x00, 0x00, 0x00, 0x78, 0x48, 0x48, 0x48, 0x48 }, /* 110 */
+    { 0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x48, 0x30 }, /* 111 */
+    { 0x00, 0x00, 0x00, 0x70, 0x48, 0x48, 0x48, 0x70 }, /* 112 */
+    { 0x00, 0x00, 0x00, 0x38, 0x48, 0x48, 0x48, 0x38 }, /* 113 */
+    { 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20 }, /* 114 */
+    { 0x00, 0x00, 0x00, 0x78, 0x40, 0x38, 0x08, 0x78 }, /* 115 */
+    { 0x00, 0x00, 0x20, 0x78, 0x20, 0x20, 0x20, 0x38 }, /* 116 */
+    { 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x48, 0x78 }, /* 117 */
+    { 0x00, 0x00, 0x00, 0x48, 0x48, 0x30, 0x30, 0x30 }, /* 118 */
+    { 0x00, 0x00, 0x00, 0x88, 0xA8, 0x50, 0x50, 0x50 }, /* 119 */
+    { 0x00, 0x00, 0x00, 0x48, 0x30, 0x30, 0x30, 0x48 }, /* 120 */
+    { 0x00, 0x00, 0x00, 0x48, 0x48, 0x30, 0x30, 0x20 }, /* 121 */
+    { 0x00, 0x00, 0x00, 0x78, 0x10, 0x30, 0x20, 0x78 }, /* 122 */
+    { 0x30, 0x20, 0x20, 0x40, 0x20, 0x20, 0x20, 0x30 }, /* 123 */
+    { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }, /* 124 */
+    { 0x60, 0x20, 0x20, 0x10, 0x20, 0x20, 0x20, 0x60 }, /* 125 */
+    { 0x00, 0x00, 0x00, 0x00, 0x70, 0x0C, 0x00, 0x00 }, /* 126 */
+    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 127 */
+
+};
+
+#endif      /* _BIOS_CGA_FONT_H */
index 797f344bba73c984f5ed2780a736826e8b23b162..0e2b961b2d565214c191b789cc41de89ef621fb0 100644 (file)
@@ -1170,12 +1170,18 @@ static void dos_write_console_char (FILE *out, uint8_t ch) {
 
 }
 
+static int bios_graphics_console_char (CPU8086 *cpu, uint8_t ch, uint8_t color);
+
 static void dos_write_standard_output (CPU8086 *cpu, uint8_t ch) {
 
     FILE *out = dos_get_handle_file (cpu, 1);
     
     if (out == stdout || out == stderr) {
-        dos_write_console_char (out, ch);
+    
+        if (!bios_graphics_console_char (cpu, ch, 3)) {
+            dos_write_console_char (out, ch);
+        }
+    
     } else if (out != NULL) {
         fputc (ch, out);
     }
@@ -2019,12 +2025,41 @@ static int host_key_available_from (FILE *source) {
 
 }
 
+static int bios_read_native_key (CPU8086 *cpu, int wait);
+
 static int host_read_key (CPU8086 *cpu) {
 
     FILE *source;
-    bios_video_refresh (cpu);
+    int key;
     
+    bios_video_refresh (cpu);
     source = dos_get_handle_file (cpu, 0);
+    
+    if (video_native_active () && (source == NULL || source == stdin || source == stdout || source == stderr)) {
+    
+        if (host_extended_key >= 0) {
+        
+            key = host_extended_key;
+            host_extended_key = -1;
+            
+            return key;
+        
+        }
+        
+        key = bios_read_native_key (cpu, 1);
+        
+        if (key < 0) {
+            return EOF;
+        }
+        
+        if (!(key & 0xFF)) {
+            host_extended_key = (key >> 8) & 0xFF;
+        }
+        
+        return key & 0xFF;
+    
+    }
+    
     return host_read_key_from (source ? source : stdin);
 
 }
@@ -10650,6 +10685,139 @@ static void bios_video_set_attribute (uint8_t attr) {
 
 }
 
+#include    "bios_cga_font.h"
+
+static void bios_cga_character (CPU8086 *cpu, unsigned row, unsigned col, uint8_t ch, uint8_t attr) {
+
+    unsigned y, x;
+    unsigned width = bios_video_mode == 0x06 ? 1 : 2;
+    
+    uint8_t foreground = attr & (bios_video_mode == 0x06 ? 1 : 3);
+    
+    if (row >= 25 || col >= bios_video_columns) {
+        return;
+    }
+    
+    for (y = 0; y < 8; y++) {
+    
+        unsigned scan = row * 8 + y;
+        
+        uint32_t offset = 0xB8000 + (scan & 1) * 0x2000 + (scan >> 1) * 80 + col * width;
+        uint8_t bits = ch < 128 ? bios_cga_font[ch][y] : 0;
+        
+        for (x = 0; x < width; x++) {
+        
+            uint8_t value = 0;
+            unsigned pixel;
+            
+            for (pixel = 0; pixel < 8 / width; pixel++) {
+            
+                if (bits & (0x80 >> (x * 8 / width + pixel))) {
+                    value |= (uint8_t) (foreground << (width == 1 ? 7 - pixel : 6 - pixel * 2));
+                }
+            
+            }
+            
+            if (attr & 0x80) {
+                value ^= cpu->mem[offset + x];
+            }
+            
+            mem_write8 (cpu->mem, cpu->mem_size, offset + x, value);
+        
+        }
+    
+    }
+
+}
+
+static void bios_cga_scroll (CPU8086 *cpu, unsigned top, unsigned left, unsigned bottom, unsigned right, unsigned lines, uint8_t color, int down) {
+
+    unsigned row, scan;
+    
+    unsigned width = bios_video_mode == 0x06 ? 1 : 2;
+    unsigned length = (right - left + 1) * width;
+    unsigned height = bottom - top + 1;
+    
+    uint8_t fill = bios_video_mode == 0x06 ? (color & 1 ? 0xFF : 0) : (uint8_t) ((color & 3) * 0x55);
+    
+    for (row = 0; row < height; row++) {
+    
+        unsigned dest_row = down ? bottom - row : top + row;
+        int source_row = lines && row + lines < height ? (int) dest_row + (down ? -(int) lines : (int) lines) : -1;
+        
+        for (scan = 0; scan < 8; scan++) {
+        
+            unsigned dy = dest_row * 8 + scan;
+            uint32_t dest = 0xB8000 + (dy & 1) * 0x2000 + (dy >> 1) * 80 + left * width;
+            
+            if (source_row >= 0) {
+            
+                unsigned sy = (unsigned) source_row * 8 + scan;
+                uint32_t src = 0xB8000 + (sy & 1) * 0x2000 + (sy >> 1) * 80 + left * width;
+                
+                memmove (cpu->mem + dest, cpu->mem + src, length);
+            
+            } else {
+                memset (cpu->mem + dest, fill, length);
+            }
+        
+        }
+    
+    }
+    
+    mem_video_dirty |= 2;
+
+}
+
+static int bios_graphics_console_char (CPU8086 *cpu, uint8_t al, uint8_t color) {
+
+    unsigned row, col;
+    
+    if (bios_video_mode < 0x04 || bios_video_mode > 0x06) {
+        return 0;
+    }
+    
+    row = bios_cursor_row[bios_video_page];
+    col = bios_cursor_col[bios_video_page];
+    
+    if (al == '\r') {
+        col = 0;
+    } else if (al == '\n') {
+        row++;
+    } else if (al == '\b') {
+    
+        if (col) {
+            col--;
+        }
+    
+    } else if (al >= 0x20) {
+    
+        bios_cga_character (cpu, row, col, al, color);
+        
+        if (++col >= bios_video_columns) {
+        
+            col = 0;
+            row++;
+        
+        }
+    
+    }
+    
+    if (row >= 25) {
+    
+        bios_cga_scroll (cpu, 0, 0, 24, bios_video_columns - 1, 1, 0, 0);
+        row = 24;
+    
+    }
+    
+    bios_cursor_row[bios_video_page] = (uint8_t) row;
+    bios_cursor_col[bios_video_page] = (uint8_t) col;
+    
+    bios_video_update_bda (cpu);
+    return 1;
+
+}
+
 static void int_10 (CPU8086 *cpu) {
 
     uint8_t ah = get_reg8 (cpu, 4);
@@ -10949,6 +11117,13 @@ static void int_10 (CPU8086 *cpu) {
                 break;
             }
             
+            if (bios_video_mode >= 0x04 && bios_video_mode <= 0x06) {
+            
+                bios_cga_scroll (cpu, top, left, bottom, right, lines, attr, ah == 0x07);
+                break;
+            
+            }
+            
             bios_video_initialize ();
             
             height = (unsigned) bottom - top + 1;
@@ -11096,6 +11271,20 @@ static void int_10 (CPU8086 *cpu) {
             
             unsigned viewport_width, viewport_height;
             
+            if (bios_video_mode >= 0x04 && bios_video_mode <= 0x06) {
+            
+                if (page == bios_video_page) {
+                
+                    for (i = 0; i < count && (unsigned) bios_cursor_col[page] + i < bios_video_columns; i++) {
+                        bios_cga_character (cpu, bios_cursor_row[page], bios_cursor_col[page] + i, al, (uint8_t) cpu->regs[REG_BX]);
+                    }
+                
+                }
+                
+                break;
+            
+            }
+            
             if (page < bios_video_page_count () && page != bios_video_page) {
             
                 uint32_t base = bios_video_page_base (page);
@@ -11233,9 +11422,14 @@ static void int_10 (CPU8086 *cpu) {
         case 0x0E: {
         
             uint8_t al = get_reg8 (cpu, 0);
-            dos_write_console_char (stdout, al);
             
+            if (bios_graphics_console_char (cpu, al, get_reg8 (cpu, REG_BX))) {
+                break;
+            }
+            
+            dos_write_console_char (stdout, al);
             fflush (stdout);
+            
             break;
         
         }