1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00
This commit is contained in:
Bob Andrews 2024-05-06 21:01:50 -04:00 committed by GitHub
commit c1521a5323
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 99 additions and 0 deletions

35
libsrc/atari/cpeekchar.s Normal file
View File

@ -0,0 +1,35 @@
.export _cpeekc
.import mul40
.importzp ptr4
.include "atari.inc"
.segment "CODE"
_cpeekc:
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
;; convert to asc
;; FIXME: ugly hack here to make tetris fx work :=P
lda #' '
cpx #0
beq @l
lda #0
@l:
ldx #0
rts

30
libsrc/atmos/cpeekchar.s Normal file
View File

@ -0,0 +1,30 @@
.include "atmos.inc"
.export _cpeekc
_cpeekc:
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
; FIXME: is that table available elsewhere?
.rodata
ScrTabLo:
.repeat 28, Line
.byte <(SCREEN + Line * 40)
.endrep
ScrTabHi:
.repeat 28, Line
.byte >(SCREEN + Line * 40)
.endrep

34
libsrc/nes/cpeekchar.s Normal file
View File

@ -0,0 +1,34 @@
.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