News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A small Assembly language program to start learning in MASM32 ?

Started by sunshine33, January 08, 2019, 02:56:09 PM

Previous topic - Next topic

sunshine33


hutch--

Sunshine,

It will depend a lot on what you already know. The MASM32 SDK was designed for people who already knew how to write Windows code in a compiler in languages like C, Pascal or Basic who are familiar with how programming logic works, allocating memory, calling system functions and the list goes on. If you have this experience, the progression to assembler programming will make sense even though it is a steep learning curve for experienced people.

If you don't have that type of experience the best advice is to learn a proper programming language that deals with the lower level stuff, direct memory control, file IO, graphics, data etc .... and when you know enough you can always come back to assembler programming.

sunshine33

hutch-- ,

Thanks a lot for the reply

I have completed my Bsc computer science degree .

I have some programming knowledge

I have done small small programs at college with C , PHP etc

I think i know how to read elements into the array and all

I have been making notes about assembly language too , But most of the programs i learn are semi advanced

I have been trying to learn MASM32 by making notes whenever i get free time ,

I want to learn MASM32 programming a bit more seriously .


[spoiler]

[/spoiler]

I am looking for a much smaller program than this too

HSE

Sumshine,

Sound like you need some elemental assembly first. The Art of Assembly from Randall Hyde perhaps it's a good option.  There is a 32bit version but not so clear, I think.

Equations in Assembly: SmplMath

jj2007

You can find essential advice at http://www.webalice.it/jj2006/Masm32_Tips_Tricks_and_Traps.htm (and you can happily ignore the MasmBasic part). Especially the \Masm32\examples folder is full of good and simple stuff.

aw27

#5
If you are a Generation Y or Z buddy, you may try to learn it from Instagram.
https://www.instagram.com/explore/tags/masm32/

You can also try Fakebook where there is a guy saying "Easy way to program in MASM32! GUI creation like Visual Basic" (I wonder who this guy can be  :badgrin:)
https://www.facebook.com/masm32pro/

sunshine33

Thanks a lot for the reply everyone.

Yup now i know where i should be looking at , \Masm32\examples

:biggrin:

TBRANSO1

Quote from: sunshine33 on January 08, 2019, 02:56:09 PMI am not exactly sure where to start .

Please help

I am finally past the beginner start phase.  I understand the feelings.

I started with the essential hello world program with the MessageBoxA.  I then just added features to the message, like looking up the MSDN docs and learning how to change the button. We don't have to worry about the handle inheritance right now.

I did the hello world, both with using INVOKE and then call by pushing in the parameters on the stack.  I then would create the .lst file, and the .pdb files to debug it to see what is going on the inside.  I then created the exact same thing in C++, and then created the assembly and disassembly files and compared them to mine.  I then got more adventurous after having mastered the hello world MessageBoxA, and thought how to do the require Fibonacci or Factorial and write the results to the MessageBoxA.  I then found out how to print a line to ask the user for the number input with the WriteFile and ReadFile API using the STDOUT and STDIN handles, then call the MessageBoxA to show the results.

Do you get the drift?

I have also kept open in my browser these links: and constantly refer to them... CONSTANTLY!!
1. https://docs.microsoft.com/en-us/cpp/assembler/masm/microsoft-macro-assembler-reference?view=vs-2017
2. https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=vs-2017
3. https://docs.microsoft.com/en-us/cpp/build/configuring-programs-for-64-bit-visual-cpp?view=vs-2017
4. http://cs.lmu.edu/~ray/notes/nasmtutorial/  - converting from NASM to MASM is a lot easier than at first sight
5. NASM.org has a tutorial and great documentation too

There are more links: but I just like to read other folks code.  I am finally at the point that I can poke around Hutches libraries and understand about 80% what is going on... I am doing the same with Irvine's library, as well as the simple io files that I found for Dandamudi's Assembly textbook.

Finally, I just take simple example scripts from the MSDN catalog and convert them to assembly.  Or I take some of the simple C library functions like strcat, memcpy, strlen, etc.. and do them in assembly.  It's practice, and what you usually find is that either it's a lot more challenging than at first thought, but it teaches you which registers to use, which byte sizes and more.

Lastly, keep at it.  I love assembly.  And I'd write a few simple class structure C++ programs with pointers and such and then read the disassembled file, you'll find that hidden under all that scary boilerplate language are just references and pointers to data stored somewhere.

The toughest part of the learning curve has been that when I found code written like over 20 years ago, I didn't know enough, until recently, that it wouldn't work because it was written in MS DOS or some kind of pre modern processing language, then I had trouble understanding the difference between ATT/INTEL and NASM/MASM stuff, and again was too dumb to realize that I can't mix and match the syntax...  :icon_rolleyes:

Now, I am trying to wrap my head around stacks alignments, calling conventions, etc...  it's a painful learning curve (to the computer that is), when you clobber registers... misalign the stack, destroy return statements... I think that I blew up my BlueTooth driver somehow...  :eusa_clap:

I use VS 2017 IDE, it's wonderful.  But I also use WinDgb. SASM IDE, but when I want the extra challenge I just use Notepad (not Notepad++) and use the command line to assemble and link and debug.

:dazzled:

jj2007

@TBRANSO1: You made incredible progress in the 40 days since you joined, compliments :t