Hst.Amiga.Vm
1.0.297
dotnet add package Hst.Amiga.Vm --version 1.0.297
NuGet\Install-Package Hst.Amiga.Vm -Version 1.0.297
<PackageReference Include="Hst.Amiga.Vm" Version="1.0.297" />
<PackageVersion Include="Hst.Amiga.Vm" Version="1.0.297" />
<PackageReference Include="Hst.Amiga.Vm" />
paket add Hst.Amiga.Vm --version 1.0.297
#r "nuget: Hst.Amiga.Vm, 1.0.297"
#:package Hst.Amiga.Vm@1.0.297
#addin nuget:?package=Hst.Amiga.Vm&version=1.0.297
#tool nuget:?package=Hst.Amiga.Vm&version=1.0.297
Hst Amiga Vm
Hst Amiga Vm is a virtual machine for running Amiga CLI executables on Windows, macOS and Linux, similar to vamos from amitools. Amiga hunk executables are loaded into emulated memory and run on an interpreted Motorola 68000 or 68020 cpu, while library calls are handled by exec.library, dos.library, utility.library and math libraries emulated in C#.
Features:
- Interpreting 68000 and 68020 cpu with full integer instruction set, including 68020 bit field, 64-bit multiply and divide, CAS/CAS2, CHK2/CMP2 and memory indirect addressing modes. FPU and MMU is not supported.
- Loads hunk executables with code, data, bss, reloc32, reloc32 short, symbol, debug and name hunks.
- Emulated exec.library with memory, memory pools, lists, signals, message ports, RawDoFmt() and SetFunction().
- Emulated dos.library mapping files, directories, locks and console to host:
- Open, read, write, seek and close files and console.
- Lock, examine, ExNext, ExAll, create, delete and rename files and directories.
- ReadArgs templates, MatchFirst/MatchNext and AmigaDOS patterns.
- VPrintf, VFWritef, FPuts, FGets and other buffered functions.
- Environment variables stored in ENV:.
- AssignLock, AssignLate, AssignPath, AssignAdd and RemAssignList changing assigns at runtime, a dos list with volumes and assigns for LockDosList, NextDosEntry and FindDosEntry, and GetDeviceProc iterating directories of multi assigns, so the Assign command from C: lists, adds and removes assigns.
- Emulated utility.library with tag item, date, 32-bit math and string functions.
- Emulated math libraries with Motorola Fast Floating Point, IEEE single and IEEE double precision: mathffp.library, mathtrans.library, mathieeesingbas.library, mathieeesingtrans.library, mathieeedoubbas.library and mathieeedoubtrans.library.
- Emulated version.library telling Workbench version 40.42 and Kickstart 40.68 in ExecBase, with resident modules for the emulated libraries, so the Version command shows versions.
- Stub libraries, which can be opened, but stop the program if a function is called. Default stubs are intuition.library and graphics.library, which are often opened by compiler startup code.
- Volumes mapping Amiga volume names to host directories and assigns mapping names to Amiga paths.
- Adf and disk images with rigid disk block mounted as volumes, so programs run in the context of the Amiga file systems in the images using FFS, PFS3 and SFS support of Hst Amiga. Adf images are mounted as DF0:, DF1: etc. and partitions with their device names, e.g. DH0:. SYS: is assigned to the first image, which is an adf, a CD image or the bootable partition with highest boot priority. Images are write protected, unless they are writable.
- ISO 9660 CD images mounted as CD0:, CD1: etc. with the volume label as volume name. Joliet and Rock Ridge names are used, when present. CD images are always write protected and Amiga protection bits and comments on CDs aren't read.
- UAE metadata with Amiga names, protection bits, comments and dates stored as UAEFSDB
_UAEFSDB.___files used by WinUAE or UAE metafiles.uaemused by FS-UAE. - Kickstart ROM mapped read-only at its base address, e.g. 0xF80000, from raw,
KICK-header and Amiga Forever encrypted ROM images. Resident modules in ROM are added to ExecBase ResModules, so programs find them with FindResident(), e.g. Version showing versions of modules in ROM and GetSCSI extracting scsi.device from ROM. ExecBase tells Kickstart version of ROM, e.g. Kickstart 39.106 for Kickstart 3.0, and OpenLibrary() of exec.library checks version of exec.library in ROM. - AmigaDOS shell running scripts and interactive command lines:
- Scripts run with Execute command from C:, e.g. from an AmigaOS 3.1 Workbench installation, including
.KEYarguments handled by Execute. - Shell internal commands of AmigaOS 3.1 shell: Alias, Ask, CD, Echo, Else, EndCLI, EndIf, EndShell, EndSkip, FailAt, Fault, Get, GetEnv, If, Lab, Path, Prompt, Quit, Resident, Run, Set, SetEnv, Skip, Stack, UnAlias, UnSet, UnSetEnv and Why.
- Local and global variables with
$name, command output substitution with backquotes, aliases and redirection with<,>and>>directly after command name. - Commands are found in current directory, command path and C:. Files with script protection bit are run with Execute.
- dos.library RunCommand(), Execute(), SystemTagList() and ReadItem() run commands from programs.
- Scripts run with Execute command from C:, e.g. from an AmigaOS 3.1 Workbench installation, including
Limitations:
- Multitasking isn't supported. Programs run as a single process and waiting for signals or messages, which will never arrive, stops the program. Commands started with Run, Execute() or SystemTagList() run synchronously.
- Devices and libraries other than exec.library, dos.library, utility.library, version.library and math libraries aren't available, e.g. icon.library and reqtools.library. OpenLibrary() returns NULL for these.
- NewShell, NewCLI and pipes aren't supported.
- Devices aren't in the dos list, and device names of mounted images, e.g. DF0:, are assigns to their volumes.
- Amiga console sequences, which need a reply from console.device, e.g. window status request, aren't supported.
- Code in Kickstart ROM isn't executed and libraries, devices and resources in ROM can't be opened, as hardware isn't emulated. Resident modules in ROM can only be found and read. Memory size must not exceed base address of Kickstart ROM.
- UAEFSDB stored as NTFS alternate data streams by WinUAE isn't supported, only
_UAEFSDB.___files.
Usage
Example of running an Amiga executable with SYS: mapped to a host directory:
using Hst.Amiga.Vm;
using Hst.Amiga.Vm.Processor;
var options = new VmOptions
{
CpuType = CpuType.M68020
};
options.Volumes["SYS"] = @"c:\amiga\sys";
var vm = new AmigaVm(options);
var result = await vm.Run(@"c:\amiga\sys\c\list", "SYS:");
Console.WriteLine($"Return code {result.ReturnCode}");
Default volumes and assigns:
- SYS: is mapped to the current directory, if no volumes are defined.
- RAM: is mapped to a temporary directory, which is deleted after the program exits.
- PROGDIR: is the directory of the executable.
- C:, S:, L:, LIBS:, DEVS:, FONTS: and LOCALE: are assigned to directories in SYS:.
- ENV: is assigned to RAM:Env, ENVARC: to SYS:Prefs/Env-Archive and T: to RAM:T.
- Assigns in
VmOptionsreplace default assigns with same name. Paths starting with+are added to the default assign like Assign ADD, e.g.+Work:Cfor C: assigned to SYS:C and Work:C.
Console input and output defaults to standard input and output, and can be redirected with the Input, Output and Error streams in VmOptions.
Amiga console control sequences in console output are translated to ANSI terminal sequences, when standard output isn't redirected. Single byte control sequence introducer 0x9B is translated to ESC [, form feed clears the screen, colors selecting Workbench pens are translated to terminal colors (pen 1 text uses default terminal color, pen 2 is bright white and pen 3 is blue), cursor on/off show and hide the cursor and Amiga specific sequences like window bounds and raw events are removed. Virtual terminal processing is enabled in Windows console. Translation can be turned on or off with TranslateConsoleOutput in VmOptions.
Translation can be checked manually with the script src/Hst.Amiga.Tests/TestData/Vm/console-colors.txt, which echoes colors, styles and other console sequences with the expected result on each line. Run it with standard input redirected and output to the terminal, e.g. cmd /c "hst.amiga vm shell < src\Hst.Amiga.Tests\TestData\Vm\console-colors.txt" in Windows. The script contains raw form feed and 0x9B bytes, so it must be saved as raw bytes and not converted to UTF-8.
Example of running an AmigaDOS script with Execute command from C: and an interactive shell:
var options = new VmOptions();
options.Volumes["SYS"] = @"c:\amiga\sys";
// script can be a host path or an Amiga path
var result = await new AmigaVm(options).Execute("SYS:S/SPat", "list sys:c/a#?");
// interactive shell reading command lines from console input
await new AmigaVm(options).Shell();
Example of running an Amiga executable from an adf image in the context of the adf with SYS: and DF0: mapped to the adf:
await using var adf = File.OpenRead(@"c:\amiga\workbench.adf");
var options = new VmOptions();
options.Images.Add(new VmImage(adf, "workbench.adf"));
// executable is read from adf and PROGDIR: is assigned to DF0:C
var result = await new AmigaVm(options).RunFromVolume("DF0:C/List", "SYS:");
Example of running GetSCSI with Kickstart 3.1 ROM loaded, which extracts scsi.device from ROM to current directory:
using Hst.Amiga.Roms;
var romBytes = await File.ReadAllBytesAsync(@"c:\amiga\kick31.rom");
var options = new VmOptions
{
// rom.key bytes are required for Amiga Forever encrypted ROMs
KickstartRom = KickstartRomReader.Read(romBytes)
};
options.Volumes["SYS"] = @"c:\amiga\work";
var result = await new AmigaVm(options).Run(@"c:\amiga\work\GetSCSI");
A program, which sets current input of the command line interface to a script like Execute does, continues running the script in the shell after the program returns, so Run of the Execute command runs scripts too.
UAE metadata
Host file systems can't store Amiga protection bits and comments, and Amiga names can contain characters like *, ? and <, which are invalid on host file systems. WinUAE and FS-UAE store these as metadata files in directories added as harddrives and the virtual machine uses the same metadata, set with UaeMetadata in VmOptions:
Auto(default): Detects metadata per directory. Directories with a_UAEFSDB.___file use UAEFSDB and directories with.uaemfiles use UAE metafiles. Directories without metadata use the format of their parent directories within the volume, otherwise UAEFSDB.UaeFsDb: UAEFSDB with one_UAEFSDB.___file per directory used by WinUAE. Amiga names with special characters are stored as host names prefixed with__uae___.UaeMetafile: UAE metafiles with one.uaemfile per file used by FS-UAE. Amiga names with special characters are stored as host names with characters encoded as%xx.None: Host names are used as Amiga names and metadata files are shown as regular files.
Metadata files are hidden from directory listings, when UAE metadata is used.
Writing metadata is disabled by default with WriteUaeMetadata set to false, so metadata files are never created, changed or deleted and changes to protection bits and comments are kept in memory only while the program runs. Setting WriteUaeMetadata to true writes changes from e.g. Protect, FileNote and Rename to metadata files.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Hst.Amiga (>= 1.0.297)
- Hst.Core (>= 1.0.104)
- LTRData.DiscUtils.Iso9660 (>= 1.0.90)
-
net10.0
- Hst.Amiga (>= 1.0.297)
- Hst.Core (>= 1.0.104)
- LTRData.DiscUtils.Iso9660 (>= 1.0.90)
-
net8.0
- Hst.Amiga (>= 1.0.297)
- Hst.Core (>= 1.0.104)
- LTRData.DiscUtils.Iso9660 (>= 1.0.90)
-
net9.0
- Hst.Amiga (>= 1.0.297)
- Hst.Core (>= 1.0.104)
- LTRData.DiscUtils.Iso9660 (>= 1.0.90)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.