Schneider / Amstrad CPC Forum

Amstrad / Schneider CPC => Programmierung => Topic started by: BadCPC on 22. May 2025, 18:15:14

Title: textdaten durchlaufen mit pointer
Post by: BadCPC on 22. May 2025, 18:15:14
Hallo meine Spezialisten, hab da wohl wieder einen denkfehler.
Schreibe gerade eine Routine die eine Zeichenkette hl auf zeichen >=&80 durchlaufen soll, und den text ab a=x als pointer. irgendwo hackt es; mit ld b,a und djnz hab ich schon probiert grübel
bei a=0 kommt ja "hallo" raus, bei a=1 soll "ich" rauskommen usw.

währe für hilfe dankbar.


org &A000
ld a,2
call &BC0E
ld a,2 ; textabschnitt in messages
;ld hl,messages
call find_messages
ret

find_messages
;a = counts do txt

ld hl,messages
;push hl

cp 0
jr z,show_text
sub &1
ld b,a

ld c,0
ld a,0
next_string
push af
push bc
;-------------
next_char
ld a,(hl)
cp &A0
;push af
jr nc,greater_80
;pop af
inc hl
jr next_char

greater_80
pop af
pop bc
inc a
cp b

jr nc, next_string
inc hl

jp show_text
ret

show_text
ld a,(hl)
cp &A0
jr nc,fin_txt
push hl
call &bb5a
pop hl
inc hl

jr show_text
fin_txt
sub &80
jp &bb5a
ret

messages
db "Hall","o" +&80 ;0
db "ich"," " +&80 ;1
db "bin"," " +&80 ;2
db "ein"," " +&80 ;3
Title: Re: textdaten durchlaufen mit pointer
Post by: BadCPC on 23. May 2025, 15:27:46
so hat sich erledigt , war mal wieder schneller im kopf als angebracht ;)