migrated to ACME assembler
commit 145d64aa6e78838ed07cefed372f0ad6a4687e97 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 20:16:57 2020 +0200 ACME adaptation commit 885209d7822286744ea53232ae7461472a01d5d6 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 19:57:25 2020 +0200 ACME adaptation commit 334d84486bc603551887e7cbeb59d329f2224cc7 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 18:29:15 2020 +0200 ACME adaptation commit b5966f49bcd8f0ca79cbec93819a31238924707e Author: FeralChild64 <you@example.com> Date: Sun Sep 20 18:09:31 2020 +0200 ACME adaptation commit 786536a93a5eab5e676fca99625b4eb094a554e7 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 17:24:48 2020 +0200 ACME adaptation commit 704c70dfb1f5d68775d6f3da220803b8a3990f56 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 15:07:12 2020 +0200 ACME adaptation commit 136874964c9083b375f151475310f9636871fc72 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 14:45:14 2020 +0200 ACME adaptation commit 8eca0d5700b72d04336e72c5cd3a68e18b85f96d Author: FeralChild64 <you@example.com> Date: Sun Sep 20 14:06:52 2020 +0200 ACME adaptation commit 11d29eb7ee318239d782f85498b6d0524624d5c4 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 13:56:45 2020 +0200 ACME apaptation commit c9b5e5e04cceb92c66bc027e6440bc0f7c5a499f Author: FeralChild64 <you@example.com> Date: Sun Sep 20 13:49:04 2020 +0200 ACME adaptation commit f5cc254cbc921f07863807468cb3fe26b410b409 Author: FeralChild64 <you@example.com> Date: Sun Sep 20 13:01:18 2020 +0200 ACME adaptation commit e135a27bf9c30cc0965379c954564e06406303b1 Author: FeralChild64 <you@example.com> Date: Sat Sep 19 21:55:01 2020 +0200 ACME adaptation commit e9dfddf90d9e2795e88b7da40ae050d733faeb56 Author: FeralChild64 <you@example.com> Date: Sat Sep 19 21:48:47 2020 +0200 Makefile fix commit 07030104c65cf5e5beeacf6d629ccb9245e58657 Author: FeralChild64 <you@example.com> Date: Sat Sep 19 21:42:00 2020 +0200 ACME adaptation commit f824362ee5bcfbffca86c430b57773b2ffd65655 Author: FeralChild64 <you@example.com> Date: Sat Sep 19 20:14:56 2020 +0200 ACME adaptation commit 3a3c59007dcd4940d89b8669f34ca56b61c25fdf Author: FeralChild64 <you@example.com> Date: Fri Sep 18 21:51:45 2020 +0200 ACME adaptation commit 6790ef7bc88a41de2881c69b7524dd4ab8c74b5d Author: FeralChild64 <you@example.com> Date: Fri Sep 18 20:35:23 2020 +0200 ACME adaptation commit 38ad18b90e9ec713aa7ca49576b3388ce1733357 Author: FeralChild64 <you@example.com> Date: Fri Sep 18 18:46:20 2020 +0200 ACME adaptation commit 541340371122a9702f7b2d9771c298223cffd0e9 Author: FeralChild64 <you@example.com> Date: Fri Sep 18 16:49:46 2020 +0200 ACME adaptation commit 25cfd5e186459be1a260d3eb8cfff767838de370 Author: FeralChild64 <you@example.com> Date: Thu Sep 17 20:13:33 2020 +0200 ACME adaptation commit f61599444d5b1d03d8fd8e4a6a7c3b85069bedb3 Author: FeralChild64 <you@example.com> Date: Thu Sep 17 19:29:23 2020 +0200 ACME adaptation commit b290be31ec7bb2e5723607697da1bbc621c84429 Author: FeralChild64 <you@example.com> Date: Thu Sep 17 17:20:14 2020 +0200 ACME adaptation commit 877be9e856880d98fd4bcb25b42aaaacda9dc463 Author: FeralChild64 <you@example.com> Date: Wed Sep 16 21:47:38 2020 +0200 ACME adaptation commit bb20edaf85d386e41d5c2f715b745b68fbd3362e Author: FeralChild64 <you@example.com> Date: Wed Sep 16 21:31:30 2020 +0200 ACME adaptation commit c5d31bd8685abce37c8e254d15aac20bd1570d9f Author: FeralChild64 <you@example.com> Date: Wed Sep 16 18:40:49 2020 +0200 ACME adaptation commit 29349826b38f8a89649171559dc8cf24c560aff1 Author: FeralChild64 <you@example.com> Date: Mon Sep 14 23:35:47 2020 +0200 ACME adaptation commit 8bcd6a621c4b11766d0cf34f79858ba90a67248e Author: FeralChild64 <you@example.com> Date: Mon Sep 14 22:52:25 2020 +0200 ACME adaptation commit e87a69edc2ce4bfcc460c31e08dcc352a985f88d Author: FeralChild64 <you@example.com> Date: Mon Sep 14 22:43:27 2020 +0200 ACME adaptation commit f49a097bd52e96d00b866c02bda7121e4543233c Author: FeralChild64 <you@example.com> Date: Mon Sep 14 19:02:07 2020 +0200 ACME adaptation commit fa0e9214a633b8e8f867cc70925b390940dcd426 Author: FeralChild64 <you@example.com> Date: Mon Sep 14 17:47:19 2020 +0200 ACME adaptation commit 1b763b91e7a03e426227129c7f22f0ce57a4c197 Author: FeralChild64 <you@example.com> Date: Mon Sep 14 17:17:10 2020 +0200 ACME adaptation commit e92a4b57b232cd85eb1e71090b8a89c7c8461ebc Author: FeralChild64 <you@example.com> Date: Mon Sep 14 17:15:37 2020 +0200 ACME adaptation commit de3c693e8a7e73ea5289198946058e3240894e6a Author: FeralChild64 <you@example.com> Date: Mon Sep 14 17:10:05 2020 +0200 ACME adaptation commit f9bd7ae0f04e932d613be9ed5cb19af9be5d338e Author: FeralChild64 <you@example.com> Date: Sun Sep 13 14:34:44 2020 +0200 ACME adaptation commit 694dee52555dbfc2b1f7f452a9671ff51106c057 Author: FeralChild64 <you@example.com> Date: Sun Sep 13 14:16:14 2020 +0200 ACME adaptation commit 0af2c55edfcd22942d9f25417eb0d35f55b71604 Author: FeralChild64 <you@example.com> Date: Fri Sep 11 17:38:09 2020 +0200 ACME adaptation commit 2015e17334bd56a1e8a13a5abc098d9c2e7ea44f Author: FeralChild64 <you@example.com> Date: Fri Sep 11 16:46:05 2020 +0200 ACME adaptation commit b1e972162798d60f4483cd6cc261e856c20c2c8c Author: FeralChild64 <you@example.com> Date: Fri Sep 11 16:24:31 2020 +0200 ACME adaptation commit 9d027e868466901ba53bf074a79ec8cf16273021 Author: FeralChild64 <you@example.com> Date: Fri Sep 11 15:04:31 2020 +0200 ACME adaptation commit 957186deddd1aa4f3b4f1aa1f421e4239a584e57 Author: FeralChild64 <you@example.com> Date: Thu Sep 10 22:49:07 2020 +0200 ACME adaptation commit b8060f67a455cfac109f08d96b62c360d693b931 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 23:07:28 2020 +0200 ACME adaptation commit e54d004568f44bbfe5c070ef1d7cf3544112e497 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 22:58:20 2020 +0200 ACME adaptation commit f90b77f073c5a605cb31c6ee451f65c8a8aff7d8 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 22:12:09 2020 +0200 ACME adaptation commit b211bb4afcd9c58fe1f5c92f3007717d611cd531 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 22:01:40 2020 +0200 ACME adaptation commit 8d7ea343b07e9e08e5f77f3c414758a6cffd0440 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 21:38:34 2020 +0200 ACME adaptation commit 46413eb0d92d6400aba0ff8dfe556e61e8a44d78 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 21:07:47 2020 +0200 ACME adaptation commit 9f98f69ecc21f7b74a5eb89e247f5a2c6fcb655d Author: FeralChild64 <you@example.com> Date: Wed Sep 9 20:05:03 2020 +0200 ACME adaptation commit 7bb9f1cadc682c7e0a4a6796739d860d473ca110 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 19:55:12 2020 +0200 ACME adaptation commit 5fc115392b5bdca6b56f67ad866b1884d2d2bdf8 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 19:31:10 2020 +0200 ACME adaptation commit b7940fc60e568d859df9e3156f6bacc6d685b2cc Author: FeralChild64 <you@example.com> Date: Wed Sep 9 19:16:09 2020 +0200 ACME adaptation commit 56288cb97197561afa0816b29c134ec1190e8eab Author: FeralChild64 <you@example.com> Date: Wed Sep 9 18:48:23 2020 +0200 ACME adaptation commit 10401a60fc7922a53d782120ef6795d889140218 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 16:34:16 2020 +0200 ACME adaptation commit 8ce76e4d2b56837a691ae84b1a412a2ae32a157b Author: FeralChild64 <you@example.com> Date: Wed Sep 9 16:20:44 2020 +0200 ACME adaptation commit 33fade899fa6172ea6b5b5f6683bb61f544429fd Author: FeralChild64 <you@example.com> Date: Wed Sep 9 15:28:46 2020 +0200 ACME adaptation commit a416f04734402fcfbc57a933731376df2e0180a1 Author: FeralChild64 <you@example.com> Date: Wed Sep 9 12:40:03 2020 +0200 ACME adaptation commit f8daee005b1d29f6912723be2ac94bc5fbeb0508 Author: FeralChild64 <you@example.com> Date: Mon Sep 7 23:29:54 2020 +0200 ACME adaptation commit 83fe6bdd0b08a44fdbfc6eefe323a4b194ccaf5b Author: FeralChild64 <you@example.com> Date: Mon Sep 7 22:23:16 2020 +0200 ACME adaptation commit cb1f75620b9c83000a15c9c7f7acefdfee79a979 Author: FeralChild64 <you@example.com> Date: Mon Sep 7 19:23:12 2020 +0200 ACME adaptation commit e524d517c933ae1f0aeb49764d307fadb4845025 Author: FeralChild64 <you@example.com> Date: Sun Sep 6 08:24:25 2020 +0200 ACME adaptation - replaced comments commit 2ab572c3a21f4a78a7312d0e684bc11d91d1717a Author: FeralChild64 <you@example.com> Date: Sat Sep 5 17:59:10 2020 +0200 ACME adaptation - replaced the assembler
This commit is contained in:
1 parent
bfc8291e41
commit
c8d255130c
685 files changed
+15835
-16296
No files matched your search
@@ -1,32 +1,32 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Well-known Kernal routine, described in:
|
||||
//
|
||||
// - http://sta.c64.org/cbm64kbdfunc.html
|
||||
//
|
||||
;
|
||||
; Well-known Kernal routine, described in:
|
||||
;
|
||||
; - http://sta.c64.org/cbm64kbdfunc.html
|
||||
;
|
||||
|
||||
|
||||
getin_keyboard: // XXX confirm that here is really a part of GETIN!
|
||||
getin_keyboard: ; XXX confirm that here is really a part of GETIN!
|
||||
|
||||
// Check for a key
|
||||
; Check for a key
|
||||
lda NDX
|
||||
bne !+
|
||||
bne @1
|
||||
|
||||
// Nothing in keyboard buffer to read
|
||||
; Nothing in keyboard buffer to read
|
||||
sec
|
||||
rts
|
||||
|
||||
!:
|
||||
@1:
|
||||
lda KEYD
|
||||
pha
|
||||
phy_trash_a
|
||||
+phy_trash_a
|
||||
|
||||
jsr pop_keyboard_buffer
|
||||
|
||||
ply_trash_a
|
||||
+ply_trash_a
|
||||
pla
|
||||
clc
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 301
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 232
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): .Y
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 301
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 232
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): .Y
|
||||
;
|
||||
|
||||
STOP:
|
||||
// Bit 7 of STKEY contains the state of the STOP key
|
||||
// (Computes Mapping the 64, p27)
|
||||
; Bit 7 of STKEY contains the state of the STOP key
|
||||
; (Computes Mapping the 64, p27)
|
||||
|
||||
// BASIC checks carry flag to indicate STOP or not
|
||||
; BASIC checks carry flag to indicate STOP or not
|
||||
lda STKEY
|
||||
bpl stop_pressed
|
||||
|
||||
// By trial and error, we know that Z + C = BREAK
|
||||
// and that neither should be set otherwise
|
||||
; By trial and error, we know that Z + C = BREAK
|
||||
; and that neither should be set otherwise
|
||||
lda #$FF
|
||||
clc
|
||||
rts
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Keyboard matrix, based on
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - pages 379-381
|
||||
// - [CM64] Computes Mapping the Commodore 64 - pages 38-39
|
||||
// - http://commodore128.mirkosoft.sk/keyboard.html (C128 extension)
|
||||
// - http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt
|
||||
;
|
||||
; Keyboard matrix, based on
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - pages 379-381
|
||||
; - [CM64] Computes Mapping the Commodore 64 - pages 38-39
|
||||
; - http://commodore128.mirkosoft.sk/keyboard.html (C128 extension)
|
||||
; - http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt
|
||||
|
||||
// Values can be computed by running a program like:
|
||||
// 10 GET A$ : IF A$ = "" GOTO10
|
||||
// 20 PRINT ASC(A$) : GOTO10
|
||||
// and converting the values
|
||||
; Values can be computed by running a program like:
|
||||
; 10 GET A$ : IF A$ = "" GOTO10
|
||||
; 20 PRINT ASC(A$) : GOTO10
|
||||
; and converting the values
|
||||
|
||||
|
||||
kb_matrix:
|
||||
|
||||
__kb_matrix_normal:
|
||||
.byte $14,$0D,$1D,$88,$85,$86,$87,$11
|
||||
.byte $33,$57,$41,$34,$5A,$53,$45,$00
|
||||
.byte $35,$52,$44,$36,$43,$46,$54,$58
|
||||
.byte $37,$59,$47,$38,$42,$48,$55,$56
|
||||
.byte $39,$49,$4A,$30,$4D,$4B,$4F,$4E
|
||||
.byte $2B,$50,$4C,$2D,$2E,$3A,$40,$2C
|
||||
.byte $5C,$2A,$3B,$13,$00,$3D,$5E,$2F
|
||||
.byte $31,$5F,$00,$32,$20,$00,$51,$03
|
||||
!byte $14,$0D,$1D,$88,$85,$86,$87,$11
|
||||
!byte $33,$57,$41,$34,$5A,$53,$45,$00
|
||||
!byte $35,$52,$44,$36,$43,$46,$54,$58
|
||||
!byte $37,$59,$47,$38,$42,$48,$55,$56
|
||||
!byte $39,$49,$4A,$30,$4D,$4B,$4F,$4E
|
||||
!byte $2B,$50,$4C,$2D,$2E,$3A,$40,$2C
|
||||
!byte $5C,$2A,$3B,$13,$00,$3D,$5E,$2F
|
||||
!byte $31,$5F,$00,$32,$20,$00,$51,$03
|
||||
|
||||
__kb_matrix_shift:
|
||||
.byte $94,$8D,$9D,$8C,$89,$8A,$8B,$91
|
||||
.byte $23,$77,$61,$24,$7A,$73,$65,$00
|
||||
.byte $25,$72,$64,$26,$63,$66,$74,$78
|
||||
.byte $27,$79,$67,$28,$62,$68,$75,$76
|
||||
.byte $29,$69,$6A,$92,$6D,$6B,$6F,$6E
|
||||
.byte $DB,$70,$6C,$DD,$3E,$5B,$BA,$3C
|
||||
.byte $A9,$C0,$5D,$93,$00,$3D,$DE,$3F
|
||||
.byte $21,$5F,$00,$22,$A0,$00,$71,$83
|
||||
!byte $94,$8D,$9D,$8C,$89,$8A,$8B,$91
|
||||
!byte $23,$77,$61,$24,$7A,$73,$65,$00
|
||||
!byte $25,$72,$64,$26,$63,$66,$74,$78
|
||||
!byte $27,$79,$67,$28,$62,$68,$75,$76
|
||||
!byte $29,$69,$6A,$92,$6D,$6B,$6F,$6E
|
||||
!byte $DB,$70,$6C,$DD,$3E,$5B,$BA,$3C
|
||||
!byte $A9,$C0,$5D,$93,$00,$3D,$DE,$3F
|
||||
!byte $21,$5F,$00,$22,$A0,$00,$71,$83
|
||||
|
||||
__kb_matrix_vendor:
|
||||
.byte $94,$8D,$9D,$8C,$89,$8A,$8B,$91
|
||||
.byte $96,$B3,$B0,$97,$AD,$AE,$B1,$00
|
||||
.byte $98,$B2,$AC,$99,$BC,$BB,$A3,$BD
|
||||
.byte $9A,$B7,$A5,$9B,$BF,$B4,$B8,$BE
|
||||
.byte $30,$A2,$B5,$30,$A7,$A1,$B9,$AA
|
||||
.byte $A6,$AF,$B6,$DC,$3E,$5B,$A4,$3C
|
||||
.byte $A8,$DF,$5D,$93,$00,$3D,$DE,$3F
|
||||
.byte $81,$5F,$00,$95,$a0,$00,$AB,$83
|
||||
!byte $94,$8D,$9D,$8C,$89,$8A,$8B,$91
|
||||
!byte $96,$B3,$B0,$97,$AD,$AE,$B1,$00
|
||||
!byte $98,$B2,$AC,$99,$BC,$BB,$A3,$BD
|
||||
!byte $9A,$B7,$A5,$9B,$BF,$B4,$B8,$BE
|
||||
!byte $30,$A2,$B5,$30,$A7,$A1,$B9,$AA
|
||||
!byte $A6,$AF,$B6,$DC,$3E,$5B,$A4,$3C
|
||||
!byte $A8,$DF,$5D,$93,$00,$3D,$DE,$3F
|
||||
!byte $81,$5F,$00,$95,$a0,$00,$AB,$83
|
||||
|
||||
__kb_matrix_ctrl:
|
||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||
.byte $1C,$17,$01,$9F,$1A,$13,$05,$00
|
||||
.byte $9C,$12,$04,$1E,$03,$06,$14,$18
|
||||
.byte $1F,$19,$07,$9E,$02,$08,$15,$16
|
||||
.byte $12,$09,$0A,$92,$0D,$0B,$0F,$0E
|
||||
#if CONFIG_EDIT_TABULATORS
|
||||
.byte $00,$10,$0C,$00,KEY_C64_TAB_FW,$1B,$00,KEY_C64_TAB_BW
|
||||
#else
|
||||
.byte $00,$10,$0C,$00,$00,$1B,$00,$00
|
||||
#endif
|
||||
.byte $1C,$00,$1D,$00,$00,$1F,$1E,$00
|
||||
.byte $90,$06,$00,$05,$00,$00,$11,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $1C,$17,$01,$9F,$1A,$13,$05,$00
|
||||
!byte $9C,$12,$04,$1E,$03,$06,$14,$18
|
||||
!byte $1F,$19,$07,$9E,$02,$08,$15,$16
|
||||
!byte $12,$09,$0A,$92,$0D,$0B,$0F,$0E
|
||||
!ifdef CONFIG_EDIT_TABULATORS {
|
||||
!byte $00,$10,$0C,$00,KEY_C64_TAB_FW,$1B,$00,KEY_C64_TAB_BW
|
||||
} else {
|
||||
!byte $00,$10,$0C,$00,$00,$1B,$00,$00
|
||||
}
|
||||
!byte $1C,$00,$1D,$00,$00,$1F,$1E,$00
|
||||
!byte $90,$06,$00,$05,$00,$00,$11,$00
|
||||
@@ -1,34 +1,33 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Extended keyboard matrix for Commodore 128 keyboards, based on
|
||||
//
|
||||
// - [CM128] Computes Mapping the Commodore 128 - page 290
|
||||
// - http://commodore128.mirkosoft.sk/keyboard.html
|
||||
//
|
||||
;
|
||||
; Extended keyboard matrix for Commodore 128 keyboards, based on
|
||||
;
|
||||
; - [CM128] Computes Mapping the Commodore 128 - page 290
|
||||
; - http://commodore128.mirkosoft.sk/keyboard.html
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_KEYBOARD_C128 && !CONFIG_LEGACY_SCNKEY
|
||||
!ifdef CONFIG_KEYBOARD_C128 { !ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
kb_matrix_128:
|
||||
|
||||
.byte KEY_HELP,$38,$35,KEY_C64_TAB_FW,$32,$34,$37,$31
|
||||
.byte KEY_ESC,$2B,$2D,$8D,$0D,$36,$39,$33
|
||||
.byte $00,$30,$2E,$91,$11,$9D,$1D,$00
|
||||
!byte KEY_HELP,$38,$35,KEY_C64_TAB_FW,$32,$34,$37,$31
|
||||
!byte KEY_ESC,$2B,$2D,$8D,$0D,$36,$39,$33
|
||||
!byte $00,$30,$2E,$91,$11,$9D,$1D,$00
|
||||
|
||||
|
||||
kb_matrix_128_bucky_filter:
|
||||
|
||||
// values for OR with CIA1_PRB content to filter out bucky keys
|
||||
; values for OR with CIA1_PRB content to filter out bucky keys
|
||||
|
||||
.byte %00000000
|
||||
.byte %00000000
|
||||
.byte %10000001 // ALT, NO_SCRL
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %10000001 ; ALT, NO_SCRL
|
||||
|
||||
|
||||
|
||||
#endif // CONFIG_KEYBOARD_C128 and no CONFIG_LEGACY_SCNKEY
|
||||
} } ; CONFIG_KEYBOARD_C128 and no CONFIG_LEGACY_SCNKEY
|
||||
@@ -1,25 +1,25 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Extended keyboard matrix for Commodore 65 keyboards, based on
|
||||
//
|
||||
// - https://github.com/MEGA65/c65-specifications/blob/master/c65manualupdated.txt
|
||||
//
|
||||
;
|
||||
; Extended keyboard matrix for Commodore 65 keyboards, based on
|
||||
;
|
||||
; - https://github.com/MEGA65/c65-specifications/blob/master/c65manualupdated.txt
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_KEYBOARD_C65 && !CONFIG_LEGACY_SCNKEY
|
||||
!ifdef CONFIG_KEYBOARD_C65 { !ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
kb_matrix_65:
|
||||
|
||||
.byte $00, KEY_C64_TAB_FW, $00, KEY_HELP, KEY_F9, KEY_F11, KEY_F13, KEY_ESC
|
||||
!byte $00, KEY_C64_TAB_FW, $00, KEY_HELP, KEY_F9, KEY_F11, KEY_F13, KEY_ESC
|
||||
|
||||
kb_matrix_65_shifted:
|
||||
|
||||
.byte $00, KEY_C64_TAB_BW, $00, KEY_HELP, KEY_F10, KEY_F12, KEY_F14, KEY_ESC
|
||||
!byte $00, KEY_C64_TAB_BW, $00, KEY_HELP, KEY_F10, KEY_F12, KEY_F14, KEY_ESC
|
||||
|
||||
|
||||
#endif // CONFIG_KEYBOARD_C65 and no CONFIG_LEGACY_SCNKEY
|
||||
} } ; CONFIG_KEYBOARD_C65 and no CONFIG_LEGACY_SCNKEY
|
||||
@@ -1,27 +1,27 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Matrix ids of keys which should be repeated regardless of RPTFLG
|
||||
//
|
||||
// Values based on:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 58
|
||||
//
|
||||
;
|
||||
; Matrix ids of keys which should be repeated regardless of RPTFLG
|
||||
;
|
||||
; Values based on:
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 58
|
||||
;
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY && !CONFIG_KEY_REPEAT_ALWAYS
|
||||
!ifndef CONFIG_LEGACY_SCNKEY { !ifndef CONFIG_KEY_REPEAT_ALWAYS {
|
||||
|
||||
|
||||
kb_matrix_alwaysrepeat:
|
||||
|
||||
.byte $3C // SPACE
|
||||
.byte $02 // CRSR LEFT/RIGHT
|
||||
.byte $07 // CRSR UP/DOWN
|
||||
.byte $00 // INS/DEL
|
||||
!byte $3C ; SPACE
|
||||
!byte $02 ; CRSR LEFT/RIGHT
|
||||
!byte $07 ; CRSR UP/DOWN
|
||||
!byte $00 ; INS/DEL
|
||||
|
||||
__kb_matrix_alwaysrepeat_end:
|
||||
|
||||
|
||||
#endif // no CONFIG_LEGACY_SCNKEY and no CONFIG_KEY_REPEAT_ALWAYS
|
||||
} } ; no CONFIG_LEGACY_SCNKEY and no CONFIG_KEY_REPEAT_ALWAYS
|
||||
@@ -1,89 +1,87 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Matrix for retrieving bucky key status on the C64 keyboard
|
||||
//
|
||||
// Values based on:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - pages 58 (SHFLAG), 173 (matrix)
|
||||
// - [CM128] Computes Mapping the Commodore 128 - pages 212 (SHFLAG), 290 (matrix)
|
||||
// - https://github.com/MEGA65/c65-specifications/blob/master/c65manualupdated.txt
|
||||
//
|
||||
;
|
||||
; Matrix for retrieving bucky key status on the C64 keyboard
|
||||
;
|
||||
; Values based on:
|
||||
; - [CM64] Computes Mapping the Commodore 64 - pages 58 (SHFLAG), 173 (matrix)
|
||||
; - [CM128] Computes Mapping the Commodore 128 - pages 212 (SHFLAG), 290 (matrix)
|
||||
; - https://github.com/MEGA65/c65-specifications/blob/master/c65manualupdated.txt
|
||||
;
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
kb_matrix_bucky_confmask: // values to be written to CIA1_PRA
|
||||
kb_matrix_bucky_confmask: ; values to be written to CIA1_PRA
|
||||
|
||||
.byte %11111101 // SHIFT (left)
|
||||
.byte %10111111 // SHIFT (right)
|
||||
.byte %01111111 // VENDOR
|
||||
.byte %01111111 // CTRL
|
||||
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
|
||||
.byte %11111111 // C128 / C65 extra keys
|
||||
.byte %11111111
|
||||
#endif
|
||||
!byte %11111101 ; SHIFT (left)
|
||||
!byte %10111111 ; SHIFT (right)
|
||||
!byte %01111111 ; VENDOR
|
||||
!byte %01111111 ; CTRL
|
||||
!ifdef CONFIG_KEYBOARD_C128_OR_C65 {
|
||||
!byte %11111111 ; C128 / C65 extra keys
|
||||
!byte %11111111
|
||||
}
|
||||
|
||||
__kb_matrix_bucky_confmask_end:
|
||||
|
||||
|
||||
#if CONFIG_KEYBOARD_C128
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
|
||||
kb_matrix_bucky_confmask_c128: // values to be written to VIC_XSCAN
|
||||
kb_matrix_bucky_confmask_c128: ; values to be written to VIC_XSCAN
|
||||
|
||||
.byte %11111111
|
||||
.byte %11111111
|
||||
.byte %11111111
|
||||
.byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
|
||||
.byte %11111011 // ALT
|
||||
.byte %11111011 // NO_SCRL
|
||||
!byte %11111011 ; ALT
|
||||
!byte %11111011 ; NO_SCRL
|
||||
}
|
||||
|
||||
#endif
|
||||
!ifdef CONFIG_KEYBOARD_C65 {
|
||||
|
||||
#if CONFIG_KEYBOARD_C65
|
||||
kb_matrix_bucky_confmask_c65: ; values to be written to C65_EXTKEYS_PR
|
||||
|
||||
kb_matrix_bucky_confmask_c65: // values to be written to C65_EXTKEYS_PR
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
!byte %11111111
|
||||
|
||||
.byte %11111111
|
||||
.byte %11111111
|
||||
.byte %11111111
|
||||
.byte %11111111
|
||||
|
||||
.byte %11111101 // ALT
|
||||
.byte %11111101 // NO_SCRL
|
||||
|
||||
#endif
|
||||
!byte %11111101 ; ALT
|
||||
!byte %11111101 ; NO_SCRL
|
||||
}
|
||||
|
||||
|
||||
kb_matrix_bucky_testmask: // for AND with CIA1_PRB value
|
||||
kb_matrix_bucky_testmask: ; for AND with CIA1_PRB value
|
||||
|
||||
.byte %10000000 // SHIFT (left)
|
||||
.byte %00010000 // SHIFT (right)
|
||||
.byte %00100000 // VENDOR
|
||||
.byte %00000100 // CTRL
|
||||
#if CONFIG_KEYBOARD_C128
|
||||
.byte %10000000 // ALT
|
||||
.byte %00000001 // NO_SCRL
|
||||
#endif
|
||||
#if CONFIG_KEYBOARD_C65
|
||||
.byte %00000100 // ALT
|
||||
.byte %00000001 // NO_SCRL
|
||||
#endif
|
||||
!byte %10000000 ; SHIFT (left)
|
||||
!byte %00010000 ; SHIFT (right)
|
||||
!byte %00100000 ; VENDOR
|
||||
!byte %00000100 ; CTRL
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
!byte %10000000 ; ALT
|
||||
!byte %00000001 ; NO_SCRL
|
||||
}
|
||||
!ifdef CONFIG_KEYBOARD_C65 {
|
||||
!byte %00000100 ; ALT
|
||||
!byte %00000001 ; NO_SCRL
|
||||
}
|
||||
|
||||
|
||||
kb_matrix_bucky_shflag: // mask to be ORed to SHFLAG to mark key status
|
||||
kb_matrix_bucky_shflag: ; mask to be ORed to SHFLAG to mark key status
|
||||
|
||||
.byte KEY_FLAG_SHIFT
|
||||
.byte KEY_FLAG_SHIFT
|
||||
.byte KEY_FLAG_VENDOR
|
||||
.byte KEY_FLAG_CTRL
|
||||
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
|
||||
.byte KEY_FLAG_ALT
|
||||
.byte KEY_FLAG_NO_SCRL
|
||||
#endif
|
||||
!byte KEY_FLAG_SHIFT
|
||||
!byte KEY_FLAG_SHIFT
|
||||
!byte KEY_FLAG_VENDOR
|
||||
!byte KEY_FLAG_CTRL
|
||||
!ifdef CONFIG_KEYBOARD_C128_OR_C65 {
|
||||
!byte KEY_FLAG_ALT
|
||||
!byte KEY_FLAG_NO_SCRL
|
||||
}
|
||||
|
||||
|
||||
#endif // no CONFIG_LEGACY_SCNKEY
|
||||
} ; no CONFIG_LEGACY_SCNKEY
|
||||
@@ -1,31 +1,29 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Matrix for filtering out bucky keys while scanning the C64 keyboard
|
||||
//
|
||||
// Values based on:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - pags 58 (SHFLAG), 173 (matrix)
|
||||
//
|
||||
;
|
||||
; Matrix for filtering out bucky keys while scanning the C64 keyboard
|
||||
;
|
||||
; Values based on:
|
||||
; - [CM64] Computes Mapping the Commodore 64 - pags 58 (SHFLAG), 173 (matrix)
|
||||
;
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
kb_matrix_bucky_filter:
|
||||
|
||||
// values for OR with CIA1_PRB content to filter out bucky keys
|
||||
; values for OR with CIA1_PRB content to filter out bucky keys
|
||||
|
||||
.byte %00000000
|
||||
.byte %10000000 // SHIFT (left)
|
||||
.byte %00000000
|
||||
.byte %00000000
|
||||
.byte %00000000
|
||||
.byte %00000000
|
||||
.byte %00010000 // SHIFT (right)
|
||||
.byte %00100100 // VENDOR + CONTROL
|
||||
|
||||
|
||||
#endif // no CONFIG_LEGACY_SCNKEY
|
||||
!byte %00000000
|
||||
!byte %10000000 ; SHIFT (left)
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00000000
|
||||
!byte %00010000 ; SHIFT (right)
|
||||
!byte %00100100 ; VENDOR + CONTROL
|
||||
}
|
||||
@@ -1,42 +1,42 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Matrix for retrieving C64 joystick status and inject is as keyboard event
|
||||
//
|
||||
;
|
||||
; Matrix for retrieving C64 joystick status and inject is as keyboard event
|
||||
;
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY && (CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR)
|
||||
!ifndef CONFIG_LEGACY_SCNKEY { !ifdef CONFIG_JOY1_OR_JOY2_CURSOR {
|
||||
|
||||
|
||||
kb_matrix_joy_status:
|
||||
|
||||
.byte %00001110 // up
|
||||
.byte %00001101 // down
|
||||
.byte %00001011 // left
|
||||
.byte %00000111 // right
|
||||
!byte %00001110 ; up
|
||||
!byte %00001101 ; down
|
||||
!byte %00001011 ; left
|
||||
!byte %00000111 ; right
|
||||
|
||||
kb_matrix_joy_keytab_idx:
|
||||
|
||||
.byte $07 // up
|
||||
.byte $07 // down
|
||||
.byte $02 // left
|
||||
.byte $02 // right
|
||||
!byte $07 ; up
|
||||
!byte $07 ; down
|
||||
!byte $02 ; left
|
||||
!byte $02 ; right
|
||||
|
||||
kb_matrix_joy_keytab_lo:
|
||||
|
||||
.byte <__kb_matrix_shift // up
|
||||
.byte <__kb_matrix_normal // down
|
||||
.byte <__kb_matrix_shift // left
|
||||
.byte <__kb_matrix_normal // right
|
||||
!byte <__kb_matrix_shift ; up
|
||||
!byte <__kb_matrix_normal ; down
|
||||
!byte <__kb_matrix_shift ; left
|
||||
!byte <__kb_matrix_normal ; right
|
||||
|
||||
kb_matrix_joy_keytab_hi:
|
||||
|
||||
.byte >__kb_matrix_shift // up
|
||||
.byte >__kb_matrix_normal // down
|
||||
.byte >__kb_matrix_shift // left
|
||||
.byte >__kb_matrix_normal // right
|
||||
!byte >__kb_matrix_shift ; up
|
||||
!byte >__kb_matrix_normal ; down
|
||||
!byte >__kb_matrix_shift ; left
|
||||
!byte >__kb_matrix_normal ; right
|
||||
|
||||
#endif
|
||||
} }
|
||||
@@ -1,27 +1,26 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper table for determining keyboard matrix decoding table on the C64 keyboard
|
||||
//
|
||||
// When more than one bucky keey is pressed, decoding keys is asking for trouble,
|
||||
// so never allow this.
|
||||
//
|
||||
;
|
||||
; Helper table for determining keyboard matrix decoding table on the C64 keyboard
|
||||
;
|
||||
; When more than one bucky keey is pressed, decoding keys is asking for trouble,
|
||||
; so never allow this.
|
||||
;
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
kb_matrix_lookup:
|
||||
|
||||
.byte (__kb_matrix_normal - kb_matrix) // %000 Normal
|
||||
.byte (__kb_matrix_shift - kb_matrix) // %001 SHIFT
|
||||
.byte (__kb_matrix_vendor - kb_matrix) // %010 VENDOR
|
||||
.byte $FF // %011 SHIFT+VENDOR
|
||||
.byte (__kb_matrix_ctrl - kb_matrix) // %100 CTRL
|
||||
.byte $FF // %101 SHIFT+CTRL
|
||||
.byte $FF // %110 VENDOR+CTRL
|
||||
.byte $FF // %111 SHIFT+VENDOR+CTRL
|
||||
|
||||
#endif
|
||||
!byte (__kb_matrix_normal - kb_matrix) ; %000 Normal
|
||||
!byte (__kb_matrix_shift - kb_matrix) ; %001 SHIFT
|
||||
!byte (__kb_matrix_vendor - kb_matrix) ; %010 VENDOR
|
||||
!byte $FF ; %011 SHIFT+VENDOR
|
||||
!byte (__kb_matrix_ctrl - kb_matrix) ; %100 CTRL
|
||||
!byte $FF ; %101 SHIFT+CTRL
|
||||
!byte $FF ; %110 VENDOR+CTRL
|
||||
!byte $FF ; %111 SHIFT+VENDOR+CTRL
|
||||
}
|
||||
@@ -1,32 +1,31 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Work out if normal, shifted, control or Vendor modified keyboard.
|
||||
// Table contains the offsets into keyboard_matrixes that should be used
|
||||
// for different values of the bottom 3 bits of key_bucky_state XXX
|
||||
// Interaction is simple to work out when playing with a C64:
|
||||
// CTRL trumps SHIFT or VENDOR
|
||||
// VENDOR + SHIFT = DOES NOTHING
|
||||
// All 3 does CONTROL
|
||||
//
|
||||
;
|
||||
; Work out if normal, shifted, control or Vendor modified keyboard.
|
||||
; Table contains the offsets into keyboard_matrixes that should be used
|
||||
; for different values of the bottom 3 bits of key_bucky_state XXX
|
||||
; Interaction is simple to work out when playing with a C64:
|
||||
; CTRL trumps SHIFT or VENDOR
|
||||
; VENDOR + SHIFT = DOES NOTHING
|
||||
; All 3 does CONTROL
|
||||
;
|
||||
|
||||
// This lookup table is used by TWW/CTR keyboard routine only!
|
||||
; This lookup table is used by TWW/CTR keyboard routine only!
|
||||
|
||||
|
||||
#if CONFIG_LEGACY_SCNKEY
|
||||
!ifdef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
kb_matrix_lookup:
|
||||
|
||||
.byte $00 // Normal
|
||||
.byte $40 // Shifted
|
||||
.byte $80 // Control
|
||||
.byte $80 // Control + SHIFT
|
||||
.byte $C0 // Vendor
|
||||
.byte $C0 // Vendor + SHIFT
|
||||
.byte $80 // Vendor + CTRL
|
||||
.byte $80 // Vendor + CTRL + SHIFT
|
||||
|
||||
#endif // CONFIG_LEGACY_SCNKEY
|
||||
!byte $00 ; Normal
|
||||
!byte $40 ; Shifted
|
||||
!byte $80 ; Control
|
||||
!byte $80 ; Control + SHIFT
|
||||
!byte $C0 ; Vendor
|
||||
!byte $C0 ; Vendor + SHIFT
|
||||
!byte $80 ; Vendor + CTRL
|
||||
!byte $80 ; Vendor + CTRL + SHIFT
|
||||
}
|
||||
@@ -1,33 +1,32 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Single row key codes for scanning the C64 keyboard
|
||||
//
|
||||
// Values based on:
|
||||
// - [CM64] Computes Mapping the Commodore 64 - pags 58 (SHFLAG), 173 (matrix)
|
||||
//
|
||||
;
|
||||
; Single row key codes for scanning the C64 keyboard
|
||||
;
|
||||
; Values based on:
|
||||
; - [CM64] Computes Mapping the Commodore 64 - pags 58 (SHFLAG), 173 (matrix)
|
||||
;
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
kb_matrix_row_keys:
|
||||
|
||||
// - values for CIA1_PRA to connect only the given row
|
||||
// - first 3 values also meant for VIC_XSCAN for C128 keyboards
|
||||
// - also used to scan a single row
|
||||
; - values for CIA1_PRA to connect only the given row
|
||||
; - first 3 values also meant for VIC_XSCAN for C128 keyboards
|
||||
; - also used to scan a single row
|
||||
|
||||
.byte %11111110
|
||||
.byte %11111101
|
||||
.byte %11111011
|
||||
.byte %11110111
|
||||
.byte %11101111
|
||||
.byte %11011111
|
||||
.byte %10111111
|
||||
.byte %01111111
|
||||
!byte %11111110
|
||||
!byte %11111101
|
||||
!byte %11111011
|
||||
!byte %11110111
|
||||
!byte %11101111
|
||||
!byte %11011111
|
||||
!byte %10111111
|
||||
!byte %01111111
|
||||
|
||||
|
||||
#endif // no CONFIG_LEGACY_SCNKEY
|
||||
} ; no CONFIG_LEGACY_SCNKEY
|
||||
@@ -1,27 +1,26 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper values to quickly determine row offset from the start of keyboard matrix
|
||||
//
|
||||
;
|
||||
; Helper values to quickly determine row offset from the start of keyboard matrix
|
||||
;
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
kb_matrix_row_offsets:
|
||||
|
||||
// - offsets (in bytes) to the first bytes of keyboard matrix rows
|
||||
; - offsets (in bytes) to the first bytes of keyboard matrix rows
|
||||
|
||||
.byte 0*8
|
||||
.byte 1*8
|
||||
.byte 2*8
|
||||
.byte 3*8
|
||||
.byte 4*8
|
||||
.byte 5*8
|
||||
.byte 6*8
|
||||
.byte 7*8
|
||||
|
||||
#endif // no CONFIG_LEGACY_SCNKEY
|
||||
!byte 0*8
|
||||
!byte 1*8
|
||||
!byte 2*8
|
||||
!byte 3*8
|
||||
!byte 4*8
|
||||
!byte 5*8
|
||||
!byte 6*8
|
||||
!byte 7*8
|
||||
}
|
||||
@@ -1,26 +1,24 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Helper routine - disconnects the keyboard from CIA1_PRB,
|
||||
// leaves $FF in .X (behavior needed in some places)
|
||||
//
|
||||
;
|
||||
; Helper routine - disconnects the keyboard from CIA1_PRB,
|
||||
; leaves $FF in .X (behavior needed in some places)
|
||||
;
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
keyboard_disconnect:
|
||||
|
||||
ldx #$FF
|
||||
stx CIA1_PRA // disconnect all the rows
|
||||
#if CONFIG_KEYBOARD_C128
|
||||
stx CIA1_PRA ; disconnect all the rows
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
stx VIC_XSCAN
|
||||
#endif
|
||||
}
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
+201
-205
@@ -1,282 +1,276 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 295
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 220
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): none
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 295
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 220
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): none
|
||||
;
|
||||
|
||||
// Variables used:
|
||||
// - KEYTAB - keyboard matrix pointer
|
||||
// - DELAY - counter for first delay between key repeats
|
||||
// - KOUNT - counter for next delays between key repeats
|
||||
// - SHFLAG - SHIFT / CTRL / VENDOR keypress status
|
||||
// - NDX - number of characters in keyboard buffer
|
||||
// - XMAX - maximum size of keyboard buffer
|
||||
// - LSTX - matrix coordinate of last pressed key
|
||||
// - LSTSHF - previous status of SHFLAG
|
||||
// - MODE - flag, whether charset toggle (SHIFT+VENDOR) is allowed
|
||||
// - RPTFLG - whether key repeat is allowed
|
||||
; Variables used:
|
||||
; - KEYTAB - keyboard matrix pointer
|
||||
; - DELAY - counter for first delay between key repeats
|
||||
; - KOUNT - counter for next delays between key repeats
|
||||
; - SHFLAG - SHIFT / CTRL / VENDOR keypress status
|
||||
; - NDX - number of characters in keyboard buffer
|
||||
; - XMAX - maximum size of keyboard buffer
|
||||
; - LSTX - matrix coordinate of last pressed key
|
||||
; - LSTSHF - previous status of SHFLAG
|
||||
; - MODE - flag, whether charset toggle (SHIFT+VENDOR) is allowed
|
||||
; - RPTFLG - whether key repeat is allowed
|
||||
|
||||
|
||||
|
||||
#if !CONFIG_LEGACY_SCNKEY
|
||||
!ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
// Routine takes some ideas from TWW/CTR proposal, see here:
|
||||
// - http://codebase64.org/doku.php?id=base:scanning_the_keyboard_the_correct_and_non_kernal_way
|
||||
; Routine takes some ideas from TWW/CTR proposal, see here:
|
||||
; - http://codebase64.org/doku.php?id=base:scanning_the_keyboard_the_correct_and_non_kernal_way
|
||||
|
||||
|
||||
SCNKEY:
|
||||
|
||||
// Prepare for SHFLAG update
|
||||
; Prepare for SHFLAG update
|
||||
|
||||
lda SHFLAG
|
||||
sta LSTSHF
|
||||
lda #$00
|
||||
sta SHFLAG
|
||||
|
||||
#if !CONFIG_JOY2_CURSOR && CONFIG_KEY_FAST_SCAN
|
||||
!ifndef CONFIG_JOY2_CURSOR { !ifdef CONFIG_KEY_FAST_SCAN {
|
||||
|
||||
// Check for any activity - speed optimization, but cannot be done
|
||||
// that early if we are to scan the joystick #2
|
||||
; Check for any activity - speed optimization, but cannot be done
|
||||
; that early if we are to scan the joystick #2
|
||||
|
||||
ldx #$00
|
||||
stx CIA1_PRA // connect all the rows
|
||||
#if CONFIG_KEYBOARD_C128
|
||||
stx CIA1_PRA ; connect all the rows
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
stx VIC_XSCAN
|
||||
#endif
|
||||
dex // puts $FF
|
||||
}
|
||||
dex ; puts $FF
|
||||
cpx CIA1_PRB
|
||||
beq scnkey_no_keys
|
||||
|
||||
#endif
|
||||
} }
|
||||
|
||||
// Retrieve SHIFT / VENDOR / CTRL / ALT / CAPS LOCK status
|
||||
; Retrieve SHIFT / VENDOR / CTRL / ALT / CAPS LOCK status
|
||||
|
||||
#if CONFIG_KEYBOARD_C128_CAPS_LOCK
|
||||
!ifdef CONFIG_KEYBOARD_C128_CAPS_LOCK {
|
||||
|
||||
// First check if this is really a C128 - to avoid false positive
|
||||
; First check if this is really a C128 - to avoid false positive
|
||||
ldx #$00
|
||||
stx VIC_XSCAN
|
||||
dex // puts $FF
|
||||
dex ; puts $FF
|
||||
cpx VIC_XSCAN
|
||||
beq !+ // branch if C64, C128 will keep some bits cleared
|
||||
beq @1 ; branch if C64, C128 will keep some bits cleared
|
||||
|
||||
lda CPU_R6510
|
||||
and #$40
|
||||
bne !+ // branch if no CAPS LOCK
|
||||
bne @1 ; branch if no CAPS LOCK
|
||||
|
||||
lda #KEY_CAPS_LOCK
|
||||
sta SHFLAG
|
||||
!:
|
||||
@1:
|
||||
|
||||
#if !CONFIG_KEYBOARD_C128
|
||||
stx VIC_XSCAN // disconnect C128 keys if no C128 keyboard is supported
|
||||
#endif
|
||||
!ifndef !CONFIG_KEYBOARD_C128 {
|
||||
stx VIC_XSCAN ; disconnect C128 keys if no C128 keyboard is supported
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_KEYBOARD_C65_CAPS_LOCK
|
||||
!ifdef CONFIG_KEYBOARD_C65_CAPS_LOCK {
|
||||
|
||||
lda C65_EXTKEYS_PR
|
||||
and #$01
|
||||
bne !+ // branch if no CAPS LOCK
|
||||
bne @2 ; branch if no CAPS LOCK
|
||||
|
||||
lda #KEY_CAPS_LOCK
|
||||
sta SHFLAG
|
||||
!:
|
||||
@2:
|
||||
|
||||
#if !CONFIG_KEYBOARD_C65
|
||||
!ifndef CONFIG_KEYBOARD_C65 {
|
||||
ldx #$FF
|
||||
stx C65_EXTKEYS_PR // disconnect C128 keys if no C128 keyboard is supported
|
||||
#endif
|
||||
|
||||
#endif
|
||||
stx C65_EXTKEYS_PR ; disconnect C65 keys if no C65 keyboard is supported
|
||||
} }
|
||||
|
||||
ldy #(__kb_matrix_bucky_confmask_end - kb_matrix_bucky_confmask - 1)
|
||||
scnkey_bucky_loop:
|
||||
lda kb_matrix_bucky_confmask, y
|
||||
sta CIA1_PRA
|
||||
#if CONFIG_KEYBOARD_C128
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
lda kb_matrix_bucky_confmask_c128, y
|
||||
sta VIC_XSCAN
|
||||
#endif
|
||||
#if CONFIG_KEYBOARD_C65
|
||||
}
|
||||
!ifdef CONFIG_KEYBOARD_C65 {
|
||||
lda kb_matrix_bucky_confmask_c65, y
|
||||
sta C65_EXTKEYS_PR
|
||||
#endif
|
||||
}
|
||||
lda kb_matrix_bucky_testmask, y
|
||||
and CIA1_PRB
|
||||
bne !+ // branch if not pressed
|
||||
bne @3 ; branch if not pressed
|
||||
lda SHFLAG
|
||||
ora kb_matrix_bucky_shflag, y
|
||||
sta SHFLAG
|
||||
!:
|
||||
@3:
|
||||
dey
|
||||
bpl scnkey_bucky_loop
|
||||
|
||||
// Set KEYTAB vector
|
||||
; Set KEYTAB vector
|
||||
|
||||
lda KEYLOG+1
|
||||
bne !+
|
||||
jsr scnkey_set_keytab // KEYLOG routine on zeropage? most likely vector not set
|
||||
jmp_8 scnkey_keytab_set_done
|
||||
bne @11
|
||||
jsr scnkey_set_keytab ; KEYLOG routine on zeropage? most likely vector not set
|
||||
+bra scnkey_keytab_set_done
|
||||
|
||||
!:
|
||||
#if HAS_OPCODES_65CE02
|
||||
jsr_ind KEYLOG
|
||||
#else
|
||||
@11:
|
||||
!ifdef HAS_OPCODES_65CE02 {
|
||||
jsr (KEYLOG)
|
||||
} else {
|
||||
jsr scnkey_via_keylog
|
||||
#endif
|
||||
}
|
||||
|
||||
scnkey_keytab_set_done:
|
||||
|
||||
#if CONFIG_JOY2_CURSOR
|
||||
!ifdef CONFIG_JOY2_CURSOR {
|
||||
|
||||
// Check for control port 2 activity
|
||||
; Check for control port 2 activity
|
||||
|
||||
ldx #$00
|
||||
stx CIA1_DDRA // set port to input to read joystick
|
||||
stx CIA1_DDRA ; set port to input to read joystick
|
||||
|
||||
lda CIA1_PRA // read the joystick 2 status
|
||||
lda CIA1_PRA ; read the joystick 2 status
|
||||
|
||||
dex // puts $FF
|
||||
stx CIA1_DDRA // set port back to output
|
||||
dex ; puts $FF
|
||||
stx CIA1_DDRA ; set port back to output
|
||||
|
||||
and #%00001111 // filter out anything but joystick movement
|
||||
and #%00001111 ; filter out anything but joystick movement
|
||||
cmp #%00001111
|
||||
|
||||
bne scnkey_joystick_filtered
|
||||
|
||||
#if CONFIG_KEY_FAST_SCAN
|
||||
!ifdef CONFIG_KEY_FAST_SCAN {
|
||||
|
||||
inx // puts $00
|
||||
stx CIA1_PRA // connect all the rows
|
||||
#if CONFIG_KEYBOARD_C128
|
||||
inx ; puts $00
|
||||
stx CIA1_PRA ; connect all the rows
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
stx VIC_XSCAN
|
||||
#endif
|
||||
#if CONFIG_KEYBOARD_C65
|
||||
}
|
||||
!ifdef CONFIG_KEYBOARD_C65 {
|
||||
stx C65_EXTKEYS_PR
|
||||
#endif
|
||||
dex // puts $FF
|
||||
}
|
||||
dex ; puts $FF
|
||||
cpx CIA1_PRB
|
||||
beq scnkey_no_keys
|
||||
|
||||
#endif // CONFIG_KEY_FAST_SCAN
|
||||
} ; CONFIG_KEY_FAST_SCAN
|
||||
} ; CONFIG_JOY2_CURSOR
|
||||
|
||||
#endif // CONFIG_JOY2_CURSOR
|
||||
; Check for control port 1 activity (can interfere with keyboard)
|
||||
|
||||
// Check for control port 1 activity (can interfere with keyboard)
|
||||
jsr keyboard_disconnect ; disconnect all the rows, .X will be $FF
|
||||
cpx CIA1_PRB ; only control port activity will be reported
|
||||
!ifdef CONFIG_JOY1_CURSOR {
|
||||
bne scnkey_joystick_1 ; use joystick for cursor keys
|
||||
} else {
|
||||
bne scnkey_no_keys ; if activity detected do not scan the keyboard
|
||||
}
|
||||
|
||||
jsr keyboard_disconnect // disconnect all the rows, .X will be $FF
|
||||
cpx CIA1_PRB // only control port activity will be reported
|
||||
#if CONFIG_JOY1_CURSOR
|
||||
bne scnkey_joystick_1 // use joystick for cursor keys
|
||||
#else
|
||||
bne scnkey_no_keys // if activity detected do not scan the keyboard
|
||||
#endif
|
||||
|
||||
// Check if KEYTAB is not 0 (happens if more than one bucky key is pressed)
|
||||
// High byte equal to 0 = table considered invalid
|
||||
; Check if KEYTAB is not 0 (happens if more than one bucky key is pressed)
|
||||
; High byte equal to 0 = table considered invalid
|
||||
|
||||
lda KEYTAB+1
|
||||
beq scnkey_no_keys
|
||||
|
||||
// Scan the keyboard matrix
|
||||
; Scan the keyboard matrix
|
||||
|
||||
ldy #$FF // offset in key matrix table, $FF for not found yet
|
||||
#if CONFIG_KEYBOARD_C128
|
||||
ldy #$FF ; offset in key matrix table, $FF for not found yet
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
jsr scnkey_128
|
||||
#endif
|
||||
#if CONFIG_KEYBOARD_C65
|
||||
}
|
||||
!ifdef CONFIG_KEYBOARD_C65 {
|
||||
jsr scnkey_65
|
||||
#endif
|
||||
}
|
||||
ldx #$07
|
||||
scnkey_matrix_loop:
|
||||
lda kb_matrix_row_keys, x
|
||||
sta CIA1_PRA
|
||||
lda kb_matrix_bucky_filter, x // filter out bucky keys
|
||||
lda kb_matrix_bucky_filter, x ; filter out bucky keys
|
||||
ora CIA1_PRB
|
||||
cmp #$FF
|
||||
beq scnkey_matrix_loop_next // skip if no key pressed from this row
|
||||
beq scnkey_matrix_loop_next ; skip if no key pressed from this row
|
||||
cpy #$FF
|
||||
bne scnkey_no_keys // jam, more than one key pressed
|
||||
// We have at least one key pressed in this row, we need to find which one exactly
|
||||
bne scnkey_no_keys ; jam, more than one key pressed
|
||||
; We have at least one key pressed in this row, we need to find which one exactly
|
||||
ldy #$07
|
||||
scnkey_matrix_loop_inner:
|
||||
cmp kb_matrix_row_keys, y
|
||||
bne !+ // not this particular key
|
||||
tya // now .A contains key offset within a row
|
||||
bne @4 ; not this particular key
|
||||
tya ; now .A contains key offset within a row
|
||||
clc
|
||||
adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start
|
||||
adc kb_matrix_row_offsets, x ; now .A contains key offset from the matrix start
|
||||
tay
|
||||
jmp scnkey_matrix_loop_next
|
||||
!:
|
||||
@4:
|
||||
dey
|
||||
bpl scnkey_matrix_loop_inner
|
||||
bmi scnkey_no_keys // branch always, multiple keys must have been pressed
|
||||
bmi scnkey_no_keys ; branch always, multiple keys must have been pressed
|
||||
scnkey_matrix_loop_next:
|
||||
dex
|
||||
bpl scnkey_matrix_loop
|
||||
|
||||
// Scanning complete - check if we got a key
|
||||
; Scanning complete - check if we got a key
|
||||
|
||||
cpy #$FF
|
||||
beq scnkey_no_keys
|
||||
|
||||
// To be extra sure, check for possible control port 1 interference once again
|
||||
; To be extra sure, check for possible control port 1 interference once again
|
||||
|
||||
jsr keyboard_disconnect // disconnect all the rows, .X will be $FF
|
||||
cpx CIA1_PRB // only control port activity will be reported
|
||||
beq scnkey_got_key // branch if joystick activity NOT detected
|
||||
jsr keyboard_disconnect ; disconnect all the rows, .X will be $FF
|
||||
cpx CIA1_PRB ; only control port activity will be reported
|
||||
beq scnkey_got_key ; branch if joystick activity NOT detected
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
scnkey_no_keys:
|
||||
|
||||
// Mark no key press
|
||||
; Mark no key press
|
||||
|
||||
lda #$40
|
||||
sta LSTX
|
||||
rts
|
||||
|
||||
#if CONFIG_JOY1_CURSOR
|
||||
!ifdef CONFIG_JOY1_CURSOR {
|
||||
|
||||
scnkey_joystick_1:
|
||||
|
||||
// Prepare joystick 1 status
|
||||
; Prepare joystick 1 status
|
||||
|
||||
lda CIA1_PRB
|
||||
and #%00001111 // filter out anything but movement
|
||||
and #%00001111 ; filter out anything but movement
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_JOY1_CURSOR || CONFIG_JOY2_CURSOR
|
||||
!ifdef CONFIG_JOY1_OR_JOY2_CURSOR {
|
||||
|
||||
scnkey_joystick_filtered:
|
||||
|
||||
// Set appropriate keyboard matrix and key code for joystick event
|
||||
; Set appropriate keyboard matrix and key code for joystick event
|
||||
|
||||
ldy #$03
|
||||
!:
|
||||
@5:
|
||||
cmp kb_matrix_joy_status, y
|
||||
beq !+
|
||||
beq @6
|
||||
dey
|
||||
bpl !-
|
||||
bpl @5
|
||||
|
||||
// Not found
|
||||
; Not found
|
||||
|
||||
rts
|
||||
!:
|
||||
// Found
|
||||
@6:
|
||||
; Found
|
||||
|
||||
lda kb_matrix_joy_keytab_lo, y
|
||||
sta KEYTAB+0
|
||||
@@ -285,65 +279,64 @@ scnkey_joystick_filtered:
|
||||
lda kb_matrix_joy_keytab_idx, y
|
||||
tay
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
scnkey_got_key: // .Y should now contain the key offset in matrix pointed by KEYTAB
|
||||
scnkey_got_key: ; .Y should now contain the key offset in matrix pointed by KEYTAB
|
||||
|
||||
cpy LSTX
|
||||
beq scnkey_try_repeat // branch if the same key as previously
|
||||
beq scnkey_try_repeat ; branch if the same key as previously
|
||||
sty LSTX
|
||||
|
||||
// Reset key repeat counters - see [CM64] page 58
|
||||
; Reset key repeat counters - see [CM64] page 58
|
||||
|
||||
// Note: according to [CM64] it should be $10 for initializing DELAY, $06 for
|
||||
// initializing KOUNT for the first time and $04 for subsequent ones - but replicating
|
||||
// this would make our implementation longer, probably without improving the compatibility.
|
||||
//
|
||||
// Besides - since I am the one who writes the code, I will make the values exactly how I like them :D
|
||||
; Note: according to [CM64] it should be $10 for initializing DELAY, $06 for
|
||||
; initializing KOUNT for the first time and $04 for subsequent ones - but replicating
|
||||
; this would make our implementation longer, probably without improving the compatibility.
|
||||
;
|
||||
; Besides - since I am the one who writes the code, I will make the values exactly how I like them :D
|
||||
|
||||
#if !CONFIG_RS232_UP9600
|
||||
!ifndef CONFIG_RS232_UP9600 {
|
||||
lda #$16
|
||||
#else
|
||||
} else {
|
||||
lda #$18
|
||||
#endif
|
||||
}
|
||||
sta DELAY
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
scnkey_output_key:
|
||||
|
||||
// Check if we have free space in the keyboard buffer
|
||||
; Check if we have free space in the keyboard buffer
|
||||
|
||||
lda NDX
|
||||
cmp XMAX
|
||||
bcs scnkey_early_repeat // no space in buffer
|
||||
bcs scnkey_early_repeat ; no space in buffer
|
||||
|
||||
// Reinitialize secondary counter
|
||||
; Reinitialize secondary counter
|
||||
|
||||
lda #$03
|
||||
sta KOUNT
|
||||
|
||||
// Retrieve the PETSCII code
|
||||
; Retrieve the PETSCII code
|
||||
|
||||
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
|
||||
!ifdef CONFIG_KEYBOARD_C128_OR_C65 {
|
||||
|
||||
cpy #$40
|
||||
bcc !+
|
||||
bcc scnkey_output_get_keycode
|
||||
|
||||
#if CONFIG_KEYBOARD_C128
|
||||
lda kb_matrix_128 - $41, y // retrieve key code from C128 extended matrix
|
||||
#elif CONFIG_KEYBOARD_C65
|
||||
!ifdef CONFIG_KEYBOARD_C128 {
|
||||
lda kb_matrix_128 - $41, y ; retrieve key code from C128 extended matrix
|
||||
} else ifdef CONFIG_KEYBOARD_C65 {
|
||||
|
||||
// Select key matrix (normal or shifted) for extended C65 keys
|
||||
; Select key matrix (normal or shifted) for extended C65 keys
|
||||
|
||||
lda SHFLAG
|
||||
and #%00000111 // KEY_FLAG_SHIFT + KEY_FLAG_VENDOR + KEY_FLAG_CTRL
|
||||
and #%00000111 ; KEY_FLAG_SHIFT + KEY_FLAG_VENDOR + KEY_FLAG_CTRL
|
||||
beq scnkey_output_65_no_shift
|
||||
cmp #KEY_FLAG_SHIFT
|
||||
// XXX how to behave on VENDOR/CTRL key? Harmonize this with claasic keys behavior
|
||||
bne scnkey_no_keys // no scanning for this bucky key combination
|
||||
; XXX how to behave on VENDOR/CTRL key? Harmonize this with clasic keys behavior
|
||||
bne scnkey_no_keys ; no scanning for this bucky key combination
|
||||
|
||||
lda kb_matrix_65_shifted - $41, y
|
||||
jmp scnkey_got_petscii
|
||||
@@ -351,76 +344,79 @@ scnkey_output_key:
|
||||
scnkey_output_65_no_shift:
|
||||
|
||||
lda kb_matrix_65 - $41, y
|
||||
}
|
||||
|
||||
#endif
|
||||
jmp scnkey_got_petscii
|
||||
!:
|
||||
lda (KEYTAB), y // retrieve key code from standard matrix
|
||||
|
||||
#endif // CONFIG_KEYBOARD_C128 or CONFIG_KEYBOARD_C65
|
||||
; FALLTROUGH
|
||||
|
||||
#if CONFIG_KEYBOARD_C128_CAPS_LOCK || CONFIG_KEYBOARD_C65_CAPS_LOCK
|
||||
scnkey_output_get_keycode:
|
||||
|
||||
// Check if we need special handling for a CAPS LOCK key
|
||||
// This is shorter than a separate set of tables
|
||||
lda (KEYTAB), y ; retrieve key code from standard matrix
|
||||
|
||||
} ; CONFIG_KEYBOARD_C128 or CONFIG_KEYBOARD_C65
|
||||
|
||||
!ifdef CONFIG_KEYBOARD_CAPS_LOCK {
|
||||
|
||||
; Check if we need special handling for a CAPS LOCK key
|
||||
; This is shorter than a separate set of tables
|
||||
|
||||
scnkey_handle_caps_lock:
|
||||
|
||||
#if !CONFIG_KEYBOARD_C128 && !CONFIG_KEYBOARD_C65
|
||||
!ifndef CONFIG_KEYBOARD_C128_OR_C65 {
|
||||
lda (KEYTAB), y
|
||||
#endif
|
||||
}
|
||||
tax
|
||||
lda SHFLAG
|
||||
and #(%00000111 + KEY_CAPS_LOCK)
|
||||
cmp #KEY_CAPS_LOCK
|
||||
bne !+ // branch if no special CAPS LOCK handling needed
|
||||
bne @7 ; branch if no special CAPS LOCK handling needed
|
||||
|
||||
cpx #$41 // 'A'
|
||||
bcc !+
|
||||
cpx #$5B // 'Z' + 1
|
||||
bcs !+
|
||||
cpx #$41 ; 'A'
|
||||
bcc @7
|
||||
cpx #$5B ; 'Z' + 1
|
||||
bcs @7
|
||||
|
||||
txa
|
||||
clc
|
||||
adc #$20 // turn lowercase into uppercase
|
||||
adc #$20 ; turn lowercase into uppercase
|
||||
tax
|
||||
!:
|
||||
@7:
|
||||
txa
|
||||
|
||||
#endif // CONFIG_KEYBOARD_C128_CAPS_LOCK or CONFIG_KEYBOARD_C65_CAPS_LOCK
|
||||
} ; CONFIG_KEYBOARD_C128_CAPS_LOCK or CONFIG_KEYBOARD_C65_CAPS_LOCK
|
||||
|
||||
#if !CONFIG_KEYBOARD_C128 && !CONFIG_KEYBOARD_C128_CAPS_LOCK && !CONFIG_KEYBOARD_C65 && !CONFIG_KEYBOARD_C65_CAPS_LOCK
|
||||
!ifndef CONFIG_KEYBOARD_C128_OR_C65 { !ifndef CONFIG_KEYBOARD_CAPS_LOCK {
|
||||
|
||||
lda (KEYTAB), y
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
||||
// Output PETSCII code to the keyboard buffer
|
||||
; Output PETSCII code to the keyboard buffer
|
||||
|
||||
scnkey_got_petscii:
|
||||
|
||||
#if CONFIG_KEYBOARD_C128 && CONFIG_EDIT_TABULATORS
|
||||
!ifdef CONFIG_KEYBOARD_C128 { !ifdef CONFIG_EDIT_TABULATORS {
|
||||
|
||||
// Special handling for SHIFT+TAB; it is easier than creating new matrix
|
||||
; Special handling for SHIFT+TAB; it is easier than creating new matrix
|
||||
|
||||
tax
|
||||
cmp #KEY_C64_TAB_FW
|
||||
bne !+
|
||||
bne @8
|
||||
lda SHFLAG
|
||||
and #KEY_FLAG_SHIFT
|
||||
beq !+
|
||||
beq @8
|
||||
ldx #KEY_C64_TAB_BW
|
||||
!:
|
||||
@8:
|
||||
txa
|
||||
|
||||
#endif // CONFIG_KEYBOARD_C128 and CONFIG_EDIT_TABULATORS
|
||||
} } ; CONFIG_KEYBOARD_C128 and CONFIG_EDIT_TABULATORS
|
||||
|
||||
beq scnkey_no_keys // branch if we have no PETSCII code for this key
|
||||
beq scnkey_no_keys ; branch if we have no PETSCII code for this key
|
||||
ldy NDX
|
||||
sta KEYD, y
|
||||
inc NDX
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
scnkey_done:
|
||||
|
||||
@@ -428,46 +424,46 @@ scnkey_done:
|
||||
|
||||
scnkey_try_repeat:
|
||||
|
||||
#if !CONFIG_KEY_REPEAT_ALWAYS
|
||||
!ifndef CONFIG_KEY_REPEAT_ALWAYS {
|
||||
|
||||
// Check whether we should repeat keys - first the flag, afterwards hardcoded list
|
||||
; Check whether we should repeat keys - first the flag, afterwards hardcoded list
|
||||
|
||||
lda RPTFLG
|
||||
bmi scnkey_handle_repeat // branch if we should repeat always
|
||||
bmi scnkey_handle_repeat ; branch if we should repeat always
|
||||
|
||||
tya
|
||||
ldx #(__kb_matrix_alwaysrepeat_end - kb_matrix_alwaysrepeat - 1)
|
||||
!:
|
||||
@9:
|
||||
cmp kb_matrix_alwaysrepeat, x
|
||||
beq scnkey_handle_repeat
|
||||
dex
|
||||
bpl !-
|
||||
bpl @9
|
||||
bmi scnkey_done
|
||||
|
||||
scnkey_handle_repeat:
|
||||
|
||||
#endif // no CONFIG_KEY_REPEAT_ALWAYS
|
||||
} ; no CONFIG_KEY_REPEAT_ALWAYS
|
||||
|
||||
// Countdown before first repeat
|
||||
; Countdown before first repeat
|
||||
|
||||
lda DELAY
|
||||
beq !+
|
||||
beq @10
|
||||
dec DELAY
|
||||
|
||||
rts
|
||||
!:
|
||||
// Countdown before subsequent repeats
|
||||
@10:
|
||||
; Countdown before subsequent repeats
|
||||
|
||||
lda KOUNT
|
||||
beq scnkey_output_key // if second counter is also 0, we can repeat the key
|
||||
beq scnkey_output_key ; if second counter is also 0, we can repeat the key
|
||||
dec KOUNT
|
||||
|
||||
rts
|
||||
|
||||
scnkey_early_repeat:
|
||||
|
||||
// Keyboard buffer was full - at least make sure the key
|
||||
// will be repeated as soon as possible
|
||||
; Keyboard buffer was full - at least make sure the key
|
||||
; will be repeated as soon as possible
|
||||
|
||||
lda #$00
|
||||
sta DELAY
|
||||
@@ -475,4 +471,4 @@ scnkey_early_repeat:
|
||||
|
||||
rts
|
||||
|
||||
#endif // no CONFIG_LEGACY_SCNKEY
|
||||
} ; no CONFIG_LEGACY_SCNKEY
|
||||
@@ -1,71 +1,71 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Keyboard scanning routine extension for C128 keyboards
|
||||
//
|
||||
// - [CM128] Computes Mapping the Commodore 128 - pages 212 (SHFLAG), 290 (matrix)
|
||||
//
|
||||
;
|
||||
; Keyboard scanning routine extension for C128 keyboards
|
||||
;
|
||||
; - [CM128] Computes Mapping the Commodore 128 - pages 212 (SHFLAG), 290 (matrix)
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_KEYBOARD_C128 && !CONFIG_LEGACY_SCNKEY
|
||||
!ifdef CONFIG_KEYBOARD_C128 { !ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
// Inlining this within SCNKEY would both overcomplicate the implementation
|
||||
// and disrupt a lot of branches (they would cross the 127 bytes distance limit)
|
||||
; Inlining this within SCNKEY would both overcomplicate the implementation
|
||||
; and disrupt a lot of branches (they would cross the 127 bytes distance limit)
|
||||
|
||||
// .Y is now $FF - try to put there a key code from extended keyboard
|
||||
; .Y is now $FF - try to put there a key code from extended keyboard
|
||||
|
||||
|
||||
scnkey_128:
|
||||
|
||||
sty CIA1_PRA // disconnect all the classic keys first
|
||||
sty CIA1_PRA ; disconnect all the classic keys first
|
||||
|
||||
ldx #$02
|
||||
scnkey_matrix_128_loop:
|
||||
lda kb_matrix_row_keys, x
|
||||
sta VIC_XSCAN
|
||||
lda kb_matrix_128_bucky_filter, x // filter out bucky keys
|
||||
lda kb_matrix_128_bucky_filter, x ; filter out bucky keys
|
||||
ora CIA1_PRB
|
||||
cmp #$FF
|
||||
beq scnkey_matrix_128_loop_next // skip if no key pressed from this row
|
||||
beq scnkey_matrix_128_loop_next ; skip if no key pressed from this row
|
||||
cpy #$FF
|
||||
bne scnkey_128_no_keys // jam, more than one key pressed
|
||||
// We have at least one key pressed in this row, we need to find which one exactly
|
||||
bne scnkey_128_no_keys ; jam, more than one key pressed
|
||||
; We have at least one key pressed in this row, we need to find which one exactly
|
||||
ldy #$07
|
||||
scnkey_matrix_128_loop_inner:
|
||||
cmp kb_matrix_row_keys, y
|
||||
bne !+ // not this particular key
|
||||
tya // now .A contains key offset within a row
|
||||
bne @1 ; not this particular key
|
||||
tya ; now .A contains key offset within a row
|
||||
clc
|
||||
adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start
|
||||
adc #$41 // now .A contains offset after the standard matrix
|
||||
adc kb_matrix_row_offsets, x ; now .A contains key offset from the matrix start
|
||||
adc #$41 ; now .A contains offset after the standard matrix
|
||||
tay
|
||||
jmp scnkey_matrix_128_loop_next
|
||||
!:
|
||||
@1:
|
||||
dey
|
||||
bpl scnkey_matrix_128_loop_inner
|
||||
bmi scnkey_128_no_keys // branch always, multiple keys must have been pressed
|
||||
bmi scnkey_128_no_keys ; branch always, multiple keys must have been pressed
|
||||
scnkey_matrix_128_loop_next:
|
||||
dex
|
||||
bpl scnkey_matrix_128_loop
|
||||
|
||||
// Scanning the C128 keyboard part complete
|
||||
; Scanning the C128 keyboard part complete
|
||||
|
||||
scnkey_128_done:
|
||||
|
||||
stx VIC_XSCAN // $FF, disconnects C128 keys
|
||||
stx VIC_XSCAN ; $FF, disconnects C128 keys
|
||||
rts
|
||||
|
||||
|
||||
scnkey_128_no_keys:
|
||||
|
||||
pla // get rid of return address from the stack
|
||||
pla ; get rid of return address from the stack
|
||||
pla
|
||||
|
||||
jmp scnkey_no_keys // pass controll to original routine
|
||||
jmp scnkey_no_keys ; pass controll to original routine
|
||||
|
||||
|
||||
#endif // CONFIG_KEYBOARD_C128 and no CONFIG_LEGACY_SCNKEY
|
||||
} } ; CONFIG_KEYBOARD_C128 and no CONFIG_LEGACY_SCNKEY
|
||||
@@ -1,68 +1,68 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Keyboard scanning routine extension for C65 keyboards
|
||||
//
|
||||
// - [CM128] Computes Mapping the Commodore 128 - pages 212 (SHFLAG)
|
||||
// - https://github.com/MEGA65/c65-specifications/blob/master/c65manualupdated.txt (matrix)
|
||||
//
|
||||
;
|
||||
; Keyboard scanning routine extension for C65 keyboards
|
||||
;
|
||||
; - [CM128] Computes Mapping the Commodore 128 - pages 212 (SHFLAG)
|
||||
; - https://github.com/MEGA65/c65-specifications/blob/master/c65manualupdated.txt (matrix)
|
||||
;
|
||||
|
||||
|
||||
#if CONFIG_KEYBOARD_C65 && !CONFIG_LEGACY_SCNKEY
|
||||
!ifdef CONFIG_KEYBOARD_C65 { !ifndef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
// Inlining this within SCNKEY would both overcomplicate the implementation
|
||||
// and disrupt a lot of branches (they would cross the 127 bytes distance limit)
|
||||
; Inlining this within SCNKEY would both overcomplicate the implementation
|
||||
; and disrupt a lot of branches (they would cross the 127 bytes distance limit)
|
||||
|
||||
// .Y is now $FF - try to put there a key code from extended keyboard
|
||||
; .Y is now $FF - try to put there a key code from extended keyboard
|
||||
|
||||
scnkey_65:
|
||||
|
||||
sty CIA1_PRA // disconnect classic keys
|
||||
sty CIA1_PRA ; disconnect classic keys
|
||||
|
||||
lda #$00
|
||||
sta C65_EXTKEYS_PR // connect C65 keys
|
||||
sta C65_EXTKEYS_PR ; connect C65 keys
|
||||
|
||||
lda #%00000101 // filter out bucky keys: ALT, NO_SCRL
|
||||
lda #%00000101 ; filter out bucky keys: ALT, NO_SCRL
|
||||
ora CIA1_PRB
|
||||
|
||||
cmp #$FF
|
||||
beq scnkey_65_done // skip if no key pressed from this row
|
||||
beq scnkey_65_done ; skip if no key pressed from this row
|
||||
|
||||
// At least one key is pressed - decode it
|
||||
; At least one key is pressed - decode it
|
||||
ldy #$07
|
||||
scnkey_matrix_65_loop:
|
||||
cmp kb_matrix_row_keys, y
|
||||
bne !+ // not this particular key
|
||||
tya // now .A contains key offset within a row
|
||||
bne @1 ; not this particular key
|
||||
tya ; now .A contains key offset within a row
|
||||
clc
|
||||
adc kb_matrix_row_offsets, x // now .A contains key offset from the matrix start
|
||||
adc #$41 // now .A contains offset after the standard matrix
|
||||
adc kb_matrix_row_offsets, x ; now .A contains key offset from the matrix start
|
||||
adc #$41 ; now .A contains offset after the standard matrix
|
||||
tay
|
||||
jmp scnkey_65_done
|
||||
!:
|
||||
@1:
|
||||
dey
|
||||
bpl scnkey_matrix_65_loop
|
||||
|
||||
// FALLTROUGH, multiple keys must have been pressed
|
||||
; FALLTROUGH, multiple keys must have been pressed
|
||||
|
||||
scnkey_65_no_keys:
|
||||
|
||||
pla // get rid of return address from the stack
|
||||
pla ; get rid of return address from the stack
|
||||
pla
|
||||
|
||||
jmp scnkey_no_keys // pass controll to original routine
|
||||
jmp scnkey_no_keys ; pass controll to original routine
|
||||
|
||||
|
||||
scnkey_65_done:
|
||||
|
||||
ldx #$FF
|
||||
stx C65_EXTKEYS_PR // connect C65 keys
|
||||
stx C65_EXTKEYS_PR ; connect C65 keys
|
||||
|
||||
rts
|
||||
|
||||
|
||||
#endif // CONFIG_KEYBOARD_C65 and no CONFIG_LEGACY_SCNKEY
|
||||
} } ; CONFIG_KEYBOARD_C65 and no CONFIG_LEGACY_SCNKEY
|
||||
+173
-173
@@ -1,124 +1,124 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Official Kernal routine, described in:
|
||||
//
|
||||
// - [RG64] C64 Programmers Reference Guide - page 295
|
||||
// - [CM64] Computes Mapping the Commodore 64 - page 220
|
||||
//
|
||||
// CPU registers that has to be preserved (see [RG64]): none
|
||||
//
|
||||
;
|
||||
; Official Kernal routine, described in:
|
||||
;
|
||||
; - [RG64] C64 Programmers Reference Guide - page 295
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 220
|
||||
;
|
||||
; CPU registers that has to be preserved (see [RG64]): none
|
||||
;
|
||||
|
||||
|
||||
// NOTE: The code here is described as legacy, because the algorithm (although working very well)
|
||||
// requires much more RAM than the original Kernal routine uses; without any form of extended
|
||||
// RAM available to Open ROMs it will always be a serious compatibility risk.
|
||||
; NOTE: The code here is described as legacy, because the algorithm (although working very well)
|
||||
; requires much more RAM than the original Kernal routine uses; without any form of extended
|
||||
; RAM available to Open ROMs it will always be a serious compatibility risk.
|
||||
|
||||
|
||||
#if CONFIG_LEGACY_SCNKEY
|
||||
!ifdef CONFIG_LEGACY_SCNKEY {
|
||||
|
||||
|
||||
// Scan the keyboard..
|
||||
// Here we don't use the horrible buggy original routine,
|
||||
// not just because of copyright. Instead, we use the
|
||||
// nice one with joystick interference removal and
|
||||
// key roll-over support from
|
||||
// http://codebase64.org/doku.php?id=base:scanning_the_keyboard_the_correct_and_non_kernal_way
|
||||
; Scan the keyboard..
|
||||
; Here we don't use the horrible buggy original routine,
|
||||
; not just because of copyright. Instead, we use the
|
||||
; nice one with joystick interference removal and
|
||||
; key roll-over support from
|
||||
; http://codebase64.org/doku.php?id=base:scanning_the_keyboard_the_correct_and_non_kernal_way
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Keyboard IO Routine
|
||||
// ~~~~~~~~~~~~~~~~~~~
|
||||
// By: TWW/CTR
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; Keyboard IO Routine
|
||||
; ~~~~~~~~~~~~~~~~~~~
|
||||
; By: TWW/CTR
|
||||
|
||||
|
||||
// Information
|
||||
// ~~~~~~~~~~~
|
||||
// The routine uses "2 Key rollower" or up to 3 if the key-combination doesen't induce shadowing.
|
||||
// If 2 or 3 keys are pressed simultaneously (within 1 scan) a "No Activity" state has to occur before new valid keys are returned.
|
||||
// RESTORE is not detectable and must be handled by NMI IRQ.
|
||||
// SHIFT LOCK is not detected due to unreliability.
|
||||
; Information
|
||||
; ~~~~~~~~~~~
|
||||
; The routine uses "2 Key rollower" or up to 3 if the key-combination doesen't induce shadowing.
|
||||
; If 2 or 3 keys are pressed simultaneously (within 1 scan) a "No Activity" state has to occur before new valid keys are returned.
|
||||
; RESTORE is not detectable and must be handled by NMI IRQ.
|
||||
; SHIFT LOCK is not detected due to unreliability.
|
||||
|
||||
|
||||
// History:
|
||||
// ~~~~~~~~
|
||||
// V3.0 - Hacked to pieces by PGS to work as KERNAL keyboard scan routine
|
||||
// V2.5 - New test tool.
|
||||
// Added return of error codes.
|
||||
// Fixed a bug causing Buffer Overflow.
|
||||
// Fixed a bug in Non Alphanumerical Flags from 2.0.
|
||||
// V2.1 - Shortened the source by adding .for loops & Updated the header and some comments.
|
||||
// Added "simultaneous keypress" check.
|
||||
// V2.0 - Added return of non-Alphanumeric keys into X & Y-Registers.
|
||||
// Small optimizations here and there.
|
||||
// V1.1 - Unrolled code to make it faster and optimized other parts of it.
|
||||
// Removed SHIFT LOCK scanning.
|
||||
// V1.0 - First Working Version along with test tool.
|
||||
; History:
|
||||
; ~~~~~~~~
|
||||
; V3.0 - Hacked to pieces by PGS to work as KERNAL keyboard scan routine
|
||||
; V2.5 - New test tool.
|
||||
; Added return of error codes.
|
||||
; Fixed a bug causing Buffer Overflow.
|
||||
; Fixed a bug in Non Alphanumerical Flags from 2.0.
|
||||
; V2.1 - Shortened the source by adding .for loops & Updated the header and some comments.
|
||||
; Added "simultaneous keypress" check.
|
||||
; V2.0 - Added return of non-Alphanumeric keys into X & Y-Registers.
|
||||
; Small optimizations here and there.
|
||||
; V1.1 - Unrolled code to make it faster and optimized other parts of it.
|
||||
; Removed SHIFT LOCK scanning.
|
||||
; V1.0 - First Working Version along with test tool.
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||
|
||||
// Low memory variables
|
||||
; Low memory variables
|
||||
|
||||
// Reuse RS232 variables, since they should not be used by other things.
|
||||
// Carefully avoid $A7 which is used by 64NET
|
||||
.label KeyQuantity = $A8 // 1 byte
|
||||
.label BufferNew = $A9 // 3 bytes
|
||||
.label TempZP = $B6 // 1 byte
|
||||
// These should be initialized in CINT to $FF
|
||||
.label BufferQuantity = $B4 // 1 byte
|
||||
.label BufferOld = $293 // 3 bytes
|
||||
.label Buffer = $297 // 4 bytes
|
||||
; Reuse RS232 variables, since they should not be used by other things.
|
||||
; Carefully avoid $A7 which is used by 64NET
|
||||
!addr KeyQuantity = $A8 ; 1 byte
|
||||
!addr BufferNew = $A9 ; 3 bytes
|
||||
!addr TempZP = $B6 ; 1 byte
|
||||
; These should be initialized in CINT to $FF
|
||||
!addr BufferQuantity = $B4 ; 1 byte
|
||||
!addr BufferOld = $293 ; 3 bytes
|
||||
!addr Buffer = $297 ; 4 bytes
|
||||
|
||||
// $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20
|
||||
// and not used on C64, so safe for us to use, probably.
|
||||
.label ScanResult = $250 // 8 bytes
|
||||
; $250-$258 is the 81st - 88th characters in BASIC input, a carry over from VIC-20
|
||||
; and not used on C64, so safe for us to use, probably.
|
||||
!addr ScanResult = $250 ; 8 bytes
|
||||
|
||||
// Operational Variables
|
||||
.const MaxKeyRollover = 3
|
||||
; Operational Variables
|
||||
!addr MaxKeyRollover = 3
|
||||
|
||||
SCNKEY:
|
||||
|
||||
lda #$00
|
||||
sta BufferQuantity
|
||||
|
||||
// Decrement key repeat timeout if non-zero
|
||||
; Decrement key repeat timeout if non-zero
|
||||
ldx KOUNT
|
||||
beq sk_start
|
||||
dec KOUNT
|
||||
|
||||
sk_start:
|
||||
// Call main keyboard scanning routine
|
||||
; Call main keyboard scanning routine
|
||||
jsr Main
|
||||
|
||||
lda BufferQuantity
|
||||
beq no_keys_waiting
|
||||
|
||||
// Stuff each key pressed into the keyboard buffer
|
||||
; Stuff each key pressed into the keyboard buffer
|
||||
|
||||
ldy #$00
|
||||
!:
|
||||
@1:
|
||||
lda Buffer,y
|
||||
jsr accept_key
|
||||
iny
|
||||
cpy BufferQuantity
|
||||
bne !-
|
||||
bne @1
|
||||
no_keys_waiting:
|
||||
|
||||
rts
|
||||
|
||||
accept_key:
|
||||
// Work out what is new and needs to be added
|
||||
// to the input buffer.
|
||||
// Also update the bucky key status flags etc
|
||||
; Work out what is new and needs to be added
|
||||
; to the input buffer.
|
||||
; Also update the bucky key status flags etc
|
||||
cmp #$ff
|
||||
beq sk_nokey
|
||||
// Got a key, turn it from matrix position to key value,
|
||||
// and stuff it in the keyboard buffer
|
||||
; Got a key, turn it from matrix position to key value,
|
||||
; and stuff it in the keyboard buffer
|
||||
|
||||
// Convert matrix position to key code
|
||||
// XXX - Add offset of $40, $80 or $C0 if shift, CONTROL or C= are held down
|
||||
; Convert matrix position to key code
|
||||
; XXX - Add offset of $40, $80 or $C0 if shift, CONTROL or C= are held down
|
||||
pha
|
||||
lda SHFLAG
|
||||
and #$7
|
||||
@@ -128,10 +128,10 @@ accept_key:
|
||||
ora kb_matrix_lookup,x
|
||||
tax
|
||||
lda kb_matrix,x
|
||||
// But don't insert $00 characters
|
||||
; But don't insert $00 characters
|
||||
beq sk_nokey
|
||||
|
||||
// Stash key into keyboard buffer
|
||||
; Stash key into keyboard buffer
|
||||
ldx NDX
|
||||
cpx XMAX
|
||||
beq sk_nokey
|
||||
@@ -142,8 +142,8 @@ sk_nokey:
|
||||
|
||||
rts
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Routine for Scanning a Matrix Row
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Routine for Scanning a Matrix Row
|
||||
|
||||
KeyInRow:
|
||||
ldy #7
|
||||
@@ -159,18 +159,18 @@ nokey:
|
||||
rts
|
||||
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Routine for handling: Key Found
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Routine for handling: Key Found
|
||||
|
||||
KeyFound:
|
||||
stx TempZP
|
||||
dec KeyQuantity
|
||||
bmi OverFlow
|
||||
|
||||
// Originally, we resolved the keys.
|
||||
// Now we just return the matrix position, so that
|
||||
// we can do C64-style bucky modifications as normal
|
||||
// was: ldy KeyTable,x
|
||||
; Originally, we resolved the keys.
|
||||
; Now we just return the matrix position, so that
|
||||
; we can do C64-style bucky modifications as normal
|
||||
; was: ldy KeyTable,x
|
||||
pha
|
||||
txa
|
||||
|
||||
@@ -180,15 +180,15 @@ KeyFound:
|
||||
ldx TempZP
|
||||
rts
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Routine for handling: Overflow
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Routine for handling: Overflow
|
||||
|
||||
OverFlow:
|
||||
pla // Dirty hack to handle 2 layers of JSR
|
||||
pla ; Dirty hack to handle 2 layers of JSR
|
||||
pla
|
||||
pla
|
||||
pla
|
||||
// Don't manipulate last legal buffer as the routine will fix itself once it gets valid input again.
|
||||
; Don't manipulate last legal buffer as the routine will fix itself once it gets valid input again.
|
||||
|
||||
ReturnNoKeys:
|
||||
sec
|
||||
@@ -197,21 +197,21 @@ ReturnNoKeys:
|
||||
lda #$FF
|
||||
sta LSTX
|
||||
ldx #MaxKeyRollover-1
|
||||
!:
|
||||
@2:
|
||||
sta Buffer,x
|
||||
sta BufferOld,x
|
||||
dex
|
||||
bpl !-
|
||||
bpl @2
|
||||
|
||||
rts
|
||||
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Exit Routine for: No Activity
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Exit Routine for: No Activity
|
||||
|
||||
NoActivityDetected:
|
||||
|
||||
// So cancel all bucky keys
|
||||
; So cancel all bucky keys
|
||||
lda SHFLAG
|
||||
sta LSTSHF
|
||||
lda #$00
|
||||
@@ -219,22 +219,22 @@ NoActivityDetected:
|
||||
|
||||
jmp ReturnNoKeys
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Configure Data Direction Registers
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Configure Data Direction Registers
|
||||
Main:
|
||||
// Begin with no key events
|
||||
; Begin with no key events
|
||||
lda #$ff
|
||||
sta BufferNew+0
|
||||
sta BufferNew+1
|
||||
sta BufferNew+2
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Check for Port Activity
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Check for Port Activity
|
||||
|
||||
ldx #$FF
|
||||
ldy #$00
|
||||
|
||||
sty CIA1_PRA // Connect all Keyboard Rows
|
||||
sty CIA1_PRA ; Connect all Keyboard Rows
|
||||
cpx CIA1_PRB
|
||||
bne skip0
|
||||
|
||||
@@ -242,69 +242,69 @@ Main:
|
||||
|
||||
JoystickActivity:
|
||||
|
||||
// Clear bucky key status
|
||||
; Clear bucky key status
|
||||
lda #$00
|
||||
sta SHFLAG
|
||||
|
||||
lda CIA1_PRB
|
||||
and #$03
|
||||
cmp #$01
|
||||
bne !+
|
||||
// down
|
||||
ldx #$07 // UP/DOWN
|
||||
bne @3
|
||||
; down
|
||||
ldx #$07 ; UP/DOWN
|
||||
jsr KeyFound
|
||||
!:
|
||||
@3:
|
||||
cmp #$02
|
||||
bne !+
|
||||
// Up
|
||||
// Mark shift as pressed
|
||||
bne @4
|
||||
; Up
|
||||
; Mark shift as pressed
|
||||
ldx #$01
|
||||
stx SHFLAG
|
||||
ldx #$07 // UP/DOWN
|
||||
ldx #$07 ; UP/DOWN
|
||||
jsr KeyFound
|
||||
!:
|
||||
// Only allow up/down OR left/right, since
|
||||
// else we have confusing situation with SHIFT required
|
||||
// for one, but not the other.
|
||||
// XXX - We could fix this by making the joystick activity
|
||||
// feed the key input at a higher level, rather than
|
||||
// simulating directly pressing the cursor keys.
|
||||
@4:
|
||||
; Only allow up/down OR left/right, since
|
||||
; else we have confusing situation with SHIFT required
|
||||
; for one, but not the other.
|
||||
; XXX - We could fix this by making the joystick activity
|
||||
; feed the key input at a higher level, rather than
|
||||
; simulating directly pressing the cursor keys.
|
||||
cmp #$03
|
||||
beq !+
|
||||
beq @5
|
||||
jmp skdone
|
||||
!:
|
||||
@5:
|
||||
lda CIA1_PRB
|
||||
and #$0c
|
||||
cmp #$04
|
||||
bne !+
|
||||
bne @6
|
||||
ldx #$02
|
||||
jsr KeyFound // LEFT/RIGHT
|
||||
!:
|
||||
jsr KeyFound ; LEFT/RIGHT
|
||||
@6:
|
||||
cmp #$08
|
||||
bne !+
|
||||
bne @7
|
||||
ldx #$01
|
||||
stx SHFLAG
|
||||
ldx #$02
|
||||
jsr KeyFound // LEFT/RIGHT
|
||||
!:
|
||||
jsr KeyFound ; LEFT/RIGHT
|
||||
@7:
|
||||
jmp skdone
|
||||
|
||||
|
||||
skip0:
|
||||
|
||||
// // Set max keys allowed before ignoring result
|
||||
; ; Set max keys allowed before ignoring result
|
||||
lda #MaxKeyRollover
|
||||
sta KeyQuantity
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Check for Control Port #1 Activity
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Check for Control Port #1 Activity
|
||||
|
||||
stx CIA1_PRA // Disconnect all Keyboard Rows
|
||||
cpx CIA1_PRB // Only Control Port activity will be detected
|
||||
stx CIA1_PRA ; Disconnect all Keyboard Rows
|
||||
cpx CIA1_PRB ; Only Control Port activity will be detected
|
||||
bne JoystickActivity
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Scan Keyboard Matrix
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Scan Keyboard Matrix
|
||||
|
||||
ldx #7
|
||||
lda #%11111110
|
||||
@@ -319,40 +319,40 @@ next_row:
|
||||
dex
|
||||
bpl next_row
|
||||
|
||||
// X gets back to $FF here, which is assumed below
|
||||
; X gets back to $FF here, which is assumed below
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Check for Control Port #1 Activity (again)
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Check for Control Port #1 Activity (again)
|
||||
|
||||
stx CIA1_PRA // Disconnect all Keyboard Rows
|
||||
cpx CIA1_PRB // Only Control Port activity will be detected
|
||||
beq !+
|
||||
stx CIA1_PRA ; Disconnect all Keyboard Rows
|
||||
cpx CIA1_PRB ; Only Control Port activity will be detected
|
||||
beq @8
|
||||
jmp ReturnNoKeys
|
||||
!:
|
||||
// Make X = $00, assumed below
|
||||
@8:
|
||||
; Make X = $00, assumed below
|
||||
inx
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Check and flag Non Alphanumeric Keys
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Check and flag Non Alphanumeric Keys
|
||||
|
||||
// Store de-bounce data for bucky keys
|
||||
// (Compute's Mapping the 64, p58-59)
|
||||
; Store de-bounce data for bucky keys
|
||||
; (Compute's Mapping the 64, p58-59)
|
||||
lda SHFLAG
|
||||
sta LSTSHF
|
||||
|
||||
// Build bucky state
|
||||
; Build bucky state
|
||||
lda #$00
|
||||
sta SHFLAG
|
||||
lda ScanResult+6
|
||||
eor #%10000000
|
||||
and #%10000000 // Left shift
|
||||
and #%10000000 ; Left shift
|
||||
rol
|
||||
rol
|
||||
and #$01
|
||||
ora SHFLAG
|
||||
sta SHFLAG
|
||||
|
||||
// Right shift
|
||||
; Right shift
|
||||
lda ScanResult+1
|
||||
eor #$10
|
||||
lsr
|
||||
@@ -363,14 +363,14 @@ next_row:
|
||||
ora SHFLAG
|
||||
sta SHFLAG
|
||||
|
||||
// Control
|
||||
; Control
|
||||
lda ScanResult+0
|
||||
eor #$04
|
||||
and #$04
|
||||
ora SHFLAG
|
||||
sta SHFLAG
|
||||
|
||||
// Vendor key
|
||||
; Vendor key
|
||||
lda ScanResult+0
|
||||
eor #$ff
|
||||
lsr
|
||||
@@ -381,13 +381,13 @@ next_row:
|
||||
ora SHFLAG
|
||||
sta SHFLAG
|
||||
|
||||
// Handle SHIFT + VENDOR
|
||||
; Handle SHIFT + VENDOR
|
||||
jsr scnkey_toggle_if_needed
|
||||
|
||||
no_case_toggle:
|
||||
|
||||
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// // Check for pressed key(s)
|
||||
; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; ; Check for pressed key(s)
|
||||
|
||||
lda ScanResult+7
|
||||
cmp #$ff
|
||||
@@ -432,15 +432,15 @@ skdone:
|
||||
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Key Scan Completed
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; Key Scan Completed
|
||||
|
||||
// Put any new key (not in old scan) into buffer
|
||||
; Put any new key (not in old scan) into buffer
|
||||
ldx #MaxKeyRollover-1
|
||||
|
||||
ProcessPressedKeys:
|
||||
|
||||
// Check if the currently pressed key is continuing to be held down
|
||||
; Check if the currently pressed key is continuing to be held down
|
||||
lda BufferNew,x
|
||||
cmp #$ff
|
||||
beq ConsiderNextKey
|
||||
@@ -453,12 +453,12 @@ ProcessPressedKeys:
|
||||
|
||||
RecordKeypress:
|
||||
|
||||
// New Key Detected
|
||||
; New Key Detected
|
||||
ldy BufferQuantity
|
||||
cpy #MaxKeyRollover
|
||||
bcc !+
|
||||
jmp ReturnNoKeys // too many new keys
|
||||
!:
|
||||
bcc @9
|
||||
jmp ReturnNoKeys ; too many new keys
|
||||
@9:
|
||||
AcceptKeyEvent:
|
||||
sta Buffer,y
|
||||
iny
|
||||
@@ -468,26 +468,26 @@ ConsiderNextKey:
|
||||
dex
|
||||
bpl ProcessPressedKeys
|
||||
|
||||
// Copy new presses to old list
|
||||
; Copy new presses to old list
|
||||
ldx #MaxKeyRollover-1
|
||||
!:
|
||||
@10:
|
||||
lda BufferNew,x
|
||||
sta BufferOld,x
|
||||
dex
|
||||
bpl !-
|
||||
bpl @10
|
||||
|
||||
// Return success and set of pressed keys
|
||||
; Return success and set of pressed keys
|
||||
clc
|
||||
rts
|
||||
|
||||
KeyHeld:
|
||||
// The key in A is still held down.
|
||||
// compare with key in LSTX
|
||||
// (Compute's Mapping the 64 p36-37)
|
||||
// if different, reset repeat count down.
|
||||
; The key in A is still held down.
|
||||
; compare with key in LSTX
|
||||
; (Compute's Mapping the 64 p36-37)
|
||||
; if different, reset repeat count down.
|
||||
|
||||
// Ignore bucky keys, so that repeat can work when a
|
||||
// bucky is held down.
|
||||
; Ignore bucky keys, so that repeat can work when a
|
||||
; bucky is held down.
|
||||
cmp #15
|
||||
beq BuckyHeld
|
||||
cmp #52
|
||||
@@ -500,7 +500,7 @@ KeyHeld:
|
||||
cmp LSTX
|
||||
beq SameKeyHeld
|
||||
|
||||
// Different key held
|
||||
; Different key held
|
||||
sta LSTX
|
||||
pha
|
||||
lda DELAY
|
||||
@@ -514,12 +514,12 @@ SameKeyHeld:
|
||||
lda KOUNT
|
||||
bmi KeyCanRepeat
|
||||
bne KeyRepeatWait
|
||||
// Count down ended, so repeat key now
|
||||
; Count down ended, so repeat key now
|
||||
KeyCanRepeat:
|
||||
|
||||
// (Compute's Mapping the 64 p58)
|
||||
; (Compute's Mapping the 64 p58)
|
||||
pha
|
||||
lda #6-2 // Fudge factor to match speed
|
||||
lda #6-2 ; Fudge factor to match speed
|
||||
sta KOUNT
|
||||
pla
|
||||
pla
|
||||
@@ -530,4 +530,4 @@ KeyRepeatWait:
|
||||
jmp ConsiderNextKey
|
||||
|
||||
|
||||
#endif // CONFIG_LEGACY_SCNKEY
|
||||
} ; CONFIG_LEGACY_SCNKEY
|
||||
@@ -1,109 +1,113 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Well-known Kernal routine, described in:
|
||||
//
|
||||
// - [CM64] Computes Mapping the Commodore 64 - pages 220, 221
|
||||
//
|
||||
;
|
||||
; Well-known Kernal routine, described in:
|
||||
;
|
||||
; - [CM64] Computes Mapping the Commodore 64 - pages 220, 221
|
||||
;
|
||||
|
||||
|
||||
scnkey_set_keytab:
|
||||
|
||||
|
||||
#if CONFIG_LEGACY_SCNKEY // routine not compatible with legacy SCNKEY
|
||||
!ifdef CONFIG_LEGACY_SCNKEY { ; routine not compatible with legacy SCNKEY
|
||||
|
||||
rts
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
|
||||
// Set initial KEYTAB value
|
||||
; Set initial KEYTAB value
|
||||
|
||||
lda #<kb_matrix
|
||||
sta KEYTAB+0
|
||||
lda #>kb_matrix
|
||||
sta KEYTAB+1
|
||||
|
||||
// Calculate table index
|
||||
; Calculate table index
|
||||
|
||||
lda SHFLAG
|
||||
and #$07 // we are only interested in SHIFT / CTRL / VENDOR keys
|
||||
and #$07 ; we are only interested in SHIFT / CTRL / VENDOR keys
|
||||
tax
|
||||
|
||||
// Retrieve table offset
|
||||
; Retrieve table offset
|
||||
lda kb_matrix_lookup, x
|
||||
cmp #$FF
|
||||
bne scnkey_valid_offset
|
||||
|
||||
// $FF means we should not decode anything, mark this by setting high byte
|
||||
// of KEYTAB to 0 (I do not think anyone would put keyboard decoding table
|
||||
// at zeropage)
|
||||
; $FF means we should not decode anything, mark this by setting high byte
|
||||
; of KEYTAB to 0 (I do not think anyone would put keyboard decoding table
|
||||
; at zeropage)
|
||||
lda #$00
|
||||
beq !+ // branch always
|
||||
beq scnkey_valid_offset_cont ; branch always
|
||||
|
||||
scnkey_valid_offset:
|
||||
|
||||
// Add offset to the vector
|
||||
; Add offset to the vector
|
||||
clc
|
||||
adc KEYTAB+0
|
||||
sta KEYTAB+0
|
||||
lda #$00
|
||||
adc KEYTAB+1
|
||||
!:
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
scnkey_valid_offset_cont:
|
||||
|
||||
sta KEYTAB+1
|
||||
|
||||
// FALLTROUGH
|
||||
; FALLTROUGH
|
||||
|
||||
|
||||
#endif // no CONFIG_LEGACY_SCNKEY
|
||||
} ; no CONFIG_LEGACY_SCNKEY
|
||||
|
||||
|
||||
scnkey_toggle_if_needed: // entry for SCNKEY (TWW/CTR version)
|
||||
scnkey_toggle_if_needed: ; entry for SCNKEY (TWW/CTR version)
|
||||
|
||||
// Check if we should toggle the character set
|
||||
; Check if we should toggle the character set
|
||||
|
||||
lda MODE
|
||||
bne !+ // not allowed to toggle
|
||||
bne @1 ; not allowed to toggle
|
||||
lda SHFLAG
|
||||
and #$03
|
||||
cmp #$03
|
||||
bne !+ // no SHIFT + VENDOR pressed
|
||||
bne @1 ; no SHIFT + VENDOR pressed
|
||||
lda LSTSHF
|
||||
and #$03
|
||||
cmp #$03
|
||||
beq !+ // already toggled
|
||||
beq @1 ; already toggled
|
||||
|
||||
// Toggle char set
|
||||
; Toggle char set
|
||||
|
||||
#if ROM_LAYOUT_M65
|
||||
!ifdef CONFIG_MB_M65 {
|
||||
|
||||
jsr M65_MODEGET
|
||||
bcc !++
|
||||
bcc @2
|
||||
|
||||
// Toggling charsets for C64 mode
|
||||
; Toggling charsets for C64 mode
|
||||
|
||||
lda VIC_YMCSB
|
||||
eor #$02
|
||||
sta VIC_YMCSB
|
||||
!:
|
||||
@1:
|
||||
rts
|
||||
|
||||
// Toggling charsets for M65 mode
|
||||
!:
|
||||
; Toggling charsets for M65 mode
|
||||
@2:
|
||||
lda VIC_CHARPTR+1
|
||||
eor #%00001000
|
||||
sta VIC_CHARPTR+1
|
||||
rts
|
||||
|
||||
#else
|
||||
} else {
|
||||
|
||||
lda VIC_YMCSB
|
||||
eor #$02
|
||||
sta VIC_YMCSB
|
||||
!:
|
||||
@1:
|
||||
rts
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# X16 * #IGNORE
|
||||
// #LAYOUT# * KERNAL_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 * #IGNORE
|
||||
;; #LAYOUT# * KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
// Short helper jump-via-vector routine, to set the keyboard matrix
|
||||
; Short helper jump-via-vector routine, to set the keyboard matrix
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
!ifndef HAS_OPCODES_65CE02 {
|
||||
|
||||
scnkey_via_keylog:
|
||||
|
||||
jmp (KEYLOG)
|
||||
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user