loi.s 489 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .sect .text
  3. .define .loi
  4. .define .los
  5. ! #bytes in cx
  6. ! address in bx
  7. ! save si/di. they might be register variables
  8. .los:
  9. mov dx,si
  10. mov si,bx
  11. pop bx
  12. mov ax,cx
  13. sar cx,1
  14. jnb 1f
  15. xorb ah,ah
  16. lodsb
  17. mov si,dx
  18. push ax
  19. jmp bx
  20. 1:
  21. sub sp,ax
  22. jmp 1f
  23. .loi:
  24. ! only called with size > 4
  25. mov dx,si
  26. mov si,bx
  27. pop bx
  28. sub sp,cx
  29. sar cx,1
  30. 1:
  31. mov ax,di
  32. mov di,sp
  33. rep movs
  34. mov si,dx
  35. mov di,ax
  36. jmp bx