Merge remote-tracking branch 'upstream/master' into feature/mtrr

This commit is contained in:
Jasmine Iwanek
2023-06-13 04:54:17 -04:00
151 changed files with 3403 additions and 2250 deletions

View File

@@ -59,6 +59,7 @@ AppDir:
- libsixel1 # if CLI:BOOL=ON
- libslirp0 # if SLIRP_EXTERNAL:BOOL=ON
- libsndio7.0 # if OPENAL:BOOL=ON
- libvdeplug-dev # -dev also pulls in libvdeplug2. -dev is required to get the proper .so symlink to the library
- libwayland-client0 # if QT:BOOL=ON
- libx11-6 # if QT:BOOL=ON
- libx11-xcb1 # if QT:BOOL=ON
@@ -73,6 +74,7 @@ AppDir:
files:
exclude:
- etc
- lib/udev
- usr/[!ls]* # * except lib, local, share
- usr/lib/*/libasound.so.* # using our own ALSA can cause issues, and the API is pretty stable anyway
- usr/lib/*.a # produced by library compilation

View File

@@ -348,10 +348,6 @@ then
# Run build for the architecture.
args=
[ $strip -ne 0 ] && args="-t $args"
case $arch_universal in # workaround: force new dynarec on for ARM
arm*) cmake_flags_extra="-D NEW_DYNAREC=ON";;
*) cmake_flags_extra=;;
esac
zsh -lc 'exec "'"$0"'" -n -b "universal slice" "'"$arch_universal"'" '"$args""$cmake_flags"' '"$cmake_flags_extra"
status=$?
@@ -587,7 +583,7 @@ else
# ...and the ones we do want listed. Non-dev packages fill missing spots on the list.
libpkgs=""
longest_libpkg=0
for pkg in libc6-dev libstdc++6 libopenal-dev libfreetype6-dev libx11-dev libsdl2-dev libpng-dev librtmidi-dev qtdeclarative5-dev libwayland-dev libevdev-dev libxkbcommon-x11-dev libglib2.0-dev libslirp-dev libfaudio-dev libaudio-dev libjack-jackd2-dev libpipewire-0.3-dev libsamplerate0-dev libsndio-dev
for pkg in libc6-dev libstdc++6 libopenal-dev libfreetype6-dev libx11-dev libsdl2-dev libpng-dev librtmidi-dev qtdeclarative5-dev libwayland-dev libevdev-dev libxkbcommon-x11-dev libglib2.0-dev libslirp-dev libfaudio-dev libaudio-dev libjack-jackd2-dev libpipewire-0.3-dev libsamplerate0-dev libsndio-dev libvdeplug-dev
do
libpkgs="$libpkgs $pkg:$arch_deb"
length=$(echo -n $pkg | sed 's/-dev$//' | sed "s/qtdeclarative/qt/" | wc -c)
@@ -677,8 +673,8 @@ rm -rf build
case $arch in
32 | x86) cmake_flags_extra="$cmake_flags_extra -D ARCH=i386";;
64 | x86_64*) cmake_flags_extra="$cmake_flags_extra -D ARCH=x86_64";;
ARM32 | arm32) cmake_flags_extra="$cmake_flags_extra -D ARCH=arm";;
ARM64 | arm64) cmake_flags_extra="$cmake_flags_extra -D ARCH=arm64";;
ARM32 | arm32) cmake_flags_extra="$cmake_flags_extra -D ARCH=arm -D NEW_DYNAREC=ON";;
ARM64 | arm64) cmake_flags_extra="$cmake_flags_extra -D ARCH=arm64 -D NEW_DYNAREC=ON";;
*) cmake_flags_extra="$cmake_flags_extra -D \"ARCH=$arch\"";;
esac
@@ -880,13 +876,13 @@ else
if grep -q "OPENAL:BOOL=ON" build/CMakeCache.txt
then
# Build openal-soft 1.22.2 manually to fix audio issues. This is a temporary
# Build openal-soft 1.23.1 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.22.2"
prefix="$cache_dir/openal-soft-1.23.1"
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.22.2.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix"
wget -qO - https://github.com/kcat/openal-soft/archive/refs/tags/1.23.1.tar.gz | tar zxf - -C "$cache_dir" || rm -rf "$prefix"
fi
# Patches to build with the old PipeWire version in Debian.
@@ -894,7 +890,7 @@ else
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 -G Ninja -D ALSOFT_UTILS=OFF -D ALSOFT_EXAMPLES=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

View File

@@ -13,3 +13,4 @@ qt5
wget
fluidsynth
ghostscript
vde2

View File

@@ -109,6 +109,9 @@ endif()
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
if(FREETYPE_INCLUDE_DIR_ft2build)
include_directories(${FREETYPE_INCLUDE_DIR_ft2build})
endif()
if(APPLE)
# Freetype is dynamically loaded by the emulator, however, we link it
# on macOS so it gets copied to the bundle by the installation process

View File

@@ -632,7 +632,11 @@ pad_susp:
}
if ((p - data) > 255)
fatal("VISO: Directory record overflow (%d) on entry %08X\n", p - data, entry);
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
fatal("VISO: Directory record overflow (%d) on entry %016" PRIX64 "\n", (uint32_t) (uintptr_t) (p - data), (uint64_t) (uintptr_t) entry);
#else
fatal("VISO: Directory record overflow (%d) on entry %08X\n", (uint32_t) (uintptr_t) (p - data), (uint32_t) (uintptr_t) entry);
#endif
data[0] = p - data; /* length */
return data[0];

View File

@@ -1007,7 +1007,7 @@ memmap_state_update(scat_t *dev)
set_global_EMS_state(dev, dev->regs[SCAT_EMS_CONTROL] & 0x80);
flushmmucache_cr3();
flushmmucache_nopc();
}
static void

View File

