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

View File

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

View File

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