2019-09-27 07:38:51 +00:00
|
|
|
;
|
|
|
|
; 2016-02-28, Groepaz
|
2022-04-02 13:39:35 +00:00
|
|
|
; 2022-03-29, Greg King
|
2019-09-27 07:38:51 +00:00
|
|
|
;
|
|
|
|
; unsigned char cpeekrevers (void);
|
|
|
|
; /* Return the reverse attribute from the current cursor position.
|
|
|
|
; ** If the character is reversed, then return 1; return 0 otherwise.
|
|
|
|
; */
|
|
|
|
;
|
|
|
|
|
|
|
|
.export _cpeekrevers
|
|
|
|
|
|
|
|
.include "cx16.inc"
|
2022-04-02 13:39:35 +00:00
|
|
|
.macpack generic
|
2019-09-27 07:38:51 +00:00
|
|
|
|
|
|
|
|
2022-04-02 13:39:35 +00:00
|
|
|
screen_addr := $1B000 ; VRAM address of text screen
|
|
|
|
|
2019-09-27 07:38:51 +00:00
|
|
|
_cpeekrevers:
|
|
|
|
php
|
2020-05-02 17:46:06 +00:00
|
|
|
lda CURS_FLAG ; is the cursor currently off?
|
|
|
|
bne @L1
|
2019-09-27 07:38:51 +00:00
|
|
|
sei ; don't let cursor blinking interfere
|
2020-05-02 17:46:06 +00:00
|
|
|
ldx CURS_STATE ; is cursor currently displayed?
|
|
|
|
beq @L1 ; jump if not
|
|
|
|
lda CURS_CHAR ; get screen code under cursor
|
|
|
|
bra @L2
|
|
|
|
|
|
|
|
@L1: stz VERA::CTRL ; use port 0
|
2019-09-27 07:38:51 +00:00
|
|
|
lda CURS_Y
|
2022-04-02 13:39:35 +00:00
|
|
|
add #<(>screen_addr)
|
2019-09-27 07:38:51 +00:00
|
|
|
sta VERA::ADDR+1 ; set row number
|
2022-04-02 13:39:35 +00:00
|
|
|
lda #^screen_addr
|
|
|
|
sta VERA::ADDR+2
|
2019-09-27 07:38:51 +00:00
|
|
|
lda CURS_X ; get character column
|
2019-11-16 18:11:40 +00:00
|
|
|
asl a ; each character has two bytes
|
2019-09-27 07:38:51 +00:00
|
|
|
sta VERA::ADDR
|
|
|
|
lda VERA::DATA0 ; get screen code
|
2020-05-02 17:46:06 +00:00
|
|
|
@L2: plp
|
2019-09-27 07:38:51 +00:00
|
|
|
and #%10000000 ; get reverse bit
|
|
|
|
asl a
|
|
|
|
tax ; ldx #>$0000
|
|
|
|
rol a ; return boolean value
|
|
|
|
rts
|