59 lines
1.6 KiB
NASM
59 lines
1.6 KiB
NASM
; ***************************************************************************
|
|
; copyright : (C) 2025 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. *
|
|
; ***************************************************************************
|
|
|
|
;
|
|
; ---------------------------------------------------------------------------
|
|
; @routine NETMSG_Common_AddUidToBuffer @global
|
|
;
|
|
; @return X points directly behind the UID in buffer
|
|
; @param X current buffer position to write UID to
|
|
; @clobbers R16, R18, R19, R20, R21
|
|
|
|
NETMSG_Common_AddUidToBuffer:
|
|
push xh
|
|
push xl
|
|
rcall Utils_ReadUid ; (R16, X)
|
|
pop xl
|
|
pop xh
|
|
st X+, r18
|
|
st X+, r19
|
|
st X+, r20
|
|
st X+, r21
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine NETMSG_AddNextMsgIdToBuffer @global
|
|
;
|
|
; Write next message id (2 bytes) into buffer given by X, advance X.
|
|
;
|
|
; @return X points to behind written message id
|
|
; @param X pointer to packet buffer
|
|
; @param Y pointer to network interface data
|
|
; @clobbers: r16, r17, r18
|
|
|
|
NETMSG_AddNextMsgIdToBuffer:
|
|
ldi r18, 1
|
|
ldd r16, Y+NET_IFACE_OFFS_LASTMSGID_LOW
|
|
ldd r17, Y+NET_IFACE_OFFS_LASTMSGID_HIGH
|
|
add r16, r18
|
|
dec r18
|
|
adc r17, r18
|
|
std Y+NET_IFACE_OFFS_LASTMSGID_LOW, r16
|
|
std Y+NET_IFACE_OFFS_LASTMSGID_HIGH, r17
|
|
st X+, r16
|
|
st X+, r17
|
|
ret
|
|
; @end
|
|
|
|
|
|
|