55 Serial Backend
This tour explores DOOM’s serial networking backend, covering interrupt handling
, UART initialization
and detection, packet framing
, network dispatch
, connection handshaking
, and modem control
.
55.1 Initialization
DOOM initializes serial communication by hooking interrupts and configuring the serial port hardware.
LaunchDOOM sets up an interrupt handler and spawns DOOM:
→sersrc/DOOMNET.C
(lines 76–102)GetUart() sets comport from CLI parameters:
→sersrc/PORT.C
(52–59)BIOS and ISA detection of UART settings:
→PORT.C
(61–67)Checks for MCA or ISA, selects UART/IRQ:
→PORT.C
(69–74)CLI overrides port/IRQ settings:
→PORT.C
(81–86)InitPort sets up UART I/O and IRQ:
→PORT.C
(109–113)Initializes UART speed and clears interrupts:
→PORT.C
(117–125)Detects 16550 FIFO vs 8250 UARTs:
→PORT.C
(147–153)Installs interrupt handler (ISR):
→PORT.C
(193–200)
55.2 UART Interrupt Handling
isr_8250()
handles basic UART interrupts:
→PORT.C
(287–295)isr_16550()
handles FIFO UARTs:
→PORT.C
(348–356)read_byte()
andwrite_byte()
manage TX/RX queues:
→PORT.C
(256–262), (268–272)
55.3 Packet Framing
ReadPacket
and WritePacket
handle framed data over serial:
ReadPacket
extracts bytes viaread_byte()
and signals completeness:
→SERSETUP.C
(135–145)write_buffer
enqueues bytes viawrite_byte()
:
→SERSETUP.C
(50–51)WritePacket
builds and sends framed packets:
→SERSETUP.C
(181–188)
55.4 Network ISR
NetISR
handles serial send/receive for DOOM:
→SERSETUP.C
(212–218)
55.5 Connection Handshake
Connect()
assigns player 0 or 1 deterministically:
→SERSETUP.C
(240–248)
55.6 Modem Control
- Commands and responses are sent with pacing:
- Setup: →
SERSETUP.C
(341–347) - Waits for response: →
SERSETUP.C
(371–378)
- Setup: →
55.7 Queues
que_t
is a 2048-byte circular buffer for serial communication:
→SERSETUP.C
(403–410)
We’ve now explored DOOM’s serial backend: interrupt hooks, UART detection, packet framing, and modem handshaking—all classic DOS-era techniques.