Compare commits
3 Commits
5c02ff6585
...
64492a5f6b
Author | SHA1 | Date | |
---|---|---|---|
64492a5f6b | |||
9867e4a119 | |||
4e76be17ad |
@ -111,10 +111,8 @@ set:
|
|||||||
bit previous_scancode
|
bit previous_scancode
|
||||||
jmi break_key ; bit 7 set = BREAK
|
jmi break_key ; bit 7 set = BREAK
|
||||||
|
|
||||||
cmp #$90 ; only BREAK is higher than 8F, (also code table only has 8F bytes)
|
cpx #$60 ; codes >= 60 in separate table to reduce memory consumption
|
||||||
bcs check_release
|
bcs x_ge_60
|
||||||
cmp #$60 ; codes >= 60 in separate table to reduce memory consumption
|
|
||||||
bcs upper_range
|
|
||||||
bbs kb::MOD::SHIFT, modifier, modshift ; if shift active
|
bbs kb::MOD::SHIFT, modifier, modshift ; if shift active
|
||||||
bbs kb::MOD::RALT, modifier, modralt ; if ralt active
|
bbs kb::MOD::RALT, modifier, modralt ; if ralt active
|
||||||
|
|
||||||
@ -122,19 +120,11 @@ set:
|
|||||||
nomod:
|
nomod:
|
||||||
lda CHARS_NOMOD,x
|
lda CHARS_NOMOD,x
|
||||||
bra check_char
|
bra check_char
|
||||||
upper_range:
|
modralt:
|
||||||
bbs kb::MOD::NUMLOCK, modifier, modnumlock ; if numlock active
|
lda CHARS_MODRALT,x
|
||||||
; numlock off
|
|
||||||
lda CHARS_NUMLOCK_OFF,x
|
|
||||||
bra check_char
|
|
||||||
modnumlock:
|
|
||||||
lda CHARS_NUMLOCK_ON,x
|
|
||||||
bra check_char
|
bra check_char
|
||||||
modshift:
|
modshift:
|
||||||
lda CHARS_MODSHIFT,x
|
lda CHARS_MODSHIFT,x
|
||||||
bra check_char
|
|
||||||
modralt:
|
|
||||||
lda CHARS_MODRALT,x
|
|
||||||
check_char:
|
check_char:
|
||||||
beq not_mod ; 0 => not mod and not char
|
beq not_mod ; 0 => not mod and not char
|
||||||
cmp #1 ; 1 => mod
|
cmp #1 ; 1 => mod
|
||||||
@ -146,8 +136,19 @@ not_mod: ; store keycode if not mod
|
|||||||
_rts:
|
_rts:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
check_release:
|
x_ge_60: ; x >= $60
|
||||||
cmp #kb::K_BREAK
|
cpx #$90 ; only BREAK is higher than 8F, (also code table only has 8F bytes)
|
||||||
|
bcs check_release
|
||||||
|
; CHARS_NUMLOCK_OFF - CHARS_NOMOD = 60 -> no need to subtract $60 first
|
||||||
|
; CHARS_NUMLOCK_ON - CHARS_MODSHIFT = 60 -> no need to subtract $60 first
|
||||||
|
bbs kb::MOD::NUMLOCK, modifier, modshift ; if numlock active
|
||||||
|
lda CHARS_NOMOD,x
|
||||||
|
bra check_char
|
||||||
|
check_release: ; x >= $90
|
||||||
|
; DEBUG
|
||||||
|
lda #'9'
|
||||||
|
sta char
|
||||||
|
cpx #kb::K_BREAK
|
||||||
bne _rts
|
bne _rts
|
||||||
lda #$ff
|
lda #$ff
|
||||||
sta previous_scancode
|
sta previous_scancode
|
||||||
@ -234,6 +235,9 @@ update_leds:
|
|||||||
.proc break_key
|
.proc break_key
|
||||||
; rmb kb::PREVIOUS::BREAK, kb::previous_scancode
|
; rmb kb::PREVIOUS::BREAK, kb::previous_scancode
|
||||||
stz previous_scancode
|
stz previous_scancode
|
||||||
|
; DEBUG
|
||||||
|
lda #'F'
|
||||||
|
sta char
|
||||||
|
|
||||||
; check mod keys
|
; check mod keys
|
||||||
cpx #kb::K::LEFTSHIFT
|
cpx #kb::K::LEFTSHIFT
|
||||||
@ -282,6 +286,10 @@ CHARS_NOMOD:
|
|||||||
.byte "\x00nbhgz6\x00\x00\x01mju78\x00"
|
.byte "\x00nbhgz6\x00\x00\x01mju78\x00"
|
||||||
.byte "\x00,kio09\x00\x00.-l\xEFp\xE2\x00"
|
.byte "\x00,kio09\x00\x00.-l\xEFp\xE2\x00"
|
||||||
.byte "\x00\x00\xE1#\xF5`\x00\x00\x01\x01\x00\x00\x00\x00\x00\x01"
|
.byte "\x00\x00\xE1#\xF5`\x00\x00\x01\x01\x00\x00\x00\x00\x00\x01"
|
||||||
|
CHARS_NUMLOCK_OFF:
|
||||||
|
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||||
|
.byte "\x00\x00\x00\x00\x00\x00\x01/\x00\x00\x00\x00+\x00*\x00"
|
||||||
|
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00-\x00"
|
||||||
CHARS_MODSHIFT:
|
CHARS_MODSHIFT:
|
||||||
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xDF\x00"
|
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xDF\x00"
|
||||||
.byte "\x00\x01\x01>\x01Q!\x00\x00\x01YSAW\"\x00"
|
.byte "\x00\x01\x01>\x01Q!\x00\x00\x01YSAW\"\x00"
|
||||||
@ -289,6 +297,10 @@ CHARS_MODSHIFT:
|
|||||||
.byte "\x00NBHGZ&\x00\x00\x01MJU/(\x00"
|
.byte "\x00NBHGZ&\x00\x00\x01MJU/(\x00"
|
||||||
.byte "\x00;KIO=)\x00\x00:_L\xEFP\xE2\x00"
|
.byte "\x00;KIO=)\x00\x00:_L\xEFP\xE2\x00"
|
||||||
.byte "\x00\x00\xE1'\xF5`\x00\x00\x01\x01\x00\x00\x00\x00\x00\x01"
|
.byte "\x00\x00\xE1'\xF5`\x00\x00\x01\x01\x00\x00\x00\x00\x00\x01"
|
||||||
|
CHARS_NUMLOCK_ON:
|
||||||
|
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x001\x0047\x00\x00\x00"
|
||||||
|
.byte "0.2568\x01\x00\x00\x003\x00\x009\x00\x00"
|
||||||
|
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00"
|
||||||
CHARS_MODRALT:
|
CHARS_MODRALT:
|
||||||
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00"
|
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00"
|
||||||
.byte "\x00\x01\x01|\x01\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00"
|
.byte "\x00\x01\x01|\x01\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00"
|
||||||
@ -296,11 +308,3 @@ CHARS_MODRALT:
|
|||||||
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00{[\x00"
|
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00{[\x00"
|
||||||
.byte "\x00\x00\x00\x00\x00}]\x00\x00\xA5\xB0\x00\x00\x00\x00\x00"
|
.byte "\x00\x00\x00\x00\x00}]\x00\x00\xA5\xB0\x00\x00\x00\x00\x00"
|
||||||
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x01"
|
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x01"
|
||||||
CHARS_NUMLOCK_OFF:
|
|
||||||
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
|
||||||
.byte "\x00\x00\x00\x00\x00\x00\x01/\x00\x00\x00\x00+\x00*\x00"
|
|
||||||
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00-\x00"
|
|
||||||
CHARS_NUMLOCK_ON:
|
|
||||||
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x001\x0047\x00\x00\x00"
|
|
||||||
.byte "0.2568\x01\x00\x00\x003\x00\x009\x00\x00"
|
|
||||||
.byte "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00"
|
|
||||||
|
@ -99,6 +99,13 @@ CODE_START:
|
|||||||
|
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
|
wai
|
||||||
|
; put shift, ralt and lalt in debug leds
|
||||||
|
lda kb::modifier
|
||||||
|
Reverse A
|
||||||
|
and #%00000111
|
||||||
|
ora IO1 + IO::RANH
|
||||||
|
sta IO1 + IO::RANH
|
||||||
lda kb::char
|
lda kb::char
|
||||||
beq @no_char
|
beq @no_char
|
||||||
stz kb::char
|
stz kb::char
|
||||||
|
@ -35,12 +35,14 @@ Import ps2kb, send_command, send_cmd, send_data, cmd_response, response_length,
|
|||||||
|
|
||||||
VIA = IO1
|
VIA = IO1
|
||||||
; Enough time must pass for 3 bits to be shifted in.
|
; Enough time must pass for 3 bits to be shifted in.
|
||||||
TIMER_RECV = 230 ; 230 ms (@1MHz)
|
; TIMER_RECV = 230 ; 230 ms (@1MHz)
|
||||||
|
TIMER_RECV = 400 ; 230 ms (@1MHz)
|
||||||
; Enough time must pass for one bit must be shifted out (parity),
|
; Enough time must pass for one bit must be shifted out (parity),
|
||||||
; but at most two (parity+stop).
|
; but at most two (parity+stop).
|
||||||
; After that, the interrupt must have happened because the keyboard will pull data low.
|
; After that, the interrupt must have happened because the keyboard will pull data low.
|
||||||
; At that point, the SR needs to be set to input again
|
; At that point, the SR needs to be set to input again
|
||||||
TIMER_SEND = 230 ; 180 ms (@1MHz)
|
; TIMER_SEND = 230 ; 180 ms (@1MHz)
|
||||||
|
TIMER_SEND = 400 ; 180 ms (@1MHz)
|
||||||
|
|
||||||
PULL_REG = IO::RANH
|
PULL_REG = IO::RANH
|
||||||
PULL_DDR = IO::DDRA
|
PULL_DDR = IO::DDRA
|
||||||
|
47
test.s65
47
test.s65
@ -1,23 +1,26 @@
|
|||||||
.include "system/system.h65"
|
.include "other/file.h65"
|
||||||
.include "system/lcd.h65"
|
|
||||||
|
|
||||||
.segment "TEST"
|
.zeropage
|
||||||
.macro MaskedWrite2 addr,value,mask
|
var1: .res 1
|
||||||
lda #value
|
char: .res 1
|
||||||
eor addr
|
|
||||||
and #mask
|
.code
|
||||||
eor addr
|
.proc my_subroutine
|
||||||
sta addr
|
pha
|
||||||
.endmacro
|
bbr4 var1,@bit_4_set
|
||||||
.import __SPI_SIZE__
|
bit var1
|
||||||
label:
|
; macro packs are supported
|
||||||
; JsrIndirect $2022
|
jmi other_routine
|
||||||
; .byte 0,1,2,3,4
|
lda #'a'
|
||||||
; JsrIndirect {($2022,x)}, label
|
sta char
|
||||||
; .byte 5,6,7,8,9
|
bra @end
|
||||||
; MaskedWrite2 lcd::LCD_IO+IO::DDRA, (lcd::RS | lcd::RW | lcd::E), lcd::RA_MASK
|
@bit_4_set:
|
||||||
; lda #(lcd::RS | lcd::RW | lcd::E) ; RA 5-7 output
|
; custom macros can be highlighted
|
||||||
; sta lcd::LCD_IO+IO::DDRA
|
Printf STR_FMT,char,var1
|
||||||
.word __SPI_SIZE__
|
@end:
|
||||||
.byte >__SPI_SIZE__
|
pla
|
||||||
.byte <__SPI_SIZE__
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
.rodata
|
||||||
|
STR_FMT: .asciiz "%c: num=%x"
|
||||||
|
@ -79,7 +79,9 @@ INCLUDE_UTILITY = 1
|
|||||||
;; @TODO optimize when immediate is used
|
;; @TODO optimize when immediate is used
|
||||||
;;********************************************************************************
|
;;********************************************************************************
|
||||||
.macro MaskedWrite addr,value,mask
|
.macro MaskedWrite addr,value,mask
|
||||||
|
.if .not .match(value, A)
|
||||||
lda value
|
lda value
|
||||||
|
.endif
|
||||||
eor addr
|
eor addr
|
||||||
and mask
|
and mask
|
||||||
eor addr
|
eor addr
|
||||||
|
Loading…
Reference in New Issue
Block a user