mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 18:08:20 -07:00
Merge remote-tracking branch 'origin/master' into opl4-daughterboard
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# Recipe file for appimage-builder.
|
||||
# Recipe file for appimage-builder.
|
||||
#
|
||||
# build.sh processes conditional comments based on CMakeCache
|
||||
# options at the end of each line. For example, a line ending in:
|
||||
# build.sh processes conditional comments based on CMakeCache
|
||||
# options at the end of each line. For example, a line ending in:
|
||||
#
|
||||
# # if QT:BOOL=ON
|
||||
# # if QT:BOOL=ON
|
||||
#
|
||||
# will be removed from the dynamically-generated copy of this
|
||||
# file if "QT" is not a boolean option set to ON, either through
|
||||
# a -D definition or the option's default value in CMakeLists.
|
||||
# will be removed from the dynamically-generated copy of this
|
||||
# file if "QT" is not a boolean option set to ON, either through
|
||||
# a -D definition or the option's default value in CMakeLists.
|
||||
#
|
||||
#
|
||||
# Authors: RichardG, <richardg867@gmail.com>
|
||||
# Authors: RichardG, <richardg867@gmail.com>
|
||||
#
|
||||
# Copyright 2022 RichardG.
|
||||
# Copyright 2022 RichardG.
|
||||
#
|
||||
|
||||
version: 1
|
||||
@@ -45,7 +45,6 @@ AppDir:
|
||||
include:
|
||||
- libedit2 # if (CLI:BOOL=ON|QT:BOOL=OFF)
|
||||
- libevdev2 # if QT:BOOL=ON
|
||||
- libfluidsynth2
|
||||
- libfreetype6
|
||||
- libgbm1 # if QT:BOOL=ON
|
||||
- libgl1 # if QT:BOOL=ON
|
||||
|
||||
16
.ci/Jenkinsfile
vendored
16
.ci/Jenkinsfile
vendored
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Jenkins build pipeline definition.
|
||||
* Jenkins build pipeline definition.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: RichardG, <richardg867@gmail.com>
|
||||
* Authors: RichardG, <richardg867@gmail.com>
|
||||
*
|
||||
* Copyright 2021-2022 RichardG.
|
||||
* Copyright 2021-2022 RichardG.
|
||||
*/
|
||||
|
||||
/* ['main builds', 'branch builds'] */
|
||||
|
||||
180
.ci/build.sh
180
.ci/build.sh
@@ -1,18 +1,18 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# Jenkins build script.
|
||||
# Jenkins build script.
|
||||
#
|
||||
#
|
||||
# Authors: RichardG, <richardg867@gmail.com>
|
||||
# Authors: RichardG, <richardg867@gmail.com>
|
||||
#
|
||||
# Copyright 2021-2022 RichardG.
|
||||
# Copyright 2021-2023 RichardG.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -26,7 +26,6 @@
|
||||
# - Packaging the Ghostscript DLL requires 32-bit and/or 64-bit Ghostscript on Program Files
|
||||
# - Packaging the FluidSynth DLL requires it to be at /home/86Box/dll32/libfluidsynth.dll
|
||||
# and/or /home/86Box/dll64/libfluidsynth64.dll (for 32-bit and 64-bit builds respectively)
|
||||
# - Packaging the Discord DLL requires wget (MSYS should come with it)
|
||||
# - For Linux builds:
|
||||
# - Only Debian and derivatives are supported
|
||||
# - dpkg and apt-get are called through sudo to manage dependencies; make sure those
|
||||
@@ -284,7 +283,7 @@ then
|
||||
then
|
||||
# Update keyring as well, since the package signing keys sometimes change.
|
||||
echo [-] Updating package databases and keyring
|
||||
yes | pacman -Sy --needed msys2-keyring
|
||||
pacman -Sy --needed --noconfirm msys2-keyring
|
||||
|
||||
# Save build tag to skip pacman sync/keyring later.
|
||||
save_buildtag pacmansync
|
||||
@@ -292,100 +291,29 @@ then
|
||||
echo [-] Not updating package databases and keyring again
|
||||
fi
|
||||
|
||||
# Query installed packages.
|
||||
pacman -Qe > "$cache_dir/pacman.txt"
|
||||
|
||||
# Download the specified versions of architecture-specific dependencies.
|
||||
echo -n [-] Downloading dependencies:
|
||||
pkg_dir="/var/cache/pacman/pkg"
|
||||
repo_base="https://repo.msys2.org/mingw/$(echo $MSYSTEM | tr '[:upper:]' '[:lower:]')"
|
||||
cat .ci/dependencies_msys.txt | tr -d '\r' > "$cache_dir/deps.txt"
|
||||
pkgs=""
|
||||
while IFS=" " read pkg version
|
||||
do
|
||||
prefixed_pkg="$MINGW_PACKAGE_PREFIX-$pkg"
|
||||
installed_version=$(grep -E "^$prefixed_pkg " "$cache_dir/pacman.txt" | cut -d " " -f 2)
|
||||
if [ "$installed_version" != "$version" ] # installed_version will be empty if not installed
|
||||
then
|
||||
echo -n " [$pkg"
|
||||
|
||||
# Download package if not already present in the local cache.
|
||||
pkg_tar="$prefixed_pkg-$version-any.pkg.tar"
|
||||
if [ -s "$pkg_dir/$pkg_tar.xz" ]
|
||||
then
|
||||
pkg_fn="$pkg_tar.xz"
|
||||
pkg_dest="$pkg_dir/$pkg_fn"
|
||||
else
|
||||
pkg_fn="$pkg_tar.zst"
|
||||
pkg_dest="$pkg_dir/$pkg_fn"
|
||||
if [ ! -s "$pkg_dest" ]
|
||||
then
|
||||
if ! wget -qO "$pkg_dest" "$repo_base/$pkg_fn"
|
||||
then
|
||||
rm -f "$pkg_dest"
|
||||
pkg_fn="$pkg_tar.xz"
|
||||
pkg_dest="$pkg_dir/$pkg_fn"
|
||||
wget -qO "$pkg_dest" "$repo_base/$pkg_fn" || rm -f "$pkg_dest"
|
||||
fi
|
||||
if [ -s "$pkg_dest" ]
|
||||
then
|
||||
wget -qO "$pkg_dest.sig" "$repo_base/$pkg_fn.sig" || rm -f "$pkg_dest.sig"
|
||||
[ ! -s "$pkg_dest.sig" ] && rm -f "$pkg_dest.sig"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if the cached package is valid.
|
||||
if [ -s "$pkg_dest" ]
|
||||
then
|
||||
# Add cached zst package.
|
||||
pkgs="$pkgs $pkg_fn"
|
||||
else
|
||||
# Not valid, remove if it exists.
|
||||
rm -f "$pkg_dest" "$pkg_dest.sig"
|
||||
echo -n " FAIL"
|
||||
fi
|
||||
echo -n "]"
|
||||
fi
|
||||
done < "$cache_dir/deps.txt"
|
||||
[ -z "$pkgs" ] && echo -n ' none required'
|
||||
echo
|
||||
|
||||
# Install the downloaded architecture-specific dependencies.
|
||||
echo [-] Installing dependencies through pacman
|
||||
if [ -n "$pkgs" ]
|
||||
then
|
||||
pushd "$pkg_dir"
|
||||
yes | pacman -U --needed $pkgs
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
# Install packages individually if installing them all together failed.
|
||||
for pkg in $pkgs
|
||||
do
|
||||
yes | pacman -U --needed "$pkg"
|
||||
done
|
||||
fi
|
||||
popd
|
||||
|
||||
# Query installed packages again.
|
||||
pacman -Qe > "$cache_dir/pacman.txt"
|
||||
fi
|
||||
|
||||
# Install the latest versions for any missing packages (if the specified version couldn't be installed).
|
||||
# Establish general dependencies.
|
||||
pkgs="git"
|
||||
while IFS=" " read pkg version
|
||||
|
||||
# Gather installed architecture-specific packages for updating.
|
||||
# This prevents outdated shared libraries, unmet dependencies
|
||||
# and potentially other issues caused by the fact pacman doesn't
|
||||
# update a package's dependencies unless explicitly told to.
|
||||
pkgs="$pkgs $(pacman -Quq | grep -E "^$MINGW_PACKAGE_PREFIX-")"
|
||||
|
||||
# Establish architecture-specific dependencies.
|
||||
while read pkg rest
|
||||
do
|
||||
prefixed_pkg="$MINGW_PACKAGE_PREFIX-$pkg"
|
||||
grep -qE "^$prefixed_pkg " "$cache_dir/pacman.txt" || pkgs="$pkgs $prefixed_pkg"
|
||||
done < "$cache_dir/deps.txt"
|
||||
rm -f "$cache_dir/pacman.txt" "$cache_dir/deps.txt"
|
||||
yes | pacman -S --needed $pkgs
|
||||
if [ $? -ne 0 ]
|
||||
pkgs="$pkgs $MINGW_PACKAGE_PREFIX-$(echo "$pkg" | tr -d '\r')" # CR removal required
|
||||
done < .ci/dependencies_msys.txt
|
||||
|
||||
# Install or update dependencies.
|
||||
echo [-] Installing dependencies through pacman
|
||||
if ! pacman -S --needed --noconfirm $pkgs
|
||||
then
|
||||
# Install packages individually if installing them all together failed.
|
||||
for pkg in $pkgs
|
||||
do
|
||||
yes | pacman -S --needed "$pkg"
|
||||
pacman -S --needed --noconfirm "$pkg"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -949,14 +877,19 @@ else
|
||||
|
||||
if grep -q "OPENAL:BOOL=ON" build/CMakeCache.txt
|
||||
then
|
||||
# Build openal-soft 1.21.1 manually to fix audio issues. This is a temporary
|
||||
# Build openal-soft 1.22.2 manually to fix audio issues. This is a temporary
|
||||
# workaround until a newer version of openal-soft trickles down to Debian repos.
|
||||
prefix="$cache_dir/openal-soft-1.21.1"
|
||||
prefix="$cache_dir/openal-soft-1.22.2"
|
||||
if [ ! -d "$prefix" ]
|
||||
then
|
||||
rm -rf "$cache_dir/openal-soft-"* # remove old versions
|
||||
wget -qO - https://github.com/kcat/openal-soft/archive/refs/tags/1.21.1.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix"
|
||||
wget -qO - https://github.com/kcat/openal-soft/archive/refs/tags/1.22.2.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix"
|
||||
fi
|
||||
|
||||
# Patches to build with the old PipeWire version in Debian.
|
||||
sed -i -e 's/>=0.3.23//' "$prefix/CMakeLists.txt"
|
||||
sed -i -e 's/PW_KEY_CONFIG_NAME/"config.name"/g' "$prefix/alc/backends/pipewire.cpp"
|
||||
|
||||
prefix_build="$prefix/build-$arch_deb"
|
||||
cmake -G Ninja -D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" -S "$prefix" -B "$prefix_build" || exit 99
|
||||
cmake --build "$prefix_build" -j$(nproc) || exit 99
|
||||
@@ -986,7 +919,8 @@ else
|
||||
sdl_ui=OFF
|
||||
grep -qiE "^QT:BOOL=ON" build/CMakeCache.txt || sdl_ui=ON
|
||||
|
||||
# Build rtmidi without JACK support to remove the dependency on libjack.
|
||||
# Build rtmidi without JACK support to remove the dependency on libjack, as
|
||||
# the Debian libjack is very likely to be incompatible with the system jackd.
|
||||
prefix="$cache_dir/rtmidi-4.0.0"
|
||||
if [ ! -d "$prefix" ]
|
||||
then
|
||||
@@ -998,6 +932,24 @@ else
|
||||
cmake --build "$prefix_build" -j$(nproc) || exit 99
|
||||
cmake --install "$prefix_build" || exit 99
|
||||
|
||||
# Build FluidSynth without sound systems to remove the dependencies on libjack
|
||||
# and other sound system libraries. We don't output audio through FluidSynth.
|
||||
prefix="$cache_dir/fluidsynth-2.3.0"
|
||||
if [ ! -d "$prefix" ]
|
||||
then
|
||||
rm -rf "$cache_dir/fluidsynth-"* # remove old versions
|
||||
wget -qO - https://github.com/FluidSynth/fluidsynth/archive/refs/tags/v2.3.0.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix"
|
||||
fi
|
||||
cp cmake/flags-gcc.cmake cmake/flags-gcc.cmake.old
|
||||
sed -i -e 's/ -Werror=.*\([" ]\)/\1/g' cmake/flags-gcc.cmake # temporary hack for -Werror=old-style-definition non-compliance on FluidSynth and SDL2
|
||||
prefix_build="$prefix/build-$arch_deb"
|
||||
cmake -G Ninja -D enable-dbus=OFF -D enable-jack=OFF -D enable-oss=OFF -D enable-sdl2=OFF -D enable-pulseaudio=OFF -D enable-pipewire=OFF -D enable-alsa=OFF \
|
||||
-D "CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D "CMAKE_INSTALL_PREFIX=$cwd_root/archive_tmp/usr" \
|
||||
-S "$prefix" -B "$prefix_build" || exit 99
|
||||
cmake --build "$prefix_build" -j$(nproc) || exit 99
|
||||
cmake --install "$prefix_build" || exit 99
|
||||
cp -p "$cwd_root/archive_tmp/usr/bin/fluidsynth" fluidsynth
|
||||
|
||||
# Build SDL2 for joystick and FAudio support, with most components
|
||||
# disabled to remove the dependencies on PulseAudio and libdrm.
|
||||
prefix="$cache_dir/SDL2-2.0.20"
|
||||
@@ -1028,6 +980,7 @@ else
|
||||
-S "$prefix" -B "$prefix_build" || exit 99
|
||||
cmake --build "$prefix_build" -j$(nproc) || exit 99
|
||||
cmake --install "$prefix_build" || exit 99
|
||||
mv cmake/flags-gcc.cmake.old cmake/flags-gcc.cmake
|
||||
|
||||
# Archive Discord Game SDK library.
|
||||
7z e -y -o"archive_tmp/usr/lib" "$discord_zip" "lib/$arch_discord/discord_game_sdk.so"
|
||||
@@ -1138,6 +1091,27 @@ EOF
|
||||
|
||||
# Copy line.
|
||||
echo "$line" >> AppImageBuilder-generated.yml
|
||||
|
||||
# Workaround for appimage-builder issues 272 and 283 (i686 and armhf are also missing)
|
||||
if [ "$arch_appimage" != "x86_64" -a "$line" = " files:" ]
|
||||
then
|
||||
# Some mild arbitrary code execution with a dummy package...
|
||||
[ ! -d /runtime ] && sudo apt-get -y -o 'DPkg::Post-Invoke::=mkdir -p /runtime; chmod 777 /runtime' install libsixel1 > /dev/null 2>&1
|
||||
|
||||
echo " include:" >> AppImageBuilder-generated.yml
|
||||
for loader in "/lib/$libdir/ld-linux"*.so.*
|
||||
do
|
||||
for loader_copy in "$loader" "/lib/$(basename "$loader")"
|
||||
do
|
||||
if [ ! -e "/runtime/compat$loader_copy" ]
|
||||
then
|
||||
mkdir -p "/runtime/compat$(dirname "$loader_copy")"
|
||||
ln -s "$loader" "/runtime/compat$loader_copy"
|
||||
fi
|
||||
echo " - /runtime/compat$loader_copy" >> AppImageBuilder-generated.yml
|
||||
done
|
||||
done
|
||||
fi
|
||||
done < .ci/AppImageBuilder.yml
|
||||
|
||||
# Download appimage-builder if necessary.
|
||||
@@ -1157,7 +1131,7 @@ EOF
|
||||
ln -s "$cache_dir/appimage-builder-cache" appimage-builder-cache
|
||||
|
||||
# Run appimage-builder in extract-and-run mode for Docker compatibility.
|
||||
# --appdir is a workaround for https://github.com/AppImageCrafters/appimage-builder/issues/270
|
||||
# --appdir is a workaround for appimage-builder issue 270 reported by us.
|
||||
for retry in 1 2 3 4 5
|
||||
do
|
||||
project="$project" project_id="$project_id" project_version="$project_version" project_icon="$project_icon" arch_deb="$arch_deb" \
|
||||
|
||||
@@ -1,24 +1,12 @@
|
||||
zlib 1.2.11-9
|
||||
binutils 2.37-4
|
||||
headers-git 9.0.0.6357.eac8c38c1-1
|
||||
crt-git 9.0.0.6357.eac8c38c1-2
|
||||
libwinpthread-git 9.0.0.6357.eac8c38c1-1
|
||||
winpthreads-git 9.0.0.6357.eac8c38c1-1
|
||||
winstorecompat-git 9.0.0.6357.eac8c38c1-1
|
||||
gcc-libs 11.2.0-4
|
||||
gcc-ada 11.2.0-4
|
||||
gcc-fortran 11.2.0-4
|
||||
gcc-libgfortran 11.2.0-4
|
||||
gcc-objc 11.2.0-4
|
||||
gcc 11.2.0-4
|
||||
libgccjit 11.2.0-4
|
||||
tools-git 9.0.0.6357.eac8c38c1-1
|
||||
ninja 1.10.2-3
|
||||
pkgconf 1.8.0-2
|
||||
openal 1.21.1-3
|
||||
libpng 1.6.37-6
|
||||
freetype 2.11.1-1
|
||||
SDL2 2.0.18-2
|
||||
rtmidi 4.0.0-1
|
||||
cmake 3.22.1-1
|
||||
qt5-static 5.15.2-4
|
||||
ninja
|
||||
cmake
|
||||
gcc
|
||||
pkgconf
|
||||
openal
|
||||
freetype
|
||||
SDL2
|
||||
zlib
|
||||
libpng
|
||||
rtmidi
|
||||
qt5-static
|
||||
qt5-translations
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# Script for converting MinGW static libraries into a DLL.
|
||||
# Script for converting MinGW static libraries into a DLL.
|
||||
#
|
||||
#
|
||||
# Authors: RichardG, <richardg867@gmail.com>
|
||||
# Authors: RichardG, <richardg867@gmail.com>
|
||||
#
|
||||
# Copyright 2021 RichardG.
|
||||
# Copyright 2021 RichardG.
|
||||
#
|
||||
|
||||
def_file="static2dll.def"
|
||||
|
||||
9
.github/dependabot.yml
vendored
Normal file
9
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
|
||||
# Maintain dependencies for GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
82
.github/workflows/c-cpp.yml
vendored
82
.github/workflows/c-cpp.yml
vendored
@@ -15,10 +15,10 @@ on:
|
||||
- "!**/CMakeLists.txt"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: MSYS2 Makefile build ${{ matrix.build.name }} ${{ matrix.dynarec.name }} build (${{ matrix.environment.msystem }})
|
||||
msys2:
|
||||
name: "Windows MSYS2 Makefile (Win32 GUI, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, ${{ matrix.environment.msystem }})"
|
||||
|
||||
runs-on: windows-latest
|
||||
runs-on: windows-2022
|
||||
|
||||
defaults:
|
||||
run:
|
||||
@@ -28,6 +28,9 @@ jobs:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
build:
|
||||
# - name: Regular
|
||||
# debug: n
|
||||
# dev: n
|
||||
- name: Debug
|
||||
debug: y
|
||||
dev: n
|
||||
@@ -44,34 +47,61 @@ jobs:
|
||||
new: y
|
||||
slug: -NDR
|
||||
environment:
|
||||
# - msystem: MSYS
|
||||
# clang: n
|
||||
# x64: y
|
||||
- msystem: MINGW32
|
||||
prefix: mingw-w64-i686
|
||||
clang: n
|
||||
x64: n
|
||||
- msystem: MINGW64
|
||||
prefix: mingw-w64-x86_64
|
||||
clang: n
|
||||
x64: y
|
||||
# - msystem: CLANG32
|
||||
# prefix: mingw-w64-clang-i686
|
||||
# clang: y
|
||||
# x64: n
|
||||
# - msystem: CLANG64
|
||||
# prefix: mingw-w64-clang-x86_64
|
||||
# clang: y
|
||||
# x64: y
|
||||
- msystem: UCRT64
|
||||
prefix: mingw-w64-ucrt-x86_64
|
||||
clang: n
|
||||
x64: y
|
||||
|
||||
steps:
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
msystem: ${{ matrix.environment.msystem }}
|
||||
install: >-
|
||||
make
|
||||
${{ matrix.environment.prefix }}-gcc
|
||||
${{ matrix.environment.prefix }}-pkg-config
|
||||
${{ matrix.environment.prefix }}-openal
|
||||
${{ matrix.environment.prefix }}-freetype
|
||||
${{ matrix.environment.prefix }}-SDL2
|
||||
${{ matrix.environment.prefix }}-zlib
|
||||
${{ matrix.environment.prefix }}-libpng
|
||||
${{ matrix.environment.prefix }}-libvncserver
|
||||
${{ matrix.environment.prefix }}-rtmidi
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: make -fwin/makefile.mingw -j DEV_BUILD=${{ matrix.build.dev }} DEBUG=${{ matrix.build.debug }} NEW_DYNAREC=${{ matrix.dynarec.new }} X64=${{ matrix.environment.x64 }} VNC=n
|
||||
working-directory: ./src
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: '86Box${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-Windows-${{ matrix.environment.msystem }}-gha${{ github.run_number }}'
|
||||
path: src/86Box.exe
|
||||
- name: Prepare MSYS2 environment
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
release: false
|
||||
update: true
|
||||
msystem: ${{ matrix.environment.msystem }}
|
||||
install: >-
|
||||
make
|
||||
pacboy: >-
|
||||
gcc:p
|
||||
clang:p
|
||||
pkg-config:p
|
||||
freetype:p
|
||||
SDL2:p
|
||||
zlib:p
|
||||
libpng:p
|
||||
openal:p
|
||||
rtmidi:p
|
||||
libvncserver:p
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: >-
|
||||
make -fwin/Makefile.mingw -j
|
||||
DEV_BUILD=${{ matrix.build.dev }}
|
||||
DEBUG=${{ matrix.build.debug }}
|
||||
NEW_DYNAREC=${{ matrix.dynarec.new }}
|
||||
CLANG=${{ matrix.environment.clang }}
|
||||
X64=${{ matrix.environment.x64 }}
|
||||
working-directory: ./src
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: '86Box${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-Windows-${{ matrix.environment.msystem }}-gha${{ github.run_number }}'
|
||||
path: src/86Box.exe
|
||||
|
||||
136
.github/workflows/cmake.yml
vendored
136
.github/workflows/cmake.yml
vendored
@@ -25,7 +25,7 @@ on:
|
||||
|
||||
jobs:
|
||||
msys2:
|
||||
name: MSYS2 ${{ matrix.build.name }} ${{ matrix.dynarec.name }} build (${{ matrix.environment.msystem }})
|
||||
name: "Windows MSYS2 (${{ matrix.ui.name }}, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, ${{ matrix.environment.msystem }})"
|
||||
|
||||
runs-on: windows-2022
|
||||
|
||||
@@ -37,6 +37,8 @@ jobs:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
build:
|
||||
# - name: Regular
|
||||
# preset: regular
|
||||
- name: Debug
|
||||
preset: debug
|
||||
slug: -Debug
|
||||
@@ -50,34 +52,56 @@ jobs:
|
||||
- name: NDR
|
||||
new: on
|
||||
slug: -NDR
|
||||
ui:
|
||||
- name: Win32 GUI
|
||||
qt: off
|
||||
static: on
|
||||
- name: Qt GUI
|
||||
qt: on
|
||||
static: off
|
||||
slug: -Qt
|
||||
packages: >-
|
||||
qt5-base:p
|
||||
qt5-tools:p
|
||||
environment:
|
||||
# - msystem: MSYS
|
||||
# toolchain: ./cmake/flags-gcc-x86_64.cmake
|
||||
- msystem: MINGW32
|
||||
prefix: mingw-w64-i686
|
||||
toolchain: ./cmake/flags-gcc-i686.cmake
|
||||
- msystem: MINGW64
|
||||
prefix: mingw-w64-x86_64
|
||||
toolchain: ./cmake/flags-gcc-x86_64.cmake
|
||||
# - msystem: CLANG32
|
||||
# prefix: mingw-w64-clang-i686
|
||||
# toolchain: ./cmake/llvm-win32-i686.cmake
|
||||
# - msystem: CLANG64
|
||||
# prefix: mingw-w64-clang-x86_64
|
||||
# toolchain: ./cmake/llvm-win32-x86_64.cmake
|
||||
- msystem: UCRT64
|
||||
prefix: mingw-w64-ucrt-x86_64
|
||||
toolchain: ./cmake/flags-gcc-x86_64.cmake
|
||||
|
||||
steps:
|
||||
- uses: msys2/setup-msys2@v2
|
||||
- name: Prepare MSYS2 environment
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
path-type: inherit
|
||||
release: false
|
||||
update: true
|
||||
msystem: ${{ matrix.environment.msystem }}
|
||||
install: >-
|
||||
${{ matrix.environment.prefix }}-ninja
|
||||
${{ matrix.environment.prefix }}-cc
|
||||
${{ matrix.environment.prefix }}-pkg-config
|
||||
${{ matrix.environment.prefix }}-freetype
|
||||
${{ matrix.environment.prefix }}-SDL2
|
||||
${{ matrix.environment.prefix }}-zlib
|
||||
${{ matrix.environment.prefix }}-libpng
|
||||
${{ matrix.environment.prefix }}-libvncserver
|
||||
${{ matrix.environment.prefix }}-openal
|
||||
${{ matrix.environment.prefix }}-rtmidi
|
||||
pacboy: >-
|
||||
ninja:p
|
||||
cmake:p
|
||||
gcc:p
|
||||
pkgconf:p
|
||||
freetype:p
|
||||
SDL2:p
|
||||
zlib:p
|
||||
libpng:p
|
||||
openal:p
|
||||
rtmidi:p
|
||||
libvncserver:p
|
||||
${{ matrix.ui.packages }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure CMake
|
||||
run: >-
|
||||
@@ -85,14 +109,15 @@ jobs:
|
||||
--toolchain ${{ matrix.environment.toolchain }}
|
||||
-D NEW_DYNAREC=${{ matrix.dynarec.new }}
|
||||
-D CMAKE_INSTALL_PREFIX=./build/artifacts
|
||||
-D QT=OFF
|
||||
-D QT=${{ matrix.ui.qt }}
|
||||
-D STATIC_BUILD=${{ matrix.ui.static }}
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Generate package
|
||||
run: cmake --install build
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: '86Box${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-Windows-${{ matrix.environment.msystem }}-gha${{ github.run_number }}'
|
||||
name: '86Box${{ matrix.ui.slug }}${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-Windows-${{ matrix.environment.msystem }}-gha${{ github.run_number }}'
|
||||
path: build/artifacts/**
|
||||
|
||||
llvm-windows:
|
||||
@@ -107,6 +132,8 @@ jobs:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
build:
|
||||
# - name: Regular
|
||||
# preset: regular
|
||||
- name: Debug
|
||||
preset: debug
|
||||
slug: -Debug
|
||||
@@ -129,15 +156,15 @@ jobs:
|
||||
target:
|
||||
- name: x86
|
||||
triplet: x86-windows-static
|
||||
toolchain: cmake/llvm-win32-i686.cmake
|
||||
toolchain: ./cmake/llvm-win32-i686.cmake
|
||||
vcvars: x64_x86
|
||||
- name: x64
|
||||
triplet: x64-windows-static
|
||||
toolchain: cmake/llvm-win32-x86_64.cmake
|
||||
toolchain: ./cmake/llvm-win32-x86_64.cmake
|
||||
vcvars: x64
|
||||
- name: ARM64
|
||||
triplet: arm64-windows-static
|
||||
toolchain: cmake/llvm-win32-aarch64.cmake
|
||||
toolchain: ./cmake/llvm-win32-aarch64.cmake
|
||||
vcvars: x64_arm64
|
||||
exclude:
|
||||
- dynarec:
|
||||
@@ -146,7 +173,6 @@ jobs:
|
||||
name: ARM64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Prepare VS environment
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
@@ -155,7 +181,7 @@ jobs:
|
||||
run: echo "C:/Program Files/LLVM/bin" >> $env:GITHUB_PATH
|
||||
- name: Download Ninja
|
||||
run: >
|
||||
Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip -OutFile ninja-win.zip &&
|
||||
Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip -OutFile ninja-win.zip &&
|
||||
Expand-Archive ninja-win.zip -DestinationPath .
|
||||
- name: Setup NuGet Credentials
|
||||
run: >
|
||||
@@ -168,11 +194,13 @@ jobs:
|
||||
-password "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: Fix MSVC atomic headers
|
||||
run: dir "C:/Program Files/Microsoft Visual Studio/2022/*/VC/Tools/MSVC/*/include" -include stdatomic.h -recurse | del
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure CMake
|
||||
run: >
|
||||
cmake -G Ninja -S . -B build --preset ${{ matrix.build.preset }}
|
||||
--toolchain C:/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
-D NEW_DYNAREC=${{ matrix.dynarec.new }} -D QT=${{ matrix.ui.qt }}
|
||||
-D CMAKE_INSTALL_PREFIX=./build/artifacts
|
||||
-D VCPKG_CHAINLOAD_TOOLCHAIN_FILE=${{ github.workspace }}/${{ matrix.target.toolchain }}
|
||||
-D VCPKG_TARGET_TRIPLET=${{ matrix.target.triplet }}
|
||||
-D VCPKG_HOST_TRIPLET=x64-windows
|
||||
@@ -188,14 +216,14 @@ jobs:
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Generate package
|
||||
run: cmake --install build --prefix ./build/artifacts
|
||||
run: cmake --install build
|
||||
- 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/**
|
||||
|
||||
linux:
|
||||
name: "Linux GCC 11 (${{ matrix.build.name }} ${{ matrix.dynarec.name }} x86_64)"
|
||||
name: "Linux GCC 11 (${{ matrix.ui.name }}, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, x86_64)"
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
@@ -203,6 +231,8 @@ jobs:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
build:
|
||||
# - name: Regular
|
||||
# preset: regular
|
||||
- name: Debug
|
||||
preset: debug
|
||||
slug: -Debug
|
||||
@@ -216,9 +246,15 @@ jobs:
|
||||
- name: NDR
|
||||
new: on
|
||||
slug: -NDR
|
||||
ui:
|
||||
- name: Qt GUI
|
||||
qt: on
|
||||
slug: -Qt
|
||||
packages: >-
|
||||
qtbase5-dev
|
||||
qttools5-dev
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install dependencies
|
||||
run: >-
|
||||
sudo apt update && sudo apt install
|
||||
@@ -229,25 +265,28 @@ jobs:
|
||||
libpng-dev
|
||||
libc6-dev
|
||||
librtmidi-dev
|
||||
qtbase5-dev
|
||||
qttools5-dev
|
||||
libopenal-dev
|
||||
libvncserver-dev
|
||||
${{ matrix.ui.packages }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure CMake
|
||||
run: >-
|
||||
cmake -G Ninja -S . -B build --preset ${{ matrix.build.preset }}
|
||||
--toolchain ./cmake/flags-gcc-x86_64.cmake
|
||||
-D NEW_DYNAREC=${{ matrix.dynarec.new }}
|
||||
-D CMAKE_INSTALL_PREFIX=./build/artifacts
|
||||
-D QT=${{ matrix.ui.qt }}
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
# - name: Generate package
|
||||
# run: cmake --install build --prefix ./build/artifacts
|
||||
# - uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: '86Box${{ matrix.build.slug }}-UbuntuJammy-x86_64-gha${{ github.run_number }}'
|
||||
# path: build/artifacts/**
|
||||
- name: Generate package
|
||||
run: cmake --install build
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: '86Box${{ matrix.ui.slug }}${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-UbuntuJammy-x86_64-gha${{ github.run_number }}'
|
||||
path: build/artifacts/**
|
||||
|
||||
macos11:
|
||||
name: "macOS 11 (${{ matrix.build.name }} x86_64)"
|
||||
name: "macOS 11 (${{ matrix.ui.name }}, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, x86_64)"
|
||||
|
||||
runs-on: macos-11
|
||||
|
||||
@@ -255,6 +294,8 @@ jobs:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
build:
|
||||
# - name: Regular
|
||||
# preset: regular
|
||||
- name: Debug
|
||||
preset: debug
|
||||
slug: -Debug
|
||||
@@ -268,24 +309,41 @@ jobs:
|
||||
- name: NDR
|
||||
new: on
|
||||
slug: -NDR
|
||||
ui:
|
||||
- name: Qt GUI
|
||||
qt: on
|
||||
slug: -Qt
|
||||
packages: >-
|
||||
qt@5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install dependencies
|
||||
run: brew install freetype sdl2 libpng rtmidi qt@5 openal-soft ninja
|
||||
run: >-
|
||||
brew install
|
||||
ninja
|
||||
freetype
|
||||
sdl2
|
||||
libpng
|
||||
rtmidi
|
||||
openal-soft
|
||||
libvncserver
|
||||
${{ matrix.ui.packages }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure CMake
|
||||
run: >-
|
||||
cmake -G Ninja -S . -B build --preset ${{ matrix.build.preset }}
|
||||
--toolchain cmake/flags-gcc-x86_64.cmake
|
||||
-D NEW_DYNAREC=${{ matrix.build.new-dynarec }}
|
||||
--toolchain ./cmake/flags-gcc-x86_64.cmake
|
||||
-D NEW_DYNAREC=${{ matrix.dynarec.new }}
|
||||
-D CMAKE_INSTALL_PREFIX=./build/artifacts
|
||||
-D QT=${{ matrix.ui.qt }}
|
||||
-D Qt5_ROOT=$(brew --prefix qt@5)
|
||||
-D Qt5LinguistTools_ROOT=$(brew --prefix qt@5)
|
||||
-D OpenAL_ROOT=$(brew --prefix openal-soft)
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Generate package
|
||||
run: cmake --install build --prefix ./build/artifacts
|
||||
run: cmake --install build
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: '86Box${{ matrix.build.slug }}-macOS-x86_64-gha${{ github.run_number }}'
|
||||
name: '86Box${{ matrix.ui.slug }}${{ matrix.dynarec.slug }}${{ matrix.build.slug }}-macOS-x86_64-gha${{ github.run_number }}'
|
||||
path: build/artifacts/**
|
||||
|
||||
51
.github/workflows/codeql.yml
vendored
Normal file
51
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on: [ push, pull_request]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: >-
|
||||
sudo apt update && sudo apt install
|
||||
build-essential
|
||||
ninja-build
|
||||
libfreetype-dev
|
||||
libsdl2-dev
|
||||
libpng-dev
|
||||
libc6-dev
|
||||
librtmidi-dev
|
||||
qtbase5-dev
|
||||
qttools5-dev
|
||||
libopenal-dev
|
||||
libvncserver-dev
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -38,6 +38,7 @@ Makefile
|
||||
# Visual Studio Code
|
||||
/.vs
|
||||
/.vscode
|
||||
/out
|
||||
|
||||
# Windows resource compiler
|
||||
RC*
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2020,2021 David Hrdlička.
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
@@ -20,7 +20,6 @@ cmake_policy(SET CMP0079 NEW)
|
||||
|
||||
if(HAIKU)
|
||||
set(OPENAL ON)
|
||||
set(RTMIDI OFF)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED QT OR QT)
|
||||
@@ -40,7 +39,7 @@ if(MUNT_EXTERNAL)
|
||||
endif()
|
||||
|
||||
project(86Box
|
||||
VERSION 3.11
|
||||
VERSION 4.0
|
||||
DESCRIPTION "Emulator of x86-based systems"
|
||||
HOMEPAGE_URL "https://86box.net"
|
||||
LANGUAGES C CXX)
|
||||
@@ -117,6 +116,10 @@ if(WIN32)
|
||||
add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if(NOT (WIN32 OR APPLE OR CMAKE_SYSTEM_NAME STREQUAL "Linux"))
|
||||
set(DISCORD OFF)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
@@ -139,6 +142,7 @@ option(MINITRACE "Enable Chrome tracing using the modified minitrace library"
|
||||
option(GDBSTUB "Enable GDB stub server for debugging" OFF)
|
||||
option(DEV_BRANCH "Development branch" OFF)
|
||||
option(QT "Qt GUI" ON)
|
||||
option(DISCORD "Discord Rich Presence support" ON)
|
||||
|
||||
# Development branch features
|
||||
#
|
||||
|
||||
@@ -1,36 +1,52 @@
|
||||
{
|
||||
"version": 3,
|
||||
"version": 2,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 21
|
||||
"minor": 20
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "base",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/artifacts",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
|
||||
"DEV_BRANCH": "OFF",
|
||||
"NEW_DYNAREC": "OFF",
|
||||
"QT": "ON"
|
||||
},
|
||||
"generator": "Ninja",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"name": "regular",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"DEV_BRANCH": "OFF",
|
||||
"NEW_DYNAREC": "OFF"
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
},
|
||||
"generator": "Ninja"
|
||||
"inherits": "base"
|
||||
},
|
||||
{
|
||||
"name": "optimized",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Optimized",
|
||||
"DEV_BRANCH": "OFF",
|
||||
"NEW_DYNAREC": "OFF"
|
||||
"CMAKE_BUILD_TYPE": "Optimized"
|
||||
},
|
||||
"generator": "Ninja"
|
||||
"inherits": "base"
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"DEV_BRANCH": "OFF",
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
},
|
||||
"inherits": "base"
|
||||
},
|
||||
{
|
||||
"name": "development",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"DEV_BRANCH": "ON",
|
||||
"NEW_DYNAREC": "OFF"
|
||||
},
|
||||
"generator": "Ninja"
|
||||
"inherits": "base"
|
||||
},
|
||||
{
|
||||
"name": "experimental",
|
||||
@@ -39,7 +55,9 @@
|
||||
"DEV_BRANCH": "ON",
|
||||
"NEW_DYNAREC": "ON"
|
||||
},
|
||||
"generator": "Ninja"
|
||||
"inherits": "base"
|
||||
}
|
||||
]
|
||||
],
|
||||
"buildPresets": [],
|
||||
"testPresets": []
|
||||
}
|
||||
|
||||
12
README.md
12
README.md
@@ -1,6 +1,6 @@
|
||||
86Box
|
||||
=====
|
||||
[](http://ci.86box.net/job/86Box)
|
||||
[](https://ci.86box.net/job/86Box/)
|
||||
|
||||
**86Box** is a low level x86 emulator that runs older operating systems and software designed for IBM PC systems and compatibles from 1981 through fairly recent system designs based on the PCI bus.
|
||||
|
||||
@@ -49,6 +49,16 @@ Licensing
|
||||
|
||||
The emulator can also optionally make use of [munt](https://github.com/munt/munt), [FluidSynth](https://www.fluidsynth.org/), [Ghostscript](https://www.ghostscript.com/) and [Discord Game SDK](https://discord.com/developers/docs/game-sdk/sdk-starter-guide), which are distributed under their respective licenses.
|
||||
|
||||
Contribution requirements
|
||||
-------------------------
|
||||
Formal codification of the project's emulated hardware contribution requirements, which all have to be met to accept an addition:
|
||||
* A ROM must be available;
|
||||
* Documentation must be available or it must be feasible to reverse engineer with a reasonable amount of time and effort;
|
||||
* It must be feasible to implement with a reasonable amount of time and effort;
|
||||
* It has to fall inside the project's scope.
|
||||
|
||||
Where unsure or for more details about the project's emulated hardware contribution requirements, contact a Contributor or higher.
|
||||
|
||||
Donations
|
||||
---------
|
||||
We do not charge you for the emulator but donations are still welcome:
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# Convenience script for changing the emulator's version.
|
||||
# Convenience script for changing the emulator's version.
|
||||
#
|
||||
#
|
||||
# Authors: RichardG, <richardg867@gmail.com>
|
||||
# Authors: RichardG, <richardg867@gmail.com>
|
||||
#
|
||||
# Copyright 2022 RichardG.
|
||||
# Copyright 2022 RichardG.
|
||||
#
|
||||
|
||||
# Parse arguments.
|
||||
@@ -73,3 +73,5 @@ patch_file src/unix/assets/*.spec '%global romver' 's/(^%global\ romver\s+)[0-9]
|
||||
patch_file src/unix/assets/*.spec 'changelog version' 's/(^[*]\s.*>\s+)[0-9].+/\1'"$newversion"-1'/'
|
||||
patch_file src/unix/assets/*.spec 'changelog date' 's/(^[*]\s)[a-zA-Z]{3}\s[a-zA-Z]{3}\s[0-9]{2}\s[0-9]{4}/\1'"$(pretty_date)"'/'
|
||||
patch_file src/unix/assets/*.metainfo.xml release 's/(<release version=")[^"]+(" date=")[^"]+/\1'"$newversion"'\2'"$(date +%Y-%m-%d)"'/'
|
||||
patch_file debian/changelog 'changelog date' 's/> .+/> '"$(date -R)"'/'
|
||||
patch_file debian/changelog 'changelog version' 's/86box \(.+\)/86box \('"$newversion"'\)/'
|
||||
|
||||
@@ -1,20 +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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for AArch64 (ARM64) targets.
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for AArch64 (ARM64) targets.
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -march=armv8-a")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv8-a")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
|
||||
|
||||
@@ -1,20 +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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for ARMv7 targets.
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for ARMv7 targets.
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -march=armv7-a -mfloat-abi=hard")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv7-a -mfloat-abi=hard")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for 32-bit x86 targets.
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for 32-bit x86 targets.
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign")
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for 64-bit x86 targets.
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for 64-bit x86 targets.
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -m64 -march=x86-64 -msse2 -mfpmath=sse -mstackrealign")
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file defining GCC compiler flags.
|
||||
# CMake toolchain file defining GCC compiler flags.
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
# Define our flags
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file defining Clang compiler flags
|
||||
# for AArch64 (ARM64)-based Apple Silicon targets.
|
||||
# CMake toolchain file defining Clang compiler flags
|
||||
# for AArch64 (ARM64)-based Apple Silicon targets.
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# dob205
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# dob205
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2022 dob205.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2022 dob205.
|
||||
#
|
||||
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -march=armv8.5-a+simd")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv8.5-a+simd")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file for Clang on Windows builds (ARM64 target).
|
||||
# CMake toolchain file for Clang on Windows builds (ARM64 target).
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-aarch64.cmake)
|
||||
@@ -27,4 +27,4 @@ set(CMAKE_CXX_COMPILER_TARGET aarch64-pc-windows-msvc)
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR ARM64)
|
||||
|
||||
# TODO: set the vcpkg target triplet perhaps?
|
||||
# TODO: set the vcpkg target triplet perhaps?
|
||||
|
||||
30
cmake/llvm-win32-arm.cmake
Normal file
30
cmake/llvm-win32-arm.cmake
Normal file
@@ -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, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-armv7.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 arm-pc-windows-msvc)
|
||||
set(CMAKE_CXX_COMPILER_TARGET arm-pc-windows-msvc)
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR ARM)
|
||||
|
||||
# TODO: set the vcpkg target triplet perhaps?
|
||||
@@ -1,16 +1,16 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file for Clang on Windows builds (x86 target).
|
||||
# CMake toolchain file for Clang on Windows builds (x86 target).
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-i686.cmake)
|
||||
@@ -27,4 +27,4 @@ set(CMAKE_CXX_COMPILER_TARGET i686-pc-windows-msvc)
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR X86)
|
||||
|
||||
# TODO: set the vcpkg target triplet perhaps?
|
||||
# TODO: set the vcpkg target triplet perhaps?
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file for Clang on Windows builds (x64/AMD64 target).
|
||||
# CMake toolchain file for Clang on Windows builds (x64/AMD64 target).
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-x86_64.cmake)
|
||||
@@ -27,4 +27,4 @@ set(CMAKE_CXX_COMPILER_TARGET x86_64-pc-windows-msvc)
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR AMD64)
|
||||
|
||||
# TODO: set the vcpkg target triplet perhaps?
|
||||
# TODO: set the vcpkg target triplet perhaps?
|
||||
|
||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,5 +1,5 @@
|
||||
86box (3.11.0-1) UNRELEASED; urgency=medium
|
||||
86box (4.0) UNRELEASED; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
* Bump release.
|
||||
|
||||
-- Jasmine Iwanek <jriwanek@gmail.com> Sun, 18 Nov 2022 23:27:00 -0500
|
||||
-- Jasmine Iwanek <jriwanek@gmail.com> Tue, 28 Feb 2023 00:02:16 -0500
|
||||
|
||||
0
debian/rules
vendored
Executable file → Normal file
0
debian/rules
vendored
Executable file → Normal file
132
src/86box.c
132
src/86box.c
@@ -10,20 +10,23 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
* Copyright 2017-2020 Fred N. van Kempen.
|
||||
* Copyright 2021 Laci bá'
|
||||
* Copyright 2021 dob205
|
||||
* Copyright 2021 Laci bá'
|
||||
* Copyright 2021 dob205
|
||||
* Copyright 2021 Andreas J. Reichel.
|
||||
* Copyright 2021-2022 Jasmine Iwanek.
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@@ -68,6 +71,7 @@
|
||||
#include <86box/isartc.h>
|
||||
#include <86box/lpt.h>
|
||||
#include <86box/serial.h>
|
||||
#include <86box/serial_passthrough.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/mouse.h>
|
||||
#include <86box/gameport.h>
|
||||
@@ -80,6 +84,7 @@
|
||||
#include <86box/scsi.h>
|
||||
#include <86box/scsi_device.h>
|
||||
#include <86box/cdrom.h>
|
||||
#include <86box/cdrom_interface.h>
|
||||
#include <86box/zip.h>
|
||||
#include <86box/mo.h>
|
||||
#include <86box/scsi_disk.h>
|
||||
@@ -96,6 +101,8 @@
|
||||
#include <86box/version.h>
|
||||
#include <86box/gdbstub.h>
|
||||
#include <86box/machine_status.h>
|
||||
#include <86box/apm.h>
|
||||
#include <86box/acpi.h>
|
||||
|
||||
// Disable c99-designator to avoid the warnings about int ng
|
||||
#ifdef __clang__
|
||||
@@ -143,50 +150,47 @@ uint64_t instru_run_ms = 0;
|
||||
|
||||
/* Configuration values. */
|
||||
int window_remember;
|
||||
int vid_resize; /* (C) allow resizing */
|
||||
int invert_display = 0; /* (C) invert the display */
|
||||
int suppress_overscan = 0; /* (C) suppress overscans */
|
||||
int scale = 0; /* (C) screen scale factor */
|
||||
int dpi_scale = 0; /* (C) DPI scaling of the emulated screen */
|
||||
int vid_api = 0; /* (C) video renderer */
|
||||
int vid_cga_contrast = 0; /* (C) video */
|
||||
int video_fullscreen = 0; /* (C) video */
|
||||
int video_fullscreen_scale = 0; /* (C) video */
|
||||
int video_fullscreen_first = 0; /* (C) video */
|
||||
int enable_overscan = 0; /* (C) video */
|
||||
int force_43 = 0; /* (C) video */
|
||||
int video_filter_method = 1; /* (C) video */
|
||||
int video_vsync = 0; /* (C) video */
|
||||
int video_framerate = -1; /* (C) video */
|
||||
char video_shader[512] = { '\0' }; /* (C) video */
|
||||
int bugger_enabled = 0; /* (C) enable ISAbugger */
|
||||
int postcard_enabled = 0; /* (C) enable POST card */
|
||||
int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */
|
||||
int isartc_type = 0; /* (C) enable ISA RTC card */
|
||||
int gfxcard = 0; /* (C) graphics/video card */
|
||||
int gfxcard_2 = 0; /* (C) graphics/video card */
|
||||
int show_second_monitors = 1; /* (C) show non-primary monitors */
|
||||
int sound_is_float = 1; /* (C) sound uses FP values */
|
||||
int GAMEBLASTER = 0; /* (C) sound option */
|
||||
int GUS = 0; /* (C) sound option */
|
||||
int SSI2001 = 0; /* (C) sound option */
|
||||
int voodoo_enabled = 0; /* (C) video option */
|
||||
int ibm8514_enabled = 0; /* (C) video option */
|
||||
int xga_enabled = 0; /* (C) video option */
|
||||
uint32_t mem_size = 0; /* (C) memory size (Installed on system board)*/
|
||||
uint32_t isa_mem_size = 0; /* (C) memory size (ISA Memory Cards) */
|
||||
int cpu_use_dynarec = 0; /* (C) cpu uses/needs Dyna */
|
||||
int cpu = 0; /* (C) cpu type */
|
||||
int fpu_type = 0; /* (C) fpu type */
|
||||
int time_sync = 0; /* (C) enable time sync */
|
||||
int confirm_reset = 1; /* (C) enable reset confirmation */
|
||||
int confirm_exit = 1; /* (C) enable exit confirmation */
|
||||
int confirm_save = 1; /* (C) enable save confirmation */
|
||||
int enable_discord = 0; /* (C) enable Discord integration */
|
||||
int pit_mode = -1; /* (C) force setting PIT mode */
|
||||
int fm_driver = 0; /* (C) select FM sound driver */
|
||||
int open_dir_usr_path = 0; /* default file open dialog directory of usr_path */
|
||||
int video_fullscreen_scale_maximized = 0; /* (C) Whether fullscreen scaling settings also apply when maximized. */
|
||||
int vid_resize; /* (C) allow resizing */
|
||||
int invert_display = 0; /* (C) invert the display */
|
||||
int suppress_overscan = 0; /* (C) suppress overscans */
|
||||
int scale = 0; /* (C) screen scale factor */
|
||||
int dpi_scale = 0; /* (C) DPI scaling of the emulated screen */
|
||||
int vid_api = 0; /* (C) video renderer */
|
||||
int vid_cga_contrast = 0; /* (C) video */
|
||||
int video_fullscreen = 0; /* (C) video */
|
||||
int video_fullscreen_scale = 0; /* (C) video */
|
||||
int video_fullscreen_first = 0; /* (C) video */
|
||||
int enable_overscan = 0; /* (C) video */
|
||||
int force_43 = 0; /* (C) video */
|
||||
int video_filter_method = 1; /* (C) video */
|
||||
int video_vsync = 0; /* (C) video */
|
||||
int video_framerate = -1; /* (C) video */
|
||||
char video_shader[512] = { '\0' }; /* (C) video */
|
||||
bool serial_passthrough_enabled[SERIAL_MAX] = { 0, 0, 0, 0 }; /* (C) activation and kind of pass-through for serial ports */
|
||||
int bugger_enabled = 0; /* (C) enable ISAbugger */
|
||||
int postcard_enabled = 0; /* (C) enable POST card */
|
||||
int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */
|
||||
int isartc_type = 0; /* (C) enable ISA RTC card */
|
||||
int gfxcard[2] = { 0, 0 }; /* (C) graphics/video card */
|
||||
int show_second_monitors = 1; /* (C) show non-primary monitors */
|
||||
int sound_is_float = 1; /* (C) sound uses FP values */
|
||||
int voodoo_enabled = 0; /* (C) video option */
|
||||
int ibm8514_enabled = 0; /* (C) video option */
|
||||
int xga_enabled = 0; /* (C) video option */
|
||||
uint32_t mem_size = 0; /* (C) memory size (Installed on system board)*/
|
||||
uint32_t isa_mem_size = 0; /* (C) memory size (ISA Memory Cards) */
|
||||
int cpu_use_dynarec = 0; /* (C) cpu uses/needs Dyna */
|
||||
int cpu = 0; /* (C) cpu type */
|
||||
int fpu_type = 0; /* (C) fpu type */
|
||||
int time_sync = 0; /* (C) enable time sync */
|
||||
int confirm_reset = 1; /* (C) enable reset confirmation */
|
||||
int confirm_exit = 1; /* (C) enable exit confirmation */
|
||||
int confirm_save = 1; /* (C) enable save confirmation */
|
||||
int enable_discord = 0; /* (C) enable Discord integration */
|
||||
int pit_mode = -1; /* (C) force setting PIT mode */
|
||||
int fm_driver = 0; /* (C) select FM sound driver */
|
||||
int open_dir_usr_path = 0; /* default file open dialog directory of usr_path */
|
||||
int video_fullscreen_scale_maximized = 0; /* (C) Whether fullscreen scaling settings also apply when maximized. */
|
||||
|
||||
/* Statistics. */
|
||||
extern int mmuflush;
|
||||
@@ -849,7 +853,7 @@ pc_init_modules(void)
|
||||
|
||||
/* Load the ROMs for the selected machine. */
|
||||
if (!machine_available(machine)) {
|
||||
swprintf(temp, sizeof(temp), plat_get_string(IDS_2063), machine_getname());
|
||||
swprintf(temp, sizeof_w(temp), plat_get_string(IDS_2063), machine_getname());
|
||||
c = 0;
|
||||
machine = -1;
|
||||
while (machine_get_internal_name_ex(c) != NULL) {
|
||||
@@ -869,34 +873,34 @@ pc_init_modules(void)
|
||||
}
|
||||
|
||||
/* Make sure we have a usable video card. */
|
||||
if (!video_card_available(gfxcard)) {
|
||||
if (!video_card_available(gfxcard[0])) {
|
||||
memset(tempc, 0, sizeof(tempc));
|
||||
device_get_name(video_card_getdevice(gfxcard), 0, tempc);
|
||||
swprintf(temp, sizeof(temp), plat_get_string(IDS_2064), tempc);
|
||||
device_get_name(video_card_getdevice(gfxcard[0]), 0, tempc);
|
||||
swprintf(temp, sizeof_w(temp), plat_get_string(IDS_2064), tempc);
|
||||
c = 0;
|
||||
while (video_get_internal_name(c) != NULL) {
|
||||
gfxcard = -1;
|
||||
gfxcard[0] = -1;
|
||||
if (video_card_available(c)) {
|
||||
ui_msgbox_header(MBX_INFO, (wchar_t *) IDS_2129, temp);
|
||||
gfxcard = c;
|
||||
gfxcard[0] = c;
|
||||
config_save();
|
||||
break;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
if (gfxcard == -1) {
|
||||
if (gfxcard[0] == -1) {
|
||||
fatal("No available video cards\n");
|
||||
exit(-1);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!video_card_available(gfxcard_2)) {
|
||||
if (!video_card_available(gfxcard[1])) {
|
||||
char tempc[512] = { 0 };
|
||||
device_get_name(video_card_getdevice(gfxcard_2), 0, tempc);
|
||||
swprintf(temp, sizeof(temp), (wchar_t *) "Video card #2 \"%hs\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card.", tempc);
|
||||
device_get_name(video_card_getdevice(gfxcard[1]), 0, tempc);
|
||||
swprintf(temp, sizeof_w(temp), plat_get_string(IDS_2163), tempc);
|
||||
ui_msgbox_header(MBX_INFO, (wchar_t *) IDS_2129, temp);
|
||||
gfxcard_2 = 0;
|
||||
gfxcard[1] = 0;
|
||||
}
|
||||
|
||||
atfullspeed = 0;
|
||||
@@ -1018,6 +1022,9 @@ pc_reset_hard_init(void)
|
||||
* modules that are.
|
||||
*/
|
||||
|
||||
/* Mark ACPI as unavailable */
|
||||
acpi_enabled = 0;
|
||||
|
||||
/* Reset the general machine support modules. */
|
||||
io_init();
|
||||
|
||||
@@ -1036,6 +1043,7 @@ pc_reset_hard_init(void)
|
||||
|
||||
/* Reset and reconfigure the serial ports. */
|
||||
serial_standalone_init();
|
||||
serial_passthrough_init();
|
||||
|
||||
/* Reset and reconfigure the Sound Card layer. */
|
||||
sound_card_reset();
|
||||
@@ -1068,6 +1076,10 @@ pc_reset_hard_init(void)
|
||||
|
||||
/* Reset the Hard Disk Controller module. */
|
||||
hdc_reset();
|
||||
|
||||
/* Reset the CD-ROM Controller module. */
|
||||
cdrom_interface_reset();
|
||||
|
||||
/* Reset and reconfigure the SCSI layer. */
|
||||
scsi_card_init();
|
||||
|
||||
@@ -1118,6 +1130,8 @@ pc_reset_hard_init(void)
|
||||
#endif
|
||||
|
||||
update_mouse_msg();
|
||||
|
||||
ui_hard_reset_completed();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1265,7 +1279,7 @@ pc_run(void)
|
||||
}
|
||||
|
||||
if (title_update) {
|
||||
mouse_msg_idx = (mouse_type == MOUSE_TYPE_NONE) ? 2 : !!mouse_capture;
|
||||
mouse_msg_idx = ((mouse_type == MOUSE_TYPE_NONE) || (mouse_mode >= 1)) ? 2 : !!mouse_capture;
|
||||
swprintf(temp, sizeof_w(temp), mouse_msg[mouse_msg_idx], fps);
|
||||
#ifdef __APPLE__
|
||||
/* Needed due to modifying the UI on the non-main thread is a big no-no. */
|
||||
|
||||
@@ -19,7 +19,7 @@ if(APPLE)
|
||||
endif()
|
||||
|
||||
add_executable(86Box 86box.c config.c log.c random.c timer.c io.c acpi.c apm.c
|
||||
dma.c ddma.c discord.c nmi.c pic.c pit.c pit_fast.c port_6x.c port_92.c ppi.c pci.c
|
||||
dma.c ddma.c nmi.c pic.c pit.c pit_fast.c port_6x.c port_92.c ppi.c pci.c
|
||||
mca.c usb.c fifo8.c device.c nvr.c nvr_at.c nvr_ps2.c machine_status.c ini.c)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
@@ -51,12 +51,20 @@ if(DEV_BRANCH)
|
||||
add_compile_definitions(DEV_BRANCH)
|
||||
endif()
|
||||
|
||||
if(DISCORD)
|
||||
add_compile_definitions(DISCORD)
|
||||
target_sources(86Box PRIVATE discord.c)
|
||||
endif()
|
||||
|
||||
if(VNC)
|
||||
add_compile_definitions(USE_VNC)
|
||||
add_library(vnc OBJECT vnc.c vnc_keymap.c)
|
||||
target_link_libraries(86Box vnc vncserver)
|
||||
if(WIN32)
|
||||
target_link_libraries(86Box ws2_32)
|
||||
find_package(LibVNCServer)
|
||||
if(LibVNCServer_FOUND)
|
||||
add_compile_definitions(USE_VNC)
|
||||
add_library(vnc OBJECT vnc.c vnc_keymap.c)
|
||||
target_link_libraries(86Box vnc LibVNCServer::vncserver)
|
||||
if(WIN32)
|
||||
target_link_libraries(86Box ws2_32)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# Prefix for localizing the general Makefile.mingw for local
|
||||
# settings, so we can avoid changing the main one for all of
|
||||
# our local setups.
|
||||
# Prefix for localizing the general Makefile.mingw for local
|
||||
# settings, so we can avoid changing the main one for all of
|
||||
# our local setups.
|
||||
#
|
||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
# Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
|
||||
#########################################################################
|
||||
# Anything here will override defaults in Makefile.MinGW. #
|
||||
# Anything here will override defaults in Makefile.MinGW. #
|
||||
#########################################################################
|
||||
|
||||
|
||||
# Name of the executable.
|
||||
#PROG := yourexe
|
||||
#PROG := 86box.exe
|
||||
|
||||
|
||||
# Various compile-time options.
|
||||
# -DROM_TRACE=0xc800 traces ROM access from segment C800
|
||||
# -DIO_TRACE=0x66 traces I/O on port 0x66
|
||||
# -DIO_CATCH enables I/O range catch logs
|
||||
STUFF :=
|
||||
STUFF :=
|
||||
|
||||
# Add feature selections here.
|
||||
# -DANSI_CFG forces the config file to ANSI encoding.
|
||||
@@ -168,31 +168,31 @@ STUFF :=
|
||||
# -DENABLE_JOYSTICK_LOG=N sets logging level at N.
|
||||
# -DENABLE_SDL_LOG=N sets logging level at N.
|
||||
# -DENABLE_SETTINGS_LOG=N sets logging level at N.
|
||||
EXTRAS :=
|
||||
EXTRAS :=
|
||||
|
||||
|
||||
AUTODEP := n
|
||||
DEBUG := n
|
||||
OPTIM := n
|
||||
X64 := n
|
||||
RELEASE := n
|
||||
USB := n
|
||||
VNC := n
|
||||
RDP := n
|
||||
DEV_BUILD := n
|
||||
DEV_BRANCH := n
|
||||
CIRRUS := n
|
||||
NE1000 := n
|
||||
NV_RIVA := n
|
||||
OPENAL := y
|
||||
FLUIDSYNTH := y
|
||||
MUNT := y
|
||||
PAS16 := n
|
||||
DYNAREC := y
|
||||
AUTODEP := n
|
||||
DEBUG := n
|
||||
OPTIM := n
|
||||
X64 := n
|
||||
RELEASE := n
|
||||
USB := n
|
||||
VNC := n
|
||||
RDP := n
|
||||
DEV_BUILD := n
|
||||
DEV_BRANCH := n
|
||||
CIRRUS := n
|
||||
NE1000 := n
|
||||
NV_RIVA := n
|
||||
OPENAL := y
|
||||
FLUIDSYNTH := y
|
||||
MUNT := y
|
||||
PAS16 := n
|
||||
DYNAREC := y
|
||||
|
||||
|
||||
#########################################################################
|
||||
# Include the master Makefile.MinGW for the rest. #
|
||||
# Include the master Makefile.MinGW for the rest. #
|
||||
#########################################################################
|
||||
include win/Makefile.mingw
|
||||
|
||||
|
||||
25
src/acpi.c
25
src/acpi.c
@@ -40,7 +40,9 @@
|
||||
#include <86box/i2c.h>
|
||||
#include <86box/video.h>
|
||||
|
||||
int acpi_rtc_status = 0;
|
||||
int acpi_rtc_status = 0;
|
||||
atomic_int acpi_pwrbut_pressed = 0;
|
||||
int acpi_enabled = 0;
|
||||
|
||||
static double cpu_to_acpi;
|
||||
|
||||
@@ -670,6 +672,7 @@ acpi_reg_write_common_regs(int size, uint16_t addr, uint8_t val, void *p)
|
||||
/* PMCNTRL - Power Management Control Register (IO) */
|
||||
if ((addr == 0x05) && (val & 0x20)) {
|
||||
sus_typ = dev->suspend_types[(val >> 2) & 7];
|
||||
acpi_log("ACPI suspend type %d flags %02X\n", (val >> 2) & 7, sus_typ);
|
||||
|
||||
if (sus_typ & SUS_POWER_OFF) {
|
||||
/* Soft power off. */
|
||||
@@ -1516,6 +1519,21 @@ acpi_ali_soft_smi_status_write(acpi_t *dev, uint8_t soft_smi)
|
||||
dev->regs.ali_soft_smi = soft_smi;
|
||||
}
|
||||
|
||||
void
|
||||
acpi_pwrbtn_timer(void *priv)
|
||||
{
|
||||
acpi_t *dev = (acpi_t *) priv;
|
||||
|
||||
timer_on_auto(&dev->pwrbtn_timer, 16. * 1000.);
|
||||
if (acpi_pwrbut_pressed) {
|
||||
acpi_pwrbut_pressed = 0;
|
||||
if (dev->regs.pmen & PWRBTN_EN) {
|
||||
dev->regs.pmsts |= PWRBTN_STS;
|
||||
acpi_update_irq(dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_apm_out(uint16_t port, uint8_t val, void *p)
|
||||
{
|
||||
@@ -1681,6 +1699,7 @@ acpi_init(const device_t *info)
|
||||
dev->suspend_types[1] = SUS_POWER_OFF;
|
||||
dev->suspend_types[2] = SUS_SUSPEND | SUS_NVR | SUS_RESET_CPU | SUS_RESET_PCI;
|
||||
dev->suspend_types[3] = SUS_SUSPEND;
|
||||
dev->suspend_types[5] = SUS_POWER_OFF; /* undocumented, used for S4/S5 by ASUS P5A ACPI table */
|
||||
break;
|
||||
|
||||
case VEN_VIA:
|
||||
@@ -1707,9 +1726,13 @@ acpi_init(const device_t *info)
|
||||
|
||||
timer_add(&dev->timer, acpi_timer_overflow, dev, 0);
|
||||
timer_add(&dev->resume_timer, acpi_timer_resume, dev, 0);
|
||||
timer_add(&dev->pwrbtn_timer, acpi_pwrbtn_timer, dev, 0);
|
||||
|
||||
timer_on_auto(&dev->pwrbtn_timer, 16. * 1000.);
|
||||
|
||||
acpi_reset(dev);
|
||||
|
||||
acpi_enabled = 1;
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2020,2021 David Hrdlička.
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
#
|
||||
|
||||
add_library(cdrom OBJECT cdrom.c cdrom_image_backend.c cdrom_image_viso.c cdrom_image.c cdrom_mitsumi.c)
|
||||
|
||||
@@ -23,9 +23,12 @@
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/cdrom.h>
|
||||
#include <86box/cdrom_image.h>
|
||||
#include <86box/cdrom_interface.h>
|
||||
#include <86box/cdrom_mitsumi.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/scsi.h>
|
||||
#include <86box/scsi_device.h>
|
||||
@@ -43,9 +46,6 @@
|
||||
#define MIN_SEEK 2000
|
||||
#define MAX_SEEK 333333
|
||||
|
||||
#define CD_BCD(x) (((x) % 10) | (((x) / 10) << 4))
|
||||
#define CD_DCB(x) ((((x) &0xf0) >> 4) * 10 + ((x) &0x0f))
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct {
|
||||
uint8_t user_data[2048],
|
||||
@@ -94,6 +94,8 @@ static uint8_t extra_buffer[296];
|
||||
|
||||
cdrom_t cdrom[CDROM_NUM];
|
||||
|
||||
int cdrom_interface_current;
|
||||
|
||||
#ifdef ENABLE_CDROM_LOG
|
||||
int cdrom_do_log = ENABLE_CDROM_LOG;
|
||||
|
||||
@@ -112,6 +114,145 @@ cdrom_log(const char *fmt, ...)
|
||||
# define cdrom_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
static const device_t cdrom_interface_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
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const device_t *device;
|
||||
} controllers[] = {
|
||||
// clang-format off
|
||||
{ &cdrom_interface_none_device },
|
||||
{ NULL }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
/* Reset the CD-ROM Interface, whichever one that is. */
|
||||
void
|
||||
cdrom_interface_reset(void)
|
||||
{
|
||||
cdrom_log("CD-ROM Interface: reset(current=%d)\n",
|
||||
cdrom_interface_current);
|
||||
|
||||
/* If we have a valid controller, add its device. */
|
||||
if (!controllers[cdrom_interface_current].device)
|
||||
return;
|
||||
|
||||
device_add(controllers[cdrom_interface_current].device);
|
||||
}
|
||||
|
||||
char *
|
||||
cdrom_interface_get_internal_name(int cdinterface)
|
||||
{
|
||||
return device_get_internal_name(controllers[cdinterface].device);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_interface_get_from_internal_name(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (controllers[c].device != NULL) {
|
||||
if (!strcmp((char *) controllers[c].device->internal_name, s))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const device_t *
|
||||
cdrom_interface_get_device(int cdinterface)
|
||||
{
|
||||
return (controllers[cdinterface].device);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_interface_has_config(int cdinterface)
|
||||
{
|
||||
const device_t *dev = cdrom_interface_get_device(cdinterface);
|
||||
|
||||
if (dev == NULL)
|
||||
return (0);
|
||||
|
||||
if (!device_has_config(dev))
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_interface_get_flags(int cdinterface)
|
||||
{
|
||||
return (controllers[cdinterface].device->flags);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_interface_available(int cdinterface)
|
||||
{
|
||||
return (device_available(controllers[cdinterface].device));
|
||||
}
|
||||
|
||||
char *
|
||||
cdrom_getname(int type)
|
||||
{
|
||||
return (char *) cdrom_drive_types[type].name;
|
||||
}
|
||||
|
||||
char *
|
||||
cdrom_get_internal_name(int type)
|
||||
{
|
||||
return (char *) cdrom_drive_types[type].internal_name;
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_get_from_internal_name(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (strlen(cdrom_drive_types[c].internal_name)) {
|
||||
if (!strcmp((char *) cdrom_drive_types[c].internal_name, s))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
cdrom_set_type(int model, int type)
|
||||
{
|
||||
cdrom[model].type = type;
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_get_type(int model)
|
||||
{
|
||||
return cdrom[model].type;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
bin2bcd(int x)
|
||||
{
|
||||
return (x % 10) | ((x / 10) << 4);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
bcd2bin(int x)
|
||||
{
|
||||
return (x >> 4) * 10 + (x & 0x0f);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_lba_to_msf_accurate(int lba)
|
||||
{
|
||||
@@ -258,12 +399,26 @@ cdrom_stop(cdrom_t *dev)
|
||||
}
|
||||
|
||||
void
|
||||
cdrom_seek(cdrom_t *dev, uint32_t pos)
|
||||
cdrom_seek(cdrom_t *dev, uint32_t pos, uint8_t vendor_type)
|
||||
{
|
||||
int m, s, f;
|
||||
|
||||
if (!dev)
|
||||
return;
|
||||
|
||||
cdrom_log("CD-ROM %i: Seek to LBA %08X\n", dev->id, pos);
|
||||
cdrom_log("CD-ROM %i: Seek to LBA %08X, vendor type = %02x.\n", dev->id, pos, vendor_type);
|
||||
|
||||
switch (vendor_type) {
|
||||
case 0x40:
|
||||
m = bcd2bin((pos >> 24) & 0xff);
|
||||
s = bcd2bin((pos >> 16) & 0xff);
|
||||
f = bcd2bin((pos >> 8) & 0xff);
|
||||
pos = MSFtoLBA(m, s, f) - 150;
|
||||
break;
|
||||
case 0x80:
|
||||
pos = bcd2bin((pos >> 24) & 0xff);
|
||||
break;
|
||||
}
|
||||
|
||||
dev->seek_pos = pos;
|
||||
cdrom_stop(dev);
|
||||
@@ -323,18 +478,6 @@ cdrom_audio_callback(cdrom_t *dev, int16_t *output, int len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
bin2bcd(int x)
|
||||
{
|
||||
return (x % 10) | ((x / 10) << 4);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
bcd2bin(int x)
|
||||
{
|
||||
return (x >> 4) * 10 + (x & 0x0f);
|
||||
}
|
||||
|
||||
static void
|
||||
msf_from_bcd(int *m, int *s, int *f)
|
||||
{
|
||||
@@ -365,20 +508,22 @@ cdrom_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len, int ismsf)
|
||||
/* Track-relative audio play. */
|
||||
dev->ops->get_track_info(dev, ismsf & 0xff, 0, &ti);
|
||||
pos += MSFtoLBA(ti.m, ti.s, ti.f) - 150;
|
||||
} else if (ismsf == 2) {
|
||||
} else if ((ismsf == 2) || (ismsf == 3)) {
|
||||
dev->ops->get_track_info(dev, pos, 0, &ti);
|
||||
pos = MSFtoLBA(ti.m, ti.s, ti.f) - 150;
|
||||
/* We have to end at the *end* of the specified track,
|
||||
not at the beginning. */
|
||||
dev->ops->get_track_info(dev, len, 1, &ti);
|
||||
len = MSFtoLBA(ti.m, ti.s, ti.f) - 150;
|
||||
if (ismsf == 2) {
|
||||
/* We have to end at the *end* of the specified track,
|
||||
not at the beginning. */
|
||||
dev->ops->get_track_info(dev, len, 1, &ti);
|
||||
len = MSFtoLBA(ti.m, ti.s, ti.f) - 150;
|
||||
}
|
||||
} else if (ismsf == 1) {
|
||||
m = (pos >> 16) & 0xff;
|
||||
s = (pos >> 8) & 0xff;
|
||||
f = pos & 0xff;
|
||||
|
||||
/* NEC CDR-260 speaks BCD. */
|
||||
if ((dev->bus_type == CDROM_BUS_ATAPI) && dev->early)
|
||||
if (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.01") || (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.00"))) /*NEC*/
|
||||
msf_from_bcd(&m, &s, &f);
|
||||
|
||||
if (pos == 0xffffff) {
|
||||
@@ -392,7 +537,7 @@ cdrom_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len, int ismsf)
|
||||
f = len & 0xff;
|
||||
|
||||
/* NEC CDR-260 speaks BCD. */
|
||||
if ((dev->bus_type == CDROM_BUS_ATAPI) && dev->early)
|
||||
if (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.01") || (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.00"))) /*NEC*/
|
||||
msf_from_bcd(&m, &s, &f);
|
||||
|
||||
len = MSFtoLBA(m, s, f) - 150;
|
||||
@@ -430,49 +575,116 @@ cdrom_audio_track_search(cdrom_t *dev, uint32_t pos, int type, uint8_t playbit)
|
||||
if (dev->cd_status == CD_STATUS_DATA_ONLY)
|
||||
return 0;
|
||||
|
||||
cdrom_log("Audio Track Search: MSF = %06x, type = %02x, playbit = %02x\n", pos, type, playbit);
|
||||
switch (type) {
|
||||
case 0x00:
|
||||
if (pos == 0xffffffff) {
|
||||
cdrom_log("CD-ROM %i: (type 0) Search from current position\n", dev->id);
|
||||
pos = dev->seek_pos;
|
||||
}
|
||||
dev->seek_pos = pos;
|
||||
break;
|
||||
case 0x40:
|
||||
cdrom_log("Audio Track Search: MSF = %06x, type = %02x\n", pos, type);
|
||||
m = CD_DCB((pos >> 24) & 0xff);
|
||||
s = CD_DCB((pos >> 16) & 0xff);
|
||||
f = CD_DCB((pos >> 8) & 0xff);
|
||||
pos = MSFtoLBA(m, s, f) - 150;
|
||||
m = bcd2bin((pos >> 24) & 0xff);
|
||||
s = bcd2bin((pos >> 16) & 0xff);
|
||||
f = bcd2bin((pos >> 8) & 0xff);
|
||||
if (pos == 0xffffffff) {
|
||||
cdrom_log("CD-ROM %i: (type 1) Search from current position\n", dev->id);
|
||||
pos = dev->seek_pos;
|
||||
} else
|
||||
pos = MSFtoLBA(m, s, f) - 150;
|
||||
|
||||
dev->seek_pos = pos;
|
||||
break;
|
||||
case 0x80:
|
||||
if (pos == 0xffffffff) {
|
||||
cdrom_log("CD-ROM %i: (type 2) Search from current position\n", dev->id);
|
||||
pos = dev->seek_pos;
|
||||
}
|
||||
dev->seek_pos = (pos >> 24) & 0xff;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Do this at this point, since it's at this point that we know the
|
||||
actual LBA position to start playing from. */
|
||||
if (!(dev->ops->track_type(dev, pos) & CD_TRACK_AUDIO)) {
|
||||
cdrom_log("CD-ROM %i: LBA %08X not on an audio track\n", dev->id, pos);
|
||||
cdrom_stop(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev->seek_pos = pos;
|
||||
dev->noplay = !playbit;
|
||||
/* Unlike standard commands, if there's a data track on an Audio CD (mixed mode)
|
||||
the playback continues with the audio muted (Toshiba CD-ROM SCSI-2 manual reference). */
|
||||
dev->cd_buflen = 0;
|
||||
dev->cd_status = playbit ? CD_STATUS_PLAYING : CD_STATUS_PAUSED;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
cdrom_toshiba_audio_play(cdrom_t *dev, uint32_t pos, int type)
|
||||
cdrom_audio_play_toshiba(cdrom_t *dev, uint32_t pos, int type)
|
||||
{
|
||||
int m = 0, s = 0, f = 0;
|
||||
|
||||
if (dev->cd_status == CD_STATUS_DATA_ONLY)
|
||||
return 0;
|
||||
|
||||
if (dev->cd_status == CD_STATUS_STOPPED || dev->cd_status == CD_STATUS_PAUSED)
|
||||
dev->cd_status = CD_STATUS_PLAYING;
|
||||
|
||||
/*Preliminary support, revert if too incomplete*/
|
||||
switch (type) {
|
||||
case 0x00:
|
||||
dev->cd_end = pos;
|
||||
break;
|
||||
case 0x40:
|
||||
cdrom_log("Toshiba Play Audio: MSF = %06x, type = %02x\n", pos, type);
|
||||
m = CD_DCB((pos >> 24) & 0xff);
|
||||
s = CD_DCB((pos >> 16) & 0xff);
|
||||
f = CD_DCB((pos >> 8) & 0xff);
|
||||
m = bcd2bin((pos >> 24) & 0xff);
|
||||
s = bcd2bin((pos >> 16) & 0xff);
|
||||
f = bcd2bin((pos >> 8) & 0xff);
|
||||
pos = MSFtoLBA(m, s, f) - 150;
|
||||
dev->cd_end = pos;
|
||||
break;
|
||||
case 0x80:
|
||||
dev->cd_end = (pos >> 24) & 0xff;
|
||||
break;
|
||||
case 0xc0:
|
||||
if (pos == 0xffffffff) {
|
||||
cdrom_log("CD-ROM %i: Playing from current position\n", dev->id);
|
||||
pos = dev->cd_end;
|
||||
}
|
||||
dev->cd_end = pos;
|
||||
break;
|
||||
}
|
||||
|
||||
cdrom_log("Toshiba/NEC Play Audio: MSF = %06x, type = %02x, cdstatus = %02x\n", pos, type, dev->cd_status);
|
||||
|
||||
/* Unlike standard commands, if there's a data track on an Audio CD (mixed mode)
|
||||
the playback continues with the audio muted (Toshiba CD-ROM SCSI-2 manual reference). */
|
||||
|
||||
dev->cd_buflen = 0;
|
||||
dev->cd_status = CD_STATUS_PLAYING;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
cdrom_audio_scan(cdrom_t *dev, uint32_t pos, int type)
|
||||
{
|
||||
int m = 0, s = 0, f = 0;
|
||||
|
||||
if (dev->cd_status == CD_STATUS_DATA_ONLY)
|
||||
return 0;
|
||||
|
||||
cdrom_log("Audio Scan: MSF = %06x, type = %02x\n", pos, type);
|
||||
switch (type) {
|
||||
case 0x00:
|
||||
if (pos == 0xffffffff) {
|
||||
cdrom_log("CD-ROM %i: (type 0) Search from current position\n", dev->id);
|
||||
pos = dev->seek_pos;
|
||||
}
|
||||
dev->seek_pos = pos;
|
||||
break;
|
||||
case 0x40:
|
||||
m = bcd2bin((pos >> 24) & 0xff);
|
||||
s = bcd2bin((pos >> 16) & 0xff);
|
||||
f = bcd2bin((pos >> 8) & 0xff);
|
||||
if (pos == 0xffffffff) {
|
||||
cdrom_log("CD-ROM %i: (type 1) Search from current position\n", dev->id);
|
||||
pos = dev->seek_pos;
|
||||
} else
|
||||
pos = MSFtoLBA(m, s, f) - 150;
|
||||
|
||||
dev->seek_pos = pos;
|
||||
break;
|
||||
case 0x80:
|
||||
dev->seek_pos = (pos >> 24) & 0xff;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -484,7 +696,6 @@ cdrom_toshiba_audio_play(cdrom_t *dev, uint32_t pos, int type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev->cd_end = pos;
|
||||
dev->cd_buflen = 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -505,7 +716,6 @@ cdrom_get_current_subchannel(cdrom_t *dev, uint8_t *b, int msf)
|
||||
uint32_t dat;
|
||||
|
||||
dev->ops->get_subchannel(dev, dev->seek_pos, &subc);
|
||||
cdrom_log("CD-ROM %i: Returned subchannel at %02i:%02i.%02i\n", subc.abs_m, subc.abs_s, subc.abs_f);
|
||||
|
||||
if (dev->cd_status == CD_STATUS_DATA_ONLY)
|
||||
ret = 0x15;
|
||||
@@ -518,8 +728,12 @@ cdrom_get_current_subchannel(cdrom_t *dev, uint8_t *b, int msf)
|
||||
ret = 0x13;
|
||||
}
|
||||
|
||||
if (b[pos] > 1)
|
||||
cdrom_log("CD-ROM %i: Returned subchannel at %02i:%02i.%02i, ret = %02x, seek pos = %08x, cd_end = %08x.\n", dev->id, subc.abs_m, subc.abs_s, subc.abs_f, ret, dev->seek_pos, dev->cd_end);
|
||||
|
||||
if (b[pos] > 1) {
|
||||
cdrom_log("B[%i] = %02x, ret = %02x.\n", pos, b[pos], ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
b[pos++] = subc.attr;
|
||||
b[pos++] = subc.track;
|
||||
@@ -529,7 +743,7 @@ cdrom_get_current_subchannel(cdrom_t *dev, uint8_t *b, int msf)
|
||||
b[pos] = 0;
|
||||
|
||||
/* NEC CDR-260 speaks BCD. */
|
||||
if ((dev->bus_type == CDROM_BUS_ATAPI) && dev->early) {
|
||||
if (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.01") || (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.00"))) /*NEC*/ {
|
||||
m = subc.abs_m;
|
||||
s = subc.abs_s;
|
||||
f = subc.abs_f;
|
||||
@@ -548,7 +762,7 @@ cdrom_get_current_subchannel(cdrom_t *dev, uint8_t *b, int msf)
|
||||
b[pos] = 0;
|
||||
|
||||
/* NEC CDR-260 speaks BCD. */
|
||||
if ((dev->bus_type == CDROM_BUS_ATAPI) && dev->early) {
|
||||
if (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.01") || (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.00"))) /*NEC*/ {
|
||||
m = subc.rel_m;
|
||||
s = subc.rel_s;
|
||||
f = subc.rel_f;
|
||||
@@ -579,6 +793,77 @@ cdrom_get_current_subchannel(cdrom_t *dev, uint8_t *b, int msf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
cdrom_get_current_subchannel_sony(cdrom_t *dev, uint8_t *b, int msf)
|
||||
{
|
||||
subchannel_t subc;
|
||||
int pos = 0;
|
||||
uint32_t dat;
|
||||
|
||||
dev->ops->get_subchannel(dev, dev->seek_pos, &subc);
|
||||
|
||||
cdrom_log("CD-ROM %i: Returned subchannel at %02i:%02i.%02i, seek pos = %08x, cd_end = %08x.\n", dev->id, subc.abs_m, subc.abs_s, subc.abs_f, dev->seek_pos, dev->cd_end);
|
||||
|
||||
b[pos++] = subc.attr;
|
||||
b[pos++] = subc.track;
|
||||
b[pos++] = subc.index;
|
||||
|
||||
if (msf) {
|
||||
b[pos++] = subc.rel_m;
|
||||
b[pos++] = subc.rel_s;
|
||||
b[pos++] = subc.rel_f;
|
||||
b[pos++] = subc.abs_m;
|
||||
b[pos++] = subc.abs_s;
|
||||
b[pos++] = subc.abs_f;
|
||||
} else {
|
||||
dat = MSFtoLBA(subc.rel_m, subc.rel_s, subc.rel_f);
|
||||
b[pos++] = (dat >> 16) & 0xff;
|
||||
b[pos++] = (dat >> 8) & 0xff;
|
||||
b[pos++] = dat & 0xff;
|
||||
dat = MSFtoLBA(subc.abs_m, subc.abs_s, subc.abs_f) - 150;
|
||||
b[pos++] = (dat >> 16) & 0xff;
|
||||
b[pos++] = (dat >> 8) & 0xff;
|
||||
b[pos++] = dat & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
cdrom_get_audio_status_sony(cdrom_t *dev, uint8_t *b, int msf)
|
||||
{
|
||||
uint8_t ret;
|
||||
subchannel_t subc;
|
||||
uint32_t dat;
|
||||
|
||||
dev->ops->get_subchannel(dev, dev->seek_pos, &subc);
|
||||
|
||||
if (dev->cd_status == CD_STATUS_DATA_ONLY)
|
||||
ret = 0x05;
|
||||
else {
|
||||
if (dev->cd_status == CD_STATUS_PLAYING)
|
||||
ret = dev->sound_on ? 0x00 : 0x02;
|
||||
else if (dev->cd_status == CD_STATUS_PAUSED)
|
||||
ret = 0x01;
|
||||
else
|
||||
ret = 0x03;
|
||||
}
|
||||
|
||||
if (msf) {
|
||||
b[0] = 0;
|
||||
b[1] = subc.abs_m;
|
||||
b[2] = subc.abs_s;
|
||||
b[3] = subc.abs_f;
|
||||
} else {
|
||||
dat = MSFtoLBA(subc.abs_m, subc.abs_s, subc.abs_f) - 150;
|
||||
b[0] = (dat >> 24) & 0xff;
|
||||
b[1] = (dat >> 16) & 0xff;
|
||||
b[2] = (dat >> 8) & 0xff;
|
||||
b[3] = dat & 0xff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
cdrom_get_current_subcodeq_playstatus(cdrom_t *dev, uint8_t *b)
|
||||
{
|
||||
@@ -587,27 +872,22 @@ cdrom_get_current_subcodeq_playstatus(cdrom_t *dev, uint8_t *b)
|
||||
|
||||
dev->ops->get_subchannel(dev, dev->seek_pos, &subc);
|
||||
|
||||
if (dev->cd_status == CD_STATUS_PLAYING)
|
||||
ret = 0x00;
|
||||
else if (dev->cd_status == CD_STATUS_PAUSED) {
|
||||
if (dev->noplay)
|
||||
ret = 0x02;
|
||||
else
|
||||
ret = 0x01;
|
||||
} else
|
||||
cdrom_log("Get Current Subcode-q Play Status = %02x, op = %02x.\n", dev->cd_status, dev->audio_op);
|
||||
|
||||
if ((dev->cd_status == CD_STATUS_DATA_ONLY) || (dev->cd_status == CD_STATUS_PLAYING_COMPLETED))
|
||||
ret = 0x03;
|
||||
else
|
||||
ret = (dev->cd_status == CD_STATUS_PLAYING) ? 0x00 : dev->audio_op;
|
||||
|
||||
b[0] = subc.attr;
|
||||
b[1] = CD_BCD(subc.track);
|
||||
b[2] = CD_BCD(subc.index);
|
||||
b[3] = CD_BCD(subc.rel_m);
|
||||
b[4] = CD_BCD(subc.rel_s);
|
||||
b[5] = CD_BCD(subc.rel_f);
|
||||
b[6] = CD_BCD(subc.abs_m);
|
||||
b[7] = CD_BCD(subc.abs_s);
|
||||
b[8] = CD_BCD(subc.abs_f);
|
||||
cdrom_log("CD-ROM %i: Returned subcode-q at %02i:%02i.%02i, track=%02x\n", dev->id, b[3], b[4], b[5], b[1]);
|
||||
|
||||
b[1] = bin2bcd(subc.track);
|
||||
b[2] = bin2bcd(subc.index);
|
||||
b[3] = bin2bcd(subc.rel_m);
|
||||
b[4] = bin2bcd(subc.rel_s);
|
||||
b[5] = bin2bcd(subc.rel_f);
|
||||
b[6] = bin2bcd(subc.abs_m);
|
||||
b[7] = bin2bcd(subc.abs_s);
|
||||
b[8] = bin2bcd(subc.abs_f);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -669,7 +949,7 @@ read_toc_normal(cdrom_t *dev, unsigned char *b, unsigned char start_track, int m
|
||||
b[len++] = 0;
|
||||
|
||||
/* NEC CDR-260 speaks BCD. */
|
||||
if ((dev->bus_type == CDROM_BUS_ATAPI) && dev->early) {
|
||||
if (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.01") || (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.00"))) { /*NEC*/
|
||||
m = ti.m;
|
||||
s = ti.s;
|
||||
f = ti.f;
|
||||
@@ -719,7 +999,7 @@ read_toc_session(cdrom_t *dev, unsigned char *b, int msf)
|
||||
b[len++] = 0;
|
||||
|
||||
/* NEC CDR-260 speaks BCD. */
|
||||
if ((dev->bus_type == CDROM_BUS_ATAPI) && dev->early) {
|
||||
if (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.01") || (!strcmp(cdrom_drive_types[dev->type].internal_name, "NEC_CD-ROM_DRIVE260_1.00"))) { /*NEC*/
|
||||
m = ti.m;
|
||||
s = ti.s;
|
||||
f = ti.f;
|
||||
@@ -777,6 +1057,74 @@ read_toc_raw(cdrom_t *dev, unsigned char *b)
|
||||
return len;
|
||||
}
|
||||
|
||||
static int
|
||||
read_toc_sony(cdrom_t *dev, unsigned char *b, unsigned char start_track, int msf)
|
||||
{
|
||||
track_info_t ti;
|
||||
int i, len = 4;
|
||||
int first_track, last_track;
|
||||
uint32_t temp;
|
||||
|
||||
cdrom_log("read_toc_sony(%08X, %08X, %02X, %i)\n", dev, b, start_track, msf);
|
||||
|
||||
dev->ops->get_tracks(dev, &first_track, &last_track);
|
||||
|
||||
/* Byte 2 = Number of the first track */
|
||||
dev->ops->get_track_info(dev, 1, 0, &ti);
|
||||
b[2] = ti.number;
|
||||
cdrom_log(" b[2] = %02X\n", b[2]);
|
||||
|
||||
/* Byte 3 = Number of the last track before the lead-out track */
|
||||
dev->ops->get_track_info(dev, last_track, 0, &ti);
|
||||
b[3] = ti.number;
|
||||
cdrom_log(" b[3] = %02X\n", b[2]);
|
||||
|
||||
if (start_track == 0x00)
|
||||
first_track = 0;
|
||||
else {
|
||||
first_track = -1;
|
||||
for (i = 0; i <= last_track; i++) {
|
||||
dev->ops->get_track_info(dev, i + 1, 0, &ti);
|
||||
if (ti.number >= start_track) {
|
||||
first_track = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
cdrom_log(" first_track = %i, last_track = %i\n", first_track, last_track);
|
||||
|
||||
/* No suitable starting track, return with error. */
|
||||
if (first_track == -1) {
|
||||
#ifdef ENABLE_CDROM_LOG
|
||||
cdrom_log(" [ERROR] No suitable track found\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = first_track; i <= last_track; i++) {
|
||||
cdrom_log(" tracks(%i) = %02X, %02X, %i:%02i.%02i\n", i, ti.attr, ti.number, ti.m, ti.s, ti.f);
|
||||
dev->ops->get_track_info(dev, i + 1, 0, &ti);
|
||||
|
||||
b[len++] = ti.attr;
|
||||
b[len++] = ti.number; /* track number */
|
||||
|
||||
if (msf) {
|
||||
b[len++] = 0;
|
||||
b[len++] = ti.m;
|
||||
b[len++] = ti.s;
|
||||
b[len++] = ti.f;
|
||||
} else {
|
||||
temp = MSFtoLBA(ti.m, ti.s, ti.f) - 150;
|
||||
b[len++] = temp >> 24;
|
||||
b[len++] = temp >> 16;
|
||||
b[len++] = temp >> 8;
|
||||
b[len++] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_read_toc(cdrom_t *dev, unsigned char *b, int type, unsigned char start_track, int msf, int max_len)
|
||||
{
|
||||
@@ -805,6 +1153,21 @@ cdrom_read_toc(cdrom_t *dev, unsigned char *b, int type, unsigned char start_tra
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_read_toc_sony(cdrom_t *dev, unsigned char *b, unsigned char start_track, int msf, int max_len)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = read_toc_sony(dev, b, start_track, msf);
|
||||
|
||||
len = MIN(len, max_len);
|
||||
|
||||
b[0] = (uint8_t) (((len - 2) >> 8) & 0xff);
|
||||
b[1] = (uint8_t) ((len - 2) & 0xff);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/* New API calls for Mitsumi CD-ROM. */
|
||||
void
|
||||
cdrom_get_track_buffer(cdrom_t *dev, uint8_t *buf)
|
||||
@@ -840,7 +1203,7 @@ cdrom_get_q(cdrom_t *dev, uint8_t *buf, int *curtoctrk, uint8_t mode)
|
||||
dev->ops->get_track_info(dev, *curtoctrk, 0, &ti);
|
||||
buf[0] = (ti.attr << 4) & 0xf0;
|
||||
buf[1] = ti.number;
|
||||
buf[2] = CD_BCD(*curtoctrk + 1);
|
||||
buf[2] = bin2bcd(*curtoctrk + 1);
|
||||
buf[3] = ti.m;
|
||||
buf[4] = ti.s;
|
||||
buf[5] = ti.f;
|
||||
@@ -887,35 +1250,50 @@ cdrom_mitsumi_audio_play(cdrom_t *dev, uint32_t pos, uint32_t len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
uint8_t
|
||||
cdrom_read_disc_info_toc(cdrom_t *dev, unsigned char *b, unsigned char track, int type)
|
||||
{
|
||||
track_info_t ti;
|
||||
int first_track, last_track;
|
||||
int m = 0, s = 0, f = 0;
|
||||
|
||||
dev->ops->get_tracks(dev, &first_track, &last_track);
|
||||
|
||||
cdrom_log("Read DISC Info TOC Type = %d, track = %d, first_track = %d, last_track = %d.\n", type, track, first_track, last_track);
|
||||
switch (type) {
|
||||
case 0:
|
||||
b[0] = CD_BCD(first_track);
|
||||
b[1] = CD_BCD(last_track);
|
||||
b[0] = bin2bcd(first_track);
|
||||
b[1] = bin2bcd(last_track);
|
||||
b[2] = 0;
|
||||
b[3] = 0;
|
||||
cdrom_log("CD-ROM %i: Returned Toshiba/NEC disc information (type 0) at %02i:%02i\n", dev->id, b[0], b[1]);
|
||||
break;
|
||||
case 1:
|
||||
dev->ops->get_track_info(dev, 0xAA, 0, &ti);
|
||||
b[0] = CD_BCD(ti.m);
|
||||
b[1] = CD_BCD(ti.s);
|
||||
b[2] = CD_BCD(ti.f);
|
||||
dev->ops->get_track_info(dev, 0xaa, 0, &ti);
|
||||
m = ti.m;
|
||||
s = ti.s;
|
||||
f = ti.f;
|
||||
msf_to_bcd(&m, &s, &f);
|
||||
b[0] = m;
|
||||
b[1] = s;
|
||||
b[2] = f;
|
||||
b[3] = 0;
|
||||
cdrom_log("CD-ROM %i: Returned Toshiba/NEC disc information (type 1) at %02i:%02i.%02i, track=%d\n", dev->id, b[0], b[1], b[2], bcd2bin(track));
|
||||
break;
|
||||
case 2:
|
||||
dev->ops->get_track_info(dev, CD_DCB(track), 0, &ti);
|
||||
b[0] = CD_BCD(ti.m);
|
||||
b[1] = CD_BCD(ti.s);
|
||||
b[2] = CD_BCD(ti.f);
|
||||
if (track > bin2bcd(last_track))
|
||||
return 0;
|
||||
|
||||
dev->ops->get_track_info(dev, bcd2bin(track), 0, &ti);
|
||||
m = ti.m;
|
||||
s = ti.s;
|
||||
f = ti.f;
|
||||
msf_to_bcd(&m, &s, &f);
|
||||
b[0] = m;
|
||||
b[1] = s;
|
||||
b[2] = f;
|
||||
b[3] = ti.attr;
|
||||
cdrom_log("CD-ROM %i: Returned Toshiba disc information at %02i:%02i.%02i, track=%d\n", dev->id, b[0], b[1], b[2], CD_DCB(track));
|
||||
cdrom_log("CD-ROM %i: Returned Toshiba/NEC disc information (type 2) at %02i:%02i.%02i, track=%d, m=%02i,s=%02i,f=%02i, tno=%02x.\n", dev->id, b[0], b[1], b[2], bcd2bin(track), m, s, f, ti.attr);
|
||||
break;
|
||||
case 3:
|
||||
b[0] = 0x00; /*TODO: correct it further, mark it as CD-Audio/CD-ROM disc for now*/
|
||||
@@ -924,6 +1302,8 @@ cdrom_read_disc_info_toc(cdrom_t *dev, unsigned char *b, unsigned char track, in
|
||||
b[3] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1201,7 +1581,7 @@ read_mode2_xa_form2(cdrom_t *dev, int cdrom_sector_flags, uint32_t lba, uint32_t
|
||||
|
||||
int
|
||||
cdrom_readsector_raw(cdrom_t *dev, uint8_t *buffer, int sector, int ismsf, int cdrom_sector_type,
|
||||
int cdrom_sector_flags, int *len)
|
||||
int cdrom_sector_flags, int *len, uint8_t vendor_type)
|
||||
{
|
||||
uint8_t *b, *temp_b;
|
||||
uint32_t msf, lba;
|
||||
@@ -1222,8 +1602,26 @@ cdrom_readsector_raw(cdrom_t *dev, uint8_t *buffer, int sector, int ismsf, int c
|
||||
lba = MSFtoLBA(m, s, f) - 150;
|
||||
msf = sector;
|
||||
} else {
|
||||
lba = sector;
|
||||
msf = cdrom_lba_to_msf_accurate(sector);
|
||||
switch (vendor_type) {
|
||||
case 0x00:
|
||||
lba = sector;
|
||||
msf = cdrom_lba_to_msf_accurate(sector);
|
||||
break;
|
||||
case 0x40:
|
||||
m = bcd2bin((sector >> 24) & 0xff);
|
||||
s = bcd2bin((sector >> 16) & 0xff);
|
||||
f = bcd2bin((sector >> 8) & 0xff);
|
||||
lba = MSFtoLBA(m, s, f) - 150;
|
||||
msf = sector;
|
||||
break;
|
||||
case 0x80:
|
||||
lba = bcd2bin((sector >> 24) & 0xff);
|
||||
msf = sector;
|
||||
break;
|
||||
/* Never used values but the compiler complains. */
|
||||
default:
|
||||
lba = msf = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->ops->track_type)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <86box/pic.h>
|
||||
#include <86box/dma.h>
|
||||
#include <86box/cdrom.h>
|
||||
#include <86box/cdrom_interface.h>
|
||||
#include <86box/cdrom_mitsumi.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/sound.h>
|
||||
@@ -109,6 +110,7 @@ typedef struct {
|
||||
int drvmode;
|
||||
int cur_toc_track;
|
||||
int pos;
|
||||
int newstat;
|
||||
} mcd_t;
|
||||
|
||||
/* The addresses sent from the guest are absolute, ie. a LBA of 0 corresponds to a MSF of 00:00:00. Otherwise, the counter displayed by the guest is wrong:
|
||||
@@ -141,9 +143,11 @@ mitsumi_cdrom_log(const char *fmt, ...)
|
||||
static void
|
||||
mitsumi_cdrom_reset(mcd_t *dev)
|
||||
{
|
||||
cdrom_t *cdrom = &cdrom[0];
|
||||
cdrom_t cdrom;
|
||||
|
||||
cdrom.host_drive = 0;
|
||||
|
||||
dev->stat = cdrom->host_drive ? (STAT_READY | STAT_CHANGE) : 0;
|
||||
dev->stat = cdrom.host_drive ? (STAT_READY | STAT_CHANGE) : 0;
|
||||
dev->cmdrd_count = 0;
|
||||
dev->cmdbuf_count = 0;
|
||||
dev->buf_count = 0;
|
||||
@@ -154,21 +158,19 @@ mitsumi_cdrom_reset(mcd_t *dev)
|
||||
dev->dmalen = COOKED_SECTOR_SIZE;
|
||||
dev->locked = 0;
|
||||
dev->change = 1;
|
||||
dev->newstat = 1;
|
||||
dev->data = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
mitsumi_cdrom_read_sector(mcd_t *dev, int first)
|
||||
{
|
||||
cdrom_t *cdrom = &cdrom[0];
|
||||
cdrom_t cdrom;
|
||||
uint8_t status;
|
||||
int ret;
|
||||
|
||||
if (cdrom == NULL)
|
||||
return 0;
|
||||
|
||||
if (dev->drvmode == DRV_MODE_CDDA) {
|
||||
status = cdrom_mitsumi_audio_play(cdrom, dev->readmsf, dev->readcount);
|
||||
status = cdrom_mitsumi_audio_play(&cdrom, dev->readmsf, dev->readcount);
|
||||
if (status == 1)
|
||||
return status;
|
||||
else
|
||||
@@ -182,15 +184,15 @@ mitsumi_cdrom_read_sector(mcd_t *dev, int first)
|
||||
dev->data = 0;
|
||||
return 0;
|
||||
}
|
||||
cdrom_stop(cdrom);
|
||||
ret = cdrom_readsector_raw(cdrom, dev->buf, cdrom->seek_pos, 0, 2, 0x10, (int *) &dev->readcount);
|
||||
cdrom_stop(&cdrom);
|
||||
ret = cdrom_readsector_raw(&cdrom, dev->buf, cdrom.seek_pos, 0, 2, 0x10, (int *) &dev->readcount, 0);
|
||||
if (!ret)
|
||||
return 0;
|
||||
if (dev->mode & 0x40) {
|
||||
dev->buf[12] = CD_BCD((dev->readmsf >> 16) & 0xff);
|
||||
dev->buf[13] = CD_BCD((dev->readmsf >> 8) & 0xff);
|
||||
}
|
||||
dev->readmsf = cdrom_lba_to_msf_accurate(cdrom->seek_pos + 1);
|
||||
dev->readmsf = cdrom_lba_to_msf_accurate(cdrom.seek_pos + 1);
|
||||
dev->buf_count = dev->dmalen + 1;
|
||||
dev->buf_idx = 0;
|
||||
dev->data = 1;
|
||||
@@ -213,6 +215,7 @@ mitsumi_cdrom_in(uint16_t port, void *priv)
|
||||
mcd_t *dev = (mcd_t *) priv;
|
||||
uint8_t ret;
|
||||
|
||||
pclog("Mitsumi CD-ROM IN=%03x\n", port);
|
||||
switch (port & 1) {
|
||||
case 0:
|
||||
if (dev->cmdbuf_count) {
|
||||
@@ -225,16 +228,19 @@ mitsumi_cdrom_in(uint16_t port, void *priv)
|
||||
if (!dev->buf_count)
|
||||
mitsumi_cdrom_read_sector(dev, 0);
|
||||
|
||||
pclog("Read port 0: ret = %02x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
pclog("Read port 0: stat = %02x\n", dev->stat);
|
||||
return dev->stat;
|
||||
case 1:
|
||||
ret = 0;
|
||||
picintc(1 << dev->irq);
|
||||
if (!dev->buf_count || !dev->data || dev->enable_dma)
|
||||
ret |= FLAG_NODATA;
|
||||
if (!dev->cmdbuf_count)
|
||||
if (!dev->cmdbuf_count || !dev->newstat)
|
||||
ret |= FLAG_NOSTAT;
|
||||
pclog("Read port 1: ret = %02x\n", ret | FLAG_UNK);
|
||||
return ret | FLAG_UNK;
|
||||
}
|
||||
|
||||
@@ -245,8 +251,9 @@ static void
|
||||
mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
mcd_t *dev = (mcd_t *) priv;
|
||||
cdrom_t *cdrom = &cdrom[0];
|
||||
cdrom_t cdrom;
|
||||
|
||||
pclog("Mitsumi CD-ROM OUT=%03x, val=%02x\n", port, val);
|
||||
switch (port & 1) {
|
||||
case 0:
|
||||
if (dev->cmdrd_count) {
|
||||
@@ -317,19 +324,19 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
break;
|
||||
}
|
||||
if (!dev->cmdrd_count)
|
||||
dev->stat = cdrom->host_drive ? (STAT_READY | (dev->change ? STAT_CHANGE : 0)) : 0;
|
||||
dev->stat = cdrom.host_drive ? (STAT_READY | (dev->change ? STAT_CHANGE : 0)) : 0;
|
||||
return;
|
||||
}
|
||||
dev->cmd = val;
|
||||
dev->cmdbuf_idx = 0;
|
||||
dev->cmdrd_count = 0;
|
||||
dev->cmdbuf_count = 1;
|
||||
dev->cmdbuf[0] = cdrom->host_drive ? (STAT_READY | (dev->change ? STAT_CHANGE : 0)) : 0;
|
||||
dev->cmdbuf[0] = cdrom.host_drive ? (STAT_READY | (dev->change ? STAT_CHANGE : 0)) : 0;
|
||||
dev->data = 0;
|
||||
switch (val) {
|
||||
case CMD_GET_INFO:
|
||||
if (cdrom->host_drive) {
|
||||
cdrom_get_track_buffer(cdrom, &(dev->cmdbuf[1]));
|
||||
if (cdrom.host_drive) {
|
||||
cdrom_get_track_buffer(&cdrom, &(dev->cmdbuf[1]));
|
||||
dev->cmdbuf_count = 10;
|
||||
dev->readcount = 0;
|
||||
} else {
|
||||
@@ -338,8 +345,8 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
break;
|
||||
case CMD_GET_Q:
|
||||
if (cdrom->host_drive) {
|
||||
cdrom_get_q(cdrom, &(dev->cmdbuf[1]), &dev->cur_toc_track, dev->mode & MODE_GET_TOC);
|
||||
if (cdrom.host_drive) {
|
||||
cdrom_get_q(&cdrom, &(dev->cmdbuf[1]), &dev->cur_toc_track, dev->mode & MODE_GET_TOC);
|
||||
dev->cmdbuf_count = 11;
|
||||
dev->readcount = 0;
|
||||
} else {
|
||||
@@ -355,7 +362,7 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
break;
|
||||
case CMD_STOPCDDA:
|
||||
case CMD_STOP:
|
||||
cdrom_stop(cdrom);
|
||||
cdrom_stop(&cdrom);
|
||||
dev->drvmode = DRV_MODE_STOP;
|
||||
dev->cur_toc_track = 0;
|
||||
break;
|
||||
@@ -364,7 +371,7 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
break;
|
||||
case CMD_READ1X:
|
||||
case CMD_READ2X:
|
||||
if (cdrom->host_drive) {
|
||||
if (cdrom.host_drive) {
|
||||
dev->readcount = 0;
|
||||
dev->drvmode = (val == CMD_READ1X) ? DRV_MODE_CDDA : DRV_MODE_READ;
|
||||
dev->cmdrd_count = 6;
|
||||
@@ -380,13 +387,17 @@ mitsumi_cdrom_out(uint16_t port, uint8_t val, void *priv)
|
||||
dev->cmdbuf_count = 4;
|
||||
break;
|
||||
case CMD_EJECT:
|
||||
cdrom_stop(cdrom);
|
||||
cdrom_stop(&cdrom);
|
||||
cdrom_eject(0);
|
||||
dev->readcount = 0;
|
||||
break;
|
||||
case CMD_LOCK:
|
||||
dev->cmdrd_count = 1;
|
||||
break;
|
||||
case CMD_SOFT_RESET:
|
||||
pclog("Soft Reset\n");
|
||||
mitsumi_cdrom_reset(dev);
|
||||
break;
|
||||
default:
|
||||
dev->cmdbuf[0] = dev->stat | STAT_CMD_CHECK;
|
||||
break;
|
||||
@@ -429,15 +440,15 @@ mitsumi_cdrom_close(void *priv)
|
||||
}
|
||||
|
||||
const device_t mitsumi_cdrom_device = {
|
||||
"Mitsumi CD-ROM interface",
|
||||
"mcd",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
0,
|
||||
mitsumi_cdrom_init,
|
||||
mitsumi_cdrom_close,
|
||||
NULL,
|
||||
{ NULL },
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
.name = "Mitsumi CD-ROM interface",
|
||||
.internal_name = "mcd",
|
||||
.flags = DEVICE_ISA | DEVICE_AT,
|
||||
.local = 1,
|
||||
.init = mitsumi_cdrom_init,
|
||||
.close = mitsumi_cdrom_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2020,2021 David Hrdlička.
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
#
|
||||
|
||||
add_library(chipset OBJECT 82c100.c acc2168.c cs8230.c ali1429.c ali1489.c ali1531.c ali1541.c ali1543.c
|
||||
add_library(chipset OBJECT 82c100.c acc2168.c cs8230.c ali1429.c ali1435.c ali1489.c ali1531.c ali1541.c ali1543.c
|
||||
ali1621.c ali6117.c headland.c ims8848.c intel_82335.c contaq_82c59x.c cs4031.c intel_420ex.c
|
||||
intel_4x0.c intel_i450kx.c intel_sio.c intel_piix.c ../ioapic.c neat.c opti283.c opti291.c opti391.c
|
||||
opti495.c opti822.c opti895.c opti5x7.c scamp.c scat.c sis_85c310.c sis_85c4xx.c
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Tiseno100
|
||||
*
|
||||
* Copyright 2019 Sarah Walker.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the ALi M1429 chipset.
|
||||
*
|
||||
* Note: This chipset has no datasheet, everything were done via
|
||||
* Note: This chipset has no datasheet, everything were done via
|
||||
* reverse engineering the BIOS of various machines using it.
|
||||
*
|
||||
*
|
||||
@@ -16,8 +16,8 @@
|
||||
* Authors: Tiseno100,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2020,2021 Tiseno100.
|
||||
* Copyright 2021,2021 Miran Grca.
|
||||
* Copyright 2020-2021 Tiseno100.
|
||||
* Copyright 2021 Miran Grca.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -161,9 +161,11 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv)
|
||||
#endif
|
||||
|
||||
if (dev->index == 0x03)
|
||||
dev->cfg_locked = !(val == 0xc5);
|
||||
dev->cfg_locked = (val != 0xc5);
|
||||
|
||||
if (!dev->cfg_locked) {
|
||||
pclog("M1429: dev->regs[%02x] = %02x\n", dev->index, val);
|
||||
|
||||
/* Common M1429 Registers */
|
||||
switch (dev->index) {
|
||||
case 0x10:
|
||||
@@ -324,8 +326,8 @@ ali1429_init(const device_t *info)
|
||||
GREEN = info->local;
|
||||
|
||||
/* M1429 Ports:
|
||||
22h Index Port
|
||||
23h Data Port
|
||||
22h Index Port
|
||||
23h Data Port
|
||||
*/
|
||||
io_sethandler(0x0022, 0x0002, ali1429_read, NULL, NULL, ali1429_write, NULL, NULL, dev);
|
||||
|
||||
|
||||
315
src/chipset/ali1435.c
Normal file
315
src/chipset/ali1435.c
Normal file
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Emulation of ALi M1435 chipset that acts as both the
|
||||
* southbridge.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2020 Miran Grca.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/apm.h>
|
||||
#include <86box/dma.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/smram.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/pic.h>
|
||||
#include <86box/pit.h>
|
||||
#include <86box/port_92.h>
|
||||
#include <86box/hdc_ide.h>
|
||||
#include <86box/hdc.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/chipset.h>
|
||||
#include <86box/spd.h>
|
||||
|
||||
#define MEM_STATE_SHADOW_R 0x01
|
||||
#define MEM_STATE_SHADOW_W 0x02
|
||||
#define MEM_STATE_SMRAM 0x04
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t index, cfg_locked,
|
||||
regs[16], pci_regs[256];
|
||||
} ali1435_t;
|
||||
|
||||
#define ENABLE_ALI1435_LOG 1
|
||||
#ifdef ENABLE_ALI1435_LOG
|
||||
int ali1435_do_log = ENABLE_ALI1435_LOG;
|
||||
|
||||
static void
|
||||
ali1435_log(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (ali1435_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define ali1435_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
/* NOTE: We cheat here. The real ALi M1435 uses a level to edge triggered IRQ converter
|
||||
when the most siginificant bit is set. We work around that by manipulating the
|
||||
emulated PIC's ELCR register. */
|
||||
static void
|
||||
ali1435_update_irqs(ali1435_t *dev, int set)
|
||||
{
|
||||
uint8_t val;
|
||||
int i, reg;
|
||||
int shift, irq;
|
||||
int irq_map[8] = { -1, 5, 9, 10, 11, 12, 14, 15 };
|
||||
pic_t *temp_pic;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
reg = 0x80 + (i >> 1);
|
||||
shift = (i & 1) << 2;
|
||||
val = (dev->pci_regs[reg] >> shift) & 0x0f;
|
||||
irq = irq_map[val & 0x07];
|
||||
if (irq == -1)
|
||||
continue;
|
||||
temp_pic = (irq >= 8) ? &pic2 : &pic;
|
||||
irq &= 7;
|
||||
if (set && (val & 0x08))
|
||||
temp_pic->elcr |= (1 << irq);
|
||||
else
|
||||
temp_pic->elcr &= ~(1 << irq);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ali1435_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
ali1435_t *dev = (ali1435_t *) priv;
|
||||
int irq, irq_map[8] = { -1, 5, 9, 10, 11, 12, 14, 15 };
|
||||
|
||||
ali1435_log("ali1435_write(%02X, %02X, %02X)\n", func, addr, val);
|
||||
|
||||
if (func > 0)
|
||||
return;
|
||||
|
||||
if ((addr < 0x04) || (addr == 0x06) || ((addr >= 0x08) && (addr <= 0x0b)))
|
||||
return;
|
||||
|
||||
if ((addr >= 0x0f) && (addr < 0x30))
|
||||
return;
|
||||
|
||||
if ((addr >= 0x34) && (addr < 0x40))
|
||||
return;
|
||||
|
||||
switch (addr) {
|
||||
/* Dummy PCI Config */
|
||||
case 0x04:
|
||||
dev->pci_regs[addr] = (val & 0x7f) | 0x07;
|
||||
break;
|
||||
|
||||
case 0x05:
|
||||
dev->pci_regs[addr] = (val & 0x01);
|
||||
break;
|
||||
|
||||
/* Dummy PCI Status */
|
||||
case 0x07:
|
||||
dev->pci_regs[addr] &= ~(val & 0xb8);
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
case 0x81:
|
||||
dev->pci_regs[addr] = val;
|
||||
ali1435_update_irqs(dev, 0);
|
||||
irq = irq_map[val & 0x07];
|
||||
if (irq >= 0) {
|
||||
ali1435_log("Set IRQ routing: INT %c -> %02X\n", 0x41 + ((addr & 0x01) << 1), irq);
|
||||
pci_set_irq_routing(PCI_INTA + ((addr & 0x01) << 1), irq);
|
||||
} else {
|
||||
ali1435_log("Set IRQ routing: INT %c -> FF\n", 0x41 + ((addr & 0x01) << 1));
|
||||
pci_set_irq_routing(PCI_INTA + ((addr & 0x01) << 1), PCI_IRQ_DISABLED);
|
||||
}
|
||||
irq = irq_map[(val >> 4) & 0x07];
|
||||
if (irq >= 0) {
|
||||
ali1435_log("Set IRQ routing: INT %c -> %02X\n", 0x42 + ((addr & 0x01) << 1), irq);
|
||||
pci_set_irq_routing(PCI_INTB + ((addr & 0x01) << 1), irq);
|
||||
} else {
|
||||
ali1435_log("Set IRQ routing: INT %c -> FF\n", 0x42 + ((addr & 0x01) << 1));
|
||||
pci_set_irq_routing(PCI_INTB + ((addr & 0x01) << 1), PCI_IRQ_DISABLED);
|
||||
}
|
||||
ali1435_update_irqs(dev, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
dev->pci_regs[addr] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
ali1435_pci_read(int func, int addr, void *priv)
|
||||
{
|
||||
ali1435_t *dev = (ali1435_t *) priv;
|
||||
uint8_t ret;
|
||||
|
||||
ret = 0xff;
|
||||
|
||||
if (func == 0)
|
||||
ret = dev->pci_regs[addr];
|
||||
|
||||
ali1435_log("ali1435_read(%02X, %02X) = %02X\n", func, addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
ali1435_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
ali1435_t *dev = (ali1435_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x22:
|
||||
dev->index = val;
|
||||
break;
|
||||
|
||||
case 0x23:
|
||||
/* #ifdef ENABLE_ALI1435_LOG
|
||||
if (dev->index != 0x03)
|
||||
ali1435_log("M1435: dev->regs[%02x] = %02x\n", dev->index, val);
|
||||
#endif */
|
||||
|
||||
if (dev->index == 0x03)
|
||||
dev->cfg_locked = (val != 0x69);
|
||||
|
||||
if (!dev->cfg_locked) {
|
||||
pclog("M1435: dev->regs[%02x] = %02x\n", dev->index, val);
|
||||
|
||||
switch (dev->index) {
|
||||
/* PCI Mechanism select? */
|
||||
case 0x00:
|
||||
dev->regs[dev->index] = val;
|
||||
pclog("PMC = %i\n", val != 0xc8);
|
||||
pci_set_pmc(val != 0xc8);
|
||||
break;
|
||||
|
||||
/* ???? */
|
||||
case 0x06:
|
||||
dev->regs[dev->index] = val;
|
||||
break;
|
||||
|
||||
/* ???? */
|
||||
case 0x07:
|
||||
dev->regs[dev->index] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
ali1435_read(uint16_t addr, void *priv)
|
||||
{
|
||||
ali1435_t *dev = (ali1435_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
if ((addr == 0x23) && (dev->index < 0x10))
|
||||
ret = dev->regs[dev->index];
|
||||
else if (addr == 0x22)
|
||||
ret = dev->index;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
ali1435_reset(void *priv)
|
||||
{
|
||||
ali1435_t *dev = (ali1435_t *) priv;
|
||||
|
||||
memset(dev->regs, 0, 16);
|
||||
|
||||
dev->regs[0x00] = 0xff;
|
||||
|
||||
pci_set_pmc(0);
|
||||
|
||||
dev->cfg_locked = 1;
|
||||
|
||||
memset(dev->pci_regs, 0, 256);
|
||||
|
||||
dev->pci_regs[0x00] = 0x25;
|
||||
dev->pci_regs[0x01] = 0x10; /*ALi*/
|
||||
dev->pci_regs[0x02] = 0x35;
|
||||
dev->pci_regs[0x03] = 0x14; /*M1435*/
|
||||
dev->pci_regs[0x04] = 0x07;
|
||||
dev->pci_regs[0x07] = 0x04;
|
||||
dev->pci_regs[0x0b] = 0x06;
|
||||
|
||||
dev->pci_regs[0x80] = 0x80;
|
||||
dev->pci_regs[0x81] = 0x00;
|
||||
|
||||
pci_set_irq_routing(PCI_INTA, PCI_IRQ_DISABLED);
|
||||
pci_set_irq_routing(PCI_INTB, PCI_IRQ_DISABLED);
|
||||
pci_set_irq_routing(PCI_INTC, PCI_IRQ_DISABLED);
|
||||
pci_set_irq_routing(PCI_INTD, PCI_IRQ_DISABLED);
|
||||
}
|
||||
|
||||
static void
|
||||
ali1435_close(void *p)
|
||||
{
|
||||
ali1435_t *dev = (ali1435_t *) p;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
static void *
|
||||
ali1435_init(const device_t *info)
|
||||
{
|
||||
ali1435_t *dev = (ali1435_t *) malloc(sizeof(ali1435_t));
|
||||
memset(dev, 0, sizeof(ali1435_t));
|
||||
|
||||
dev->cfg_locked = 1;
|
||||
|
||||
/* M1435 Ports:
|
||||
22h Index Port
|
||||
23h Data Port
|
||||
*/
|
||||
io_sethandler(0x0022, 0x0002, ali1435_read, NULL, NULL, ali1435_write, NULL, NULL, dev);
|
||||
|
||||
pci_add_card(PCI_ADD_NORTHBRIDGE, ali1435_pci_read, ali1435_pci_write, dev);
|
||||
|
||||
ali1435_reset(dev);
|
||||
|
||||
/* pci_set_irq_level(PCI_INTA, 0);
|
||||
pci_set_irq_level(PCI_INTB, 0);
|
||||
pci_set_irq_level(PCI_INTC, 0);
|
||||
pci_set_irq_level(PCI_INTD, 0); */
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
const device_t ali1435_device = {
|
||||
.name = "Intel ALi M1435",
|
||||
.internal_name = "ali1435",
|
||||
.flags = DEVICE_PCI,
|
||||
.local = 0x00,
|
||||
.init = ali1435_init,
|
||||
.close = ali1435_close,
|
||||
.reset = ali1435_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
@@ -13,8 +13,8 @@
|
||||
* Authors: Tiseno100,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2020,2021 Tiseno100.
|
||||
* Copyright 2020,2021 Miran Grca.
|
||||
* Copyright 2020-2021 Tiseno100.
|
||||
* Copyright 2020-2021 Miran Grca.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -254,6 +254,14 @@ ali1533_write(int func, int addr, uint8_t val, void *priv)
|
||||
dev->pci_conf[addr] = val & 0xcf;
|
||||
/* This actually enables/disables the USB *device* rather than the interface itself. */
|
||||
dev->usb_dev_enable = !(val & 0x40);
|
||||
if (dev->type == 1) {
|
||||
nvr_at_index_read_handler(0, 0x0070, dev->nvr);
|
||||
nvr_at_index_read_handler(0, 0x0072, dev->nvr);
|
||||
if (val & 0x20) {
|
||||
nvr_at_index_read_handler(1, 0x0070, dev->nvr);
|
||||
nvr_at_index_read_handler(1, 0x0072, dev->nvr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Hardware setting status bits, read-only (register 0x54) */
|
||||
|
||||
@@ -46,38 +46,40 @@ typedef struct ali6117_t {
|
||||
|
||||
/* Total size, Bank 0 size, Bank 1 size, Bank 2 size, Bank 3 size. */
|
||||
static uint32_t ali6117_modes[32][5] = {
|
||||
{ 1024, 512, 512, 0, 0 },
|
||||
{ 2048, 512, 512, 512, 512 },
|
||||
{ 3072, 512, 512, 2048, 0 },
|
||||
{ 5120, 512, 512, 2048, 2048 },
|
||||
{ 9216, 512, 512, 8192, 0 },
|
||||
{ 1024, 1024, 0, 0, 0 },
|
||||
{ 2048, 1024, 1024, 0, 0 },
|
||||
{ 4096, 1024, 1024, 2048, 0 },
|
||||
{ 6144, 1024, 1024, 2048, 2048 },
|
||||
{ 10240, 1024, 1024, 8192, 0 },
|
||||
{ 18432, 1024, 1024, 8192, 8192 },
|
||||
{ 3072, 1024, 2048, 0, 0 },
|
||||
{ 5120, 1024, 2048, 2048, 0 },
|
||||
{ 9216, 1024, 8192, 0, 0 },
|
||||
{ 2048, 2048, 0, 0, 0 },
|
||||
{ 4096, 2048, 2048, 0, 0 },
|
||||
{ 6144, 2048, 2048, 2048, 0 },
|
||||
{ 8192, 2048, 2048, 2048, 2048 },
|
||||
{ 12288, 2048, 2048, 8192, 0 },
|
||||
{ 20480, 2048, 2048, 8192, 8192 },
|
||||
{ 10240, 2048, 8192, 0, 0 },
|
||||
{ 18432, 2048, 8192, 8192, 0 },
|
||||
{ 26624, 2048, 8192, 8192, 8192 },
|
||||
{ 4096, 4096, 0, 0, 0 },
|
||||
{ 8192, 4096, 4096, 0, 0 },
|
||||
{ 24576, 4096, 4096, 8192, 8192 },
|
||||
{ 12288, 4096, 8192, 0, 0 },
|
||||
{ 8192, 8192, 0, 0, 0 },
|
||||
{ 16384, 8192, 8192, 0, 0 },
|
||||
{ 24576, 8192, 8192, 8192, 0 },
|
||||
{ 32768, 8192, 8192, 8192, 8192 },
|
||||
{ 65536, 32768, 32768, 0, 0 }
|
||||
// clang-format off
|
||||
{ 1024, 512, 512, 0, 0 },
|
||||
{ 2048, 512, 512, 512, 512 },
|
||||
{ 3072, 512, 512, 2048, 0 },
|
||||
{ 5120, 512, 512, 2048, 2048 },
|
||||
{ 9216, 512, 512, 8192, 0 },
|
||||
{ 1024, 1024, 0, 0, 0 },
|
||||
{ 2048, 1024, 1024, 0, 0 },
|
||||
{ 4096, 1024, 1024, 2048, 0 },
|
||||
{ 6144, 1024, 1024, 2048, 2048 },
|
||||
{ 10240, 1024, 1024, 8192, 0 },
|
||||
{ 18432, 1024, 1024, 8192, 8192 },
|
||||
{ 3072, 1024, 2048, 0, 0 },
|
||||
{ 5120, 1024, 2048, 2048, 0 },
|
||||
{ 9216, 1024, 8192, 0, 0 },
|
||||
{ 2048, 2048, 0, 0, 0 },
|
||||
{ 4096, 2048, 2048, 0, 0 },
|
||||
{ 6144, 2048, 2048, 2048, 0 },
|
||||
{ 8192, 2048, 2048, 2048, 2048 },
|
||||
{ 12288, 2048, 2048, 8192, 0 },
|
||||
{ 20480, 2048, 2048, 8192, 8192 },
|
||||
{ 10240, 2048, 8192, 0, 0 },
|
||||
{ 18432, 2048, 8192, 8192, 0 },
|
||||
{ 26624, 2048, 8192, 8192, 8192 },
|
||||
{ 4096, 4096, 0, 0, 0 },
|
||||
{ 8192, 4096, 4096, 0, 0 },
|
||||
{ 24576, 4096, 4096, 8192, 8192 },
|
||||
{ 12288, 4096, 8192, 0, 0 },
|
||||
{ 8192, 8192, 0, 0, 0 },
|
||||
{ 16384, 8192, 8192, 0, 0 },
|
||||
{ 24576, 8192, 8192, 8192, 0 },
|
||||
{ 32768, 8192, 8192, 8192, 8192 },
|
||||
{ 65536, 32768, 32768, 0, 0 }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
#ifdef ENABLE_ALI6117_LOG
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
*
|
||||
* Copyright 2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Original by GreatPsycho for PCem.
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
*
|
||||
* Copyright 2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
@@ -84,16 +84,20 @@ typedef struct scat_t {
|
||||
} scat_t;
|
||||
|
||||
static const uint8_t max_map[32] = {
|
||||
// clang-format off
|
||||
0, 1, 1, 1, 2, 3, 4, 8,
|
||||
4, 8, 12, 16, 20, 24, 28, 32,
|
||||
0, 5, 9, 13, 6, 10, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
// clang-format om
|
||||
};
|
||||
static const uint8_t max_map_sx[32] = {
|
||||
0, 1, 2, 1, 3, 4, 6, 10,
|
||||
5, 9, 13, 4, 8, 12, 16, 14,
|
||||
18, 22, 26, 20, 24, 28, 32, 18,
|
||||
20, 32, 0, 0, 0, 0, 0, 0
|
||||
// clang-format off
|
||||
0, 1, 2, 1, 3, 4, 6, 10,
|
||||
5, 9, 13, 4, 8, 12, 16, 14,
|
||||
18, 22, 26, 20, 24, 28, 32, 18,
|
||||
20, 32, 0, 0, 0, 0, 0, 0
|
||||
// clang-format om
|
||||
};
|
||||
static const uint8_t scatsx_external_is_RAS[33] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2019,2020 Miran Grca.
|
||||
* Copyright 2019-2020 Miran Grca.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef struct sis_85c50x_t {
|
||||
pci_conf[256], pci_conf_sb[256],
|
||||
regs[256];
|
||||
|
||||
smram_t *smram;
|
||||
smram_t *smram[2];
|
||||
port_92_t *port_92;
|
||||
} sis_85c50x_t;
|
||||
|
||||
@@ -93,28 +93,41 @@ static void
|
||||
sis_85c50x_smm_recalc(sis_85c50x_t *dev)
|
||||
{
|
||||
/* NOTE: Naming mismatch - what the datasheet calls "host address" is what we call ram_base. */
|
||||
uint32_t ram_base = (dev->pci_conf[0x64] << 20) | ((dev->pci_conf[0x65] & 0x07) << 28);
|
||||
uint32_t host_base = (dev->pci_conf[0x64] << 20) | ((dev->pci_conf[0x65] & 0x07) << 28);
|
||||
|
||||
smram_disable(dev->smram);
|
||||
smram_disable_all();
|
||||
|
||||
if ((((dev->pci_conf[0x65] & 0xe0) >> 5) != 0x00) && (ram_base == 0x00000000))
|
||||
if ((((dev->pci_conf[0x65] & 0xe0) >> 5) != 0x00) && (host_base == 0x00000000))
|
||||
return;
|
||||
|
||||
switch ((dev->pci_conf[0x65] & 0xe0) >> 5) {
|
||||
case 0x00:
|
||||
smram_enable(dev->smram, 0xe0000, 0xe0000, 0x8000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
sis_85c50x_log("SiS 50x SMRAM: 000E0000-000E7FFF -> 000E0000-000E7FFF\n");
|
||||
smram_enable(dev->smram[0], 0xe0000, 0xe0000, 0x8000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
break;
|
||||
case 0x01:
|
||||
smram_enable(dev->smram, 0xb0000, ram_base, 0x10000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
host_base |= 0x000b0000;
|
||||
sis_85c50x_log("SiS 50x SMRAM: %08X-%08X -> 000B0000-000BFFFF\n", host_base, host_base + 0x10000 - 1);
|
||||
smram_enable(dev->smram[0], host_base, 0xb0000, 0x10000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
smram_enable(dev->smram[1], host_base ^ 0x00100000, 0xb0000, 0x10000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
break;
|
||||
case 0x02:
|
||||
smram_enable(dev->smram, 0xa0000, ram_base, 0x10000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
host_base |= 0x000a0000;
|
||||
sis_85c50x_log("SiS 50x SMRAM: %08X-%08X -> 000A0000-000AFFFF\n", host_base, host_base + 0x10000 - 1);
|
||||
smram_enable(dev->smram[0], host_base, 0xa0000, 0x10000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
smram_enable(dev->smram[1], host_base ^ 0x00100000, 0xa0000, 0x10000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
break;
|
||||
case 0x04:
|
||||
smram_enable(dev->smram, 0xa0000, ram_base, 0x8000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
host_base |= 0x000a0000;
|
||||
sis_85c50x_log("SiS 50x SMRAM: %08X-%08X -> 000A0000-000AFFFF\n", host_base, host_base + 0x8000 - 1);
|
||||
smram_enable(dev->smram[0], host_base, 0xa0000, 0x8000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
smram_enable(dev->smram[1], host_base ^ 0x00100000, 0xa0000, 0x8000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
break;
|
||||
case 0x06:
|
||||
smram_enable(dev->smram, 0xb0000, ram_base, 0x8000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
host_base |= 0x000b0000;
|
||||
sis_85c50x_log("SiS 50x SMRAM: %08X-%08X -> 000B0000-000BFFFF\n", host_base, host_base + 0x8000 - 1);
|
||||
smram_enable(dev->smram[0], host_base, 0xb0000, 0x8000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
smram_enable(dev->smram[1], host_base ^ 0x00100000, 0xa0000, 0x8000, (dev->pci_conf[0x65] & 0x10), 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -122,95 +135,97 @@ sis_85c50x_smm_recalc(sis_85c50x_t *dev)
|
||||
static void
|
||||
sis_85c50x_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
sis_85c50x_t *dev = (sis_85c50x_t *) priv;
|
||||
uint8_t valxor = (val ^ dev->pci_conf[addr]);
|
||||
sis_85c50x_t *dev = (sis_85c50x_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x04: /* Command - low byte */
|
||||
dev->pci_conf[addr] = (dev->pci_conf[addr] & 0xb4) | (val & 0x4b);
|
||||
break;
|
||||
case 0x07: /* Status - high byte */
|
||||
dev->pci_conf[addr] = ((dev->pci_conf[addr] & 0xf9) & ~(val & 0xf8)) | (val & 0x06);
|
||||
break;
|
||||
case 0x50:
|
||||
dev->pci_conf[addr] = val;
|
||||
break;
|
||||
case 0x51: /* Cache */
|
||||
dev->pci_conf[addr] = val;
|
||||
cpu_cache_ext_enabled = (val & 0x40);
|
||||
cpu_update_waitstates();
|
||||
break;
|
||||
case 0x52:
|
||||
dev->pci_conf[addr] = val;
|
||||
break;
|
||||
case 0x53: /* Shadow RAM */
|
||||
case 0x54:
|
||||
case 0x55:
|
||||
case 0x56:
|
||||
dev->pci_conf[addr] = val;
|
||||
sis_85c50x_shadow_recalc(dev);
|
||||
if (addr == 0x54)
|
||||
sis_85c50x_log("85C501: [W] (%02X, %02X) = %02X\n", func, addr, val);
|
||||
|
||||
if (func == 0x00)
|
||||
switch (addr) {
|
||||
case 0x04: /* Command - low byte */
|
||||
dev->pci_conf[addr] = (dev->pci_conf[addr] & 0xb4) | (val & 0x4b);
|
||||
break;
|
||||
case 0x07: /* Status - high byte */
|
||||
dev->pci_conf[addr] = ((dev->pci_conf[addr] & 0xf9) & ~(val & 0xf8)) | (val & 0x06);
|
||||
break;
|
||||
case 0x50:
|
||||
dev->pci_conf[addr] = val;
|
||||
break;
|
||||
case 0x51: /* Cache */
|
||||
dev->pci_conf[addr] = val;
|
||||
cpu_cache_ext_enabled = (val & 0x40);
|
||||
cpu_update_waitstates();
|
||||
break;
|
||||
case 0x52:
|
||||
dev->pci_conf[addr] = val;
|
||||
break;
|
||||
case 0x53: /* Shadow RAM */
|
||||
case 0x54:
|
||||
case 0x55:
|
||||
case 0x56:
|
||||
dev->pci_conf[addr] = val;
|
||||
sis_85c50x_shadow_recalc(dev);
|
||||
if (addr == 0x54)
|
||||
sis_85c50x_smm_recalc(dev);
|
||||
break;
|
||||
case 0x57:
|
||||
case 0x58:
|
||||
case 0x59:
|
||||
case 0x5a:
|
||||
case 0x5c:
|
||||
case 0x5d:
|
||||
case 0x5e:
|
||||
case 0x61:
|
||||
case 0x62:
|
||||
case 0x63:
|
||||
case 0x67:
|
||||
case 0x68:
|
||||
case 0x6a:
|
||||
case 0x6b:
|
||||
case 0x6c:
|
||||
case 0x6d:
|
||||
case 0x6e:
|
||||
case 0x6f:
|
||||
dev->pci_conf[addr] = val;
|
||||
break;
|
||||
case 0x5f:
|
||||
dev->pci_conf[addr] = val & 0xfe;
|
||||
break;
|
||||
case 0x5b:
|
||||
dev->pci_conf[addr] = val;
|
||||
break;
|
||||
case 0x60: /* SMI */
|
||||
if ((dev->pci_conf[0x68] & 0x01) && !(dev->pci_conf[addr] & 0x02) && (val & 0x02)) {
|
||||
dev->pci_conf[0x69] |= 0x01;
|
||||
smi_raise();
|
||||
}
|
||||
dev->pci_conf[addr] = val & 0x3e;
|
||||
break;
|
||||
case 0x64: /* SMRAM */
|
||||
case 0x65:
|
||||
dev->pci_conf[addr] = val;
|
||||
sis_85c50x_smm_recalc(dev);
|
||||
break;
|
||||
case 0x57:
|
||||
case 0x58:
|
||||
case 0x59:
|
||||
case 0x5a:
|
||||
case 0x5c:
|
||||
case 0x5d:
|
||||
case 0x5e:
|
||||
case 0x61:
|
||||
case 0x62:
|
||||
case 0x63:
|
||||
case 0x67:
|
||||
case 0x68:
|
||||
case 0x6a:
|
||||
case 0x6b:
|
||||
case 0x6c:
|
||||
case 0x6d:
|
||||
case 0x6e:
|
||||
case 0x6f:
|
||||
dev->pci_conf[addr] = val;
|
||||
break;
|
||||
case 0x5f:
|
||||
dev->pci_conf[addr] = val & 0xfe;
|
||||
break;
|
||||
case 0x5b:
|
||||
dev->pci_conf[addr] = val;
|
||||
if (valxor & 0xc0)
|
||||
port_92_set_features(dev->port_92, !!(val & 0x40), !!(val & 0x80));
|
||||
break;
|
||||
case 0x60: /* SMI */
|
||||
if ((dev->pci_conf[0x68] & 0x01) && !(dev->pci_conf[addr] & 0x02) && (val & 0x02)) {
|
||||
dev->pci_conf[0x69] |= 0x01;
|
||||
smi_raise();
|
||||
}
|
||||
dev->pci_conf[addr] = val & 0x3e;
|
||||
break;
|
||||
case 0x64: /* SMRAM */
|
||||
case 0x65:
|
||||
dev->pci_conf[addr] = val;
|
||||
sis_85c50x_smm_recalc(dev);
|
||||
break;
|
||||
case 0x66:
|
||||
dev->pci_conf[addr] = (val & 0x7f);
|
||||
break;
|
||||
case 0x69:
|
||||
dev->pci_conf[addr] &= ~(val);
|
||||
break;
|
||||
}
|
||||
|
||||
sis_85c50x_log("85C501: dev->pci_conf[%02x] = %02x\n", addr, val);
|
||||
break;
|
||||
case 0x66:
|
||||
dev->pci_conf[addr] = (val & 0x7f);
|
||||
break;
|
||||
case 0x69:
|
||||
dev->pci_conf[addr] &= ~(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
sis_85c50x_read(int func, int addr, void *priv)
|
||||
{
|
||||
sis_85c50x_t *dev = (sis_85c50x_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
sis_85c50x_log("85C501: dev->pci_conf[%02x] (%02x)\n", addr, dev->pci_conf[addr]);
|
||||
if (func == 0x00)
|
||||
ret = dev->pci_conf[addr];
|
||||
|
||||
return dev->pci_conf[addr];
|
||||
sis_85c50x_log("85C501: [R] (%02X, %02X) = %02X\n", func, addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -218,45 +233,51 @@ sis_85c50x_sb_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
sis_85c50x_t *dev = (sis_85c50x_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x04: /* Command */
|
||||
dev->pci_conf_sb[addr] = val & 0x0f;
|
||||
break;
|
||||
case 0x07: /* Status */
|
||||
dev->pci_conf_sb[addr] &= ~(val & 0x30);
|
||||
break;
|
||||
case 0x40: /* BIOS Control Register */
|
||||
dev->pci_conf_sb[addr] = val & 0x3f;
|
||||
break;
|
||||
case 0x41:
|
||||
case 0x42:
|
||||
case 0x43:
|
||||
case 0x44:
|
||||
/* INTA/B/C/D# Remapping Control Register */
|
||||
dev->pci_conf_sb[addr] = val & 0x8f;
|
||||
if (val & 0x80)
|
||||
pci_set_irq_routing(PCI_INTA + (addr - 0x41), PCI_IRQ_DISABLED);
|
||||
else
|
||||
pci_set_irq_routing(PCI_INTA + (addr - 0x41), val & 0xf);
|
||||
break;
|
||||
case 0x48: /* ISA Master/DMA Memory Cycle Control Register 1 */
|
||||
case 0x49: /* ISA Master/DMA Memory Cycle Control Register 2 */
|
||||
case 0x4a: /* ISA Master/DMA Memory Cycle Control Register 3 */
|
||||
case 0x4b: /* ISA Master/DMA Memory Cycle Control Register 4 */
|
||||
dev->pci_conf_sb[addr] = val;
|
||||
break;
|
||||
}
|
||||
sis_85c50x_log("85C503: [W] (%02X, %02X) = %02X\n", func, addr, val);
|
||||
|
||||
sis_85c50x_log("85C503: dev->pci_conf_sb[%02x] = %02x\n", addr, val);
|
||||
if (func == 0x00)
|
||||
switch (addr) {
|
||||
case 0x04: /* Command */
|
||||
dev->pci_conf_sb[addr] = val & 0x0f;
|
||||
break;
|
||||
case 0x07: /* Status */
|
||||
dev->pci_conf_sb[addr] &= ~(val & 0x30);
|
||||
break;
|
||||
case 0x40: /* BIOS Control Register */
|
||||
dev->pci_conf_sb[addr] = val & 0x3f;
|
||||
break;
|
||||
case 0x41:
|
||||
case 0x42:
|
||||
case 0x43:
|
||||
case 0x44:
|
||||
/* INTA/B/C/D# Remapping Control Register */
|
||||
dev->pci_conf_sb[addr] = val & 0x8f;
|
||||
if (val & 0x80)
|
||||
pci_set_irq_routing(PCI_INTA + (addr - 0x41), PCI_IRQ_DISABLED);
|
||||
else
|
||||
pci_set_irq_routing(PCI_INTA + (addr - 0x41), val & 0xf);
|
||||
break;
|
||||
case 0x48: /* ISA Master/DMA Memory Cycle Control Register 1 */
|
||||
case 0x49: /* ISA Master/DMA Memory Cycle Control Register 2 */
|
||||
case 0x4a: /* ISA Master/DMA Memory Cycle Control Register 3 */
|
||||
case 0x4b: /* ISA Master/DMA Memory Cycle Control Register 4 */
|
||||
dev->pci_conf_sb[addr] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
sis_85c50x_sb_read(int func, int addr, void *priv)
|
||||
{
|
||||
sis_85c50x_t *dev = (sis_85c50x_t *) priv;
|
||||
sis_85c50x_log("85C503: dev->pci_conf_sb[%02x] (%02x)\n", addr, dev->pci_conf_sb[addr]);
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
return dev->pci_conf_sb[addr];
|
||||
if (func == 0x00)
|
||||
ret = dev->pci_conf_sb[addr];
|
||||
|
||||
sis_85c50x_log("85C503: [W] (%02X, %02X) = %02X\n", func, addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -264,6 +285,8 @@ sis_85c50x_isa_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
sis_85c50x_t *dev = (sis_85c50x_t *) priv;
|
||||
|
||||
sis_85c50x_log("85C503 ISA: [W] (%04X) = %02X\n", addr, val);
|
||||
|
||||
switch (addr) {
|
||||
case 0x22:
|
||||
dev->index = val;
|
||||
@@ -279,7 +302,7 @@ sis_85c50x_isa_write(uint16_t addr, uint8_t val, void *priv)
|
||||
break;
|
||||
case 0x84:
|
||||
case 0x88:
|
||||
case 0x9:
|
||||
case 0x89:
|
||||
case 0x8a:
|
||||
case 0x8b:
|
||||
dev->regs[dev->index] = val;
|
||||
@@ -290,8 +313,6 @@ sis_85c50x_isa_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
sis_85c50x_log("85C501-ISA: dev->regs[%02x] = %02x\n", addr, val);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
@@ -313,7 +334,7 @@ sis_85c50x_isa_read(uint16_t addr, void *priv)
|
||||
break;
|
||||
}
|
||||
|
||||
sis_85c50x_log("85C501-ISA: dev->regs[%02x] (%02x)\n", dev->index, ret);
|
||||
sis_85c50x_log("85C503 ISA: [R] (%04X) = %02X\n", addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -359,10 +380,10 @@ sis_85c50x_reset(void *priv)
|
||||
dev->pci_conf_sb[0x09] = 0x00;
|
||||
dev->pci_conf_sb[0x0a] = 0x01;
|
||||
dev->pci_conf_sb[0x0b] = 0x06;
|
||||
sis_85c50x_write(0, 0x41, 0x80, dev);
|
||||
sis_85c50x_write(0, 0x42, 0x80, dev);
|
||||
sis_85c50x_write(0, 0x43, 0x80, dev);
|
||||
sis_85c50x_write(0, 0x44, 0x80, dev);
|
||||
sis_85c50x_sb_write(0, 0x41, 0x80, dev);
|
||||
sis_85c50x_sb_write(0, 0x42, 0x80, dev);
|
||||
sis_85c50x_sb_write(0, 0x43, 0x80, dev);
|
||||
sis_85c50x_sb_write(0, 0x44, 0x80, dev);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -370,7 +391,8 @@ sis_85c50x_close(void *priv)
|
||||
{
|
||||
sis_85c50x_t *dev = (sis_85c50x_t *) priv;
|
||||
|
||||
smram_del(dev->smram);
|
||||
smram_del(dev->smram[1]);
|
||||
smram_del(dev->smram[0]);
|
||||
free(dev);
|
||||
}
|
||||
|
||||
@@ -387,7 +409,9 @@ sis_85c50x_init(const device_t *info)
|
||||
pci_add_card(PCI_ADD_SOUTHBRIDGE, sis_85c50x_sb_read, sis_85c50x_sb_write, dev);
|
||||
io_sethandler(0x0022, 0x0002, sis_85c50x_isa_read, NULL, NULL, sis_85c50x_isa_write, NULL, NULL, dev);
|
||||
|
||||
dev->smram = smram_add();
|
||||
dev->smram[0] = smram_add();
|
||||
dev->smram[1] = smram_add();
|
||||
|
||||
dev->port_92 = device_add(&port_92_device);
|
||||
|
||||
sis_85c50x_reset(dev);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Melissa Goad, <mszoopers@protonmail.com>
|
||||
* Tiseno100,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Melissa Goad, <mszoopers@protonmail.com>
|
||||
* RichardG, <richardg867@gmail.com>
|
||||
@@ -851,9 +851,28 @@ pipc_sb_handlers(pipc_t *dev, uint8_t modem)
|
||||
|
||||
if (dev->ac97_regs[0][0x42] & 0x04) {
|
||||
io_sethandler(0x388, 4, pipc_fm_read, NULL, NULL, pipc_fm_write, NULL, NULL, dev);
|
||||
#ifndef VIA_PIPC_FM_EMULATION
|
||||
dev->sb->opl_enabled = 1;
|
||||
} else {
|
||||
dev->sb->opl_enabled = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pipc_sb_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
pipc_t *dev = (pipc_t *) priv;
|
||||
|
||||
/* Poll SB audio only if the legacy block is enabled. */
|
||||
#ifdef VIA_PIPC_FM_EMULATION
|
||||
if (dev->ac97_regs[0][0x42] & 0x01)
|
||||
#else
|
||||
if (dev->ac97_regs[0][0x42] & 0x05)
|
||||
#endif
|
||||
sb_get_buffer_sbpro(buffer, len, dev->sb);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
pipc_read(int func, int addr, void *priv)
|
||||
{
|
||||
@@ -1599,10 +1618,7 @@ pipc_init(const device_t *info)
|
||||
ac97_via_set_slot(dev->ac97, dev->slot, PCI_INTC);
|
||||
|
||||
dev->sb = device_add_inst(&sb_pro_compat_device, 2);
|
||||
#ifndef VIA_PIPC_FM_EMULATION
|
||||
dev->sb->opl_enabled = 1;
|
||||
#endif
|
||||
sound_add_handler(sb_get_buffer_sbpro, dev->sb);
|
||||
sound_add_handler(pipc_sb_get_buffer, dev);
|
||||
|
||||
dev->gameport = gameport_add(&gameport_sio_device);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2020,2021 David Hrdlička.
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
#
|
||||
|
||||
if(DYNAREC)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
|
||||
@@ -744,7 +744,7 @@ rop81_l(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeb
|
||||
host_reg = 0;
|
||||
} else {
|
||||
SAVE_EA();
|
||||
MEM_CHECK_WRITE(target_seg);
|
||||
MEM_CHECK_WRITE_L(target_seg);
|
||||
host_reg = MEM_LOAD_ADDR_EA_L_NO_ABRT(target_seg);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -667,14 +667,16 @@ ropFCHS(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeb
|
||||
return op_pc; \
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
opFLDimm(1, 1.0)
|
||||
opFLDimm(L2T, 3.3219280948873623)
|
||||
opFLDimm(L2E, 1.4426950408889634);
|
||||
opFLDimm(L2T, 3.3219280948873623)
|
||||
opFLDimm(L2E, 1.4426950408889634);
|
||||
opFLDimm(PI, 3.141592653589793);
|
||||
opFLDimm(EG2, 0.3010299956639812);
|
||||
opFLDimm(Z, 0.0)
|
||||
// clang-format on
|
||||
|
||||
static uint32_t ropFLDLN2(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
static uint32_t ropFLDLN2(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
FP_ENTER();
|
||||
FP_LOAD_IMM_Q(0x3fe62e42fefa39f0ull);
|
||||
|
||||
@@ -82,7 +82,7 @@ load_param_1_reg_32(int reg)
|
||||
#if 0
|
||||
static __inline void load_param_1_64(codeblock_t *block, uint64_t param)
|
||||
{
|
||||
addbyte(0x48);
|
||||
addbyte(0x48);
|
||||
# if _WIN64
|
||||
addbyte(0xb9); /*MOVL $fetchdat,%ecx*/
|
||||
# else
|
||||
|
||||
@@ -485,48 +485,51 @@ codegen_flush(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
static int opcode_modrm[256] = {
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, /*60*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, /*60*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*90*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*a0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*b0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*90*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*a0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*b0*/
|
||||
|
||||
1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*d0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*e0*/
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, /*f0*/
|
||||
1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*d0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*e0*/
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, /*f0*/
|
||||
};
|
||||
|
||||
int opcode_0f_modrm[256] = {
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, /*00*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/
|
||||
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /*30*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, /*00*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/
|
||||
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /*30*/
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, /*60*/
|
||||
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, /*70*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, /*60*/
|
||||
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, /*70*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /*a0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /*a0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/
|
||||
|
||||
1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/
|
||||
0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/
|
||||
1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/
|
||||
0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/
|
||||
};
|
||||
// clang-format off
|
||||
|
||||
void
|
||||
codegen_debug(void)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
@@ -1627,48 +1627,51 @@ codegen_flush(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
static int opcode_modrm[256] = {
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, /*60*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, /*60*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*90*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*a0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*b0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*90*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*a0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*b0*/
|
||||
|
||||
1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*d0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*e0*/
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, /*f0*/
|
||||
1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*d0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*e0*/
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, /*f0*/
|
||||
};
|
||||
|
||||
int opcode_0f_modrm[256] = {
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, /*00*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/
|
||||
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /*30*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, /*00*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/
|
||||
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /*30*/
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, /*60*/
|
||||
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, /*70*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, /*60*/
|
||||
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, /*70*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /*a0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /*a0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/
|
||||
|
||||
1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/
|
||||
0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/
|
||||
1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/
|
||||
0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
void
|
||||
codegen_debug(void)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2020,2021 David Hrdlička.
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
#
|
||||
|
||||
if(DYNAREC)
|
||||
|
||||
@@ -322,48 +322,51 @@ codegen_generate_ea(ir_data_t *ir, x86seg *op_ea_seg, uint32_t fetchdat, int op_
|
||||
return codegen_generate_ea_16_long(ir, op_ea_seg, fetchdat, op_ssegs, op_pc);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
static uint8_t opcode_modrm[256] = {
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, /*60*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, /*60*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*90*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*a0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*b0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*90*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*a0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*b0*/
|
||||
|
||||
1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*d0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*e0*/
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, /*f0*/
|
||||
1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*d0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*e0*/
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, /*f0*/
|
||||
};
|
||||
|
||||
static uint8_t opcode_0f_modrm[256] = {
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, /*00*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/
|
||||
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /*30*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, /*00*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/
|
||||
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /*30*/
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, /*60*/
|
||||
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, /*70*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, /*60*/
|
||||
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, /*70*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /*a0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /*a0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/
|
||||
|
||||
1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/
|
||||
0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/
|
||||
1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*d0*/
|
||||
0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, /*e0*/
|
||||
0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0 /*f0*/
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
void
|
||||
codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_pc, uint32_t old_pc)
|
||||
|
||||
@@ -119,8 +119,8 @@ codegen_ADD(codeblock_t *block, uop_t *uop)
|
||||
static int
|
||||
codegen_ADD_IMM(codeblock_t *block, uop_t *uop)
|
||||
{
|
||||
// host_arm_ADD_IMM(block, uop->dest_reg_a_real, uop->src_reg_a_real, uop->imm_data);
|
||||
// return 0;
|
||||
// host_arm_ADD_IMM(block, uop->dest_reg_a_real, uop->src_reg_a_real, uop->imm_data);
|
||||
// return 0;
|
||||
|
||||
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real), src_reg = HOST_REG_GET(uop->src_reg_a_real);
|
||||
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real), src_size = IREG_GET_SIZE(uop->src_reg_a_real);
|
||||
@@ -2597,8 +2597,8 @@ codegen_SUB(codeblock_t *block, uop_t *uop)
|
||||
|
||||
return 0;
|
||||
|
||||
// host_arm_SUB_REG_LSL(block, uop->dest_reg_a_real, uop->src_reg_a_real, uop->src_reg_b_real, 0);
|
||||
// return 0;
|
||||
// host_arm_SUB_REG_LSL(block, uop->dest_reg_a_real, uop->src_reg_a_real, uop->src_reg_b_real, 0);
|
||||
// return 0;
|
||||
}
|
||||
static int
|
||||
codegen_SUB_IMM(codeblock_t *block, uop_t *uop)
|
||||
|
||||
@@ -37,16 +37,18 @@
|
||||
return op_pc + 2; \
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
ropParith(PFADD)
|
||||
ropParith(PFCMPEQ)
|
||||
ropParith(PFCMPGE)
|
||||
ropParith(PFCMPGT)
|
||||
ropParith(PFMAX)
|
||||
ropParith(PFMIN)
|
||||
ropParith(PFMUL)
|
||||
ropParith(PFSUB)
|
||||
ropParith(PFCMPEQ)
|
||||
ropParith(PFCMPGE)
|
||||
ropParith(PFCMPGT)
|
||||
ropParith(PFMAX)
|
||||
ropParith(PFMIN)
|
||||
ropParith(PFMUL)
|
||||
ropParith(PFSUB)
|
||||
// clang-format on
|
||||
|
||||
uint32_t ropPF2ID(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
uint32_t ropPF2ID(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
|
||||
@@ -423,8 +423,10 @@ ropFUCOMPP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1; \
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
ropF_arith_mem(s, uop_MEM_LOAD_SINGLE)
|
||||
ropF_arith_mem(d, uop_MEM_LOAD_DOUBLE)
|
||||
ropF_arith_mem(d, uop_MEM_LOAD_DOUBLE)
|
||||
// clang-format on
|
||||
|
||||
#define ropFI_arith_mem(name, temp_reg) \
|
||||
uint32_t ropFIADD##name(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc) \
|
||||
|
||||
162
src/config.c
162
src/config.c
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker,
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Overdoze,
|
||||
@@ -19,7 +19,9 @@
|
||||
* Copyright 2008-2019 Sarah Walker.
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
* Copyright 2018,2019 David Hrdlička.
|
||||
* Copyright 2018-2019 David Hrdlička.
|
||||
* Copyright 2021 Andreas J. Reichel.
|
||||
* Copyright 2021-2022 Jasmine Iwanek.
|
||||
*
|
||||
* NOTE: Forcing config files to be in Unicode encoding breaks
|
||||
* it on Windows XP, and possibly also Vista. Use the
|
||||
@@ -54,6 +56,8 @@
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/fdc_ext.h>
|
||||
#include <86box/gameport.h>
|
||||
#include <86box/serial.h>
|
||||
#include <86box/serial_passthrough.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/mouse.h>
|
||||
#include <86box/thread.h>
|
||||
@@ -61,6 +65,7 @@
|
||||
#include <86box/scsi.h>
|
||||
#include <86box/scsi_device.h>
|
||||
#include <86box/cdrom.h>
|
||||
#include <86box/cdrom_interface.h>
|
||||
#include <86box/zip.h>
|
||||
#include <86box/mo.h>
|
||||
#include <86box/sound.h>
|
||||
@@ -80,6 +85,7 @@ static ini_t config;
|
||||
static int backwards_compat = 0;
|
||||
static int backwards_compat2 = 0;
|
||||
|
||||
#define ENABLE_CONFIG_LOG 1
|
||||
#ifdef ENABLE_CONFIG_LOG
|
||||
int config_do_log = ENABLE_CONFIG_LOG;
|
||||
|
||||
@@ -529,7 +535,7 @@ load_video(void)
|
||||
|
||||
if (machine_has_flags(machine, MACHINE_VIDEO_ONLY)) {
|
||||
ini_section_delete_var(cat, "gfxcard");
|
||||
gfxcard = VID_INTERNAL;
|
||||
gfxcard[0] = VID_INTERNAL;
|
||||
} else {
|
||||
p = ini_section_get_string(cat, "gfxcard", NULL);
|
||||
if (p == NULL) {
|
||||
@@ -543,9 +549,9 @@ load_video(void)
|
||||
free_p = 1;
|
||||
}
|
||||
if (!strcmp(p, "virge375_vbe20_pci")) /* migrate renamed cards */
|
||||
gfxcard = video_get_video_from_internal_name("virge385_pci");
|
||||
gfxcard[0] = video_get_video_from_internal_name("virge385_pci");
|
||||
else
|
||||
gfxcard = video_get_video_from_internal_name(p);
|
||||
gfxcard[0] = video_get_video_from_internal_name(p);
|
||||
if (free_p)
|
||||
free(p);
|
||||
}
|
||||
@@ -559,7 +565,7 @@ load_video(void)
|
||||
p = ini_section_get_string(cat, "gfxcard_2", NULL);
|
||||
if (!p)
|
||||
p = "none";
|
||||
gfxcard_2 = video_get_video_from_internal_name(p);
|
||||
gfxcard[1] = video_get_video_from_internal_name(p);
|
||||
}
|
||||
|
||||
/* Load "Input Devices" section. */
|
||||
@@ -650,6 +656,8 @@ load_input_devices(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tablet_tool_type = !!ini_section_get_int(cat, "tablet_tool_type", 1);
|
||||
}
|
||||
|
||||
/* Load "Sound" section. */
|
||||
@@ -665,9 +673,36 @@ load_sound(void)
|
||||
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
||||
p = "es1371";
|
||||
if (p != NULL)
|
||||
sound_card_current = sound_card_get_from_internal_name(p);
|
||||
sound_card_current[0] = sound_card_get_from_internal_name(p);
|
||||
else
|
||||
sound_card_current = 0;
|
||||
sound_card_current[0] = 0;
|
||||
|
||||
p = ini_section_get_string(cat, "sndcard2", NULL);
|
||||
/* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */
|
||||
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
||||
p = "es1371";
|
||||
if (p != NULL)
|
||||
sound_card_current[1] = sound_card_get_from_internal_name(p);
|
||||
else
|
||||
sound_card_current[1] = 0;
|
||||
|
||||
p = ini_section_get_string(cat, "sndcard3", NULL);
|
||||
/* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */
|
||||
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
||||
p = "es1371";
|
||||
if (p != NULL)
|
||||
sound_card_current[2] = sound_card_get_from_internal_name(p);
|
||||
else
|
||||
sound_card_current[2] = 0;
|
||||
|
||||
p = ini_section_get_string(cat, "sndcard4", NULL);
|
||||
/* FIXME: Hack to not break configs with the Sound Blaster 128 PCI set. */
|
||||
if ((p != NULL) && (!strcmp(p, "sbpci128") || !strcmp(p, "sb128pci")))
|
||||
p = "es1371";
|
||||
if (p != NULL)
|
||||
sound_card_current[3] = sound_card_get_from_internal_name(p);
|
||||
else
|
||||
sound_card_current[3] = 0;
|
||||
|
||||
p = ini_section_get_string(cat, "midi_device", NULL);
|
||||
if (p != NULL)
|
||||
@@ -683,10 +718,6 @@ load_sound(void)
|
||||
|
||||
mpu401_standalone_enable = !!ini_section_get_int(cat, "mpu401_standalone", 0);
|
||||
|
||||
SSI2001 = !!ini_section_get_int(cat, "ssi2001", 0);
|
||||
GAMEBLASTER = !!ini_section_get_int(cat, "gameblaster", 0);
|
||||
GUS = !!ini_section_get_int(cat, "gus", 0);
|
||||
|
||||
memset(temp, '\0', sizeof(temp));
|
||||
p = ini_section_get_string(cat, "sound_type", "float");
|
||||
if (strlen(p) > 511)
|
||||
@@ -810,6 +841,8 @@ load_ports(void)
|
||||
char temp[512];
|
||||
int c, d;
|
||||
|
||||
memset(temp, 0, sizeof(temp));
|
||||
|
||||
for (c = 0; c < SERIAL_MAX; c++) {
|
||||
sprintf(temp, "serial%d_enabled", c + 1);
|
||||
com_ports[c].enabled = !!ini_section_get_int(cat, temp, (c >= 2) ? 0 : 1);
|
||||
@@ -819,6 +852,12 @@ load_ports(void)
|
||||
p = (char *) ini_section_get_string(cat, temp, "none");
|
||||
com_ports[c].device = com_device_get_from_internal_name(p);
|
||||
*/
|
||||
|
||||
sprintf(temp, "serial%d_passthrough_enabled", c + 1);
|
||||
serial_passthrough_enabled[c] = !!ini_section_get_int(cat, temp, 0);
|
||||
|
||||
if (serial_passthrough_enabled[c])
|
||||
config_log("Serial Port %d: passthrough enabled.\n\n", c + 1);
|
||||
}
|
||||
|
||||
for (c = 0; c < PARALLEL_MAX; c++) {
|
||||
@@ -904,6 +943,15 @@ load_storage_controllers(void)
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
p = ini_section_get_string(cat, "cdrom_interface", NULL);
|
||||
if (p != NULL)
|
||||
cdrom_interface_current = cdrom_interface_get_from_internal_name(p);
|
||||
|
||||
if (free_p) {
|
||||
free(p);
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
ide_ter_enabled = !!ini_section_get_int(cat, "ide_ter", 0);
|
||||
ide_qua_enabled = !!ini_section_get_int(cat, "ide_qua", 0);
|
||||
|
||||
@@ -998,13 +1046,13 @@ load_hard_disks(void)
|
||||
break;
|
||||
|
||||
case HDD_BUS_IDE:
|
||||
max_spt = 63;
|
||||
max_spt = 255;
|
||||
max_hpc = 255;
|
||||
max_tracks = 266305;
|
||||
break;
|
||||
|
||||
case HDD_BUS_SCSI:
|
||||
max_spt = 99;
|
||||
max_spt = 255;
|
||||
max_hpc = 255;
|
||||
max_tracks = 266305;
|
||||
break;
|
||||
@@ -1321,8 +1369,13 @@ load_floppy_and_cdrom_drives(void)
|
||||
|
||||
sprintf(temp, "cdrom_%02i_speed", c + 1);
|
||||
cdrom[c].speed = ini_section_get_int(cat, temp, 8);
|
||||
sprintf(temp, "cdrom_%02i_early", c + 1);
|
||||
cdrom[c].early = ini_section_get_int(cat, temp, 0);
|
||||
|
||||
sprintf(temp, "cdrom_%02i_type", c + 1);
|
||||
p = ini_section_get_string(cat, temp, (c == 1) ? "86BOX_CD-ROM_1.00" : "none");
|
||||
cdrom_set_type(c, cdrom_get_from_internal_name(p));
|
||||
if (cdrom_get_type(c) > KNOWN_CDROM_DRIVE_TYPES)
|
||||
cdrom_set_type(c, KNOWN_CDROM_DRIVE_TYPES);
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
/* Default values, needed for proper operation of the Settings dialog. */
|
||||
cdrom[c].ide_channel = cdrom[c].scsi_device_id = c + 2;
|
||||
@@ -1813,7 +1866,7 @@ config_load(void)
|
||||
dpi_scale = 1;
|
||||
|
||||
fpu_type = fpu_get_type(cpu_f, cpu, "none");
|
||||
gfxcard = video_get_video_from_internal_name("cga");
|
||||
gfxcard[0] = video_get_video_from_internal_name("cga");
|
||||
vid_api = plat_vidapi("default");
|
||||
vid_resize = 0;
|
||||
video_fullscreen_first = 1;
|
||||
@@ -2197,7 +2250,7 @@ save_video(void)
|
||||
ini_section_t cat = ini_find_or_create_section(config, "Video");
|
||||
|
||||
ini_section_set_string(cat, "gfxcard",
|
||||
video_get_internal_name(gfxcard));
|
||||
video_get_internal_name(gfxcard[0]));
|
||||
|
||||
if (voodoo_enabled == 0)
|
||||
ini_section_delete_var(cat, "voodoo");
|
||||
@@ -2214,10 +2267,10 @@ save_video(void)
|
||||
else
|
||||
ini_section_set_int(cat, "xga", xga_enabled);
|
||||
|
||||
if (gfxcard_2 == 0)
|
||||
if (gfxcard[1] == 0)
|
||||
ini_section_delete_var(cat, "gfxcard_2");
|
||||
else
|
||||
ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard_2));
|
||||
ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard[1]));
|
||||
|
||||
if (show_second_monitors == 1)
|
||||
ini_section_delete_var(cat, "show_second_monitors");
|
||||
@@ -2287,6 +2340,12 @@ save_input_devices(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (tablet_tool_type != 1) {
|
||||
ini_section_set_int(cat, "tablet_tool_type", tablet_tool_type);
|
||||
} else {
|
||||
ini_section_delete_var(cat, "tablet_tool_type");
|
||||
}
|
||||
|
||||
ini_delete_section_if_empty(config, cat);
|
||||
}
|
||||
|
||||
@@ -2296,10 +2355,25 @@ save_sound(void)
|
||||
{
|
||||
ini_section_t cat = ini_find_or_create_section(config, "Sound");
|
||||
|
||||
if (sound_card_current == 0)
|
||||
if (sound_card_current[0] == 0)
|
||||
ini_section_delete_var(cat, "sndcard");
|
||||
else
|
||||
ini_section_set_string(cat, "sndcard", sound_card_get_internal_name(sound_card_current));
|
||||
ini_section_set_string(cat, "sndcard", sound_card_get_internal_name(sound_card_current[0]));
|
||||
|
||||
if (sound_card_current[1] == 0)
|
||||
ini_section_delete_var(cat, "sndcard2");
|
||||
else
|
||||
ini_section_set_string(cat, "sndcard2", sound_card_get_internal_name(sound_card_current[1]));
|
||||
|
||||
if (sound_card_current[2] == 0)
|
||||
ini_section_delete_var(cat, "sndcard3");
|
||||
else
|
||||
ini_section_set_string(cat, "sndcard3", sound_card_get_internal_name(sound_card_current[2]));
|
||||
|
||||
if (sound_card_current[3] == 0)
|
||||
ini_section_delete_var(cat, "sndcard4");
|
||||
else
|
||||
ini_section_set_string(cat, "sndcard4", sound_card_get_internal_name(sound_card_current[3]));
|
||||
|
||||
if (!strcmp(midi_out_device_get_internal_name(midi_output_device_current), "none"))
|
||||
ini_section_delete_var(cat, "midi_device");
|
||||
@@ -2316,21 +2390,6 @@ save_sound(void)
|
||||
else
|
||||
ini_section_set_int(cat, "mpu401_standalone", mpu401_standalone_enable);
|
||||
|
||||
if (SSI2001 == 0)
|
||||
ini_section_delete_var(cat, "ssi2001");
|
||||
else
|
||||
ini_section_set_int(cat, "ssi2001", SSI2001);
|
||||
|
||||
if (GAMEBLASTER == 0)
|
||||
ini_section_delete_var(cat, "gameblaster");
|
||||
else
|
||||
ini_section_set_int(cat, "gameblaster", GAMEBLASTER);
|
||||
|
||||
if (GUS == 0)
|
||||
ini_section_delete_var(cat, "gus");
|
||||
else
|
||||
ini_section_set_int(cat, "gus", GUS);
|
||||
|
||||
if (sound_is_float == 1)
|
||||
ini_section_delete_var(cat, "sound_type");
|
||||
else
|
||||
@@ -2420,6 +2479,13 @@ save_ports(void)
|
||||
ini_section_set_string(cat, temp,
|
||||
(char *) com_device_get_internal_name(com_ports[c].device));
|
||||
*/
|
||||
|
||||
sprintf(temp, "serial%d_passthrough_enabled", c + 1);
|
||||
if (serial_passthrough_enabled[c]) {
|
||||
ini_section_set_int(cat, temp, 1);
|
||||
} else {
|
||||
ini_section_delete_var(cat, temp);
|
||||
}
|
||||
}
|
||||
|
||||
for (c = 0; c < PARALLEL_MAX; c++) {
|
||||
@@ -2470,6 +2536,12 @@ save_storage_controllers(void)
|
||||
ini_section_set_string(cat, "hdc",
|
||||
hdc_get_internal_name(hdc_current));
|
||||
|
||||
if (cdrom_interface_current == 0)
|
||||
ini_section_delete_var(cat, "cdrom_interface");
|
||||
else
|
||||
ini_section_set_string(cat, "cdrom_interface",
|
||||
cdrom_interface_get_internal_name(cdrom_interface_current));
|
||||
|
||||
if (ide_ter_enabled == 0)
|
||||
ini_section_delete_var(cat, "ide_ter");
|
||||
else
|
||||
@@ -2717,17 +2789,25 @@ save_floppy_and_cdrom_drives(void)
|
||||
ini_section_set_int(cat, temp, cdrom[c].speed);
|
||||
}
|
||||
|
||||
sprintf(temp, "cdrom_%02i_early", c + 1);
|
||||
if ((cdrom[c].bus_type == 0) || (cdrom[c].early == 0)) {
|
||||
sprintf(temp, "cdrom_%02i_type", c + 1);
|
||||
if ((cdrom[c].bus_type == 0) || (cdrom[c].bus_type == CDROM_BUS_MITSUMI)) {
|
||||
ini_section_delete_var(cat, temp);
|
||||
} else {
|
||||
ini_section_set_int(cat, temp, cdrom[c].early);
|
||||
ini_section_set_string(cat, temp,
|
||||
cdrom_get_internal_name(cdrom_get_type(c)));
|
||||
}
|
||||
|
||||
sprintf(temp, "cdrom_%02i_parameters", c + 1);
|
||||
if (cdrom[c].bus_type == 0) {
|
||||
ini_section_delete_var(cat, temp);
|
||||
} else {
|
||||
} else { /*In case one wants an ATAPI drive on SCSI and vice-versa.*/
|
||||
if (cdrom[c].bus_type == CDROM_BUS_ATAPI) {
|
||||
if (cdrom_drive_types[cdrom_get_type(c)].bus_type == BUS_TYPE_SCSI)
|
||||
cdrom[c].bus_type = CDROM_BUS_SCSI;
|
||||
} else if (cdrom[c].bus_type == CDROM_BUS_SCSI) {
|
||||
if (cdrom_drive_types[cdrom_get_type(c)].bus_type == BUS_TYPE_IDE)
|
||||
cdrom[c].bus_type = CDROM_BUS_ATAPI;
|
||||
}
|
||||
sprintf(tmp2, "%u, %s", cdrom[c].sound_on,
|
||||
hdd_bus_to_string(cdrom[c].bus_type, 1));
|
||||
ini_section_set_string(cat, temp, tmp2);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2019 Sarah Walker.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* leilei,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2020,2021 David Hrdlička.
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
#
|
||||
|
||||
add_library(cpu OBJECT cpu.c cpu_table.c fpu.c x86.c 808x.c 386.c 386_common.c
|
||||
|
||||
@@ -949,7 +949,7 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32, uin
|
||||
if (regmask & IMPL_ESP)
|
||||
regmask |= SRCDEP_ESP | DSTDEP_ESP;
|
||||
|
||||
agi_stall = check_agi(prev_deps, prev_opcode, prev_fetchdat, prev_op_32);
|
||||
agi_stall = check_agi(prev_deps, prev_opcode, prev_fetchdat, prev_op_32);
|
||||
|
||||
/*Second instruction in the pair*/
|
||||
if ((timings[opcode] & PAIR_MASK) == PAIR_NP)
|
||||
@@ -992,7 +992,7 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32, uin
|
||||
if (!t_pair)
|
||||
fatal("Pairable 0 cycles! %02x %02x\n", opcode, prev_opcode);
|
||||
|
||||
agi_stall = check_agi(deps, opcode, fetchdat, op_32);
|
||||
agi_stall = check_agi(deps, opcode, fetchdat, op_32);
|
||||
|
||||
codegen_block_cycles += t_pair + agi_stall;
|
||||
decode_delay = (-t_pair) + 1 + agi_stall;
|
||||
@@ -1012,7 +1012,7 @@ void codegen_timing_686_opcode(uint8_t opcode, uint32_t fetchdat, int op_32, uin
|
||||
/*Instruction not pairable*/
|
||||
int agi_stall = 0;
|
||||
|
||||
agi_stall = check_agi(deps, opcode, fetchdat, op_32);
|
||||
agi_stall = check_agi(deps, opcode, fetchdat, op_32);
|
||||
|
||||
codegen_block_cycles += COUNT(timings[opcode], op_32) + decode_delay + agi_stall;
|
||||
decode_delay = (-COUNT(timings[opcode], op_32)) + 1 + agi_stall;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*Most of the vector instructions here are a total guess.
|
||||
Some of the timings are based on http://users.atw.hu/instlatx64/AuthenticAMD0000562_K6_InstLatX86.txt*/
|
||||
Some of the timings are based on http://http://web.archive.org/web/20181122095446/http://users.atw.hu/instlatx64/AuthenticAMD0000562_K6_InstLatX86.txt*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -23,10 +23,10 @@ typedef enum uop_type_t
|
||||
UOP_ALUP0, /*Executes in Port 0 ALU unit*/
|
||||
UOP_LOAD, /*Executes in Load unit*/
|
||||
UOP_STORED, /*Executes in Data Store unit*/
|
||||
UOP_STOREA, /*Executes in Address Store unit*/
|
||||
UOP_STOREA, /*Executes in Address Store unit*/
|
||||
UOP_FLOAD, /*Executes in Load unit*/
|
||||
UOP_FSTORED, /*Executes in Data Store unit*/
|
||||
UOP_FSTOREA, /*Executes in Address Store unit*/
|
||||
UOP_FSTOREA, /*Executes in Address Store unit*/
|
||||
UOP_MLOAD, /*Executes in Load unit*/
|
||||
UOP_MSTORED, /*Executes in Data Store unit*/
|
||||
UOP_MSTOREA, /*Executes in Address Store unit*/
|
||||
@@ -93,7 +93,7 @@ static const macro_op_t alu_store_op =
|
||||
.uop[1] = {.type = UOP_ALU, .latency = 1},
|
||||
.uop[2] = {.type = UOP_STORED, .latency = 1},
|
||||
.uop[3] = {.type = UOP_STOREA, .latency = 1}
|
||||
};
|
||||
};
|
||||
static const macro_op_t alup0_store_op =
|
||||
{
|
||||
.nr_uops = 4,
|
||||
@@ -162,8 +162,8 @@ static const macro_op_t loop_op =
|
||||
.decode_type = DECODE_COMPLEX,
|
||||
.uop[0] = {.type = UOP_ALU, .latency = 1},
|
||||
.uop[1] = {.type = UOP_ALU, .latency = 1},
|
||||
.uop[2] = {.type = UOP_ALU, .latency = 1},
|
||||
.uop[3] = {.type = UOP_ALU, .latency = 1},
|
||||
.uop[2] = {.type = UOP_ALU, .latency = 1},
|
||||
.uop[3] = {.type = UOP_ALU, .latency = 1},
|
||||
.uop[4] = {.type = UOP_BRANCH, .latency = 1}
|
||||
};
|
||||
static const macro_op_t mov_reg_seg_op =
|
||||
@@ -219,7 +219,7 @@ static const macro_op_t push_seg_op =
|
||||
.uop[0] = {.type = UOP_LOAD, .latency = 1},
|
||||
.uop[1] = {.type = UOP_STORED, .latency = 1},
|
||||
.uop[2] = {.type = UOP_STOREA, .latency = 1},
|
||||
.uop[3] = {.type = UOP_ALU, .latency = 1}
|
||||
.uop[3] = {.type = UOP_ALU, .latency = 1}
|
||||
};
|
||||
static const macro_op_t stos_op =
|
||||
{
|
||||
@@ -1607,24 +1607,24 @@ static p6_unit_t *units;
|
||||
/*Pentium Pro has no MMX*/
|
||||
static p6_unit_t ppro_units[] =
|
||||
{
|
||||
{.uop_mask = (1 << UOP_ALU) | (1 << UOP_ALUP0) | (1 << UOP_FLOAT)}, /*Port 0*/
|
||||
{.uop_mask = (1 << UOP_ALU) | (1 << UOP_BRANCH)}, /*Port 1*/
|
||||
{.uop_mask = (1 << UOP_LOAD) | (1 << UOP_FLOAD)}, /*Port 2*/
|
||||
{.uop_mask = (1 << UOP_STORED) | (1 << UOP_FSTORED)}, /*Port 3*/
|
||||
{.uop_mask = (1 << UOP_STOREA) | (1 << UOP_FSTOREA)}, /*Port 4*/
|
||||
{.uop_mask = (1 << UOP_ALU) | (1 << UOP_ALUP0) | (1 << UOP_FLOAT)}, /*Port 0*/
|
||||
{.uop_mask = (1 << UOP_ALU) | (1 << UOP_BRANCH)}, /*Port 1*/
|
||||
{.uop_mask = (1 << UOP_LOAD) | (1 << UOP_FLOAD)}, /*Port 2*/
|
||||
{.uop_mask = (1 << UOP_STORED) | (1 << UOP_FSTORED)}, /*Port 3*/
|
||||
{.uop_mask = (1 << UOP_STOREA) | (1 << UOP_FSTOREA)}, /*Port 4*/
|
||||
};
|
||||
#define NR_PPRO_UNITS (sizeof(ppro_units) / sizeof(p6_unit_t))
|
||||
|
||||
/*Pentium II/Celeron assigns the multiplier to port 0, the shifter to port 1, and shares the MMX ALU*/
|
||||
static p6_unit_t p2_units[] =
|
||||
{
|
||||
{.uop_mask = (1 << UOP_ALU) | (1 << UOP_ALUP0) | (1 << UOP_FLOAT) | /*Port 0*/
|
||||
(1 << UOP_MMX) | (1 << UOP_MMX_MUL)},
|
||||
{.uop_mask = (1 << UOP_ALU) | (1 << UOP_BRANCH) | /*Port 1*/
|
||||
(1 << UOP_MMX) | (1 << UOP_MMX_SHIFT)},
|
||||
{.uop_mask = (1 << UOP_LOAD) | (1 << UOP_FLOAD) | (1 << UOP_MLOAD)}, /*Port 2*/
|
||||
{.uop_mask = (1 << UOP_STORED) | (1 << UOP_FSTORED) | (1 << UOP_MSTORED)}, /*Port 3*/
|
||||
{.uop_mask = (1 << UOP_STOREA) | (1 << UOP_FSTOREA) | (1 << UOP_MSTOREA)}, /*Port 4*/
|
||||
{.uop_mask = (1 << UOP_ALU) | (1 << UOP_ALUP0) | (1 << UOP_FLOAT) | /*Port 0*/
|
||||
(1 << UOP_MMX) | (1 << UOP_MMX_MUL)},
|
||||
{.uop_mask = (1 << UOP_ALU) | (1 << UOP_BRANCH) | /*Port 1*/
|
||||
(1 << UOP_MMX) | (1 << UOP_MMX_SHIFT)},
|
||||
{.uop_mask = (1 << UOP_LOAD) | (1 << UOP_FLOAD) | (1 << UOP_MLOAD)}, /*Port 2*/
|
||||
{.uop_mask = (1 << UOP_STORED) | (1 << UOP_FSTORED) | (1 << UOP_MSTORED)}, /*Port 3*/
|
||||
{.uop_mask = (1 << UOP_STOREA) | (1 << UOP_FSTOREA) | (1 << UOP_MSTOREA)}, /*Port 4*/
|
||||
};
|
||||
#define NR_P2_UNITS (sizeof(p2_units) / sizeof(p6_unit_t))
|
||||
|
||||
@@ -1790,7 +1790,7 @@ static void decode_instruction(const macro_op_t *ins, uint64_t deps, uint32_t fe
|
||||
uint32_t regmask_required;
|
||||
uint32_t regmask_modified;
|
||||
int c;
|
||||
int d = 0; /*Complex decoder uOPs*/
|
||||
int d = 0; /*Complex decoder uOPs*/
|
||||
int earliest_start = 0;
|
||||
decode_type_t decode_type = ins->decode_type;
|
||||
int instr_length = codegen_timing_instr_length(deps, fetchdat, op_32);
|
||||
@@ -1839,7 +1839,7 @@ static void decode_instruction(const macro_op_t *ins, uint64_t deps, uint32_t fe
|
||||
decode_buffer.uops[decode_buffer.nr_uops] = &ins->uop[0];
|
||||
decode_buffer.earliest_start[decode_buffer.nr_uops] = earliest_start;
|
||||
decode_buffer.nr_uops = 2+d;
|
||||
if (d)
|
||||
if (d)
|
||||
decode_flush_p6();
|
||||
}
|
||||
else if (decode_buffer.nr_uops)
|
||||
@@ -1869,7 +1869,7 @@ static void decode_instruction(const macro_op_t *ins, uint64_t deps, uint32_t fe
|
||||
decode_buffer.earliest_start[d] = earliest_start;
|
||||
else
|
||||
decode_buffer.earliest_start[d] = -1;
|
||||
d++;
|
||||
d++;
|
||||
|
||||
if ((d == 3) && (ins->nr_uops > 4)) /*Ins. with >4 uOPs require the use of special units only present on 3 translate PLAs*/
|
||||
{
|
||||
@@ -1878,10 +1878,10 @@ static void decode_instruction(const macro_op_t *ins, uint64_t deps, uint32_t fe
|
||||
decode_flush_p6(); /*The other two decoders are halted to preserve in-order issue*/
|
||||
}
|
||||
}
|
||||
if (d)
|
||||
{
|
||||
decode_buffer.nr_uops = d;
|
||||
}
|
||||
if (d)
|
||||
{
|
||||
decode_buffer.nr_uops = d;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1982,8 +1982,8 @@ void codegen_timing_p6_opcode(uint8_t opcode, uint32_t fetchdat, int op_32, uint
|
||||
switch (last_prefix)
|
||||
{
|
||||
case 0x0f:
|
||||
ins_table = mod3 ? opcode_timings_0f_mod3 : opcode_timings_0f;
|
||||
deps = mod3 ? opcode_deps_0f_mod3 : opcode_deps_0f;
|
||||
ins_table = mod3 ? opcode_timings_0f_mod3 : opcode_timings_0f;
|
||||
deps = mod3 ? opcode_deps_0f_mod3 : opcode_deps_0f;
|
||||
break;
|
||||
|
||||
case 0xd8:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* CPU type handler.
|
||||
*
|
||||
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* leilei,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -61,6 +61,7 @@ enum {
|
||||
CPUID_AMDSEP = (1 << 10),
|
||||
CPUID_SEP = (1 << 11),
|
||||
CPUID_MTRR = (1 << 12),
|
||||
CPUID_PGE = (1 << 13),
|
||||
CPUID_MCA = (1 << 14),
|
||||
CPUID_CMOV = (1 << 15),
|
||||
CPUID_MMX = (1 << 23),
|
||||
@@ -234,7 +235,7 @@ cpu_is_eligible(const cpu_family_t *cpu_family, int cpu, int machine)
|
||||
if (packages & CPU_PKG_SOCKET3)
|
||||
packages |= CPU_PKG_SOCKET1;
|
||||
else if (packages & CPU_PKG_SLOT1)
|
||||
packages |= CPU_PKG_SOCKET370;
|
||||
packages |= CPU_PKG_SOCKET370 | CPU_PKG_SOCKET8;
|
||||
|
||||
/* Package type. */
|
||||
if (!(cpu_family->package & packages))
|
||||
@@ -1158,7 +1159,7 @@ cpu_set(void)
|
||||
if (cpu_s->cpu_type >= CPU_K6_2)
|
||||
x86_setopcodes(ops_386, ops_k62_0f);
|
||||
# if defined(DEV_BRANCH) && defined(USE_AMD_K5)
|
||||
else if (cpu_s->cpu_type = CPU_K6)
|
||||
else if (cpu_s->cpu_type == CPU_K6)
|
||||
x86_setopcodes(ops_386, ops_k6_0f);
|
||||
else
|
||||
x86_setopcodes(ops_386, ops_pentiummmx_0f);
|
||||
@@ -1169,8 +1170,10 @@ cpu_set(void)
|
||||
#endif
|
||||
|
||||
if ((cpu_s->cpu_type == CPU_K6_2P) || (cpu_s->cpu_type == CPU_K6_3P)) {
|
||||
x86_opcodes_3DNOW = ops_3DNOWE;
|
||||
x86_opcodes_3DNOW = ops_3DNOWE;
|
||||
#ifdef USE_DYNAREC
|
||||
x86_dynarec_opcodes_3DNOW = dynarec_ops_3DNOWE;
|
||||
#endif
|
||||
}
|
||||
|
||||
timing_rr = 1; /* register dest - register src */
|
||||
@@ -1296,7 +1299,7 @@ cpu_set(void)
|
||||
if (cpu_s->cpu_type >= CPU_PENTIUM2)
|
||||
cpu_features |= CPU_FEATURE_MMX;
|
||||
msr.fcr = (1 << 8) | (1 << 9) | (1 << 12) | (1 << 16) | (1 << 19) | (1 << 21);
|
||||
cpu_CR4_mask = CR4_VME | CR4_PVI | CR4_TSD | CR4_DE | CR4_PSE | CR4_MCE | CR4_PAE | CR4_PCE;
|
||||
cpu_CR4_mask = CR4_VME | CR4_PVI | CR4_TSD | CR4_DE | CR4_PSE | CR4_MCE | CR4_PAE | CR4_PCE | CR4_PGE;
|
||||
if (cpu_s->cpu_type == CPU_PENTIUM2D)
|
||||
cpu_CR4_mask |= CR4_OSFXSR;
|
||||
|
||||
@@ -1957,7 +1960,7 @@ cpu_CPUID(void)
|
||||
} else if (EAX == 1) {
|
||||
EAX = CPUID;
|
||||
EBX = ECX = 0;
|
||||
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_MTRR | CPUID_MCA | CPUID_SEP | CPUID_CMOV;
|
||||
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_SEP | CPUID_CMOV;
|
||||
} else if (EAX == 2) {
|
||||
EAX = 0x00000001;
|
||||
EBX = ECX = 0;
|
||||
@@ -1975,7 +1978,7 @@ cpu_CPUID(void)
|
||||
} else if (EAX == 1) {
|
||||
EAX = CPUID;
|
||||
EBX = ECX = 0;
|
||||
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR | CPUID_MCA | CPUID_SEP | CPUID_CMOV;
|
||||
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_SEP | CPUID_CMOV;
|
||||
} else if (EAX == 2) {
|
||||
EAX = 0x00000001;
|
||||
EBX = ECX = 0;
|
||||
@@ -1993,7 +1996,7 @@ cpu_CPUID(void)
|
||||
} else if (EAX == 1) {
|
||||
EAX = CPUID;
|
||||
EBX = ECX = 0;
|
||||
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR | CPUID_MCA | CPUID_SEP | CPUID_FXSR | CPUID_CMOV;
|
||||
EDX = CPUID_FPU | CPUID_VME | CPUID_PSE | CPUID_TSC | CPUID_MSR | CPUID_PAE | CPUID_MCE | CPUID_CMPXCHG8B | CPUID_MMX | CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_SEP | CPUID_FXSR | CPUID_CMOV;
|
||||
} else if (EAX == 2) {
|
||||
EAX = 0x00000001;
|
||||
EBX = ECX = 0;
|
||||
@@ -2845,7 +2848,7 @@ amd_k_invalid_wrmsr:
|
||||
break;
|
||||
case 0x1b:
|
||||
cpu_log("APIC_BASE write: %08X%08X\n", EDX, EAX);
|
||||
// msr.apic_base = EAX | ((uint64_t)EDX << 32);
|
||||
// msr.apic_base = EAX | ((uint64_t) EDX << 32);
|
||||
break;
|
||||
case 0x2a:
|
||||
break;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* leilei,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -172,35 +172,42 @@ typedef struct {
|
||||
const cpu_legacy_table_t **tables;
|
||||
} cpu_legacy_machine_t;
|
||||
|
||||
#define C_FLAG 0x0001
|
||||
#define P_FLAG 0x0004
|
||||
#define A_FLAG 0x0010
|
||||
#define Z_FLAG 0x0040
|
||||
#define N_FLAG 0x0080
|
||||
#define T_FLAG 0x0100
|
||||
#define I_FLAG 0x0200
|
||||
#define D_FLAG 0x0400
|
||||
#define V_FLAG 0x0800
|
||||
#define NT_FLAG 0x4000
|
||||
#define MD_FLAG 0x8000
|
||||
#define C_FLAG 0x0001
|
||||
#define P_FLAG 0x0004
|
||||
#define A_FLAG 0x0010
|
||||
#define Z_FLAG 0x0040
|
||||
#define N_FLAG 0x0080
|
||||
#define T_FLAG 0x0100
|
||||
#define I_FLAG 0x0200
|
||||
#define D_FLAG 0x0400
|
||||
#define V_FLAG 0x0800
|
||||
#define NT_FLAG 0x4000
|
||||
#define MD_FLAG 0x8000
|
||||
|
||||
#define RF_FLAG 0x0001 /* in EFLAGS */
|
||||
#define VM_FLAG 0x0002 /* in EFLAGS */
|
||||
#define VIF_FLAG 0x0008 /* in EFLAGS */
|
||||
#define VIP_FLAG 0x0010 /* in EFLAGS */
|
||||
#define VID_FLAG 0x0020 /* in EFLAGS */
|
||||
#define RF_FLAG 0x0001 /* in EFLAGS */
|
||||
#define VM_FLAG 0x0002 /* in EFLAGS */
|
||||
#define VIF_FLAG 0x0008 /* in EFLAGS */
|
||||
#define VIP_FLAG 0x0010 /* in EFLAGS */
|
||||
#define VID_FLAG 0x0020 /* in EFLAGS */
|
||||
|
||||
#define WP_FLAG 0x10000 /* in CR0 */
|
||||
#define CR4_VME (1 << 0)
|
||||
#define CR4_PVI (1 << 1)
|
||||
#define CR4_PSE (1 << 4)
|
||||
#define CR4_PAE (1 << 5)
|
||||
#define WP_FLAG 0x10000 /* in CR0 */
|
||||
|
||||
#define CPL ((cpu_state.seg_cs.access >> 5) & 3)
|
||||
#define CR4_VME (1 << 0) /* Virtual 8086 Mode Extensions */
|
||||
#define CR4_PVI (1 << 1) /* Protected-mode Virtual Interrupts */
|
||||
#define CR4_TSD (1 << 2) /* Time Stamp Disable */
|
||||
#define CR4_DE (1 << 3) /* Debugging Extensions */
|
||||
#define CR4_PSE (1 << 4) /* Page Size Extension */
|
||||
#define CR4_PAE (1 << 5) /* Physical Address Extension */
|
||||
#define CR4_MCE (1 << 6) /* Machine Check Exception */
|
||||
#define CR4_PGE (1 << 7) /* Page Global Enabled */
|
||||
#define CR4_PCE (1 << 8) /* Performance-Monitoring Counter enable */
|
||||
#define CR4_OSFXSR (1 << 9) /* Operating system support for FXSAVE and FXRSTOR instructions */
|
||||
|
||||
#define IOPL ((cpu_state.flags >> 12) & 3)
|
||||
#define CPL ((cpu_state.seg_cs.access >> 5) & 3)
|
||||
|
||||
#define IOPLp ((!(msw & 1)) || (CPL <= IOPL))
|
||||
#define IOPL ((cpu_state.flags >> 12) & 3)
|
||||
|
||||
#define IOPLp ((!(msw & 1)) || (CPL <= IOPL))
|
||||
|
||||
typedef union {
|
||||
uint32_t l;
|
||||
@@ -467,15 +474,9 @@ COMPILE_TIME_ASSERT(sizeof(cpu_state_t) <= 128)
|
||||
# define fpu_cycles cpu_state._fpu_cycles
|
||||
#endif
|
||||
|
||||
#define cpu_rm cpu_state.rm_data.rm_mod_reg.rm
|
||||
#define cpu_mod cpu_state.rm_data.rm_mod_reg.mod
|
||||
#define cpu_reg cpu_state.rm_data.rm_mod_reg.reg
|
||||
|
||||
#define CR4_TSD (1 << 2)
|
||||
#define CR4_DE (1 << 3)
|
||||
#define CR4_MCE (1 << 6)
|
||||
#define CR4_PCE (1 << 8)
|
||||
#define CR4_OSFXSR (1 << 9)
|
||||
#define cpu_rm cpu_state.rm_data.rm_mod_reg.rm
|
||||
#define cpu_mod cpu_state.rm_data.rm_mod_reg.mod
|
||||
#define cpu_reg cpu_state.rm_data.rm_mod_reg.reg
|
||||
|
||||
/* Global variables. */
|
||||
extern cpu_state_t cpu_state;
|
||||
|
||||
1985
src/cpu/cpu_table.c
1985
src/cpu/cpu_table.c
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* FPU type handler.
|
||||
*
|
||||
* Authors: Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
|
||||
@@ -148,7 +148,7 @@ opMOV_CRx_r_a16(uint32_t fetchdat)
|
||||
break;
|
||||
case 4:
|
||||
if (cpu_has_feature(CPU_FEATURE_CR4)) {
|
||||
if (((cpu_state.regs[cpu_rm].l ^ cr4) & cpu_CR4_mask) & CR4_PAE)
|
||||
if (((cpu_state.regs[cpu_rm].l ^ cr4) & cpu_CR4_mask) & (CR4_PAE | CR4_PGE))
|
||||
flushmmucache();
|
||||
cr4 = cpu_state.regs[cpu_rm].l & cpu_CR4_mask;
|
||||
break;
|
||||
@@ -205,7 +205,7 @@ opMOV_CRx_r_a32(uint32_t fetchdat)
|
||||
break;
|
||||
case 4:
|
||||
if (cpu_has_feature(CPU_FEATURE_CR4)) {
|
||||
if (((cpu_state.regs[cpu_rm].l ^ cr4) & cpu_CR4_mask) & CR4_PAE)
|
||||
if (((cpu_state.regs[cpu_rm].l ^ cr4) & cpu_CR4_mask) & (CR4_PAE | CR4_PGE))
|
||||
flushmmucache();
|
||||
cr4 = cpu_state.regs[cpu_rm].l & cpu_CR4_mask;
|
||||
break;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* leilei,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
|
||||
@@ -125,25 +125,27 @@
|
||||
return 0; \
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
opFPU(s, x87_ts, 16, t.i, geteal, t.s, _32)
|
||||
#ifndef FPU_8087
|
||||
opFPU(s, x87_ts, 32, t.i, geteal, t.s, _32)
|
||||
#endif
|
||||
opFPU(d, x87_td, 16, t.i, geteaq, t.d, _64)
|
||||
opFPU(d, x87_td, 16, t.i, geteaq, t.d, _64)
|
||||
#ifndef FPU_8087
|
||||
opFPU(d, x87_td, 32, t.i, geteaq, t.d, _64)
|
||||
opFPU(d, x87_td, 32, t.i, geteaq, t.d, _64)
|
||||
#endif
|
||||
|
||||
opFPU(iw, uint16_t, 16, t, geteaw, (double) (int16_t) t, _i16)
|
||||
opFPU(iw, uint16_t, 16, t, geteaw, (double) (int16_t) t, _i16)
|
||||
#ifndef FPU_8087
|
||||
opFPU(iw, uint16_t, 32, t, geteaw, (double) (int16_t) t, _i16)
|
||||
opFPU(iw, uint16_t, 32, t, geteaw, (double) (int16_t) t, _i16)
|
||||
#endif
|
||||
opFPU(il, uint32_t, 16, t, geteal, (double) (int32_t) t, _i32)
|
||||
opFPU(il, uint32_t, 16, t, geteal, (double) (int32_t) t, _i32)
|
||||
#ifndef FPU_8087
|
||||
opFPU(il, uint32_t, 32, t, geteal, (double) (int32_t) t, _i32)
|
||||
opFPU(il, uint32_t, 32, t, geteal, (double) (int32_t) t, _i32)
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
static int opFADD(uint32_t fetchdat)
|
||||
static int opFADD(uint32_t fetchdat)
|
||||
{
|
||||
FP_ENTER();
|
||||
cpu_state.pc++;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2019 Sarah Walker.
|
||||
|
||||
@@ -124,7 +124,7 @@ static inline uint_fast64_t crc_reflect(uint_fast64_t data, size_t data_len) {
|
||||
* \return The updated crc value.
|
||||
******************************************************************************/
|
||||
uint64_t crc64(uint_fast64_t crc, const void *in_data, const uint64_t len) {
|
||||
const uint8_t *data = in_data;
|
||||
const uint8_t *data = (uint8_t *) in_data;
|
||||
bool bit;
|
||||
|
||||
for (uint64_t offset = 0; offset < len; offset++) {
|
||||
@@ -152,7 +152,7 @@ uint64_t crc64(uint_fast64_t crc, const void *in_data, const uint64_t len) {
|
||||
|
||||
/* Only for testing; doesn't support DUAL */
|
||||
uint64_t crc64_lookup(uint64_t crc, const void *in_data, const uint64_t len) {
|
||||
const uint8_t *data = in_data;
|
||||
const uint8_t *data = (uint8_t *) in_data;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
crc = crc64_table[0][(uint8_t)crc ^ data[i]] ^ (crc >> 8);
|
||||
}
|
||||
@@ -167,7 +167,7 @@ bool crc64speed_init(void) {
|
||||
#else
|
||||
should_init(crc64_table_little, LITTLE1);
|
||||
#endif
|
||||
crcspeed64little_init(crc64, dual ? crc64_table_little : crc64_table);
|
||||
crcspeed64little_init(crc64, dual ? (uint64_t (*)[256]) crc64_table_little : crc64_table);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ bool crc64speed_init_big(void) {
|
||||
#else
|
||||
should_init(crc64_table_big, BIG1);
|
||||
#endif
|
||||
crcspeed64big_init(crc64, dual ? crc64_table_big : crc64_table);
|
||||
crcspeed64big_init(crc64, dual ? (uint64_t (*)[256]) crc64_table_big : crc64_table);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ uint64_t crc64speed(uint64_t crc, const void *s, const uint64_t l) {
|
||||
#else
|
||||
check_init(crc64_table_little, LITTLE1);
|
||||
#endif
|
||||
return crcspeed64little(dual ? crc64_table_little : crc64_table, crc,
|
||||
return crcspeed64little(dual ? (uint64_t (*)[256]) crc64_table_little : crc64_table, crc,
|
||||
(void *)s, l);
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ uint64_t crc64speed_big(uint64_t crc, const void *s, const uint64_t l) {
|
||||
#else
|
||||
check_init(crc64_table_big, BIG1);
|
||||
#endif
|
||||
return crcspeed64big(dual ? crc64_table_big : crc64_table, crc, (void *)s,
|
||||
return crcspeed64big(dual ? (uint64_t (*)[256]) crc64_table_big : crc64_table, crc, (void *)s,
|
||||
l);
|
||||
}
|
||||
|
||||
|
||||
122
src/device.c
122
src/device.c
@@ -13,11 +13,13 @@
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
*
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
* Copyright 2008-2019 Sarah Walker.
|
||||
* Copyright 2021 Andreas J. Reichel.
|
||||
* Copyright 2021-2022 Jasmine Iwanek.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -90,7 +92,8 @@ device_set_context(device_context_t *c, const device_t *d, int inst)
|
||||
void *sec, *single_sec;
|
||||
|
||||
memset(c, 0, sizeof(device_context_t));
|
||||
c->dev = d;
|
||||
c->dev = d;
|
||||
c->instance = inst;
|
||||
if (inst) {
|
||||
sprintf(c->name, "%s #%i", d->name, inst);
|
||||
|
||||
@@ -132,7 +135,7 @@ device_context_restore(void)
|
||||
}
|
||||
|
||||
static void *
|
||||
device_add_common(const device_t *d, const device_t *cd, void *p, int inst)
|
||||
device_add_common(const device_t *d, const device_t *cd, void *p, void *params, int inst)
|
||||
{
|
||||
void *priv = NULL;
|
||||
int c;
|
||||
@@ -157,7 +160,7 @@ device_add_common(const device_t *d, const device_t *cd, void *p, int inst)
|
||||
device_set_context(&device_current, cd, inst);
|
||||
|
||||
if (d->init != NULL) {
|
||||
priv = d->init(d);
|
||||
priv = (d->flags & DEVICE_EXTPARAMS) ? d->init_ext(d, params) : d->init(d);
|
||||
if (priv == NULL) {
|
||||
if (d->name)
|
||||
device_log("DEVICE: device '%s' init failed\n", d->name);
|
||||
@@ -196,55 +199,103 @@ device_get_internal_name(const device_t *d)
|
||||
void *
|
||||
device_add(const device_t *d)
|
||||
{
|
||||
return device_add_common(d, d, NULL, 0);
|
||||
return device_add_common(d, d, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
void *
|
||||
device_add_parameters(const device_t *d, void *params)
|
||||
{
|
||||
return device_add_common(d, d, NULL, params, 0);
|
||||
}
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_add_ex(const device_t *d, void *priv)
|
||||
{
|
||||
device_add_common(d, d, priv, 0);
|
||||
device_add_common(d, d, priv, NULL, 0);
|
||||
}
|
||||
|
||||
void
|
||||
device_add_ex_parameters(const device_t *d, void *priv, void *params)
|
||||
{
|
||||
device_add_common(d, d, priv, params, 0);
|
||||
}
|
||||
|
||||
void *
|
||||
device_add_inst(const device_t *d, int inst)
|
||||
{
|
||||
return device_add_common(d, d, NULL, inst);
|
||||
return device_add_common(d, d, NULL, NULL, inst);
|
||||
}
|
||||
|
||||
void *
|
||||
device_add_inst_parameters(const device_t *d, int inst, void *params)
|
||||
{
|
||||
return device_add_common(d, d, NULL, params, inst);
|
||||
}
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_add_inst_ex(const device_t *d, void *priv, int inst)
|
||||
{
|
||||
device_add_common(d, d, priv, inst);
|
||||
device_add_common(d, d, priv, NULL, inst);
|
||||
}
|
||||
|
||||
/* These four are to add a device with another device's context - will be
|
||||
void
|
||||
device_add_inst_ex_parameters(const device_t *d, void *priv, int inst, void *params)
|
||||
{
|
||||
device_add_common(d, d, priv, params, inst);
|
||||
}
|
||||
|
||||
/* These eight are to add a device with another device's context - will be
|
||||
used to add machines' internal devices. */
|
||||
void *
|
||||
device_cadd(const device_t *d, const device_t *cd)
|
||||
{
|
||||
return device_add_common(d, cd, NULL, 0);
|
||||
return device_add_common(d, cd, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
void *
|
||||
device_cadd_parameters(const device_t *d, const device_t *cd, void *params)
|
||||
{
|
||||
return device_add_common(d, cd, NULL, params, 0);
|
||||
}
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_cadd_ex(const device_t *d, const device_t *cd, void *priv)
|
||||
{
|
||||
device_add_common(d, cd, priv, 0);
|
||||
device_add_common(d, cd, priv, NULL, 0);
|
||||
}
|
||||
|
||||
void
|
||||
device_cadd_ex_parameters(const device_t *d, const device_t *cd, void *priv, void *params)
|
||||
{
|
||||
device_add_common(d, cd, priv, params, 0);
|
||||
}
|
||||
|
||||
void *
|
||||
device_cadd_inst(const device_t *d, const device_t *cd, int inst)
|
||||
{
|
||||
return device_add_common(d, cd, NULL, inst);
|
||||
return device_add_common(d, cd, NULL, NULL, inst);
|
||||
}
|
||||
|
||||
void *
|
||||
device_cadd_inst_parameters(const device_t *d, const device_t *cd, int inst, void *params)
|
||||
{
|
||||
return device_add_common(d, cd, NULL, params, inst);
|
||||
}
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_cadd_inst_ex(const device_t *d, const device_t *cd, void *priv, int inst)
|
||||
{
|
||||
device_add_common(d, cd, priv, inst);
|
||||
device_add_common(d, cd, priv, NULL, inst);
|
||||
}
|
||||
|
||||
void
|
||||
device_cadd_inst_ex_parameters(const device_t *d, const device_t *cd, void *priv, int inst, void *params)
|
||||
{
|
||||
device_add_common(d, cd, priv, params, inst);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -347,6 +398,39 @@ device_available(const device_t *d)
|
||||
return (0);
|
||||
}
|
||||
|
||||
const char *
|
||||
device_get_bios_file(const device_t *d, const char *internal_name, int file_no)
|
||||
{
|
||||
device_config_t *config = NULL;
|
||||
device_config_bios_t *bios = NULL;
|
||||
|
||||
if (d != NULL) {
|
||||
config = (device_config_t *) d->config;
|
||||
if (config != NULL) {
|
||||
while (config->type != -1) {
|
||||
if (config->type == CONFIG_BIOS) {
|
||||
bios = (device_config_bios_t *) config->bios;
|
||||
|
||||
/* Go through the ROM's in the device configuration. */
|
||||
while (bios->files_no != 0) {
|
||||
if (!strcmp(internal_name, bios->internal_name)) {
|
||||
if (file_no < bios->files_no)
|
||||
return bios->files[file_no];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
bios++;
|
||||
}
|
||||
}
|
||||
config++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* A NULL device is never available. */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
int
|
||||
device_has_config(const device_t *d)
|
||||
{
|
||||
@@ -379,7 +463,7 @@ device_poll(const device_t *d, int x, int y, int z, int b)
|
||||
if (devices[c] != NULL) {
|
||||
if (devices[c] == d) {
|
||||
if (devices[c]->poll)
|
||||
return (devices[c]->poll(x, y, z, b, device_priv[c]));
|
||||
return (devices[c]->poll(x, y, z, b, 0, 0, device_priv[c]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -523,6 +607,12 @@ device_force_redraw(void)
|
||||
}
|
||||
}
|
||||
|
||||
const int
|
||||
device_get_instance(void)
|
||||
{
|
||||
return device_current.instance;
|
||||
}
|
||||
|
||||
const char *
|
||||
device_get_config_string(const char *s)
|
||||
{
|
||||
@@ -715,7 +805,7 @@ device_is_valid(const device_t *device, int m)
|
||||
int
|
||||
machine_get_config_int(char *s)
|
||||
{
|
||||
const device_t *d = machine_getdevice(machine);
|
||||
const device_t *d = machine_get_device(machine);
|
||||
const device_config_t *c;
|
||||
|
||||
if (d == NULL)
|
||||
@@ -735,7 +825,7 @@ machine_get_config_int(char *s)
|
||||
char *
|
||||
machine_get_config_string(char *s)
|
||||
{
|
||||
const device_t *d = machine_getdevice(machine);
|
||||
const device_t *d = machine_get_device(machine);
|
||||
const device_config_t *c;
|
||||
|
||||
if (d == NULL)
|
||||
|
||||
@@ -10,14 +10,17 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2020,2021 David Hrdlička.
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
# Copyright 2021 Andreas J. Reichel.
|
||||
# Copyright 2021-2022 Jasmine Iwanek.
|
||||
#
|
||||
|
||||
add_library(dev OBJECT bugger.c cassette.c cartridge.c hasp.c hwm.c hwm_lm75.c hwm_lm78.c hwm_gl518sm.c
|
||||
hwm_vt82c686.c ibm_5161.c isamem.c isartc.c ../lpt.c pci_bridge.c
|
||||
postcard.c serial.c clock_ics9xxx.c isapnp.c i2c.c i2c_gpio.c
|
||||
smbus_piix4.c smbus_ali7101.c keyboard.c keyboard_xt.c keyboard_at.c
|
||||
mouse.c mouse_bus.c mouse_serial.c mouse_ps2.c phoenix_486_jumper.c)
|
||||
mouse.c mouse_bus.c mouse_serial.c mouse_ps2.c phoenix_486_jumper.c
|
||||
mouse_wacom_tablet.c serial_passthrough.c)
|
||||
|
||||
if(ISAMEM_RAMPAGE)
|
||||
target_compile_definitions(dev PRIVATE USE_ISAMEM_RAMPAGE)
|
||||
|
||||
@@ -82,12 +82,13 @@
|
||||
#include <86box/pic.h>
|
||||
#include <86box/isartc.h>
|
||||
|
||||
#define ISARTC_EV170 0
|
||||
#define ISARTC_DTK 1
|
||||
#define ISARTC_P5PAK 2
|
||||
#define ISARTC_A6PAK 3
|
||||
#define ISARTC_EV170 0
|
||||
#define ISARTC_DTK 1
|
||||
#define ISARTC_P5PAK 2
|
||||
#define ISARTC_A6PAK 3
|
||||
#define ISARTC_VENDEX 4
|
||||
|
||||
#define ISARTC_DEBUG 0
|
||||
#define ISARTC_DEBUG 0
|
||||
|
||||
typedef struct {
|
||||
const char *name; /* board name */
|
||||
@@ -544,6 +545,18 @@ isartc_init(const device_t *info)
|
||||
dev->year = MM67_AL_DOM; /* year, NON STANDARD */
|
||||
break;
|
||||
|
||||
case ISARTC_VENDEX: /* Vendex HeadStart Turbo 888-XT RTC */
|
||||
dev->flags |= FLAG_YEAR80 | FLAG_YEARBCD;
|
||||
dev->base_addr = 0x0300;
|
||||
dev->base_addrsz = 32;
|
||||
dev->f_rd = mm67_read;
|
||||
dev->f_wr = mm67_write;
|
||||
dev->nvr.reset = mm67_reset;
|
||||
dev->nvr.start = mm67_start;
|
||||
dev->nvr.tick = mm67_tick;
|
||||
dev->year = MM67_AL_DOM; /* year, NON STANDARD */
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -559,7 +572,7 @@ isartc_init(const device_t *info)
|
||||
dev->f_rd, NULL, NULL, dev->f_wr, NULL, NULL, dev);
|
||||
|
||||
/* Hook into the NVR backend. */
|
||||
dev->nvr.fn = isartc_get_internal_name(isartc_type);
|
||||
dev->nvr.fn = (char *) info->internal_name;
|
||||
dev->nvr.irq = dev->irq;
|
||||
if (!is_at)
|
||||
nvr_init(&dev->nvr);
|
||||
@@ -709,6 +722,21 @@ static const device_t a6pak_device = {
|
||||
.config = a6pak_config
|
||||
};
|
||||
|
||||
/* Onboard RTC devices */
|
||||
const device_t vendex_xt_rtc_onboard_device = {
|
||||
.name = "National Semiconductor MM58167 (Vendex)",
|
||||
.internal_name = "vendex_xt_rtc",
|
||||
.flags = DEVICE_ISA,
|
||||
.local = ISARTC_VENDEX,
|
||||
.init = isartc_init,
|
||||
.close = isartc_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
static const device_t isartc_none_device = {
|
||||
.name = "None",
|
||||
.internal_name = "none",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* EngiNerd <webmaster.crrc@yahoo.it>
|
||||
* EngiNerd, <webmaster.crrc@yahoo.it>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
@@ -1291,8 +1291,8 @@ write64_generic(void *priv, uint8_t val)
|
||||
} else {
|
||||
if (((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF) && ((dev->flags & KBC_VEN_MASK) != KBC_VEN_INTEL_AMI))
|
||||
#if 0
|
||||
add_to_kbc_queue_front(dev, (dev->input_port | fixed_bits) &
|
||||
(((dev->flags & KBC_VEN_MASK) == KBC_VEN_ACER) ? 0xeb : 0xef), 0, 0x00);
|
||||
add_to_kbc_queue_front(dev, (dev->input_port | fixed_bits) &
|
||||
(((dev->flags & KBC_VEN_MASK) == KBC_VEN_ACER) ? 0xeb : 0xef), 0, 0x00);
|
||||
#else
|
||||
add_to_kbc_queue_front(dev, ((dev->input_port | fixed_bits) & 0xf0) | (((dev->flags & KBC_VEN_MASK) == KBC_VEN_ACER) ? 0x08 : 0x0c), 0, 0x00);
|
||||
#endif
|
||||
@@ -1947,7 +1947,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
|
||||
val &= ~0x0c;
|
||||
val |= (dev->output_port & 0x0c);
|
||||
}
|
||||
write_output(dev, val);
|
||||
write_output(dev, val | 0x01);
|
||||
break;
|
||||
|
||||
case 0xd2: /* write to keyboard output buffer */
|
||||
@@ -2491,7 +2491,7 @@ kbd_init(const device_t *info)
|
||||
|
||||
dev->flags = info->local;
|
||||
|
||||
video_reset(gfxcard);
|
||||
video_reset(gfxcard[0]);
|
||||
kbd_reset(dev);
|
||||
|
||||
io_sethandler(0x0060, 1, kbd_read, NULL, NULL, kbd_write, NULL, NULL, dev);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* EngiNerd, <webmaster.crrc@yahoo.it>
|
||||
@@ -126,219 +126,219 @@ const scancode scancode_xt[512] = {
|
||||
{ {0x50, 0}, {0xd0, 0} }, { {0x51, 0}, {0xd1, 0} },
|
||||
{ {0x52, 0}, {0xd2, 0} }, { {0x53, 0}, {0xd3, 0} },
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*054*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*054*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*058*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*058*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*05c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*05c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*060*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*060*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*064*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*064*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*068*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*068*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*06c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*06c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*070*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*070*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*074*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*074*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*078*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*078*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*07c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*07c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*080*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*080*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*084*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*084*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*088*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*088*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*08c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*08c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*090*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*090*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*094*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*094*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*098*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*098*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*09c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*09c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0a0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0a0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0a4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0a4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0a8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0a8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0ac*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0ac*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0b0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0b0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0b4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0b4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0b8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0b8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0bc*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0bc*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0c0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0c0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0c4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0c4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0c8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0c8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0cc*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0cc*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0d0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0d0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0d4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0d4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0d8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0d8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0dc*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0dc*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0e0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0e0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0e4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0e4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0e8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0e8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0ec*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0ec*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0f0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0f0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0f4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0f4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0f8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0f8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0fc*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*0fc*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*100*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*100*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*104*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*104*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*108*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*108*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*10c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*10c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*110*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*110*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*114*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*114*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*118*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*118*/
|
||||
{ {0x1c, 0}, {0x9c, 0} }, { {0x1d, 0}, {0x9d, 0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*11c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*11c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*120*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*120*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*124*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*124*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*128*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*128*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*12c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*12c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*130*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*130*/
|
||||
{ {0}, {0} }, { {0x35, 0}, {0xb5, 0} },
|
||||
{ {0}, {0} }, { {0x37, 0}, {0xb7, 0} }, /*134*/
|
||||
{ {0}, {0} }, { {0x37, 0}, {0xb7, 0} }, /*134*/
|
||||
{ {0x38, 0}, {0xb8, 0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*138*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*138*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*13c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*13c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*140*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*140*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0x46, 0}, {0xc6, 0} }, { {0x47, 0}, {0xc7, 0} }, /*144*/
|
||||
{ {0x46, 0}, {0xc6, 0} }, { {0x47, 0}, {0xc7, 0} }, /*144*/
|
||||
{ {0x48, 0}, {0xc8, 0} }, { {0x49, 0}, {0xc9, 0} },
|
||||
{ {0}, {0} }, { {0x4b, 0}, {0xcb, 0} }, /*148*/
|
||||
{ {0}, {0} }, { {0x4b, 0}, {0xcb, 0} }, /*148*/
|
||||
{ {0}, {0} }, { {0x4d, 0}, {0xcd, 0} },
|
||||
{ {0}, {0} }, { {0x4f, 0}, {0xcf, 0} }, /*14c*/
|
||||
{ {0}, {0} }, { {0x4f, 0}, {0xcf, 0} }, /*14c*/
|
||||
{ {0x50, 0}, {0xd0, 0} }, { {0x51, 0}, {0xd1, 0} },
|
||||
{ {0x52, 0}, {0xd2, 0} }, { {0x53, 0}, {0xd3, 0} }, /*150*/
|
||||
{ {0x52, 0}, {0xd2, 0} }, { {0x53, 0}, {0xd3, 0} }, /*150*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*154*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*154*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*158*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*158*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*15c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*15c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*160*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*160*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*164*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*164*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*168*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*168*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*16c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*16c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*170*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*170*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*174*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*174*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*148*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*148*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*17c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*17c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*180*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*180*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*184*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*184*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*88*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*88*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*18c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*18c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*190*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*190*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*194*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*194*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*198*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*198*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*19c*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*19c*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1a0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1a0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1a4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1a4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1a8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1a8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1ac*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1ac*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1b0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1b0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1b4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1b4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1b8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1b8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1bc*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1bc*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1c0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1c0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1c4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1c4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1c8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1c8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1cc*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1cc*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1d0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1d0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1d4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1d4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1d8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1d8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1dc*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1dc*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1e0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1e0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1e4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1e4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1e8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1e8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1ec*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1ec*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1f0*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1f0*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1f4*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1f4*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1f8*/
|
||||
{ {0}, {0} }, { {0}, {0} }, /*1f8*/
|
||||
{ {0}, {0} }, { {0}, {0} },
|
||||
{ {0}, {0} }, { {0}, {0} } /*1fc*/
|
||||
{ {0}, {0} }, { {0}, {0} } /*1fc*/
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -730,7 +730,7 @@ kbd_init(const device_t *info)
|
||||
|
||||
key_queue_start = key_queue_end = 0;
|
||||
|
||||
video_reset(gfxcard);
|
||||
video_reset(gfxcard[0]);
|
||||
|
||||
if ((kbd->type == KBD_TYPE_PC81) || (kbd->type == KBD_TYPE_PC82) ||
|
||||
(kbd->type == KBD_TYPE_PRAVETZ) || (kbd->type == KBD_TYPE_XT82) ||
|
||||
|
||||
@@ -37,7 +37,13 @@ int mouse_type = 0;
|
||||
int mouse_x,
|
||||
mouse_y,
|
||||
mouse_z,
|
||||
mouse_buttons;
|
||||
mouse_buttons,
|
||||
mouse_mode,
|
||||
mouse_tablet_in_proximity = 0,
|
||||
tablet_tool_type = 1; /* 0 = Puck/Cursor, 1 = Pen */
|
||||
|
||||
double mouse_x_abs,
|
||||
mouse_y_abs;
|
||||
|
||||
static const device_t mouse_none_device = {
|
||||
.name = "None",
|
||||
@@ -80,6 +86,7 @@ static mouse_t mouse_devices[] = {
|
||||
{ &mouse_msserial_device },
|
||||
{ &mouse_ltserial_device },
|
||||
{ &mouse_ps2_device },
|
||||
{ &mouse_wacom_device },
|
||||
{ NULL }
|
||||
// clang-format on
|
||||
};
|
||||
@@ -88,6 +95,7 @@ static const device_t *mouse_curr;
|
||||
static void *mouse_priv;
|
||||
static int mouse_nbut;
|
||||
static int (*mouse_dev_poll)(int x, int y, int z, int b, void *priv);
|
||||
static void (*mouse_poll_ex)(void) = NULL;
|
||||
|
||||
#ifdef ENABLE_MOUSE_LOG
|
||||
int mouse_do_log = ENABLE_MOUSE_LOG;
|
||||
@@ -146,6 +154,7 @@ mouse_reset(void)
|
||||
/* Clear local data. */
|
||||
mouse_x = mouse_y = mouse_z = 0;
|
||||
mouse_buttons = 0x00;
|
||||
mouse_mode = 0;
|
||||
|
||||
/* If no mouse configured, we're done. */
|
||||
if (mouse_type == 0)
|
||||
@@ -164,17 +173,26 @@ mouse_set_buttons(int buttons)
|
||||
mouse_nbut = buttons;
|
||||
}
|
||||
|
||||
void
|
||||
mouse_set_poll_ex(void (*poll_ex)(void))
|
||||
{
|
||||
mouse_poll_ex = poll_ex;
|
||||
}
|
||||
|
||||
void
|
||||
mouse_process(void)
|
||||
{
|
||||
if (mouse_curr == NULL)
|
||||
return;
|
||||
|
||||
mouse_poll();
|
||||
if (mouse_poll_ex)
|
||||
mouse_poll_ex();
|
||||
else
|
||||
mouse_poll();
|
||||
|
||||
if ((mouse_dev_poll != NULL) || (mouse_curr->poll != NULL)) {
|
||||
if (mouse_curr->poll != NULL)
|
||||
mouse_curr->poll(mouse_x, mouse_y, mouse_z, mouse_buttons, mouse_priv);
|
||||
mouse_curr->poll(mouse_x, mouse_y, mouse_z, mouse_buttons, mouse_x_abs, mouse_y_abs, mouse_priv);
|
||||
else
|
||||
mouse_dev_poll(mouse_x, mouse_y, mouse_z, mouse_buttons, mouse_priv);
|
||||
|
||||
|
||||
@@ -317,14 +317,14 @@ lt_write(uint16_t port, uint8_t val, void *priv)
|
||||
* This indicates the mode of operation of D7:
|
||||
* 1 = Mode set, 0 = Bit set/reset
|
||||
* D6,D5 = Mode selection (port A)
|
||||
* 00 = Mode 0 = Basic I/O
|
||||
* 01 = Mode 1 = Strobed I/O
|
||||
* 10 = Mode 2 = Bi-dir bus
|
||||
* 00 = Mode 0 = Basic I/O
|
||||
* 01 = Mode 1 = Strobed I/O
|
||||
* 10 = Mode 2 = Bi-dir bus
|
||||
* D4 = Port A direction (1 = input)
|
||||
* D3 = Port C (upper 4 bits) direction. (1 = input)
|
||||
* D2 = Mode selection (port B & C)
|
||||
* 0 = Mode 0 = Basic I/O
|
||||
* 1 = Mode 1 = Strobed I/O
|
||||
* 0 = Mode 0 = Basic I/O
|
||||
* 1 = Mode 1 = Strobed I/O
|
||||
* D1 = Port B direction (1 = input)
|
||||
* D0 = Port C (lower 4 bits) direction. (1 = input)
|
||||
*
|
||||
@@ -333,8 +333,8 @@ lt_write(uint16_t port, uint8_t val, void *priv)
|
||||
* being an output port and lower 4 bits an input port, and
|
||||
* enable the sucker. Courtesy Intel 8255 databook. Lars
|
||||
*
|
||||
* 1001 1011 9B 1111 Default state
|
||||
* 1001 0001 91 1001 Driver-initialized state
|
||||
* 1001 1011 9B 1111 Default state
|
||||
* 1001 0001 91 1001 Driver-initialized state
|
||||
* The only difference is - port C upper and port B go from
|
||||
* input to output.
|
||||
*/
|
||||
@@ -449,7 +449,7 @@ ms_write(uint16_t port, uint8_t val, void *priv)
|
||||
|
||||
/* The emulator calls us with an update on the host mouse device. */
|
||||
static int
|
||||
bm_poll(int x, int y, int z, int b, void *priv)
|
||||
bm_poll(int x, int y, int z, int b, double abs_x, double abs_y, void *priv)
|
||||
{
|
||||
mouse_t *dev = (mouse_t *) priv;
|
||||
int xor ;
|
||||
|
||||
@@ -191,6 +191,12 @@ ps2_write(uint8_t val, void *priv)
|
||||
keyboard_at_adddata_mouse(dev->sample_rate);
|
||||
break;
|
||||
|
||||
case 0xea: /* set stream */
|
||||
dev->flags &= ~FLAG_CTRLDAT;
|
||||
mouse_scan = 1;
|
||||
keyboard_at_adddata_mouse(0xfa); /* ACK for command byte */
|
||||
break;
|
||||
|
||||
case 0xeb: /* Get mouse data */
|
||||
keyboard_at_adddata_mouse(0xfa);
|
||||
|
||||
@@ -261,7 +267,7 @@ mouse_reset:
|
||||
}
|
||||
|
||||
static int
|
||||
ps2_poll(int x, int y, int z, int b, void *priv)
|
||||
ps2_poll(int x, int y, int z, int b, double abs_x, double abs_y, void *priv)
|
||||
{
|
||||
mouse_t *dev = (mouse_t *) priv;
|
||||
|
||||
@@ -270,7 +276,7 @@ ps2_poll(int x, int y, int z, int b, void *priv)
|
||||
|
||||
#if 0
|
||||
if (!(dev->flags & FLAG_ENABLED))
|
||||
return(0xff);
|
||||
return(0xff);
|
||||
#endif
|
||||
|
||||
if (!mouse_scan)
|
||||
|
||||
@@ -511,7 +511,7 @@ sermouse_command_timer(void *priv)
|
||||
}
|
||||
|
||||
static int
|
||||
sermouse_poll(int x, int y, int z, int b, void *priv)
|
||||
sermouse_poll(int x, int y, int z, int b, double abs_x, double abs_y, void *priv)
|
||||
{
|
||||
mouse_t *dev = (mouse_t *) priv;
|
||||
|
||||
|
||||
446
src/device/mouse_wacom_tablet.c
Normal file
446
src/device/mouse_wacom_tablet.c
Normal file
@@ -0,0 +1,446 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/mouse.h>
|
||||
#include <86box/serial.h>
|
||||
#include <86box/plat.h>
|
||||
|
||||
#define FLAG_3BTN 0x20 /* enable 3-button mode */
|
||||
|
||||
enum wacom_modes {
|
||||
WACOM_MODE_SUPPRESSED = 0,
|
||||
WACOM_MODE_POINT = 1,
|
||||
WACOM_MODE_STREAM = 2,
|
||||
WACOM_MODE_SWITCH = 3,
|
||||
};
|
||||
|
||||
enum {
|
||||
REPORT_PHASE_PREPARE,
|
||||
REPORT_PHASE_TRANSMIT
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const char *name; /* name of this device */
|
||||
int8_t type, /* type of this device */
|
||||
port;
|
||||
uint8_t flags, but, /* device flags */
|
||||
status, format,
|
||||
data_len, data[64],
|
||||
data_rec[0x200];
|
||||
int abs_x, abs_y,
|
||||
rel_x, rel_y,
|
||||
oldb, b;
|
||||
|
||||
int data_pos, data_rec_pos, mode, transmission_ongoing, transmission_format, interval;
|
||||
int increment, suppressed_increment;
|
||||
int transmission_stopped;
|
||||
int reset;
|
||||
int transmit_id, transmit_id_pending;
|
||||
int pressure_mode;
|
||||
int suppressed, measurement, always_report;
|
||||
int remote_req, remote_mode;
|
||||
|
||||
int last_abs_x, last_abs_y; /* Suppressed/Increment Mode. */
|
||||
uint32_t settings; /* Settings DWORD */
|
||||
|
||||
double transmit_period;
|
||||
double old_tsc, reset_tsc;
|
||||
pc_timer_t report_timer;
|
||||
|
||||
serial_t *serial;
|
||||
} mouse_wacom_t;
|
||||
|
||||
static double
|
||||
wacom_transmit_period(mouse_wacom_t *dev, int bps, int rps)
|
||||
{
|
||||
double dbps = (double) bps;
|
||||
double temp = 0.0;
|
||||
int word_len = 10;
|
||||
|
||||
if (rps == -1)
|
||||
temp = (double) word_len;
|
||||
else {
|
||||
temp = (double) rps;
|
||||
temp = (9600.0 - (temp * 33.0));
|
||||
temp /= rps;
|
||||
}
|
||||
temp = (1000000.0 / dbps) * temp;
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
static void
|
||||
wacom_reset(mouse_wacom_t *wacom)
|
||||
{
|
||||
wacom->transmit_period = wacom_transmit_period(wacom, 9600, -1);
|
||||
wacom->mode = WACOM_MODE_POINT;
|
||||
wacom->data_pos = 0;
|
||||
wacom->transmission_ongoing = 0;
|
||||
wacom->mode = 0;
|
||||
wacom->transmission_stopped = 0;
|
||||
wacom->interval = 0;
|
||||
wacom->transmit_id = 0;
|
||||
wacom->format = 0; /* ASCII */
|
||||
wacom->measurement = 1;
|
||||
wacom->increment = wacom->suppressed_increment = 0;
|
||||
wacom->reset_tsc = tsc;
|
||||
wacom->remote_mode = wacom->remote_req = 0;
|
||||
wacom->always_report = 0;
|
||||
|
||||
mouse_mode = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
wacom_callback(struct serial_s *serial, void *priv)
|
||||
{
|
||||
mouse_wacom_t *wacom = (mouse_wacom_t *) priv;
|
||||
|
||||
wacom->transmit_period = wacom_transmit_period(wacom, 9600, -1);
|
||||
timer_stop(&wacom->report_timer);
|
||||
timer_on_auto(&wacom->report_timer, wacom->transmit_period);
|
||||
}
|
||||
|
||||
static void
|
||||
wacom_write(struct serial_s *serial, void *priv, uint8_t data)
|
||||
{
|
||||
mouse_wacom_t *wacom = (mouse_wacom_t *) priv;
|
||||
static int special_command = 0;
|
||||
|
||||
if (data == '~') {
|
||||
special_command = 1;
|
||||
return;
|
||||
}
|
||||
if (special_command) {
|
||||
switch (data) {
|
||||
case '#':
|
||||
{
|
||||
if (!wacom->transmission_ongoing)
|
||||
wacom->transmit_id++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
special_command = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (data == '@') {
|
||||
wacom->remote_req = 1;
|
||||
wacom->remote_mode = 1;
|
||||
return;
|
||||
}
|
||||
if (data == 0x13) {
|
||||
wacom->transmission_stopped = 1;
|
||||
return;
|
||||
}
|
||||
if (data == 0x11) {
|
||||
wacom->transmission_stopped = 0;
|
||||
wacom->remote_mode = wacom->remote_req = 0;
|
||||
return;
|
||||
}
|
||||
wacom->data_rec[wacom->data_rec_pos++] = data;
|
||||
if (data == '\r' || data == '\n') {
|
||||
wacom->data_rec[wacom->data_rec_pos] = 0;
|
||||
wacom->data_rec_pos = 0;
|
||||
|
||||
if (data == '\n')
|
||||
pclog("Wacom: written %s", wacom->data_rec);
|
||||
else
|
||||
pclog("Wacom: written %s\n", wacom->data_rec);
|
||||
if (!memcmp(wacom->data_rec, "AS", 2)) {
|
||||
wacom->format = (wacom->data_rec[2] == '1');
|
||||
wacom->transmission_ongoing = 0;
|
||||
} else if (!memcmp(wacom->data_rec, "SR", 2)) {
|
||||
wacom->mode = WACOM_MODE_STREAM;
|
||||
wacom->suppressed_increment = 0;
|
||||
} else if (!memcmp(wacom->data_rec, "IN", 2)) {
|
||||
sscanf((const char *) wacom->data_rec, "IN%d", &wacom->increment);
|
||||
} else if (!memcmp(wacom->data_rec, "RE", 2) || wacom->data_rec[0] == '$' || wacom->data_rec[0] == '#') {
|
||||
wacom_reset(wacom);
|
||||
} else if (!memcmp(wacom->data_rec, "IT", 2)) {
|
||||
sscanf((const char *) wacom->data_rec, "IT%d", &wacom->interval);
|
||||
} else if (!memcmp(wacom->data_rec, "DE", 2)) {
|
||||
sscanf((const char *) wacom->data_rec, "DE%d", &mouse_mode);
|
||||
mouse_mode = !mouse_mode;
|
||||
plat_mouse_capture(0);
|
||||
} else if (!memcmp(wacom->data_rec, "SU", 2)) {
|
||||
sscanf((const char *) wacom->data_rec, "SU%d", &wacom->suppressed_increment);
|
||||
} else if (!memcmp(wacom->data_rec, "PH", 2)) {
|
||||
sscanf((const char *) wacom->data_rec, "PH%d", &wacom->pressure_mode);
|
||||
} else if (!memcmp(wacom->data_rec, "IC", 2)) {
|
||||
sscanf((const char *) wacom->data_rec, "IC%d", &wacom->measurement);
|
||||
} else if (!memcmp(wacom->data_rec, "AL", 2)) {
|
||||
sscanf((const char *) wacom->data_rec, "AL%d", &wacom->always_report);
|
||||
} else if (!memcmp(wacom->data_rec, "RQ", 2)) {
|
||||
sscanf((const char *) wacom->data_rec, "RQ%d", &wacom->remote_mode);
|
||||
if (wacom->remote_mode)
|
||||
wacom->remote_req = 1;
|
||||
} else if (!memcmp(wacom->data_rec, "SP", 2)) {
|
||||
wacom->transmission_stopped = 1;
|
||||
} else if (!memcmp(wacom->data_rec, "ST", 2)) {
|
||||
wacom->transmission_stopped = 0;
|
||||
wacom->remote_mode = wacom->remote_req = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
wacom_poll(int x, int y, int z, int b, double abs_x, double abs_y, void *priv)
|
||||
{
|
||||
mouse_wacom_t *wacom = (mouse_wacom_t *) priv;
|
||||
wacom->abs_x = abs_x * (wacom->measurement ? 4566. : 5800.);
|
||||
wacom->abs_y = abs_y * (wacom->measurement ? 2972. : 3774.);
|
||||
if (wacom->abs_x > (wacom->measurement ? 4566 : 5800))
|
||||
wacom->abs_x = (wacom->measurement ? 4566 : 5800);
|
||||
if (wacom->abs_y > (wacom->measurement ? 2972 : 3774))
|
||||
wacom->abs_x = (wacom->measurement ? 2972 : 3774);
|
||||
if (wacom->abs_x < 0)
|
||||
wacom->abs_x = 0;
|
||||
if (wacom->abs_y < 0)
|
||||
wacom->abs_y = 0;
|
||||
wacom->rel_x = x;
|
||||
wacom->rel_y = y;
|
||||
if (wacom->b != b)
|
||||
wacom->oldb = wacom->b;
|
||||
wacom->b = b;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
wacom_switch_off_to_on(int b, int oldb)
|
||||
{
|
||||
if (!(oldb & 0x1) && (b & 1))
|
||||
return 1;
|
||||
if (!(oldb & 0x2) && (b & 2))
|
||||
return 1;
|
||||
if (!(oldb & 0x4) && (b & 4))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
wacom_get_switch(int b)
|
||||
{
|
||||
if (b & 0x4)
|
||||
return 0x23;
|
||||
if (b & 0x2)
|
||||
return 0x22;
|
||||
if (b & 0x1)
|
||||
return 0x21;
|
||||
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
static void
|
||||
wacom_transmit_prepare(mouse_wacom_t *wacom, int x, int y)
|
||||
{
|
||||
wacom->transmission_ongoing = 1;
|
||||
wacom->data_pos = 0;
|
||||
memset(wacom->data, 0, sizeof(wacom->data));
|
||||
if (wacom->transmit_id) {
|
||||
wacom->transmission_format = 0;
|
||||
snprintf((char *) wacom->data, sizeof(wacom->data), "~#SD51C V3.2.1.01\r");
|
||||
return;
|
||||
}
|
||||
wacom->transmission_format = wacom->format;
|
||||
wacom->last_abs_x = wacom->abs_x;
|
||||
wacom->last_abs_y = wacom->abs_y;
|
||||
wacom->remote_req = 0;
|
||||
|
||||
wacom->oldb = wacom->b;
|
||||
if (wacom->format == 1) {
|
||||
wacom->data[0] = 0xC0;
|
||||
wacom->data[6] = wacom->pressure_mode ? ((wacom->b & 0x1) ? (uint8_t) 31 : (uint8_t) -31) : wacom_get_switch(wacom->b);
|
||||
|
||||
wacom->data[5] = (y & 0x7F);
|
||||
wacom->data[4] = ((y & 0x3F80) >> 7) & 0x7F;
|
||||
wacom->data[3] = (((y & 0xC000) >> 14) & 3);
|
||||
|
||||
wacom->data[2] = (x & 0x7F);
|
||||
wacom->data[1] = ((x & 0x3F80) >> 7) & 0x7F;
|
||||
wacom->data[0] |= (((x & 0xC000) >> 14) & 3);
|
||||
|
||||
if (mouse_mode == 0) {
|
||||
wacom->data[0] |= (!!(x < 0)) << 2;
|
||||
wacom->data[3] |= (!!(y < 0)) << 2;
|
||||
}
|
||||
|
||||
if (wacom->pressure_mode) {
|
||||
wacom->data[0] |= 0x10;
|
||||
wacom->data[6] &= 0x7F;
|
||||
}
|
||||
|
||||
if (tablet_tool_type == 1) {
|
||||
wacom->data[0] |= 0x20;
|
||||
}
|
||||
|
||||
if (!mouse_tablet_in_proximity) {
|
||||
wacom->data[0] &= ~0x40;
|
||||
}
|
||||
} else {
|
||||
wacom->data[0] = 0;
|
||||
snprintf((char *) wacom->data, sizeof(wacom->data), "*,%05d,%05d,%d\r\n",
|
||||
wacom->abs_x, wacom->abs_y,
|
||||
wacom->pressure_mode ? ((wacom->b & 0x1) ? (uint8_t) -31 : (uint8_t) 15) : ((wacom->b & 0x1) ? 21 : 00));
|
||||
}
|
||||
}
|
||||
|
||||
extern double cpuclock;
|
||||
static void
|
||||
wacom_report_timer(void *priv)
|
||||
{
|
||||
mouse_wacom_t *wacom = (mouse_wacom_t *) priv;
|
||||
double milisecond_diff = ((double) (tsc - wacom->old_tsc)) / cpuclock * 1000.0;
|
||||
int relative_mode = (mouse_mode == 0);
|
||||
int x = (relative_mode ? wacom->rel_x : wacom->abs_x);
|
||||
int y = (relative_mode ? wacom->rel_y : wacom->abs_y);
|
||||
int x_diff = abs(relative_mode ? wacom->rel_x : (wacom->abs_x - wacom->last_abs_x));
|
||||
int y_diff = abs(relative_mode ? wacom->rel_y : (wacom->abs_y - wacom->last_abs_y));
|
||||
int increment = wacom->suppressed_increment ? wacom->suppressed_increment : wacom->increment;
|
||||
|
||||
timer_on_auto(&wacom->report_timer, wacom->transmit_period);
|
||||
if ((((double) (tsc - wacom->reset_tsc)) / cpuclock * 1000.0) <= 10)
|
||||
return;
|
||||
if (wacom->transmit_id && !wacom->transmission_ongoing)
|
||||
goto transmit_prepare;
|
||||
if (wacom->transmission_ongoing)
|
||||
goto transmit;
|
||||
else if (wacom->remote_mode && !wacom->remote_req)
|
||||
return;
|
||||
else {
|
||||
if (wacom->remote_mode && wacom->remote_req) {
|
||||
goto transmit_prepare;
|
||||
}
|
||||
if (wacom->transmission_stopped || (!mouse_tablet_in_proximity && !wacom->always_report))
|
||||
return;
|
||||
|
||||
if (milisecond_diff >= (wacom->interval * 5)) {
|
||||
wacom->old_tsc = tsc;
|
||||
} else
|
||||
return;
|
||||
|
||||
switch (wacom->mode) {
|
||||
case WACOM_MODE_STREAM:
|
||||
default:
|
||||
break;
|
||||
|
||||
case WACOM_MODE_POINT:
|
||||
{
|
||||
if (!(wacom_switch_off_to_on(wacom->b, wacom->oldb)))
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
case WACOM_MODE_SWITCH:
|
||||
{
|
||||
if (!wacom->b)
|
||||
return;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (increment && !(x_diff > increment || y_diff > increment)) {
|
||||
if (wacom->suppressed_increment && (wacom->b == wacom->oldb))
|
||||
return;
|
||||
|
||||
if (wacom->increment && !wacom_switch_off_to_on(wacom->b, wacom->oldb))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
transmit_prepare:
|
||||
wacom_transmit_prepare(wacom, x, y);
|
||||
|
||||
transmit:
|
||||
serial_write_fifo(wacom->serial, wacom->data[wacom->data_pos++]);
|
||||
if ((wacom->transmission_format == 0 && wacom->data[wacom->data_pos] == 0)
|
||||
|| (wacom->transmission_format == 1 && wacom->data_pos == 7)) {
|
||||
wacom->transmission_ongoing = 0;
|
||||
wacom->transmit_id = 0;
|
||||
wacom->data_pos = 0;
|
||||
wacom->old_tsc = tsc;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void *
|
||||
wacom_init(const device_t *info)
|
||||
{
|
||||
mouse_wacom_t *dev;
|
||||
|
||||
dev = (mouse_wacom_t *) calloc(1, sizeof(mouse_wacom_t));
|
||||
dev->name = info->name;
|
||||
dev->but = 3;
|
||||
|
||||
dev->port = device_get_config_int("port");
|
||||
|
||||
dev->serial = serial_attach(dev->port, wacom_callback, wacom_write, dev);
|
||||
timer_add(&dev->report_timer, wacom_report_timer, dev, 0);
|
||||
mouse_set_buttons(dev->but);
|
||||
|
||||
wacom_reset(dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
static void
|
||||
wacom_speed_changed(void *priv)
|
||||
{
|
||||
mouse_wacom_t *dev = (mouse_wacom_t *) priv;
|
||||
|
||||
wacom_callback(dev->serial, dev);
|
||||
}
|
||||
|
||||
static void
|
||||
wacom_close(void *priv)
|
||||
{
|
||||
mouse_wacom_t *dev = (mouse_wacom_t *) priv;
|
||||
|
||||
/* Detach serial port from the mouse. */
|
||||
if (dev && dev->serial && dev->serial->sd)
|
||||
memset(dev->serial->sd, 0, sizeof(serial_device_t));
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
static const device_config_t wacom_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "port",
|
||||
.description = "Serial Port",
|
||||
.type = CONFIG_SELECTION,
|
||||
.default_string = "",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
{ .description = "COM1", .value = 0 },
|
||||
{ .description = "COM2", .value = 1 },
|
||||
{ .description = "COM3", .value = 2 },
|
||||
{ .description = "COM4", .value = 3 },
|
||||
{ .description = "" }
|
||||
}
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
const device_t mouse_wacom_device = {
|
||||
.name = "Wacom SD-510C",
|
||||
.internal_name = "wacom_serial",
|
||||
.flags = DEVICE_COM,
|
||||
.local = MOUSE_TYPE_WACOM,
|
||||
.init = wacom_init,
|
||||
.close = wacom_close,
|
||||
.reset = NULL,
|
||||
{ .poll = wacom_poll },
|
||||
.speed_changed = wacom_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = wacom_config
|
||||
};
|
||||
@@ -8,6 +8,8 @@
|
||||
*
|
||||
* Implementation of the Phoenix 486 Jumper Readout
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Tiseno100
|
||||
*
|
||||
* Copyright 2020 Tiseno100
|
||||
@@ -89,7 +91,7 @@ phoenix_486_jumper_reset(void *priv)
|
||||
dev->jumper = 0x00;
|
||||
else {
|
||||
dev->jumper = 0x9f;
|
||||
if (gfxcard != 0x01)
|
||||
if (gfxcard[0] != 0x01)
|
||||
dev->jumper |= 0x40;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -78,10 +78,12 @@ serial_reset_port(serial_t *dev)
|
||||
dev->iir = dev->ier = dev->lcr = dev->fcr = 0;
|
||||
dev->fifo_enabled = 0;
|
||||
dev->xmit_fifo_pos = dev->rcvr_fifo_pos = 0;
|
||||
dev->xmit_fifo_end = dev->rcvr_fifo_end = 0;
|
||||
dev->rcvr_fifo_full = 0;
|
||||
dev->baud_cycles = 0;
|
||||
dev->out_new = 0xffff;
|
||||
memset(dev->xmit_fifo, 0, 16);
|
||||
memset(dev->rcvr_fifo, 0, 14);
|
||||
memset(dev->rcvr_fifo, 0, 16);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -89,10 +91,15 @@ serial_transmit_period(serial_t *dev)
|
||||
{
|
||||
double ddlab;
|
||||
|
||||
ddlab = (double) dev->dlab;
|
||||
if (dev->dlab != 0x0000)
|
||||
ddlab = (double) dev->dlab;
|
||||
else
|
||||
ddlab = 65536.0;
|
||||
|
||||
/* Bit period based on DLAB. */
|
||||
dev->transmit_period = (16000000.0 * ddlab) / dev->clock_src;
|
||||
if (dev->sd && dev->sd->transmit_period_callback)
|
||||
dev->sd->transmit_period_callback(dev, dev->sd->priv, dev->transmit_period);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -143,40 +150,90 @@ serial_clear_timeout(serial_t *dev)
|
||||
}
|
||||
|
||||
static void
|
||||
write_fifo(serial_t *dev, uint8_t dat)
|
||||
serial_receive_timer(void *priv)
|
||||
{
|
||||
serial_log("write_fifo(%08X, %02X, %i, %i)\n", dev, dat, (dev->type >= SERIAL_16550) && dev->fifo_enabled, dev->rcvr_fifo_pos & 0x0f);
|
||||
serial_t *dev = (serial_t *) priv;
|
||||
|
||||
// serial_log("serial_receive_timer()\n");
|
||||
|
||||
timer_on_auto(&dev->receive_timer, /* dev->bits * */ dev->transmit_period);
|
||||
|
||||
if ((dev->type >= SERIAL_16550) && dev->fifo_enabled) {
|
||||
/* FIFO mode. */
|
||||
timer_disable(&dev->timeout_timer);
|
||||
/* Indicate overrun. */
|
||||
if (dev->rcvr_fifo_full)
|
||||
dev->lsr |= 0x02;
|
||||
else
|
||||
dev->rcvr_fifo[dev->rcvr_fifo_pos] = dat;
|
||||
dev->lsr &= 0xfe;
|
||||
dev->int_status &= ~SERIAL_INT_RECEIVE;
|
||||
if (dev->rcvr_fifo_pos == (dev->rcvr_fifo_len - 1)) {
|
||||
dev->lsr |= 0x01;
|
||||
dev->int_status |= SERIAL_INT_RECEIVE;
|
||||
|
||||
if (dev->out_new != 0xffff) {
|
||||
/* We have received a byte into the RSR. */
|
||||
|
||||
/* Clear FIFO timeout. */
|
||||
serial_clear_timeout(dev);
|
||||
|
||||
if (dev->rcvr_fifo_full) {
|
||||
/* Overrun - just discard the byte in the RSR. */
|
||||
serial_log("FIFO overrun\n");
|
||||
dev->lsr |= 0x02;
|
||||
} else {
|
||||
/* We can input data into the FIFO. */
|
||||
dev->rcvr_fifo[dev->rcvr_fifo_end] = (uint8_t) (dev->out_new & 0xff);
|
||||
// dev->rcvr_fifo_end = (dev->rcvr_fifo_end + 1) & 0x0f;
|
||||
/* Do not wrap around, makes sure it still triggers the interrupt
|
||||
at 16 bytes. */
|
||||
dev->rcvr_fifo_end++;
|
||||
|
||||
serial_log("To FIFO: %02X (%i, %i, %i)\n", (uint8_t) (dev->out_new & 0xff),
|
||||
abs(dev->rcvr_fifo_end - dev->rcvr_fifo_pos),
|
||||
dev->rcvr_fifo_end, dev->rcvr_fifo_pos);
|
||||
dev->out_new = 0xffff;
|
||||
|
||||
if (abs(dev->rcvr_fifo_end - dev->rcvr_fifo_pos) >= dev->rcvr_fifo_len) {
|
||||
/* We have >= trigger level bytes, raise Data Ready interrupt. */
|
||||
serial_log("We have >= %i bytes in the FIFO, data ready!\n", dev->rcvr_fifo_len);
|
||||
dev->lsr |= 0x01;
|
||||
dev->int_status |= SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
|
||||
/* Now wrap around. */
|
||||
dev->rcvr_fifo_end &= 0x0f;
|
||||
|
||||
if (dev->rcvr_fifo_end == dev->rcvr_fifo_pos)
|
||||
dev->rcvr_fifo_full = 1;
|
||||
|
||||
timer_on_auto(&dev->timeout_timer, 4.0 * dev->bits * dev->transmit_period);
|
||||
}
|
||||
}
|
||||
if (dev->rcvr_fifo_pos < 15)
|
||||
dev->rcvr_fifo_pos++;
|
||||
else
|
||||
dev->rcvr_fifo_full = 1;
|
||||
serial_update_ints(dev);
|
||||
timer_on_auto(&dev->timeout_timer, 4.0 * dev->bits * dev->transmit_period);
|
||||
}
|
||||
|
||||
serial_update_ints(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_16550) && dev->fifo_enabled,
|
||||
((dev->type >= SERIAL_16550) && dev->fifo_enabled) ? (dev->rcvr_fifo_pos % dev->rcvr_fifo_len) : 0);
|
||||
|
||||
if ((dev->type >= SERIAL_16550) && dev->fifo_enabled) {
|
||||
/* FIFO mode. */
|
||||
|
||||
/* This is the first phase, we are sending the data to the RSR (Receiver Shift
|
||||
Register), from where it's going to get dispatched to the FIFO. */
|
||||
} else {
|
||||
/* Non-FIFO mode. */
|
||||
|
||||
/* Indicate overrun. */
|
||||
if (dev->lsr & 0x01)
|
||||
dev->lsr |= 0x02;
|
||||
dev->dat = dat;
|
||||
|
||||
/* Raise Data Ready interrupt. */
|
||||
serial_log("To RHR: %02X\n", dat);
|
||||
dev->lsr |= 0x01;
|
||||
dev->int_status |= SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
|
||||
/* Do this here, because in non-FIFO mode, this is read directly. */
|
||||
dev->out_new = (uint16_t) dat;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -311,9 +368,27 @@ serial_timeout_timer(void *priv)
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
|
||||
void
|
||||
serial_device_timeout(void *priv)
|
||||
{
|
||||
serial_t *dev = (serial_t *) priv;
|
||||
|
||||
#ifdef ENABLE_SERIAL_LOG
|
||||
serial_log("serial_device_timeout()\n");
|
||||
#endif
|
||||
|
||||
if (!dev->fifo_enabled) {
|
||||
dev->lsr |= 0x10;
|
||||
dev->int_status |= SERIAL_INT_LSR;
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
serial_update_speed(serial_t *dev)
|
||||
{
|
||||
timer_on_auto(&dev->receive_timer, /* dev->bits * */ dev->transmit_period);
|
||||
|
||||
if (dev->transmit_enabled & 3)
|
||||
timer_on_auto(&dev->transmit_timer, dev->transmit_period);
|
||||
|
||||
@@ -331,6 +406,63 @@ serial_reset_fifo(serial_t *dev)
|
||||
dev->rcvr_fifo_full = 0;
|
||||
}
|
||||
|
||||
void
|
||||
serial_set_dsr(serial_t *dev, uint8_t enabled)
|
||||
{
|
||||
if (dev->mctrl & 0x10)
|
||||
return;
|
||||
|
||||
dev->msr &= ~0x2;
|
||||
dev->msr |= ((dev->msr & 0x20) ^ ((!!enabled) << 5)) >> 4;
|
||||
dev->msr &= ~0x20;
|
||||
dev->msr |= (!!enabled) << 5;
|
||||
dev->msr_set &= ~0x20;
|
||||
dev->msr_set |= (!!enabled) << 5;
|
||||
|
||||
if (dev->msr & 0x2) {
|
||||
dev->int_status |= SERIAL_INT_MSR;
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
serial_set_cts(serial_t *dev, uint8_t enabled)
|
||||
{
|
||||
if (dev->mctrl & 0x10)
|
||||
return;
|
||||
|
||||
dev->msr &= ~0x1;
|
||||
dev->msr |= ((dev->msr & 0x10) ^ ((!!enabled) << 4)) >> 4;
|
||||
dev->msr &= ~0x10;
|
||||
dev->msr |= (!!enabled) << 4;
|
||||
dev->msr_set &= ~0x10;
|
||||
dev->msr_set |= (!!enabled) << 4;
|
||||
|
||||
if (dev->msr & 0x1) {
|
||||
dev->int_status |= SERIAL_INT_MSR;
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
serial_set_dcd(serial_t *dev, uint8_t enabled)
|
||||
{
|
||||
if (dev->mctrl & 0x10)
|
||||
return;
|
||||
|
||||
dev->msr &= ~0x8;
|
||||
dev->msr |= ((dev->msr & 0x80) ^ ((!!enabled) << 7)) >> 4;
|
||||
dev->msr &= ~0x80;
|
||||
dev->msr |= (!!enabled) << 7;
|
||||
dev->msr_set &= ~0x80;
|
||||
dev->msr_set |= (!!enabled) << 7;
|
||||
|
||||
if (dev->msr & 0x8) {
|
||||
dev->int_status |= SERIAL_INT_MSR;
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
serial_set_clock_src(serial_t *dev, double clock_src)
|
||||
{
|
||||
@@ -346,7 +478,8 @@ serial_write(uint16_t addr, uint8_t val, void *p)
|
||||
serial_t *dev = (serial_t *) p;
|
||||
uint8_t new_msr, old;
|
||||
|
||||
serial_log("UART: Write %02X to port %02X\n", val, addr);
|
||||
// serial_log("UART: Write %02X to port %02X\n", val, addr);
|
||||
serial_log("UART: [%04X:%08X] Write %02X to port %02X\n", CS, cpu_state.pc, val, addr);
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
|
||||
@@ -405,6 +538,7 @@ serial_write(uint16_t addr, uint8_t val, void *p)
|
||||
if (val & 0x02) {
|
||||
memset(dev->rcvr_fifo, 0, 14);
|
||||
dev->rcvr_fifo_pos = 0;
|
||||
dev->rcvr_fifo_end = 0;
|
||||
dev->rcvr_fifo_full = 0;
|
||||
}
|
||||
if (val & 0x04) {
|
||||
@@ -425,13 +559,14 @@ serial_write(uint16_t addr, uint8_t val, void *p)
|
||||
dev->rcvr_fifo_len = 14;
|
||||
break;
|
||||
}
|
||||
dev->out_new = 0xffff;
|
||||
serial_log("FIFO now %sabled, receive FIFO length = %i\n", dev->fifo_enabled ? "en" : "dis", dev->rcvr_fifo_len);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
old = dev->lcr;
|
||||
dev->lcr = val;
|
||||
if ((old ^ val) & 0x0f) {
|
||||
if ((old ^ val) & 0x3f) {
|
||||
/* Data bits + start bit. */
|
||||
dev->bits = ((dev->lcr & 0x03) + 5) + 1;
|
||||
/* Stop bits. */
|
||||
@@ -444,11 +579,14 @@ serial_write(uint16_t addr, uint8_t val, void *p)
|
||||
|
||||
serial_transmit_period(dev);
|
||||
serial_update_speed(dev);
|
||||
|
||||
if (dev->sd && dev->sd->lcr_callback)
|
||||
dev->sd->lcr_callback(dev, dev->sd->priv, dev->lcr);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if ((val & 2) && !(dev->mctrl & 2)) {
|
||||
if (dev->sd->rcr_callback)
|
||||
if (dev->sd && dev->sd->rcr_callback)
|
||||
dev->sd->rcr_callback(dev, dev->sd->priv);
|
||||
}
|
||||
if (!(val & 8) && (dev->mctrl & 8))
|
||||
@@ -487,7 +625,11 @@ serial_write(uint16_t addr, uint8_t val, void *p)
|
||||
serial_update_ints(dev);
|
||||
break;
|
||||
case 6:
|
||||
dev->msr = val;
|
||||
// dev->msr = (val & 0xf0) | (dev->msr & 0x0f);
|
||||
// dev->msr = val;
|
||||
/* The actual condition bits of the MSR are read-only, but the delta bits are
|
||||
undocumentedly writable, and the PCjr BIOS uses them to raise MSR interrupts. */
|
||||
dev->msr = (dev->msr & 0xf0) | (val & 0x0f);
|
||||
if (dev->msr & 0x0f)
|
||||
dev->int_status |= SERIAL_INT_MSR;
|
||||
serial_update_ints(dev);
|
||||
@@ -503,7 +645,7 @@ uint8_t
|
||||
serial_read(uint16_t addr, void *p)
|
||||
{
|
||||
serial_t *dev = (serial_t *) p;
|
||||
uint8_t i, ret = 0;
|
||||
uint8_t ret = 0;
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
|
||||
@@ -514,33 +656,49 @@ serial_read(uint16_t addr, void *p)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Clear timeout. */
|
||||
serial_clear_timeout(dev);
|
||||
|
||||
if ((dev->type >= SERIAL_16550) && dev->fifo_enabled) {
|
||||
/* FIFO mode. */
|
||||
|
||||
serial_clear_timeout(dev);
|
||||
if (dev->rcvr_fifo_full || (dev->rcvr_fifo_pos != dev->rcvr_fifo_end)) {
|
||||
/* There is data in the FIFO. */
|
||||
ret = dev->rcvr_fifo[dev->rcvr_fifo_pos];
|
||||
dev->rcvr_fifo_pos = (dev->rcvr_fifo_pos + 1) & 0x0f;
|
||||
|
||||
ret = dev->rcvr_fifo[0];
|
||||
dev->rcvr_fifo_full = 0;
|
||||
if (dev->rcvr_fifo_pos > 0) {
|
||||
for (i = 1; i < 16; i++)
|
||||
dev->rcvr_fifo[i - 1] = dev->rcvr_fifo[i];
|
||||
serial_log("FIFO position %i: read %02X, next %02X\n", dev->rcvr_fifo_pos, ret, dev->rcvr_fifo[0]);
|
||||
dev->rcvr_fifo_pos--;
|
||||
/* At least one byte remains to be read, start the timeout
|
||||
timer so that a timeout is indicated in case of no read. */
|
||||
timer_on_auto(&dev->timeout_timer, 4.0 * dev->bits * dev->transmit_period);
|
||||
} else {
|
||||
dev->lsr &= 0xfe;
|
||||
dev->int_status &= ~SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(dev);
|
||||
/* Make sure to clear the FIFO full condition. */
|
||||
dev->rcvr_fifo_full = 0;
|
||||
|
||||
if (abs(dev->rcvr_fifo_pos - dev->rcvr_fifo_end) < dev->rcvr_fifo_len) {
|
||||
/* Amount of data in the FIFO below trigger level,
|
||||
clear Data Ready interrupt. */
|
||||
dev->int_status &= ~SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
|
||||
/* Make sure the Data Ready bit of the LSR is set if we still have
|
||||
bytes left in the FIFO. */
|
||||
if (dev->rcvr_fifo_pos != dev->rcvr_fifo_end) {
|
||||
dev->lsr |= 0x01;
|
||||
/* There are bytes left in the FIFO, activate the FIFO Timeout timer. */
|
||||
timer_on_auto(&dev->timeout_timer, 4.0 * dev->bits * dev->transmit_period);
|
||||
} else
|
||||
dev->lsr &= 0xfe;
|
||||
}
|
||||
} else {
|
||||
ret = dev->dat;
|
||||
/* Non-FIFO mode. */
|
||||
|
||||
ret = (uint8_t) (dev->out_new & 0xffff);
|
||||
dev->out_new = 0xffff;
|
||||
|
||||
/* Always clear Data Ready interrupt. */
|
||||
dev->lsr &= 0xfe;
|
||||
dev->int_status &= ~SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(dev);
|
||||
}
|
||||
serial_log("Read data: %02X\n", ret);
|
||||
|
||||
// serial_log("Read data: %02X\n", ret);
|
||||
break;
|
||||
case 1:
|
||||
if (dev->lcr & 0x80)
|
||||
@@ -571,7 +729,7 @@ serial_read(uint16_t addr, void *p)
|
||||
serial_update_ints(dev);
|
||||
break;
|
||||
case 6:
|
||||
ret = dev->msr;
|
||||
ret = dev->msr | dev->msr_set;
|
||||
dev->msr &= ~0x0f;
|
||||
dev->int_status &= ~SERIAL_INT_MSR;
|
||||
serial_update_ints(dev);
|
||||
@@ -581,7 +739,8 @@ serial_read(uint16_t addr, void *p)
|
||||
break;
|
||||
}
|
||||
|
||||
serial_log("UART: Read %02X from port %02X\n", ret, addr);
|
||||
// serial_log("UART: Read %02X from port %02X\n", ret, addr);
|
||||
serial_log("UART: [%04X:%08X] Read %02X from port %02X\n", CS, cpu_state.pc, ret, addr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -630,9 +789,30 @@ serial_attach(int port,
|
||||
{
|
||||
serial_device_t *sd = &serial_devices[port];
|
||||
|
||||
sd->rcr_callback = rcr_callback;
|
||||
sd->dev_write = dev_write;
|
||||
sd->priv = priv;
|
||||
sd->rcr_callback = rcr_callback;
|
||||
sd->dev_write = dev_write;
|
||||
sd->transmit_period_callback = NULL;
|
||||
sd->lcr_callback = NULL;
|
||||
sd->priv = priv;
|
||||
|
||||
return sd->serial;
|
||||
}
|
||||
|
||||
serial_t *
|
||||
serial_attach_ex(int port,
|
||||
void (*rcr_callback)(struct serial_s *serial, void *p),
|
||||
void (*dev_write)(struct serial_s *serial, void *p, uint8_t data),
|
||||
void (*transmit_period_callback)(struct serial_s *serial, void *p, double transmit_period),
|
||||
void (*lcr_callback)(struct serial_s *serial, void *p, uint8_t data_bits),
|
||||
void *priv)
|
||||
{
|
||||
serial_device_t *sd = &serial_devices[port];
|
||||
|
||||
sd->rcr_callback = rcr_callback;
|
||||
sd->dev_write = dev_write;
|
||||
sd->transmit_period_callback = transmit_period_callback;
|
||||
sd->lcr_callback = lcr_callback;
|
||||
sd->priv = priv;
|
||||
|
||||
return sd->serial;
|
||||
}
|
||||
@@ -655,6 +835,34 @@ serial_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
static void
|
||||
serial_reset(void *priv)
|
||||
{
|
||||
serial_t *dev = (serial_t *) priv;
|
||||
|
||||
timer_disable(&dev->transmit_timer);
|
||||
timer_disable(&dev->timeout_timer);
|
||||
timer_disable(&dev->receive_timer);
|
||||
|
||||
dev->lsr = dev->thr = dev->mctrl = dev->rcr = 0x00;
|
||||
dev->iir = dev->ier = dev->lcr = dev->msr = 0x00;
|
||||
dev->dat = dev->int_status = dev->scratch = dev->fcr = 0x00;
|
||||
dev->fifo_enabled = dev->rcvr_fifo_len = dev->bits = dev->data_bits = 0x00;
|
||||
dev->baud_cycles = dev->rcvr_fifo_full = dev->txsr = dev->out = 0x00;
|
||||
|
||||
dev->dlab = dev->out_new = 0x0000;
|
||||
|
||||
dev->rcvr_fifo_pos = dev->xmit_fifo_pos = dev->rcvr_fifo_end = dev->xmit_fifo_end = 0x00;
|
||||
|
||||
serial_reset_port(dev);
|
||||
|
||||
dev->dlab = 96;
|
||||
dev->fcr = 0x06;
|
||||
|
||||
serial_transmit_period(dev);
|
||||
serial_update_speed(dev);
|
||||
}
|
||||
|
||||
static void *
|
||||
serial_init(const device_t *info)
|
||||
{
|
||||
@@ -680,12 +888,17 @@ serial_init(const device_t *info)
|
||||
serial_setup(dev, COM1_ADDR, COM1_IRQ);
|
||||
|
||||
/* Default to 1200,N,7. */
|
||||
dev->dlab = 96;
|
||||
dev->fcr = 0x06;
|
||||
dev->clock_src = 1843200.0;
|
||||
serial_transmit_period(dev);
|
||||
dev->dlab = 96;
|
||||
dev->fcr = 0x06;
|
||||
if (info->local == SERIAL_8250_PCJR)
|
||||
dev->clock_src = 1789500.0;
|
||||
else
|
||||
dev->clock_src = 1843200.0;
|
||||
timer_add(&dev->transmit_timer, serial_transmit_timer, dev, 0);
|
||||
timer_add(&dev->timeout_timer, serial_timeout_timer, dev, 0);
|
||||
timer_add(&dev->receive_timer, serial_receive_timer, dev, 0);
|
||||
serial_transmit_period(dev);
|
||||
serial_update_speed(dev);
|
||||
}
|
||||
|
||||
next_inst++;
|
||||
@@ -713,7 +926,7 @@ const device_t ns8250_device = {
|
||||
.local = SERIAL_8250,
|
||||
.init = serial_init,
|
||||
.close = serial_close,
|
||||
.reset = NULL,
|
||||
.reset = serial_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = serial_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
@@ -727,7 +940,7 @@ const device_t ns8250_pcjr_device = {
|
||||
.local = SERIAL_8250_PCJR,
|
||||
.init = serial_init,
|
||||
.close = serial_close,
|
||||
.reset = NULL,
|
||||
.reset = serial_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = serial_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
@@ -741,7 +954,7 @@ const device_t ns16450_device = {
|
||||
.local = SERIAL_16450,
|
||||
.init = serial_init,
|
||||
.close = serial_close,
|
||||
.reset = NULL,
|
||||
.reset = serial_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = serial_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
@@ -755,7 +968,7 @@ const device_t ns16550_device = {
|
||||
.local = SERIAL_16550,
|
||||
.init = serial_init,
|
||||
.close = serial_close,
|
||||
.reset = NULL,
|
||||
.reset = serial_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = serial_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
@@ -769,7 +982,7 @@ const device_t ns16650_device = {
|
||||
.local = SERIAL_16650,
|
||||
.init = serial_init,
|
||||
.close = serial_close,
|
||||
.reset = NULL,
|
||||
.reset = serial_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = serial_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
@@ -783,7 +996,7 @@ const device_t ns16750_device = {
|
||||
.local = SERIAL_16750,
|
||||
.init = serial_init,
|
||||
.close = serial_close,
|
||||
.reset = NULL,
|
||||
.reset = serial_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = serial_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
@@ -797,7 +1010,7 @@ const device_t ns16850_device = {
|
||||
.local = SERIAL_16850,
|
||||
.init = serial_init,
|
||||
.close = serial_close,
|
||||
.reset = NULL,
|
||||
.reset = serial_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = serial_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
@@ -811,7 +1024,7 @@ const device_t ns16950_device = {
|
||||
.local = SERIAL_16950,
|
||||
.init = serial_init,
|
||||
.close = serial_close,
|
||||
.reset = NULL,
|
||||
.reset = serial_reset,
|
||||
{ .available = NULL },
|
||||
.speed_changed = serial_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
|
||||
365
src/device/serial_passthrough.c
Normal file
365
src/device/serial_passthrough.c
Normal file
@@ -0,0 +1,365 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Implementation of Serial passthrough device.
|
||||
*
|
||||
*
|
||||
* Authors: Andreas J. Reichel <webmaster@6th-dimension.com>,
|
||||
* Jasmine Iwanek <jasmine@iwanek.co.uk>
|
||||
*
|
||||
* Copyright 2021 Andreas J. Reichel.
|
||||
* Copyright 2021-2022 Jasmine Iwanek.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/serial.h>
|
||||
#include <86box/serial_passthrough.h>
|
||||
#include <86box/plat_serial_passthrough.h>
|
||||
|
||||
#define ENABLE_SERIAL_PASSTHROUGH_LOG 1
|
||||
#ifdef ENABLE_SERIAL_PASSTHROUGH_LOG
|
||||
int serial_passthrough_do_log = ENABLE_SERIAL_PASSTHROUGH_LOG;
|
||||
|
||||
static void
|
||||
serial_passthrough_log(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (serial_passthrough_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define serial_passthrough_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
void
|
||||
serial_passthrough_init(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
for (c = 0; c < SERIAL_MAX; c++) {
|
||||
if (serial_passthrough_enabled[c]) {
|
||||
/* Instance n for COM n */
|
||||
device_add_inst(&serial_passthrough_device, c + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
serial_passthrough_write(serial_t *s, void *priv, uint8_t val)
|
||||
{
|
||||
plat_serpt_write(priv, val);
|
||||
}
|
||||
|
||||
static void
|
||||
host_to_serial_cb(void *priv)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
|
||||
uint8_t byte;
|
||||
|
||||
/* write_fifo has no failure indication, but if we write to fast, the host
|
||||
* can never fetch the bytes in time, so check if the fifo is full if in
|
||||
* fifo mode or if lsr has bit 0 set if not in fifo mode */
|
||||
if ((dev->serial->type >= SERIAL_16550) && dev->serial->fifo_enabled) {
|
||||
if (dev->serial->rcvr_fifo_full) {
|
||||
goto no_write_to_machine;
|
||||
}
|
||||
} else {
|
||||
if (dev->serial->lsr & 1) {
|
||||
goto no_write_to_machine;
|
||||
}
|
||||
}
|
||||
if (plat_serpt_read(dev, &byte)) {
|
||||
// printf("got byte %02X\n", byte);
|
||||
serial_write_fifo(dev->serial, byte);
|
||||
// serial_set_dsr(dev->serial, 1);
|
||||
}
|
||||
no_write_to_machine:
|
||||
// serial_device_timeout(dev->serial);
|
||||
timer_on_auto(&dev->host_to_serial_timer, (1000000.0 / dev->baudrate) * (double) dev->bits);
|
||||
}
|
||||
|
||||
static void
|
||||
serial_passthrough_rcr_cb(struct serial_s *serial, void *priv)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
|
||||
timer_stop(&dev->host_to_serial_timer);
|
||||
/* FIXME: do something to dev->baudrate */
|
||||
timer_on_auto(&dev->host_to_serial_timer, (1000000.0 / dev->baudrate) * (double) dev->bits);
|
||||
// serial_clear_fifo(dev->serial);
|
||||
}
|
||||
|
||||
static void
|
||||
serial_passthrough_speed_changed(void *priv)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
|
||||
timer_stop(&dev->host_to_serial_timer);
|
||||
/* FIXME: do something to dev->baudrate */
|
||||
timer_on_auto(&dev->host_to_serial_timer, (1000000.0 / dev->baudrate) * (double) dev->bits);
|
||||
// serial_clear_fifo(dev->serial);
|
||||
}
|
||||
|
||||
static void
|
||||
serial_passthrough_dev_close(void *priv)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) priv;
|
||||
|
||||
/* Detach passthrough device from COM port */
|
||||
if (dev && dev->serial && dev->serial->sd)
|
||||
memset(dev->serial->sd, 0, sizeof(serial_device_t));
|
||||
|
||||
plat_serpt_close(dev);
|
||||
free(dev);
|
||||
}
|
||||
|
||||
void
|
||||
serial_passthrough_transmit_period(serial_t *serial, void *p, double transmit_period)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) p;
|
||||
|
||||
if (dev->mode != SERPT_MODE_HOSTSER)
|
||||
return;
|
||||
dev->baudrate = 1000000.0 / (transmit_period);
|
||||
|
||||
serial_passthrough_speed_changed(p);
|
||||
plat_serpt_set_params(dev);
|
||||
}
|
||||
|
||||
void
|
||||
serial_passthrough_lcr_callback(serial_t *serial, void *p, uint8_t lcr)
|
||||
{
|
||||
serial_passthrough_t *dev = (serial_passthrough_t *) p;
|
||||
|
||||
if (dev->mode != SERPT_MODE_HOSTSER)
|
||||
return;
|
||||
dev->bits = serial->bits;
|
||||
dev->data_bits = ((lcr & 0x03) + 5);
|
||||
serial_passthrough_speed_changed(p);
|
||||
plat_serpt_set_params(dev);
|
||||
}
|
||||
|
||||
/* Initialize the device for use by the user. */
|
||||
static void *
|
||||
serial_passthrough_dev_init(const device_t *info)
|
||||
{
|
||||
serial_passthrough_t *dev;
|
||||
|
||||
dev = (serial_passthrough_t *) malloc(sizeof(serial_passthrough_t));
|
||||
memset(dev, 0, sizeof(serial_passthrough_t));
|
||||
dev->mode = device_get_config_int("mode");
|
||||
|
||||
dev->port = device_get_instance() - 1;
|
||||
dev->baudrate = device_get_config_int("baudrate");
|
||||
dev->data_bits = device_get_config_int("data_bits");
|
||||
|
||||
/* Attach passthrough device to a COM port */
|
||||
dev->serial = serial_attach_ex(dev->port, serial_passthrough_rcr_cb,
|
||||
serial_passthrough_write, serial_passthrough_transmit_period, serial_passthrough_lcr_callback, dev);
|
||||
|
||||
strncpy(dev->host_serial_path, device_get_config_string("host_serial_path"), 1023);
|
||||
#ifdef _WIN32
|
||||
strncpy(dev->named_pipe, device_get_config_string("named_pipe"), 1023);
|
||||
#endif
|
||||
|
||||
serial_passthrough_log("%s: port=COM%d\n", info->name, dev->port + 1);
|
||||
serial_passthrough_log("%s: baud=%f\n", info->name, dev->baudrate);
|
||||
serial_passthrough_log("%s: mode=%s\n", info->name, serpt_mode_names[dev->mode]);
|
||||
|
||||
if (plat_serpt_open_device(dev)) {
|
||||
serial_passthrough_log("%s: not running\n", info->name);
|
||||
return NULL;
|
||||
}
|
||||
serial_passthrough_log("%s: running\n", info->name);
|
||||
|
||||
memset(&dev->host_to_serial_timer, 0, sizeof(pc_timer_t));
|
||||
timer_add(&dev->host_to_serial_timer, host_to_serial_cb, dev, 1);
|
||||
serial_set_cts(dev->serial, 1);
|
||||
serial_set_dsr(dev->serial, 1);
|
||||
serial_set_dcd(dev->serial, 1);
|
||||
|
||||
/* 1 start bit + data bits + stop bits (no parity assumed) */
|
||||
dev->bits = 1 + device_get_config_int("data_bits") + device_get_config_int("stop_bits");
|
||||
|
||||
/* Return our private data to the I/O layer. */
|
||||
return dev;
|
||||
}
|
||||
|
||||
const char *serpt_mode_names[SERPT_MODES_MAX] = {
|
||||
[SERPT_MODE_VCON] = "vcon",
|
||||
[SERPT_MODE_TCPSRV] = "tcpsrv",
|
||||
[SERPT_MODE_TCPCLNT] = "tcpclnt",
|
||||
[SERPT_MODE_HOSTSER] = "hostser",
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static const device_config_t serial_passthrough_config[] = {
|
||||
{
|
||||
.name = "mode",
|
||||
.description = "Passthrough Mode",
|
||||
.type = CONFIG_SELECTION,
|
||||
.default_string = "",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
#ifdef _WIN32
|
||||
{
|
||||
.description = "Named Pipe (Server)",
|
||||
.value = SERPT_MODE_VCON
|
||||
},
|
||||
#if 0 /* TODO */
|
||||
{
|
||||
.description = "Named Pipe (Client)",
|
||||
.value = SERPT_MODE_VCON
|
||||
},
|
||||
#endif
|
||||
#else
|
||||
{
|
||||
.description = "Pseudo Terminal/Virtual Console",
|
||||
.value = SERPT_MODE_VCON
|
||||
},
|
||||
#endif
|
||||
#if 0 /* TODO */
|
||||
{
|
||||
.description = "TCP Server",
|
||||
.value = SERPT_MODE_TCPSRV
|
||||
},
|
||||
{
|
||||
.description = "TCP Client",
|
||||
.value = SERPT_MODE_TCPCLNT
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.description = "Host Serial Passthrough",
|
||||
.value = SERPT_MODE_HOSTSER
|
||||
},
|
||||
{
|
||||
.description = ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
.name = "host_serial_path",
|
||||
.description = "Host Serial Device",
|
||||
.type = CONFIG_SERPORT,
|
||||
.default_string = "",
|
||||
.file_filter = NULL,
|
||||
.spinner = {},
|
||||
.selection = {}
|
||||
},
|
||||
#ifdef _WIN32
|
||||
{
|
||||
.name = "named_pipe",
|
||||
.description = "Name of pipe",
|
||||
.type = CONFIG_STRING,
|
||||
.default_string = "\\\\.\\pipe\\86Box\\test",
|
||||
.file_filter = NULL,
|
||||
.spinner = {},
|
||||
.selection = {}
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.name = "data_bits",
|
||||
.description = "Data bits",
|
||||
.type = CONFIG_SELECTION,
|
||||
.default_string = "8",
|
||||
.default_int = 8,
|
||||
.file_filter = NULL,
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
#if 0 /* Mentioned by WFW 3.1x, not supported, atleast on Linux */
|
||||
{ .description = "4", .value = 4 },
|
||||
#endif
|
||||
{ .description = "5", .value = 5 },
|
||||
{ .description = "6", .value = 6 },
|
||||
{ .description = "7", .value = 7 },
|
||||
{ .description = "8", .value = 8 }
|
||||
}
|
||||
},
|
||||
{
|
||||
.name = "stop_bits",
|
||||
.description = "Stop bits",
|
||||
.type = CONFIG_SELECTION,
|
||||
.default_string = "1",
|
||||
.default_int = 1,
|
||||
.file_filter = NULL,
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
{ .description = "1", .value = 1 },
|
||||
#if 0
|
||||
{ .description = "1.5", .value = 1.5 },
|
||||
#endif
|
||||
{ .description = "2", .value = 2 }
|
||||
}
|
||||
},
|
||||
{
|
||||
.name = "baudrate",
|
||||
.description = "Baud Rate of Passthrough",
|
||||
.type = CONFIG_SELECTION,
|
||||
.default_string = "",
|
||||
.default_int = 115200,
|
||||
.file_filter = NULL,
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
#if 0
|
||||
{ .description = "256000", .value = 256000 },
|
||||
{ .description = "128000", .value = 128000 },
|
||||
#endif
|
||||
{ .description = "115200", .value = 115200 },
|
||||
{ .description = "57600", .value = 57600 },
|
||||
{ .description = "56000", .value = 56000 },
|
||||
{ .description = "38400", .value = 38400 },
|
||||
{ .description = "19200", .value = 19200 },
|
||||
{ .description = "14400", .value = 14400 },
|
||||
{ .description = "9600", .value = 9600 },
|
||||
{ .description = "7200", .value = 7200 },
|
||||
{ .description = "4800", .value = 4800 },
|
||||
{ .description = "2400", .value = 2400 },
|
||||
{ .description = "1800", .value = 1800 },
|
||||
{ .description = "1200", .value = 1200 },
|
||||
{ .description = "600", .value = 600 },
|
||||
{ .description = "300", .value = 300 },
|
||||
{ .description = "150", .value = 150 },
|
||||
#if 0
|
||||
{ .description = "134.5", .value = 134.5 },
|
||||
#endif
|
||||
{ .description = "110", .value = 110 },
|
||||
{ .description = "75", .value = 75 }
|
||||
}
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
const device_t serial_passthrough_device = {
|
||||
.name = "Serial Passthrough Device",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = serial_passthrough_dev_init,
|
||||
.close = serial_passthrough_dev_close,
|
||||
.reset = NULL,
|
||||
{ .poll = NULL },
|
||||
.speed_changed = serial_passthrough_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = serial_passthrough_config
|
||||
};
|
||||
@@ -88,7 +88,7 @@ discord_update_activity(int paused)
|
||||
*(paren - 1) = '\0';
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# pragma GCC diagnostic ignored "-Wformat-truncation"
|
||||
#endif
|
||||
if (strlen(vm_name) < 100) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2020,2021 David Hrdlička.
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
#
|
||||
|
||||
add_library(hdd OBJECT hdd.c hdd_image.c hdd_table.c hdc.c hdc_st506_xt.c
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2017-2018 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
@@ -84,6 +84,7 @@ static const struct {
|
||||
{ &hdc_none_device },
|
||||
{ &hdc_internal_device },
|
||||
{ &st506_xt_xebec_device },
|
||||
{ &st506_xt_wdxt_gen_device },
|
||||
{ &st506_xt_dtc5150x_device },
|
||||
{ &st506_xt_st11_m_device },
|
||||
{ &st506_xt_wd1002a_wx1_device },
|
||||
@@ -103,6 +104,7 @@ static const struct {
|
||||
{ &xta_wdxt150_device },
|
||||
{ &xtide_acculogic_device },
|
||||
{ &xtide_device },
|
||||
{ &xtide_plus_device },
|
||||
{ &esdi_ps2_device },
|
||||
{ &ide_pci_device },
|
||||
{ &ide_pci_2ch_device },
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
|
||||
@@ -54,11 +54,11 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2017-2018 Fred N. van Kempen.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
@@ -537,7 +537,7 @@ ide_hd_identify(ide_t *ide)
|
||||
/*
|
||||
Bit 0 = The fields reported in words 54-58 are valid;
|
||||
Bit 1 = The fields reported in words 64-70 are valid;
|
||||
Bit 2 = The fields reported in word 88 are valid. */
|
||||
Bit 2 = The fields reported in word 88 are valid. */
|
||||
ide->buffer[53] = 1;
|
||||
|
||||
if (ide->cfg_spt != 0) {
|
||||
@@ -737,8 +737,9 @@ ide_set_signature(ide_t *ide)
|
||||
ide->secount = ide->sc->phase;
|
||||
ide->cylinder = ide->sc->request_length;
|
||||
} else {
|
||||
ide->secount = 1;
|
||||
ide->cylinder = ((ide->type == IDE_HDD) ? 0 : 0xFFFF);
|
||||
ide->secount = 1;
|
||||
// ide->cylinder = ((ide->type == IDE_HDD) ? 0 : 0xFFFF);
|
||||
ide->cylinder = ((ide->type == IDE_HDD) ? 0 : 0x7F7F);
|
||||
if (ide->type == IDE_HDD)
|
||||
ide->drive = 0;
|
||||
}
|
||||
@@ -1150,6 +1151,9 @@ ide_atapi_packet_write(ide_t *ide, uint32_t val, int length)
|
||||
bufferw = (uint16_t *) bufferb;
|
||||
bufferl = (uint32_t *) bufferb;
|
||||
|
||||
if (dev->packet_status == PHASE_DATA_IN)
|
||||
return;
|
||||
|
||||
switch (length) {
|
||||
case 1:
|
||||
bufferb[dev->pos] = val & 0xff;
|
||||
@@ -1888,11 +1892,7 @@ static uint8_t
|
||||
ide_status(ide_t *ide, ide_t *ide_other, int ch)
|
||||
{
|
||||
if ((ide->type == IDE_NONE) && ((ide_other->type == IDE_NONE) || !(ch & 1)))
|
||||
#ifdef STATUS_BIT_7_PULLDOWN
|
||||
return 0x7F; /* Bit 7 pulled down, all other bits pulled up, per the spec. */
|
||||
#else
|
||||
return 0xFF;
|
||||
#endif
|
||||
return 0x7f; /* Bit 7 pulled down, all other bits pulled up, per the spec. */
|
||||
else if ((ide->type == IDE_NONE) && (ch & 1))
|
||||
return 0x00; /* On real hardware, a slave with a present master always returns a status of 0x00. */
|
||||
else if (ide->type == IDE_ATAPI)
|
||||
@@ -1906,7 +1906,7 @@ ide_readb(uint16_t addr, void *priv)
|
||||
{
|
||||
ide_board_t *dev = (ide_board_t *) priv;
|
||||
|
||||
int ch;
|
||||
int ch, absent = 0;
|
||||
ide_t *ide;
|
||||
|
||||
ch = dev->cur_dev;
|
||||
@@ -1918,18 +1918,31 @@ ide_readb(uint16_t addr, void *priv)
|
||||
addr |= 0x90;
|
||||
addr &= 0xFFF7;
|
||||
|
||||
if ((ide->type == IDE_NONE) && ((ide_drives[ch ^ 1]->type == IDE_NONE) || !(ch & 1)))
|
||||
absent = 1; /* Absent and is master or both are absent. */
|
||||
else if ((ide->type == IDE_NONE) && (ch & 1))
|
||||
absent = 2; /* Absent and is slave and master is present. */
|
||||
|
||||
switch (addr & 0x7) {
|
||||
case 0x0: /* Data */
|
||||
tempw = ide_read_data(ide, 2);
|
||||
temp = tempw & 0xff;
|
||||
if (absent == 1)
|
||||
temp = 0x7f;
|
||||
else if (absent == 2)
|
||||
temp = 0x00;
|
||||
else {
|
||||
tempw = ide_read_data(ide, 2);
|
||||
temp = tempw & 0xff;
|
||||
}
|
||||
break;
|
||||
|
||||
/* For ATAPI: Bits 7-4 = sense key, bit 3 = MCR (media change requested),
|
||||
Bit 2 = ABRT (aborted command), Bit 1 = EOM (end of media),
|
||||
and Bit 0 = ILI (illegal length indication). */
|
||||
case 0x1: /* Error */
|
||||
if (ide->type == IDE_NONE)
|
||||
temp = 0;
|
||||
if (absent == 1)
|
||||
temp = 0x7f;
|
||||
else if (absent == 2)
|
||||
temp = 0x01;
|
||||
else if (ide->type == IDE_ATAPI)
|
||||
temp = ide->sc->error;
|
||||
else
|
||||
@@ -1943,27 +1956,37 @@ ide_readb(uint16_t addr, void *priv)
|
||||
Direction:
|
||||
To device if set;
|
||||
From device if clear.
|
||||
IO DRQ CoD
|
||||
0 1 1 Ready to accept command packet
|
||||
1 1 1 Message - ready to send message to host
|
||||
1 1 0 Data to host
|
||||
0 1 0 Data from host
|
||||
1 0 1 Status. */
|
||||
IO DRQ CoD
|
||||
0 1 1 Ready to accept command packet
|
||||
1 1 1 Message - ready to send message to host
|
||||
1 1 0 Data to host
|
||||
0 1 0 Data from host
|
||||
1 0 1 Status. */
|
||||
case 0x2: /* Sector count */
|
||||
if (ide->type == IDE_ATAPI)
|
||||
if (absent == 1)
|
||||
temp = 0x7f;
|
||||
else if (absent == 2)
|
||||
temp = 0x01;
|
||||
else if (ide->type == IDE_ATAPI)
|
||||
temp = ide->sc->phase;
|
||||
else if (ide->type != IDE_NONE)
|
||||
else
|
||||
temp = ide->secount;
|
||||
break;
|
||||
|
||||
case 0x3: /* Sector */
|
||||
if (ide->type != IDE_NONE)
|
||||
if (absent == 1)
|
||||
temp = 0x7f;
|
||||
else if (absent == 2)
|
||||
temp = 0x01;
|
||||
else
|
||||
temp = (uint8_t) ide->sector;
|
||||
break;
|
||||
|
||||
case 0x4: /* Cylinder low */
|
||||
if (ide->type == IDE_NONE)
|
||||
temp = 0xFF;
|
||||
if (absent == 1)
|
||||
temp = 0x7f;
|
||||
else if (absent == 2)
|
||||
temp = 0x00;
|
||||
else if (ide->type == IDE_ATAPI)
|
||||
temp = ide->sc->request_length & 0xff;
|
||||
else
|
||||
@@ -1971,8 +1994,10 @@ ide_readb(uint16_t addr, void *priv)
|
||||
break;
|
||||
|
||||
case 0x5: /* Cylinder high */
|
||||
if (ide->type == IDE_NONE)
|
||||
temp = 0xFF;
|
||||
if (absent == 1)
|
||||
temp = 0x7f;
|
||||
else if (absent == 2)
|
||||
temp = 0x00;
|
||||
else if (ide->type == IDE_ATAPI)
|
||||
temp = ide->sc->request_length >> 8;
|
||||
else
|
||||
@@ -1980,7 +2005,12 @@ ide_readb(uint16_t addr, void *priv)
|
||||
break;
|
||||
|
||||
case 0x6: /* Drive/Head */
|
||||
temp = (uint8_t) (ide->head | ((ch & 1) ? 0x10 : 0) | (ide->lba ? 0x40 : 0) | 0xa0);
|
||||
if (absent == 1)
|
||||
temp = 0x7f;
|
||||
else if (absent == 2)
|
||||
temp = 0xb0;
|
||||
else
|
||||
temp = (uint8_t) (ide->head | ((ch & 1) ? 0x10 : 0) | (ide->lba ? 0x40 : 0) | 0xa0);
|
||||
break;
|
||||
|
||||
/* For ATAPI: Bit 5 is DMA ready, but without overlapped or interlaved DMA, it is
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2019 Sarah Walker.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user