Taking assembly class

CPA

Elite Member
Nov 19, 2001
30,322
4
0
Are there any good sites that list out the keywords for assembly using VC++? My textbook seems ancient and does not use proper keywords, nor does MS VC++ Help do any good. It's kinda hard to code in assembly if I don't know the proper syntax.
rolleye.gif
 

CPA

Elite Member
Nov 19, 2001
30,322
4
0
in-line assembler is built in VC++ compiler, to my understanding.
 

Noid

Platinum Member
Sep 20, 2000
2,390
193
106
Assembly language is machine language. Its the language behind C++ or VC or any language.

Its machine language that builds makes the compliers for higher level language.

Gads,,, I remember dealing with that only once when I needed bit manipulation for COMP4 calculations that lost their sign byte and moving it to back to memory.

(when memory was 640k ... lol)

Ah ,,, yes .. the good ole days ...

What you need is to study the calling structure to a machine language program and its API's.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Its machine language that builds makes the compliers for higher level language

Not any more, most compilers are compiled with a high level language like C. Even Mono (the GPL .NET implementation) is self hosting, meaning it compiles itself now.
 

Gaunt

Senior member
Aug 29, 2001
450
0
0
You can use the inline assembler from visual C++, but I think there's also a way to use just the command line and visual C++'s assembler to build your exe files. As for figuring out what the syntax is, a search of google will probably help quite a bit... I just did a quick search for "x86 assembly" and came up with quite a few things that could be helpful.

Chances are there is something in your course that will be more helpful, however. For instance, my Prof provided us with an include file for our assembly applications that helped with string manipulation and input/output routines. When you say your textbook doesn't use proper keywords... that doesn't make a lot of sense. Alot of the basic commands in assembly (mov, jmp, bne, add, sub....) are standard commands. The conventions for passing the operands can differ from assembler to assembler, but the keywords should be the same.

I would suggest looking online for a quick x86 assembly tutorial, and picking up an assembler, such as NASM or masm, instead of trying to use Visual C++'s inline assembler. NASM is free, and although I have seen MASM available online, I'm not sure it's free.
 

CPA

Elite Member
Nov 19, 2001
30,322
4
0
Originally posted by: Gaunt
You can use the inline assembler from visual C++, but I think there's also a way to use just the command line and visual C++'s assembler to build your exe files. As for figuring out what the syntax is, a search of google will probably help quite a bit... I just did a quick search for "x86 assembly" and came up with quite a few things that could be helpful.

Chances are there is something in your course that will be more helpful, however. For instance, my Prof provided us with an include file for our assembly applications that helped with string manipulation and input/output routines. When you say your textbook doesn't use proper keywords... that doesn't make a lot of sense. Alot of the basic commands in assembly (mov, jmp, bne, add, sub....) are standard commands. The conventions for passing the operands can differ from assembler to assembler, but the keywords should be the same.

I would suggest looking online for a quick x86 assembly tutorial, and picking up an assembler, such as NASM or masm, instead of trying to use Visual C++'s inline assembler. NASM is free, and although I have seen MASM available online, I'm not sure it's free.

Using standard keywords would make sense, but my text uses keywords such as copy, assign, input, output and other whole word expressions. I believe MS VC++ uses abbreviated words, such as what you listed, but I cannot find a list of them in MS VC++ Help. My text also uses up arrows and what looks to be => to assign data into registers. Is that truly the case?

 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
laff ... and how is the C compiler written?

Well now that we have working compilers abount it could be done in anything. Look at gcc, it's 99% C code.

$ pwd
/tmp/gcc-3.2-3.2.2ds8/gcc-3.2.2
$find -name '*.c' | wc -l
3433
$find -name '*.S' | wc -l
32
$find -name '*.s' | wc -l
10
$find -name '*.cpp' | wc -l
180
 

Bovinicus

Diamond Member
Aug 8, 2001
3,145
0
0
Who wants to learn assembly anyway? =P
Just kidding, but that language is needlessly tough. Modern compilers do a pretty good job of spitting out efficient programs. I know, there is no way it can compete with a well-written assembly program, but it is super hard from what I have seen.

