; smelly.asm By Michael Kohn ; April 7,1995 ; EXPECTS: es to point to the start of video page being searched ; si should point to a string in memory ending in either a 0 ; or a chr$(13) (CR) ; RETURNS: nothing.. just highlights selected text (if found) on screen .model tiny .code start: jmp Installation wsear: inc si ; a recursive routine that checks for two words add di, 2 ; being similar (wow! recursion :) mov bl, es:[di] mov bh, [si] cmp bh, 13 je done cmp bh, 0 je done cmp bl, bh jne skipy ; if difference, then abort recursion and cl=0 inc cl ; counts how many similar letters call wsear jmp done skipy: mov cl, 0 done: ret right: push di push si lea si, nwerd highl: mov bl, [si] cmp bl, 0 je donep mov es:[di], bl add di, 2 inc si jmp highl donep: pop si pop di ret search: mov di, 0 again: mov bl, es:[di] mov bh, [si] cmp bl, bh jne skip mov cl, 1 push si push di call wsear ; my RECURSIVE routine pop di pop si cmp cl, 0 jz skip call right ; for lack of a better name :) skip: add di, 2 cmp di, 4000 jne again ret oldInt8 label dword oldIP dw ? oldCS dw ? werd db "EXE",0 nwerd db "XXX",0 .286 myIntHandler: sti pusha push ds push es mov ax, cs mov ds, ax mov ax, 0b800h mov es, ax lea si, werd call search pop es pop ds popa jmp cs:oldInt8 Installation: push cs pop ds mov ax,0 mov es, ax mov bx, es:[4*8] mov ax, es:[4*8+2] mov oldIP, bx mov oldCS, ax mov es:[4*8+2], cs lea ax, myIntHandler mov es:[4*8], ax mov dx, 100h mov al, 0 mov ah, 31h int 21h ; lea dx, Installation ; int 27h end start