The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: TmX on June 13, 2006, 02:13:29 PM

Title: Where to start ?
Post by: TmX on June 13, 2006, 02:13:29 PM
My first encounter with asm is in Win 2000 (MASM32 & HLA).
Back to the good old DOS era, I never learn asm, such as TASM.
So, where to start learning asm, since it very different from another languages,
such as C or Pascal ?
Title: Re: Where to start ?
Post by: Ossa on June 13, 2006, 02:33:56 PM
Hi TmX, welcome to the board!

You'll find that ASM is nearly as easy as C once you've been using it for a bit, so no need to fear.

There are plenty of tutorials and lots of example code in the MASM32 package (which I assume you have).

It comes with Iczelion's Windows 32-bit Assembly tutorials, but they are also online at: http://spiff.tripnet.se/~iczelion/tutorials.html

As for other resources, I wrote a small tutorial a few years ago which some liked and some didn't: http://ossa.the-wot.co.uk/tutorial_asm1_tex.htm

For reference, you will want to download a copy of the Intel manuals (or the AMD manuals - they cover the same stuff and, yes, anything you write for one will work on the other): http://developer.intel.com/design/Pentium4/documentation.htm (scroll down to the "manuals" section).

Once you have the basics down, you should look at Mark Larson's optimisation tutorials: http://www.mark.masmcode.com/

Of course, if you have any other questions, the great people will be able to help.

Hope some of that helps,
Ossa

(sorry for the "genericness" of the post... I got most of the links from one of my older posts)
Title: Re: Where to start ?
Post by: dsouza123 on June 13, 2006, 03:09:10 PM
This is a minimal example of a GUI MASM32 program, MASM32 can also produce console based programs.


; #########################################################################
;
; This is a minimal GUI based program for MASM32.
; It displays a MessageBox, waits for user response, then exits.
;
; It needs to be Assembled & Linked to produce mini.exe
;
; #########################################################################

      .386                   ; minimum CPU needed to run program on
      .model flat, stdcall   ; flat memory model, standard call default
      option casemap :none   ; case sensitive

; #########################################################################

      include \masm32\include\windows.inc  ; predefined values for constants etc
      include \masm32\include\user32.inc   ; include file for user32.dll
      include \masm32\include\kernel32.inc ; include file for kernel32.dll

      includelib \masm32\lib\user32.lib    ; library file for user32.dll
      includelib \masm32\lib\kernel32.lib  ; library file for kernel32.dll

; #########################################################################
    .data
      szDlgTitle    db "Minimum MASM32",0
      szMsg         db "  --- Assembler Pure and Simple ---  ",0

    .code
start:

    ; ------------------------------------------------------------------
    ; The following are the function calls using MASM "invoke" syntax.
    ; It is clearer code, it is type checked against a function prototype
    ; and it is less error prone.
    ; ------------------------------------------------------------------

    invoke MessageBox,0,ADDR szMsg,ADDR szDlgTitle,MB_OK
    invoke ExitProcess,0

    ; ------------------------------------------------------------------
    ; The following are the same function calls using push, call syntax.
    ; ------------------------------------------------------------------

    ; push MB_OK
    ; push offset szDlgTitle
    ; push offset szMsg
    ; push 0
    ; call MessageBox

    ; push 0
    ; call ExitProcess

end start
Title: Re: Where to start ?
Post by: Mark Jones on June 13, 2006, 04:57:45 PM
Hi Tmx, also see the AMD developer pages:

http://developer.amd.com/documentation.aspx
Title: Re: Where to start ?
Post by: TmX on July 03, 2006, 02:43:00 AM
Those are nice  :bg
But ... I need a tutorial on the assembler itself (using opcodes,registers, etc...)
Don't want to rush to Win32 API programming  :bg
Title: Re: Where to start ?
Post by: Ossa on July 03, 2006, 10:00:27 AM
Once again, take a look at the tutorial I wrote: here (http://ossa.the-wot.co.uk/tutorial_asm1_tex.htm)

Also Tomas Bleeker's Tutorials here (http://www.madwizard.org/view.php?page=tutorials.contents) might help.

Ossa
Title: Re: Where to start ?
Post by: dsouza123 on July 03, 2006, 02:10:44 PM
In the MASM32 package there are 9 help files,
with 5 addressing assembly language and it's use/formatting in MASM.

They are very easy to access using the MASM32 editor.
Click on Help on the menu and then click on one of the help files.

The direct files are:
opcodes.hlp
masm32.hlp
asmintro.hlp
hlhelp.hlp
fphelp.hlp