diff --git a/avr/modules/heap/main.asm b/avr/modules/heap/main.asm index edf8028..fa9fadd 100644 --- a/avr/modules/heap/main.asm +++ b/avr/modules/heap/main.asm @@ -78,6 +78,7 @@ Heap_Init: ; @param r25:r24 number of bytes to alloc ; @return CFLAG set of okay, cleared otherwise ; @return X start of allocated memory +; @clobbers r16, r17, r18, r19, r24, r25, X Heap_Alloc: rjmp heapAllocFirstFit @@ -92,6 +93,7 @@ Heap_Alloc: ; @param r25:r24 number of bytes to alloc ; @return CFLAG set of okay, cleared otherwise ; @return X start of allocated memory +; @clobbers r16, r17, r18, r19, r24, r25, X heapAllocFirstFit: adiw r25:r24, 3 ; align size to next multiple of 4 @@ -109,7 +111,7 @@ heapAllocFirstFit_loop: sbrc r18, HEAP_HEADER_BIT_USED rjmp heapAllocFirstFit_next ; jump if used ; current chunk free, check size - andi r18, 0xfc + andi r18, 0xfc mov r16, r18 mov r17, r19 sub r16, r24 @@ -119,7 +121,7 @@ heapAllocFirstFit_loop: sec ret heapAllocFirstFit_next: - andi r18, 0xfc + andi r18, 0xfc add xl, r18 adc xh, r19 adiw xh:xl, 2 ; skip footer