and.s 270 B

1234567891011121314151617181920
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .define .and
  3. ! #bytes in cx
  4. ! save di; it might be a register variable
  5. .sect .text
  6. .and:
  7. pop bx ! return address
  8. mov dx,di
  9. mov di,sp
  10. add di,cx
  11. sar cx,1
  12. 1:
  13. pop ax
  14. and ax,(di)
  15. stos
  16. loop 1b
  17. mov di,dx
  18. jmp bx