This commit is contained in:
mrdudz
2022-07-24 04:59:45 +02:00
parent 193b7b9ee7
commit 10c2ce205b
3 changed files with 58 additions and 75 deletions

View File

@@ -1,41 +1,35 @@
.export _cpeekchar .export _cpeekchar
.export _cpeekcharxy
.import _gotoxy .import mul40
.import mul40 .importzp ptr4
.importzp ptr4
.include "atari.inc" .include "atari.inc"
.segment "CODE" .segment "CODE"
_cpeekcharxy:
jsr _gotoxy ; Set cursor
_cpeekchar: _cpeekchar:
lda ROWCRS lda ROWCRS
jsr mul40 ; destroys tmp4 jsr mul40 ; destroys tmp4
clc clc
adc SAVMSC ; add start of screen memory adc SAVMSC ; add start of screen memory
sta ptr4 sta ptr4
txa txa
adc SAVMSC+1 adc SAVMSC+1
sta ptr4+1 sta ptr4+1
ldy COLCRS ldy COLCRS
lda (ptr4),y ; get char lda (ptr4),y ; get char
tax tax
;; convert to asc ;; convert to asc
;; ugly hack here to make tetris fx work :=P ;; FIXME: ugly hack here to make tetris fx work :=P
lda #' ' lda #' '
cpx #0 cpx #0
beq @l beq @l
lda #0 lda #0
@l: @l:
ldx #0 ldx #0
rts rts

View File

@@ -1,36 +1,31 @@
.include "atmos.inc" .include "atmos.inc"
.import _gotoxy .export _cpeekchar
.export _cpeekchar,_cpeekcharxy
_cpeekcharxy:
jsr _gotoxy ; Will pop x parameter
_cpeekchar: _cpeekchar:
ldy CURS_Y ldy CURS_Y
ldx ScrTabLo,y ldx ScrTabLo,y
stx @l+1 stx @l+1
ldx ScrTabHi,y ldx ScrTabHi,y
stx @l+2 stx @l+2
ldx CURS_X ldx CURS_X
@l: @l:
lda $bb80,x lda $bb80,x
;; inc COORDX_TEXT ;; inc COORDX_TEXT
ldx #0 ldx #0
rts rts
; FIXME: is that table available elsewhere? ; FIXME: is that table available elsewhere?
.rodata .rodata
ScrTabLo: ScrTabLo:
.repeat 28, Line .repeat 28, Line
.byte <(SCREEN + Line * 40) .byte <(SCREEN + Line * 40)
.endrep .endrep
ScrTabHi: ScrTabHi:
.repeat 28, Line .repeat 28, Line
.byte >(SCREEN + Line * 40) .byte >(SCREEN + Line * 40)
.endrep .endrep

View File

@@ -1,40 +1,34 @@
.export _cpeekchar .export _cpeekchar
.export _cpeekcharxy
.import _gotoxy .import ppubuf_waitempty
.import ppubuf_waitempty
.include "nes.inc" .include "nes.inc"
.segment "CODE" .segment "CODE"
_cpeekcharxy:
jsr _gotoxy ; Set cursor
_cpeekchar: _cpeekchar:
; wait until all console data has been written ; wait until all console data has been written
jsr ppubuf_waitempty jsr ppubuf_waitempty
ldy SCREEN_PTR+1
ldx SCREEN_PTR
ldy SCREEN_PTR+1
ldx SCREEN_PTR
; waiting for vblank is incredibly slow :// ; waiting for vblank is incredibly slow ://
vwait: vwait:
; lda $2002 ;wait ; lda $2002 ;wait
; bpl vwait ; bpl vwait
lda #0 lda #0
sty $2006 sty $2006
stx $2006 stx $2006
ldy $2007 ; first read is invalid ldy $2007 ; first read is invalid
ldy $2007 ; get data ldy $2007 ; get data
sta $2006 sta $2006
sta $2006 sta $2006
tya tya
and #$7f ; ?!?! and #$7f ; ?!?!
rts rts