Why so complex? Again all in PBP... assuming positive numbers only...
A, B and C must all be the same type (ie all WORDS or all BYTES).
C=A+B
If C < A then Goto SumOverflow
Actually, B can be a BYTE if C & A are WORDS and it still will hold water.
Extending this to the original post...
Code:
AHighWord var Word
ALowWord var Word
BByte var Byte
CHighWord var Word
CLowWord var Word
AHighWord=$0001
ALowWord=$FFFE
BByte=$2E
CHighWord=AHighWord
CLowWord=ALowWord+BByte
If CLowWord < ALowWord then CHighWord=CHighWord+1
or without using the variable C...
Code:
ALowWord=ALowWord+BByte
If ALowWord < BByte then AHighWord=AHighWord+1
Actually in both above examples, BByte can be replaced with BWord and it'll still work.
Bookmarks