|
-
February 23rd, 2003, 07:45 PM
#11
Member
Re: Whats Assembly???
I actually know what assembly is.... Its a programming language that is really old... but still powerfull...Right?? Well, i got a few questions about it... so any help you can give would be great
nope. do not think of assembly programming as a language. there are several reasons for this, and the most important one is that every different computer architecture has a completely different assembly language. try reading assembly for a 386, 686, SPARC, Alpha, MIPS, Motorolla, PIC, or any other popular architecture and you will quickly find that they are all totally different. not only are they different, but they operate under totally different principles. some ISA's (instruction set architectures) are RISC, some are CISC. some ISAs are register-memory, some are stack-based, some are accumulator-based, and some are register-register. assembly is just a one-level abstraction of physical machine language, that is, ones and zeros. that's why assemblers are cheap--all they do is translate your "program" into it's machine form by doing a few passes. assemblers are not compilers--believe it or not there is a big difference. so you can probably surmise that assembly is not just an old, powerful programming language. each computer architecture comes with its own assembly language--the first computers invented may not have had the exact same concept of assembly, but even they had a primitive form of assembly language. to fully understand what assembly language is, you'll probably want to read a college-level textbook like Hennessy and Patterson.
#1. Is assembly a good "First programming language"??? I have started learning C++ but it is extreamly difficult.. Not to mention the "best" compiler is owned by M$
that all depends, really. if your goal is to program a uPIC controller to read analog values to run an electronic sprinkler system controller then yes. if your goal is to write a computer game, then HELL NO. it is unwise to write large programs in assembly--however it is a common practice in fields such as graphics to find the most heavily used parts of the program and optimize them with assembly, since humans can generally write much more efficient assembly than compilers. do not bother trying to write assembly for any major computer system, it is too difficult and tedious. start with C/C++. not only are they solid languages with lots of background and documentation, but they are free. if you're on a windows box, just download cygwin (www.cygwin.com) and you'll have everything you need. for the curious, compile a hello world type program with GCC, and use the -S switch. or use objdump. the output will be an assembly version of hello world. this is about what it will look like:
.def ___main; .scl 2; .type 32; .endef
.text
LC0:
.ascii "Hello, World! -- C\12\0"
.align 2
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
subl $24, %esp
andl $-16, %esp
movl $0, %eax
movl %eax, -8(%ebp)
movl -8(%ebp), %eax
call __alloca
call ___main
movl $LC0, (%esp)
call _printf
movl __impure_ptr, %eax
movl 4(%eax), %eax
movl %eax, (%esp)
call _getc
movl %eax, -4(%ebp)
movl $0, %eax
leave
ret
.def _getc; .scl 2; .type 32; .endef
.def _printf; .scl 2; .type 32; .endef
see what i mean? who wants to program that? read the Intel architecture manual to discover the meanings of the various semantics.
#2. Where can I find an Assembly compiler??? I have a C++ compiler...Visual C++ it cost me tons of $$$.. Will an assembly compiler cost just as much???
like i said, assemblers are not compilers. a real compiler takes a high-level language like C and converts it to assembly, then optimizes the assembly, and then goes through the rest of the process of assembling and linking and whatnot. as for assemblers, they are generally not that hard to find. of course you need to specify which ISA you're trying to find an assembler for. since i'll assume you mean x86 assembly, go with nasm--i believe it was mentioned earlier in this thread.
#3. Are there any assembly tutorials out there??? Wait.. stupid question  (Ha! caught myself that time) There are some in the "Tutorials" section of the forums right? If their are any others that you recommend... plz inform me
i recommend just doing a google search for "assembly programming" or something. i don't know what your level of education is, and i'm not insulting your intelligence, but it sounds like you may be a little green to tackle assembly. learn some computer architecture first. without a basic concept of computer architecture, assembly won't make much sense. good luck
-
February 23rd, 2003, 08:55 PM
#12
Member
Thanks Guys!!!
All of your infor is really helpful 
I think I won't start learning Assembley right now... I think I'll stick with C++ for a while
By the way... Those linx that you guys put in where excellent Thanks for your input
-
February 23rd, 2003, 11:13 PM
#13
Assembly is good for some things, not others. If you need to provide maximum performance for a particular device (for example, max throughput for an A to D converter to a storage device for collecting data in a laboratory setting or writing an especially high performance device driver), it's pretty hard to beat the native assembly language.
If your boss wants a complete program tomorrow (or even next week), assembly is probably not in the cards. Also, as already noted here, the form and syntax of assembly language depends on the hardware used, so it is not very portable except as an experience base you carry in your head.
However, if you have a lot of time to spend and a lot of curiosity about exactly how your hardware and operating system work, assembly language programming is probably the best teacher (in the same sense that a Marine drill instructor is your best teacher.) You will learn, you will learn a lot, but you will pay a high price.
Unfortunately, I am only one generation of programmers beyond the one that though assembly language compilers were a great advance. Those boys wrote programs using binary machine language, often put in a word or byte at a time through front panel swithes. For my sins, I once had to write and input a bootstrap loader that way, and I would really hate to do anything more complicated than that!!
These days, I believe VB is best for quickly writing an impressive looking program (that generally depends on the current speed and capacity of PCs to disguise the inefficiency) and C++ is the best for real professional jobs. Either of these would be a better first language, with VB providing almost immediate gratification and C++ being the language that one probably should aim for eventually.
-
February 24th, 2003, 02:48 AM
#14
Senior Member
Using C you can include dos.h and the add assembly instructions like this:
#include<dos.h>
main(){
unsigned int var;
asm { //start assembly instructions
cli //Clear Interrup Flag
mov dx, var //Duracion del tono
in al, 0x61 //Se obtiene el valor del puerto B del i8255
and al, 0xfe //Desconexion del speaker
}
return 0;
}
That is just a small example of how to put assembly instructions in a C program. It worked on borland turbo C compiler.
-
February 24th, 2003, 04:28 AM
#15
Turmoil good choice bud!
I would suggest learning a high level-lang 1st.
But if U insist check outASM
There U will find lots of help to get U started tools, tuts, and more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|