- OWINIT save Register used in C
[owSlave2.git] / common / OWRomFunctionsDual.s
index adc571c..1a9b0d4 100644 (file)
@@ -64,6 +64,7 @@
 #define OW_FWCONFIGINFO1 7
 #define OW_FWCONFIGINFO2 8
 
+.comm idtable,64
 
 #ifdef _CHANGEABLE_ID_
 #define OW_WRITE_NEWID 9
@@ -71,7 +72,6 @@
 #define OW_SET_NEWID 11
 #define OW_FIRST_COMMAND 12
 .comm newid,8
-.comm idtable,64
        
 .macro CHANGE_ID_COMMANDS
        cset 0x75,OW_WRITE_NEWID
@@ -406,10 +406,10 @@ h_fwconfiginfo_go:
        rjmp handle_end_inc
 h_fwconfiginfo_crc:
        lds r_rwbyte,crc
-       rjmp handle_end
+       rjmp handle_end_inc
 h_fwconfiginfo_crc2:
        lds r_rwbyte,crc+1
-       rjmp handle_end
+       rjmp handle_end_inc
 h_fwconfiginfo_all:
        rjmp handle_end_sleep
 
@@ -507,19 +507,11 @@ h_setid_EEPROM_write:
        //rcall read_EEPROM_ID2
        push r_idm1
        push r_idm2
-       push r_idn1
-       push r_idn2
        push xl
        push xh
-       push yl
-       push yh
        rcall init_idtable
-       pop yh
-       pop yl
        pop xh
        pop xl
-       pop r_idn2
-       pop r_idn1
        pop r_idm2
        pop r_idm1
 h_setid_bad_code_all:
@@ -540,10 +532,12 @@ spause:
 
 .global OWINIT
 OWINIT:
+       
 #ifndef _DIS_FLASH_
 ; check for bootloader jumper
        ;vor allen anderen Registerconfigs
-       
+       push r_temp
+
        ldi r_temp,(1<<PUD) ;enable pullup 
        out _SFR_IO_ADDR(MCUCR) ,r_temp
        sbi _SFR_IO_ADDR(PORTA),PINA5 ;internal pullup on PINA5
@@ -568,8 +562,15 @@ owinit_botest_end:
 #endif
        HW_INIT  //Microcontroller specific
        CHIP_INIT //1-Wire device specific
-#ifdef _CHANGEABLE_ID_
+       pop r_temp
 init_idtable:
+       push yl
+       push yh
+       push r_temp
+       push r_rwbyte
+       push r_idn1
+       push r_idn2
+#ifdef _CHANGEABLE_ID_
        rcall read_EEPROM_ID1
        rcall read_EEPROM_ID2
 #endif
@@ -640,6 +641,13 @@ owinit_cpconfig2:
        sts bcount,r_temp
        sts alarmflag,r_temp
        RESETZEROMARKER
+       pop r_idn2
+       pop r_idn1
+       pop r_rwbyte
+       pop r_temp
+       pop yh
+       pop yl
+       
        ret
 
 .global EXTERN_SLEEP