Merge branch 'master' into feature/fdd_sound_emulation_proto

This commit is contained in:
Toni Riikonen
2025-09-14 10:39:16 +03:00
committed by GitHub
120 changed files with 2837 additions and 20046 deletions

6
.ci/Jenkinsfile vendored
View File

@@ -36,11 +36,8 @@ def osFlags = [
]
def archNames = [
'32': 'x86 (32-bit)',
'x86': 'x86 (32-bit)',
'64': 'x64 (64-bit)',
'x86_64': 'x64 (64-bit)',
'arm32': 'ARM (32-bit)',
'arm64': 'ARM (64-bit)'
]
@@ -57,11 +54,8 @@ def dynarecNames = [
]
def dynarecArchs = [
'32': ['ODR', 'NDR'],
'x86': ['ODR', 'NDR'],
'64': ['ODR', 'NDR'],
'x86_64': ['ODR', 'NDR'],
'arm32': ['NDR'],
'arm64': ['NDR'],
'x86_64+arm64': ['ODR', 'NDR']
]

View File

@@ -325,9 +325,7 @@ echo [-] Building [$package_name] for [$arch] with flags [$cmake_flags]
toolchain_prefix=flags-gcc
is_mac && toolchain_prefix=llvm-macos
case $arch in
32 | x86) toolchain="$toolchain_prefix-i686";;
64 | x86_64*) toolchain="$toolchain_prefix-x86_64";;
ARM32 | arm32) toolchain="$toolchain_prefix-armv7";;
ARM64 | arm64) toolchain="$toolchain_prefix-aarch64";;
*) toolchain="$toolchain_prefix-$arch";;
esac
@@ -600,8 +598,8 @@ then
cmake_flags_extra="$cmake_flags_extra -D MOLTENVK=ON -D \"MOLTENVK_INCLUDE_DIR=$macports\""
fi
# Enable Libserialport
cmake_flags_extra="$cmake_flags_extra -D \"LIBSERIALPORT_ROOT=$macports\""
# Enable libserialport.
cmake_flags_extra="$cmake_flags_extra -D \"LIBSERIALPORT_ROOT=$macports\""
# Install dependencies only if we're in a new build and/or MacPorts prefix.
if check_buildtag "$(basename "$macports")"
@@ -670,9 +668,7 @@ then
else
# Determine Debian architecture.
case $arch in
x86) arch_deb="i386";;
x86_64) arch_deb="amd64";;
arm32) arch_deb="armhf";;
*) arch_deb="$arch";;
esac
grep -q " bullseye " /etc/apt/sources.list || echo [!] WARNING: System not running the expected Debian version
@@ -710,15 +706,12 @@ else
# Determine toolchain architecture triplet.
case $arch in
x86) arch_triplet="i686-linux-gnu";;
arm32) arch_triplet="arm-linux-gnueabihf";;
arm64) arch_triplet="aarch64-linux-gnu";;
*) arch_triplet="$arch-linux-gnu";;
esac
# Determine library directory name for this architecture.
case $arch in
x86) libdir="i386-linux-gnu";;
*) libdir="$arch_triplet";;
esac
@@ -791,9 +784,7 @@ rm -rf build
# Add ARCH to skip the arch_detect process.
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 -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
@@ -1185,8 +1176,6 @@ then
else
# Determine AppImage runtime architecture.
case $arch in
x86) arch_appimage="i686";;
arm32) arch_appimage="armhf";;
arm64) arch_appimage="aarch64";;
*) arch_appimage="$arch";;
esac

View File

@@ -52,9 +52,6 @@ body:
- macOS - Universal (Intel and Apple Silicon)
- Linux - x64 (64-bit)
- Linux - ARM (64-bit)
- Windows - x86 (32-bit)
- Linux - ARM (32-bit)
- Linux - x86 (32-bit)
validations:
required: true
- type: checkboxes

View File

@@ -36,7 +36,7 @@ if(MUNT_EXTERNAL)
endif()
project(86Box
VERSION 5.1
VERSION 6.0
DESCRIPTION "Emulator of x86-based systems"
HOMEPAGE_URL "https://86box.net"
LANGUAGES C CXX)
@@ -139,7 +139,7 @@ option(DISCORD "Discord Rich Presence support"
option(DEBUGREGS486 "Enable debug register opeartion on 486+ CPUs" OFF)
option(LIBASAN "Enable compilation with the addresss sanitizer" OFF)
if((ARCH STREQUAL "arm64") OR (ARCH STREQUAL "arm"))
if((ARCH STREQUAL "arm64"))
set(NEW_DYNAREC ON)
else()
option(NEW_DYNAREC "Use the PCem v15 (\"new\") dynamic recompiler" OFF)

View File

@@ -1,20 +0,0 @@
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box distribution.
#
# CMake toolchain file defining GCC compiler flags
# for ARMv7 targets.
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
#
# Copyright 2021 David Hrdlička.
#
string(APPEND CMAKE_C_FLAGS_INIT " -march=armv7-a+fp -mfloat-abi=hard")
string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv7-a+fp -mfloat-abi=hard")
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)

View File

@@ -1,20 +0,0 @@
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box distribution.
#
# CMake toolchain file defining GCC compiler flags
# for 32-bit x86 targets.
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
#
# Copyright 2021 David Hrdlička.
#
string(APPEND CMAKE_C_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign")
string(APPEND CMAKE_CXX_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign")
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)

View File

@@ -1,30 +0,0 @@
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box distribution.
#
# CMake toolchain file for Clang on Windows builds (x86 target).
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
#
# Copyright 2021 David Hrdlička.
#
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-i686.cmake)
# Use the GCC-compatible Clang executables in order to use our flags
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
# `llvm-rc` is barely usable as of LLVM 13, using MS' rc.exe for now
set(CMAKE_RC_COMPILER rc)
set(CMAKE_C_COMPILER_TARGET i686-pc-windows-msvc)
set(CMAKE_CXX_COMPILER_TARGET i686-pc-windows-msvc)
set(CMAKE_SYSTEM_PROCESSOR X86)
# TODO: set the vcpkg target triplet perhaps?

4
debian/changelog vendored
View File

@@ -1,5 +1,5 @@
86box (5.1) UNRELEASED; urgency=medium
86box (6.0) UNRELEASED; urgency=medium
* Bump release.
-- Jasmine Iwanek <jriwanek@gmail.com> Wed, 27 Aug 2025 19:39:16 +0200
-- Jasmine Iwanek <jriwanek@gmail.com> Sun, 14 Sep 2025 01:57:44 +0200

3
debian/control vendored
View File

@@ -25,10 +25,9 @@ Homepage: https://86box.net/
Rules-Requires-Root: no
Package: 86box
Architecture: amd64 armhf arm64 i386
Architecture: amd64 arm64
Depends: ${shlibs:Depends},
${misc:Depends},
sse2-support [i386]
Recommends: libpcap0.8-dev
Description: An emulator for classic IBM PC clones
86Box is a low level x86 emulator that runs older operating systems and software

16
debian/rules vendored
View File

@@ -5,20 +5,12 @@
ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
ifeq ($(ARCH), $(filter $(ARCH), amd64 i386))
NDR=off
ifeq ($(ARCH),amd64)
TOOLCHAIN=cmake/flags-gcc-x86_64.cmake
else
TOOLCHAIN=cmake/flags-gcc-i686.cmake
endif
ifeq ($(ARCH), $(filter $(ARCH), amd64))
NDR=off
TOOLCHAIN=cmake/flags-gcc-x86_64.cmake
else
NDR=on
ifeq ($(ARCH),armhf)
TOOLCHAIN=cmake/flags-gcc-armv7.cmake
else
TOOLCHAIN=cmake/flags-gcc-aarch64.cmake
endif
TOOLCHAIN=cmake/flags-gcc-aarch64.cmake
endif
%:

View File

@@ -230,6 +230,7 @@ int other_scsi_present = 0; /* SCSI contro
int is_pcjr = 0; /* The current machine is PCjr. */
int portable_mode = 0; /* We are running in portable mode
(global dirs = exe path) */
int global_cfg_overridden = 0; /* Global config file was overriden on command line */
int monitor_edid = 0; /* (C) Which EDID to use. 0=default, 1=custom. */
char monitor_edid_path[1024] = { 0 }; /* (C) Path to custom EDID */
@@ -853,6 +854,7 @@ usage:
if ((c + 1) == argc || plat_dir_check(argv[c + 1]))
goto usage;
global_cfg_overridden = 1;
global = argv[++c];
} else if (!strcasecmp(argv[c], "--image") || !strcasecmp(argv[c], "-I")) {
if ((c + 1) == argc)
@@ -1152,11 +1154,13 @@ usage:
start_vmm = 1;
} else {
strncpy(vmm_path, vmm_path_cfg, sizeof(vmm_path) - 1);
vmm_path[sizeof(vmm_path) - 1] = '\0';
}
if (start_vmm) {
pclog("# VM Manager enabled. Path: %s\n", vmm_path);
strncpy(usr_path, vmm_path, sizeof(usr_path) - 1);
usr_path[sizeof(usr_path) - 1] = '\0';
} else
#endif
{
@@ -1865,6 +1869,12 @@ pc_run(void)
if (title_update) {
mouse_msg_idx = ((mouse_type == MOUSE_TYPE_NONE) || (mouse_input_mode >= 1)) ? 2 : !!mouse_capture;
#ifdef SCREENSHOT_MODE
if (force_10ms)
fps = ((fps + 2) / 5) * 5;
else
fps = ((fps + 20) / 50) * 50;
#endif
swprintf(temp, sizeof_w(temp), mouse_msg[mouse_msg_idx], fps / (force_10ms ? 1 : 10), force_10ms ? 0 : (fps % 10));
#ifdef __APPLE__
/* Needed due to modifying the UI on the non-main thread is a big no-no. */

View File

@@ -84,6 +84,10 @@ if(DEBUGREGS486)
add_compile_definitions(USE_DEBUG_REGS_486)
endif()
if(SCREENSHOT_MODE)
add_compile_definitions(SCREENSHOT_MODE)
endif()
if(VNC)
find_package(LibVNCServer)
if(LibVNCServer_FOUND)
@@ -103,21 +107,34 @@ if(INSTRUMENT)
add_compile_definitions(USE_INSTRUMENT)
endif()
target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom rdisk mo hdd
net print scsi sio snd utils vid voodoo plat ui)
target_link_libraries(86Box
cpu
chipset
mch
dev
mem
fdd
game
cdrom
rdisk
mo
hdd
net
print
scsi
sio
snd
utils
vid
voodoo
plat
ui
)
if(HAIKU)
target_link_libraries(86Box be)
endif()
if(WIN32 AND ARCH STREQUAL "i386")
if(MINGW)
target_link_options(86Box PRIVATE "LINKER:--large-address-aware")
else()
target_link_options(86Box PRIVATE "LINKER:/LARGEADDRESSAWARE")
endif()
endif()
if(STATIC_BUILD)
if(MINGW OR UNIX)
target_link_options(86Box PRIVATE "-static")

View File

@@ -19,8 +19,6 @@
# error ARCH arm
#elif defined(__aarch64__) || defined(_M_ARM64)
# error ARCH arm64
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
# error ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
# error ARCH x86_64
#endif

View File

@@ -10,9 +10,11 @@
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
# Jasmine Iwanek, <jriwanek@gmail.com>
# Connor Hyde, <mario64crashed@gmail.com>
#
# Copyright 2020-2021 David Hrdlička.
# Copyright 2024 Jasmine Iwanek.
# Copyright 2025 Connor Hyde / starfrost
#
if(DYNAREC)
@@ -21,19 +23,15 @@ if(DYNAREC)
codegen_ops.c
)
if(ARCH STREQUAL "i386")
target_sources(dynarec PRIVATE
codegen_x86.c
codegen_accumulate_x86.c
)
elseif(ARCH STREQUAL "x86_64")
if(ARCH STREQUAL "x86_64")
target_sources(dynarec PRIVATE
codegen_x86-64.c
codegen_accumulate_x86-64.c
)
else()
message(SEND_ERROR
"Dynarec is incompatible with target platform ${ARCH}")
"Old dynarec is incompatible with target platform ${ARCH}")
endif()
target_link_libraries(86Box dynarec cgt)

View File

@@ -42,8 +42,6 @@
#ifdef __amd64__
# include "codegen_x86-64.h"
#elif defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined _M_X64
# include "codegen_x86.h"
#else
# error Dynamic recompiler not implemented on your platform
#endif

View File

@@ -1,66 +0,0 @@
#include <stdint.h>
#include <stdio.h>
#include <86box/86box.h>
#include "cpu.h"
#include <86box/mem.h>
#include "codegen.h"
#include "codegen_accumulate.h"
static struct
{
int count;
uintptr_t dest_reg;
} acc_regs[] = {
[ACCREG_cycles] = {0, (uintptr_t) & (cycles)}
};
void
codegen_accumulate(int acc_reg, int delta)
{
acc_regs[acc_reg].count += delta;
#ifdef USE_ACYCS
if ((acc_reg == ACCREG_cycles) && (delta != 0)) {
if (delta == -1) {
/* -delta = 1 */
addbyte(0xff); /*inc dword ptr[&acycs]*/
addbyte(0x05);
addlong((uint32_t) (uintptr_t) & (acycs));
} else if (delta == 1) {
/* -delta = -1 */
addbyte(0xff); /*dec dword ptr[&acycs]*/
addbyte(0x0d);
addlong((uint32_t) (uintptr_t) & (acycs));
} else {
addbyte(0x81); /*ADD $acc_regs[c].count,acc_regs[c].dest*/
addbyte(0x05);
addlong((uint32_t) (uintptr_t) & (acycs));
addlong((uintptr_t) -delta);
}
}
#endif
}
void
codegen_accumulate_flush(void)
{
if (acc_regs[0].count) {
/* To reduce the size of the generated code, we take advantage of
the fact that the target offset points to _cycles within cpu_state,
so we can just use our existing infrastracture for variables
relative to cpu_state. */
addbyte(0x81); /*MOVL $acc_regs[0].count,(_cycles)*/
addbyte(0x45);
addbyte((uint8_t) cpu_state_offset(_cycles));
addlong(acc_regs[0].count);
}
acc_regs[0].count = 0;
}
void
codegen_accumulate_reset(void)
{
acc_regs[0].count = 0;
}

View File

@@ -18,13 +18,8 @@
#include "cpu.h"
#include "codegen.h"
#include "codegen_ops.h"
#if defined __amd64__ || defined _M_X64
# include "codegen_ops_x86-64.h"
#elif defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
# include "codegen_ops_x86.h"
#endif
// Old dynarec now x86-64 only
#include "codegen_ops_x86-64.h"
#include "codegen_ops_arith.h"
#include "codegen_ops_fpu.h"
#include "codegen_ops_jump.h"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,45 +0,0 @@
#define BLOCK_SIZE 0x4000
#define BLOCK_MASK 0x3fff
#define BLOCK_START 0
#define HASH_SIZE 0x20000
#define HASH_MASK 0x1ffff
#define HASH(l) ((l) &0x1ffff)
#define BLOCK_EXIT_OFFSET 0x7f0
#ifdef OLD_GPF
# define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 20)
#else
# define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 14)
#endif
#define BLOCK_MAX 1720
enum {
OP_RET = 0xc3
};
#define NR_HOST_REGS 4
extern int host_reg_mapping[NR_HOST_REGS];
#define NR_HOST_XMM_REGS 8
extern int host_reg_xmm_mapping[NR_HOST_XMM_REGS];
extern uint32_t mem_load_addr_ea_b;
extern uint32_t mem_load_addr_ea_w;
extern uint32_t mem_load_addr_ea_l;
extern uint32_t mem_load_addr_ea_q;
extern uint32_t mem_store_addr_ea_b;
extern uint32_t mem_store_addr_ea_w;
extern uint32_t mem_store_addr_ea_l;
extern uint32_t mem_store_addr_ea_q;
extern uint32_t mem_load_addr_ea_b_no_abrt;
extern uint32_t mem_store_addr_ea_b_no_abrt;
extern uint32_t mem_load_addr_ea_w_no_abrt;
extern uint32_t mem_store_addr_ea_w_no_abrt;
extern uint32_t mem_load_addr_ea_l_no_abrt;
extern uint32_t mem_store_addr_ea_l_no_abrt;
extern uint32_t mem_check_write;
extern uint32_t mem_check_write_w;
extern uint32_t mem_check_write_l;

View File

@@ -46,15 +46,7 @@ if(DYNAREC)
codegen_reg.c
)
if(ARCH STREQUAL "i386")
target_sources(dynarec PRIVATE
codegen_backend_x86.c
codegen_backend_x86_ops.c
codegen_backend_x86_ops_fpu.c
codegen_backend_x86_ops_sse.c
codegen_backend_x86_uops.c
)
elseif(ARCH STREQUAL "x86_64")
if(ARCH STREQUAL "x86_64")
target_sources(dynarec PRIVATE
codegen_backend_x86-64.c
codegen_backend_x86-64_ops.c
@@ -68,12 +60,6 @@ if(DYNAREC)
codegen_backend_arm64_uops.c
codegen_backend_arm64_imm.c
)
elseif(ARCH STREQUAL "arm")
target_sources(dynarec PRIVATE
codegen_backend_arm.c
codegen_backend_arm_ops.c
codegen_backend_arm_uops.c
)
else()
message(SEND_ERROR
"Dynarec is incompatible with target platform ${ARCH}")

View File

