Reboot considerations
June 05 1998

   Subject:   REBOOT code
      Date:   Fri, 05 Jun 1998 07:32:10 GMT
      From:   Tom Wellige <>
 Newsgroups:  borland.public.turbopascal

More Pascal and Turbo Vision sources:

In article <>, wrote:
> Can anyone help me make a reboot code??? in Pascal or Assembler???
> Please help... Tanx

You can use one of the following functions:

  procedure WarmReset; assembler;
     MOV    AX,0040h
     MOV    ES,AX
     MOV    DI,0072h
     MOV    AX,01234h
     DB     0EAh, 00, 00, 0FFh, 0FFh

  procedure ColdReset; assembler;
     MOV    AX,0040h
     MOV    ES,AX
     MOV    DI,0072h
     XOR    AX,AX
     DB     0EAh, 00, 00, 0FFh, 0FFh

But be carefull. Both functions don't flush any existing HD cash so you
probably destroy some importatnat data.

Check for an existing cache can be done with:

  function CacheInstalled: boolean; assembler;
    push bp
    mov  ax,04A10h
    mov  bx,0
    mov  cx,0EBABh
    int  2Fh
    pop  bp
    cmp  ax,0BABEh
    mov  ax,0
    jnz  @Fin
    inc  ax


and flushing the cache with:

  procedure FlushCache; assembler;
    call CacheInstalled
    cmp  ax,1
    jnz  @Fin
    mov  ax,04A10h
    mov  bx,1
    int  2Fh


Regards, Tom.

Hardware Reboot:

Port[$64]  := $0FE;

   Subject:           Re: Standby & Shutdown
      Date:           5 Jun 1998 20:17:46 GMT
      From:           "Sp00l" <>
 Organization:           A customer of Tele2
 Newsgroups:           borland.public.turbopascal

> Q1: Does anybody know some routine to turn off your computer??
> Q2: Does anyone know a routine to put your computer on standby???
> If possible, the routines should not lock up, if it is not possible to
> run these options on your computer...
> If you know a trick in Pascal or Assembler, please reply

-- Jump to address $FFFF:0000
         inline ($EA/00/00/$FF/$FF);
--     call interrupt 19
            int $19
--    have the keyboard controller reset the CPU
         port [$64] := $FE;
--   simulate keypress ctrl-alt-del
         mem[$40:$17] := mem[$40:$17] or 12;
           mov ax, $4F53
           int $15

--------------------- can'----
Procedure Idle; inline ($CD/$28); { Int 28               }

Procedure boot (magic:word);
  memw[$40:$72] := magic;             { set boot type }

  { simulate keypress ctrl-alt-del }
  mem[$40:$17] := mem[$40:$17] or 12; { set flags of ctrl + alt keys }
    mov ax, $4F53                     { del key  }
    int $15                           { press it }
  mem[$40:$17] := mem[$40:$17] and $F0;{ release ctrl + shift + alt }

  { if we come here: allow cache to do staged write }
  idle; idle; idle;
  delay (500);

  { if we have come here: reset CPU }
  port [$64] := $FE;                  { tell keyboard controller to reset
  delay (500);                        { wait until it has an effect }

  { if all didn't work, try this: }
  inline ($EA/00/00/$FF/$FF);         { jump FFFF:0000 }

  { we had no luck, so go into an endless loop }
  @0: jmp @0

  { should NEVER NEVER NEVER come here }


Procedure ColdBoot; begin boot ($0000); end;
Procedure WarmBoot; begin boot ($1234); end;

ja mata!
/ Sp00l

   Subject: RE: rebooting via jmp F000:FFF0h and why you shouldnt use it
      Date: Tue, 02 Feb 1999 16:35:47 -0500
      From: Richard Day <>
Newsgroups: borland.public.tasm

I received several messages about this subject asking why the jmp wasn't
working on their comp and how come int 19 sometimes does not work so
here it is...

First of all I should say this:

jmp F000:FFF0h

is the ONLY way to reset a 8088 from software but this is the ONLY time
you should ever use it
so detect the cpu if your concerned about 8088 people using your
( Cpu detection is another subject entirely )

int 19 is another way but usually fails for the same reason's that the
jmp does.

if your using a mca and some eisa systems you can do it this way
this will not work on so called IBM Clones

    in     al,92h   ; get system control port
    jmp    $+2      ; add a slight delay
    or     al,1     ; set bit 0 for fast reset
    out    92h,al   ; do the reset
    hlt             ; should never get here

on AT- 286+  systems the preferred method is to use the keyboard

first you should set the bios up so the kind of reset you want will be

0         is cold boot- check memory all memory altered
1234h  is warm boot skip mem check some memory may be modified
4321h is warm boot skip memory check leave ram unchanged
          ( useful for preserving EMS pages in old days )
0064h cycle bios tests for manufacturing burn-in ( only some vendors )

you want to put the value at bios address 40:72h
then we call the keyboard controller to initiate reset

Reboot proc near
    xor     cx,cx       ; time-out counter
cmd_wait:               ; loop start while waiting for buffer to empty
    in      al,64h      ; get controller status
    jmp     $+2         ; io delay
    test    al,2        ; is the input buffer full ?
    jz      reboot      ; buffer isn't full lets rock
    jmp     $+2         ; another io delay to let buffer get flushed
    loop    cmd_wait    ; try again
    jmp     cmd_error   ; Error this shouldn't happen!
    mov     al,0feh     ; reboot command
    out     64h,al      ; send it, shouldn't return
    mov     ah,1        ; should NEVER get here, return error
Reboot endp

Hope this clarifies it :)

 This page hosted by  Get your own Free Homepage