4 ms·
It would have been more clear to adopt an arrow notation: mov a => b vs mov b <= a Then you could support both forms at the same time :)
by amenghra 6y ago
It would have been more clear to adopt an arrow notation:
mov a => b
vs
mov b <= a
Then you could support both forms at the same time :)
- enriquto 6y agoI cannot help but to read these as "larger than or equal" and "smaller than or equal". Maybe use -> and <- ? Or yet better, unicode arrows: ← → ⇐ ⇒
- mhh__ 6y agoIf you think a CPU will do that for you for free you're in for a shock so it doesn't really matter.
- Someone 6y agoIf you do that, drop the ‘mov’. Before you know it you have a rudimentary programming language with a bunch of special variables, one for each register, and the ability to introduce other names for memory regions. From there, an improvement could be to allow, say R1 = R1 + R2 + R3 even when that requires two instructions.
- wyldfire 6y agoThe intent of assembly is to avoid this kind of complexity. However, there's nothing wrong with having the assembly language mnemonics/operators be symbolic. `R1 = R1 + R2` is an acceptable way to represent your architecture's add instruction. You can't support arbitrary expressions of registers (but assemble-time constant expressions are usually ok). > even when that requires two instructions. In fact, some assemblers do provide assembler-mapped instructions or other similar features like this. The inverse is also possible: assembler optimizations to collapse multiple independent instructions into a single one.
- Someone 6y ago> You can't support arbitrary expressions of registers > In fact, some assemblers do provide assembler-mapped instructions or other similar features like this. So, which is it :-) ? I think you know both are true, but for those who don’t: The original intent of assembly was to make it easier to encode instructions. Those assemblers provided a 1:1 mapping between assembly instructions and CPU instructions. (There may even have been assemblers that map assembly instructions 1:1 on machine words, but I think declaration of multi word memory regions was a very early addition. It’s so much more natural to write “give me 10 zero-initialized bytes here” than to write ten statements “give me a zero-initialized byte here” So, that’s your first statement. Macro assemblers (aka high-level assemblers) give you the second one. They let you write macros that, for example, add multi-word addition loops to your (now virtual) instruction set. https://en.wikipedia.org/wiki/High-level_assembler https://en.wikipedia.org/wiki/High-level_assembler: “High-level assemblers typically provide instructions that directly assemble one-to-one into low-level machine code as in any assembler, plus control statements such as IF, WHILE, REPEAT...UNTIL, and FOR, macros, and other enhancements. This allows the use of high-level control statement abstractions wherever maximal speed or minimal space is not essential; low-level statements that assemble directly to machine code can be used to produce the fastest or shortest code. The end result is assembly source code that is far more readable than standard assembly code while preserving the efficiency inherent with using assembly language. High-level assemblers generally provide information-hiding facilities and the ability to call functions and procedures using a high-level-like syntax (i.e., the assembler automatically produces code to push parameters on the stack rather than the programmer having to manually write the code to do this). High-level assemblers also provide data abstractions normally found in high-level languages. Examples include structures, unions, classes, and sets. Some high-level assemblers (e.g., TASM and HLA) support object-oriented programming.”