Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/11/06 15:52
Read: times


 
#107050 - Help about ADD/ADDC in a VB project
I am programming a simulator for 8051,i have some problem about the flag Altering in ADD and ADDC

'Is this Correct ?
CY, AC, OV, are function names that set the flags

For Calculating ADD we can call "ADD8(OP1,OP2)"
For Calculating ADDC we can call "ADD8(OP1,OP2,Carry)"

Public Function ADD8(ByVal Op1 As Byte, ByVal Op2 As Byte, Optional ByVal Op3 As Byte = 0) As Byte
Dim i As Integer
i = CInt(Op1) + CInt(Op2) + CInt(Op3)

ADD8 = LOW8(i)

AC (LOW4(Op1) + LOW4(Op2) + Op3) > 15

If i > 255 Then
CY True
If i < 0 Then
OV True
Else
OV False
End If
Else
OV False
CY False
End If

End Function


List of 7 messages in thread
TopicAuthorDate
Help about ADD/ADDC in a VB project            01/01/70 00:00      
   all answers are in "the bible"            01/01/70 00:00      
   CY AC and OC            01/01/70 00:00      
      Reply about ADD/ADDC in a VB project            01/01/70 00:00      
         AGAIN: why reinvent the wheel?            01/01/70 00:00      
   did you consider            01/01/70 00:00      
      He's writing a simulator?            01/01/70 00:00      

Back to Subject List