cms.s 582 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. .define .cms
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! Any size compare
  8. ! Expects: size in de-registers
  9. ! operands on stack
  10. ! Yields in de-registers: 0 if operands are equal
  11. ! 1 if operands are not equal
  12. .cms:
  13. pop h
  14. shld .retadr
  15. mov l,e
  16. mov h,d
  17. mov a,l
  18. rar
  19. cc eoddz !trap is size is odd
  20. dad sp !now hl points to second operand
  21. !and sp points to the first.
  22. 1: dcx sp
  23. pop psw !get next byte in accumulator
  24. cmp m
  25. inx h
  26. dcx d
  27. jnz 2f !jump if bytes are not equal
  28. mov a,d
  29. ora e
  30. jnz 1b
  31. jmp 3f
  32. 2: dad d
  33. lxi d,1
  34. 3: sphl
  35. lhld .retadr
  36. pchl