dos33fsprogs/pt3_player/keypress_minimal.s

48 lines
995 B
ArmAsm
Raw Normal View History

2019-05-16 15:38:57 +00:00
;==========================================================
; Get Key
;==========================================================
;
get_key:
lda KEYPRESS ; 3
bpl no_key ; 2nt/3
2019-06-01 04:04:55 +00:00
bit KEYRESET ; clear the keyboard buffer ; 4
2019-05-16 15:38:57 +00:00
figure_out_key:
cmp #' '+128 ; the mask destroys space ; 2
2019-06-03 18:58:29 +00:00
beq return_key ; so handle it specially ; 2nt/3
2019-05-16 15:38:57 +00:00
check_right_arrow:
2019-06-01 04:04:55 +00:00
cmp #$95 ; 2
2019-05-16 15:38:57 +00:00
bne check_left_arrow ; 2nt/3
lda #'D' ; 2
check_left_arrow:
2019-06-01 04:04:55 +00:00
cmp #$88 ; 2
2019-05-16 15:38:57 +00:00
bne check_up_arrow ; 2nt/3
lda #'A' ; 2
check_up_arrow:
2019-06-01 04:04:55 +00:00
cmp #$8B ; 2
2019-05-16 15:38:57 +00:00
bne check_down_arrow ; 2nt/3
lda #'W' ; 2
check_down_arrow:
2019-06-01 04:04:55 +00:00
cmp #$8A ; 2
2019-05-16 15:38:57 +00:00
bne check_escape ; 2nt/3
lda #'S' ; 2
check_escape:
2019-06-01 04:04:55 +00:00
and #$5f ; mask, to make upper-case ; 2
2019-05-16 15:38:57 +00:00
cmp #$1B ; 2
2019-06-03 18:58:29 +00:00
bne return_key ; 2nt/3
2019-05-16 15:38:57 +00:00
lda #'Q' ; 2
2019-06-03 18:58:29 +00:00
bne return_key ; branch always ; 3
2019-05-16 15:38:57 +00:00
no_key:
2019-06-03 18:58:29 +00:00
lda #0 ; no key, so return a zero ; 2
2019-05-16 15:38:57 +00:00
2019-06-03 18:58:29 +00:00
return_key:
2019-05-16 15:38:57 +00:00
rts ; 6
;============