> -- 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.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.