Anyway, goto a mass bookstore (Borders, Crown, etc.) and take a look at their computer book section. You can take brief looks at different books and see which one you like best.
 

Noid

Platinum Member
Sep 20, 2000
2,390
193
106
dood ... my point is ... assembler is the base of all languages.

You cant go any lower than assembler.

You must be thinking of something else.
Is that what they teach in college now?

My CS degree program had us write a simple complier in assembler. (a long time ago)

Long before PCs were made... only Mainframe IBM 360/370 were used to teach programming.
I ran around with huge boxes of cards before they implemented text editors.

Thank god that C is used now. Theres no need for assembler unless you need to do bit maniplualtion and direct addressing.
 

manly

Lifer
Jan 25, 2000
13,308
4,084
136
Originally posted by: CPA

Using standard keywords would make sense, but my text uses keywords such as copy, assign, input, output and other whole word expressions. I believe MS VC++ uses abbreviated words, such as what you listed, but I cannot find a list of them in MS VC++ Help. My text also uses up arrows and what looks to be => to assign data into registers. Is that truly the case?
I wish I knew x86 assembly, but now I'm not sure what the question is either. You just have to learn standard x86 assembly, and then embed it directly into C++ source. Here's a brief intro I found using Google:
http://www.math.uaa.alaska.edu/~afkjm/cs221/handouts/inline.pdf

The instruction syntax would be identical to MASM (for which you can find books and reference material), which I believe is the Intel syntax. As opposed to AT&T syntax IIRC.

It doesn't sound like your book covers x86 assembly, at least not any instructions that I've ever seen. For a free resource on x86 ASM, look up Art of Assembly, freely available on the Web. The latest revision covers a high-level assembly layered on top of MASM though, so it may not be applicable to your situation. AoA is supposed to be a great intro to x86 assembly.

I used to know some more assembly, and how to link assembled modules into C programs, but that's some years ago. I'm a Java weanie now. :eek: After studying a clean instruction set like MIPS, it was hard to hit the books and learn x86.

Noid apparently needs to take a compilers course (again). :)
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
dood ... my point is ... assembler is the base of all languages.

So? It's a nice thing to know about because it can help debugging, but there's basically no reason to use asm for anything other than OS code.

Long before PCs were made... only Mainframe IBM 360/370 were used to teach programming.
I ran around with huge boxes of cards before they implemented text editors.

Thankfully those days are long past, just like the days of coding compilers in asm.
 

Noid

Platinum Member
Sep 20, 2000
2,390
193
106
Not any more, most compilers are compiled with a high level language like C. Even Mono (the GPL .NET implementation) is self hosting, meaning it compiles itself now.

I was stating that your statement above is incorrect. I didnt want to have to get this direct. But I guess I do.
I also didnt say anything about not needing to know it. Dont put words in my mouth.

I think some of you need a history lesson on binary logic, data structures, and programming.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
I was stating that your statement above is incorrect. I didnt want to have to get this direct. But I guess I do.

Find me a compiler for any language written in asm. For my side I already provided gcc, which is done in almost all C.
 

CPA

Elite Member
Nov 19, 2001
30,322
4
0
OMG, my thread has been hijacked :Q:p;)

Manly, I will do as you suggest and see what comes up. Tomorrow morning I will check out that site also. Thanks for the help.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Sure compilers were written in somehing as low as asm or machine language at some point, gotta start somewhere, but they havn't been for a very long time and probably never will be again. There's just no reason to. Even B was rewritten in B as soon as the compiler was finished, according to your link.

Maybe I misinterpreted your statement: Its machine language that builds makes the compliers for higher level language , because even reading it now I'm still not sure what it's meaning is 100%.

While wanting to use a higher-level language, he wrote the original Unix system in PDP-7 assembler

So? That's the OS, not the compiler. And as soon as they got a C compiler working, unix was rewitten in C.
 

Noid

Platinum Member
Sep 20, 2000
2,390
193
106
I prove my point.
Your stuborn. (to put it nicely)
Im not wasting anymore time on you.