Alternate font support for MDA and Hercules

This commit is contained in:
Jasmine Iwanek
2025-05-26 04:38:28 -04:00
parent 09e107e008
commit 8e895903ed
7 changed files with 176 additions and 98 deletions

View File

@@ -543,14 +543,33 @@ hercules_init(UNUSED(const device_t *info))
dev->vram = (uint8_t *) malloc(0x10000);
switch(device_get_config_int("font")) {
case 0:
loadfont(FONT_IBM_MDA_437_PATH, 0);
break;
case 1:
loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0);
break;
case 2:
loadfont(FONT_KAM_PATH, 0);
break;
case 3:
loadfont(FONT_KAMCL16_PATH, 0);
break;
}
timer_add(&dev->timer, hercules_poll, dev, 1);
mem_mapping_add(&dev->mapping, 0xb0000, 0x08000,
hercules_read, NULL, NULL, hercules_write, NULL, NULL,
NULL /*dev->vram*/, MEM_MAPPING_EXTERNAL, dev);
hercules_read, NULL, NULL,
hercules_write, NULL, NULL,
NULL /*dev->vram*/, MEM_MAPPING_EXTERNAL,
dev);
io_sethandler(0x03b0, 16,
hercules_in, NULL, NULL, hercules_out, NULL, NULL, dev);
io_sethandler(0x03b0, 0x0010,
hercules_in, NULL, NULL,
hercules_out, NULL, NULL,
dev);
for (uint16_t c = 0; c < 256; c++) {
dev->cols[c][0][0] = dev->cols[c][1][0] = dev->cols[c][1][1] = 16;
@@ -642,6 +661,23 @@ static const device_config_t hercules_config[] = {
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "font",
.description = "Font",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "US (CP 437)", .value = 0 },
{ .description = "IBM Nordic (CP 437-Nordic)", .value = 1 },
{ .description = "Czech Kamenicky (CP 895) #1", .value = 2 },
{ .description = "Czech Kamenicky (CP 895) #2", .value = 3 },
{ .description = "" }
},
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};