Announcement

Collapse
No announcement yet.

Reboot using PB 3.5

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

  • Reboot using PB 3.5

    How do I cause the PC to reboot from within a Power Basic 3.5 program?

  • #2
    There is some reboot code in the EXAMPLE or FAQ folders supplied with PB3.5.

    Note that some Windows platforms (ie, Windows NT/2000/etc) may not actually permit a system reboot to occur, but it should work fine for plain vanilla DOS systems.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Steve - try this:

      Code:
      DEF SEG = &HFFFF
      Z& = &H0000
      CALL ABSOLUTE Z&	'--jump into the BIOS "Cold Boot"
      This is the restart code I use in all of my embedded-systems programs(*) - which are all plain-DOS based, so as Lance says, this isn't necessarily guaranteed to work from within Windows...

      (* A cold-start is necessary on most embedded-systems boards if you're using a Flashdisk module such as the M-Systems' Disk-On-Chip, I've discovered, because the DOC's BIOS extensions don't get reinitialized on a warm-boot and the flashdisk suddenly "disappears".)

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

      Comment


      • #4
        It should be noted that if you can reboot within windows, you
        will probably get the scandisk routine the next time you boot.
        Windows uses something in the partition or boot sector (I don't
        remember which) to tell itself if an orderly shutdown has been
        performed or not. If it hasn't, then it will do the scandisk
        thing. If you can reboot within windows, the orderly shutdown
        flag will not have been set and .......


        ------------------
        There are no atheists in a fox hole or the morning of a math test.
        If my flag offends you, I'll help you pack.

        Comment


        • #5
          ...which is not necessarily a bad thing since, if your DOS program is able to reboot the system from within Windows, an orderly shutdown won't have been performed.

          The only way I can think of to get around that, is if you can figure out how to call the Windows "shutdown" service from within the DOS box.

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

          Comment


          • #6
            You are right Gary. It's not necessarily a bad thing. Windows
            will go ahead and boot normally after the scandisk. I only
            mentioned this to keep shivers from being generated in ones
            spine should this occur.


            ------------------
            There are no atheists in a fox hole or the morning of a math test.
            If my flag offends you, I'll help you pack.

            Comment


            • #7
              Originally posted by Mel Bishop:
              You are right Gary. It's not necessarily a bad thing. Windows
              will go ahead and boot normally after the scandisk. I only
              mentioned this to keep shivers from being generated in ones
              spine should this occur.


              The code Gary posted worked fine for my app. I am running DOS on an embedded system and have no Windows worries...

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

              Comment


              • #8
                Steve - if you'd rather do a warm-boot instead and bypass all the cold-boot POST tests, then
                Code:
                CALL INTERRUPT &H19
                will also work. Just beware of the caveat mentioned above if you're using a DiskOnChip or some other FlashRAM module which masquerades as a hard drive; the DOC's BIOS extensions will fail to reinitialize on a warm boot. (This is one of those lovely "undocumented features" M-Systems fails to mention in their datasheets. Drove me nuts for about two days trying to figure out why my C: drive kept disappearing... at first, I thought it was a defective module, but it turns out they all do it.)

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

                Comment

                Working...
                X