Compare commits
No commits in common. "64492a5f6b8b2ab1ac6442aae7219f24291ff08a" and "5c02ff65858dc5d348c666e9731b34d77f40dc99" have entirely different histories.
64492a5f6b
...
5c02ff6585
@ -111,8 +111,10 @@ set:
|
||||
bit previous_scancode
|
||||
jmi break_key ; bit 7 set = BREAK
|
||||
|
||||
cpx #$60 ; codes >= 60 in separate table to reduce memory consumption
|
||||
bcs x_ge_60
|
||||
cmp #$90 ; only BREAK is higher than 8F, (also code table only has 8F bytes)
|
||||
bcs check_release
|
||||
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::RALT, modifier, modralt ; if ralt active
|
||||
|
||||
@ -120,11 +122,19 @@ set:
|
||||
nomod:
|
||||
lda CHARS_NOMOD,x
|
||||
bra check_char
|
||||
modralt:
|
||||
lda CHARS_MODRALT,x
|
||||
upper_range:
|
||||
bbs kb::MOD::NUMLOCK, modifier, modnumlock ; if numlock active
|
||||
; numlock off
|
||||
lda CHARS_NUMLOCK_OFF,x
|
||||
bra check_char
|
||||
modnumlock:
|
||||
lda CHARS_NUMLOCK_ON,x
|
||||
bra check_char
|
||||
modshift:
|
||||
lda CHARS_MODSHIFT,x
|
||||
bra check_char
|
||||
modralt:
|
||||
lda CHARS_MODRALT,x
|
||||
check_char:
|
||||
beq not_mod ; 0 => not mod and not char
|
||||
cmp #1 ; 1 => mod
|
||||
@ -136,19 +146,8 @@ not_mod: ; store keycode if not mod
|
||||
_rts:
|
||||
rts
|
||||
|
||||
x_ge_60: ; x >= $60
|
||||
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
|
||||
check_release:
|
||||
cmp #kb::K_BREAK
|
||||
bne _rts
|
||||
lda #$ff
|
||||
sta previous_scancode
|
||||
@ -235,9 +234,6 @@ update_leds:
|
||||
.proc break_key
|
||||
; rmb kb::PREVIOUS::BREAK, kb::previous_scancode
|
||||
stz previous_scancode
|
||||
; DEBUG
|
||||
lda #'F'
|
||||
sta char
|
||||
|
||||
; check mod keys
|
||||
cpx #kb::K::LEFTSHIFT
|
||||
@ -286,10 +282,6 @@ CHARS_NOMOD:
|
||||
.byte "\x00nbhgz6\x00\x00\x01mju78\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"
|
||||
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:
|
||||
.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"
|
||||
@ -297,10 +289,6 @@ CHARS_MODSHIFT:
|
||||
.byte "\x00NBHGZ&\x00\x00\x01MJU/(\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"
|
||||
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:
|
||||
.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"
|
||||
@ -308,3 +296,11 @@ 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\xA5\xB0\x00\x00\x00\x00\x00"
|
||||
.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,13 +99,6 @@ CODE_START:
|
||||
|
||||
|
||||
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
|
||||
beq @no_char
|
||||
stz kb::char
|
||||
|
@ -35,14 +35,12 @@ Import ps2kb, send_command, send_cmd, send_data, cmd_response, response_length,
|
||||
|
||||
VIA = IO1
|
||||
; Enough time must pass for 3 bits to be shifted in.
|
||||
; TIMER_RECV = 230 ; 230 ms (@1MHz)
|
||||
TIMER_RECV = 400 ; 230 ms (@1MHz)
|
||||
TIMER_RECV = 230 ; 230 ms (@1MHz)
|
||||
; Enough time must pass for one bit must be shifted out (parity),
|
||||
; but at most two (parity+stop).
|
||||
; 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
|
||||
; TIMER_SEND = 230 ; 180 ms (@1MHz)
|
||||
TIMER_SEND = 400 ; 180 ms (@1MHz)
|
||||
TIMER_SEND = 230 ; 180 ms (@1MHz)
|
||||
|
||||
PULL_REG = IO::RANH
|
||||
PULL_DDR = IO::DDRA
|
||||
|
47
test.s65
47
test.s65
@ -1,26 +1,23 @@
|
||||
.include "other/file.h65"
|
||||
.include "system/system.h65"
|
||||
.include "system/lcd.h65"
|
||||
|
||||
.zeropage
|
||||
var1: .res 1
|
||||
char: .res 1
|
||||
|
||||
.code
|
||||
.proc my_subroutine
|
||||
pha
|
||||
bbr4 var1,@bit_4_set
|
||||
bit var1
|
||||
; macro packs are supported
|
||||
jmi other_routine
|
||||
lda #'a'
|
||||
sta char
|
||||
bra @end
|
||||
@bit_4_set:
|
||||
; custom macros can be highlighted
|
||||
Printf STR_FMT,char,var1
|
||||
@end:
|
||||
pla
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.rodata
|
||||
STR_FMT: .asciiz "%c: num=%x"
|
||||
.segment "TEST"
|
||||
.macro MaskedWrite2 addr,value,mask
|
||||
lda #value
|
||||
eor addr
|
||||
and #mask
|
||||
eor addr
|
||||
sta addr
|
||||
.endmacro
|
||||
.import __SPI_SIZE__
|
||||
label:
|
||||
; JsrIndirect $2022
|
||||
; .byte 0,1,2,3,4
|
||||
; JsrIndirect {($2022,x)}, label
|
||||
; .byte 5,6,7,8,9
|
||||
; MaskedWrite2 lcd::LCD_IO+IO::DDRA, (lcd::RS | lcd::RW | lcd::E), lcd::RA_MASK
|
||||
; lda #(lcd::RS | lcd::RW | lcd::E) ; RA 5-7 output
|
||||
; sta lcd::LCD_IO+IO::DDRA
|
||||
.word __SPI_SIZE__
|
||||
.byte >__SPI_SIZE__
|
||||
.byte <__SPI_SIZE__
|
||||
|
@ -79,9 +79,7 @@ INCLUDE_UTILITY = 1
|
||||
;; @TODO optimize when immediate is used
|
||||
;;********************************************************************************
|
||||
.macro MaskedWrite addr,value,mask
|
||||
.if .not .match(value, A)
|
||||
lda value
|
||||
.endif
|
||||
eor addr
|
||||
and mask
|
||||
eor addr
|
||||
|
Loading…
Reference in New Issue
Block a user