[futurebasic] Re: [FB] Toolbox FN RelString

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1998 : Group Archive : Group : All Groups

From: Chris Stasny <staz@...>
Date: Thu, 31 Dec 1998 10:45:56 -0600
>Sorry Staz, but I'm a little dense. Where do you actually see the results.
>The function does not seem to return any values. Shouldn't the last line
>read something like END FN=result?
>>
>>'-------------------------------------
>>'relString
>>'-------------------------------------
>>LOCAL FN relStringCaseSen(@word1&,@word2&)
>>
>>  `     move.l  ^word1&,a0
>>  `     move.l  ^word2&,a1
>>  `     moveq   #0,d0
>>  `     move.b  (a0)+,d0
>>  `     swap    d0
>>  `     move.b  (a1)+,d0
>>  `     dc.w    $A450
>>END FN
>>

the relString trap puts its result in register D0. We could extract that
result and put it in a variable...

`  move.w	d0,^sortResult

Then return the result from the function


END FN = sortResult

This would tell FB to put the result back in D0...

`  move.w      ^sortResult,d0  ; this happens behind the scenes
`                              ; you don't actually see it


The final effect is that you took a result out of d0, put it in a variable
and FB put it back in d0. (Ring around the register) Since I knew that the
result was in d0 and I knew that END FN without an equal sign would not
affect the register, I just let it return to the calling routine.

The calling routine _always_ expects the result to be in d0.



In case you are interested, my dog now has an email address. You can write
to her at summer@.... Don't expect a reply tho. She can't read.

-STAZ   ~)~

--------------------------------------------------------------
STAZ Software * 4387 Leisure Time Dr * Diamondhead, MS 39525
--------------------------------------------------------------
Orders: 800-348-2623      EMail http: //www.stazsoftware.com
  Tech: 228-255-7085             FAX: 228-255-7086
--------------------------------------------------------------