sti.s 448 B

1234567891011121314151617181920212223242526272829303132
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .sect .text
  3. .define .sti
  4. .define .sts
  5. ! #bytes in cx
  6. ! address in bx
  7. ! save di/si. they might be register variables
  8. .sts:
  9. mov dx,di ! save di
  10. mov di,bx
  11. pop bx
  12. sar cx,1
  13. jnb 1f
  14. pop ax
  15. stosb
  16. mov di,dx
  17. jmp bx
  18. .sti:
  19. ! only called with count > 4
  20. mov dx,di
  21. mov di,bx
  22. pop bx
  23. sar cx,1
  24. 1:
  25. mov ax,si
  26. mov si,sp
  27. rep movs
  28. mov sp,si
  29. mov di,dx
  30. mov si,ax
  31. jmp bx