Example 14. 32-Bit Assembly Program for Example 13

;*********************************************************** ;* FUNCTION VENEER: $max * ;*********************************************************** $max: .state16 BX pc NOP .state32 B _max .text .global _max ;*********************************************************** ;* FUNCTION DEF: _max * ;*********************************************************** _max: CMP A1, A2 MOVLE A1, A2 BX LR

Since sum( ) is a 16-bit function, its entry point is $sum. Because it was compiled for dual-state interworking, an alternate entry point, _sum, located in a different section is included. All calls to sum( ) requiring a state change use the _sum entry point.

The call to max( ) in sum( ) references $max, because sum( ) is a 16-bit function. If max( ) were a 16-bit function, sum( ) would call the actual entry point for max( ). However, since max( ) is a 32-bit function, $max is the alternate entry point for max( ) and handles the state change required by sum( ).