pTAL Guidelines for TAL Programmers

Contents
pTAL Guidelines for TAL Programmers527256-002
v
Examples (continued)
Examples (continued)
Example 2-25. Using Indexing and Pointers to Access Stack Marker
(TAL Only) 2-27
Example 2-26. Changing Return Location by Using TNS Stack Marker
(TAL Only) 2-28
Example 2-27. Changing Return Location Without Using TNS Stack Marker 2-29
Example 2-28. $OPTIONAL Routine 2-30
Example 2-29. $OPTIONAL Routine With Parameter Pair 2-30
Example 2-30. Building a Parameter Mask (TAL Only) 2-31
Example 2-31. Alternative to Building a Parameter Mask 2-31
Example 2-32. Returning Function’s Value on the Stack (TAL Only) 2-32
Example 2-33. Returning Function’s Value With RETURN Statement 2-32
Example 2-34. Dynamic Procedure Calls With CODE Statements (TAL Only) 2-33
Example 2-35. Dynamic Procedure Calls With PROC Parameters 2-34
Example 2-36. Dynamic Procedure Calls With Procedure Pointers 2-34
Example 2-37. Using STACK and CODE Statements to Pass Parameters
(TAL Only) 2-37
Example 2-38. Assuming That Parameters Are Stored Consecutively 2-37
Example 2-39. Not Assuming That Parameters Are Stored Consecutively 2-38
Example 2-40. Referencing a Parameter Relative to a Local Variable 2-38
Example 2-41. Definition Structure as Formal Parameter (TAL Only) 2-39
Example 2-42. Structure Pointer as Formal Parameter 2-39
Example 2-43. @ Operator 2-40
Example 2-44. Referencing Condition Codes (TAL Only) 2-41
Example 2-45. Invalid Condition Code Test After Procedure Call 2-42
Example 2-46. Invalid Overflow Test After Arithmetic Operation 2-42
Example 2-47. Invalid Condition Code Test After Arithmetic Operation 2-43
Example 2-48.
Valid References to Hardware Indicators 2-43
Example 2-49.
Invalid Test of a Hardware Indicator 2-43
Example 2-50. Valid Test of a Hardware Indicator 2-43
Example 2-51. Valid Test of a Hardware Indicator 2-44
Example 2-52. Testing Condition Code in THEN Part of Nested IF Statement 2-44
Example 2-53. Testing Condition Code in ELSE Part of Nested IF Statement 2-45
Example 2-54. Invalid $OVERFLOW Test (pTAL) 2-45
Example 2-55. Invalid $CARRY Test (pTAL) 2-45
Example 2-56. Valid $OVERFLOW Test (pTAL) 2-46
Example 2-57. Valid $CARRY Test 2-46
Example 2-58. Testing a Hardware Indicator in a Called Procedure (TAL Only) 2-47
Example 2-59. Passing the Value of a Condition Code to a Procedure 2-47