1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

Fixed cbm_k_readst() to work around a VIC-20 Kernal bug.

It properly returns the RS-232 device's status.
This commit is contained in:
Greg King 2021-01-13 03:20:19 -05:00
parent 0f1386ff4c
commit 710c6c6f2f
3 changed files with 37 additions and 8 deletions

View File

@ -1,8 +1,7 @@
;
; Vic20 generic definitions. Stolen mostly from c64.inc - Steve Schmidtke
; VIC-20 generic definitions. Stolen mostly from c64.inc -- Steve Schmidtke
;
; ---------------------------------------------------------------------------
; Zero page, Commodore stuff
@ -12,8 +11,8 @@ TXTPTR := $7A ; Pointer into BASIC source code
STATUS := $90 ; Kernal I/O completion status
TIME := $A0 ; 60HZ clock
FNAM_LEN := $B7 ; Length of filename
SECADR := $B9 ; Secondary address
DEVNUM := $BA ; Device number
SECADR := $B9 ; Second address
DEVNUM := $BA ; Device number (first address)
FNAM := $BB ; Pointer to filename
KEY_COUNT := $C6 ; Number of keys in input buffer
RVS := $C7 ; Reverse flag
@ -36,6 +35,8 @@ KBDREPEAT := $28a
KBDREPEATRATE := $28b
KBDREPEATDELAY := $28c
RSSTAT := $297 ; RS-232 device driver status
; ---------------------------------------------------------------------------
; Screen size

View File

@ -1,5 +1,6 @@
;
; Ullrich von Bassewitz, 03.06.1999
; 1999-06-03, Ullrich von Bassewitz
; 2021-01-12, Greg King
;
; unsigned char cbm_k_readst (void);
;
@ -10,6 +11,5 @@
_cbm_k_readst:
jsr READST
ldx #0 ; Clear high byte
rts
ldx #>$0000
jmp READST

28
libsrc/vic20/c_readst.s Normal file
View File

@ -0,0 +1,28 @@
;
; 1999-06-03, Ullrich von Bassewitz
; 2021-01-12, Greg King
;
; unsigned char cbm_k_readst (void);
;
; This version works around a bug in VIC-20 Kernal's READST function.
;
.include "vic20.inc"
.include "../cbm/cbm.inc"
.export _cbm_k_readst
_cbm_k_readst:
ldx #>$0000
lda DEVNUM
cmp #CBMDEV_RS232
beq @L1
jmp READST
; Work-around: Read the RS-232 status variable directly.
@L1: lda RSSTAT
stx RSSTAT ; reset the status bits
rts