overflow.awl 588 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ORGANIZATION_BLOCK OB 1
  2. BEGIN
  3. // no overflow
  4. // start = 1000
  5. // end = 3000
  6. // diff = 2000
  7. L 3000
  8. L 1000
  9. -D
  10. UD DW#16#7FFFFFFF
  11. T MD 0
  12. // overflow
  13. // start = 2147483646
  14. // end = 5
  15. // diff = 7
  16. L 5
  17. L L#2147483646
  18. -D
  19. UD DW#16#7FFFFFFF
  20. T MD 4
  21. // overflow
  22. // start = 2147483646
  23. // end = 2000000000
  24. // diff = 2000000002
  25. L L#2000000000
  26. L L#2147483646
  27. -D
  28. UD DW#16#7FFFFFFF
  29. T MD 8
  30. __ASSERT== MD 0, 2000
  31. __ASSERT== MD 4, 7
  32. __ASSERT== MD 8, L#2000000002
  33. CALL SFC 46 // STOP CPU
  34. END_ORGANIZATION_BLOCK