NES complete now (tested and conio test updated), replaces what is in #532

This commit is contained in:
mrdudz
2025-05-24 19:19:49 +02:00
parent 6628c4ff43
commit 228316ff58
6 changed files with 85 additions and 36 deletions

37
libsrc/nes/cpeekc.s Normal file
View File

@@ -0,0 +1,37 @@
;
; 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