Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.3 KiB

  1. title fmsghdr - far message header and finder
  2. ;--------------------------------------------------------------------------
  3. ;
  4. ; Microsoft C Compiler Runtime for MS-DOS
  5. ;
  6. ; (C)Copyright Microsoft Corporation, 1986
  7. ;
  8. ;--------------------------------------------------------------------------
  9. ;
  10. ; Revision History
  11. ;
  12. ; 04/17/86 Randy Nevin (adapted from Greg Whitten's version
  13. ; of nmsghdr.asm)
  14. ;
  15. ;--------------------------------------------------------------------------
  16. ?DF= 1 ; this is special for c startup
  17. include version.inc
  18. ?PLM= 1 ; pascal calling conventions
  19. .xlist
  20. include cmacros.inc
  21. include msdos.inc
  22. .list
  23. createSeg _TEXT, code, byte, public, CODE, <>
  24. createSeg _DATA, data, word, public, DATA, DGROUP
  25. createSeg FAR_HDR,fhdr, byte, public, FAR_MSG,FMGROUP
  26. createSeg FAR_MSG,fmsg, byte, public, FAR_MSG,FMGROUP
  27. createSeg FAR_PAD,fpad, byte, common, FAR_MSG,FMGROUP
  28. createSeg FAR_EPAD,fepad, byte, common, FAR_MSG,FMGROUP
  29. defGrp DGROUP ; define DGROUP
  30. defGrp FMGROUP ; define FMGROUP
  31. codeOFFSET equ offset _TEXT:
  32. fmsgOFFSET equ offset FMGROUP:
  33. sBegin fhdr
  34. assumes ds,DGROUP
  35. db '<<FMSG>>'
  36. stfmsg label byte
  37. sEnd
  38. SBegin fpad
  39. assumes ds,DGROUP
  40. dw -1 ; message padding marker
  41. sEnd
  42. sBegin fepad
  43. assumes ds,DGROUP
  44. db -1
  45. sEnd
  46. sBegin code
  47. assumes cs,code
  48. assumes ds,DGROUP
  49. ;------------------------------------------------------------------------
  50. ;
  51. ; char far * pascal __FMSG_TEXT ( messagenumber)
  52. ;
  53. ; This routine returns a far pointer to the message associated with
  54. ; messagenumber. If the message does not exist, then a 0:0 is returned.
  55. cProc __FMSG_TEXT,<PUBLIC>,<ds,si,di> ; pascal calling
  56. parmW msgt
  57. cBegin
  58. mov ax,FMGROUP
  59. mov ds,ax ; ds = FMGROUP (force it always)
  60. push ds
  61. pop es
  62. mov dx,msgt ; dx = message number
  63. mov si,fmsgOFFSET stfmsg ; start of far messages
  64. tloop:
  65. lodsw ; ax = current message number
  66. cmp ax,dx
  67. je found ; found it - return address
  68. inc ax
  69. xchg ax,si
  70. jz found ; at end and not found - return 0
  71. xchg di,ax
  72. xor ax,ax
  73. mov cx,-1
  74. repne scasb ; skip until 00
  75. mov si,di
  76. jmp tloop ; try next entry
  77. found:
  78. xchg ax,si
  79. cwd ; zero out dx in case NULL
  80. or ax,ax
  81. jz notfound
  82. mov dx,ds ; remember segment selector
  83. notfound:
  84. cEnd
  85. sEnd
  86. end
  87.