initial commit from old source
This commit is contained in:
40
libsrc/nes/cpeekchar.s
Normal file
40
libsrc/nes/cpeekchar.s
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
.export _cpeekchar
|
||||
.export _cpeekcharxy
|
||||
|
||||
.import _gotoxy
|
||||
.import ppubuf_waitempty
|
||||
|
||||
.include "nes.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcharxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekchar:
|
||||
|
||||
; wait until all console data has been written
|
||||
jsr ppubuf_waitempty
|
||||
|
||||
ldy SCREEN_PTR+1
|
||||
ldx SCREEN_PTR
|
||||
|
||||
; waiting for vblank is incredibly slow ://
|
||||
vwait:
|
||||
; lda $2002 ;wait
|
||||
; bpl vwait
|
||||
|
||||
lda #0
|
||||
sty $2006
|
||||
stx $2006
|
||||
ldy $2007 ; first read is invalid
|
||||
ldy $2007 ; get data
|
||||
sta $2006
|
||||
sta $2006
|
||||
|
||||
tya
|
||||
and #$7f ; ?!?!
|
||||
rts
|
||||
|
||||
Reference in New Issue
Block a user