@@ -108,7 +108,7 @@ codeblock_allocator_get_ptr(mem_block_t *block)
void
codegen_allocator_clean_blocks(UNUSED(struct mem_block_t *block))
{
#if defined __ARM_EABI__ || defined _ARM_ || defined __aarch64__ || defined _M_ARM || defined _M_ARM64
#if defined __ARM_EABI__ || defined __aarch64__ || defined _M_ARM64
while (1) {
# ifndef _MSC_VER
__clear_cache(&mem_block_alloc[block->offset], &mem_block_alloc[block->offset + MEM_BLOCK_SIZE]);

View File

@@ -11,13 +11,11 @@
are chained together by jump instructions.
Due to the chaining, the total memory size is limited by the range of a jump
instruction. ARMv7 is restricted to +/- 32 MB, ARMv8 to +/- 128 MB, x86 to
+/- 2GB. As a result, total memory size is limited to 32 MB on ARMv7*/
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM
# define MEM_BLOCK_NR 32768
#else
# define MEM_BLOCK_NR 131072
#endif
instruction. ARMv8 is limited to +/- 128 MB, x86 to
+/- 2GB. It was 32 MB on ARMv7 before we removed it*/
#define MEM_BLOCK_NR 131072
#define MEM_BLOCK_MASK (MEM_BLOCK_NR - 1)
#define MEM_BLOCK_SIZE 0x3c0

View File

@@ -3,14 +3,10 @@
#if defined __amd64__ || defined _M_X64
# include "codegen_backend_x86-64.h"
#elif defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
# include "codegen_backend_x86.h"
#elif defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM
# include "codegen_backend_arm.h"
#elif defined __aarch64__ || defined _M_ARM64
# include "codegen_backend_arm64.h"
#else
# error Dynamic recompiler not implemented on your platform
# error New dynamic recompiler not implemented on your platform
#endif
void codegen_backend_init(void);

View File

@@ -1,373 +0,0 @@
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM
# include <stdint.h>
# include <stdlib.h>
# include <86box/86box.h>
# include "cpu.h"
# include <86box/mem.h>
# include "codegen.h"
# include "codegen_allocator.h"
# include "codegen_backend.h"
# include "codegen_backend_arm_defs.h"
# include "codegen_backend_arm_ops.h"
# include "codegen_reg.h"
# include "x86.h"
# include "x86seg_common.h"
# include "x86seg.h"
# include "x87_sf.h"
# include "x87.h"
# if defined(__linux__) || defined(__APPLE__)
# include <sys/mman.h>
# include <unistd.h>
# endif
# if defined WIN32 || defined _WIN32 || defined _WIN32
# include <windows.h>
# endif
# include <string.h>
void *codegen_mem_load_byte;
void *codegen_mem_load_word;
void *codegen_mem_load_long;
void *codegen_mem_load_quad;
void *codegen_mem_load_single;
void *codegen_mem_load_double;
void *codegen_mem_store_byte;
void *codegen_mem_store_word;
void *codegen_mem_store_long;
void *codegen_mem_store_quad;
void *codegen_mem_store_single;
void *codegen_mem_store_double;
void *codegen_fp_round;
void *codegen_gpf_rout;
void *codegen_exit_rout;
host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] = {
{ REG_R4, 0},
{ REG_R5, 0},
{ REG_R6, 0},
{ REG_R7, 0},
{ REG_R8, 0},
{ REG_R9, 0},
{ REG_R11, 0}
};
host_reg_def_t codegen_host_fp_reg_list[CODEGEN_HOST_FP_REGS] = {
{ REG_D8, 0},
{ REG_D9, 0},
{ REG_D10, 0},
{ REG_D11, 0},
{ REG_D12, 0},
{ REG_D13, 0},
{ REG_D14, 0},
{ REG_D15, 0}
};
static void
build_load_routine(codeblock_t *block, int size, int is_float)
{
uint32_t *branch_offset;
uint32_t *misaligned_offset;
/*In - R0 = address
Out - R0 = data, R1 = abrt*/
/*MOV R1, R0, LSR #12
MOV R2, #readlookup2
LDR R1, [R2, R1, LSL #2]
CMP R1, #-1
BNE +
LDRB R0, [R1, R0]
MOV R1, #0
MOV PC, LR
* STR LR, [SP, -4]!
BL readmembl
LDRB R1, cpu_state.abrt
LDR PC, [SP], #4
*/
codegen_alloc(block, 80);
host_arm_MOV_REG_LSR(block, REG_R1, REG_R0, 12);
host_arm_MOV_IMM(block, REG_R2, (uint32_t) readlookup2);
host_arm_LDR_REG_LSL(block, REG_R1, REG_R2, REG_R1, 2);
if (size != 1) {
host_arm_TST_IMM(block, REG_R0, size - 1);
misaligned_offset = host_arm_BNE_(block);
}
host_arm_CMP_IMM(block, REG_R1, -1);
branch_offset = host_arm_BEQ_(block);
if (size == 1 && !is_float)
host_arm_LDRB_REG(block, REG_R0, REG_R1, REG_R0);
else if (size == 2 && !is_float)
host_arm_LDRH_REG(block, REG_R0, REG_R1, REG_R0);
else if (size == 4 && !is_float)
host_arm_LDR_REG(block, REG_R0, REG_R1, REG_R0);
else if (size == 4 && is_float) {
host_arm_ADD_REG(block, REG_R0, REG_R0, REG_R1);
host_arm_VLDR_S(block, REG_D_TEMP, REG_R0, 0);
} else if (size == 8) {
host_arm_ADD_REG(block, REG_R0, REG_R0, REG_R1);
host_arm_VLDR_D(block, REG_D_TEMP, REG_R0, 0);
}
host_arm_MOV_IMM(block, REG_R1, 0);
host_arm_MOV_REG(block, REG_PC, REG_LR);
*branch_offset |= ((((uintptr_t) &block_write_data[block_pos] - (uintptr_t) branch_offset) - 8) & 0x3fffffc) >> 2;
if (size != 1)
*misaligned_offset |= ((((uintptr_t) &block_write_data[block_pos] - (uintptr_t) misaligned_offset) - 8) & 0x3fffffc) >> 2;
host_arm_STR_IMM_WB(block, REG_LR, REG_HOST_SP, -4);
if (size == 1)
host_arm_BL(block, (uintptr_t) readmembl);
else if (size == 2)
host_arm_BL(block, (uintptr_t) readmemwl);
else if (size == 4)
host_arm_BL(block, (uintptr_t) readmemll);
else if (size == 8)
host_arm_BL(block, (uintptr_t) readmemql);
else
fatal("build_load_routine - unknown size %i\n", size);
if (size == 4 && is_float)
host_arm_VMOV_S_32(block, REG_D_TEMP, REG_R0);
else if (size == 8)
host_arm_VMOV_D_64(block, REG_D_TEMP, REG_R0, REG_R1);
host_arm_LDRB_ABS(block, REG_R1, &cpu_state.abrt);
host_arm_LDR_IMM_POST(block, REG_PC, REG_HOST_SP, 4);
}
static void
build_store_routine(codeblock_t *block, int size, int is_float)
{
uint32_t *branch_offset;
uint32_t *misaligned_offset;
/*In - R0 = address
Out - R0 = data, R1 = abrt*/
/*MOV R1, R0, LSR #12
MOV R2, #readlookup2
LDR R1, [R2, R1, LSL #2]
CMP R1, #-1
BNE +
LDRB R0, [R1, R0]
MOV R1, #0
MOV PC, LR
* STR LR, [SP, -4]!
BL readmembl
LDRB R1, cpu_state.abrt
LDR PC, [SP], #4
*/
codegen_alloc(block, 80);
host_arm_MOV_REG_LSR(block, REG_R2, REG_R0, 12);
host_arm_MOV_IMM(block, REG_R3, (uint32_t) writelookup2);
host_arm_LDR_REG_LSL(block, REG_R2, REG_R3, REG_R2, 2);
if (size != 1) {
host_arm_TST_IMM(block, REG_R0, size - 1);
misaligned_offset = host_arm_BNE_(block);
}
host_arm_CMP_IMM(block, REG_R2, -1);
branch_offset = host_arm_BEQ_(block);
if (size == 1 && !is_float)
host_arm_STRB_REG(block, REG_R1, REG_R2, REG_R0);
else if (size == 2 && !is_float)
host_arm_STRH_REG(block, REG_R1, REG_R2, REG_R0);
else if (size == 4 && !is_float)
host_arm_STR_REG(block, REG_R1, REG_R2, REG_R0);
else if (size == 4 && is_float) {
host_arm_ADD_REG(block, REG_R0, REG_R0, REG_R2);
host_arm_VSTR_S(block, REG_D_TEMP, REG_R0, 0);
} else if (size == 8) {
host_arm_ADD_REG(block, REG_R0, REG_R0, REG_R2);
host_arm_VSTR_D(block, REG_D_TEMP, REG_R0, 0);
}
host_arm_MOV_IMM(block, REG_R1, 0);
host_arm_MOV_REG(block, REG_PC, REG_LR);
*branch_offset |= ((((uintptr_t) &block_write_data[block_pos] - (uintptr_t) branch_offset) - 8) & 0x3fffffc) >> 2;
if (size != 1)
*misaligned_offset |= ((((uintptr_t) &block_write_data[block_pos] - (uintptr_t) misaligned_offset) - 8) & 0x3fffffc) >> 2;
host_arm_STR_IMM_WB(block, REG_LR, REG_HOST_SP, -4);
if (size == 4 && is_float)
host_arm_VMOV_32_S(block, REG_R1, REG_D_TEMP);
else if (size == 8)
host_arm_VMOV_64_D(block, REG_R2, REG_R3, REG_D_TEMP);
if (size == 1)
host_arm_BL(block, (uintptr_t) writemembl);
else if (size == 2)
host_arm_BL(block, (uintptr_t) writememwl);
else if (size == 4)
host_arm_BL(block, (uintptr_t) writememll);
else if (size == 8)
host_arm_BL_r1(block, (uintptr_t) writememql);
else
fatal("build_store_routine - unknown size %i\n", size);
host_arm_LDRB_ABS(block, REG_R1, &cpu_state.abrt);
host_arm_LDR_IMM_POST(block, REG_PC, REG_HOST_SP, 4);
}
static void
build_loadstore_routines(codeblock_t *block)
{
codegen_mem_load_byte = &block_write_data[block_pos];
build_load_routine(block, 1, 0);
codegen_mem_load_word = &block_write_data[block_pos];
build_load_routine(block, 2, 0);
codegen_mem_load_long = &block_write_data[block_pos];
build_load_routine(block, 4, 0);
codegen_mem_load_quad = &block_write_data[block_pos];
build_load_routine(block, 8, 0);
codegen_mem_load_single = &block_write_data[block_pos];
build_load_routine(block, 4, 1);
codegen_mem_load_double = &block_write_data[block_pos];
build_load_routine(block, 8, 1);
codegen_mem_store_byte = &block_write_data[block_pos];
build_store_routine(block, 1, 0);
codegen_mem_store_word = &block_write_data[block_pos];
build_store_routine(block, 2, 0);
codegen_mem_store_long = &block_write_data[block_pos];
build_store_routine(block, 4, 0);
codegen_mem_store_quad = &block_write_data[block_pos];
build_store_routine(block, 8, 0);
codegen_mem_store_single = &block_write_data[block_pos];
build_store_routine(block, 4, 1);
codegen_mem_store_double = &block_write_data[block_pos];
build_store_routine(block, 8, 1);
}
/*VFP has a specific round-to-zero instruction, and the default rounding mode
is nearest. For round up/down, temporarily change the rounding mode in FPCSR*/
# define FPCSR_ROUNDING_MASK (3 << 22)
# define FPCSR_ROUNDING_UP (1 << 22)
# define FPCSR_ROUNDING_DOWN (2 << 22)
static void
build_fp_round_routine(codeblock_t *block)
{
uint32_t *jump_table;
codegen_alloc(block, 80);
host_arm_MOV_REG(block, REG_TEMP2, REG_LR);
host_arm_MOV_REG(block, REG_LR, REG_TEMP2);
host_arm_LDR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.new_fp_control - (uintptr_t) &cpu_state);
host_arm_LDR_REG(block, REG_PC, REG_PC, REG_TEMP);
host_arm_NOP(block);
jump_table = (uint32_t *) &block_write_data[block_pos];
host_arm_NOP(block);
host_arm_NOP(block);
host_arm_NOP(block);
host_arm_NOP(block);
jump_table[X87_ROUNDING_NEAREST] = (uint64_t) (uintptr_t) &block_write_data[block_pos]; // tie even
host_arm_VCVTR_IS_D(block, REG_D_TEMP, REG_D_TEMP);
host_arm_MOV_REG(block, REG_PC, REG_LR);
jump_table[X87_ROUNDING_UP] = (uint64_t) (uintptr_t) &block_write_data[block_pos]; // pos inf
host_arm_LDR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.old_fp_control - (uintptr_t) &cpu_state);
host_arm_BIC_IMM(block, REG_TEMP2, REG_TEMP, FPCSR_ROUNDING_MASK);
host_arm_ORR_IMM(block, REG_TEMP2, REG_TEMP2, FPCSR_ROUNDING_UP);
host_arm_VMSR_FPSCR(block, REG_TEMP2);
host_arm_VCVTR_IS_D(block, REG_D_TEMP, REG_D_TEMP);
host_arm_VMSR_FPSCR(block, REG_TEMP);
host_arm_MOV_REG(block, REG_PC, REG_LR);
jump_table[X87_ROUNDING_DOWN] = (uint64_t) (uintptr_t) &block_write_data[block_pos]; // neg inf
host_arm_LDR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.old_fp_control - (uintptr_t) &cpu_state);
host_arm_BIC_IMM(block, REG_TEMP2, REG_TEMP, FPCSR_ROUNDING_MASK);
host_arm_ORR_IMM(block, REG_TEMP2, REG_TEMP, FPCSR_ROUNDING_DOWN);
host_arm_VMSR_FPSCR(block, REG_TEMP2);
host_arm_VCVTR_IS_D(block, REG_D_TEMP, REG_D_TEMP);
host_arm_VMSR_FPSCR(block, REG_TEMP);
host_arm_MOV_REG(block, REG_PC, REG_LR);
jump_table[X87_ROUNDING_CHOP] = (uint64_t) (uintptr_t) &block_write_data[block_pos]; // zero
host_arm_VCVT_IS_D(block, REG_D_TEMP, REG_D_TEMP);
host_arm_MOV_REG(block, REG_PC, REG_LR);
}
void
codegen_backend_init(void)
{
codeblock_t *block;
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
codeblock_hash = malloc(HASH_SIZE * sizeof(codeblock_t *));
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
for (int c = 0; c < BLOCK_SIZE; c++)
codeblock[c].pc = BLOCK_PC_INVALID;
block_current = 0;
block_pos = 0;
block = &codeblock[block_current];
block->head_mem_block = codegen_allocator_allocate(NULL, block_current);
block->data = codeblock_allocator_get_ptr(block->head_mem_block);
block_write_data = block->data;
build_loadstore_routines(&codeblock[block_current]);
# if 0
pclog("block_pos=%i\n", block_pos);
# endif
codegen_fp_round = &block_write_data[block_pos];
build_fp_round_routine(&codeblock[block_current]);
codegen_alloc(block, 80);
codegen_gpf_rout = &block_write_data[block_pos];
host_arm_MOV_IMM(block, REG_R0, 0);
host_arm_MOV_IMM(block, REG_R1, 0);
host_arm_call(block, x86gpf);
codegen_exit_rout = &block_write_data[block_pos];
host_arm_ADD_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x40);
host_arm_LDMIA_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_PC);
block_write_data = NULL;
# if 0
fatal("block_pos=%i\n", block_pos);
# endif
asm("vmrs %0, fpscr\n"
: "=r"(cpu_state.old_fp_control));
if ((cpu_state.old_fp_control >> 22) & 3)
fatal("VFP not in nearest rounding mode\n");
}
void
codegen_set_rounding_mode(int mode)
{
if (mode < 0 || mode > 3)
fatal("codegen_set_rounding_mode - invalid mode\n");
cpu_state.new_fp_control = mode << 2;
}
/*R10 - cpu_state*/
void
codegen_backend_prologue(codeblock_t *block)
{
block_pos = BLOCK_START;
/*Entry code*/
host_arm_STMDB_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_LR);
host_arm_SUB_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x40);
host_arm_MOV_IMM(block, REG_CPUSTATE, (uint32_t) &cpu_state);
if (block->flags & CODEBLOCK_HAS_FPU) {
host_arm_LDR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.TOP - (uintptr_t) &cpu_state);
host_arm_SUB_IMM(block, REG_TEMP, REG_TEMP, block->TOP);
host_arm_STR_IMM(block, REG_TEMP, REG_HOST_SP, IREG_TOP_diff_stack_offset);
}
}
void
codegen_backend_epilogue(codeblock_t *block)
{
host_arm_ADD_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x40);
host_arm_LDMIA_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_PC);
codegen_allocator_clean_blocks(block->head_mem_block);
}
#endif

View File

@@ -1,24 +0,0 @@
#include "codegen_backend_arm_defs.h"
#define BLOCK_SIZE 0x4000
#define BLOCK_MASK 0x3fff
#define BLOCK_START 0
#define HASH_SIZE 0x20000
#define HASH_MASK 0x1ffff
#define HASH(l) ((l) &0x1ffff)
#define BLOCK_MAX 0x3c0
void host_arm_ADD_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
void host_arm_LDMIA_WB(codeblock_t *block, int addr_reg, uint32_t reg_mask);
void host_arm_LDR_IMM(codeblock_t *block, int dst_reg, int addr_reg, int offset);
void host_arm_MOV_IMM(codeblock_t *block, int dst_reg, uint32_t imm);
void host_arm_STMDB_WB(codeblock_t *block, int addr_reg, uint32_t reg_mask);
void host_arm_SUB_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
void host_arm_call(codeblock_t *block, void *dst_addr);
void host_arm_nop(codeblock_t *block);
void codegen_alloc(codeblock_t *block, int size);

View File

@@ -1,88 +0,0 @@
#define REG_R0 0
#define REG_R1 1
#define REG_R2 2
#define REG_R3 3
#define REG_R4 4
#define REG_R5 5
#define REG_R6 6
#define REG_R7 7
#define REG_R8 8
#define REG_R9 9
#define REG_R10 10
#define REG_R11 11
#define REG_R12 12
#define REG_HOST_SP 13
#define REG_LR 14
#define REG_PC 15
#define REG_ARG0 REG_R0
#define REG_ARG1 REG_R1
#define REG_ARG2 REG_R2
#define REG_ARG3 REG_R3
#define REG_CPUSTATE REG_R10
#define REG_TEMP REG_R3
#define REG_TEMP2 REG_R2
#define REG_D0 0
#define REG_D1 1
#define REG_D2 2
#define REG_D3 3
#define REG_D4 4
#define REG_D5 5
#define REG_D6 6
#define REG_D7 7
#define REG_D8 8
#define REG_D9 9
#define REG_D10 10
#define REG_D11 11
#define REG_D12 12
#define REG_D13 13
#define REG_D14 14
#define REG_D15 15
#define REG_D_TEMP REG_D0
#define REG_Q_TEMP REG_D0
#define REG_Q_TEMP_2 REG_D2
#define REG_MASK_R0 (1 << REG_R0)
#define REG_MASK_R1 (1 << REG_R1)
#define REG_MASK_R2 (1 << REG_R2)
#define REG_MASK_R3 (1 << REG_R3)
#define REG_MASK_R4 (1 << REG_R4)
#define REG_MASK_R5 (1 << REG_R5)
#define REG_MASK_R6 (1 << REG_R6)
#define REG_MASK_R7 (1 << REG_R7)
#define REG_MASK_R8 (1 << REG_R8)
#define REG_MASK_R9 (1 << REG_R9)
#define REG_MASK_R10 (1 << REG_R10)
#define REG_MASK_R11 (1 << REG_R11)
#define REG_MASK_R12 (1 << REG_R12)
#define REG_MASK_SP (1 << REG_HOST_SP)
#define REG_MASK_LR (1 << REG_LR)
#define REG_MASK_PC (1 << REG_PC)
#define REG_MASK_LOCAL (REG_MASK_R4 | REG_MASK_R5 | REG_MASK_R6 | REG_MASK_R7 | REG_MASK_R8 | REG_MASK_R9 | REG_MASK_R10 | REG_MASK_R11)
#define CODEGEN_HOST_REGS 7
#define CODEGEN_HOST_FP_REGS 8
extern void *codegen_mem_load_byte;
extern void *codegen_mem_load_word;
extern void *codegen_mem_load_long;
extern void *codegen_mem_load_quad;
extern void *codegen_mem_load_single;
extern void *codegen_mem_load_double;
extern void *codegen_mem_store_byte;
extern void *codegen_mem_store_word;
extern void *codegen_mem_store_long;
extern void *codegen_mem_store_quad;
extern void *codegen_mem_store_single;
extern void *codegen_mem_store_double;
extern void *codegen_fp_round;
extern void *codegen_gpf_rout;
extern void *codegen_exit_rout;

File diff suppressed because it is too large Load Diff

View File

