Re: To Beth

From: Alex (alex_at_alex.com)
Date: 03/17/05


Date: Thu, 17 Mar 2005 13:16:40 +1100


"\\o//annabee" <http://TheWannabee.org> wrote in message
news:opsnrdmskw1ounrv@news.braodpark.no...
> På Thu, 17 Mar 2005 11:50:15 +1100, skrev Alex <alex@alex.com>:
>
>> Its making life much easier, admittedly 100% of my bootcode and second
>> stage loader are entirely in assembly language. I chose to use C mainly
>> in the
>> kernel as development times are 1/20th of that it would take to write the
>> kernel
>> entire in assembly.
>
> I see what you mean, but I disagree. Because I think theres a payment
> upfront with asm, and that this payment slowly becomes a huge tax return
> in the long run. Allready, I write asm, in many many cases, when using the
> known, much-used memonics, just as effective as I wrote pascal, earlier.
> More effective.
>

I would agree that well written assembly code will almost always perform
better than any code generated by a HLL. With CPU's being as quick as they
are these days, the number of excuses for programmers to become lazy,
increase.
I disagree that development time is faster writing in assembler, and
debugging of
asm code is more time consuming.

eg: this routine took me not much more than a couple of mins
to write:

dword fs_type()
{
if(bpb.bpb_fatsize16)
{
    fatsz=bpb.bpb_fatsize16;
}
else
{
    fatsz=bpb.bpb_fatsize32;
}
if(bpb.bpb_totsec16)
{
    totsec=bpb.bpb_totsec16;
}
else
{
    totsec=bpb.bpb_totsec32;
}
datasec=totsec-(bpb.bpb_reservedsec_cnt+(bpb.bpb_numfats*fatsz)+rootdirsectors);
countofclusters=datasec/bpb.bpb_secpercluster;
firstdatasector=(bpb.bpb_reservedsec_cnt+(bpb.bpb_numfats*fatsz)+rootdirsectors);
if(countofclusters<4085)
{
    return(FAT12);
}
else
{
    if(countofclusters<65525)
    {
        return(FAT16);
    }
    else
    {
        return(FAT32);
    }
}
}

Imagine the time taken to write the equivilent in asm? In the time
that it would have most _average_ asm coders to write the
equivilent, I could have written another dozen C functions.
Thats why I disagree development timeframes are quicker in asm.

> I thought for instance it was a real hell to start with the FPU memonics ?
> But after some time, the order of the memonics for "optimal" performance,
> in both writingtime and execution time comes, by itself. I am surpriced
> how easy the brain understands whats going on, with assembly, after just
> some small practice. And I find no diffrence in calling a C function, over
> a asm function, except the latter is usually much faster running.
>

This is true of well written asm code. Its also possible for asm code
to be slower than the C equivilent if the asm code is poorly written.

>
> Also, something I just must say, is that the myth that assembly is hard to
> read, vanishes if you have a good macro language available. I have never
> found any reason to comment a single proc, in 1000kb of assembly code. I
> find it now more easy to just read the code, than to look at the comments,
> and so I stopped commenting a long time ago.
>

Not commenting code in my opinion is the worst habit ever. I always comment
code. That way, if i pull some code off the shelf 2 years later, the
comments are
there to help refresh my memory straight away, also, if another programmer
has to work on your project and you havent commented anything, I am sure
he/she would feel like murdering you :P

>> PS: How did you know I was working on an OS? :P
>
> I am psychic ??? :D
>
> --

lol :P

I am certainly not bagging out asm as I believe it to be an extremely
powerful
and efficient language. My arguement in this case is purely based on
development
timeframes.



Relevant Pages

  • Re: Hey, what is all this off topic posting?
    ... >>> that's all you're using macros for, I can see why you don't much like ASM. ... > PL/I language constructs though. ... >> write the macros using some arcane assembler to do that on a new ...
    (sci.electronics.design)
  • Re: HLA v2.x and / or LASM suggestion: Win32 Resources
    ... Assembler" probably always get when people are actually talking about ... machine_ from ASM or even some of the more "low-level" C programming - ... "Abstraction" - as I keep saying and, one day, I Hope people will ... writing code thinking it's "portable" when, in fact, it contains ...
    (alt.lang.asm)
  • Re: a turbo assembly language
    ... > With this You will go more fast of a C (or whatever language you want) ... > programmer because debugging assembly program is easier. ... * "Writing Asm would be more time consuming than HLL". ... RosAsm Assembler Syntax, at all. ...
    (alt.lang.asm)
  • Re: What micros do you actually hate to work with?
    ... with less than tiny asm ... hassle to work with 32 bit longs in assembler for an 8 bit uP, ... Microchip's C compiler tools and their assembly under MPLAB. ... In this case, also, I was the only programmer. ...
    (comp.arch.embedded)
  • Re: Why use assembly?
    ... I use asm because, when given a propper tool, like RosAsm, its simply the easiest, clearest language. ... that learning asm with some of the older assembler may actually be a pain in the ass. ... The remaining bits that are not easy, comes from situations like when you have to write your own code for things that just take a single line of code in a HLL. ... Becomming an asm programmer is to take the step from beeing a servant in the dark to beeing the master of your own destiny in the programming world. ...
    (alt.lang.asm)