flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > [RISC-V] several real instructions per line. |
Author |
|
bitRAKE 29 Mar 2023, 15:14
What does it look like? Is there an instruction separator? Couldn't instructions just forward any unprocessed text as another instruction?
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
29 Mar 2023, 15:14 |
|
edfed 29 Mar 2023, 18:39
writing macros is not so hard. in fact, with fasmg, everything is macro, then...
|
|||
29 Mar 2023, 18:39 |
|
revolution 29 Mar 2023, 23:56
Three instructions on a single line:
Code: irp i, <mov ax, bx>, <cmp cx, dx>, <imul ebx, ecx, 42> {i} |
|||
29 Mar 2023, 23:56 |
|
AsmGuru62 30 Mar 2023, 00:22
Confusing for me as well.
|
|||
30 Mar 2023, 00:22 |
|
bitRAKE 30 Mar 2023, 00:34
Well, in the past we've seen many attempts at compact code:
Code: imul ebx, <cmovc <cmp ecx, eax>, edx>, 42 ; destination falls out of <> That's why I was curious what kind of syntax is being suggested by the RISC-V spec. Maybe they found something that works, or perhaps the ops are so miniscule as to work like instruction prefixes? * RoAsm using | as a line break for multi-instruction lines. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup Last edited by bitRAKE on 30 Mar 2023, 00:45; edited 1 time in total |
|||
30 Mar 2023, 00:34 |
|
revolution 30 Mar 2023, 00:43
bitRAKE wrote: That's why I was curious what kind of syntax is being suggested by the RISC-V spec. Maybe they found something that works, or perhaps the ops are so miniscule as to work like instruction prefixes? The RISC-V instruction mnemonics are perfectly normal. |
|||
30 Mar 2023, 00:43 |
|
revolution 30 Mar 2023, 02:41
bitRAKE wrote: * RoAsm using | as a line break for multi-instruction lines. Perhaps using \ could work? Usually \ is for line concatenation, but if followed by more text then it could also serve as a line break. Code: inc ax \ cmp ax, 42 \ seta cl |
|||
30 Mar 2023, 02:41 |
|
bitRAKE 30 Mar 2023, 04:58
For fasmg there aren't many limitations for what can be used. Even semicolon is possible.
Code: inc ax ; cmp ax, 42 ; seta cl _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
30 Mar 2023, 04:58 |
|
Tomasz Grysztar 30 Mar 2023, 07:49
And do you remember that simple tweak of fasm 1?
|
|||
30 Mar 2023, 07:49 |
|
sylware 30 Mar 2023, 09:32
Well, I was expecting some clear-cut and well defined way to get a "real instruction" separator on a line for fasmg (in x86_64, that would be ';' I guess).
Since one of the major RISC-V assembler is binutils as, the instruction separator on line would be ';'. For instance, RIP relative addressing on RISC-V is a set of dual instruction combos. Since I would like to keep the real instructions and not define 73894739847394 macros or some massively parameterized macros, I would write those combos on a single line. label: instruction ; label: instruction ... EDIT: (basically a real token from a set of real tokens). |
|||
30 Mar 2023, 09:32 |
|
Tomasz Grysztar 30 Mar 2023, 12:24
As bitRAKE pointed out, fasmg gives you much freedom to decide what syntax you're going to use:
Code: calminstruction ? line& local instruction loop: match instruction | line, line jno final assemble instruction jump loop final: assemble line end calminstruction inc ax | here: cmp ax, 42 | seta cl Code: retaincomments calminstruction ? line& local instruction, comment match line // comment, line loop: match instruction; line, line jno final assemble instruction jump loop final: assemble line end calminstruction inc ax ; here: cmp ax, 42 ; seta cl // comment |
|||
30 Mar 2023, 12:24 |
|
sylware 30 Mar 2023, 14:16
Allright, I stand corrected, there is no interference of using ';' as an instruction separator on a line.
Hard for an occasional fasmg macro/calm coder like me to forget not about the "for each line" preprocessing... Actually I may add this to my existing x86_64 fasmg code to allow "one liner" C preprocessor macro, like I have with the binutils as support C preprocessor macros. Now and as far as I know, the bad apples seem to be nasm/yasm where there is no multi-instruction line (I will probably drop them once I start to code some RISC-V assembly then). meh. |
|||
30 Mar 2023, 14:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.