HackerTrans
TopNewTrendsCommentsPastAskShowJobs

livre

no profile record

comments

livre
·vor 6 Jahren·discuss
Not really, the other reply is right. Most registers are clobbered. FreeBASIC only passes the asm code inside the asm block directly to GAS (using the .intel_syntax noprefix directive). As I said, the compiler is too dumb to figure out what registers are being used so as a safety measure it clobbers almost all of them (see Register Preservation here[1]).

[1] https://documentation.help/FreeBASIC/KeyPgAsm.html
livre
·vor 6 Jahren·discuss
Sadly I think Rust's way is the best one in the long term even if it's not very user friendly. There are a lot of problems with the FreeBASIC syntax, my comment was mostly wishful thinking. As other user has said in a reply to my comment, you can't beat the level of control Rust's syntax provides and that's what most people writing assembly would want. You are also right that a proper asm parser would be difficult to maintain due to the amount of architectures Rust has to support.
livre
·vor 6 Jahren·discuss
I may be the only one but I feel like this (and the old) asm syntax is too complex and not very user friendly. It looks heavily inspired GCC. I'm sorry for the upcoming German (you can ignore it and just read the examples), I feel like a smarter compiler could have a friendlier asm syntax, similar to the one used by FreeBASIC[1].

I hope you can see why I prefer that. Even though the FB compiler is not very smart and just pushes and pops all important regs to and from the stack its asm syntax is a joy to write. I don't have to specify clobber registers, in, out and variables and functions are in scope by default. Also the asm code is not a string and doesn't need to be quoted, it's doesn't look like something foreign at all.

I know that something like that is currently not possible in Rust but I'd love to see it some day.

[1] https://www.freebasic-portal.de/befehlsreferenz/inline-assem...