Skip to content
Snippets Groups Projects
Commit fc41cb22 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Statically initialize uart to COM1 details, don't rely on VDDInitialize call

Older versions of Windows don't (always?) call VDDInitialize(), so we need
to statically initialize the uart struct.

This should address the problem reported by Fzf (FQBBS) via DOVE-Net:

... When using the included SBBSEXEC.DLL, the UART emulation
defaults to base address 0x000 and interrupt 0x0.  The lockups do not occur
when this is left as-is but none of the UART emulation does anything.  Setting
a ComPort in a [UART] section of SVDM.INI or SBBSEXEC.INI does change the I/O
address and IRQ to an expected value.  But this isn't necessary.  The mere
existence of one of those two INI files, even if empty, sets the UART to the
expected default of 0x3F8/IRQ4.  The debug entry is always as follows when left
without any INI file:

[180] SBBS: Virtualizing UART (0x0, IRQ 0)

This bug appears to be caused by commit 3ba5aa8d (1 year ago), where
uart was no longer statically-initialzed and relied on VDDInitialize() to be
called to copy default_uart to the uart struct.
parent e1b4ed09
No related branches found
No related tags found
No related merge requests found
Pipeline #6110 passed
......@@ -39,6 +39,21 @@
#define LINEAR_RX_BUFLEN 10000
#define READ_TIMEOUT (30 * 1000) // X00REF.DOC "the timeout value is set to 30 seconds"
#define DEFAULT_UART { \
.io_base = UART_COM1_IO_BASE, \
.irq = UART_COM1_IRQ, \
.ier_reg = 0, \
.lcr_reg = UART_LCR_8_DATA_BITS, \
.mcr_reg = UART_MCR_DTR, \
.lsr_reg = UART_LSR_EMPTY_DATA | UART_LSR_EMPTY_XMIT, \
.msr_reg = UART_MSR_CTS | UART_MSR_DSR, \
.scratch_reg = 0, \
.divisor_latch_lsb = 0x03, /* 38400 */ \
.divisor_latch_msb = 0x00, \
.fifo_enabled = 0, \
.virtualize = FALSE \
}
/* UART Parameters and virtual registers */
struct uart {
WORD io_base;
......@@ -53,20 +68,7 @@ struct uart {
BYTE divisor_latch_msb;
BYTE fifo_enabled;
BOOL virtualize;
} default_uart = {
.io_base = UART_COM1_IO_BASE, /* COM1 */
.irq = UART_COM1_IRQ,
.ier_reg = 0,
.lcr_reg = UART_LCR_8_DATA_BITS,
.mcr_reg = UART_MCR_DTR,
.lsr_reg = UART_LSR_EMPTY_DATA | UART_LSR_EMPTY_XMIT,
.msr_reg = UART_MSR_CTS | UART_MSR_DSR,
.scratch_reg = 0,
.divisor_latch_lsb = 0x03, /* 38400 */
.divisor_latch_msb = 0x00,
.fifo_enabled = 0,
.virtualize = FALSE
}, uart;
} default_uart = DEFAULT_UART, uart = DEFAULT_UART;
// Notice: re-initialize global variables in VDDInitialize for NTVDMx64 and pre-Vista versions of Windows
int log_level = LOG_INFO;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment