4 ms·
Intel. I can't bring myself to learn this: movl mem_location(%ebx,%ecx,4), %eax on any architecture where assemblers also support this: mov eax, [ebx
by msla 5y ago
Intel. I can't bring myself to learn this:
movl mem_location(%ebx,%ecx,4), %eax
on any architecture where assemblers also support this:
mov eax, [ebx + ecx*4 + mem_location]
- mrlonglong 5y agoEither works for me, I'm easy. Besides I cut my teeth on m68k and x86, and I do like how it keeps it easy with things like mov.b, mov.w and mov.l - keeps things clear what you're working with.
- messe 5y agoAgreed. I like `mov %src, dst` more than `mov [dst], src`, but GAS's `seg:disp(base, index, scale)` is insanity compared to Intel syntax.
- Galanwe 5y agoWould you agree that it makes more sense though? I tend to agree with you, I _want_ to write 'mv src, dst', but the other way around has some strong supporting reasons: - it's closer to the usual pseudo assembly "eax <- ebx" - it's closer to the mathematical "A = B" - on a more practical side, it's what was adopter by C standard library "memcpy(dst, src)" Thinking about it, there are more reasons to favor 'mov dst, src'. I think the culprit (at least for me) is that I cannot "pronounce" it correctly in my head. I have to use some peripheral sentence such as "move in dst the contents of src" instead of the more natural (but backward from the reading perspective) "move src to dst"
- rhn_mk1 5y agoNitpickery, but in the mathematical notation A = B is not an assignment (and is exactly the same as B = A). Assignment is more clearly written as A := B, but I never saw this as a maths thing, but as a programming convention.
- mrlonglong 5y agoDoes movl mem(%ebx + %ecx + 4), %ecx also work? If so that would read better than with the commas. (Sorry, can't quite recall how to get code snippet markup to work)