Allow to influence the user abort check.

It's imho in general a pretty unfortunate design to have IP65 check the keyboard during blocking operations. Rather it should call back into the application and have that decide what type of user abort it wants to offer.

Anyhow I don't want to change all that - at least not now. Therefore I just added the option to influence which key is considered the abort key - and provide a key value that isn't actually used and as such disables the abort check.
This commit is contained in:
Oliver Schmidt 2017-06-05 17:20:27 +02:00
parent af4fb5a90b
commit a987c40490
4 changed files with 47 additions and 17 deletions

View File

@ -2,10 +2,18 @@
.export check_for_abort_key
.export get_key_if_available
.export get_key_ip65
.export abort_key
.exportzp abort_key_default = $9b
.exportzp abort_key_disable = $80
.import ip65_process
.data
abort_key: .byte $9b ; ESC
.code
; use Apple 2 monitor ROM function to read from keyboard
@ -31,12 +39,12 @@ got_key:
and #$7f
rts
; check whether the escape key is being pressed
; check whether the abort key is being pressed
; inputs: none
; outputs: sec if escape pressed, clear otherwise
; outputs: sec if abort key pressed, clear otherwise
check_for_abort_key:
lda $c000 ; current key pressed
cmp #$9b
cmp abort_key
bne :+
bit $c010 ; clear the keyboard strobe
sec

View File

@ -4,14 +4,18 @@
.export check_for_abort_key
.export get_key_if_available
.export get_key_ip65
.export abort_key
.exportzp abort_key_default = 0
.exportzp abort_key_disable = 0
.import ip65_process
.data
iocb: .byte 0
kname: .byte "K:",155
abort_key: .byte 0 ; ???
iocb: .byte 0
kname: .byte "K:",155
.code
@ -63,9 +67,9 @@ get_key_ip65:
beq get_key_ip65
rts
;check whether the ??? key is being pressed
;check whether the abort key is being pressed
;inputs: none
;outputs: sec if ??? pressed, clear otherwise
;outputs: sec if abort key pressed, clear otherwise
check_for_abort_key:
; TODO: implement actual check
clc

View File

@ -2,10 +2,18 @@
.export check_for_abort_key
.export get_key_if_available
.export get_key_ip65
.export abort_key
.exportzp abort_key_default = $3f
.exportzp abort_key_disable = $ff
.import ip65_process
.data
abort_key: .byte $3f ; RUN/STOP
.code
; use C64 Kernel ROM function to read a key
@ -14,8 +22,9 @@
get_key:
ldy #0
sty $cc ; cursor on
@loop:
jsr get_key_if_available
beq get_key
beq @loop
ldy #1
sty $cc ; cursor off
rts
@ -32,18 +41,18 @@ get_key_ip65:
beq get_key_ip65
rts
; check whether the RUN/STOP key is being pressed
; check whether the abort key is being pressed
; inputs: none
; outputs: sec if RUN/STOP pressed, clear otherwise
; outputs: sec if abort key pressed, clear otherwise
check_for_abort_key:
lda $cb ; current key pressed
cmp #$3F
cmp abort_key
bne @not_abort
@flush_loop:
jsr get_key_if_available
bne @flush_loop
lda $cb ; current key pressed
cmp #$3F
cmp abort_key
beq @flush_loop
sec
rts

View File

@ -2,10 +2,18 @@
.export check_for_abort_key
.export get_key_if_available
.export get_key_ip65
.export abort_key
.exportzp abort_key_default = $18
.exportzp abort_key_disable = $ff
.import ip65_process
.data
abort_key: .byte $18 ; RUN/STOP
.code
; use Vic 20 Kernel ROM function to read a key
@ -14,8 +22,9 @@
get_key:
ldy #0
sty $cc ; cursor on
@loop:
jsr get_key_if_available
beq get_key
beq @loop
ldy #1
sty $cc ; cursor off
rts
@ -32,18 +41,18 @@ get_key_ip65:
beq get_key_ip65
rts
; check whether the RUN/STOP key is being pressed
; check whether the abort key is being pressed
; inputs: none
; outputs: sec if RUN/STOP pressed, clear otherwise
; outputs: sec if abort key pressed, clear otherwise
check_for_abort_key:
lda $cb ; current key pressed
cmp #$18
cmp abort_key
bne @not_abort
@flush_loop:
jsr get_key_if_available
bne @flush_loop
lda $cb ; current key pressed
cmp #$18
cmp abort_key
beq @flush_loop
sec
rts