1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-02 19:42:23 +00:00
cc65/libsrc/atari/cpeekc.s
Greg King ae7a38f3de Added peek functions to the conio library.
The functions return the character, or its attributes, that is at the current screen location of conio's cursor.  The values can be used directly by the output functions to reproduce that screen character.
2021-12-11 18:47:33 -05:00

36 lines
717 B
ArmAsm

;
; 2016-02-28, Groepaz
; 2017-06-21, Greg King
;
; char cpeekc (void);
;
.export _cpeekc
.include "atari.inc"
_cpeekc:
lda OLDCHR ; get char under cursor
and #<~$80 ; remove reverse bit
;; convert internal screen code to AtSCII
tay
and #%01100000
asl a
asl a
rol a
rol a
tax
tya
eor intats,x
ldx #>$0000
rts
.rodata
intats: .byte %00100000 ; -> %001xxxxx
.byte %01100000 ; -> %010xxxxx
.byte %01000000 ; -> %000xxxxx
.byte %00000000 ; -> %011xxxxx