Re: A82: Printing Strings
[Prev][Next][Index][Thread]
Re: A82: Printing Strings
Hmmmm. How about you set up the words as rows of numbers?
Dict:
.db 2, 1, 20, 0, 0, 0, 0, 0, 0 ; Bat
.db 3, 1, 20, 0, 0, 0, 0, 0, 0 ; Cat
.db 4, 15, 7, 0, 0, 0, 0, 0, 0 ; Dog
Dictonary entry #1 would be (Dict), #2 would be (Dict 1*10), #3 would be
(Dict 2*10), #n would be (Dict (n-1)*10). All the words would have to be
the same length, of course, so you'd just take the number of letters in
the longest word and make all of the words that long by adding spaces, or
0's.
(space) 0
A 1
B 2
C 3
D 4
E 5
F 6
G 7
H 8
I 9
J 10
K 11
L 12
M 13
N 14
O 15
P 16
Q 17
R 18
S 19
T 20
U 21
V 22
W 23
X 24
Y 25
Z 26
-Scoobie
Matt Maurano <maurano@best.com> writes:
>I want to be able to print a large number of strings stored in one
>location, but separately. For example, lets say I was doing a
>dictionary. I would want to be able to show each word on the screen,
>as
>the user cycles through by the arrows. Example, it starts out on Cat,
>and when you press the right arrow, it goes to Dog, or the left would
>make it go to Bat. Now, I could do this by having separate code for
>all
>of the words, but that could get huge. I think this might be better:
>
>Dict:
>.db "Bat",0,"Cat",0,"Dog"
>
>And have it keep the location of the string its on, and go back or
>forward till it hits a zero, or some other delimiter. So I guess I'm
>asking, how do I print items of a zero-delimited database one at a
>time?
>No special sorting, just print them in the order stored. The code
>should
>actually be pretty short (Read to a zero, inc the location one, and
>print it), leaving the bulk of the space for the data, but I don't
>have
>the knowledge to do it. Any help?
>
>
References: