[comp.emacs] Ctrl-space on PC uemacs 3.10

ericksen@unc.cs.unc.edu (Jim Ericksen) (10/14/89)

A while ago there was a question on how to get control-space to work
as a set-mark key in uemacs 3.10 running on PC's.  I have written
ctlspace.com, a simple TSR which intercepts the BIOS keyboard
interrupts, translating the space key to ^@ whenever the control key
is pressed at the time.  Put the command CTLSPACE into your autoexec
file, add the line

	bind-to-key	set-mark	^@

to your emacs.rc file, and you're in business.  Attached is the source
and uuencoded executable.

--------------------------------------------------------------------------

title	ctlspace.asm
page	62,132

; Translate control-space into ^@ (null, like shift-ctrl-2) for emacs use
; Public Domain software by Jim Ericksen

code		segment
		assume	cs:code,ds:nothing,es:nothing
		org	100H

; .com entry point
start:		jmp	install

; program variables
vector$16	dd	4*016h
old$16		dd	?		; save original intr entry addr

; interrupt entry point
wedge$16	proc	far
		or	ah,ah		; check function requested
		jz	readit
		jmp	[old$16]	; if not read-next-key then exit

readit:		pushf
		call	[old$16]	; do normal intr routine
		cmp	al,20h
		jne	exit$16		; if not space key then exit

isaspace:	push	ax
		mov	ah,2
		pushf
		call	[old$16]	; use BIOS to read shift status
		test	al,04h
		pop	ax
		jz	exit$16		; if ctrl key not pressed then exit

ctrlspace:	mov	ax,0300h	; change to null char

exit$16:	iret
wedge$16	endp

; installation code
install		proc 	near	
		cli
		lds	si,vector$16		; load addr of vector tbl entry
		les	di,dword ptr [si]	; read entry from vector table
		mov	word ptr old$16,di
		mov	word ptr old$16+2,es	; save original vector
		mov	word ptr [si],offset wedge$16
		mov	word ptr [si+2],cs	; set new vector
		sti
		mov	dx,offset install
		int	27h			; terminate & remain resident
install		endp
code		ends
		end	start

----------------------------  CUT HERE  ----------------------------------
begin 644 ctlspace.com
MZRZ06``````````*Y'0%+O\N!P&<+O\>!P$\('414+0"G"[_'@<!J`18=`.X
B``//^B[%-@,!Q#PNB3X'`2Z,!@D!QP0+`8Q,`ONZ,`'-)R[_
`
end