2005-03-26 17:03:30 +00:00
|
|
|
;
|
|
|
|
; Kevin Ruland
|
|
|
|
;
|
|
|
|
; char cgetc (void);
|
|
|
|
;
|
|
|
|
; If open_apple key is pressed then the high-bit of the key is set.
|
|
|
|
;
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2005-03-26 17:03:30 +00:00
|
|
|
.export _cgetc
|
|
|
|
|
|
|
|
.include "apple2.inc"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
_cgetc:
|
2005-04-08 19:27:07 +00:00
|
|
|
lda KBD
|
2013-05-09 11:56:54 +00:00
|
|
|
bpl _cgetc ; If < 128, no key pressed
|
2005-03-26 17:03:30 +00:00
|
|
|
|
|
|
|
; At this time, the high bit of the key pressed is set
|
2013-05-09 11:56:54 +00:00
|
|
|
bit KBDSTRB ; Clear keyboard strobe
|
2005-04-08 19:27:07 +00:00
|
|
|
.ifdef __APPLE2ENH__
|
2013-05-09 11:56:54 +00:00
|
|
|
bit BUTN0 ; Check if OpenApple is down
|
2005-04-08 19:27:07 +00:00
|
|
|
bmi done
|
|
|
|
.endif
|
2013-05-09 11:56:54 +00:00
|
|
|
and #$7F ; If not down, then clear high bit
|
|
|
|
done: ldx #$00
|
2005-03-26 17:03:30 +00:00
|
|
|
rts
|