mirror of
https://github.com/cc65/cc65.git
synced 2025-01-08 04:30:15 +00:00
ae7a38f3de
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.
38 lines
789 B
ArmAsm
38 lines
789 B
ArmAsm
;
|
|
; 2016-02-28, Groepaz
|
|
; 2017-08-17, Greg King
|
|
;
|
|
; char cpeekc (void);
|
|
;
|
|
|
|
.export _cpeekc
|
|
|
|
.import ppubuf_waitempty
|
|
.forceimport initconio
|
|
|
|
.include "nes.inc"
|
|
|
|
|
|
_cpeekc:
|
|
; wait until all console data has been written
|
|
jsr ppubuf_waitempty
|
|
|
|
ldy SCREEN_PTR+1
|
|
lda SCREEN_PTR
|
|
|
|
; waiting for vblank is incredibly slow ://
|
|
vwait:
|
|
; ldx PPU_STATUS
|
|
; bpl vwait
|
|
|
|
ldx #>$0000
|
|
sty PPU_VRAM_ADDR2
|
|
sta PPU_VRAM_ADDR2
|
|
lda PPU_VRAM_IO ; first read is invalid
|
|
lda PPU_VRAM_IO ; get data
|
|
stx PPU_VRAM_ADDR2
|
|
stx PPU_VRAM_ADDR2
|
|
|
|
and #<~$80 ; remove reverse bit
|
|
rts
|