Announcement

Collapse
No announcement yet.

Programming outside of DOS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programming outside of DOS

    OK, this has been itching in the back of my brain for some time now, but I don't even know where to start looking. I see various utilities that run without DOS. That is, they are loaded directly from boot, and are self contained. Bios is obviously one, but I'm thinking about things like secondary boot loaders, and some other utilities and diagnostics I have seen.

    How do you do that? Can PB be used to write programs like that? If not, why not? Seems like PB would be a lovely tool for writing bios add-ins, and there seem to be standards for bootable secondary bios utilities.

    Any input would be appreciated, like I said, I don't even know where to start looking. Thanks.


    ------------------
    What can go wrong will go wrong.
    Anything can go wrong.
    What hasn't?!?!
    What can go wrong will go wrong.
    Anything can go wrong.
    What hasn't?!?!

  • #2
    PowerBASIC programs rely on the PowerBASIC runtime, which is a set of subroutines that interface with both DOS and the BIOS. Since PB automatically links these in to you executables, I don't think it would be suitable for this type of programming. Also, you need control over where in memory your program goes and so forth.

    Writing programs that run without DOS is definitely possible, most likely with assembly language or C. Bear in mind though, that without DOS, you have to provide yourself all the subroutines necessary to interface with the hardware. In effect you must write DOS yourself. Of coures the BIOS does supply a good amount of functionality.

    A few projects whose source code should help you out are:

    lilo
    grub
    memtest86

    A google search should get you the source code. These programs are written in C and assembly and run without any operating system. Lilo and grub are boot loaders (can boot a variety of OSs) and memtest86 is a very handy memory tester program.

    Michael


    ------------------

    Comment


    • #3
      Criss,

      You can't write such code in PB, since it needs DOS installed
      before it can do anything.

      Pre-OS code has to run from the boot sector of the boot drive,
      and is written in ASM.

      Some years ago there was a problem with software trainers in
      my company picking up boot sector viruses on their floppy disks
      as they traveled from site to site. They would get infected at
      one site and then spread the infection to several others. This
      was in pre-internet days, when anti-virus software wasn't so
      commonly employed. And this was not good for our image.

      I solved that problem by writing a custom boot loader. The loader
      ran a little program that could check the BIOS environment and
      determine if a virus had gone resident during boot. If it found
      a resident virus, it displayed a big red splash that even our
      trainers could not ignore . It also disabled the virus and
      auto-disinfected the floppy, but could not do the same with the
      HDD, which would at that point be infected as well. But I had
      them carrying a regular anti-virus disk (F-PROT) to clean the HDD with.

      It worked, too.

      These days all of the diskettes I distribute carry a updated
      version of that program. If you want to see it, its here:
      http://personal.atl.bellsouth.net/l/...o/zefrboot.zip

      The zip contains an SFX floppy disk image. (When the disk boots
      it will display a help file, then start a little data recovery
      program - you can just ESC your way out of those).

      If that's the kind of thing you have in mind, just email me
      (my addy is in the docs on that disk), if you want the source
      code and the installer.

      Bob




      ------------------

      Comment


      • #4
        Chriss,

        if you are still interested to use PowerBasic without DOS, you can use my bootloader which I posted in the source code section.

        This bootloader provides sufficient INT 21h support so that a PBDOS program can be run without DOS. It will boot the program from a 1.44 floppy, however, this floppy can be used to make a bootable CD as well.

        I provided two PB sample programs which can be run using this bootloader. I also got the game Connect4 to work.

        As long as the loaded program just does print to screen, keyboard input, serial I/O or calculations it can be run. If you do file operations or use other DOS functions it will crash.

        Georg

        ------------------

        Comment


        • #5
          Thanks Bob and Georg for the cool tools.

          What can go wrong will go wrong.
          Anything can go wrong.
          What hasn't?!?!

          Comment


          • #6
            Very cool. This is something I figured didn't/couldn't exist.
            I've got some uses for this that I was dreading trying to write
            in asm. Thanks, you just made my job a *lot* easier.

            ------------------
            http://www.softcon.com]


            for hosting/internet


            access.

            Comment


            • #7
              Just a small correction. The BIOS (Basic Input/Output System)
              is embedded in a ROM or EPROM chip on the motherboard, and gives
              the basic capability for booting from a floppy, CD, or HDD. As
              memory capacity has gone up, BIOS functionality has been expanded
              to provide more services, which you can access and modify with
              the Setup capability.

              There is no universal way to get into the Setup mode on every
              PC. It depends on model and manufacturer. You have to do it
              just before the PC's boot loader begins booting up the system.
              Sometimes it is activated by holding down the F1 or F2 key as
              the system starts, some computers require the Ctrl+S key combo,
              and I've seen where the vendor required a special Setup boot
              floppy to get into it. Details usually are displayed briefly
              on the screen as the system starts up or are covered in the
              owner's manual.

              You can replace the BIOS used with your system with a more
              current version, but increasingly, venders are providing
              firmware upgrades that update the BIOS when you download and
              install them. This is something else to check for when you
              visit the download section of your vender's web site.

              It's somewhat surprising that competent and informed people
              with PC skills may have never visited the hardware venders'
              sites for their PC, network card, video card, sound card, modem,
              printer, and other peripherals. There are frequently free
              downloads, patches, and drivers to wring better performance out
              of that piece of equipment that you bought in the last few years.


              ------------------
              Old Navy Chief, Systems Engineer, Systems Analyst, now semi-retired

              Comment

              Working...
              X