Subversion Repositories MB01 Project

Rev

Blame | Last modification | View Log | Download | RSS feed

;;
;; Copyright (c) 2016 Marco Granati <mg@unet.bz>
;;
;; Permission to use, copy, modify, and distribute this software for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;;
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;

;; name: sp.inc 
;; rev.: 2016/07/28
;; bios C816 version v1.0

.LIST on

SOH             .EQU    $01
STX             .EQU    $02
ETX             .EQU    $03
EOT             .EQU    $04
ENQ             .EQU    $05
ACK             .EQU    $06
DLE             .EQU    $10
SYN             .EQU    $16

SOBUFSIZ        .EQU    $2000   ; dimensione coda TX1/TX2 ACIA (8K)
;SOBUFSIZ       .EQU    $0100   ; dimensione coda TX1/TX2 ACIA (8K)
SIBUFSIZ        .EQU    $4000   ; dimensione coda RX1/RX2 ACIA (16K)
;SIBUFSIZ       .EQU    $0100   ; dimensione coda RX1/RX2 ACIA (16K)

NGUARD1         .EQU    $80     ; numero bytes di guardia buffer RX XON/XOFF
NGUARD2         .EQU    $40     ; numero bytes di guardia buffer RX handshake
;NGUARD1                .EQU    $40     ; numero bytes di guardia buffer RX XON/XOFF
;NGUARD2                .EQU    $20     ; numero bytes di guardia buffer RX handshake
NFREE1          .EQU    $1000   ; minimo posto in coda RX per cancellare pausa remota
NFREE2          .EQU    $0800
;NGUARD3                .EQU    $F0
;NGUARD4                .EQU    $F8

;---------------------------------------------------------------------------
; direct page var's for serial ports handling 
;---------------------------------------------------------------------------

DPSP:   .SECTION page0, common, ref_only, offset spwrk  ;ACIA D.P.

_DPSP_START     .DS     0

; WARNING: not change order and type of the following variables

; acia 1 var's
splin           .DB             ; interrupt status register
spcsr           .DB             ; control status register
spfr            .DB             ; format register
spout           .DB             ; XON/XOFF send flag

; acia 2 var's
splin2          .DB             ; interrupt status register
spcsr2          .DB             ; control status register
spfr2           .DB             ; format register
spout2          .DB             ; XON/XOFF send flag

; serial port's mode & status
spmode          .DB             ; <7>: 0=no handshake, 1=handshake
                                ; <6>: 0=software/1=hardware handshake
                                ; <5>: not used
                                ; <4>: baud rate: 0=19200, 1=38400
                                ; <3>: 0=odd parity, 1=even parity
                                ; <2>: 0=no parity, 1=parity as specified
                                ;      by bit <3>
                                ; <1>: interface type: 0=RS232, 1=RS485
                                ; <0>: RS232: uplink flow control (RTS/DCD)
                                ;      RS485: 120 ohm termination on
                                ; if bit 7=1 and bit 1=1, bit 6 is forced to 0
                        
spstat          .DB             ; serial port status            
                                ; <7>: rx error (data discarded)
                                ; <6>: rx buffer overflow
                                ; <5>: remote disconnession (DSR line = 1)
                                ; <4>: output buffer overflow
                                ; <3>: not used
                                ; <2>: framing error
                                ; <1>: parity error
                                ; <0>: overrun error

sppause         .DB             ; local/remote pause flag's             
                                ; <7>: remote pause (sent an XON or set RTS=1)
                                ; <6>: local pause (received an XON or CTS=1)

sptmp           .DB             ; temp. byte used while get data

; serial port's mode & status
spmode2         .DB             ; <7>: 0=no handshake, 1=handshake
                                ; <6>: 0=software/1=hardware handshake
                                ; <5>: not used
                                ; <4>: baud rate: 0=19200, 1=38400
                                ; <3>: 0=odd parity, 1=even parity
                                ; <2>: 0=no parity, 1=parity as specified
                                ;      by bit <3>
                                ; <1>: interface type: 0=RS232, 1=RS485
                                ; <0>: RS232: uplink flow control (RTS/DCD)
                                ;      RS485: 120 ohm termination on
                                ; if bit 7=1 and bit 1=1, bit 6 is forced to 0
                        
spstat2         .DB             ; serial port status            
                                ; <7>: rx error (data discarded)
                                ; <6>: rx buffer overflow
                                ; <5>: remote disconnession (DSR line = 1)
                                ; <4>: output buffer overflow
                                ; <3>: not used
                                ; <2>: framing error
                                ; <1>: parity error
                                ; <0>: overrun error

sppause2        .DB             ; local/remote pause flag's             
                                ; <7>: remote pause (sent XOFF/XON or RTS=1/0)
                                ; <6>: local pause (rx XOFF/XON or CTS=0/1)

sppost          .DB             ; after POST must hold $C0

ibuftail        .DW             ; pointer to tail of input buffer
ibufhead        .DW             ; pointer to head of input buffer
ibuftail2       .DW
ibufhead2       .DW

obuftail        .DW             ; pointer to tail of output buffer
obufhead        .DW             ; pointer to head of output buffer
obuftail2       .DW
obufhead2       .DW

ibufcnt         .DW             ; count of bytes in input buffer
obufcnt         .DW             ; count of bytes in output buffer
ibufcnt2        .DW
obufcnt2        .DW

icntmin         .DW             ; min. count for clear remote pause  
icntmax         .DW             ; max. count for set remote pause
icntmin2        .DW
icntmax2        .DW

_DPSP_END       .DS     0
DPSPSIZ         .EQU    (_DPSP_END - _DPSP_START)


        .ENDS

ACIArxe_1       .EQU    spstat
ACIArxe_2       .EQU    spstat2
ACIAhsk_1       .EQU    spmode
ACIAhsk_2       .EQU    spmode2
ACIAPause_1     .EQU    sppause
ACIAPause_2     .EQU    sppause2
ACIAcsr_1       .EQU    spcsr
ACIAcsr_2       .EQU    spcsr2
ACIAfr_1        .EQU    spfr
ACIAfr_2        .EQU    spfr2
ACIAOut_1       .EQU    sppause
ACIAOut_2       .EQU    sppause2
ACIAICnt_1      .EQU    ibufcnt
ACIAICnt_2      .EQU    ibufcnt2
ACIAIHead_1     .EQU    ibufhead
ACIAIHead_2     .EQU    ibufhead2
ACIAITail_1     .EQU    ibuftail
ACIAITail_2     .EQU    ibuftail2
ACIAOCnt_1      .EQU    obufcnt
ACIAOCnt_2      .EQU    obufcnt2
ACIAOHead_1     .EQU    obufhead
ACIAOHead_2     .EQU    obufhead2
ACIAOTail_1     .EQU    obuftail
ACIAOTail_2     .EQU    obuftail2

ACIAOBUFLEN     .EQU    SOBUFSIZ
ACIAIBUFLEN     .EQU    SIBUFSIZ
ACIAOUTBUF1     .EQU    SPOUTBUFF
ACIAOUTBUF2     .EQU    SPOUTBUFF2
ACIAINBUF1      .EQU    SPINBUFF
ACIAINBUF2      .EQU    SPINBUFF2

ACIATmp         .EQU    sptmp

.LIST off