2015-09-09 12:04:07 +00:00
|
|
|
.include "atari.inc"
|
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
.export get_key
|
|
|
|
.export check_for_abort_key
|
|
|
|
.export get_key_if_available
|
|
|
|
.export get_key_ip65
|
2017-06-05 15:20:27 +00:00
|
|
|
.export abort_key
|
|
|
|
.exportzp abort_key_default = 0
|
|
|
|
.exportzp abort_key_disable = 0
|
2015-08-28 13:19:52 +00:00
|
|
|
|
|
|
|
.import ip65_process
|
|
|
|
|
|
|
|
|
|
|
|
.data
|
|
|
|
|
2017-06-05 15:20:27 +00:00
|
|
|
abort_key: .byte 0 ; ???
|
|
|
|
iocb: .byte 0
|
|
|
|
kname: .byte "K:",155
|
2015-08-28 13:19:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
.code
|
|
|
|
|
|
|
|
; inputs: none
|
|
|
|
; outputs: A contains ASCII value of key just pressed
|
|
|
|
get_key:
|
|
|
|
jsr get_key_if_available
|
2017-08-09 19:27:21 +00:00
|
|
|
bcc get_key
|
2015-08-28 13:19:52 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
; inputs: none
|
2017-08-09 19:27:21 +00:00
|
|
|
; outputs: sec if key pressed, clear otherwise
|
|
|
|
; A contains ASCII value of key just pressed
|
2015-08-28 13:19:52 +00:00
|
|
|
get_key_if_available:
|
2015-09-09 12:04:07 +00:00
|
|
|
lda CH ; GLOBAL VARIABLE FOR KEYBOARD
|
2015-08-28 13:19:52 +00:00
|
|
|
cmp #255
|
2017-08-09 19:27:21 +00:00
|
|
|
beq no_key
|
2015-08-28 13:19:52 +00:00
|
|
|
ldx iocb ; K: already open?
|
|
|
|
bne @read
|
|
|
|
ldx #$40 ; IOCB to use for keyboard input
|
|
|
|
stx iocb ; mark K: as open
|
|
|
|
lda #<kname
|
2015-09-09 12:04:07 +00:00
|
|
|
sta ICBAL,x ; 1-byte low buffer address
|
2015-08-28 13:19:52 +00:00
|
|
|
lda #>kname
|
2015-09-09 12:04:07 +00:00
|
|
|
sta ICBAH,x ; 1-byte high buffer address
|
|
|
|
lda #OPEN ; open
|
|
|
|
sta ICCOM,x ; COMMAND CODE
|
|
|
|
lda #OPNIN ; open for input (all devices)
|
|
|
|
sta ICAX1,x ; 1-byte first auxiliary information
|
|
|
|
jsr CIOV ; vector to CIO
|
2015-08-28 13:19:52 +00:00
|
|
|
@read:
|
|
|
|
lda #0
|
2015-09-09 12:04:07 +00:00
|
|
|
sta ICBLL,x ; 1-byte low buffer length
|
|
|
|
sta ICBLH,x ; 1-byte high buffer length
|
|
|
|
lda #GETCHR ; get character(s)
|
|
|
|
sta ICCOM,x ; COMMAND CODE
|
|
|
|
jsr CIOV ; vector to CIO
|
2015-08-28 13:19:52 +00:00
|
|
|
ldx #255
|
2015-09-09 12:04:07 +00:00
|
|
|
stx CH ; GLOBAL VARIABLE FOR KEYBOARD
|
2017-08-09 19:27:21 +00:00
|
|
|
sec
|
2015-08-28 13:19:52 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
; process inbound ip packets while waiting for a keypress
|
|
|
|
get_key_ip65:
|
|
|
|
jsr ip65_process
|
|
|
|
jsr get_key_if_available
|
2017-08-09 19:27:21 +00:00
|
|
|
bcc get_key_ip65
|
2015-08-28 13:19:52 +00:00
|
|
|
rts
|
|
|
|
|
2017-06-05 15:20:27 +00:00
|
|
|
;check whether the abort key is being pressed
|
2015-08-28 13:19:52 +00:00
|
|
|
;inputs: none
|
2017-06-05 15:20:27 +00:00
|
|
|
;outputs: sec if abort key pressed, clear otherwise
|
2015-08-28 13:19:52 +00:00
|
|
|
check_for_abort_key:
|
|
|
|
; TODO: implement actual check
|
2017-08-09 19:27:21 +00:00
|
|
|
no_key:
|
2015-08-28 13:19:52 +00:00
|
|
|
clc
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;-- LICENSE FOR atrinputs.s --
|
|
|
|
; 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/
|
2017-08-09 19:27:21 +00:00
|
|
|
;
|
2015-08-28 13:19:52 +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.
|
2017-08-09 19:27:21 +00:00
|
|
|
;
|
2015-08-28 13:19:52 +00:00
|
|
|
; The Original Code is ip65.
|
2017-08-09 19:27:21 +00:00
|
|
|
;
|
2015-08-28 13:19:52 +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
|
2017-08-09 19:27:21 +00:00
|
|
|
; Jonno Downes. All Rights Reserved.
|
2015-08-28 13:19:52 +00:00
|
|
|
; -- LICENSE END --
|