fix cpeekc/cpeekcolor/cpeekrevers/cpeeks for atmos, replaces what is in #532
This commit is contained in:
21
libsrc/atmos/cpeekc.s
Normal file
21
libsrc/atmos/cpeekc.s
Normal file
@@ -0,0 +1,21 @@
|
||||
;
|
||||
; 2016-02-28, Groepaz
|
||||
; 2017-06-19, Greg King
|
||||
;
|
||||
; char cpeekc (void);
|
||||
;
|
||||
; Atmos version
|
||||
;
|
||||
|
||||
.export _cpeekc
|
||||
|
||||
.import setscrptr
|
||||
.importzp ptr2
|
||||
|
||||
|
||||
_cpeekc:
|
||||
jsr setscrptr ; Set ptr2 and .Y to the cursor's address
|
||||
lda (ptr2),y ; Get char
|
||||
and #<~$80 ; Remove revers() bit
|
||||
ldx #>$0000
|
||||
rts
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
.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
|
||||
10
libsrc/atmos/cpeekcolor.s
Normal file
10
libsrc/atmos/cpeekcolor.s
Normal file
@@ -0,0 +1,10 @@
|
||||
;
|
||||
; 2017-06-03, Greg King
|
||||
;
|
||||
; unsigned char cpeekcolor (void);
|
||||
;
|
||||
; Atmos version
|
||||
;
|
||||
|
||||
.import return1
|
||||
.export _cpeekcolor := return1 ; always COLOR_WHITE
|
||||
22
libsrc/atmos/cpeekrevers.s
Normal file
22
libsrc/atmos/cpeekrevers.s
Normal file
@@ -0,0 +1,22 @@
|
||||
;
|
||||
; 2017-06-08, Greg King
|
||||
;
|
||||
; unsigned char cpeekrevers (void);
|
||||
;
|
||||
; Atmos version
|
||||
;
|
||||
|
||||
.export _cpeekrevers
|
||||
|
||||
.import setscrptr
|
||||
.importzp ptr2
|
||||
|
||||
|
||||
_cpeekrevers:
|
||||
jsr setscrptr ; Set ptr2 and .Y to the cursor's address
|
||||
lda (ptr2),y ; Get char
|
||||
and #$80 ; get reverse bit
|
||||
asl a
|
||||
tax ; ldx #>$0000
|
||||
rol a ; return boolean value
|
||||
rts
|
||||
54
libsrc/atmos/cpeeks.s
Normal file
54
libsrc/atmos/cpeeks.s
Normal file
@@ -0,0 +1,54 @@
|
||||
;
|
||||
; 2017-06-20, Greg King
|
||||
;
|
||||
; void cpeeks (char* s, unsigned length);
|
||||
;
|
||||
|
||||
.export _cpeeks
|
||||
|
||||
.import setscrptr, popax
|
||||
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
||||
|
||||
.macpack generic
|
||||
|
||||
|
||||
_cpeeks:
|
||||
eor #<$FFFF ; counting a word upward is faster
|
||||
sta ptr3 ; so, we use -(length + 1)
|
||||
txa
|
||||
eor #>$FFFF
|
||||
sta ptr3+1
|
||||
|
||||
jsr setscrptr ; Set ptr2 and .Y to the cursor's address
|
||||
sty tmp2
|
||||
|
||||
jsr popax
|
||||
sta tmp1 ; (will be a .Y index)
|
||||
stx ptr1+1
|
||||
ldx #<$0000
|
||||
stx ptr1
|
||||
bze L3 ; branch always
|
||||
|
||||
L4: ldy tmp2
|
||||
lda (ptr2),y ; Get char
|
||||
iny
|
||||
bnz L2
|
||||
inc ptr2+1
|
||||
L2: sty tmp2
|
||||
and #<~$80 ; Remove reverse bit
|
||||
ldy tmp1
|
||||
sta (ptr1),y
|
||||
iny
|
||||
bnz L1
|
||||
inc ptr1+1
|
||||
L1: sty tmp1
|
||||
|
||||
L3: inc ptr3 ; count length
|
||||
bnz L4
|
||||
inc ptr3+1
|
||||
bnz L4
|
||||
|
||||
txa ; terminate the string
|
||||
ldy tmp1
|
||||
sta (ptr1),y
|
||||
rts
|
||||
Reference in New Issue
Block a user