prt0.as 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. / prt0.s (emx+fpc) -- Made from crt0.s,
  2. / Copyright (c) 1990-1999-2001 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 __text
  9. .globl ___SYSCALL
  10. .globl __data
  11. .globl __init
  12. .globl __dos_init
  13. .globl __dos_syscall
  14. .text
  15. __text:
  16. push $__data
  17. call __dos_init
  18. jmp __init
  19. ___SYSCALL:
  20. call __dos_syscall
  21. ret
  22. .space 6, 0x90
  23. __init: cld
  24. call _main
  25. movb $0x4c,%ah
  26. call ___SYSCALL
  27. 2: jmp 2b
  28. / In executables created with emxbind, the call to _dos_init will
  29. / be fixed up at load time to _emx_init of emx.dll. Under DOS,
  30. / this dummy is called instead as there is no fixup. This module
  31. / must be linked statically to avoid having two fixups for the
  32. / same location.
  33. __dos_init:
  34. ret $4
  35. .align 2, 0x90
  36. __dos_syscall:
  37. int $0x21
  38. ret
  39. .data
  40. / The data segment starts with a table containing the start and end
  41. / addresses of the text, data and bss segments
  42. __data:
  43. .long __text
  44. .long __etext
  45. .long __data
  46. .long __edata
  47. .long __edata
  48. .long __end
  49. __heap_base:
  50. .long 0
  51. __heap_end:
  52. .long 0
  53. __heap_brk:
  54. .long 0
  55. .long 0
  56. .long __os2dll
  57. .long 0
  58. .long 0
  59. .long 0x02000000
  60. .long 0
  61. .long 0
  62. .byte 0
  63. .space 63, 0
  64. / Don't touch this. It's EMX vodoo. In short, this causes the __os2dll symbol
  65. / point to table of DLL data that the linker includes in the executable.
  66. .stabs "__os2dll", 21, 0, 0, 0xffffffff
  67. .stabs "___CTOR_LIST__", 21, 0, 0, 0xffffffff
  68. .stabs "___DTOR_LIST__", 21, 0, 0, 0xffffffff
  69. .stabs "___crtinit1__", 21, 0, 0, 0xffffffff
  70. .stabs "___crtexit1__", 21, 0, 0, 0xffffffff
  71. .stabs "___eh_frame__", 21, 0, 0, 0xffffffff