mirror of
https://github.com/fadden/6502bench.git
synced 2024-06-12 23:29:32 +00:00
Documentation / comment tweaks
This commit is contained in:
parent
74fa310718
commit
62509d0bd7
|
@ -32,7 +32,7 @@ namespace Asm65 {
|
||||||
Cont, // LDA, STA, PHP, NOP, ... (always continue to next instruction)
|
Cont, // LDA, STA, PHP, NOP, ... (always continue to next instruction)
|
||||||
NoCont, // RTS, BRK, ... (jump to new address, not specified in operand)
|
NoCont, // RTS, BRK, ... (jump to new address, not specified in operand)
|
||||||
CallSubroutine, // JSR, JSL (jump to new address, and also continue to next)
|
CallSubroutine, // JSR, JSL (jump to new address, and also continue to next)
|
||||||
ConditionalBranch // BCC, BEQ, ... (jump to new address and/or continue to next)
|
ConditionalBranch // BCC, BEQ, ... (jump to new address, or continue to next)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -16,7 +16,10 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace CommonUtil {
|
namespace CommonUtil {
|
||||||
public class BitTwiddle {
|
/// <summary>
|
||||||
|
/// Some bit-twiddling functions.
|
||||||
|
/// </summary>
|
||||||
|
public static class BitTwiddle {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the argument, rounded up to the next highest power of 2. If the argument
|
/// Returns the argument, rounded up to the next highest power of 2. If the argument
|
||||||
/// is an exact power of two, it is returned unmodified.
|
/// is an exact power of two, it is returned unmodified.
|
||||||
|
@ -32,7 +35,7 @@ namespace CommonUtil {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Classic bit-twiddling approach. I can't find a "count leading zeroes" function
|
/// Classic bit-twiddling approach. I can't find a "count leading zeroes" function
|
||||||
/// in C# that turns into a CPU instruction; if we had that, we could just use 1<<N.
|
/// in C# that turns into a CPU instruction; if we had that, we could just use 1<<N.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static int NextHighestPowerOf2(int val) {
|
public static int NextHighestPowerOf2(int val) {
|
||||||
val |= val >> 1; // "smear" bits across integer
|
val |= val >> 1; // "smear" bits across integer
|
||||||
|
@ -50,8 +53,8 @@ namespace CommonUtil {
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If you pass in 10110100, this will return 00000100.
|
/// If you pass in 10110100, this will return 00000100.
|
||||||
///
|
///
|
||||||
/// Two's complement negation inverts and adds one, so 01100 --> 10011+1 --> 10100. The
|
/// Two's complement negation inverts and adds one, so 01100 --> 10011+1 --> 10100.
|
||||||
/// only set bit they have in common is the one we want.
|
/// The only set bit they have in common is the one we want.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static int IsolateLeastSignificantOne(int val) {
|
public static int IsolateLeastSignificantOne(int val) {
|
||||||
return val & -val;
|
return val & -val;
|
||||||
|
@ -62,7 +65,7 @@ namespace CommonUtil {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If you pass in 10110100, this will return 4.
|
/// If you pass in 10110100, this will return 4.
|
||||||
///
|
///
|
||||||
/// This comes from http://aggregate.org/MAGIC/#Population%20Count%20(Ones%20Count) .
|
/// This comes from http://aggregate.org/MAGIC/#Population%20Count%20(Ones%20Count) .
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static int CountOneBits(int val) {
|
public static int CountOneBits(int val) {
|
||||||
|
@ -82,7 +85,7 @@ namespace CommonUtil {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If you pass in 10110100, this will return 2.
|
/// If you pass in 10110100, this will return 2.
|
||||||
///
|
///
|
||||||
/// Also from http://aggregate.org/MAGIC/ .
|
/// Also from http://aggregate.org/MAGIC/ .
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static int CountTrailingZeroes(int val) {
|
public static int CountTrailingZeroes(int val) {
|
||||||
|
|
|
@ -132,6 +132,9 @@
|
||||||
shift-click the line at address $2077. Use
|
shift-click the line at address $2077. Use
|
||||||
<samp>Actions > Tag Bytes As Inline Data</samp>
|
<samp>Actions > Tag Bytes As Inline Data</samp>
|
||||||
(<kbd class="key">Ctrl+H</kbd><kbd class="key">Ctrl+I</kbd>).</p>
|
(<kbd class="key">Ctrl+H</kbd><kbd class="key">Ctrl+I</kbd>).</p>
|
||||||
|
<p>Unlike code start and end tags, where you only tag the byte
|
||||||
|
where the code starts or stops, for inline data you need to tag
|
||||||
|
every byte.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user