@@ -1,252 +0,0 @@
#define COND_SHIFT 28
#define COND_EQ (0x0 << COND_SHIFT)
#define COND_NE (0x1 << COND_SHIFT)
#define COND_CS (0x2 << COND_SHIFT)
#define COND_CC (0x3 << COND_SHIFT)
#define COND_MI (0x4 << COND_SHIFT)
#define COND_PL (0x5 << COND_SHIFT)
#define COND_VS (0x6 << COND_SHIFT)
#define COND_VC (0x7 << COND_SHIFT)
#define COND_HI (0x8 << COND_SHIFT)
#define COND_LS (0x9 << COND_SHIFT)
#define COND_GE (0xa << COND_SHIFT)
#define COND_LT (0xb << COND_SHIFT)
#define COND_GT (0xc << COND_SHIFT)
#define COND_LE (0xd << COND_SHIFT)
#define COND_AL (0xe << COND_SHIFT)
void host_arm_ADD_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
#define host_arm_ADD_REG(block, dst_reg, src_reg_n, src_reg_m) host_arm_ADD_REG_LSL(block, dst_reg, src_reg_n, src_reg_m, 0)
void host_arm_ADD_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_ADD_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_AND_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
void host_arm_AND_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_AND_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_B(codeblock_t *block, uintptr_t dest_addr);
void host_arm_BFI(codeblock_t *block, int dst_reg, int src_reg, int lsb, int width);
void host_arm_BIC_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
void host_arm_BIC_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_BIC_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_BL(codeblock_t *block, uintptr_t dest_addr);
void host_arm_BL_r1(codeblock_t *block, uintptr_t dest_addr);
void host_arm_BLX(codeblock_t *block, int addr_reg);
uint32_t *host_arm_BCC_(codeblock_t *block);
uint32_t *host_arm_BCS_(codeblock_t *block);
uint32_t *host_arm_BEQ_(codeblock_t *block);
uint32_t *host_arm_BGE_(codeblock_t *block);
uint32_t *host_arm_BGT_(codeblock_t *block);
uint32_t *host_arm_BHI_(codeblock_t *block);
uint32_t *host_arm_BLE_(codeblock_t *block);
uint32_t *host_arm_BLS_(codeblock_t *block);
uint32_t *host_arm_BLT_(codeblock_t *block);
uint32_t *host_arm_BMI_(codeblock_t *block);
uint32_t *host_arm_BNE_(codeblock_t *block);
uint32_t *host_arm_BPL_(codeblock_t *block);
uint32_t *host_arm_BVC_(codeblock_t *block);
uint32_t *host_arm_BVS_(codeblock_t *block);
void host_arm_BEQ(codeblock_t *block, uintptr_t dest_addr);
void host_arm_BNE(codeblock_t *block, uintptr_t dest_addr);
void host_arm_BX(codeblock_t *block, int addr_reg);
void host_arm_CMN_IMM(codeblock_t *block, int src_reg, uint32_t imm);
void host_arm_CMN_REG_LSL(codeblock_t *block, int src_reg_n, int src_reg_m, int shift);
void host_arm_CMP_IMM(codeblock_t *block, int src_reg, uint32_t imm);
#define host_arm_CMP_REG(block, src_reg_n, src_reg_m) host_arm_CMP_REG_LSL(block, src_reg_n, src_reg_m, 0)
void host_arm_CMP_REG_LSL(codeblock_t *block, int src_reg_n, int src_reg_m, int shift);
void host_arm_EOR_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
void host_arm_EOR_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_LDMIA_WB(codeblock_t *block, int addr_reg, uint32_t reg_mask);
void host_arm_LDR_IMM(codeblock_t *block, int dst_reg, int addr_reg, int offset);
void host_arm_LDR_IMM_POST(codeblock_t *block, int dst_reg, int addr_reg, int offset);
#define host_arm_LDR_REG(block, dst_reg, addr_reg, offset_reg) host_arm_LDR_REG_LSL(block, dst_reg, addr_reg, offset_reg, 0)
void host_arm_LDR_REG_LSL(codeblock_t *block, int dst_reg, int addr_reg, int offset_reg, int shift);
void host_arm_LDRB_ABS(codeblock_t *block, int dst, void *p);
void host_arm_LDRB_IMM(codeblock_t *block, int dst_reg, int addr_reg, int offset);
#define host_arm_LDRB_REG(block, dst_reg, addr_reg, offset_reg) host_arm_LDRB_REG_LSL(block, dst_reg, addr_reg, offset_reg, 0)
void host_arm_LDRB_REG_LSL(codeblock_t *block, int dst_reg, int addr_reg, int offset_reg, int shift);
void host_arm_LDRH_IMM(codeblock_t *block, int dst_reg, int addr_reg, int offset);
void host_arm_LDRH_REG(codeblock_t *block, int dst_reg, int addr_reg, int offset_reg);
void host_arm_MOV_IMM(codeblock_t *block, int dst_reg, uint32_t imm);
#define host_arm_MOV_REG(block, dst_reg, src_reg) host_arm_MOV_REG_LSL(block, dst_reg, src_reg, 0)
void host_arm_MOV_REG_ASR(codeblock_t *block, int dst_reg, int src_reg, int shift);
void host_arm_MOV_REG_ASR_REG(codeblock_t *block, int dst_reg, int src_reg, int shift_reg);
void host_arm_MOV_REG_LSL(codeblock_t *block, int dst_reg, int src_reg, int shift);
void host_arm_MOV_REG_LSL_REG(codeblock_t *block, int dst_reg, int src_reg, int shift_reg);
void host_arm_MOV_REG_LSR(codeblock_t *block, int dst_reg, int src_reg, int shift);
void host_arm_MOV_REG_LSR_REG(codeblock_t *block, int dst_reg, int src_reg, int shift_reg);
void host_arm_MOV_REG_ROR(codeblock_t *block, int dst_reg, int src_reg, int shift);
void host_arm_MOV_REG_ROR_REG(codeblock_t *block, int dst_reg, int src_reg, int shift_reg);
void host_arm_MOVT_IMM(codeblock_t *block, int dst_reg, uint16_t imm);
void host_arm_MOVW_IMM(codeblock_t *block, int dst_reg, uint16_t imm);
void host_arm_MVN_REG_LSL(codeblock_t *block, int dst_reg, int src_reg, int shift);
#define host_arm_NOP(block) host_arm_MOV_REG(block, REG_R0, REG_R0)
void host_arm_ORR_IMM_cond(codeblock_t *block, uint32_t cond, int dst_reg, int src_reg, uint32_t imm);
void host_arm_ORR_REG_LSL_cond(codeblock_t *block, uint32_t cond, int dst_reg, int src_reg_n, int src_reg_m, int shift);
#define host_arm_ORR_IMM(block, dst_reg, src_reg, imm) host_arm_ORR_IMM_cond(block, COND_AL, dst_reg, src_reg, imm)
#define host_arm_ORR_REG_LSL(block, dst_reg, src_reg_a, src_reg_b, shift) host_arm_ORR_REG_LSL_cond(block, COND_AL, dst_reg, src_reg_a, src_reg_b, shift)
#define host_arm_ORRCC_IMM(block, dst_reg, src_reg, imm) host_arm_ORR_IMM_cond(block, COND_CC, dst_reg, src_reg, imm)
#define host_arm_ORREQ_IMM(block, dst_reg, src_reg, imm) host_arm_ORR_IMM_cond(block, COND_EQ, dst_reg, src_reg, imm)
#define host_arm_ORRVS_IMM(block, dst_reg, src_reg, imm) host_arm_ORR_IMM_cond(block, COND_VS, dst_reg, src_reg, imm)
void host_arm_RSB_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
void host_arm_RSB_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_RSB_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_STMDB_WB(codeblock_t *block, int addr_reg, uint32_t reg_mask);
void host_arm_STR_IMM(codeblock_t *block, int src_reg, int addr_reg, int offset);
void host_arm_STR_IMM_WB(codeblock_t *block, int src_reg, int addr_reg, int offset);
#define host_arm_STR_REG(block, src_reg, addr_reg, offset_reg) host_arm_STR_REG_LSL(block, src_reg, addr_reg, offset_reg, 0)
void host_arm_STR_REG_LSL(codeblock_t *block, int src_reg, int addr_reg, int offset_reg, int shift);
void host_arm_STRB_IMM(codeblock_t *block, int src_reg, int addr_reg, int offset);
#define host_arm_STRB_REG(block, src_reg, addr_reg, offset_reg) host_arm_STRB_REG_LSL(block, src_reg, addr_reg, offset_reg, 0)
void host_arm_STRB_REG_LSL(codeblock_t *block, int src_reg, int addr_reg, int offset_reg, int shift);
void host_arm_STRH_IMM(codeblock_t *block, int src_reg, int addr_reg, int offset);
void host_arm_STRH_REG(codeblock_t *block, int src_reg, int addr_reg, int offset_reg);
void host_arm_SUB_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
void host_arm_SUB_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_SUB_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
void host_arm_SXTB(codeblock_t *block, int dst_reg, int src_reg, int rotate);
void host_arm_SXTH(codeblock_t *block, int dst_reg, int src_reg, int rotate);
void host_arm_TST_IMM(codeblock_t *block, int src_reg1, uint32_t imm);
void host_arm_TST_REG(codeblock_t *block, int src_reg1, int src_reg2);
void host_arm_UADD8(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
void host_arm_UADD16(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
void host_arm_USUB8(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
void host_arm_USUB16(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
void host_arm_UXTB(codeblock_t *block, int dst_reg, int src_reg, int rotate);
void host_arm_UXTH(codeblock_t *block, int dst_reg, int src_reg, int rotate);
void host_arm_VABS_D(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VADD_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VADD_I8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VADD_I16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VADD_I32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VADD_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VAND_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VBIC_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCMP_D(codeblock_t *block, int src_reg_d, int src_reg_m);
void host_arm_VCEQ_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCEQ_I8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCEQ_I16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCEQ_I32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCGE_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCGT_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCGT_S8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCGT_S16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCGT_S32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VCHS_D(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VCVT_D_IS(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VCVT_D_S(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VCVT_F32_S32(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VCVT_IS_D(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VCVT_S32_F32(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VCVT_S_D(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VCVTR_IS_D(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VDIV_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VDIV_S(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VDUP_32(codeblock_t *block, int dst_reg, int src_reg_m, int imm);
void host_arm_VEOR_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VLDR_D(codeblock_t *block, int dest_reg, int base_reg, int offset);
void host_arm_VLDR_S(codeblock_t *block, int dest_reg, int base_reg, int offset);
void host_arm_VMOV_32_S(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VMOV_64_D(codeblock_t *block, int dest_reg_low, int dest_reg_high, int src_reg);
void host_arm_VMOV_D_64(codeblock_t *block, int dest_reg, int src_reg_low, int src_reg_high);
void host_arm_VMOV_S_32(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VMOV_D_D(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VMOVN_I32(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VMOVN_I64(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VMRS_APSR(codeblock_t *block);
void host_arm_VMSR_FPSCR(codeblock_t *block, int src_reg);
void host_arm_VMAX_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VMIN_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VMOV_F32_ONE(codeblock_t *block, int dst_reg);
void host_arm_VMUL_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VMUL_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VMUL_S16(codeblock_t *block, int dest_reg, int src_reg_n, int src_reg_m);
void host_arm_VMULL_S16(codeblock_t *block, int dest_reg, int src_reg_n, int src_reg_m);
void host_arm_VNEG_D(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VORR_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VPADDL_S16(codeblock_t *block, int dst_reg, int src_reg);
void host_arm_VPADDL_S32(codeblock_t *block, int dst_reg, int src_reg);
void host_arm_VPADDL_Q_S32(codeblock_t *block, int dst_reg, int src_reg);
void host_arm_VQADD_S8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VQADD_U8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VQADD_S16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VQADD_U16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VQSUB_S8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VQSUB_U8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VQSUB_S16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VQSUB_U16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VQMOVN_S16(codeblock_t *block, int dst_reg, int src_reg);
void host_arm_VQMOVN_S32(codeblock_t *block, int dst_reg, int src_reg);
void host_arm_VQMOVN_U16(codeblock_t *block, int dst_reg, int src_reg);
void host_arm_VSHL_D_IMM_16(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHL_D_IMM_32(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHL_D_IMM_64(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHR_D_S16(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHR_D_S32(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHR_D_S64(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHR_D_U16(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHR_D_U32(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHR_D_U64(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSHRN_32(codeblock_t *block, int dest_reg, int src_reg, int shift);
void host_arm_VSQRT_D(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VSQRT_S(codeblock_t *block, int dest_reg, int src_reg);
void host_arm_VSTR_D(codeblock_t *block, int src_reg, int base_reg, int offset);
void host_arm_VSTR_S(codeblock_t *block, int src_reg, int base_reg, int offset);
void host_arm_VSUB_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VSUB_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VSUB_S(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VSUB_I8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VSUB_I16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VSUB_I32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
void host_arm_VZIP_D8(codeblock_t *block, int d_reg, int m_reg);
void host_arm_VZIP_D16(codeblock_t *block, int d_reg, int m_reg);
void host_arm_VZIP_D32(codeblock_t *block, int d_reg, int m_reg);

File diff suppressed because it is too large Load Diff

View File

@@ -1,345 +0,0 @@
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
# include <stddef.h>
# include <stdint.h>
# include <stdlib.h>
# include <86box/86box.h>
# include "cpu.h"
# include <86box/mem.h>
# include "codegen.h"
# include "codegen_allocator.h"
# include "codegen_backend.h"
# include "codegen_backend_x86_defs.h"
# include "codegen_backend_x86_ops.h"
# include "codegen_backend_x86_ops_sse.h"
# include "codegen_reg.h"
# include "x86.h"
# include "x86seg_common.h"
# include "x86seg.h"
# if defined(__linux__) || defined(__APPLE__)
# include <sys/mman.h>
# include <unistd.h>
# endif
# if defined WIN32 || defined _WIN32 || defined _WIN32
# include <windows.h>
# endif
# include <string.h>
void *codegen_mem_load_byte;
void *codegen_mem_load_word;
void *codegen_mem_load_long;
void *codegen_mem_load_quad;
void *codegen_mem_load_single;
void *codegen_mem_load_double;
void *codegen_mem_store_byte;
void *codegen_mem_store_word;
void *codegen_mem_store_long;
void *codegen_mem_store_quad;
void *codegen_mem_store_single;
void *codegen_mem_store_double;
void *codegen_gpf_rout;
void *codegen_exit_rout;
host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] = {
/*Note: while EAX and EDX are normally volatile registers under x86
calling conventions, the recompiler will explicitly save and restore
them across funcion calls*/
{REG_EAX, 0},
{ REG_EBX, 0},
{ REG_EDX, 0}
};
host_reg_def_t codegen_host_fp_reg_list[CODEGEN_HOST_FP_REGS] = {
{REG_XMM0, HOST_REG_FLAG_VOLATILE},
{ REG_XMM1, HOST_REG_FLAG_VOLATILE},
{ REG_XMM2, HOST_REG_FLAG_VOLATILE},
{ REG_XMM3, HOST_REG_FLAG_VOLATILE},
{ REG_XMM4, HOST_REG_FLAG_VOLATILE},
{ REG_XMM5, HOST_REG_FLAG_VOLATILE}
};
static void
build_load_routine(codeblock_t *block, int size, int is_float)
{
uint8_t *branch_offset;
uint8_t *misaligned_offset = NULL;
/*In - ESI = address
Out - ECX = data, ESI = abrt*/
/*MOV ECX, ESI
SHR ESI, 12
MOV ESI, [readlookup2+ESI*4]
CMP ESI, -1
JNZ +
MOVZX ECX, B[ESI+ECX]
XOR ESI,ESI
RET
* PUSH EAX
PUSH EDX
PUSH ECX
CALL readmembl
POP ECX
POP EDX
POP EAX
MOVZX ECX, AL
RET
*/
host_x86_MOV32_REG_REG(block, REG_ECX, REG_ESI);
host_x86_SHR32_IMM(block, REG_ESI, 12);
host_x86_MOV32_REG_ABS_INDEX_SHIFT(block, REG_ESI, readlookup2, REG_ESI, 2);
if (size != 1) {
host_x86_TEST32_REG_IMM(block, REG_ECX, size - 1);
misaligned_offset = host_x86_JNZ_short(block);
}
host_x86_CMP32_REG_IMM(block, REG_ESI, (uint32_t) -1);
branch_offset = host_x86_JZ_short(block);
if (size == 1 && !is_float)
host_x86_MOVZX_BASE_INDEX_32_8(block, REG_ECX, REG_ESI, REG_ECX);
else if (size == 2 && !is_float)
host_x86_MOVZX_BASE_INDEX_32_16(block, REG_ECX, REG_ESI, REG_ECX);
else if (size == 4 && !is_float)
host_x86_MOV32_REG_BASE_INDEX(block, REG_ECX, REG_ESI, REG_ECX);
else if (size == 4 && is_float)
host_x86_CVTSS2SD_XREG_BASE_INDEX(block, REG_XMM_TEMP, REG_ESI, REG_ECX);
else if (size == 8)
host_x86_MOVQ_XREG_BASE_INDEX(block, REG_XMM_TEMP, REG_ESI, REG_ECX);
else
fatal("build_load_routine: size=%i\n", size);
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
host_x86_RET(block);
*branch_offset = (uint8_t) ((uintptr_t) &block_write_data[block_pos] - (uintptr_t) branch_offset) - 1;
if (size != 1)
*misaligned_offset = (uint8_t) ((uintptr_t) &block_write_data[block_pos] - (uintptr_t) misaligned_offset) - 1;
host_x86_PUSH(block, REG_EAX);
host_x86_PUSH(block, REG_EDX);
host_x86_PUSH(block, REG_ECX);
if (size == 1)
host_x86_CALL(block, (void *) readmembl);
else if (size == 2)
host_x86_CALL(block, (void *) readmemwl);
else if (size == 4)
host_x86_CALL(block, (void *) readmemll);
else if (size == 8)
host_x86_CALL(block, (void *) readmemql);
host_x86_POP(block, REG_ECX);
if (size == 1 && !is_float)
host_x86_MOVZX_REG_32_8(block, REG_ECX, REG_EAX);
else if (size == 2 && !is_float)
host_x86_MOVZX_REG_32_16(block, REG_ECX, REG_EAX);
else if (size == 4 && !is_float)
host_x86_MOV32_REG_REG(block, REG_ECX, REG_EAX);
else if (size == 4 && is_float) {
host_x86_MOVD_XREG_REG(block, REG_XMM_TEMP, REG_EAX);
host_x86_CVTSS2SD_XREG_XREG(block, REG_XMM_TEMP, REG_XMM_TEMP);
} else if (size == 8) {
host_x86_MOVD_XREG_REG(block, REG_XMM_TEMP, REG_EAX);
host_x86_MOVD_XREG_REG(block, REG_XMM_TEMP2, REG_EDX);
host_x86_UNPCKLPS_XREG_XREG(block, REG_XMM_TEMP, REG_XMM_TEMP2);
}
host_x86_POP(block, REG_EDX);
host_x86_POP(block, REG_EAX);
host_x86_MOVZX_REG_ABS_32_8(block, REG_ESI, &cpu_state.abrt);
host_x86_RET(block);
block_pos = (block_pos + 63) & ~63;
}
static void
build_store_routine(codeblock_t *block, int size, int is_float)
{
uint8_t *branch_offset;
uint8_t *misaligned_offset = NULL;
/*In - ECX = data, ESI = address
Out - ESI = abrt
Corrupts EDI*/
/*MOV EDI, ESI
SHR ESI, 12
MOV ESI, [writelookup2+ESI*4]
CMP ESI, -1
JNZ +
MOV [ESI+EDI], ECX
XOR ESI,ESI
RET
* PUSH EAX
PUSH EDX
PUSH ECX
CALL writemembl
POP ECX
POP EDX
POP EAX
MOVZX ECX, AL
RET
*/
host_x86_MOV32_REG_REG(block, REG_EDI, REG_ESI);
host_x86_SHR32_IMM(block, REG_ESI, 12);
host_x86_MOV32_REG_ABS_INDEX_SHIFT(block, REG_ESI, writelookup2, REG_ESI, 2);
if (size != 1) {
host_x86_TEST32_REG_IMM(block, REG_EDI, size - 1);
misaligned_offset = host_x86_JNZ_short(block);
}
host_x86_CMP32_REG_IMM(block, REG_ESI, (uint32_t) -1);
branch_offset = host_x86_JZ_short(block);
if (size == 1 && !is_float)
host_x86_MOV8_BASE_INDEX_REG(block, REG_ESI, REG_EDI, REG_ECX);
else if (size == 2 && !is_float)
host_x86_MOV16_BASE_INDEX_REG(block, REG_ESI, REG_EDI, REG_ECX);
else if (size == 4 && !is_float)
host_x86_MOV32_BASE_INDEX_REG(block, REG_ESI, REG_EDI, REG_ECX);
else if (size == 4 && is_float)
host_x86_MOVD_BASE_INDEX_XREG(block, REG_ESI, REG_EDI, REG_XMM_TEMP);
else if (size == 8)
host_x86_MOVQ_BASE_INDEX_XREG(block, REG_ESI, REG_EDI, REG_XMM_TEMP);
else
fatal("build_store_routine: size=%i is_float=%i\n", size, is_float);
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
host_x86_RET(block);
*branch_offset = (uint8_t) ((uintptr_t) &block_write_data[block_pos] - (uintptr_t) branch_offset) - 1;
if (size != 1)
*misaligned_offset = (uint8_t) ((uintptr_t) &block_write_data[block_pos] - (uintptr_t) misaligned_offset) - 1;
if (size == 4 && is_float)
host_x86_MOVD_REG_XREG(block, REG_ECX, REG_XMM_TEMP);
host_x86_PUSH(block, REG_EAX);
host_x86_PUSH(block, REG_EDX);
host_x86_PUSH(block, REG_ECX);
if (size == 8) {
host_x86_MOVQ_STACK_OFFSET_XREG(block, -8, REG_XMM_TEMP);
host_x86_SUB32_REG_IMM(block, REG_ESP, 8);
}
host_x86_PUSH(block, REG_EDI);
if (size == 1)
host_x86_CALL(block, (void *) writemembl);
else if (size == 2)
host_x86_CALL(block, (void *) writememwl);
else if (size == 4)
host_x86_CALL(block, (void *) writememll);
else if (size == 8)
host_x86_CALL(block, (void *) writememql);
host_x86_POP(block, REG_EDI);
if (size == 8)
host_x86_ADD32_REG_IMM(block, REG_ESP, 8);
host_x86_POP(block, REG_ECX);
host_x86_POP(block, REG_EDX);
host_x86_POP(block, REG_EAX);
host_x86_MOVZX_REG_ABS_32_8(block, REG_ESI, &cpu_state.abrt);
host_x86_RET(block);
block_pos = (block_pos + 63) & ~63;
}
static void
build_loadstore_routines(codeblock_t *block)
{
codegen_mem_load_byte = &codeblock[block_current].data[block_pos];
build_load_routine(block, 1, 0);
codegen_mem_load_word = &codeblock[block_current].data[block_pos];
build_load_routine(block, 2, 0);
codegen_mem_load_long = &codeblock[block_current].data[block_pos];
build_load_routine(block, 4, 0);
codegen_mem_load_quad = &codeblock[block_current].data[block_pos];
build_load_routine(block, 8, 0);
codegen_mem_load_single = &codeblock[block_current].data[block_pos];
build_load_routine(block, 4, 1);
codegen_mem_load_double = &codeblock[block_current].data[block_pos];
build_load_routine(block, 8, 1);
codegen_mem_store_byte = &codeblock[block_current].data[block_pos];
build_store_routine(block, 1, 0);
codegen_mem_store_word = &codeblock[block_current].data[block_pos];
build_store_routine(block, 2, 0);
codegen_mem_store_long = &codeblock[block_current].data[block_pos];
build_store_routine(block, 4, 0);
codegen_mem_store_quad = &codeblock[block_current].data[block_pos];
build_store_routine(block, 8, 0);
codegen_mem_store_single = &codeblock[block_current].data[block_pos];
build_store_routine(block, 4, 1);
codegen_mem_store_double = &codeblock[block_current].data[block_pos];
build_store_routine(block, 8, 1);
}
void
codegen_backend_init(void)
{
codeblock_t *block;
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
codeblock_hash = malloc(HASH_SIZE * sizeof(codeblock_t *));
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
for (uint32_t c = 0; c < BLOCK_SIZE; c++)
codeblock[c].pc = BLOCK_PC_INVALID;
block_current = 0;
block_pos = 0;
block = &codeblock[block_current];
block->head_mem_block = codegen_allocator_allocate(NULL, block_current);
block->data = codeblock_allocator_get_ptr(block->head_mem_block);
block_write_data = block->data;
build_loadstore_routines(block);
codegen_gpf_rout = &codeblock[block_current].data[block_pos];
host_x86_MOV32_STACK_IMM(block, STACK_ARG0, 0);
host_x86_MOV32_STACK_IMM(block, STACK_ARG1, 0);
host_x86_CALL(block, (void *) x86gpf);
codegen_exit_rout = &codeblock[block_current].data[block_pos];
host_x86_ADD32_REG_IMM(block, REG_ESP, 64);
host_x86_POP(block, REG_EDI);
host_x86_POP(block, REG_ESI);
host_x86_POP(block, REG_EBP);
host_x86_POP(block, REG_EDX);
host_x86_RET(block);
block_write_data = NULL;
cpu_state.old_fp_control = 0;
asm(
"fstcw %0\n"
"stmxcsr %1\n"
: "=m"(cpu_state.old_fp_control2),
"=m"(cpu_state.old_fp_control));
cpu_state.trunc_fp_control = cpu_state.old_fp_control | 0x6000;
}
void
codegen_set_rounding_mode(int mode)
{
/*SSE*/
cpu_state.new_fp_control = (cpu_state.old_fp_control & ~0x6000) | (mode << 13);
/*x87 - used for double -> i64 conversions*/
cpu_state.new_fp_control2 = (cpu_state.old_fp_control2 & ~0x0c00) | (mode << 10);
}
void
codegen_backend_prologue(codeblock_t *block)
{
block_pos = BLOCK_START; /*Entry code*/
host_x86_PUSH(block, REG_EBX);
host_x86_PUSH(block, REG_EBP);
host_x86_PUSH(block, REG_ESI);
host_x86_PUSH(block, REG_EDI);
host_x86_SUB32_REG_IMM(block, REG_ESP, 64);
host_x86_MOV32_REG_IMM(block, REG_EBP, ((uintptr_t) &cpu_state) + 128);
if (block->flags & CODEBLOCK_HAS_FPU) {
host_x86_MOV32_REG_ABS(block, REG_EAX, &cpu_state.TOP);
host_x86_SUB32_REG_IMM(block, REG_EAX, block->TOP);
host_x86_MOV32_BASE_OFFSET_REG(block, REG_ESP, IREG_TOP_diff_stack_offset, REG_EAX);
}
}
void
codegen_backend_epilogue(codeblock_t *block)
{
host_x86_ADD32_REG_IMM(block, REG_ESP, 64);
host_x86_POP(block, REG_EDI);
host_x86_POP(block, REG_ESI);
host_x86_POP(block, REG_EBP);
host_x86_POP(block, REG_EDX);
host_x86_RET(block);
}
#endif

View File

@@ -1,14 +0,0 @@
#include "codegen_backend_x86_defs.h"
#define BLOCK_SIZE 0x10000
#define BLOCK_MASK 0xffff
#define BLOCK_START 0
#define HASH_SIZE 0x20000
#define HASH_MASK 0x1ffff
#define HASH(l) ((l) &0x1ffff)
#define BLOCK_MAX 0x3c0
#define CODEGEN_BACKEND_HAS_MOV_IMM

View File

@@ -1,50 +0,0 @@
#ifndef _CODEGEN_BACKEND_X86_DEFS_H_
#define _CODEGEN_BACKEND_X86_DEFS_H_
#define REG_EAX 0
#define REG_ECX 1
#define REG_EDX 2
#define REG_EBX 3
#define REG_ESP 4
#define REG_EBP 5
#define REG_ESI 6
#define REG_EDI 7
#define REG_XMM0 0
#define REG_XMM1 1
#define REG_XMM2 2
#define REG_XMM3 3
#define REG_XMM4 4
#define REG_XMM5 5
#define REG_XMM6 6
#define REG_XMM7 7
#define REG_XMM_TEMP REG_XMM7
#define REG_XMM_TEMP2 REG_XMM6
#define CODEGEN_HOST_REGS 3
#define CODEGEN_HOST_FP_REGS 6
extern void *codegen_mem_load_byte;
extern void *codegen_mem_load_word;
extern void *codegen_mem_load_long;
extern void *codegen_mem_load_quad;
extern void *codegen_mem_load_single;
extern void *codegen_mem_load_double;
extern void *codegen_mem_store_byte;
extern void *codegen_mem_store_word;
extern void *codegen_mem_store_long;
extern void *codegen_mem_store_quad;
extern void *codegen_mem_store_single;
extern void *codegen_mem_store_double;
extern void *codegen_gpf_rout;
extern void *codegen_exit_rout;
#define STACK_ARG0 (0)
#define STACK_ARG1 (4)
#define STACK_ARG2 (8)
#define STACK_ARG3 (12)
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,195 +0,0 @@
void host_x86_ADD32_REG_ABS(codeblock_t *block, int dst_reg, void *p);
void host_x86_ADD8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
void host_x86_ADD16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
void host_x86_ADD32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
void host_x86_ADD8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_ADD16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_ADD32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_AND8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
void host_x86_AND16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
void host_x86_AND32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
void host_x86_AND8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_AND16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_AND32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_CALL(codeblock_t *block, void *p);
void host_x86_CMP16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
void host_x86_CMP32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
void host_x86_CMP8_REG_REG(codeblock_t *block, int src_reg_a, int src_reg_b);
void host_x86_CMP16_REG_REG(codeblock_t *block, int src_reg_a, int src_reg_b);
void host_x86_CMP32_REG_REG(codeblock_t *block, int src_reg_a, int src_reg_b);
void host_x86_INC32_ABS(codeblock_t *block, void *p);
void host_x86_JMP(codeblock_t *block, void *p);
uint32_t *host_x86_JMP_short(codeblock_t *block);
uint32_t *host_x86_JMP_long(codeblock_t *block);
void host_x86_JNZ(codeblock_t *block, void *p);
void host_x86_JZ(codeblock_t *block, void *p);
uint8_t *host_x86_JNZ_short(codeblock_t *block);
uint8_t *host_x86_JS_short(codeblock_t *block);
uint8_t *host_x86_JZ_short(codeblock_t *block);
uint32_t *host_x86_JNB_long(codeblock_t *block);
uint32_t *host_x86_JNBE_long(codeblock_t *block);
uint32_t *host_x86_JNL_long(codeblock_t *block);
uint32_t *host_x86_JNLE_long(codeblock_t *block);
uint32_t *host_x86_JNO_long(codeblock_t *block);
uint32_t *host_x86_JNS_long(codeblock_t *block);
uint32_t *host_x86_JNZ_long(codeblock_t *block);
uint32_t *host_x86_JB_long(codeblock_t *block);
uint32_t *host_x86_JBE_long(codeblock_t *block);
uint32_t *host_x86_JL_long(codeblock_t *block);
uint32_t *host_x86_JLE_long(codeblock_t *block);
uint32_t *host_x86_JO_long(codeblock_t *block);
uint32_t *host_x86_JS_long(codeblock_t *block);
uint32_t *host_x86_JZ_long(codeblock_t *block);
void host_x86_LAHF(codeblock_t *block);
void host_x86_LEA_REG_IMM(codeblock_t *block, int dst_reg, int src_reg_a, uint32_t offset);
void host_x86_LEA_REG_REG(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
void host_x86_LEA_REG_REG_SHIFT(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b, int shift);
void host_x86_MOV8_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data);
void host_x86_MOV16_ABS_IMM(codeblock_t *block, void *p, uint16_t imm_data);
void host_x86_MOV32_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data);
void host_x86_MOV8_ABS_REG(codeblock_t *block, void *p, int src_reg);
void host_x86_MOV16_ABS_REG(codeblock_t *block, void *p, int src_reg);
void host_x86_MOV32_ABS_REG(codeblock_t *block, void *p, int src_reg);
void host_x86_MOV8_ABS_REG_REG_SHIFT_REG(codeblock_t *block, uint32_t addr, int base_reg, int idx_reg, int shift, int src_reg);
void host_x86_MOV8_BASE_INDEX_REG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
void host_x86_MOV16_BASE_INDEX_REG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
void host_x86_MOV32_BASE_INDEX_REG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
void host_x86_MOV16_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset, int dst_reg);
void host_x86_MOV32_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset, int dst_reg);
void host_x86_MOV32_BASE_OFFSET_IMM(codeblock_t *block, int base_reg, int offset, uint32_t imm_data);
void host_x86_MOV8_REG_ABS(codeblock_t *block, int dst_reg, void *p);
void host_x86_MOV16_REG_ABS(codeblock_t *block, int dst_reg, void *p);
void host_x86_MOV32_REG_ABS(codeblock_t *block, int dst_reg, void *p);
void host_x86_MOV32_REG_ABS_INDEX_SHIFT(codeblock_t *block, int dst_reg, void *p, int idx_reg, int shift);
void host_x86_MOV8_REG_ABS_REG_REG_SHIFT(codeblock_t *block, int dst_addr, uint32_t addr, int base_reg, int idx_reg, int shift);
void host_x86_MOV32_REG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
void host_x86_MOV16_REG_BASE_OFFSET(codeblock_t *block, int dst_reg, int base_reg, int offset);
void host_x86_MOV32_REG_BASE_OFFSET(codeblock_t *block, int dst_reg, int base_reg, int offset);
void host_x86_MOV8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
void host_x86_MOV16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
void host_x86_MOV32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
void host_x86_MOV8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOV16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOV32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
#define host_x86_MOV16_STACK_REG(block, offset, src_reg) host_x86_MOV16_BASE_OFFSET_REG(block, REG_ESP, offset, src_reg)
void host_x86_MOV32_STACK_IMM(codeblock_t *block, int32_t offset, uint32_t imm_data);
void host_x86_MOVSX_REG_16_8(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVSX_REG_32_8(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVSX_REG_32_16(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVZX_REG_16_8(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVZX_REG_32_8(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVZX_REG_32_16(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVZX_REG_ABS_16_8(codeblock_t *block, int dst_reg, void *p);
void host_x86_MOVZX_REG_ABS_32_8(codeblock_t *block, int dst_reg, void *p);
void host_x86_MOVZX_REG_ABS_32_16(codeblock_t *block, int dst_reg, void *p);
void host_x86_MOVZX_BASE_INDEX_32_8(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
void host_x86_MOVZX_BASE_INDEX_32_16(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
void host_x86_OR8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_OR16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_OR32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_OR8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
void host_x86_OR16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
void host_x86_OR32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
void host_x86_POP(codeblock_t *block, int src_reg);
void host_x86_PUSH(codeblock_t *block, int src_reg);
void host_x86_RET(codeblock_t *block);
void host_x86_ROL8_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_ROL16_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_ROL32_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_ROL8_CL(codeblock_t *block, int dst_reg);
void host_x86_ROL16_CL(codeblock_t *block, int dst_reg);
void host_x86_ROL32_CL(codeblock_t *block, int dst_reg);
void host_x86_ROR8_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_ROR16_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_ROR32_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_ROR8_CL(codeblock_t *block, int dst_reg);
void host_x86_ROR16_CL(codeblock_t *block, int dst_reg);
void host_x86_ROR32_CL(codeblock_t *block, int dst_reg);
void host_x86_SAR8_CL(codeblock_t *block, int dst_reg);
void host_x86_SAR16_CL(codeblock_t *block, int dst_reg);
void host_x86_SAR32_CL(codeblock_t *block, int dst_reg);
void host_x86_SAR8_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SAR16_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SAR32_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SHL8_CL(codeblock_t *block, int dst_reg);
void host_x86_SHL16_CL(codeblock_t *block, int dst_reg);
void host_x86_SHL32_CL(codeblock_t *block, int dst_reg);
void host_x86_SHL8_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SHL16_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SHL32_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SHR8_CL(codeblock_t *block, int dst_reg);
void host_x86_SHR16_CL(codeblock_t *block, int dst_reg);
void host_x86_SHR32_CL(codeblock_t *block, int dst_reg);
void host_x86_SHR8_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SHR16_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SHR32_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_SUB8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
void host_x86_SUB16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
void host_x86_SUB32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
void host_x86_SUB8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_SUB16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_SUB32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_TEST8_REG(codeblock_t *block, int src_host_reg, int dst_host_reg);
void host_x86_TEST16_REG(codeblock_t *block, int src_host_reg, int dst_host_reg);
void host_x86_TEST32_REG(codeblock_t *block, int src_host_reg, int dst_host_reg);
void host_x86_TEST32_REG_IMM(codeblock_t *block, int src_host_reg, uint32_t imm_data);
void host_x86_XOR8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_XOR16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_XOR32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_XOR8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
void host_x86_XOR16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
void host_x86_XOR32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);

View File

@@ -1,75 +0,0 @@
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
# include <stdint.h>
# include <86box/86box.h>
# include "cpu.h"
# include <86box/mem.h>
# include <86box/plat_unused.h>
# include "codegen.h"
# include "codegen_allocator.h"
# include "codegen_backend.h"
# include "codegen_backend_x86_defs.h"
# include "codegen_backend_x86_ops_fpu.h"
# include "codegen_backend_x86_ops_helpers.h"
void
host_x87_FILDq_BASE(codeblock_t *block, int base_reg)
{
if (base_reg == REG_ESP) {
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0xdf, 0x2c, 0x24); /*FILDq [ESP]*/
} else {
codegen_alloc_bytes(block, 2);
codegen_addbyte2(block, 0xdf, 0x28 | base_reg); /*FILDq [base_reg]*/
}
}
void
host_x87_FISTPq_BASE(codeblock_t *block, int base_reg)
{
if (base_reg == REG_ESP) {
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0xdf, 0x3c, 0x24); /*FISTPq [ESP]*/
} else {
codegen_alloc_bytes(block, 2);
codegen_addbyte2(block, 0xdf, 0x38 | base_reg); /*FISTPq [base_reg]*/
}
}
void
host_x87_FLDCW(codeblock_t *block, void *p)
{
int offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
if (offset >= -128 && offset < 127) {
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0xd9, 0x68 | REG_EBP, offset); /*FLDCW offset[EBP]*/
} else {
codegen_alloc_bytes(block, 6);
codegen_addbyte2(block, 0xd9, 0x2d); /*FLDCW [p]*/
codegen_addlong(block, (uint32_t) p);
}
}
void
host_x87_FLDd_BASE(codeblock_t *block, int base_reg)
{
if (base_reg == REG_ESP) {
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0xdd, 0x04, 0x24); /*FILDq [ESP]*/
} else {
codegen_alloc_bytes(block, 2);
codegen_addbyte2(block, 0xdd, 0x08 | base_reg); /*FILDq [base_reg]*/
}
}
void
host_x87_FSTPd_BASE(codeblock_t *block, int base_reg)
{
if (base_reg == REG_ESP) {
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0xdd, 0x1c, 0x24); /*FILDq [ESP]*/
} else {
codegen_alloc_bytes(block, 2);
codegen_addbyte2(block, 0xdd, 0x18 | base_reg); /*FILDq [base_reg]*/
}
}
#endif

View File

@@ -1,5 +0,0 @@
void host_x87_FILDq_BASE(codeblock_t *block, int base_reg);
void host_x87_FISTPq_BASE(codeblock_t *block, int base_reg);
void host_x87_FLDCW(codeblock_t *block, void *p);
void host_x87_FLDd_BASE(codeblock_t *block, int base_reg);
void host_x87_FSTPd_BASE(codeblock_t *block, int base_reg);

View File

@@ -1,94 +0,0 @@
#define JMP_LEN_BYTES 5
static inline void
codegen_addbyte(UNUSED(codeblock_t *block), uint8_t val)
{
if (block_pos >= BLOCK_MAX)
fatal("codegen_addbyte over! %i\n", block_pos);
block_write_data[block_pos++] = val;
}
static inline void
codegen_addbyte2(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb)
{
if (block_pos > (BLOCK_MAX - 2))
fatal("codegen_addbyte2 over! %i\n", block_pos);
block_write_data[block_pos++] = vala;
block_write_data[block_pos++] = valb;
}
static inline void
codegen_addbyte3(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb, uint8_t valc)
{
if (block_pos > (BLOCK_MAX - 3))
fatal("codegen_addbyte3 over! %i\n", block_pos);
block_write_data[block_pos++] = vala;
block_write_data[block_pos++] = valb;
block_write_data[block_pos++] = valc;
}
static inline void
codegen_addbyte4(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb, uint8_t valc, uint8_t vald)
{
if (block_pos > (BLOCK_MAX - 4))
fatal("codegen_addbyte4 over! %i\n", block_pos);
block_write_data[block_pos++] = vala;
block_write_data[block_pos++] = valb;
block_write_data[block_pos++] = valc;
block_write_data[block_pos++] = vald;
}
static inline void
codegen_addword(UNUSED(codeblock_t *block), uint16_t val)
{
if (block_pos > (BLOCK_MAX - 2))
fatal("codegen_addword over! %i\n", block_pos);
*(uint16_t *) &block_write_data[block_pos] = val;
block_pos += 2;
}
static inline void
codegen_addlong(UNUSED(codeblock_t *block), uint32_t val)
{
if (block_pos > (BLOCK_MAX - 4))
fatal("codegen_addlong over! %i\n", block_pos);
*(uint32_t *) &block_write_data[block_pos] = val;
block_pos += 4;
}
static inline void
codegen_addquad(UNUSED(codeblock_t *block), uint64_t val)
{
if (block_pos > (BLOCK_MAX - 8))
fatal("codegen_addquad over! %i\n", block_pos);
*(uint64_t *) &block_write_data[block_pos] = val;
block_pos += 8;
}
static void
codegen_allocate_new_block(codeblock_t *block)
{
/*Current block is full. Allocate a new block*/
struct mem_block_t *new_block = codegen_allocator_allocate(block->head_mem_block, get_block_nr(block));
uint8_t *new_ptr = codeblock_allocator_get_ptr(new_block);
/*Add a jump instruction to the new block*/
codegen_addbyte(block, 0xe9); /*JMP*/
codegen_addlong(block, (uintptr_t) new_ptr - (uintptr_t) &block_write_data[block_pos + 4]);
/*Set write address to start of new block*/
block_pos = 0;
block_write_data = new_ptr;
}
static inline void
codegen_alloc_bytes(codeblock_t *block, int size)
{
if (block_pos > ((BLOCK_MAX - size) - JMP_LEN_BYTES))
codegen_allocate_new_block(block);
}
static inline int
is_imm8(uint32_t imm_data)
{
if (imm_data <= 0x7f || imm_data >= 0xffffff80)
return 1;
return 0;
}

View File

@@ -1,630 +0,0 @@
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
# include <stdint.h>
# include <86box/86box.h>
# include "cpu.h"
# include <86box/mem.h>
# include <86box/plat_unused.h>
# include "codegen.h"
# include "codegen_allocator.h"
# include "codegen_backend.h"
# include "codegen_backend_x86_defs.h"
# include "codegen_backend_x86_ops_sse.h"
# include "codegen_backend_x86_ops_helpers.h"
void
host_x86_ADDPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0x0f, 0x58, 0xc0 | src_reg | (dst_reg << 3)); /*ADDPS dst_reg, src_reg*/
}
void
host_x86_ADDSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x58, 0xc0 | src_reg | (dst_reg << 3));
}
void
host_x86_CMPPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg, int type)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x0f, 0xc2, 0xc0 | src_reg | (dst_reg << 3), type); /*CMPPS dst_reg, src_reg, type*/
}
void
host_x86_COMISD_XREG_XREG(codeblock_t *block, int src_reg_a, int src_reg_b)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x2e, 0xc0 | src_reg_b | (src_reg_a << 3));
}
void
host_x86_CVTDQ2PS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0x0f, 0x5b, 0xc0 | src_reg | (dst_reg << 3)); /*CVTDQ2PS dst_reg, src_reg*/
}
void
host_x86_CVTPS2DQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x5b, 0xc0 | src_reg | (dst_reg << 3)); /*CVTPS2DQ dst_reg, src_reg*/
}
void
host_x86_CVTSD2SI_REG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x2d, 0xc0 | src_reg | (dst_reg << 3)); /*CVTSD2SI dst_reg, src_reg*/
}
void
host_x86_CVTSD2SS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x5a, 0xc0 | src_reg | (dst_reg << 3)); /*CVTSD2SS dst_reg, src_reg*/
}
void
host_x86_CVTSI2SD_XREG_REG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x2a, 0xc0 | src_reg | (dst_reg << 3)); /*CVTSI2SD dst_reg, src_reg*/
}
void
host_x86_CVTSI2SS_XREG_REG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf3, 0x0f, 0x2a, 0xc0 | src_reg | (dst_reg << 3)); /*CVTSI2SD dst_reg, src_reg*/
}
void
host_x86_CVTSS2SD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf3, 0x0f, 0x5a, 0xc0 | src_reg | (dst_reg << 3));
}
void
host_x86_CVTSS2SD_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0xf3, 0x0f, 0x5a, 0x04 | (dst_reg << 3)); /*CVTSS2SD XMMx, [base_reg + idx_reg]*/
codegen_addbyte(block, base_reg | (idx_reg << 3));
}
void
host_x86_DIVSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x5e, 0xc0 | src_reg | (dst_reg << 3)); /*DIVSD dst_reg, src_reg*/
}
void
host_x86_DIVSS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf3, 0x0f, 0x5e, 0xc0 | src_reg | (dst_reg << 3)); /*DIVSS dst_reg, src_reg*/
}
void
host_x86_LDMXCSR(codeblock_t *block, void *p)
{
int offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
if (offset >= -128 && offset < 127) {
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x0f, 0xae, 0x50 | REG_EBP, offset); /*LDMXCSR offset[EBP]*/
} else {
codegen_alloc_bytes(block, 7);
codegen_addbyte3(block, 0x0f, 0xae, 0x15); /*LDMXCSR [p]*/
codegen_addlong(block, (uint32_t) p);
}
}
void
host_x86_MAXSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x5f, 0xc0 | src_reg | (dst_reg << 3)); /*MAXSD dst_reg, src_reg*/
}
void
host_x86_MOVD_BASE_INDEX_XREG(codeblock_t *block, int base_reg, int idx_reg, int src_reg)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x7e, 0x04 | (src_reg << 3)); /*MOVD XMMx, [base_reg + idx_reg]*/
codegen_addbyte(block, base_reg | (idx_reg << 3));
}
void
host_x86_MOVD_REG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x7e, 0xc0 | dst_reg | (src_reg << 3));
}
void
host_x86_MOVD_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x6e, 0x04 | (dst_reg << 3)); /*MOVD XMMx, [base_reg + idx_reg]*/
codegen_addbyte(block, base_reg | (idx_reg << 3));
}
void
host_x86_MOVD_XREG_REG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x6e, 0xc0 | src_reg | (dst_reg << 3));
}
void
host_x86_MOVQ_ABS_XREG(codeblock_t *block, void *p, int src_reg)
{
int offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
if (offset >= -128 && offset < 127) {
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x45 | (src_reg << 3)); /*MOVQ offset[EBP], src_reg*/
codegen_addbyte(block, offset);
} else {
codegen_alloc_bytes(block, 8);
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x05 | (src_reg << 3)); /*MOVQ [p], src_reg*/
codegen_addlong(block, (uint32_t) p);
}
}
void
host_x86_MOVQ_ABS_REG_REG_SHIFT_XREG(codeblock_t *block, uint32_t addr, int src_reg_a, int src_reg_b, int shift, int src_reg)
{
if (addr < 0x80 || addr >= 0xffffff80) {
codegen_alloc_bytes(block, 6);
codegen_addbyte3(block, 0x66, 0x0f, 0xd6); /*MOVQ addr[src_reg_a + src_reg_b << shift], XMMx*/
codegen_addbyte3(block, 0x44 | (src_reg << 3), src_reg_a | (src_reg_b << 3) | (shift << 6), addr & 0xff);
} else {
codegen_alloc_bytes(block, 9);
codegen_addbyte3(block, 0x66, 0x0f, 0xd6); /*MOVQ addr[src_reg_a + src_reg_b << shift], XMMx*/
codegen_addbyte2(block, 0x84 | (src_reg << 3), src_reg_a | (src_reg_b << 3) | (shift << 6));
codegen_addlong(block, addr);
}
}
void
host_x86_MOVQ_BASE_INDEX_XREG(codeblock_t *block, int base_reg, int idx_reg, int src_reg)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x04 | (src_reg << 3)); /*MOVQ XMMx, [base_reg + idx_reg]*/
codegen_addbyte(block, base_reg | (idx_reg << 3));
}
void
host_x86_MOVQ_BASE_OFFSET_XREG(codeblock_t *block, int base_reg, int offset, int src_reg)
{
if (offset >= -128 && offset < 127) {
if (base_reg == REG_ESP) {
codegen_alloc_bytes(block, 6);
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x44 | (src_reg << 3)); /*MOVQ [ESP + offset], XMMx*/
codegen_addbyte2(block, 0x24, offset);
} else {
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x40 | base_reg | (src_reg << 3)); /*MOVQ [base_reg + offset], XMMx*/
codegen_addbyte(block, offset);
}
} else
fatal("MOVQ_BASE_OFFSET_XREG - offset %i\n", offset);
}
void
host_x86_MOVQ_STACK_OFFSET_XREG(codeblock_t *block, int offset, int src_reg)
{
if (!offset) {
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x04 | (src_reg << 3)); /*MOVQ [ESP], src_reg*/
codegen_addbyte(block, 0x24);
} else if (offset >= -0x80 && offset < 0x80) {
codegen_alloc_bytes(block, 6);
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x44 | (src_reg << 3)); /*MOVQ offset[ESP], src_reg*/
codegen_addbyte2(block, 0x24, offset & 0xff);
} else {
codegen_alloc_bytes(block, 9);
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x84 | (src_reg << 3)); /*MOVQ offset[ESP], src_reg*/
codegen_addbyte(block, 0x24);
codegen_addlong(block, offset);
}
}
void
host_x86_MOVQ_XREG_ABS(codeblock_t *block, int dst_reg, void *p)
{
int offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
if (offset >= -128 && offset < 127) {
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x45 | (dst_reg << 3)); /*MOVQ offset[EBP], src_reg*/
codegen_addbyte(block, offset);
} else {
codegen_alloc_bytes(block, 8);
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x05 | (dst_reg << 3)); /*MOVQ [p], src_reg*/
codegen_addlong(block, (uint32_t) p);
}
}
void
host_x86_MOVQ_XREG_ABS_REG_REG_SHIFT(codeblock_t *block, int dst_reg, uint32_t addr, int src_reg_a, int src_reg_b, int shift)
{
if (addr < 0x80 || addr >= 0xffffff80) {
codegen_alloc_bytes(block, 6);
codegen_addbyte3(block, 0xf3, 0x0f, 0x7e); /*MOVQ XMMx, addr[src_reg_a + src_reg_b << shift]*/
codegen_addbyte3(block, 0x44 | (dst_reg << 3), src_reg_a | (src_reg_b << 3) | (shift << 6), addr & 0xff);
} else {
codegen_alloc_bytes(block, 9);
codegen_addbyte3(block, 0xf3, 0x0f, 0x7e); /*MOVQ XMMx, addr[src_reg_a + src_reg_b << shift]*/
codegen_addbyte2(block, 0x84 | (dst_reg << 3), src_reg_a | (src_reg_b << 3) | (shift << 6));
codegen_addlong(block, addr);
}
}
void
host_x86_MOVQ_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x04 | (dst_reg << 3)); /*MOVQ XMMx, [base_reg + idx_reg]*/
codegen_addbyte(block, base_reg | (idx_reg << 3));
}
void
host_x86_MOVQ_XREG_BASE_OFFSET(codeblock_t *block, int dst_reg, int base_reg, int offset)
{
if (offset >= -128 && offset < 127) {
if (base_reg == REG_ESP) {
codegen_alloc_bytes(block, 6);
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x44 | (dst_reg << 3)); /*MOVQ XMMx, [ESP + offset]*/
codegen_addbyte2(block, 0x24, offset);
} else {
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x40 | base_reg | (dst_reg << 3)); /*MOVQ XMMx, [base_reg + offset]*/
codegen_addbyte(block, offset);
}
} else
fatal("MOVQ_REG_BASE_OFFSET - offset %i\n", offset);
}
void
host_x86_MOVQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0xc0 | src_reg | (dst_reg << 3)); /*MOVQ dst_reg, src_reg*/
}
void
host_x86_MAXPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0x0f, 0x5f, 0xc0 | src_reg | (dst_reg << 3)); /*MAXPS dst_reg, src_reg*/
}
void
host_x86_MINPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0x0f, 0x5d, 0xc0 | src_reg | (dst_reg << 3)); /*MINPS dst_reg, src_reg*/
}
void
host_x86_MULPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0x0f, 0x59, 0xc0 | src_reg | (dst_reg << 3)); /*MULPS dst_reg, src_reg*/
}
void
host_x86_MULSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x59, 0xc0 | src_reg | (dst_reg << 3));
}
void
host_x86_PACKSSWB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 9);
codegen_addbyte4(block, 0x66, 0x0f, 0x63, 0xc0 | src_reg | (dst_reg << 3)); /*PACKSSWB dst_reg, src_reg*/
codegen_addbyte4(block, 0x66, 0x0f, 0x70, 0xc0 | dst_reg | (dst_reg << 3)); /*PSHUFD dst_reg, dst_reg, 0x88 (move bits 64-95 to 32-63)*/
codegen_addbyte(block, 0x88);
}
void
host_x86_PACKSSDW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 9);
codegen_addbyte4(block, 0x66, 0x0f, 0x6b, 0xc0 | src_reg | (dst_reg << 3)); /*PACKSSDW dst_reg, src_reg*/
codegen_addbyte4(block, 0x66, 0x0f, 0x70, 0xc0 | dst_reg | (dst_reg << 3)); /*PSHUFD dst_reg, dst_reg, 0x88 (move bits 64-95 to 32-63)*/
codegen_addbyte(block, 0x88);
}
void
host_x86_PACKUSWB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 9);
codegen_addbyte4(block, 0x66, 0x0f, 0x67, 0xc0 | src_reg | (dst_reg << 3)); /*PACKUSWB dst_reg, src_reg*/
codegen_addbyte4(block, 0x66, 0x0f, 0x70, 0xc0 | dst_reg | (dst_reg << 3)); /*PSHUFD dst_reg, dst_reg, 0x88 (move bits 64-95 to 32-63)*/
codegen_addbyte(block, 0x88);
}
void
host_x86_PADDB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xfc, 0xc0 | src_reg | (dst_reg << 3)); /*PADDB dst_reg, src_reg*/
}
void
host_x86_PADDW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xfd, 0xc0 | src_reg | (dst_reg << 3)); /*PADDW dst_reg, src_reg*/
}
void
host_x86_PADDD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xfe, 0xc0 | src_reg | (dst_reg << 3)); /*PADDD dst_reg, src_reg*/
}
void
host_x86_PADDSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xec, 0xc0 | src_reg | (dst_reg << 3)); /*PADDSB dst_reg, src_reg*/
}
void
host_x86_PADDSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xed, 0xc0 | src_reg | (dst_reg << 3)); /*PADDSW dst_reg, src_reg*/
}
void
host_x86_PADDUSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xdc, 0xc0 | src_reg | (dst_reg << 3)); /*PADDUSB dst_reg, src_reg*/
}
void
host_x86_PADDUSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xdd, 0xc0 | src_reg | (dst_reg << 3)); /*PADDUSW dst_reg, src_reg*/
}
void
host_x86_PAND_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xdb, 0xc0 | src_reg | (dst_reg << 3)); /*PAND dst_reg, src_reg*/
}
void
host_x86_PANDN_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xdf, 0xc0 | src_reg | (dst_reg << 3)); /*PANDN dst_reg, src_reg*/
}
void
host_x86_POR_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xeb, 0xc0 | src_reg | (dst_reg << 3)); /*POR dst_reg, src_reg*/
}
void
host_x86_PXOR_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xef, 0xc0 | src_reg | (dst_reg << 3)); /*PXOR dst_reg, src_reg*/
}
void
host_x86_PCMPEQB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x74, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPEQB dst_reg, src_reg*/
}
void
host_x86_PCMPEQW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x75, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPEQW dst_reg, src_reg*/
}
void
host_x86_PCMPEQD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x76, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPEQD dst_reg, src_reg*/
}
void
host_x86_PCMPGTB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x64, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPGTB dst_reg, src_reg*/
}
void
host_x86_PCMPGTW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x65, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPGTW dst_reg, src_reg*/
}
void
host_x86_PCMPGTD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x66, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPGTD dst_reg, src_reg*/
}
void
host_x86_PMADDWD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xf5, 0xc0 | src_reg | (dst_reg << 3)); /*PMULLW dst_reg, src_reg*/
}
void
host_x86_PMULHW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xe5, 0xc0 | src_reg | (dst_reg << 3)); /*PMULLW dst_reg, src_reg*/
}
void
host_x86_PMULLW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xd5, 0xc0 | src_reg | (dst_reg << 3)); /*PMULLW dst_reg, src_reg*/
}
void
host_x86_PSHUFD_XREG_XREG_IMM(codeblock_t *block, int dst_reg, int src_reg, uint8_t shuffle)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x70, 0xc0 | src_reg | (dst_reg << 3)); /*PSHUFD dst_reg, dst_reg, 0xee (move top 64-bits to low 64-bits)*/
codegen_addbyte(block, shuffle);
}
void
host_x86_PSLLW_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x71, 0xc0 | 0x30 | dst_reg); /*PSLLW dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSLLD_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x72, 0xc0 | 0x30 | dst_reg); /*PSLLD dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSLLQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x73, 0xc0 | 0x30 | dst_reg); /*PSLLD dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSRAW_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x71, 0xc0 | 0x20 | dst_reg); /*PSRAW dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSRAD_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x72, 0xc0 | 0x20 | dst_reg); /*PSRAD dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSRAQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x73, 0xc0 | 0x20 | dst_reg); /*PSRAD dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSRLW_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x71, 0xc0 | 0x10 | dst_reg); /*PSRLW dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSRLD_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x72, 0xc0 | 0x10 | dst_reg); /*PSRLD dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSRLQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
{
codegen_alloc_bytes(block, 5);
codegen_addbyte4(block, 0x66, 0x0f, 0x73, 0xc0 | 0x10 | dst_reg); /*PSRLD dst_reg, imm*/
codegen_addbyte(block, shift);
}
void
host_x86_PSUBB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xf8, 0xc0 | src_reg | (dst_reg << 3)); /*PADDB dst_reg, src_reg*/
}
void
host_x86_PSUBW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xf9, 0xc0 | src_reg | (dst_reg << 3)); /*PADDW dst_reg, src_reg*/
}
void
host_x86_PSUBD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xfa, 0xc0 | src_reg | (dst_reg << 3)); /*PADDD dst_reg, src_reg*/
}
void
host_x86_PSUBSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xe8, 0xc0 | src_reg | (dst_reg << 3)); /*PSUBSB dst_reg, src_reg*/
}
void
host_x86_PSUBSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xe9, 0xc0 | src_reg | (dst_reg << 3)); /*PSUBSW dst_reg, src_reg*/
}
void
host_x86_PSUBUSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xd8, 0xc0 | src_reg | (dst_reg << 3)); /*PSUBUSB dst_reg, src_reg*/
}
void
host_x86_PSUBUSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0xd9, 0xc0 | src_reg | (dst_reg << 3)); /*PSUBUSW dst_reg, src_reg*/
}
void
host_x86_PUNPCKLBW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x60, 0xc0 | src_reg | (dst_reg << 3)); /*PUNPCKLBW dst_reg, src_reg*/
}
void
host_x86_PUNPCKLWD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x61, 0xc0 | src_reg | (dst_reg << 3)); /*PUNPCKLWD dst_reg, src_reg*/
}
void
host_x86_PUNPCKLDQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x66, 0x0f, 0x62, 0xc0 | src_reg | (dst_reg << 3)); /*PUNPCKLDQ dst_reg, src_reg*/
}
void
host_x86_SQRTSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x51, 0xc0 | src_reg | (dst_reg << 3)); /*SQRTSD dst_reg, src_reg*/
}
void
host_x86_SQRTSS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf3, 0x0f, 0x51, 0xc0 | src_reg | (dst_reg << 3)); /*SQRTSS dst_reg, src_reg*/
}
void
host_x86_SUBPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0x0f, 0x5c, 0xc0 | src_reg | (dst_reg << 3)); /*SUBPS dst_reg, src_reg*/
}
void
host_x86_SUBSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0xf2, 0x0f, 0x5c, 0xc0 | src_reg | (dst_reg << 3));
}
void
host_x86_UNPCKLPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_alloc_bytes(block, 3);
codegen_addbyte3(block, 0x0f, 0x14, 0xc0 | src_reg | (dst_reg << 3));
}
#endif

