Microsoft KB Archive/35794

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Sample Program on scasb Instruction Documentation Error ID Number: Q35794

5.00
MS-DOS docerr

Summary:

On Page 371, section 18.3, of the “Microsoft Macro Assembler Programmer’s Guide,” the code fragment and discussion are incorrect.

The manual implies that if CX=0 after the “repne scasb” instruction, the character was not found. This information is false; the character could have been in the last byte of the string. Furthermore, the programmer’s guide states that if the character is found, then ES:DI points to the character. This information also is wrong. ES:DI points to one after the character.

On Page 364, the programmers guide correctly describes the steps in which the CPU executes the repne prefix with the scasb instruction.

This documentation error was corrected on the “Microsoft Macro Assembler Programmer’s Guide” for Version 5.10.

More Information:

The code sample is as follows:

.DATA

string db ‘The quick brown fox jumps over the lazy dog" lstring equ $-string pstring dd string .CODE . . . cld mov cs,lstring ;Load length of string les di,pstring ;Load address of string mov al,’z’ ;Load character tofind repne scasb ;Search jcxz notfoung ;CX is 0 if not found . . . notfound: