Skip to content

Commit

Permalink
Merge branch 'develop' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-jonsson committed Aug 27, 2024
2 parents c7b3818 + e2994aa commit ba0c232
Show file tree
Hide file tree
Showing 88 changed files with 7,990 additions and 1,082 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/libretro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

env:
VXT_VERSION: 1.0.0
VXT_VERSION: 1.1.0
ZIG_VERSION: 0.10.1
ZIG_ARCHS: "x86_64-linux-gnu i386-linux-gnu aarch64-linux-gnu arm-linux-gnueabi x86_64-macos-none aarch64-macos-none"
NDK_VERSION: r20
Expand Down Expand Up @@ -63,33 +63,33 @@ jobs:
shell: msys2 {0}
run: |
PATH="${GITHUB_WORKSPACE}/premake5":"$PATH"
premake5 --cc=gcc gmake
premake5 --no-modules --cc=gcc gmake
make clean libretro-frontend
mkdir package/virtualxt/x86_64-windows-gnu
cp build/lib/*.dll package/virtualxt/x86_64-windows-gnu
cp build/libretro/*.dll package/virtualxt/x86_64-windows-gnu
- name: Build (Android)
env:
CLANG_PATH: "./android-ndk-${NDK_VERSION}/toolchains/llvm/prebuilt/windows-x86_64/bin"
run: |
premake5 --cc=clang --os=android gmake
premake5 --no-modules --cc=clang --os=android gmake
for arch in ${NDK_ARCHS}; do
echo Building ${arch}...
rm -rf build/lib
rm -rf build/libretro
make CC="${CLANG_PATH}/${arch}21-clang" LD="${CLANG_PATH}/llvm-ld" AR="${CLANG_PATH}/llvm-ar" clean libretro-frontend
mkdir package/virtualxt/${arch}
cp build/lib/*.so package/virtualxt/${arch}
cp build/libretro/*.so package/virtualxt/${arch}
done
- name: Build (Unix)
run: |
premake5 --cc=clang --os=linux gmake
premake5 --no-modules --cc=clang --os=linux gmake
for arch in ${ZIG_ARCHS}; do
echo Building ${arch}...
rm -rf build/lib
rm -rf build/libretro
make CC="zig cc -target ${arch}" AR="zig ar" RANLIB="zig ranlib" clean libretro-frontend
mkdir package/virtualxt/${arch}
cp build/lib/*.so package/virtualxt/${arch}
cp build/libretro/*.so package/virtualxt/${arch}
done
- name: Package & Deploy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Build
run: |
premake5 --modules=ctrl,cga,mouse --static gmake
premake5 --modules=ctrl,cga,mouse gmake
make config=release_web clean web-frontend
- name: Docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sdl2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

env:
VXT_VERSION: 1.0.0
VXT_VERSION: 1.1.0
SDL2_VERSION: 2.28.5

jobs:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/terminal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Terminal

on:
push:
branches: [ "develop", "edge", "release" ]
pull_request:
branches: [ "develop" ]

workflow_dispatch:

env:
VXT_VERSION: 1.1.0

jobs:
netbsd-build:
name: Build (NetBSD AMD64)
runs-on: ubuntu-latest
env:
VXT_VERSION: 1.1.0
steps:
- uses: actions/checkout@v4
- name: Test and Build
timeout-minutes: 10
uses: vmactions/netbsd-vm@v1
with:
release: "10.0"
envs: VXT_VERSION
usesh: true
copyback: false
prepare: |
PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r | cut -d_ -f1)/All" /usr/sbin/pkg_add pkgin
pkgin -y in premake5 gmake libpcap-1.10.4
run: |
git config --global --add safe.directory $(pwd)
premake5 --test gmake
gmake clean test
premake5 gmake
gmake clean terminal-frontend
4 changes: 2 additions & 2 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

env:
VXT_VERSION: 1.0.0
VXT_VERSION: 1.1.0

jobs:
web-build:
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Build
run: |
premake5 --modules=ctrl,cga,mouse --static gmake
premake5 --modules=ctrl,cga,mouse gmake
make config=release_web clean web-frontend
- name: Package
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ __pycache__
/tools/tests/8088v1/8088.json
/lib/vxt/8088_tests.c

/*.log
/*.trace*
/tools/vxtdrv/vxtdrv.com
/tools/shutdown/shutdown.com
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
[![Build](https://github.com/andreas-jonsson/virtualxt/actions/workflows/sdl2.yml/badge.svg)](https://github.com/andreas-jonsson/virtualxt/actions/workflows/sdl2.yml)
[![Codecov](https://codecov.io/gh/andreas-jonsson/virtualxt/branch/develop/graph/badge.svg?token=HD9I58ZGG5)](https://codecov.io/gh/andreas-jonsson/virtualxt)
[![Packages](https://repology.org/badge/tiny-repos/virtualxt.svg?header=packages)](https://repology.org/project/virtualxt/versions)
[![Forum](https://img.shields.io/badge/forum-itch.io-blue)](https://phix.itch.io/virtualxt/community)
[![Chat](https://img.shields.io/matrix/virtualxt:matrix.org)](https://matrix.to/#/#virtualxt:matrix.org)
[![Support](https://github.com/BoostIO/issuehunt-materials/raw/master/v1/issuehunt-shield-v1.svg)](https://issuehunt.io/r/andreas-jonsson/virtualxt)

VirtualXT is a Turbo PC/XT (8088/V20) emulator that runs on modern hardware and operating systems.
VirtualXT is a PC/XT (8088) emulator that runs on modern hardware and operating systems.
It is designed to be simple and lightweight yet still capable enough to run a large
library of old application and games.

Browser version is avalible [here](https://realmode.games).

## Features

* Intel 8088 or NEC V20 CPU
* Intel 8088 processor
* Hardware CPU validator
* VGA and CGA compatible graphics
* CGA or VGA compatible graphics
* GLaBIOS or Turbo XT BIOS 3.1 with extensions
* Keyboard controller with 83-key XT-style keyboard
* Serial port with Microsoft 2-button mouse
* Floppy and hard disk controller
* ISA passthrough​ using Arstech USB2ISA adapter
* Floppy and hard disk emulation
* ISA passthrough​using Arstech USB2ISA adapter
* Direct file share with host
* Flexible module system
* Integerated GDB server
Expand All @@ -43,7 +43,7 @@ Browser version is avalible [here](https://realmode.games).
The emulator is written in C11 and can be compiled with most modern C compilers. In order to generate a Makefile you need to install [Premake](https://premake.github.io/). You also need to have [SDL2](https://www.libsdl.org/) installed on your system or pass `--sdl-path=<path to lib>` to the premake script.

```
git clone https://github.com/andreas-jonsson/virtualxt.git
git clone -b release https://github.com/andreas-jonsson/virtualxt.git
cd virtualxt
premake5 --modules gmake
make sdl2-frontend
Expand All @@ -64,6 +64,7 @@ It should be noted that DMA currently not supported and the CH367 board is **VER

A hardware validator was developed to ensure proper CPU behaviour.
Some additional information about that can be found [here](https://hackaday.io/project/184209-virtualxt-hardware-validator).
This [talk](https://youtu.be/qatzd0niz9A?si=_NVqQu_zc1KDB8W6) by Daniel Balsom describes the process in details.

![validator screenshot](screenshots/validator.jpg)

Expand Down
Binary file modified boot/freedos.img
Binary file not shown.
Binary file modified boot/freedos_hd.img
Binary file not shown.
Binary file modified boot/freedos_web_hd.img
Binary file not shown.
21 changes: 8 additions & 13 deletions front/libretro/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
#include "zip2img.h"
#endif

#ifdef VXTU_MODULES
#error Modules are not supported in this frontend. Configure with '--no-modules'.
#endif

#define AUDIO_FREQUENCY 44100

#define LOG(...) log_cb(RETRO_LOG_INFO, __VA_ARGS__)
Expand Down Expand Up @@ -83,7 +87,6 @@ struct retro_vfs_file_handle *disk_image_files[256] = {NULL};
struct retro_vfs_file_handle *hd_image = NULL;

int cpu_frequency = VXT_DEFAULT_FREQUENCY;
enum vxt_cpu_type cpu_type = VXT_CPU_8088;

vxt_system *sys = NULL;
struct vxt_pirepheral *disk = NULL;
Expand Down Expand Up @@ -143,7 +146,7 @@ static int tell_file(vxt_system *s, void *fp) {
}

static bool is_zip(const char *file) {
const char *ext = strrchr(file, '.');
const char *ext = strrchr(file, '.');
return ext && !strcmp(ext, ".zip");
}

Expand Down Expand Up @@ -281,7 +284,7 @@ static bool add_image_index(void) {
}

static const char *process_zip(const char *path) {
#ifdef ZIP2IMG
#ifdef ZIP2IMG
if (is_zip(path)) {
if (!temp_file_name[0]) {
tmpnam(temp_file_name);
Expand Down Expand Up @@ -311,12 +314,6 @@ static void check_variables(void) {
)
}

var = (struct retro_variable){ .key = "virtualxt_v20" };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
cpu_type = strcmp(var.value, "false") ? VXT_CPU_V20 : VXT_CPU_8088;
if (sys) SYNC(vxt_system_configure(sys, "libretro", var.key, var.value));
}

var = (struct retro_variable){ .key = "virtualxt_led" };
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
use_led_interface = strcmp(var.value, "false") != 0;
Expand All @@ -343,7 +340,7 @@ void retro_init(void) {
struct vxtu_disk_interface intrf = {
&read_file, &write_file, &seek_file, &tell_file
};

disk = vxtu_disk_create(&realloc, &intrf);
ppi = vxtu_ppi_create(&realloc);
cga = cga_create(&realloc);
Expand All @@ -368,10 +365,9 @@ void retro_init(void) {

vxtu_disk_set_activity_callback(disk, &disk_activity_cb, NULL);

sys = vxt_system_create(&realloc, cpu_type, cpu_frequency, devices);
sys = vxt_system_create(&realloc, cpu_frequency, devices);
vxt_system_initialize(sys);

LOG("CPU Type: %s\n", (cpu_type == VXT_CPU_8088) ? "Intel 8088" : "NEC V20");
LOG("CPU Frequency: %.2fMHz\n", (double)cpu_frequency / 1000000.0);
LOG("Installed pirepherals:\n");
for (int i = 1; i < VXT_MAX_PIREPHERALS; i++) {
Expand Down Expand Up @@ -446,7 +442,6 @@ void retro_set_environment(retro_environment_t cb) {

static const struct retro_variable vars[] = {
{ "virtualxt_led", "LED Interface; false|true" },
{ "virtualxt_v20", "NEC V20; false|true" },
{ "virtualxt_cpu_frequency", "CPU Frequency; 4.77MHz|6MHz|8MHz|10MHz|12MHz|16MHz" },
{ NULL, NULL }
};
Expand Down
2 changes: 1 addition & 1 deletion front/libretro/virtualxt_libretro.info
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ corename = "virtualxt"
license = "zlib-acknowledgement"
permissions = ""
categories = "Emulator"
display_version = "1.0.0"
display_version = "1.1.0"

# Hardware Information
manufacturer = "IBM"
Expand Down
14 changes: 4 additions & 10 deletions front/sdl/docopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ int elems_to_args(struct Elements *elements, struct DocoptArgs *args,
for (i = 0; i < elements->n_options; i++) {
option = &elements->options[i];
if (help && option->value && strcmp(option->olong, "--help") == 0) {
for (j = 0; j < 20; j++)
for (j = 0; j < 19; j++)
puts(args->help_message[j]);
return EXIT_FAILURE;
} else if (version && option->value &&
Expand Down Expand Up @@ -257,10 +257,6 @@ int elems_to_args(struct Elements *elements, struct DocoptArgs *args,
if (option->argument) {
args->config = (char *) option->argument;
}
} else if (strcmp(option->olong, "--cpu") == 0) {
if (option->argument) {
args->cpu = (char *) option->argument;
}
} else if (strcmp(option->olong, "--floppy") == 0) {
if (option->argument) {
args->floppy = (char *) option->argument;
Expand Down Expand Up @@ -303,8 +299,8 @@ int elems_to_args(struct Elements *elements, struct DocoptArgs *args,

struct DocoptArgs docopt(int argc, char *argv[], const bool help, const char *version) {
struct DocoptArgs args = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, (char *) "8088", NULL, (char *)
"10.0", NULL, NULL, NULL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, (char *) "10.0", NULL, NULL,
NULL,
usage_pattern,
{ "Usage: virtualxt [options]",
"",
Expand All @@ -322,7 +318,6 @@ struct DocoptArgs docopt(int argc, char *argv[], const bool help, const char *ve
" --rifs=PATH Share directory with guest OS via RIFS. (Experimental)",
" --config=PATH Set config directory.",
" --trace=FILE Write CPU trace to file.",
" --cpu=TYPE Types are 8088, v20 and 286. [default: 8088]",
" --frequency=MHZ CPU frequency. [default: 10.0]",
" -a --floppy=FILE Mount floppy image as drive A.",
" -c --harddrive=FILE Mount harddrive image as drive C."}
Expand All @@ -343,7 +338,6 @@ struct DocoptArgs docopt(int argc, char *argv[], const bool help, const char *ve
{NULL, "--no-idle", 0, 0, NULL},
{"-v", "--version", 0, 0, NULL},
{NULL, "--config", 1, 0, NULL},
{NULL, "--cpu", 1, 0, NULL},
{"-a", "--floppy", 1, 0, NULL},
{NULL, "--frequency", 1, 0, NULL},
{"-c", "--harddrive", 1, 0, NULL},
Expand All @@ -355,7 +349,7 @@ struct DocoptArgs docopt(int argc, char *argv[], const bool help, const char *ve

elements.n_commands = 0;
elements.n_arguments = 0;
elements.n_options = 17;
elements.n_options = 16;
elements.commands = commands;
elements.arguments = arguments;
elements.options = options;
Expand Down
10 changes: 2 additions & 8 deletions front/sdl/docopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ typedef size_t bool;

#include <sys/limits.h>

// This is a FreeBSD hack.
#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
//#elif defined(__FreeBSD__) || defined(__NetBSD__)
//|| defined(__OpenBSD__) || defined(__bsdi__)
//|| defined(__DragonFly__) || defined(macintosh)
//|| defined(__APPLE__) || defined(__APPLE_CC__)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)

#include <sys/syslimits.h>

Expand Down Expand Up @@ -99,15 +94,14 @@ struct DocoptArgs {
size_t version;
/* options with arguments */
char *config;
char *cpu;
char *floppy;
char *frequency;
char *harddrive;
char *rifs;
char *trace;
/* special */
const char *usage_pattern;
const char *help_message[20];
const char *help_message[19];
};

struct DocoptArgs docopt(int, char *[], bool, const char *);
Expand Down
Loading

0 comments on commit ba0c232

Please sign in to comment.