_fork.s 250 B

1234567891011121314151617181920
  1. .sect .text; .sect .rom; .sect .data; .sect .bss
  2. .define __fork, _par_uid
  3. .sect .bss
  4. .comm _par_uid, 2
  5. .sect .text
  6. __fork:
  7. mov ax,2
  8. call syscal
  9. jb 1f
  10. and bx,bx
  11. je 2f
  12. ret
  13. 1:
  14. mov (_errno),ax
  15. mov ax,-1
  16. ret
  17. 2:
  18. mov (_par_uid),ax
  19. xor ax,ax
  20. ret