Skip to content

Commit

Permalink
UARTReplacement now always returns 1 for port 0x133b bit 4 (1 if the …
Browse files Browse the repository at this point in the history
…Tx buffer is empty).
  • Loading branch information
Threetwosevensixseven committed Dec 16, 2024
1 parent 713b016 commit 7cab4c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion UARTReplacement/Properties/AssemblyInfoExtra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System.Reflection;

[assembly: AssemblyConfiguration("7e20a6b")]
[assembly: AssemblyConfiguration("713b016")]
[assembly: AssemblyCopyright("Copyright © 2019-2024 Robin Verhagen-Guest")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
10 changes: 8 additions & 2 deletions UARTReplacement/UARTReplacement_Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,16 @@ public byte Read(eAccess _type, int _port, int _id, out bool _isvalid)
// Reads from this port return a status flag in bit 0 indicating whether
// there is any data available to read from the UART buffer.
_isvalid = true;
// bit 4 = 1 if the Tx buffer is empty. Hardcode this to 1 for now, as the PC OS has a very large TX buffer.
// It will work better for program that wait for this flag to be 1 before continuing.
// bit 0 = 1 if the Rx buffer contains bytes. This is reporting our internal RX buffer, which is drained as
// fast as possble from the serial buffer, and kept in currentBuffer for port 0x143b reads to return it.
// In future, consider also including the serial port .BytesToRead count.
// Other flags can also be implemented in future.
if (currentBuffer.Count > 0)
return 1;
return 0b_0001_0001;
else
return 0;
return 0b_0001_0000;
}
}
catch (Exception ex)
Expand Down

0 comments on commit 7cab4c1

Please sign in to comment.