minor formatting.
This commit is contained in:
@@ -78,6 +78,7 @@ Heap_Init:
|
|||||||
; @param r25:r24 number of bytes to alloc
|
; @param r25:r24 number of bytes to alloc
|
||||||
; @return CFLAG set of okay, cleared otherwise
|
; @return CFLAG set of okay, cleared otherwise
|
||||||
; @return X start of allocated memory
|
; @return X start of allocated memory
|
||||||
|
; @clobbers r16, r17, r18, r19, r24, r25, X
|
||||||
|
|
||||||
Heap_Alloc:
|
Heap_Alloc:
|
||||||
rjmp heapAllocFirstFit
|
rjmp heapAllocFirstFit
|
||||||
@@ -92,6 +93,7 @@ Heap_Alloc:
|
|||||||
; @param r25:r24 number of bytes to alloc
|
; @param r25:r24 number of bytes to alloc
|
||||||
; @return CFLAG set of okay, cleared otherwise
|
; @return CFLAG set of okay, cleared otherwise
|
||||||
; @return X start of allocated memory
|
; @return X start of allocated memory
|
||||||
|
; @clobbers r16, r17, r18, r19, r24, r25, X
|
||||||
|
|
||||||
heapAllocFirstFit:
|
heapAllocFirstFit:
|
||||||
adiw r25:r24, 3 ; align size to next multiple of 4
|
adiw r25:r24, 3 ; align size to next multiple of 4
|
||||||
@@ -109,7 +111,7 @@ heapAllocFirstFit_loop:
|
|||||||
sbrc r18, HEAP_HEADER_BIT_USED
|
sbrc r18, HEAP_HEADER_BIT_USED
|
||||||
rjmp heapAllocFirstFit_next ; jump if used
|
rjmp heapAllocFirstFit_next ; jump if used
|
||||||
; current chunk free, check size
|
; current chunk free, check size
|
||||||
andi r18, 0xfc
|
andi r18, 0xfc
|
||||||
mov r16, r18
|
mov r16, r18
|
||||||
mov r17, r19
|
mov r17, r19
|
||||||
sub r16, r24
|
sub r16, r24
|
||||||
@@ -119,7 +121,7 @@ heapAllocFirstFit_loop:
|
|||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
heapAllocFirstFit_next:
|
heapAllocFirstFit_next:
|
||||||
andi r18, 0xfc
|
andi r18, 0xfc
|
||||||
add xl, r18
|
add xl, r18
|
||||||
adc xh, r19
|
adc xh, r19
|
||||||
adiw xh:xl, 2 ; skip footer
|
adiw xh:xl, 2 ; skip footer
|
||||||
|
|||||||
Reference in New Issue
Block a user