home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
assemblr
/
library
/
os2dualb
/
asksys.asm
< prev
next >
Wrap
Assembly Source File
|
1989-02-28
|
6KB
|
121 lines
; ASKSYS.ASM -- Written for Microsoft MASM 5.x
; Implements dual-boot with timeout for DOS and OS/2
; Last modification: 02-15-89
;
; Copyright (C) 1988 Ziff Communications Co. and PC Tech Journal
; Written by Ted Mirecki
;
; Modifications Copyright (C) 1989 BAB Enterprises
; Entered by Brad Berson
;
; This file must be assembled, linked and EXE2BIN'd to the name ASKSYS
; or ASKSYS.COM. When making changes keep the target file size to 2048
; bytes or less to avoid file fragmentation when installing feature.
;
; Change equates in first section as necessary for selection keys,
; default selection and selection timeout.
OS2 equ 13 ; <Ent> for OS/2,
DOS equ 27 ; <Esc> for DOS,
DEFAULT equ DOS ; Default to DOS
SECONDS equ 15 ; after 15 seconds
group1 group code,data
assume cs:group1, ds:group1
code segment byte public ; Establish code segment first
code ends
data segment word ; but define data segment first
time dw SECONDS*18
oldint8 label dword
int8off dw 0
int8seg dw 0
bootaddr dd 7C00h
msg$ db "OS/2 - DOS Dual Boot Program", 0Dh, 0Ah, 0Ah
db "Copyright (C) 1988 Ziff Communications Co.", 0Dh, 0Ah
db "and PC Tech Journal Magazine", 0Dh, 0Ah
db "Modifications (C) 1989 BAB Enterprises", 0Dh, 0Ah
db "Technical Consulting Services", 0Dh, 0Ah, 0Ah
db "Boot: Enter = OS/2, Esc = DOS", 0Dh, 0Ah, 0Ah, 0
even
dosboot db 128 dup ('DOS-') ; Space for DOS boot record and
os2boot db 128 dup ('OS2-') ; space for OS/2 boot record
data ends
code segment byte public ; Resume code segment
asksys proc
push ax
push bx
push cx
push si
push di
push ds
push es
mov ax,cs ; Set DS to code segment
mov ds,ax
lea si,msg$ ; Get address of message,
boot1: lodsb
or al,al ; null byte = end of message
jz boot2
mov ah,0Eh ; Call BIOS TTY write,
int 10h
jmp boot1 ; loop until end of messsage
int8 = 8*4 ; Address of Int 8 vector
boot2: xor ax,ax
mov es,ax ; Point ES to Int table,
mov ax,es:int8 ; get Int 8 address
mov bx,es:int8+2
mov int8off,ax ; and save it.
mov int8seg,bx
lea bx,timertick ; Address of timer routine,
cli ; hold off ints,
mov es:int8,bx ; set timer interrupt
mov es:int8+2,cs
sti ; and allow interrupts
boot3: mov ah,1 ; Get KB status
int 16h
jnz boot4 ; Key pressed if no ZF
cmp time,0 ; else test for timeout
jg boot3 ; No timeout; test KB again
mov al,DEFAULT ; Set default keystroke
jmp short boot5 ; and go for it
boot4: xor ah,ah ; Get the keystroke
int 16h
cmp al,DOS ; Was it for DOS?
je boot5
cmp al,OS2 ; or for OS/2?
jne boot3 ; If neither, read KB again
boot5: mov bx,int8off ; Get original Int 8 vector,
mov cx,int8seg
cli
mov es:int8,bx ; restore it in vector table
mov es:int8+2,cx
sti
lea si,dosboot ; Load DOS boot record address
cmp al,DOS ; Was it DOS?
je boot6
lea si,os2boot ; else load OS/2 boot record -
boot6: les di,bootaddr ; ES:DI points to its address
mov cx,256 ; Length of record in words
rep movsw ; Insert boot rec at boot addr
pop es ; Exit sequence
pop ds
pop di
pop si
pop cx
pop bx
pop ax
jmp cs:bootaddr ; Branch to boot record
asksys endp
; Int 8, timer tick interrupt, is repointed here.
; This routine counts down a time value and chains to original Int 8.
timertick proc
dec cs:time
jmp cs:oldint8
timertick endp
code ends
end