Skip to content

Commit

Permalink
[KERNAL] move PFKEY to extapi (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
mooinglemur authored Mar 23, 2024
1 parent 315183a commit 34680f1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ This is a major update with new features and bug fixes. This ROM requires a matc
4. `joystick_ps2_keycodes` can remap the keyboard joystick
5. `iso_cursor_char` sets the blinking cursor screen code to a character other than $9F while in ISO mode.
6. `ps2kbd_typematic` sets the keyboard repeat delay and repeat rate.
7. `pfkey`, similar to the C128 `PFKEY` API call. Within the KERNAL screen editor, the actions of the function keys F1-F8, as well as the SHIFT+RUN action can be changed.
* Solved a race in kbd_scan if a KERNAL call was in progress was interrupted by the default ISR.
* Removed support for preserving state in the KERNAL ISR for VERA 0.1.1. VERA 0.3.1 is the new minimum version.
* Implemented the C128 `PFKEY` API call. Within the KERNAL screen editor, the actions of the function keys F1-F8, as well as the SHIFT+RUN action can be changed.
* DOS
* Implemented turning on ___experimental___ fast reads (auto_tx) and writes for SD card accesses, implemented via the channel 15 command `"U0>Bn"` where `n` is a value from 0 to 3.
* 0 = Turn off fast reads/writes
Expand Down
2 changes: 1 addition & 1 deletion inc/kernal.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ lkupla = $ff59
lkupsa = $ff5c
screen_mode = $ff5f ; old name: swapper
screen_set_charset = $ff62 ; old name: dlchr
pfkey = $ff65
;pfkey = $ff65 ; moved to extapi slot 7
jsrfar = $ff6e
fetch = $ff74
stash = $ff77
Expand Down
25 changes: 8 additions & 17 deletions kernal/cbm/editor.s
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ MODIFIER_4080 = 32
MODIFIER_SHIFT = 1

.include "io.inc"
.include "regs.inc"

; kernal
.export crsw
Expand Down Expand Up @@ -1333,23 +1334,13 @@ iso_cursor_char:
rts

pfkey:
KVARS_START
KVARS_START_TRASH_A_NZ
cpy #11 ; max length is 10 characters
bcs @error
dex ; input shuld be 1-9, shifted to 0-8
cpx #9 ; max keynum is 9 (shifted to 8)
bcs @error
phy ; preserve Y (length)
phx ; preserve X (keynum)
tax ; pointer is in ZP
; get pointer out of arbitrary ZP into kernal ZP
lda 0,x
sta tmp2
lda 1,x
sta tmp2+1
; convert key number to offset into table
; multiply X by 11
plx ; restore X (keynum)
txa
beq @found
clc
lda #0
Expand All @@ -1358,14 +1349,14 @@ pfkey:
bne :-
tax
@found:
ply ; restore Y (length)
tya
beq @terminate
@loop:
lda (tmp2)
lda (r0)
sta fkeytb,x
inc tmp2
inc r0L
bne :+
inc tmp2+1
inc r0H
: inx
dey
bne @loop
Expand All @@ -1378,7 +1369,7 @@ pfkey:
@error:
sec
@end:
KVARS_END
KVARS_END_TRASH_A_NZ
rts

set_fkey_defaults:
Expand Down
2 changes: 1 addition & 1 deletion kernal/vectors.s
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
jmp lkupsa ; $FF5C: [C128] LKUPSA - look up secondary address
jmp screen_mode ; $FF5F: screen_mode - get/set screen mode [unsupported C128: SWAPPER]
jmp screen_set_charset ; $FF62: activate 8x8 text mode charset [incompatible with C128: DLCHR – init 80-col character RAM]
jmp pfkey ; $FF65: [C128] PFKEY – program a function key
.byte 0, 0, 0 ; $FF65: [C128] PFKEY – X16 implementation in extapi slot #7
jmp mouse_config ; $FF68: mouse_config - configure mouse pointer [unsupported C128: SETBNK – set bank for I/O operations]
jmp mouse_get ; $FF6B: mouse_get - get state of mouse [unsupported C128: GETCFG – lookup MMU data for given bank]
jmp jsrfar ; $FF6E: [C128] JSRFAR – gosub in another bank [incompatible with C128]
Expand Down
2 changes: 2 additions & 0 deletions kernal/x16/extapi.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.import joystick_ps2_keycodes
.import iso_cursor_char
.import ps2kbd_typematic
.import pfkey

.export extapi

Expand Down Expand Up @@ -41,3 +42,4 @@ apitbl:
.word joystick_ps2_keycodes-1 ; API 4
.word iso_cursor_char-1 ; API 5
.word ps2kbd_typematic-1 ; API 6
.word pfkey-1 ; API 7
2 changes: 1 addition & 1 deletion kernsup/kernsup.inc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bridge lkupla ; $FF59: LKUPLA
bridge lkupsa ; $FF5C: LKUPSA
bridge screen_mode ; $FF5F: get/set screen mode
bridge screen_set_charset ; $FF62: activate 8x8 text mode charset
bridge pfkey ; $FF65: PFKEY – program a function key
.byte 0, 0, 0 ; $FF65:
bridge mouse_config ; $FF68: mouse_config
bridge mouse_get ; $FF6B: mouse_get
jmp xjsrfar ; $FF6E: JSRFAR – gosub in another bank
Expand Down

0 comments on commit 34680f1

Please sign in to comment.