Hi! 12-Feb-98 06:23 PICLIST@MITVMA.MIT.EDU wrote about "Re: Accessing text strings.": >> Hi! >> 6-Feb-98 17:21 John Payson wrote about "Re: Accessing text strings.": >> >> >> >> >> Format: >> >> db "Answer=" >> >> movlw answer >> >> call IntPConvert >> >> goto BGetHund >> >> goto BGetTens >> >> goto GetOnes >> >> db " Result=" >> ..... >> >> IntPConvert: >> >> bsf blankflag >> >> movwf FSR >> >> movf IND,w >> >> movwf TempL >> >> incf IND ^^^^ mistype? "FSR", I think... >> >> movf IND,w >> >> movwf TempH >> >> goto Convert ; My wonderful bin->dec convert routine >> ..... ..... >> Actually, we shall read "Answer=", but then some strange effects >> will be produced. (I suppouse that "Convert" makes conversion only). >> >> If index==7 then instructions "movlw answer" and >> "call IntPConvert" will be done. So, the value returned by >> conversion rotine "Convert" will be obtained by caller instead >> of the first digit of ansver (hundreds). >> >> If index==8 then only "call IntPConvert" will be done, and W >> will cotain value of 8 (if "addwf PCL,f" is used). So, TempL and >> TempH will be replaced with the values of SFR's 0x08 and 0x09 >> "Convert" routine will be called again. The value returned by >> "Convert" will be included into the string too. I'm sorry, my explanation wasn't exact. :( It is necessary to replace "CALL IntPConvert" with "GOTO IntPConvert" in quoted program to make this explanation true. But the key problem was noted correctly. Instruction follow "movlw answer" will be executed twice: when index=7 (OK, we want to do this) and when index=8 (unexpected). It is illegal, because no "movlw answer" executed before it; so, routine "Convert" will get "garbage value" in W. Furthermore, it should not be executed at all. -- Vladimir M. Klochko