Inline assembly question
Eugene Wissner
belka at caraus.de
Sun Nov 12 18:48:02 UTC 2017
On Sunday, 12 November 2017 at 15:25:43 UTC, Dibyendu Majumdar
wrote:
> On Sunday, 12 November 2017 at 12:32:09 UTC, Basile B. wrote:
>> On Sunday, 12 November 2017 at 12:17:51 UTC, Dibyendu Majumdar
>> wrote:
>>> On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner
>>> wrote:
>>>> [...]
>>>
>>> Thank you - I probably could use something like this. It is
>>> uglier than the simpler approach in dynasm of course.
>>>
>>> How about when I need to combine this with some struct/union
>>> access? In dynasm I can write:
>>>
>>> | mov BASE, CI->u.l.base // BASE =
>>> ci->u.l.base (volatile)
>>> | mov PC, CI->u.l.savedpc // PC =
>>> CI->u.l.savedpc
>>>
>>> How can I mix the mixin above and combine with struct offsets?
>>>
>>
>> https://dlang.org/spec/iasm.html#agregate_member_offsets
>>
>> aggregate.member.offsetof[someregister]
>
> Sorry I didn't phrase my question accurately. Presumably to use
> above with the mnemonics I would need additional mixin
> templates where the aggregate type and member etc would need to
> be parameters?
You can use just string parameters instead of enums, then you can
pass arbitrary arguments to the instructions. The compiler will
tell you if something is wrong with the syntax of the generated
assembly.
More information about the Digitalmars-d-learn
mailing list