Skip to content

Conversation

@fmstephe
Copy link

This demonstrates how to read from memory locations using operand.Mem. I
think this example is valuable because I had (arbitrarily) chosen
looking up a slice/string index value in assembly as a learning task. I
found doing this in avo surprisingly difficult because I didn't know
which type to use to express a memory location. This should hopefully
clarify that for other avo beginners.

@fmstephe
Copy link
Author

I'm not sure if PRs are desired by this project. But I had some difficulty writing the, very simple, assembly functions that are included in this PR. My only challenge was the time it took to work through various types available, to eventually find the operand.Mem{} type which did exactly what I needed.

As I couldn't find any examples which spell out how this type can be used I created these examples.

I tried to maintain the style of READMEs that already exist (as they are excellent) but I am not certain they are 100% correct.

Francis Stephens added 2 commits June 26, 2025 16:44
This demonstrates how to read from memory locations using operand.Mem. I
think this example is valuable because I had (arbitrarily) chosen
looking up a slice/string index value in assembly as a learning task. I
found doing this in avo surprisingly difficult because I didn't know
which type to use to express a memory location. This should hopefully
clarify that for other avo beginners.
It had scale set to 4, instead of 8. This _was_ a bug in the actual code
as well, but it was fixed in the code and not in the README.
@fmstephe fmstephe force-pushed the add-operand-mem-example branch from e6d0425 to e4b3d17 Compare June 26, 2025 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant