Re: A86: String Writing
[Prev][Next][Index][Thread]
Re: A86: String Writing
traditionally, when working with strings by length, one starts with b as
the length of the string and counts down. that way, you can do this:
djnz start
instead of this:
> inc b
> ld a,b
> cp 14
> jp z, done
> jp start
also, you can put it in a subroutine and use it with strings of different
lengths.
now, this would give you a problem in your routine with the address of
the current character to be printed. unless the starting point is
important throughout the routine however, you can just inc hl after every
character and the character to print will always be at (hl)
as to your question though, yes that should work. make sure the string
isn't in the middle of your code like that, though.
-josh
On Tue, 19 Oct 1999 17:29:19 -0700 "Akshay Dhalwala" <akdjr@softhome.net>
writes:
>
>i have a question. suppose i have the following string:
>
>text:
>.db "Welcome to EB"
>
>if i do the following:
>
> ld b,0
> ld hl,text
>start:
> push hl
> ld d,0
> ld e,b
> add hl,de
> ld a,(hl)
> call _putc
> pop hl
> push bc
> ld b,10
>hloop:
> halt
> djnz hloop
> pop bc
> inc b
> ld a,b
> cp 14
> jp z, done
> jp start
>done:
> ret
>
>will it output the string on the screen? You can assume that i have
>already
>set the curCol and curRow. Also if it won't work, do i have the right
>idea
>about it? Basically, i want to be able to write the string out letter
>by
>letter.
>
>thanks
>
>akshay
>
>
___________________________________________________________________
Get the Internet just the way you want it.
Free software, free e-mail, and free Internet access for a month!
Try Juno Web: http://dl.www.juno.com/dynoget/tagj.