-
Notifications
You must be signed in to change notification settings - Fork 1
/
REBOOT.ASM
128 lines (87 loc) · 2.19 KB
/
REBOOT.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
page ,132
title REBOOT.ASM
;
; REBOOT.ASM
; Fast reboot utility
;
; by Jeff Parsons 17-Jun-1992
;
__acrtused equ 1
public __acrtused
include all.inc
ORG_VALUE equ 100h ; for .COM file
GRP16 group _TEXT16,_DATA16
;
; Insure that _TEXT16 is the first segment in the image file
; (although MASM6 seems to do the right thing anyway)
;
_TEXT16 segment para public 'CODE'
_TEXT16 ends
_DATA16 segment para public 'DATA'
stack label word
_DATA16 ends
ROMSEG segment at 0FFFFh
org 0000h
Reset label far
ROMSEG ends
_TEXT16 segment para public 'CODE'
org ORG_VALUE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Init16
;
; ENTRY
; None
;
; EXIT
; Never
;
; USES
; All
;
assume cs:GRP16,ds:GRP16,es:GRP16,ss:GRP16
public Init16
Init16 proc far
mov ah,DOS_DISK_RESET ; try to insure that all disk
int INT_DOS ; buffers are flushed
mov ax,VIDEO_RESET shl 8 or VMODE_CO80
int INT_VIDEO ; reset the video mode
;
; Check processor type; if it's not 286 or higher, we can't
; (and needn't) reboot via an 8042 keyboard controller command
;
Check286
je InitContinue ; it's pre-286 (808x or 8018x)
;
; This is the new, improved way: reset the processor and get control
; back from the ROM immediately using the appropriate CMOS shutdown code
;
cli
mov ax,SEG_ROMDATA
mov ds,ax
assume ds:_ROMDATA
mov [RomData].rb_IOROMInit.w_lo,offset GRP16:InitContinue
mov [RomData].rb_IOROMInit.w_hi,es
ResetCPU CMOSSHUTDOWN_FARJMP
public InitContinue
InitContinue label far
assume ds:nothing,es:nothing,ss:nothing
cli
cld
mov ax,cs
mov ss,ax
mov sp,offset GRP16:stack+512
mov ax,SEG_ROMDATA
mov ds,ax
mov es,ax
assume ds:_ROMDATA,es:_ROMDATA
SumVecs ; chksum ok?
je init_veccopy ; yes
mov [RomData].rb_ResetFlag,RESETFLAG_WARM
jmp far ptr ROMSEG:Reset; no, so just do a warm boot
init_veccopy:
CopyVecs ; copy vectors back into the IVT
ResetPICs ; reset PICS for real-mode operation
int INT_REBOOT ; now do an INT 19h soft boot
Init16 endp
_TEXT16 ends
end Init16