home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_03_06 / 3n06062a < prev    next >
Text File  |  1992-04-08  |  2KB  |  77 lines

  1. ;-------------------------------------------------------------------
  2. ; TSR version of the NMI rebooter (it even works on DOS 1.0)
  3. ;-------------------------------------------------------------------
  4. ; Tony Ingenoso
  5. ; 1323 SE 17th #274
  6. ; Ft. Lauderdale, FL 33316
  7. ;-------------------------------------------------------------------
  8. bios    segment at 0FFFFH    ; Dummy segment where the BIOS lives
  9.         assume  cs:bios        ;
  10.         org     0        ;
  11. boot    label   far             ; Jumping here reboots the PC
  12. bios    ends
  13.  
  14. cseg    segment para public 'CODE'
  15.     assume    cs:cseg,ds:cseg,es:nothing,ss:cseg
  16.     org    100H
  17. start    label    near
  18. ;
  19. ; Display the logo
  20. ;
  21.     mov    ah, 09H            ; Display string
  22.     mov    dx, offset logo        ;
  23.     int    21H            ;
  24. ;
  25. ; Relocate the trapper routine to a safe spot up in the PSP to save space.
  26. ; We move it on top of the default FCB's since we're not going to use them.
  27. ;
  28.     cld                ;
  29.     mov    si, offset NMItrapper    ; Location of trapper code
  30.     mov    di, 005CH        ; Location of first FCB
  31.     mov    cx, TRAPPER_LEN        ; # of bytes to move
  32.     rep    movsb            ; 
  33. ;
  34. ; Grab the NMI vector
  35. ;
  36.     mov    ax, 2502H        ; Set vector
  37.     mov    dx, 005CH        ; DS:DX-->NMI trapper routine
  38.     int    21H            ;
  39. ;
  40. ; Should we free the environment?
  41. ;
  42.     mov    ax, 3000H        ; Get version
  43.     int    21H            ;
  44.     cmp    al, 0            ; Is it 1.X?
  45.     je    GoResident        ; 1.X doesn't have environments
  46. ;
  47. ; Free the space used by the environment.
  48. ;
  49.     mov    es, word ptr cs:[2CH]    ; PSP[2CH]-->environment
  50.     mov    ah, 49H            ; Free memory block
  51.     int    21H            ;
  52. ;
  53. ; Compute ending address and stay resident
  54. ;
  55. GoResident:
  56.     mov    dx, (5CH + TRAPPER_LEN + 1)
  57.     int    27H            ; 1.0 compatible TSR
  58.  
  59. ;----------------------------------------------
  60. ; NMI trapper routine (gets moved up into PSP)
  61. ;----------------------------------------------
  62. NMItrapper proc far
  63.         mov     ax, 0040H               ; Set BIOS reset flag
  64.         mov     ds, ax                  ;
  65.         mov     word ptr ds:[72H],1234H ; WARM
  66.         jmp     boot                    ; JMP FFFF:0000
  67. TRAPPER_LEN EQU $-NMItrapper
  68. NMItrapper endp
  69.  
  70. ;----------------------------------------------
  71. ;                 Messages
  72. ;----------------------------------------------
  73. logo    db      'TSRBOOT V1.00, Reboot on NMI',13,10
  74.         db      'Tony Ingenoso, 1992',13,10,'$'
  75. cseg    ends
  76.     end    start
  77.