home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_01_06 / 1n06021a < prev    next >
Text File  |  1990-08-13  |  1KB  |  60 lines

  1.         page    ,132
  2.  
  3. ;
  4. ;  Figure 7
  5. ;  Function to perform a warm or cold reboot.
  6. ;  Call with Zero to perform a cold boot, Non-Zero for a warm boot.
  7. ;
  8.  
  9.  
  10. %       .MODEL  memodel,lang            ;Add model and language support via
  11.                                         ;command line macros, e.g.
  12.                                         ;MASM /Dmemodel=LARGE /Dlang=C
  13.  
  14.         .DATA
  15.  
  16. bootflg dw      72h,40h
  17.  
  18.         .CODE
  19.                 
  20. reboot  PROC    bootype:WORD            ;0 for Cold boot, 1 for Warm boot
  21.         les     DI,dword ptr [bootflg]
  22.         mov     AX,bootype
  23.         and     AX,AX
  24.         je      setype
  25.         mov     AX,01234h
  26. setype: 
  27.         mov     word ptr ES:[DI],AX
  28.         cli
  29.         xor     AX,AX
  30.         mov     DS,AX
  31.         mov     ES,AX
  32.         mov     SS,AX
  33.         mov     SP,AX
  34. kbwait:
  35.         in      AL,64H                  ;wait on AT keyboard controller
  36.         test    AL,2
  37.         jne     kbwait
  38.  
  39.         xor     AL,AL                   ;try reset lines
  40.         out     64H,AL
  41.         nop
  42.         nop
  43.         nop
  44.         mov     AL,0FEh
  45.         out     64H,AL
  46.         nop
  47.         nop
  48.         nop
  49.         mov     AX,0002H                ;jump to reset vector via IRET
  50.         push    AX
  51.         mov     AX,0F000H
  52.         push    AX
  53.         mov     AX,0FFF0H
  54.         push    AX
  55.         iret
  56.         
  57. reboot  ENDP
  58.  
  59.         end
  60.