In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: So the trick is to insert identical code in both 'if' section and 'else' section, but the label only in the 'if' section, and an org in the 'else' section. 1 07F8 0F7F device SX28,oschs1,turbo,stackx,optionx ;sx device options 2 =00000000 irc_cal IRC_SLOW 3 =02FAF080 freq 50_000_000 ;cpu frequency 4 07FF 0A07 reset main 5 expand 6 7 Assign macro Name ;create a macro 8 ifndef I??Name ;test for the modified parameter passed already exists 9 I??Name 10 jmp @??Name ;create this label from the parameter passed 11 else 12 org I??Name 13 jmp @??Name ;create this label from the parameter passed 14 endif 15 endm ;done 16 17 =00000000 org 0 18 Assign rx1 19 m ifndef Irx1 ;test for the modified parameter passed already exists 20 m Irx1 21 m jmp @rx1 ;create this label from the parameter passed 22 m else 23 =00000000 m org Irx1 24 0000 0010 m jmp @rx1 ;create this label from the parameter passed 0001 0A04 25 m endif 27 Assign rx2 28 m ifndef Irx2 ;test for the modified parameter passed already exists 29 m Irx2 30 m jmp @rx2 ;create this label from the parameter passed 31 m else 32 =00000002 m org Irx2 33 0002 0010 m jmp @rx2 ;create this label from the parameter passed 0003 0A05 34 m endif 36 =00000004 rx1 37 0004 0C01 mov w,#1 38 =00000005 rx2 39 0005 01C4 add w,fsr 40 0006 000C ret 41 =00000007 main 42 0007 0A07 jmp main Cross Reference 10 symbols Symbol Type Value Line __SASM DATA 00000001 0000 __SX_FREQ DATA 02FAF080 0003 __SX_IRC_CAL DATA 00000000 0002 __SX_RESET RESB 00000A07 0004 fsr RESV 00000004 0039 Irx1 ADDR 00000000 0020 Irx2 ADDR 00000002 0029 main ADDR 00000007 0041 rx1 ADDR 00000004 0036 rx2 ADDR 00000005 0038 regards peter ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=244787#m245758 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)