aboutsummaryrefslogtreecommitdiff
path: root/src/memory.c
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
commit8af4b246d86df7bc906841689912534ea450cce5 (patch)
tree3f8432c1c305b151125997632cbd3c3de4fb3835 /src/memory.c
parent687f56226dc8a024ef560ee4b390a630819f437c (diff)
Removed memory bit flags entirely.
[#28] Bit flags were exclusively a cosmetic component, not needed at all to run the simulator. I've added a new 'render' module that takes care of appending bit flags to rendered memory images, providing the same aesthetic result, but only when requested.
Diffstat (limited to 'src/memory.c')
-rw-r--r--src/memory.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/memory.c b/src/memory.c
index 1036152..b02a5b9 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -7,8 +7,6 @@
#include "instset.h"
#include "memory.h"
-#define MAX_ZOOM 0x10000
-
static boolean g_is_init;
static uint32 g_order;
static uint32 g_size;
@@ -185,52 +183,6 @@ uint8 sal_mem_get_byte(uint32 address)
return g_memory[address];
}
-void sal_mem_render_image(
- uint32 origin, uint32 cell_size, uint32 buff_size, uint8_p buffer
-) {
- /* Render a 1D image of a given section of memory, at a given resolution
- (zoom) and store it in a pre-allocated 'buffer'.
-
- On the Salis python handler we draw memory as a 1D 'image' on the WORLD
- page. If we were to render this image directly on python, it would be
- excruciatingly slow, as we have to iterate over large areas of memory!
- Therefore, this memory module comes with a built-in, super fast renderer.
- */
- uint32 i;
- assert(g_is_init);
- assert(sal_mem_is_address_valid(origin));
- assert(cell_size);
- assert(cell_size <= MAX_ZOOM);
- assert(buff_size);
- assert(buffer);
-
- /* We make use of openmp for multi-threaded looping. This allows even
- faster render times, wherever openmp is supported.
- */
- #pragma omp parallel for
- for (i = 0; i < buff_size; i++) {
- uint32 j;
- uint32 inst_sum = 0;
- uint32 alloc_found = 0;
- uint32 cell_addr = origin + (i * cell_size);
-
- for (j = 0; j < cell_size; j++) {
- uint32 address = j + cell_addr;
-
- if (sal_mem_is_address_valid(address)) {
- inst_sum += sal_mem_get_inst(address);
-
- if (sal_mem_is_allocated(address)) {
- alloc_found = ALLOCATED_FLAG;
- }
- }
- }
-
- buffer[i] = (uint8)(inst_sum / cell_size);
- buffer[i] |= (uint8)(alloc_found);
- }
-}
-
static boolean inst_count_is_correct(void)
{
/* Check that the instruction counter is in a valid state