"IBM personal computer assembly language tutorial" - читать интересную книгу автора (Auerbach J.)

carry flags.

The addressing summary and the instruction summary given above masks a
lot of annoying little exceptions. For example, you can't POP CS, and
although the R <-- M form of LES is legal, the M <-- R form isn't etc.
etc. My advice is

a. Go for the general rules

b. Don't try to memorize the exceptions

c. Rely on common sense and the assembler to teach you about
exceptions over time. A lot of the exceptions cover things you
wouldn't want to do anyway.

5. A few instructions are rich enough and useful enough to warrent careful
study. Here are a few final study guidelines:

a. It is well worth the time learning to use the string instruction
set effectively. Among the most useful are

REP MOVSB ;moves a string
REP STOSB ;initializes memory
REPNE SCASB ;look up occurance of character in string
REPE CMPSB ;compare two strings

b. Similarly, if you have never written for a stack machine before,
you will need to exercise PUSH and POP and get very comfortable
with them because they are going to be good friends. If you are
used to the 370, with lots of general purpose registers, you may
find yourself feeling cramped at first, with many fewer registers
and many instructions having register restrictions. But, you have
a hidden ally: you need a register and you don't want to throw
away what's in it? Just PUSH it, and when you are done, POP it
back. This can lead to abuse. Never have more than two
"expedient" PUSHes in effect and never leave something PUSHed
across a major header comment or for more than 15 instructions or


IBM PC Assembly Language Tutorial 9


so. An exception is the saving and restoring of registers at
entrance to and exit from a subroutine; here, if the subroutine is
long, you should probably PUSH everything which the caller may need
saved, whether you will use the register or not, and POP it in
reverse order at the end.

Be aware that CALL and INT push return address information on the
stack and RET and IRET pop it off. It is a good idea to become