[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New Web browser for MiNT.



On Mon, 30 Mar 1998, Konrad Kokoszkiewicz wrote:

> Well, I disagree. Having an example of myself here, I can say, that
> assembler people probably don't code in asm just because it is considered
> cool. They usually prefer assembler for its advantages over C or another
> high level language. 

I am fully aware of the advantages of asm over C when it comes to speed
and efficiency - however, these points aren't always valid ones. On many
occassions (most common interactive applications) a slight speed loss does
not matter and the advantages of a more portable and easily maintained 
program far outweigh the speed advantages.

> coding the same in C is a pain for you. Though I haven't been ever on the
> scene, I think that scene programming experience is useful here, because
> you also know most of optimal structures for data processing by heart.

This is definitely true. Naturally I'm a great friend of scene stuff and
didn't mean to imply that it's a bad thing - quite the opposite! Just that
even scene people have to realize at some point that assembler isn't the 
One and Only Programming Language (even the game coders I know code mostly
in C while hand-optimizing critical parts in asm).

> Programming in assembler is as easy (or: as hard) as in other languages,
> the only problem with assembler (that it is considered hard) is that
> people don't know assembler. 

This is not purely true. There is a clear reason why high-level languages
were developed - easiness and fast development times. When dealing with
large and possibly complex structures it is obviously easier the more
abstract you can make the operations, without having to deal with every
single minor operation or the operations of the hardware.

> The advantages of the assembler are:
> 
> - assembler programs are short. A simple GEM application (cleanly written)
>   takes few kilobytes including Devpac AES & VDI data structures.
> - assembler programs are fast. If you have an intensive task which uses
>   several variables and pointers in a loop, the assembler gives you an
>   easy possibility to access 15 32-bit registers. If you put all your 
>   variables there, your code will be lightspeed when compared wit a C
>   compiled equivalent with 2 accessible registers and the rest of
>   variables stored in the memory.

I am quite aware of these points. The second point was slightly vague,
however: why on earth would a C compiler only use 2 registers???
Pretty crappy C compiler if it doesn't use registers whenever possible (of
course this may be the gace with M68k gcc?).
This can be affected also by using the "register" keyword that ANSI has
clearly defined (although most compilers optimize well enough without it
nowadays).

In fact modern processors and compilers are beginning to be so complex
that coding asm isn't even worth it. You may get a speed bonus but the
amount of time used to do that is quite a bit.
> 
> Also it is much easier (at least for me) to develop programs written
> totally in assembler instead of mixed C & asm. Just because interfacing
> the code from C to asm is pure pain and wastes the CPU time (you have to
> push variables to the stack, then call teh assembler module with jsr, then
> pull everything back, do the job, then do rts in order to be back to the 
> C).

You may need to do that, but in the name of portability and extensibility,
I'd say it's worth it. Have you checked out the inline assembler
possibilities gcc offers? I haven't, but they may offer some useful
functionality when it comes to mixing asm with C code.
> 
> The idea that assembler is particularly hard and everything should be
> written in slow, but "easy" C, is a myth, especially when it applies to
> m68k assembler. I would like to kick this bullshit out of people's
> mentality.  Assembler is not hard by definition, it is hard if you don't
> know it. 

I am familiar with assembler and there is no way anyone can
convince me it's easier than C (the more abstraction available, the
easier things are - I think should be quite obvious even to an asm
programmer).

> The same with C and other programming languages (not easy "by
> definition" but because it is taught in schools and people used to use
> it). 

Another point that should be noticed is that it makes a lot of sense
teaching C in schools. Teaching just m68k assembler would be ridiculous.
What if you suddenly end up on a RISC UNIX machine and have to code
something? Wont be much help knowing m68k assembler then.. (yes, after
learning the basics of programming, any language can be learnt easily, but
why go for a less-useful one when you can go for a useful on?).

         -     ---------- = = ---------//--+
         |    /     Kristoffer Lawson      |    www.fishpool.com
         +-> |    setok@fishpool.com       |  - - --+
             |-- Fishpool Creations Ltd - /         |
             +-------- = - - - = ---------      /~setok/