home *** CD-ROM | disk | FTP | other *** search
- ; pccbrk.asm
- ;
- ; 10/11/90 by Ted
- ;
- ; Low level function for Oakland CTL-BRK detection.
- ;
- ; OWL-PCA 1.2
- ; Copyright (c) 1988, 1989 Oakland Group Inc.
- ; ALL RIGHTS RESERVED
- ;
- ;------------------------REVISION HISTORY--------------------------------------;
- ;
- ;------------------------------------------------------------------------------;
- include PCDECL.MAC
-
- PSEG
- ; ---------------------------------------------------------------- ;
- ; ******* data in code segment *********
-
- cbrk dw 0
- initted dw 0
- brk1b dd ?
- ; ---------------------------------------------------------------- ;
- ; Int 1B vector catch - sets flag for control-break gotten
-
- flagset proc far
- mov cs:cbrk, 1 ; set our cbrk flag
- iret
- flagset endp
- ; ---------------------------------------------------------------- ;
- ; Repoint vector for break interrupt to our code.
- ; void DIGPRIV pc_catchcbrk(void);
-
- pubproc DIGPRIV pc_catchcbrk
- push bp
- mov bp,sp
- push es
-
- mov cs:initted, 1
-
- cli
-
- ; Get the int 1B vector that bios has set up
- mov al, 1Bh
- mov ah, 35h
- int 21h
- mov word ptr cs:brk1b, bx
- mov word ptr cs:brk1b+2, es
-
- ; Set int 1B vector to point to flag setter routine
- push ds
- push cs
- pop ds
-
- mov al, 1Bh
- mov ah, 25h
- mov dx, offset flagset
- int 21h
-
- pop ds
-
- sti ; allow interrupts now
-
- nocatch:
- pop es
- pop bp
- ret
- endproc pc_catchcbrk
-
- ; ---------------------------------------------------------------- ;
- ; Restore the cbrk addresses
- ; void DIGPRIV pc_restorecbrk(void);
-
- pubproc DIGPRIV pc_restorecbrk
- push bp
- push ds
-
- cmp cs:initted, 0
- je nofix
-
- ; Restore the int 1B ctl break vector
- mov al, 1Bh
- mov ah, 25h
- mov dx, word ptr cs:brk1b
- mov bx, word ptr cs:brk1b+2
- mov ds, bx
- int 21h
-
- mov cs:initted, 0
- nofix:
- pop ds
- pop bp
- ret
- endproc pc_restorecbrk
- ; ---------------------------------------------------------------- ;
- ; Check the cbrk flag, and reset it if the cleanup flag is TRUE
- ; boolean DIGPRIV pc_checkcbrk(int cleanup);
-
- pubproc DIGPRIV pc_checkcbrk <cleanup>
- push bp
- mov bp,sp
-
- ; Get the code into ax, and clear it if cleanup is not 0
- cli
- mov ax, cs:cbrk
-
- cmp word ptr [bp].cleanup, 0
- je noclean
- mov cs:cbrk, 0
- noclean:
- sti
-
- pop bp
- ret
- endproc pc_checkcbrk
- ;------------------------------------------------------------------------------;
- ENDPS
- end
- ;------------------------------------------------------------------------------;
-