initial commit from old source
This commit is contained in:
41
libsrc/atari/cpeekchar.s
Normal file
41
libsrc/atari/cpeekchar.s
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
.export _cpeekchar
|
||||
.export _cpeekcharxy
|
||||
|
||||
.import _gotoxy
|
||||
.import mul40
|
||||
.importzp ptr4
|
||||
|
||||
.include "atari/atari.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcharxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekchar:
|
||||
|
||||
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
|
||||
|
||||
;; ugly hack here to make tetris fx work :=P
|
||||
lda #' '
|
||||
cpx #0
|
||||
beq @l
|
||||
lda #0
|
||||
@l:
|
||||
ldx #0
|
||||
rts
|
||||
36
libsrc/atmos/cpeekchar.s
Normal file
36
libsrc/atmos/cpeekchar.s
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
.include "atmos.inc"
|
||||
|
||||
.import _gotoxy
|
||||
.export _cpeekchar,_cpeekcharxy
|
||||
|
||||
_cpeekcharxy:
|
||||
|
||||
jsr _gotoxy ; Will pop x parameter
|
||||
|
||||
_cpeekchar:
|
||||
|
||||
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
|
||||
|
||||
74
libsrc/c128/cpeekchar.s
Normal file
74
libsrc/c128/cpeekchar.s
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
.export _cpeekchar
|
||||
.export _cpeekcharxy
|
||||
|
||||
.import _gotoxy
|
||||
|
||||
.import plot,popa
|
||||
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "c128/c128.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcharxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekchar:
|
||||
|
||||
lda MODE
|
||||
bmi @c80
|
||||
|
||||
ldy CURS_X
|
||||
lda (SCREEN_PTR),y ; get char
|
||||
|
||||
@return:
|
||||
; convert to asc
|
||||
and #$7f
|
||||
|
||||
; 0 - $1f +$40
|
||||
; $20 - $3f
|
||||
; $40 - $7e +$80
|
||||
|
||||
cmp #$1f
|
||||
bcs @sk1
|
||||
;; clc
|
||||
adc #$40
|
||||
rts
|
||||
|
||||
@sk1:
|
||||
cmp #$40
|
||||
bcc @end
|
||||
clc
|
||||
adc #$80
|
||||
@end:
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
@c80:
|
||||
lda SCREEN_PTR
|
||||
ldy SCREEN_PTR+1
|
||||
clc
|
||||
adc CURS_X
|
||||
bcc @s
|
||||
iny
|
||||
@s:
|
||||
; get byte from vdc mem
|
||||
ldx #VDC_DATA_LO
|
||||
stx VDC_ADDR_REG
|
||||
@L0: bit VDC_ADDR_REG
|
||||
bpl @L0
|
||||
sta VDC_DATA_REG
|
||||
dex
|
||||
tya
|
||||
stx VDC_ADDR_REG
|
||||
sta VDC_DATA_REG
|
||||
|
||||
ldx #VDC_DATA_RW
|
||||
stx VDC_ADDR_REG
|
||||
@L1: bit VDC_ADDR_REG
|
||||
bpl @L1
|
||||
lda VDC_DATA_REG
|
||||
jmp @return
|
||||
67
libsrc/c128/cpeekcol.s
Normal file
67
libsrc/c128/cpeekcol.s
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
.export _cpeekcol
|
||||
.export _cpeekcolxy
|
||||
|
||||
.import _gotoxy
|
||||
|
||||
.include "c128/c128.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcolxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekcol:
|
||||
|
||||
bit MODE
|
||||
bmi @c80
|
||||
|
||||
ldy CURS_X
|
||||
lda (CRAM_PTR),y ; get col
|
||||
and #$0f
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
@c80:
|
||||
lda CRAM_PTR
|
||||
ldy CRAM_PTR+1
|
||||
clc
|
||||
adc CURS_X
|
||||
bcc @s
|
||||
iny
|
||||
@s:
|
||||
; get byte from vdc mem
|
||||
ldx #VDC_DATA_LO
|
||||
stx VDC_ADDR_REG
|
||||
@L0: bit VDC_ADDR_REG
|
||||
bpl @L0
|
||||
sta VDC_DATA_REG
|
||||
dex
|
||||
;;tya
|
||||
stx VDC_ADDR_REG
|
||||
sty VDC_DATA_REG
|
||||
|
||||
ldx #VDC_DATA_RW
|
||||
stx VDC_ADDR_REG
|
||||
@L1: bit VDC_ADDR_REG
|
||||
bpl @L1
|
||||
lda VDC_DATA_REG
|
||||
|
||||
|
||||
and #$0f
|
||||
|
||||
; translate vdc->vic colour
|
||||
|
||||
vdctovic:
|
||||
ldy #16
|
||||
@L2: cmp $CE5C-1,y
|
||||
beq @L3
|
||||
dey
|
||||
bne @L2
|
||||
@L3:
|
||||
dey
|
||||
tya
|
||||
|
||||
ldx #0
|
||||
rts
|
||||
39
libsrc/cbm/cpeekchar.s
Normal file
39
libsrc/cbm/cpeekchar.s
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
.export _cpeekchar
|
||||
.export _cpeekcharxy
|
||||
|
||||
.import _gotoxy
|
||||
|
||||
.include "cbm/cbm.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcharxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekchar:
|
||||
|
||||
ldy CURS_X
|
||||
lda (SCREEN_PTR),y ; get char
|
||||
ldx #0
|
||||
|
||||
and #$7f
|
||||
|
||||
; 0 - $1f +$40
|
||||
; $20 - $3f
|
||||
; $40 - $7e +$80
|
||||
|
||||
cmp #$1f
|
||||
bcs @sk1
|
||||
;; clc
|
||||
adc #$40
|
||||
rts
|
||||
|
||||
@sk1:
|
||||
cmp #$40
|
||||
bcc @end
|
||||
clc
|
||||
adc #$80
|
||||
@end:
|
||||
rts
|
||||
21
libsrc/cbm/cpeekcol.s
Normal file
21
libsrc/cbm/cpeekcol.s
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
.export _cpeekcol
|
||||
.export _cpeekcolxy
|
||||
|
||||
.import _gotoxy
|
||||
|
||||
.include "cc65/conio.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcolxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekcol:
|
||||
|
||||
ldy CURS_X
|
||||
lda (CRAM_PTR),y ; get color
|
||||
and #$0f
|
||||
ldx #0
|
||||
rts
|
||||
32
libsrc/cbm510/cpeekchar.s
Normal file
32
libsrc/cbm510/cpeekchar.s
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
.export _cpeekchar
|
||||
.export _cpeekcharxy
|
||||
|
||||
.import _gotoxy
|
||||
|
||||
.include "cbm510/cbm510.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcharxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekchar:
|
||||
lda #0
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
;; ?!?!
|
||||
|
||||
ldx IndReg
|
||||
ldy #$0F
|
||||
sty IndReg
|
||||
|
||||
ldy CURS_X
|
||||
lda (SCREEN_PTR),y ; get char
|
||||
|
||||
stx IndReg
|
||||
|
||||
ldx #0
|
||||
rts
|
||||
31
libsrc/cbm510/cpeekcol.s
Normal file
31
libsrc/cbm510/cpeekcol.s
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
.export _cpeekcol
|
||||
.export _cpeekcolxy
|
||||
|
||||
.import _gotoxy
|
||||
|
||||
.include "cbm510/cbm510.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcolxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekcol:
|
||||
|
||||
lda #0
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
;; why the HELL doesnt this work ?!?
|
||||
lda #$0F
|
||||
ldy CURS_X
|
||||
sei
|
||||
ldx IndReg
|
||||
sta IndReg
|
||||
lda (CRAM_PTR),y ; get color
|
||||
stx IndReg
|
||||
cli
|
||||
ldx #0
|
||||
rts
|
||||
45
libsrc/cbm610/cpeekchar.s
Normal file
45
libsrc/cbm610/cpeekchar.s
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
.export _cpeekchar
|
||||
.export _cpeekcharxy
|
||||
|
||||
.import _gotoxy
|
||||
|
||||
.include "cbm610/cbm610.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcharxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekchar:
|
||||
|
||||
ldx IndReg
|
||||
ldy #$0F
|
||||
sty IndReg
|
||||
|
||||
ldy CURS_X
|
||||
lda (CharPtr),y ; get char
|
||||
; convert to asc
|
||||
and #$7f
|
||||
|
||||
; 0 - $1f +$40
|
||||
; $20 - $3f
|
||||
; $40 - $7e +$80
|
||||
|
||||
cmp #$1f
|
||||
bcs @sk1
|
||||
;; clc
|
||||
adc #$40
|
||||
jmp @end
|
||||
|
||||
@sk1:
|
||||
cmp #$40
|
||||
bcc @end
|
||||
clc
|
||||
adc #$80
|
||||
|
||||
@end:
|
||||
stx IndReg
|
||||
ldx #0
|
||||
rts
|
||||
40
libsrc/nes/cpeekchar.s
Normal file
40
libsrc/nes/cpeekchar.s
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
.export _cpeekchar
|
||||
.export _cpeekcharxy
|
||||
|
||||
.import _gotoxy
|
||||
.import ppubuf_waitempty
|
||||
|
||||
.include "nes.inc"
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
_cpeekcharxy:
|
||||
|
||||
jsr _gotoxy ; Set cursor
|
||||
|
||||
_cpeekchar:
|
||||
|
||||
; 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
|
||||
|
||||
Reference in New Issue
Block a user