difference between win32,dos and linux assembly
Results 1 to 7 of 7

Thread: difference between win32,dos and linux assembly

  1. #1

    difference between win32,dos and linux assembly

    hi guys,

    i've just started to learn assembly, i've got a couple of tutorials and a couple of assemblers (Tasm,Masm32,LZasm,Goasm,Nasm) , but somehow i've started with one tutorial, written a program, try to assemble it, and all i got was a bunch of errors...

    Code:
    .model small
    .stack
    .data
    message   db "Hello world, I'm learning Assembly !!!", "$"
    
    .code
    
    main   proc
       mov   ax,seg message
       mov   ds,ax
    
       mov   ah,09
       lea   dx,message
       int   21h
    
       mov   ax,4c00h
       int   21h
    main   endp
    end main
    this was the source. i've tried assembling it on linux --> no good, try do do it with masm32,LZasm,GoAsm,Tasm on Windows --> no good either...

    so i guess this is a DOS tutorial, but how can i see the difference?? i eventually want to learn assembly for win32 and linux, mostly because i would like to use a debugger if necessary, and so i must be able to read/understand assembly...

    this is the tutorial i've found for win32 here, great tutorial b.t.w., but like i said, how can i see in the code if a program is written for DOS assembly, Linux or win32 ???

    i've tried google for this, but none of the things i've found were very clear

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Posts
    339
    Well, int 21h was originally a DOS interrupt call, so it can't be used in Linux. But you can still use it on the DOS/Command Prompt in Windows. (See below note).

    how can i see in the code if a program is written for DOS assembly, Linux or win32 ???
    I think the author should've explicitly explained it, since assembly language is always architecture (hardware and OS) specific.

    Note:
    Here's how I test the int 21h function call on my XP box. I open a command prompt then use the good ol' debug command:

    C:\>debug
    -a100
    1389:0100 jmp 110
    1389:0102 db "Test INT 21h$"
    1389:010F nop
    1389:0110 mov dx,102
    1389:0113 mov ah,9
    1389:0115 int 21
    1389:0117 int 20
    1389:0119
    -g
    Test INT 21h
    Program terminated normally
    -q
    C:\>


    Peace always,
    <jdenny>
    Always listen to experts. They\'ll tell you what can\'t be done and why. Then go and do it. -- Robert Heinlein
    I\'m basically a very lazy person who likes to get credit for things other people actually do. -- Linus Torvalds


  3. #3
    Senior Member
    Join Date
    Apr 2004
    Posts
    1,130
    you can see the diference between the code looking for system calls or HL API.
    as Jdenny stated, assembly is hardware oriented. So you are programming at your pc, you are using IA-32 archicteture (a.k.a. Intel 32-bits). Basic instructions are connected to what Intel has specified on that (you can get book from Intel side).
    --- there is some extensions to that archicture that arent present on every machine, such as SSE2 (intel) or 3DNow (AMD) ---
    If u look thru the code, you will see eventually a system call/API. On that, you can identify the target platform (Win/*nix).
    Meu sítio

    FORMAT C: Yes ...Yes??? ...Nooooo!!! ^C ^C ^C ^C ^C
    If I die before I sleep, I pray the Lord my soul to encrypt.
    If I die before I wake, I pray the Lord my soul to brake.

  4. #4
    thanks, this will surely help me

  5. #5
    Junior Member
    Join Date
    Aug 2004
    Posts
    11
    lepricaun, complementing what everyone else said, I consider the best way to find out what architecture the source file is designed for is to analyse the program structure, because, like jdenny said, different archictures require assembly programs to be built in different ways, and that could be a difficult task for beginners. I recommend you stick with DOS for a while (because that's the system most beginner tutorials use) and then move to a more complicated platform when you're used to all the assembly mnemonics, syntax and paradigm.

    There are excellent free assembly tutorials and resources by Randall Hyde available here:
    http://webster.cs.ucr.edu

    Start on Art Of Assembly and then move on to your architecture of choice.
    Have fun!

    and yet some more excellent assembly for win32 tutorials and resources available here:
    http://www.win32asm.cjb.net

  6. #6
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    C:\>debug
    -a100
    1389:0100 jmp 110
    1389:0102 db "Test INT 21h$"
    1389:010F nop
    1389:0110 mov dx,102
    1389:0113 mov ah,9
    1389:0115 int 21
    1389:0117 int 20
    1389:0119
    -g
    Test INT 21h
    Program terminated normally
    -q
    C:\>
    Lol, that's funny, I always found coding assembly annoying in debug because I had to count on which offset I would declare something. That jump in the beginning solves that. Lol, that I never thought of that.
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  7. #7
    thanks for the links, i'll go and check it out...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •