Skip to content

Shell memory layout

sy2002 edited this page Jun 6, 2023 · 4 revisions

Since QNICE does not offer a dynamic memory management system, the Shell uses a hard-coded memory layout to perform its duties. This memory layout seeks a balance between three conflictive goals:

  1. When browsing for files (such as games, programs, ROMs, cartridges, etc.): Display as many files and subfolders within a given folder as possible. The memory is needed for displaying the directory entries in an alphabetically ordered fashion.
  2. When browsing through deeply structured libraries of files, make sure that the file browser remembers all the subfolders so that as soon as you start to "climb up" the directory-tree again (i.e. leave a subdirectory) the file-browser continues where you left off.
  3. Have an On Screen Menu with as many menu items and sub-menus as possible.

You can configure the memory layout in m2m-rom.asm. Go to the section that is called Heap and Stack and locate the following constants:

MENU_HEAP_SIZE
HEAP_SIZE
STACK_SIZE
B_STACK_SIZE

Example log from the "C64 for MEGA65" core version 5:

Maximum available QNICE memory: 31994
  Used as general heap:         28544
  Used as menu heap:            1664
  Used as stack:                1536
    Used as general stack:      768
    Used as browser stack:      768
  Free QNICE memory:            250
Free space in QNICE ROM:        5631
OSM heap utilization:
  MENU_HEAP_SIZE:               1664
  Free menu heap space:         260
  OPTM_HEAP_SIZE:               260
  Free OPTM heap space:         17