Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into usb-bochs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 committed Dec 13, 2024
2 parents 3accf36 + 6710b96 commit d9fec8a
Show file tree
Hide file tree
Showing 92 changed files with 3,245 additions and 1,666 deletions.
1 change: 1 addition & 0 deletions .ci/AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ AppDir:
- libxkbcommon-x11-0 # if QT:BOOL=ON
- qtwayland5 # if QT:BOOL=ON
- zlib1g
- libserialport0
files:
exclude:
- etc
Expand Down
9 changes: 6 additions & 3 deletions .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ then
cmake_flags_extra="$cmake_flags_extra -D MOLTENVK=ON -D \"MOLTENVK_INCLUDE_DIR=$macports\""
fi

# Enable Libserialport
cmake_flags_extra="$cmake_flags_extra -D \"LIBSERIALPORT_ROOT=$macports\""

# Install dependencies only if we're in a new build and/or MacPorts prefix.
if check_buildtag "$(basename "$macports")"
then
Expand All @@ -539,11 +542,11 @@ then
sudo sed -i -e 's/configure.env-append MAKE=/configure.env-append VULKAN_SDK=${prefix} MAKE=/g' "$qt5_portfile"
fi

# Patch openal-soft to use 1.23.1 on all targets instead of 1.24.0 on >=11.0 only,
# Patch openal-soft to use 1.23.1 on all targets instead of 1.24.1 on >=10.15 only,
# to prevent a symlink mismatch from having different versions on x86_64 and arm64.
# See: https://github.com/macports/macports-ports/commit/9b4903fc9c76769d476079e404c9a3b8a225f8aa
openal_portfile="$macports/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/audio/openal-soft/Portfile"
sudo sed -i -e 's/if {${os.platform} ne "darwin" || ${os.major} >= 21}/if {0}/g' "$openal_portfile"
sudo sed -i -e 's/if {${os.platform} ne "darwin" || ${os.major} >= 19}/if {0}/g' "$openal_portfile"

# Patch wget to remove libproxy support, as it depends on shared-mime-info which
# fails to build for a 10.13 target, which we have to do despite wget only being
Expand Down Expand Up @@ -622,7 +625,7 @@ else
# ...and the ones we do want listed. Non-dev packages fill missing spots on the list.
libpkgs=""
longest_libpkg=0
for pkg in libc6-dev libstdc++6 libopenal-dev libfreetype6-dev libx11-dev libsdl2-dev libpng-dev librtmidi-dev qtdeclarative5-dev libwayland-dev libevdev-dev libxkbcommon-x11-dev libglib2.0-dev libslirp-dev libfaudio-dev libaudio-dev libjack-jackd2-dev libpipewire-0.3-dev libsamplerate0-dev libsndio-dev libvdeplug-dev libfluidsynth-dev libsndfile1-dev
for pkg in libc6-dev libstdc++6 libopenal-dev libfreetype6-dev libx11-dev libsdl2-dev libpng-dev librtmidi-dev qtdeclarative5-dev libwayland-dev libevdev-dev libxkbcommon-x11-dev libglib2.0-dev libslirp-dev libfaudio-dev libaudio-dev libjack-jackd2-dev libpipewire-0.3-dev libsamplerate0-dev libsndio-dev libvdeplug-dev libfluidsynth-dev libsndfile1-dev libserialport-dev
do
libpkgs="$libpkgs $pkg:$arch_deb"
length=$(echo -n $pkg | sed 's/-dev$//' | sed "s/qtdeclarative/qt/" | wc -c)
Expand Down
1 change: 1 addition & 0 deletions .ci/dependencies_macports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ ghostscript
libslirp
vde2
libsndfile
libserialport
1 change: 1 addition & 0 deletions .ci/dependencies_msys.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ qt5-static
qt5-translations
vulkan-headers
libsndfile
libserialport
3 changes: 2 additions & 1 deletion .github/workflows/cmake_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
libslirp-dev
libfluidsynth-dev
libvdeplug-dev
libserialport-dev
${{ matrix.ui.packages }}
- name: Checkout repository
Expand All @@ -90,7 +91,7 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@5c3c39143e381909307f6903f13774b275ed956d
uses: SonarSource/sonarcloud-github-c-cpp@v3

