* miscellaneous definitions HResMaxX equ 639 high resolution X limit HResMaxY equ 191 high resolution Y limit MousData equ $0008 arbitrary choice for mouse data area ($0008-$000F) PcktSize equ 5 number of bytes in mouse data packet SyncData equ %10000000 initial mouse data byte pattern SyncMask equ %11111000 mask for initial mouse data byte pattern * 6551 register definitions org 0 DataReg rmb 1 receive/transmit data StatReg rmb 1 IRQ/DSR/DCD/error status (read only) PRstReg equ StatReg programmed reset (write only) CmdReg rmb 1 command (parity/echo/Tx IRQ/Rx IRQ/DTR) CtrlReg rmb 1 control (stop bits/word length/Rx clock/baud rate) * Status bit definitions Stat.IRQ equ %10000000 IRQ occurred Stat.DSR equ %01000000 current DSR input level (0=enabled, 1=disabled) Stat.DCD equ %00100000 current DCD input level (0=enabled, 1=disabled) Stat.TxE equ %00010000 Tx register empty Stat.RxF equ %00001000 Rx register full Stat.Ovn equ %00000100 overrun error Stat.Frm equ %00000010 framing error Stat.Par equ %00000001 parity error Stat.Err equ Stat.Ovn!Stat.Frm!Stat.Par status error bits Stat.Flp equ $00 all status bits active when set Stat.Msk equ Stat.RxF!Stat.Ovn!Stat.Frm!Stat.Par active IRQ bits * Command bit definitions Cmd.Par equ %11100000 see parity table below Cmd.Echo equ %00010000 Rx echo (0=disabled, 1=enabled) Cmd.TxIC equ %00001100 see Tx IRQ control table below Cmd.RxIE equ %00000010 Rx IRQ enable (0=enabled, 1=disabled) Cmd.DTR equ %00000001 DTR output (0=disabled, 1=enabled) * parity table Par.None equ %00000000 Par.Odd equ %00100000 Par.Even equ %01100000 Par.Mark equ %10100000 Par.Spac equ %11100000 * Tx IRQ control table TIC.Off equ %00000000 RTS disabled, Tx IRQ disabled TIC.On equ %00000100 RTS enabled, Tx IRQ enabled TIC.RTS equ %00001000 RTS enabled, Tx IRQ disabled TIC.Brk equ %00001100 RTS enabled, Tx line break * Control bit definitions Ctl.Stop equ %10000000 stop bits (clear=1, set=2) Ctl.DBit equ %01100000 see data bit table below Ctl.RClk equ %00010000 Rx clock source (0=external, 1=internal) Ctl.Baud equ %00001111 see baud rate table below * data bit table DB.5 equ %01100000 five data bits per character DB.6 equ %01000000 six data bits per character DB.7 equ %00100000 seven data bits per character DB.8 equ %00000000 eight data bits per character * baud rate table org 0 BR.ExClk rmb 1 16x external clock BR.00050 rmb 1 50 baud BR.00075 rmb 1 75 baud BR.00110 rmb 1 109.92 baud BR.00135 rmb 1 134.58 baud BR.00150 rmb 1 150 baud BR.00300 rmb 1 300 baud BR.00600 rmb 1 600 baud BR.01200 rmb 1 1200 baud BR.01800 rmb 1 1800 baud BR.02400 rmb 1 2400 baud BR.03600 rmb 1 3600 baud BR.04800 rmb 1 4800 baud BR.07200 rmb 1 7200 baud BR.09600 rmb 1 9600 baud BR.19200 rmb 1 19200 baud * Btn.Cntr bit definitions BC.Butn1 equ %00100000 button #1 (left, 1 = pressed) BC.Butn2 equ %00010000 button #2 (middle, 1 = pressed) BC.Butn3 equ %00001000 button #3 (right, 1 = pressed) BC.RxCnt equ %00000111 Rx data counter BC.Butns equ BC.Butn1!BC.Butn2!BC.Butn3 mask for all buttons * mouse static data area definitions org 0 Btn.Cntr rmb 1 mouse button status and Rx data counter Buffer rmb 3 Rx buffer for 1st 3 bytes of XY mouse data (must start at 1,u) CrntXPos rmb 2 mouse X position (0 to HResMaxX) CrntYPos rmb 2 mouse Y position (0 to HResMaxY*2)