home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / TC-OS2.ZIP / C0-OS2.ASM next >
Assembly Source File  |  1988-05-27  |  3KB  |  93 lines

  1.         NAME    c0
  2.         PAGE    60,132
  3. ;[]------------------------------------------------------------[]
  4. ;|      C0-OS2.ASM -- Turbo C Start Up Code for OS/2            |
  5. ;|                                                              |
  6. ;|      Copyright (c) 1988 by Sam Denton                        |
  7. ;|      All Rights Reserved.                                    |
  8. ;[]------------------------------------------------------------[]
  9.  
  10. ;       Segment and Group declarations
  11.  
  12. _TEXT   SEGMENT BYTE PUBLIC 'CODE'
  13. _TEXT   ENDS
  14. _DATA   SEGMENT PARA PUBLIC 'DATA'
  15. environ@        dd      __argc@
  16. __argv@         dd      __argc@
  17. __argc@         dw      0
  18. _DATA   ENDS
  19. _EMUSEG SEGMENT WORD PUBLIC 'DATA'
  20. _EMUSEG ENDS
  21. _CVTSEG SEGMENT WORD PUBLIC 'DATA'
  22. _CVTSEG ENDS
  23. _SCNSEG SEGMENT WORD PUBLIC 'DATA'
  24. _SCNSEG ENDS
  25. _BSS    SEGMENT WORD PUBLIC 'BSS'
  26. _BSS    ENDS
  27. _BSSEND SEGMENT BYTE PUBLIC 'BSSEND'
  28. _BSSEND ENDS
  29. _STACK  SEGMENT STACK 'STACK'
  30.         dw      200 dup(?)
  31. _STACK  ENDS
  32. SSEG    SEGMENT STACK 'STACK'
  33.         dw      200 dup(?)
  34. SSEG    ENDS
  35.  
  36. DGROUP  GROUP   _DATA, _EMUSEG, _CVTSEG, _SCNSEG, _BSS, _BSSEND
  37.         ASSUME  CS:_TEXT, DS:DGROUP
  38.  
  39. ;       External References
  40.  
  41.         extrn   _main:far
  42.         extrn   _exit:far
  43.         extrn   DosExit:far
  44.         public  __exit
  45.  
  46.         SUBTTL  Start Up Code
  47.         PAGE
  48. ;/*                                                     */
  49. ;/*-----------------------------------------------------*/
  50. ;/*                                                     */
  51. ;/*     Start Up Code                                   */
  52. ;/*     -------------                                   */
  53. ;/*                                                     */
  54. ;/*-----------------------------------------------------*/
  55. ;/*                                                     */
  56. _TEXT   SEGMENT
  57. STARTX          PROC    NEAR
  58.  
  59. ;       Prepare main arguments
  60.  
  61. ;       ExitCode = main(argc,argv,envp);
  62.  
  63.                 push    word ptr environ@+2
  64.                 push    word ptr environ@
  65.                 push    word ptr __argv@+2
  66.                 push    word ptr __argv@
  67.                 push    __argc@
  68.                 call    _main
  69.  
  70. ;       Flush and close streams and files
  71.  
  72.                 push    ax
  73.                 call    _exit
  74.  
  75. ;       Restore "Divide overflow" interrupt vector
  76.  
  77. __exit          proc    far
  78.  
  79. ;       Set DS to DGROUP
  80.  
  81.                 db      6Ah,1
  82.                 db      6Ah,0
  83.                 call    DosExit
  84.  
  85. __exit          endp
  86. STARTX          ENDP
  87.  
  88. ;       The DGROUP@ variable is used to reload DS with DGROUP
  89.  
  90. DGROUP@@        dw      seg DGROUP
  91. _TEXT   ENDS
  92.         END     STARTX
  93.