avr: reorganized common code.
This commit is contained in:
47
avr/common/inccounter16.asm
Normal file
47
avr/common/inccounter16.asm
Normal file
@@ -0,0 +1,47 @@
|
||||
; ***************************************************************************
|
||||
; 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_INCCOUNTER16_ASM
|
||||
#define AQH_AVR_COMMON_INCCOUNTER16_ASM
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Utils_IncrementCounter16 @global
|
||||
;
|
||||
; Increment a 16 bit counter at the address given by X.
|
||||
;
|
||||
; @param X Address of the 2 byte counter (1. byte is LSB)
|
||||
; @clobbers r18, r19, r22
|
||||
|
||||
Utils_IncrementCounter16:
|
||||
ld r18, x+
|
||||
ld r19, x
|
||||
ldi r22, 1
|
||||
add r18, r22
|
||||
clr r22 ; doesn't affect carry flag
|
||||
adc r19, r22
|
||||
st x, r19
|
||||
st -x, r18
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user