## Memory.jack This library provides two services: direct access to the computer's main memory (RAM), and allocation and recycling of memory blocks. The Hack RAM consists of 3840 words, each holding a 16-bit binary number. ### function void init(int start, int end) Initializes the class. First address of heap is start, last address of heap is end. ### function int peek(int address) Returns the RAM value at the given address. ### function void poke(int address, int value) Sets the RAM value at the given address to the given value. ### function int alloc(int size) Finds an available RAM block of the given size and returns a reference to its base address. ### function void deAlloc(Array o) De-allocates the given object (cast as an array) by making it available for future allocations. *** ### Project * Implement `Memory.jack` * Test in simulation: ``` $ cd 04_Memory_Test $ make $ cd ../00_HACK $ apio clean $ apio sim ``` * Check the content of special function register DEBUG0--DEBUG4. ![](memory.png)