Skip to content

Commit

Permalink
Updated: Reloaded.Memory.Buffers to LargeAddressAware Version
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Jun 18, 2022
1 parent 9031bb0 commit 3008dab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Source/Reloaded.Assembler/Assembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public unsafe class Assembler : IDisposable
{
// Address and size of allocation of where the text/mnemonics to be assembled will be stored.
private object _lock = new object();
private IntPtr _textAddress;
private nuint _textAddress;
private int _textSize;
private IntPtr _resultAddress;
private nuint _resultAddress;
private int _resultSize;

private static readonly MemoryBufferHelper _bufferHelper;
Expand Down Expand Up @@ -146,7 +146,7 @@ public byte[] Assemble(string mnemonics, ushort passLimit = 100)
_processMemory.WriteRaw(_textAddress, mnemonicBytes);

// Assemble and check result.
var result = _assembleFunction(_textAddress, _resultAddress, (IntPtr)_resultSize, passLimit, IntPtr.Zero);
var result = _assembleFunction((IntPtr)(void*)_textAddress, (IntPtr)(void*)_resultAddress, (IntPtr)_resultSize, passLimit, IntPtr.Zero);

// As stated in FASMDLL.TXT, at the beginning of the block, the FASM_STATE structure will reside.
// It is defined in FASM.ASH. We read it here.
Expand Down Expand Up @@ -219,7 +219,7 @@ private void AllocateText(int textSize, int retryCount)
_textAddress = allocationProperties.MemoryAddress;
_textSize = allocationProperties.Size;

if (_textAddress == IntPtr.Zero)
if (_textAddress == 0)
throw new FasmWrapperException("Failed to allocate text memory for Assembler.");
}

Expand All @@ -232,7 +232,7 @@ private void AllocateResult(int resultSize, int retryCount)
_resultAddress = allocationProperties.MemoryAddress;
_resultSize = allocationProperties.Size;

if (_resultAddress == IntPtr.Zero)
if (_resultAddress == 0)
throw new FasmWrapperException("Failed to allocate result memory for Assembler.");
}

Expand Down
3 changes: 2 additions & 1 deletion Source/Reloaded.Assembler/Reloaded.Assembler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>Icon.png</PackageIcon>

<LangVersion>preview</LangVersion>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

Expand All @@ -50,6 +51,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Reloaded.Memory.Buffers" Version="1.4.6" />
<PackageReference Include="Reloaded.Memory.Buffers" Version="2.0.0" />
</ItemGroup>
</Project>

0 comments on commit 3008dab

Please sign in to comment.