; Resident program that aborts current process with ^R_shift and returns
; to originating process (eg, if run by DOS, returns to DOS).
; A more powerful version of ^Bk, which just jams and doesn't allow
; recovery (back to DOS or originating program) in some prgrams.
; For recalcitrant programs that aren't currently or never did listen to
; the keyboard. Also for programs that take dozens of keystrokes to exit
; (like symphony). Use when you want it to exit, not when it wants to exit.
; Leaves return code 0Fh, which can be interrogated by BATCH IF and
; ERRORLEVEL, and DOS fn 4Dh.
; So far it's compatible with Sidekick (can be installed before or
; after). Abort detects whether it is loaded and reloading ABORT produces no
; action. When coresident with other hooked int9 programs (those activated
; by the keyboard, such as sidekick) sometime ABORT cannot tell that it's
; already loaded in which case a second attempt to load ABORT will lock up
; the machine. It doesn't always happen, so I dont know the whole story yet.
; Generally ABORT seems benign, however let me know about any bugs or
; Assembled with IBM MASM 1.00
; From a idea in Breakpt.com, a program by Edward Batulis (c) 1985,
; published in Byte, Sep 86, p127
; Joe Mack, Sept '86
; Dept Chemistry, UMBC
; 5401 Wilkens Ave
; (301)-455-3292 afternoons best
; or MIX BBS, leave a message in "ADV" conference
; 301-480-0350 1200-8-N-1 (it maybe area code 202- not sure)
cseg segment para public 'code'
;leave secret notice in early code for mad disassemblers
notice db 'ABORT1_0',01Ah
old_int9_vector label dword
old_int9_offs dw ?
old_int9_seg dw ?
;call old keyboard routine by simulating an int
push es ;save registers
mov ax,40h ;look at keyboard flag1 in ROM BIOS data area
and al,05h ;mask all but bit 1, bit 3
cmp al,5 ;Ctrl-Right Shift pressed?
;no, take no action, return to process that was interrupted by the keystroke
;if so return to originating process
pop bx ;restore registers
mov ah,4Ch ;dos exit fn
mov al,0Fh ;return code
pop bx ;restore before quitting
END_OF_RESIDENT_CODE LABEL BYTE
banner_1 db 'ABORT1_0, Mack 1986',0Dh,0Ah,0Dh,0Ah
db 'ABORT1_0 installed',0Dh,0Ah
db 'Resident program, exit anything with ^R_shift combination',0Dh,0Ah
db 'Key combination detected by int 9h, exits via DOS fn call 4Ch.',0Dh,0Ah
db 'Leaves return code 0Fh for batch language and DOS fn call 4Dh.',0Dh,0Ah,'$' ,0Dh,0Ah,'$'
banner_2 db 'ABORT1_0, Mack 1986',0Dh,0Ah,0Dh,0Ah
db 'ABORT already installed',0Dh,0Ah,'$'
install: ;get keyboard interrupt vector
mov ah,35h ;get interrupt vector fn
mov al,9 ;int 9
cmp bx,offset new_int9 ;are we installed yet?
jne installz ;if not, install, else exit
mov dx,offset banner_2 ;write banner_2
int 20h ;and exit
mov old_int9_offs,bx ;otherwise, save old keyboard interrupt address
mov dx,offset banner_1 ;print banner_1
mov ah,9 ;print string
;set kbd interrupt to point to new_int9
mov ah,25h ;set interrupt fn
mov al,9 ;int9
mov dx,offset new_int9 ;new address
;terminate and stay partially resident, point to last byte of resident code+1
mov dx,offset END_OF_RESIDENT_CODE+1