#include "interpreter.h"


Data Structures | |
| struct | dynamicMemCell |
| Dynamic memory cell. More... | |
| struct | DynamicMemory |
| Interface to the dynamic memory. More... | |
| struct | StaticMemory |
| Static memory. More... | |
Typedefs | |
| typedef int32_t | MemCell |
| Virtual memory cell content. | |
| typedef struct dynamicMemCell | DynamicMemCell |
| Dynamic memory cell. | |
Functions | |
| void | pasm_initMemory () |
| Initialize the memory system. | |
| void | pasm_resetMemory () |
| Reset the memory system. | |
| void | pasm_writeValue (uint32_t address, int32_t value) |
| Write some value into some virtual memory cell. | |
| int32_t | pasm_readValue (uint32_t address) |
| Read value from a virtual memory cell. | |
| void | pasm_createStaticMemory (uint32_t size) |
| Create a block of virtual static memory. | |
| void | pasm_writeInstruction (uint32_t address, Instruction instruction) |
| Write some instruction into some virtual memory cell. | |
| ErrorCode | pasm_readInstruction (uint32_t address, Instruction *instruction) |
| Read instruction from a virtual memory cell. | |
The memory system takes care of reading values from and writing values into the virtual memory. The memory system knows 2 ways to allocate virtual memory: virtual static memory and virtual dynamic memory. Virtual static memory is created all at once and allows for fast address seeking. Virtual dynamic memory gets created when it is needed but traversing the virtual dynamic memory is a lot slower.
| typedef struct dynamicMemCell DynamicMemCell |
Dynamic memory cell.
This type of memory cell belongs to the virtual dynamic memory.
| void pasm_createStaticMemory | ( | uint32_t | size | ) |
Create a block of virtual static memory.
| size | Size of the static memory. |
| ErrorCode pasm_readInstruction | ( | uint32_t | address, | |
| Instruction * | instruction | |||
| ) |
Read instruction from a virtual memory cell.
| address | Virtual address to read the instruction from | |
| instruction | Pointer to empty instruction. The function will fill in the instruction. |
| int32_t pasm_readValue | ( | uint32_t | address | ) |
Read value from a virtual memory cell.
| address | Virtual address to read the value from |
| void pasm_resetMemory | ( | ) |
Reset the memory system.
This will also free all memory that was allocated on the host machine for the virtual memory.
| void pasm_writeInstruction | ( | uint32_t | address, | |
| Instruction | instruction | |||
| ) |
Write some instruction into some virtual memory cell.
| address | Virtual address to write the instruction into | |
| instruction | Instruction to write into the memory cell |
| void pasm_writeValue | ( | uint32_t | address, | |
| int32_t | value | |||
| ) |
Write some value into some virtual memory cell.
| address | Virtual address to write the value into | |
| value | Value to write into the memory cell |
1.5.6