Timeline for Brainf*ck interpreter written in x86 assembly
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 30, 2016 at 15:25 | comment | added | Sep Roland | Indenting the code is strongly adviced because it makes the code much more readable. How you indent is a matter of personal taste. At the very least I think the labels should stand out from the rest of the code. | |
May 30, 2016 at 15:23 | comment | added | Sep Roland |
Registers like EDI , ESI and EBX are non-volatile, meaning that the code that uses these must preserve them. This implies e.g. that the code that performs StdOut will not change these registers. This allows you to have certain values in them without having to push /pop them around an invoke StdOut ... .
|
|
May 30, 2016 at 15:18 | comment | added | Sep Roland |
xor reg,reg is the preferred way to zero a register because it has a shorter encoding (2 bytes against 5 for the mov reg,0 ) and because the manufacturer (Intel) made it extra fast precisely for doing that.
|
|
May 29, 2016 at 23:30 | vote | accept | Wasabi Fan | ||
May 29, 2016 at 23:30 | comment | added | Wasabi Fan |
Great, thanks for the review! I've seen that "xor to clear" pattern used fairly widely; why is that preferred? Is it faster, or just clearer to those who are experienced in Assembly? Also, how do I choose between using the general-purpose registers and using EDI and ESI (how do you know that those ones are safe)? Finally, it looks like you indented the code in your revised snippets; is that a preferred practice in assembly, even if there isn't a inherent place to do it in the language (e.g. there are no braces)?
|
|
May 29, 2016 at 21:49 | history | answered | Sep Roland | CC BY-SA 3.0 |