Files
aqhomecontrol/avr/modules/network/msg/range-r.asm
2026-04-26 12:47:50 +02:00

44 lines
1.2 KiB
NASM

; ***************************************************************************
; 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_NETWORK_MSG_RANGE_R_ASM
#define AQH_AVR_NETWORK_MSG_RANGE_R_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine NETMSG_RangeRead @global
; Read a RANGE message.
;
; @param X buffer to read from
; @return R18 command
; @return R20 range begin
; @return R21 range end
; @clobbers none
NETMSG_Range_Read:
adiw xh:xl, NETMSG_OFFS_CMD
ld r18, X ; command
adiw xh:xl, NETMSG_RANGE_OFFS_FROM-NETMSG_OFFS_CMD ; skip src addr and uid
ld r20, X+ ; range from
ld r21, X ; range to
sbiw xh:xl, NETMSG_RANGE_OFFS_TO ; back to msg begin
ret
; @end
#endif