Bug in the ez80

nobody wrote on Tuesday, March 06, 2007:

The timer_isr function implemented in C change the CPU flags before the assembly code save the "af" registers.
The timer_isr must be written in assembler to come around(for ez80L92):

;
     .assume adl=1       
     .def _timer_isr
     .ref _vTaskIncrementTick
     .ref _vTaskSwitchContext
     .ref _pxCurrentTCB           
    
_timer_isr:
   
    ;  portSAVE_CONTEXT();
   
     PUSH   IX
     push   af    ; save flags                           
     LD     IX,0
     ADD    IX,SP
     in0    a,(80h)              
     push   bc                           
     push   de                           
     push   hl                           
     push   iy                           
     ex     af,af’                
     exx                               
     push   af                           
     push   bc                           
     push   de                           
     push   hl                           
     ld     ix,0                  
     add    ix,sp                 
     ld     hl,(_pxCurrentTCB)    
     ld     (hl),ix                 
    
     CALL _vTaskIncrementTick

     CALL _vTaskSwitchContext

    ; portRESTORE_CONTEXT_ISR();
   
     ld     hl,(_pxCurrentTCB)    
     ld     hl,(hl)          
     ld     sp,hl                 
     pop    hl                           
     pop    de                           
     pop    bc                           
     pop    af                           
     exx                                 
     ex     af,af’                
     pop    iy                           
     pop    hl                           
     pop    de                           
     pop    bc                           
     pop    af                           
     pop    ix                           
     ei
     reti                         

Best regards:
Ivar Jeppesen
Embedit A/S
Denmark