This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How would you create a conditional %define in asm

I'm tring to create a conditional address statement in my start167.a66. The goal is to be able to use the same start up file with different uv2 targets. one target would be stand-alone and the other target needs to coexist with a bootloader ROM.
(The programming tools I have available can only program CS0 )

I tried to create a block using the if/else statement but found out the hard way that the last/latest %Define statement will over ride any previous ones.

; BUSCON2/ADDRSEL2
; --- Set BUSCON2 = 1 to initialize the BUSCON2/ADDRSEL2 registers
$SET (BUSCON2 = 1) ; Uv2/Dave

;$IF (I_USE_CS0 = 1)     ; pick you chip

%DEFINE(ADDRESS2) (80000H) ;  0x80000 clears the 1'st ROM by 2 times (8*64K)->2x256
%DEFINE(RANGE2) (256K)      ; (this setsup a mask for start address as well as size

$ELSE  ;][ App Programs are to run out of the second ROM and expect intr table @0
%DEFINE(ADDRESS2) (00000H) ; MUST BE SET TO 0! or no intrupts will work
%DEFINE(RANGE2) (256K)     ; only limited by
$ENDIF ; ] of changed chip config
the only other approach I can think of his two break these lines out into other files and then let the IF/else pick one of them. Does anyone have a cleaner approach?

Parents
  • Thank you DUPLAY gilles
    Your solution works great!

    For any beginner carousing these messages:
    The monitor has its own "start167.a66" file which executes an EINIT after configuring whatever it needs. If you include your own startup file and run it with the monitor, certain instructions will not have any effect like modifying the watchdog or CLOCKOUT (CLKEN) settings. The address configuration registers, (and BUSCONx reg), however, can be modified (as long as you not running out of them).

Reply
  • Thank you DUPLAY gilles
    Your solution works great!

    For any beginner carousing these messages:
    The monitor has its own "start167.a66" file which executes an EINIT after configuring whatever it needs. If you include your own startup file and run it with the monitor, certain instructions will not have any effect like modifying the watchdog or CLOCKOUT (CLKEN) settings. The address configuration registers, (and BUSCONx reg), however, can be modified (as long as you not running out of them).

Children
No data