Merge branch 'master' into feature/plus4-tgi-driver
This commit is contained in:
@@ -157,8 +157,9 @@ SER_CLOSE:
|
||||
|
||||
; Done, return an error code
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -225,22 +226,23 @@ SER_OPEN:
|
||||
|
||||
; Done
|
||||
|
||||
lda #<SER_ERR_OK
|
||||
tax ; A is zero
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
; Invalid parameter
|
||||
|
||||
InvParam:
|
||||
lda #<SER_ERR_INIT_FAILED
|
||||
ldx #>SER_ERR_INIT_FAILED
|
||||
lda #SER_ERR_INIT_FAILED
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Baud rate not available
|
||||
|
||||
InvBaud:
|
||||
lda #<SER_ERR_BAUD_UNAVAIL
|
||||
ldx #>SER_ERR_BAUD_UNAVAIL
|
||||
lda #SER_ERR_BAUD_UNAVAIL
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -250,19 +252,14 @@ InvBaud:
|
||||
;
|
||||
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
|
||||
; Check for buffer empty
|
||||
|
||||
@L1: lda RecvFreeCnt ; (25)
|
||||
lda RecvFreeCnt ; (25)
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #<SER_ERR_NO_DATA
|
||||
ldx #>SER_ERR_NO_DATA
|
||||
lda #SER_ERR_NO_DATA
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Check for flow stopped & enough free: release flow control
|
||||
@@ -298,27 +295,30 @@ SER_PUT:
|
||||
; Try to send
|
||||
|
||||
ldx SendFreeCnt
|
||||
inx ; X = $ff?
|
||||
cpx #$ff ; Nothing to flush
|
||||
beq @L2
|
||||
pha
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
pla
|
||||
|
||||
; Put byte into send buffer & send
|
||||
; Reload SendFreeCnt after TryToSend
|
||||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
lda #<SER_ERR_OVERFLOW ; X is already zero
|
||||
ldx SendFreeCnt
|
||||
bne @L2
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
; Put byte into send buffer & send
|
||||
|
||||
@L2: ldx SendTail
|
||||
sta SendBuf,x
|
||||
inc SendTail
|
||||
dec SendFreeCnt
|
||||
lda #$ff
|
||||
jsr TryToSend
|
||||
lda #<SER_ERR_OK
|
||||
lda #SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
tax
|
||||
rts
|
||||
|
||||
@@ -331,7 +331,8 @@ SER_STATUS:
|
||||
lda ACIA_STATUS
|
||||
ldx #0
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
.assert SER_ERR_OK = 0, error
|
||||
txa
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -341,8 +342,8 @@ SER_STATUS:
|
||||
;
|
||||
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
lda #SER_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
ldx #0 ; return value is char
|
||||
rts ; Run into IRQ instead
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
@@ -384,25 +385,25 @@ SER_IRQ:
|
||||
sta tmp1 ; Remember tryHard flag
|
||||
@L0: lda SendFreeCnt
|
||||
cmp #$ff
|
||||
beq @L3 ; Bail out
|
||||
beq @L2 ; Bail out
|
||||
|
||||
; Check for flow stopped
|
||||
|
||||
@L1: lda Stopped
|
||||
bne @L3 ; Bail out
|
||||
bne @L2 ; Bail out
|
||||
|
||||
; Check that swiftlink is ready to send
|
||||
|
||||
@L2: lda ACIA_STATUS
|
||||
lda ACIA_STATUS
|
||||
and #$10
|
||||
bne @L4
|
||||
bit tmp1 ; Keep trying if must try hard
|
||||
bmi @L0
|
||||
@L3: rts
|
||||
bne @L3
|
||||
bit tmp1 ;keep trying if must try hard
|
||||
bmi @L1
|
||||
@L2: rts
|
||||
|
||||
; Send byte and try again
|
||||
|
||||
@L4: ldx SendHead
|
||||
@L3: ldx SendHead
|
||||
lda SendBuf,x
|
||||
sta ACIA_DATA
|
||||
inc SendHead
|
||||
|
||||
Reference in New Issue
Block a user