CODESTYLE.md: word wrap

This commit is contained in:
rgimad
2025-02-01 15:46:23 +03:00
parent a20ffc6542
commit 6ab513e17d

View File

@@ -1,25 +1,37 @@
## FASM codestyle ## FASM codestyle
### Rules ### Rules
* No tab characters allowed. * No tab characters allowed.
* Code labels must be on a separate line without indent. It is not allowed to have a label and a command on the same line. Combinations of label and data in one line allowed. * Code labels must be on a separate line without indent. It is not allowed to
* Lines with commands must start with 8 spaces. A mnemonic is short if its 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. have a label and a command on the same line. Combinations of label and data in
* 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. one line allowed.
* All code and text files should be in UTF-8 without BOM. * Lines with commands must start with **8** spaces. A mnemonic is short if its
length is less than **8**. Arguments for short mnemonics must start in column **16**.
### Recommended Arguments for long mnemonics must be separated from the mnemonic by exactly
* Variables should have either a clear name or a comment. one space. Arguments must be separated with a comma and exactly one space after
* The same is advisable for labels, as well as put them in a separate line without indent. a comma. Arguments continued in the next line must start from the same position
* When you write a subroutine, it is very important to describe it's purpose, input and output data, spoiled registers like this: (TODO: mb use asmxygen) as in the first line.
``` * Prefixes `lock/rep[z|e|nz|ne]` are considered as a logical part of the
; doing job command, so they start at position 8, then after exactly one space follows the
; in main mnemonic and arguments.
; eax = some data * All code and text files should be in UTF-8 without BOM.
; ebx -> some pointer
; out ### Recommended
; eax = result data * Variables should have either a clear name or a comment.
; destroys ebx * The same is advisable for labels, as well as put them in a separate line
subroutine: without indent.
``` * When you write a subroutine, it is very important to describe it's purpose,
* Only cast sizes when necessary, FASM keeps track of data types for you, use this feature to write flexible code. input and output data, spoiled registers like this: (TODO: mb use asmxygen)
* When you need to cast, do it on the memory location, not on the operand. ```
; doing job
; in
; eax = some data
; ebx -> some pointer
; out
; eax = result data
; destroys ebx
subroutine:
```
* Only cast sizes when necessary, FASM keeps track of data types for you, use
this feature to write flexible code.
* When you need to cast, do it on the memory location, not on the operand.