 
					
				
		
 
					
				
		
 CompilerGuru
		
			CompilerGuru
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
interrupt VectorNumber_Viicx void intI2C(void){ ..} 
					
				
		
 
					
				
		
 CompilerGuru
		
			CompilerGuru
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		#pragma CODE_SEG __NEAR_SEG NON_BANKEDSecond, for interrupt functions as in the question, near as calling convention specifier is against that interrupt handlers have the "interrupt" calling convention. Functions are either near, far or interrupt handlers. I think a near specified for an interrupt handler is ignored.
 
					
				
		
#pragma CODE_SEG NON_BANKEDinterrupt VectorNumber_Viicx void near intI2C(void){  ..}#pragma CODE_SEG  DEFAULT 
					
				
		
/* Disable interrupts without destroying the i-bit in CCR. */
unsigned char cond;
#define SAFE_DisableInterrupts asm PSHA;      \
                               asm TPA;       \
                               asm STAA cond; \
                               asm PULA;      \
                               asm SEI;   
                                
#define SAFE_EnableInterrupts  if(!(cond & 0x10)) \
                                 asm CLI;
#pragma CODE_SEG NON_BANKED_ROUTINES
unsigned char readFromPage (unsigned char page, const unsigned char* address)
{
    unsigned char value;
    unsigned char tmp = PPAGE;
   
    SAFE_DisableInterrupts;
    PPAGE = page;
    value = *address;
    PPAGE = tmp;
    SAFE_EnableInterrupts;
    return value;
}
 
					
				
		
 CompilerGuru
		
			CompilerGuru
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Just wondering, why does this readFromPage need to disable the interrupts during its read access? I would think that placing it non banked is mandatory and sufficient. Daniel
 
					
				
		
 
					
				
		
 CompilerGuru
		
			CompilerGuru
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 
					
				
		
 CompilerGuru
		
			CompilerGuru
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
hi ,
i attemp to port one project to "banked mode" from "small mode" on the 08DZ128.
         in small mode ,the project works well  ( code  size about 55k). but link error occured in banked mode.
         the following details  the steps
        Step 1:  initial new project with "banked" mode.
        Step 2:  inport all source code ( .c , .h  and .asm  files)
          Step 3:     rebuilt the .prm
          Step 4:     locate the ISR in non_banked area using #pragma code_seg  ISR_NON_BANKED
                           in c function    including  all others called in ISR
          Step5:      locate the ISR in non_banked area using ISR_NON_BANKED: SECTION in
                           assemble function including all others called in ISR.
          Step 6: link error L1102 out of allocation space in segment APP_CALL_ TABLE at address
                       0xDA80.
when i check the .map show the calltable would occupy more than 50% space. and CallTable1,VectorTable,VectorTable1 similar.
      CallTable                                    0'Error      18      24       0   CALL_TABLE 
      CallTable1                                   0'Error      5D      93       0   CALL_TABLE1
      VectorTable                                  0'Error      18      24       0   ToVectorTable
      VectorTable1                                 0'Error      60      96       0   ToVectorTable1
         
         but as you know, the CallTable  is  capable   of  storing the 8 interrupt vector(16 bytes)
        Actually, i ever tried  to  delet the pointer function, and directly provide the isr vector in .prm, and everything is OK.
       therefore i suppose some setting wrong. pls refer  to the .prm, isr.c and  .map attached!
       Did i make myslef  clear ?
using _NEAR_SEG will remedy the issue?
        any advice or suggestion will be appreciated!
         
         
 
					
				
		
 
					
				
		
 CompilerGuru
		
			CompilerGuru
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 
					
				
		
 
					
				
		
