Closed Thread
Results 1 to 3 of 3

Thread: 16 bit assembly with in Gcc and 16 bit compile (how to?)

  1. #1
    Kuto's Avatar
    Kuto is offline Learning Programmer
    Join Date
    May 2009
    Posts
    48
    Rep Power
    10

    16 bit assembly with in Gcc and 16 bit compile (how to?)

    I want to use inline asm with in gcc. like:
    Code:
    int main(){
    
    asm(
    "movb $0xe,%ah \n"
    "movb $0x65,%al \n"
    " int  $0x10 " );
    
    return 0;
    }
    I could compile and link but didn't work.. it said "segmentation fault".
    what can i do, help me plz..
    Last edited by Jaan; 07-02-2009 at 07:41 AM. Reason: Please use code tags when you are posting your codes!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    TkTech's Avatar
    TkTech is offline The Crazy One
    Join Date
    Jun 2006
    Location
    Canada
    Posts
    1,412
    Blog Entries
    1
    Rep Power
    31

    Re: 16 bit assembly with in Gcc and 16 bit compile (how to?)

    GCC doesn't produce 16bit code. You need to compile it as a separate object file using as and then link it to your final binary using ld with a link script.

    The segmentation fault is likely because your trying to run real mode code under another OS...

  4. #3
    Kuto's Avatar
    Kuto is offline Learning Programmer
    Join Date
    May 2009
    Posts
    48
    Rep Power
    10

    Re: 16 bit assembly with in Gcc and 16 bit compile (how to?)

    Thank you friend.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. how can I run? Compile?
    By Hamed in forum C and C++
    Replies: 10
    Last Post: 10-02-2010, 09:46 AM
  2. compile from notepad++
    By rivci in forum Java Help
    Replies: 16
    Last Post: 05-11-2010, 05:05 PM
  3. Can't Compile
    By tedmp0816 in forum C and C++
    Replies: 4
    Last Post: 10-20-2009, 01:00 AM
  4. Replies: 2
    Last Post: 08-21-2009, 02:32 AM
  5. How to compile?
    By TcM in forum C and C++
    Replies: 9
    Last Post: 06-19-2009, 10:14 AM

Tags for this Thread

Bookmarks

Posting Permissions

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