summaryrefslogtreecommitdiff
path: root/reference/C/CONTRIB/SNIP/coldboot.asm
blob: 828c79d247d9c853d06709400b79d7faabe7c1f0 (plain)
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
; by: David Nugent via ECPROG echo
;
; works VERY reliably under all the protected mode environments I've
; tried (namely DV and PC-MOS). Haven't tried VM386 or NX386 yet, but
; I'm hopeful.... ;-)
 
 
BIOS_POST  equ    0472H        ; POST (warm boot) flag
 
 
        xor BX,BX               ; AL=1 for warm boot, 0 for cold
        mov ES,BX
        cmp AL,1
        jnz @NcB
        mov AX,1234H            ; Avoid POST
@NcB:
        mov ES:[BIOS_POST],AX   ; Install flag
 
        cli                     ; Reboot
        xor AX,AX
        mov DS,AX
        mov ES,AX
        mov SS,AX
        mov SP,AX
@cP:
        in AL,64H               ; Wait on AT keyboard controller
        test AL,2
        jne @cP
 
        xor AL,AL               ; Try reset lines
        out 64H,AL
        iodelay
        mov AL,0FEh
        out 64H,AL
        iodelay
        mov AX,0002H            ; Jump to reset vector
        push AX                 ; via IRET
        mov AX,0F000H
        push AX
        mov AX,0FFF0H
        push AX
        iret