News:

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

Getting Started

Started by Akash, December 31, 2011, 08:33:19 AM

Previous topic - Next topic

Akash

Sorry if I started this in the wrong place. Introducing myself, I'm not a beginner to Programming  :bg . I know VisualBasic, FreeBasic, C and Pascal. But, now I want to learn Assembly Programming. I couldnot find any file meant for beginners to Assembly in MASM32 Installation Folder. If I'm not wrong there should be one with proper guide for the beginners to ASM. So, could you please refer me to some PDF/CHM help files that can make me start reading and writing ASM.  :toothy

Thankyou ...   :8)

MichaelW

Try the \masm32\help folder, starting with asmintro.chm.
eschew obfuscation


Akash

 :U Thank you. I really appreciate your help. I had almost started learning Randy Hyde's HLA (The Art of Assembly Language) but I read someone criticizing it for being a bit Basic(ish) rather than ASM(ish). So I stopped it.

Thank you.  :cheekygreen:

jj2007

Quote from: Akash on January 01, 2012, 08:16:39 AMI read someone criticizing HLA for being a bit Basic(ish) rather than ASM(ish).

What you write is misleading.
First, HLA belongs to the family of languages that require, for unknown reasons, semicolons at the end of each line (I am allergic against semicolons and brackets of all sorts)
Second, Basic is a wonderful language provided it gets assembled with ml.exe or Jwasm :8)

braincell

Hi,

I also just wanted to introduce myself and say I'm not a bot.
I'm going to construct my question and post a topic tomorrow.
I'm really glad I found this forum, I'm quite new to ASM.

Cheers


anunitu

Assembly is not really hard,as Hutch says assembler in a windows environment is much easier than the old DOS assembler,you had to understand memory segments, and if you wanted something like a GUI,you would have to grind yourself some code to make it happen.

dedndave

DOS wasn't that hard, really
it's not like you need to be a math major to grasp segmented addressing

what makes modern programming difficult is the OS - much more complex
but then, for every additional thing there is to learn, there are more features available

Akash

QuoteWhat you write is misleading
Sorry if it is/was offensive. But, someone wrote it that way.

Quotesemicolons at the end of each line
:thumbu I agree with you but, they can be helpful when writing multiple statements on line (in C, Pascal).

QuoteSecond, Basic is a wonderful language provided it gets assembled with ml.exe or Jwasm
I am not talking about MASMBasic but, I am one of those lazy people who is just too tired with EndIF  :'(


I am not a Programmer (and am/was not a Computer Science Student either) though I have plan(s) to specialize in IT in the future  :wink . But, got interested in programming somehow and am addicted of it. ASM has and gives power one can't get any with other languages. :bdg

But, which one is better amongst MASM and FASM ? FASM seems quite a popular choice among many people.

jj2007

Quote from: Akash on January 05, 2012, 05:51:06 AM
QuoteWhat you write is misleading
Sorry if it is/was offensive. But, someone wrote it that way.

I was just joking, Akash. Welcome to the Forum :thumbu

Akash

Please accept my apologies for reviving this (almost)dead-thread. But, I read some intro files and got that mov copies data/values into registers.

ecx is a 32 bit register. Just for example:

var
    i : integer;

begin
i := 2;  // i equals 2
end.

then, in MASM, it should be (i suppose,)

mov ecx, 2

but, what is ecx ? This is my question which none of the help files seem to answer. I mean, it is a 32 bit register (in memory,) but, what should I supose ecx should mean?
I mean where will ecx store my 2. Just like i := 2 in Pascal (i stores 2). And, most importantly, when should I figure out what register to use when I have to store something else like characters and others ? When should I understand that I should use ebx,edx and others. When I mov a value into a register (like ecx) and then if I use ecx again, will the ecx be overwritten ?

The only thing I understood as I read Assembly are PUSH and POP.
Sorry for this stupid question/s. But, this is what is making me feel my question is stupid.

Thanks ..



dedndave

ECX is a one of the "general" registers in Intel 32-bit CPU's
the general registers are named EAX, EBX, ECX, EDX, EBP, ESI, and EDI
another register is ESP - the stack pointer
and another is EIP - the instruction pointer, which you cannot access directly
EAX, EBX, ECX, and EDX may also be accessed as words or bytes



they are really just names, but they do have some meaning

EAX - accumulator (EAX and EDX are typically used to hold data)
EBX - base index (may be used to hold addresses - on newer CPU's all general registers may be used to address data)
ECX - count (may be used to hold the iteration count for loops)
EDX - data (sometimes, EDX and EAX are used together to hold 64-bit values)

EBP - base pointer (typically used to hold a stable location on the stack)
ESP - stack pointer (used to hold the current stack location)
ESI - source index (may be used to hold the address of a "source" string)
EDI - destination index (may be used to hold the address of a "destination" string)

EIP - instruction pointer (the location of the next instruction to be executed)

there are several other regsiters for the FPU and SIMD instructions, as well as "segment" registers
for now, worry about the ones listed above   :P

here is some suggested reading - start with chapter 1
http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/toc.html

mineiro

Ecx is a register Sr Akash, and a register is suposed to store some numbers. (binary numbers or if you like, hexadecimal numbers).
You can think in the same way if you have a shoebox. Each box have (or not) shoes inside it, and if you are talking about 16 bits registers, so you can have 16 shoes inside that box, in your case, you are talking about a box that can hold 32 shoes. In eletronic, we call this flip-flop.(a chip that can hold one bit (shoe)), but joined with others, can hold so much bits.
So, you have named that box with the name of "eCx", because you like to "Count", or "eAx", "Acumulator", or use that box with union (or not) of other box , so eBx(Base), or hold some Data(eDx) in that box. Playing with assembly you have freedon to store numbers in any box that you like, but some instructions(mnemonics) are registers specific. Read about "loop" instruction and you will see that the number stored in "ecx" will be decremented each time.
Your question is when numbers will be numbers, and when numbers will be data, because all inside computers are numbers. We define this, the programmers.
An example is; the number "30" in hexadecimal, can be some counter, so it will be a number (signed or not), but if you throw this number to screen, you will see a representation of 0 (yes, that zero that you are reading) number, so the number will be data.

Quote from: Akash on January 17, 2012, 08:32:30 AM
When I mov a value into a register (like ecx) and then if I use ecx again, will the ecx be overwritten ?
Yes, but you can save ecx before changing it using "push" and after, restore it using "pop"


mov ecx,2              ;ecx after processed = 2
push ecx                ;saving ecx in stack
mov ecx,1              ;after processed ecx=1
pop ecx                 ;after processed ecx = 2


FORTRANS

Hi,

   A register is a piece of memory with some special features
added on to it.  Like any memory location, you can store and
retrieve values in it.  And you can do logical and arithmetic
operations on its contents.  A register is special in that it is built
into the CPU and has added functionality, like being used for
addressing or indexing memory external to the CPU.

Regards,

Steve N.

Akash

#14
Thank you all for the help. I really appreciate it.  :thumbu

Looks like I really have to continue with THE ART OF ASSEMBLY LANGUAGE Book.  :eek Too  bad for me that I stopped it the last time ..  :(

And I suppose this (attached picture in zip) one is just a false positive of Avira Antivirus. Am I right ?
Thank you all ..