sti.s 568 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .sect .text
  3. .define .sti
  4. .define .sts
  5. ! #bytes in ecx
  6. ! address in ebx
  7. ! save edi/esi. they might be register variables
  8. .sts:
  9. pop edx
  10. sar ecx,1
  11. jnb 1f
  12. pop eax
  13. movb (ebx),al
  14. jmp edx
  15. 1:
  16. sar ecx,1
  17. jnb 1f
  18. pop eax
  19. o16 mov (ebx),ax
  20. jmp edx
  21. 1:
  22. push edx
  23. mov edx,edi
  24. mov edi,ebx
  25. pop ebx
  26. jmp 1f
  27. .sti:
  28. ! only called with count >> 4
  29. mov edx,edi
  30. mov edi,ebx
  31. pop ebx
  32. sar ecx,2
  33. 1:
  34. mov eax,esi
  35. mov esi,esp
  36. rep movs
  37. mov esp,esi
  38. mov edi,edx
  39. mov esi,eax
  40. jmp ebx