[comp.lang.pascal] INT 019h question

C0361@univscvm.csd.scarolina.edu ( Thomas Jenkins) (12/07/90)

Hello,

  I have a question which I'm directing to several lists.  I've gotten a
request from a section here that deals with PCs.  They are updating the config
.sys file on pcs, then rebooting.  They wanted to have the program reboot the
system after changes are complete.  When asked, I said call int 019h.  This
will preform a warm boot.  Didn't work.  All my references say 19h has no
arguments and if a certain memory location contains 1234h, no memory check
is done, else a memory check will occur.
  Now I tried it.  No luck.  These are my attempts:

Turbo Pascal 5.5 :


USES DOS;
VAR  REGS : REGISTERS ;
BEGIN
  Intr ( $19 , REGS ) ;
END.

Out come:  Starts reboot, never clears screen or starts autoexec.bat.  System
hangs.

Turbo Assembler:

MODEL IDEAL
.......

START:
         mov         ax,@DATA
         mov         ds,ax

         int         019h

         mov         al,00h
         mov         ah,04ch
         int         021h


ENDS     CODE
         END         START

( some code deletion - relavant stuff here )

Out come:  Same as above.

Now I'm really comfused!  So,  I look in my handy _Mastering_Turbo_Assembler_
by Tom Swan:  Sure enough there's a rebooting module.  The code uses the
BIOSData segment to load the 1234h and then uses a JMP FAR to the reboot
code!!!

Here's my question:  WHY?!?!?!?  Why wont int19h do as written?  I have
already written the short ( 585 byte ) exe file for them, but I'm still
confussed as to why it was done this way.  Any ideas are welcomed.  Respond
tom me or any of these lists as I read them all.

Thanks,

tom

THOMAS E. JENKINS, JR.                +--------+  FROM SHOE  +--------+
                                      |"IS THE COMPUTER STILL GIVING  |
PROGRAMMER,                           | YOU TROUBLE?..."              |
  UNIVERSITY OF SOUTH CAROLINA        |"NO, NOT ANYMORE..."           |
  C0361 AT UNIVSCVM.BITNET            |"WHAT DID YOU DO?..."          |
  C0361 AT UNIVSCVM.CSD.SCAROLINA.EDU |" I TURNED IT OFF."            |
                                      +-------------------------------+

bobb@vice.ICO.TEK.COM (Bob Beauchaine) (12/07/90)

In article <25207@adm.brl.mil> C0361@univscvm.csd.scarolina.edu ( Thomas Jenkins) writes:
>They wanted to have the program reboot the
>system after changes are complete.  When asked, I said call int 019h.  This
>will preform a warm boot.  Didn't work.  All my references say 19h has no
>arguments and if a certain memory location contains 1234h, no memory check
>is done, else a memory check will occur.
>  Now I tried it.  No luck.  These are my attempts:
>

  Beats me.  I thought this would work also, and unless I'm mistaken
  I've used this method myself to perform warm boots.
  Just now, I went over to a AST 286 box and tried to execute a
  INT 19 from debug.  The computer just hung with the A: drive
  spinning.  Peter Nortons guide to the IBM PC does indeed verify
  that int 19H is the BIOS bootstrap loader.  


  Bob Beauchaine
  bobb@vice.ICO.TEK.COM

phys169@csc.canterbury.ac.nz (12/07/90)

In article <25207@adm.brl.mil>, C0361@univscvm.csd.scarolina.edu ( Thomas Jenkins) writes:
> ...  All my references say 19h has no
> arguments and if a certain memory location contains 1234h, no memory check
> is done, else a memory check will occur.
>   Now I tried it.  No luck...

Ralf Brown's interrupt list mentions the problem of interrupt vectors being
changed spoiling the reboot. interrupts up to 1C should be returned to
reasonable values (ie. into ROM), esp int 08.

I haven't had much to do with int 19h, but if you're still stuck I can get help
from a friend for you who knows about such things. I also have a list of what
the interrupts should be pointing to on an original IBM, but you probably need
to see what your particulr machine does with them before TSR's take them over. 

Mark Aitchison.

