; initHeap: Sets up the heap into its initial configuration with no
; bytes allocated.
; (There is no reason to modify the provided code for this subroutine.)
initHeap MOV R1, #0x800  ; 0x800 = address of first byte in heap
         MOV R0, #0x200  ; 0x200 = number of bytes in heap
         STR R0, [R1]
         MOV PC, LR

; malloc: Allocates from the heap a block of memory containing at least
; the number of bytes found in R0, returning the address of the
; allocated block's first byte.
malloc   ADD R0, R0, #7  ; add 4 bytes for header and round up to
         BIC R0, R0, #3  ; multiple of 4
        
         MOV PC, LR
        
; free: Deallocates the memory block allocation identified by R0 as
; the address of the block's first byte.
free     MOV PC, LR
