reader: add # for "swap" command #4
Merged
+59
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a reader token that will swap the top two
elements on the stack, which means we can do things
like this:
Which will,
of 0x12300000
rdsmnwhich will pop the first copy and read whateveris at that SMN address (this is just an example; assume it is
a valid SMN address) and push it onto the stack. The stack
now contains the value it read via SMN, as well as the
0x1230_000pushed earlierthree values (1,4, 0b101 and the contents of the SMN register
read a moment ago). Set bits will set bits 1..=3 in the SMN
value to
101and push that onto the stack. The stack nowcontains the modified SMN value and 0x12300000.
contains the SMN address at the top, then the modified value
wrsmnwhich will pop the address and value, andwrite the value to that SMN address.
And we're done. This may be clearer using the
|syntax:Signed-off-by: Dan Cross [email protected]