News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Assembly prerequisites - why C ?

Started by frktons, May 20, 2010, 08:51:56 PM

Previous topic - Next topic

frktons

The more I read about Assembly, the more I stumble upon "C".
I have been exposed to COBOL,PL1,BASIC,CLIPPER syntax for quite a while
but "C" syntax is a little bit different [ I mean weird! ].

The concepts are almost familiar (functions, variables, instructions, loops, file
management, pointers, arrays and you know what), but all those parenteses, some
of them don't even exist on my keyboard: {} - I have to use ALT + 123/125 to
display curly braces,  and semicolons, and so on.

Many good books about Assembly, or Windows API, or Algorithms use "C".

So though a little bit reluctant, I started "The C programming language" by K&R.

Well, after the first chapter it got on my nerves, so I turned to something more
tutorial-like [C for dummies - C for the absolute beginner - and some more].

Why "C"? I guess some of you know the answer, and the "C" as well.  :lol



Mind is like a parachute. You know what to do in order to use it :-)

clive

Probably because the OS from UNIX onward were written mostly in C, with a small amount of less portable assembler.

It is also very easy to interface C/ASM.

To be honest, the prerequisite is any high level language. Some of the Campus programmers couldn't program their assignments in any language, let alone assembler.
It could be a random act of randomness. Those happen a lot as well.

frktons

Quote from: clive on May 20, 2010, 09:00:30 PM
Probably because the OS from UNIX onward were written mostly in C, with a small amount of less portable assembler.

It is also very easy to interface C/ASM.

To be honest, the prerequisite is any high level language. Some of the Campus programmers couldn't program their assignments in any language, let alone assembler.

Well, maybe this is the reason a lot of good books on Windows API use C, and
many Assembly teachers/writers do as well.

I've been coding with HLL for the last 30 years, so this prerequisite  should have been aquired.  :P
Some time I find Assembly syntax and logic easier then C's one. But it probably depends on the
fact that I'm just moving into both languages.
Mind is like a parachute. You know what to do in order to use it :-)

dedndave

if you are working on ASM, you really don't have to "try to learn C"
it will happen by osmosis - lol
you will always find yourself looking at some piece of C code and thinking "now, how do i do that in ASM"
just learn the "operators and expressions" - * means it's a pointer - and away you go   :bg

GregL

frktons,

You might find that you really like C once you learn it.


dedndave

nahhhhh - assembler forever !!!
:bg

TmX

Quote from: frktons on May 20, 2010, 08:51:56 PM
Why "C"? I guess some of you know the answer, and the "C" as well.  :lol

Actually, any HLL should do the job, because
Quote
are advised to start with a compiler first to learn basic concepts like addressing, programming logic, control flow and similar.

But since beginners usually start with procedural language (and C is still the most widely used), so there you go.
C looks pretty normal to me, at least when compared to Lisp  :bg

frktons

Quote from: dedndave on May 20, 2010, 10:52:56 PM
if you are working on ASM, you really don't have to "try to learn C"
it will happen by osmosis - lol
you will always find yourself looking at some piece of C code and thinking "now, how do i do that in ASM"
just learn the "operators and expressions" - * means it's a pointer - and away you go   :bg

There are too many examples in C for Assembly and API programming, so I figured it out
"better to know some basic C at least".  :P
I tried the osmosis, but it didn't work  :lol
Probably C can be used like a tool along the way to learn Assembly.  ::)

Quote from: Greg Lyon on May 20, 2010, 11:55:20 PM
frktons,

You might find that you really like C once you learn it.



Well I hope so, otherwise it'd be hard to use it. :P

Quote from: TmX on May 21, 2010, 12:29:20 AM
Quote from: frktons on May 20, 2010, 08:51:56 PM
Why "C"? I guess some of you know the answer, and the "C" as well.  :lol

Actually, any HLL should do the job, because
Quote
are advised to start with a compiler first to learn basic concepts like addressing, programming logic, control flow and similar.

But since beginners usually start with procedural language (and C is still the most widely used), so there you go.
C looks pretty normal to me, at least when compared to Lisp  :bg