View File

@@ -1,111 +0,0 @@
void host_x86_ADDPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_ADDSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
#define CMPPS_EQ 0
#define CMPPS_NLT 5
#define CMPPS_NLE 6
void host_x86_CMPPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg, int type);
void host_x86_COMISD_XREG_XREG(codeblock_t *block, int src_reg_a, int src_reg_b);
void host_x86_CVTDQ2PS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_CVTPS2DQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_CVTSD2SI_REG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_CVTSD2SS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_CVTSI2SD_XREG_REG(codeblock_t *block, int dest_reg, int src_reg);
void host_x86_CVTSI2SS_XREG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_CVTSS2SD_XREG_XREG(codeblock_t *block, int dest_reg, int src_reg);
void host_x86_CVTSS2SD_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
void host_x86_DIVSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_DIVSS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_LDMXCSR(codeblock_t *block, void *p);
void host_x86_MAXSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVD_BASE_INDEX_XREG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
void host_x86_MOVD_REG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVD_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
void host_x86_MOVD_XREG_REG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MOVQ_ABS_XREG(codeblock_t *block, void *p, int src_reg);
void host_x86_MOVQ_ABS_REG_REG_SHIFT_XREG(codeblock_t *block, uint32_t addr, int src_reg_a, int src_reg_b, int shift, int src_reg);
void host_x86_MOVQ_BASE_INDEX_XREG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
void host_x86_MOVQ_BASE_OFFSET_XREG(codeblock_t *block, int base_reg, int offset, int src_reg);
void host_x86_MOVQ_STACK_OFFSET_XREG(codeblock_t *block, int offset, int src_reg);
void host_x86_MOVQ_XREG_ABS(codeblock_t *block, int dst_reg, void *p);
void host_x86_MOVQ_XREG_ABS_REG_REG_SHIFT(codeblock_t *block, int dst_reg, uint32_t addr, int src_reg_a, int src_reg_b, int shift);
void host_x86_MOVQ_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
void host_x86_MOVQ_XREG_BASE_OFFSET(codeblock_t *block, int dst_reg, int base_reg, int offset);
void host_x86_MOVQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MAXPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MINPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MULPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_MULSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PACKSSWB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PACKSSDW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PACKUSWB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PADDB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PADDW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PADDD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PADDSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PADDSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PADDUSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PADDUSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PAND_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PANDN_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_POR_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PXOR_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PCMPEQB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PCMPEQW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PCMPEQD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PCMPGTB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PCMPGTW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PCMPGTD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PMADDWD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PMULHW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PMULLW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PSLLW_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSLLD_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSLLQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSRAW_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSRAD_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSRAQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSRLW_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSRLD_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSRLQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
void host_x86_PSHUFD_XREG_XREG_IMM(codeblock_t *block, int dst_reg, int src_reg, uint8_t shuffle);
void host_x86_PSUBB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PSUBW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PSUBD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PSUBSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PSUBSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PSUBUSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PSUBUSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PUNPCKLBW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PUNPCKLWD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_PUNPCKLDQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_SQRTSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_SQRTSS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_SUBPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_SUBSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
void host_x86_UNPCKLPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);

File diff suppressed because it is too large Load Diff

View File

@@ -388,11 +388,11 @@ typedef struct {
uint32_t old_fp_control;
uint32_t new_fp_control;
# endif
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
# if defined _M_IX86
uint16_t old_fp_control2;
uint16_t new_fp_control2;
# endif
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined __amd64__ || defined _M_X64
# if defined __amd64__ || defined _M_X64
uint32_t trunc_fp_control;
# endif
#else

View File

@@ -92,8 +92,8 @@ cart_image_close(int drive)
static void
cart_image_load(int drive, char *fn)
{
FILE *fp;
uint32_t size;
FILE *fp = NULL;
uint32_t size = 0;
uint32_t base = 0x00000000;
cart_image_close(drive);
@@ -137,7 +137,7 @@ cart_image_load(int drive, char *fn)
static void
cart_load_common(int drive, char *fn, uint8_t hard_reset)
{
FILE *fp;
FILE *fp = NULL;
cartridge_log("Cartridge: loading drive %d with '%s'\n", drive, fn);

View File

@@ -106,7 +106,7 @@ typedef struct mouse_wacom_t {
int last_abs_y; /* Suppressed/Increment Mode. */
union {
uint32_t settings; /* Settings DWORD */
/* We don't target any architectures except x86/x64/ARM32/ARM64.
/* We don't target any architectures except x64/ARM64.
(The ABIs for those are explicit in little-endian bit ordering) */
struct settings_bits {
uint8_t remote_mode : 1;

View File

@@ -812,7 +812,7 @@ ide_set_signature(ide_t *ide)
ide->tf->sector = 1;
ide->tf->head = 0;
ide->tf->secount = 1;
ide->tf->cylinder = ide_signatures[ide->type & ~IDE_SHADOW];
ide->tf->cylinder = (ide->type == IDE_ATAPI_SHADOW) ? 0x0000 : ide_signatures[ide->type & ~IDE_SHADOW];
if (ide->type == IDE_HDD)
ide->drive = 0;
@@ -1581,7 +1581,7 @@ ide_reset_registers(ide_t *ide)
ide->tf->atastat = DRDY_STAT | DSC_STAT;
ide->tf->error = 1;
ide->tf->secount = 1;
ide->tf->cylinder = ide_signatures[ide->type & ~IDE_SHADOW];
ide->tf->cylinder = (ide->type == IDE_ATAPI_SHADOW) ? 0x0000 : ide_signatures[ide->type & ~IDE_SHADOW];
ide->tf->sector = 1;
ide->tf->head = 0;

View File

@@ -79,7 +79,7 @@
* Unconditionally aligning does not cost very much, so do it if unsure
*/
#ifndef STRICT_ALIGN
# define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
# define STRICT_ALIGN !(defined (__amd64))
#endif
/*

View File

@@ -202,6 +202,7 @@ extern char vmm_path[1024]; /* VM Manager path to scan */
extern int start_vmm; /* the current execution will start the manager */
extern int portable_mode; /* we are running in portable mode
(global dirs = exe path) */
extern int global_cfg_overridden; /* global config file was overriden on command line */
extern int monitor_edid; /* (C) Which EDID to use. 0=default, 1=custom. */
extern char monitor_edid_path[1024]; /* (C) Path to custom EDID */

View File

@@ -498,6 +498,7 @@ extern int machine_at_cmdpc_init(const machine_t *);
extern int machine_at_portableii_init(const machine_t *);
extern int machine_at_portableiii_init(const machine_t *);
extern int machine_at_grid1520_init(const machine_t *);
extern int machine_at_pc900_init(const machine_t *);
extern int machine_at_mr286_init(const machine_t *);
extern int machine_at_pc8_init(const machine_t *);
extern int machine_at_m290_init(const machine_t *);
@@ -515,19 +516,19 @@ extern int machine_at_dells200_init(const machine_t *);
extern int machine_at_super286c_init(const machine_t *);
extern int machine_at_at122_init(const machine_t *);
extern int machine_at_tuliptc7_init(const machine_t *);
/* Wells American A*Star with custom award BIOS. */
extern int machine_at_wellamerastar_init(const machine_t *);
/* GC103 */
extern int machine_at_quadt286_init(const machine_t *);
extern void machine_at_headland_common_init(const machine_t *model, int type);
extern int machine_at_tg286m_init(const machine_t *);
/* Wells American A*Star with custom award BIOS. */
extern int machine_at_wellamerastar_init(const machine_t *);
/* NEAT */
extern int machine_at_px286_init(const machine_t *);
extern int machine_at_ataripc4_init(const machine_t *);
extern int machine_at_neat_ami_init(const machine_t *);
extern int machine_at_3302_init(const machine_t *);
extern int machine_at_px286_init(const machine_t *);
/* SCAMP */
extern int machine_at_pc7286_init(const machine_t *);
@@ -557,8 +558,8 @@ extern const device_t pbl300sx_device;
extern int machine_at_pbl300sx_init(const machine_t *);
/* ALi M1217 */
extern int machine_at_arb1374_init(const machine_t *);
extern int machine_at_sbc350a_init(const machine_t *);
extern int machine_at_arb1374_init(const machine_t *);
extern int machine_at_flytech386_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t c325ax_device;
@@ -608,6 +609,10 @@ extern int machine_at_wd76c10_init(const machine_t *);
extern int machine_at_pja511m_init(const machine_t *);
extern int machine_at_prox1332_init(const machine_t *);
/* m_at_486slc.c */
/* OPTi 283 */
extern int machine_at_rycleopardlx_init(const machine_t *);
/* m_at_386dx.c */
/* ISA */
#ifdef EMU_DEVICE_H
@@ -639,10 +644,6 @@ extern int machine_at_opti495_init(const machine_t *);
extern int machine_at_asus3863364k_init(const machine_t *);
extern int machine_at_asus386_init(const machine_t *);
/* m_at_486slc.c */
/* OPTi 283 */
extern int machine_at_rycleopardlx_init(const machine_t *);
/* m_at_386dx_486.c */
/* ALi M1429G */
extern int machine_at_exp4349_init(const machine_t *);
@@ -1127,12 +1128,18 @@ extern int machine_at_p6i440e2_init(const machine_t *);
/* i440BX */
extern int machine_at_bf6_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t bx6_device;
#endif
extern int machine_at_bx6_init(const machine_t *);
extern int machine_at_ax6bc_init(const machine_t *);
extern int machine_at_p2bls_init(const machine_t *);
extern int machine_at_p3bf_init(const machine_t *);
extern int machine_at_686bx_init(const machine_t *);
extern int machine_at_lgibmx7g_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t ms6119_device;
#endif
extern int machine_at_ms6119_init(const machine_t *);
extern int machine_at_p6sba_init(const machine_t *);
extern int machine_at_s1846_init(const machine_t *);
@@ -1319,7 +1326,11 @@ extern const device_t jukopc_device;
extern int machine_xt_jukopc_init(const machine_t *);
extern int machine_xt_kaypropc_init(const machine_t *);
extern int machine_xt_micoms_xl7turbo_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t pc500_device;
#endif
extern int machine_xt_pc500_init(const machine_t *);
extern int machine_xt_pc500plus_init(const machine_t *);
extern int machine_xt_pc700_init(const machine_t *);
extern int machine_xt_pc4i_init(const machine_t *);
extern int machine_xt_openxt_init(const machine_t *);

View File

@@ -1,3 +1,4 @@
extern char *path_get_basename(const char *path);
extern void path_get_dirname(char *dest, const char *path);
extern char *path_get_filename(char *s);
extern char *path_get_extension(char *s);
@@ -5,4 +6,4 @@ extern void path_append_filename(char *dest, const char *s1, const char *s2);
extern void path_slash(char *path);
extern const char *path_get_slash(char *path);
extern void path_normalize(char *path);
extern int path_abs(char *path);
extern int path_abs(char *path);

View File

@@ -32,6 +32,14 @@ enum {
AD1848_TYPE_CS4235 = 6
};
enum {
AD1848_AUX1 = 2,
AD1848_AUX2 = 4,
AD1848_OUT = 6,
AD1848_LINE_IN = 18,
AD1848_MONO = 26
};
typedef struct ad1848_t {
uint8_t type;
uint8_t index;
@@ -47,6 +55,7 @@ typedef struct ad1848_t {
int16_t out_l;
int16_t out_r;
int8_t cd_vol_reg;
double cd_vol_l;
double cd_vol_r;
int fm_vol_l;
@@ -86,8 +95,9 @@ extern void ad1848_write(uint16_t addr, uint8_t val, void *priv);
extern void ad1848_update(ad1848_t *ad1848);
extern void ad1848_speed_changed(ad1848_t *ad1848);
extern void ad1848_set_cd_audio_channel(void *priv, int channel);
extern void ad1848_filter_cd_audio(int channel, double *buffer, void *priv);
extern void ad1848_filter_aux2(void* priv, double* out_l, double* out_r);
extern void ad1848_filter_channel(void* priv, int channel, double* out_l, double* out_r);
extern void ad1848_init(ad1848_t *ad1848, uint8_t type);

View File

@@ -199,8 +199,8 @@ typedef struct emu8k_voice_t {
* something, similarly to targets and current, but... of what?
* what is curious is that if they are already zero, they are not written to, so it really
* looks like they are information about the status of the channel. (lfo position maybe?) */
uint32_t unknown_data0_4;
uint32_t unknown_data0_5;
uint32_t z2;
uint32_t z1;
union {
uint32_t psst;
struct {
@@ -229,7 +229,7 @@ typedef struct emu8k_voice_t {
};
#define CCCA_FILTQ_GET(ccca) (ccca >> 28)
#define CCCA_FILTQ_SET(ccca, q) ccca = (ccca & 0x0FFFFFFF) | (q << 28)
/* Bit 27 should always be zero */
/* Bit 27 should always be zero on EMU8000 */
#define CCCA_DMA_ACTIVE(ccca) (ccca & 0x04000000)
#define CCCA_DMA_WRITE_MODE(ccca) (ccca & 0x02000000)
#define CCCA_DMA_WRITE_RIGHT(ccca) (ccca & 0x01000000)
@@ -316,7 +316,9 @@ typedef struct emu8k_voice_t {
int env_engine_on;
emu8k_mem_internal_t addr, loop_start, loop_end;
emu8k_mem_internal_t addr;
emu8k_mem_internal_t loop_start;
emu8k_mem_internal_t loop_end;
int32_t initial_att;
int32_t initial_filter;

View File

@@ -207,9 +207,11 @@ extern const device_t es1373_onboard_device;
extern const device_t ct5880_device;
extern const device_t ct5880_onboard_device;
/* Gravis UltraSound and UltraSound Max */
/* Gravis UltraSound family */
extern const device_t gus_device;
extern const device_t gus_v37_device;
extern const device_t gus_max_device;
extern const device_t gus_ace_device;
/* IBM PS/1 Audio Card */
extern const device_t ps1snd_device;

View File

@@ -141,6 +141,7 @@ typedef struct svga_t {
int render_line_offset;
int start_retrace_latch;
int vga_mode;
int half_pixel;
/*The three variables below allow us to implement memory maps like that seen on a 1MB Trio64 :
0MB-1MB - VRAM

View File

@@ -1,7 +1,7 @@
#ifndef VIDEO_VOODOO_RENDER_H
#define VIDEO_VOODOO_RENDER_H
#if !(defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined __amd64__ || defined _M_X64)
#if !(defined __amd64__ || defined _M_X64)
# define NO_CODEGEN
#endif

View File

@@ -305,7 +305,8 @@ machine_at_portableiii_init(const machine_t *model)
}
int
machine_at_grid1520_init(const machine_t *model) {
machine_at_grid1520_init(const machine_t *model)
{
int ret = 0;
ret = bios_load_linear("roms/machines/grid1520/grid1520_891025.rom",
@@ -328,6 +329,28 @@ machine_at_grid1520_init(const machine_t *model) {
return ret;
}
int
machine_at_pc900_init(const machine_t *model)
{
int ret = 0;
ret = bios_load_linear("roms/machines/pc900/mpf_pc900_v207a.bin",
0x000f8000, 32768, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
mem_remap_top(384);
if (fdc_current[0] == FDC_INTERNAL)
device_add(&fdc_at_device);
return ret;
}
int
machine_at_mr286_init(const machine_t *model)
{
@@ -713,6 +736,28 @@ machine_at_tg286m_init(const machine_t *model)
return ret;
}
int
machine_at_px286_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/px286/KENITEC.BIN",
0x000f0000, 65536, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
if (fdc_current[0] == FDC_INTERNAL)
device_add(&fdc_at_device);
device_add(&neat_device);
return ret;
}
// TODO
// Onboard Paradise PVGA1A-JK VGA Graphics
// Data Technology Corporation DTC7187 RLL Controller (Optional)
@@ -793,28 +838,6 @@ machine_at_3302_init(const machine_t *model)
return ret;
}
int
machine_at_px286_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/px286/KENITEC.BIN",
0x000f0000, 65536, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
if (fdc_current[0] == FDC_INTERNAL)
device_add(&fdc_at_device);
device_add(&neat_device);
return ret;
}
/* SCAMP */
int
machine_at_pc7286_init(const machine_t *model)

View File

@@ -162,28 +162,6 @@ machine_at_pbl300sx_init(const machine_t *model)
}
/* ALi M1217 */
int
machine_at_arb1374_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/arb1374/1374s.rom",
0x000f0000, 65536, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
device_add(&ali1217_device);
device_add(&ide_isa_device);
device_add_params(&w83877_device, (void *) (W83877F | W83877_3F0 | W83XX7_IDE_PRI));
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
return ret;
}
int
machine_at_sbc350a_init(const machine_t *model)
{
@@ -206,6 +184,28 @@ machine_at_sbc350a_init(const machine_t *model)
return ret;
}
int
machine_at_arb1374_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/arb1374/1374s.rom",
0x000f0000, 65536, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
device_add(&ali1217_device);
device_add(&ide_isa_device);
device_add_params(&w83877_device, (void *) (W83877F | W83877_3F0 | W83XX7_IDE_PRI));
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
return ret;
}
int
machine_at_flytech386_init(const machine_t *model)
{

View File

@@ -348,17 +348,57 @@ machine_at_bf6_init(const machine_t *model)
return ret;
}
static const device_config_t bx6_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "bx6",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.bios = {
{ .name = "1998/07/28 - BIOS EG", .internal_name = "bx6", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/bx6/BX6_EG.BIN", "" } },
{ .name = "2000/03/10 - BIOS QS", .internal_name = "bx6_qs", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/bx6/BX6_QS.bin", "" } },
{ .files_no = 0 }
},
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t bx6_device = {
.name = "ABIT BX6",
.internal_name = "bx6_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = bx6_config
};
int
machine_at_bx6_init(const machine_t *model)
{
int ret;
int ret = 0;
const char* fn;
ret = bios_load_linear("roms/machines/bx6/BX6_EG.BIN",
0x000e0000, 131072, 0);
if (bios_only || !ret)
/* No ROMs available */
if (!device_available(model->device))
return ret;
device_context(model->device);
fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000e0000, 131072, 0);
device_context_restore();
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
@@ -519,17 +559,61 @@ machine_at_686bx_init(const machine_t *model)
return ret;
}
static const device_config_t ms6119_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "ms6119",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.bios = {
{ .name = "Award Modular BIOS v4.51PG - Version 3.30b1 (LG IBM Multinet i x7G)", .internal_name = "lgibmx7g", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ms6119/ms6119.331", "" } },
{ .name = "Award Modular BIOS v4.51PG - Version 2.12 (Viglen Vig69M)", .internal_name = "vig69m", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ms6119/vig69m.212", "" } },
{ .name = "Award Modular BIOS v4.51PG - Version 2.10", .internal_name = "ms6119", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ms6119/w6119ims.2a0", "" } },
{ .name = "AMIBIOS 071595 - Version 1.90 (Packard Bell Tacoma)", .internal_name = "tacoma", .bios_type = BIOS_NORMAL,
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ms6119/A19P2190.ROM", "" } },
{ .files_no = 0 }
},
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t ms6119_device = {
.name = "MSI MS-6119",
.internal_name = "ms6119_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ms6119_config
};
int
machine_at_lgibmx7g_init(const machine_t *model)
machine_at_ms6119_init(const machine_t *model)
{
int ret;
int ret = 0;
const char* fn;
ret = bios_load_linear("roms/machines/lgibmx7g/ms6119.331",
0x000c0000, 262144, 0);
if (bios_only || !ret)
/* No ROMs available */
if (!device_available(model->device))
return ret;
device_context(model->device);
fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000c0000, 262144, 0);
device_context_restore();
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
@@ -545,7 +629,7 @@ machine_at_lgibmx7g_init(const machine_t *model)
device_add_params(&w83977_device, (void *) (W83977TF | W83977_AMI | W83977_NO_NVR));
device_add(&winbond_flash_w29c020_device);
spd_register(SPD_TYPE_SDRAM, 0x7, 256);
return ret;
}

View File

@@ -155,6 +155,10 @@ static const device_config_t cu430hx_config[] = {
.files_no = 5, .local = 0, .size = 262144, .files = { "roms/machines/cu430hx/1003DK08.BIO", "roms/machines/cu430hx/1003DK08.BI1",
"roms/machines/cu430hx/1003DK08.BI2", "roms/machines/cu430hx/1003DK08.BI3",
"roms/machines/cu430hx/1003DK08.RCV", "" } },
{ .name = "Intel AMIBIOS - Revision 1.00.04.DK0K (NEC PowerMate V2xxx/P2xxx)", .internal_name = "powermatev2p2", .bios_type = BIOS_NORMAL,
.files_no = 5, .local = 0, .size = 262144, .files = { "roms/machines/cu430hx/1004DK0K.BIO", "roms/machines/cu430hx/1004DK0K.BI1",
"roms/machines/cu430hx/1004DK0K.BI2", "roms/machines/cu430hx/1004DK0K.BI3",
"roms/machines/cu430hx/1004DK0K.RCV", "" } },
{ .name = "Intel AMIBIOS - Revision 1.00.06.DK0", .internal_name = "cu430hx", .bios_type = BIOS_NORMAL,
.files_no = 5, .local = 0, .size = 262144, .files = { "roms/machines/cu430hx/1006DK0_.BIO", "roms/machines/cu430hx/1006DK0_.BI1",
"roms/machines/cu430hx/1006DK0_.BI2", "roms/machines/cu430hx/1006DK0_.BI3",

View File

@@ -774,14 +774,14 @@ pit_irq0_timer_pcjr(int new_out, int old_out, UNUSED(void *priv))
static const device_config_t pcjr_config[] = {
// clang-format off
{
.name = "display_type",
.description = "Display type",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = PCJR_RGB,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "display_type",
.description = "Display type",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = PCJR_RGB,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "RGB", .value = PCJR_RGB },
{ .description = "Composite", .value = PCJR_COMPOSITE },
{ .description = "RGB (no brown)", .value = PCJR_RGB_NO_BROWN },
@@ -807,11 +807,11 @@ static const device_config_t pcjr_config[] = {
.bios = { { 0 } }
},
{
.name = "apply_hd",
.description = "Apply overscan deltas",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 1
.name = "apply_hd",
.description = "Apply overscan deltas",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 1
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on

View File

@@ -974,13 +974,88 @@ machine_xt_micoms_xl7turbo_init(const machine_t *model)
return ret;
}
static const device_config_t pc500_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "pc500_330",
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.bios = {
{
.name = "3.30",
.internal_name = "pc500_330",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 8192,
.files = { "roms/machines/pc500/rom330.bin", "" }
},
{
.name = "3.10",
.internal_name = "pc500_310",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 8192,
.files = { "roms/machines/pc500/rom310.bin", "" }
},
{ .files_no = 0 }
},
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t pc500_device = {
.name = "Multitech PC-500",
.internal_name = "pc500_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pc500_config
};
int
machine_xt_pc500_init(const machine_t *model)
{
int ret = 0;
const char *fn;
/* No ROMs available. */
if (!device_available(model->device))
return ret;
device_context(model->device);
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000fe000, 8192, 0);
device_context_restore();
if (bios_only || !ret)
return ret;
device_add(&kbc_pc_device);
machine_xt_common_init(model, 0);
return ret;
}
int
machine_xt_pc500plus_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/pc500/rom404.bin",
0x000f8000, 32768, 0);
0x000fc000, 16384, 0);
if (bios_only || !ret)
return ret;

File diff suppressed because it is too large Load Diff

View File

@@ -419,7 +419,7 @@ void mtr_flush_with_state(int is_last) {
len = snprintf(linebuf, ARRAY_SIZE(linebuf), "%s{\"cat\":\"%s\",\"pid\":%i,\"tid\":%i,\"ts\":%" PRId64 ",\"ph\":\"%c\",\"name\":\"%s\",\"args\":{%s}%s}",
first_line ? "" : ",\n",
cat, raw->pid, raw->tid, raw->ts - time_offset, raw->ph, raw->name, arg_buf, id_buf);
fwrite(linebuf, 1, len, f);
fwrite(linebuf, 1, len, fp);
first_line = 0;
if (raw->arg_type == MTR_ARG_TYPE_STRING_COPY) {

View File

@@ -15,7 +15,7 @@ msgstr ""
msgid "&Right CTRL is left ALT"
msgstr ""
msgid "&Hard Reset..."
msgid "&Hard reset"
msgstr ""
msgid "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr ""
msgid "R&emember size && position"
msgstr ""
msgid "Remember size && position"
msgstr ""
msgid "Re&nderer"
msgstr ""
@@ -1074,6 +1077,12 @@ msgstr ""
msgid "Start"
msgstr ""
msgid "&Force shutdown"
msgstr ""
msgid "&Start"
msgstr ""
msgid "Not running"
msgstr ""
@@ -2136,6 +2145,9 @@ msgstr ""
msgid "Enable Game port"
msgstr ""
msgid "Enable Adlib ports"
msgstr ""
msgid "SID Model"
msgstr ""

View File

@@ -15,7 +15,7 @@ msgstr "&Klávesnice vyžaduje záběr myši"
msgid "&Right CTRL is left ALT"
msgstr "&Pravý Ctrl je levý Alt"
msgid "&Hard Reset..."
msgid "&Hard reset"
msgstr "&Resetovat"
msgid "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Měnitelná velikost okna"
msgid "R&emember size && position"
msgstr "&Pamatovat velikost a pozici"
msgid "Remember size && position"
msgstr "Pamatovat velikost a pozici"
msgid "Re&nderer"
msgstr "&Renderer"
@@ -1074,6 +1077,12 @@ msgstr "Vynutit vypnutí"
msgid "Start"
msgstr "Spustit"
msgid "&Force shutdown"
msgstr "&Vynutit vypnutí"
msgid "&Start"
msgstr "&Spustit"
msgid "Not running"
msgstr "Neběží"
@@ -2136,6 +2145,9 @@ msgstr "Nízký DMA kanál"
msgid "Enable Game port"
msgstr "Povolit herní port"
msgid "Enable Adlib ports"
msgstr "Povolit porty Adlib"
msgid "SID Model"
msgstr "Model SID"
@@ -2968,16 +2980,16 @@ msgid "EDID file \"%ls\" is too large."
msgstr "Soubor EDID \"%ls\" je příliš velký."
msgid "OpenGL input scale"
msgstr "Vstupní měřítko OpenGL"
msgstr "Měřítko vstupu OpenGL"
msgid "OpenGL input stretch mode"
msgstr "režim roztažení vstupu OpenGL"
msgstr "Režim roztažení vstupu OpenGL"
msgid "Color scheme"
msgstr "Barevné schéma"
msgid "Light"
msgstr "Světlo"
msgstr "Světlé"
msgid "Dark"
msgstr "Tmavá"
msgstr "Tmavé"

View File

@@ -15,8 +15,8 @@ msgstr "&Tastatur benötigt das Einfangen des Mauszeigers"
msgid "&Right CTRL is left ALT"
msgstr "&Die rechte Strg-Taste ist die linke Alt-Taste"
msgid "&Hard Reset..."
msgstr "&Kaltstart..."
msgid "&Hard reset"
msgstr "&Kaltstart"
msgid "&Ctrl+Alt+Del"
msgstr "&Strg+Alt+Entf"
@@ -51,6 +51,9 @@ msgstr "G&rößenverstellbares Fenster"
msgid "R&emember size && position"
msgstr "Größe && &Position merken"
msgid "Remember size && position"
msgstr "Größe && Position merken"
msgid "Re&nderer"
msgstr "Re&nderer"
@@ -1074,6 +1077,12 @@ msgstr "Abschaltung erzwingen"
msgid "Start"
msgstr "Einschalten"
msgid "&Force shutdown"
msgstr "&Abschaltung erzwingen"
msgid "&Start"
msgstr "&Einschalten"
msgid "Not running"
msgstr "Läuft nicht"
@@ -2136,6 +2145,9 @@ msgstr "Niedrige DMA"
msgid "Enable Game port"
msgstr "Game-Port einschalten"
msgid "Enable Adlib ports"
msgstr "Adlib-Ports einschalten"
msgid "SID Model"
msgstr "SID-Modell"

View File

@@ -15,8 +15,8 @@ msgstr "&Teclado requiere captura"
msgid "&Right CTRL is left ALT"
msgstr "CTRL &derecho es ALT izquierdo"
msgid "&Hard Reset..."
msgstr "&Hard Reset..."
msgid "&Hard reset"
msgstr "&Hard reset"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "Ven&tana redimensionable"
msgid "R&emember size && position"
msgstr "&Recordar tamaño y posición"
msgid "Remember size && position"
msgstr "Recordar tamaño y posición"
msgid "Re&nderer"
msgstr "Re&nderizador"
@@ -1074,6 +1077,12 @@ msgstr "Apagqar forzadamente"
msgid "Start"
msgstr "Iniciar"
msgid "&Force shutdown"
msgstr "&Apagqar forzadamente"
msgid "&Start"
msgstr "&Iniciar"
msgid "Not running"
msgstr "No en ejecución"
@@ -2136,6 +2145,9 @@ msgstr "DMA bajo"
msgid "Enable Game port"
msgstr "Habilitar puerto de juegos"
msgid "Enable Adlib ports"
msgstr "Habilitar puertos Adlib"
msgid "SID Model"
msgstr "Modelo de SID"

View File

@@ -15,8 +15,8 @@ msgstr "&Vaadi näppäimistön kaappaus"
msgid "&Right CTRL is left ALT"
msgstr "&Oikea CTRL on vasen ALT"
msgid "&Hard Reset..."
msgstr "&Uudelleenkäynnistys (kylmä)..."
msgid "&Hard reset"
msgstr "&Uudelleenkäynnistys (kylmä)"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Salli koon muuttaminen"
msgid "R&emember size && position"
msgstr "&Muista koko ja sijainti"
msgid "Remember size && position"
msgstr "Muista koko ja sijainti"
msgid "Re&nderer"
msgstr "&Renderöijä"
@@ -1074,6 +1077,12 @@ msgstr "Pakota sammutus"
msgid "Start"
msgstr "Käynnistä"
msgid "&Force shutdown"
msgstr "&Pakota sammutus"
msgid "&Start"
msgstr "&Käynnistä"
msgid "Not running"
msgstr "Ei käynnissä"
@@ -1318,7 +1327,7 @@ msgid "Found %1"
msgstr "%1 löydetty"
msgid "System"
msgstr "Kone"
msgstr "Järjestelmä"
msgid "Storage"
msgstr "Tallennus"
@@ -2136,6 +2145,9 @@ msgstr "Matala DMA"
msgid "Enable Game port"
msgstr "Peliportti"
msgid "Enable Adlib ports"
msgstr "Adlib-portit"
msgid "SID Model"
msgstr "SID-malli"
@@ -2956,10 +2968,10 @@ msgid "CGA composite settings"
msgstr "CGA:n komposiittiasetukset"
msgid "Monitor EDID"
msgstr "Monitorin EDID"
msgstr "Näytön EDID"
msgid "Export..."
msgstr "Vie..."
msgstr "Vie..."
msgid "Export EDID"
msgstr "Vie EDID"
@@ -2968,16 +2980,16 @@ msgid "EDID file \"%ls\" is too large."
msgstr "EDID-tiedosto \"%ls\" on liian suuri."
msgid "OpenGL input scale"
msgstr "OpenGL:n syöttöasteikko"
msgstr "OpenGL-syötteen skaalaus"
msgid "OpenGL input stretch mode"
msgstr "OpenGL:n syötteen venytystila"
msgstr "OpenGL-syötteen venytystila"
msgid "Color scheme"
msgstr "Värimaailma"
msgstr "Väriteema"
msgid "Light"
msgstr "Valo"
msgstr "Vaalea"
msgid "Dark"
msgstr "Tumma"

View File

@@ -15,8 +15,8 @@ msgstr "C&apturer le clavier"
msgid "&Right CTRL is left ALT"
msgstr "CTRL &Droite devient ALT Gauche"
msgid "&Hard Reset..."
msgstr "&Hard Reset..."
msgid "&Hard reset"
msgstr "&Hard reset"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Suppr"
@@ -51,6 +51,9 @@ msgstr "Fenêtre &redimensionnable"
msgid "R&emember size && position"
msgstr "S&auvegarder taille && position"
msgid "Remember size && position"
msgstr "Sauvegarder taille && position"
msgid "Re&nderer"
msgstr "Moteur de re&ndu vidéo"
@@ -1074,6 +1077,12 @@ msgstr "Arrêt forcé"
msgid "Start"
msgstr "Démarrer"
msgid "&Force shutdown"
msgstr "&Arrêt forcé"
msgid "&Start"
msgstr "&Démarrer"
msgid "Not running"
msgstr "Inactive"
@@ -2136,6 +2145,9 @@ msgstr "DMA bas"
msgid "Enable Game port"
msgstr "Activer le port de jeu"
msgid "Enable Adlib ports"
msgstr "Activer les ports Adlib"
msgid "SID Model"
msgstr "Modèle SID"

View File

@@ -15,8 +15,8 @@ msgstr "&Tipkovnica zahtijeva hvatanje miša"
msgid "&Right CTRL is left ALT"
msgstr "&Desni CTRL je lijevi ALT"
msgid "&Hard Reset..."
msgstr "&Ponovno pokretanje..."
msgid "&Hard reset"
msgstr "&Ponovno pokretanje"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Prozor s promjenjivim veličinama"
msgid "R&emember size && position"
msgstr "&Zapamtite veličinu i položaj"
msgid "Remember size && position"
msgstr "Zapamtite veličinu i položaj"
msgid "Re&nderer"
msgstr "&Renderer"
@@ -1074,6 +1077,12 @@ msgstr "Prisilno isključi"
msgid "Start"
msgstr "Pokreni"
msgid "&Force shutdown"
msgstr "Prisilno &isključi"
msgid "&Start"
msgstr "&Pokreni"
msgid "Not running"
msgstr "Se ne pokreće"
@@ -2136,6 +2145,9 @@ msgstr "Niski DMA"
msgid "Enable Game port"
msgstr "Omogoći vrata za igru"
msgid "Enable Adlib ports"
msgstr "Omogući Adlib portove"
msgid "SID Model"
msgstr "Model SID-a"

View File

@@ -15,8 +15,8 @@ msgstr "&Tastiera richiede la cattura"
msgid "&Right CTRL is left ALT"
msgstr "CTRL &destro è ALT sinistro"
msgid "&Hard Reset..."
msgstr "&Riavvia..."
msgid "&Hard reset"
msgstr "&Riavvia"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Canc"
@@ -51,6 +51,9 @@ msgstr "&Finestra ridimensionabile"
msgid "R&emember size && position"
msgstr "R&icorda dimensioni e posizione"
msgid "Remember size && position"
msgstr "Ricorda dimensioni e posizione"
msgid "Re&nderer"
msgstr "Re&nderizzatore"
@@ -1074,6 +1077,12 @@ msgstr "Forza arresto"
msgid "Start"
msgstr "Avvia"
msgid "&Force shutdown"
msgstr "&Forza arresto"
msgid "&Start"
msgstr "&Avvia"
msgid "Not running"
msgstr "Inattivo"
@@ -2136,6 +2145,9 @@ msgstr "DMA basso"
msgid "Enable Game port"
msgstr "Abilita la porta giochi"
msgid "Enable Adlib ports"
msgstr "Abilita porte Adlib"
msgid "SID Model"
msgstr "Modello SID"

View File

@@ -15,8 +15,8 @@ msgstr "キーボードはキャプチャが必要(&K)"
msgid "&Right CTRL is left ALT"
msgstr "右CTRLを左ALTへ変換(&R)"
msgid "&Hard Reset..."
msgstr "ハード リセット(&H)..."
msgid "&Hard reset"
msgstr "ハード リセット(&H)"
msgid "&Ctrl+Alt+Del"
msgstr "Ctrl+Alt+Del(&C)"
@@ -51,6 +51,9 @@ msgstr "ウィンドウのサイズを変更可能(&R)"
msgid "R&emember size && position"
msgstr "ウィンドウのサイズと位置を保存(&E)"
msgid "Remember size && position"
msgstr "ウィンドウのサイズと位置を保存"
msgid "Re&nderer"
msgstr "レンダラー(&N)"
@@ -1074,6 +1077,12 @@ msgstr "強制終了"
msgid "Start"
msgstr "スタート"
msgid "&Force shutdown"
msgstr "強制終了(&F)"
msgid "&Start"
msgstr "スタート(&S)"
msgid "Not running"
msgstr "停止した"
@@ -2136,6 +2145,9 @@ msgstr "低DMA"
msgid "Enable Game port"
msgstr "ゲームポートを有効にする"
msgid "Enable Adlib ports"
msgstr "Adlibポートを有効にする"
msgid "SID Model"
msgstr "SIDモデル"

View File

@@ -15,8 +15,8 @@ msgstr "키보드는 캡쳐가 필요함(&K)"
msgid "&Right CTRL is left ALT"
msgstr "우측CTRL로 좌측ALT 입력(&R)"
msgid "&Hard Reset..."
msgstr "재시작(&H)..."
msgid "&Hard reset"
msgstr "재시작(&H)"
msgid "&Ctrl+Alt+Del"
msgstr "Ctrl+Alt+Del(&C)"
@@ -51,6 +51,9 @@ msgstr "창 크기 조절 가능하게 하기(&R)"
msgid "R&emember size && position"
msgstr "창 크기와 위치를 기억하기(&E)"
msgid "Remember size && position"
msgstr "창 크기와 위치를 기억하기"
msgid "Re&nderer"
msgstr "렌더러(&N)"
@@ -1074,6 +1077,12 @@ msgstr "강제 종료"
msgid "Start"
msgstr "시작"
msgid "&Force shutdown"
msgstr "강제 종료(&F)"
msgid "&Start"
msgstr "시작(&S)"
msgid "Not running"
msgstr "실행 중이 아닙니다"
@@ -2136,6 +2145,9 @@ msgstr "낮은 DMA"
msgid "Enable Game port"
msgstr "게임 포트 사용"
msgid "Enable Adlib ports"
msgstr "Adlib 포트 활성화"
msgid "SID Model"
msgstr "SID 모델"

View File

@@ -15,8 +15,8 @@ msgstr "&Tastatur krever opptak"
msgid "&Right CTRL is left ALT"
msgstr "&Høyre CTRL er venstre ALT"
msgid "&Hard Reset..."
msgstr "&Hard tilbakestilling..."
msgid "&Hard reset"
msgstr "&Hard tilbakestilling"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Justerbart vindu"
msgid "R&emember size && position"
msgstr "H&usk størrelse &og plassering"
msgid "Remember size && position"
msgstr "Husk størrelse og plassering"
msgid "Re&nderer"
msgstr "Re&nderer"
@@ -1074,6 +1077,12 @@ msgstr "Tvangsavslutt"
msgid "Start"
msgstr "Start"
msgid "&Force shutdown"
msgstr "&Tvangsavslutt"
msgid "&Start"
msgstr "&Start"
msgid "Not running"
msgstr "Ikke kjørende"
@@ -2136,6 +2145,9 @@ msgstr "Lav DMA"
msgid "Enable Game port"
msgstr "Aktiver spillport"
msgid "Enable Adlib ports"
msgstr "Aktiver Adlib-porter"
msgid "SID Model"
msgstr "SID-modell"

View File

@@ -15,8 +15,8 @@ msgstr "&Keyboard vereist vastleggen"
msgid "&Right CTRL is left ALT"
msgstr "&Rechtse CTRL is linkse ALT"
msgid "&Hard Reset..."
msgstr "&Harde Reset..."
msgid "&Hard reset"
msgstr "&Harde reset"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Venster met aanpasbare grootte"
msgid "R&emember size && position"
msgstr "&Onthoud grootte && positie"
msgid "Remember size && position"
msgstr "Onthoud grootte && positie"
msgid "Re&nderer"
msgstr "Re&nderer"
@@ -1074,6 +1077,12 @@ msgstr "Forceer afsluiten"
msgid "Start"
msgstr "Start"
msgid "&Force shutdown"
msgstr "&Forceer afsluiten"
msgid "&Start"
msgstr "&Start"
msgid "Not running"
msgstr "Niet actied"
@@ -2136,6 +2145,9 @@ msgstr "Lage DMA"
msgid "Enable Game port"
msgstr "Game-poort inschakelen"
msgid "Enable Adlib ports"
msgstr "Adlib-poorten inschakelen"
msgid "SID Model"
msgstr "SID-model"

View File

@@ -15,8 +15,8 @@ msgstr "&Klawiatura wymaga przechwytu myszy"
msgid "&Right CTRL is left ALT"
msgstr "Prawy C&TRL to lewy ALT"
msgid "&Hard Reset..."
msgstr "Twardy &reset..."
msgid "&Hard reset"
msgstr "Twardy &reset"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Okno o zmiennym rozmiarze"
msgid "R&emember size && position"
msgstr "P&amiętaj rozmiar i pozycję"
msgid "Remember size && position"
msgstr "Pamiętaj rozmiar i pozycję"
msgid "Re&nderer"
msgstr "Re&nderer"
@@ -1074,6 +1077,12 @@ msgstr "Wymuś zamknięcie"
msgid "Start"
msgstr "Uruchom"
msgid "&Force shutdown"
msgstr "&Wymuś zamknięcie"
msgid "&Start"
msgstr "&Uruchom"
msgid "Not running"
msgstr "Wyłączona"
@@ -2136,6 +2145,9 @@ msgstr "Niski poziom DMA"
msgid "Enable Game port"
msgstr "Włącz port gier"
msgid "Enable Adlib ports"
msgstr "Włącz porty Adlib"
msgid "SID Model"
msgstr "Model SID"

View File

@@ -15,8 +15,8 @@ msgstr "O &teclado requer captura"
msgid "&Right CTRL is left ALT"
msgstr "CTR&L direito é o ALT esquerdo"
msgid "&Hard Reset..."
msgstr "&Reinicialização completa..."
msgid "&Hard reset"
msgstr "&Reinicialização completa"
msgid "&Ctrl+Alt+Del"
msgstr "Ctrl+Alt+&Del"
@@ -51,6 +51,9 @@ msgstr "&Janela redimensionável"
msgid "R&emember size && position"
msgstr "&Lembrar tamanho e posição"
msgid "Remember size && position"
msgstr "Lembrar tamanho e posição"
msgid "Re&nderer"
msgstr "&Renderizador"
@@ -1074,6 +1077,12 @@ msgstr "Forçar desligamento"
msgid "Start"
msgstr "Iniciar"
msgid "&Force shutdown"
msgstr "&Forçar desligamento"
msgid "&Start"
msgstr "&Iniciar"
msgid "Not running"
msgstr "Parado"
@@ -2136,6 +2145,9 @@ msgstr "DMA baixo"
msgid "Enable Game port"
msgstr "Ativar a porta do jogo"
msgid "Enable Adlib ports"
msgstr "Ativar portas Adlib"
msgid "SID Model"
msgstr "Modelo do SID"

View File

@@ -15,8 +15,8 @@ msgstr "&Teclado requere captura"
msgid "&Right CTRL is left ALT"
msgstr "CTRL &direito é ALT esquerdo"
msgid "&Hard Reset..."
msgstr "&Reinicialização completa..."
msgid "&Hard reset"
msgstr "&Reinicialização completa"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Janela redimensionável"
msgid "R&emember size && position"
msgstr "&Lembrar tamanho e posição"
msgid "Remember size && position"
msgstr "Lembrar tamanho e posição"
msgid "Re&nderer"
msgstr "&Renderizador"
@@ -1074,6 +1077,12 @@ msgstr "Desligamento forçado"
msgid "Start"
msgstr "Iniciar"
msgid "&Force shutdown"
msgstr "&Desligamento forçado"
msgid "&Start"
msgstr "&Iniciar"
msgid "Not running"
msgstr "Não em execução"
@@ -2136,6 +2145,9 @@ msgstr "DMA baixo"
msgid "Enable Game port"
msgstr "Ativar a porta de jogos"
msgid "Enable Adlib ports"
msgstr "Ativar portas Adlib"
msgid "SID Model"
msgstr "Modelo do SID"

View File

@@ -15,8 +15,8 @@ msgstr "&Клавиатура требует захвата"
msgid "&Right CTRL is left ALT"
msgstr "&Правый CTRL - это левый ALT"
msgid "&Hard Reset..."
msgstr "&Холодная перезагрузка..."
msgid "&Hard reset"
msgstr "&Холодная перезагрузка"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Изменяемый размер окна"
msgid "R&emember size && position"
msgstr "&Запомнить размер и положение"
msgid "Remember size && position"
msgstr "Запомнить размер и положение"
msgid "Re&nderer"
msgstr "&Рендеринг"
@@ -1074,6 +1077,12 @@ msgstr "Принудительное завершение работы"
msgid "Start"
msgstr "Пуск"
msgid "&Force shutdown"
msgstr "Принудительное &завершение работы"
msgid "&Start"
msgstr "&Пуск"
msgid "Not running"
msgstr "Не работает"
@@ -2136,6 +2145,9 @@ msgstr "Низкий DMA"
msgid "Enable Game port"
msgstr "Включить игровой порт"
msgid "Enable Adlib ports"
msgstr "Включить порты Adlib"
msgid "SID Model"
msgstr "Модель SID"

View File

@@ -15,7 +15,7 @@ msgstr "&Klávesnica vyžaduje záber"
msgid "&Right CTRL is left ALT"
msgstr "&Pravý Ctrl je ľavý Alt"
msgid "&Hard Reset..."
msgid "&Hard reset"
msgstr "&Resetovať"
msgid "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Premenná veľkosť okna"
msgid "R&emember size && position"
msgstr "&Pamätať si veľkosť a polohu"
msgid "Remember size && position"
msgstr "Pamätať si veľkosť a polohu"
msgid "Re&nderer"
msgstr "&Renderer"
@@ -1074,6 +1077,12 @@ msgstr "Vynútiť vypnutie"
msgid "Start"
msgstr "Spustiť"
msgid "&Force shutdown"
msgstr "&Vynútiť vypnutie"
msgid "&Start"
msgstr "&Spustiť"
msgid "Not running"
msgstr "Nebeží"
@@ -2136,6 +2145,9 @@ msgstr "Nízka hodnota DMA"
msgid "Enable Game port"
msgstr "Povolenie herného portu"
msgid "Enable Adlib ports"
msgstr "Povoliť porty Adlib"
msgid "SID Model"
msgstr "Model SID"

View File

@@ -15,8 +15,8 @@ msgstr "&Tipkovnica potrebuje zajem"
msgid "&Right CTRL is left ALT"
msgstr "&Desni CTRL je levi ALT"
msgid "&Hard Reset..."
msgstr "&Ponovni zagon..."
msgid "&Hard reset"
msgstr "&Ponovni zagon"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "S&premenljiva velikost okna"
msgid "R&emember size && position"
msgstr "&Zapomni si velikost in položaj"
msgid "Remember size && position"
msgstr "Zapomni si velikost in položaj"
msgid "Re&nderer"
msgstr "&Upodabljanje"
@@ -1074,6 +1077,12 @@ msgstr "Prisilno prekini"
msgid "Start"
msgstr "Zaženi"
msgid "&Force shutdown"
msgstr "&Prisilno prekini"
msgid "&Start"
msgstr "&Zaženi"
msgid "Not running"
msgstr "Se ne izvaja"
@@ -2136,6 +2145,9 @@ msgstr "Nizki DMA"
msgid "Enable Game port"
msgstr "Omogočanje igralnih vrat"
msgid "Enable Adlib ports"
msgstr "Omogoči vrata Adlib"
msgid "SID Model"
msgstr "Model SID-a"

View File

@@ -15,8 +15,8 @@ msgstr "&Tangentbord behöver uppfångas"
msgid "&Right CTRL is left ALT"
msgstr "&Höger CTRL är vänster ALT"
msgid "&Hard Reset..."
msgstr "&Hård omstart..."
msgid "&Hard reset"
msgstr "&Hård omstart"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Ändringsbar fönsterstorlek"
msgid "R&emember size && position"
msgstr "K&om ihåg storlek && position"
msgid "Remember size && position"
msgstr "Kom ihåg storlek && position"
msgid "Re&nderer"
msgstr "Re&nderare"
@@ -1074,6 +1077,12 @@ msgstr "Tvinga avstängning"
msgid "Start"
msgstr "Starta"
msgid "&Force shutdown"
msgstr "&Tvinga avstängning"
msgid "&Start"
msgstr "&Starta"
msgid "Not running"
msgstr "Körs ej"
@@ -2136,6 +2145,9 @@ msgstr "Låg DMA"
msgid "Enable Game port"
msgstr "Aktivera spelport"
msgid "Enable Adlib ports"
msgstr "Aktivera Adlib-portar"
msgid "SID Model"
msgstr "SID-modell"

View File

@@ -15,8 +15,8 @@ msgstr "&Klavye sadece fare yakalandığında çalışsın"
msgid "&Right CTRL is left ALT"
msgstr "&Sağ CTRL tuşunu sol ALT tuşu olarak ayarla"
msgid "&Hard Reset..."
msgstr "Yeniden başlamaya &zorla..."
msgid "&Hard reset"
msgstr "Yeniden başlamaya &zorla"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Boyutlandırılabilir pencere"
msgid "R&emember size && position"
msgstr "&Pencere boyut ve pozisyonunu kaydet"
msgid "Remember size && position"
msgstr "Pencere boyut ve pozisyonunu kaydet"
msgid "Re&nderer"
msgstr "Derley&ici"
@@ -1074,6 +1077,12 @@ msgstr "Kapatmaya zorla"
msgid "Start"
msgstr "Başlat"
msgid "&Force shutdown"
msgstr "&Kapatmaya zorla"
msgid "&Start"
msgstr "&Başlat"
msgid "Not running"
msgstr "Çalışmıyor"
@@ -2136,6 +2145,9 @@ msgstr "Düşük DMA"
msgid "Enable Game port"
msgstr "Gameport'ı etkinleştir"
msgid "Enable Adlib ports"
msgstr "Adlib bağlantı noktalarını etkinleştir"
msgid "SID Model"
msgstr "SID Modeli"

View File

@@ -15,8 +15,8 @@ msgstr "&Клавіатура потребує захвату"
msgid "&Right CTRL is left ALT"
msgstr "&Правий CTRL - це лівий ALT"
msgid "&Hard Reset..."
msgstr "&Холодне перезавантаження..."
msgid "&Hard reset"
msgstr "&Холодне перезавантаження"
msgid "&Ctrl+Alt+Del"
msgstr "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "&Змінний розмір вікна"
msgid "R&emember size && position"
msgstr "&Запам'ятати розмір і становище"
msgid "Remember size && position"
msgstr "Запам'ятати розмір і становище"
msgid "Re&nderer"
msgstr "&Рендеринг"
@@ -1074,6 +1077,12 @@ msgstr "Примусове завершення роботи"
msgid "Start"
msgstr "Пуск"
msgid "&Force shutdown"
msgstr "Примусове &завершення роботи"
msgid "&Start"
msgstr "&Пуск"
msgid "Not running"
msgstr "Не працює"
@@ -2136,6 +2145,9 @@ msgstr "Низький рівень DMA"
msgid "Enable Game port"
msgstr "Увімкнути ігровий порт"
msgid "Enable Adlib ports"
msgstr "Увімкнути порти Adlib"
msgid "SID Model"
msgstr "Модель SID"

View File

@@ -15,7 +15,7 @@ msgstr "Bàn phím &hoạt động cần 'bắt' chuột"
msgid "&Right CTRL is left ALT"
msgstr "Gắn ALT trái vào CTRL ph&ải"
msgid "&Hard Reset..."
msgid "&Hard reset"
msgstr "Buộc khởi độn&g lại"
msgid "&Ctrl+Alt+Del"
@@ -51,6 +51,9 @@ msgstr "Tùy chỉnh cỡ cử&a sổ"
msgid "R&emember size && position"
msgstr "Ghi nhớ vị trí và kíc&h thước cửa sổ"
msgid "Remember size && position"
msgstr "Ghi nhớ vị trí và kích thước cửa sổ"
msgid "Re&nderer"
msgstr "Re&nderer"
@@ -1074,6 +1077,12 @@ msgstr "Buộc tắt nguồn máy"
msgid "Start"
msgstr "Khởi động"
msgid "&Force shutdown"
msgstr "&Buộc tắt nguồn máy"
msgid "&Start"
msgstr "&Khởi động"
msgid "Not running"
msgstr "Đang không chạy"
@@ -2136,6 +2145,9 @@ msgstr "DMA thấp"
msgid "Enable Game port"
msgstr "Bật cổng trò chơi"
msgid "Enable Adlib ports"
msgstr "Bật cổng Adlib"
msgid "SID Model"
msgstr "Mẫu SID"

View File

@@ -15,8 +15,8 @@ msgstr "键盘需要捕捉(&K)"
msgid "&Right CTRL is left ALT"
msgstr "将右 CTRL 键映射为左 ALT 键(&R)"
msgid "&Hard Reset..."
msgstr "硬重置(&H)..."
msgid "&Hard reset"
msgstr "硬重置(&H)"
msgid "&Ctrl+Alt+Del"
msgstr "Ctrl+Alt+Del(&C)"
@@ -51,6 +51,9 @@ msgstr "窗口大小可调(&R)"
msgid "R&emember size && position"
msgstr "记住窗口大小和位置(&E)"
msgid "Remember size && position"
msgstr "记住窗口大小和位置"
msgid "Re&nderer"
msgstr "渲染器(&N)"
@@ -1074,6 +1077,12 @@ msgstr "强制关机"
msgid "Start"
msgstr "启动"
msgid "&Force shutdown"
msgstr "强制关机(&F)"
msgid "&Start"
msgstr "启动(&S)"
msgid "Not running"
msgstr "未在运行"
@@ -2136,6 +2145,9 @@ msgstr "低 DMA"
msgid "Enable Game port"
msgstr "启用游戏端口"
msgid "Enable Adlib ports"
msgstr "启用 Adlib 端口"
msgid "SID Model"
msgstr "SID 芯片型号"

View File

@@ -15,8 +15,8 @@ msgstr "鍵盤需要捕捉(&K)"
msgid "&Right CTRL is left ALT"
msgstr "將右 CTRL 鍵映射為左 ALT 鍵(&R)"
msgid "&Hard Reset..."
msgstr "硬重設(&H)..."
msgid "&Hard reset"
msgstr "硬重設(&H)"
msgid "&Ctrl+Alt+Del"
msgstr "Ctrl+Alt+Del(&C)"
@@ -51,6 +51,9 @@ msgstr "視窗大小可調(&R)"
msgid "R&emember size && position"
msgstr "記住視窗大小和位置(&E)"
msgid "Remember size && position"
msgstr "記住視窗大小和位置"
msgid "Re&nderer"
msgstr "渲染器(&N)"
@@ -1074,6 +1077,12 @@ msgstr "強制關機"
msgid "Start"
msgstr "開始"
msgid "&Force shutdown"
msgstr "強制關機(&F)"
msgid "&Start"
msgstr "開始(&S)"
msgid "Not running"
msgstr "未執行"
@@ -2136,6 +2145,9 @@ msgstr "低 DMA"
msgid "Enable Game port"
msgstr "啟用遊戲埠"
msgid "Enable Adlib ports"
msgstr "啟用 Adlib 連接埠"
msgid "SID Model"
msgstr "SID 型號"

View File

@@ -200,7 +200,11 @@ MainWindow::MainWindow(QWidget *parent)
frameRateTimer->setInterval(1000);
frameRateTimer->setSingleShot(false);
connect(frameRateTimer, &QTimer::timeout, [hertz_label] {
hertz_label->setText(tr("%1 Hz").arg(QString::number(monitors[0].mon_actualrenderedframes.load()) + (monitors[0].mon_interlace ? "i" : "")));
auto hz = monitors[0].mon_actualrenderedframes.load();
#ifdef SCREENSHOT_MODE
hz = ((hz + 2) / 5) * 5;
#endif
hertz_label->setText(tr("%1 Hz").arg(QString::number(hz) + (monitors[0].mon_interlace ? "i" : "")));
});
statusBar()->addPermanentWidget(hertz_label);
frameRateTimer->start(1000);

View File

@@ -340,7 +340,7 @@
<normaloff>:/menuicons/qt/icons/hard_reset.ico</normaloff>:/menuicons/qt/icons/hard_reset.ico</iconset>
</property>
<property name="text">
<string>&amp;Hard Reset...</string>
<string>&amp;Hard reset</string>
</property>
<property name="iconVisibleInMenu">
<bool>false</bool>

View File

@@ -267,6 +267,13 @@ plat_getcwd(char *bufp, int max)
return 0;
}
char *
path_get_basename(const char *path)
{
QFileInfo fi(path);
return fi.fileName().toUtf8().data();
}
void
path_get_dirname(char *dest, const char *path)
{

View File

@@ -161,7 +161,8 @@ VMManagerDetailSection::setupMainLayout()
void
VMManagerDetailSection::setSections()
{
int row = 0;
int row = 0;
bool empty = true;
for (const auto& section : sections) {
QStringList sectionsToAdd = section.value.split(sectionSeparator);
@@ -189,12 +190,13 @@ VMManagerDetailSection::setSections()
const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
frameGridLayout->addItem(hSpacer, row, 2);
empty = false;
row++;
}
}
collapseButton->setContent(ui->detailFrame);
if (sections.size())
if (!empty)
setVisible(true);
}
void

View File

@@ -109,6 +109,53 @@ VMManagerMain::VMManagerMain(QWidget *parent) :
if (indexAt.isValid()) {
QMenu contextMenu(tr("Context Menu"), ui->listView);
QAction startAction(tr("&Start"));
contextMenu.addAction(&startAction);
connect(&startAction, &QAction::triggered, [this] {
selected_sysconfig->startButtonPressed();
});
startAction.setEnabled(selected_sysconfig->process->state() == QProcess::NotRunning);
startAction.setVisible(selected_sysconfig->process->state() == QProcess::NotRunning);
QAction pauseAction(tr("&Pause"));
contextMenu.addAction(&pauseAction);
connect(&pauseAction, &QAction::triggered, [this] {
selected_sysconfig->pauseButtonPressed();
});
pauseAction.setEnabled(selected_sysconfig->process->state() == QProcess::Running);
pauseAction.setVisible(selected_sysconfig->process->state() == QProcess::Running);
if (selected_sysconfig->getProcessStatus() != VMManagerSystem::ProcessStatus::Running)
pauseAction.setText(tr("Re&sume"));
QAction resetAction(tr("&Hard reset"));
contextMenu.addAction(&resetAction);
connect(&resetAction, &QAction::triggered, [this] {
selected_sysconfig->restartButtonPressed();
});
resetAction.setEnabled(selected_sysconfig->process->state() == QProcess::Running);
QAction forceShutdownAction(tr("&Force shutdown"));
contextMenu.addAction(&forceShutdownAction);
connect(&forceShutdownAction, &QAction::triggered, [this] {
selected_sysconfig->shutdownForceButtonPressed();
});
forceShutdownAction.setEnabled(selected_sysconfig->process->state() == QProcess::Running);
QAction cadAction(tr("&Ctrl+Alt+Del"));
contextMenu.addAction(&cadAction);
connect(&cadAction, &QAction::triggered, [this] {
selected_sysconfig->cadButtonPressed();
});
cadAction.setEnabled(selected_sysconfig->process->state() == QProcess::Running);
contextMenu.addSeparator();
QAction settingsAction(tr("&Settings..."));
contextMenu.addAction(&settingsAction);
connect(&settingsAction, &QAction::triggered, [this] {
selected_sysconfig->launchSettings();
});
QAction nameChangeAction(tr("Change &display name..."));
contextMenu.addAction(&nameChangeAction);
// Use a lambda to call a function so indexAt can be passed
@@ -343,7 +390,7 @@ illegal_chars:
} else {
QMenu contextMenu(tr("Context Menu"), ui->listView);
QAction newMachineAction(tr("New machine..."));
QAction newMachineAction(tr("&New machine..."));
contextMenu.addAction(&newMachineAction);
connect(&newMachineAction, &QAction::triggered, this, &VMManagerMain::newMachineWizard);
@@ -740,6 +787,18 @@ VMManagerMain::machineCountString(QString states) const
return tr("VMs: %1").arg(states);
}
QList<int>
VMManagerMain::getPaneSizes() const
{
return ui->splitter->sizes();
}
void
VMManagerMain::setPaneSizes(const QList<int> &sizes)
{
ui->splitter->setSizes(sizes);
}
void
VMManagerMain::modelDataChange()
{

View File

@@ -87,6 +87,9 @@ public slots:
void onConfigUpdated(const QString &uuid);
int getActiveMachineCount();
QList<int> getPaneSizes() const;
void setPaneSizes(const QList<int> &sizes);
private:
Ui::VMManagerMain *ui;

View File

@@ -135,26 +135,42 @@ VMManagerMainWindow(QWidget *parent)
{
auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
this->ui->actionRemember_size_and_position->setChecked(!!config->getStringValue("window_remember").toInt());
if (ui->actionRemember_size_and_position->isChecked()) {
QStringList list = config->getStringValue("window_coordinates").split(',');
for (auto& cur : list) {
cur = cur.trimmed();
}
QRect geom;
geom.setX(list[0].toInt());
geom.setY(list[1].toInt());
geom.setWidth(list[2].toInt());
geom.setHeight(list[3].toInt());
if (!!config->getStringValue("window_remember").toInt()) {
QString coords = config->getStringValue("window_coordinates");
if (!coords.isEmpty()) {
QStringList list = coords.split(',');
for (auto& cur : list) {
cur = cur.trimmed();
}
QRect geom;
geom.setX(list[0].toInt());
geom.setY(list[1].toInt());
geom.setWidth(list[2].toInt());
geom.setHeight(list[3].toInt());
setGeometry(geom);
}
setGeometry(geom);
if (!!config->getStringValue("window_maximized").toInt()) {
setWindowState(windowState() | Qt::WindowMaximized);
}
QString splitter = config->getStringValue("window_splitter");
if (!splitter.isEmpty()) {
QStringList list = splitter.split(',');
for (auto& cur : list) {
cur = cur.trimmed();
}
QList<int> paneSizes;
paneSizes.append(list[0].toInt());
paneSizes.append(list[1].toInt());
vmm->setPaneSizes(paneSizes);
}
} else {
config->setStringValue("window_remember", "");
config->setStringValue("window_coordinates", "");
config->setStringValue("window_maximized", "");
config->setStringValue("window_splitter", "");
}
delete config;
}
@@ -214,14 +230,14 @@ VMManagerMainWindow::saveSettings() const
const auto currentSelection = vmm->getCurrentSelection();
const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
config->setStringValue("last_selection", currentSelection);
config->setStringValue("window_remember", QString::number(ui->actionRemember_size_and_position->isChecked()));
if (ui->actionRemember_size_and_position->isChecked()) {
if (!!config->getStringValue("window_remember").toInt()) {
config->setStringValue("window_coordinates", QString::asprintf("%i, %i, %i, %i", this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height()));
config->setStringValue("window_maximized", this->isMaximized() ? "1" : "");
config->setStringValue("window_splitter", QString::asprintf("%i, %i", vmm->getPaneSizes()[0], vmm->getPaneSizes()[1]));
} else {
config->setStringValue("window_remember", "");
config->setStringValue("window_coordinates", "");
config->setStringValue("window_maximized", "");
config->setStringValue("window_splitter", "");
}
// Sometimes required to ensure the settings save before the app exits
config->sync();

View File

@@ -28,7 +28,6 @@
<string>&amp;Tools</string>
</property>
<addaction name="actionPreferences"/>
<addaction name="actionRemember_size_and_position"/>
<addaction name="actionCheck_for_updates"/>
</widget>
<widget class="QMenu" name="menuFile">
@@ -99,6 +98,9 @@
<property name="text">
<string>&amp;Start</string>
</property>
<property name="toolTip">
<string>Start</string>
</property>
<property name="iconVisibleInMenu">
<bool>false</bool>
</property>
@@ -109,7 +111,10 @@
<normaloff>:/menuicons/qt/icons/hard_reset.ico</normaloff>:/menuicons/qt/icons/hard_reset.ico</iconset>
</property>
<property name="text">
<string>&amp;Hard Reset...</string>
<string>&amp;Hard reset</string>
</property>
<property name="toolTip">
<string>Hard reset</string>
</property>
<property name="iconVisibleInMenu">
<bool>false</bool>
@@ -168,6 +173,9 @@
<property name="text">
<string>&amp;Settings...</string>
</property>
<property name="toolTip">
<string>Settings...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
@@ -187,14 +195,6 @@
<string>New machine...</string>
</property>
</action>
<action name="actionRemember_size_and_position">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>R&amp;emember size &amp;&amp; position</string>
</property>
</action>
<action name="actionPreferences">
<property name="text">
<string>&amp;Preferences...</string>

View File

@@ -70,6 +70,8 @@ VMManagerPreferences(QWidget *parent) : ui(new Ui::VMManagerPreferences)
#endif
const auto useRegexSearch = config->getStringValue("regex_search").toInt();
ui->regexSearchCheckBox->setChecked(useRegexSearch);
const auto rememberSizePosition = config->getStringValue("window_remember").toInt();
ui->rememberSizePositionCheckBox->setChecked(rememberSizePosition);
ui->radioButtonSystem->setChecked(color_scheme == 0);
ui->radioButtonLight->setChecked(color_scheme == 1);
@@ -112,6 +114,7 @@ VMManagerPreferences::accept()
#if EMU_BUILD_NUM != 0
config->setStringValue("update_check", ui->updateCheckBox->isChecked() ? "1" : "0");
#endif
config->setStringValue("window_remember", ui->rememberSizePositionCheckBox->isChecked() ? "1" : "0");
config->setStringValue("regex_search", ui->regexSearchCheckBox->isChecked() ? "1" : "0");
QDialog::accept();
}

View File

@@ -92,6 +92,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="rememberSizePositionCheckBox">
<property name="text">
<string>Remember size &amp;&amp; position</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="updateCheckBox">
<property name="text">
@@ -165,6 +172,7 @@
<tabstop>dirSelectButton</tabstop>
<tabstop>comboBoxLanguage</tabstop>
<tabstop>pushButtonLanguage</tabstop>
<tabstop>rememberSizePositionCheckBox</tabstop>
<tabstop>updateCheckBox</tabstop>
<tabstop>regexSearchCheckBox</tabstop>
</tabstops>

View File

@@ -425,6 +425,16 @@ VMManagerSystem::launchMainProcess() {
QStringList args;
args << "--vmpath" << config_dir;
args << "--vmname" << displayName;
if (rom_path[0] != '\0')
args << "--rompath" << QString(rom_path);
if (global_cfg_overridden)
args << "--global" << QString(global_cfg_path);
if (!hook_enabled)
args << "--nohook";
if (start_in_fullscreen)
args << "--fullscreen";
if (!confirm_exit_cmdl)
args << "--noconfirm";
process->setProgram(program);
process->setArguments(args);
qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments();
@@ -481,6 +491,10 @@ VMManagerSystem::launchSettings() {
QStringList open_command_args;
QStringList args;
args << "--vmpath" << config_dir << "--settings";
if (rom_path[0] != '\0')
args << "--rompath" << QString(rom_path);
if (global_cfg_overridden)
args << "--global" << QString(global_cfg_path);
process->setProgram(program);
process->setArguments(args);
qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments();
@@ -711,7 +725,7 @@ VMManagerSystem::setupVars() {
}
static auto floppy_match = QRegularExpression("fdd_\\d\\d_type", QRegularExpression::CaseInsensitiveOption);
static auto cdrom_match = QRegularExpression("cdrom_\\d\\d_type", QRegularExpression::CaseInsensitiveOption);
static auto cdrom_match = QRegularExpression("cdrom_\\d\\d_parameters", QRegularExpression::CaseInsensitiveOption);
for(const auto& key: floppy_cdrom_config.keys()) {
if(key.contains(floppy_match)) {
// auto device_number = key.split("_").at(1);
@@ -727,22 +741,23 @@ VMManagerSystem::setupVars() {
}
if(key.contains(cdrom_match)) {
auto device_number = key.split("_").at(1);
auto cdrom_internal_name = QString(floppy_cdrom_config[key]);
auto cdrom_parameters = QString(floppy_cdrom_config[key]);
auto cdrom_bus = cdrom_parameters.split(",").at(1).trimmed().toUpper();
auto cdrom_type_key = QString("cdrom_%1_type").arg(device_number);
auto cdrom_internal_name = QString(floppy_cdrom_config[cdrom_type_key]);
if (cdrom_internal_name.isEmpty())
cdrom_internal_name = "86cd";
auto cdrom_type = cdrom_get_from_internal_name(cdrom_internal_name.toUtf8().data());
auto cdrom_speed_key = QString("cdrom_%1_speed").arg(device_number);
auto cdrom_parameters_key = QString("cdrom_%1_parameters").arg(device_number);
auto cdrom_speed = QString(floppy_cdrom_config[cdrom_speed_key]);
auto cdrom_parameters = QString(floppy_cdrom_config[cdrom_parameters_key]);
auto cdrom_bus = cdrom_parameters.split(",").at(1).trimmed().toUpper();
if (cdrom_speed.isEmpty())
cdrom_speed = "8";
if(cdrom_type != -1) {
if(!cdrom_speed.isEmpty()) {
cdrom_speed = QString("%1x ").arg(cdrom_speed);
}
if(!cdrom_bus.isEmpty()) {
cdrom_bus = QString(" (%1)").arg(cdrom_bus);
}
if ((cdrom_bus != "NONE") && (cdrom_type != -1)) {
cdrom_speed = QString("%1x ").arg(cdrom_speed);
cdrom_bus = QString(" (%1)").arg(cdrom_bus);
cdromDevices.append(QString("%1%2 %3 %4%5").arg(cdrom_speed, cdrom_drive_types[cdrom_type].vendor, cdrom_drive_types[cdrom_type].model, cdrom_drive_types[cdrom_type].revision, cdrom_bus));
}
}

View File

@@ -50,9 +50,13 @@ joystick_init(void)
SDL_SetHint(SDL_HINT_JOYSTICK_THREAD, "1");
#endif
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != 0) {
#ifdef __APPLE__
if (SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) != 0)
#else
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != 0)
#endif
return;
}
joysticks_present = SDL_NumJoysticks();
memset(sdl_joy, 0, sizeof(sdl_joy));

View File

@@ -37,10 +37,11 @@
#define I_MUSIC 1
#define I_WT 2
#define I_CD 3
#define I_MIDI 4
#define I_FDD 5
#define I_FDD 4
#define I_MIDI 5
static int audio[6] = {-1, -1, -1, -1, -1, -1};
#ifdef USE_NEW_API
static struct audio_swpar info[5];
#else
@@ -48,120 +49,139 @@ static audio_info_t info[6];
#endif
static int freqs[6] = {SOUND_FREQ, MUSIC_FREQ, WT_FREQ, CD_FREQ, SOUND_FREQ, 0};
void closeal(void){
int i;
for(i = 0; i < sizeof(audio) / sizeof(audio[0]); i++){
if(audio[i] != -1){
close(audio[i]);
}
audio[i] = -1;
}
void
closeal(void)
{
for (int i = 0; i < sizeof(audio) / sizeof(audio[0]); i++) {
if (audio[i] != -1)
close(audio[i]);
audio[i] = -1;
}
}
void inital(void){
int i;
for(i = 0; i < sizeof(audio) / sizeof(audio[0]); i++){
audio[i] = open("/dev/audio", O_WRONLY);
if(audio[i] == -1) audio[i] = open("/dev/audio0", O_WRONLY);
if(audio[i] != -1){
void
inital(void)
{
for (int i = 0; i < sizeof(audio) / sizeof(audio[0]); i++) {
audio[i] = open("/dev/audio", O_WRONLY);
if (audio[i] == -1)
audio[i] = open("/dev/audio0", O_WRONLY);
if (audio[i] != -1) {
#ifdef USE_NEW_API
AUDIO_INITPAR(&info[i]);
ioctl(audio[i], AUDIO_GETPAR, &info[i]);
info[i].sig = 1;
info[i].bits = 16;
info[i].pchan = 2;
info[i].bps = 2;
ioctl(audio[i], AUDIO_SETPAR, &info[i]);
AUDIO_INITPAR(&info[i]);
ioctl(audio[i], AUDIO_GETPAR, &info[i]);
info[i].sig = 1;
info[i].bits = 16;
info[i].pchan = 2;
info[i].bps = 2;
ioctl(audio[i], AUDIO_SETPAR, &info[i]);
#else
AUDIO_INITINFO(&info[i]);
AUDIO_INITINFO(&info[i]);
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 900000000)
ioctl(audio[i], AUDIO_GETFORMAT, &info[i]);
ioctl(audio[i], AUDIO_GETFORMAT, &info[i]);
#else
ioctl(audio[i], AUDIO_GETINFO, &info[i]);
ioctl(audio[i], AUDIO_GETINFO, &info[i]);
#endif
info[i].play.channels = 2;
info[i].play.precision = 16;
info[i].play.encoding = AUDIO_ENCODING_SLINEAR;
info[i].hiwat = 5;
info[i].lowat = 3;
ioctl(audio[i], AUDIO_SETINFO, &info[i]);
info[i].play.channels = 2;
info[i].play.precision = 16;
info[i].play.encoding = AUDIO_ENCODING_SLINEAR;
info[i].hiwat = 5;
info[i].lowat = 3;
ioctl(audio[i], AUDIO_SETINFO, &info[i]);
#endif
}
}
}
}
}
void givealbuffer_common(const void *buf, const uint8_t src, const int size){
const int freq = freqs[src];
int16_t* output;
int output_size;
int16_t* conv;
int conv_size;
int i;
double gain;
int target_rate;
if(audio[src] == -1) return;
void
givealbuffer_common(const void *buf, const uint8_t src, const int size)
{
const int freq = freqs[src];
int16_t* output;
int output_size;
int16_t* conv;
int conv_size;
double gain;
int target_rate;
gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
if(audio[src] == -1)
return;
if(sound_is_float){
float* input = (float*)buf;
conv_size = sizeof(int16_t) * size;
conv = malloc(conv_size);
for(i = 0; i < conv_size / sizeof(int16_t); i++){
conv[i] = 32767 * input[i];
}
}else{
conv_size = size * sizeof(int16_t);
conv = malloc(conv_size);
memcpy(conv, buf, conv_size);
}
gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0);
if (sound_is_float) {
float* input = (float*)buf;
conv_size = sizeof(int16_t) * size;
conv = malloc(conv_size);
for (int i = 0; i < conv_size / sizeof(int16_t); i++)
conv[i] = 32767 * input[i];
} else {
conv_size = size * sizeof(int16_t);
conv = malloc(conv_size);
memcpy(conv, buf, conv_size);
}
#ifdef USE_NEW_API
target_rate = info[src].rate;
target_rate = info[src].rate;
#else
target_rate = info[src].play.sample_rate;
target_rate = info[src].play.sample_rate;
#endif
output_size = (double)conv_size * target_rate / freq;
output_size -= output_size % 4;
output = malloc(output_size);
for(i = 0; i < output_size / sizeof(int16_t) / 2; i++){
int ind = i * freq / target_rate * 2;
output[i * 2 + 0] = conv[ind + 0] * gain;
output[i * 2 + 1] = conv[ind + 1] * gain;
}
output_size = (double) conv_size * target_rate / freq;
output_size -= output_size % 4;
output = malloc(output_size);
for (int i = 0; i < output_size / sizeof(int16_t) / 2; i++) {
int ind = i * freq / target_rate * 2;
output[i * 2 + 0] = conv[ind + 0] * gain;
output[i * 2 + 1] = conv[ind + 1] * gain;
}
write(audio[src], output, output_size);
write(audio[src], output, output_size);
free(conv);
free(output);
free(conv);
free(output);
}
void givealbuffer(const void *buf){
givealbuffer_common(buf, I_NORMAL, SOUNDBUFLEN << 1);
void
givealbuffer(const void *buf)
{
givealbuffer_common(buf, I_NORMAL, SOUNDBUFLEN << 1);
}
void givealbuffer_music(const void *buf){
givealbuffer_common(buf, I_MUSIC, MUSICBUFLEN << 1);
void
givealbuffer_music(const void *buf)
{
givealbuffer_common(buf, I_MUSIC, MUSICBUFLEN << 1);
}
void givealbuffer_wt(const void *buf){
givealbuffer_common(buf, I_WT, WTBUFLEN << 1);
void
givealbuffer_wt(const void *buf)
{
givealbuffer_common(buf, I_WT, WTBUFLEN << 1);
}
void givealbuffer_cd(const void *buf){
givealbuffer_common(buf, I_CD, CD_BUFLEN << 1);
void
givealbuffer_cd(const void *buf)
{
givealbuffer_common(buf, I_CD, CD_BUFLEN << 1);
}
void givealbuffer_fdd(const void *buf, const uint32_t size){
void
givealbuffer_fdd(const void *buf, const uint32_t size)
{
givealbuffer_common(buf, I_FDD, (int) size);
}
void givealbuffer_midi(const void *buf, const uint32_t size){
givealbuffer_common(buf, I_MIDI, (int) size);
void
givealbuffer_midi(const void *buf, const uint32_t size)
{
givealbuffer_common(buf, I_MIDI, (int) size);
}
void al_set_midi(const int freq, UNUSED(const int buf_size)){
freqs[I_MIDI] = freq;
void
al_set_midi(const int freq, UNUSED(const int buf_size))
{
freqs[I_MIDI] = freq;
}

View File

@@ -37,6 +37,13 @@
#define FREQ SOUND_FREQ
#define BUFLEN SOUNDBUFLEN
#define I_NORMAL 0
#define I_MUSIC 1
#define I_WT 2
#define I_CD 3
#define I_FDD 4
#define I_MIDI 5
ALuint buffers[4]; /* front and back buffers */
ALuint buffers_music[4]; /* front and back buffers */
ALuint buffers_wt[4]; /* front and back buffers */
@@ -171,13 +178,47 @@ inital(void)
// Create sources: 0=main, 1=music, 2=wt, 3=cd, 4=fdd, 5=midi(optional)
alGenSources(sources, source);
// Initialize all sources
for (int i = 0; i < sources; i++) {
alSource3f(source[i], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSource3f(source[i], AL_VELOCITY, 0.0f, 0.0f, 0.0f);
alSource3f(source[i], AL_DIRECTION, 0.0f, 0.0f, 0.0f);
alSourcef(source[i], AL_ROLLOFF_FACTOR, 0.0f);
alSourcei(source[i], AL_SOURCE_RELATIVE, AL_TRUE);
if (init_midi)
alGenSources(5, source);
else
alGenSources(4, source);
alSource3f(source[I_NORMAL], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_NORMAL], AL_VELOCITY, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_NORMAL], AL_DIRECTION, 0.0f, 0.0f, 0.0f);
alSourcef(source[I_NORMAL], AL_ROLLOFF_FACTOR, 0.0f);
alSourcei(source[I_NORMAL], AL_SOURCE_RELATIVE, AL_TRUE);
alSource3f(source[I_MUSIC], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_MUSIC], AL_VELOCITY, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_MUSIC], AL_DIRECTION, 0.0f, 0.0f, 0.0f);
alSourcef(source[I_MUSIC], AL_ROLLOFF_FACTOR, 0.0f);
alSourcei(source[I_MUSIC], AL_SOURCE_RELATIVE, AL_TRUE);
alSource3f(source[I_WT], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_WT], AL_VELOCITY, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_WT], AL_DIRECTION, 0.0f, 0.0f, 0.0f);
alSourcef(source[I_WT], AL_ROLLOFF_FACTOR, 0.0f);
alSourcei(source[I_WT], AL_SOURCE_RELATIVE, AL_TRUE);
alSource3f(source[I_CD], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_CD], AL_VELOCITY, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_CD], AL_DIRECTION, 0.0f, 0.0f, 0.0f);
alSourcef(source[I_CD], AL_ROLLOFF_FACTOR, 0.0f);
alSourcei(source[I_CD], AL_SOURCE_RELATIVE, AL_TRUE);
alSource3f(source[I_FDD], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_FDD], AL_VELOCITY, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_FDD], AL_DIRECTION, 0.0f, 0.0f, 0.0f);
alSourcef(source[I_FDD], AL_ROLLOFF_FACTOR, 0.0f);
alSourcei(source[I_FDD], AL_SOURCE_RELATIVE, AL_TRUE);
if (init_midi) {
alSource3f(source[I_MIDI], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_MIDI], AL_VELOCITY, 0.0f, 0.0f, 0.0f);
alSource3f(source[I_MIDI], AL_DIRECTION, 0.0f, 0.0f, 0.0f);
alSourcef(source[I_MIDI], AL_ROLLOFF_FACTOR, 0.0f);
alSourcei(source[I_MIDI], AL_SOURCE_RELATIVE, AL_TRUE);
}
if (sound_is_float) {
@@ -233,6 +274,20 @@ inital(void)
alSourcePlay(source[4]);
if (init_midi)
alSourcePlay(source[5]);
alSourceQueueBuffers(source[I_NORMAL], 4, buffers);
alSourceQueueBuffers(source[I_MUSIC], 4, buffers_music);
alSourceQueueBuffers(source[I_WT], 4, buffers_wt);
alSourceQueueBuffers(source[I_CD], 4, buffers_cd);
alSourceQueueBuffers(source[I_FDD], 4, buffers_fdd);
if (init_midi)
alSourceQueueBuffers(source[I_MIDI], 4, buffers_midi);
alSourcePlay(source[I_NORMAL]);
alSourcePlay(source[I_MUSIC]);
alSourcePlay(source[I_WT]);
alSourcePlay(source[I_CD]);
alSourcePlay(source[I_FDD]);
if (init_midi)
alSourcePlay(source[I_MIDI]);
if (sound_is_float) {
if (init_midi)

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