Useful features to consider #1274
Replies: 6 comments 21 replies
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
By the way, you can use ASSERT to show that xor is being used in place of a constant: |
Beta Was this translation helpful? Give feedback.
-
If you're just starting in assembly, it's probably a good idea to get into the mindset that assembly pretty much requires if you want to be successful at it. There's no rule that says that all callable blocks of code have to end with Toolchains don't optimize your assembly code because you are expected to do it. Your code is as lean and fast as you make it, and no better or worse. |
Beta Was this translation helpful? Give feedback.
-
I have workarounded this like follows, but I would like more to be able to name the macro macro ldz
if (\2) == 0
xor \1
else
ld \1, \2
endc
endm ldz a, AUDENA_OFF
ld [rNR52], a |
Beta Was this translation helpful? Give feedback.
-
I can imagine that the following idea can also be considered a bad one, but I would like to know your opinion anyways. I learn from other points of views.
|
Beta Was this translation helpful? Give feedback.
-
ld r8, expr
whereexpr
evaluates to zero so it generates the more efficientxor r8
instruction. This allows you to be more declarative when writing code without sacrificing performance. For example in the following common scenario:To be translated to a more efficient code like this:
inline
keyword or similar to allow inlining a function body at a specified call site easily without having to create a macro version of the same subroutine. So we can write the subroutine only once as usual while being able to choose at each individual call site if we are going to call it or inline it. Example:Beta Was this translation helpful? Give feedback.
All reactions