2 ; 2017-07-05, Greg King
5 ; void cpeeks (char* s, unsigned length);
11 .importzp ptr1, ptr2, ptr3, tmp1, tmp2
15 ; FIXME c128 needs special version that handles the 80-column VDC.
20 eor #<$FFFF ; counting a word upward is faster
21 sta ptr3 ; so, we use -(length + 1)
37 sta tmp1 ; (will be a .Y index)
41 bze L3 ; branch always
44 lda (ptr2),y ; get char
49 and #<~$80 ; remove reverse bit
51 ; Convert the screen code into a PetSCII code.
65 @sk2: ;clc ; both above cmp and adc clear carry flag
75 L3: inc ptr3 ; count length
80 txa ; terminate the string
85 ;-----------------------------------------------------------
96 sta tmp1 ; (will be a .Y index)
100 bze L3a ; branch always
109 ; get byte from VDC mem
122 bpl @L1 ; wait for blanking
125 and #<~$80 ; remove reverse bit
127 ; Convert the screen code into a PetSCII code.
141 @sk2: ;clc ; both above cmp and adc clear carry flag
151 L3a: inc ptr3 ; count length
156 lda #0 ; terminate the string