Monday, March 19, 2012

How execute the assemble program by using nasm

How execute the assemble program by using nasm 

After the installation of assembler here is a explanation of a  assemble a little bit but with highly understand of how processor works  .
here first thing how assemble program can be written :
the code or syntax is so easy as such English  ,before start programing just  having the little knowledge for register :
now, the codes begun .
        

           mov ax,15                        :move 15 to ax register   
           mov bx,10                      :move 5 to ax register 
           add ax,bx                       :move 5 to ax register 
           mov bx,15                      :move 5 to ax register 
           add ax,bx                       :move 5 to ax register 

>>here ax is a register in which we put the operand (operand are on which operation can be perform) 15 to ax, this is the instruction which we give in first line .

>>now come on second instruction here we put the value of 10 in bx register

>> ax ,bx and what ever register use in it are know according to assemble is destination and the code which we provide to operate is source


>> so all above the code should be understand, now type the program in a text-editor which is more convenient to you (e.g Notepad ,Dos ,etc)

>> now the think in that which is confusing is that [ORG 0x100] and mov ax,0x4c00
int 0x21 ,this are the instruction which we will learn in above classes for now just for execute the program we need that otherwise system perhaps shutdown or restart .
 
Add caption
>> After that typing the program in notepad file save it with extension .asm  for example  


>>here new is file name and .asm is extension
>> save the file into the nasm folder in c:> programs file>.
>> now assemble the program by nasm we run nasm



>>here in assembler we give the command to nasm that::
    c:\program files \nasm> nasm new.asm -o new.com -l new.lst
that command tell the nasm that new.asm file which we created make its com file and listing file by (-o , -l). now check that 2 files are created in nasm folder.
after that nothing is happen but assembler do it its work now type another command to nasm

c:\program files \nasm> edit new.lst




after enter it new window is open





that is the screen which show both high level language or low level,and how processor  learn our command by using hexa decimal  the explanation of a program exceed on next post INSHALLAH

No comments:

Post a Comment