home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / ASKSYS.ZIP / ASKSYS.ASM
Assembly Source File  |  1989-04-07  |  3KB  |  111 lines

  1. page    ,132
  2. ;asksys.asm - implement dual boot for OS/2. Ref: PC Tech Journal, Sept. 1988
  3.  
  4.     include d:\sys\standard.icl
  5.  
  6. OS2     equ     13
  7. MSDOS    equ    27
  8. DEFAULT equ    OS2
  9. SECONDS equ    5
  10.  
  11. group1  group   code,data
  12.         assume  cs:group1,ds:group1
  13.  
  14. code    segment byte public
  15. code    ends
  16.  
  17. data    segment word
  18.  
  19. time        dw    (SECONDS*182)/10
  20. oldint8         label   dword
  21. int8off         dw      0
  22. int8seg         dw      0
  23. bootaddr    dd    7c00h
  24.  
  25.     if    DEFAULT EQ MSDOS
  26. msg$        db    'Press ESC (or wait 5 seconds) to boot DOS',cr,lf
  27.         db    'Any other key for OS|2',cr,lf,0
  28.     else
  29. msg$        db    'Press ESC to boot DOS',cr,lf
  30.         db    'Any other key (or wait 5 seconds) for OS|2',cr,lf,0
  31.     endif
  32.  
  33.                 even
  34. dosboot     db    512 dup ('D')    ;marker for DOS boot record
  35. os2boot     db    512 dup ('O')    ;marker for OS2 boot record
  36.  
  37. data    ends
  38.  
  39. code    segment byte public
  40. asksys  proc
  41.         push    ax
  42.         push    bx
  43.         push    cx
  44.         push    si
  45.         push    di
  46.         push    ds
  47.         push    es
  48.         mov     ax,cs
  49.         mov     ds,ax
  50.         lea     si,msg$
  51. boot1:  lodsb
  52.         or      al,al
  53.         jz      boot2
  54.         mov     ah,0eh
  55.         int     10h
  56.         jmp     boot1
  57. boot2:  
  58.         int8 = 8*4
  59.         xor     ax,ax
  60.         mov     es,ax                   ;es --> interrupt table
  61.         mov     ax,es:int8
  62.         mov     bx,es:int8+2
  63.         mov     int8off,ax              ;save int 8 address
  64.         mov     int8seg,bx
  65.         lea     bx,timertick            ;address of timer routine
  66.         cli
  67.         mov     es:int8,bx
  68.         mov     es:int8+2,cs
  69.         sti
  70. boot3:  mov     ah,1
  71.         int     16h
  72.         jnz     boot4                   ;key pressed if no zero flag
  73.         cmp     time,0
  74.         jg      boot3
  75.         mov     al,DEFAULT
  76.         jmp     short   boot5
  77. boot4:  xor     ah,ah
  78.     int    16h
  79. boot5:  mov     bx,int8off
  80.         mov     cx,int8seg
  81.         cli
  82.         mov     es:int8,bx
  83.         mov     es:int8+2,cx
  84.         sti
  85.         lea     si,dosboot
  86.     cmp    al,MSDOS
  87.         je      boot6
  88.         lea     si,os2boot
  89. boot6:  les     di,bootaddr
  90.         mov     cx,256
  91.         rep     movsw
  92.         pop     es
  93.         pop     ds
  94.         pop     di
  95.         pop     si
  96.         pop     cx
  97.         pop     bx
  98.         pop     ax
  99.         jmp     cs:bootaddr
  100. asksys  endp
  101.  
  102. ;int 8 timer tick int is revectored to here
  103.  
  104. timertick       proc
  105.         dec     cs:time
  106.         jmp     cs:oldint8
  107. timertick       endp
  108.  
  109. code    ends
  110.         end
  111.