×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Some considerations...
2

Some considerations...

Some considerations...

(OP)
Hi,

I hope you will have some patience to me as I´m new to ASM.
I have 3 "existencial" questions about ASM that I hope you can help me with.

First: I have seen so far two types of ASM code. One uses something like push and call commands without any include files. The other uses include files and instead of using push and call commands it puts everything into a single line... For instance, if we are calling a Windows API the code will call it in a way similar to visual basic(in a single line not using offset). It seems this is a new aproach. Because this, it seems to me that there are different "versions" of assembly. If this is true, it means that to compile ASM code, the compiler we will use depends on how the code was writen... So, it means that I can´t use TASM to compile any assembly code?

Second: Why use include files? For instance, imagine I´m using a windows API to show a messagebox. I think I can do this with and without include files. Does the include files help us to garantee that if the dll with that API running in the client is not compatible with our code, it doesn´t matter because the code will only use the include file? If this is not the answer I can´t get the point of using it. On the other hand, with the include file... Doesn´t the compiled exe become bigger?

Third: I would like your opinion about the best assembly tools one can use (like compiler, ASM editor, Hexeditor, disassembler...)

Thank you in advance!

Sérgio Oliveira

RE: Some considerations...

Generally an assembler produces code from only opcodes.
An assembler also uses directives. A directive tells the assembler the context of the opcodes ie near,far,16bit,32bit etc
These opcodes directly tell the processor what to do.
ie push ax pushes the value of ax onto the stack.

If an assembler produces more object code that your opcode generation then it isnt a true assembler (more like a compiler).

You only need to include librarys if you are using routines within them, just like you do pascal with "uses dos,crt" etc

use of these libraries is made by use of a far call. You must prepare the pre-requisits before making the call.

If you are interfacing with an operating system you must ensure that the OS libraries you use are loaded and ready for your use.

you must find an assembler to suit your needs. There are plenty of free assembly tools to download free off the net for any OS but generally if its for windows then you will have to pay. If you plan to program in windows then you need resources to learn how to do it (you'll have to pay for those too).

"People who have nothing to say, say it too loud and have little knowledge. It's the quiet ones you need to worry about!"

RE: Some considerations...

This is Win32Asm.

The 'Invoke' way is the way MASM does it.

The push way is the way TASM does it.

Generally in writing Win32Asm you want the API calls to stand out so you use Invoke.  In fact, many TASM coders use macros to simulate the Invoke call (they usually call it SCall or SCALL).  Note that either way most of the time the same amount of code gets generated.  In fact you might consider Invoke as a glorified macro which is already predefined by the assembler.

If you look at the include files packaged with MASM32, you'll just see a lot of PROTO declarations.  These simply tell the PE loader to import the routines from the OS's library.  You can remove the include files but you will have to PROTO the routines you use manually.  And if ever you do not call a PROTO'ed routine, it won't get imported at all, so no worries about Include files bloating the exe.  If you look at the include files included in MASM32 you will NEVER see any actual code, just PROTO's, STRUC defs, EQU's, and MACRO's.  The bloat is all at compile time and never reaches the obj file.  Note however that there are some very tricky ways in which you do not even need to PROTO OS routines (to save space if your file is < 5Kb), if you have MASM32 v 7 you can find one way in \Masm32\Example8\mob\Noimport\

Hutch's MASM32 package is good, particularly the latest version (v7).  Note that MASM32 is NOT MASM (but includes MASM) so MASM32 v7 actually includes MASM v.6.14.4888 he he he.

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close