Category : Utilities for DOS and Windows Machines
Archive   : EBREAK.ZIP
Filename : EBREAK.ASM

 
Output of file : EBREAK.ASM contained in archive : EBREAK.ZIP
;--------------------------------------------------------------------------
;
; EBREAK v1.0 - enhanced break - Public Domain by TLG Software
;
; EBREAK is a resident program that makes the Cntl-Break key "stronger",
; so that it will even break out of tight loops which don't involve DOS
; calls.
;
; NOTE: When Cntl-Break is hit the hardware interrupts (below 20H) are
; all reset to their values as of when the program was installed.
; Therefore, if you are installing resident programs which steal
; these interrupts they should be installed BEFORE this program.
; This program steals int 09H and int 1BH.
;
; Cntl-Break resets the system timer to run at the normal rate,
; and restores the video mode to the state it was in when EBREAK
; was installed.
;
; Copyright (c) 1986 by TLG software
; (O Cheyette, DB Clegg, M Golden)
; This program is hereby placed into the public domain.
; EBREAK is, however, copyrighted by the authors. You may make
; copies of EBREAK for your own use, and you may make copies for
; others.
;
; TLG software does not warrant that EBREAK operates as designed,
; and is not liable for any damages of any kind sustained through
; the use of the program.
;
;-------------------------------------------------------------------------

code segment para public
assume cs:code

steal_int macro int_num,subst_int,old_int
mov bx,int_num * 4
mov ax,word ptr es:[bx]
mov word ptr old_int, ax
mov ax,word ptr es:[bx+2]
mov word ptr old_int[2], ax
mov word ptr es:[bx], offset subst_int
mov word ptr es:[bx+2], cs
endm

IntVecs segment at 0
org 9 * 4
int_9 dd ?
org 1Bh * 4
int_1B dd ?
org 449H
video_state db ?
IntVecs ends

org 2Ch
environment label word

BREAK_HIT equ 1

org 5CH
DOS_1B dd ? ; DOS int 1B
real_int_9 dd ? ; keyboard handler
called_cs dw ?
break_flag db ?
int_mask db ? ; original interrupts enabled
orig_int_tbl db 80H dup(?) ; room for copy of int tbl
; Note that table is on a double word
initial_mode db ? ; initial video mode

org 100h
start: jmp setup

assume ds:nothing, es:nothing

handle_9 proc far ; grabs the code segment of
push bp ; code executing when key was hit
mov bp,sp
mov bp,[bp+4] ; code segment of caller
mov called_cs,bp
pop bp
mov break_flag,0 ; clear break
pushf ; fake an interrupt
call real_int_9
test break_flag,BREAK_HIT ; did we get break?
jz no_break

in al,61H ; turn off sound
jmp short $+2
and al,0FCH
out 61H,al

mov al,36H ; reset system timer
out 43H,al
xor al,al
jmp short $+2
out 40H,al
jmp short $+2
out 40H,al

mov cx,40H ; restore int tbl
push cs
pop ds
assume ds:code
xor ax,ax
mov es,ax
assume es:IntVecs
mov di,ax
mov si,offset orig_int_tbl
cli
cld
rep movsw

mov al,int_mask ; restore enabled ints
out 21H,al
sti

mov al,initial_mode ; set video back to original
cmp video_state,al
je vid_ok
xor ah,ah
int 10H
vid_ok:

mov ax,4C01h ; can we really do this?!!?
int 21H ; YOW!

no_break:
iret ; done
handle_9 endp


handle_1B proc far
assume ds:nothing, es:nothing
push ax
mov ax,cs
cmp called_cs,ax
jbe called_from_below ; check if were in DOS
cmp called_cs,0A000H
jae called_from_below ; or in BIOS
or break_flag,BREAK_HIT
called_from_below:
pop ax
jmp DOS_1B ; do DOS's int 1B
handle_1B endp

handler_end label byte

HANDLE_1B_LEN equ $ - handle_1B

installing_msg db 'EBREAK v1.0 installed. ',
Copyright db 'Copyright (c) 1986, TLG Software - Public Domain',
db 0Dh, 0Ah
installing_msg_len equ $ - installing_msg
not_inst_msg db 'EBREAK previously installed.', 0Dh, 0Ah
not_inst_msg_len equ $ - not_inst_msg

assume ds:code, es:nothing
steal proc far
setup:
mov es,environment ; free environment area
mov ax,4900H
int 21H

xor ax,ax ; set up es to IntVecs
mov es,ax
assume es:IntVecs

les di,int_1B ; check for already installed
assume es:nothing
mov cx,HANDLE_1B_LEN
mov si,di
repz cmpsb
jcxz already_installed

mov es,ax ; point es to IntVecs again
assume es:IntVecs

cli
steal_int 09H,handle_9,real_int_9
steal_int 1BH,handle_1B,DOS_1B
sti

mov cx,40H ; save int tbl
push cs
pop es
assume es:code
xor ax,ax
mov ds,ax
assume ds:IntVecs
mov si,ax
mov di,offset orig_int_tbl
cld
rep movsw

in al,21H ; save enabled ints
mov int_mask,al

mov al,video_state ; save video mode
mov initial_mode,al

push cs
pop ds ; restore segment
assume ds:code
mov dx,offset installing_msg
mov cx,installing_msg_len
mov bx,1
mov ax,4000h
int 21h
mov dx,offset handler_end
int 27H ; terminate and stay resident

already_installed:
mov dx,offset not_inst_msg
mov cx,not_inst_msg_len
mov bx,1
mov ax,4000h
int 21h
int 20h ; exit, not installing code
steal endp

code ends
end start


  3 Responses to “Category : Utilities for DOS and Windows Machines
Archive   : EBREAK.ZIP
Filename : EBREAK.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/