This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>{Title}</title> | |
| <style> | |
| body { font-family:Arial; margin:20px; font-size:14pt} | |
| </style> | |
| </head> | |
| <body> | |
| <h1>{Title}</h1> | |
| {foreach Sections} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Machine : CPU, IBus | |
| { | |
| // Main entry point | |
| public int RunProgram(string programName, string commandTail, int nCmdShow); | |
| // Services | |
| public ModuleManager ModuleManager { get; } | |
| public VariableResolver VariableResolver { get; } | |
| public PathMapper PathMapper { get; } | |
| public DosApi Dos { get; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "mountPoints": | |
| { | |
| "C:\\WINDOWS": | |
| { | |
| "host": "$(Win3muFolder)\\FILES\\WINDOWS", | |
| "hostWrite": "$(AppData)\\Win3mu\\$(AppName)\\FILES\\WINDOWS", | |
| }, | |
| "C:\\$(AppName)": | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "merge:mountPoints": | |
| { | |
| "C:\\MYDATA": | |
| { | |
| "host": "$(MyDocuments)\\MYDATA" | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ushort adc16(ushort inFlags, ushort a, ushort b, ushort* outFlags) | |
| { | |
| __asm | |
| { | |
| push word ptr[inFlags] | |
| popf | |
| mov ax, word ptr[a] | |
| adc ax, word ptr[b] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create thunks for all exported methods | |
| foreach (var mi in this.GetType().GetMethods()) | |
| { | |
| // Check it has an EntryPoint attribute | |
| var ep = mi.GetCustomAttributes<EntryPointAttribute>().FirstOrDefault(); | |
| if (ep==null) | |
| continue; | |
| // Create a system thunk for it | |
| var vmptr = _machine.CreateSystemThunk(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The parameters that will be passed to the C# code via reflection | |
| List<object> csharpParameters = new List<object(); | |
| // Position of next parameter on the VM stack (+4 because the | |
| // caller’s return address is also on the stack) | |
| ushort vmStackPos = _machine.sp + 4; | |
| // Convert all parameters | |
| foreach (var pi in mi.GetParameters()) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The real API method imported from Windows | |
| [DllImport(“user32.dll”)] | |
| static extern uint MessageBox(IntPtr hWndParent, string msg, string title, uint options); | |
| // Implementation method exported to 16-bit code | |
| [EntryPoint(0x0001)] | |
| public ushort MessageBox(ushort hWndParent, string msg, string title, ushort options) | |
| { | |
| // No more messing around with the VM stack for parameters | |
| // nor with the ax register for the return value. Nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [MappedType] | |
| public struct nuint | |
| { | |
| public nuint(uint value) | |
| { | |
| this.value = value; | |
| } | |
| public uint value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [EntryPoint(0x0001)] | |
| [DllImport(“user32.dll”)] | |
| public static extern nuint MessageBox(HWND hWndParent, string msg, string title, nuint options); |