Re: A86: Displaying text
[Prev][Next][Index][Thread]
Re: A86: Displaying text
--- ComAsYuAre@aol.com wrote:
>
> In a message dated 8/24/99 10:42:56 PM Eastern
> Daylight Time, KidFedX@aol.com
> writes:
>
> > What would be the best way to go about displaying
> multiple lines of text.
> > Something like:
> > ld b,Text ;number of lines to display
> > show:
> > inc hl ;now points to line of text
> > call _puts ;shows text on screen
> > call _newline
> > djnz show ;if all lines have been disp go
> back
> > ret
> > Text:
> > .db 3,"Welcome to TI","This is just a test
> line","So is this one",0 ;
> 3
> > is the # of lines to be displayed
> >
> > Doing it that way just seems to run the 3 lines
> together. If I put a
> > terminator (0) at the end of everyline to be
> displayed would that increase
> > the size of the program?
> > Thanks for your help.
>
> there are multiple problems with this. each line
> needs to have a 0 ending it
> so that _puts knows it has reached the end of the
> string.
>
> this is more what you're looking for:
>
> show:
> ld b,3
> ld hl,text
> puts_loop:
> push bc ;save counter
> call _puts
> call _newline
> pop bc ;retrieve counter
> djnz puts_loop
> ret
>
> text:
> .db "Welcome to TI",0
> .db "This is just a test line",0
> .db "So is this one",0
>
>
If you had different messages that you wanted to
display you could do this:
ld hl,text
call show
call _getkey
ld hl,text2 ;goes right into rountine
show:
ld b,(hl)
inc hl
puts_loop:
push bc
call _puts
call _newline
pop bc
djnz puts_loop
ret
text:
.db 3
.db "Welcome to TI",0
.db "This is just a test line",0
.db "So is this one",0
text2:
.db 2
.db "This is another test",0
.db "So is this",0
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com