News:

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

Learning Assembly for fun

Started by frktons, February 15, 2010, 03:22:29 AM

Previous topic - Next topic

jcfuller

Hutch,
  I hear you and concur. I started assembly programming on an Atari 800XL using MAC65, which was, as the name suggests, a macro assembler for the 6502 processor.  If I remember correctly I think there was even  a pretty  complete "basic" composed of macro's at the time.

James

jj2007

Quote from: jcfuller on February 21, 2010, 10:35:48 AM
If I remember correctly I think there was even  a pretty  complete "basic" composed of macro's at the time.

When I wrote MasmBasic, I got a suspicion that the early BASIC's that required the Let keyword were done that way - just macros. Masm is incredibly versatile in this respect.

hutch--

It tends to be an issue of priority stacking, I have always treated assembler AS assembler, not an appendage to another language and while I happily write code in compilers, I use an assembler for what it is good for, complete architecture freedom, massively powerful facilities, as many library module as you want to write and the choice of how high or low level you want to write.

When I hear people talking about writing pure assembler my mind hearkens back to the old brigade that left assembler as a shambles that no-one used and most laughed at. They don't seem to laugh any more.  :P

What was even funnier was the old fellas cobbling together a few DOS interrupts were simply using the TSR runtime library that was part of the OS, there was nothing pure about it and while anyone who has written this type of code can write it like an assembler dump, if it is ever going to be seen by anyone else or maintained or fixed then it gets written very differently. Badly written code of any flavour suffers all of these problems and assembler is no different from the rest when its badly documented and poorly laid out.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

frktons

Hi everybody!

Very good point of view you are expressing, and in many ways I agree with most of them,
even if they apparently look different or opposite.  :dazzled:

I've looked around, searched the internet, and collected some infos and tools for starting my holidays on "ASM-beach" as I prefer to imagine it.

From what I have got, till now, it looks like:

-MASM is well and healthy, still upgraded by Microsoft, but with lesser infos as time passes by.
After MASM 6.1 the docs tended to disappear, and it's hard to know if there are new opcodes or functionalities
as ML stepped from 6 to 9 in the last 12 years or more. I guess there are many.  :8)

-NASM is a growing tool, with lots of free e-books and tutorials, also Video Tutorials. :eek

- many other good assemblers growing up [FASM,GOASM and so on].

From the point of view of a novice assembler student, "me", NASM looks more attractive for the
quantity of infos you can freely find around.

Probably from the point of view of experienced assembly programmers, MASM is a more powerful tool, and even if there is a partial lack of infos, it doesn't matter for them, they can manage to use it anyway.

Macros are wonderful extras, but they "appear" more like "advanced stuff" for any programming language than starting points to learn  from zero. It is very nice to know they are available, anyway. :bdg

Of course I lack assembly experience and expertise, so what I've found could be a very small and partial
view of the whole.

By the way, I'd like to express my opinion about the samples I've found around for the Hello.asm gem.

It's always simpler to write a piece of code than to explain it, as I've learned in my 30 years of coding.

From dos to linux to windows console and gui examples, I've noticed very few explanatory comments.

One of the best documented one goes like:


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

;                 Build this with the "Project" menu using
;                       "Console Assemble and Link"

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model
    option casemap :none                    ; case sensitive

    include \masm32\include\windows.inc     ; always first
    include \masm32\macros\macros.asm       ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc

  ; ------------------------------------------------
  ; Library files that have definitions for function
  ; exports and tested reliable prebuilt code.
  ; ------------------------------------------------
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib

    .code                       ; Tell MASM where the code starts

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

start:                          ; The CODE entry point to the program

    print chr$("Hey, this actually works.",13,10)
    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start                       ; Tell MASM where the program ends


When the first line of code is written, in my opinion, it should be a line of comment, explaining itself, something like:

; This line is a comment. Every line starting with a ";" is a line of comment in this Assembly sintax....

If there is a line of code like:

