prt1.as 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. cld
  17. xorl %ebp, %ebp
  18. leal (%esp), %edi /* argv[] */
  19. movl %edi,_environ
  20. call L_ptr_tbl
  21. movl %ecx,_envc
  22. movl %edi,_argv
  23. call L_ptr_tbl
  24. movl %ecx,_argc
  25. jmp *%esi
  26. L_ptr_tbl:
  27. xorl %eax, %eax
  28. movl $-1, %ecx
  29. 1: incl %ecx
  30. scasl
  31. jne 1b
  32. ret
  33. / In executables created with emxbind, the call to _dos_init will
  34. / be fixed up at load time to _emx_init of emx.dll. Under DOS,
  35. / this dummy is called instead as there is no fixup. This module
  36. / must be linked statically to avoid having two fixups for the
  37. / same location.
  38. .globl __dos_init
  39. .globl __dos_syscall
  40. __dos_init:
  41. ret $4
  42. .align 2, 0x90
  43. __dos_syscall:
  44. int $0x21
  45. ret
  46. .data
  47. .comm _environ, 4
  48. .comm _envc, 4
  49. .comm _argv, 4
  50. .comm _argc, 4