Straighten checking of the initialized flag in both, the C64 and C128

versions of rs232.s.
New include file common/rs232.inc, use the constants from this file instead
of defining them separately in each platform specific rs232 module.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1208 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-03-25 06:06:52 +00:00
parent f709fd679b
commit 7d11fa012c
4 changed files with 128 additions and 146 deletions

View File

@@ -29,6 +29,7 @@
.include "atari.inc"
.include "../common/errno.inc"
.include "../common/rs232.inc"
.rodata
@@ -130,17 +131,13 @@ cioerr: jsr fddecusage ; decrement usage counter of fd as open failed
; using 8 bit word size. So only 8 bit is currently tested.
;
; shouldn't this come from a "rs232.inc" ??
ErrNotInitialized = $01
ErrNoData = $04
.proc _rs232_params
sta tmp2
lda rshand
cmp #$ff
bne work ; work only if initialized
lda #ErrNotInitialized
lda #RS_ERR_NOT_INITIALIZED
bne done
work: lda rshand
ldx #0
@@ -241,7 +238,7 @@ done: rts
ldy rshand
cpy #$ff
bne work ; work only if initialized
lda #ErrNotInitialized
lda #RS_ERR_NOT_INITIALIZED
bne nierr
work: sta ptr1
@@ -267,7 +264,7 @@ go: ; check whether there is any input available
beq nix_da ; no input waiting...
; input is available: get it!
lda #GETCHR ; get raw bytes
sta ICCOM,x ; in command code
lda #0
@@ -282,11 +279,11 @@ go: ; check whether there is any input available
sta (ptr1,x) ; return received byte
txa
rts
nierr: ldx #0
rts
nix_da: lda #ErrNoData
nix_da: lda #RS_ERR_NO_DATA
ldx #0
rts
@@ -307,7 +304,7 @@ nix_da: lda #ErrNoData
ldy rshand
cpy #$ff
bne work ; work only if initialized
lda #ErrNotInitialized
lda #RS_ERR_NOT_INITIALIZED
bne nierr
work: pha