home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PCASM1.ZIP / APP3.DOC < prev    next >
Text File  |  1990-08-02  |  29KB  |  717 lines

  1.  
  2.  
  3.  
  4.                                                                          xxvii
  5.  
  6.  
  7.                       APPENDIX III - INSTRUCTION SPEED AND FLAGS
  8.  
  9.  
  10.              This appendix contains a list of all the 8086 instructions along
  11.              with their relatives speed and the flags they affect. These speed
  12.              numbers are from INTEL and are in clock ticks.{1} If you have a
  13.              25 mhz clock, then it is doing 25 million ticks per second. If
  14.              you have a 4.77 mhz clock, then it is doing 4.77 million ticks
  15.              per second. Instead of calling them ticks, I'll be calling them
  16.              clocks.
  17.  
  18.              In order to understand these numbers, you need a little extra
  19.              information. In order to do an instruction, ANY microprocessor
  20.              must:
  21.  
  22.                  (1) calculate any memory addresses.
  23.                  (2) fetch the two operands (or the single operand if it is   
  24.                      an instruction like NOT).
  25.                  (3) process the instruction and 
  26.                  (4) put the result in the destination. 
  27.  
  28.              While (3) will require the same amount of time whether the
  29.              operands are in memory or in registers, (1), (2) and (4) are all
  30.              different depending on where the operands are. Some machines
  31.              allow both operands to be in memory, but the 8086 does not.
  32.              Therefore, (1) is either NO memory addresses (if everything is in
  33.              registers) or ONE memory address. 
  34.  
  35.              Calculating a memory address involves (a) calculating the offset
  36.              from the beginning of the segment and (b) adding it to the
  37.              segment starting address. Part (a) is different depending on the
  38.              addressing mode. In terms of the speed of calculating (a) and
  39.              (b), the order is:
  40.  
  41.                  (i)     one pointer
  42.                  (ii)    named variable (+ constant) 
  43.                  (iii)   two pointers
  44.                  (iv)    one pointer + constant
  45.                  (v)     two pointers + constant
  46.  
  47.              The reason that (ii) contains both "variable" and "variable +
  48.              constant" is that the addition (variable + constant) is done by
  49.              the assembler, not the 8086. By the time the 8086 sees it, it is
  50.              a single number. The constants in both (iv) and (v) need to be
  51.              added by the 8086, and this takes extra time. According to INTEL,
  52.              here is the time required for calculating all possible memory
  53.              addresses. Note that some pointers are marginally faster than
  54.              other pointers (this is trivial - don't worry about it).
  55.  
  56.              ____________________
  57.  
  58.                 1 All the speed numbers are from "Programmer's Pocket
  59.              Reference Guide", (c)1980, 1982 Intel Corporation.
  60.  
  61.              ______________________
  62.  
  63.              The PC Assembler Tutor - Copyright (C) 1990 Chuck Nelson
  64.  
  65.  
  66.  
  67.  
  68.              The PC Assembler Tutor                                     xxviii
  69.              ______________________
  70.  
  71.  
  72.                         ADDRESSING MODE                          CLOCKS (EA)
  73.                  (i)   [bx], [si], [di], [bp]                           5
  74.                  (ii)  variable (+ constant)                            6
  75.                  (iii) [bp+di] or [bx+si]                               7
  76.                        [bp+si] or [bx+di]                               8
  77.                  (iv)  ([bx] or [si] or [di] or [bp]) + constant        9
  78.                  (v)   ([bp+di] or [bx+si]) + constant                  11
  79.                        ([bp+si] or [bx+di]) + constant                  12
  80.                         
  81.              The most complicated memory address takes 2.4 times longer to
  82.              calculate than the simplest address. These calculation times will
  83.              be noted by EA (calculate Effective Address). Remember, if both
  84.              operands are in registers, this calculation does not have to be
  85.              done. 
  86.  
  87.              In order for you to see how all of this works, we'll use ADD as
  88.              an example. Don't start using the table till you understand this
  89.              example.
  90.  
  91.              On the 8086, we normaly have the following possibilities for
  92.              source and destination:
  93.  
  94.                  register, register
  95.                  register, memory
  96.                  memory, register
  97.                  register, constant
  98.                  memory, constant
  99.  
  100.              In Appendix II, we simply combined them as:
  101.  
  102.                  reg/mem, reg/mem
  103.                  reg/mem, constant
  104.  
  105.              We can't do this here because they all have different times. For
  106.              ADD they are:
  107.  
  108.                  ADD                      CLOCKS
  109.                  register, register       3
  110.                  register, memory         9  + EA
  111.                  memory, register         16 + EA
  112.                  register, constant       4
  113.                  memory, constant         17 + EA
  114.  
  115.              Notice how much faster using a register is. The EA stands for
  116.              "calculate Effective Address" and is the number from the list
  117.              above. If you have:
  118.  
  119.                  add  ax, bx
  120.  
  121.              that is "register, register", and it will take 3 clocks to
  122.              execute. If you have:
  123.  
  124.                  add [bx+di+9], 17
  125.  
  126.              that is "memory, constant" and will take 17 + EA. What is EA
  127.              here? According to the above list, [BX+DI+CONSTANT] takes 12
  128.  
  129.  
  130.  
  131.  
  132.              Appendix III - Speeds and Flag Settings                      xxix
  133.              _______________________________________
  134.  
  135.              cycles, so 17 + EA is 17 + 12 is 29, so this will take 29 clocks.
  136.              That's right. The one instruction is almost 10 times slower than
  137.              the other. If you can move things into some registers, do a
  138.              number of calculations, and then move them back to memory, you
  139.              can save a lot of time. Let's do a few examples to make sure that
  140.              you see all of them:
  141.  
  142.  
  143.                  INSTRUCTION              TYPE                TIME
  144.  
  145.                  add  variable1, bl       memory, register    16 + EA = 22
  146.                  add  bl, variable1       register, memory    9  + EA = 15
  147.                  add  [si], di            memory, register    16 + EA = 21
  148.                  add  di, [si]            register, memory    9  + EA = 14
  149.  
  150.              Examples 1 and 2 are the same except that source and destination
  151.              have been switched. The same applies to examples 3 and 4. Notice
  152.              that when the 8086 has to fetch the variable and then put the
  153.              result back in memory, it is significantly slower than when it
  154.              just gets the variable from memory and puts the result in a
  155.              register.
  156.  
  157.  
  158.                  INSTRUCTION              TYPE                TIME
  159.  
  160.                  add  ax, cx              register, register  3
  161.                  add  di, 1876            register, constant  4
  162.                  add  variable1, 199      memory, constant    17 + EA = 23
  163.  
  164.              To show you how the different types of EA effect the time, let's
  165.              do all 3 types of "source, destination" that involve memory.
  166.              First, "memory, register":
  167.  
  168.  
  169.                  INSTRUCTION              TIME
  170.  
  171.                  add  [bx], ax            16 + EA = 21
  172.                  add  variable1, ax       16 + EA = 22
  173.                  add  [bp+di], ax         16 + EA = 23
  174.                  add  [bp+si], ax         16 + EA = 24
  175.                  add  [bx+9], ax          16 + EA = 25
  176.                  add  [bp+di+294], ax     16 + EA = 27
  177.                  add  [bx+di+294], ax     16 + EA = 28
  178.  
  179.              Now let's do the same things but go "register, memory":
  180.  
  181.                  INSTRUCTION              TIME
  182.  
  183.                  add  ax, [bx]            9 + EA = 14
  184.                  add  ax, variable1       9 + EA = 15
  185.                  add  ax, [bp+di]         9 + EA = 16
  186.                  add  ax, [bp+si]         9 + EA = 17
  187.                  add  ax, [bx+9]          9 + EA = 18
  188.                  add  ax, [bp+di+294]     9 + EA = 20
  189.                  add  ax, [bx+di+294]     9 + EA = 21
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.              The PC Assembler Tutor                                        xxx
  197.              ______________________
  198.  
  199.              And finally we have "memory, constant":
  200.  
  201.                  INSTRUCTION              TIME
  202.  
  203.                  add  [bx], 177           17 + EA = 22
  204.                  add  variable1, 177      17 + EA = 23
  205.                  add  [bp+di], 177        17 + EA = 24
  206.                  add  [bp+si], 177        17 + EA = 25
  207.                  add  [bx+9], 177         17 + EA = 26
  208.                  add  [bp+di+294], 177    17 + EA = 28
  209.                  add  [bx+di+294], 177    17 + EA = 29
  210.  
  211.  
  212.              Is this everything you need to know before looking at the list?
  213.              Not quite. Most of the 8086 family has a 16 bit data bus. That
  214.              means that there are 16 wires connecting the processor to memory,
  215.              and the processor reads 1 word (2 bytes) at a time. These memory
  216.              reads ALWAYS start at an even location 1472d, 88026d, 198752d,
  217.              etc. If you are reading one byte, it makes no difference whether
  218.              it is at an even or odd location. If you are reading a word at an
  219.              even location, then everything is normal. If you are reading a
  220.              word at an ODD location, however, the processor must:
  221.  
  222.                  1) start reading at the first even location that contains
  223.                  the variable.
  224.                  2) read the next even location (which contains the last part
  225.                  of the variable).
  226.                  3) join the parts together.
  227.  
  228.              As an example, let's take a word at address 21957 (i.e. 21957-
  229.              21958). The processor will:
  230.  
  231.                  1) read the high byte from the word at 21956
  232.                  2) read the low byte from the word at 21958
  233.                  3) join them together. It now has 21957-21958.
  234.  
  235.              The processor can do this, but it takes extra time (4 extra clock
  236.              ticks), so our speed listing will also contain the following
  237.              notice:
  238.  
  239.                  WORDS WHICH ARE AT ODD ADDRESSES NEED 4 EXTRA CLOCKS
  240.  
  241.              Thus for:
  242.  
  243.                  add  ax, variable1        (9 + EA = 15)
  244.  
  245.              if the address is an even location, the instruction will require
  246.              15 clocks. If it is an odd location, the instruction will require
  247.              19 clocks (4 extra ticks). It is worth your while to keep words
  248.              at even locations if at all possible.
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.              Appendix III - Speeds and Flag Settings                      xxxi
  261.              _______________________________________
  262.  
  263.  
  264.                                 INSTRUCTION SPEEDS AND FLAGS
  265.  
  266.  
  267.              REGISTER:
  268.                  One of the arithmetic registers - either word (AX, BX, CX,
  269.                  DX, SI, DI, BP, SP for word operations) or byte (AH, AL, BH,
  270.                  BL, CH, CL, DH or DL for byte operations).
  271.  
  272.              AX or AL:
  273.                  AX and AL are considered special on the 8086. Sometimes
  274.                  there is a special AX/AL form of the instruction, (such as
  275.                  for ADD). This form will be shorter. It will only be noted
  276.                  if it is FASTER (such as for MOV) or if it is the only form
  277.                  allowed. It will either say (AX/AL) or (AX only) depending
  278.                  on whether both words and bytes are allowed or only words
  279.                  are allowed. Though both multiplication and division require
  280.                  the use of the (AX/AL) register, the AX/AL is understood,
  281.                  and is not mentioned in the instruction.
  282.  
  283.              SEGREG:
  284.                  One of the 4 segment registers - CS, DS, ES or SS.
  285.  
  286.              MEMORY:
  287.                  Either a byte or word in memory. It may be addressed with
  288.                  any possible addressing mode, and the extra time needed to
  289.                  calculate the address in memory (EA - calculate Effective
  290.                  Address) is the following:
  291.  
  292.  
  293.                         ADDRESSING MODE                          CLOCKS (EA)
  294.  
  295.                  (i)   [bx], [si], [di], [bp]                           5
  296.                  (ii)  variable (+ constant)                            6
  297.                  (iii) [bp+di] or [bx+si]                               7
  298.                        [bp+si] or [bx+di]                               8
  299.                  (iv)  ([bx] or [si] or [di] or [bp]) + constant        9
  300.                  (v)   ([bp+di] or [bx+si]) + constant                  11
  301.                        ([bp+si] or [bx+di]) + constant                  12
  302.                         
  303.              EXTRA TIME:
  304.                  1) WORDS WHICH ARE AT ODD ADDRESSES NEED 4 EXTRA CLOCKS.
  305.                  2) A segment override adds 2 clocks to the instruction.
  306.  
  307.  
  308.  
  309.              FLAGS
  310.  
  311.              Following the instruction mnemonic is information in square
  312.              brackets that indicates how the instruction effects the flags
  313.              register. There are three possibilities
  314.  
  315.                  1) The instruction may alter the value of a flag in a
  316.                  particular way depending on the result. For AND, the sign,
  317.                  zero and parity flags [SZP] will be set according to the
  318.                  result.
  319.  
  320.  
  321.  
  322.  
  323.  
  324.              The PC Assembler Tutor                                      xxxii
  325.              ______________________
  326.  
  327.                  2) The instruction may set a flag to a specific number
  328.                  (either 1 or 0). For AND, the overflow flag and the carry
  329.                  flag are cleared [(OC=0)].
  330.  
  331.                  3) The instruction may unreliably alter a flag. That means
  332.                  that the instruction might change the flag, but that it
  333.                  gives you no information. This kind of flag cannot be
  334.                  trusted after this operation. For AND, the auxillary flag is
  335.                  unreliable [?A?].
  336.  
  337.              The information will always be displayed in this order. The flags
  338.              which are reliably set according to the result will be listed
  339.              first [SZP]. Next, any flags which are either set or cleared will
  340.              be put inside parentheses followed by an equal sign followed by
  341.              the value of the flag (all inside of the parentheses)
  342.              [SZP,(OC=0)]. Finally, any unrelaible flags will be put between
  343.              question marks [SZP,(OC=0),?A?]. Each part will be separated by
  344.              commas. If no flags are changed by the instruction, the brackets
  345.              will have [none] written between them.
  346.  
  347.              Each flags will be indicated by a single letter. The letters are:
  348.  
  349.                  O    overflow flag       0 = no overflow, 1 = overflow
  350.  
  351.                  D    direction flag      direction of movement
  352.                                           for string instructions
  353.                                           0 = upwards, 1 = downwards
  354.  
  355.                  I    interrupt enable    0 = no ints, 1 = ints o.k.
  356.  
  357.                  T    trap flag           trap next instruction?
  358.                                           0 = no trap, 1 = trap
  359.  
  360.                  S    sign flag           0 = positive, 1 = negative
  361.  
  362.                  Z    zero flag           0 = non-zero, 1 = zero
  363.  
  364.                  A    auxillary flag      carry out of bottom half
  365.                                           register?  0 = no, 1 = yes
  366.  
  367.                  P    parity flag         0 = odd, 1 = even
  368.  
  369.                  C    carry flag          0 = no carry, 1 = carry
  370.  
  371.  
  372.  
  373.              ***************** THE INSTRUCTIONS *********************
  374.  
  375.              INSTRUCTION                TIMING
  376.  
  377.              AAA [AC,?OSZP?]         4 clocks
  378.  
  379.              AAD [SZP,?OAC?]         60 clocks
  380.  
  381.              AAM [SZP,?OAC?]         83 clocks
  382.  
  383.              AAS [AC,?OSZP?]         4 clocks
  384.  
  385.  
  386.  
  387.  
  388.              Appendix III - Speeds and Flag Settings                    xxxiii
  389.              _______________________________________
  390.  
  391.  
  392.              ADC [OSZAPC]            see ADD
  393.  
  394.              ADD [OSZAPC]            register, register    3
  395.                                      register, memory      9  + EA
  396.                                      memory, register      16 + EA
  397.                                      register, constant    4
  398.                                      memory, constant      17 + EA
  399.  
  400.              AND [SZP,(OC=0),?A?]    see ADD
  401.  
  402.              CALL [none]             near call                19
  403.                                      far call                 28
  404.                                      near call (reg-ind)      16  {2}
  405.                                      near call (mem-ind)      21 + EA
  406.                                      far call (mem-ind)       37 + EA
  407.  
  408.              CBW [none]              2 clocks
  409.  
  410.              CLC [(C=0)]             2 clocks
  411.  
  412.              CLD [(D=0)]             2 clocks
  413.  
  414.              CLI [(I=0)]             2 clocks
  415.  
  416.              CMC [C]                 2 clocks
  417.  
  418.              CMP [OSZAPC]            register, register    3
  419.                                      register, memory      9  + EA
  420.                                      memory, register      9  + EA
  421.                                      register, constant    4
  422.                                      memory, constant      10 + EA
  423.  
  424.              CMPS [OSZAPC]           22 clocks
  425.  
  426.              CWD [none]              5 clocks
  427.  
  428.              DAA [SZAPC,?O?]         4 clocks
  429.  
  430.              DAS [SZAPC,?O?]         4 clocks
  431.  
  432.              DEC [OSZAP]             word register       2
  433.                                      byte register       3
  434.                                      word/byte memory    15 + EA
  435.  
  436.              DIV [?OSZAPC?]          byte register       80 - 90  {3}
  437.                                      word register       144 - 162
  438.              ____________________
  439.  
  440.                 2 These three last ones are indirect calls. They get the
  441.              address of the subroutine from a register (reg-ind) or from
  442.              memory (mem-ind).
  443.  
  444.                 3 The smaller the numbers, the faster this operation can be
  445.              accomplished. This applies for signed and unsigned multiplication
  446.              and division. They all show a range of values rather than a
  447.              specific value.
  448.  
  449.  
  450.  
  451.  
  452.              The PC Assembler Tutor                                      xxxiv
  453.              ______________________
  454.  
  455.                                      byte memory         (86 - 96) + EA
  456.                                      word memory         (150 - 168) + EA
  457.  
  458.              ESC [none]              memory              8 + EA
  459.                                      coproc. register    2
  460.                                      This only makes sense if you know
  461.                                      about coprocessors.
  462.  
  463.              HLT [none]              2 clocks
  464.  
  465.              IDIV [none]             byte register       101 - 112
  466.                                      word register       165 - 184
  467.                                      byte memory         (107 - 118) + EA
  468.                                      word memory         (171 - 190) + EA
  469.  
  470.              IMUL [OC,?SZAP?]        byte register       80 - 98
  471.                                      word register       128 - 154
  472.                                      byte memory         (86 - 104) + EA
  473.                                      word memory         (134 - 160) + EA
  474.  
  475.              IN [none]               (AX/AL), port#      10
  476.                                      (AX/AL), dx         8
  477.  
  478.              INC [OSCAP]             word register       2
  479.                                      byte register       3
  480.                                      word/byte memory    15 + EA
  481.  
  482.              INT [(IT=0) {4} ]       51 clocks  {5}
  483.  
  484.              INTO [ {6} ]            overflow            54
  485.                                      no overflow         4
  486.  
  487.              IRET [ {7} ]            24 clocks
  488.  
  489.  
  490.              J(condition) [none]     This includes all conditional jumps
  491.                                      (JAE, JZ, JNO, JLE, JP, etc.) with the
  492.                                      exception of JCXZ.
  493.                                      jump                16
  494.                                      no jump             4
  495.              ____________________
  496.  
  497.                 4 Although this sets the trap flag and interrupt flag to 0, it
  498.              doesn't do it to YOUR flags, it does it to the flags that the
  499.              interrupt will see. Your flags are safely stored on the stack and
  500.              will return unaltered at the end of the interrupt.
  501.  
  502.                 5 There is one exception. INT 3, when coded as the single byte
  503.              trap interrupt, is 52 clocks.
  504.  
  505.                 6 If there is overflow, it pushes your flags and sets (IT=0)
  506.              for the interrupt. If there was no overflow, it does nothing. In
  507.              either case your own flags will remain unaffected.
  508.  
  509.                 7 This puts the copy of your old flags back in the flags
  510.              register. The flags will be the same as they were when you called
  511.              the interrupt.
  512.  
  513.  
  514.  
  515.  
  516.              Appendix III - Speeds and Flag Settings                      xxxv
  517.              _______________________________________
  518.  
  519.  
  520.              JCXZ [none]             jump                18
  521.                                      no jump             6
  522.  
  523.              JMP [none]              same segment        15
  524.                                      different segment   15
  525.                                      near (reg-ind)      11  {8}
  526.                                      near (mem-ind)      18 + EA
  527.                                      far  (mem-ind)      24 + EA
  528.  
  529.              LAHF [none]             4 clocks
  530.  
  531.              LDS [none]              16 + EA
  532.  
  533.              LES [none]              16 + EA
  534.  
  535.              LEA [none]              2 + EA
  536.  
  537.              LOCK [none]             2 clocks
  538.  
  539.              LODS [none]             12 clocks
  540.  
  541.              LOOP [none]             jump                17
  542.                                      no jump             5
  543.  
  544.              LOOPE/LOOPZ [none]      jump                18
  545.                                      no jump             6
  546.  
  547.              LOOPNE/LOOPNZ [none]    jump                19
  548.                                      no jump             5
  549.  
  550.              MOV [none]              register, register    2
  551.                                      register, memory      8  + EA
  552.                                      memory, register      9  + EA
  553.                                      register, constant    4
  554.                                      memory, constant      10 + EA
  555.                                      (AX/AL) <-> memory    10 {9}
  556.  
  557.  
  558.  
  559.              ____________________
  560.  
  561.                 8 These last three are indirect jumps. The information about
  562.              where to jump to is coming from a register (reg-ind) or from
  563.              memory (mem-ind).
  564.  
  565.                 9 This is a special instruction which moves a directly
  566.              addressed variable to or from AX (or AL for bytes). Pointers are
  567.              not allowed, only the forms:
  568.  
  569.                  mov  ax, variable1
  570.                  mov  variable1, ax
  571.  
  572.              This takes 10 clocks instead of 14 or 15 for the other form.
  573.              Whether this form gets used is up to the assembler, not you.
  574.              Fortunately, MASM, TurboAssembler and A86 all use this form when
  575.              appropriate.
  576.  
  577.  
  578.  
  579.  
  580.              The PC Assembler Tutor                                      xxxvi
  581.              ______________________
  582.  
  583.                                      segreg <-> register   2  {10}
  584.                                      segreg, memory        8 + EA
  585.                                      memory, segreg        9 + EA
  586.  
  587.              MOVS [none]             11 clocks
  588.  
  589.              MUL [OC,?SZAP?]         byte register       70 - 77
  590.                                      word register       118 - 133
  591.                                      byte memory         (76 - 83) + EA
  592.                                      word memory         (124 - 139) + EA
  593.  
  594.              NEG [OSZAPC] {11}       register            3
  595.                                      memory              16 + EA
  596.  
  597.              NOP [none]              3 clocks
  598.  
  599.              NOT [none]              register            3
  600.                                      memory              16 + EA
  601.  
  602.              OR [SZP,(OC=0),?A?]     see ADD
  603.  
  604.              OUT [none]              (AX/AL), port#      10
  605.                                      (AX/AL), dx         8
  606.  
  607.              POP [none]              register            8
  608.                                      segreg              8
  609.                                      memory              17 + EA
  610.  
  611.              POPF [ {12} ]           8 clocks
  612.  
  613.              PUSH [none]             register            11
  614.                                      segreg              10
  615.                                      memory              16 + EA
  616.  
  617.              PUSHF [none]            10 clocks
  618.  
  619.              RCL [OC]                register by 1 bit     2
  620.                                      memory by 1 bit       15 + EA
  621.                                      register by # in CL   8 + (4 * #) {13}
  622.                                      memory by # in CL     20 + EA + (4 * #)
  623.  
  624.              RCR [OC]                see RCL
  625.  
  626.              ____________________
  627.  
  628.                 10 MOV, PUSH and POP are the only instructions that can alter
  629.              the segment registers (other than CALLs and JMPs).
  630.  
  631.                 11 (NEG number) sets the flags the same as (SUB 0, number).
  632.  
  633.                 12 POPF resets the flags register by POPping a word of the
  634.              stack and using the values stored in that word.
  635.  
  636.                 13 Thus, if you rotate right by 3 bits add (4 * 3), if you
  637.              rotate by 7 bits add (4 * 7), if you rotate by 2 bits add 
  638.              (4 * 2).  As you can see, this can cost a lot of time if you are
  639.              rotating more than 3 or 4 bits.
  640.  
  641.  
  642.  
  643.  
  644.              Appendix III - Speeds and Flag Settings                    xxxvii
  645.              _______________________________________
  646.  
  647.              REP [none]              2 clocks
  648.  
  649.              RET [none]              near ret            8 {14}
  650.                                      near ret (#)        12
  651.                                      far ret             18
  652.                                      far ret (#)         17
  653.  
  654.              ROL [OC]                see RCL
  655.  
  656.              ROR [OC]                see RCL
  657.  
  658.              SAHF [ {15} ]           4 clocks
  659.  
  660.              SAL/SHL [OSZPC,?A?]     see RCL
  661.  
  662.              SAR [OSZPC,?A?]         see RCL
  663.  
  664.              SBB [OSZAPC]            see ADD
  665.  
  666.              SCAS [OSZAPC]           15 clocks
  667.  
  668.              SEGMENT OVERRIDE [none] 2 clocks
  669.  
  670.              SHR [OSZPC,?A?]         see RCL
  671.  
  672.              STC [(C=1)]             2 clocks
  673.  
  674.              STD [(D=1)]             2 clocks
  675.  
  676.              STI [(I=1)]             2 clocks
  677.  
  678.              STOS [none]             11 clocks
  679.  
  680.              SUB [OSZAPC]            see ADD
  681.  
  682.              TEST [SZP,(OC=0),?A?]   register, register    3
  683.                                      register, memory      9  + EA
  684.                                      memory, register      9  + EA
  685.                                      (AX/AL), constant     4
  686.                                      register, constant    5
  687.                                      memory, constant      11 + EA
  688.  
  689.              WAIT [none]             3 clocks minimum, then check every 5
  690.                                      clocks 
  691.  
  692.              XCHG [none]             register, register    4
  693.                                      (AX only), register   3
  694.              ____________________
  695.  
  696.                 14 The # here indicates that you pop things off the stack as
  697.              you would in a Pascal program:
  698.  
  699.                  ret (18)
  700.                  ret (6)
  701.  
  702.                 15 Alters the values of the SZAPC flags according to the
  703.              values in the AH register.
  704.  
  705.  
  706.  
  707.  
  708.              The PC Assembler Tutor                                    xxxviii
  709.              ______________________
  710.  
  711.                                      register, memory      17 + EA
  712.  
  713.              XLAT [none]             11 clocks
  714.  
  715.              XOR [SZP,(OC=0),?A?]    see ADD
  716.  
  717.