2013-12-27 13:57:56 +00:00
|
|
|
.export get_key
|
2013-12-13 21:24:03 +00:00
|
|
|
.export check_for_abort_key
|
|
|
|
.export get_key_if_available
|
2017-05-07 18:53:04 +00:00
|
|
|
.export get_key_ip65
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
.import ip65_process
|
2013-12-27 13:57:56 +00:00
|
|
|
|
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
.code
|
2013-12-27 13:57:56 +00:00
|
|
|
|
|
|
|
; use Apple 2 monitor ROM function to read from keyboard
|
|
|
|
; inputs: none
|
|
|
|
; outputs: A contains ASCII code of key pressed
|
2017-05-07 18:53:04 +00:00
|
|
|
get_key = $fd0c
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; inputs: none
|
|
|
|
; outputs: A contains ASCII value of key just pressed (0 if no key pressed)
|
2013-12-13 21:24:03 +00:00
|
|
|
get_key_if_available:
|
2017-05-03 18:51:06 +00:00
|
|
|
lda $c000 ; current key pressed
|
2017-05-07 18:53:04 +00:00
|
|
|
bmi got_key
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #0
|
|
|
|
rts
|
2017-05-07 18:53:04 +00:00
|
|
|
|
|
|
|
; process inbound ip packets while waiting for a keypress
|
|
|
|
get_key_ip65:
|
|
|
|
jsr ip65_process
|
|
|
|
lda $c000 ; key down?
|
|
|
|
bpl get_key_ip65
|
|
|
|
got_key:
|
|
|
|
bit $c010 ; clear the keyboard strobe
|
2017-05-03 18:51:06 +00:00
|
|
|
and #$7f
|
|
|
|
rts
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; check whether the escape key is being pressed
|
|
|
|
; inputs: none
|
|
|
|
; outputs: sec if escape pressed, clear otherwise
|
2013-12-13 21:24:03 +00:00
|
|
|
check_for_abort_key:
|
2013-12-27 13:57:56 +00:00
|
|
|
lda $c000 ; current key pressed
|
2015-02-16 21:29:22 +00:00
|
|
|
cmp #$9b
|
2013-12-27 13:57:56 +00:00
|
|
|
bne :+
|
|
|
|
bit $c010 ; clear the keyboard strobe
|
|
|
|
sec
|
|
|
|
rts
|
|
|
|
: clc
|
|
|
|
rts
|
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; -- LICENSE FOR a2input.s --
|
2013-12-13 21:24:03 +00:00
|
|
|
; The contents of this file are subject to the Mozilla Public License
|
|
|
|
; Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
; compliance with the License. You may obtain a copy of the License at
|
|
|
|
; http://www.mozilla.org/MPL/
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; Software distributed under the License is distributed on an "AS IS"
|
|
|
|
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
; License for the specific language governing rights and limitations
|
|
|
|
; under the License.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Original Code is ip65.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Initial Developer of the Original Code is Jonno Downes,
|
|
|
|
; jonno@jamtronix.com.
|
|
|
|
; Portions created by the Initial Developer are Copyright (C) 2009
|
2013-12-27 13:57:56 +00:00
|
|
|
; Jonno Downes. All Rights Reserved.
|
2013-12-13 21:24:03 +00:00
|
|
|
; -- LICENSE END --
|