- name: Configure CMake
run: >-
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/cmake_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
fluidsynth
libslirp
vde
libserialport
${{ matrix.ui.packages }}
- name: Checkout repository
Expand All @@ -90,7 +91,7 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@5c3c39143e381909307f6903f13774b275ed956d
uses: SonarSource/sonarcloud-github-c-cpp@v3

- name: Configure CMake
run: >-
Expand All @@ -102,6 +103,7 @@ jobs:
-D Qt5_ROOT=$(brew --prefix qt@5)
-D Qt5LinguistTools_ROOT=$(brew --prefix qt@5)
-D OpenAL_ROOT=$(brew --prefix openal-soft)
-D LIBSERIALPORT_ROOT=$(brew --prefix libserialport)
- name: Build
run: |
Expand Down Expand Up @@ -181,6 +183,7 @@ jobs:
openal-soft
fluidsynth
libslirp
libserialport
${{ matrix.ui.packages }}
- name: Checkout repository
Expand All @@ -189,7 +192,7 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

# - name: Install sonar-scanner and build-wrapper
# uses: SonarSource/sonarcloud-github-c-cpp@5c3c39143e381909307f6903f13774b275ed956d
# uses: SonarSource/sonarcloud-github-c-cpp@v3

- name: Configure CMake
run: >-
Expand All @@ -201,6 +204,7 @@ jobs:
-D Qt5_ROOT=$(brew --prefix qt@5)
-D Qt5LinguistTools_ROOT=$(brew --prefix qt@5)
-D OpenAL_ROOT=$(brew --prefix openal-soft)
-D LIBSERIALPORT_ROOT=$(brew --prefix libserialport)
- name: Build
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cmake_windows_msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
rtmidi:p
libslirp:p
fluidsynth:p
libserialport:p
${{ matrix.ui.packages }}
- name: Checkout repository
Expand All @@ -105,7 +106,7 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@5c3c39143e381909307f6903f13774b275ed956d
uses: SonarSource/sonarcloud-github-c-cpp@v3

