2000-05-28 13:40:48 +00:00
|
|
|
;
|
2002-11-03 22:10:55 +00:00
|
|
|
; Christian Groessler, November-2002
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
2002-11-03 22:10:55 +00:00
|
|
|
; get a char from the keyboard
|
2000-05-28 13:40:48 +00:00
|
|
|
; char cgetc(void)
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atari.inc"
|
|
|
|
.export _cgetc,setcursor
|
2013-08-27 08:21:42 +00:00
|
|
|
.import KEYBDV_handler
|
2013-05-09 11:56:54 +00:00
|
|
|
.import cursor,mul40
|
2002-11-26 21:31:01 +00:00
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
_cgetc:
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr setcursor
|
2013-05-30 23:38:16 +00:00
|
|
|
lda #12
|
|
|
|
sta ICAX1Z ; fix problems with direct call to KEYBDV
|
2013-09-19 20:36:22 +00:00
|
|
|
.ifndef __ATARIXL__
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr @1
|
2013-05-30 23:38:16 +00:00
|
|
|
.else
|
2013-08-27 08:21:42 +00:00
|
|
|
jsr KEYBDV_handler
|
2013-05-30 23:38:16 +00:00
|
|
|
.endif
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #0
|
|
|
|
rts
|
2001-12-04 01:04:20 +00:00
|
|
|
|
2013-09-19 20:36:22 +00:00
|
|
|
.ifndef __ATARIXL__
|
2013-08-27 08:21:42 +00:00
|
|
|
@1: lda KEYBDV+5
|
2013-05-09 11:56:54 +00:00
|
|
|
pha
|
|
|
|
lda KEYBDV+4
|
|
|
|
pha
|
2013-08-27 08:21:42 +00:00
|
|
|
rts
|
2013-05-30 23:38:16 +00:00
|
|
|
.endif
|
2002-11-03 22:10:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc setcursor
|
2002-11-03 22:10:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #0
|
|
|
|
lda OLDCHR
|
|
|
|
sta (OLDADR),y
|
2002-11-26 21:31:01 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda ROWCRS
|
|
|
|
jsr mul40
|
|
|
|
clc
|
|
|
|
adc SAVMSC ; add start of screen memory
|
|
|
|
sta OLDADR
|
|
|
|
txa
|
|
|
|
adc SAVMSC+1
|
|
|
|
sta OLDADR+1
|
|
|
|
lda COLCRS
|
|
|
|
adc OLDADR
|
|
|
|
sta OLDADR
|
|
|
|
bcc nc
|
|
|
|
inc OLDADR+1
|
|
|
|
nc: lda (OLDADR),y
|
|
|
|
sta OLDCHR
|
2002-11-03 22:10:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx cursor ; current cursor setting as requested by the user
|
|
|
|
beq off
|
|
|
|
ldx #0
|
|
|
|
beq cont
|
2002-11-03 22:10:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
off: inx
|
|
|
|
cont: stx CRSINH ; update system variable
|
2002-11-03 22:10:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
beq turnon
|
|
|
|
and #$7f ; clear high bit / inverse flag
|
|
|
|
finish: sta (OLDADR),y ; update on-screen display
|
|
|
|
rts
|
2002-11-03 22:10:55 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
turnon: ora #$80 ; set high bit / inverse flag
|
|
|
|
bne finish
|
2002-11-03 22:10:55 +00:00
|
|
|
|
|
|
|
.endproc
|