In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: Bean, The attached program gets compiled wrong if there is a RETURN command in it. [code] 134 =00000022 mysub: ;SUB mysub 135 136 0022 070D JNB onBreak,@__ELSE_1 ; if onBreak = 1 then 0023 0010 0A26 137 138 0025 000D RETP ; return 139 140 =00000026 __ELSE_1: ; endif 141 =00000026 __ENDIF_1: 142 143 0026 050D SETB onBreak ; onBreak = 1 144 145 ;ENDSUB 146 147 148 ;' ------------------------------------------------------------------------- 149 ;' Data Tables 150 ;' ------------------------------------------------------------------------- 151 0027 0000 DW 0 ;data 0 [/code] A workaround for now is to GOTO a label above ENDSUB. [code] 134 =00000022 mysub: ;SUB mysub 135 136 0022 070D JNB onBreak,@__ELSE_1 ; if onBreak = 1 then 0023 0010 0A27 137 138 0025 0010 JMP @leaveSub ; goto leaveSub 0026 0A28 139 140 =00000027 __ELSE_1: ; endif 141 =00000027 __ENDIF_1: 142 143 0027 050D SETB onBreak ; onBreak = 1 144 145 =00000028 leaveSub: ;leaveSub: 146 147 0028 000D RETP ;ENDSUB 148 149 150 151 ;' ------------------------------------------------------------------------- 152 ;' Data Tables 153 ;' ------------------------------------------------------------------------- 154 0029 0000 DW 0 ;data 0 [/code] regards peter [/code][/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=324027 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)