People often don't bother specifying a baud rate for virtual serial
ports. Handle parsing correctly.
pc_serial: call getint
jc .err
push bx ; Serial port #
+ xor ax,ax
+ mov [FlowControl],ax ; Default to no flow control
+ mov [FlowIgnore],al
call skipspace
- jnc .ok
- pop bx
-.err: ret
-.ok:
+ jc .nobaud
call ungetc
call getint
- mov [FlowControl], word 0 ; Default to no flow control
jc .nobaud
.valid_baud:
push ebx
in al,dx ; Read back LCR (detect missing hw)
cmp al,03h ; If nothing here we'll read 00 or FF
- jne .serial_port_bad ; Assume serial port busted
+ jne .err ; Assume serial port busted
dec dx
dec dx ; DX -> IER
xor al,al ; IRQ disable
.notfirst:
ret
-.serial_port_bad:
+.err:
mov [SerialPort], word 0
ret