File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -699,7 +699,7 @@ def right_shift_reg(self):
699
699
self .v [0xF ] = bit_one
700
700
self .last_op = f"SHR V{ x :01X} "
701
701
else :
702
- bit_one = self .v [x ] & 0x1
702
+ bit_one = self .v [y ] & 0x1
703
703
self .v [x ] = self .v [y ] >> 1
704
704
self .v [0xF ] = bit_one
705
705
self .last_op = f"SHR V{ x :01X} , V{ y :01X} "
Original file line number Diff line number Diff line change @@ -399,6 +399,15 @@ def test_right_shift_reg(self):
399
399
self .assertEqual (self .cpu .v [x ], shifted_val )
400
400
self .assertEqual (self .cpu .v [0xF ], bit_zero )
401
401
402
+ def test_right_shift_reg_y_bug (self ):
403
+ self .cpu .shift_quirks = False
404
+ self .cpu .operand = 0x0120
405
+ self .cpu .v [1 ] = 0
406
+ self .cpu .v [2 ] = 1
407
+ self .cpu .right_shift_reg ()
408
+ self .assertEqual (0 , self .cpu .v [1 ])
409
+ self .assertEqual (1 , self .cpu .v [0xF ])
410
+
402
411
def test_subtract_reg_from_reg1 (self ):
403
412
for x in range (0xF ):
404
413
for y in range (0xF ):
You can’t perform that action at this time.
0 commit comments