Jerome Grimbert writes:

> My assembly being a little rusted, I would like to check with the knowledgeable
> people the following portion of code.
>
>
>               ...
>               tst.l   d2
>               beq.s   first_place
> second_place:
>               ...
>
> Now, if d2 is 0, would executing that code reach first_place or second_place ?
> (I have my idea, but I do not want to influence the audience).
>
> Thanks for your attention.
 
Glad to see that "assembly questions" still appear to attract a lot of interest. I too sometimes have problems with conditionals. Probably something to do with latent dyslexia (I really must get round to joining the DNA - National Dyslexia Association  ;) (If you dont get the joke you are probably a sufferer too!) My solution was to create and use the following table:
 
                           Conditional branching (bcc)
                           ---------------------------

                                   CMP Dx,Dy
 
                        X = branch taken, N Z C = flags set
 

            Dx/Dy  |  1/0  |  1/1  | -1/0  |  0/1  | 1/-1  | -2/-1 |
            Flags  |   NC  |   Z   |   C   | ----  |   N   |  ---- |
                   + - - - + - - - + - - - + - - - + - - - + - - - +
          U   bhi  |       |       |       |   X   |   X   |   X   |
                   +       +       +       +       +       +       +
          U   bls  |   X   |   X   |   X   |       |       |       |
                   +       +       +       +       +       +       +
          U   bcc  |       |   X   |       |   X   |   X   |   X   |
                   +       +       +       +       +       +       +
          U   bcs  |   X   |       |   X   |       |       |       |
                   +       +       +       +       +       +       +
              bne  |   X   |       |   X   |   X   |   X   |   X   |
                   +       +       +       +       +       +       +
              beq  |       |   X   |       |       |       |       |
                   +       +       +       +       +       +       +
          S   bpl  |       |   X   |   X   |   X   |       |   X   |
                   +       +       +       +       +       +       +
          S   bmi  |   X   |       |       |       |   X   |       |
                   +       +       +       +       +       +       +
          S   bge  |       |   X   |   X   |   X   |       |   X   |
                   +       +       +       +       +       +       +
          S   blt  |   X   |       |       |       |   X   |       |
                   +       +       +       +       +       +       +
          S   bgt  |       |       |   X   |   X   |       |   X   |
                   +       +       +       +       +       +       +
          S   ble  |   X   |   X   |       |       |   X   |       |
                   +       +       +       +       +       +       +
 
                                    (Please let me know if you discover any mistakes!)
 
                                                                Per

Reply via email to