; ( n f-addr -- ) ; Memory ; writes n to flash memory using assembly code (code to be placed in boot loader section) VE_DO_STOREI_NRWW: .dw $ff09 .db "(!i-nrww)",0 .dw VE_HEAD .set VE_HEAD = VE_DO_STOREI_NRWW XT_DO_STOREI: .dw PFA_DO_STOREI_NRWW PFA_DO_STOREI_NRWW: ; store status register in temp1,SREG push temp1 cli movw temp2, tosl ; save the (word) address loadtos ; get the new value for the flash cell push xl push xh push yl push yh rcall DO_STOREI_atmega pop yh pop yl pop xh pop xl ; finally clear the stack loadtos pop temp1 ; restore status register (and interrupt enable flag) out SREG,temp1 jmp_ DO_NEXT ; DO_STOREI_atmega: ; write data to temp page buffer ; use the values in tosl/tosh at the ; appropiate place rcall pageload ; erase page if needed ; it is needed if a bit goes from 0 to 1 com temp4 com temp5 and tosl, temp4 and tosh, temp5 or tosh, tosl breq DO_STOREI_writepage movw zl, temp2 ldi temp0,(1<