Don't know.  ::)
I am already used to 
Quote
basic concepts like addressing, programming logic, control flow and similar
but I have never seen a book or tut on Assembly or Windows API using COBOL or PL1.  :eek
Mind is like a parachute. You know what to do in order to use it :-)

joemc

using C is kinda like a lingua franca.  i believe partly because it is fairly old and still powerful. helps OSes were written in it too. Almost everyone knows C.  :)  As far as Assembler making more sense, i agree, but it is also much more verbose. And i had the oposite entry into things.  I was trying to find C tutorials on Win32 and found Iczelion's tutorials. Was able to understand most of it because it was all function calls anyways.

hutch--

Frank,

Its all been said but with most OS code aver the last 20 years or so C architecture is how its done and to write code in those OS versions you need to be able to handle C format. MS-DOS up to about 6 was written in MASM and was not directly C format but all Windows versions from 3.0 onwards were written in C and later C++ so languages that are Windows capable need to be able to handle that format.

With MASM you are free from much of the notation clutter but you still must handle stuff like zero terminated strings, structures, unions and of course addressing stored in pointers but its a good tool for doing this stuff once you get the sniff of it.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

frktons

Quote from: joemc on May 21, 2010, 02:47:10 AM
using C is kinda like a lingua franca.  i believe partly because it is fairly old and still powerful. helps OSes were written in it too. Almost everyone knows C.  :)  As far as Assembler making more sense, i agree, but it is also much more verbose. And i had the oposite entry into things.  I was trying to find C tutorials on Win32 and found Iczelion's tutorials. Was able to understand most of it because it was all function calls anyways.

Well I think that in a land of C-speaking people I'm going to learn some of it  :P

Quote from: hutch-- on May 21, 2010, 03:19:34 AM
Frank,

Its all been said but with most OS code aver the last 20 years or so C architecture is how its done and to write code in those OS versions you need to be able to handle C format. MS-DOS up to about 6 was written in MASM and was not directly C format but all Windows versions from 3.0 onwards were written in C and later C++ so languages that are Windows capable need to be able to handle that format.

With MASM you are free from much of the notation clutter but you still must handle stuff like zero terminated strings, structures, unions and of course addressing stored in pointers but its a good tool for doing this stuff once you get the sniff of it.

:U Reading "C for dummies" and " a couple more just to have a taste of "C".  :lol

Mind is like a parachute. You know what to do in order to use it :-)

redskull

I found the key to learning C is to treat C and C++ as two seperate, incompatible languages.  So many authors (and even programmers) mix classes and STL with low-level pointers and C library functions, and it creates a nightmare of unreadable, unstable code.  Either learn 'C', or learn C++; don't try to learn them both at the same time, and avoid any books (or teachers, or coworkers) that try to.

Also, the notation is completly programmer dependent; you can write beautiful, clear programs in C, or you can take all the syntax shortcuts and remove all the whitespace to create a dense block of unreadable code to try and impress newcomers with how el33t u r (internet forums are rampant with guys like that).

Personally, i really like C++ for "real" programming, as long as its used right.  But for "fun" programming, MASM is still the best.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

oex

I code in ASM and PHP.... PHP is like c in format but without the confusion of c/c++.... It is a scripting language (so you dont end up with exes).... Most on this forum will dispise PHP and frown on it as being 'too easy'.... it is :bg.... c is somewhere in the middle.... it has higher level syntax than ASM but I honestly find this a drag.... You have hundreds of different words that mean DWORD which is annoying if you want to cover a large array of programming topics.... In PHP you cant do a lot of stuff it is too high level but you can also do a lot of things very simply that you just cant in c/asm like multiple format image manipulation in a few lines
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

GregL

I agree with redskull, C and C++ should be treated as two separate languages.

Quote from: oexYou have hundreds of different words that mean DWORD which is annoying if you want to cover a large array of programming topics...
Actually that is a Windows API thing. There aren't that many data types in C.



oex

My mistake sorry I started with c then microsoft muddied the waters :lol
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv