Changeset 903

Show
Ignore:
Timestamp:
02/15/07 06:57:10 (2 years ago)
Author:
common
Message:

libemu

  • add logic for jcc
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libemu/trunk/src/functions/jcc.c

    r888 r903  
    77#include "emu/emu_memory.h" 
    88 
    9  
     9#define OF_IS_ONE(cpu)  (CPU_FLAG_ISSET(cpu, f_of) != 0)  
     10#define OF_IS_ZERO(cpu) (CPU_FLAG_ISSET(cpu, f_of) == 0) 
     11#define OF_IS(cpu)      (CPU_FLAG_ISSET(cpu, f_of)?1:0)  
     12  
     13#define CF_IS_ONE(cpu)  (CPU_FLAG_ISSET(cpu, f_cf) != 0)  
     14#define CF_IS_ZERO(cpu) (CPU_FLAG_ISSET(cpu, f_cf) == 0)  
     15 
     16#define ZF_IS_ONE(cpu)  (CPU_FLAG_ISSET(cpu, f_zf) != 0)  
     17#define ZF_IS_ZERO(cpu) (CPU_FLAG_ISSET(cpu, f_zf) == 0)  
     18 
     19#define SF_IS_ONE(cpu)  (CPU_FLAG_ISSET(cpu, f_sf) != 0)  
     20#define SF_IS_ZERO(cpu) (CPU_FLAG_ISSET(cpu, f_sf) == 0)  
     21#define SF_IS(cpu)      (CPU_FLAG_ISSET(cpu, f_sf)?1:0)  
     22 
     23#define PF_IS_ONE(cpu)  (CPU_FLAG_ISSET(cpu, f_pf) != 0)  
     24#define PF_IS_ZERO(cpu) (CPU_FLAG_ISSET(cpu, f_pf) == 0)  
    1025 
    1126 
     
    1328{ 
    1429        /* 70 cb       Jump short if overflow (OF=1)                           JO rel8         */ 
     30        if (OF_IS_ONE(c)) 
     31        { 
     32                 
     33        } 
    1534        return 0; 
    1635} 
     
    2039 
    2140        /* 71 cb       Jump short if not overflow (OF=0)                       JNO rel8        */ 
     41        if (OF_IS_ZERO(c)) 
     42        { 
     43                 
     44        } 
    2245        return 0; 
    2346} 
     
    2952        /* 72 cb       Jump short if carry (CF=1)                              JC rel8         */ 
    3053        /* 72 cb       Jump short if not above or equal (CF=1)                 JNAE rel8       */ 
     54        if (CF_IS_ONE(c)) 
     55        { 
     56                 
     57        } 
    3158        return 0; 
    3259} 
     
    3865        /* 73 cb       Jump short if not below (CF=0)                          JNB rel8        */ 
    3966        /* 73 cb       Jump short if not carry (CF=0)                          JNC rel8        */ 
    40  
     67        if (CF_IS_ZERO(c)) 
     68        { 
     69                 
     70        } 
    4171 
    4272        return 0; 
     
    4878        /* 74 cb       Jump short if equal (ZF=1)                              JE rel8         */ 
    4979        /* 74 cb       Jump short if zero (ZF = 1)                             JZ rel8         */ 
    50  
     80        if (ZF_IS_ONE(c)) 
     81        { 
     82                 
     83        } 
    5184 
    5285        return 0; 
     
    5891        /* 75 cb       Jump short if not equal (ZF=0)                          JNE rel8        */ 
    5992        /* 75 cb       Jump short if not zero (ZF=0)                           JNZ rel8        */ 
    60  
     93        if (ZF_IS_ZERO(c)) 
     94        { 
     95                 
     96        } 
    6197 
    6298        return 0; 
     
    68104        /* 76 cb       Jump short if below or equal (CF=1 or ZF=1)             JBE rel8        */ 
    69105        /* 76 cb       Jump short if not above (CF=1 or ZF=1)                  JNA rel8        */ 
    70  
     106        if (CF_IS_ONE(c) || ZF_IS_ONE(c)) 
     107        { 
     108                 
     109        } 
    71110 
    72111        return 0; 
     
    78117        /* 77 cb       Jump short if above (CF=0 and ZF=0)                     JA rel8         */ 
    79118        /* 77 cb       Jump short if not below or equal (CF=0 and ZF=0)        JNBE rel8       */ 
     119        if (CF_IS_ZERO(c) && ZF_IS_ZERO(c)) 
     120        { 
     121 
     122        } 
    80123 
    81124 
     
    87130 
    88131        /* 78 cb       Jump short if sign (SF=1)                               JS rel8         */ 
    89  
     132        if (SF_IS_ONE(c)) 
     133        { 
     134                 
     135        } 
    90136 
    91137        return 0; 
     
    96142 
    97143        /* 79 cb       Jump short if not sign (SF=0)                           JNS rel8        */ 
    98  
     144        if (SF_IS_ZERO(c)) 
     145        { 
     146                 
     147        } 
    99148 
    100149        return 0; 
     
    106155        /* 7A cb       Jump short if parity even (PF=1)                        JPE rel8        */ 
    107156        /* 7A cb       Jump short if parity (PF=1)                             JP rel8         */ 
    108  
     157        if (PF_IS_ONE(c)) 
     158        { 
     159                 
     160        } 
    109161 
    110162        return 0; 
     
    116168        /* 7B cb       Jump short if not parity (PF=0)                         JNP rel8        */ 
    117169        /* 7B cb       Jump short if parity odd (PF=0)                         JPO rel8        */ 
     170        if (PF_IS_ZERO(c)) 
     171        { 
     172 
     173        } 
    118174 
    119175 
     
    126182        /* 7C cb       Jump short if less (SF<>OF)                             JL rel8         */ 
    127183        /* 7C cb       Jump short if not greater or equal (SF<>OF)             JNGE rel8       */ 
     184        if (SF_IS(c) != OF_IS(c)) 
     185        { 
     186 
     187        } 
    128188 
    129189 
     
    136196        /* 7D cb       Jump short if greater or equal (SF=OF)                  JGE rel8        */ 
    137197        /* 7D cb       Jump short if not less (SF=OF)                          JNL rel8        */ 
    138  
     198        if (SF_IS(c) == OF_IS(c)) 
     199        { 
     200 
     201        } 
    139202 
    140203        return 0; 
     
    146209        /* 7E cb       Jump short if less or equal (ZF=1 or SF<>OF)            JLE rel8        */ 
    147210        /* 7E cb       Jump short if not greater (ZF=1 or SF<>OF)              JNG rel8        */ 
     211        if ( ZF_IS_ONE(c) || (SF_IS(c) != OF_IS(c))) 
     212        { 
     213 
     214        } 
    148215 
    149216 
     
    156223        /* 7F cb       Jump short if greater (ZF=0 and SF=OF)                  JG rel8         */ 
    157224        /* 7F cb       Jump short if not less or equal (ZF=0 and SF=OF)        JNLE rel8       */ 
    158  
     225        if ( ZF_IS_ONE(c) && (SF_IS(c) == OF_IS(c))) 
     226        { 
     227 
     228        } 
    159229 
    160230        return 0; 
     
    167237        /* E3 cb       Jump short if ECX register is 0                         JECXZ rel8      */ 
    168238 
    169  
    170239        return 0; 
    171240} 
     
    175244 
    176245        /* 0F 80 cw/cd  Jump near if overflow (OF=1)                           JO rel16/32     */ 
    177  
     246        if (OF_IS_ONE(c)) 
     247        { 
     248                 
     249        } 
    178250 
    179251        return 0; 
     
    184256 
    185257        /* 0F 81 cw/cd  Jump near if not overflow (OF=0)                       JNO rel16/32    */ 
    186  
     258        if (OF_IS_ZERO(c)) 
     259        { 
     260                 
     261        } 
    187262 
    188263        return 0; 
     
    195270        /* 0F 82 cw/cd  Jump near if carry (CF=1)                              JC rel16/32     */ 
    196271        /* 0F 82 cw/cd  Jump near if not above or equal (CF=1)                 JNAE rel16/32   */ 
    197  
     272        if (CF_IS_ONE(c)) 
     273        { 
     274                 
     275        } 
    198276 
    199277        return 0; 
     
    206284        /* 0F 83 cw/cd  Jump near if not below (CF=0)                          JNB rel16/32    */ 
    207285        /* 0F 83 cw/cd  Jump near if not carry (CF=0)                          JNC rel16/32    */ 
    208  
     286        if (CF_IS_ZERO(c)) 
     287        { 
     288                 
     289        } 
    209290 
    210291        return 0; 
     
    216297        /* 0F 84 cw/cd  Jump near if equal (ZF=1)                              JE rel16/32     */ 
    217298        /* 0F 84 cw/cd  Jump near if zero (ZF=1)                               JZ rel16/32     */ 
    218  
     299        if (ZF_IS_ONE(c)) 
     300        { 
     301                 
     302        } 
    219303 
    220304        return 0; 
     
    226310        /* 0F 85 cw/cd  Jump near if not equal (ZF=0)                          JNE rel16/32    */ 
    227311        /* 0F 85 cw/cd  Jump near if not zero (ZF=0)                           JNZ rel16/32    */ 
    228  
     312        if (ZF_IS_ZERO(c)) 
     313        { 
     314                 
     315        } 
    229316 
    230317        return 0; 
     
    236323        /* 0F 86 cw/cd  Jump near if below or equal (CF=1 or ZF=1)             JBE rel16/32    */ 
    237324        /* 0F 86 cw/cd  Jump near if not above (CF=1 or ZF=1)                  JNA rel16/32    */ 
    238  
     325        if (CF_IS_ONE(c) || ZF_IS_ONE(c)) 
     326        { 
     327                 
     328        } 
    239329 
    240330        return 0; 
     
    246336        /* 0F 87 cw/cd  Jump near if above (CF=0 and ZF=0)                     JA rel16/32     */ 
    247337        /* 0F 87 cw/cd  Jump near if not below or equal (CF=0 and ZF=0)        JNBE rel16/32   */ 
    248  
     338        if (CF_IS_ZERO(c) && ZF_IS_ZERO(c)) 
     339        { 
     340 
     341        } 
     342         
    249343 
    250344        return 0; 
     
    255349 
    256350        /* 0F 88 cw/cd  Jump near if sign (SF=1)                               JS rel16/32     */ 
    257  
     351        if (SF_IS_ONE(c)) 
     352        { 
     353                 
     354        } 
    258355 
    259356        return 0; 
     
    264361 
    265362        /* 0F 89 cw/cd  Jump near if not sign (SF=0)                           JNS rel16/32    */ 
    266  
     363        if (SF_IS_ZERO(c)) 
     364        { 
     365                 
     366        } 
    267367 
    268368        return 0; 
     
    274374        /* 0F 8A cw/cd  Jump near if parity even (PF=1)                        JPE rel16/32    */ 
    275375        /* 0F 8A cw/cd  Jump near if parity (PF=1)                             JP rel16/32     */ 
    276  
     376        if (PF_IS_ONE(c)) 
     377        { 
     378                 
     379        } 
    277380 
    278381        return 0; 
     
    284387        /* 0F 8B cw/cd  Jump near if not parity (PF=0)                         JNP rel16/32    */ 
    285388        /* 0F 8B cw/cd  Jump near if parity odd (PF=0)                         JPO rel16/32    */ 
    286  
     389        if (PF_IS_ZERO(c)) 
     390        { 
     391                 
     392        } 
    287393 
    288394        return 0; 
     
    294400        /* 0F 8C cw/cd  Jump near if less (SF<>OF)                             JL rel16/32     */ 
    295401        /* 0F 8C cw/cd  Jump near if not greater or equal (SF<>OF)             JNGE rel16/32   */ 
    296  
     402        if (SF_IS(c) != OF_IS(c)) 
     403        { 
     404                 
     405        } 
    297406 
    298407        return 0; 
     
    304413        /* 0F 8D cw/cd  Jump near if greater or equal (SF=OF)                  JGE rel16/32    */ 
    305414        /* 0F 8D cw/cd  Jump near if not less (SF=OF)                          JNL rel16/32    */ 
    306  
     415        if (SF_IS(c) == OF_IS(c)) 
     416        { 
     417                 
     418        } 
    307419 
    308420        return 0; 
     
    314426        /* 0F 8E cw/cd  Jump near if less or equal (ZF=1 or SF<>OF)            JLE rel16/32    */ 
    315427        /* 0F 8E cw/cd  Jump near if not greater (ZF=1 or SF<>OF)              JNG rel16/32    */ 
    316  
     428        if (ZF_IS_ONE(c) || SF_IS(c) != OF_IS(c)) 
     429        { 
     430                 
     431        } 
    317432 
    318433        return 0; 
     
    324439        /* 0F 8F cw/cd  Jump near if greater (ZF=0 and SF=OF)                  JG rel16/32     */ 
    325440        /* 0F 8F cw/cd  Jump near if not less or equal (ZF=0 and SF=OF)        JNLE rel16/32   */ 
    326  
    327  
    328         return 0; 
    329 
    330  
     441        if (ZF_IS_ZERO(c) && SF_IS(c) == OF_IS(c)) 
     442        { 
     443 
     444        } 
     445 
     446 
     447        return 0; 
     448
     449