rck.s 511 B

123456789101112131415161718192021222324252627282930313233343536
  1. .define .rck
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. .rck:
  8. pop bc
  9. pop ix
  10. 3: pop hl
  11. push hl
  12. ld e,(ix)
  13. ld d,(ix+1)
  14. ld a,h
  15. xor d ! check sign bit to catch overflow with subtract
  16. jp m,1f
  17. sbc hl,de
  18. jr 2f
  19. 1: xor d ! now a equals (original) h again
  20. 2: call m,e.rck
  21. pop de
  22. push de
  23. ld l,(ix+2)
  24. ld h,(ix+3)
  25. ld a,h
  26. xor d ! check sign bit to catch overflow with subtract
  27. jp m,1f
  28. sbc hl,de
  29. jr 2f
  30. 1: xor d ! now a equals (original) h again
  31. 2: call m,e.rck
  32. push bc
  33. pop ix
  34. jp (ix)