NES complete now (tested and conio test updated), replaces what is in #532
This commit is contained in:
@@ -9,11 +9,11 @@
|
||||
|
||||
|
||||
.export _textcolor, _bgcolor, _bordercolor
|
||||
.import return0, ppubuf_put
|
||||
.import return0, return1, ppubuf_put
|
||||
|
||||
.include "nes.inc"
|
||||
|
||||
_textcolor = return0
|
||||
_textcolor = return1
|
||||
_bordercolor = return0
|
||||
|
||||
.proc _bgcolor
|
||||
|
||||
37
libsrc/nes/cpeekc.s
Normal file
37
libsrc/nes/cpeekc.s
Normal 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
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
.export _cpeekc
|
||||
|
||||
.import ppubuf_waitempty
|
||||
|
||||
.include "nes.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekc:
|
||||
|
||||
; 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
|
||||
|
||||
8
libsrc/nes/cpeekcolor.s
Normal file
8
libsrc/nes/cpeekcolor.s
Normal file
@@ -0,0 +1,8 @@
|
||||
;
|
||||
; 2017-06-03, Greg King
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
;
|
||||
|
||||
.import return1
|
||||
.export _cpeekcolor := return1 ; always COLOR_WHITE
|
||||
37
libsrc/nes/cpeekrevers.s
Normal file
37
libsrc/nes/cpeekrevers.s
Normal file
@@ -0,0 +1,37 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-08-17, Greg King
|
||||
;
|
||||
; char cpeekrevers (void);
|
||||
;
|
||||
|
||||
.export _cpeekrevers
|
||||
|
||||
.import ppubuf_waitempty
|
||||
.forceimport initconio
|
||||
|
||||
.include "nes.inc"
|
||||
|
||||
|
||||
_cpeekrevers:
|
||||
; 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 ; get reverse bit
|
||||
rts
|
||||
@@ -59,6 +59,7 @@ void peektest(void)
|
||||
(void)textcolor(j);
|
||||
revers((j >> 1)&1);
|
||||
cputc('a' + j);
|
||||
rbuf[j] = (j >> 1)&1;
|
||||
}
|
||||
for (j = 0; j < NUMCOLS; ++j) {
|
||||
gotoxy(j, LINE_PEEKTEST);
|
||||
|
||||
Reference in New Issue
Block a user