dup.s 229 B

1234567891011121314151617
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .define .dup
  3. ! #bytes in cx
  4. .sect .text
  5. .dup:
  6. pop bx ! return address
  7. mov ax,si
  8. mov dx,di
  9. mov si,sp
  10. sub sp,cx
  11. mov di,sp
  12. sar cx,1
  13. rep movs
  14. mov si,ax
  15. mov di,dx
  16. jmp bx