cms.s 328 B

1234567891011121314151617181920212223
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .define .cms
  3. ! #bytes in cx
  4. .sect .text
  5. .cms:
  6. pop bx ! return address
  7. mov dx,sp
  8. push si
  9. push di
  10. mov si,dx
  11. add dx,cx
  12. mov di,dx
  13. add dx,cx
  14. sar cx,1
  15. repe cmps
  16. je 1f
  17. inc cx
  18. 1:
  19. pop di
  20. pop si
  21. mov sp,dx
  22. jmp bx