?? ser.txt
字號:
Include: ser.a or stdlib.a
Routine: ComGetMCR
-------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: None
Registers on return: AL = MCR value
Flags affected: None
Example of Usage:
ComGetMCR
<do something with value in MCR>
Description:
The MCR (modem control register) bits are defined as follows:
Modem Control Register (MCR):
bit 0- Data Terminal Ready (DTR)
bit 1- Request to send (RTS)
bit 2- OUT 1
bit 3- OUT 2
bit 4- Loop back control.
bits 5-7- Always zero.
The DTR and RTS bits control the function of these lines on the 8250.
They are useful mainly for polled I/O handshake operations (though they
*could* be used with interrupt I/O, it's rarely necessary unless your
main application is *really* slow and the data is coming in real fast.
Out1 and Out2 control output pins on the 8255. Keep in mind that the OUT1
pin enables/disables the serial port interrupts. Play with this *only* if
you want to control the interrupt enable.
Loop back control is mainly useful for testing the serial port or checking
to see if a serial chip is present.
Include: ser.a or stdlib.a
Routine: ComSetMCR
-------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: AL = new MCR value
Registers on return: None
Flags affected: None
Example of Usage:
mov al, NewMCRValue
ComSetMCR
Description:
This routine writes the value in AL to the modem control register. See
ComGetMCR for details on the MCR register.
Include: ser.a or stdlib.a
Routine: ComGetLCR
-------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: None
Registers on return: AL = LCR value
Flags affected: None
Example of Usage:
ComGetLCR
<do something with value in LCR>
Description:
The LCR (line control register) bits are defined as follows:
Line Control Register (LCR):
bits 0,1- Word length (00=5, 01=6, 10=7, 11=8 bits).
bit 2- Stop bits (0=1, 1=2 stop bits [1-1/2 if 5 data bits]).
bit 3- Parity enabled if one.
bit 4- 0 for odd parity, 1 for even parity (assuming bit 3 = 1).
bit 5- 1 for stuck parity.
bit 6- 1=force break.
bit 7- 1=Divisor latch access bit. 0=rcv/xmit access bit.
Since the standard library provides routines to initialize the serial chip
(which is the purpose of this port) you shouldn't really mess with this
port at all. You may, however, use ComGetLCR to see what the current
settings are before making any changes.
Warning: (applies mainly to ComSetLCR) DO NOT, UNDER ANY CIRCUMSTANCES,
CHANGE THE DIVISOR LATCH ACCESS BIT WHILE OPERATING IN INTERRUPT MODE.
The interrupt service routine assumes the rcv/xmit register is mapped in
whenever an interrupt occurs. If you must play with the divisor latch,
turn off interrupts before changing it. Always set the divisor latch
access bit back to zero before turning interrupts back on.
Include: ser.a or stdlib.a
Routine: ComSetLCR
-------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: AL = new LCR value
Registers on return: None
Flags affected: None
Example of Usage:
; If this maps in the divisor latch, be sure we're not operating with
; serial interrupts!
mov al, NewLCRValue
ComSetLCR
Description:
This routine writes the value in AL to the line control register. See
ComGetLCR for details on the LCR register. Especially note the warning
about the divisor latch access bit.
Include: ser.a or stdlib.a
Routine: ComGetIIR
-------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: None
Registers on return: AL = IIR value
Flags affected: None
Example of Usage:
ComGetIIR
<do something with value in IIR>
Description:
The IIR (interrupt identification register) bits are defined as follows:
Interrupt ID Register (IIR):
bit 0- No interrupt is pending (interrupt pending if zero).
bits 1,2- Binary value denoting source of interrupt:
00-Modem status
01-Transmitter Hold Register Empty
10-Received Data Available
11-Receiver line status
bits 3-7 Always zero.
This value is of little use to anyone except the interrupt service routine.
The ISR is the only code which should really access this port.
Include: ser.a or stdlib.a
Routine: ComGetIER
-------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: None
Registers on return: AL = IER value
Flags affected: None
Example of Usage:
ComGetIER
<do something with value in IER>
Description:
The IER (line control register) bits are defined as follows:
Interupt enable register (IER):
If one:
bit 0- Enables received data available interrupt.
bit 1- Enables transmitter holding register empty interrupt.
bit 2- Enables receiver line status interrupt.
bit 3- Enables the modem status interrupt.
bits 4-7- Always set to zero.
Normally, the interrupt initialization procedure sets up this port. You may
read or change its value as you deem necessary to control the types of
interrupts the system generates. Note that the interrupt service routine
(ISR) in the library ignores errors. You will need to modify the ISR if you
need to trap errors.
Include: ser.a or stdlib.a
Routine: ComSetIER
-------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: AL = new IER value
Registers on return: None
Flags affected: None
Example of Usage:
mov al, NewIERValue
ComSetIER
Description:
Writes the value in AL to the IER. See ComGetIER for more details.
Include: ser.a or stdlib.a
Routine: ComInitIntr
---------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: None
Registers on return: None
Flags affected: None
Example of Usage:
ComInitIntr
Description:
Sets up the chip to generate interrupts and programs the PC to transfer
control to the library serial interrupt service routine when an interrupt
occurs. Note that other than interrupt initialization, this code does not
initialize the 8250 chip.
Include: ser.a or stdlib.a
Routine: ComDisIntr
--------------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: None
Registers on return: None
Flags affected: None
Example of Usage:
ComDisIntr
Description:
This routine uninstalls the ISR and programs the chip to stop the generation
of interrupts. You must call ComInitIntr after calling this routine to
turn the interrupt system back on.
Include: ser.a or stdlib.a
Routine: ComIn
---------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: None
Registers on return: AL=character read from buffer or port
Flags affected: None
Example of Usage:
ComIn
<Do something with AL>
Description:
ComIn is the input routine associated with interrupt I/O. It reads the
next available character from the serial input buffer. If no characters
are avialable in the buffer, it waits until the system receives one before
returning.
Include: ser.a or stdlib.a
Routine: ComOut
----------------
Author: Randall Hyde
Category: Serial Communications
Registers on entry: AL=Character to output
Registers on return: None
Flags affected: None
Example of Usage:
<Get character to write into AL>
ComOut
Description:
ComOut is the output routine associated with interrupt I/O. If the serial
transmitter isn't currently busy, it will immediately write the data to the
serial port. If it is busy, it will buffer the character up. In most cases
this routine returns quickly to its caller. The only time this routine
will delay is if the buffer is full can you cannot add any additional
characters to it.
Include: ser.a or stdlib.a
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -