Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

# Code files
[*.{cs,csproj,sln,props,targets}]
indent_style = tab
indent_size = 2
tab_width = 2

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_style = tab
indent_size = 2
tab_width = 2

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_style = tab
indent_size = 2
tab_width = 2

# JSON files
[*.json]
indent_style = tab
indent_size = 2
tab_width = 2

# Markdown files
[*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false

# Dotnet code style settings:
[*.cs]
# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = warning

# Organize usings
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# this. preferences
dotnet_style_qualification_for_field = true:suggestion
dotnet_style_qualification_for_property = true:suggestion
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_event = true:suggestion

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
dotnet_style_readonly_field = true:suggestion

# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent

# CSharp code style settings:
[*.cs]
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = no_change
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents_when_block = false

# Spacing options
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false

# Wrapping preferences
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true

# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

# var preferences
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion

# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion

# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion

# Expression preferences
csharp_prefer_braces = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
9 changes: 7 additions & 2 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ name: .NET Desktop CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

Expand Down Expand Up @@ -68,7 +67,7 @@ jobs:
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 10.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
Expand All @@ -79,3 +78,9 @@ jobs:
run: msbuild $env:Solution_Name /restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

# Run tests
- name: Run tests
run: dotnet test $env:Solution_Name --configuration $env:Configuration --no-build --verbosity normal
env:
Configuration: ${{ matrix.configuration }}
64 changes: 64 additions & 0 deletions MixEmul.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,92 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{E76E698C-4
docs\MixEmul Documentation 0.4.0.pdf = docs\MixEmul Documentation 0.4.0.pdf
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MixLib.Tests", "tests\MixLib.Tests\MixLib.Tests.csproj", "{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MixAssembler.Tests", "tests\MixAssembler.Tests\MixAssembler.Tests.csproj", "{3E248D49-7799-449E-87C5-E5EA0FC49185}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Debug|x64.ActiveCfg = Debug|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Debug|x64.Build.0 = Debug|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Debug|x86.ActiveCfg = Debug|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Debug|x86.Build.0 = Debug|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Release|Any CPU.Build.0 = Release|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Release|x64.ActiveCfg = Release|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Release|x64.Build.0 = Release|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Release|x86.ActiveCfg = Release|Any CPU
{3CE2CBD5-6C29-437B-844B-A32C1029128A}.Release|x86.Build.0 = Release|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Debug|x64.ActiveCfg = Debug|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Debug|x64.Build.0 = Debug|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Debug|x86.ActiveCfg = Debug|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Debug|x86.Build.0 = Debug|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Release|Any CPU.Build.0 = Release|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Release|x64.ActiveCfg = Release|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Release|x64.Build.0 = Release|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Release|x86.ActiveCfg = Release|Any CPU
{8947C313-9E7E-4558-A9C1-DCB59F4C32E2}.Release|x86.Build.0 = Release|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Debug|x64.ActiveCfg = Debug|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Debug|x64.Build.0 = Debug|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Debug|x86.ActiveCfg = Debug|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Debug|x86.Build.0 = Debug|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Release|Any CPU.Build.0 = Release|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Release|x64.ActiveCfg = Release|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Release|x64.Build.0 = Release|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Release|x86.ActiveCfg = Release|Any CPU
{5865F55B-9F09-47FC-8DB6-84AF7B5990EE}.Release|x86.Build.0 = Release|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Debug|x64.ActiveCfg = Debug|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Debug|x64.Build.0 = Debug|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Debug|x86.ActiveCfg = Debug|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Debug|x86.Build.0 = Debug|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Release|Any CPU.Build.0 = Release|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Release|x64.ActiveCfg = Release|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Release|x64.Build.0 = Release|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Release|x86.ActiveCfg = Release|Any CPU
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F}.Release|x86.Build.0 = Release|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Debug|x64.ActiveCfg = Debug|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Debug|x64.Build.0 = Debug|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Debug|x86.ActiveCfg = Debug|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Debug|x86.Build.0 = Debug|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Release|Any CPU.Build.0 = Release|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Release|x64.ActiveCfg = Release|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Release|x64.Build.0 = Release|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Release|x86.ActiveCfg = Release|Any CPU
{3E248D49-7799-449E-87C5-E5EA0FC49185}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B9BEEA8E-0FE4-4AED-8A59-C1E8245F604F} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{3E248D49-7799-449E-87C5-E5EA0FC49185} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1B4C5CE4-B012-43B1-B37A-034B5866A9AE}
EndGlobalSection
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# ![MixEmul](http://rbergen.home.xs4all.nl/mixemullogo.jpg)   MixEmul

[![.NET Desktop CI](https://github.com/rbergen/MixEmul/actions/workflows/dotnet-desktop.yml/badge.svg)](https://github.com/rbergen/MixEmul/actions/workflows/dotnet-desktop.yml)

## What is it?

MixEmul is an emulator for the MIX computer that is described in The Art of Computer Programming (TAOCP) series of books by D.E. Knuth. MIX is a hypothetical, non-existent computer with features similar to those of real computers of the 1960s. It ‑ or more accurately, its assembly language MIXAL ‑ is used as the foundation for the text of the books.
MixEmul completely emulates the entire MIX instruction set. With that I mean that MixEmul not only performs the actions that an instruction should ‑ like multiplying when it encounters a MUL instruction ‑, but it does it in the way MIX would. For example, the time unit ("tick") counts that are included in TAOCP Volume 1 are implemented as well. Also, as TAOCP specifies, I/O operations are performed in the background.

Expand All @@ -13,15 +16,18 @@ Oh, I'd almost forget, it incorporates a MIXAL assembler too. This means that yo
In a few words: MixEmul contains all the features that I think I need to be able to better absorb the contents of the TAOCP books.

## Can I get it?

Well, obviously the answer is yes; you're looking at its sources as we speak. However, getting it to run doesn't even require you to build it yourself. The latest binary version I have seen working myself can be downloaded from [the releases page](https://github.com/rbergen/MixEmul/releases).

## What's with all the security warnings?

For incomprehensible reasons, MIX enthusiasts are not as common as you or I would like. This means that MixEmul is not downloaded as often as, for instance, Google Chrome. Furthermore, I loved writing MixEmul and I love maintaining it, but out of principle I refuse to cash out for things like code signing certificates. This means that on an average computer, your browser, your OS and probably your virus scanner will all object to downloading and running MixEmul.
I'm afraid you'll just have to trust me when I say that MixEmul was not written to cause you or your computer any harm. Over the years, I have spent quite a few hours figuring out first how to improve MixEmul and then how to code those improvements; causing trouble is never an improvement in my book.

So again, trust me when I say that MixEmul is safe. Or don't trust me, and miss out on what I still consider to be the best MIX emulator available. :)

## Can I support the author?

Yes. You can support me through [PayPal](https://www.paypal.me/rutgervanbergen).

_- Rutger van Bergen - [github.com/rbergen](https://github.com/rbergen)_
9 changes: 8 additions & 1 deletion docs/Changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ x: Bugfix

=========================================

0.5.2.0 (2026-03-08)
* Bumped all projects to .NET 10.0
* Applied C# 14 based improvements
* Added unit tests for a number of (foundational) classes
* Fixed a number of minor bugs
* Fixed a number of formatting issues in the source code

0.5.1.2 (2024-08-23)
* Bumped Lib and Assembler to .NET 8.0
* Applied .NET 8.0 and C# 12 based improvements
Expand Down Expand Up @@ -219,4 +226,4 @@ x Fixed IndexOutOfRangeException that could occur when using the arrow down key
x Minor errors in class member naming and visibility fixed

0.1.2424.30916 (2006-08-21)
* First public release
* First public release
4 changes: 2 additions & 2 deletions src/MixAssembler/Finding/AssemblyError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace MixAssembler.Finding
{
public class AssemblyError(int lineNumber, LineSection lineSection, int causeStartIndex, int causeLength, ValidationError error)
public class AssemblyError(int lineNumber, LineSection lineSection, int causeStartIndex, int causeLength, ValidationError error)
: ValidationFinding(Severity.Error, lineNumber, lineSection, causeStartIndex, causeLength, error)
{
}
}
}
2 changes: 1 addition & 1 deletion src/MixAssembler/Finding/AssemblyFinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace MixAssembler.Finding
{

public abstract class AssemblyFinding(Severity severity, int lineNumber, LineSection section, int startCharIndex, int length)
{
{
public int Length => length;
public int LineNumber => lineNumber;
public LineSection LineSection => section;
Expand Down
2 changes: 1 addition & 1 deletion src/MixAssembler/Finding/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace MixAssembler.Finding
{
public class AssemblyInfo(string message, int lineNumber, LineSection lineSection, int startCharIndex, int length)
public class AssemblyInfo(string message, int lineNumber, LineSection lineSection, int startCharIndex, int length)
: AssemblyFinding(MixLib.Misc.Severity.Info, lineNumber, lineSection, startCharIndex, length)
{
public override string Message
Expand Down
4 changes: 2 additions & 2 deletions src/MixAssembler/Finding/AssemblyWarning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace MixAssembler.Finding
{
public class AssemblyWarning(int lineNumber, LineSection lineSection, int causeStartIndex, int causeLength, ValidationError error)
public class AssemblyWarning(int lineNumber, LineSection lineSection, int causeStartIndex, int causeLength, ValidationError error)
: ValidationFinding(Severity.Warning, lineNumber, lineSection, causeStartIndex, causeLength, error)
{
}
}
}
2 changes: 1 addition & 1 deletion src/MixAssembler/Finding/ValidationFinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace MixAssembler.Finding
{
public class ValidationFinding(Severity severity, int lineNumber, LineSection lineSection, int causeStartIndex, int causeLength, ValidationError error)
public class ValidationFinding(Severity severity, int lineNumber, LineSection lineSection, int causeStartIndex, int causeLength, ValidationError error)
: AssemblyFinding(severity, lineNumber, lineSection, causeStartIndex, causeLength)
{
public ValidationError Error => error;
Expand Down
Loading
Loading