A83: getString routine


[Prev][Next][Index][Thread]

A83: getString routine



Does someone can explain me these routine, particulary text wich are in bold ? I found it in Periodic Table 2.0 of Ahmed El-Helw. There is a list of elements. How does the program do to put the good string in hl.
 
ld hl,Elements
ld a,[number of the element : 1=Hydrogen, 2=Helium]
call getString
 
;---------= Point hl to string a =---------
; by: Joe Wingerbermuhle
; Thanks, this is a lot easier than my
; method of multiplying string # * 12
;
; Input: a=string number (0 to 255)
;  hl->string data
; Output: hl->string
 
getString:
         or a
         ret z
         ld b,a
         xor a
getStringL1:
         push bc
         ld c,-1
         cpir

         pop bc
         djnz getStringL1
         ret
 
Elements:
        .db "Hydrogen",0
        .db "Helium",0
        .db "Lithium",0
        .db "Beryllium",0
        .db "Boron",0
        .db "Carbon",0
        .db "Nitrogen",0
        .db "Oxygen",0
        ...
 
Thanks
 
Ti-83
 
Le monde de la TI-83
http://www.ti-83.fr.st
ti-83@fr.st