Use sparkly new _naked attribute
[fw/sdcc] / device / lib / ds390 / tinibios.c
index 6be2f3671752a84271140ae3f306deeb756fd603..4c4f0ef291d8e146a50f2ff2070ec93a5f386e36 100755 (executable)
@@ -487,37 +487,32 @@ void ClockInit() {
 // This needs to be SUPER fast. What we really want is:
 
 #if 0
-void ClockIrqHandler (void) interrupt 1 {
+void junk_ClockIrqHandler (void) interrupt 10 {
   TL0=timer0ReloadValue&0xff;
   TH0=timer0ReloadValue>>8;
   milliSeconds++;
 }
 #else
 // but look at the code, and the pushes and pops, so:
-#pragma EXCLUDE b,dpl,dph,dpx
-void ClockIrqHandler (void) interrupt 1 {
+void ClockIrqHandler (void) interrupt 1 _naked
+{
   _asm
+    push acc
     mov _TL0,_timer0ReloadValue
     mov _TH0,_timer0ReloadValue+1
-    mov a,#0x01
-    add a,_milliSeconds+0
-    mov _milliSeconds+0,a
-    jnc _ClockIrqHandlerDone
-    clr a
-    addc a,_milliSeconds+1
-    mov _milliSeconds+1,a
-    jnc _ClockIrqHandlerDone
-    clr a
-    addc a,_milliSeconds+2
-    mov _milliSeconds+2,a
-    jnc _ClockIrqHandlerDone
     clr a
-    addc a,_milliSeconds+3
-    mov _milliSeconds+3,a
+    inc _milliSeconds+0
+    cjne a,_milliSeconds+0,_ClockIrqHandlerDone
+    inc _milliSeconds+1
+    cjne a,_milliSeconds+1,_ClockIrqHandlerDone
+    inc _milliSeconds+2
+    cjne a,_milliSeconds+2,_ClockIrqHandlerDone
+    inc _milliSeconds+3
    _ClockIrqHandlerDone:
+    pop acc
+    reti
   _endasm;
 }
-#pragma EXCLUDE NONE
 #endif
 
 // we can't just use milliSeconds