adi4.s 364 B

12345678910111213141516171819202122232425262728
  1. .define .adi4
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! Add two 32 bits signed or unsigned integers
  8. ! Expects on stack: operands
  9. ! Yields on stack: result
  10. .adi4: pop h
  11. shld .retadr ! get return address out of the way
  12. pop d
  13. pop h
  14. xthl
  15. dad d
  16. shld .tmp1
  17. pop d
  18. pop h
  19. jnc 1f
  20. inx h
  21. 1: dad d
  22. push h
  23. lhld .tmp1
  24. push h
  25. lhld .retadr
  26. pchl