Reboot Source Code

Source Code for programs that reboot your PC.


Reboot.c

#define MAGIC 0 /* for cold restart */
/* #define MAGIC 0x1234 /* for warm restart */

#define BOOT_SEG 0xffffL
#define BOOT_OFF 0x0000L
#define BOOT_ADR ((BOOT_SEG << 16) | BOOT_OFF)

#define DOS_SEG 0x0040L
#define RESET_FLAG 0x0072L
#define RESET_ADR ((DOS_SEG << 16) | RESET_FLAG)

main()
{
	void ((far *fp)()) = (void (far *)()) BOOT_ADR;

	*(int far *)RESET_ADR = MAGIC;
	(*fp)();
	return 0; /* never gets here, but keeps compiler happy */
}

Reboot.bas

REM From PC Mag, Vol11 Number 5

DECLARE SUB ReBoot (Warm%)

CALL ReBoot(1)      'be sure to save this program before running it!

SUB ReBoot (Warm%) STATIC
  IF Warm% THEN                 'if they want a warm boot
    DEF SEG = 0                 'assign the value 1234 Hex
    POKE &H473, &H12            'to address 0000:0473 Hex
    POKE &H472, &H34
  END IF
  DEF SEG = &HFFFF              'either way call the BIOS
  CALL Absolute(0)              'routine at FFFF:0000 Hex
END SUB

To use these "scripts" cut&paste the source into a file, then issue the following command "debug < cldboot.scr".

CLDBoot.scr

A 0100
MOV AX,40
MOV DS,AX
JMP FFFF:0000

N CLDBOOT.COM
RCX
10
W
Q

WRMBoot.scr

A 0100
MOV AX,40
MOV DS,AX
MOV WORD PTR [72],1234
JMP FFFF:0000

N REBOOT.COM
RCX
10
W
Q