Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub flg_signzeroparity8(ByVal Value As UByte)
- If Value = 0 Then zf = 1 Else zf = 0
- If (Value And &h80) Then sf = 1 Else sf = 0
- pf = parity(Value)
- End Sub
- Sub flg_signzeroparity16(ByVal Value As UShort)
- If Value = 0 Then zf = 1 Else zf = 0
- If (Value And &h8000) Then sf = 1 Else sf = 0
- pf = parity(Value And &hFF)
- End Sub
- Sub flg_logical8(ByVal Value As UByte)
- flg_signzeroparity8 Value
- cf = 0
- of = 0
- End Sub
- Sub flg_logical16(ByVal Value As UShort)
- flg_signzeroparity16 Value
- cf = 0
- of = 0
- End Sub
- Sub flg_adc8(ByVal v1 As UByte, ByVal v2 As UByte, ByVal v3 As UByte) 'v3 is carry flag
- Dim dst As UShort
- dst = v1+v2+v3
- flg_signzeroparity8 dst
- If (dst And &hFF00) Then cf = 1 Else cf = 0
- If (((dst Xor v1) And (dst Xor v2)) And &h80) Then of = 1 Else of = 0
- If ((v1 Xor v2 Xor dst) And &h10) Then af = 1 Else af = 0
- End Sub
- Sub flg_adc16(ByVal v1 As UShort, ByVal v2 As UShort, ByVal v3 As UShort) 'v3 is carry flag
- Dim dst As UInteger
- dst = v1+v2+v3
- flg_signzeroparity16 dst
- If (dst And &hFFFF0000) Then cf = 1 Else cf = 0
- If (((dst Xor v1) And (dst Xor v2)) And &h8000) Then of = 1 Else of = 0
- If ((v1 Xor v2 Xor dst) And &h10) Then af = 1 Else af = 0
- End Sub
- Sub flg_add8(ByVal v1 As UByte, ByVal v2 As UByte)
- Dim dst As UShort
- dst = v1+v2
- flg_signzeroparity8 dst
- If (dst And &hFF00) Then cf = 1 Else cf = 0
- If (((dst Xor v1) And (dst Xor v2)) And &h80) Then of = 1 Else of = 0
- If ((v1 Xor v2 Xor dst) And &h10) Then af = 1 Else af = 0
- End Sub
- Sub flg_add16(ByVal v1 As UShort, ByVal v2 As UShort)
- Dim dst As UInteger
- dst = v1+v2
- flg_signzeroparity16 dst
- If (dst And &hFFFF0000) Then cf = 1 Else cf = 0
- If ((dst Xor v1) And (dst Xor v2) And &h8000) Then of = 1 Else of = 0
- If ((v1 Xor v2 Xor dst) And &h10) Then af = 1 Else af = 0
- End Sub
- Sub flg_sub8(ByVal v1 As UByte, ByVal v2 As UByte)
- Dim dst As UShort
- dst = v1-v2
- flg_signzeroparity8 dst
- If (dst And &hFF00) Then cf = 1 Else cf = 0
- If ((dst Xor v1) And (v1 Xor v2) And &h80) Then of = 1 Else of = 0
- If ((v1 Xor v2 Xor dst) And &h10) Then af = 1 Else af = 0
- End Sub
- Sub flg_sub16(ByVal v1 As UShort, ByVal v2 As UShort)
- Dim dst As UInteger
- dst = v1-v2
- flg_signzeroparity16 dst
- If (dst And &hFFFF0000) Then cf = 1 Else cf = 0
- If ((dst Xor v1) And (v1 Xor v2) And &h8000) Then of = 1 Else of = 0
- If ((v1 Xor v2 Xor dst) And &h10) Then af = 1 Else af = 0
- End Sub
- Sub flg_sbb8(ByVal v1 As UByte, ByVal v2 As UByte, ByVal v3 As UByte) 'v3 is carry flag
- Dim dst As UShort
- dst = v1-v2-v3
- flg_signzeroparity8 dst
- If (dst And &hFF00) Then cf = 1 Else cf = 0
- If ((dst Xor v1) And (v1 Xor v2) And &h80) Then of = 1 Else of = 0
- If ((v1 Xor v2 Xor dst) And &h10) Then af = 1 Else af = 0
- End Sub
- Sub flg_sbb16(ByVal v1 As UShort, ByVal v2 As UShort, ByVal v3 As UShort) 'v3 is carry flag
- Dim dst As UInteger
- dst = v1-v2-v3
- flg_signzeroparity16 dst
- If (dst And &hFFFF0000) Then cf = 1 Else cf = 0
- If ((dst Xor v1) And (v1 Xor v2) And &h8000) Then of = 1 Else of = 0
- If ((v1 Xor v2 Xor dst) And &h10) Then af = 1 Else af = 0
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement