diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 340d89500..2326a920c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -25,7 +25,7 @@ If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. Windows 10] - - 86Box version: [e.g. v3.00 build 3333; saying "Latest from Jenkins" isn't helpful] + - 86Box version: [e.g. v3.7.1 build 4032; saying "Latest from Jenkins" isn't helpful] - Build information: [i.e. new/old dynarec, architecture and build type] **Additional context** diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 6d13f5b72..8dbd4a4b5 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -52,7 +52,7 @@ jobs: ${{ matrix.environment.prefix }}-libpng ${{ matrix.environment.prefix }}-libvncserver ${{ matrix.environment.prefix }}-rtmidi - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: make run: make -fwin/makefile.mingw -j DEV_BUILD=${{ matrix.dev-build }} NEW_DYNAREC=${{ matrix.new-dynarec }} X64=${{ matrix.environment.x64 }} VNC=n working-directory: ./src diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a1b9b4d5b..ed4bf39ed 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -78,7 +78,7 @@ jobs: ${{ matrix.environment.prefix }}-libvncserver ${{ matrix.environment.prefix }}-openal ${{ matrix.environment.prefix }}-rtmidi - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Configure CMake run: >- cmake -G Ninja -S . -B build --preset ${{ matrix.build.preset }} @@ -90,7 +90,7 @@ jobs: run: cmake --build build - name: Generate package run: cmake --install build - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: '86Box${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-Windows-${{ matrix.environment.msystem }}-gha${{ github.run_number }}' path: build/artifacts/** @@ -146,7 +146,7 @@ jobs: name: ARM64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Prepare VS environment uses: ilammy/msvc-dev-cmd@v1 with: @@ -189,7 +189,7 @@ jobs: run: cmake --build build - name: Generate package run: cmake --install build --prefix ./build/artifacts - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: '86Box${{ matrix.ui.slug }}${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-Windows-LLVM-${{ matrix.target.name }}-gha${{ github.run_number }}' path: build/artifacts/** @@ -218,7 +218,7 @@ jobs: slug: -NDR steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install dependencies run: >- sudo apt update && sudo apt install @@ -241,7 +241,7 @@ jobs: run: cmake --build build # - name: Generate package # run: cmake --install build --prefix ./build/artifacts -# - uses: actions/upload-artifact@v2 +# - uses: actions/upload-artifact@v3 # with: # name: '86Box${{ matrix.build.slug }}-UbuntuJammy-x86_64-gha${{ github.run_number }}' # path: build/artifacts/** @@ -270,7 +270,7 @@ jobs: slug: -NDR steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install dependencies run: brew install freetype sdl2 libpng rtmidi qt@5 openal-soft ninja - name: Configure CMake @@ -285,7 +285,7 @@ jobs: run: cmake --build build - name: Generate package run: cmake --install build --prefix ./build/artifacts - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: '86Box${{ matrix.build.slug }}-macOS-x86_64-gha${{ github.run_number }}' path: build/artifacts/** diff --git a/src/chipset/82c100.c b/src/chipset/82c100.c index fc3441b47..7769ab66b 100644 --- a/src/chipset/82c100.c +++ b/src/chipset/82c100.c @@ -14,11 +14,13 @@ * * Copyright 2021 Miran Grca. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include <86box/device.h> #include "cpu.h" @@ -48,7 +50,7 @@ typedef struct } ct_82c100_t; #ifdef ENABLE_CT_82C100_LOG -int ct_82c100_do_log = ENABLE_CT82C100_LOG; +int ct_82c100_do_log = ENABLE_CT_82C100_LOG; static void ct_82c100_log(const char *fmt, ...) diff --git a/src/chipset/acc2168.c b/src/chipset/acc2168.c index aa3921d71..60cca9327 100644 --- a/src/chipset/acc2168.c +++ b/src/chipset/acc2168.c @@ -40,6 +40,7 @@ #ifdef ENABLE_ACC2168_LOG int acc2168_do_log = ENABLE_ACC2168_LOG; + static void acc2168_log(const char *fmt, ...) { diff --git a/src/chipset/ali1489.c b/src/chipset/ali1489.c index c71b3e46d..e42033a7d 100644 --- a/src/chipset/ali1489.c +++ b/src/chipset/ali1489.c @@ -45,6 +45,7 @@ #ifdef ENABLE_ALI1489_LOG int ali1489_do_log = ENABLE_ALI1489_LOG; + static void ali1489_log(const char *fmt, ...) { diff --git a/src/chipset/ali1531.c b/src/chipset/ali1531.c index bf157953d..438d351e5 100644 --- a/src/chipset/ali1531.c +++ b/src/chipset/ali1531.c @@ -42,6 +42,7 @@ typedef struct ali1531_t { #ifdef ENABLE_ALI1531_LOG int ali1531_do_log = ENABLE_ALI1531_LOG; + static void ali1531_log(const char *fmt, ...) { diff --git a/src/chipset/ali1541.c b/src/chipset/ali1541.c index 4882ba717..7cf6ca166 100644 --- a/src/chipset/ali1541.c +++ b/src/chipset/ali1541.c @@ -40,6 +40,7 @@ typedef struct ali1541_t { #ifdef ENABLE_ALI1541_LOG int ali1541_do_log = ENABLE_ALI1541_LOG; + static void ali1541_log(const char *fmt, ...) { diff --git a/src/chipset/ali1543.c b/src/chipset/ali1543.c index 02910ded8..70ba182e1 100644 --- a/src/chipset/ali1543.c +++ b/src/chipset/ali1543.c @@ -78,6 +78,7 @@ int ali1533_irq_routing[16] = { PCI_IRQ_DISABLED, 9, 3, 10, 4, 5, 7, 6, #ifdef ENABLE_ALI1543_LOG int ali1543_do_log = ENABLE_ALI1543_LOG; + static void ali1543_log(const char *fmt, ...) { diff --git a/src/chipset/ali1621.c b/src/chipset/ali1621.c index 5f5f5883c..3c5ab8cc2 100644 --- a/src/chipset/ali1621.c +++ b/src/chipset/ali1621.c @@ -39,6 +39,7 @@ typedef struct ali1621_t { #ifdef ENABLE_ALI1621_LOG int ali1621_do_log = ENABLE_ALI1621_LOG; + static void ali1621_log(const char *fmt, ...) { diff --git a/src/chipset/cs4031.c b/src/chipset/cs4031.c index 6eddc8cad..9ae80578a 100644 --- a/src/chipset/cs4031.c +++ b/src/chipset/cs4031.c @@ -41,6 +41,7 @@ typedef struct #ifdef ENABLE_CS4031_LOG int cs4031_do_log = ENABLE_CS4031_LOG; + static void cs4031_log(const char *fmt, ...) { diff --git a/src/chipset/et6000.c b/src/chipset/et6000.c index 5aaa5bff9..ab92d6fe6 100644 --- a/src/chipset/et6000.c +++ b/src/chipset/et6000.c @@ -40,6 +40,7 @@ typedef struct #ifdef ENABLE_ET6000_LOG int et6000_do_log = ENABLE_ET6000_LOG; + static void et6000_log(const char *fmt, ...) { diff --git a/src/chipset/intel_420ex.c b/src/chipset/intel_420ex.c index 406aeb48a..e81782c1f 100644 --- a/src/chipset/intel_420ex.c +++ b/src/chipset/intel_420ex.c @@ -13,11 +13,13 @@ * * Copyright 2020 Miran Grca. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/device.h> diff --git a/src/chipset/intel_4x0.c b/src/chipset/intel_4x0.c index 5ed236935..7857f7f06 100644 --- a/src/chipset/intel_4x0.c +++ b/src/chipset/intel_4x0.c @@ -14,11 +14,13 @@ * * Copyright 2019,2020 Miran Grca. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/mem.h> diff --git a/src/chipset/intel_82335.c b/src/chipset/intel_82335.c index 96f0cad2c..14936530b 100644 --- a/src/chipset/intel_82335.c +++ b/src/chipset/intel_82335.c @@ -65,6 +65,7 @@ typedef struct #ifdef ENABLE_INTEL_82335_LOG int intel_82335_do_log = ENABLE_INTEL_82335_LOG; + static void intel_82335_log(const char *fmt, ...) { diff --git a/src/chipset/intel_i450kx.c b/src/chipset/intel_i450kx.c index a6cecf915..3c81ec11a 100644 --- a/src/chipset/intel_i450kx.c +++ b/src/chipset/intel_i450kx.c @@ -40,6 +40,7 @@ i450GX is way more popular of an option but needs more stuff. #ifdef ENABLE_450KX_LOG int i450kx_do_log = ENABLE_450KX_LOG; + static void i450kx_log(const char *fmt, ...) { diff --git a/src/chipset/intel_sio.c b/src/chipset/intel_sio.c index 5e9a001df..d7c3ea073 100644 --- a/src/chipset/intel_sio.c +++ b/src/chipset/intel_sio.c @@ -12,11 +12,13 @@ * * Copyright 2016-2018 Miran Grca. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/device.h> diff --git a/src/chipset/neat.c b/src/chipset/neat.c index 6b4f476fe..87c219f1f 100644 --- a/src/chipset/neat.c +++ b/src/chipset/neat.c @@ -19,11 +19,13 @@ * * Copyright 2018 Fred N. van Kempen. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include <86box/device.h> #include <86box/io.h> diff --git a/src/chipset/olivetti_eva.c b/src/chipset/olivetti_eva.c index b06030508..07b7eab6f 100644 --- a/src/chipset/olivetti_eva.c +++ b/src/chipset/olivetti_eva.c @@ -41,6 +41,7 @@ typedef struct #ifdef ENABLE_OLIVETTI_EVA_LOG int olivetti_eva_do_log = ENABLE_OLIVETTI_EVA_LOG; + static void olivetti_eva_log(const char *fmt, ...) { diff --git a/src/chipset/opti291.c b/src/chipset/opti291.c index 52a2803aa..0aafc538d 100644 --- a/src/chipset/opti291.c +++ b/src/chipset/opti291.c @@ -31,6 +31,7 @@ #ifdef ENABLE_OPTI291_LOG int opti291_do_log = ENABLE_OPTI291_LOG; + static void opti291_log(const char *fmt, ...) { diff --git a/src/chipset/opti822.c b/src/chipset/opti822.c index cdcd2d2f8..ec8ce699e 100644 --- a/src/chipset/opti822.c +++ b/src/chipset/opti822.c @@ -40,6 +40,7 @@ #ifdef ENABLE_OPTI822_LOG int opti822_do_log = ENABLE_OPTI822_LOG; + static void opti822_log(const char *fmt, ...) { diff --git a/src/chipset/sis_5511.c b/src/chipset/sis_5511.c index a4f3f42b1..7f5a22796 100644 --- a/src/chipset/sis_5511.c +++ b/src/chipset/sis_5511.c @@ -49,6 +49,7 @@ #ifdef ENABLE_SIS_5511_LOG int sis_5511_do_log = ENABLE_SIS_5511_LOG; + static void sis_5511_log(const char *fmt, ...) { diff --git a/src/chipset/sis_5571.c b/src/chipset/sis_5571.c index c761e4f85..008ca5423 100644 --- a/src/chipset/sis_5571.c +++ b/src/chipset/sis_5571.c @@ -55,6 +55,7 @@ #ifdef ENABLE_SIS_5571_LOG int sis_5571_do_log = ENABLE_SIS_5571_LOG; + static void sis_5571_log(const char *fmt, ...) { diff --git a/src/chipset/sis_85c50x.c b/src/chipset/sis_85c50x.c index f0209bf90..06552c751 100644 --- a/src/chipset/sis_85c50x.c +++ b/src/chipset/sis_85c50x.c @@ -38,6 +38,7 @@ #ifdef ENABLE_SIS_85C50X_LOG int sis_85c50x_do_log = ENABLE_SIS_85C50X_LOG; + static void sis_85c50x_log(const char *fmt, ...) { diff --git a/src/chipset/via_vt82c49x.c b/src/chipset/via_vt82c49x.c index 2555a688c..7f413bb97 100644 --- a/src/chipset/via_vt82c49x.c +++ b/src/chipset/via_vt82c49x.c @@ -46,6 +46,7 @@ typedef struct #ifdef ENABLE_VT82C49X_LOG int vt82c49x_do_log = ENABLE_VT82C49X_LOG; + static void vt82c49x_log(const char *fmt, ...) { diff --git a/src/chipset/wd76c10.c b/src/chipset/wd76c10.c index c4716e1d8..e0cc171fb 100644 --- a/src/chipset/wd76c10.c +++ b/src/chipset/wd76c10.c @@ -47,6 +47,7 @@ #ifdef ENABLE_WD76C10_LOG int wd76c10_do_log = ENABLE_WD76C10_LOG; + static void wd76c10_log(const char *fmt, ...) { diff --git a/src/device/isartc.c b/src/device/isartc.c index b2f268569..c87a48f11 100644 --- a/src/device/isartc.c +++ b/src/device/isartc.c @@ -64,12 +64,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/timer.h> diff --git a/src/disk/hdc.c b/src/disk/hdc.c index 1df1cd39b..47584d113 100644 --- a/src/disk/hdc.c +++ b/src/disk/hdc.c @@ -49,35 +49,13 @@ hdc_log(const char *fmt, ...) # define hdc_log(fmt, ...) #endif -static void * -nullhdc_init(const device_t *info) -{ - return (NULL); -} - -static void -nullhdc_close(void *priv) -{ -} - -static void * -inthdc_init(const device_t *info) -{ - return (NULL); -} - -static void -inthdc_close(void *priv) -{ -} - static const device_t hdc_none_device = { .name = "None", .internal_name = "none", .flags = 0, .local = 0, - .init = nullhdc_init, - .close = nullhdc_close, + .init = NULL, + .close = NULL, .reset = NULL, { .available = NULL }, .speed_changed = NULL, @@ -90,8 +68,8 @@ static const device_t hdc_internal_device = { .internal_name = "internal", .flags = 0, .local = 0, - .init = inthdc_init, - .close = inthdc_close, + .init = NULL, + .close = NULL, .reset = NULL, { .available = NULL }, .speed_changed = NULL, diff --git a/src/disk/hdc_ide_cmd640.c b/src/disk/hdc_ide_cmd640.c index 4cd323a88..c892bedd6 100644 --- a/src/disk/hdc_ide_cmd640.c +++ b/src/disk/hdc_ide_cmd640.c @@ -51,6 +51,7 @@ static int next_id = 0; #ifdef ENABLE_CMD640_LOG int cmd640_do_log = ENABLE_CMD640_LOG; + static void cmd640_log(const char *fmt, ...) { diff --git a/src/disk/hdc_ide_cmd646.c b/src/disk/hdc_ide_cmd646.c index d03474af5..98deaa459 100644 --- a/src/disk/hdc_ide_cmd646.c +++ b/src/disk/hdc_ide_cmd646.c @@ -49,6 +49,7 @@ typedef struct #ifdef ENABLE_CMD646_LOG int cmd646_do_log = ENABLE_CMD646_LOG; + static void cmd646_log(const char *fmt, ...) { diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index f88971e83..360fee1e6 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -94,6 +94,22 @@ fdc_log(const char *fmt, ...) # define fdc_log(fmt, ...) #endif +/* +const device_t fdc_none_device = { + .name = "None", + .internal_name = "none", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; +*/ + const device_t fdc_internal_device = { .name = "Internal", .internal_name = "internal", @@ -112,9 +128,9 @@ typedef const struct { const device_t *device; } fdc_cards_t; -/* All emulated machines have at least one integrated FDC controller */ static fdc_cards_t fdc_cards[] = { // clang-format off +// { &fdc_none_device }, { &fdc_internal_device }, { &fdc_b215_device }, { &fdc_pii151b_device }, @@ -1224,7 +1240,7 @@ fdc_read(uint16_t addr, void *priv) { fdc_t *fdc = (fdc_t *) priv; uint8_t ret; - int drive; + int drive = 0; cycles -= ISA_CYCLES(8); @@ -2275,7 +2291,11 @@ fdc_reset(void *priv) fdc->max_track = (fdc->flags & FDC_FLAG_MORE_TRACKS) ? 85 : 79; fdc_remove(fdc); - fdc_set_base(fdc, (fdc->flags & FDC_FLAG_PCJR) ? FDC_PRIMARY_PCJR_ADDR : FDC_PRIMARY_ADDR); + if (fdc->flags & FDC_FLAG_SEC) { + fdc_set_base(fdc, FDC_SECONDARY_ADDR); + } else { + fdc_set_base(fdc, (fdc->flags & FDC_FLAG_PCJR) ? FDC_PRIMARY_PCJR_ADDR : FDC_PRIMARY_ADDR); + } current_drive = 0; @@ -2304,10 +2324,15 @@ fdc_init(const device_t *info) fdc->flags = info->local; - fdc->irq = FDC_PRIMARY_IRQ; + if (fdc->flags & FDC_FLAG_SEC) + fdc->irq = FDC_SECONDARY_IRQ; + else + fdc->irq = FDC_PRIMARY_IRQ; if (fdc->flags & FDC_FLAG_PCJR) timer_add(&fdc->watchdog_timer, fdc_watchdog_poll, fdc, 0); + else if (fdc->flags & FDC_FLAG_SEC) + fdc->dma_ch = FDC_SECONDARY_DMA; else fdc->dma_ch = FDC_PRIMARY_DMA; @@ -2347,6 +2372,20 @@ const device_t fdc_xt_device = { .config = NULL }; +const device_t fdc_xt_sec_device = { + .name = "PC/XT Floppy Drive Controller (Secondary)", + .internal_name = "fdc_xt", + .flags = FDC_FLAG_SEC, + .local = 0, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + const device_t fdc_xt_t1x00_device = { .name = "PC/XT Floppy Drive Controller (Toshiba)", .internal_name = "fdc_xt_t1x00", @@ -2417,6 +2456,20 @@ const device_t fdc_at_device = { .config = NULL }; +const device_t fdc_at_sec_device = { + .name = "PC/AT Floppy Drive Controller (Secondary)", + .internal_name = "fdc_at_sec", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_SEC, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + const device_t fdc_at_actlow_device = { .name = "PC/AT Floppy Drive Controller (Active low)", .internal_name = "fdc_at_actlow", diff --git a/src/floppy/fdd_img.c b/src/floppy/fdd_img.c index e0a10a6e1..497f41997 100644 --- a/src/floppy/fdd_img.c +++ b/src/floppy/fdd_img.c @@ -283,11 +283,9 @@ const int gap3_sizes[5][8][48] = { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }; - #ifdef ENABLE_IMG_LOG int img_do_log = ENABLE_IMG_LOG; - static void img_log(const char *fmt, ...) { diff --git a/src/floppy/fdd_td0.c b/src/floppy/fdd_td0.c index b783c507a..e5e253781 100644 --- a/src/floppy/fdd_td0.c +++ b/src/floppy/fdd_td0.c @@ -204,11 +204,9 @@ static const uint8_t d_len[256] = { static td0_t *td0[FDD_NUM]; - #ifdef ENABLE_TD0_LOG int td0_do_log = ENABLE_TD0_LOG; - static void td0_log(const char *fmt, ...) { diff --git a/src/include/86box/fdc.h b/src/include/86box/fdc.h index 6f3328da9..355d19155 100644 --- a/src/include/86box/fdc.h +++ b/src/include/86box/fdc.h @@ -52,6 +52,7 @@ extern int fdc_type; #define FDC_FLAG_AMSTRAD 0x200 /* Non-AT Amstrad machines */ #define FDC_FLAG_UMC 0x400 /* UMC UM8398 */ #define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */ +#define FDC_FLAG_SEC 0x1000 /* Is Secondary */ typedef struct { uint8_t dor, stat, command, processed_cmd, dat, st0, swap, dtl; @@ -185,11 +186,13 @@ extern uint8_t fdc_get_current_drive(void); #ifdef EMU_DEVICE_H extern const device_t fdc_xt_device; +extern const device_t fdc_xt_sec_device; extern const device_t fdc_xt_t1x00_device; extern const device_t fdc_xt_tandy_device; extern const device_t fdc_xt_amstrad_device; extern const device_t fdc_pcjr_device; extern const device_t fdc_at_device; +extern const device_t fdc_at_sec_device; extern const device_t fdc_at_actlow_device; extern const device_t fdc_at_ps1_device; extern const device_t fdc_at_smc_device; diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 04d13270e..cf3a353b1 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -787,6 +787,8 @@ extern int machine_xt_kaypropc_init(const machine_t *); extern int machine_xt_sansx16_init(const machine_t *); extern int machine_xt_bw230_init(const machine_t *); +extern int machine_xt_v20xt_init(const machine_t *); + extern int machine_xt_iskra3104_init(const machine_t *); extern int machine_xt_pravetz16_imko4_init(const machine_t *); diff --git a/src/machine/m_at_286_386sx.c b/src/machine/m_at_286_386sx.c index e30272063..0787fd170 100644 --- a/src/machine/m_at_286_386sx.c +++ b/src/machine/m_at_286_386sx.c @@ -254,10 +254,14 @@ machine_at_micronics386_init(const machine_t *model) } static void -machine_at_scat_init(const machine_t *model, int is_v4) +machine_at_scat_init(const machine_t *model, int is_v4, int is_ami) { machine_at_common_init(model); - device_add(&keyboard_at_ami_device); + + if (is_ami) + device_add(&keyboard_at_ami_device); + else + device_add(&keyboard_at_device); if (is_v4) device_add(&scat_4_device); @@ -289,7 +293,7 @@ machine_at_award286_init(const machine_t *model) if (bios_only || !ret) return ret; - machine_at_scat_init(model, 0); + machine_at_scat_init(model, 0, 1); if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); @@ -308,7 +312,7 @@ machine_at_gdc212m_init(const machine_t *model) if (bios_only || !ret) return ret; - machine_at_scat_init(model, 0); + machine_at_scat_init(model, 0, 1); if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); @@ -331,10 +335,7 @@ machine_at_gw286ct_init(const machine_t *model) device_add(&f82c710_device); - machine_at_common_init(model); - device_add(&keyboard_at_device); - - device_add(&scat_4_device); + machine_at_scat_init(model, 1, 0); device_add(&ide_isa_device); @@ -352,7 +353,7 @@ machine_at_super286tr_init(const machine_t *model) if (bios_only || !ret) return ret; - machine_at_scat_init(model, 0); + machine_at_scat_init(model, 0, 1); if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); @@ -371,7 +372,7 @@ machine_at_spc4200p_init(const machine_t *model) if (bios_only || !ret) return ret; - machine_at_scat_init(model, 0); + machine_at_scat_init(model, 0, 1); if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); @@ -391,7 +392,7 @@ machine_at_spc4216p_init(const machine_t *model) if (bios_only || !ret) return ret; - machine_at_scat_init(model, 1); + machine_at_scat_init(model, 1, 1); if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); @@ -414,7 +415,7 @@ machine_at_spc4620p_init(const machine_t *model) if (gfxcard == VID_INTERNAL) device_add(&ati28800k_spc4620p_device); - machine_at_scat_init(model, 1); + machine_at_scat_init(model, 1, 1); if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); @@ -449,7 +450,7 @@ machine_at_deskmaster286_init(const machine_t *model) if (bios_only || !ret) return ret; - machine_at_scat_init(model, 0); + machine_at_scat_init(model, 0, 1); if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); @@ -720,11 +721,10 @@ machine_at_mr1217_init(const machine_t *model) if (bios_only || !ret) return ret; - machine_at_common_init(model); + machine_at_common_ide_init(model); device_add(&ali1217_device); device_add(&fdc_at_device); - device_add(&ide_isa_device); device_add(&keyboard_ps2_device); return ret; diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index fa7059c88..e36da3208 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -581,3 +581,19 @@ machine_xt_bw230_init(const machine_t *model) return ret; } + +int +machine_xt_v20xt_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/v20xt/V20XTBios.bin", + 0x000fe000, 8192, 0); + + if (bios_only || !ret) + return ret; + + machine_xt_clone_init(model); + + return ret; +} diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 08a8a3c86..4e8a5f7ce 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -1646,6 +1646,42 @@ const machine_t machines[] = { .snd_device = NULL, .net_device = NULL }, + { + .name = "[V20] PC-XT", + .internal_name = "v20xt", + .type = MACHINE_TYPE_8088, + .chipset = MACHINE_CHIPSET_DISCRETE, + .init = machine_xt_v20xt_init, + .pad = 0, + .pad0 = 0, + .pad1 = MACHINE_AVAILABLE, + .pad2 = 0, + .cpu = { + .package = CPU_PKG_8088, + .block = CPU_BLOCK(CPU_8088), + .min_bus = 0, + .max_bus = 0, + .min_voltage = 0, + .max_voltage = 0, + .min_multi = 0, + .max_multi = 0 + }, + .bus_flags = MACHINE_PC, + .flags = MACHINE_FLAGS_NONE, + .ram = { + .min = 64, + .max = 640, + .step = 64 + }, + .nvrmask = 0, + .kbc = KBC_IBM_PC_XT, + .kbc_p1 = 0xff00, + .gpio = 0xffffffff, + .device = NULL, + .vid_device = NULL, + .snd_device = NULL, + .net_device = NULL + }, /* 8086 Machines */ { diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index 1ee1d1276..84b7a5ca8 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -393,7 +393,7 @@ static int pcnetCanReceive(nic_t *dev); int pcnet_do_log = ENABLE_PCNET_LOG; static void -pcnetlog(int lvl, const char *fmt, ...) +pcnet_log(int lvl, const char *fmt, ...) { va_list ap; @@ -404,7 +404,7 @@ pcnetlog(int lvl, const char *fmt, ...) } } #else -# define pcnetlog(lvl, fmt, ...) +# define pcnet_log(lvl, fmt, ...) #endif static void @@ -479,7 +479,7 @@ pcnetTmdLoad(nic_t *dev, TMD *tmd, uint32_t addr, int fRetIfNotOwn) } /* Double check the own bit; guest drivers might be buggy and lock prefixes in the recompiler are ignored by other threads. */ if (tmd->tmd1.own == 1 && !(ownbyte & 0x80)) - pcnetlog(3, "%s: pcnetTmdLoad: own bit flipped while reading!!\n", dev->name); + pcnet_log(3, "%s: pcnetTmdLoad: own bit flipped while reading!!\n", dev->name); if (!(ownbyte & 0x80)) tmd->tmd1.own = 0; @@ -572,7 +572,7 @@ pcnetRmdLoad(nic_t *dev, RMD *rmd, uint32_t addr, int fRetIfNotOwn) } /* Double check the own bit; guest drivers might be buggy and lock prefixes in the recompiler are ignored by other threads. */ if (rmd->rmd1.own == 1 && !(ownbyte & 0x80)) - pcnetlog(3, "%s: pcnetRmdLoad: own bit flipped while reading!!\n", dev->name); + pcnet_log(3, "%s: pcnetRmdLoad: own bit flipped while reading!!\n", dev->name); if (!(ownbyte & 0x80)) rmd->rmd1.own = 0; @@ -755,7 +755,7 @@ padr_match(nic_t *dev, const uint8_t *buf, int size) padr[5] = dev->aCSR[14] >> 8; result = !CSR_DRCVPA(dev) && !memcmp(hdr->ether_dhost, padr, 6); - pcnetlog(3, "%s: packet dhost=%02x:%02x:%02x:%02x:%02x:%02x, " + pcnet_log(3, "%s: packet dhost=%02x:%02x:%02x:%02x:%02x:%02x, " "padr=%02x:%02x:%02x:%02x:%02x:%02x => %d\n", dev->name, hdr->ether_dhost[0], hdr->ether_dhost[1], hdr->ether_dhost[2], @@ -771,7 +771,7 @@ padr_bcast(nic_t *dev, const uint8_t *buf, size_t size) static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; struct ether_header *hdr = (struct ether_header *) buf; int result = !CSR_DRCVBC(dev) && !memcmp(hdr->ether_dhost, aBCAST, 6); - pcnetlog(3, "%s: padr_bcast result=%d\n", dev->name, result); + pcnet_log(3, "%s: padr_bcast result=%d\n", dev->name, result); return result; } @@ -817,7 +817,7 @@ pcnetTdraAddr(nic_t *dev, int idx) static void pcnetSoftReset(nic_t *dev) { - pcnetlog(3, "%s: pcnetSoftReset\n", dev->name); + pcnet_log(3, "%s: pcnetSoftReset\n", dev->name); dev->u32Lnkst = 0x40; dev->GCRDRA = 0; @@ -888,7 +888,7 @@ pcnetUpdateIrq(nic_t *dev) if (dev->aCSR[4] & 0x0080) { /* UINTCMD */ dev->aCSR[4] &= ~0x0080; /* clear UINTCMD */ dev->aCSR[4] |= 0x0040; /* set UINT */ - pcnetlog(2, "%s: user int\n", dev->name); + pcnet_log(2, "%s: user int\n", dev->name); } if (dev->aCSR[4] & csr0 & 0x0040 /* CSR_INEA */) { @@ -906,7 +906,7 @@ pcnetUpdateIrq(nic_t *dev) dev->aCSR[0] = csr0; - pcnetlog(2, "%s: pcnetUpdateIrq: iISR=%d\n", dev->name, iISR); + pcnet_log(2, "%s: pcnetUpdateIrq: iISR=%d\n", dev->name, iISR); pcnet_do_irq(dev, iISR); dev->iISR = iISR; @@ -916,7 +916,7 @@ static void pcnetInit(nic_t *dev) { int i; - pcnetlog(3, "%s: pcnetInit: init_addr=%#010x\n", dev->name, PHYSADDR(dev, CSR_IADR(dev))); + pcnet_log(3, "%s: pcnetInit: init_addr=%#010x\n", dev->name, PHYSADDR(dev, CSR_IADR(dev))); /** @todo Documentation says that RCVRL and XMTRL are stored as two's complement! * Software is allowed to write these registers directly. */ @@ -943,13 +943,13 @@ pcnetInit(nic_t *dev) struct INITBLK32 initblk; dev->GCUpperPhys = 0; PCNET_INIT(); - pcnetlog(3, "%s: initblk.rlen=%#04x, initblk.tlen=%#04x\n", + pcnet_log(3, "%s: initblk.rlen=%#04x, initblk.tlen=%#04x\n", dev->name, initblk.rlen, initblk.tlen); } else { struct INITBLK16 initblk; dev->GCUpperPhys = (0xff00 & (uint32_t) dev->aCSR[2]) << 16; PCNET_INIT(); - pcnetlog(3, "%s: initblk.rlen=%#04x, initblk.tlen=%#04x\n", + pcnet_log(3, "%s: initblk.rlen=%#04x, initblk.tlen=%#04x\n", dev->name, initblk.rlen, initblk.tlen); } @@ -984,15 +984,15 @@ pcnetInit(nic_t *dev) CSR_CRST(dev) = CSR_CRBC(dev) = CSR_NRST(dev) = CSR_NRBC(dev) = 0; CSR_CXST(dev) = CSR_CXBC(dev) = CSR_NXST(dev) = CSR_NXBC(dev) = 0; - pcnetlog(1, "%s: Init: SWSTYLE=%d GCRDRA=%#010x[%d] GCTDRA=%#010x[%d]%s\n", + pcnet_log(1, "%s: Init: SWSTYLE=%d GCRDRA=%#010x[%d] GCTDRA=%#010x[%d]%s\n", dev->name, BCR_SWSTYLE(dev), dev->GCRDRA, CSR_RCVRL(dev), dev->GCTDRA, CSR_XMTRL(dev), !dev->fSignalRxMiss ? " (CSR0_MISS disabled)" : ""); if (dev->GCRDRA & (dev->iLog2DescSize - 1)) - pcnetlog(1, "%s: Warning: Misaligned RDRA\n", dev->name); + pcnet_log(1, "%s: Warning: Misaligned RDRA\n", dev->name); if (dev->GCTDRA & (dev->iLog2DescSize - 1)) - pcnetlog(1, "%s: Warning: Misaligned TDRA\n", dev->name); + pcnet_log(1, "%s: Warning: Misaligned TDRA\n", dev->name); dev->aCSR[0] |= 0x0101; /* Initialization done */ dev->aCSR[0] &= ~0x0004; /* clear STOP bit */ @@ -1004,7 +1004,7 @@ pcnetInit(nic_t *dev) static void pcnetStart(nic_t *dev) { - pcnetlog(3, "%s: pcnetStart: Poll timer\n", dev->name); + pcnet_log(3, "%s: pcnetStart: Poll timer\n", dev->name); /* Reset any cached RX/TX descriptor state. */ CSR_CRDA(dev) = CSR_CRBA(dev) = CSR_NRDA(dev) = CSR_NRBA(dev) = 0; @@ -1025,7 +1025,7 @@ pcnetStart(nic_t *dev) static void pcnetStop(nic_t *dev) { - pcnetlog(3, "%s: pcnetStop: Poll timer\n", dev->name); + pcnet_log(3, "%s: pcnetStop: Poll timer\n", dev->name); dev->aCSR[0] = 0x0004; dev->aCSR[4] &= ~0x02c2; dev->aCSR[5] &= ~0x0011; @@ -1071,7 +1071,7 @@ pcnetRdtePoll(nic_t *dev) * Don't flood the release log with errors. */ if (++dev->uCntBadRMD < 50) - pcnetlog(1, "%s: BAD RMD ENTRIES AT %#010x (i=%d)\n", + pcnet_log(1, "%s: BAD RMD ENTRIES AT %#010x (i=%d)\n", dev->name, addr, i); return; } @@ -1097,7 +1097,7 @@ pcnetRdtePoll(nic_t *dev) * Don't flood the release log with errors. */ if (++dev->uCntBadRMD < 50) - pcnetlog(1, "%s: BAD RMD ENTRIES + AT %#010x (i=%d)\n", + pcnet_log(1, "%s: BAD RMD ENTRIES + AT %#010x (i=%d)\n", dev->name, addr, i); return; } @@ -1125,7 +1125,7 @@ pcnetTdtePoll(nic_t *dev, TMD *tmd) return 0; if (tmd->tmd1.ones != 15) { - pcnetlog(1, "%s: BAD TMD XDA=%#010x\n", + pcnet_log(1, "%s: BAD TMD XDA=%#010x\n", dev->name, PHYSADDR(dev, cxda)); return 0; } @@ -1177,20 +1177,20 @@ pcnetCalcPacketLen(nic_t *dev, int cb) * No need to count further since this packet won't be sent anyway * due to underflow. */ - pcnetlog(3, "%s: pcnetCalcPacketLen: underflow, return %u\n", dev->name, cbPacket); + pcnet_log(3, "%s: pcnetCalcPacketLen: underflow, return %u\n", dev->name, cbPacket); return cbPacket; } if (tmd.tmd1.ones != 15) { - pcnetlog(1, "%s: BAD TMD XDA=%#010x\n", + pcnet_log(1, "%s: BAD TMD XDA=%#010x\n", dev->name, PHYSADDR(dev, addrDesc)); - pcnetlog(3, "%s: pcnetCalcPacketLen: bad TMD, return %u\n", dev->name, cbPacket); + pcnet_log(3, "%s: pcnetCalcPacketLen: bad TMD, return %u\n", dev->name, cbPacket); return cbPacket; } - pcnetlog(3, "%s: pcnetCalcPacketLen: got valid TMD, cb=%u\n", dev->name, 4096 - tmd.tmd1.bcnt); + pcnet_log(3, "%s: pcnetCalcPacketLen: got valid TMD, cb=%u\n", dev->name, 4096 - tmd.tmd1.bcnt); cbPacket += 4096 - tmd.tmd1.bcnt; } while (!tmd.tmd1.enp); - pcnetlog(3, "#%d pcnetCalcPacketLen: return %u\n", dev->name, cbPacket); + pcnet_log(3, "#%d pcnetCalcPacketLen: return %u\n", dev->name, cbPacket); return cbPacket; } @@ -1227,7 +1227,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) if (dev->fMaybeOutOfSpace) return 0; - pcnetlog(1, "%s: pcnetReceiveNoSync: RX %x:%x:%x:%x:%x:%x > %x:%x:%x:%x:%x:%x len %d\n", dev->name, + pcnet_log(1, "%s: pcnetReceiveNoSync: RX %x:%x:%x:%x:%x:%x > %x:%x:%x:%x:%x:%x len %d\n", dev->name, buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], size); @@ -1258,7 +1258,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) dev->aCSR[0] |= 0x1000; /* Set MISS flag */ CSR_MISSC(dev) ++; - pcnetlog(2, "%s: pcnetReceiveNoSync: packet missed\n", dev->name); + pcnet_log(2, "%s: pcnetReceiveNoSync: packet missed\n", dev->name); } else { RTNETETHERHDR *pEth = (RTNETETHERHDR *) buf; int fStrip = 0; @@ -1331,7 +1331,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) /* RX disabled in the meantime? If so, abort RX. */ if (CSR_DRX(dev) || CSR_STOP(dev) || CSR_SPND(dev)) { - pcnetlog(3, "%s: RX disabled 1\n", dev->name); + pcnet_log(3, "%s: RX disabled 1\n", dev->name); return 0; } @@ -1374,7 +1374,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) /* RX disabled in the meantime? If so, abort RX. */ if (CSR_DRX(dev) || CSR_STOP(dev) || CSR_SPND(dev)) { - pcnetlog(3, "%s: RX disabled 2\n", dev->name); + pcnet_log(3, "%s: RX disabled 2\n", dev->name); return 0; } @@ -1400,7 +1400,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) rmd.rmd2.mcnt = cbPacket; rmd.rmd2.zeros = 0; } else { - pcnetlog(1, "%s: Overflow by %ubytes\n", dev->name, size); + pcnet_log(1, "%s: Overflow by %ubytes\n", dev->name, size); rmd.rmd1.oflo = 1; rmd.rmd1.buff = 1; rmd.rmd1.err = 1; @@ -1410,7 +1410,7 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size) pcnetRmdStorePassHost(dev, &rmd, PHYSADDR(dev, crda)); dev->aCSR[0] |= 0x0400; - pcnetlog(1, "%s: RINT set, RCVRC=%d CRDA=%#010x\n", dev->name, + pcnet_log(1, "%s: RINT set, RCVRC=%d CRDA=%#010x\n", dev->name, CSR_RCVRC(dev), PHYSADDR(dev, CSR_CRDA(dev))); /* guest driver is owner: force repoll of current and next RDTEs */ @@ -1477,7 +1477,7 @@ pcnetAsyncTransmit(nic_t *dev) && dev->cLinkDownReported > PCNET_MAX_LINKDOWN_REPORTED)) break; - pcnetlog(3, "%s: TMDLOAD %#010x\n", dev->name, PHYSADDR(dev, CSR_CXDA(dev))); + pcnet_log(3, "%s: TMDLOAD %#010x\n", dev->name, PHYSADDR(dev, CSR_CXDA(dev))); int fLoopback = CSR_LOOP(dev); @@ -1486,7 +1486,7 @@ pcnetAsyncTransmit(nic_t *dev) */ if (tmd.tmd1.stp && tmd.tmd1.enp) { const int cb = 4096 - tmd.tmd1.bcnt; - pcnetlog("%s: pcnetAsyncTransmit: stp&enp: cb=%d xmtrc=%#x\n", dev->name, cb, CSR_XMTRC(dev)); + pcnet_log("%s: pcnetAsyncTransmit: stp&enp: cb=%d xmtrc=%#x\n", dev->name, cb, CSR_XMTRC(dev)); if ((pcnetIsLinkUp(dev) || fLoopback)) { @@ -1504,7 +1504,7 @@ pcnetAsyncTransmit(nic_t *dev) pcnetReceiveNoSync(dev, dev->abLoopBuf, dev->xmit_pos); } else { - pcnetlog(3, "%s: pcnetAsyncTransmit: transmit loopbuf stp and enp, xmit pos = %d\n", dev->name, dev->xmit_pos); + pcnet_log(3, "%s: pcnetAsyncTransmit: transmit loopbuf stp and enp, xmit pos = %d\n", dev->name, dev->xmit_pos); network_tx(dev->netcard, dev->abLoopBuf, dev->xmit_pos); } } else if (cb == 4096) { @@ -1533,7 +1533,7 @@ pcnetAsyncTransmit(nic_t *dev) * and later hardware is that the buffer lengths are *16-bit* * two's complement numbers between 0 and 4096. AMD's drivers * in fact generally treat the length as a 16-bit quantity. */ - pcnetlog(1, "%s: pcnetAsyncTransmit: illegal 4kb frame -> ignoring\n", dev->name); + pcnet_log(1, "%s: pcnetAsyncTransmit: illegal 4kb frame -> ignoring\n", dev->name); pcnetTmdStorePassHost(dev, &tmd, PHYSADDR(dev, CSR_CXDA(dev))); break; } else { @@ -1588,7 +1588,7 @@ pcnetAsyncTransmit(nic_t *dev) if (!CSR_DXSUFLO(dev)) /* stop on xmit underflow */ dev->aCSR[0] &= ~0x0010; /* clear TXON */ pcnetTmdStorePassHost(dev, &tmd, GCPhysPrevTmd); - pcnetlog(3, "%s: pcnetAsyncTransmit: Underflow!!!\n", dev->name); + pcnet_log(3, "%s: pcnetAsyncTransmit: Underflow!!!\n", dev->name); break; } @@ -1614,10 +1614,10 @@ pcnetAsyncTransmit(nic_t *dev) if (HOST_IS_OWNER(CSR_CRST(dev))) pcnetRdtePoll(dev); - pcnetlog(3, "%s: pcnetAsyncTransmit: receive loopback enp\n", dev->name); + pcnet_log(3, "%s: pcnetAsyncTransmit: receive loopback enp\n", dev->name); pcnetReceiveNoSync(dev, dev->abLoopBuf, dev->xmit_pos); } else { - pcnetlog(3, "%s: pcnetAsyncTransmit: transmit loopbuf enp\n", dev->name); + pcnet_log(3, "%s: pcnetAsyncTransmit: transmit loopbuf enp\n", dev->name); network_tx(dev->netcard, dev->abLoopBuf, dev->xmit_pos); } @@ -1694,7 +1694,7 @@ pcnetPollTimer(void *p) static void pcnetHardReset(nic_t *dev) { - pcnetlog(2, "%s: pcnetHardReset\n", dev->name); + pcnet_log(2, "%s: pcnetHardReset\n", dev->name); dev->iISR = 0; pcnet_do_irq(dev, 0); @@ -1730,7 +1730,7 @@ pcnetHardReset(nic_t *dev) static void pcnet_csr_writew(nic_t *dev, uint16_t rap, uint16_t val) { - pcnetlog(1, "%s: pcnet_csr_writew: rap=%d val=%#06x\n", dev->name, rap, val); + pcnet_log(1, "%s: pcnet_csr_writew: rap=%d val=%#06x\n", dev->name, rap, val); switch (rap) { case 0: { @@ -1745,27 +1745,27 @@ pcnet_csr_writew(nic_t *dev, uint16_t rap, uint16_t val) if ((val & 7) == 7) val &= ~3; - pcnetlog(2, "%s: CSR0 val = %04x, val2 = %04x\n", dev->name, val, dev->aCSR[0]); + pcnet_log(2, "%s: CSR0 val = %04x, val2 = %04x\n", dev->name, val, dev->aCSR[0]); dev->aCSR[0] = csr0; if (!CSR_STOP(dev) && (val & 4)) { - pcnetlog(3, "%s: pcnet_csr_writew(): Stop\n", dev->name); + pcnet_log(3, "%s: pcnet_csr_writew(): Stop\n", dev->name); pcnetStop(dev); } if (!CSR_INIT(dev) && (val & 1)) { - pcnetlog(3, "%s: pcnet_csr_writew(): Init\n", dev->name); + pcnet_log(3, "%s: pcnet_csr_writew(): Init\n", dev->name); pcnetInit(dev); } if (!CSR_STRT(dev) && (val & 2)) { - pcnetlog(3, "%s: pcnet_csr_writew(): Start\n", dev->name); + pcnet_log(3, "%s: pcnet_csr_writew(): Start\n", dev->name); pcnetStart(dev); } if (CSR_TDMD(dev)) { - pcnetlog(3, "%s: pcnet_csr_writew(): Transmit\n", dev->name); + pcnet_log(3, "%s: pcnet_csr_writew(): Transmit\n", dev->name); pcnetAsyncTransmit(dev); } } @@ -1850,16 +1850,16 @@ pcnet_csr_writew(nic_t *dev, uint16_t rap, uint16_t val) case 24: /* BADRL */ case 25: /* BADRU */ if (!CSR_STOP(dev) && !CSR_SPND(dev)) { - pcnetlog(3, "%s: WRITE CSR%d, %#06x, ignoring!!\n", dev->name, rap, val); + pcnet_log(3, "%s: WRITE CSR%d, %#06x, ignoring!!\n", dev->name, rap, val); return; } if (rap == 24) dev->GCRDRA = (dev->GCRDRA & 0xffff0000) | (val & 0x0000ffff); else dev->GCRDRA = (dev->GCRDRA & 0x0000ffff) | ((val & 0x0000ffff) << 16); - pcnetlog(3, "%s: WRITE CSR%d, %#06x => GCRDRA=%08x (alt init)\n", dev->name, rap, val, dev->GCRDRA); + pcnet_log(3, "%s: WRITE CSR%d, %#06x => GCRDRA=%08x (alt init)\n", dev->name, rap, val, dev->GCRDRA); if (dev->GCRDRA & (dev->iLog2DescSize - 1)) - pcnetlog(1, "%s: Warning: Misaligned RDRA (GCRDRA=%#010x)\n", dev->name, dev->GCRDRA); + pcnet_log(1, "%s: Warning: Misaligned RDRA (GCRDRA=%#010x)\n", dev->name, dev->GCRDRA); break; /* * 30 & 31 are the Base Address of Transmit Descriptor. @@ -1868,7 +1868,7 @@ pcnet_csr_writew(nic_t *dev, uint16_t rap, uint16_t val) case 30: /* BADXL */ case 31: /* BADXU */ if (!CSR_STOP(dev) && !CSR_SPND(dev)) { - pcnetlog(3, "%s: WRITE CSR%d, %#06x !!\n", dev->name, rap, val); + pcnet_log(3, "%s: WRITE CSR%d, %#06x !!\n", dev->name, rap, val); return; } if (rap == 30) @@ -1876,10 +1876,10 @@ pcnet_csr_writew(nic_t *dev, uint16_t rap, uint16_t val) else dev->GCTDRA = (dev->GCTDRA & 0x0000ffff) | ((val & 0x0000ffff) << 16); - pcnetlog(3, "%s: WRITE CSR%d, %#06x => GCTDRA=%08x (alt init)\n", dev->name, rap, val, dev->GCTDRA); + pcnet_log(3, "%s: WRITE CSR%d, %#06x => GCTDRA=%08x (alt init)\n", dev->name, rap, val, dev->GCTDRA); if (dev->GCTDRA & (dev->iLog2DescSize - 1)) - pcnetlog(1, "%s: Warning: Misaligned TDRA (GCTDRA=%#010x)\n", dev->name, dev->GCTDRA); + pcnet_log(1, "%s: Warning: Misaligned TDRA (GCTDRA=%#010x)\n", dev->name, dev->GCTDRA); break; case 58: /* Software Style */ pcnet_bcr_writew(dev, BCR_SWS, val); @@ -1893,10 +1893,10 @@ pcnet_csr_writew(nic_t *dev, uint16_t rap, uint16_t val) case 78: /* XMTRL */ /** @todo call pcnetUpdateRingHandlers */ /** @todo transmit ring length is stored in two's complement! */ if (!CSR_STOP(dev) && !CSR_SPND(dev)) { - pcnetlog(3, "%s: WRITE CSR%d, %#06x !!\n", dev->name, rap, val); + pcnet_log(3, "%s: WRITE CSR%d, %#06x !!\n", dev->name, rap, val); return; } - pcnetlog(3, "%s: WRITE CSR%d, %#06x (hacked %#06x) (alt init)\n", dev->name, + pcnet_log(3, "%s: WRITE CSR%d, %#06x (hacked %#06x) (alt init)\n", dev->name, rap, val, 1 + ~val); val = 1 + ~val; @@ -1951,7 +1951,7 @@ pcnet_csr_readw(nic_t *dev, uint16_t rap) val = dev->aCSR[rap]; break; } - pcnetlog(3, "%s: pcnet_csr_readw rap=%d val=0x%04x\n", dev->name, rap, val); + pcnet_log(3, "%s: pcnet_csr_readw rap=%d val=0x%04x\n", dev->name, rap, val); return val; } @@ -1959,7 +1959,7 @@ static void pcnet_bcr_writew(nic_t *dev, uint16_t rap, uint16_t val) { rap &= 0x7f; - pcnetlog(3, "%s: pcnet_bcr_writew rap=%d val=0x%04x\n", dev->name, rap, val); + pcnet_log(3, "%s: pcnet_bcr_writew rap=%d val=0x%04x\n", dev->name, rap, val); switch (rap) { case BCR_SWS: if (!(CSR_STOP(dev) || CSR_SPND(dev))) @@ -2194,14 +2194,14 @@ pcnet_bcr_readw(nic_t *dev, uint16_t rap) break; } - pcnetlog(3, "pcnet_bcr_readw rap=%d val=0x%04x\n", rap, val); + pcnet_log(3, "pcnet_bcr_readw rap=%d val=0x%04x\n", rap, val); return val; } static void pcnet_word_write(nic_t *dev, uint32_t addr, uint16_t val) { - pcnetlog(3, "%s: pcnet_word_write: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev)); + pcnet_log(3, "%s: pcnet_word_write: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev)); if (!BCR_DWIO(dev)) { switch (addr & 0x0f) { @@ -2236,7 +2236,7 @@ pcnet_byte_read(nic_t *dev, uint32_t addr) pcnetUpdateIrq(dev); - pcnetlog(3, "%s: pcnet_word_read: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev)); + pcnet_log(3, "%s: pcnet_word_read: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev)); return (val); } @@ -2274,7 +2274,7 @@ pcnet_word_read(nic_t *dev, uint32_t addr) pcnetUpdateIrq(dev); skip_update_irq: - pcnetlog(3, "%s: pcnet_word_read: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev)); + pcnet_log(3, "%s: pcnet_word_read: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev)); return (val); } @@ -2299,7 +2299,7 @@ pcnet_dword_write(nic_t *dev, uint32_t addr, uint32_t val) } else if ((addr & 0x0f) == 0) { /* switch device to dword i/o mode */ pcnet_bcr_writew(dev, BCR_BSBC, pcnet_bcr_readw(dev, BCR_BSBC) | 0x0080); - pcnetlog(3, "%s: device switched into dword i/o mode\n", dev->name); + pcnet_log(3, "%s: device switched into dword i/o mode\n", dev->name); }; } @@ -2333,7 +2333,7 @@ pcnet_dword_read(nic_t *dev, uint32_t addr) pcnetUpdateIrq(dev); skip_update_irq: - pcnetlog(3, "%s: Read Long mode, addr = %08x, val = %08x\n", dev->name, addr, val); + pcnet_log(3, "%s: Read Long mode, addr = %08x, val = %08x\n", dev->name, addr, val); return (val); } @@ -2358,7 +2358,7 @@ pcnet_write(nic_t *dev, uint32_t addr, uint32_t val, int len) { uint16_t off = addr & 0x1f; - pcnetlog(3, "%s: write addr %x, val %x, off %x, len %d\n", dev->name, addr, val, off, len); + pcnet_log(3, "%s: write addr %x, val %x, off %x, len %d\n", dev->name, addr, val, off, len); if (off < 0x10) { if (!BCR_DWIO(dev) && len == 1) @@ -2404,7 +2404,7 @@ pcnet_read(nic_t *dev, uint32_t addr, int len) uint32_t retval = 0xffffffff; uint16_t off = addr & 0x1f; - pcnetlog(3, "%s: read addr %x, off %x, len %d\n", dev->name, addr, off, len); + pcnet_log(3, "%s: read addr %x, off %x, len %d\n", dev->name, addr, off, len); if (off < 0x10) { if (!BCR_DWIO(dev) && len == 1) @@ -2423,7 +2423,7 @@ pcnet_read(nic_t *dev, uint32_t addr, int len) retval = pcnet_dword_read(dev, addr); } - pcnetlog(3, "%s: value in read - %08x\n", dev->name, retval); + pcnet_log(3, "%s: value in read - %08x\n", dev->name, retval); return (retval); } @@ -2538,7 +2538,7 @@ pcnet_pci_write(int func, int addr, uint8_t val, void *p) nic_t *dev = (nic_t *) p; uint8_t valxor; - pcnetlog(4, "%s: Write value %02X to register %02X\n", dev->name, val, addr & 0xff); + pcnet_log(4, "%s: Write value %02X to register %02X\n", dev->name, val, addr & 0xff); switch (addr) { case 0x04: @@ -2577,7 +2577,7 @@ pcnet_pci_write(int func, int addr, uint8_t val, void *p) pcnet_pci_bar[0].addr &= 0xff00; dev->PCIBase = pcnet_pci_bar[0].addr; /* Log the new base. */ - pcnetlog(4, "%s: New I/O base is %04X\n", dev->name, dev->PCIBase); + pcnet_log(4, "%s: New I/O base is %04X\n", dev->name, dev->PCIBase); /* We're done, so get out of the here. */ if (pcnet_pci_regs[4] & PCI_COMMAND_IO) { if (dev->PCIBase != 0) @@ -2597,7 +2597,7 @@ pcnet_pci_write(int func, int addr, uint8_t val, void *p) pcnet_pci_bar[1].addr &= 0xffffc000; dev->MMIOBase = pcnet_pci_bar[1].addr & 0xffffc000; /* Log the new base. */ - pcnetlog(4, "%s: New MMIO base is %08X\n", dev->name, dev->MMIOBase); + pcnet_log(4, "%s: New MMIO base is %08X\n", dev->name, dev->MMIOBase); /* We're done, so get out of the here. */ if (pcnet_pci_regs[4] & PCI_COMMAND_MEM) { if (dev->MMIOBase != 0) @@ -2617,7 +2617,7 @@ pcnet_pci_read(int func, int addr, void *p) { nic_t *dev = (nic_t *) p; - pcnetlog(4, "%s: Read to register %02X\n", dev->name, addr & 0xff); + pcnet_log(4, "%s: Read to register %02X\n", dev->name, addr & 0xff); switch (addr) { case 0x00: @@ -2983,12 +2983,12 @@ pcnet_init(const device_t *info) pcnet_ioset(dev, dev->base_address, 0x20); } - pcnetlog(2, "%s: I/O=%04x, IRQ=%d, MAC=%02x:%02x:%02x:%02x:%02x:%02x\n", + pcnet_log(2, "%s: I/O=%04x, IRQ=%d, MAC=%02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, dev->base_address, dev->base_irq, dev->aPROM[0], dev->aPROM[1], dev->aPROM[2], dev->aPROM[3], dev->aPROM[4], dev->aPROM[5]); - pcnetlog(1, "%s: %s attached IO=0x%X IRQ=%d\n", dev->name, + pcnet_log(1, "%s: %s attached IO=0x%X IRQ=%d\n", dev->name, dev->is_pci ? "PCI" : "VLB/ISA", dev->base_address, dev->base_irq); /* Reset the board. */ @@ -3013,7 +3013,7 @@ pcnet_close(void *priv) { nic_t *dev = (nic_t *) priv; - pcnetlog(1, "%s: closed\n", dev->name); + pcnet_log(1, "%s: closed\n", dev->name); netcard_close(dev->netcard); diff --git a/src/network/network.c b/src/network/network.c index 69df16b22..a2783c158 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -56,6 +56,9 @@ #include #include #include +#ifndef _WIN32 +#include +#endif /* _WIN32 */ #include #define HAVE_STDARG_H #include <86box/86box.h> @@ -125,7 +128,7 @@ netdev_t network_devs[NET_HOST_INTF_MAX]; /* Local variables. */ -#ifdef ENABLE_NETWORK_LOG +#if defined ENABLE_NETWORK_LOG && !defined(_WIN32) int network_do_log = ENABLE_NETWORK_LOG; static FILE *network_dump = NULL; static mutex_t *network_dump_mutex; @@ -215,7 +218,7 @@ network_init(void) if (i > 0) network_ndev += i; -#ifdef ENABLE_NETWORK_LOG +#if defined ENABLE_NETWORK_LOG && !defined(_WIN32) /* Start packet dump. */ network_dump = fopen("network.pcap", "wb"); @@ -471,7 +474,7 @@ netcard_close(netcard_t *card) void network_close(void) { -#ifdef ENABLE_NETWORK_LOG +#if defined ENABLE_NETWORK_LOG && !defined(_WIN32) thread_close_mutex(network_dump_mutex); network_dump_mutex = NULL; #endif @@ -494,7 +497,7 @@ network_reset(void) ui_sb_update_icon(SB_NETWORK, 0); -#ifdef ENABLE_NETWORK_LOG +#if defined ENABLE_NETWORK_LOG && !defined(_WIN32) network_dump_mutex = thread_create_mutex(); #endif diff --git a/src/network/pcap_if.c b/src/network/pcap_if.c index 800ac5848..c38803462 100644 --- a/src/network/pcap_if.c +++ b/src/network/pcap_if.c @@ -46,6 +46,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -54,6 +55,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include <86box/plat.h> #include <86box/plat_dynld.h> @@ -243,16 +245,6 @@ show_devs(capdev_t *list, int num) } } -void -pclog(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); -} - int main(int argc, char **argv) { diff --git a/src/printer/png.c b/src/printer/png.c index ee90bdbae..8c0be60e1 100644 --- a/src/printer/png.c +++ b/src/printer/png.c @@ -44,6 +44,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -52,6 +53,7 @@ #include #define PNG_DEBUG 0 #include +#define HAVE_STDARG_H #include <86box/86box.h> #include <86box/plat.h> #include <86box/plat_dynld.h> @@ -73,15 +75,15 @@ #define PNGFUNC(x) png_##x -#ifdef ENABLE_ESCP_LOG -int png_do_log = ENABLE_ESCP_LOG; +#ifdef ENABLE_PNG_LOG +int png_do_log = ENABLE_PNG_LOG; static void png_log(const char *fmt, ...) { va_list ap; - if (escp_do_log) { + if (png_do_log) { va_start(ap, fmt); pclog_ex(fmt, ap); va_end(ap); diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index 7281b8dd7..45b457578 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -48,6 +48,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -56,6 +57,7 @@ #include #include #include FT_FREETYPE_H +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/qt/win_joystick_rawinput.c b/src/qt/win_joystick_rawinput.c index dd95f40c9..7aeef6137 100644 --- a/src/qt/win_joystick_rawinput.c +++ b/src/qt/win_joystick_rawinput.c @@ -36,7 +36,6 @@ #ifdef ENABLE_JOYSTICK_LOG int joystick_do_log = ENABLE_JOYSTICK_LOG; - static void joystick_log(const char *fmt, ...) { diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index 9a4810412..38d7922ba 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -20,11 +20,11 @@ * Copyright 2016-2018 Miran Grca. * Copyright 2017,2018 Fred N. van Kempen. */ +#include #include #include #include #include -#include #include #define HAVE_STDARG_H #include <86box/86box.h> diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index f57cfd9c5..6e983e720 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -15,8 +15,8 @@ * * Copyright 2016-2020 Miran Grca. */ -#include #include +#include #include #include #include diff --git a/src/scsi/scsi_ncr53c8xx.c b/src/scsi/scsi_ncr53c8xx.c index ba5ccd002..53d37c9d8 100644 --- a/src/scsi/scsi_ncr53c8xx.c +++ b/src/scsi/scsi_ncr53c8xx.c @@ -879,17 +879,10 @@ ncr53c8xx_do_msgout(ncr53c8xx_t *dev, uint8_t id) { uint8_t msg; int len, arg; -#ifdef ENABLE_NCR53C8XX_LOG - uint32_t current_tag; -#endif scsi_device_t *sd; sd = &scsi_devices[dev->bus][id]; -#ifdef ENABLE_NCR53C8XX_LOG - current_tag = id; -#endif - ncr53c8xx_log("MSG out len=%d\n", dev->dbc); while (dev->dbc) { msg = ncr53c8xx_get_msgbyte(dev); @@ -1011,9 +1004,6 @@ ncr53c8xx_process_script(ncr53c8xx_t *dev) int opcode, insn_processed = 0, reg, operator, cond, jmp, n, i, c; int32_t offset; uint8_t op0, op1, data8, mask, data[7]; -#ifdef ENABLE_NCR53C8XX_LOG - uint8_t *pp; -#endif dev->sstop = 0; again: @@ -1337,10 +1327,6 @@ again: dev->dsp += 4; ncr53c8xx_memcpy(dev, dest, addr, insn & 0xffffff); } else { -#ifdef ENABLE_NCR53C8XX_LOG - pp = data; -#endif - if (insn & (1 << 28)) addr = dev->dsa + sextract32(addr, 0, 24); n = (insn & 7); diff --git a/src/scsi/scsi_x54x.c b/src/scsi/scsi_x54x.c index 08b36585e..4cfcd49b2 100644 --- a/src/scsi/scsi_x54x.c +++ b/src/scsi/scsi_x54x.c @@ -957,7 +957,7 @@ x54x_scsi_cmd_phase1(x54x_t *dev) } dev->callback_sub_phase = 3; - x54x_log("scsi_devices[%02xi][%02i].Status = %02X\n", x54x->bus, req->TargetID, sd->status); + x54x_log("scsi_devices[%02xi][%02i].Status = %02X\n", dev->bus, req->TargetID, sd->status); } static void diff --git a/src/sio/sio_pc87310.c b/src/sio/sio_pc87310.c index 03cb63958..5b5267191 100644 --- a/src/sio/sio_pc87310.c +++ b/src/sio/sio_pc87310.c @@ -45,6 +45,7 @@ #ifdef ENABLE_PC87310_LOG int pc87310_do_log = ENABLE_PC87310_LOG; + static void pc87310_log(const char *fmt, ...) { diff --git a/src/sio/sio_pc87311.c b/src/sio/sio_pc87311.c index cb6acb99c..2c098d5ab 100644 --- a/src/sio/sio_pc87311.c +++ b/src/sio/sio_pc87311.c @@ -45,6 +45,7 @@ #ifdef ENABLE_PC87311_LOG int pc87311_do_log = ENABLE_PC87311_LOG; + static void pc87311_log(const char *fmt, ...) { diff --git a/src/sio/sio_prime3b.c b/src/sio/sio_prime3b.c index dfbe6d1e8..b0267f0a0 100644 --- a/src/sio/sio_prime3b.c +++ b/src/sio/sio_prime3b.c @@ -37,6 +37,7 @@ #ifdef ENABLE_PRIME3B_LOG int prime3b_do_log = ENABLE_PRIME3B_LOG; + static void prime3b_log(const char *fmt, ...) { diff --git a/src/sio/sio_prime3c.c b/src/sio/sio_prime3c.c index a19f8f6dc..303a10967 100644 --- a/src/sio/sio_prime3c.c +++ b/src/sio/sio_prime3c.c @@ -32,6 +32,7 @@ #ifdef ENABLE_PRIME3C_LOG int prime3c_do_log = ENABLE_PRIME3C_LOG; + static void prime3c_log(const char *fmt, ...) { diff --git a/src/sio/sio_w83787f.c b/src/sio/sio_w83787f.c index fd26cde0c..ce6c20386 100644 --- a/src/sio/sio_w83787f.c +++ b/src/sio/sio_w83787f.c @@ -39,6 +39,7 @@ #ifdef ENABLE_W83787_LOG int w83787_do_log = ENABLE_W83787_LOG; + static void w83787_log(const char *fmt, ...) { diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index adc63e33b..7a72d0ef0 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -495,10 +495,6 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page) break; } - if (page == 0x0e || page == 0x0f) { - audiopci_log("Read frame = %02x, page = %02x, uart fifo valid = %02x, temp = %03x\n", frame, page, dev->valid, ret); - } - return ret; } diff --git a/src/sound/snd_opl_nuked.c b/src/sound/snd_opl_nuked.c index 85d524654..437ae8bc3 100644 --- a/src/sound/snd_opl_nuked.c +++ b/src/sound/snd_opl_nuked.c @@ -37,11 +37,13 @@ * Copyright 2016-2020 Miran Grca. * Copyright 2013-2018 Alexey Khokholov (Nuke.YKT) */ +#include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include <86box/snd_opl_nuked.h> #include <86box/sound.h> @@ -208,14 +210,18 @@ enum { }; #ifdef ENABLE_OPL_LOG +int nuked_do_log = ENABLE_OPL_LOG; + static void nuked_log(const char *fmt, ...) { va_list ap; - va_start(ap, fmt); - pclog_ex(fmt, ap); - va_end(ap); + if (nuked_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } } #else # define nuked_log(fmt, ...) diff --git a/src/sound/snd_opl_ymfm.cpp b/src/sound/snd_opl_ymfm.cpp index 2e58545f6..1e9f5f9b5 100644 --- a/src/sound/snd_opl_ymfm.cpp +++ b/src/sound/snd_opl_ymfm.cpp @@ -13,7 +13,7 @@ * * Copyright 2022 Adrien Moulin. */ - +#include #include #include #include @@ -21,6 +21,7 @@ #include "ymfm/ymfm_opl.h" extern "C" { +#define HAVE_STDARG_H #include <86box/86box.h> #include <86box/timer.h> #include <86box/device.h> @@ -225,15 +226,18 @@ extern "C" { #include <86box/snd_opl.h> #ifdef ENABLE_OPL_LOG +int ymfm_do_log = ENABLE_OPL_LOG; static void ymfm_log(const char *fmt, ...) { va_list ap; - va_start(ap, fmt); - pclog_ex(fmt, ap); - va_end(ap); + if (ymfm_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } } #else # define ymfm_log(fmt, ...) diff --git a/src/video/vid_compaq_cga.c b/src/video/vid_compaq_cga.c index 9b61b70f5..5bc7c6e99 100644 --- a/src/video/vid_compaq_cga.c +++ b/src/video/vid_compaq_cga.c @@ -18,12 +18,14 @@ * Copyright 2008-2019 Sarah Walker. * Copyright 2016-2019 Miran Grca. */ +#include #include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/io.h> diff --git a/src/video/vid_ht216.c b/src/video/vid_ht216.c index cf5e8f5f4..734e4cc90 100644 --- a/src/video/vid_ht216.c +++ b/src/video/vid_ht216.c @@ -16,11 +16,13 @@ * Copyright 2019 Sarah Walker. * Copyright 2019 Miran Grca. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/io.h> diff --git a/src/video/vid_icd2061.c b/src/video/vid_icd2061.c index 3eca22fc1..85740144c 100644 --- a/src/video/vid_icd2061.c +++ b/src/video/vid_icd2061.c @@ -20,11 +20,13 @@ * * Copyright 2016-2018 Miran Grca. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include <86box/device.h> diff --git a/src/video/vid_ics2494.c b/src/video/vid_ics2494.c index 9ab686ae9..d3a40cc8b 100644 --- a/src/video/vid_ics2494.c +++ b/src/video/vid_ics2494.c @@ -16,11 +16,13 @@ * * Copyright 2020 Miran Grca. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include <86box/device.h> @@ -28,8 +30,8 @@ typedef struct ics2494_t { float freq[16]; } ics2494_t; -#ifdef ENABLE_ics2494_LOG -int ics2494_do_log = ENABLE_ics2494_LOG; +#ifdef ENABLE_ICS2494_LOG +int ics2494_do_log = ENABLE_ICS2494_LOG; static void ics2494_log(const char *fmt, ...) diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index 2838d5f93..2d61c47f1 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -15,6 +15,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -22,6 +23,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index b0ac32035..d1521ce05 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_banshee_blitter.c b/src/video/vid_voodoo_banshee_blitter.c index 548ec0f6e..8a9b24337 100644 --- a/src/video/vid_voodoo_banshee_blitter.c +++ b/src/video/vid_voodoo_banshee_blitter.c @@ -9,6 +9,7 @@ - 16 bpp runs with tiled framebuffer - to aid 3D? 8 and 32 bpp use linear */ +#include #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_blitter.c b/src/video/vid_voodoo_blitter.c index 9ffeb9553..00847554a 100644 --- a/src/video/vid_voodoo_blitter.c +++ b/src/video/vid_voodoo_blitter.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_display.c b/src/video/vid_voodoo_display.c index 071e29df2..40e0b2ce9 100644 --- a/src/video/vid_voodoo_display.c +++ b/src/video/vid_voodoo_display.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_fb.c b/src/video/vid_voodoo_fb.c index 76c860239..705c16853 100644 --- a/src/video/vid_voodoo_fb.c +++ b/src/video/vid_voodoo_fb.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_fifo.c b/src/video/vid_voodoo_fifo.c index 5ac845e6f..65b8017a6 100644 --- a/src/video/vid_voodoo_fifo.c +++ b/src/video/vid_voodoo_fifo.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_reg.c b/src/video/vid_voodoo_reg.c index 84f56e726..9eb2dc3f8 100644 --- a/src/video/vid_voodoo_reg.c +++ b/src/video/vid_voodoo_reg.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_render.c b/src/video/vid_voodoo_render.c index 608f99a6a..ec16b3a32 100644 --- a/src/video/vid_voodoo_render.c +++ b/src/video/vid_voodoo_render.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_setup.c b/src/video/vid_voodoo_setup.c index 0da5449bf..f98ddb450 100644 --- a/src/video/vid_voodoo_setup.c +++ b/src/video/vid_voodoo_setup.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/video/vid_voodoo_texture.c b/src/video/vid_voodoo_texture.c index e0530c6d4..12ec56d0b 100644 --- a/src/video/vid_voodoo_texture.c +++ b/src/video/vid_voodoo_texture.c @@ -14,6 +14,7 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include @@ -21,6 +22,7 @@ #include #include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/machine.h> diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index 0a44b611e..cb3b51e77 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -54,6 +54,7 @@ #define WIN32_LEAN_AND_MEAN #include #include +#include #include #include @@ -253,7 +254,7 @@ sdl_blit(int x, int y, int w, int h, int monitor_index) ret = SDL_RenderCopy(sdl_render, sdl_tex, &r_src, 0); if (ret) - sdl_log("SDL: unable to copy texture to renderer (%s)\n", sdl_GetError()); + sdl_log("SDL: unable to copy texture to renderer (%s)\n", SDL_GetError()); SDL_RenderPresent(sdl_render); SDL_UnlockMutex(sdl_mutex); @@ -295,7 +296,7 @@ sdl_blit_ex(int x, int y, int w, int h, int monitor_index) ret = SDL_RenderCopy(sdl_render, sdl_tex, &r_src, 0); if (ret) - sdl_log("SDL: unable to copy texture to renderer (%s)\n", sdl_GetError()); + sdl_log("SDL: unable to copy texture to renderer (%s)\n", SDL_GetError()); SDL_RenderPresent(sdl_render); SDL_UnlockMutex(sdl_mutex); @@ -458,7 +459,7 @@ sdl_init_common(int flags) wchar_t temp[128]; SDL_version ver; - sdl_log("SDL: init (fs=%d)\n", fs); + sdl_log("SDL: init (flags=%d)\n", flags); /* Get and log the version of the DLL we are using. */ SDL_GetVersion(&ver); @@ -466,7 +467,7 @@ sdl_init_common(int flags) /* Initialize the SDL system. */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { - sdl_log("SDL: initialization failed (%s)\n", sdl_GetError()); + sdl_log("SDL: initialization failed (%s)\n", SDL_GetError()); return (0); }