aboutsummaryrefslogtreecommitdiff
path: root/include/memory.h
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:14 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 02:29:14 +0100
commit38764943e5fc61c424c018068dc7f6790dddf147 (patch)
tree65a0f5a00c91436b30e580f16365557437d61da7 /include/memory.h
parent0e7b2e49585e3725736ae380cbd2dfb28fea5093 (diff)
Format repass.
Diffstat (limited to 'include/memory.h')
-rw-r--r--include/memory.h52
1 files changed, 33 insertions, 19 deletions
diff --git a/include/memory.h b/include/memory.h
index 6376d7c..e144228 100644
--- a/include/memory.h
+++ b/include/memory.h
@@ -13,75 +13,89 @@
#define ALLOCATED_FLAG 0x20
#define INSTRUCTION_MASK 0x1f
-void _sal_mem_init(uint32 order);
-void _sal_mem_quit(void);
-void _sal_mem_load_from(FILE *file);
-void _sal_mem_save_into(FILE *file);
-
-/** Get memory order.
+/**
+* Get memory order.
* @return Order of memory (memory_size == 1 << order)
*/
SALIS_API uint32 sal_mem_get_order(void);
-/** Get memory size.
+/**
+* Get memory size.
* @return Size of memory (memory_size == 1 << order)
*/
SALIS_API uint32 sal_mem_get_size(void);
-/** Get amount of addresses with the allocated flag set on them.
+/**
+* Get amount of addresses with the allocated flag set on them.
* @return Amount of addresses with the allocated flag set
*/
SALIS_API uint32 sal_mem_get_allocated(void);
-/** Get memory capacity.
+/**
+* Get memory capacity.
* @return Memory capacity (capacity == size / 2)
*/
SALIS_API uint32 sal_mem_get_capacity(void);
-/** Get amount of addresses with a given instruction written on them.
+/**
+* Get amount of addresses with a given instruction written on them.
* @param inst Instruction whose amount we want to count
* @return Amount of addresses with given instruction
*/
SALIS_API uint32 sal_mem_get_inst_count(uint8 inst);
-/** Determine if memory is above its capacity.
+/**
+* Determine if memory is above its capacity.
* @return Memory is above capacity
*/
SALIS_API boolean sal_mem_is_over_capacity(void);
-/** Check validity of address.
+/**
+* Check validity of address.
* @param address Address being queried
* @return Validity of address (validity == address < size)
*/
SALIS_API boolean sal_mem_is_address_valid(uint32 address);
-/** Check if given address has the allocated flag set.
+/**
+* Check if given address has the allocated flag set.
* @param address Address being queried
* @return Allocated flag is set on this address
*/
SALIS_API boolean sal_mem_is_allocated(uint32 address);
-void _sal_mem_set_allocated(uint32 address);
-void _sal_mem_unset_allocated(uint32 address);
-
-/** Get current instruction at address.
+/**
+* Get current instruction at address.
* @param address Address being queried
* @return Instruction currently written at address
*/
SALIS_API uint8 sal_mem_get_inst(uint32 address);
-/** Write instruction into address.
+/**
+* Write instruction into address.
* @param address Address being set
* @param inst Instruction to write at given address
*/
SALIS_API void sal_mem_set_inst(uint32 address, uint8 inst);
-/** Get current byte at address.
+/**
+* Get current byte at address.
* @param address Address being queried
* @return Byte currently written at address (includes alloc-flag & instruction)
*/
SALIS_API uint8 sal_mem_get_byte(uint32 address);
+
+/*******************************
+* PRIVATES *
+*******************************/
+
+void _sal_mem_init(uint32 order);
+void _sal_mem_quit(void);
+void _sal_mem_load_from(FILE *file);
+void _sal_mem_save_into(FILE *file);
+void _sal_mem_set_allocated(uint32 address);
+void _sal_mem_unset_allocated(uint32 address);
void _sal_mem_cycle(void);
#endif