initial commit from old source
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user