prt1.as 1.9 KB

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