mirror of
https://github.com/cc65/cc65.git
synced 2025-01-11 11:30:13 +00:00
Merge pull request #482 from greg-king5/pet-kbrepeat
Make the CBM Pet kbrepeat() work on both 40-/80-column machines.
This commit is contained in:
commit
308f74561c
@ -26,22 +26,21 @@ SCR_LINELEN := $D5 ; Screen line length
|
||||
CURS_Y := $D8 ; Cursor row
|
||||
FNADR := $DA ; Pointer to file name
|
||||
|
||||
; 80-Column CBMs
|
||||
KBDREPEAT80 := $E4
|
||||
KBDRPTRATE80 := $E5
|
||||
KBDRPTDELAY80 := $E6
|
||||
|
||||
BASIC_BUF := $200 ; Location of command-line
|
||||
BASIC_BUF_LEN = 81 ; Maximum length of command-line
|
||||
|
||||
KEY_BUF := $26F ; Keyboard buffer
|
||||
|
||||
;FIXME: we must somehow handle the difference between the two - how?
|
||||
|
||||
; 40-Column PETs
|
||||
;KBDREPEAT := $3ee
|
||||
;KBDREPEATRATE := $3ea
|
||||
;KBDREPEATDELAY := $3e9
|
||||
|
||||
; 80-Column PETs
|
||||
KBDREPEAT := $e4
|
||||
KBDREPEATRATE := $e5
|
||||
KBDREPEATDELAY := $e6
|
||||
; 40-Column PETs/CBMs
|
||||
KBDRPTDELAY40 := $3E9
|
||||
KBDRPTRATE40 := $3EA
|
||||
KBDREPEAT40 := $3EE
|
||||
KBDREPEAT40B := $3F8
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PET ROM type detection
|
||||
@ -67,5 +66,3 @@ VIA_PRB := $E840
|
||||
VIA_PRA := $E841
|
||||
VIA_DDRB := $E842
|
||||
VIA_DDRA := $E843
|
||||
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
|
||||
<article>
|
||||
<title>cc65 function reference
|
||||
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
|
||||
<date>2016-08-07
|
||||
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
|
||||
<url url="mailto:greg.king5@verizon.net" name="Greg King">
|
||||
<date>2017-09-02
|
||||
|
||||
<abstract>
|
||||
cc65 is a C compiler for 6502 based systems. This function reference describes
|
||||
@ -2166,26 +2167,6 @@ to get off the serial bus so it can be used for other purposes.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
<sect1>kbrepeat<label id="kbrepeat"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Set keyboard repeat mode
|
||||
<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
|
||||
<tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
|
||||
<tag/Description/This function changes which keys have automatic repeat when
|
||||
being hold down for a certain time. Possible values are KBREPEAT_CURSOR (repeat
|
||||
only cursor-related keys), KBREPEAT_NONE (no repeat for any keys) and
|
||||
KBREPEAT_ALL (repeat all keys). The old mode is returned so it can be restored
|
||||
later.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
<sect1>cclear<label id="cclear"><p>
|
||||
|
||||
@ -4062,6 +4043,28 @@ do), the function is rather useless.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>kbrepeat<label id="kbrepeat"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Set the keyboard repeat mode.
|
||||
<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
|
||||
<tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
|
||||
<tag/Description/This function changes which keys have automatic repeat when
|
||||
being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
|
||||
(repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
|
||||
keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
|
||||
it can be restored later.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is available only as a fastcall function; so, it may be used
|
||||
only in the presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/cc65
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>labs<label id="labs"><p>
|
||||
|
||||
<quote>
|
||||
|
@ -1,14 +1,29 @@
|
||||
;
|
||||
; unsigned char __fastcall__ kbrepeat (unsigned char mode);
|
||||
;
|
||||
; 2017-06-16, Groepaz
|
||||
; 2017-09-05, Greg King
|
||||
;
|
||||
|
||||
.export _kbrepeat
|
||||
.export _kbrepeat
|
||||
|
||||
.include "pet.inc"
|
||||
|
||||
_kbrepeat:
|
||||
ldx KBDREPEAT ; get old value
|
||||
sta KBDREPEAT ; store new value
|
||||
txa ; return old value
|
||||
ldx #0
|
||||
ldx #>$0000
|
||||
ldy SCR_LINELEN
|
||||
cpy #40 + 1
|
||||
bcc L1 ; branch if screen is 40 columns wide
|
||||
|
||||
ldy KBDREPEAT80 ; get old value
|
||||
sta KBDREPEAT80 ; store new value
|
||||
tya ; return old value
|
||||
rts
|
||||
|
||||
L1: tay
|
||||
lda KBDREPEAT40B ; get REPEAT-key flag (used by some editor ROMs)
|
||||
lsr a ; move bit 0 into bit 7
|
||||
ror a
|
||||
ora KBDREPEAT40 ; combine with old key-REPEAT flags
|
||||
sty KBDREPEAT40
|
||||
rts
|
||||
|
Loading…
x
Reference in New Issue
Block a user