avr: added NETMSG_Debug_Write2 (sends bytes from a buffer)

This commit is contained in:
Martin Preuss
2026-03-15 20:23:49 +01:00
parent 1d8b467b1d
commit 6c83991df7

View File

@@ -51,3 +51,42 @@ NETMSG_Debug_Write:
; ---------------------------------------------------------------------------
; @routine NETMSG_Debug_Write2 @global
;
; @param Y pointer to device to write msg for
; @param X pointer to buffer to write to
; @param Z source pointer (in RAM)
; @clobbers R16, R17, R18, R19, R20, R21
NETMSG_Debug_Write2:
push xl
push xh
ldi r16, 0xff
st X+, r16 ; dest address
mov r16, r20
ldi r17, 2
add r16, r17 ; msg code+src address+n payload bytes
st X+, r16 ; msg len
ldi r16, NETMSG_CMD_DEBUG
st X+, r16 ; msg code
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
mov r17, r20
NETMSG_Debug_Write2_loop:
ld r16, Z+
st X+, r16
dec r17
brne NETMSG_Debug_Write2_loop
pop xh
pop xl
push xl
push xh
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
pop xh
pop xl
ret
; @end