@@ -886,6 +886,9 @@ def _shru16(ins):
886886 Shift Right Arithmetic
887887 """
888888 op1 , op2 = tuple (ins .quad [2 :])
889+ label = tmp_label ()
890+ label2 = tmp_label ()
891+
889892 if is_int (op2 ):
890893 op = int16 (op2 )
891894 if op == 0 :
@@ -903,11 +906,9 @@ def _shru16(ins):
903906 output = _8bit_oper (op2 )
904907 output .append ('ld b, a' )
905908 output .extend (_16bit_oper (op1 ))
909+ output .append ('or a' )
910+ output .append ('jr z, %s' % label2 )
906911
907- label = tmp_label ()
908- label2 = tmp_label ()
909- output .append ('or a' )
910- output .append ('jr z, %s' % label2 )
911912 output .append ('%s:' % label )
912913 output .append ('srl h' )
913914 output .append ('rr l' )
@@ -929,6 +930,9 @@ def _shri16(ins):
929930 Shift Right Arithmetic
930931 """
931932 op1 , op2 = tuple (ins .quad [2 :])
933+ label = tmp_label ()
934+ label2 = tmp_label ()
935+
932936 if is_int (op2 ):
933937 op = int16 (op2 )
934938 if op == 0 :
@@ -946,11 +950,9 @@ def _shri16(ins):
946950 output = _8bit_oper (op2 )
947951 output .append ('ld b, a' )
948952 output .extend (_16bit_oper (op1 ))
953+ output .append ('or a' )
954+ output .append ('jr z, %s' % label2 )
949955
950- label = tmp_label ()
951- label2 = tmp_label ()
952- output .append ('or a' )
953- output .append ('jr z, %s' % label2 )
954956 output .append ('%s:' % label )
955957 output .append ('sra h' )
956958 output .append ('rr l' )
@@ -972,6 +974,9 @@ def _shl16(ins):
972974 unroll lop
973975 """
974976 op1 , op2 = tuple (ins .quad [2 :])
977+ label = tmp_label ()
978+ label2 = tmp_label ()
979+
975980 if is_int (op2 ):
976981 op = int16 (op2 )
977982 if op == 0 :
@@ -988,11 +993,9 @@ def _shl16(ins):
988993 output = _8bit_oper (op2 )
989994 output .append ('ld b, a' )
990995 output .extend (_16bit_oper (op1 ))
996+ output .append ('or a' )
997+ output .append ('jr z, %s' % label2 )
991998
992- label = tmp_label ()
993- label2 = tmp_label ()
994- output .append ('or a' )
995- output .append ('jr z, %s' % label2 )
996999 output .append ('%s:' % label )
9971000 output .append ('add hl, hl' )
9981001 output .append ('djnz %s' % label )
0 commit comments