From c798a6849bcaee752c24f01152f15bd5de5c5f93 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 19:53:25 -0500 Subject: [PATCH 01/16] Stubs for 16650-16950 UARTs --- src/device/serial.c | 36 ++++++++++++++++++++++++++++++++++++ src/include/86box/serial.h | 11 ++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/device/serial.c b/src/device/serial.c index 15527fad4..7f93edb53 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -757,3 +757,39 @@ const device_t ns16550_device = { { NULL }, serial_speed_changed, NULL, NULL }; + +const device_t ns16650_device = { + "Startech Semiconductor 16650(-compatible) UART", + 0, + SERIAL_16650, + serial_init, serial_close, NULL, + { NULL }, serial_speed_changed, NULL, + NULL +}; + +const device_t ns16750_device = { + "Texas Instruments 16750(-compatible) UART", + 0, + SERIAL_16750, + serial_init, serial_close, NULL, + { NULL }, serial_speed_changed, NULL, + NULL +}; + +const device_t ns16850_device = { + "Exar Corporation NS16850(-compatible) UART", + 0, + SERIAL_16850, + serial_init, serial_close, NULL, + { NULL }, serial_speed_changed, NULL, + NULL +}; + +const device_t ns16950_device = { + "Oxford Semiconductor NS16950(-compatible) UART", + 0, + SERIAL_16950, + serial_init, serial_close, NULL, + { NULL }, serial_speed_changed, NULL, + NULL +}; diff --git a/src/include/86box/serial.h b/src/include/86box/serial.h index 576c0c12e..25512f2c8 100644 --- a/src/include/86box/serial.h +++ b/src/include/86box/serial.h @@ -6,7 +6,8 @@ * * This file is part of the 86Box distribution. * - * Definitions for the NS8250/16450/16550 UART emulation. + * Definitions for the NS8250/16450/16550/16650/16750/16850/16950 + * UART emulation. * * * @@ -26,6 +27,10 @@ #define SERIAL_8250_PCJR 1 #define SERIAL_NS16450 2 #define SERIAL_NS16550 3 +#define SERIAL_16650 4 +#define SERIAL_16750 5 +#define SERIAL_16850 6 +#define SERIAL_16950 7 #define SERIAL_FIFO_SIZE 16 @@ -93,6 +98,10 @@ extern const device_t i8250_device; extern const device_t i8250_pcjr_device; extern const device_t ns16450_device; extern const device_t ns16550_device; +extern const device_t ns16650_device; +extern const device_t ns16750_device; +extern const device_t ns16850_device; +extern const device_t ns16950_device; #endif /*EMU_SERIAL_H*/ From 9d1898e9f354c7a148682a7a12cafd5926c1133f Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 19:54:02 -0500 Subject: [PATCH 02/16] Fix a prior derp cleanly --- src/include/86box/serial.h | 2 -- src/machine/m_pcjr.c | 2 +- src/machine/m_xt_zenith.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/include/86box/serial.h b/src/include/86box/serial.h index 25512f2c8..a8009f5f9 100644 --- a/src/include/86box/serial.h +++ b/src/include/86box/serial.h @@ -44,8 +44,6 @@ #define SERIAL4_ADDR 0x02e8 #define SERIAL4_IRQ 3 -#define MAX_SERIAL 4 - struct serial_device_s; struct serial_s; diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index 482c26ed6..a29d23f0c 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -867,7 +867,7 @@ machine_pcjr_init(const machine_t *model) device_add(&fdc_pcjr_device); device_add(&i8250_pcjr_device); - serial_set_next_inst(MAX_SERIAL); /* So that serial_standalone_init() won't do anything. */ + serial_set_next_inst(SERIAL_MAX); /* So that serial_standalone_init() won't do anything. */ return ret; } diff --git a/src/machine/m_xt_zenith.c b/src/machine/m_xt_zenith.c index 791ebdcd1..7dc211bf7 100644 --- a/src/machine/m_xt_zenith.c +++ b/src/machine/m_xt_zenith.c @@ -154,7 +154,7 @@ machine_xt_z184_init(const machine_t *model) lpt2_remove(); lpt1_init(0x278); device_add(&i8250_device); - serial_set_next_inst(MAX_SERIAL); /* So that serial_standalone_init() won't do anything. */ + serial_set_next_inst(SERIAL_MAX); /* So that serial_standalone_init() won't do anything. */ device_add(&cga_device); From 85eaaf9d2d120d9c0a4a67cdbe510f9ff2abe9d0 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 19:54:23 -0500 Subject: [PATCH 03/16] Default UART to 16550 --- src/device/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/serial.c b/src/device/serial.c index 7f93edb53..0186a997f 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -718,7 +718,7 @@ serial_set_next_inst(int ni) void serial_standalone_init(void) { for ( ; next_inst < 4; ) - device_add_inst(&i8250_device, next_inst + 1); + device_add_inst(&ns16550_device, next_inst + 1); }; From 89726bc1555844fffa7d8af36a7aaccaceb4e7a5 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 19:54:54 -0500 Subject: [PATCH 04/16] XT UART to 8250 --- src/machine/m_xt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index 1e4e7bd39..bd0f8dac0 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -8,6 +8,7 @@ #include <86box/pit.h> #include <86box/mem.h> #include <86box/device.h> +#include <86box/serial.h> #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/fdc_ext.h> @@ -30,6 +31,10 @@ machine_xt_common_init(const machine_t *model) device_add(&fdc_xt_device); nmi_init(); + + device_add_inst(&i8250_device, 1); + device_add_inst(&i8250_device, 2); + standalone_gameport_type = &gameport_device; } From 8c4cd92490dec1956b4d894995bb14db7946011a Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 19:55:05 -0500 Subject: [PATCH 05/16] AT UART to 16450 --- src/machine/m_at.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/machine/m_at.c b/src/machine/m_at.c index dc47b6207..61f6f4752 100644 --- a/src/machine/m_at.c +++ b/src/machine/m_at.c @@ -47,6 +47,7 @@ #include <86box/dma.h> #include <86box/mem.h> #include <86box/device.h> +#include <86box/serial.h> #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/fdc_ext.h> @@ -79,6 +80,9 @@ machine_at_common_init_ex(const machine_t *model, int type) else if (type == 0) device_add(&at_nvr_device); + device_add_inst(&ns16450_device, 1); + device_add_inst(&ns16450_device, 2); + standalone_gameport_type = &gameport_device; } From 4f8d1a9ede79537a02d72dfc179bf10df061657e Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 20:22:11 -0500 Subject: [PATCH 06/16] Revert "AT UART to 16450" This reverts commit 8c4cd92490dec1956b4d894995bb14db7946011a. --- src/machine/m_at.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/machine/m_at.c b/src/machine/m_at.c index 61f6f4752..dc47b6207 100644 --- a/src/machine/m_at.c +++ b/src/machine/m_at.c @@ -47,7 +47,6 @@ #include <86box/dma.h> #include <86box/mem.h> #include <86box/device.h> -#include <86box/serial.h> #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/fdc_ext.h> @@ -80,9 +79,6 @@ machine_at_common_init_ex(const machine_t *model, int type) else if (type == 0) device_add(&at_nvr_device); - device_add_inst(&ns16450_device, 1); - device_add_inst(&ns16450_device, 2); - standalone_gameport_type = &gameport_device; } From 948624b6f41631203ae0cf6192631cf13b042905 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 19:54:23 -0500 Subject: [PATCH 07/16] Default UART to 16550 --- src/device/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/serial.c b/src/device/serial.c index 7f93edb53..0186a997f 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -718,7 +718,7 @@ serial_set_next_inst(int ni) void serial_standalone_init(void) { for ( ; next_inst < 4; ) - device_add_inst(&i8250_device, next_inst + 1); + device_add_inst(&ns16550_device, next_inst + 1); }; From 149666b54b3b2848a3d31e9fd64501fbafc36ce8 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 21:21:34 -0500 Subject: [PATCH 08/16] Consistency and naming --- src/device/serial.c | 26 +++++++++++++------------- src/include/86box/serial.h | 10 +++++----- src/machine/m_at_commodore.c | 2 +- src/machine/m_pcjr.c | 2 +- src/machine/m_xt_zenith.c | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/device/serial.c b/src/device/serial.c index 0186a997f..a4c0decf6 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -129,7 +129,7 @@ serial_update_ints(serial_t *dev) } if (stat && (dev->irq != 0xff) && ((dev->mctrl & 8) || (dev->type == SERIAL_8250_PCJR))) { - if (dev->type >= SERIAL_NS16450) + if (dev->type >= SERIAL_16450) picintlevel(1 << dev->irq); else picint(1 << dev->irq); @@ -151,9 +151,9 @@ serial_clear_timeout(serial_t *dev) static void write_fifo(serial_t *dev, uint8_t dat) { - serial_log("write_fifo(%08X, %02X, %i, %i)\n", dev, dat, (dev->type >= SERIAL_NS16550) && dev->fifo_enabled, dev->rcvr_fifo_pos & 0x0f); + serial_log("write_fifo(%08X, %02X, %i, %i)\n", dev, dat, (dev->type >= SERIAL_16550) && dev->fifo_enabled, dev->rcvr_fifo_pos & 0x0f); - if ((dev->type >= SERIAL_NS16550) && dev->fifo_enabled) { + if ((dev->type >= SERIAL_16550) && dev->fifo_enabled) { /* FIFO mode. */ timer_disable(&dev->timeout_timer); /* Indicate overrun. */ @@ -189,7 +189,7 @@ write_fifo(serial_t *dev, uint8_t dat) void serial_write_fifo(serial_t *dev, uint8_t dat) { - serial_log("serial_write_fifo(%08X, %02X, %i, %i)\n", dev, dat, (dev->type >= SERIAL_NS16550) && dev->fifo_enabled, dev->rcvr_fifo_pos & 0x0f); + serial_log("serial_write_fifo(%08X, %02X, %i, %i)\n", dev, dat, (dev->type >= SERIAL_16550) && dev->fifo_enabled, dev->rcvr_fifo_pos & 0x0f); if (!(dev->mctrl & 0x10)) write_fifo(dev, dat); @@ -371,7 +371,7 @@ serial_write(uint16_t addr, uint8_t val, void *p) dev->int_status &= ~SERIAL_INT_TRANSMIT; serial_update_ints(dev); - if ((dev->type >= SERIAL_NS16550) && dev->fifo_enabled && (dev->xmit_fifo_pos < 16)) { + if ((dev->type >= SERIAL_16550) && dev->fifo_enabled && (dev->xmit_fifo_pos < 16)) { /* FIFO mode, begin transmitting. */ timer_on_auto(&dev->transmit_timer, dev->transmit_period); dev->transmit_enabled |= 1; /* Start moving. */ @@ -396,7 +396,7 @@ serial_write(uint16_t addr, uint8_t val, void *p) serial_update_ints(dev); break; case 2: - if (dev->type >= SERIAL_NS16550) { + if (dev->type >= SERIAL_16550) { if ((val ^ dev->fcr) & 0x01) serial_reset_fifo(dev); dev->fcr = val & 0xf9; @@ -500,7 +500,7 @@ serial_write(uint16_t addr, uint8_t val, void *p) serial_update_ints(dev); break; case 7: - if (dev->type >= SERIAL_NS16450) + if (dev->type >= SERIAL_16450) dev->scratch = val; break; } @@ -522,7 +522,7 @@ serial_read(uint16_t addr, void *p) break; } - if ((dev->type >= SERIAL_NS16550) && dev->fifo_enabled) { + if ((dev->type >= SERIAL_16550) && dev->fifo_enabled) { /* FIFO mode. */ serial_clear_timeout(dev); @@ -722,8 +722,8 @@ serial_standalone_init(void) { }; -const device_t i8250_device = { - "Intel 8250(-compatible) UART", +const device_t ns8250_device = { + "National Semiconductor 8250(-compatible) UART", 0, SERIAL_8250, serial_init, serial_close, NULL, @@ -732,7 +732,7 @@ const device_t i8250_device = { }; const device_t i8250_pcjr_device = { - "Intel 8250(-compatible) UART for PCjr", + "National Semiconductor 8250(-compatible) UART for PCjr", DEVICE_PCJR, SERIAL_8250_PCJR, serial_init, serial_close, NULL, @@ -743,7 +743,7 @@ const device_t i8250_pcjr_device = { const device_t ns16450_device = { "National Semiconductor NS16450(-compatible) UART", 0, - SERIAL_NS16450, + SERIAL_16450, serial_init, serial_close, NULL, { NULL }, serial_speed_changed, NULL, NULL @@ -752,7 +752,7 @@ const device_t ns16450_device = { const device_t ns16550_device = { "National Semiconductor NS16550(-compatible) UART", 0, - SERIAL_NS16550, + SERIAL_16550, serial_init, serial_close, NULL, { NULL }, serial_speed_changed, NULL, NULL diff --git a/src/include/86box/serial.h b/src/include/86box/serial.h index a8009f5f9..5203c17f8 100644 --- a/src/include/86box/serial.h +++ b/src/include/86box/serial.h @@ -23,10 +23,10 @@ # define EMU_SERIAL_H -#define SERIAL_8250 0 +#define SERIAL_8250 0 #define SERIAL_8250_PCJR 1 -#define SERIAL_NS16450 2 -#define SERIAL_NS16550 3 +#define SERIAL_16450 2 +#define SERIAL_16550 3 #define SERIAL_16650 4 #define SERIAL_16750 5 #define SERIAL_16850 6 @@ -92,8 +92,8 @@ extern void serial_standalone_init(void); extern void serial_set_clock_src(serial_t *dev, double clock_src); extern void serial_reset_port(serial_t *dev); -extern const device_t i8250_device; -extern const device_t i8250_pcjr_device; +extern const device_t ns8250_device; +extern const device_t ns8250_pcjr_device; extern const device_t ns16450_device; extern const device_t ns16550_device; extern const device_t ns16650_device; diff --git a/src/machine/m_at_commodore.c b/src/machine/m_at_commodore.c index 7d00e51bb..8aa75059f 100644 --- a/src/machine/m_at_commodore.c +++ b/src/machine/m_at_commodore.c @@ -112,7 +112,7 @@ machine_at_cmdpc_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); - cmd_uart = device_add(&i8250_device); + cmd_uart = device_add(&ns8250_device); cbm_io_init(); diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index a29d23f0c..80c982bee 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -866,7 +866,7 @@ machine_pcjr_init(const machine_t *model) device_add(&fdc_pcjr_device); - device_add(&i8250_pcjr_device); + device_add(&ns8250_pcjr_device); serial_set_next_inst(SERIAL_MAX); /* So that serial_standalone_init() won't do anything. */ return ret; diff --git a/src/machine/m_xt_zenith.c b/src/machine/m_xt_zenith.c index 7dc211bf7..f820bfd2e 100644 --- a/src/machine/m_xt_zenith.c +++ b/src/machine/m_xt_zenith.c @@ -153,7 +153,7 @@ machine_xt_z184_init(const machine_t *model) lpt1_remove(); /* only one parallel port */ lpt2_remove(); lpt1_init(0x278); - device_add(&i8250_device); + device_add(&ns8250_device); serial_set_next_inst(SERIAL_MAX); /* So that serial_standalone_init() won't do anything. */ device_add(&cga_device); From b80de956b35e7598dd35ad7569bf68266a05685a Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 21:21:55 -0500 Subject: [PATCH 09/16] Revert "Merge branch 'uart' of https://github.com/jriwanek-forks/86Box into uart" This reverts commit 3eb3f0eb1e7169bebdc50e97369f502514e27001, reversing changes made to 149666b54b3b2848a3d31e9fd64501fbafc36ce8. --- src/machine/m_xt.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index bd0f8dac0..1e4e7bd39 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -8,7 +8,6 @@ #include <86box/pit.h> #include <86box/mem.h> #include <86box/device.h> -#include <86box/serial.h> #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/fdc_ext.h> @@ -31,10 +30,6 @@ machine_xt_common_init(const machine_t *model) device_add(&fdc_xt_device); nmi_init(); - - device_add_inst(&i8250_device, 1); - device_add_inst(&i8250_device, 2); - standalone_gameport_type = &gameport_device; } From 70056c9ed01c546f40cacabe091749c228ef9e20 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 21:22:38 -0500 Subject: [PATCH 10/16] Revert "Default UART to 16550" This reverts commit 85eaaf9d2d120d9c0a4a67cdbe510f9ff2abe9d0. --- src/device/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/serial.c b/src/device/serial.c index a4c0decf6..5d1c422af 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -718,7 +718,7 @@ serial_set_next_inst(int ni) void serial_standalone_init(void) { for ( ; next_inst < 4; ) - device_add_inst(&ns16550_device, next_inst + 1); + device_add_inst(&i8250_device, next_inst + 1); }; From 055c0ecd6949f4e048ae8809e3a1f14c8b70e6e6 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 21:30:24 -0500 Subject: [PATCH 11/16] Mistake --- src/device/serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/device/serial.c b/src/device/serial.c index 5d1c422af..d9178e566 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -718,7 +718,7 @@ serial_set_next_inst(int ni) void serial_standalone_init(void) { for ( ; next_inst < 4; ) - device_add_inst(&i8250_device, next_inst + 1); + device_add_inst(&ns8250_device, next_inst + 1); }; @@ -731,7 +731,7 @@ const device_t ns8250_device = { NULL }; -const device_t i8250_pcjr_device = { +const device_t ns8250_pcjr_device = { "National Semiconductor 8250(-compatible) UART for PCjr", DEVICE_PCJR, SERIAL_8250_PCJR, From 6fa603839e7678506a670be7e32a1f85f06a784d Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 19 Dec 2021 22:44:24 -0500 Subject: [PATCH 12/16] Add support for a joystick port at 0x209 --- src/game/gameport.c | 11 ++++++++++- src/include/86box/gameport.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index 32fa572e6..145262278 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -446,7 +446,7 @@ const device_t gameport_device = { }; const device_t gameport_201_device = { - "Game port (port 201h only)", + "Game port (Port 201h only)", 0, 0x010201, gameport_init, gameport_close, @@ -463,6 +463,15 @@ const device_t gameport_208_device = { NULL }; +const device_t gameport_209_device = { + "Game port (Port 209h only)", + 0, 0x010209, + gameport_init, + gameport_close, + NULL, { NULL }, NULL, + NULL +}; + const device_t gameport_pnp_device = { "Game port (Plug and Play only)", 0, 0x080000, diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index 486939af9..49a6980de 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -109,6 +109,7 @@ extern "C" { extern const device_t gameport_device; extern const device_t gameport_201_device; extern const device_t gameport_208_device; +extern const device_t gameport_209_device; extern const device_t gameport_pnp_device; extern const device_t gameport_pnp_6io_device; extern const device_t gameport_sio_device; From 7a2d7f4eef56c3667cfed31fdfdb3f72fb5a3e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 20 Dec 2021 21:21:23 +0100 Subject: [PATCH 13/16] Add a EditorConfig rule for .cmake files --- .editorconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.editorconfig b/.editorconfig index 8c5c392e5..047c9d67c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -28,3 +28,7 @@ indent_size = 2 [**/CMakeLists.txt] indent_style = space indent_size = 4 + +[*.cmake] +indent_style = space +indent_size = 4 From 3f576ce6cab525e555cbda55221f7714a25d9e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 20 Dec 2021 21:23:54 +0100 Subject: [PATCH 14/16] Allow overriding the toolchain flags --- cmake/flags-gcc-arm64.cmake | 4 ++-- cmake/flags-gcc-armv7.cmake | 4 ++-- cmake/flags-gcc-i686.cmake | 4 ++-- cmake/flags-gcc-x86_64.cmake | 4 ++-- cmake/flags-gcc.cmake | 16 ++++++++-------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cmake/flags-gcc-arm64.cmake b/cmake/flags-gcc-arm64.cmake index 9aa21f4a6..3a0778230 100644 --- a/cmake/flags-gcc-arm64.cmake +++ b/cmake/flags-gcc-arm64.cmake @@ -1,4 +1,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) -set(CMAKE_C_FLAGS "-march=armv8-a -mfloat-abi=hard ${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "-march=armv8-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS}") \ No newline at end of file +set(CMAKE_C_FLAGS_INIT "-march=armv8-a -mfloat-abi=hard ${CMAKE_C_FLAGS_INIT}") +set(CMAKE_CXX_FLAGS_INIT "-march=armv8-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS_INIT}") \ No newline at end of file diff --git a/cmake/flags-gcc-armv7.cmake b/cmake/flags-gcc-armv7.cmake index c832a389e..9df648f54 100644 --- a/cmake/flags-gcc-armv7.cmake +++ b/cmake/flags-gcc-armv7.cmake @@ -1,4 +1,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) -set(CMAKE_C_FLAGS "-march=armv7-a -mfloat-abi=hard ${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS}") \ No newline at end of file +set(CMAKE_C_FLAGS_INIT "-march=armv7-a -mfloat-abi=hard ${CMAKE_C_FLAGS_INIT}") +set(CMAKE_CXX_FLAGS_INIT "-march=armv7-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS_INIT}") \ No newline at end of file diff --git a/cmake/flags-gcc-i686.cmake b/cmake/flags-gcc-i686.cmake index fd0a7618c..84c8a7b57 100644 --- a/cmake/flags-gcc-i686.cmake +++ b/cmake/flags-gcc-i686.cmake @@ -1,4 +1,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) -set(CMAKE_C_FLAGS "-m32 -march=i686 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "-m32 -march=i686 -msse2 -mfpmath=sse ${CMAKE_CXX_FLAGS}") \ No newline at end of file +set(CMAKE_C_FLAGS_INIT "-m32 -march=i686 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS_INIT}") +set(CMAKE_CXX_FLAGS_INIT "-m32 -march=i686 -msse2 -mfpmath=sse ${CMAKE_CXX_FLAGS_INIT}") \ No newline at end of file diff --git a/cmake/flags-gcc-x86_64.cmake b/cmake/flags-gcc-x86_64.cmake index 1b8385661..5ee305551 100644 --- a/cmake/flags-gcc-x86_64.cmake +++ b/cmake/flags-gcc-x86_64.cmake @@ -1,4 +1,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) -set(CMAKE_C_FLAGS "-m64 -march=x86-64 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "-m64 -march=x86-64 -msse2 -mfpmath=sse ${CMAKE_CXX_FLAGS}") \ No newline at end of file +set(CMAKE_C_FLAGS_INIT "-m64 -march=x86-64 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS_INIT}") +set(CMAKE_CXX_FLAGS_INIT "-m64 -march=x86-64 -msse2 -mfpmath=sse ${CMAKE_CXX_FLAGS_INIT}") \ No newline at end of file diff --git a/cmake/flags-gcc.cmake b/cmake/flags-gcc.cmake index 437b2e39e..bf67340c8 100644 --- a/cmake/flags-gcc.cmake +++ b/cmake/flags-gcc.cmake @@ -1,10 +1,10 @@ set(CMAKE_CONFIGURATION_TYPES Debug;Release;Optimized) -set(CMAKE_C_FLAGS "-fomit-frame-pointer -mstackrealign -Wall -fno-strict-aliasing") -set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS}) -set(CMAKE_C_FLAGS_RELEASE "-g0 -O3") -set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) -set(CMAKE_C_FLAGS_DEBUG "-ggdb -Og") -set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) -set(CMAKE_C_FLAGS_OPTIMIZED "-march=native -mtune=native -O3 -ffp-contract=fast -flto") -set(CMAKE_CXX_FLAGS_OPTIMIZED ${CMAKE_C_FLAGS_OPTIMIZED}) \ No newline at end of file +set(CMAKE_C_FLAGS_INIT "-fomit-frame-pointer -mstackrealign -Wall -fno-strict-aliasing") +set(CMAKE_CXX_FLAGS_INIT ${CMAKE_C_FLAGS_INIT}) +set(CMAKE_C_FLAGS_RELEASE_INIT "-g0 -O3") +set(CMAKE_CXX_FLAGS_RELEASE_INIT ${CMAKE_C_FLAGS_RELEASE_INIT}) +set(CMAKE_C_FLAGS_DEBUG_INIT "-ggdb -Og") +set(CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_C_FLAGS_DEBUG_INIT}) +set(CMAKE_C_FLAGS_OPTIMIZED_INIT "-march=native -mtune=native -O3 -ffp-contract=fast -flto") +set(CMAKE_CXX_FLAGS_OPTIMIZED_INIT ${CMAKE_C_FLAGS_OPTIMIZED_INIT}) \ No newline at end of file From 9e3ad3b79fa5fc0357f8f7b936e324b7d37b023f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 20 Dec 2021 21:54:24 +0100 Subject: [PATCH 15/16] Add comments to the toolchain files --- cmake/flags-gcc-aarch64.cmake | 20 ++++++++++++++++++++ cmake/flags-gcc-arm64.cmake | 4 ---- cmake/flags-gcc-armv7.cmake | 16 ++++++++++++++++ cmake/flags-gcc-i686.cmake | 16 ++++++++++++++++ cmake/flags-gcc-x86_64.cmake | 16 ++++++++++++++++ cmake/flags-gcc.cmake | 17 ++++++++++++++++- cmake/llvm-win32-aarch64.cmake | 30 ++++++++++++++++++++++++++++++ cmake/llvm-win32-arm64.cmake | 10 ---------- cmake/llvm-win32-i686.cmake | 32 ++++++++++++++++++++++++++------ cmake/llvm-win32-x86_64.cmake | 32 ++++++++++++++++++++++++++------ 10 files changed, 166 insertions(+), 27 deletions(-) create mode 100644 cmake/flags-gcc-aarch64.cmake delete mode 100644 cmake/flags-gcc-arm64.cmake create mode 100644 cmake/llvm-win32-aarch64.cmake delete mode 100644 cmake/llvm-win32-arm64.cmake diff --git a/cmake/flags-gcc-aarch64.cmake b/cmake/flags-gcc-aarch64.cmake new file mode 100644 index 000000000..5e37b9c3f --- /dev/null +++ b/cmake/flags-gcc-aarch64.cmake @@ -0,0 +1,20 @@ +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# CMake toolchain file defining GCC compiler flags +# for AArch64 (ARM64) targets. +# +# Authors: David Hrdlička, +# +# Copyright 2021 David Hrdlička. +# + +include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) + +set(CMAKE_C_FLAGS_INIT "-march=armv8-a -mfloat-abi=hard ${CMAKE_C_FLAGS_INIT}") +set(CMAKE_CXX_FLAGS_INIT "-march=armv8-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS_INIT}") \ No newline at end of file diff --git a/cmake/flags-gcc-arm64.cmake b/cmake/flags-gcc-arm64.cmake deleted file mode 100644 index 3a0778230..000000000 --- a/cmake/flags-gcc-arm64.cmake +++ /dev/null @@ -1,4 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) - -set(CMAKE_C_FLAGS_INIT "-march=armv8-a -mfloat-abi=hard ${CMAKE_C_FLAGS_INIT}") -set(CMAKE_CXX_FLAGS_INIT "-march=armv8-a -mfloat-abi=hard ${CMAKE_CXX_FLAGS_INIT}") \ No newline at end of file diff --git a/cmake/flags-gcc-armv7.cmake b/cmake/flags-gcc-armv7.cmake index 9df648f54..4ee436c35 100644 --- a/cmake/flags-gcc-armv7.cmake +++ b/cmake/flags-gcc-armv7.cmake @@ -1,3 +1,19 @@ +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# CMake toolchain file defining GCC compiler flags +# for ARMv7 targets. +# +# Authors: David Hrdlička, +# +# Copyright 2021 David Hrdlička. +# + include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) set(CMAKE_C_FLAGS_INIT "-march=armv7-a -mfloat-abi=hard ${CMAKE_C_FLAGS_INIT}") diff --git a/cmake/flags-gcc-i686.cmake b/cmake/flags-gcc-i686.cmake index 84c8a7b57..9c508f17b 100644 --- a/cmake/flags-gcc-i686.cmake +++ b/cmake/flags-gcc-i686.cmake @@ -1,3 +1,19 @@ +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# CMake toolchain file defining GCC compiler flags +# for 32-bit x86 targets. +# +# Authors: David Hrdlička, +# +# Copyright 2021 David Hrdlička. +# + include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) set(CMAKE_C_FLAGS_INIT "-m32 -march=i686 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS_INIT}") diff --git a/cmake/flags-gcc-x86_64.cmake b/cmake/flags-gcc-x86_64.cmake index 5ee305551..4edd2ec79 100644 --- a/cmake/flags-gcc-x86_64.cmake +++ b/cmake/flags-gcc-x86_64.cmake @@ -1,3 +1,19 @@ +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# CMake toolchain file defining GCC compiler flags +# for 64-bit x86 targets. +# +# Authors: David Hrdlička, +# +# Copyright 2021 David Hrdlička. +# + include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake) set(CMAKE_C_FLAGS_INIT "-m64 -march=x86-64 -msse2 -mfpmath=sse ${CMAKE_C_FLAGS_INIT}") diff --git a/cmake/flags-gcc.cmake b/cmake/flags-gcc.cmake index bf67340c8..bebe58f2a 100644 --- a/cmake/flags-gcc.cmake +++ b/cmake/flags-gcc.cmake @@ -1,4 +1,19 @@ -set(CMAKE_CONFIGURATION_TYPES Debug;Release;Optimized) +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# CMake toolchain file defining GCC compiler flags. +# +# Authors: David Hrdlička, +# +# Copyright 2021 David Hrdlička. +# + +set(CMAKE_CONFIGURATION_TYPES Debug;Release;Optimized) set(CMAKE_C_FLAGS_INIT "-fomit-frame-pointer -mstackrealign -Wall -fno-strict-aliasing") set(CMAKE_CXX_FLAGS_INIT ${CMAKE_C_FLAGS_INIT}) diff --git a/cmake/llvm-win32-aarch64.cmake b/cmake/llvm-win32-aarch64.cmake new file mode 100644 index 000000000..4aacb248f --- /dev/null +++ b/cmake/llvm-win32-aarch64.cmake @@ -0,0 +1,30 @@ +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# CMake toolchain file for Clang on Windows builds (ARM64 target). +# +# Authors: David Hrdlička, +# +# Copyright 2021 David Hrdlička. +# + +include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-aarch64.cmake) + +# Use the GCC-compatible Clang executables in order to use our flags +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) + +# `llvm-rc` is barely usable as of LLVM 13, using MS' rc.exe for now +set(CMAKE_RC_COMPILER rc) + +set(CMAKE_C_COMPILER_TARGET aarch64-pc-windows-msvc) +set(CMAKE_CXX_COMPILER_TARGET aarch64-pc-windows-msvc) + +set(CMAKE_SYSTEM_PROCESSOR ARM64) + +# TODO: set the vcpkg target triplet perhaps? \ No newline at end of file diff --git a/cmake/llvm-win32-arm64.cmake b/cmake/llvm-win32-arm64.cmake deleted file mode 100644 index 1648382c3..000000000 --- a/cmake/llvm-win32-arm64.cmake +++ /dev/null @@ -1,10 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-arm64.cmake) - -set(CMAKE_C_COMPILER clang) -set(CMAKE_CXX_COMPILER clang++) -set(CMAKE_RC_COMPILER rc) - -set(CMAKE_C_COMPILER_TARGET aarch64-pc-windows-msvc) -set(CMAKE_CXX_COMPILER_TARGET aarch64-pc-windows-msvc) - -set(CMAKE_SYSTEM_PROCESSOR ARM64) \ No newline at end of file diff --git a/cmake/llvm-win32-i686.cmake b/cmake/llvm-win32-i686.cmake index c7fec1749..8221f8bc2 100644 --- a/cmake/llvm-win32-i686.cmake +++ b/cmake/llvm-win32-i686.cmake @@ -1,10 +1,30 @@ +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# CMake toolchain file for Clang on Windows builds (x86 target). +# +# Authors: David Hrdlička, +# +# Copyright 2021 David Hrdlička. +# + include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-i686.cmake) -set(CMAKE_C_COMPILER clang) -set(CMAKE_CXX_COMPILER clang++) -set(CMAKE_RC_COMPILER rc) +# Use the GCC-compatible Clang executables in order to use our flags +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) -set(CMAKE_C_COMPILER_TARGET i686-pc-windows-msvc) -set(CMAKE_CXX_COMPILER_TARGET i686-pc-windows-msvc) +# `llvm-rc` is barely usable as of LLVM 13, using MS' rc.exe for now +set(CMAKE_RC_COMPILER rc) -set(CMAKE_SYSTEM_PROCESSOR X86) \ No newline at end of file +set(CMAKE_C_COMPILER_TARGET i686-pc-windows-msvc) +set(CMAKE_CXX_COMPILER_TARGET i686-pc-windows-msvc) + +set(CMAKE_SYSTEM_PROCESSOR X86) + +# TODO: set the vcpkg target triplet perhaps? \ No newline at end of file diff --git a/cmake/llvm-win32-x86_64.cmake b/cmake/llvm-win32-x86_64.cmake index c26940aaa..7caeb7836 100644 --- a/cmake/llvm-win32-x86_64.cmake +++ b/cmake/llvm-win32-x86_64.cmake @@ -1,10 +1,30 @@ +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# CMake toolchain file for Clang on Windows builds (x64/AMD64 target). +# +# Authors: David Hrdlička, +# +# Copyright 2021 David Hrdlička. +# + include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-x86_64.cmake) -set(CMAKE_C_COMPILER clang) -set(CMAKE_CXX_COMPILER clang++) -set(CMAKE_RC_COMPILER rc) +# Use the GCC-compatible Clang executables in order to use our flags +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) -set(CMAKE_C_COMPILER_TARGET x86_64-pc-windows-msvc) -set(CMAKE_CXX_COMPILER_TARGET x86_64-pc-windows-msvc) +# `llvm-rc` is barely usable as of LLVM 13, using MS' rc.exe for now +set(CMAKE_RC_COMPILER rc) -set(CMAKE_SYSTEM_PROCESSOR AMD64) \ No newline at end of file +set(CMAKE_C_COMPILER_TARGET x86_64-pc-windows-msvc) +set(CMAKE_CXX_COMPILER_TARGET x86_64-pc-windows-msvc) + +set(CMAKE_SYSTEM_PROCESSOR AMD64) + +# TODO: set the vcpkg target triplet perhaps? \ No newline at end of file From df985616e0b9786a550c5bb026963802b56b9089 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 20 Dec 2021 23:06:39 +0100 Subject: [PATCH 16/16] Renamed the new variable in the nvr struct. --- src/include/86box/nvr.h | 2 +- src/nvr.c | 4 ++-- src/nvr_at.c | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/include/86box/nvr.h b/src/include/86box/nvr.h index 82bdb01c3..b0157088c 100644 --- a/src/include/86box/nvr.h +++ b/src/include/86box/nvr.h @@ -67,7 +67,7 @@ typedef struct _nvr_ { char *fn; /* pathname of image file */ uint16_t size; /* device configuration */ - int8_t irq, new; + int8_t irq, is_new; uint8_t onesec_cnt; pc_timer_t onesec_time; diff --git a/src/nvr.c b/src/nvr.c index 45b89f306..ee9dcaaca 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -262,7 +262,7 @@ nvr_load(void) path = nvr_path(saved_nvr->fn); nvr_log("NVR: loading from '%s'\n", path); fp = plat_fopen(path, "rb"); - saved_nvr->new = (fp == NULL); + saved_nvr->is_new = (fp == NULL); if (fp != NULL) { /* Read NVR contents from file. */ if (fread(saved_nvr->regs, 1, saved_nvr->size, fp) != saved_nvr->size) @@ -270,7 +270,7 @@ nvr_load(void) (void)fclose(fp); } } else - saved_nvr->new = 1; + saved_nvr->is_new = 1; /* Get the local RTC running! */ if (saved_nvr->start != NULL) diff --git a/src/nvr_at.c b/src/nvr_at.c index cb85cd2d8..5b258a057 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -565,11 +565,11 @@ static void nvr_reg_common_write(uint16_t reg, uint8_t val, nvr_t *nvr, local_t *local) { if ((reg == 0x2c) && (local->flags & FLAG_AMI_1994_HACK)) - nvr->new = 0; + nvr->is_new = 0; if ((reg == 0x2d) && (local->flags & FLAG_AMI_1992_HACK)) - nvr->new = 0; + nvr->is_new = 0; if ((reg == 0x52) && (local->flags & FLAG_AMI_1995_HACK)) - nvr->new = 0; + nvr->is_new = 0; if ((reg >= 0x38) && (reg <= 0x3f) && local->wp[0]) return; if ((reg >= 0xb8) && (reg <= 0xbf) && local->wp[1]) @@ -706,14 +706,14 @@ nvr_read(uint16_t addr, void *priv) break; case 0x2c: - if (!nvr->new && (local->flags & FLAG_AMI_1994_HACK)) + if (!nvr->is_new && (local->flags & FLAG_AMI_1994_HACK)) ret = nvr->regs[local->addr[addr_id]] & 0x7f; else ret = nvr->regs[local->addr[addr_id]]; break; case 0x2d: - if (!nvr->new && (local->flags & FLAG_AMI_1992_HACK)) + if (!nvr->is_new && (local->flags & FLAG_AMI_1992_HACK)) ret = nvr->regs[local->addr[addr_id]] & 0xf7; else ret = nvr->regs[local->addr[addr_id]]; @@ -721,7 +721,7 @@ nvr_read(uint16_t addr, void *priv) case 0x2e: case 0x2f: - if (!nvr->new && (local->flags & FLAG_AMI_1992_HACK)) { + if (!nvr->is_new && (local->flags & FLAG_AMI_1992_HACK)) { for (i = 0x10; i <= 0x2d; i++) { if (i == 0x2d) checksum += (nvr->regs[i] & 0xf7); @@ -732,7 +732,7 @@ nvr_read(uint16_t addr, void *priv) ret = checksum >> 8; else ret = checksum & 0xff; - } else if (!nvr->new && (local->flags & FLAG_AMI_1994_HACK)) { + } else if (!nvr->is_new && (local->flags & FLAG_AMI_1994_HACK)) { for (i = 0x10; i <= 0x2d; i++) { if (i == 0x2c) checksum += (nvr->regs[i] & 0x7f); @@ -749,7 +749,7 @@ nvr_read(uint16_t addr, void *priv) case 0x3e: case 0x3f: - if (!nvr->new && (local->flags & FLAG_AMI_1995_HACK)) { + if (!nvr->is_new && (local->flags & FLAG_AMI_1995_HACK)) { /* The checksum at 3E-3F is for 37-3D and 40-7F. */ for (i = 0x37; i <= 0x3d; i++) checksum += nvr->regs[i]; @@ -763,7 +763,7 @@ nvr_read(uint16_t addr, void *priv) ret = checksum >> 8; else ret = checksum & 0xff; - } else if (!nvr->new && (local->flags & FLAG_P6RP4_HACK)) { + } else if (!nvr->is_new && (local->flags & FLAG_P6RP4_HACK)) { /* The checksum at 3E-3F is for 37-3D and 40-51. */ for (i = 0x37; i <= 0x3d; i++) checksum += nvr->regs[i]; @@ -782,14 +782,14 @@ nvr_read(uint16_t addr, void *priv) break; case 0x43: - if (!nvr->new && (local->flags & FLAG_P6RP4_HACK)) + if (!nvr->is_new && (local->flags & FLAG_P6RP4_HACK)) ret = nvr->regs[local->addr[addr_id]] | 0x02; else ret = nvr->regs[local->addr[addr_id]]; break; case 0x52: - if (!nvr->new && (local->flags & FLAG_AMI_1995_HACK)) + if (!nvr->is_new && (local->flags & FLAG_AMI_1995_HACK)) ret = nvr->regs[local->addr[addr_id]] & 0xf3; else ret = nvr->regs[local->addr[addr_id]];