File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,14 @@ static inline void SET_CF(unsigned int c)
145145 RFL .cout ^= (c != is_cf_set ()) * (LF_MASK_PO | LF_MASK_CF );
146146}
147147
148+ static inline void SET_ZF (unsigned int c )
149+ {
150+ // to set ZF in RFL.res we must transfer SF/PF to RFL.cout
151+ RFL .cout = (RFL .cout & ~(LF_MASK_PD | LF_MASK_SD )) |
152+ (((is_sf_set () << LF_BIT_SD ) | (is_pf_set () << LF_BIT_PD )) ^ LF_MASK_PD );
153+ RFL .res = (!c ) << 8 ;
154+ }
155+
148156/* add/sub rule for carry using MSB:
149157 * the carry-out expressions from Bochs 2.6 are used here.
150158 * RFL.cout is a cheap-to-compute 32-bit word that encodes the following flags:
@@ -2542,25 +2550,19 @@ unsigned int Gen_sim(const IGen *IG)
25422550 case O_BITOP : {
25432551 unsigned char o1 = (unsigned char )IG -> p0 ;
25442552 signed char o2 = (signed char )IG -> p1 ;
2545- int flg ;
25462553 GTRACE3 ("O_BITOP" ,o2 ,0xff ,o1 );
25472554 if (o1 == 0x1c || o1 == 0x1d ) { /* bsf/bsr */
25482555 if (mode & DATA16 ) DR1 .d = DR1 .w .l ;
25492556 DR1 .d = o1 == 0x1c ? find_bit (DR1 .d ) : find_bit_r (DR1 .d );
2550- FlagSync_All ();
25512557 if (DR1 .d == -1 ) {
2552- flg = 0x40 ; // ZF set
2558+ SET_ZF ( 1 );
25532559 } else {
2554- flg = 0 ;
2560+ SET_ZF ( 0 ) ;
25552561 if (mode & DATA16 )
25562562 CPUWORD (o2 ) = DR1 .d ;
25572563 else
25582564 CPULONG (o2 ) = DR1 .d ;
25592565 }
2560- // set ZF
2561- FlagSync_All ();
2562- CPUBYTE (Ofs_FLAGS )= (CPUBYTE (Ofs_FLAGS )& 0xbf )|flg ;
2563- FlagSync_RFL ();
25642566 break ;
25652567 }
25662568 if (o1 >= 0x20 )
You can’t perform that action at this time.
0 commit comments