diff options
-rw-r--r-- | com32/lib/sys/ansicon_write.c | 19 | ||||
-rw-r--r-- | comboot.doc | 1 | ||||
-rw-r--r-- | comboot.inc | 4 |
3 files changed, 22 insertions, 2 deletions
diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c index d3bdff1f..b22421ef 100644 --- a/com32/lib/sys/ansicon_write.c +++ b/com32/lib/sys/ansicon_write.c @@ -57,6 +57,7 @@ enum ansi_state { #define MAX_PARMS 16 struct term_state { + int disabled; int attr; /* Current display attribute */ int vtgraphics; /* VT graphics on/off */ int intensity; @@ -76,6 +77,7 @@ struct term_state { static const struct term_state default_state = { + .disabled = 0, .attr = 0x07, /* Grey on black */ .vtgraphics = 0, .intensity = 1, @@ -103,10 +105,20 @@ static const char decvt_to_cp437[] = static void __constructor ansicon_init(void) { static com32sys_t ireg; /* Auto-initalized to all zero */ + com32sys_t oreg; /* Initial state */ memcpy(&st, &default_state, sizeof st); + /* Are we disabled? */ + ireg.eax.w[0] = 0x000b; + __intcall(0x22, &ireg, &oreg); + + if ( (signed char)oreg.ebx.b[1] < 0 ) { + st.disabled = 1; + return; + } + /* Force text mode */ ireg.eax.w[0] = 0x0005; __intcall(0x22, &ireg, NULL); @@ -114,8 +126,8 @@ static void __constructor ansicon_init(void) /* Get cursor shape */ ireg.eax.b[1] = 0x03; ireg.ebx.b[1] = BIOS_PAGE; - __intcall(0x10, &ireg, &ireg); - st.cursor_type = ireg.ecx.w[0]; + __intcall(0x10, &ireg, &oreg); + st.cursor_type = oreg.ecx.w[0]; } /* Erase a region of the screen */ @@ -506,6 +518,9 @@ ssize_t __ansicon_write(struct file_info *fp, const void *buf, size_t count) (void)fp; + if ( st.disabled ) + return n; /* Nothing to do */ + while ( count-- ) { ansicon_putchar(*bufp++); n++; diff --git a/comboot.doc b/comboot.doc index 62b17db3..7719068e 100644 --- a/comboot.doc +++ b/comboot.doc @@ -424,6 +424,7 @@ AX=000Bh [2.00] Get Serial Console Configuration Output: DX Serial port I/O base (e.g. 3F8h = COM1...) CX Baud rate divisor (1 = 115200 bps, 2 = 57600 bps...) BX Flow control configuration bits (see syslinux.doc) + -> Bit 15 is set if the video console is disabled If no serial port is configured, DX will be set to 0 and the other registers are undefined. diff --git a/comboot.inc b/comboot.inc index 3859998e..44d02d82 100644 --- a/comboot.inc +++ b/comboot.inc @@ -509,6 +509,10 @@ comapi_serialcfg: or al,ah mov ah,[FlowIgnore] shr ah,4 + test byte [DisplayCon],01h + jnz .normalconsole + or ah,80h +.normalconsole: mov P_BX,ax clc ret |