News:

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

New to assembly

Started by lonewolff, March 01, 2009, 01:10:21 AM

Previous topic - Next topic

lonewolff

Hi all,

I am pretty new to assembly (32 Bit anyway). I look forward to getting my teeth into it.
I consider myself an intermediate C++ programmer. I have a fairly descent knowledge of Winsock and Windows API programming.

I just decided I would love to get back into low level, as I used to fiddle around with 16bit assemby (in debug  :U )

This site looks awesome and I have a wealth of information to dig through.

Wish me luck!  :bg

BlackVortex

Knowledge of API is the most important thing for windows assembly.

Gotta love "invoke" !

lonewolff

Looks like it :)

I have just been looking at Iczelion's tutorials and have a working message box.

I love how my C++ equvalent is a 30Kb exe and the ASM version is just 2.5Kb. That is awesome.

In C++ you can use the | symbol to include other options. For example;

MB_OK|MB_ICONWARNING

This doesn't seem to work in my asm program. Is there a quick way around this in assembly?


BogdanOntanu

Quote from: lonewolff on March 01, 2009, 01:55:07 AM
...

In C++ you can use the | symbol to include other options. For example;

MB_OK|MB_ICONWARNING

This doesn't seem to work in my asm program. Is there a quick way around this in assembly?

Depending on the values you could use:

MB_OK + MB_ICONWARNING


However the "correct" syntax should be:

MB_OK OR MB_ICONWARNING
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

lonewolff

Awesome, that did the job.

I guess it is a matter of learing the new formatting concepts. That will take time but will be worth it.  :8)

GregL

lonewolff,

Welcome. If you know C/C++ and the Windows API, you shouldn't have any big problems learning MASM programming.

Get a copy of the MASM Programmer's Guide, this one is in .chm format: http://www.masm32.com/board/index.php?topic=5433.msg70110#msg70110

The Intel manuals are very helpful too.

Iczelion's tutorials are good too.

Good luck, I think you'll enjoy it.



lonewolff

Cool. Just downloaded it.

I am just in the process of converting a couple off C++ applications from my site over to assembly. So, far so good.

I am about to attempt edit boxes and buttons. If I get excited enough, I'll then have a crack at converting one of my winsock apps over.

I love the world of 32bit assembly so far :)

slovach

Quote from: lonewolff on March 01, 2009, 01:55:07 AM
Looks like it :)

I have just been looking at Iczelion's tutorials and have a working message box.

I love how my C++ equvalent is a 30Kb exe and the ASM version is just 2.5Kb. That is awesome.

In C++ you can use the | symbol to include other options. For example;

MB_OK|MB_ICONWARNING

This doesn't seem to work in my asm program. Is there a quick way around this in assembly?



This is because of the CRT. You'll probably see similar sizes for the most part if you go without it.

The easiest way imo is just creating your own entry point. Just use what the linker expects, ie WinMainCRTStartup()

void __cdecl WinMainCRTStartup(){
   ExitProcess(WinMain(GetModuleHandle(NULL), NULL, NULL, SW_NORMAL));
}

donkey

Hi lonewolff,

If you are looking to do Win32 API programming your programs will look a lot like a skewed version of C. I recently wrote a help viewer and noticed that there was very little in the way of actual assembly in it, mostly just calling API functions and moving things around. The amount of math was trivial, adjusting a few RECT structures and offsets within structures. If you are already familiar with the API you should get up to speed very quickly.

BTW in the program these are the only assembly instructions I used...

push/pop
mov
add/sub
or/xor/and
test/cmp
jxx
call/ret
inc/dec
shr/shl

Not a heck of a lot when you consider it's over 2000 lines of code, but then the program was largely COM based.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

jj2007

Quote from: Greg on March 01, 2009, 02:56:25 AM
The Intel manuals are very helpful too.

The Intel Manuals are 3.7 (A-Z) + 11 (N-Z) MB pdf's - useful if you know already what you were looking for.

For a start, have a look at \masm32\help\opcodes.chm. As Edgar (Donkey) wrote, you will only need a handful of opcodes to write a Win32 program. The \masm32\help folder is overall extremely useful - \masm32\help\hlhelp.chm is my favourite lecture :wink

BATSoftware

I suggest you download and install the Visual Studio 6.0A help files. This set of help containes a large selection of basic windows API programming information from a time when Windows programing did not involve the .NET crap. You will learn what is really going on in the background of .NET by reading this stuff. In fact, after a while you will start to feal cheap and dirty - just like a crack whore but addicted to M$ brand of mindnumming dope.

donkey

Quote from: BATSoftware on March 01, 2009, 03:30:46 PM
I suggest you download and install the Visual Studio 6.0A help files. This set of help containes a large selection of basic windows API programming information from a time when Windows programing did not involve the .NET crap. You will learn what is really going on in the background of .NET by reading this stuff. In fact, after a while you will start to feal cheap and dirty - just like a crack whore but addicted to M$ brand of mindnumming dope.

.NET is not much an issue, even the new features in Windows 7 like MultiTouch uses the Win32 API and is then invoked by .NET. There is very little that you can say is only available in the managed environment or cannot be at least mimicked in the flat API and this will be true at least for the foreseeable future, the fact that Windows 7 will still have much of it's .NET functionality as a wrapper over the API speaks volumes. Get the latest version of MSDN or the PSDK, at least that way you will have the Vista functions as well.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable