TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: PAUL WANKADIA
from: HENK DEUTEKOM
date: 1997-07-07 12:26:00
subject: Reset

                                                        >> C_PLUSPLUS <<
Monday, July 07, 1997
Hello Paul!
Saturday, July 05, 1997, Paul Wankadia writes to Rafa Velilla:
 PW> On 29 Jun 97, Rafa Velilla wrote to All --
 RV>> Does anybody know how to produce a reset by software? The only
 RV>> way I know is:   cout<<"Please press the reset button"; ... but
 RV>> it is not satisfactory (sometimes works but sometimes the
 RV>> user don't want to press the button).
 PW> You'll need to use ASM to do that.  How does your compiler do inline
 PW> ASM?
You can do it also in C/C++ (use one of them):
/*--------------------------------------------------------------------
    soft reset
--------------------------------------------------------------------*/
void reset()
{
    //  a way to invoke a soft reset (full Asm)
    _asm {
        push bp
        mov  bp,sp
        sub  sp,4
        mov  word ptr [bp-2],0
        mov  word ptr [bp-4],472h
        les  bx,dword ptr [bp-4]
        mov  word ptr es:[bx+2],0
        mov  word ptr es:[bx],1234h
        mov  ax,0FFFFh
        push ax
        inc  ax
        push ax
        iret
    }
// or
    //  a way to invoke a soft reset (mixed)
    long _far *bootflag = (long _far *)0x00000472;
    *bootflag = 0x1234;
    _asm {
           mov  ax,0xffff
           push ax
           inc  ax
           push ax
           iret
         }
// or
    //  a way to invoke a soft reset (full C/C++)
    void (far *PtrReboot) (void);
    unsigned far *PtrBootFlag = (unsigned far *)0x00000472;
    *PtrBootFlag = 0x1234;
    PtrReboot =  (void (far *) (void))0xffff0000;
    (*PtrReboot) ();
}
Regards, Henk
E-mail: hdeutekom@bundy.idn.nl
--- FMail/386 1.02+ & GoldED/386 2.50+
---------------
* Origin: Henk's point, The Netherlands (2:283/6.22)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.