nobody@kodak.com (Thomas Bullinger, KAG, Tel.: (049-)) (12/07/90)

Hi Tom,
In your article you wrote:

>Now I'm really comfused!  So,  I look in my handy _Mastering_Turbo_Assembler_
>by Tom Swan:  Sure enough there's a rebooting module.  The code uses the
>BIOSData segment to load the 1234h and then uses a JMP FAR to the reboot
>code!!!
>
>Here's my question:  WHY?!?!?!?  Why wont int19h do as written?  I have
>already written the short ( 585 byte ) exe file for them, but I'm still
>confussed as to why it was done this way.  Any ideas are welcomed.  Respond
>tom me or any of these lists as I read them all.
>
>Thanks,
>
>tom

I tried it once the way you did. After failing I looked into some magazines
etc. to look for it:
As far as I know, the INT 19H tries to boot the PC. If it fails, it will
switch to the built-in BASIC. In clones there is none, so it hangs.

So I wrote a tiny little program to reboot the PC and called it BOOT.COM:

	MOV	AX,40H		;Select BIOS Area
	MOV	ES,AX
	MOV	ES:[72H],1234H	;Bypass memory test
				;Set to 0000H to perform memory tests too
	JMP	0FFFF:0000H	;Reboot

This code always works, on PC's, on clones and even on PS/2.

+----------------------------------------------+
| Thomas Bullinger | bulli@kodak.com           |
|                  | bulli@nadia.stgt.sub.org  |
| D-7000 Stuttgart | 76535.2221@compuserve.com |
+----------------------------------------------+
|          Don't worry, be happy               |
+----------------------------------------------+

CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) (12/07/90)

On Thu, 6 Dec 90 10:41:48 EST, C0361@UNIVSCVM.BITNET (Thomas Jenkins)
  wrote:

>  I have a question which I'm directing to several lists.  I've
>gotten a request from a section here that deals with PCs.  They are
>updating the config .sys file on pcs, then rebooting.  They wanted to
>have the program reboot the system after changes are complete.  When
>asked, I said call int 019h.  This will preform a warm boot.  Didn't
>work.  All my references say 19h has no arguments and if a certain
>memory location contains 1234h, no memory check is done, else a
>memory check will occur.
>  Now I tried it.  No luck.  These are my attempts:

[code deleted]

>Now I'm really comfused!  So,  I look in my handy
>_Mastering_Turbo_Assembler_ by Tom Swan:  Sure enough there's a
>rebooting module.  The code uses the BIOSData segment to load the
>1234h and then uses a JMP FAR to the reboot code!!!

[remainder deleted]

As others have pointed out, INT $19 is the bootstrap loader.
Apparently its handling is one of the areas of frequent
incompatibility. I note that TurboPower Software rejected the INT $19
approach in favor of the $1234, JMP FFFF:0000 approach, and that Neil
Rubenking published an inline version of the latter method years back
in PC Magazine. I'm sure I have read before of common (but probably
_not_ IBM) systems hanging from calling INT $19.

JMP FFFF:0000 does not always work either: Depending on
configuration, memory managers such as QEMM will fail to detect your
intent to reboot and will hang the system or the wrong type of boot
will be performed.

On a Compaq 386 20/e running Compaq MS-DOS 3.31, with nothing but DOS
loaded, I see that the INT $19 code does not soon lead to the same
code that the JMP FFFF:0000 code leads to. (I tired of debugging it
after seeing that it didn't go there quickly. I also searched for the
bytes corresponding to the real target of the JMP FFFF:0000 (which is
a JMP to a JMP) and didn't find them anywhere near the INT $19 code.)

The point of this article is to confirm that you apparently can't
count on $19 working for rebooting a variety of systems; that even
JMP FFFF:0000 isn't 100% reliable, and that the two approaches
weren't necessarily going to do the same thing in the first place.

+--------------------------------------------------------------------+
| Karl Brendel                           Centers for Disease Control |
| Internet: CDCKAB@EMUVM1.BITNET         Epidemiology Program Office |
| Bitnet: CDCKAB@EMUVM1                  Atlanta, GA, USA            |
|                        Home of Epi Info 5.0                        |
+--------------------------------------------------------------------+