From db34cc06b95cf08cfdffcdac6e7e99f6bd3814b8 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 24 Nov 2024 00:53:09 -0500 Subject: [PATCH 1/2] Deal with many magic numbers in gameport.c --- src/game/gameport.c | 28 ++++++++++++++-------------- src/include/86box/gameport.h | 3 +++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index 58d9a446f..4c7b4c74b 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -468,7 +468,7 @@ const device_t gameport_device = { .name = "Game port", .internal_name = "gameport", .flags = 0, - .local = 0x080200, + .local = GAMEPORT_8ADDR | 0x0200, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -482,7 +482,7 @@ const device_t gameport_201_device = { .name = "Game port (Port 201h only)", .internal_name = "gameport_201", .flags = 0, - .local = 0x010201, + .local = GAMEPORT_1ADDR | 0x0201, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -496,7 +496,7 @@ const device_t gameport_203_device = { .name = "Game port (Port 203h only)", .internal_name = "gameport_203", .flags = 0, - .local = 0x010203, + .local = GAMEPORT_1ADDR | 0x0203, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -510,7 +510,7 @@ const device_t gameport_205_device = { .name = "Game port (Port 205h only)", .internal_name = "gameport_205", .flags = 0, - .local = 0x010205, + .local = GAMEPORT_1ADDR | 0x0205, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -524,7 +524,7 @@ const device_t gameport_207_device = { .name = "Game port (Port 207h only)", .internal_name = "gameport_207", .flags = 0, - .local = 0x010207, + .local = GAMEPORT_1ADDR | 0x0207, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -538,7 +538,7 @@ const device_t gameport_208_device = { .name = "Game port (Port 208h-20fh)", .internal_name = "gameport_208", .flags = 0, - .local = 0x080208, + .local = GAMEPORT_8ADDR | 0x0208, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -552,7 +552,7 @@ const device_t gameport_209_device = { .name = "Game port (Port 209h only)", .internal_name = "gameport_209", .flags = 0, - .local = 0x010209, + .local = GAMEPORT_1ADDR | 0x0209, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -566,7 +566,7 @@ const device_t gameport_20b_device = { .name = "Game port (Port 20Bh only)", .internal_name = "gameport_20b", .flags = 0, - .local = 0x01020B, + .local = GAMEPORT_1ADDR | 0x020B, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -580,7 +580,7 @@ const device_t gameport_20d_device = { .name = "Game port (Port 20Dh only)", .internal_name = "gameport_20d", .flags = 0, - .local = 0x01020D, + .local = GAMEPORT_1ADDR | 0x020D, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -594,7 +594,7 @@ const device_t gameport_20f_device = { .name = "Game port (Port 20Fh only)", .internal_name = "gameport_20f", .flags = 0, - .local = 0x01020F, + .local = GAMEPORT_1ADDR | 0x020F, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -662,7 +662,7 @@ const device_t gameport_pnp_device = { .name = "Game port (Plug and Play only)", .internal_name = "gameport_pnp", .flags = 0, - .local = 0x080000, + .local = GAMEPORT_8ADDR, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -676,7 +676,7 @@ const device_t gameport_pnp_6io_device = { .name = "Game port (Plug and Play only, 6 I/O ports)", .internal_name = "gameport_pnp_6io", .flags = 0, - .local = 0x060000, + .local = GAMEPORT_6ADDR, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -690,7 +690,7 @@ const device_t gameport_sio_device = { .name = "Game port (Super I/O)", .internal_name = "gameport_sio", .flags = 0, - .local = 0x1080000, + .local = GAMEPORT_SIO | GAMEPORT_8ADDR, .init = gameport_init, .close = gameport_close, .reset = NULL, @@ -704,7 +704,7 @@ const device_t gameport_sio_1io_device = { .name = "Game port (Super I/O, 1 I/O port)", .internal_name = "gameport_sio", .flags = 0, - .local = 0x1010000, + .local = GAMEPORT_SIO | GAMEPORT_1ADDR, .init = gameport_init, .close = gameport_close, .reset = NULL, diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index d9c702394..0dcb5a805 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -45,6 +45,9 @@ #define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0) +#define GAMEPORT_1ADDR 0x010000 +#define GAMEPORT_6ADDR 0x060000 +#define GAMEPORT_8ADDR 0x080000 #define GAMEPORT_SIO 0x1000000 typedef struct plat_joystick_t { From 53c6c9660c0878eac33672d85295350c2fd76710 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sat, 30 Nov 2024 15:33:29 -0500 Subject: [PATCH 2/2] Update gameport copyright --- src/game/gameport.c | 4 +++- src/include/86box/gameport.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index 4c7b4c74b..e7495e365 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -13,10 +13,12 @@ * Authors: Miran Grca, * Sarah Walker, * RichardG, + * Jasmine Iwanek, * - * Copyright 2016-2018 Miran Grca. + * Copyright 2016-2022 Miran Grca. * Copyright 2008-2018 Sarah Walker. * Copyright 2021 RichardG. + * Copyright 2021-2024 Jasmine Iwanek. */ #include #include diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index 0dcb5a805..576d6b8e7 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -13,10 +13,12 @@ * Authors: Miran Grca, * Sarah Walker, * RichardG, + * Jasmine Iwanek, * - * Copyright 2016-2018 Miran Grca. + * Copyright 2016-2022 Miran Grca. * Copyright 2008-2018 Sarah Walker. * Copyright 2021 RichardG. + * Copyright 2021-2024 Jasmine Iwanek. */ #ifndef EMU_GAMEPORT_H #define EMU_GAMEPORT_H