home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
ASKSYS.ZIP
/
ASKSYS.ASM
Wrap
Assembly Source File
|
1989-04-07
|
3KB
|
111 lines
page ,132
;asksys.asm - implement dual boot for OS/2. Ref: PC Tech Journal, Sept. 1988
include d:\sys\standard.icl
OS2 equ 13
MSDOS equ 27
DEFAULT equ OS2
SECONDS equ 5
group1 group code,data
assume cs:group1,ds:group1
code segment byte public
code ends
data segment word
time dw (SECONDS*182)/10
oldint8 label dword
int8off dw 0
int8seg dw 0
bootaddr dd 7c00h
if DEFAULT EQ MSDOS
msg$ db 'Press ESC (or wait 5 seconds) to boot DOS',cr,lf
db 'Any other key for OS|2',cr,lf,0
else
msg$ db 'Press ESC to boot DOS',cr,lf
db 'Any other key (or wait 5 seconds) for OS|2',cr,lf,0
endif
even
dosboot db 512 dup ('D') ;marker for DOS boot record
os2boot db 512 dup ('O') ;marker for OS2 boot record
data ends
code segment byte public
asksys proc
push ax
push bx
push cx
push si
push di
push ds
push es
mov ax,cs
mov ds,ax
lea si,msg$
boot1: lodsb
or al,al
jz boot2
mov ah,0eh
int 10h
jmp boot1
boot2:
int8 = 8*4
xor ax,ax
mov es,ax ;es --> interrupt table
mov ax,es:int8
mov bx,es:int8+2
mov int8off,ax ;save int 8 address
mov int8seg,bx
lea bx,timertick ;address of timer routine
cli
mov es:int8,bx
mov es:int8+2,cs
sti
boot3: mov ah,1
int 16h
jnz boot4 ;key pressed if no zero flag
cmp time,0
jg boot3
mov al,DEFAULT
jmp short boot5
boot4: xor ah,ah
int 16h
boot5: mov bx,int8off
mov cx,int8seg
cli
mov es:int8,bx
mov es:int8+2,cx
sti
lea si,dosboot
cmp al,MSDOS
je boot6
lea si,os2boot
boot6: les di,bootaddr
mov cx,256
rep movsw
pop es
pop ds
pop di
pop si
pop cx
pop bx
pop ax
jmp cs:bootaddr
asksys endp
;int 8 timer tick int is revectored to here
timertick proc
dec cs:time
jmp cs:oldint8
timertick endp
code ends
end