flat assembler
Message board for the users of flat assembler.
Index
> Main > How to indent? |
Author |
|
JohnFound 13 Feb 2005, 15:24
IMHO, horizontal indentation in assembly code is not usefull at all. Assembly language have different syntax than HLLs and formating rules are different too.
The problem with horizontal indentation is that it prevents proper recognition of source elements: label, opcode, operands, comment Better use vertical indentation (i.e. empty lines between logical blocks) and more comments. Using local labels (.localLabel) and reasonable names of labels will help make code more readable. Horizontal indentation is usefull only for complex nested data definition statements, especially using macroses and in FASM, in macro definitions, where the rules are more HLL-like. Regards. |
|||
13 Feb 2005, 15:24 |
|
madmatt 13 Feb 2005, 16:12
I like indenting especially for complex looping. and you can use the if.inc macros which greatly reduces "Label HELL", both of these methods used together make for some pleasurable assembly programming, AND debugging. For and example you can look at my code in windows forum, look for the question, 'problems with windows menus' and download the source code.
MadMatt |
|||
13 Feb 2005, 16:12 |
|
vid 14 Feb 2005, 02:11
just like JohnFOund told, my code looks like:
Code: ;if something then skip loop cmp [skiploop],0 je .endloop ;otherwise fill variables for loop mov cx,[outerloopcount] ;outer loop until ecx>0 .outerloop: dec cx cmp cx,0 je .endloop ;inner loop - write 'a' ecx times mov eax,ecx mov ah,2 mov dl,'a' .innerloop: int 21h dec eax cmp eax,0 ja .innerloop ;continue looping jmp .outerloop .endloop: hope you got it |
|||
14 Feb 2005, 02:11 |
|
scientica 14 Feb 2005, 15:40
I feel that well, soon be debatng who is right about K&R/"One true brace style", GNU style, etc,etcetc ad nausem
once and for all: There is no right and wrong with indentation it's just a matter of personal preference and stubborness anyone else trying to say something else if just trying to convince you to use his/hers indentation preference, I frequenlty point out that my preference is K&R and that I'm always right and every one else is wrong (j/k, pun intended) Some times indentation is good, eg, when you got nested loops, it helps to show their "level" by indentation (can be a space, a tab, a bilion spaces and tabs,etc). And some times it's easier to "put it all on one line" - eg: marco three_nop { db 90h,90h,90h } |
|||
14 Feb 2005, 15:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.