mirror of
https://github.com/cc65/cc65.git
synced 2024-12-27 00:29:31 +00:00
Added redeye check for SER_HS_SW handshake
This commit is contained in:
parent
6cf8ee8eb5
commit
acff429eb8
@ -259,16 +259,26 @@ SND_INTERRUPT = TIMER7_INTERRUPT
|
||||
|
||||
INTRST = $FD80
|
||||
INTSET = $FD81
|
||||
|
||||
MAGRDY0 = $FD84
|
||||
MAGRDY1 = $FD85
|
||||
AUDIN = $FD86
|
||||
SYSCTL1 = $FD87
|
||||
MIKEYHREV = $FD88
|
||||
MIKEYSREV = $FD89
|
||||
IODIR = $FD8A
|
||||
IODAT = $FD8B
|
||||
|
||||
SERCTL = $FD8C
|
||||
IODIR = $FD8A
|
||||
IODAT = $FD8B
|
||||
; IODIR and IODAT bit definitions
|
||||
AUDIN_BIT = $10 ; Note that there is also the address AUDIN
|
||||
READ_ENABLE = $10 ; Same bit for AUDIN_BIT
|
||||
RESTLESS = $08
|
||||
NOEXP = $04 ; If set, redeye is not connected
|
||||
CART_ADDR_DATA = $02
|
||||
CART_POWER_OFF = $02 ; Same bit for CART_ADDR_DATA
|
||||
EXTERNAL_POWER = $01
|
||||
|
||||
SERCTL = $FD8C
|
||||
; SERCTL bit definitions for write operations
|
||||
TXINTEN = $80
|
||||
RXINTEN = $40
|
||||
|
@ -200,7 +200,18 @@ checkhs:
|
||||
ldy #SER_PARAMS::HANDSHAKE ; Handshake
|
||||
lda (ptr1),y
|
||||
cmp #SER_HS_NONE
|
||||
beq redeye_ok
|
||||
cmp #SER_HS_SW ; Software handshake will check for connected redeye
|
||||
bne invparameter
|
||||
|
||||
lda IODAT
|
||||
and #NOEXP ; Check if redeye bit flag is unset
|
||||
beq redeye_ok
|
||||
lda #SER_ERR_NO_DEVICE ; ComLynx cable is not inserted
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
redeye_ok:
|
||||
lda SERDAT
|
||||
lda contrl
|
||||
ora #RXINTEN|RESETERR ; Turn on interrupts for receive
|
||||
@ -209,6 +220,7 @@ checkhs:
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
invparameter:
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
|
Loading…
Reference in New Issue
Block a user