+ Reply to Thread
Results 1 to 3 of 3

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

  1. #1
    Newbie Kuto is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    9

    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 09:41 AM. Reason: Please use code tags when you are posting your codes!

  2. #2
    The Crazy One TkTech will become famous soon enough TkTech's Avatar
    Join Date
    Jun 2006
    Location
    Canada
    Age
    18
    Posts
    1,549
    Blog Entries
    1

    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...

  3. #3
    Newbie Kuto is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    9

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

    Thank you friend.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

     

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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