From 6c83991df78db759de77783e9534432f7bf4611f Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 15 Mar 2026 20:23:49 +0100 Subject: [PATCH] avr: added NETMSG_Debug_Write2 (sends bytes from a buffer) --- avr/modules/network/msg/debug-w.asm | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/avr/modules/network/msg/debug-w.asm b/avr/modules/network/msg/debug-w.asm index 93e8930..2eae766 100644 --- a/avr/modules/network/msg/debug-w.asm +++ b/avr/modules/network/msg/debug-w.asm @@ -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 + + +