- OWINIT save Register used in C
[owSlave2.git] / common / OWRomFunctions.s
index aa7891d..e889416 100644 (file)
 #ifdef _CHANGEABLE_ID_
 ; lesen der ID aus dem EEPROM beim Start
 read_EEPROM_ID:  
+       push r_bytep
+       push r_rwbyte//r_temp2 and Z is not in gnu C save area
        ldi r_temp2,lo8(E2END)
        ldi zh,hi8(E2END)
        subi r_temp2,7
@@ -123,6 +125,8 @@ read_EEPROM_ID_loop:
        cpi r_bytep,8
        brne read_EEPROM_ID_loop
 read_EEPROM_ID_end:
+       pop r_rwbyte
+       pop r_bytep
        ret
 #endif
 
@@ -165,7 +169,7 @@ hrc_jmp_flasher:
        lds r_temp,flashmarker
        cpi r_temp,2
        brne hrc_jmp_flasher_inc
-       ldi r_temp,0xE0
+       ldi r_temp,0xC0
        push r_temp
        ldi r_temp,0x0E
        push r_temp
@@ -437,7 +441,7 @@ 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
@@ -453,7 +457,7 @@ OWINIT:
        sbic _SFR_IO_ADDR(PINA),PINA5 
        rjmp owinit_botest_end ;PINA5 nicht 0.... nicht verbunden
        cbi _SFR_IO_ADDR(DDRA),PINA4
-       ldi r_temp,0xE0
+       ldi r_temp,0xC0
        push r_temp
        ldi r_temp,0x0E
        push r_temp
@@ -470,4 +474,20 @@ owinit_botest_end:
        sts bcount,r_temp
        sts alarmflag,r_temp
        RESETZEROMARKER
+       pop r_temp
        ret
+
+
+.global EXTERN_SLEEP
+EXTERN_SLEEP:
+       cli
+       push r_temp
+       ldi r_temp,0
+       sts mode,r_temp ;SLEEP
+       sts gcontrol,r_temp
+       sts sendflag,r_temp
+       sts bcount,r_temp
+       RESETZEROMARKER
+       pop r_temp
+       sei
+       ret
\ No newline at end of file