From 86d966811bb2341fdd217b4866a7473c7961bd23 Mon Sep 17 00:00:00 2001 From: Elaina Claus Date: Thu, 4 Sep 2025 17:51:52 -0400 Subject: [PATCH] prototypes for displaying some memory maps but now I need to write an arena allocator...so brb --- include/BIOS/func/E820_memory_map.nasm | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/BIOS/func/E820_memory_map.nasm b/include/BIOS/func/E820_memory_map.nasm index 1d4a3f4..0a7dba9 100644 --- a/include/BIOS/func/E820_memory_map.nasm +++ b/include/BIOS/func/E820_memory_map.nasm @@ -84,6 +84,38 @@ GetMemoryMap: pop es __CDECL16_EXIT ret + +PrintMemoryMap: + __CDECL16_ENTRY +.func: + mov eax, dword [SteviaInfo + SteviaInfoStruct_t.MemoryMapEntries] + cmp eax, 0 + je PrintMemoryMap.endp ; if entries == 0, exit + + mov ecx, eax ; store # of entries in counter + mov eax, BIOSMemoryMap ; address to start of e820 mmap + + push dword ecx + push dword eax + call FormatMemoryMapEntry + add sp, 0x8 + + ; ax contains segment offset to string after call + ; TODO: going to need an allocator for strings and stuff... + ; print_string strformat_buffer +.endp: + __CDECL16_EXIT + ret + +FormatMemoryMapEntry: + __CDECL16_ENTRY +.func: + ; create a string buffer somewhere and return address to result string in ax +.endp: + __CDECL16_EXIT + ret + + %endif %define __INC_E820MEMORY_MAP \ No newline at end of file