Find the answer to your Linux question:
Results 1 to 6 of 6
Hi everyone, I am trying to learn OS fundamental from a programmers perspective and currently studying on real mode programming.I have experience with protected mode but never actually did something ...
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    9

    Real Mode Programming

    Hi everyone,

    I am trying to learn OS fundamental from a programmers perspective and currently studying on real mode programming.I have experience with protected mode but never actually did something in real mode.

    I searched around to see if I can grab some tutorials or etc but nothing significant especially for C (most of them are for assembly)

    My question is;

    I wrote a program in C for protected mode and it works as expected.It does basic disk I/O read() and write(), in real mode I know these functions are available through "int 13" but I have no clue where to start in C.

    Can I switch to or simulate real mode while linux is running ? Is there such a feature?

    Also I would like to know how to port protected mode code to real mode so that ported code will only use bios interrupts.

    Any ideas and help are welcomed!

    Thank you

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    This may interest you...Then again it my not

    bcc(1): Bruce's C compiler - Linux man page

    Check the 'see also' at the bottom of the man page

    Plus this one

    SourceForge.net: Linux Real Mode Interface - Project Web Hosting - Open Source Software
    Make mine Arch Linux

  3. #3
    Just Joined!
    Join Date
    Jan 2010
    Posts
    9
    I know that I need to swtich to vm to call real mode interrupts from protected, but coudln't find a resource that explains the process of this.

    I mean I can only do bios interrupts from real mode but how about porting a protected mode code to real thats where I am stuck.

    Seabios seems really interesting though, I will check it out.

  4. #4
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Quote Originally Posted by n00b13 View Post
    I know that I need to swtich to vm to call real mode interrupts from protected, but coudln't find a resource that explains the process of this.

    I mean I can only do bios interrupts from real mode but how about porting a protected mode code to real thats where I am stuck.

    Seabios seems really interesting though, I will check it out.
    The only time I used real mode was with a boot disk...As for porting a protected mode code to real mode code - is that even practical.

    Your first question can be answered by reading the CPU docs - Intel or AMD provide full documentation.
    Make mine Arch Linux

  5. #5
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,114
    You're probably better off working in DOS.
    Install dosemu. It is a way to run a DOS session under
    Linux. You can then run a real mode C compiler like PCC
    as well as any assembler you choose to write assembly code.

    With dosemu, you can run your own copy of DOS, or the default
    install of freedos

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    The dosemu package might work for you, or you can run DOS in a virtual machine and learn all about real-mode programming and bios interrupt handling all you want without jeapordizing your system. Do run it on hardware that support hardware virtualization however, to better protect your host OS.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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