CODESTYLE.md: word wrap 100

This commit is contained in:
rgimad
2025-02-01 15:56:47 +03:00
parent 6ab513e17d
commit 5c18f0cbba

View File

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