Since I can't cross-post, I'll CC the relevant people but I thought my
comments should be made to the Arachne list since that's where the post
was visible.
 
ANDY wrote:
> 
> On Fri, 20 Jul 2001, Randy Goldenberg wrote:
> <snip>
> so if I write a program either in C/C++, assembly language or machine
> language, I must have a *thorough* knowledge of the inner workings of
> the OS, DOS, Windows, *nix that I am writing the program to run on,
> *before* I start writing the the code (not necessarily the program)

No. That does not apply to "C" and variants.
> 
> would you write a DOS, Windows or *nix app in assembly language or machine
> language? maybe assembly but does machine language "go too deep" to be
> used for a windows app?? I know when writing a machine language program
> one must have a thorough knowledge of the inner workings of/all the,
> *CPU chip*(Not OS) calls, specifications etc.
> 
> p.s. if machine language is appropriate for OS creation, what
> specifically is assembly language appropriate for?

Machine language could only be considered to be appropriate for designing
/modifying the MACHINE itself, or possibly writing an ASSEMBLER - although
I'm sure there are easier ways to write an assembler these days - but the
assembler is what translates memnonics (arbitrary names for instructions)
into machine code (actual binary instructions).

No one would write an OS in machine code - although it could be done.
An OS is normally and properly written in assembly language.

A fat, bloated, creeping slow OS can be written in "C" and it has
been done. See Linux. Or TSX. Or Win 9+. (parts of)

>    I am concluding that in order to succesfully write *code*, C/C++ or
> otherwise, one must have a thorough knowledge of both, the CPU chip and
> memory constraints(hardware) And the OS which the code is to be executed
> on... alot to study for the programmer(s)!!

No. "C" insulates the programmer from the hardware concerns to a VERY
large degree. The "C" programmer's god is his compiler. This does all
the thinking for him/her and gives us all the headaches. <G>

To clarify:
Machine code consists of binary patterns that the machine is internally
programmed to recognize as instructions. This internal programming is 
basically just a look-up table that can be checking the whole instruction
byte or even just pieces of it (bits). The examination of these bits
and the resultant actions (or partial actions) is controlled by what is
called micro-code. It is part of the structure of the CPU. Intel, Cryix,
Motorola, DEC etc... hardware engineers design this.

Hex code (or debug code) is just a series of binary bytes that can be sent
to the machine for interpretation and execution. 
Hex is short for hexadecimal. Just a number system that happens to fit well
when describing a group of eight binary bits. There was a time when Octal
was used for this purpose. Even decimal COULD be used. The number system
is just a matter of convenience (and sometimes personal taste). You can
write this if you want to do something very quickly without an editor or 
assembler handy. You need a reference book on the machine instruction set.

Assembly code (source) is a series of very short words (memnonics) that
are easier to remember and deal with than the hex code they represent.
The assembler takes your somewhat cryptic collection of abbreviations
and assembles them into a series of hex (or more appropriately binary)
digits which represent the instructions and memory references you want
the hardware to try to execute. <G>

Higher level languages like Basic, Fortran, Pascal, APL,"C", etc. allow
you to write programs that do complex things without having to know what
the hardware thinks of your idea. The above list of languages all do the
same thing with different degrees of efficiency.

Basic allows you to write in English and understand immediately what you 
have written.  Basic programs, although general, can be compiled to provide
instructions that will run on specific hardware. These instructions are
usually not very efficient - they run quite slowly. The basic compilers
are not very smart. 

The other languages listed are much more twisted in their syntax and begin
to appear as totally foreign languages. Greek comes to mind. <G> 
Generally they compile better as you proceed to the right, but this has
nothing to do with the readability of the written source, only the amount
of thought put into the compiler. :(

Finally, both assemblers and compilers output machine specific code. You 
must have the appropriate compiler for the OS and hardware you want your
program to run on. In the case of the assemblers, even the input source
is machine specific.


-  Clarence Verge
--
-  Help stamp out FATWARE.  As a start visit: http://home.arachne.cz/
-  The internet is infected - Windows is a VIRUS !!
--

Reply via email to