Most people, having learned a little assembly language, grumble about the seemingly huge number of instructions it takes to do anything useful. By and large, this is a legitimate gripe-and the major reason people write programs in higher-level languages such as Pascal and Basic. The x86 instruction set, on the other hand, is full of surprises, and the surprise most likely to make apprentice assembly programmers gasp is the instruction group we call the string instructions.
They alone of all the instructions in the x86 instruction set have the power to deal with long sequences of bytes or words at one time. (In assembly language, any contiguous sequence of bytes or words in memory may be considered a string-not simply sequences of human-readable characters.) More amazingly, they deal with these large sequences of bytes or words in an extraordinarily compact way: by executing an instruction loop entirely inside the CPU! A string instruction is, in effect, a complete instruction loop baked into a single instruction.
The string instructions are subtle and complicated, and I won't be able to treat them exhaustively in this book. Much of what they do qualifies as an advanced topic. Still, you can get a good start on understanding the string instructions by using them to build some simple tools to add to your video toolkit.
Besides, for my money, the string instructions are easily the single most fascinating aspect of assembly language work.