From 0f1386ff4c0d88a533050138de2f3a4f2796863f Mon Sep 17 00:00:00 2001 From: Greg King Date: Thu, 25 Mar 2021 08:28:15 -0400 Subject: [PATCH 1/2] Added documentation about the slightly different behavior of cpeekcolor() on the cx16 platform. --- doc/cx16.sgml | 69 ++++++++++++++++++++++++++---------------------- doc/funcref.sgml | 2 ++ 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/doc/cx16.sgml b/doc/cx16.sgml index 490d07849..9e743064f 100644 --- a/doc/cx16.sgml +++ b/doc/cx16.sgml @@ -142,13 +142,20 @@ The functions listed below are special for the CX16. See the for declarations and usage. -get_ostype -set_tv -videomode -vpeek -vpoke +get_ostype() +set_tv() +videomode() +vpeek() +vpoke() +CBM-specific functions

@@ -157,32 +164,32 @@ machines. See the for declarations and usage. -cbm_close -cbm_closedir -cbm_k_basin -cbm_k_bsout -cbm_k_chkin -cbm_k_ckout -cbm_k_close -cbm_k_clrch -cbm_k_getin -cbm_k_load -cbm_k_open -cbm_k_readst -cbm_k_save -cbm_k_second -cbm_k_setlfs -cbm_k_setnam -cbm_k_tksa -cbm_load -cbm_open -cbm_opendir -cbm_read -cbm_readdir -cbm_save -cbm_write -get_tv -waitvsync +cbm_close() +cbm_closedir() +cbm_k_basin() +cbm_k_bsout() +cbm_k_chkin() +cbm_k_ckout() +cbm_k_close() +cbm_k_clrch() +cbm_k_getin() +cbm_k_load() +cbm_k_open() +cbm_k_readst() +cbm_k_save() +cbm_k_second() +cbm_k_setlfs() +cbm_k_setnam() +cbm_k_tksa() +cbm_load() +cbm_open() +cbm_opendir() +cbm_read() +cbm_readdir() +cbm_save() +cbm_write() +get_tv() +waitvsync() diff --git a/doc/funcref.sgml b/doc/funcref.sgml index a954c6581..3b3db2e09 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -2813,6 +2813,8 @@ location of the cursor in the display screen RAM. That number can be passed to done to make it obvious that peeking doesn't move the cursor in any way. Your program must place the cursor where it wants to peek before it calls any of those functions. +On the cx16 (Commander X16) target, this function returns two values: the +background color, in the high nybble, and the text color, in the low nybble. Date: Wed, 13 Jan 2021 03:20:19 -0500 Subject: [PATCH 2/2] Fixed cbm_k_readst() to work around a VIC-20 Kernal bug. It properly returns the RS-232 device's status. --- asminc/vic20.inc | 9 +++++---- libsrc/cbm/c_readst.s | 8 ++++---- libsrc/vic20/c_readst.s | 28 ++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 libsrc/vic20/c_readst.s diff --git a/asminc/vic20.inc b/asminc/vic20.inc index fa9fdfa8d..91da083f1 100644 --- a/asminc/vic20.inc +++ b/asminc/vic20.inc @@ -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 diff --git a/libsrc/cbm/c_readst.s b/libsrc/cbm/c_readst.s index 85211dd2f..bcaacbbae 100644 --- a/libsrc/cbm/c_readst.s +++ b/libsrc/cbm/c_readst.s @@ -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 diff --git a/libsrc/vic20/c_readst.s b/libsrc/vic20/c_readst.s new file mode 100644 index 000000000..2cb11bb21 --- /dev/null +++ b/libsrc/vic20/c_readst.s @@ -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