Make the Game Blaster's I/O address configurable

This commit is contained in:
Alexander Babikov
2021-08-04 13:46:26 +05:00
parent bfcc36ac8e
commit 9632f99552
4 changed files with 54 additions and 6 deletions

View File

@@ -181,7 +181,8 @@ void *cms_init(const device_t *info)
cms_t *cms = malloc(sizeof(cms_t));
memset(cms, 0, sizeof(cms_t));
io_sethandler(0x0220, 0x0010, cms_read, NULL, NULL, cms_write, NULL, NULL, cms);
uint16_t addr = device_get_config_hex16("base");
io_sethandler(addr, 0x0010, cms_read, NULL, NULL, cms_write, NULL, NULL, cms);
sound_add_handler(cms_get_buffer, cms);
return cms;
}
@@ -193,11 +194,44 @@ void cms_close(void *p)
free(cms);
}
static const device_config_t cms_config[] =
{
{
"base", "Address", CONFIG_HEX16, "", 0x220, "", { 0 },
{
{
"0x210", 0x210
},
{
"0x220", 0x220
},
{
"0x230", 0x230
},
{
"0x240", 0x240
},
{
"0x250", 0x250
},
{
"0x260", 0x260
},
{
""
}
}
},
{
"", "", -1
}
};
const device_t cms_device =
{
"Creative Music System / Game Blaster",
0, 0,
cms_init, cms_close, NULL,
{ NULL }, NULL, NULL,
NULL
cms_config
};