@@ -21,7 +21,8 @@ typedef struct
static void
rabbit_recalcmapping(rabbit_t *dev)
{
uint32_t shread, shwrite;
uint32_t shread;
uint32_t shwrite;
uint32_t shflags = 0;
shread = !!(dev->regs[0x101] & 0x40);

View File

@@ -212,7 +212,8 @@ codeblock_tree_delete(codeblock_t *block)
return;
} else {
/*Difficult case - node has two children. Walk right child to find lowest node*/
codeblock_t *lowest = block->right, *highest;
codeblock_t *lowest = block->right;
codeblock_t *highest;
codeblock_t *old_parent;
while (lowest->left)

View File

@@ -607,51 +607,3 @@ RecompOpFn recomp_opcodes_REPNE[512] = {
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
// clang-format on
};
RecompOpFn recomp_opcodes_NULL[512] = {
// clang-format off
/*16-bit data*/
/* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/
/*00*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*10*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*20*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*30*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*40*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*50*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*60*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*70*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*80*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*90*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*a0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*b0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*c0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*d0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*e0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*32-bit data*/
/* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/
/*00*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*10*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*20*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*30*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*40*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*50*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*60*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*70*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*80*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*90*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*a0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*b0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*c0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*d0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*e0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
// clang-format on
};

View File

@@ -17,7 +17,6 @@ extern RecompOpFn recomp_opcodes_de[512];
extern RecompOpFn recomp_opcodes_df[512];
extern RecompOpFn recomp_opcodes_REPE[512];
extern RecompOpFn recomp_opcodes_REPNE[512];
extern RecompOpFn recomp_opcodes_NULL[512];
#define REG_EAX 0
#define REG_ECX 1

View File

@@ -281,7 +281,8 @@ ROP_ARITH_RM(SUB, SUB, 1)
static uint32_t
ropCMP_b_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
src_reg = LOAD_REG_B(fetchdat & 7);
@@ -307,7 +308,8 @@ ropCMP_b_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, c
static uint32_t
ropCMP_w_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
src_reg = LOAD_REG_W(fetchdat & 7);
@@ -333,7 +335,8 @@ ropCMP_w_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, c
static uint32_t
ropCMP_l_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
src_reg = LOAD_REG_L(fetchdat & 7);
@@ -360,7 +363,8 @@ ropCMP_l_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, c
static uint32_t
ropCMP_b_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
dst_reg = LOAD_REG_B(fetchdat & 7);
@@ -386,7 +390,8 @@ ropCMP_b_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc,
static uint32_t
ropCMP_w_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
dst_reg = LOAD_REG_W(fetchdat & 7);
@@ -412,7 +417,8 @@ ropCMP_w_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc,
static uint32_t
ropCMP_l_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
dst_reg = LOAD_REG_L(fetchdat & 7);

View File

@@ -156,7 +156,8 @@ static uint32_t
ropFSTd(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
x86seg *target_seg;
int host_reg1, host_reg2 = 0;
int host_reg1;
int host_reg2 = 0;
FP_ENTER();
op_pc--;
@@ -593,7 +594,8 @@ static uint32_t
ropFISTPq(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
x86seg *target_seg;
int host_reg1, host_reg2;
int host_reg1;
int host_reg2;
FP_ENTER();
op_pc--;
@@ -679,7 +681,7 @@ opFLDimm(Z, 0.0)
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);
FP_LOAD_IMM_Q(0x3fe62e42fefa39f0ULL);
return op_pc;
}

View File

@@ -175,7 +175,8 @@ ROP_LOGIC(XOR, XOR, 1)
static uint32_t
ropTEST_b_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
src_reg = LOAD_REG_B(fetchdat & 7);
@@ -198,7 +199,8 @@ ropTEST_b_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc,
static uint32_t
ropTEST_w_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
src_reg = LOAD_REG_W(fetchdat & 7);
@@ -221,7 +223,8 @@ ropTEST_w_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc,
static uint32_t
ropTEST_l_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg;
int src_reg;
int dst_reg;
if ((fetchdat & 0xc0) == 0xc0) {
src_reg = LOAD_REG_L(fetchdat & 7);

View File

@@ -1,7 +1,8 @@
static uint32_t
ropMOVQ_q_mm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int host_reg1, host_reg2 = 0;
int host_reg1;
int host_reg2 = 0;
MMX_ENTER();
@@ -29,7 +30,8 @@ ropMOVQ_mm_q(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc,
MMX_ENTER();
if ((fetchdat & 0xc0) == 0xc0) {
int host_reg1, host_reg2;
int host_reg1;
int host_reg2;
LOAD_MMX_Q(fetchdat & 7, &host_reg1, &host_reg2);
STORE_MMX_Q((fetchdat >> 3) & 7, host_reg1, host_reg2);

View File

@@ -536,7 +536,8 @@ FETCH_EA_16(x86seg *op_ea_seg, uint32_t fetchdat, int op_ssegs, uint32_t *op_pc)
addlong((fetchdat >> 8) & 0xffff);
(*op_pc) += 2;
} else {
int base_reg = 0, index_reg = 0;
int base_reg = 0;
int index_reg = 0;
switch (rm) {
case 0:
@@ -639,8 +640,9 @@ FETCH_EA_32(x86seg *op_ea_seg, uint32_t fetchdat, int op_ssegs, uint32_t *op_pc,
uint32_t new_eaaddr;
if (rm == 4) {
uint8_t sib = fetchdat >> 8;
int base_reg = -1, index_reg = -1;
uint8_t sib = fetchdat >> 8;
int base_reg = -1;
int index_reg = -1;
(*op_pc)++;

View File

@@ -45,7 +45,9 @@ OP_XCHG_EAX_(EBP)
static uint32_t
ropXCHG_b(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg, temp_reg;
int src_reg;
int dst_reg;
int temp_reg;
if ((fetchdat & 0xc0) != 0xc0)
return 0;
@@ -61,7 +63,9 @@ ropXCHG_b(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, cod
static uint32_t
ropXCHG_w(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg, temp_reg;
int src_reg;
int dst_reg;
int temp_reg;
if ((fetchdat & 0xc0) != 0xc0)
return 0;
@@ -77,7 +81,9 @@ ropXCHG_w(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, cod
static uint32_t
ropXCHG_l(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
{
int src_reg, dst_reg, temp_reg;
int src_reg;
int dst_reg;
int temp_reg;
if ((fetchdat & 0xc0) != 0xc0)
return 0;

View File

@@ -883,7 +883,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
case 0xd8:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_d8_a32 : x86_dynarec_opcodes_d8_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_d8;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_d8;
opcode_shift = 3;
opcode_mask = 0x1f;
over = 1;
@@ -893,7 +893,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xd9:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_d9_a32 : x86_dynarec_opcodes_d9_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_d9;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_d9;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -902,7 +902,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xda:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_da_a32 : x86_dynarec_opcodes_da_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_da;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_da;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -911,7 +911,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xdb:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_db_a32 : x86_dynarec_opcodes_db_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_db;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_db;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -920,7 +920,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xdc:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_dc_a32 : x86_dynarec_opcodes_dc_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_dc;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_dc;
opcode_shift = 3;
opcode_mask = 0x1f;
over = 1;
@@ -930,7 +930,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xdd:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_dd_a32 : x86_dynarec_opcodes_dd_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_dd;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_dd;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -939,7 +939,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xde:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_de_a32 : x86_dynarec_opcodes_de_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_de;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_de;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -948,7 +948,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xdf:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_df_a32 : x86_dynarec_opcodes_df_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_df;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_df;
opcode_mask = 0xff;
over = 1;
pc_off = -1;

View File

@@ -69,7 +69,8 @@
# include <windows.h>
# endif
int codegen_flat_ds, codegen_flat_ss;
int codegen_flat_ds;
int codegen_flat_ss;
int mmx_ebx_ecx_loaded;
int codegen_flags_changed = 0;
int codegen_fpu_entered = 0;
@@ -1921,7 +1922,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
case 0xd8:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_d8_a32 : x86_dynarec_opcodes_d8_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_d8;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_d8;
opcode_shift = 3;
opcode_mask = 0x1f;
over = 1;
@@ -1931,7 +1932,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xd9:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_d9_a32 : x86_dynarec_opcodes_d9_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_d9;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_d9;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -1940,7 +1941,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xda:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_da_a32 : x86_dynarec_opcodes_da_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_da;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_da;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -1949,7 +1950,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xdb:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_db_a32 : x86_dynarec_opcodes_db_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_db;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_db;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -1958,7 +1959,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xdc:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_dc_a32 : x86_dynarec_opcodes_dc_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_dc;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_dc;
opcode_shift = 3;
opcode_mask = 0x1f;
over = 1;
@@ -1968,7 +1969,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xdd:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_dd_a32 : x86_dynarec_opcodes_dd_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_dd;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_dd;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -1977,7 +1978,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xde:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_de_a32 : x86_dynarec_opcodes_de_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_de;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_de;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -1986,7 +1987,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
break;
case 0xdf:
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_df_a32 : x86_dynarec_opcodes_df_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_df;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_df;
opcode_mask = 0xff;
over = 1;
pc_off = -1;

View File

@@ -31,9 +31,7 @@ static struct
int
codegen_get_instruction_uop(codeblock_t *block, uint32_t pc, int *first_instruction, int *TOP)
{
int c;
for (c = 0; c <= block->ins; c++) {
for (uint8_t c = 0; c <= block->ins; c++) {
if (codegen_instructions[c].pc == pc) {
*first_instruction = c;
*TOP = codegen_instructions[c].TOP;
@@ -137,7 +135,9 @@ codegen_generate_ea_16_long(ir_data_t *ir, x86seg *op_ea_seg, uint32_t fetchdat,
uop_MOV_IMM(ir, IREG_eaaddr, addr);
(*op_pc) += 2;
} else {
int base_reg, index_reg, offset;
int base_reg;
int index_reg;
int offset;
switch (cpu_rm & 7) {
case 0:
@@ -374,7 +374,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
codeblock_t *block = &codeblock[block_current];
ir_data_t *ir = codegen_get_ir_data();
uint32_t op_pc = new_pc;
OpFn *op_table = (OpFn *) x86_dynarec_opcodes;
const OpFn *op_table = (OpFn *) x86_dynarec_opcodes;
RecompOpFn *recomp_op_table = recomp_opcodes;
int opcode_shift = 0;
int opcode_mask = 0x3ff;
@@ -398,7 +398,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
#ifdef DEBUG_EXTRA
last_prefix = 0x0f;
#endif
op_table = (OpFn *) x86_dynarec_opcodes_0f;
op_table = x86_dynarec_opcodes_0f;
recomp_op_table = recomp_opcodes_0f;
over = 1;
break;
@@ -440,7 +440,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
last_prefix = 0xd8;
#endif
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_d8_a32 : x86_dynarec_opcodes_d8_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_d8;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_d8;
opcode_shift = 3;
opcode_mask = 0x1f;
over = 1;
@@ -453,7 +453,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
last_prefix = 0xd9;
#endif
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_d9_a32 : x86_dynarec_opcodes_d9_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_d9;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_d9;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -465,7 +465,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
last_prefix = 0xda;
#endif
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_da_a32 : x86_dynarec_opcodes_da_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_da;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_da;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -477,7 +477,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
last_prefix = 0xdb;
#endif
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_db_a32 : x86_dynarec_opcodes_db_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_db;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_db;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -489,7 +489,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
last_prefix = 0xdc;
#endif
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_dc_a32 : x86_dynarec_opcodes_dc_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_dc;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_dc;
opcode_shift = 3;
opcode_mask = 0x1f;
over = 1;
@@ -502,7 +502,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
last_prefix = 0xdd;
#endif
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_dd_a32 : x86_dynarec_opcodes_dd_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_dd;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_dd;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -514,7 +514,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
last_prefix = 0xde;
#endif
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_de_a32 : x86_dynarec_opcodes_de_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_de;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_de;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -526,7 +526,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
last_prefix = 0xdf;
#endif
op_table = (op_32 & 0x200) ? x86_dynarec_opcodes_df_a32 : x86_dynarec_opcodes_df_a16;
recomp_op_table = fpu_softfloat ? recomp_opcodes_NULL : recomp_opcodes_df;
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_df;
opcode_mask = 0xff;
over = 1;
pc_off = -1;
@@ -541,14 +541,14 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
#ifdef DEBUG_EXTRA
last_prefix = 0xf2;
#endif
op_table = (OpFn *) x86_dynarec_opcodes_REPNE;
op_table = x86_dynarec_opcodes_REPNE;
recomp_op_table = NULL; // recomp_opcodes_REPNE;
break;
case 0xf3: /*REPE*/
#ifdef DEBUG_EXTRA
last_prefix = 0xf3;
#endif
op_table = (OpFn *) x86_dynarec_opcodes_REPE;
op_table = x86_dynarec_opcodes_REPE;
recomp_op_table = NULL; // recomp_opcodes_REPE;
break;
@@ -713,6 +713,7 @@ generate_call:
uop_MOV_IMM(ir, IREG_ssegs, op_ssegs);
uop_LOAD_FUNC_ARG_IMM(ir, 0, fetchdat);
uop_CALL_INSTRUCTION_FUNC(ir, op);
codegen_flags_changed = 0;
codegen_mark_code_present(block, cs + cpu_state.pc, 8);
last_op_32 = op_32;

View File

@@ -212,7 +212,8 @@ codeblock_tree_delete(codeblock_t *block)
return;
} else {
/*Difficult case - node has two children. Walk right child to find lowest node*/
codeblock_t *lowest = &codeblock[block->right], *highest;
codeblock_t *lowest = &codeblock[block->right];
codeblock_t *highest;
codeblock_t *old_parent;
uint16_t lowest_nr;

View File

@@ -32,8 +32,6 @@ int codegen_allocator_usage = 0;
void
codegen_allocator_init(void)
{
int c;
#if defined WIN32 || defined _WIN32 || defined _WIN32
mem_block_alloc = VirtualAlloc(NULL, MEM_BLOCK_NR * MEM_BLOCK_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
/* TODO: check deployment target: older Intel-based versions of macOS don't play
@@ -44,7 +42,7 @@ codegen_allocator_init(void)
mem_block_alloc = mmap(0, MEM_BLOCK_NR * MEM_BLOCK_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
#endif
for (c = 0; c < MEM_BLOCK_NR; c++) {
for (uint32_t c = 0; c < MEM_BLOCK_NR; c++) {
mem_blocks[c].offset = c * MEM_BLOCK_SIZE;
mem_blocks[c].code_block = BLOCK_INVALID;
if (c < MEM_BLOCK_NR - 1)

View File

@@ -1313,7 +1313,8 @@ static uint32_t imm_table[][2] = {
uint32_t
host_arm64_find_imm(uint32_t data)
{
int l = 0, r = IMM_NR - 1;
int l = 0;
int r = IMM_NR - 1;
while (l <= r) {
int m = (l + r) >> 1;

View File

@@ -263,7 +263,6 @@ void
codegen_backend_init(void)
{
codeblock_t *block;
int c;
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
codeblock_hash = malloc(HASH_SIZE * sizeof(codeblock_t *));
@@ -271,7 +270,7 @@ codegen_backend_init(void)
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
for (c = 0; c < BLOCK_SIZE; c++)
for (uint32_t c = 0; c < BLOCK_SIZE; c++)
codeblock[c].pc = BLOCK_PC_INVALID;
block_current = 0;

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,8 @@
uint8_t *block_write_data = NULL;
int codegen_flat_ds, codegen_flat_ss;
int codegen_flat_ds;
int codegen_flat_ss;
int mmx_ebx_ecx_loaded;
int codegen_flags_changed = 0;
int codegen_fpu_entered = 0;
@@ -61,7 +62,8 @@ static void delete_dirty_block(codeblock_t *block);
The size of this list is limited to DIRTY_LIST_MAX_SIZE blocks. When this is
exceeded the oldest entry will be moved to the free list.*/
static uint16_t block_dirty_list_head, block_dirty_list_tail;
static uint16_t block_dirty_list_head;
static uint16_t block_dirty_list_tail;
static int dirty_list_size = 0;
#define DIRTY_LIST_MAX_SIZE 64
@@ -210,13 +212,11 @@ block_free_list_get(void)
void
codegen_init(void)
{
int c;
codegen_allocator_init();
codegen_backend_init();
block_free_list = 0;
for (c = 0; c < BLOCK_SIZE; c++)
for (uint32_t c = 0; c < BLOCK_SIZE; c++)
block_free_list_add(&codeblock[c]);
block_dirty_list_head = block_dirty_list_tail = 0;
dirty_list_size = 0;
@@ -472,7 +472,6 @@ codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
{
uint16_t block_nr = page->block;
int remove_from_evict_list = 0;
int c;
while (block_nr) {
codeblock_t *block = &codeblock[block_nr];
@@ -509,7 +508,7 @@ codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
page->code_present_mask &= ~page->dirty_mask;
page->dirty_mask = 0;
for (c = 0; c < 64; c++) {
for (uint8_t c = 0; c < 64; c++) {
if (page->byte_code_present_mask[c] & page->byte_dirty_mask[c])
remove_from_evict_list = 0;
page->byte_code_present_mask[c] &= ~page->byte_dirty_mask[c];

View File

@@ -12,7 +12,8 @@
extern int has_ea;
static ir_data_t ir_block;
static int codegen_unroll_start, codegen_unroll_count;
static int codegen_unroll_start;
static int codegen_unroll_count;
static int codegen_unroll_first_instruction;
ir_data_t *
@@ -64,13 +65,12 @@ codegen_ir_compile(ir_data_t *ir, codeblock_t *block)
int c;
if (codegen_unroll_count) {
int unroll_count;
int unroll_end;
codegen_set_loop_start(ir, codegen_unroll_first_instruction);
unroll_end = ir->wr_pos;
for (unroll_count = 1; unroll_count < codegen_unroll_count; unroll_count++) {
for (int unroll_count = 1; unroll_count < codegen_unroll_count; unroll_count++) {
int offset = ir->wr_pos - codegen_unroll_start;
// pclog("Unroll from %i to %i, offset %i - iteration %i\n", codegen_unroll_start, ir->wr_pos, offset, unroll_count);
for (c = codegen_unroll_start; c < unroll_end; c++) {

View File

@@ -557,51 +557,3 @@ RecompOpFn recomp_opcodes_df[512] = {
// clang-format on
};
RecompOpFn recomp_opcodes_NULL[512] = {
// clang-format off
/*16-bit data*/
/* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/
/*00*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*10*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*20*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*30*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*40*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*50*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*60*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*70*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*80*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*90*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*a0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*b0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*c0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*d0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*e0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*32-bit data*/
/* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/
/*00*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*10*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*20*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*30*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*40*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*50*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*60*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*70*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*80*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*90*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*a0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*b0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*c0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*d0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*e0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
// clang-format on
};

View File

@@ -20,7 +20,6 @@ extern RecompOpFn recomp_opcodes_de[512];
extern RecompOpFn recomp_opcodes_df[512];
/*extern RecompOpFn recomp_opcodes_REPE[512];
extern RecompOpFn recomp_opcodes_REPNE[512];*/
extern RecompOpFn recomp_opcodes_NULL[512];
#define REG_EAX 0
#define REG_ECX 1

View File

@@ -264,7 +264,8 @@ ropJNE_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t ne
static int
ropJBE_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t next_pc)
{
int jump_uop, jump_uop2 = -1;
int jump_uop;
int jump_uop2 = -1;
int do_unroll = ((CF_SET() || ZF_SET()) && codegen_can_unroll(block, ir, next_pc, dest_addr));
switch (codegen_flags_changed ? cpu_state.flags_op : FLAGS_UNKNOWN) {
@@ -331,7 +332,8 @@ ropJBE_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t ne
static int
ropJNBE_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t next_pc)
{
int jump_uop, jump_uop2 = -1;
int jump_uop;
int jump_uop2 = -1;
int do_unroll = ((!CF_SET() && !ZF_SET()) && codegen_can_unroll(block, ir, next_pc, dest_addr));
switch (codegen_flags_changed ? cpu_state.flags_op : FLAGS_UNKNOWN) {
@@ -686,7 +688,8 @@ ropJNL_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t ne
static int
ropJLE_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t next_pc)
{
int jump_uop, jump_uop2 = -1;
int jump_uop;
int jump_uop2 = -1;
int do_unroll = (((NF_SET() ? 1 : 0) != (VF_SET() ? 1 : 0) || ZF_SET()) && codegen_can_unroll(block, ir, next_pc, dest_addr));
switch (codegen_flags_changed ? cpu_state.flags_op : FLAGS_UNKNOWN) {
@@ -748,7 +751,8 @@ ropJLE_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t ne
static int
ropJNLE_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t next_pc)
{
int jump_uop, jump_uop2 = -1;
int jump_uop;
int jump_uop2 = -1;
int do_unroll = ((NF_SET() ? 1 : 0) == (VF_SET() ? 1 : 0) && !ZF_SET() && codegen_can_unroll(block, ir, next_pc, dest_addr));
switch (codegen_flags_changed ? cpu_state.flags_op : FLAGS_UNKNOWN) {
@@ -928,7 +932,8 @@ ropLOOPE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
{
uint32_t offset = (int32_t) (int8_t) fastreadb(cs + op_pc);
uint32_t dest_addr = op_pc + 1 + offset;
int jump_uop, jump_uop2;
int jump_uop;
int jump_uop2;
if (!(op_32 & 0x100))
dest_addr &= 0xffff;
@@ -960,7 +965,8 @@ ropLOOPNE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
{
uint32_t offset = (int32_t) (int8_t) fastreadb(cs + op_pc);
uint32_t dest_addr = op_pc + 1 + offset;
int jump_uop, jump_uop2;
int jump_uop;
int jump_uop2;
if (!(op_32 & 0x100))
dest_addr &= 0xffff;

View File

@@ -269,7 +269,8 @@ uint32_t
ropFF_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
{
x86seg *target_seg = NULL;
int src_reg, sp_reg;
int src_reg;
int sp_reg;
if ((fetchdat & 0x38) != 0x00 && (fetchdat & 0x38) != 0x08 && (fetchdat & 0x38) != 0x10 && (fetchdat & 0x38) != 0x20 && (fetchdat & 0x38) != 0x28 && (fetchdat & 0x38) != 0x30)
return 0;
@@ -367,7 +368,8 @@ uint32_t
ropFF_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
{
x86seg *target_seg = NULL;
int src_reg, sp_reg;
int src_reg;
int sp_reg;
if ((fetchdat & 0x38) != 0x00 && (fetchdat & 0x38) != 0x08 && (fetchdat & 0x38) != 0x10 && (fetchdat & 0x38) != 0x20 && (fetchdat & 0x38) != 0x28 && (fetchdat & 0x38) != 0x30)
return 0;

View File

@@ -30,7 +30,8 @@ typedef struct host_reg_set_t {
int nr_regs;
} host_reg_set_t;
static host_reg_set_t host_reg_set, host_fp_reg_set;
static host_reg_set_t host_reg_set;
static host_reg_set_t host_fp_reg_set;
enum {
REG_BYTE,
@@ -182,9 +183,7 @@ struct
void
codegen_reg_mark_as_required(void)
{
int reg;
for (reg = 0; reg < IREG_COUNT; reg++) {
for (uint8_t reg = 0; reg < IREG_COUNT; reg++) {
int last_version = reg_last_version[reg];
if (last_version > 0 && ireg_data[reg].is_volatile == REG_PERMANENT)
@@ -533,9 +532,8 @@ alloc_reg(ir_reg_t ir_reg)
{
host_reg_set_t *reg_set = get_reg_set(ir_reg);
int nr_regs = (reg_set == &host_reg_set) ? CODEGEN_HOST_REGS : CODEGEN_HOST_FP_REGS;
int c;
for (c = 0; c < nr_regs; c++) {
for (int c = 0; c < nr_regs; c++) {
if (IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(ir_reg.reg)) {
#ifndef RELEASE_BUILD
if (reg_set->regs[c].version != ir_reg.version)
@@ -552,9 +550,8 @@ alloc_dest_reg(ir_reg_t ir_reg, int dest_reference)
{
host_reg_set_t *reg_set = get_reg_set(ir_reg);
int nr_regs = (reg_set == &host_reg_set) ? CODEGEN_HOST_REGS : CODEGEN_HOST_FP_REGS;
int c;
for (c = 0; c < nr_regs; c++) {
for (int c = 0; c < nr_regs; c++) {
if (IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(ir_reg.reg)) {
if (reg_set->regs[c].version == ir_reg.version) {
reg_set->locked |= (1 << c);
@@ -737,10 +734,9 @@ int
codegen_reg_is_loaded(ir_reg_t ir_reg)
{
host_reg_set_t *reg_set = get_reg_set(ir_reg);
int c;
/*Search for previous version in host register*/
for (c = 0; c < reg_set->nr_regs; c++) {
for (int c = 0; c < reg_set->nr_regs; c++) {
if (!ir_reg_is_invalid(reg_set->regs[c]) && IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(ir_reg.reg)) {
if (reg_set->regs[c].version <= ir_reg.version - 1) {
# ifndef RELEASE_BUILD

View File

@@ -46,6 +46,42 @@ uint32_t backupregs[16];
x86seg _oldds;
#if 1
int opcode_length[256] = { 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 3, /* 0x0x */
3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, /* 0x1x */
3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, /* 0x2x */
3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, /* 0x3x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x4x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x5x */
1, 1, 3, 3, 1, 1, 1, 1, 3, 3, 2, 3, 1, 1, 1, 1, /* 0x6x */
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x7x */
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x8x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, /* 0x9x */
3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, /* 0xax */
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xbx */
3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, 1, 1, 2, 1, 1, /* 0xcx */
3, 3, 3, 3, 2, 2, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xdx */
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 1, 1, 1, 1, /* 0xex */
1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 3, 3 }; /* 0xfx */
#else
int opcode_length[256] = { 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 3, /* 0x0x */
3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, /* 0x1x */
3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 1, /* 0x2x */
3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 1, /* 0x3x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x4x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x5x */
1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 1, 1, 1, 1, /* 0x6x */
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x7x */
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x8x */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, /* 0x9x */
3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, /* 0xax */
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xbx */
3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, 1, 1, 2, 1, 1, /* 0xcx */
3, 3, 3, 3, 2, 2, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xdx */
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 1, 1, 1, 1, /* 0xex */
3, 1, 3, 3, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 3, 3 }; /* 0xfx */
#endif
#ifdef ENABLE_386_LOG
int x386_do_log = ENABLE_386_LOG;
@@ -143,7 +179,7 @@ exec386(int cycs)
cpu_state.ea_seg = &cpu_state.seg_ds;
cpu_state.ssegs = 0;
fetchdat = fastreadl(cs + cpu_state.pc);
fetchdat = fastreadl_fetch(cs + cpu_state.pc);
if (!cpu_state.abrt) {
#ifdef ENABLE_386_LOG

View File

@@ -1683,7 +1683,7 @@ sysexit(uint32_t fetchdat)
cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS /* | CPU_STATUS_V86*/);
cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE);
flushmmucache_cr3();
flushmmucache_nopc();
set_use32(1);
set_stack32(1);
@@ -1804,7 +1804,7 @@ sysret(uint32_t fetchdat)
cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS /* | CPU_STATUS_V86*/);
cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE);
flushmmucache_cr3();
flushmmucache_nopc();
set_use32(1);
set_stack32(1);

View File

@@ -257,6 +257,51 @@ get_ram_ptr(uint32_t a)
}
}
extern int opcode_length[256];
static __inline uint16_t
fastreadw_fetch(uint32_t a)
{
uint8_t *t;
uint16_t val;
if ((a & 0xFFF) > 0xFFE) {
val = fastreadb(a);
if (opcode_length[val & 0xff] > 1)
val |= (fastreadb(a + 1) << 8);
return val;
}
if ((a >> 12) == pccache)
return *((uint16_t *) &pccache2[a]);
t = getpccache(a);
if (cpu_state.abrt)
return 0;
pccache = a >> 12;
pccache2 = t;
return *((uint16_t *) &pccache2[a]);
}
static __inline uint32_t
fastreadl_fetch(uint32_t a)
{
uint8_t *t;
uint32_t val;
if ((a & 0xFFF) < 0xFFD) {
if ((a >> 12) != pccache) {
t = getpccache(a);
if (cpu_state.abrt)
return 0;
pccache2 = t;
pccache = a >> 12;
}
return *((uint32_t *) &pccache2[a]);
}
val = fastreadw_fetch(a);
if (opcode_length[val & 0xff] > 2)
val |= (fastreadw(a + 2) << 16);
return val;
}
static __inline uint8_t
getbyte(void)
{

View File

@@ -348,7 +348,7 @@ exec386_dynarec_int(void)
cpu_state.ea_seg = &cpu_state.seg_ds;
cpu_state.ssegs = 0;
fetchdat = fastreadl(cs + cpu_state.pc);
fetchdat = fastreadl_fetch(cs + cpu_state.pc);
# ifdef ENABLE_386_DYNAREC_LOG
if (in_smm)
x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat);
@@ -572,7 +572,7 @@ exec386_dynarec_dyn(void)
cpu_state.ea_seg = &cpu_state.seg_ds;
cpu_state.ssegs = 0;
fetchdat = fastreadl(cs + cpu_state.pc);
fetchdat = fastreadl_fetch(cs + cpu_state.pc);
# ifdef ENABLE_386_DYNAREC_LOG
if (in_smm)
x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat);
@@ -668,7 +668,7 @@ exec386_dynarec_dyn(void)
cpu_state.ssegs = 0;
codegen_endpc = (cs + cpu_state.pc) + 8;
fetchdat = fastreadl(cs + cpu_state.pc);
fetchdat = fastreadl_fetch(cs + cpu_state.pc);
# ifdef ENABLE_386_DYNAREC_LOG
if (in_smm)

View File

@@ -1526,7 +1526,7 @@ cpu_set(void)
break;
default:
fatal("cpu_set : unknown CPU type %i\n", cpu_s->cpu_type);
fatal("cpu_set : unknown CPU type %llu\n", cpu_s->cpu_type);
}
switch (fpu_type) {

View File

@@ -548,7 +548,8 @@ BX_CPP_INLINE floatx80 packFloatx80(int zSign, Bit32s zExp, Bit64u zSig)
BX_CPP_INLINE int floatx80_is_nan(floatx80 a)
{
return ((a.exp & 0x7FFF) == 0x7FFF) && (Bit64s) (a.fraction<<1);
// return ((a.exp & 0x7FFF) == 0x7FFF) && (Bit64s) (a.fraction<<1);
return ((a.exp & 0x7FFF) == 0x7FFF) && (((Bit64s) (a.fraction<<1)) != 0);
}
/*----------------------------------------------------------------------------

View File

@@ -536,7 +536,7 @@ flags_rebuild_c(void)
static __inline int
flags_res_valid(void)
{
if (cpu_state.flags_op == FLAGS_UNKNOWN || (cpu_state.flags_op >= FLAGS_ROL8 && cpu_state.flags_op <= FLAGS_ROR32))
if ((cpu_state.flags_op == FLAGS_UNKNOWN) || ((cpu_state.flags_op >= FLAGS_ROL8) && (cpu_state.flags_op <= FLAGS_ROR32)))
return 0;
return 1;

View File

@@ -998,7 +998,7 @@ opLOADALL386(uint32_t fetchdat)
loadall_load_segment(la_addr + 0xc0, &cpu_state.seg_es);
if (CPL == 3 && oldcpl != 3)
flushmmucache_cr3();
flushmmucache_nopc();
oldcpl = CPL;
CLOCK_CYCLES(350);

View File

@@ -251,12 +251,12 @@ opMOV_DRx_r_a32(uint32_t fetchdat)
static void
opMOV_r_TRx(void)
{
uint32_t base;
// uint32_t base;
base = _tr[4] & 0xfffff800;
// base = _tr[4] & 0xfffff800;
switch (cpu_reg) {
case 3:
pclog("[R] %08X cache = %08X\n", base + cache_index, _tr[3]);
// pclog("[R] %08X cache = %08X\n", base + cache_index, _tr[3]);
_tr[3] = *(uint32_t *) &(_cache[cache_index]);
cache_index = (cache_index + 4) & 0xf;
break;
@@ -300,35 +300,35 @@ opMOV_TRx_r(void)
ctl = _tr[5] & 3;
switch (cpu_reg) {
case 3:
pclog("[W] %08X cache = %08X\n", base + cache_index, _tr[3]);
// pclog("[W] %08X cache = %08X\n", base + cache_index, _tr[3]);
*(uint32_t *) &(_cache[cache_index]) = _tr[3];
cache_index = (cache_index + 4) & 0xf;
break;
case 4:
if (!(cr0 & 1) && !(_tr[5] & (1 << 19)))
pclog("TAG = %08X, DEST = %08X\n", base, base + cache_index - 16);
// if (!(cr0 & 1) && !(_tr[5] & (1 << 19)))
// pclog("TAG = %08X, DEST = %08X\n", base, base + cache_index - 16);
break;
case 5:
pclog("[16] EXT = %i (%i), SET = %04X\n", !!(_tr[5] & (1 << 19)), _tr[5] & 0x03, _tr[5] & 0x7f0);
// pclog("[16] EXT = %i (%i), SET = %04X\n", !!(_tr[5] & (1 << 19)), _tr[5] & 0x03, _tr[5] & 0x7f0);
if (!(_tr[5] & (1 << 19))) {
switch (ctl) {
case 0:
pclog(" Cache fill or read...\n", base);
// pclog(" Cache fill or read...\n", base);
break;
case 1:
base += (_tr[5] & 0x7f0);
pclog(" Writing 16 bytes to %08X...\n", base);
// pclog(" Writing 16 bytes to %08X...\n", base);
for (i = 0; i < 16; i += 4)
mem_writel_phys(base + i, *(uint32_t *) &(_cache[i]));
break;
case 2:
base += (_tr[5] & 0x7f0);
pclog(" Reading 16 bytes from %08X...\n", base);
// pclog(" Reading 16 bytes from %08X...\n", base);
for (i = 0; i < 16; i += 4)
*(uint32_t *) &(_cache[i]) = mem_readl_phys(base + i);
break;
case 3:
pclog(" Cache invalidate/flush...\n", base);
// pclog(" Cache invalidate/flush...\n", base);
break;
}
}

View File

@@ -461,7 +461,7 @@ op0F01_common(uint32_t fetchdat, int is32, int is286, int ea32)
break;
}
SEG_CHECK_READ(cpu_state.ea_seg);
mmu_invalidate(ds + cpu_state.eaaddr);
flushmmucache_nopc();
CLOCK_CYCLES(12);
PREFETCH_RUN(12, 2, rmdat, 0, 0, 0, 0, ea32);
break;

View File

@@ -580,7 +580,7 @@ loadcs(uint16_t seg)
do_seg_load(&cpu_state.seg_cs, segdat);
use32 = (segdat[3] & 0x40) ? 0x300 : 0;
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -609,7 +609,7 @@ loadcs(uint16_t seg)
cpu_state.seg_cs.access = (cpu_state.eflags & VM_FLAG) ? 0xe2 : 0x82;
cpu_state.seg_cs.ar_high = 0x10;
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -673,7 +673,7 @@ loadcsjmp(uint16_t seg, uint32_t old_pc)
do_seg_load(&cpu_state.seg_cs, segdat);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -751,7 +751,7 @@ loadcsjmp(uint16_t seg, uint32_t old_pc)
CS = seg2;
do_seg_load(&cpu_state.seg_cs, segdat);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -794,7 +794,7 @@ loadcsjmp(uint16_t seg, uint32_t old_pc)
cpu_state.seg_cs.access = (cpu_state.eflags & VM_FLAG) ? 0xe2 : 0x82;
cpu_state.seg_cs.ar_high = 0x10;
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -957,7 +957,7 @@ loadcscall(uint16_t seg)
CS = seg;
do_seg_load(&cpu_state.seg_cs, segdat);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -1100,7 +1100,7 @@ loadcscall(uint16_t seg)
CS = seg2;
do_seg_load(&cpu_state.seg_cs, segdat);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -1182,7 +1182,7 @@ loadcscall(uint16_t seg)
CS = seg2;
do_seg_load(&cpu_state.seg_cs, segdat);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -1227,7 +1227,7 @@ loadcscall(uint16_t seg)
cpu_state.seg_cs.access = (cpu_state.eflags & VM_FLAG) ? 0xe2 : 0x82;
cpu_state.seg_cs.ar_high = 0x10;
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -1332,7 +1332,7 @@ pmoderetf(int is32, uint16_t off)
do_seg_load(&cpu_state.seg_cs, segdat);
cpu_state.seg_cs.access = (cpu_state.seg_cs.access & ~(3 << 5)) | ((CS & 3) << 5);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -1445,7 +1445,7 @@ pmoderetf(int is32, uint16_t off)
CS = seg;
do_seg_load(&cpu_state.seg_cs, segdat);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -1697,7 +1697,7 @@ pmodeint(int num, int soft)
CS = (seg & 0xfffc) | new_cpl;
cpu_state.seg_cs.access = (cpu_state.seg_cs.access & ~0x60) | (new_cpl << 5);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -1863,7 +1863,7 @@ pmodeiret(int is32)
cpu_state.seg_cs.access = 0xe2;
cpu_state.seg_cs.ar_high = 0x10;
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -1948,7 +1948,7 @@ pmodeiret(int is32)
do_seg_load(&cpu_state.seg_cs, segdat);
cpu_state.seg_cs.access = (cpu_state.seg_cs.access & ~0x60) | ((CS & 0x0003) << 5);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -2037,7 +2037,7 @@ pmodeiret(int is32)
do_seg_load(&cpu_state.seg_cs, segdat);
cpu_state.seg_cs.access = (cpu_state.seg_cs.access & ~0x60) | ((CS & 3) << 5);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -2233,7 +2233,7 @@ taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
CS = new_cs;
do_seg_load(&cpu_state.seg_cs, segdat2);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif
@@ -2401,7 +2401,7 @@ taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
CS = new_cs;
do_seg_load(&cpu_state.seg_cs, segdat2);
if ((CPL == 3) && (oldcpl != 3))
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef USE_NEW_DYNAREC
oldcpl = CPL;
#endif

View File

@@ -134,6 +134,8 @@ typedef struct {
serial_t *serial;
} mouse_wacom_t;
/* TODO: What is this needed for? */
#if 0
static unsigned int
reverse(register unsigned int x)
{
@@ -143,6 +145,7 @@ reverse(register unsigned int x)
x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
return ((x >> 16) | (x << 16));
}
#endif
static double
wacom_transmit_period(mouse_wacom_t *dev, int bps, int rps)

View File

@@ -163,8 +163,8 @@ extern void pclog_ex(const char *fmt, va_list);
extern void fatal_ex(const char *fmt, va_list);
#endif
extern void pclog_toggle_suppr(void);
extern void pclog(const char *fmt, ...);
extern void fatal(const char *fmt, ...);
extern void pclog(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
extern void fatal(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
extern void set_screen_size(int x, int y);
extern void set_screen_size_monitor(int x, int y, int monitor_index);
extern void reset_screen_size(void);

View File

@@ -69,7 +69,7 @@
#define IDS_2089 2089 // "KB"
#define IDS_KB IDS_2089 // "KB"
#define IDS_2090 2090 // "Could not initialize the video..."
#define IDS_2090 2090 // "Could not initialize the video..."
#define IDS_2091 2091 // "Default"
#define IDS_DEFAULT IDS_2091 // "Default"
@@ -81,78 +81,78 @@
#define IDS_TYPE IDS_2093 // "Type"
/* TODO */
#define IDS_2094 2094 // "PCap failed to set up.."
#define IDS_2095 2095 // "No PCap devices found"
#define IDS_2096 2096 // "Invalid PCap device"
#define IDS_2097 2097 // "Standard 2-button joystick(s)"
#define IDS_2098 2098 // "Standard 4-button joystick"
#define IDS_2099 2099 // "Standard 6-button joystick"
#define IDS_2100 2100 // "Standard 8-button joystick"
#define IDS_2101 2101 // "CH Flightstick Pro"
#define IDS_2102 2102 // "Microsoft SideWinder Pad"
#define IDS_2103 2103 // "Thrustmaster Flight Cont.."
#define IDS_2104 2104 // "None"
#define IDS_2105 2105 // "Unable to load keyboard..."
#define IDS_2106 2106 // "Unable to register raw input."
#define IDS_2107 2107 // "%u"
#define IDS_2108 2108 // "%u MB (CHS: %i, %i, %i)"
#define IDS_2109 2109 // "Floppy %i (%s): %ls"
#define IDS_2110 2110 // "All floppy images (*.0??;*.."
#define IDS_2111 2111 // "Unable to initialize Free.."
#define IDS_2112 2112 // "Unable to initialize SDL..."
#define IDS_2113 2113 // "Are you sure you want to..."
#define IDS_2114 2114 // "Are you sure you want to..."
#define IDS_2115 2115 // "Unable to initialize Ghostscript..."
#define IDS_2116 2116 // "MO %i (%03i): %ls"
#define IDS_2117 2117 // "MO images (*.IM?)\0*.IM..."
#define IDS_2118 2118 // "Welcome to 86Box!"
#define IDS_2119 2119 // "Internal controller"
#define IDS_2120 2120 // "Exit"
#define IDS_2121 2121 // "No ROMs found"
#define IDS_2122 2122 // "Do you want to save the settings?"
#define IDS_2123 2123 // "This will hard reset the emulated..."
#define IDS_2124 2124 // "Save"
#define IDS_2125 2125 // "About 86Box"
#define IDS_2126 2126 // "86Box v" EMU_VERSION
#define IDS_2127 2127 // "An emulator of old computers..."
#define IDS_2128 2128 // "OK"
#define IDS_2129 2129 // "Hardware not available"
#define IDS_2130 2130 // "Make sure " LIB_NAME_PCAP "..."
#define IDS_2131 2131 // "Invalid configuration"
#define IDS_2132 2132 // LIB_NAME_FREETYPE " is required..."
#define IDS_2133 2133 // LIB_NAME_GS " is required for...
#define IDS_2134 2134 // LIB_NAME_FLUIDSYNTH " is required..."
#define IDS_2135 2135 // "Entering fullscreen mode"
#define IDS_2136 2136 // "Don't show this message again"
#define IDS_2137 2137 // "Don't exit"
#define IDS_2138 2138 // "Reset"
#define IDS_2139 2139 // "Don't reset"
#define IDS_2140 2140 // "MO images (*.IM?)\0*.IM?..."
#define IDS_2141 2141 // "CD-ROM images (*.ISO;*.CU.."
#define IDS_2142 2142 // "%hs Device Configuration"
#define IDS_2143 2143 // "Monitor in sleep mode"
#define IDS_2144 2144 // "OpenGL Shaders (*.GLSL)..."
#define IDS_2145 2145 // "OpenGL options"
#define IDS_2146 2146 // "You are loading an unsupported..."
#define IDS_2147 2147 // "CPU type filtering based on..."
#define IDS_2148 2148 // "Continue"
#define IDS_2149 2149 // "Cassette: %s"
#define IDS_2150 2150 // "Cassette images (*.PCM;*.RAW;*..."
#define IDS_2151 2151 // "Cartridge %i: %ls"
#define IDS_2152 2152 // "Cartridge images (*.JRC)\0*.JRC\0..."
#define IDS_2153 2153 // "Error initializing renderer"
#define IDS_2154 2154 // "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer."
#define IDS_2155 2155 // "Resume execution"
#define IDS_2156 2156 // "Pause execution"
#define IDS_2157 2157 // "Press Ctrl+Alt+Del"
#define IDS_2158 2158 // "Press Ctrl+Alt+Esc"
#define IDS_2159 2159 // "Hard reset"
#define IDS_2160 2160 // "ACPI shutdown"
#define IDS_2161 2161 // "Settings"
#define IDS_2162 2162 // "Early drive"
#define IDS_2163 2163 // "no dynarec"
#define IDS_2164 2164 // "old dynarec"
#define IDS_2165 2165 // "new dynarec"
#define IDS_2094 2094 // "PCap failed to set up.."
#define IDS_2095 2095 // "No PCap devices found"
#define IDS_2096 2096 // "Invalid PCap device"
#define IDS_2097 2097 // "Standard 2-button joystick(s)"
#define IDS_2098 2098 // "Standard 4-button joystick"
#define IDS_2099 2099 // "Standard 6-button joystick"
#define IDS_2100 2100 // "Standard 8-button joystick"
#define IDS_2101 2101 // "CH Flightstick Pro"
#define IDS_2102 2102 // "Microsoft SideWinder Pad"
#define IDS_2103 2103 // "Thrustmaster Flight Cont.."
#define IDS_2104 2104 // "None"
#define IDS_2105 2105 // "Unable to load keyboard..."
#define IDS_2106 2106 // "Unable to register raw input."
#define IDS_2107 2107 // "%u"
#define IDS_2108 2108 // "%u MB (CHS: %i, %i, %i)"
#define IDS_2109 2109 // "Floppy %i (%s): %ls"
#define IDS_2110 2110 // "All floppy images (*.0??;*.."
#define IDS_2111 2111 // "Unable to initialize Free.."
#define IDS_2112 2112 // "Unable to initialize SDL..."
#define IDS_2113 2113 // "Are you sure you want to..."
#define IDS_2114 2114 // "Are you sure you want to..."
#define IDS_2115 2115 // "Unable to initialize Ghostscript..."
#define IDS_2116 2116 // "MO %i (%03i): %ls"
#define IDS_2117 2117 // "MO images (*.IM?)\0*.IM..."
#define IDS_2118 2118 // "Welcome to 86Box!"
#define IDS_2119 2119 // "Internal controller"
#define IDS_2120 2120 // "Exit"
#define IDS_2121 2121 // "No ROMs found"
#define IDS_2122 2122 // "Do you want to save the settings?"
#define IDS_2123 2123 // "This will hard reset the emulated..."
#define IDS_2124 2124 // "Save"
#define IDS_2125 2125 // "About 86Box"
#define IDS_2126 2126 // "86Box v" EMU_VERSION
#define IDS_2127 2127 // "An emulator of old computers..."
#define IDS_2128 2128 // "OK"
#define IDS_2129 2129 // "Hardware not available"
#define IDS_2130 2130 // "Make sure " LIB_NAME_PCAP "..."
#define IDS_2131 2131 // "Invalid configuration"
#define IDS_2132 2132 // LIB_NAME_FREETYPE " is required..."
#define IDS_2133 2133 // LIB_NAME_GS " is required for...
#define IDS_2134 2134 // LIB_NAME_FLUIDSYNTH " is required..."
#define IDS_2135 2135 // "Entering fullscreen mode"
#define IDS_2136 2136 // "Don't show this message again"
#define IDS_2137 2137 // "Don't exit"
#define IDS_2138 2138 // "Reset"
#define IDS_2139 2139 // "Don't reset"
#define IDS_2140 2140 // "MO images (*.IM?)\0*.IM?..."
#define IDS_2141 2141 // "CD-ROM images (*.ISO;*.CU.."
#define IDS_2142 2142 // "%hs Device Configuration"
#define IDS_2143 2143 // "Monitor in sleep mode"
#define IDS_2144 2144 // "OpenGL Shaders (*.GLSL)..."
#define IDS_2145 2145 // "OpenGL options"
#define IDS_2146 2146 // "You are loading an unsupported..."
#define IDS_2147 2147 // "CPU type filtering based on..."
#define IDS_2148 2148 // "Continue"
#define IDS_2149 2149 // "Cassette: %s"
#define IDS_2150 2150 // "Cassette images (*.PCM;*.RAW;*..."
#define IDS_2151 2151 // "Cartridge %i: %ls"
#define IDS_2152 2152 // "Cartridge images (*.JRC)\0*.JRC\0..."
#define IDS_2153 2153 // "Error initializing renderer"
#define IDS_2154 2154 // "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer."
#define IDS_2155 2155 // "Resume execution"
#define IDS_2156 2156 // "Pause execution"
#define IDS_2157 2157 // "Press Ctrl+Alt+Del"
#define IDS_2158 2158 // "Press Ctrl+Alt+Esc"
#define IDS_2159 2159 // "Hard reset"
#define IDS_2160 2160 // "ACPI shutdown"
#define IDS_2161 2161 // "Settings"
#define IDS_2162 2162 // "Early drive"
#define IDS_2163 2163 // "no dynarec"
#define IDS_2164 2164 // "old dynarec"
#define IDS_2165 2165 // "new dynarec"
#ifdef USE_DYNAREC
# ifdef USE_NEW_DYNAREC
# define IDS_DYNAREC IDS_2165
@@ -162,118 +162,118 @@
#else
# define IDS_DYNAREC IDS_2163
#endif
#define IDS_2166 2166 // "Video card #2 ""%hs"" is not..."
#define IDS_2167 2167 // "Network driver initialization failed"
#define IDS_2168 2168 // "The network configuration will be switched to the null driver"
#define IDS_2166 2166 // "Video card #2 ""%hs"" is not..."
#define IDS_2167 2167 // "Network driver initialization failed"
#define IDS_2168 2168 // "The network configuration will be switched to the null driver"
#define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i"
#define IDS_4098 4098 // "%i"
#define IDS_4099 4099 // "MFM/RLL or ESDI CD-ROM driv.."
#define IDS_4100 4100 // "Custom..."
#define IDS_4101 4101 // "Custom (large)..."
#define IDS_4102 4102 // "Add New Hard Disk"
#define IDS_4103 4103 // "Add Existing Hard Disk"
#define IDS_4104 4104 // "HDI disk images cannot be..."
#define IDS_4105 4105 // "Disk images cannot be larger..."
#define IDS_4106 4106 // "Hard disk images (*.HDI;*.HD.."
#define IDS_4107 4107 // "Unable to open the file for read"
#define IDS_4108 4108 // "Unable to open the file for write"
#define IDS_4109 4109 // "HDI or HDX image with a sect.."
#define IDS_4110 4110 // "USB is not yet supported"
#define IDS_4111 4111 // "Disk image file already exists"
#define IDS_4112 4112 // "Please specify a valid file name."
#define IDS_4113 4113 // "Remember to partition and fo.."
#define IDS_4114 4114 // "Make sure the file exists and..."
#define IDS_4115 4115 // "Make sure the file is being..."
#define IDS_4116 4116 // "Disk image too large"
#define IDS_4117 4117 // "Remember to partition and format..."
#define IDS_4118 4118 // "The selected file will be..."
#define IDS_4119 4119 // "Unsupported disk image"
#define IDS_4120 4120 // "Overwrite"
#define IDS_4121 4121 // "Don't overwrite"
#define IDS_4122 4122 // "Raw image (.img)"
#define IDS_4123 4123 // "HDI image (.hdi)"
#define IDS_4124 4124 // "HDX image (.hdx)"
#define IDS_4125 4125 // "Fixed-size VHD (.vhd)"
#define IDS_4126 4126 // "Dynamic-size VHD (.vhd)"
#define IDS_4127 4127 // "Differencing VHD (.vhd)"
#define IDS_4128 4128 // "Large blocks (2 MB)"
#define IDS_4129 4129 // "Small blocks (512 KB)"
#define IDS_4130 4130 // "VHD files (*.VHD)\0*.VHD\0All..."
#define IDS_4131 4131 // "Select the parent VHD"
#define IDS_4132 4132 // "This could mean that the parent..."
#define IDS_4133 4133 // "Parent and child disk timestamps..."
#define IDS_4134 4134 // "Could not fix VHD timestamp."
#define IDS_4135 4135 // "%01i:%02i"
#define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i"
#define IDS_4098 4098 // "%i"
#define IDS_4099 4099 // "MFM/RLL or ESDI CD-ROM driv.."
#define IDS_4100 4100 // "Custom..."
#define IDS_4101 4101 // "Custom (large)..."
#define IDS_4102 4102 // "Add New Hard Disk"
#define IDS_4103 4103 // "Add Existing Hard Disk"
#define IDS_4104 4104 // "HDI disk images cannot be..."
#define IDS_4105 4105 // "Disk images cannot be larger..."
#define IDS_4106 4106 // "Hard disk images (*.HDI;*.HD.."
#define IDS_4107 4107 // "Unable to open the file for read"
#define IDS_4108 4108 // "Unable to open the file for write"
#define IDS_4109 4109 // "HDI or HDX image with a sect.."
#define IDS_4110 4110 // "USB is not yet supported"
#define IDS_4111 4111 // "Disk image file already exists"
#define IDS_4112 4112 // "Please specify a valid file name."
#define IDS_4113 4113 // "Remember to partition and fo.."
#define IDS_4114 4114 // "Make sure the file exists and..."
#define IDS_4115 4115 // "Make sure the file is being..."
#define IDS_4116 4116 // "Disk image too large"
#define IDS_4117 4117 // "Remember to partition and format..."
#define IDS_4118 4118 // "The selected file will be..."
#define IDS_4119 4119 // "Unsupported disk image"
#define IDS_4120 4120 // "Overwrite"
#define IDS_4121 4121 // "Don't overwrite"
#define IDS_4122 4122 // "Raw image (.img)"
#define IDS_4123 4123 // "HDI image (.hdi)"
#define IDS_4124 4124 // "HDX image (.hdx)"
#define IDS_4125 4125 // "Fixed-size VHD (.vhd)"
#define IDS_4126 4126 // "Dynamic-size VHD (.vhd)"
#define IDS_4127 4127 // "Differencing VHD (.vhd)"
#define IDS_4128 4128 // "Large blocks (2 MB)"
#define IDS_4129 4129 // "Small blocks (512 KB)"
#define IDS_4130 4130 // "VHD files (*.VHD)\0*.VHD\0All..."
#define IDS_4131 4131 // "Select the parent VHD"
#define IDS_4132 4132 // "This could mean that the parent..."
#define IDS_4133 4133 // "Parent and child disk timestamps..."
#define IDS_4134 4134 // "Could not fix VHD timestamp."
#define IDS_4135 4135 // "%01i:%02i"
#define IDS_4352 4352 // "MFM/RLL"
#define IDS_4353 4353 // "XT IDE"
#define IDS_4354 4354 // "ESDI"
#define IDS_4355 4355 // "IDE"
#define IDS_4356 4356 // "ATAPI"
#define IDS_4357 4357 // "SCSI"
#define IDS_4352 4352 // "MFM/RLL"
#define IDS_4353 4353 // "XT IDE"
#define IDS_4354 4354 // "ESDI"
#define IDS_4355 4355 // "IDE"
#define IDS_4356 4356 // "ATAPI"
#define IDS_4357 4357 // "SCSI"
#define IDS_4608 4608 // "MFM/RLL (%01i:%01i)"
#define IDS_4609 4609 // "XT IDE (%01i:%01i)"
#define IDS_4610 4610 // "ESDI (%01i:%01i)"
#define IDS_4611 4611 // "IDE (%01i:%01i)"
#define IDS_4612 4612 // "ATAPI (%01i:%01i)"
#define IDS_4613 4613 // "SCSI (%02i:%02i)"
#define IDS_4608 4608 // "MFM/RLL (%01i:%01i)"
#define IDS_4609 4609 // "XT IDE (%01i:%01i)"
#define IDS_4610 4610 // "ESDI (%01i:%01i)"
#define IDS_4611 4611 // "IDE (%01i:%01i)"
#define IDS_4612 4612 // "ATAPI (%01i:%01i)"
#define IDS_4613 4613 // "SCSI (%02i:%02i)"
#define IDS_5120 5120 // "CD-ROM %i (%s): %s"
#define IDS_5120 5120 // "CD-ROM %i (%s): %s"
#define IDS_5376 5376 // "Disabled"
#define IDS_5377 5377 // <Reserved>
#define IDS_5378 5378 // <Reserved>
#define IDS_5379 5379 // <Reserved>
#define IDS_5380 5380 // <Reserved>
#define IDS_5381 5381 // "ATAPI"
#define IDS_5382 5382 // "SCSI"
#define IDS_5376 5376 // "Disabled"
#define IDS_5377 5377 // <Reserved>
#define IDS_5378 5378 // <Reserved>
#define IDS_5379 5379 // <Reserved>
#define IDS_5380 5380 // <Reserved>
#define IDS_5381 5381 // "ATAPI"
#define IDS_5382 5382 // "SCSI"
#define IDS_5632 5632 // "Disabled"
#define IDS_5633 5633 // <Reserved>
#define IDS_5634 5634 // <Reserved>
#define IDS_5635 5635 // <Reserved>
#define IDS_5636 5636 // <Reserved>
#define IDS_5637 5637 // "ATAPI (%01i:%01i)"
#define IDS_5638 5638 // "SCSI (%02i:%02i)"
#define IDS_5632 5632 // "Disabled"
#define IDS_5633 5633 // <Reserved>
#define IDS_5634 5634 // <Reserved>
#define IDS_5635 5635 // <Reserved>
#define IDS_5636 5636 // <Reserved>
#define IDS_5637 5637 // "ATAPI (%01i:%01i)"
#define IDS_5638 5638 // "SCSI (%02i:%02i)"
#define IDS_5888 5888 // "160 kB"
#define IDS_5889 5889 // "180 kB"
#define IDS_5890 5890 // "320 kB"
#define IDS_5891 5891 // "360 kB"
#define IDS_5892 5892 // "640 kB"
#define IDS_5893 5893 // "720 kB"
#define IDS_5894 5894 // "1.2 MB"
#define IDS_5895 5895 // "1.25 MB"
#define IDS_5896 5896 // "1.44 MB"
#define IDS_5897 5897 // "DMF (cluster 1024)"
#define IDS_5898 5898 // "DMF (cluster 2048)"
#define IDS_5899 5899 // "2.88 MB"
#define IDS_5900 5900 // "ZIP 100"
#define IDS_5901 5901 // "ZIP 250"
#define IDS_5902 5902 // "3.5\" 128 MB (ISO 10090)"
#define IDS_5903 5903 // "3.5\" 230 MB (ISO 13963)"
#define IDS_5904 5904 // "3.5\" 540 MB (ISO 15498)"
#define IDS_5905 5905 // "3.5\" 640 MB (ISO 15498)"
#define IDS_5906 5906 // "3.5\" 1.3 GB (GigaMO)"
#define IDS_5907 5907 // "3.5\" 2.3 GB (GigaMO 2)"
#define IDS_5908 5908 // "5.25\" 600 MB"
#define IDS_5909 5909 // "5.25\" 650 MB"
#define IDS_5910 5910 // "5.25\" 1 GB"
#define IDS_5911 5911 // "5.25\" 1.3 GB"
#define IDS_5888 5888 // "160 kB"
#define IDS_5889 5889 // "180 kB"
#define IDS_5890 5890 // "320 kB"
#define IDS_5891 5891 // "360 kB"
#define IDS_5892 5892 // "640 kB"
#define IDS_5893 5893 // "720 kB"
#define IDS_5894 5894 // "1.2 MB"
#define IDS_5895 5895 // "1.25 MB"
#define IDS_5896 5896 // "1.44 MB"
#define IDS_5897 5897 // "DMF (cluster 1024)"
#define IDS_5898 5898 // "DMF (cluster 2048)"
#define IDS_5899 5899 // "2.88 MB"
#define IDS_5900 5900 // "ZIP 100"
#define IDS_5901 5901 // "ZIP 250"
#define IDS_5902 5902 // "3.5\" 128 MB (ISO 10090)"
#define IDS_5903 5903 // "3.5\" 230 MB (ISO 13963)"
#define IDS_5904 5904 // "3.5\" 540 MB (ISO 15498)"
#define IDS_5905 5905 // "3.5\" 640 MB (ISO 15498)"
#define IDS_5906 5906 // "3.5\" 1.3 GB (GigaMO)"
#define IDS_5907 5907 // "3.5\" 2.3 GB (GigaMO 2)"
#define IDS_5908 5908 // "5.25\" 600 MB"
#define IDS_5909 5909 // "5.25\" 650 MB"
#define IDS_5910 5910 // "5.25\" 1 GB"
#define IDS_5911 5911 // "5.25\" 1.3 GB"
#define IDS_6144 6144 // "Perfect RPM"
#define IDS_6145 6145 // "1%% below perfect RPM"
#define IDS_6146 6146 // "1.5%% below perfect RPM"
#define IDS_6147 6147 // "2%% below perfect RPM"
#define IDS_6144 6144 // "Perfect RPM"
#define IDS_6145 6145 // "1%% below perfect RPM"
#define IDS_6146 6146 // "1.5%% below perfect RPM"
#define IDS_6147 6147 // "2%% below perfect RPM"
#define IDS_7168 7168 // "(System Default)"
#define IDS_7168 7168 // "(System Default)"
#define IDS_LANG_ENUS IDS_7168
#define STR_NUM_2048 120
#define STR_NUM_2048 121
// UNUSED: #define STR_NUM_3072 11
#define STR_NUM_4096 40
#define STR_NUM_4352 6

View File

@@ -157,8 +157,6 @@
mem_set_access((smm ? ACCESS_CPU_SMM : ACCESS_CPU), 1, base, size, is_smram)
#define mem_set_access_smram_bus(smm, base, size, is_smram) \
mem_set_access((smm ? ACCESS_BUS_SMM : ACCESS_BUS), 1, base, size, is_smram)
#define flushmmucache_cr3 \
flushmmucache_nopc
typedef struct {
uint16_t x : 5,
@@ -228,7 +226,7 @@ typedef struct page_t {
} page_t;
extern uint32_t purgable_page_list_head;
static inline int
__attribute__((always_inline)) static inline int
page_in_evict_list(page_t *p)
{
return (p->evict_prev != EVICT_NOT_IN_LIST);
@@ -415,7 +413,6 @@ extern void mem_reset_page_blocks(void);
extern void flushmmucache(void);
extern void flushmmucache_nopc(void);
extern void mmu_invalidate(uint32_t addr);
extern void mem_a20_init(void);
extern void mem_a20_recalc(void);

View File

@@ -178,7 +178,10 @@ typedef struct {
0xFF. */
id1; /* 0x70 for the RTL8019AS, 0x43 for the
RTL8029AS, otherwise 0xFF. */
int mem_size, mem_start, mem_end;
uint32_t mem_size;
uint32_t mem_start;
uint32_t mem_end;
uint32_t mem_wrap;
int tx_timer_index;
int tx_timer_active;

View File

@@ -66,6 +66,9 @@ extern void seekdir(DIR *, long);
extern int closedir(DIR *);
# define rewinddir(dirp) seekdir(dirp, 0L)
#elif defined(__FreeBSD__)
/* FreeBSD uses dirent.h instead of sys/dir.h */
# include <dirent.h>
#else
/* On linux and macOS, use the standard functions and types */
# include <sys/dir.h>

View File

@@ -280,7 +280,7 @@
#define IDC_COMBO_HD_BUS 1135
#define IDC_COMBO_HD_CHANNEL 1136
#define IDC_COMBO_HD_ID 1137
#define IDC_COMBO_HD_LUN 1138
#define IDC_COMBO_HD_SPEED 1138
#define IDC_COMBO_HD_CHANNEL_IDE 1139
#define IDC_EDIT_HD_FILE_NAME 1140 /* add hard disk dialog */

View File

@@ -549,12 +549,6 @@ mmutranslate_noabrt(uint32_t addr, int rw)
return mmutranslate_noabrt_normal(addr, rw);
}
void
mmu_invalidate(uint32_t addr)
{
flushmmucache_cr3();
}
uint8_t
mem_addr_range_match(uint32_t addr, uint32_t start, uint32_t len)
{
@@ -2351,7 +2345,7 @@ mem_invalidate_range(uint32_t start_addr, uint32_t end_addr)
if (p) {
p->dirty_mask = 0xffffffffffffffffULL;
if (p->byte_dirty_mask)
if ((p->mem != page_ff) && p->byte_dirty_mask)
memset(p->byte_dirty_mask, 0xff, 64 * sizeof(uint64_t));
if (!page_in_evict_list(p))
@@ -2457,7 +2451,7 @@ mem_mapping_recalc(uint64_t base, uint64_t size)
map = map->next;
}
flushmmucache_cr3();
flushmmucache_nopc();
#ifdef ENABLE_MEM_LOG
pclog("\nMemory map:\n");

View File

@@ -43,8 +43,13 @@ endif()
if (UNIX)
find_path(HAS_VDE "libvdeplug.h" PATHS ${VDE_INCLUDE_DIR} "/usr/include /usr/local/include" "/opt/homebrew/include" )
if(HAS_VDE)
add_compile_definitions(HAS_VDE)
list(APPEND net_sources net_vde.c)
find_library(VDE_LIB vdeplug)
if (NOT VDE_LIB)
message(WARNING "Could not find VDE. The library will not be bundled and any related features will be disabled.")
else()
add_compile_definitions(HAS_VDE)
list(APPEND net_sources net_vde.c)
endif()
endif()
endif()

View File

@@ -195,7 +195,7 @@ dp8390_write_cr(dp8390_t *dev, uint32_t val)
/* Check for start-tx */
if ((val & 0x04) && dev->TCR.loop_cntl) {
if (dev->TCR.loop_cntl) {
dp8390_rx_common(dev, &dev->mem[(dev->tx_page_start * 256) - dev->mem_start],
dp8390_rx_common(dev, &dev->mem[((dev->tx_page_start * 256) - dev->mem_start) & dev->mem_wrap],
dev->tx_bytes);
}
} else if (val & 0x04) {
@@ -217,7 +217,7 @@ dp8390_write_cr(dp8390_t *dev, uint32_t val)
/* TODO: report TX error to the driver ? */
if (!(dev->card->link_state & NET_LINK_DOWN))
network_tx(dev->card, &dev->mem[(dev->tx_page_start * 256) - dev->mem_start], dev->tx_bytes);
network_tx(dev->card, &dev->mem[((dev->tx_page_start * 256) - dev->mem_start) & dev->mem_wrap], dev->tx_bytes);
/* some more debug */
#ifdef ENABLE_DP8390_LOG
@@ -390,7 +390,7 @@ dp8390_rx_common(void *priv, uint8_t *buf, int io_len)
} else {
endbytes = (dev->page_stop - dev->curr_page) * 256;
memcpy(startptr + sizeof(pkthdr), buf, endbytes - sizeof(pkthdr));
startptr = &dev->mem[(dev->page_start * 256) - dev->mem_start];
startptr = &dev->mem[((dev->tx_page_start * 256) - dev->mem_start) & dev->mem_wrap];
memcpy(startptr, buf + endbytes - sizeof(pkthdr), io_len - endbytes + 8);
}
dev->curr_page = nextpage;
@@ -917,6 +917,7 @@ dp8390_mem_alloc(dp8390_t *dev, uint32_t start, uint32_t size)
dev->mem_start = start;
dev->mem_end = start + size;
dev->mem_size = size;
dev->mem_wrap = size - 1;
dp8390_log("DP8390: Mapped %i bytes of memory at address %04X in the address space\n", size, start);
}

View File

@@ -307,7 +307,7 @@ static void
ctr_set_state_1(ctr_t *ctr)
{
uint8_t mode = (ctr->m & 0x03);
int do_reload = !!ctr->incomplete || (ctr->state == 0);
int do_reload = !!ctr->incomplete || (mode == 0) || (ctr->state == 0);
ctr->incomplete = 0;
@@ -984,7 +984,7 @@ pit_set_clock(int clock)
ISACONST = (uint64_t) ((cpuclock / (double) cpu_isa_speed) * (double) (1ULL << 32));
xt_cpu_multi = 1ULL;
} else {
cpuclock = 14318184.0;
cpuclock = (157500000.0 / 11.0);
PITCONSTD = 12.0;
PITCONST = (12ULL << 32ULL);
CGACONST = (8ULL << 32ULL);

View File

@@ -239,7 +239,6 @@ if (APPLE)
if (NOT MOLTENVK_LIB)
message(FATAL_ERROR "Could not find MoltenVK library")
endif()
target_link_libraries(ui PRIVATE "${MOLTENVK_LIB}")
endif()
endif()
@@ -313,6 +312,20 @@ macro(install_qt5_plugin _qt_plugin_name _runtime_plugins_var _prefix)
endif()
endmacro()
macro(install_bundle_library _library_path _installed_name _runtime_plugins_var _prefix)
if(EXISTS "${_library_path}")
file(REAL_PATH "${_library_path}" _lib_resolved)
if(EXISTS "${_lib_resolved}")
install(FILES "${_lib_resolved}" DESTINATION "${_prefix}" RENAME "${_installed_name}")
list(APPEND ${_runtime_plugins_var} "\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${_prefix}/${_installed_name}")
else()
message(WARNING "Library ${_installed_name} will not be bundled: The library was found but could not be resolved.")
endif()
else()
message(STATUS "Library ${_installed_name} was not found - skipping")
endif()
endmacro()
if (APPLE AND CMAKE_MACOSX_BUNDLE)
set(prefix "86Box.app/Contents")
set(INSTALL_RUNTIME_DIR "${prefix}/MacOS")
@@ -326,19 +339,10 @@ if (APPLE AND CMAKE_MACOSX_BUNDLE)
install_qt5_plugin("Qt${QT_MAJOR}::QICNSPlugin" RUNTIME_PLUGINS ${prefix})
# Install libraries that are loaded at runtime and not linked
if (GHOSTSCRIPT_LIB)
set(GS_LIBRARY_NAME "libgs.dylib")
file(REAL_PATH ${GHOSTSCRIPT_LIB} GS_LIB_RESOLVED)
install(FILES ${GS_LIB_RESOLVED} DESTINATION ${INSTALL_LIB_DIR} RENAME ${GS_LIBRARY_NAME})
list(APPEND RUNTIME_PLUGINS "\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${INSTALL_LIB_DIR}/${GS_LIBRARY_NAME}")
endif ()
if (FLUIDSYNTH_LIB)
set(FLUIDSYNTH_LIBRARY_NAME "libfluidsynth.dylib")
file(REAL_PATH ${FLUIDSYNTH_LIB} FLUIDSYNTH_LIB_RESOLVED)
install(FILES ${FLUIDSYNTH_LIB_RESOLVED} DESTINATION ${INSTALL_LIB_DIR} RENAME ${FLUIDSYNTH_LIBRARY_NAME})
list(APPEND RUNTIME_PLUGINS "\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${INSTALL_LIB_DIR}/${FLUIDSYNTH_LIBRARY_NAME}")
endif ()
install_bundle_library("${GHOSTSCRIPT_LIB}" "libgs.dylib" RUNTIME_PLUGINS ${INSTALL_LIB_DIR})
install_bundle_library("${FLUIDSYNTH_LIB}" "libfluidsynth.dylib" RUNTIME_PLUGINS ${INSTALL_LIB_DIR})
install_bundle_library("${VDE_LIB}" "libvdeplug.dylib" RUNTIME_PLUGINS ${INSTALL_LIB_DIR})
install_bundle_library("${MOLTENVK_LIB}" "libVulkan.dylib" RUNTIME_PLUGINS ${INSTALL_LIB_DIR})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
"[Paths]\nPlugins = PlugIns\n")
@@ -365,16 +369,6 @@ if (APPLE AND CMAKE_MACOSX_BUNDLE)
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath \"@executable_path/../Frameworks/\"
\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${INSTALL_RUNTIME_DIR}/86Box\")
")
if(MOLTENVK)
install(CODE "
execute_process(
COMMAND bash -c \"set -e
echo \\\"-- Creating vulkan dylib symlink for QT (libVulkan.dylib -> libMoltenVK.dylib)\\\"
cd \${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${INSTALL_LIB_DIR}
ln -sf libMoltenVK.dylib libVulkan.dylib
\")
")
endif()
endif()
if (UNIX AND NOT APPLE AND NOT HAIKU)

View File

@@ -109,7 +109,6 @@ DeviceConfig::ConfigureDevice(const _device_ *device, int instance, Settings *se
{
DeviceConfig dc(settings);
dc.setWindowTitle(QString("%1 Device Configuration").arg(device->name));
int c;
int p;
int q;
@@ -216,7 +215,7 @@ DeviceConfig::ConfigureDevice(const _device_ *device, int instance, Settings *se
char *selected;
selected = config_get_string(device_context.name, const_cast<char *>(config->name), const_cast<char *>(config->default_string));
c = q = 0;
q = 0;
for (auto *bios = config->bios; (bios != nullptr) && (bios->name != nullptr) && (strlen(bios->name) > 0); ++bios) {
p = 0;
for (int d = 0; d < bios->files_no; d++)
@@ -226,7 +225,6 @@ DeviceConfig::ConfigureDevice(const _device_ *device, int instance, Settings *se
if (!strcmp(selected, bios->internal_name)) {
currentIndex = row;
}
c++;
}
q++;
}

View File

@@ -327,7 +327,7 @@ RendererStack::switchRenderer(Renderer renderer)
createRenderer(renderer);
disconnect(this, &RendererStack::blit, this, &RendererStack::blitDummy);
blitDummied = false;
QTimer::singleShot(1000, this, [this]() { blitDummied = false; });
QTimer::singleShot(1000, this, []() { blitDummied = false; });
});
rendererWindow->hasBlitFunc() ? current.reset() : current.release()->deleteLater();

View File

@@ -64,7 +64,6 @@ SettingsNetwork::SettingsNetwork(QWidget *parent)
auto *nic_cbox = findChild<QComboBox *>(QString("comboBoxNIC%1").arg(i + 1));
auto *net_type_cbox = findChild<QComboBox *>(QString("comboBoxNet%1").arg(i + 1));
auto *intf_cbox = findChild<QComboBox *>(QString("comboBoxIntf%1").arg(i + 1));
auto *socket_line = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i + 1));
connect(nic_cbox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsNetwork::on_comboIndexChanged);
connect(net_type_cbox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsNetwork::on_comboIndexChanged);
connect(intf_cbox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingsNetwork::on_comboIndexChanged);

View File

@@ -98,6 +98,8 @@ joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_t *joy, USAGE usage)
void
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
{
LONG center;
if (joy->nr_axes >= 8)
return;
@@ -141,7 +143,10 @@ joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS
}
rawjoy->axis[joy->nr_axes].min = prop->LogicalMin;
joy->nr_axes++;
center = (rawjoy->axis[joy->nr_axes].max - rawjoy->axis[joy->nr_axes].min + 1) / 2;
if (center != 0x00)
joy->nr_axes++;
}
void

View File

@@ -1249,8 +1249,10 @@ cmi8x38_speed_changed(void *priv)
{
cmi8x38_t *dev = (cmi8x38_t *) priv;
double freq;
uint8_t dsr = dev->io_regs[0x09], freqreg = dev->io_regs[0x05] >> 2;
uint8_t chfmt45 = dev->io_regs[0x0b], chfmt6 = dev->io_regs[0x15];
uint8_t dsr = dev->io_regs[0x09];
uint8_t freqreg = dev->io_regs[0x05] >> 2;
uint8_t chfmt45 = dev->io_regs[0x0b];
uint8_t chfmt6 = dev->io_regs[0x15];
#ifdef ENABLE_CMI8X38_LOG
char buf[256];

View File

@@ -21,6 +21,9 @@
# define _DEFAULT_SOURCE 1
# define _BSD_SOURCE 1
#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
# define __BSD_VISIBLE 1
#endif
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
@@ -165,7 +168,7 @@ plat_serpt_set_params(void *p)
term_attr.c_cflag &= CSTOPB;
if (dev->serial->lcr & 0x04)
term_attr.c_cflag |= CSTOPB;
#ifdef __APPLE__
#if !defined(__linux__)
term_attr.c_cflag &= PARENB | PARODD;
#else
term_attr.c_cflag &= PARENB | PARODD | CMSPAR;
@@ -174,7 +177,7 @@ plat_serpt_set_params(void *p)
term_attr.c_cflag |= PARENB;
if (!(dev->serial->lcr & 0x10))
term_attr.c_cflag |= PARODD;
#ifndef __APPLE__
#if defined(__linux__)
if ((dev->serial->lcr & 0x20))
term_attr.c_cflag |= CMSPAR;
#endif

View File

@@ -342,6 +342,8 @@ ohci_set_interrupt(usb_t *dev, uint8_t bit)
ohci_update_irq(dev);
}
/* TODO: Actually use this function somewhere. */
#if 0
/* Next two functions ported over from QEMU. */
static int ohci_copy_td_input(usb_t* dev, usb_td_t *td,
uint8_t *buf, int len)
@@ -363,6 +365,7 @@ static int ohci_copy_td_input(usb_t* dev, usb_td_t *td,
dma_bm_write(ptr, buf, len - n, 1);
return 0;
}
#endif
static int ohci_copy_td_output(usb_t* dev, usb_td_t *td,
uint8_t *buf, int len)

View File

@@ -2241,7 +2241,7 @@ rect_fill_pix:
}
} else if (dev->accel.output && !dev->accel.input) {
while (count-- && (dev->accel.sy >= 0)) {
if ((dev->accel.cx >= dev->accel.clip_left && dev->accel.cx <= clip_r && dev->accel.cy >= dev->accel.clip_top && dev->accel.cy <= clip_b)) {
if (dev->accel.cx >= dev->accel.clip_left && dev->accel.cx <= clip_r && dev->accel.cy >= dev->accel.clip_top && dev->accel.cy <= clip_b) {
src_dat = cpu_dat;
if (!dev->accel.odd_out && !dev->accel.sx) {
READ(dev->accel.newdest_out + dev->accel.cur_x, dest_dat);
@@ -3363,7 +3363,6 @@ static void
ibm8514_render_8bpp(svga_t *svga)
{
ibm8514_t *dev = &svga->dev8514;
int x;
uint32_t *p;
uint32_t dat;
@@ -3378,7 +3377,7 @@ ibm8514_render_8bpp(svga_t *svga)
dev->firstline_draw = dev->displine;
dev->lastline_draw = dev->displine;
for (x = 0; x <= dev->h_disp; x += 8) {
for (int x = 0; x <= dev->h_disp; x += 8) {
dat = *(uint32_t *) (&dev->vram[dev->ma & dev->vram_mask]);
p[0] = dev->map8[dat & 0xff];
p[1] = dev->map8[(dat >> 8) & 0xff];
@@ -3401,22 +3400,19 @@ ibm8514_render_8bpp(svga_t *svga)
static void
ibm8514_render_overscan_left(ibm8514_t *dev, svga_t *svga)
{
int i;
if ((dev->displine + svga->y_add) < 0)
return;
if (svga->scrblank || (dev->h_disp == 0))
return;
for (i = 0; i < svga->x_add; i++)
for (int i = 0; i < svga->x_add; i++)
buffer32->line[dev->displine + svga->y_add][i] = svga->overscan_color;
}
static void
ibm8514_render_overscan_right(ibm8514_t *dev, svga_t *svga)
{
int i;
int right;
if ((dev->displine + svga->y_add) < 0)
@@ -3426,7 +3422,7 @@ ibm8514_render_overscan_right(ibm8514_t *dev, svga_t *svga)
return;
right = (overscan_x >> 1);
for (i = 0; i < right; i++)
for (int i = 0; i < right; i++)
buffer32->line[dev->displine + svga->y_add][svga->x_add + dev->h_disp + i] = svga->overscan_color;
}

View File

@@ -207,7 +207,7 @@ ati18800_init(const device_t *info)
case ATI18800_EDGE16:
rom_init(&ati18800->bios_rom, BIOS_ROM_PATH_EDGE16, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
break;
};
}
if (info->local == ATI18800_EDGE16) {
svga_init(info, &ati18800->svga, ati18800, 1 << 18, /*256kb*/

View File

@@ -401,52 +401,52 @@ ati28800_recalctimings(svga_t *svga)
switch (((ati28800->regs[0xbe] & 0x10) >> 1) | ((ati28800->regs[0xb9] & 2) << 1) | ((svga->miscout & 0x0C) >> 2)) {
case 0x00:
svga->clock = (cpuclock * (double) (1ull << 32)) / 42954000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 42954000.0;
break;
case 0x01:
svga->clock = (cpuclock * (double) (1ull << 32)) / 48771000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 48771000.0;
break;
case 0x02:
ati28800_log("clock 2\n");
break;
case 0x03:
svga->clock = (cpuclock * (double) (1ull << 32)) / 36000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 36000000.0;
break;
case 0x04:
svga->clock = (cpuclock * (double) (1ull << 32)) / 50350000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 50350000.0;
break;
case 0x05:
svga->clock = (cpuclock * (double) (1ull << 32)) / 56640000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 56640000.0;
break;
case 0x06:
ati28800_log("clock 2\n");
break;
case 0x07:
svga->clock = (cpuclock * (double) (1ull << 32)) / 44900000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 44900000.0;
break;
case 0x08:
svga->clock = (cpuclock * (double) (1ull << 32)) / 30240000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 30240000.0;
break;
case 0x09:
svga->clock = (cpuclock * (double) (1ull << 32)) / 32000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 32000000.0;
break;
case 0x0A:
svga->clock = (cpuclock * (double) (1ull << 32)) / 37500000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 37500000.0;
break;
case 0x0B:
svga->clock = (cpuclock * (double) (1ull << 32)) / 39000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 39000000.0;
break;
case 0x0C:
svga->clock = (cpuclock * (double) (1ull << 32)) / 50350000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 50350000.0;
break;
case 0x0D:
svga->clock = (cpuclock * (double) (1ull << 32)) / 56644000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 56644000.0;
break;
case 0x0E:
svga->clock = (cpuclock * (double) (1ull << 32)) / 75000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 75000000.0;
break;
case 0x0F:
svga->clock = (cpuclock * (double) (1ull << 32)) / 65000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 65000000.0;
break;
default:
break;
@@ -665,7 +665,7 @@ ati28800_init(const device_t *info)
break;
}
return (ati28800);
return ati28800;
}
static int
@@ -677,20 +677,20 @@ ati28800_available(void)
static int
ati28800k_available(void)
{
return ((rom_present(BIOS_ATIKOR_PATH) && rom_present(FONT_ATIKOR_PATH)));
return (rom_present(BIOS_ATIKOR_PATH) && rom_present(FONT_ATIKOR_PATH));
}
static int
compaq_ati28800_available(void)
{
return ((rom_present(BIOS_VGAXL_ROM_PATH)));
return (rom_present(BIOS_VGAXL_ROM_PATH));
}
#if defined(DEV_BRANCH) && defined(USE_XL24)
static int
ati28800_wonderxl24_available(void)
{
return ((rom_present(BIOS_XL24_EVEN_PATH) && rom_present(BIOS_XL24_ODD_PATH)));
return (rom_present(BIOS_XL24_EVEN_PATH) && rom_present(BIOS_XL24_ODD_PATH));
}
#endif

View File

@@ -201,12 +201,11 @@ void
ati68860_set_ramdac_type(void *p, int type)
{
ati68860_ramdac_t *ramdac = (ati68860_ramdac_t *) p;
int c;
if (ramdac->ramdac_type != type) {
ramdac->ramdac_type = type;
for (c = 0; c < 2; c++) {
for (uint8_t c = 0; c < 2; c++) {
if (ramdac->ramdac_type == RAMDAC_8BIT)
ramdac->pallook[c] = makecol32(ramdac->pal[c].r, ramdac->pal[c].g,
ramdac->pal[c].b);
@@ -248,13 +247,13 @@ void
ati68860_hwcursor_draw(svga_t *svga, int displine)
{
ati68860_ramdac_t *ramdac = (ati68860_ramdac_t *) svga->ramdac;
int x, offset;
int offset;
uint8_t dat;
uint32_t col0 = ramdac->pallook[0];
uint32_t col1 = ramdac->pallook[1];
offset = svga->dac_hwcursor_latch.xoff;
for (x = 0; x < 64 - svga->dac_hwcursor_latch.xoff; x += 4) {
for (uint32_t x = 0; x < 64 - svga->dac_hwcursor_latch.xoff; x += 4) {
dat = svga->vram[svga->dac_hwcursor_latch.addr + (offset >> 2)];
if (!(dat & 2))
buffer32->line[displine][svga->dac_hwcursor_latch.x + x + svga->x_add] = (dat & 1) ? col1 : col0;

View File

@@ -58,7 +58,6 @@ ati_eeprom_save(ati_eeprom_t *eeprom)
void
ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat)
{
int c;
if (!ena) {
eeprom->out = 1;
}
@@ -157,7 +156,7 @@ ati_eeprom_write(ati_eeprom_t *eeprom, int ena, int clk, int dat)
case EEPROM_OP_WRALMAIN:
if (!eeprom->wp) {
for (c = 0; c < 256; c++)
for (uint16_t c = 0; c < 256; c++)
eeprom->data[c] = eeprom->dat;
ati_eeprom_save(eeprom);
}

View File

@@ -1179,9 +1179,6 @@ mach64_queue(mach64_t *mach64, uint32_t addr, uint32_t val, uint32_t type)
void
mach64_start_fill(mach64_t *mach64)
{
int x;
int y;
mach64->accel.dst_x = 0;
mach64->accel.dst_y = 0;
mach64->accel.dst_x_start = (mach64->dst_y_x >> 16) & 0xfff;
@@ -1258,8 +1255,8 @@ mach64_start_fill(mach64_t *mach64)
mach64->accel.source_host = ((mach64->dp_src & 7) == SRC_HOST) || (((mach64->dp_src >> 8) & 7) == SRC_HOST);
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) {
for (uint8_t y = 0; y < 8; y++) {
for (uint8_t x = 0; x < 8; x++) {
uint32_t temp = (y & 4) ? mach64->pat_reg1 : mach64->pat_reg0;
mach64->accel.pattern[y][7 - x] = (temp >> (x + ((y & 3) * 8))) & 1;
}
@@ -1310,9 +1307,6 @@ mach64_start_fill(mach64_t *mach64)
void
mach64_start_line(mach64_t *mach64)
{
int x;
int y;
mach64->accel.dst_x = (mach64->dst_y_x >> 16) & 0xfff;
mach64->accel.dst_y = mach64->dst_y_x & 0xfff;
@@ -1355,8 +1349,8 @@ mach64_start_line(mach64_t *mach64)
mach64->accel.source_host = ((mach64->dp_src & 7) == SRC_HOST) || (((mach64->dp_src >> 8) & 7) == SRC_HOST);
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) {
for (uint8_t y = 0; y < 8; y++) {
for (uint8_t x = 0; x < 8; x++) {
uint32_t temp = (y & 4) ? mach64->pat_reg1 : mach64->pat_reg0;
mach64->accel.pattern[y][7 - x] = (temp >> (x + ((y & 3) * 8))) & 1;
}
@@ -2057,8 +2051,6 @@ mach64_load_context(mach64_t *mach64)
static void
pll_write(mach64_t *mach64, uint32_t addr, uint8_t val)
{
int c;
switch (addr & 3) {
case 0: /*Clock sel*/
break;
@@ -2069,7 +2061,7 @@ pll_write(mach64_t *mach64, uint32_t addr, uint8_t val)
mach64->pll_regs[mach64->pll_addr] = val;
mach64_log("pll_write %02x,%02x\n", mach64->pll_addr, val);
for (c = 0; c < 4; c++) {
for (uint8_t c = 0; c < 4; c++) {
double m = (double) mach64->pll_regs[PLL_REF_DIV];
double n = (double) mach64->pll_regs[VCLK0_FB_DIV + c];
double r = 14318184.0;
@@ -3974,7 +3966,6 @@ mach64_overlay_draw(svga_t *svga, int displine)
static void
mach64_io_remove(mach64_t *mach64)
{
int c;
uint16_t io_base = 0x02ec;
switch (mach64->io_base) {
@@ -3995,7 +3986,7 @@ mach64_io_remove(mach64_t *mach64)
io_removehandler(0x03c0, 0x0020, mach64_in, NULL, NULL, mach64_out, NULL, NULL, mach64);
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
io_removehandler((c * 0x1000) + 0x0000 + io_base, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64);
io_removehandler((c * 0x1000) + 0x0400 + io_base, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64);
io_removehandler((c * 0x1000) + 0x0800 + io_base, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64);
@@ -4011,14 +4002,12 @@ mach64_io_remove(mach64_t *mach64)
static void
mach64_io_set(mach64_t *mach64)
{
int c;
mach64_io_remove(mach64);
io_sethandler(0x03c0, 0x0020, mach64_in, NULL, NULL, mach64_out, NULL, NULL, mach64);
if (!mach64->use_block_decoded_io) {
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
io_sethandler((c * 0x1000) + 0x2ec, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64);
io_sethandler((c * 0x1000) + 0x6ec, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64);
io_sethandler((c * 0x1000) + 0xaec, 0x0004, mach64_ext_inb, mach64_ext_inw, mach64_ext_inl, mach64_ext_outb, mach64_ext_outw, mach64_ext_outl, mach64);

View File

@@ -160,7 +160,7 @@ bt48x_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_t *
break;
case 0x0a:
if ((ramdac->type >= BT485) && (ramdac->cmd_r0 & 0x80)) {
switch ((svga->dac_addr & ((ramdac->type >= BT485A) ? 0xff : 0x3f))) {
switch (svga->dac_addr & ((ramdac->type >= BT485A) ? 0xff : 0x3f)) {
case 0x01:
/* Command Register 3 (RS value = 1010) */
ramdac->cmd_r3 = val;
@@ -284,7 +284,7 @@ bt48x_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga)
break;
case 0x0a:
if ((ramdac->type >= BT485) && (ramdac->cmd_r0 & 0x80)) {
switch ((svga->dac_addr & ((ramdac->type >= BT485A) ? 0xff : 0x3f))) {
switch (svga->dac_addr & ((ramdac->type >= BT485A) ? 0xff : 0x3f)) {
case 0x00:
default:
temp = ramdac->status | (svga->dac_status ? 0x04 : 0x00);
@@ -355,11 +355,20 @@ bt48x_recalctimings(void *p, svga_t *svga)
void
bt48x_hwcursor_draw(svga_t *svga, int displine)
{
int x, xx, comb, b0, b1;
int comb;
int b0;
int b1;
uint16_t dat[2];
int offset = svga->dac_hwcursor_latch.x - svga->dac_hwcursor_latch.xoff;
int pitch, bppl, mode, x_pos, y_pos;
uint32_t clr1, clr2, clr3, *p;
int pitch;
int bppl;
int mode;
int x_pos;
int y_pos;
uint32_t clr1;
uint32_t clr2;
uint32_t clr3;
uint32_t *p;
uint8_t *cd;
bt48x_ramdac_t *ramdac = (bt48x_ramdac_t *) svga->ramdac;
@@ -384,11 +393,11 @@ bt48x_hwcursor_draw(svga_t *svga, int displine)
else
cd = (uint8_t *) ramdac->cursor32_data;
for (x = 0; x < svga->dac_hwcursor_latch.cur_xsize; x += 16) {
for (int x = 0; x < svga->dac_hwcursor_latch.cur_xsize; x += 16) {
dat[0] = (cd[svga->dac_hwcursor_latch.addr] << 8) | cd[svga->dac_hwcursor_latch.addr + 1];
dat[1] = (cd[svga->dac_hwcursor_latch.addr + bppl] << 8) | cd[svga->dac_hwcursor_latch.addr + bppl + 1];
for (xx = 0; xx < 16; xx++) {
for (uint8_t xx = 0; xx < 16; xx++) {
b0 = (dat[0] >> (15 - xx)) & 1;
b1 = (dat[1] >> (15 - xx)) & 1;
comb = (b0 | (b1 << 1));

View File

@@ -175,7 +175,8 @@ void
cga_recalctimings(cga_t *cga)
{
double disptime;
double _dispontime, _dispofftime;
double _dispontime;
double _dispofftime;
if (cga->cgamode & 1) {
disptime = (double) (cga->crtc[0] + 1);
@@ -197,9 +198,13 @@ cga_poll(void *p)
cga_t *cga = (cga_t *) p;
uint16_t ca = (cga->crtc[15] | (cga->crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c, xs_temp, ys_temp;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
uint8_t border;
uint16_t dat;
int cols[4];
@@ -221,18 +226,18 @@ cga_poll(void *p)
cga->lastline = cga->displine;
for (c = 0; c < 8; c++) {
if ((cga->cgamode & 0x12) == 0x12) {
buffer32->line[(cga->displine << 1)][c] = buffer32->line[(cga->displine << 1) + 1][c] = 0;
buffer32->line[cga->displine << 1][c] = buffer32->line[(cga->displine << 1) + 1][c] = 0;
if (cga->cgamode & 1) {
buffer32->line[(cga->displine << 1)][c + (cga->crtc[1] << 3) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 3) + 8] = 0;
buffer32->line[cga->displine << 1][c + (cga->crtc[1] << 3) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 3) + 8] = 0;
} else {
buffer32->line[(cga->displine << 1)][c + (cga->crtc[1] << 4) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 4) + 8] = 0;
buffer32->line[cga->displine << 1][c + (cga->crtc[1] << 4) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 4) + 8] = 0;
}
} else {
buffer32->line[(cga->displine << 1)][c] = buffer32->line[(cga->displine << 1) + 1][c] = (cga->cgacol & 15) + 16;
buffer32->line[cga->displine << 1][c] = buffer32->line[(cga->displine << 1) + 1][c] = (cga->cgacol & 15) + 16;
if (cga->cgamode & 1) {
buffer32->line[(cga->displine << 1)][c + (cga->crtc[1] << 3) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 3) + 8] = (cga->cgacol & 15) + 16;
buffer32->line[cga->displine << 1][c + (cga->crtc[1] << 3) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 3) + 8] = (cga->cgacol & 15) + 16;
} else {
buffer32->line[(cga->displine << 1)][c + (cga->crtc[1] << 4) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 4) + 8] = (cga->cgacol & 15) + 16;
buffer32->line[cga->displine << 1][c + (cga->crtc[1] << 4) + 8] = buffer32->line[(cga->displine << 1) + 1][c + (cga->crtc[1] << 4) + 8] = (cga->cgacol & 15) + 16;
}
}
}
@@ -253,11 +258,11 @@ cga_poll(void *p)
cols[0] = (attr >> 4) + 16;
if (drawcursor) {
for (c = 0; c < 8; c++) {
buffer32->line[(cga->displine << 1)][(x << 3) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
buffer32->line[cga->displine << 1][(x << 3) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
}
} else {
for (c = 0; c < 8; c++) {
buffer32->line[(cga->displine << 1)][(x << 3) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[cga->displine << 1][(x << 3) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 3) + c + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
cga->ma++;
@@ -265,8 +270,8 @@ cga_poll(void *p)
} else if (!(cga->cgamode & 2)) {
for (x = 0; x < cga->crtc[1]; x++) {
if (cga->cgamode & 8) {
chr = cga->vram[((cga->ma << 1) & 0x3fff)];
attr = cga->vram[(((cga->ma << 1) + 1) & 0x3fff)];
chr = cga->vram[(cga->ma << 1) & 0x3fff];
attr = cga->vram[((cga->ma << 1) + 1) & 0x3fff];
} else
chr = attr = 0;
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron);
@@ -280,11 +285,11 @@ cga_poll(void *p)
cga->ma++;
if (drawcursor) {
for (c = 0; c < 8; c++) {
buffer32->line[(cga->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
}
} else {
for (c = 0; c < 8; c++) {
buffer32->line[(cga->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr + cga->fontbase][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
}
}
@@ -311,7 +316,7 @@ cga_poll(void *p)
dat = 0;
cga->ma++;
for (c = 0; c < 8; c++) {
buffer32->line[(cga->displine << 1)][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1)][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 8] = buffer32->line[cga->displine << 1][(x << 4) + (c << 1) + 1 + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
dat <<= 2;
}
}
@@ -325,7 +330,7 @@ cga_poll(void *p)
dat = 0;
cga->ma++;
for (c = 0; c < 16; c++) {
buffer32->line[(cga->displine << 1)][(x << 4) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15];
buffer32->line[cga->displine << 1][(x << 4) + c + 8] = buffer32->line[(cga->displine << 1) + 1][(x << 4) + c + 8] = cols[dat >> 15];
dat <<= 1;
}
}
@@ -352,7 +357,7 @@ cga_poll(void *p)
else
border = cga->cgacol & 0x0f;
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[(cga->displine << 1)]);
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[cga->displine << 1]);
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[(cga->displine << 1) + 1]);
} else {
video_process_8(x, cga->displine << 1);
@@ -489,11 +494,11 @@ cga_poll(void *p)
}
if (cga->cgadispon)
cga->cgastat &= ~1;
if ((cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 1))))
if (cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 1)))
cga->con = 1;
if (cga->cgadispon && (cga->cgamode & 1)) {
for (x = 0; x < (cga->crtc[1] << 1); x++)
cga->charbuffer[x] = cga->vram[(((cga->ma << 1) + x) & 0x3fff)];
cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff];
}
}
}

View File

@@ -75,7 +75,12 @@ double mode_hue;
double min_v;
double max_v;
double video_ri, video_rq, video_gi, video_gq, video_bi, video_bq;
double video_ri;
double video_rq;
double video_gi;
double video_gq;
double video_bi;
double video_bq;
int video_sharpness;
int tandy_mode_control = 0;
@@ -84,11 +89,18 @@ static bool new_cga = 0;
void
update_cga16_color(uint8_t cgamode)
{
int x;
double c, i, v;
double q, a, s, r;
double iq_adjust_i, iq_adjust_q;
double i0, i3, mode_saturation;
double c;
double i;
double v;
double q;
double a;
double s;
double r;
double iq_adjust_i;
double iq_adjust_q;
double i0;
double i3;
double mode_saturation;
static const double ri = 0.9563;
static const double rq = 0.6210;
@@ -117,7 +129,7 @@ update_cga16_color(uint8_t cgamode)
mode_brightness += (new_cga ? brightness - 10 : brightness) * 5; /* new CGA: -10 */
mode_saturation = (new_cga ? 4.35 : 2.9) * saturation / 100; /* new CGA: 150% */
for (x = 0; x < 1024; ++x) {
for (uint16_t x = 0; x < 1024; ++x) {
int phase = x & 3;
int right = (x >> 2) & 15;
int left = (x >> 6) & 15;
@@ -187,7 +199,8 @@ Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks /*, bool doublewi
int *b;
int *i;
Bit32u *srgb;
int *ap, *bp;
int *ap;
int *bp;
#define COMPOSITE_CONVERT(I, Q) \
do { \
@@ -257,7 +270,14 @@ Composite_Process(uint8_t cgamode, Bit8u border, Bit32u blocks /*, bool doublewi
i[0] = (i[0] << 3) - ap[0];
srgb = (Bit32u *) TempLine;
for (x2 = 0; x2 < blocks; ++x2) {
int y, a, b, c, d, rr, gg, bb;
int y;
int a;
int b;
int c;
int d;
int rr;
int gg;
int bb;
COMPOSITE_CONVERT(a, b);
COMPOSITE_CONVERT(-b, a);
COMPOSITE_CONVERT(-a, -b);

View File

@@ -515,22 +515,25 @@ gd54xx_overlay_draw(svga_t *svga, int displine)
gd54xx_t *gd54xx = (gd54xx_t *) svga->p;
int shift = (svga->crtc[0x27] >= CIRRUS_ID_CLGD5446) ? 2 : 0;
int h_acc = svga->overlay_latch.h_acc;
int r[8], g[8], b[8];
int x_read = 4, x_write = 4;
int x;
int r[8];
int g[8];
int b[8];
int x_read = 4;
int x_write = 4;
uint32_t *p;
uint8_t *src = &svga->vram[(svga->overlay_latch.addr << shift) & svga->vram_mask];
int bpp = svga->bpp;
int bytesperpix = (bpp + 7) / 8;
uint8_t *src2 = &svga->vram[(svga->ma - (svga->hdisp * bytesperpix)) & svga->vram_display_mask];
int occl, ckval;
int occl;
int ckval;
p = &((uint32_t *) svga->monitor->target_buffer->line[displine])[gd54xx->overlay.region1size + svga->x_add];
src2 += gd54xx->overlay.region1size * bytesperpix;
OVERLAY_SAMPLE();
for (x = 0; (x < gd54xx->overlay.region2size) && ((x + gd54xx->overlay.region1size) < svga->hdisp); x++) {
for (int x = 0; (x < gd54xx->overlay.region2size) && ((x + gd54xx->overlay.region1size) < svga->hdisp); x++) {
if (gd54xx->overlay.occlusion) {
occl = 1;
ckval = gd54xx->overlay.ck;
@@ -614,8 +617,8 @@ gd54xx_out(uint16_t addr, uint8_t val, void *p)
gd54xx_t *gd54xx = (gd54xx_t *) p;
svga_t *svga = &gd54xx->svga;
uint8_t old;
int c;
uint8_t o, index;
uint8_t o;
uint8_t index;
uint32_t o32;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1))
@@ -637,7 +640,7 @@ gd54xx_out(uint16_t addr, uint8_t val, void *p)
if (svga->attraddr < 16)
svga->fullchange = changeframecount;
if (svga->attraddr == 0x10 || svga->attraddr == 0x14 || svga->attraddr < 0x10) {
for (c = 0; c < 16; c++) {
for (uint8_t c = 0; c < 16; c++) {
if (svga->attrregs[0x10] & 0x80)
svga->egapal[c] = (svga->attrregs[c] & 0xf) | ((svga->attrregs[0x14] & 0xf) << 4);
else
@@ -1159,7 +1162,8 @@ gd54xx_in(uint16_t addr, void *p)
gd54xx_t *gd54xx = (gd54xx_t *) p;
svga_t *svga = &gd54xx->svga;
uint8_t index, ret = 0xff;
uint8_t index;
uint8_t ret = 0xff;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1))
addr ^= 0x60;
@@ -1550,7 +1554,8 @@ static void
gd543x_recalc_mapping(gd54xx_t *gd54xx)
{
svga_t *svga = &gd54xx->svga;
uint32_t base, size;
uint32_t base;
uint32_t size;
if ((gd54xx->pci && (!(gd54xx->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM))) || (gd54xx->mca && (!(gd54xx->pos_regs[2] & 1)))) {
mem_mapping_disable(&svga->mapping);
@@ -1630,7 +1635,7 @@ gd543x_recalc_mapping(gd54xx_t *gd54xx)
if ((svga->crtc[0x27] >= CIRRUS_ID_CLGD5436) && (gd54xx->blt.status & CIRRUS_BLT_APERTURE2) && ((gd54xx->blt.mode & (CIRRUS_BLTMODE_COLOREXPAND | CIRRUS_BLTMODE_MEMSYSSRC)) == (CIRRUS_BLTMODE_COLOREXPAND | CIRRUS_BLTMODE_MEMSYSSRC))) {
if (svga->crtc[0x27] == CIRRUS_ID_CLGD5480)
mem_mapping_set_addr(&gd54xx->aperture2_mapping, gd54xx->lfb_base + (16777216), 16777216);
mem_mapping_set_addr(&gd54xx->aperture2_mapping, gd54xx->lfb_base + 16777216, 16777216);
else
mem_mapping_set_addr(&gd54xx->aperture2_mapping, 0xbc000, 0x04000);
} else
@@ -1642,7 +1647,8 @@ static void
gd54xx_recalctimings(svga_t *svga)
{
gd54xx_t *gd54xx = (gd54xx_t *) svga->p;
uint8_t clocksel, rdmask;
uint8_t clocksel;
uint8_t rdmask;
uint8_t linedbl = svga->dispend * 9 / 10 >= svga->hdisp;
svga->rowoffset = (svga->crtc[0x13]) | (((int) (uint32_t) (svga->crtc[0x1b] & 0x10)) << 4);
@@ -1801,7 +1807,7 @@ gd54xx_recalctimings(svga_t *svga)
clocksel = (svga->miscout >> 2) & 3;
if (!gd54xx->vclk_n[clocksel] || !gd54xx->vclk_d[clocksel])
svga->clock = (cpuclock * (float) (1ull << 32)) / ((svga->miscout & 0xc) ? 28322000.0 : 25175000.0);
svga->clock = (cpuclock * (float) (1ULL << 32)) / ((svga->miscout & 0xc) ? 28322000.0 : 25175000.0);
else {
int n = gd54xx->vclk_n[clocksel] & 0x7f;
int d = (gd54xx->vclk_d[clocksel] & 0x3e) >> 1;
@@ -1818,7 +1824,7 @@ gd54xx_recalctimings(svga_t *svga)
break;
}
}
svga->clock = (cpuclock * (double) (1ull << 32)) / freq;
svga->clock = (cpuclock * (double) (1ULL << 32)) / freq;
}
svga->vram_display_mask = (svga->crtc[0x1b] & 2) ? gd54xx->vram_mask : 0x3ffff;
@@ -1828,7 +1834,9 @@ static void
gd54xx_hwcursor_draw(svga_t *svga, int displine)
{
gd54xx_t *gd54xx = (gd54xx_t *) svga->p;
int x, xx, comb, b0, b1;
int comb;
int b0;
int b1;
uint8_t dat[2];
int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff;
int pitch = (svga->hwcursor.cur_xsize == 64) ? 16 : 4;
@@ -1841,13 +1849,13 @@ gd54xx_hwcursor_draw(svga_t *svga, int displine)
if (svga->interlace && svga->hwcursor_oddeven)
svga->hwcursor_latch.addr += pitch;
for (x = 0; x < svga->hwcursor.cur_xsize; x += 8) {
for (int x = 0; x < svga->hwcursor.cur_xsize; x += 8) {
dat[0] = svga->vram[svga->hwcursor_latch.addr & svga->vram_display_mask];
if (svga->hwcursor.cur_xsize == 64)
dat[1] = svga->vram[(svga->hwcursor_latch.addr + 0x08) & svga->vram_display_mask];
else
dat[1] = svga->vram[(svga->hwcursor_latch.addr + 0x80) & svga->vram_display_mask];
for (xx = 0; xx < 8; xx++) {
for (uint8_t xx = 0; xx < 8; xx++) {
b0 = (dat[0] >> (7 - xx)) & 1;
b1 = (dat[1] >> (7 - xx)) & 1;
comb = (b1 | (b0 << 1));
@@ -1966,15 +1974,13 @@ gd54xx_mem_sys_dest_read(gd54xx_t *gd54xx)
static void
gd54xx_mem_sys_src_write(gd54xx_t *gd54xx, uint8_t val)
{
int i;
gd54xx->blt.sys_src32 &= ~(0xff << (gd54xx->blt.sys_cnt << 3));
gd54xx->blt.sys_src32 |= (val << (gd54xx->blt.sys_cnt << 3));
gd54xx->blt.sys_cnt = (gd54xx->blt.sys_cnt + 1) & 3;
if (gd54xx->blt.sys_cnt == 0) {
if ((gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) && !(gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)) {
for (i = 0; i < 32; i += 8)
for (uint8_t i = 0; i < 32; i += 8)
gd54xx_start_blit((gd54xx->blt.sys_src32 >> i) & 0xff, 8, gd54xx, &gd54xx->svga);
} else
gd54xx_start_blit(gd54xx->blt.sys_src32, 32, gd54xx, &gd54xx->svga);
@@ -2064,7 +2070,8 @@ gd54xx_writel(uint32_t addr, uint32_t val, void *p)
static void
gd54xx_write_modes45(svga_t *svga, uint8_t val, uint32_t addr)
{
uint32_t i, j;
uint32_t i;
uint32_t j;
switch (svga->writemode) {
case 4:
@@ -3152,7 +3159,8 @@ gd54xx_get_pixel_width(gd54xx_t *gd54xx)
static void
gd54xx_blit(gd54xx_t *gd54xx, uint8_t mask, uint8_t *dst, uint8_t target, int skip)
{
int is_transp, is_bgonly;
int is_transp;
int is_bgonly;
/* skip indicates whether or not it is a pixel to be skipped (used for left skip);
mask indicates transparency or not (only when transparent comparison is enabled):
@@ -3204,10 +3212,16 @@ gd54xx_transparent_comp(gd54xx_t *gd54xx, uint32_t xx, uint8_t src)
static void
gd54xx_pattern_copy(gd54xx_t *gd54xx)
{
uint8_t target, src, *dst;
int x, y, pattern_y, pattern_pitch;
uint32_t bitmask = 0, xx, pixel;
uint32_t srca, srca2, dsta;
uint8_t target;
uint8_t src;
uint8_t *dst;
int pattern_y;
int pattern_pitch;
uint32_t bitmask = 0;
uint32_t pixel;
uint32_t srca;
uint32_t srca2;
uint32_t dsta;
svga_t *svga = &gd54xx->svga;
pattern_pitch = gd54xx->blt.pixel_width << 3;
@@ -3234,18 +3248,18 @@ gd54xx_pattern_copy(gd54xx_t *gd54xx)
/* The boundary has to be equal to the size of the pattern. */
srca = (gd54xx->blt.src_addr & ~0x07) & svga->vram_mask;
for (y = 0; y <= gd54xx->blt.height; y++) {
for (uint16_t y = 0; y <= gd54xx->blt.height; y++) {
/* Go to the correct pattern line. */
srca2 = srca + (pattern_y * pattern_pitch);
pixel = 0;
for (x = 0; x <= gd54xx->blt.width; x += gd54xx->blt.pixel_width) {
for (uint16_t x = 0; x <= gd54xx->blt.width; x += gd54xx->blt.pixel_width) {
if (gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND) {
if (gd54xx->blt.modeext & CIRRUS_BLTMODEEXT_SOLIDFILL)
bitmask = 1;
else
bitmask = svga->vram[srca2 & svga->vram_mask] & (0x80 >> pixel);
}
for (xx = 0; xx < gd54xx->blt.pixel_width; xx++) {
for (int xx = 0; xx < gd54xx->blt.pixel_width; xx++) {
if (gd54xx->blt.mode & CIRRUS_BLTMODE_COLOREXPAND)
src = gd54xx_color_expand(gd54xx, bitmask, xx);
else {
@@ -3280,9 +3294,12 @@ gd54xx_reset_blit(gd54xx_t *gd54xx)
static void
gd54xx_mem_sys_src(gd54xx_t *gd54xx, uint32_t cpu_dat, uint32_t count)
{
uint8_t *dst, exp, target;
uint8_t *dst;
uint8_t exp;
uint8_t target;
int mask_shift;
uint32_t byte_pos, bitmask = 0;
uint32_t byte_pos;
uint32_t bitmask = 0;
svga_t *svga = &gd54xx->svga;
gd54xx->blt.ms_is_dest = 0;
@@ -3367,9 +3384,12 @@ gd54xx_mem_sys_src(gd54xx_t *gd54xx, uint32_t cpu_dat, uint32_t count)
static void
gd54xx_normal_blit(uint32_t count, gd54xx_t *gd54xx, svga_t *svga)
{
uint8_t src = 0, dst;
uint8_t src = 0;
uint8_t dst;
uint16_t width = gd54xx->blt.width;
int x_max = 0, shift = 0, mask = 0;
int x_max = 0;
int shift = 0;
int mask = 0;
uint32_t src_addr = gd54xx->blt.src_addr;
uint32_t dst_addr = gd54xx->blt.dst_addr;
@@ -3740,8 +3760,8 @@ gd54xx_reset(void *priv)
memset(svga->gdcreg, 0x00, sizeof(svga->gdcreg));
svga->crtc[0] = 63;
svga->crtc[6] = 255;
svga->dispontime = 1000ull << 32;
svga->dispofftime = 1000ull << 32;
svga->dispontime = 1000ULL << 32;
svga->dispofftime = 1000ULL << 32;
svga->bpp = 8;
io_removehandler(0x03c0, 0x0020, gd54xx_in, NULL, NULL, gd54xx_out, NULL, NULL, gd54xx);
@@ -3810,7 +3830,8 @@ static void
int id = info->local & 0xff;
int vram;
char *romfn = NULL;
char *romfn1 = NULL, *romfn2 = NULL;
char *romfn1 = NULL;
char *romfn2 = NULL;
memset(gd54xx, 0, sizeof(gd54xx_t));
gd54xx->pci = !!(info->flags & DEVICE_PCI);

View File

@@ -122,9 +122,11 @@ void
colorplus_poll(void *p)
{
colorplus_t *colorplus = (colorplus_t *) p;
int x, c;
int x;
int c;
int oldvc;
uint16_t dat0, dat1;
uint16_t dat0;
uint16_t dat1;
int cols[4];
int col;
int oldsc;
@@ -315,11 +317,11 @@ colorplus_poll(void *p)
}
if (colorplus->cga.cgadispon)
colorplus->cga.cgastat &= ~1;
if ((colorplus->cga.sc == (colorplus->cga.crtc[10] & 31) || ((colorplus->cga.crtc[8] & 3) == 3 && colorplus->cga.sc == ((colorplus->cga.crtc[10] & 31) >> 1))))
if (colorplus->cga.sc == (colorplus->cga.crtc[10] & 31) || ((colorplus->cga.crtc[8] & 3) == 3 && colorplus->cga.sc == ((colorplus->cga.crtc[10] & 31) >> 1)))
colorplus->cga.con = 1;
if (colorplus->cga.cgadispon && (colorplus->cga.cgamode & 1)) {
for (x = 0; x < (colorplus->cga.crtc[1] << 1); x++)
colorplus->cga.charbuffer[x] = colorplus->cga.vram[(((colorplus->cga.ma << 1) + x) & 0x3fff)];
colorplus->cga.charbuffer[x] = colorplus->cga.vram[((colorplus->cga.ma << 1) + x) & 0x3fff];
}
}
}

View File

@@ -69,7 +69,9 @@ compaq_cga_log(const char *fmt, ...)
void
compaq_cga_recalctimings(compaq_cga_t *self)
{
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
disptime = self->cga.crtc[0] + 1;
_dispontime = self->cga.crtc[1];
@@ -86,9 +88,13 @@ compaq_cga_poll(void *p)
compaq_cga_t *self = (compaq_cga_t *) p;
uint16_t ca = (self->cga.crtc[15] | (self->cga.crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c, xs_temp, ys_temp;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
uint8_t border;
uint8_t cols[4];
int oldsc;
@@ -176,8 +182,8 @@ compaq_cga_poll(void *p)
}
} else {
for (x = 0; x < self->cga.crtc[1]; x++) {
chr = self->cga.vram[((self->cga.ma << 1) & 0x3fff)];
attr = self->cga.vram[(((self->cga.ma << 1) + 1) & 0x3fff)];
chr = self->cga.vram[(self->cga.ma << 1) & 0x3fff];
attr = self->cga.vram[((self->cga.ma << 1) + 1) & 0x3fff];
drawcursor = ((self->cga.ma == ca) && self->cga.con && self->cga.cursoron);
if (vflags) {
@@ -380,12 +386,12 @@ compaq_cga_poll(void *p)
if (self->cga.cgadispon)
self->cga.cgastat &= ~1;
if ((self->cga.sc == (self->cga.crtc[10] & 31) || ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == ((self->cga.crtc[10] & 31) >> 1))))
if (self->cga.sc == (self->cga.crtc[10] & 31) || ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == ((self->cga.crtc[10] & 31) >> 1)))
self->cga.con = 1;
if (self->cga.cgadispon && (self->cga.cgamode & 1)) {
for (x = 0; x < (self->cga.crtc[1] << 1); x++)
self->cga.charbuffer[x] = self->cga.vram[(((self->cga.ma << 1) + x) & 0x3fff)];
self->cga.charbuffer[x] = self->cga.vram[((self->cga.ma << 1) + x) & 0x3fff];
}
}
}
@@ -394,7 +400,6 @@ void *
compaq_cga_init(const device_t *info)
{
int display_type;
int c;
compaq_cga_t *self = malloc(sizeof(compaq_cga_t));
memset(self, 0, sizeof(compaq_cga_t));
@@ -411,7 +416,7 @@ compaq_cga_init(const device_t *info)
io_sethandler(0x03d0, 0x0010, cga_in, NULL, NULL, cga_out, NULL, NULL, self);
if (info->local) {
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
mdaattr[c][0][0] = mdaattr[c][1][0] = mdaattr[c][1][1] = 16;
if (c & 8)
mdaattr[c][0][1] = 15 + 16;

View File

@@ -133,7 +133,8 @@ ddc_init(void *i2c)
memset(edid, 0, sizeof(edid_t));
uint8_t *edid_bytes = (uint8_t *) edid;
double horiz_mm = PIXEL_MM(800), vert_mm = PIXEL_MM(600);
double horiz_mm = PIXEL_MM(800);
double vert_mm = PIXEL_MM(600);
memset(&edid->magic[1], 0xff, sizeof(edid->magic) - 2);

View File

@@ -54,14 +54,17 @@ enum {
static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
static uint8_t ega_rotate[8][256];
static uint32_t pallook16[256], pallook64[256];
static int ega_type = 0, old_overscan_color = 0;
static uint32_t pallook16[256];
static uint32_t pallook64[256];
static int ega_type = 0;
static int old_overscan_color = 0;
uint8_t egaremap2bpp[256];
/* 3C2 controls default mode on EGA. On VGA, it determines monitor type (mono or colour):
7=CGA mode (200 lines), 9=EGA mode (350 lines), 8=EGA mode (200 lines). */
int egaswitchread, egaswitches = 9;
int egaswitchread;
int egaswitches = 9;
int update_overscan = 0;
uint8_t ega_in(uint16_t addr, void *p);
@@ -70,8 +73,8 @@ void
ega_out(uint16_t addr, uint8_t val, void *p)
{
ega_t *ega = (ega_t *) p;
int c;
uint8_t o, old;
uint8_t o;
uint8_t old;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(ega->miscout & 1))
addr ^= 0x60;
@@ -117,7 +120,7 @@ ega_out(uint16_t addr, uint8_t val, void *p)
if (ega->attraddr < 16)
ega->fullchange = changeframecount;
if (ega->attraddr == 0x10 || ega->attraddr == 0x14 || ega->attraddr < 0x10) {
for (c = 0; c < 16; c++) {
for (uint8_t c = 0; c < 16; c++) {
if (ega->attrregs[0x10] & 0x80)
ega->egapal[c] = (ega->attrregs[c] & 0xf) | ((ega->attrregs[0x14] & 0xf) << 4);
else
@@ -347,7 +350,9 @@ ega_recalctimings(ega_t *ega)
{
int clksel;
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
double crtcconst;
ega->vtotal = ega->crtc[6];
@@ -392,20 +397,20 @@ ega_recalctimings(ega_t *ega)
switch (clksel) {
case 0:
crtcconst = (cpuclock / 25175000.0 * (double) (1ull << 32));
crtcconst = (cpuclock / 25175000.0 * (double) (1ULL << 32));
break;
case 1:
crtcconst = (cpuclock / 28322000.0 * (double) (1ull << 32));
crtcconst = (cpuclock / 28322000.0 * (double) (1ULL << 32));
break;
case 4:
crtcconst = (cpuclock / 14318181.0 * (double) (1ull << 32));
crtcconst = (cpuclock / 14318181.0 * (double) (1ULL << 32));
break;
case 5:
crtcconst = (cpuclock / 16257000.0 * (double) (1ull << 32));
crtcconst = (cpuclock / 16257000.0 * (double) (1ULL << 32));
break;
case 7:
default:
crtcconst = (cpuclock / 36000000.0 * (double) (1ull << 32));
crtcconst = (cpuclock / 36000000.0 * (double) (1ULL << 32));
break;
}
if (!(ega->seqregs[1] & 1))
@@ -479,8 +484,10 @@ void
ega_poll(void *p)
{
ega_t *ega = (ega_t *) p;
int x, old_ma;
int wx = 640, wy = 350;
int x;
int old_ma;
int wx = 640;
int wy = 350;
uint32_t blink_delay;
if (!ega->linepos) {
@@ -575,10 +582,11 @@ ega_poll(void *p)
ega->vc++;
ega->vc &= 511;
if (ega->vc == ega->split) {
// TODO: Implement the hardware bug where the first scanline is drawn twice when the split happens
if (ega->interlace && ega->oddeven)
ega->ma = ega->maback = ega->ma_latch + (ega->rowoffset << 1);
ega->ma = ega->maback = ega->rowoffset << 1;
else
ega->ma = ega->maback = ega->ma_latch;
ega->ma = ega->maback = 0;
ega->ma <<= 2;
ega->maback <<= 2;
ega->sc = 0;
@@ -680,14 +688,16 @@ ega_poll(void *p)
void
ega_doblit(int wx, int wy, ega_t *ega)
{
int y_add = (enable_overscan) ? overscan_y : 0;
int x_add = (enable_overscan) ? overscan_x : 0;
int y_start = (enable_overscan) ? 0 : (overscan_y >> 1);
int x_start = (enable_overscan) ? 0 : (overscan_x >> 1);
int y_add = enable_overscan ? overscan_y : 0;
int x_add = enable_overscan ? overscan_x : 0;
int y_start = enable_overscan ? 0 : (overscan_y >> 1);
int x_start = enable_overscan ? 0 : (overscan_x >> 1);
int bottom = (overscan_y >> 1) + (ega->crtc[8] & 0x1f);
uint32_t *p;
int i, j;
int xs_temp, ys_temp;
int i;
int j;
int xs_temp;
int ys_temp;
if (ega->vres) {
y_add <<= 1;
@@ -773,7 +783,7 @@ ega_remap_cpu_addr(uint32_t inaddr, ega_t *ega)
a0mux |= 1;
}
switch ((ega->gdcreg[6] & 0xC)) {
switch (ega->gdcreg[6] & 0xC) {
case 0x0: // 128K A000
addr &= 0xFFFF;
// TODO: Confirm the behaviour of this on actual hardware
@@ -824,7 +834,10 @@ void
ega_write(uint32_t addr, uint8_t val, void *p)
{
ega_t *ega = (ega_t *) p;
uint8_t vala, valb, valc, vald;
uint8_t vala;
uint8_t valb;
uint8_t valc;
uint8_t vald;
int writemask2 = ega->writemask;
cycles -= video_timing_write_b;
@@ -996,7 +1009,10 @@ uint8_t
ega_read(uint32_t addr, void *p)
{
ega_t *ega = (ega_t *) p;
uint8_t temp, temp2, temp3, temp4;
uint8_t temp;
uint8_t temp2;
uint8_t temp3;
uint8_t temp4;
int readplane = ega->readplane;
cycles -= video_timing_read_b;
@@ -1037,7 +1053,9 @@ ega_read(uint32_t addr, void *p)
void
ega_init(ega_t *ega, int monitor_type, int is_mono)
{
int c, d, e;
int c;
int d;
int e;
ega->vram = malloc(0x40000);
ega->vrammask = 0x3ffff;
@@ -1166,7 +1184,7 @@ static void *
ega_standalone_init(const device_t *info)
{
ega_t *ega = malloc(sizeof(ega_t));
int monitor_type, c;
int monitor_type;
memset(ega, 0, sizeof(ega_t));
@@ -1211,7 +1229,7 @@ ega_standalone_init(const device_t *info)
}
if ((ega->bios_rom.rom[0x3ffe] == 0xaa) && (ega->bios_rom.rom[0x3fff] == 0x55)) {
for (c = 0; c < 0x2000; c++) {
for (uint16_t c = 0; c < 0x2000; c++) {
uint8_t temp = ega->bios_rom.rom[c];
ega->bios_rom.rom[c] = ega->bios_rom.rom[0x3fff - c];
ega->bios_rom.rom[0x3fff - c] = temp;

View File

@@ -33,7 +33,7 @@
int
ega_display_line(ega_t *ega)
{
int y_add = (enable_overscan) ? (overscan_y >> 1) : 0;
int y_add = enable_overscan ? (overscan_y >> 1) : 0;
unsigned int dl = ega->displine;
if (ega->crtc[9] & 0x1f)
@@ -47,12 +47,12 @@ ega_display_line(ega_t *ega)
void
ega_render_blank(ega_t *ega)
{
int x, xx;
int xx;
if ((ega->displine + ega->y_add) < 0)
return;
for (x = 0; x < (ega->hdisp + ega->scrollcache); x++) {
for (int x = 0; x < (ega->hdisp + ega->scrollcache); x++) {
switch (ega->seqregs[1] & 9) {
case 0:
for (xx = 0; xx < 9; xx++)
@@ -77,22 +77,20 @@ ega_render_blank(ega_t *ega)
void
ega_render_overscan_left(ega_t *ega)
{
int i;
if ((ega->displine + ega->y_add) < 0)
return;
if (ega->scrblank || (ega->hdisp == 0))
return;
for (i = 0; i < ega->x_add; i++)
for (int i = 0; i < ega->x_add; i++)
buffer32->line[ega->displine + ega->y_add][i] = ega->overscan_color;
}
void
ega_render_overscan_right(ega_t *ega)
{
int i, right;
int right;
if ((ega->displine + ega->y_add) < 0)
return;
@@ -101,7 +99,7 @@ ega_render_overscan_right(ega_t *ega)
return;
right = (overscan_x >> 1) + ega->scrollcache;
for (i = 0; i < right; i++)
for (int i = 0; i < right; i++)
buffer32->line[ega->displine + ega->y_add][ega->x_add + ega->hdisp + i] = ega->overscan_color;
}
@@ -132,7 +130,8 @@ ega_render_text(ega_t *ega)
int drawcursor = ((ega->ma == ega->ca) && ega->con && ega->cursoron);
uint32_t chr, attr;
uint32_t chr;
uint32_t attr;
if (!crtcreset) {
chr = ega->vram[addr];
attr = ega->vram[addr + 1];
@@ -141,11 +140,12 @@ ega_render_text(ega_t *ega)
uint32_t charaddr;
if (attr & 8)
charaddr = ega->charsetb + ((chr * 0x80));
charaddr = ega->charsetb + (chr * 0x80);
else
charaddr = ega->charseta + ((chr * 0x80));
charaddr = ega->charseta + (chr * 0x80);
int fg, bg;
int fg;
int bg;
if (drawcursor) {
bg = ega->pallook[ega->egapal[attr & 0x0f]];
fg = ega->pallook[ega->egapal[attr >> 4]];
@@ -236,7 +236,7 @@ ega_render_graphics(ega_t *ega)
| (edatlookup[(edat[2] >> inshift) & 3][(edat[3] >> inshift) & 3] << 2);
// FIXME: Confirm blink behaviour is actually XOR on real hardware
uint32_t p0 = ega->pallook[ega->egapal[((dat >> 4) & ega->plane_mask) ^ blinkmask]];
uint32_t p1 = ega->pallook[ega->egapal[((dat ) & ega->plane_mask) ^ blinkmask]];
uint32_t p1 = ega->pallook[ega->egapal[(dat & ega->plane_mask) ^ blinkmask]];
for (int subx = 0; subx < dotwidth; subx++)
p[outoffs + subx] = p0;
for (int subx = 0; subx < dotwidth; subx++)

View File

@@ -195,13 +195,13 @@ et3000_recalctimings(svga_t *svga)
case 1:
break;
case 3:
svga->clock = (cpuclock * (double) (1ull << 32)) / 40000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 40000000.0;
break;
case 5:
svga->clock = (cpuclock * (double) (1ull << 32)) / 65000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 65000000.0;
break;
default:
svga->clock = (cpuclock * (double) (1ull << 32)) / 36000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 36000000.0;
break;
}
}
@@ -237,7 +237,7 @@ et3000_init(const device_t *info)
dev->svga.packed_chain4 = 1;
return (dev);
return dev;
}
static void

View File

@@ -561,13 +561,13 @@ et4000_recalctimings(svga_t *svga)
case 1:
break;
case 3:
svga->clock = (cpuclock * (double) (1ull << 32)) / 40000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 40000000.0;
break;
case 5:
svga->clock = (cpuclock * (double) (1ull << 32)) / 65000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 65000000.0;
break;
default:
svga->clock = (cpuclock * (double) (1ull << 32)) / 36000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 36000000.0;
break;
}
@@ -747,7 +747,7 @@ et4000_init(const device_t *info)
dev->svga.packed_chain4 = 1;
return (dev);
return dev;
}
static void

View File

@@ -285,7 +285,7 @@ et4000w32p_out(uint16_t addr, uint8_t val, void *p)
}
}
if (((et4000->type == ET4000W32) && (svga->hwcursor.cur_xsize == 128))) {
if ((et4000->type == ET4000W32) && (svga->hwcursor.cur_xsize == 128)) {
switch (svga->bpp) {
case 8:
svga->hwcursor.xoff += 32;
@@ -437,7 +437,7 @@ et4000w32p_recalctimings(svga_t *svga)
if (svga->attrregs[0x16] & 0x20)
svga->hdisp <<= 1;
svga->clock = (cpuclock * (double) (1ull << 32)) / svga->getclock((svga->miscout >> 2) & 3, svga->clock_gen);
svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock((svga->miscout >> 2) & 3, svga->clock_gen);
if (et4000->type != ET4000W32P_DIAMOND) {
if ((svga->gdcreg[6] & 1) || (svga->attrregs[0x10] & 1)) {
@@ -463,7 +463,7 @@ et4000w32p_recalctimings(svga_t *svga)
if (!(svga->gdcreg[6] & 1) && !(svga->attrregs[0x10] & 1)) { /* Text mode */
svga->ma_latch--;
if ((svga->seqregs[1] & 8)) /*40 column*/
if (svga->seqregs[1] & 8) /*40 column*/
svga->hdisp += (svga->seqregs[1] & 1) ? 16 : 18;
else
svga->hdisp += (svga->seqregs[1] & 1) ? 8 : 9;
@@ -2080,7 +2080,9 @@ static void
et4000w32_blit(int count, int cpu_input, uint32_t src_dat, uint32_t mix_dat, et4000w32p_t *et4000)
{
svga_t *svga = &et4000->svga;
uint8_t pattern, source, dest;
uint8_t pattern;
uint8_t source;
uint8_t dest;
uint8_t rop;
uint8_t out;
int mixmap;
@@ -2255,7 +2257,10 @@ static void
et4000w32p_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et4000w32p_t *et4000)
{
svga_t *svga = &et4000->svga;
uint8_t pattern, source, dest, out;
uint8_t pattern;
uint8_t source;
uint8_t dest;
uint8_t out;
uint8_t rop;
int mixdat;
@@ -2449,7 +2454,9 @@ void
et4000w32p_hwcursor_draw(svga_t *svga, int displine)
{
et4000w32p_t *et4000 = (et4000w32p_t *) svga->p;
int x, offset, xx, xx2;
int offset;
int xx;
int xx2;
int shift = (et4000->adjust_cursor + 1);
int width = (svga->hwcursor_latch.cur_xsize - svga->hwcursor_latch.xoff);
int pitch = (svga->hwcursor_latch.cur_xsize == 128) ? 32 : 16;
@@ -2472,7 +2479,7 @@ et4000w32p_hwcursor_draw(svga_t *svga, int displine)
}
}
for (x = 0; x < (width - minus_width); x += x_acc) {
for (int x = 0; x < (width - minus_width); x += x_acc) {
dat = svga->vram[svga->hwcursor_latch.addr + (offset >> 2)];
xx = svga->hwcursor_latch.x + svga->x_add + x;

View File

@@ -179,9 +179,7 @@ f82c425_smartmap_add(int a, int b, int sat)
static void
f82c425_smartmap(f82c425_t *f82c425)
{
int i;
for (i = 0; i < 256; i++) {
for (uint16_t i = 0; i < 256; i++) {
uint8_t bg = f82c425_rgbi(i >> 4);
uint8_t fg = f82c425_rgbi(i & 0xf);
@@ -223,9 +221,7 @@ f82c425_smartmap(f82c425_t *f82c425)
static void
f82c425_colormap(f82c425_t *f82c425)
{
int i;
for (i = 0; i < 4; i++)
for (uint8_t i = 0; i < 4; i++)
colormap[i] = f82c425_makecol(5 * i, 0, f82c425->function & 0x80);
}
@@ -330,7 +326,8 @@ static void
f82c425_recalctimings(f82c425_t *f82c425)
{
double disptime;
double _dispontime, _dispofftime;
double _dispontime;
double _dispofftime;
if (f82c425->function & 0x08) {
cga_recalctimings(&f82c425->cga);
@@ -349,8 +346,9 @@ static void
f82c425_text_row(f82c425_t *f82c425)
{
uint32_t colors[2];
int x, c;
uint8_t chr, attr;
int c;
uint8_t chr;
uint8_t attr;
int drawcursor;
int cursorline;
int blink;
@@ -371,7 +369,7 @@ f82c425_text_row(f82c425_t *f82c425)
cursorline = ((f82c425->cga.crtc[0x0a] & 0x0F) <= sc) && ((f82c425->cga.crtc[0x0b] & 0x0F) >= sc);
}
for (x = 0; x < columns; x++) {
for (int x = 0; x < columns; x++) {
chr = f82c425->vram[(addr + 2 * x) & 0x3FFF];
attr = f82c425->vram[(addr + 2 * x + 1) & 0x3FFF];
drawcursor = ((ma == ca) && cursorline && (f82c425->cga.cgamode & 0x8) && (f82c425->cga.cgablink & 0x10));
@@ -409,7 +407,6 @@ f82c425_text_row(f82c425_t *f82c425)
static void
f82c425_cgaline6(f82c425_t *f82c425)
{
int x, c;
uint8_t dat;
uint16_t addr;
@@ -417,11 +414,11 @@ f82c425_cgaline6(f82c425_t *f82c425)
addr = ((f82c425->displine) & 1) * 0x2000 + (f82c425->displine >> 1) * 80 + ((ma & ~1) << 1);
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
dat = f82c425->vram[addr & 0x3FFF];
addr++;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
((uint32_t *) buffer32->line[f82c425->displine])[x * 8 + c] = colormap[dat & 0x80 ? 3 : 0];
dat = dat << 1;
@@ -433,18 +430,18 @@ f82c425_cgaline6(f82c425_t *f82c425)
static void
f82c425_cgaline4(f82c425_t *f82c425)
{
int x, c;
uint8_t dat, pattern;
uint8_t dat;
uint8_t pattern;
uint16_t addr;
uint16_t ma = (f82c425->cga.crtc[0x0d] | (f82c425->cga.crtc[0x0c] << 8)) & 0x3fff;
addr = ((f82c425->displine) & 1) * 0x2000 + (f82c425->displine >> 1) * 80 + ((ma & ~1) << 1);
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
dat = f82c425->vram[addr & 0x3FFF];
addr++;
for (c = 0; c < 4; c++) {
for (uint8_t c = 0; c < 4; c++) {
pattern = (dat & 0xC0) >> 6;
if (!(f82c425->cga.cgamode & 0x08))
pattern = 0;

View File

@@ -322,7 +322,8 @@ void
genius_recalctimings(genius_t *genius)
{
double disptime;
double _dispontime, _dispofftime;
double _dispontime;
double _dispofftime;
disptime = 0x31;
_dispontime = 0x28;
@@ -374,15 +375,24 @@ genius_textline(genius_t *genius, uint8_t background, int mda, int cols80)
{
int w = 80; /* 80 characters across */
int cw = 9; /* Each character is 9 pixels wide */
uint8_t chr, attr, sc, ctrl;
uint8_t *crtc, bitmap[2];
int x, blink, c, row, charh;
int drawcursor, cursorline;
uint8_t chr;
uint8_t attr;
uint8_t sc;
uint8_t ctrl;
uint8_t *crtc;
uint8_t bitmap[2];
int blink;
int c;
int row;
int charh;
int drawcursor;
int cursorline;
uint16_t addr;
uint16_t ma = (genius->mda_crtc[13] | (genius->mda_crtc[12] << 8)) & 0x3fff;
uint16_t ca = (genius->mda_crtc[15] | (genius->mda_crtc[14] << 8)) & 0x3fff;
unsigned char *framebuf = genius->vram + 0x10000;
uint32_t col, dl = genius->displine;
uint32_t col;
uint32_t dl = genius->displine;
/* Character height is 12-15 */
if (mda) {
@@ -437,7 +447,7 @@ genius_textline(genius_t *genius, uint8_t background, int mda, int cols80)
else
cursorline = ((crtc[10] & 0x1F) <= sc) && ((crtc[11] & 0x1F) >= sc);
for (x = 0; x < w; x++) {
for (int x = 0; x < w; x++) {
#if 0
if ((genius->genius_charh & 0x10) && ((addr + 2 * x) > 0x0FFF))
chr = 0x00;
@@ -549,9 +559,10 @@ genius_textline(genius_t *genius, uint8_t background, int mda, int cols80)
void
genius_cgaline(genius_t *genius)
{
int x, c;
uint32_t dat, addr;
uint8_t ink_f, ink_b;
uint32_t dat;
uint32_t addr;
uint8_t ink_f;
uint8_t ink_b;
ink_f = (genius->genius_control & 0x20) ? genius_pal[0] : genius_pal[3];
ink_b = (genius->genius_control & 0x20) ? genius_pal[3] : genius_pal[0];
@@ -564,11 +575,11 @@ genius_cgaline(genius_t *genius)
if ((genius->displine - 512) & 2)
addr += 0x2000;
for (x = 0; x < 80; x++) {
for (uint8_t x = 0; x < 80; x++) {
dat = genius->vram[addr];
addr++;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
if (dat & 0x80)
buffer32->line[genius->displine][(x << 3) + c] = ink_f;
else
@@ -583,9 +594,10 @@ genius_cgaline(genius_t *genius)
void
genius_hiresline(genius_t *genius)
{
int x, c;
uint32_t dat, addr;
uint8_t ink_f, ink_b;
uint32_t dat;
uint32_t addr;
uint8_t ink_f;
uint8_t ink_b;
ink_f = (genius->genius_control & 0x20) ? genius_pal[0] : genius_pal[3];
ink_b = (genius->genius_control & 0x20) ? genius_pal[3] : genius_pal[0];
@@ -596,10 +608,10 @@ genius_hiresline(genius_t *genius)
else /* The second 496 live at B8000 */
addr = 0x18000 + (128 * (genius->displine - 512));
for (x = 0; x < 91; x++) {
for (uint8_t x = 0; x < 91; x++) {
dat = genius->vram[addr + x];
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
if (dat & 0x80)
buffer32->line[genius->displine][(x << 3) + c] = ink_f;
else
@@ -614,7 +626,6 @@ void
genius_poll(void *p)
{
genius_t *genius = (genius_t *) p;
int x;
uint8_t background;
if (!genius->linepos) {
@@ -633,7 +644,7 @@ genius_poll(void *p)
video_wait_for_buffer();
/* Start off with a blank line */
for (x = 0; x < GENIUS_XSIZE; x++)
for (uint16_t x = 0; x < GENIUS_XSIZE; x++)
buffer32->line[genius->displine][x] = background;
/* If graphics display enabled, draw graphics on top
@@ -714,7 +725,6 @@ void
*
genius_init(const device_t *info)
{
int c;
genius_t *genius = malloc(sizeof(genius_t));
memset(genius, 0, sizeof(genius_t));
@@ -744,7 +754,7 @@ void
/* MDA attributes */
/* I don't know if the Genius's MDA emulation actually does
* emulate bright / non-bright. For the time being pretend it does. */
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
mdaattr[c][0][0] = mdaattr[c][1][0] = mdaattr[c][1][1] = genius_pal[0];
if (c & 8)
mdaattr[c][0][1] = genius_pal[3];

View File

@@ -39,7 +39,8 @@ static void
recalc_timings(hercules_t *dev)
{
double disptime;
double _dispontime, _dispofftime;
double _dispontime;
double _dispofftime;
disptime = dev->crtc[0] + 1;
_dispontime = dev->crtc[1];
@@ -187,7 +188,7 @@ hercules_in(uint16_t addr, void *priv)
break;
}
return (ret);
return ret;
}
static void
@@ -236,7 +237,6 @@ hercules_read(uint32_t addr, void *priv)
static void
hercules_render_overscan_left(hercules_t *dev)
{
int i;
uint32_t width;
if (dev->ctrl & 0x02)
@@ -250,14 +250,13 @@ hercules_render_overscan_left(hercules_t *dev)
if (width == 0)
return;
for (i = 0; i < 8; i++)
for (uint8_t i = 0; i < 8; i++)
buffer32->line[dev->displine + 14][i] = 0x00000000;
}
static void
hercules_render_overscan_right(hercules_t *dev)
{
int i;
uint32_t width;
if (dev->ctrl & 0x02)
@@ -271,7 +270,7 @@ hercules_render_overscan_right(hercules_t *dev)
if (width == 0)
return;
for (i = 0; i < 8; i++)
for (uint8_t i = 0; i < 8; i++)
buffer32->line[dev->displine + 14][8 + width + i] = 0x00000000;
}
@@ -279,11 +278,19 @@ static void
hercules_poll(void *priv)
{
hercules_t *dev = (hercules_t *) priv;
uint8_t chr, attr;
uint16_t ca, dat;
uint8_t chr;
uint8_t attr;
uint16_t ca;
uint16_t dat;
uint16_t pa;
int oldsc, blink;
int x, xx, y, yy, c, oldvc;
int oldsc;
int blink;
int x;
int xx;
int y;
int yy;
int c;
int oldvc;
int drawcursor;
uint32_t *p;
@@ -507,7 +514,7 @@ hercules_poll(void *priv)
dev->ma = dev->maback;
}
if ((dev->sc == (dev->crtc[10] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[10] & 31) >> 1))))
if (dev->sc == (dev->crtc[10] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[10] & 31) >> 1)))
dev->con = 1;
if (dev->dispon && !(dev->ctrl & 0x02)) {
for (x = 0; x < (dev->crtc[1] << 1); x++) {
@@ -523,7 +530,6 @@ static void *
hercules_init(const device_t *info)
{
hercules_t *dev;
int c;
dev = (hercules_t *) malloc(sizeof(hercules_t));
memset(dev, 0x00, sizeof(hercules_t));
@@ -543,7 +549,7 @@ hercules_init(const device_t *info)
io_sethandler(0x03b0, 16,
hercules_in, NULL, NULL, hercules_out, NULL, NULL, dev);
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
dev->cols[c][0][0] = dev->cols[c][1][0] = dev->cols[c][1][1] = 16;
if (c & 0x08)
@@ -578,7 +584,7 @@ hercules_init(const device_t *info)
/* Force the LPT3 port to be enabled. */
lpt3_init(0x3BC);
return (dev);
return dev;
}
static void

View File

@@ -103,7 +103,8 @@ static void
recalc_timings(herculesplus_t *dev)
{
double disptime;
double _dispontime, _dispofftime;
double _dispontime;
double _dispofftime;
disptime = dev->crtc[0] + 1;
_dispontime = dev->crtc[1];
@@ -214,9 +215,13 @@ herculesplus_read(uint32_t addr, void *priv)
static void
draw_char_rom(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
{
unsigned ull, val, ifg, ibg;
unsigned ull;
unsigned val;
unsigned ifg;
unsigned ibg;
const uint8_t *fnt;
int i, elg, blk;
int elg;
int blk;
int cw = HERCULESPLUS_CW;
blk = 0;
@@ -259,7 +264,7 @@ draw_char_rom(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
val |= (val >> 1) & 1;
}
for (i = 0; i < cw; i++) {
for (int i = 0; i < cw; i++) {
buffer32->line[dev->displine][x * cw + i] = (val & 0x100) ? ifg : ibg;
val = val << 1;
}
@@ -268,9 +273,13 @@ draw_char_rom(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
static void
draw_char_ram4(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
{
unsigned ull, val, ibg, cfg;
unsigned ull;
unsigned val;
unsigned ibg;
unsigned cfg;
const uint8_t *fnt;
int i, elg, blk;
int elg;
int blk;
int cw = HERCULESPLUS_CW;
int blink = dev->ctrl & HERCULESPLUS_CTRL_BLINK;
@@ -310,7 +319,7 @@ draw_char_ram4(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
val |= (val >> 1) & 1;
}
for (i = 0; i < cw; i++) {
for (int i = 0; i < cw; i++) {
/* Generate pixel colour */
cfg = 0;
@@ -326,9 +335,18 @@ draw_char_ram4(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
static void
draw_char_ram48(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
{
int i, elg, blk, ul, ol, bld;
unsigned ull, oll, ulc = 0, olc = 0;
unsigned val, ibg, cfg;
int elg;
int blk;
int ul;
int ol;
int bld;
unsigned ull;
unsigned oll;
unsigned ulc = 0;
unsigned olc = 0;
unsigned val;
unsigned ibg;
unsigned cfg;
const unsigned char *fnt;
int cw = HERCULESPLUS_CW;
int blink = dev->ctrl & HERCULESPLUS_CTRL_BLINK;
@@ -395,7 +413,7 @@ draw_char_ram48(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
val |= (val >> 1);
}
for (i = 0; i < cw; i++) {
for (int i = 0; i < cw; i++) {
/* Generate pixel colour */
cfg = val & 0x100;
if (dev->sc == oll)
@@ -414,11 +432,11 @@ static void
text_line(herculesplus_t *dev, uint16_t ca)
{
int drawcursor;
int x, c;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
uint32_t col;
for (x = 0; x < dev->crtc[1]; x++) {
for (uint8_t x = 0; x < dev->crtc[1]; x++) {
if (dev->ctrl & 8) {
chr = dev->vram[(dev->ma << 1) & 0xfff];
attr = dev->vram[((dev->ma << 1) + 1) & 0xfff];
@@ -447,7 +465,7 @@ text_line(herculesplus_t *dev, uint16_t ca)
int cw = HERCULESPLUS_CW;
col = dev->cols[attr][0][1];
for (c = 0; c < cw; c++)
for (int c = 0; c < cw; c++)
buffer32->line[dev->displine][x * cw + c] = col;
}
}
@@ -457,7 +475,8 @@ static void
graphics_line(herculesplus_t *dev)
{
uint16_t ca;
int x, c, plane = 0;
int c;
int plane = 0;
uint16_t val;
/* Graphics mode. */
@@ -465,7 +484,7 @@ graphics_line(herculesplus_t *dev)
if ((dev->ctrl & HERCULESPLUS_CTRL_PAGE1) && (dev->ctrl2 & HERCULESPLUS_CTRL2_PAGE1))
ca += 0x8000;
for (x = 0; x < dev->crtc[1]; x++) {
for (uint8_t x = 0; x < dev->crtc[1]; x++) {
if (dev->ctrl & 8)
val = (dev->vram[((dev->ma << 1) & 0x1fff) + ca + 0x10000 * plane] << 8)
| dev->vram[((dev->ma << 1) & 0x1fff) + ca + 0x10000 * plane + 1];
@@ -489,7 +508,9 @@ herculesplus_poll(void *priv)
{
herculesplus_t *dev = (herculesplus_t *) priv;
uint16_t ca = (dev->crtc[15] | (dev->crtc[14] << 8)) & 0x3fff;
int x, oldvc, oldsc;
int x;
int oldvc;
int oldsc;
VIDEO_MONITOR_PROLOGUE();
if (!dev->linepos) {
@@ -612,7 +633,7 @@ herculesplus_poll(void *priv)
dev->ma = dev->maback;
}
if ((dev->sc == (dev->crtc[10] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[10] & 31) >> 1))))
if (dev->sc == (dev->crtc[10] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[10] & 31) >> 1)))
dev->con = 1;
}
@@ -623,7 +644,6 @@ static void *
herculesplus_init(const device_t *info)
{
herculesplus_t *dev;
int c;
dev = (herculesplus_t *) malloc(sizeof(herculesplus_t));
memset(dev, 0, sizeof(herculesplus_t));
@@ -641,7 +661,7 @@ herculesplus_init(const device_t *info)
io_sethandler(0x03b0, 16,
herculesplus_in, NULL, NULL, herculesplus_out, NULL, NULL, dev);
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
dev->cols[c][0][0] = dev->cols[c][1][0] = dev->cols[c][1][1] = 16;
if (c & 8)
dev->cols[c][0][1] = 15 + 16;

View File

@@ -614,16 +614,16 @@ ht216_recalctimings(svga_t *svga)
case 1:
break;
case 4:
svga->clock = (cpuclock * (double) (1ull << 32)) / 50350000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 50350000.0;
break;
case 5:
svga->clock = (cpuclock * (double) (1ull << 32)) / 65000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 65000000.0;
break;
case 7:
svga->clock = (cpuclock * (double) (1ull << 32)) / 40000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 40000000.0;
break;
default:
svga->clock = (cpuclock * (double) (1ull << 32)) / 36000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 36000000.0;
break;
}
@@ -703,7 +703,7 @@ static void
ht216_hwcursor_draw(svga_t *svga, int displine)
{
ht216_t *ht216 = (ht216_t *) svga->p;
int x, shift = (ht216->adjust_cursor ? 2 : 1);
int shift = (ht216->adjust_cursor ? 2 : 1);
uint32_t dat[2];
int offset = svga->hwcursor_latch.x + svga->hwcursor_latch.xoff;
int width = (ht216->adjust_cursor ? 16 : 32);
@@ -717,7 +717,7 @@ ht216_hwcursor_draw(svga_t *svga, int displine)
dat[0] = (svga->vram[svga->hwcursor_latch.addr] << 24) | (svga->vram[svga->hwcursor_latch.addr + 1] << 16) | (svga->vram[svga->hwcursor_latch.addr + 2] << 8) | svga->vram[svga->hwcursor_latch.addr + 3];
dat[1] = (svga->vram[svga->hwcursor_latch.addr + 128] << 24) | (svga->vram[svga->hwcursor_latch.addr + 128 + 1] << 16) | (svga->vram[svga->hwcursor_latch.addr + 128 + 2] << 8) | svga->vram[svga->hwcursor_latch.addr + 128 + 3];
for (x = 0; x < width; x++) {
for (int x = 0; x < width; x++) {
if (!(dat[0] & 0x80000000))
((uint32_t *) buffer32->line[displine])[svga->x_add + offset + x] = 0;
if (dat[1] & 0x80000000)
@@ -796,10 +796,13 @@ static void
ht216_dm_write(ht216_t *ht216, uint32_t addr, uint8_t cpu_dat, uint8_t cpu_dat_unexpanded)
{
svga_t *svga = &ht216->svga;
int writemask2 = svga->writemask, reset_wm = 0;
int writemask2 = svga->writemask;
int reset_wm = 0;
latch_t vall;
uint8_t i, wm = svga->writemask;
uint8_t count = 4, fg_data[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t i;
uint8_t wm = svga->writemask;
uint8_t count = 4;
uint8_t fg_data[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
if (ht216->ht_regs[0xcd] & HT_REG_CD_P8PCEXP)
writemask2 = svga->seqregs[2];
@@ -984,8 +987,10 @@ ht216_dm_extalu_write(ht216_t *ht216, uint32_t addr, uint8_t cpu_dat, uint8_t bi
01 = Bit mask (3CF:8)
1x = (3C4:F5)*/
svga_t *svga = &ht216->svga;
uint8_t input_a = 0, input_b = 0;
uint8_t fg, bg;
uint8_t input_a = 0;
uint8_t input_b = 0;
uint8_t fg;
uint8_t bg;
uint8_t output;
uint32_t remapped_addr = dword_remap(svga, addr);
@@ -1024,7 +1029,8 @@ ht216_dm_masked_write(ht216_t *ht216, uint32_t addr, uint8_t val, uint8_t bit_ma
{
svga_t *svga = &ht216->svga;
int writemask2 = svga->writemask;
uint8_t count = 4, i;
uint8_t count = 4;
uint8_t i;
uint8_t full_mask = 0x0f;
if (ht216->ht_regs[0xcd] & HT_REG_CD_P8PCEXP)
@@ -1098,7 +1104,8 @@ ht216_write_common(ht216_t *ht216, uint32_t addr, uint8_t val)
*/
svga_t *svga = &ht216->svga;
int i;
uint8_t bit_mask = 0, rop_select = 0;
uint8_t bit_mask = 0;
uint8_t rop_select = 0;
cycles -= video_timing_write_b;
@@ -1287,11 +1294,12 @@ ht216_read_common(ht216_t *ht216, uint32_t addr)
{
svga_t *svga = &ht216->svga;
uint32_t latch_addr = 0;
int offset, readplane = svga->readplane;
uint8_t or, i;
uint8_t count = 2;
uint8_t plane, pixel;
uint8_t temp, ret;
int offset;
int readplane = svga->readplane;
uint8_t or;
uint8_t count = 2;
uint8_t temp;
uint8_t ret;
if (ht216->ht_regs[0xc8] & HT_REG_C8_MOVSB)
addr <<= 3;
@@ -1309,7 +1317,7 @@ ht216_read_common(ht216_t *ht216, uint32_t addr)
latch_addr = (addr & svga->vram_mask) & ~7;
if (ht216->ht_regs[0xcd] & HT_REG_CD_ASTODE)
latch_addr += (svga->gdcreg[3] & 7);
for (i = 0; i < 8; i++)
for (uint8_t i = 0; i < 8; i++)
ht216->bg_latch[i] = svga->vram[dword_remap(svga, latch_addr + i)];
return svga->vram[dword_remap(svga, addr) & svga->vram_mask];
} else if (svga->chain4) {
@@ -1332,22 +1340,22 @@ ht216_read_common(ht216_t *ht216, uint32_t addr)
latch_addr = addr & ~7;
if (ht216->ht_regs[0xcd] & HT_REG_CD_ASTODE) {
offset = addr & 7;
for (i = 0; i < 8; i++)
for (uint8_t i = 0; i < 8; i++)
ht216->bg_latch[i] = svga->vram[latch_addr | ((offset + i) & 7)];
} else {
for (i = 0; i < 8; i++)
for (uint8_t i = 0; i < 8; i++)
ht216->bg_latch[i] = svga->vram[latch_addr | i];
}
or = addr & 4;
for (i = 0; i < 4; i++)
for (uint8_t i = 0; i < 4; i++)
svga->latch.b[i] = ht216->bg_latch[i | or ];
if (svga->readmode) {
temp = 0xff;
for (pixel = 0; pixel < 8; pixel++) {
for (plane = 0; plane < (uint8_t)(1 << count); plane++) {
for (uint8_t pixel = 0; pixel < 8; pixel++) {
for (uint8_t plane = 0; plane < (uint8_t)(1 << count); plane++) {
if (svga->colournocare & (1 << plane)) {
/* If we care about a plane, and the pixel has a mismatch on it, clear its bit. */
if (((svga->latch.b[plane] >> pixel) & 1) != ((svga->colourcompare >> plane) & 1))

View File

@@ -74,7 +74,6 @@ typedef struct
void
ibm_rgb528_render_4bpp(svga_t *svga)
{
int x;
uint32_t *p;
ibm_rgb528_pixel32_t dat_out;
uint8_t dat;
@@ -98,7 +97,7 @@ ibm_rgb528_render_4bpp(svga_t *svga)
svga->firstline_draw = svga->displine;
svga->lastline_draw = svga->displine;
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
for (int x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
if (vram_size == 3) {
if (!(x & 31)) {
dat64 = *(uint64_t *) (&svga->vram[svga->ma]);
@@ -155,7 +154,6 @@ ibm_rgb528_render_4bpp(svga_t *svga)
void
ibm_rgb528_render_8bpp(svga_t *svga)
{
int x;
uint32_t *p;
ibm_rgb528_pixel32_t dat_out;
uint8_t dat;
@@ -177,7 +175,7 @@ ibm_rgb528_render_8bpp(svga_t *svga)
svga->firstline_draw = svga->displine;
svga->lastline_draw = svga->displine;
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
for (int x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
if (vram_size == 3) {
if (!(x & 15)) {
dat64 = *(uint64_t *) (&svga->vram[svga->ma]);
@@ -225,7 +223,6 @@ ibm_rgb528_render_8bpp(svga_t *svga)
void
ibm_rgb528_render_15_16bpp(svga_t *svga)
{
int x;
uint32_t *p;
ibm_rgb528_pixel16_t *dat_ex;
ibm_rgb528_pixel32_t dat_out;
@@ -242,7 +239,8 @@ ibm_rgb528_render_15_16bpp(svga_t *svga)
uint8_t b6bit_lin = ramdac->indexed_data[0x07] & 0x80;
uint8_t swaprb = ramdac->indexed_data[0x72] & 0x80;
uint8_t swap_word = ramdac->indexed_data[0x72] & 0x10;
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x01, temp;
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x01;
uint8_t temp;
if ((svga->displine + svga->y_add) < 0)
return;
@@ -257,7 +255,7 @@ ibm_rgb528_render_15_16bpp(svga_t *svga)
svga->firstline_draw = svga->displine;
svga->lastline_draw = svga->displine;
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
for (int x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
if (vram_size == 2) {
if (!(x & 7)) {
dat64 = *(uint64_t *) (&svga->vram[svga->ma]);
@@ -350,7 +348,6 @@ ibm_rgb528_render_15_16bpp(svga_t *svga)
void
ibm_rgb528_render_24bpp(svga_t *svga)
{
int x;
uint32_t *p;
ibm_rgb528_pixel32_t *dat_ex;
uint32_t dat;
@@ -361,7 +358,8 @@ ibm_rgb528_render_24bpp(svga_t *svga)
uint8_t swaprb = ramdac->indexed_data[0x72] & 0x80;
uint8_t swap_word = ramdac->indexed_data[0x72] & 0x10;
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x01;
uint8_t b6bit_lin = ramdac->indexed_data[0x07] & 0x80, temp;
uint8_t b6bit_lin = ramdac->indexed_data[0x07] & 0x80;
uint8_t temp;
if ((svga->displine + svga->y_add) < 0)
return;
@@ -373,7 +371,7 @@ ibm_rgb528_render_24bpp(svga_t *svga)
svga->firstline_draw = svga->displine;
svga->lastline_draw = svga->displine;
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
for (int x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
dat_ex = (ibm_rgb528_pixel32_t *) &dat;
if (vram_size == 3) {
if ((x & 15) == 0) {
@@ -392,7 +390,7 @@ ibm_rgb528_render_24bpp(svga_t *svga)
dat64[5] = (dat64[5] << 32ULL) | (dat64[5] >> 32ULL);
}
}
dat_ex = (ibm_rgb528_pixel32_t *) &(dat8[((x & 15) * 3)]);
dat_ex = (ibm_rgb528_pixel32_t *) &(dat8[(x & 15) * 3]);
} else if (vram_size == 1) {
if ((x & 7) == 0) {
dat64[0] = *(uint64_t *) (&svga->vram[svga->ma & svga->vram_display_mask]);
@@ -404,7 +402,7 @@ ibm_rgb528_render_24bpp(svga_t *svga)
dat64[2] = (dat64[2] << 32ULL) | (dat64[2] >> 32ULL);
}
}
dat_ex = (ibm_rgb528_pixel32_t *) &(dat8[((x & 7) * 3)]);
dat_ex = (ibm_rgb528_pixel32_t *) &(dat8[(x & 7) * 3]);
} else
dat = 0x00000000;
if (swaprb) {
@@ -439,7 +437,6 @@ ibm_rgb528_render_24bpp(svga_t *svga)
void
ibm_rgb528_render_32bpp(svga_t *svga)
{
int x;
uint32_t *p;
ibm_rgb528_pixel32_t *dat_ex;
uint32_t dat = 0x00000000;
@@ -451,7 +448,8 @@ ibm_rgb528_render_32bpp(svga_t *svga)
uint8_t swaprb = ramdac->indexed_data[0x72] & 0x80;
uint8_t swap_word = ramdac->indexed_data[0x72] & 0x10;
uint8_t vram_size = ramdac->indexed_data[0x70] & 0x01;
uint8_t b6bit_lin = ramdac->indexed_data[0x07] & 0x80, temp;
uint8_t b6bit_lin = ramdac->indexed_data[0x07] & 0x80;
uint8_t temp;
if ((svga->displine + svga->y_add) < 0)
return;
@@ -463,7 +461,7 @@ ibm_rgb528_render_32bpp(svga_t *svga)
svga->firstline_draw = svga->displine;
svga->lastline_draw = svga->displine;
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
for (int x = 0; x <= (svga->hdisp + svga->scrollcache); x++) {
if (vram_size == 3) {
if (!(x & 3)) {
dat64 = *(uint64_t *) (&svga->vram[svga->ma]);
@@ -489,7 +487,7 @@ ibm_rgb528_render_32bpp(svga_t *svga)
dat_ex->r = dat_ex->b;
dat_ex->b = temp;
}
if ((b32_dcol < 0x03) && (by32_pol))
if ((b32_dcol < 0x03) && by32_pol)
dat ^= 0x01000000;
if ((b32_dcol == 0x00) || ((b32_dcol == 0x01) && !(dat & 0x01000000))) {
dat_ex->a = 0x00;
@@ -825,8 +823,12 @@ ibm_rgb528_recalctimings(void *p, svga_t *svga)
void
ibm_rgb528_hwcursor_draw(svga_t *svga, int displine)
{
uint8_t dat, four_pixels = 0x00;
int x, pitch, x_pos, y_pos, offset = svga->dac_hwcursor_latch.x - svga->dac_hwcursor_latch.xoff;
uint8_t dat;
uint8_t four_pixels = 0x00;
int pitch;
int x_pos;
int y_pos;
int offset = svga->dac_hwcursor_latch.x - svga->dac_hwcursor_latch.xoff;
uint32_t *p;
ibm_rgb528_ramdac_t *ramdac = (ibm_rgb528_ramdac_t *) svga->ramdac;
uint8_t pix_ordr = ramdac->indexed_data[0x30] & 0x20;
@@ -844,7 +846,7 @@ ibm_rgb528_hwcursor_draw(svga_t *svga, int displine)
x_pos = offset + svga->x_add;
p = buffer32->line[y_pos];
for (x = 0; x < svga->dac_hwcursor_latch.cur_xsize; x++) {
for (int x = 0; x < svga->dac_hwcursor_latch.cur_xsize; x++) {
if (!(x & 3))
four_pixels = ramdac->indexed_data[svga->dac_hwcursor_latch.addr];

View File

@@ -61,8 +61,16 @@ icd2061_write(void *p, int val)
{
icd2061_t *icd2061 = (icd2061_t *) p;
int nd, oc, nc;
int a, qa, q, pa, p_, m, ps;
int nd;
int oc;
int nc;
int a;
int qa;
int q;
int pa;
int p_;
int m;
int ps;
nd = (val & 2) >> 1; /* Old data. */
oc = icd2061->state & 1; /* Old clock. */

View File

@@ -45,7 +45,8 @@ void
ics2595_write(void *p, int strobe, int dat)
{
ics2595_t *ics2595 = (ics2595_t *) p;
int d, n;
int d;
int n;
int l;
if (strobe) {

View File

@@ -147,7 +147,7 @@ fifo_read(im1024_t *dev)
im1024_log("IM1024: fifo_read: %02x\n", ret);
return (ret);
return ret;
}
/*
@@ -168,12 +168,12 @@ input_byte(pgc_t *pgc, uint8_t *result)
}
if (pgc->stopped)
return (0);
return 0;
if (pgc->mapram[0x3ff]) {
/* Reset triggered. */
pgc_reset(pgc);
return (0);
return 0;
}
if (dev->fifo_wrptr == dev->fifo_rdptr) {
@@ -182,7 +182,7 @@ input_byte(pgc_t *pgc, uint8_t *result)
} else
*result = fifo_read(dev);
return (1);
return 1;
}
/* Macros to disable clipping and save clip state. */
@@ -214,7 +214,7 @@ im1024_read(uint32_t addr, void *priv)
if (addr == 0xc6331 && dev->pgc.mapram[0x330] == 1) {
/* Hardcode that there are 128 bytes free. */
return (0x80);
return 0x80;
}
return (pgc_read(addr, &dev->pgc));
@@ -255,8 +255,10 @@ hndl_imgsiz(pgc_t *pgc)
#if 0
im1024_t *dev = (im1024_t *)pgc;
#endif
int16_t w, h;
uint8_t a, b;
int16_t w;
int16_t h;
uint8_t a;
uint8_t b;
if (!pgc_param_word(pgc, &w))
return;
@@ -318,7 +320,8 @@ hndl_linfun(pgc_t *pgc)
static void
hndl_pan(pgc_t *pgc)
{
int16_t x, y;
int16_t x;
int16_t y;
if (!pgc_param_word(pgc, &x))
return;
@@ -335,7 +338,8 @@ hndl_pan(pgc_t *pgc)
static void
hndl_pline(pgc_t *pgc)
{
int16_t x[257], y[257];
int16_t x[257];
int16_t y[257];
uint16_t linemask = pgc->line_pattern;
uint8_t count;
unsigned n;
@@ -405,9 +409,12 @@ blkmov_row(pgc_t *pgc, int16_t x0, int16_t x1, int16_t x2, int16_t sy, int16_t t
static void
hndl_blkmov(pgc_t *pgc)
{
int16_t x0, y0;
int16_t x1, y1;
int16_t x2, y2;
int16_t x0;
int16_t y0;
int16_t x1;
int16_t y1;
int16_t x2;
int16_t y2;
int16_t y;
if (!pgc_param_word(pgc, &x0))
@@ -451,7 +458,8 @@ hndl_blkmov(pgc_t *pgc)
static void
hndl_ellipse(pgc_t *pgc)
{
int16_t x, y;
int16_t x;
int16_t y;
if (!pgc_param_word(pgc, &x))
return;
@@ -471,7 +479,8 @@ hndl_ellipse(pgc_t *pgc)
static void
hndl_move(pgc_t *pgc)
{
int16_t x, y;
int16_t x;
int16_t y;
if (!pgc_param_word(pgc, &x))
return;
@@ -491,7 +500,8 @@ hndl_move(pgc_t *pgc)
static void
hndl_draw(pgc_t *pgc)
{
int16_t x, y;
int16_t x;
int16_t y;
if (!pgc_param_word(pgc, &x))
return;
@@ -513,10 +523,16 @@ hndl_draw(pgc_t *pgc)
static void
hndl_poly(pgc_t *pgc)
{
int32_t *x, *y, *nx, *ny;
int16_t xw, yw, mask;
int32_t *x;
int32_t *y;
int32_t *nx;
int32_t *ny;
int16_t xw;
int16_t yw;
int16_t mask;
unsigned realcount = 0;
unsigned n, as = 256;
unsigned n;
unsigned as = 256;
int parsing = 1;
uint8_t count;
@@ -596,7 +612,7 @@ hndl_poly(pgc_t *pgc)
/* Swallow the POLY. */
pgc->clcur->rdptr++;
}
};
}
im1024_log("IM1024: POLY (%i) fill_mode=%i\n", realcount, pgc->fill_mode);
#ifdef ENABLE_IM1024_LOG
@@ -648,7 +664,12 @@ parse_poly(pgc_t *pgc, pgc_cl_t *cl, int c)
static void
hndl_rect(pgc_t *pgc)
{
int16_t x0, y0, x1, y1, p, q;
int16_t x0;
int16_t y0;
int16_t x1;
int16_t y1;
int16_t p;
int16_t q;
x0 = pgc->x >> 16;
y0 = pgc->y >> 16;
@@ -698,9 +719,11 @@ static void
hndl_tdefin(pgc_t *pgc)
{
im1024_t *dev = (im1024_t *) pgc;
uint8_t ch, bt;
uint8_t rows, cols;
unsigned len, n;
uint8_t ch;
uint8_t bt;
uint8_t rows;
uint8_t cols;
unsigned len;
if (!pgc_param_byte(pgc, &ch))
return;
@@ -713,7 +736,7 @@ hndl_tdefin(pgc_t *pgc)
ch, rows, cols, pgc->mapram[0x300], pgc->mapram[0x301]);
len = ((cols + 7) / 8) * rows;
for (n = 0; n < len; n++) {
for (unsigned int n = 0; n < len; n++) {
if (!pgc_param_byte(pgc, &bt))
return;
@@ -742,8 +765,11 @@ hndl_twrite(pgc_t *pgc)
{
uint8_t buf[256];
im1024_t *dev = (im1024_t *) pgc;
uint8_t count, mask, *row;
int x, y, wb, n;
uint8_t count;
uint8_t mask;
uint8_t *row;
int wb;
int n;
int16_t x0 = pgc->x >> 16;
int16_t y0 = pgc->y >> 16;
@@ -764,10 +790,10 @@ hndl_twrite(pgc_t *pgc)
im1024_log("IM1024: ch=0x%02x w=%i h=%i wb=%i\n",
buf[n], dev->fontx[buf[n]], dev->fonty[buf[n]], wb);
for (y = 0; y < dev->fonty[buf[n]]; y++) {
for (uint8_t y = 0; y < dev->fonty[buf[n]]; y++) {
mask = 0x80;
row = &dev->font[buf[n]][y * wb];
for (x = 0; x < dev->fontx[buf[n]]; x++) {
for (uint8_t x = 0; x < dev->fontx[buf[n]]; x++) {
if (row[0] & mask)
pgc_plot(pgc, x + x0, y0 - y);
mask = mask >> 1;
@@ -786,11 +812,12 @@ static void
hndl_txt88(pgc_t *pgc)
{
uint8_t buf[256];
uint8_t count, mask, *row;
uint8_t count;
uint8_t mask;
uint8_t *row;
int16_t x0 = pgc->x >> 16;
int16_t y0 = pgc->y >> 16;
unsigned n;
int x, y;
if (!pgc_param_byte(pgc, &count))
return;
@@ -807,10 +834,10 @@ hndl_txt88(pgc_t *pgc)
for (n = 0; n < count; n++) {
im1024_log("ch=0x%02x w=12 h=18\n", buf[n]);
for (y = 0; y < 18; y++) {
for (uint8_t y = 0; y < 18; y++) {
mask = 0x80;
row = &fontdat12x18[buf[n]][y * 2];
for (x = 0; x < 12; x++) {
for (uint8_t x = 0; x < 12; x++) {
if (row[0] & mask)
pgc_plot(pgc, x + x0, y0 - y);
mask = mask >> 1;
@@ -828,9 +855,15 @@ hndl_txt88(pgc_t *pgc)
static void
hndl_imagew(pgc_t *pgc)
{
int16_t vp_x1, vp_y1, vp_x2, vp_y2;
int16_t row1, col1, col2;
uint8_t v1, v2;
int16_t vp_x1;
int16_t vp_y1;
int16_t vp_x2;
int16_t vp_y2;
int16_t row1;
int16_t col1;
int16_t col2;
uint8_t v1;
uint8_t v2;
if (!pgc_param_word(pgc, &row1))
return;
@@ -908,8 +941,8 @@ hndl_imagew(pgc_t *pgc)
static void
hndl_dot(pgc_t *pgc)
{
int16_t x = pgc->x >> 16,
y = pgc->y >> 16;
int16_t x = pgc->x >> 16;
int16_t y = pgc->y >> 16;
pgc_sto_raster(pgc, &x, &y);
@@ -928,8 +961,10 @@ hndl_dot(pgc_t *pgc)
static void
hndl_imagex(pgc_t *pgc)
{
int16_t x0, x1, y0, y1;
int16_t p, q;
int16_t x0;
int16_t x1;
int16_t y0;
int16_t y1;
if (!pgc_param_word(pgc, &x0))
return;
@@ -943,8 +978,8 @@ hndl_imagex(pgc_t *pgc)
/* Already using raster coordinates, no need to convert. */
im1024_log("IM1024: IMAGEX (%i,%i,%i,%i)\n", x0, y0, x1, y1);
for (p = y0; p <= y1; p++) {
for (q = x0; q <= x1; q++) {
for (int16_t p = y0; p <= y1; p++) {
for (int16_t q = x0; q <= x1; q++) {
if (!pgc_result_byte(pgc, pgc_read_pixel(pgc, q, p)))
return;
}
@@ -1020,7 +1055,7 @@ im1024_init(const device_t *info)
video_inform(VIDEO_FLAG_TYPE_CGA, &timing_im1024);
return (dev);
return dev;
}
static void

View File

@@ -186,7 +186,8 @@ static void
recalc_timings(incolor_t *dev)
{
double disptime;
double _dispontime, _dispofftime;
double _dispontime;
double _dispofftime;
disptime = dev->crtc[0] + 1;
_dispontime = dev->crtc[1];
@@ -299,10 +300,8 @@ incolor_write(uint32_t addr, uint8_t val, void *priv)
unsigned char fg = dev->crtc[INCOLOR_CRTC_RWCOL] & 0x0F;
unsigned char bg = (dev->crtc[INCOLOR_CRTC_RWCOL] >> 4) & 0x0F;
unsigned char w = 0;
unsigned char vmask; /* Mask of bit within byte */
unsigned char pmask; /* Mask of plane within colour value */
unsigned char latch;
int plane;
addr &= 0xffff;
@@ -319,13 +318,13 @@ incolor_write(uint32_t addr, uint8_t val, void *priv)
* 3: 1 => source latch, 0 => ~source latch
*/
pmask = 1;
for (plane = 0; plane < 4; pmask <<= 1, wmask >>= 1, addr += 0x10000, plane++) {
for (uint8_t plane = 0; plane < 4; pmask <<= 1, wmask >>= 1, addr += 0x10000, plane++) {
if (wmask & 0x10) /* Ignore writes to selected plane */
{
continue;
}
latch = dev->latch[plane];
for (vmask = 0x80; vmask != 0; vmask >>= 1) {
for (unsigned char vmask = 0x80 /* Mask of bit within byte */; vmask != 0; vmask >>= 1) {
switch (wmode) {
case 0x00:
if (val & vmask)
@@ -375,7 +374,7 @@ incolor_read(uint32_t addr, void *priv)
unsigned char dc; /* "don't care" register */
unsigned char bg; /* background colour */
unsigned char fg;
unsigned char mask, pmask;
unsigned char pmask;
addr &= 0xffff;
@@ -393,7 +392,7 @@ incolor_read(uint32_t addr, void *priv)
}
/* For each pixel, work out if its colour matches the background */
for (mask = 0x80; mask != 0; mask >>= 1) {
for (unsigned char mask = 0x80; mask != 0; mask >>= 1) {
fg = 0;
dc = dev->crtc[INCOLOR_CRTC_RWCTRL] & 0x0F;
bg = (dev->crtc[INCOLOR_CRTC_RWCOL] >> 4) & 0x0F;
@@ -417,13 +416,15 @@ incolor_read(uint32_t addr, void *priv)
static void
draw_char_rom(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
{
int i;
int elg, blk;
int elg;
int blk;
unsigned ull;
unsigned val;
unsigned ifg, ibg;
unsigned ifg;
unsigned ibg;
const unsigned char *fnt;
uint32_t fg, bg;
uint32_t fg;
uint32_t bg;
int cw = INCOLOR_CW;
blk = 0;
@@ -488,7 +489,7 @@ draw_char_rom(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
val |= (val >> 1) & 1;
}
}
for (i = 0; i < cw; i++) {
for (int i = 0; i < cw; i++) {
buffer32->line[dev->displine][x * cw + i] = (val & 0x100) ? fg : bg;
val = val << 1;
}
@@ -497,11 +498,14 @@ draw_char_rom(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
static void
draw_char_ram4(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
{
int i;
int elg, blk;
int elg;
int blk;
unsigned ull;
unsigned val[4];
unsigned ifg, ibg, cfg, pmask, plane;
unsigned ifg;
unsigned ibg;
unsigned cfg;
unsigned pmask;
const unsigned char *fnt;
uint32_t fg;
int cw = INCOLOR_CW;
@@ -569,11 +573,11 @@ draw_char_ram4(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
val[3] |= (val[3] >> 1) & 1;
}
}
for (i = 0; i < cw; i++) {
for (int i = 0; i < cw; i++) {
/* Generate pixel colour */
cfg = 0;
pmask = 1;
for (plane = 0; plane < 4; plane++, pmask = pmask << 1) {
for (uint8_t plane = 0; plane < 4; plane++, pmask = pmask << 1) {
if (val[plane] & 0x100)
cfg |= (ifg & pmask);
else
@@ -599,11 +603,20 @@ draw_char_ram4(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
static void
draw_char_ram48(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
{
int i;
int elg, blk, ul, ol, bld;
unsigned ull, oll, ulc = 0, olc = 0;
int elg;
int blk;
int ul;
int ol;
int bld;
unsigned ull;
unsigned oll;
unsigned ulc = 0;
unsigned olc = 0;
unsigned val[4];
unsigned ifg = 0, ibg, cfg, pmask, plane;
unsigned ifg = 0;
unsigned ibg;
unsigned cfg;
unsigned pmask;
const unsigned char *fnt;
uint32_t fg;
int cw = INCOLOR_CW;
@@ -692,7 +705,7 @@ draw_char_ram48(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
val[3] |= (val[3] >> 1);
}
}
for (i = 0; i < cw; i++) {
for (int i = 0; i < cw; i++) {
/* Generate pixel colour */
cfg = 0;
pmask = 1;
@@ -701,7 +714,7 @@ draw_char_ram48(incolor_t *dev, int x, uint8_t chr, uint8_t attr)
} else if (dev->sc == ull) {
cfg = ulc ^ ibg; /* Underline */
} else {
for (plane = 0; plane < 4; plane++, pmask = pmask << 1) {
for (uint8_t plane = 0; plane < 4; plane++, pmask = pmask << 1) {
if (val[plane] & 0x100) {
if (altattr)
cfg |= ((~ibg) & pmask);
@@ -729,11 +742,11 @@ static void
text_line(incolor_t *dev, uint16_t ca)
{
int drawcursor;
int x, c;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
uint32_t col;
for (x = 0; x < dev->crtc[1]; x++) {
for (uint8_t x = 0; x < dev->crtc[1]; x++) {
if (dev->ctrl & 8) {
chr = dev->vram[(dev->ma << 1) & 0xfff];
attr = dev->vram[((dev->ma << 1) + 1) & 0xfff];
@@ -774,7 +787,7 @@ text_line(incolor_t *dev, uint16_t ca)
} else {
col = dev->rgb[defpal[ink]];
}
for (c = 0; c < cw; c++) {
for (int c = 0; c < cw; c++) {
buffer32->line[dev->displine][x * cw + c] = col;
}
}
@@ -786,7 +799,8 @@ graphics_line(incolor_t *dev)
{
uint8_t mask;
uint16_t ca;
int x, c, plane, col;
int plane;
int col;
uint8_t ink;
uint16_t val[4];
@@ -795,7 +809,7 @@ graphics_line(incolor_t *dev)
if ((dev->ctrl & INCOLOR_CTRL_PAGE1) && (dev->ctrl2 & INCOLOR_CTRL2_PAGE1))
ca += 0x8000;
for (x = 0; x < dev->crtc[1]; x++) {
for (uint8_t x = 0; x < dev->crtc[1]; x++) {
mask = dev->crtc[INCOLOR_CRTC_MASK]; /* Planes to display */
for (plane = 0; plane < 4; plane++, mask = mask >> 1) {
if (dev->ctrl & 8) {
@@ -808,7 +822,7 @@ graphics_line(incolor_t *dev)
}
dev->ma++;
for (c = 0; c < 16; c++) {
for (uint8_t c = 0; c < 16; c++) {
ink = 0;
for (plane = 0; plane < 4; plane++) {
ink = ink >> 1;
@@ -952,7 +966,7 @@ incolor_poll(void *priv)
dev->ma = dev->maback;
}
if ((dev->sc == (dev->crtc[10] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[10] & 31) >> 1))))
if (dev->sc == (dev->crtc[10] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[10] & 31) >> 1)))
dev->con = 1;
}
}

View File

@@ -105,7 +105,9 @@ mda_read(uint32_t addr, void *p)
void
mda_recalctimings(mda_t *mda)
{
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
disptime = mda->crtc[0] + 1;
_dispontime = mda->crtc[1];
_dispofftime = disptime - _dispontime;
@@ -121,9 +123,11 @@ mda_poll(void *p)
mda_t *mda = (mda_t *) p;
uint16_t ca = (mda->crtc[15] | (mda->crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c;
int x;
int c;
int oldvc;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
int oldsc;
int blink;
@@ -252,7 +256,7 @@ mda_poll(void *p)
mda->sc &= 31;
mda->ma = mda->maback;
}
if ((mda->sc == (mda->crtc[10] & 31) || ((mda->crtc[8] & 3) == 3 && mda->sc == ((mda->crtc[10] & 31) >> 1)))) {
if (mda->sc == (mda->crtc[10] & 31) || ((mda->crtc[8] & 3) == 3 && mda->sc == ((mda->crtc[10] & 31) >> 1))) {
mda->con = 1;
}
}
@@ -262,9 +266,7 @@ mda_poll(void *p)
void
mda_init(mda_t *mda)
{
int c;
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = 16;
if (c & 8)
mdacols[c][0][1] = 15 + 16;

View File

@@ -848,7 +848,7 @@ mystique_recalctimings(svga_t *svga)
mystique_t *mystique = (mystique_t *) svga->p;
int clk_sel = (svga->miscout >> 2) & 3;
svga->clock = (cpuclock * (float) (1ull << 32)) / svga->getclock(clk_sel & 3, svga->clock_gen);
svga->clock = (cpuclock * (float) (1ULL << 32)) / svga->getclock(clk_sel & 3, svga->clock_gen);
if (mystique->crtcext_regs[1] & CRTCX_R1_HTOTAL8)
svga->htotal += 0x100;
@@ -1369,7 +1369,8 @@ mystique_ctrl_read_b(uint32_t addr, void *p)
int fifocount;
uint16_t addr_0x0f = 0;
uint16_t addr_0x03 = 0;
int rs2 = 0, rs3 = 0;
int rs2 = 0;
int rs3 = 0;
if ((mystique->type == MGA_2064W) && (addr & 0x3e00) == 0x3c00) {
/*RAMDAC*/
@@ -1589,7 +1590,6 @@ mystique_accel_ctrl_write_b(uint32_t addr, uint8_t val, void *p)
{
mystique_t *mystique = (mystique_t *) p;
int start_blit = 0;
int x;
if ((addr & 0x300) == 0x100) {
addr &= ~0x100;
@@ -1620,7 +1620,7 @@ mystique_accel_ctrl_write_b(uint32_t addr, uint8_t val, void *p)
case REG_PAT1 + 1:
case REG_PAT1 + 2:
case REG_PAT1 + 3:
for (x = 0; x < 8; x++)
for (uint8_t x = 0; x < 8; x++)
mystique->dwgreg.pattern[addr & 7][x] = mystique->dwgreg.pattern[addr & 7][x + 8] = val & (1 << (7 - x));
break;
@@ -1930,7 +1930,8 @@ mystique_ctrl_write_b(uint32_t addr, uint8_t val, void *p)
svga_t *svga = &mystique->svga;
uint16_t addr_0x0f = 0;
uint16_t addr_0x03 = 0;
int rs2 = 0, rs3 = 0;
int rs2 = 0;
int rs3 = 0;
if ((mystique->type == MGA_2064W) && (addr & 0x3e00) == 0x3c00) {
/*RAMDAC*/
@@ -2174,10 +2175,8 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p)
mystique->dwgreg.dwgctrl = val;
if (val & DWGCTRL_SOLID) {
int x, y;
for (y = 0; y < 8; y++) {
for (x = 0; x < 16; x++)
for (uint8_t y = 0; y < 8; y++) {
for (uint8_t x = 0; x < 16; x++)
mystique->dwgreg.pattern[y][x] = 1;
}
mystique->dwgreg.src[0] = 0xffffffff;
@@ -2251,10 +2250,9 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p)
case REG_SRC0:
{
int x = 0, y = 0;
mystique->dwgreg.src[0] = val;
for (y = 0; y < 2; y++) {
for (x = 0; x < 16; x++) {
for (uint8_t y = 0; y < 2; y++) {
for (uint8_t x = 0; x < 16; x++) {
mystique->dwgreg.pattern[y][x] = val & (1 << (x + (y * 16)));
}
}
@@ -2265,10 +2263,9 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p)
break;
case REG_SRC1:
{
int x = 0, y = 0;
mystique->dwgreg.src[1] = val;
for (y = 2; y < 4; y++) {
for (x = 0; x < 16; x++) {
for (uint8_t y = 2; y < 4; y++) {
for (uint8_t x = 0; x < 16; x++) {
mystique->dwgreg.pattern[y][x] = val & (1 << (x + ((y - 2) * 16)));
}
}
@@ -2279,10 +2276,9 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p)
break;
case REG_SRC2:
{
int x = 0, y = 0;
mystique->dwgreg.src[2] = val;
for (y = 4; y < 6; y++) {
for (x = 0; x < 16; x++) {
for (uint8_t y = 4; y < 6; y++) {
for (uint8_t x = 0; x < 16; x++) {
mystique->dwgreg.pattern[y][x] = val & (1 << (x + ((y - 4) * 16)));
}
}
@@ -2293,10 +2289,9 @@ mystique_accel_ctrl_write_l(uint32_t addr, uint32_t val, void *p)
}
case REG_SRC3:
{
int x = 0, y = 0;
mystique->dwgreg.src[3] = val;
for (y = 6; y < 8; y++) {
for (x = 0; x < 16; x++) {
for (uint8_t y = 6; y < 8; y++) {
for (uint8_t x = 0; x < 16; x++) {
mystique->dwgreg.pattern[y][x] = val & (1 << (x + ((y - 6) * 16)));
}
}
@@ -2651,7 +2646,8 @@ run_dma(mystique_t *mystique)
}
if ((mystique->dma.pri_header & 0xff) != 0x15) {
uint32_t val, reg_addr;
uint32_t val;
uint32_t reg_addr;
dma_bm_read(mystique->dma.primaddress & DMA_ADDR_MASK, (uint8_t *) &val, 4, 4);
mystique->dma.primaddress += 4;
@@ -2693,7 +2689,8 @@ run_dma(mystique_t *mystique)
mystique->dma.secaddress += 4;
}
uint32_t val, reg_addr;
uint32_t val;
uint32_t reg_addr;
dma_bm_read(mystique->dma.secaddress & DMA_ADDR_MASK, (uint8_t *) &val, 4, 4);
mystique->dma.secaddress += 4;
@@ -3131,18 +3128,18 @@ blit_fbitblt(mystique_t *mystique)
{
svga_t *svga = &mystique->svga;
uint32_t src_addr;
int y;
int x_dir = mystique->dwgreg.sgn.scanleft ? -1 : 1;
int16_t x_start = mystique->dwgreg.sgn.scanleft ? mystique->dwgreg.fxright : mystique->dwgreg.fxleft;
int16_t x_end = mystique->dwgreg.sgn.scanleft ? mystique->dwgreg.fxleft : mystique->dwgreg.fxright;
src_addr = mystique->dwgreg.ar[3];
for (y = 0; y < mystique->dwgreg.length; y++) {
for (uint16_t y = 0; y < mystique->dwgreg.length; y++) {
int16_t x = x_start;
while (1) {
if (x >= mystique->dwgreg.cxleft && x <= mystique->dwgreg.cxright && mystique->dwgreg.ydst_lin >= mystique->dwgreg.ytop && mystique->dwgreg.ydst_lin <= mystique->dwgreg.ybot) {
uint32_t src, old_dst;
uint32_t src;
uint32_t old_dst;
switch (mystique->maccess_running & MACCESS_PWIDTH_MASK) {
case MACCESS_PWIDTH_8:
@@ -3206,11 +3203,13 @@ static void
blit_iload_iload(mystique_t *mystique, uint32_t data, int size)
{
svga_t *svga = &mystique->svga;
uint32_t src, dst;
uint32_t src;
uint32_t dst;
uint32_t dst2;
uint64_t data64;
int min_size = 8;
uint32_t bltckey = mystique->dwgreg.fcol, bltcmsk = mystique->dwgreg.bcol;
uint32_t bltckey = mystique->dwgreg.fcol;
uint32_t bltcmsk = mystique->dwgreg.bcol;
const int transc = mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANSC;
const int trans_sel = (mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANS_MASK) >> DWGCTRL_TRANS_SHIFT;
uint8_t const *const trans = &trans_masks[trans_sel][(mystique->dwgreg.selline & 3) * 4];
@@ -3561,11 +3560,19 @@ blit_iload_iload_scale(mystique_t *mystique, uint32_t data, int size)
{
svga_t *svga = &mystique->svga;
uint64_t data64 = 0;
int y0, y1;
int u, v;
int dR, dG, dB;
int r0, g0, b0;
int r1, g1, b1;
int y0;
int y1;
int u;
int v;
int dR;
int dG;
int dB;
int r0;
int g0;
int b0;
int r1;
int g1;
int b1;
switch (mystique->dwgreg.dwgctrl_running & DWGCTRL_BLTMOD_MASK) {
case DWGCTRL_BLTMOD_BUYUV:
@@ -3692,10 +3699,19 @@ blit_iload_iload_high(mystique_t *mystique, uint32_t data, int size)
{
svga_t *svga = &mystique->svga;
uint32_t out_data;
int y0, y1, u, v;
int dR, dG, dB;
int r = 0, g = 0, b = 0;
int next_r = 0, next_g = 0, next_b = 0;
int y0;
int y1;
int u;
int v;
int dR;
int dG;
int dB;
int r = 0;
int g = 0;
int b = 0;
int next_r = 0;
int next_g = 0;
int next_b = 0;
switch (mystique->dwgreg.dwgctrl_running & DWGCTRL_BLTMOD_MASK) {
case DWGCTRL_BLTMOD_BUYUV:
@@ -3811,7 +3827,8 @@ blit_iload_iload_high(mystique_t *mystique, uint32_t data, int size)
static void
blit_iload_iload_highv(mystique_t *mystique, uint32_t data, int size)
{
uint8_t *src0, *src1;
uint8_t *src0;
uint8_t *src1;
switch (mystique->dwgreg.dwgctrl_running & DWGCTRL_BLTMOD_MASK) {
case DWGCTRL_BLTMOD_BUYUV:
@@ -3890,7 +3907,9 @@ static void
blit_line(mystique_t *mystique, int closed)
{
svga_t *svga = &mystique->svga;
uint32_t src, dst, old_dst;
uint32_t src;
uint32_t dst;
uint32_t old_dst;
int x;
int z_write;
@@ -3971,7 +3990,9 @@ blit_line(mystique_t *mystique, int closed)
uint16_t old_z = z_p[x];
if (z_check(z, old_z, mystique->dwgreg.dwgctrl_running & DWGCTRL_ZMODE_MASK)) {
int r = 0, g = 0, b = 0;
int r = 0;
int g = 0;
int b = 0;
if (z_write)
z_p[x] = z;
@@ -4072,7 +4093,10 @@ static void
blit_trap(mystique_t *mystique)
{
svga_t *svga = &mystique->svga;
uint32_t z_back, r_back, g_back, b_back;
uint32_t z_back;
uint32_t r_back;
uint32_t g_back;
uint32_t b_back;
int z_write;
int y;
const int trans_sel = (mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANS_MASK) >> DWGCTRL_TRANS_SHIFT;
@@ -4160,7 +4184,8 @@ blit_trap(mystique_t *mystique)
int xoff = (mystique->dwgreg.xoff + (x_l & 7)) & 15;
int pattern = mystique->dwgreg.pattern[yoff][xoff];
uint32_t src = pattern ? mystique->dwgreg.fcol : mystique->dwgreg.bcol;
uint32_t dst, old_dst;
uint32_t dst;
uint32_t old_dst;
switch (mystique->maccess_running & MACCESS_PWIDTH_MASK) {
case MACCESS_PWIDTH_8:
@@ -4250,8 +4275,11 @@ blit_trap(mystique_t *mystique)
uint16_t old_z = z_p[x_l];
if (z_check(z, old_z, mystique->dwgreg.dwgctrl_running & DWGCTRL_ZMODE_MASK)) {
uint32_t dst = 0, old_dst;
int r = 0, g = 0, b = 0;
uint32_t dst = 0;
uint32_t old_dst;
int r = 0;
int g = 0;
int b = 0;
if (!(mystique->dwgreg.dr[4] & (1 << 23)))
r = (mystique->dwgreg.dr[4] >> 15) & 0xff;
@@ -4351,7 +4379,8 @@ texture_read(mystique_t *mystique, int *tex_r, int *tex_g, int *tex_b, int *atra
const unsigned int w_mask = (mystique->dwgreg.texwidth & TEXWIDTH_TWMASK_MASK) >> TEXWIDTH_TWMASK_SHIFT;
const unsigned int h_mask = (mystique->dwgreg.texheight & TEXHEIGHT_THMASK_MASK) >> TEXHEIGHT_THMASK_SHIFT;
uint16_t src = 0;
int s, t;
int s;
int t;
if (mystique->dwgreg.texctl & TEXCTL_NPCEN) {
const int s_shift = 20 - (mystique->dwgreg.texwidth & TEXWIDTH_TW_MASK);
@@ -4362,7 +4391,7 @@ texture_read(mystique_t *mystique, int *tex_r, int *tex_g, int *tex_b, int *atra
} else {
const int s_shift = (20 + 16) - (mystique->dwgreg.texwidth & TEXWIDTH_TW_MASK);
const int t_shift = (20 + 16) - (mystique->dwgreg.texheight & TEXHEIGHT_TH_MASK);
int64_t q = mystique->dwgreg.tmr[8] ? ((0x100000000ll / (int64_t) (int32_t) mystique->dwgreg.tmr[8]) /*>> 16*/) : 0;
int64_t q = mystique->dwgreg.tmr[8] ? (0x100000000LL / (int64_t) (int32_t) mystique->dwgreg.tmr[8] /*>> 16*/) : 0;
s = (((int64_t) (int32_t) mystique->dwgreg.tmr[6] * q) /*<< 8*/) >> s_shift; /*((16+20)-12);*/
t = (((int64_t) (int32_t) mystique->dwgreg.tmr[7] * q) /*<< 8*/) >> t_shift; /*((16+20)-9);*/
@@ -4466,9 +4495,14 @@ blit_texture_trap(mystique_t *mystique)
uint16_t old_z = z_p[x_l];
if (z_check(z, old_z, mystique->dwgreg.dwgctrl_running & DWGCTRL_ZMODE_MASK)) {
int tex_r = 0, tex_g = 0, tex_b = 0;
int ctransp, atransp = 0;
int i_r = 0, i_g = 0, i_b = 0;
int tex_r = 0;
int tex_g = 0;
int tex_b = 0;
int ctransp;
int atransp = 0;
int i_r = 0;
int i_g = 0;
int i_b = 0;
if (!(mystique->dwgreg.dr[4] & (1 << 23)))
i_r = (mystique->dwgreg.dr[4] >> 15) & 0xff;
@@ -4726,7 +4760,8 @@ blit_bitblt(mystique_t *mystique)
if (x >= mystique->dwgreg.cxleft && x <= mystique->dwgreg.cxright && mystique->dwgreg.ydst_lin >= mystique->dwgreg.ytop && mystique->dwgreg.ydst_lin <= mystique->dwgreg.ybot && ((svga->vram[byte_addr] & (1 << bit_offset)) || !(mystique->dwgreg.dwgctrl_running & DWGCTRL_TRANSC)) && trans[x & 3]) {
uint32_t src = (svga->vram[byte_addr] & (1 << bit_offset)) ? mystique->dwgreg.fcol : mystique->dwgreg.bcol;
uint32_t dst, old_dst;
uint32_t dst;
uint32_t old_dst;
switch (mystique->maccess_running & MACCESS_PWIDTH_MASK) {
case MACCESS_PWIDTH_8:
@@ -4801,7 +4836,9 @@ blit_bitblt(mystique_t *mystique)
while (1) {
if (x >= mystique->dwgreg.cxleft && x <= mystique->dwgreg.cxright && mystique->dwgreg.ydst_lin >= mystique->dwgreg.ytop && mystique->dwgreg.ydst_lin <= mystique->dwgreg.ybot && trans[x & 3]) {
uint32_t src, dst, old_dst;
uint32_t src;
uint32_t dst;
uint32_t old_dst;
switch (mystique->maccess_running & MACCESS_PWIDTH_MASK) {
case MACCESS_PWIDTH_8:
@@ -5112,7 +5149,6 @@ static void
mystique_hwcursor_draw(svga_t *svga, int displine)
{
mystique_t *mystique = (mystique_t *) svga->p;
int x;
uint64_t dat[2];
int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff;
@@ -5124,10 +5160,10 @@ mystique_hwcursor_draw(svga_t *svga, int displine)
svga->hwcursor_latch.addr += 16;
switch (mystique->xcurctrl & XCURCTRL_CURMODE_MASK) {
case XCURCTRL_CURMODE_XGA:
for (x = 0; x < 64; x++) {
if (!(dat[1] & (1ull << 63)))
svga->monitor->target_buffer->line[displine][offset + svga->x_add] = (dat[0] & (1ull << 63)) ? mystique->cursor.col[1] : mystique->cursor.col[0];
else if (dat[0] & (1ull << 63))
for (uint8_t x = 0; x < 64; x++) {
if (!(dat[1] & (1ULL << 63)))
svga->monitor->target_buffer->line[displine][offset + svga->x_add] = (dat[0] & (1ULL << 63)) ? mystique->cursor.col[1] : mystique->cursor.col[0];
else if (dat[0] & (1ULL << 63))
svga->monitor->target_buffer->line[displine][offset + svga->x_add] ^= 0xffffff;
offset++;
@@ -5409,7 +5445,6 @@ mystique_pci_write(int func, int addr, uint8_t val, void *p)
static void *
mystique_init(const device_t *info)
{
int c;
mystique_t *mystique = malloc(sizeof(mystique_t));
char *romfn;
@@ -5487,7 +5522,7 @@ mystique_init(const device_t *info)
mystique->pci_regs[0x41] = 0x01; /* vgaboot = 1 */
mystique->pci_regs[0x43] = 0x40; /* biosen = 1 */
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
dither5[c][0][0] = c >> 3;
dither5[c][1][1] = (c + 2) >> 3;
dither5[c][1][0] = (c + 4) >> 3;

View File

@@ -50,9 +50,11 @@ static video_timings_t timing_nga = { .type = VIDEO_ISA, .write_b = 8, .write_w
void
nga_recalctimings(nga_t *nga)
{
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
if ((nga->cga.cgamode & 1)) {
if (nga->cga.cgamode & 1) {
disptime = nga->cga.crtc[0] + 1;
_dispontime = nga->cga.crtc[1];
} else {
@@ -136,7 +138,7 @@ nga_read(uint32_t addr, void *priv)
nga->cga.charbuffer[offset | 1] = nga->cga.vram[addr & 0x7fff];
}
return (ret);
return ret;
}
void
@@ -146,10 +148,15 @@ nga_poll(void *priv)
/* set cursor position in memory */
uint16_t ca = (nga->cga.crtc[15] | (nga->cga.crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c, xs_temp, ys_temp;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr, attr;
uint16_t dat, dat2;
uint8_t chr;
uint8_t attr;
uint16_t dat;
uint16_t dat2;
int cols[4];
int col;
int oldsc;
@@ -338,7 +345,7 @@ nga_poll(void *priv)
/* nga specific */
cols[0] = ((nga->cga.cgamode & 0x12) == 0x12) ? 0 : (nga->cga.cgacol & 15) + 16;
/* 80-col */
if ((nga->cga.cgamode & 1)) {
if (nga->cga.cgamode & 1) {
hline(buffer32, 0, (nga->cga.displine << 1), ((nga->cga.crtc[1] << 3) + 16) << 2, cols[0]);
hline(buffer32, 0, (nga->cga.displine << 1) + 1, ((nga->cga.crtc[1] << 3) + 16) << 2, cols[0]);
} else {
@@ -347,7 +354,7 @@ nga_poll(void *priv)
}
}
if ((nga->cga.cgamode & 1))
if (nga->cga.cgamode & 1)
/* set screen width */
x = (nga->cga.crtc[1] << 3) + 16;
else
@@ -444,7 +451,7 @@ nga_poll(void *priv)
nga->cga.vsynctime = 16;
/* vsync pos */
if (nga->cga.crtc[7]) {
if ((nga->cga.cgamode & 1))
if (nga->cga.cgamode & 1)
/* set screen width */
x = (nga->cga.crtc[1] << 3) + 16;
else
@@ -515,7 +522,7 @@ nga_poll(void *priv)
nga->cga.cgastat &= ~1;
/* enable cursor if its scanline was reached */
if ((nga->cga.sc == (nga->cga.crtc[10] & 31) || ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == ((nga->cga.crtc[10] & 31) >> 1))))
if (nga->cga.sc == (nga->cga.crtc[10] & 31) || ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == ((nga->cga.crtc[10] & 31) >> 1)))
nga->cga.con = 1;
}
/* 80-columns */

View File

@@ -69,7 +69,8 @@ oti_out(uint16_t addr, uint8_t val, void *p)
oti_t *oti = (oti_t *) p;
svga_t *svga = &oti->svga;
uint8_t old;
uint8_t idx, enable;
uint8_t idx;
uint8_t enable;
if (!oti->chip_id && !(oti->enable_register & 1) && (addr != 0x3C3))
return;
@@ -202,7 +203,8 @@ oti_in(uint16_t addr, void *p)
{
oti_t *oti = (oti_t *) p;
svga_t *svga = &oti->svga;
uint8_t idx, temp;
uint8_t idx;
uint8_t temp;
if (!oti->chip_id && !(oti->enable_register & 1) && (addr != 0x3C3))
return 0xff;
@@ -313,7 +315,7 @@ oti_in(uint16_t addr, void *p)
break;
}
return (temp);
return temp;
}
static void
@@ -374,7 +376,7 @@ oti_recalctimings(svga_t *svga)
oti_t *oti = (oti_t *) svga->p;
int clk_sel = ((svga->miscout >> 2) & 3) | ((oti->regs[0x0d] & 0x20) >> 3);
svga->clock = (cpuclock * (double) (1ull << 32)) / oti_getclock(clk_sel);
svga->clock = (cpuclock * (double) (1ULL << 32)) / oti_getclock(clk_sel);
if (oti->chip_id > 0) {
if (oti->regs[0x14] & 0x08)
@@ -473,7 +475,7 @@ oti_init(const device_t *info)
oti->svga.miscout = 1;
oti->svga.packed_chain4 = 1;
return (oti);
return oti;
}
static void

View File

@@ -59,7 +59,9 @@ static uint8_t mdaattr[256][2][2];
void
ogc_recalctimings(ogc_t *ogc)
{
double _dispontime, _dispofftime, disptime;
double _dispontime;
double _dispofftime;
double disptime;
if (ogc->cga.cgamode & 1) {
disptime = ogc->cga.crtc[0] + 1;
@@ -134,7 +136,7 @@ ogc_in(uint16_t addr, void *priv)
}
}
return (ret);
return ret;
}
void
@@ -188,10 +190,15 @@ ogc_poll(void *priv)
ogc_t *ogc = (ogc_t *) priv;
uint16_t ca = (ogc->cga.crtc[15] | (ogc->cga.crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c, xs_temp, ys_temp;
int x;
int c;
int xs_temp;
int ys_temp;
int oldvc;
uint8_t chr, attr;
uint16_t dat, dat2;
uint8_t chr;
uint8_t attr;
uint16_t dat;
uint16_t dat2;
int cols[4];
int oldsc;
int blink = 0;
@@ -537,9 +544,7 @@ ogc_speed_changed(void *priv)
void
ogc_mdaattr_rebuild(void)
{
int c;
for (c = 0; c < 256; c++) {
for (uint16_t c = 0; c < 256; c++) {
mdaattr[c][0][0] = mdaattr[c][1][0] = mdaattr[c][1][1] = 16;
if (c & 8)
mdaattr[c][0][1] = 15 + 16;

View File

@@ -289,7 +289,7 @@ paradise_remap(paradise_t *paradise)
paradise->write_bank[1] = paradise->write_bank[3] = (svga->gdcreg[9] << 12) + ((svga->gdcreg[6] & 0x08) ? 0 : 0x8000);
}
if ((((svga->gdcreg[0x0b] & 0xc0) == 0xc0) && !svga->chain4 && (svga->crtc[0x14] & 0x40) && ((svga->gdcreg[6] >> 2) & 3) == 1))
if (((svga->gdcreg[0x0b] & 0xc0) == 0xc0) && !svga->chain4 && (svga->crtc[0x14] & 0x40) && ((svga->gdcreg[6] >> 2) & 3) == 1)
paradise->check = 1;
if (paradise->bank_mask == 0x7f) {
@@ -349,7 +349,8 @@ paradise_write(uint32_t addr, uint8_t val, void *p)
{
paradise_t *paradise = (paradise_t *) p;
svga_t *svga = &paradise->svga;
uint32_t prev_addr, prev_addr2;
uint32_t prev_addr;
uint32_t prev_addr2;
addr = (addr & 0x7fff) + paradise->write_bank[(addr >> 15) & 3];
@@ -397,7 +398,8 @@ paradise_writew(uint32_t addr, uint16_t val, void *p)
{
paradise_t *paradise = (paradise_t *) p;
svga_t *svga = &paradise->svga;
uint32_t prev_addr, prev_addr2;
uint32_t prev_addr;
uint32_t prev_addr2;
addr = (addr & 0x7fff) + paradise->write_bank[(addr >> 15) & 3];
@@ -446,7 +448,8 @@ paradise_read(uint32_t addr, void *p)
{
paradise_t *paradise = (paradise_t *) p;
svga_t *svga = &paradise->svga;
uint32_t prev_addr, prev_addr2;
uint32_t prev_addr;
uint32_t prev_addr2;
addr = (addr & 0x7fff) + paradise->read_bank[(addr >> 15) & 3];
@@ -494,7 +497,8 @@ paradise_readw(uint32_t addr, void *p)
{
paradise_t *paradise = (paradise_t *) p;
svga_t *svga = &paradise->svga;
uint32_t prev_addr, prev_addr2;
uint32_t prev_addr;
uint32_t prev_addr2;
addr = (addr & 0x7fff) + paradise->read_bank[(addr >> 15) & 3];

View File

@@ -324,7 +324,6 @@ read_command(pgc_t *dev)
static int
parse_command(pgc_t *dev, const pgc_cmd_t **pcmd)
{
const pgc_cmd_t *cmd;
char match[7];
*pcmd = NULL;
@@ -343,7 +342,7 @@ parse_command(pgc_t *dev, const pgc_cmd_t **pcmd)
* dev->commands may be a subclass list (terminated with '*')
* or the core list (terminated with '@')
*/
for (cmd = dev->commands; cmd->ascii[0] != '@'; cmd++) {
for (const pgc_cmd_t *cmd = dev->commands; cmd->ascii[0] != '@'; cmd++) {
/* End of subclass command list, chain to core. */
if (cmd->ascii[0] == '*')
cmd = dev->master;
@@ -465,12 +464,11 @@ static void
hndl_clread(pgc_t *dev)
{
uint8_t param = 0;
uint32_t n;
if (!pgc_param_byte(dev, &param))
return;
for (n = 0; n < dev->clist[param].wrptr; n++) {
for (uint32_t n = 0; n < dev->clist[param].wrptr; n++) {
if (!pgc_result_byte(dev, dev->clist[param].list[n]))
return;
}
@@ -493,12 +491,11 @@ static void
hndl_clears(pgc_t *dev)
{
uint8_t param = 0;
uint32_t y;
if (!pgc_param_byte(dev, &param))
return;
for (y = 0; y < dev->screenh; y++)
for (uint32_t y = 0; y < dev->screenh; y++)
memset(dev->vram + y * dev->maxw, param, dev->screenw);
}
@@ -569,7 +566,8 @@ hndl_prmfil(pgc_t *dev)
static void
hndl_move(pgc_t *dev)
{
int32_t x = 0, y = 0;
int32_t x = 0;
int32_t y = 0;
if (!pgc_param_coord(dev, &x))
return;
@@ -586,7 +584,9 @@ hndl_move(pgc_t *dev)
static void
hndl_move3(pgc_t *dev)
{
int32_t x = 0, y = 0, z = 0;
int32_t x = 0;
int32_t y = 0;
int32_t z = 0;
if (!pgc_param_coord(dev, &x))
return;
@@ -604,7 +604,8 @@ hndl_move3(pgc_t *dev)
static void
hndl_mover(pgc_t *dev)
{
int32_t x = 0, y = 0;
int32_t x = 0;
int32_t y = 0;
if (!pgc_param_coord(dev, &x))
return;
@@ -619,7 +620,9 @@ hndl_mover(pgc_t *dev)
static void
hndl_mover3(pgc_t *dev)
{
int32_t x = 0, y = 0, z = 0;
int32_t x = 0;
int32_t y = 0;
int32_t z = 0;
if (!pgc_param_coord(dev, &x))
return;
@@ -752,7 +755,12 @@ pgc_plot(pgc_t *dev, uint16_t x, uint16_t y)
uint16_t
pgc_draw_line_r(pgc_t *dev, int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint16_t linemask)
{
int32_t dx, dy, sx, sy, err, e2;
int32_t dx;
int32_t dy;
int32_t sx;
int32_t sy;
int32_t err;
int32_t e2;
dx = abs(x1 - x0);
dy = abs(y1 - y0);
@@ -850,8 +858,11 @@ pgc_fill_polygon(pgc_t *dev, unsigned corners, int32_t *x, int32_t *y)
double *nodex;
double *dx;
double *dy;
unsigned n, nodes, i, j;
double ymin, ymax, ypos;
unsigned nodes;
unsigned i;
unsigned j;
double ymin;
double ymax;
pgc_log("PGC: fill_polygon(%i corners)\n", corners);
@@ -878,7 +889,7 @@ pgc_fill_polygon(pgc_t *dev, unsigned corners, int32_t *x, int32_t *y)
}
ymin = ymax = y[0] / 65536.0;
for (n = 0; n < corners; n++) {
for (unsigned int n = 0; n < corners; n++) {
/* Convert from PGC fixed-point to native floating-point. */
dx[n] = x[n] / 65536.0;
dy[n] = y[n] / 65536.0;
@@ -892,7 +903,7 @@ pgc_fill_polygon(pgc_t *dev, unsigned corners, int32_t *x, int32_t *y)
/* Polygon fill. Based on <http://alienryderflex.com/polygon_fill/> */
/* For each row, work out where the polygon lines intersect with
* that row. */
for (ypos = ymin; ypos <= ymax; ypos++) {
for (double ypos = ymin; ypos <= ymax; ypos++) {
nodes = 0;
j = corners - 1;
for (i = 0; i < corners; i++) {
@@ -908,8 +919,10 @@ pgc_fill_polygon(pgc_t *dev, unsigned corners, int32_t *x, int32_t *y)
/* And fill between them. */
for (i = 0; i < nodes; i += 2) {
int16_t x1 = (int16_t) nodex[i], x2 = (int16_t) nodex[i + 1],
y1 = (int16_t) ypos, y2 = (int16_t) ypos;
int16_t x1 = (int16_t) nodex[i];
int16_t x2 = (int16_t) nodex[i + 1];
int16_t y1 = (int16_t) ypos;
int16_t y2 = (int16_t) ypos;
pgc_sto_raster(dev, &x1, &y1);
pgc_sto_raster(dev, &x2, &y2);
pgc_fill_line_r(dev, x1, x2, y1);
@@ -930,7 +943,6 @@ pgc_draw_ellipse(pgc_t *dev, int32_t x, int32_t y)
double w = x / 65536.0;
double y0 = dev->y / 65536.0;
double x0 = dev->x / 65536.0;
double ypos, xpos;
double x1;
double xlast = 0.0;
int16_t linemask = dev->line_pattern;
@@ -940,7 +952,7 @@ pgc_draw_ellipse(pgc_t *dev, int32_t x, int32_t y)
pgc_dto_raster(dev, &x0, &y0);
for (ypos = 0; ypos <= h; ypos++) {
for (double ypos = 0; ypos <= h; ypos++) {
if (ypos == 0) {
if (dev->fill_mode)
pgc_fill_line_r(dev, (uint16_t) (x0 - w),
@@ -966,7 +978,7 @@ pgc_draw_ellipse(pgc_t *dev, int32_t x, int32_t y)
}
/* Draw border. */
for (xpos = xlast; xpos >= x1; xpos--) {
for (double xpos = xlast; xpos >= x1; xpos--) {
if (linemask & 0x8000) {
pgc_plot(dev, (uint16_t) (x0 + xpos),
(uint16_t) (y0 + ypos));
@@ -990,7 +1002,8 @@ pgc_draw_ellipse(pgc_t *dev, int32_t x, int32_t y)
static void
hndl_ellipse(pgc_t *dev)
{
int32_t x = 0, y = 0;
int32_t x = 0;
int32_t y = 0;
if (!pgc_param_coord(dev, &x))
return;
@@ -1007,13 +1020,12 @@ hndl_poly(pgc_t *dev)
uint8_t count;
int32_t x[256];
int32_t y[256];
int32_t n;
if (!pgc_param_byte(dev, &count))
return;
pgc_log("PGC: POLY (%i)\n", count);
for (n = 0; n < count; n++) {
for (uint8_t n = 0; n < count; n++) {
if (!pgc_param_coord(dev, &x[n]))
return;
if (!pgc_param_coord(dev, &y[n]))
@@ -1064,8 +1076,11 @@ hndl_display(pgc_t *dev)
static void
hndl_imagew(pgc_t *dev)
{
int16_t row, col1, col2;
uint8_t v1, v2;
int16_t row;
int16_t col1;
int16_t col2;
uint8_t v1;
uint8_t v2;
if (!pgc_param_word(dev, &row))
return;
@@ -1174,9 +1189,8 @@ static void
hndl_lut(pgc_t *dev)
{
uint8_t param[4];
int n;
for (n = 0; n < 4; n++) {
for (uint8_t n = 0; n < 4; n++) {
if (!pgc_param_byte(dev, &param[n]))
return;
if (n > 0 && param[n] > 15) {
@@ -1215,9 +1229,8 @@ void
pgc_hndl_lut8(pgc_t *dev)
{
uint8_t param[4];
int n;
for (n = 0; n < 4; n++)
for (uint8_t n = 0; n < 4; n++)
if (!pgc_param_byte(dev, &param[n]))
return;
@@ -1229,9 +1242,8 @@ static void
hndl_areapt(pgc_t *dev)
{
int16_t pat[16];
int n;
for (n = 0; n < 16; n++)
for (uint8_t n = 0; n < 16; n++)
if (!pgc_param_word(dev, &pat[n]))
return;
@@ -1319,7 +1331,10 @@ hndl_tsize(pgc_t *pgc)
static void
hndl_vwport(pgc_t *dev)
{
int16_t x1, x2, y1, y2;
int16_t x1;
int16_t x2;
int16_t y1;
int16_t y2;
if (!pgc_param_word(dev, &x1))
return;
@@ -1341,7 +1356,10 @@ hndl_vwport(pgc_t *dev)
static void
hndl_window(pgc_t *dev)
{
int16_t x1, x2, y1, y2;
int16_t x1;
int16_t x2;
int16_t y1;
int16_t y2;
if (!pgc_param_word(dev, &x1))
return;
@@ -1583,8 +1601,6 @@ pgc_error(pgc_t *dev, int err)
void
pgc_reset(pgc_t *dev)
{
int n;
memset(dev->mapram, 0x00, sizeof(dev->mapram));
/* The 'CGA disable' jumper is not currently implemented. */
@@ -1617,7 +1633,7 @@ pgc_reset(pgc_t *dev)
dev->vp_y2 = dev->vish - 1;
/* Empty command lists. */
for (n = 0; n < 256; n++) {
for (uint16_t n = 0; n < 256; n++) {
dev->clist[n].wrptr = 0;
dev->clist[n].rdptr = 0;
dev->clist[n].repeat = 0;
@@ -1763,7 +1779,8 @@ pgc_param_byte(pgc_t *dev, uint8_t *val)
int
pgc_param_word(pgc_t *dev, int16_t *val)
{
uint8_t lo, hi;
uint8_t lo;
uint8_t hi;
int32_t c;
if (dev->clcur) {
@@ -1995,14 +2012,13 @@ int
pgc_parse_bytes(pgc_t *dev, pgc_cl_t *cl, int count)
{
uint8_t *param = (uint8_t *) malloc(count);
int n;
if (!param) {
pgc_error(dev, PGC_ERROR_OVERFLOW);
return 0;
}
for (n = 0; n < count; n++) {
for (int n = 0; n < count; n++) {
if (!pgc_param_byte(dev, &param[n])) {
free(param);
return 0;
@@ -2025,14 +2041,13 @@ int
pgc_parse_words(pgc_t *dev, pgc_cl_t *cl, int count)
{
int16_t *param = (int16_t *) malloc(count * sizeof(int16_t));
int n;
if (!param) {
pgc_error(dev, PGC_ERROR_OVERFLOW);
return 0;
}
for (n = 0; n < count; n++) {
for (int n = 0; n < count; n++) {
if (!pgc_param_word(dev, &param[n])) {
free(param);
return 0;
@@ -2110,7 +2125,8 @@ pgc_dto_raster(pgc_t *dev, double *x, double *y)
void
pgc_sto_raster(pgc_t *dev, int16_t *x, int16_t *y)
{
double xd = *x, yd = *y;
double xd = *x;
double yd = *y;
pgc_dto_raster(dev, &xd, &yd);
*x = (int16_t) xd;
@@ -2120,7 +2136,8 @@ pgc_sto_raster(pgc_t *dev, int16_t *x, int16_t *y)
void
pgc_ito_raster(pgc_t *dev, int32_t *x, int32_t *y)
{
double xd = *x, yd = *y;
double xd = *x;
double yd = *y;
pgc_dto_raster(dev, &xd, &yd);
*x = (int32_t) xd;
@@ -2130,9 +2147,12 @@ pgc_ito_raster(pgc_t *dev, int32_t *x, int32_t *y)
void
pgc_recalctimings(pgc_t *dev)
{
double disptime, _dispontime, _dispofftime;
double pixel_clock = (cpuclock / (dev->cga_selected ? 25175000.0 : dev->native_pixel_clock) * (double) (1ull << 32));
uint8_t crtc0 = 97, crtc1 = 80; /* Values from MDA, taken from there due to the 25 MHz refresh rate. */
double disptime;
double _dispontime;
double _dispofftime;
double pixel_clock = (cpuclock / (dev->cga_selected ? 25175000.0 : dev->native_pixel_clock) * (double) (1ULL << 32));
uint8_t crtc0 = 97; /* Value from MDA, taken from there due to the 25 MHz refresh rate. */
uint8_t crtc1 = 80; /* Value from MDA, taken from there due to the 25 MHz refresh rate. */
/* Multiply pixel clock by 8. */
pixel_clock *= 8.0;
@@ -2309,8 +2329,8 @@ pgc_read(uint32_t addr, void *priv)
void
pgc_cga_text(pgc_t *dev, int w)
{
int x, c;
uint8_t chr, attr;
uint8_t chr;
uint8_t attr;
int drawcursor = 0;
uint32_t cols[2];
int pitch = (dev->mapram[0x3e9] + 1) * 2;
@@ -2324,7 +2344,7 @@ pgc_cga_text(pgc_t *dev, int w)
addr = &dev->cga_vram[((ma + ((dev->displine / pitch) * w)) * 2) & 0x3ffe];
ma += (dev->displine / pitch) * w;
for (x = 0; x < w; x++) {
for (int x = 0; x < w; x++) {
chr = *addr++;
attr = *addr++;
@@ -2344,7 +2364,7 @@ pgc_cga_text(pgc_t *dev, int w)
cols[0] = (attr >> 4) + 16;
}
for (c = 0; c < cw; c++) {
for (int c = 0; c < cw; c++) {
if (drawcursor)
val = cols[(fontdatm[chr + dev->fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ 0x0f;
else
@@ -2365,7 +2385,6 @@ pgc_cga_text(pgc_t *dev, int w)
void
pgc_cga_gfx40(pgc_t *dev)
{
int x, c;
uint32_t cols[4];
int col;
uint16_t ma = (dev->mapram[0x3ed] | (dev->mapram[0x3ec] << 8)) & 0x3fff;
@@ -2394,11 +2413,11 @@ pgc_cga_gfx40(pgc_t *dev)
cols[3] = col | 6;
}
for (x = 0; x < 40; x++) {
for (uint8_t x = 0; x < 40; x++) {
addr = &dev->cga_vram[(ma + 2 * x + 80 * (dev->displine >> 2) + 0x2000 * ((dev->displine >> 1) & 1)) & 0x3fff];
dat = (addr[0] << 8) | addr[1];
dev->ma++;
for (c = 0; c < 8; c++) {
for (uint8_t c = 0; c < 8; c++) {
buffer32->line[dev->displine][(x << 4) + (c << 1)] = buffer32->line[dev->displine][(x << 4) + (c << 1) + 1] = cols[dat >> 14];
dat <<= 2;
}
@@ -2409,7 +2428,6 @@ pgc_cga_gfx40(pgc_t *dev)
void
pgc_cga_gfx80(pgc_t *dev)
{
int x, c;
uint32_t cols[2];
uint16_t ma = (dev->mapram[0x3ed] | (dev->mapram[0x3ec] << 8)) & 0x3fff;
uint8_t *addr;
@@ -2418,11 +2436,11 @@ pgc_cga_gfx80(pgc_t *dev)
cols[0] = 16;
cols[1] = (dev->mapram[0x3d9] & 15) + 16;
for (x = 0; x < 40; x++) {
for (uint8_t x = 0; x < 40; x++) {
addr = &dev->cga_vram[(ma + 2 * x + 80 * (dev->displine >> 2) + 0x2000 * ((dev->displine >> 1) & 1)) & 0x3fff];
dat = (addr[0] << 8) | addr[1];
dev->ma++;
for (c = 0; c < 16; c++) {
for (uint8_t c = 0; c < 16; c++) {
buffer32->line[dev->displine][(x << 4) + c] = cols[dat >> 15];
dat <<= 1;
}
@@ -2512,7 +2530,7 @@ void
pgc_poll(void *priv)
{
pgc_t *dev = (pgc_t *) priv;
uint32_t x, y;
uint32_t y;
if (dev->cga_selected) {
pgc_cga_poll(dev);
@@ -2532,7 +2550,7 @@ pgc_poll(void *priv)
* the IM1024 driver uses PAN -112 for an offset of
* 224. */
y = dev->displine - 2 * dev->pan_y;
for (x = 0; x < dev->screenw; x++) {
for (uint32_t x = 0; x < dev->screenw; x++) {
if (x + dev->pan_x < dev->maxw)
buffer32->line[dev->displine][x] = dev->palette[dev->vram[y * dev->maxw + x]];
else
@@ -2643,8 +2661,6 @@ void
pgc_init(pgc_t *dev, int maxw, int maxh, int visw, int vish,
int (*inpbyte)(pgc_t *, uint8_t *), double npc)
{
int i;
/* Make it a 16k mapping at C4000 (will be C4000-C7FFF),
because of the emulator's granularity - the original
mapping will conflict with hard disk controller BIOS'es. */
@@ -2671,7 +2687,7 @@ pgc_init(pgc_t *dev, int maxw, int maxh, int visw, int vish,
/* Create and initialize command lists. */
dev->clist = (pgc_cl_t *) malloc(256 * sizeof(pgc_cl_t));
memset(dev->clist, 0x00, 256 * sizeof(pgc_cl_t));
for (i = 0; i < 256; i++) {
for (uint16_t i = 0; i < 256; i++) {
dev->clist[i].list = NULL;
dev->clist[i].listmax = 0;
dev->clist[i].wrptr = 0;
@@ -2708,7 +2724,7 @@ pgc_standalone_init(const device_t *info)
video_inform(VIDEO_FLAG_TYPE_CGA, &timing_pgc);
return (dev);
return dev;
}
const device_t pgc_device = {

View File

@@ -209,22 +209,22 @@ rtg_recalctimings(svga_t *svga)
case 1:
break;
case 2:
svga->clock = (cpuclock * (double) (1ull << 32)) / 36000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 36000000.0;
break;
case 3:
svga->clock = (cpuclock * (double) (1ull << 32)) / 65100000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 65100000.0;
break;
case 4:
svga->clock = (cpuclock * (double) (1ull << 32)) / 44900000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 44900000.0;
break;
case 5:
svga->clock = (cpuclock * (double) (1ull << 32)) / 50000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 50000000.0;
break;
case 6:
svga->clock = (cpuclock * (double) (1ull << 32)) / 80000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 80000000.0;
break;
case 7:
svga->clock = (cpuclock * (double) (1ull << 32)) / 75000000.0;
svga->clock = (cpuclock * (double) (1ULL << 32)) / 75000000.0;
break;
}
@@ -317,7 +317,7 @@ rtg_init(const device_t *info)
rom_init(&dev->bios_rom, (char *) fn,
0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
return (dev);
return dev;
}
static void

View File

@@ -2004,12 +2004,13 @@ static void
s3_hwcursor_draw(svga_t *svga, int displine)
{
s3_t *s3 = (s3_t *) svga->p;
int x, shift = 1;
int shift = 1;
int width = 16;
uint16_t dat[2];
int xx;
int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff;
uint32_t fg, bg;
uint32_t fg;
uint32_t bg;
uint32_t real_addr;
uint32_t remapped_addr;
@@ -2070,7 +2071,7 @@ s3_hwcursor_draw(svga_t *svga, int displine)
real_addr = s3_hwcursor_convert_addr(svga);
for (x = 0; x < 64; x += 16) {
for (uint8_t x = 0; x < 64; x += 16) {
remapped_addr = dword_remap(svga, real_addr);
dat[0] = (svga->vram[remapped_addr & s3->vram_mask] << 8) | svga->vram[(remapped_addr + 1) & s3->vram_mask];
@@ -2334,9 +2335,12 @@ s3_trio64v_overlay_draw(svga_t *svga, int displine)
s3_t *s3 = (s3_t *) svga->p;
int offset = (s3->streams.sec_x - s3->streams.pri_x) + 1;
int h_acc = s3->streams.dda_horiz_accumulator;
int r[8], g[8], b[8];
int x_size, x_read = 4, x_write = 4;
int x;
int r[8];
int g[8];
int b[8];
int x_size;
int x_read = 4;
int x_write = 4;
uint32_t *p;
uint8_t *src = &svga->vram[svga->overlay_latch.addr];
@@ -2349,7 +2353,7 @@ s3_trio64v_overlay_draw(svga_t *svga, int displine)
OVERLAY_SAMPLE();
for (x = 0; x < x_size; x++) {
for (int x = 0; x < x_size; x++) {
*p++ = r[x_read] | (g[x_read] << 8) | (b[x_read] << 16);
h_acc += s3->streams.k1_horiz_scale;
@@ -2562,8 +2566,10 @@ s3_out(uint16_t addr, uint8_t val, void *p)
{
s3_t *s3 = (s3_t *) p;
svga_t *svga = &s3->svga;
uint8_t old, mask;
int rs2, rs3;
uint8_t old;
uint8_t mask;
int rs2;
int rs3;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1))
addr ^= 0x60;
@@ -2632,7 +2638,7 @@ s3_out(uint16_t addr, uint8_t val, void *p)
bt48x_ramdac_out(addr, rs2, rs3, val, svga->ramdac, svga);
} else if ((s3->chip == S3_VISION964 && s3->card_type == S3_ELSAWIN2KPROX_964) || (s3->chip == S3_VISION968 && (s3->card_type == S3_ELSAWIN2KPROX || s3->card_type == S3_PHOENIX_VISION968 || s3->card_type == S3_NUMBER9_9FX_771)))
ibm_rgb528_ramdac_out(addr, rs2, val, svga->ramdac, svga);
else if ((s3->chip == S3_VISION968 && (s3->card_type == S3_SPEA_MERCURY_P64V || s3->card_type == S3_MIROVIDEO40SV_ERGO_968))) {
else if (s3->chip == S3_VISION968 && (s3->card_type == S3_SPEA_MERCURY_P64V || s3->card_type == S3_MIROVIDEO40SV_ERGO_968)) {
rs3 = !!(svga->crtc[0x55] & 0x02);
tvp3026_ramdac_out(addr, rs2, rs3, val, svga->ramdac, svga);
} else if (((s3->chip == S3_86C801) || (s3->chip == S3_86C805)) && (s3->card_type != S3_MIROCRYSTAL10SD_805 && s3->card_type != S3_MIROCRYSTAL8S_805))
@@ -2906,7 +2912,8 @@ s3_in(uint16_t addr, void *p)
{
s3_t *s3 = (s3_t *) p;
svga_t *svga = &s3->svga;
int rs2, rs3;
int rs2;
int rs3;
uint8_t temp;
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1))
@@ -3086,7 +3093,7 @@ s3_recalctimings(svga_t *svga)
if ((((svga->miscout >> 2) & 3) == 3) && s3->chip < S3_TRIO32)
clk_sel = svga->crtc[0x42] & 0x0f;
svga->clock = (cpuclock * (double) (1ull << 32)) / svga->getclock(clk_sel, svga->clock_gen);
svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clk_sel, svga->clock_gen);
switch (svga->crtc[0x67] >> 4) {
case 3:
@@ -3368,7 +3375,7 @@ s3_trio64v_recalctimings(svga_t *svga)
svga->split |= 0x400;
svga->interlace = svga->crtc[0x42] & 0x20;
svga->clock = (cpuclock * (double) (1ull << 32)) / svga->getclock(clk_sel, svga->clock_gen);
svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clk_sel, svga->clock_gen);
if ((svga->crtc[0x67] & 0xc) != 0xc) /*VGA mode*/
{
@@ -3579,7 +3586,9 @@ s3_trio64_getclock(int clock, void *p)
s3_t *s3 = (s3_t *) p;
svga_t *svga = &s3->svga;
float t;
int m, n1, n2;
int m;
int n1;
int n2;
if (clock == 0)
return 25175000.0;
if (clock == 1)
@@ -5668,9 +5677,15 @@ polygon_setup(s3_t *s3)
static __inline void
convert_to_rgb32(int idf, int is_yuv, uint32_t val, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *r2, uint8_t *g2, uint8_t *b2)
{
static double dr = 0.0, dg = 0.0, db = 0.0;
static double dY1 = 0.0, dCr = 0.0, dY2 = 0.0, dCb = 0.0;
static double dU = 0.0, dV = 0.0;
static double dr = 0.0;
static double dg = 0.0;
static double db = 0.0;
static double dY1 = 0.0;
static double dCr = 0.0;
static double dY2 = 0.0;
static double dCb = 0.0;
static double dU = 0.0;
static double dV = 0.0;
switch (idf) {
case 0: /* 8 bpp, RGB 3-3-2 */
@@ -5750,10 +5765,18 @@ convert_to_rgb32(int idf, int is_yuv, uint32_t val, uint8_t *r, uint8_t *g, uint
static __inline void
convert_from_rgb32(int idf, int odf, int is_yuv, uint32_t *val, uint8_t r, uint8_t g, uint8_t b, uint8_t r2, uint8_t g2, uint8_t b2)
{
static double dr = 0.0, dg = 0.0, db = 0.0;
static double dr2 = 0.0, dg2 = 0.0, db2 = 0.0;
static double dY1 = 0.0, dCr = 0.0, dY2 = 0.0, dCb = 0.0;
static double dU = 0.0, dV = 0.0;
static double dr = 0.0;
static double dg = 0.0;
static double db = 0.0;
static double dr2 = 0.0;
static double dg2 = 0.0;
static double db2 = 0.0;
static double dY1 = 0.0;
static double dCr = 0.0;
static double dY2 = 0.0;
static double dCb = 0.0;
static double dU = 0.0;
static double dV = 0.0;
dr = (double) r;
dg = (double) g;
@@ -5832,13 +5855,23 @@ static void
s3_visionx68_video_engine_op(uint32_t cpu_dat, s3_t *s3)
{
svga_t *svga = &s3->svga;
int idf, odf, host;
int idf;
int odf;
int host;
int is_yuv;
uint32_t src, dest = 0x00000000;
uint8_t r = 0x00, g = 0x00, b = 0x00, r2 = 0x00, g2 = 0x00, b2 = 0x00;
uint32_t src;
uint32_t dest = 0x00000000;
uint8_t r = 0x00;
uint8_t g = 0x00;
uint8_t b = 0x00;
uint8_t r2 = 0x00;
uint8_t g2 = 0x00;
uint8_t b2 = 0x00;
uint16_t *vram_w = (uint16_t *) svga->vram;
uint32_t *vram_l = (uint32_t *) svga->vram;
uint32_t k2 = 0, dda = 0, diff = 0;
uint32_t k2 = 0;
uint32_t dda = 0;
uint32_t diff = 0;
int count = -1;
idf = s3->videoengine.idf;
@@ -5879,8 +5912,8 @@ s3_visionx68_video_engine_op(uint32_t cpu_dat, s3_t *s3)
s3->videoengine.sx = k2 - dda + diff - 1;
s3->videoengine.sx_backup = s3->videoengine.len - s3->videoengine.start - 1;
}
s3->videoengine.sx_scale_inc = (double) ((s3->videoengine.sx_backup >> 1));
s3->videoengine.sx_scale_inc = s3->videoengine.sx_scale_inc / (double) ((s3->videoengine.sx >> 1));
s3->videoengine.sx_scale_inc = (double) (s3->videoengine.sx_backup >> 1);
s3->videoengine.sx_scale_inc = s3->videoengine.sx_scale_inc / (double) (s3->videoengine.sx >> 1);
} else {
s3->videoengine.sx_scale = (double) (s3->videoengine.k1 - 2);
s3->videoengine.sx_scale_dec = (s3->videoengine.sx_scale / (double) (s3->videoengine.len - s3->videoengine.start - 2));
@@ -5942,8 +5975,8 @@ s3_visionx68_video_engine_op(uint32_t cpu_dat, s3_t *s3)
s3->videoengine.sx = k2 - dda + diff - 1;
s3->videoengine.sx_backup = s3->videoengine.len - s3->videoengine.start - 1;
}
s3->videoengine.sx_scale_inc = (double) ((s3->videoengine.sx_backup >> 1));
s3->videoengine.sx_scale_inc = s3->videoengine.sx_scale_inc / (double) ((s3->videoengine.sx >> 1));
s3->videoengine.sx_scale_inc = (double) (s3->videoengine.sx_backup >> 1);
s3->videoengine.sx_scale_inc = s3->videoengine.sx_scale_inc / (double) (s3->videoengine.sx >> 1);
s3->videoengine.cx = 0.0;
s3->videoengine.dx = 0.0;
@@ -6036,9 +6069,13 @@ void
s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_t *s3)
{
svga_t *svga = &s3->svga;
uint32_t src_dat = 0, dest_dat, old_dest_dat;
uint32_t out, pat_dat = 0;
int frgd_mix, bkgd_mix;
uint32_t src_dat = 0;
uint32_t dest_dat;
uint32_t old_dest_dat;
uint32_t out;
uint32_t pat_dat = 0;
int frgd_mix;
int bkgd_mix;
int clip_t = s3->accel.multifunc[1] & 0xfff;
int clip_l = s3->accel.multifunc[2] & 0xfff;
int clip_b = s3->accel.multifunc[3] & 0xfff;
@@ -6052,7 +6089,8 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
int compare_mode = (s3->accel.multifunc[0xe] >> 7) & 3;
uint32_t rd_mask = s3->accel.rd_mask;
int cmd = s3->accel.cmd >> 13;
uint32_t srcbase, dstbase;
uint32_t srcbase;
uint32_t dstbase;
if ((s3->chip >= S3_TRIO64 || s3->chip == S3_VISION968 || s3->chip == S3_VISION868) && (s3->accel.cmd & (1 << 11))) {
cmd |= 8;
@@ -6077,7 +6115,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
dstbase >>= 2;
}
if ((s3->accel.cmd & 0x100) && ((s3_cpu_src(s3) || (s3_cpu_dest(s3)))) && (!cpu_input || (s3_enable_fifo(s3) == 0))) {
if ((s3->accel.cmd & 0x100) && (s3_cpu_src(s3) || (s3_cpu_dest(s3))) && (!cpu_input || (s3_enable_fifo(s3) == 0))) {
s3->force_busy = 1;
}
@@ -6476,7 +6514,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
s3->accel.temp_cnt = 16;
}
if (((s3->accel.cx & 0xfff) >= clip_l && (s3->accel.cx & 0xfff) <= clip_r && (s3->accel.cy & 0xfff) >= clip_t && (s3->accel.cy & 0xfff) <= clip_b)) {
if ((s3->accel.cx & 0xfff) >= clip_l && (s3->accel.cx & 0xfff) <= clip_r && (s3->accel.cy & 0xfff) >= clip_t && (s3->accel.cy & 0xfff) <= clip_b) {
if (s3_cpu_dest(s3) && ((s3->accel.multifunc[0xa] & 0xc0) == 0x00)) {
mix_dat = mix_mask; /* Mix data = forced to foreground register. */
} else if (s3_cpu_dest(s3) && vram_mask) {
@@ -6506,7 +6544,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
break;
}
if (((compare_mode == 2 && src_dat != compare) || (compare_mode == 3 && src_dat == compare) || compare_mode < 2)) {
if ((compare_mode == 2 && src_dat != compare) || (compare_mode == 3 && src_dat == compare) || compare_mode < 2) {
READ(s3->accel.dest + s3->accel.cx, dest_dat);
MIX
@@ -6574,7 +6612,8 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
case 3: /*Polygon Fill Solid (Vision868/968 and Trio64 only)*/
{
int end_y1, end_y2;
int end_y1;
int end_y2;
if (s3->chip != S3_TRIO64 && s3->chip != S3_VISION968 && s3->chip != S3_VISION868)
break;
@@ -6612,7 +6651,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
break;
}
if (((compare_mode == 2 && src_dat != compare) || (compare_mode == 3 && src_dat == compare) || compare_mode < 2)) {
if ((compare_mode == 2 && src_dat != compare) || (compare_mode == 3 && src_dat == compare) || compare_mode < 2) {
READ(s3->accel.dest + s3->accel.poly_x, dest_dat);
MIX
@@ -6688,7 +6727,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
if (!cpu_input && frgd_mix == 3 && !vram_mask && !compare_mode && (s3->accel.cmd & 0xa0) == 0xa0 && (s3->accel.frgd_mix & 0xf) == 7 && (s3->accel.bkgd_mix & 0xf) == 7) {
while (1) {
if (((s3->accel.dx & 0xfff) >= clip_l && (s3->accel.dx & 0xfff) <= clip_r && (s3->accel.dy & 0xfff) >= clip_t && (s3->accel.dy & 0xfff) <= clip_b)) {
if ((s3->accel.dx & 0xfff) >= clip_l && (s3->accel.dx & 0xfff) <= clip_r && (s3->accel.dy & 0xfff) >= clip_t && (s3->accel.dy & 0xfff) <= clip_b) {
READ(s3->accel.src + s3->accel.cx, src_dat);
READ(s3->accel.dest + s3->accel.dx, dest_dat);
@@ -6747,6 +6786,7 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
}
if ((((compare_mode == 2 && src_dat != compare) || (compare_mode == 3 && src_dat == compare) || compare_mode < 2))) {
READ(s3->accel.dest + s3->accel.dx, dest_dat);
MIX
@@ -7029,7 +7069,8 @@ s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat, s3_
case 11: /*Polygon Fill Pattern (Vision868/968 and Trio64 only)*/
{
int end_y1, end_y2;
int end_y1;
int end_y2;
if (s3->chip != S3_TRIO64 && s3->chip != S3_VISION968 && s3->chip != S3_VISION868)
break;
@@ -7455,7 +7496,8 @@ static void
fifo_thread(void *param)
{
s3_t *s3 = (s3_t *) param;
uint64_t start_time, end_time;
uint64_t start_time;
uint64_t end_time;
while (s3->fifo_thread_run) {
thread_set_event(s3->fifo_not_full_event);
@@ -7523,8 +7565,8 @@ s3_reset(void *priv)
memset(svga->crtc, 0x00, sizeof(svga->crtc));
svga->crtc[0] = 63;
svga->crtc[6] = 255;
svga->dispontime = 1000ull << 32;
svga->dispofftime = 1000ull << 32;
svga->dispontime = 1000ULL << 32;
svga->dispofftime = 1000ULL << 32;
svga->bpp = 8;
if (s3->pci)
@@ -7661,7 +7703,8 @@ static void *
s3_init(const device_t *info)
{
const char *bios_fn;
int chip, stepping;
int chip;
int stepping;
s3_t *s3 = malloc(sizeof(s3_t));
svga_t *svga = &s3->svga;
int vram;

View File

@@ -796,7 +796,7 @@ s3_virge_recalctimings(svga_t *svga)
int m = svga->seqregs[0x13] & 0x7f;
double freq = (((double) m + 2) / (((double) n + 2) * (double) (1 << r))) * 14318184.0;
svga->clock = (cpuclock * (float) (1ull << 32)) / freq;
svga->clock = (cpuclock * (float) (1ULL << 32)) / freq;
}
if ((svga->crtc[0x67] & 0xc) != 0xc) /*VGA mode*/
@@ -1179,7 +1179,7 @@ s3_virge_mmio_fifo_write_l(uint32_t addr, uint32_t val, virge_t *virge)
{
int x = addr & 4;
int y = (addr >> 3) & 7;
int color, xx;
int color;
int byte;
virge->s3d.pattern_8[y * 8 + x] = val & 0xff;
virge->s3d.pattern_8[y * 8 + x + 1] = val >> 8;
@@ -1192,7 +1192,7 @@ s3_virge_mmio_fifo_write_l(uint32_t addr, uint32_t val, virge_t *virge)
virge->s3d.pattern_16[y * 8 + x + 1] = val >> 16;
addr &= 0x00ff;
for (xx = 0; xx < 4; xx++) {
for (uint8_t xx = 0; xx < 4; xx++) {
x = ((addr + xx) / 3) % 8;
y = ((addr + xx) / 24) % 8;
color = ((addr + xx) % 3) << 3;
@@ -2045,10 +2045,13 @@ s3_virge_bitblt(virge_t *virge, int count, uint32_t cpu_dat)
int x_mul;
int cpu_dat_shift;
uint32_t *pattern_data;
uint32_t src_fg_clr, src_bg_clr;
uint32_t src_fg_clr;
uint32_t src_bg_clr;
uint32_t src_addr;
uint32_t dest_addr;
uint32_t source = 0, dest = 0, pattern;
uint32_t source = 0;
uint32_t dest = 0;
uint32_t pattern;
uint32_t out = 0;
int update;
@@ -2095,9 +2098,8 @@ s3_virge_bitblt(virge_t *virge, int count, uint32_t cpu_dat)
break;
}
if (virge->s3d.cmd_set & CMD_SET_MP) {
int x, y;
for (y = 0; y < 4; y++) {
for (x = 0; x < 8; x++) {
for (uint8_t y = 0; y < 4; y++) {
for (uint8_t x = 0; x < 8; x++) {
if (virge->s3d.mono_pat_0 & (1 << (x + y * 8)))
mono_pattern[y * 8 + (7 - x)] = virge->s3d.pat_fg_clr;
else
@@ -2311,7 +2313,9 @@ s3_virge_bitblt(virge_t *virge, int count, uint32_t cpu_dat)
do {
uint32_t dest_addr = virge->s3d.dest_base + (x * x_mul) + (virge->s3d.dest_y * virge->s3d.dest_str);
uint32_t source = 0, dest = 0, pattern;
uint32_t source = 0;
uint32_t dest = 0;
uint32_t pattern;
uint32_t out = 0;
int update = 1;
@@ -2361,7 +2365,9 @@ skip_line:
int xdir = (x < xend) ? 1 : -1;
do {
uint32_t dest_addr = virge->s3d.dest_base + (x * x_mul) + (y * virge->s3d.dest_str);
uint32_t source = 0, dest = 0, pattern;
uint32_t source = 0;
uint32_t dest = 0;
uint32_t pattern;
uint32_t out = 0;
int update = 1;
@@ -2452,7 +2458,8 @@ static void (*dest_pixel)(s3d_state_t *state);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
static int _x, _y;
static int _x;
static int _y;
static void
tex_ARGB1555(s3d_state_t *state, s3d_texture_state_t *texture_state, rgba_t *out)
@@ -2553,7 +2560,8 @@ tex_sample_normal_filter(s3d_state_t *state)
s3d_texture_state_t texture_state;
int tex_offset;
rgba_t tex_samples[4];
int du, dv;
int du;
int dv;
int d[4];
texture_state.level = state->max_d;
@@ -2610,7 +2618,8 @@ tex_sample_mipmap_filter(s3d_state_t *state)
s3d_texture_state_t texture_state;
int tex_offset;
rgba_t tex_samples[4];
int du, dv;
int du;
int dv;
int d[4];
texture_state.level = (state->d < 0) ? state->max_d : state->max_d - ((state->d >> 27) & 0xf);
@@ -2669,10 +2678,13 @@ static void
tex_sample_persp_normal_filter(s3d_state_t *state)
{
s3d_texture_state_t texture_state;
int32_t w = 0, u, v;
int32_t w = 0;
int32_t u;
int32_t v;
int tex_offset;
rgba_t tex_samples[4];
int du, dv;
int du;
int dv;
int d[4];
if (state->w)
@@ -2735,10 +2747,13 @@ static void
tex_sample_persp_normal_filter_375(s3d_state_t *state)
{
s3d_texture_state_t texture_state;
int32_t w = 0, u, v;
int32_t w = 0;
int32_t u;
int32_t v;
int tex_offset;
rgba_t tex_samples[4];
int du, dv;
int du;
int dv;
int d[4];
if (state->w)
@@ -2803,10 +2818,13 @@ static void
tex_sample_persp_mipmap_filter(s3d_state_t *state)
{
s3d_texture_state_t texture_state;
int32_t w = 0, u, v;
int32_t w = 0;
int32_t u;
int32_t v;
int tex_offset;
rgba_t tex_samples[4];
int du, dv;
int du;
int dv;
int d[4];
if (state->w)
@@ -2873,10 +2891,13 @@ static void
tex_sample_persp_mipmap_filter_375(s3d_state_t *state)
{
s3d_texture_state_t texture_state;
int32_t w = 0, u, v;
int32_t w = 0;
int32_t u;
int32_t v;
int tex_offset;
rgba_t tex_samples[4];
int du, dv;
int du;
int dv;
int d[4];
if (state->w)
@@ -3031,10 +3052,13 @@ tri(virge_t *virge, s3d_t *s3d_tri, s3d_state_t *state, int yc, int32_t dx1, int
int bpp = (s3d_tri->cmd_set >> 2) & 7;
uint32_t dest_offset = 0, z_offset = 0;
uint32_t dest_offset = 0;
uint32_t z_offset = 0;
uint32_t src_col;
int src_r = 0, src_g = 0, src_b = 0;
int src_r = 0;
int src_g = 0;
int src_b = 0;
int x;
int xe;
@@ -3324,7 +3348,6 @@ s3_virge_triangle(virge_t *virge, s3d_t *s3d_tri)
s3d_state_t state;
uint32_t tex_base;
int c;
uint64_t start_time = plat_timer_read();
uint64_t end_time;
@@ -3349,7 +3372,7 @@ s3_virge_triangle(virge_t *virge, s3d_t *s3d_tri)
state.base_w = s3d_tri->tws;
tex_base = s3d_tri->tex_base;
for (c = 9; c >= 0; c--) {
for (uint8_t c = 9; c >= 0; c--) {
state.texture[c] = (uint16_t *) &virge->svga.vram[tex_base];
if (c <= state.max_d)
tex_base += ((1 << (c * 2)) * tex_size[(s3d_tri->cmd_set >> 5) & 7]) / 2;
@@ -3464,11 +3487,11 @@ static void
s3_virge_hwcursor_draw(svga_t *svga, int displine)
{
virge_t *virge = (virge_t *) svga->p;
int x;
uint16_t dat[2];
int xx;
int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff;
uint32_t fg, bg;
uint32_t fg;
uint32_t bg;
uint32_t vram_mask = virge->vram_mask;
if (svga->interlace && svga->hwcursor_oddeven)
@@ -3497,7 +3520,7 @@ s3_virge_hwcursor_draw(svga_t *svga, int displine)
break;
}
for (x = 0; x < 64; x += 16) {
for (uint8_t x = 0; x < 64; x += 16) {
dat[0] = (svga->vram[svga->hwcursor_latch.addr & vram_mask] << 8) | svga->vram[(svga->hwcursor_latch.addr + 1) & vram_mask];
dat[1] = (svga->vram[(svga->hwcursor_latch.addr + 2) & vram_mask] << 8) | svga->vram[(svga->hwcursor_latch.addr + 3) & vram_mask];
if (svga->crtc[0x55] & 0x10) {
@@ -3751,9 +3774,12 @@ s3_virge_overlay_draw(svga_t *svga, int displine)
virge_t *virge = (virge_t *) svga->p;
int offset = (virge->streams.sec_x - virge->streams.pri_x) + 1;
int h_acc = virge->streams.dda_horiz_accumulator;
int r[8], g[8], b[8];
int x_size, x_read = 4, x_write = 4;
int x;
int r[8];
int g[8];
int b[8];
int x_size;
int x_read = 4;
int x_write = 4;
uint32_t *p;
uint8_t *src = &svga->vram[svga->overlay_latch.addr];
@@ -3766,7 +3792,7 @@ s3_virge_overlay_draw(svga_t *svga, int displine)
OVERLAY_SAMPLE();
for (x = 0; x < x_size; x++) {
for (int x = 0; x < x_size; x++) {
*p++ = r[x_read] | (g[x_read] << 8) | (b[x_read] << 16);
h_acc += virge->streams.k1_horiz_scale;
@@ -4039,8 +4065,8 @@ s3_virge_reset(void *priv)
memset(svga->crtc, 0x00, sizeof(svga->crtc));
svga->crtc[0] = 63;
svga->crtc[6] = 255;
svga->dispontime = 1000ull << 32;
svga->dispofftime = 1000ull << 32;
svga->dispontime = 1000ULL << 32;
svga->dispofftime = 1000ULL << 32;
svga->bpp = 8;
io_removehandler(0x03c0, 0x0020, s3_virge_in, NULL, NULL, s3_virge_out, NULL, NULL, virge);

View File

@@ -93,7 +93,8 @@ uint8_t
sc1148x_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga)
{
sc1148x_ramdac_t *ramdac = (sc1148x_ramdac_t *) p;
uint8_t ret = 0xff, rs = (addr & 0x03) | ((!!rs2) << 2);
uint8_t ret = 0xff;
uint8_t rs = (addr & 0x03) | ((!!rs2) << 2);
switch (rs) {
case 2:

Some files were not shown because too many files have changed in this diff Show More