Style: Difference between revisions
Jump to navigation
Jump to search
Pathoswithin (talk | contribs) No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
; out: eax = result data | ; out: eax = result data | ||
; destroys ebx</syntaxhighlight> | ; destroys ebx</syntaxhighlight> | ||
* Only cast when necessary, FASM keeps track of data types for you, use this functionality to write flexible code. | |||
* When you need to cast, do it on the memory location, not on the operand. | |||
[[Category:Coding]] | [[Category:Coding]] |
Latest revision as of 19:12, 4 March 2016
SVN kernel rules
- No tab characters allowed.
- Code labels must be on a separate line. It is not allowed to have a label and a command on the same line. Combinations of label and data in one line is allowed.
- Lines with commands must start with 8 spaces. A mnemonic is short if it's length is less than 8. Arguments for short mnemonics must start in the column 16. Arguments for long mnemonics must be separated from the mnemonic by exactly one space. Arguments must be separated with a comma and exactly one space after a comma. Arguments continued in the next line must start from the same position as in the first line.
- Prefixes lock/rep[z|e|nz|ne] are considered as a logical part of the command, so they start at position 8, then after exactly one space follows the main mnemonic and arguments.
- The special property 'svn:eol-style' must be set to 'native'.
- All code and text files should be in UTF-8 without BOM.
Recommendations
- Variables must have either a comprehensive name or a commentary.
- The same is advisable for labels, as well as arrange them in a separate line without indent.
- When writing a subroutine, it is very important to describe it's purpose, input and output data, spoiled registers:
; doing job
subroutine:
; in: eax = some data
; ebx -> some pointer
; out: eax = result data
; destroys ebx
- Only cast when necessary, FASM keeps track of data types for you, use this functionality to write flexible code.
- When you need to cast, do it on the memory location, not on the operand.