Terence wrote:
> I know there were TSR-like routines in the days of the Radio Shack and
> Epson 10 computers and later Superbrain computers because I used such
> things with CP/M.
> I know that in the Epson CPU I had to set up a background module to
> handle the USA -type keyboard in Spanish. There was something similar
> in the Burroughs B22 BTOS software. These are, I think all pre-1986. Of
> course they didn't use the interrupt structure servicing the same way
> as DOS later did, but the similar hardware was there in the 8086 chip.
> (Yes I just located a BTOS assembler manual dated Feb 1986. Somewhere
> I have a complete CPM source listing). I seem to remember that
> creating a TSR was a service call in DOS 3.1 (whenever that was) and
> possibly earlier versions.
>
; test prog
; TASM code
; This very simple tsr hooks the int9 (keyboard), calls the OLD
; keyboard handler each key, AND makes the top left character on
; the screen chnage colour with each key-stroke
;
; A REAL tsr usually hooks int8 (timer) also. Then the int9 sets a flag
; the int8 checks for the flag, and that you are not in dos. If both
; of these conditions are met then it would invoke some real task.
; tasm /ml /mx /m2 keytsr.asm
; tlink /t keytsr.obj
; make sure cs == ds
..model tiny
..386
finish equ $
..code
..startup
snatch_key:
; get the current int9 vector
mov ah, 35h
mov al, 9
int 21h
mov keep_seg9, es
mov keep_off9, bx
; install our new int9 handler
; cs has to equal ds for this to work
mov dx, offset int9
mov al, 9
mov ah, 25h
int 21h
; terminate, but stay in memory
mov dx, offset snatch_key
add dx, 0100h
mov cl, 4
shr dx, cl
inc dx
mov ah, 31h
mov al, 0
int 21h
; quit completely - should never get here
; huh?
mov ah, 0
int 21h
ret
; =================================================
int9:
; make it do something so we know it is working
; makes top left text character change colour when key
; is pressed
push ds
push bx
mov bx, 0b800h
mov ds, bx
mov bx, 1
inc byte ptr [bx]
pop bx
pop ds
;pushf
;call cs:keep_off9
;retf 02
; this works better, call + iret is Ok too
jmp cs:[int9_ptr]
; data has to be in CODE segment
int9_ptr equ this dword
keep_off9 dw ?
keep_seg9 dw ?
END
Pretty much the simplest tsr
Google will turn up lotes of tsr information.
Alex Russell


|