prt1.as 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. / prt1.s (emx+fpk) -- Made from crt2.s and dos.s,
  2. / Copyright (c) 1990-1999-2000 by Eberhard Mattes.
  3. / Changed for Free Pascal in 1997 Daniel Mantione.
  4. / This code is _not_ under the Library GNU Public
  5. / License, because the original is not. See copying.emx
  6. / for details. You should have received it with this
  7. / product, write the author if you haven't.
  8. .globl __entry1
  9. .globl _environ
  10. .globl _envc
  11. .globl _argv
  12. .globl _argc
  13. .text
  14. __entry1:
  15. popl %esi
  16. xorl %ebp, %ebp
  17. leal (%esp), %edi
  18. movl %edi,_environ
  19. call L_ptr_tbl
  20. mov %ecx,_envc
  21. mov %edi,_argv
  22. call L_ptr_tbl
  23. mov %ecx,_argc
  24. jmp *%esi
  25. L_ptr_tbl:
  26. xorl %eax, %eax
  27. movl $-1, %ecx
  28. 1: incl %ecx
  29. scasl
  30. jne 1b
  31. ret
  32. / In executables created with emxbind, the call to _dos_init will
  33. / be fixed up at load time to _emx_init of emx.dll. Under DOS,
  34. / this dummy is called instead as there is no fixup. This module
  35. / must be linked statically to avoid having two fixups for the
  36. / same location.
  37. .globl __dos_init
  38. .globl __dos_syscall
  39. __dos_init:
  40. ret $4
  41. .align 2, 0x90
  42. __dos_syscall:
  43. int $0x21
  44. ret
  45. .data
  46. .comm _environ, 4
  47. .comm _envc, 4
  48. .comm _argv, 4
  49. .comm _argc, 4