> -- Mainline
> PUSH BASEPTR                          Save "this" pointer
> MOVE %ADDR(CUSTOMER), BASEPTR         Set "this" pointer
> CALL .GETPHONE, +4                    Call method saving space
> for return value
>
> -- GETPHONE
> MOVE @STACKPTR-4, BASEPTR             Get "this" pointer
> MOVE BASEPTR+CUSTPHONE, @STACKPTR     Store address of
> "CUSTPHONE" in stack
> RETRN                                         Return to caller
>
> -- Mainline
> POP  R0                                       Pop return value
> into register
> POP  BASEPTR                          Pop "this" pointer
> MOVE R0, BASEPTR+PHONE                        Move register to
> variable "PHONE"

Hmmm.  Not quite.  How about this:

-- Mainline
PUSH BASEPTR                            Save "this" pointer
MOVE %ADDR(CUSTOMER), BASEPTR           Set "this" pointer
CALL .GETPHONE, +4                      Call method

-- GETPHONE
MOVE BASEPTR+CUSTPHONE, @STACKPTR-4     Store address of value
RETRN                                           Return to caller

-- Mainline
POP  R0                                 Pop return value
POP  BASEPTR                            Pop "this" pointer
MOVE R0, BASEPTR+PHONE                  Move register to "PHONE"

One less instruction.  I get confused sometimes, but the idea is there.

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.