Questions tagged [assembly]
For questions relating to assembly language, a low-level programming language that provides a human-readable representation of machine code instructions. It is specific to the architecture of a particular computer system and is considered a symbolic representation of the machine code.
14 questions
0
votes
3
answers
334
views
How do compilers which output WebAssembly Text Format (or any other LISP-like language) make sure the assembly code is indented consistently?
So, I recently run into this bug in the compiler for my programming language that outputs WebAssembly Text Format. Here is what the output looked like:
I fixed it by changing in my compiler:
...
-6
votes
2
answers
372
views
How can an assembler provide suggestions for misspelt named registers with Levenshtein distance, as it cannot know token is supposed to be a register?
Here is an example program in PicoBlaze assembly language illustrating and explaining the problem:
...
0
votes
1
answer
430
views
Why don't assemblers, even those that support arithmetic expressions in compile-time constants, tend to support the ternary conditional `?:` operator?
So, as per my previous question, I added the support for the ternary conditional operator ?: into my PicoBlaze assembler written in JavaScript for compile-time ...
8
votes
0
answers
349
views
In ARM assembly, why is the bitwise OR operation called "ORR" (with double 'r'), rather than simply "OR"?
So, I've been studying the basics of the ARM assembly (and daydreaming about making a compiler which outputs it) and I can't help but notice that the mnemonic doing the bitwise OR operation in ARM ...
2
votes
2
answers
366
views
How does the GNU Assembler deal with the directives for changing the syntax from AT&T to Intel or vice versa if those directives are in if-branching?
GNU Assembler, when targetting x86, has directives .att_syntax and .intel_syntax for switching between Intel Syntax and AT&T ...
3
votes
0
answers
213
views
What are some options to test ARM assembly that some compiler outputs under Windows? QEMU is not an option, right?
So, I've designed a programming language called AEC and I've made an AEC-to-x86 compiler and an AEC-to-WebAssembly compiler. I am thinking about developing an AEC-to-ARM compiler.
A little problem is: ...
1
vote
0
answers
122
views
How do the assemblers for processors which have "near jump" and "far jump" instructions of different length calculate the addresses of the labels? [duplicate]
How do preprocessors of the assemblers for processors which have "near jump" and "far jump" instructions of different length (like x86) calculate the addresses of the labels? Isn't ...
5
votes
1
answer
497
views
How is Rosetta 2 capable of translating x87 instructions (which are stack-based) to ARM machine code (where the FPU is register-based)?
Rosetta 2 is a program that enables the new ARM-based Macs to run programs for old x86-based Macs by translating x86 machine code to ARM machine code. But how does it do that? What seems especially ...
-2
votes
1
answer
233
views
How to provide a sensible error message for `load (load s0, s1), s2` when parsing assembly? [closed]
Suppose somebody completely misunderstands how assembly language works and, instead of writing:
load s1, s2
load s0, s1
He writes:
...
1
vote
2
answers
2k
views
Does x86 assembly support linguistic recursion? [closed]
In my book "Jezici za gimnazijalce" (not available online) and in my Bachelor thesis (which will be online in about a month) I was claiming that assembly languages are like the Piraha ...
3
votes
1
answer
517
views
X86-64 Assembly for Recursive Functions
A compiler I'm writing generates the following x86-64 assembly (AT&T syntax) for a recursive factorial function. I convert the assembly into an ELF executable using ...
3
votes
1
answer
183
views
How do I explain to a syntax highlighter to highlight `a` differently in `load s0, a` (where it is a hexadecimal constant) and `regbank a`? [duplicate]
In the syntax highlighter I have implemented in my PicoBlaze Simulator in JavaScript, the assembly code
address 0
load s0, 0
load s0, a
regbank a
is highlighted as ...
17
votes
2
answers
2k
views
What are the advantages and disadvantages of the callee versus caller clearing the stack after a call?
This is more a question about compiler design than language design, but in low level languages, when a function is called, the parameters are pushed onto the stack, and when the function returns, the ...
5
votes
3
answers
807
views
What are some different approaches for inline assembly, and what are their pros and cons?
In my programming language that compiles to WebAssembly, I am using the following syntax for inline assembly:
...