[comp.lang.pascal] Turbo Vision

mwizard@eecs.cs.pdx.edu (Craig Nelson) (03/16/91)

	Craig, here (you already knew that).  I ran across a small glitch in
Turbo Vision's EDITORS.TPU unit.  Seems the speedy routines someone optimized
in the EDITORS.PAS source code have a bug.  I refer to the ScanKeyMap routine
in specific.  Try running the TVEDIT program and type  $10.00,  or maybe
100%,  or how about #00.  You notice what I did. The $,%,#, and ^ symbols are
filtered out due to the algorithm being used.  May also be the structure it
references (the KeyMap) but it looks pretty sound.  Those characters mentioned
earlier filter out to be such nice things as ShiftIns, CtrlIns, etc... Nice
little addition, but it kinda screws up the project I was working on.  I'm
working on the fix right now.  The assembly code is pretty straight foreward
so it shouldn't take too long.  
	If anyone out there already has a fix I could use the extra typing time
to do bigger and better things (like hunt for more bugs)

	Mail responses, questions, comments, money, etc... to

	mwizard@eecs.ee.pdx.edu   (Craig Nelson)

reino@cs.eur.nl (Reino de Boer) (03/18/91)

In <1981@pdxgate.UUCP> mwizard@eecs.cs.pdx.edu (Craig Nelson) writes:

>	Craig, here (you already knew that).  I ran across a small glitch in
>Turbo Vision's EDITORS.TPU unit.  Seems the speedy routines someone optimized
>in the EDITORS.PAS source code have a bug.  I refer to the ScanKeyMap routine
>in specific.  Try running the TVEDIT program and type  $10.00,  or maybe
>100%,  or how about #00.  You notice what I did. The $,%,#, and ^ symbols are
>filtered out due to the algorithm being used.  May also be the structure it
>references (the KeyMap) but it looks pretty sound.  Those characters mentioned
>earlier filter out to be such nice things as ShiftIns, CtrlIns, etc... Nice
>little addition, but it kinda screws up the project I was working on.  I'm
>working on the fix right now.  The assembly code is pretty straight foreward
>so it shouldn't take too long.  
>	If anyone out there already has a fix I could use the extra typing time
>to do bigger and better things (like hunt for more bugs)

function ScanKeyMap(KeyMap: Pointer; KeyCode: Word): Word; assembler;
asm
	PUSH	DS
	LDS	SI,KeyMap
	MOV	DX,KeyCode
	CLD
	LODSW
	MOV	CX,AX
@@1:	LODSW
	MOV	BX,AX
	LODSW
	{ The next line used to be OR BL,BL }
	OR	DL,DL  { BL, BL : WAS THIS A BUG ??????????? }
	{ I think it does the right thing now ? }
	JE	@@2
	CMP	BL,DL
	JNE	@@3
	OR	BH,BH
	JE	@@4
@@2:	CMP	BH,DH
	JE	@@4
@@3:	LOOP	@@1
        XOR     AX, AX
@@4:    POP	DS
end;

Hope this fixes the editors -- Reino
-- 
Reino R. A. de Boer     "We want to build the right product right, right?"
Erasmus University Rotterdam ( Informatica )
e-mail: reino@cs.eur.nl