avr: use Heap_AllocAndZero
This commit is contained in:
@@ -91,21 +91,11 @@ LayoutCtx_new:
|
|||||||
; alloc on heap
|
; alloc on heap
|
||||||
push r24
|
push r24
|
||||||
push r25
|
push r25
|
||||||
bigcall Heap_Alloc ; (r16, r17, r18, r19, r24, r25)
|
bigcall Heap_AllocAndZero ; (r16, r17, r18, r19, r24, r25)
|
||||||
pop r25
|
pop r25
|
||||||
pop r24
|
pop r24
|
||||||
pop r16
|
pop r16
|
||||||
brcc LayoutCtx_new_ret
|
brcc LayoutCtx_new_ret
|
||||||
; preset with 0
|
|
||||||
push xl
|
|
||||||
push xh
|
|
||||||
clr r17
|
|
||||||
LayoutCtx_new_loop:
|
|
||||||
st X+, r17
|
|
||||||
sbiw r25:r24, 1
|
|
||||||
brne LayoutCtx_new_loop
|
|
||||||
pop xh
|
|
||||||
pop xl
|
|
||||||
adiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
adiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
||||||
st X, r16 ; store number of items
|
st X, r16 ; store number of items
|
||||||
sbiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
sbiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
||||||
|
|||||||
Reference in New Issue
Block a user