From 595a14042853748f9a7f05fbf3e06b3d476e5f7e Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Thu, 5 Sep 2024 18:53:00 +0200 Subject: [PATCH] avr: reorder code (only need to load X if there is still something to do). --- avr/modules/stats/main.asm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/avr/modules/stats/main.asm b/avr/modules/stats/main.asm index 26a4390..c319739 100644 --- a/avr/modules/stats/main.asm +++ b/avr/modules/stats/main.asm @@ -55,14 +55,15 @@ Stats_Run: in r15, SREG push r15 cli + + lds r17, statsRemaining + tst r17 ; some left? + breq Stats_Run_done ; nope, jump to end + ldi xl, LOW(com2SendBuffer) ldi xh, HIGH(com2SendBuffer) ldi r16, 0xff ; broadcast - lds r17, statsRemaining - tst r17 - breq Stats_Run_done - cpi r17, STATS_POS_RECV brne Stats_Run_l1 rcall CPRO_WriteComRecvStats