The error message is selected using a number in X, as follows: RTNERR allows a function to raise an error message. The reason RTNYES is a separate function is because of its behavior when the function was XEQ'd from the keyboard: in that case, RTNYES will display the message "Yes" ans RTNNO will display the message "No". In terms of the flow of control, RTNYES acts just like RTN, while RTNNO returns to the line after the one RTN would return to, skipping the line right after the calling XEQ. RTNYES and RTNNO allow a function to behave like a conditional. The stack restoration happens automagically upon RTN. Thus, in order to implement a binary operator, all that's needed is to call FUNC2 at the beginning of the function, and make sure the result is in X when it returns. Upon RTN, a function initialized with FUNC0 will restore all four stack registers and LASTx to their original values a function initialized with FUNC1 will leave X intact, restore the original X to LASTx, and restore Y, Z, and T to their original values and a function initialized with FUNC2 will leave X intact, restore the original X to LASTx, and restore T to T and Z, and restore Z to Y. The descriptions on my web site cover the implementation in the official 2.5.23 release the following documents the implementation in my current prototype:įUNC0, FUNC1, and FUNC2: These functions preserve the stack and LASTx, in preparation for restoring registers when the function returns. I wasn't happy about it and made several improvements, in the areas of error handling and RTN behavior. The implementation of these functions in 2.5.23 is functional, but flawed. The idea is to make it easier to implement the proper stack behavior, and to allow subroutines to return error codes and to act as conditionals. In Free42 2.5.23, I introduced a few new functions that are meant to help create subroutines that behave like built-in functions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |