; *************************************************************************** ; copyright : (C) 2026 by Martin Preuss ; email : martin@libchipcard.de ; ; *************************************************************************** ; * This file is part of the project "AqHome". * ; * Please see toplevel file COPYING of that project for license details. * ; *************************************************************************** #ifndef AQH_AVR_COMMON_INCCOUNTER32_ASM #define AQH_AVR_COMMON_INCCOUNTER32_ASM ; *************************************************************************** ; code .cseg ; --------------------------------------------------------------------------- ; @routine Utils_IncrementCounter32 @global ; ; Increment a 32 bit counter at the address given by X. ; ; @param X Address of the 4 byte counter (1. byte is LSB) ; @clobbers r18, r19, r20, r21, 22 Utils_IncrementCounter32: ld r18, x+ ld r19, x+ ld r20, x+ ld r21, x ldi r22, 1 add r18, r22 clr r22 ; doesn't affect carry flag adc r19, r22 adc r20, r22 adc r21, r22 st x, r21 st -x, r20 st -x, r19 st -x, r18 ret ; @end #endif