mov eax, 123

what I need to know is what is "mov" [OK I guess what it is], why I am using this
"opcode" and what an opcode is, and why I use 123 instead of 234 or anything else.

So 1 line of code could need 10 lines or more of comments to explain all the stuff that instruction means or, at least, the important ones.

This is what I really need when I look for a tutorial.  

I don't know if a tutorial like this exist, but it would cover almost all my needs to start learning assembly.

Some more days to analize the stuff I collected, and I'll know if there is something that suits my needs.  :bg

Bye and enjoy

Frank





Mind is like a parachute. You know what to do in order to use it :-)

BlackVortex

Just because MASM documentation is outdated, it doesn't mean it's useless. All ml.exe versions are compatible, so don't worry about it. The best tutorials are Iczelion's (google it, it's a whole series)

Also, when you see unknown API names after invokes, they're usually windows APIs and you can searh MSDN for them. If they aren't APIs, then they're functions, maybe in one of the include files. Those are documented in the MASM32 docs. Opcodes are there, too.

For starters, keep close to Iczelion's programming style.

QuoteSome more days to analize the stuff I collected, and I'll know if there is something that suits my needs. 
I hope you meant "analyze"   :cheekygreen:

frktons

Quote
I hope you meant "analyze"   :cheekygreen:

I did, indeed, my dude  :lol

but "analize" is more funny and this topic is "just for fun".  :cheekygreen:
Mind is like a parachute. You know what to do in order to use it :-)

hutch--

Frank,

With MASM, the documentation from version 6.0 is still basically current with notation and the macros. Microsoft have slightly updated the documentation that is on MSDN but very little has changed over a long time. What they do is add extra instructions as they become available and in the case of 64 bit, the have a 64 bit version ML64 but it is not fully developed yet as it does the job they need.

NASM is a good choice if you are aiming at multiple platforms but it is different from historical Intel notation so you will have to get used to it. It will certainly fill the category of recreational programming.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

and, btw, Frank....
Next Generation was my fave   :P



sorry - no Franktons, there
but, how about that red-head ?
oh - and seven of nine, too

frktons

Thanks for the feeds-back  :thumbu

There are enough ebooks and docs around for MASM-6, I think, so merging
the infos step by step could give me a good idea of the whole matter.

regards

the Borg-girl from Voyager serie was gorgeous  :P
Mind is like a parachute. You know what to do in order to use it :-)

qWord

Quote from: dedndave on February 22, 2010, 12:42:54 AM
Next Generation was my fave :P
Data was the best of all  :toothy ... unfortunately he died in the one of the last movies.
FPU in a trice: SmplMath
It's that simple!

dedndave

yah - that borg girl was Seven of Nine - she was introduced in "Next Generation" (played by Jeri Ryan)
also not shown in that pic is Lt Torres - half klingon + half human = total babe   :bg
(played by Roxann Dawson)

Data was fun, but i think he was programmed in C   :bg
he was unable to use contractions
i sometimes suffer from that problem when i type - lol

hutch--

I certainly like the second series the best, its production techniques are a bit old by today's standards but it often had a plot and I liked both of the ladies in it, Marina Sirtis and the lady standing next to Picard who was not only good looking but could dance and do many things.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

and - - she was a Doctor, to boot !!!
ahhhh - to be a "cared for" man   :bg
Gates McFadden is her name
i got the first couple seasons from torrent, and a few later episodes
then, my isp cracked down on torrents - oh well   :(

GregL

I have never had a good experience with torrents, straight downloads work much better for me.

Re. Star Trek, personally I prefer the original series, I just got done watching all three seasons, took me a couple of months. They're available on DVD and Blu-Ray.


hutch--

 :bg

Yes, Gates McFadden, always liked her, genuine talent there and looks like a nice lady as well.

I did like marina Sirtis though, I saw her years later in a movie playing a Russian military officer and she still had the talent. Nice Greek girl.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php