sy2002 / MiSTer2MEGA65

Framework to simplify porting MiSTer (and other) cores to the MEGA65
GNU General Public License v3.0
34 stars 8 forks source link

Users should not need to change the framework's code in "edge cases" of VDRIVES, CRT/ROM loading #8

Closed sy2002 closed 1 year ago

sy2002 commented 1 year ago

It is a balancing act of being able to show directories with rather more than less files in them in the Shell's FileBrowser (i.e. maximizing the size of HEAP in m2m-asm.asm) and providing meaningful default values for the maximum amount of VDRIVES (VDRIVES_MAX), the maximum amount of manually loadable CRTs/ROMs in the OSM (CRTROM_MAN_MAX) and the maximum amount of automatically loaded ROMs (CRTROM_AUT_MAX) since the latter three maximum values lead to a certain amount of overhead that significantly eats into the free HEAP space.

Even though the user of our M2M framework can configure the amount of actually used VDRIVES, manually loadable CRTs/ROMs and automatically loaded ROMs in globals.vhd, the user currently needs to touch framework code in case of any of these amounts is larger than 3 as described in the comments in globals.vhd:

constant C_VDNUM              : natural := 3;  -- amount of virtual drives; if more than 3: also adjust VDRIVES_MAX in M2M/rom/shell_vars.asm, maximum is 15
...
constant C_CRTROMS_MAN_NUM       : natural := 0;  -- amount of manually loadable ROMs and carts, if more than 3: also adjust CRTROM_MAN_MAX in M2M/rom/shell_vars.asm, Needs to be in sync with config.vhd. Maximum is 16
...
constant C_CRTROMS_AUTO_NUM      : natural := 0;  -- Amount of automatically loadable ROMs and carts, if more than 3: also adjust CRTROM_MAN_MAX in M2M/rom/shell_vars.asm, Needs to be in sync with config.vhd. Maximum is 16

In the case of VDRIVES and manually loadable ROMs/CRTs, the M2M framework user currently needs to touch two spots in shell_vars.asm and one spot in shell.asm and in the case of automatically loading ROMs the user needs to touch one spot in shell_vars.asm.

This is complicated and error prone and it goes against the M2M framework's philosophy that M2M framework users are not supposed to touch the actual framework in the M2M folder but only work in "their" CORE folder.

Here is how we can fix this:

  1. Move the appropriate settings (.EQU constants) from shell_vars.asm to CORE/m2m-rom/m2m-rom.asm)

  2. Enhance our framework's ROM build script CORE/m2m-rom/make_rom.sh such that the script parses m2m-rom.asm and then dynamically generates include files that contain everything that the M2M framework needs depending on the settings in m2m-rom.asm.

  3. These include files are then included in shell_vars.asm and in shell.asm.

  4. We then also need to adjust the hints in strings.asm and the comments in globals.vhd

This empowers the M2M framework's users to configure the above-mentioned "balancing act" by changing constants in m2m-rom.asm i.e. in "their space" without touching any framework code.

sy2002 commented 1 year ago

Done: Originally programmed it in the C64 core and then merged to M2M.