C6805 - Setting Multiple MORs

C6805 uses #pragma MOR or #pragma MORI to set a Mask Option Register in ROM. This register controls some 6805 features. Recent C6805 variations have multiple MOR's. To ensure the second MOR is initialized first at run-time, move the line that sets it from main() to a function called __STARTUP().

#pragma option v;
#pragma memory ROMPROG  [8192]  @ 0x0100;
#pragma memory RAMPAGE0 [176]   @ 0x0050;
#pragma vector __RESET @ 0x3ffe;
#define mor1 0x3abc 
#define mor1value 29 
#pragma mor @ mor1 = mor1value;
#pragma portrw mor1_ @ mor1;
#define xyz 0x54 
char q;
#pragma mor @ 0x1234 = xyz;
#pragma mor @ 0x4567 = &q + 5;
#pragma mori @ 0x3fdf = 0x54;
#define mor1 0x3abc 
#define mor1value 29 
char i;

void main (void)
{
  _mor1 = mor1value;
  NOP();
  i = _mor1 ;
}