home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK7 / SOURCE / STARTUP / DOS / CRT0MSG.AS$ / CRT0MSG
Encoding:
Text File  |  1991-11-06  |  3.1 KB  |  140 lines

  1.     page    ,132
  2.     title    crt0msg - startup messages
  3. ;***
  4. ;dos/crt0msg.asm - startup error messages
  5. ;
  6. ;    Copyright (c) 1985-1992, Microsoft Corporation.  All rights reserved.
  7. ;
  8. ;Purpose:
  9. ;    Core collection of error messages contained in programs
  10. ;    which use the C startup code; also contains _FF_MSGBANNER
  11. ;    for writing the first portion of run-time error messages.
  12. ;
  13. ;*******************************************************************************
  14.  
  15.  
  16. ?DF=        1            ; this is special for c startup
  17. include version.inc
  18. .xlist
  19. include cmacros.inc
  20. include cmsgs.inc
  21. include defsegs.inc
  22. include rterr.inc
  23. .list
  24.  
  25. CrtDefSegs <nmsg>
  26. CrtDefSegs <code,data>
  27.  
  28.  
  29. public    __acrtmsg
  30. __acrtmsg=    9876h
  31.  
  32. ;    Messages used by crt0.asm
  33.  
  34. sBegin    nmsg
  35. assumes ds,data
  36.  
  37. _RTERR    _RT_STACK, _RT_STACK_TXT, _RT_STANDARD        ; 'stack overflow'
  38. _RTERR    _RT_INTDIV, _RT_INTDIV_TXT, _RT_STANDARD    ; 'integer divide by 0'
  39.  
  40. _RTERR    _RT_SPACEENV, _RT_SPACEENV_TXT, _RT_STANDARD    ; 'not enough space for environment'
  41.  
  42. ifdef    _WINDOWS
  43. _RTERR    _RT_HEAP, _RT_HEAP_TXT, _RT_STANDARD        ; 'unexpected heap error'
  44. ifdef    _QWIN
  45. _RTERR    _RT_QWIN, _RT_QWIN_TXT, _RT_STANDARD        ; 'unexpected QuickWin error'
  46. endif
  47. ifndef    _WINDLL
  48. _RTERR    _RT_SPACEARG, _RT_SPACEARG_TXT, _RT_STANDARD    ; 'not enough space for arguments'
  49. _RTERR    _RT_NOMAIN, _RT_NOMAIN_TXT, _RT_STANDARD    ; 'no main procedure'
  50. endif
  51. endif    ;_WINDOWS
  52.  
  53. ; Special error message entries
  54. _RTERR    _RT_CRNL, _RT_CRNL_TXT, _RT_STRING    ; <13,10>
  55. _RTERR    _RT_BANNER, _RT_BANNER_TXT, _RT_STRING    ; 'run-time error '
  56.  
  57. sEnd    nmsg
  58.  
  59. sBegin    npad
  60. assumes ds,data
  61.     dw    -1
  62. ; no padding for now;
  63. ; MAX padding would be
  64. ;    db    114 dup(0)
  65. sEnd
  66.  
  67. externP     _NMSG_WRITE
  68.  
  69. sBegin    data
  70.     assumes ds,data
  71.  
  72. globalCP    _adbgmsg,0    ; For C, _FF_DBGMSG is inactive, so
  73.                 ; _adbgmsg is set to null;
  74.                 ; For FORTRAN, _adbgmsg is set to
  75.                 ; point to _FF_DBGMSG in dbginit
  76.                 ; initializer in dbgmsg.asm
  77.  
  78. sEnd    data
  79.  
  80.  
  81. sBegin    code
  82.     assumes cs,code
  83.     assumes ds,data
  84.  
  85. page
  86. ;***
  87. ;_FF_MSGBANNER - writes out first part of run-time error messages
  88. ;
  89. ;Purpose:
  90. ;    This routine writes "\r\nrun-time error " to standard error.
  91. ;
  92. ;    For FORTRAN $DEBUG error messages, it also uses the _FF_DBGMSG
  93. ;    routine whose address is stored in the _adbgmsg variable to print out
  94. ;    file and line number information associated with the run-time error.
  95. ;    If the value of _adbgmsg is found to be null, then the _FF_DBGMSG
  96. ;    routine won't be called from here (the case for C-only programs).
  97. ;
  98. ;Entry:
  99. ;    No arguments.
  100. ;
  101. ;Exit:
  102. ;    Nothing returned.
  103. ;
  104. ;Uses:
  105. ;    AX,BX,CX,DX,ES are destroyed.
  106. ;
  107. ;Exceptions:
  108. ;    None handled.
  109. ;
  110. ;*******************************************************************************
  111.  
  112. cProc    _FF_MSGBANNER,<PUBLIC>,<>
  113.  
  114. cBegin
  115.  
  116.     mov    ax,_RT_CRNL        ; "\r\n" to begin error message
  117.     push    ax
  118.     callcrt _NMSG_WRITE
  119.  
  120. ifndef _WINDOWS
  121. if sizeC
  122.     cmp    word ptr [__adbgmsg+2],0
  123. else                    ; not needed for C-only version
  124.     cmp    [__adbgmsg],0
  125. endif
  126.     jz    dbgmsg_inactive
  127.     call    [__adbgmsg]        ; near or far call as appropriate
  128. dbgmsg_inactive:
  129. endif    ;!_WINDOWS
  130.  
  131.     mov    ax,_RT_BANNER        ; run-time error message banner
  132.     push    ax
  133.     callcrt _NMSG_WRITE
  134.  
  135. cEnd
  136.  
  137. sEnd    code
  138.  
  139.     end
  140.