Re: Formatting in assembly
- From: Chewy509@xxxxxxxxxxxxxxxx
- Date: 30 Mar 2006 18:15:10 -0800
James Daughtry wrote:
Okay, this is a combination of "What constitutes good formatting in
assembly?" and "Hey Betov, how does this strike you?". Here's some
RosAsm code formatted with Betov's suggestions. I'll eat my hat and say
that the flow is definitely easier to follow:
<snip?
The formatting works, but not quite as well. Ironically, this is
similar to my first attempts at writing assembly where I tried to
format the code like I would C. I rather like it, but I'm curious what
everyone else around here thinks about formatting assembly source code.
The sky is the limit, how do you feel assembly should be formatted for
readability? :-)
Hi James,
First of all, everyone will have a different opinion on this topic. No
2 coders will share the same 'style'. But anyway, here is the style
that I tend to use for my personal projects.
Single column, labels and assembler directives/options hard left.
Source intended 1 tab (1 tab = 2 or 4 spaces). For loops and other
conditional branches no addtional indentation (unlike your examples).
Comments align on column 32. Double line feed between procedures always
with header comment (procedure description including input/output).
Header comment has 2 leading comment characters (eg ;;) and aligned on
column 1.
Labels have each first letter of each word capitalised, and depending
on label name, words are joined or separated by underscore. eg.
SourceLabel2: or ThisIsAVeryLongLabel:
or:
use 32bit
;; Proc ExitToSystem:
;; This procedure exits the application returning control to the OS.
;; expects: al = exit code
;; output: void
ExitToSystem:
mov ah, 4ch
int 21h
ret
;; More code...
But if I'm working on someone else's code, then I use their coding
style...
--
Darran (aka Chewy509) brought to you by Google Groups!
.
- Follow-Ups:
- Re: Formatting in assembly
- From: James Daughtry
- Re: Formatting in assembly
- References:
- Formatting in assembly
- From: James Daughtry
- Formatting in assembly
- Prev by Date: Re: GDI can be fast!
- Next by Date: Re: Formatting in assembly
- Previous by thread: Formatting in assembly
- Next by thread: Re: Formatting in assembly
- Index(es):
Relevant Pages
|