Skip to content

Commit

Permalink
MEGA65: allow pre-init Attic RAM content
Browse files Browse the repository at this point in the history
Allow Attic RAM to be pre-inited from the content of a file, given by
the CLI option "-initattic FILENAME".

Idea from @ki-bo on Discord

Also can be part of #238 ... though that issue has bigger scope.
  • Loading branch information
lgblgblgb committed Sep 15, 2024
1 parent 7c88427 commit efcf16d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion targets/mega65/configdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static const struct xemutools_configdef_str_st str_options[] = {
{ "importbas", NULL, "Import and RUN BASIC65 program from TEXT file", &configdb.importbas },
{ "cartbin8000",NULL, "Load binary cartridge image from $8000", &configdb.cartbin8000 },
{ "winpos", NULL, "Window position: x,y (integers)", &configdb.winpos },
{ "initattic", NULL, "Pre-fill the Attic RAM with the content of a file", &configdb.init_attic },
{ NULL }
};

Expand Down Expand Up @@ -153,7 +154,7 @@ static const void *do_not_save_opts[] = {
&configdb.matrixstart,
&configdb.dumpmem, &configdb.dumpscreen, &configdb.screenshot_and_exit,
&configdb.testing, &configdb.hyperdebug, &configdb.hyperdebugfreezer, &configdb.usestubrom, &configdb.useinitrom, &configdb.useutilmenu,
&configdb.cartbin8000, &configdb.winpos, &configdb.ramcheckread,
&configdb.cartbin8000, &configdb.winpos, &configdb.ramcheckread, &configdb.init_attic,
NULL
};

Expand Down
1 change: 1 addition & 0 deletions targets/mega65/configdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ struct configdb_st {
int matrixdisable;
char *winpos;
int ramcheckread;
char *init_attic;
};

extern struct configdb_st configdb;
Expand Down
2 changes: 2 additions & 0 deletions targets/mega65/mega65.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ static void mega65_init ( void )
}
// Fill memory with the needed pre-initialized regions to be able to start.
preinit_memory_for_start();
if (configdb.init_attic)
xemu_load_file(configdb.init_attic, attic_ram, 1, 8 << 20, "Cannot initialize Attic RAM from a file");
// *** Image file for SDCARD support, and other related init functions handled there as well (eg d81access, fdc init ... related registers, etc)
if (sdcard_init(configdb.sdimg,
#ifndef XEMU_ARCH_HTML
Expand Down

0 comments on commit efcf16d

Please sign in to comment.