diff --git a/avr/ringbuffer.asm b/avr/ringbuffer.asm index 2f2bd84..a5bb5c9 100644 --- a/avr/ringbuffer.asm +++ b/avr/ringbuffer.asm @@ -63,6 +63,17 @@ RingBuffer_Alloc: RingBuffer_Alloc_l1: std y+RINGBUFFER_OFFS_WRITEPOS, r19 mov r16, r20 + + ; preset first byte (this is the length byte in COM module) with 0 + push yl + push yh + clr r17 + add yl, r16 + adc yh, r17 + st y+RINGBUFFER_OFFS_DATA, r17 + pop yh + pop yl + out SREG, r21 ; restore global interrupt enable bit in SREG sec ret