- name: Configure CMake
run: >-
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
libslirp-dev
libfluidsynth-dev
libvdeplug-dev
libserialport-dev
${{ matrix.ui.packages }}
- name: Checkout repository
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
fluidsynth
libslirp
vde
libserialport
${{ matrix.ui.packages }}
- name: Checkout repository
Expand All @@ -97,6 +98,7 @@ jobs:
-D Qt5_ROOT=$(brew --prefix qt@5)
-D Qt5LinguistTools_ROOT=$(brew --prefix qt@5)
-D OpenAL_ROOT=$(brew --prefix openal-soft)
-D LIBSERIALPORT_ROOT=$(brew --prefix libserialport)
- name: Build
run: cmake --build build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql_windows_msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
rtmidi:p
libslirp:p
fluidsynth:p
libserialport:p
${{ matrix.ui.packages }}
- name: Checkout repository
Expand Down
4 changes: 3 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"Qt5_DIR": "/opt/homebrew/opt/qt@5/lib/cmake/Qt5",
"MOLTENVK_DIR": "/opt/homebrew/opt/molten-vk",
"Qt5LinguistTools_DIR": "/opt/homebrew/opt/qt@5/lib/cmake/Qt5LinguistTools",
"OpenAL_ROOT": "/opt/homebrew/opt/openal-soft"
"OpenAL_ROOT": "/opt/homebrew/opt/openal-soft",
"LIBSERIALPORT_ROOT": "/opt/homebrew/opt/libserialport"
},
"inherits": "regular"
},
Expand All @@ -86,6 +87,7 @@
"MOLTENVK_DIR": "/opt/homebrew/opt/molten-vk",
"Qt5LinguistTools_DIR": "/opt/homebrew/opt/qt@5/lib/cmake/Qt5LinguistTools",
"OpenAL_ROOT": "/opt/homebrew/opt/openal-soft",
"LIBSERIALPORT_ROOT": "/opt/homebrew/opt/libserialport",
"CMAKE_CXX_FLAGS_DEBUG": "-g -O0 -DENABLE_VDE_LOG",
"CMAKE_C_FLAGS_DEBUG": "-g -O0 -DENABLE_VDE_LOG"
},
Expand Down
3 changes: 2 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Build-Depends: cmake (>= 3.21),
libsndfile-dev,
ninja-build,
qttools5-dev,
qtbase5-private-dev
qtbase5-private-dev,
libserialport-dev
Standards-Version: 4.6.0
Homepage: https://86box.net/
#Vcs-Browser: https://salsa.debian.org/debian/86box
Expand Down
24 changes: 12 additions & 12 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,9 +897,9 @@ load_storage_controllers(void)
fatal("load_storage_controllers(): strlen(p) > 2047 "
"(cassette_image_history[%i])\n", i);
else
snprintf(cassette_image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
snprintf(cassette_image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(cassette_image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
snprintf(cassette_image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(cassette_image_history[i]);
}
Expand Down Expand Up @@ -962,9 +962,9 @@ load_storage_controllers(void)
fatal("load_storage_controllers(): strlen(p) > 2047 "
"(cart_image_history[%i][%i])\n", c, i);
else
snprintf(cart_image_history[c][i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
snprintf(cart_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(cart_image_history[c][i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
snprintf(cart_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(cart_image_history[c][i]);
}
Expand Down Expand Up @@ -1261,9 +1261,9 @@ load_floppy_and_cdrom_drives(void)
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 2047 "
"(fdd_image_history[%i][%i])\n", c, i);
else
snprintf(fdd_image_history[c][i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
snprintf(fdd_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(fdd_image_history[c][i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
snprintf(fdd_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(fdd_image_history[c][i]);
}
Expand Down Expand Up @@ -1372,9 +1372,9 @@ load_floppy_and_cdrom_drives(void)
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 2047 "
"(cdrom[%i].image_history[%i])\n", c, i);
else
snprintf(cdrom[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
snprintf(cdrom[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(cdrom[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
snprintf(cdrom[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(cdrom[c].image_history[i]);
}
Expand Down Expand Up @@ -1502,9 +1502,9 @@ load_other_removable_devices(void)
fatal("load_other_removable_devices(): strlen(p) > 2047 "
"(zip_drives[%i].image_history[%i])\n", c, i);
else
snprintf(zip_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
snprintf(zip_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(zip_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
snprintf(zip_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(zip_drives[c].image_history[i]);
}
Expand Down Expand Up @@ -1615,9 +1615,9 @@ load_other_removable_devices(void)
fatal("load_other_removable_devices(): strlen(p) > 2047 "
"(mo_drives[%i].image_history[%i])\n", c, i);
else
snprintf(mo_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
snprintf(mo_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(mo_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
snprintf(mo_drives[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(mo_drives[c].image_history[i]);
}
Expand Down
29 changes: 21 additions & 8 deletions src/device/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ serial_receive_timer(void *priv)
/* Raise Data Ready interrupt. */
dev->lsr |= 0x01;
dev->int_status |= SERIAL_INT_RECEIVE;
if (dev->lsr & 0x02)
dev->int_status |= SERIAL_INT_LSR;

serial_update_ints(dev);
}
Expand Down Expand Up @@ -266,10 +268,6 @@ serial_move_to_txsr(serial_t *dev)
/* Update interrupts to signal THRE and that TXSR is no longer empty. */
serial_update_ints(dev);
}
if (dev->transmit_enabled & 2)
dev->baud_cycles++;
else
dev->baud_cycles = 0; /* If not moving while transmitting, reset BAUDOUT cycle count. */
if (!dev->fifo_enabled || (fifo_get_count(dev->xmit_fifo) == 0x0))
dev->transmit_enabled &= ~1; /* Stop moving. */
dev->transmit_enabled |= 2; /* Start transmitting. */
Expand Down Expand Up @@ -303,16 +301,26 @@ static void
serial_transmit_timer(void *priv)
{
serial_t *dev = (serial_t *) priv;
int delay = 8; /* STOP to THRE delay is 8 BAUDOUT cycles. */
/*
Norton Diagnostics waits for up to 2 bit periods, this is
confirmed by the NS16550A timings graph, which shows operation
as follows after write: 1 bit of delay, then start bit, and at
the end of the start bit, move from THR to TXSR.
*/
int delay = 1;

if (dev->transmit_enabled & 3) {
/*
If already transmitting, move from THR to TXSR at the end of
the last data bit.
*/
if ((dev->transmit_enabled & 1) && (dev->transmit_enabled & 2))
delay = dev->data_bits; /* Delay by less if already transmitting. */
delay = dev->data_bits + 1;

dev->baud_cycles++;

/* We have processed (total bits) BAUDOUT cycles, transmit the byte. */
if ((dev->baud_cycles == dev->bits) && (dev->transmit_enabled & 2))
/* We have processed (delay + total bits) BAUDOUT cycles, transmit the byte. */
if ((dev->baud_cycles == (dev->bits + 1)) && (dev->transmit_enabled & 2))
serial_process_txsr(dev);

/* We have processed (data bits) BAUDOUT cycles. */
Expand Down Expand Up @@ -614,6 +622,11 @@ serial_write(uint16_t addr, uint8_t val, void *priv)

dev->msr = new_msr;

if (dev->msr & 0x0f) {
dev->int_status |= SERIAL_INT_MSR;
serial_update_ints(dev);
}

/* TODO: Why reset the FIFO's here?! */
fifo_reset(dev->xmit_fifo);
fifo_reset(dev->rcvr_fifo);
Expand Down
5 changes: 4 additions & 1 deletion src/disk/hdc_ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,10 @@ ide_hd_identify(const ide_t *ide)
/* Firmware */
ide_padstr((char *) (ide->buffer + 23), EMU_VERSION_EX, 8);
/* Model */
ide_padstr((char *) (ide->buffer + 27), device_identify, 40);
if (hdd[ide->hdd_num].model)
ide_padstr((char *) (ide->buffer + 27), hdd[ide->hdd_num].model, 40);
else
ide_padstr((char *) (ide->buffer + 27), device_identify, 40);
/* Fixed drive */
ide->buffer[0] = (1 << 6);
/* Buffer type */
Expand Down
7 changes: 6 additions & 1 deletion src/disk/hdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,10 @@ static hdd_preset_t hdd_speed_presets[] = {
{ .name = "[1997] 5400 RPM", .internal_name = "1997_5400rpm", .zones = 16, .avg_spt = 185, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 64, .max_multiple = 32 },
{ .name = "[1998] 5400 RPM", .internal_name = "1998_5400rpm", .zones = 16, .avg_spt = 300, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 32 },
{ .name = "[2000] 7200 RPM", .internal_name = "2000_7200rpm", .zones = 16, .avg_spt = 350, .heads = 6, .rpm = 7200, .full_stroke_ms = 15, .track_seek_ms = 2, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 32 },
// clang-format on
{ .name = "Conner CP3024", .internal_name = "CP3024", .model = "Conner Peripherals 20MB - CP3024", .zones = 1, .avg_spt = 33, .heads = 2, .rpm = 3500, .full_stroke_ms = 50, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 },
{ .name = "Conner CP3044", .internal_name = "CP3044", .model = "Conner Peripherals 40MB - CP3044", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3500, .full_stroke_ms = 50, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 },
{ .name = "Conner CP3104", .internal_name = "CP3104", .model = "Conner Peripherals 104MB - CP3104", .zones = 1, .avg_spt = 33, .heads = 8, .rpm = 3500, .full_stroke_ms = 45, .track_seek_ms = 8, .rcache_num_seg = 4, .rcache_seg_size = 8, .max_multiple = 8 },
// clang-format on
};

int
Expand Down Expand Up @@ -472,6 +475,8 @@ hdd_preset_apply(int hdd_id)
hd->cache.num_segments = preset->rcache_num_seg;
hd->cache.segment_size = preset->rcache_seg_size;
hd->max_multiple_block = preset->max_multiple;
if (preset->model)
hd->model = preset->model;

if (!hd->speed_preset)
return;
Expand Down
Loading

0 comments on commit d9fec8a

Please sign in to comment.