home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft_Programmers_Library.7z / MPL / masm / masmknwl.txt < prev    next >
Encoding:
Text File  |  2013-11-08  |  1.2 MB  |  35,316 lines

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1.  Microsoft Macro Assembler [MASM]
  2.  =============================================================================
  3.  
  4.  
  5.  1. @DataSize Misspelled
  6.  
  7.  Product Version(s): 5.00 5.10
  8.  Operating System:   MS-DOS
  9.  Flags: ENDUSER | docerr
  10.  Last Modified:  3-MAR-1989    ArticleIdent: Q26583
  11.  
  12.  Problem:
  13.  
  14.  Page 91 of the "MS-DOS Macro Assembler User's Guide" shows @DataSize
  15.  and @CodeSize typed as @datasize and @codesize. This information is
  16.  inconsistent with Mixed.inc, which types them as @Datasize and
  17.  @CodeSize. This process will result in an error when interfacing C and
  18.  MASM using the NOIGNORECASE option.
  19.  
  20.  Response:
  21.  
  22.  Both the documentation and Mixed.Inc should show @DataSize and
  23.  @CodeSize. The mistyping only will matter when assembling with the -Ml
  24.  option to preserve case in names.
  25.  
  26.  
  27.  2. Cannot Backup Disk
  28.  
  29.  Product Version(s): 5.10
  30.  Operating System:   MS-DOS
  31.  Flags: ENDUSER |
  32.  Last Modified: 27-MAY-1988    ArticleIdent: Q28216
  33.  
  34.  Question:
  35.     I am trying to make backup copies of my distribution disks. One
  36.  of the disks will not copy; the disk is labeled "Microsoft CodeView and
  37.  Utilities for MS-OS/2." Is this disk corrupt?
  38.  
  39.  Response:
  40.     The disk should be fine. The information on this disk is required
  41.  only by individuals who have MS-OS/2 and was intentionally saved on a
  42.  high-density formatted disk.
  43.     Since OS/2 must be run on a 286 or 386 machine, reading this disk
  44.  will not be a problem since these machines have high-density floppy
  45.  drives.
  46.     If your machine is less than a 286, you probably have a low-density
  47.  disk drive and you will not be able to read this disk; however, you
  48.  will not be running under MS-OS/2 and will not need the information on
  49.  the disk anyway.
  50.  
  51.  
  52.  3. UNDEL Does Not Work with DOS Version 2.x
  53.  
  54.  Product Version(s): 5.10
  55.  Operating System:   MS-DOS
  56.  Flags: ENDUSER |
  57.  Last Modified: 27-MAY-1988    ArticleIdent: Q28531
  58.  
  59.  Problem:
  60.     The UNDEL that came with MASM Version 5.10 does not work properly.
  61.  I am using DOS Version 2.x.
  62.  
  63.  Response:
  64.     The utilities UNDEL, EXP, RM, and MEGREP are all bound. There is at
  65.  least one known problem with running bound programs under DOS Version
  66.  2.x, that is, you cannot rename the .EXE file to anything other than
  67.  the name BIND outputs it as. For example, if the MAKE file reads as
  68.  follows:
  69.  
  70.      bind undelp.exe doscalls.lib api.lib -o undelb.exe
  71.  
  72.  then you cannot rename UNDELB.EXE in order for it to work correctly on
  73.  DOS Version 2.x.
  74.  
  75.  
  76.  4. A Loop Instruction in .386 USE16 Segment Which Decrements ECX
  77.  
  78.  Product Version(s): 5.00 5.10
  79.  Operating System:   MS-DOS
  80.  Flags: ENDUSER |
  81.  Last Modified:  9-FEB-1988    ArticleIdent: Q26707
  82.  
  83.  Problem:
  84.     What is the mnemonic for a LOOP instruction in a .386 USE16 segment
  85.  which decrements ECX?
  86.  
  87.  Response:
  88.     You can use a cast override to change the operand size for the LOOP
  89.  instruction. For example, "LOOP dword ptr alabel". In a 16-bit
  90.  segment, ECX will be used instead of CX. If you use a WORD override in
  91.  a 32-bit segment, CX will be used instead of ECX.
  92.  
  93.  
  94.  5. PROC and USES Documentation
  95.  
  96.  Product Version(s): 5.10   | 5.10
  97.  Operating System:   MS-DOS | OS/2
  98.  Flags: ENDUSER |
  99.  Last Modified: 12-JAN-1989    ArticleIdent: Q34293
  100.  
  101.     The new PROC directive in Macro Assembler Version 5.10 is
  102.  documented on Page 37 of the "Microsoft Macro Assembler 5.1 Updates and
  103.  Microsoft Editor" manual.
  104.     Used in conjunction with the PROC directive are the NEAR, FAR, and
  105.  USES keywords, also documented on Page 37.
  106.  
  107.  
  108.  6. Operator "." and the Operator "*"
  109.  
  110.  Product Version(s): 5.10
  111.  Operating System:   MS-DOS
  112.  Flags: ENDUSER | buglist5.10
  113.  Last Modified: 27-MAY-1988    ArticleIdent: Q27835
  114.  
  115.  Problem:
  116.     I am using indirect addressing in the following Microsoft Macro
  117.  Assembler instruction (the variable "esi" is a structure variable and
  118.  "eax" is a 386 register):
  119.  
  120.  mov eax,[eax.esi*2]
  121.  
  122.     The opcodes generated by MASM indicate that MASM is not using
  123.  indirect addressing.
  124.  
  125.  Response:
  126.     The problem occurs because the "." operator has a higher precedence
  127.  than the "*" operator. MASM turns "[eax.esi*2]" into "[(eax+esi)*2]"
  128.  as a result of the precedence. MASM evaluates "(eax+esi)" as a
  129.  constant instead of a register; eax being used with a structure
  130.  variable, esi. Thus, the result of the constant expression "(eax+esi)"
  131.  is multiplied by two and the address mode is lost.
  132.     A workaround is to use the "+" operator which has lower precedence
  133.  and produces the correct result. The "." operator should be reserved
  134.  for structure field names as documented.
  135.     Microsoft will correct the problem in a future release.
  136.  
  137.  
  138.  7. High and Low Operators on External Items
  139.  
  140.  Product Version(s): 5.10
  141.  Operating System:   MS-DOS
  142.  Flags: ENDUSER |
  143.  Last Modified: 13-MAY-1988    ArticleIdent: Q28625
  144.  
  145.  Problem:
  146.     The High and Low operators are not working on my external
  147.  variables. The following source code demonstrates the problem:
  148.  
  149.     .model small
  150.     extrn e:dword
  151.     .data
  152.     dd  8 dup(low e,high e)
  153.     end
  154.  
  155.  Response:
  156.     The source code above exhibits the incorrect use of an EXTRN
  157.  statement. The EXTRN statement must be either defined within a segment
  158.  or referenced using a segment override. In the above example, the
  159.  .DATA should be placed before the EXTRN statement in order to
  160.  associate the variable "e" with a segment.
  161.  
  162.  
  163.  8. Making Backup Copies
  164.  
  165.  Product Version(s): 5.00 5.10 | 5.10
  166.  Operating System:   MS-DOS    | OS/2
  167.  Flags: ENDUSER | docerr
  168.  Last Modified: 12-JAN-1989    ArticleIdent: Q34361
  169.  
  170.     Page 7 in Section 1.1.1 "Making Backup Copies" of the "Microsoft
  171.  Macro Assembler User's Guide" incorrectly suggests that you "put the
  172.  copies in a safe place and use them only to restore the originals if
  173.  they are damaged or destroyed."
  174.     The advice should be to use the backups and to save the original
  175.  disks for making future working copies.
  176.  
  177.  
  178.  
  179.  9. LES Instruction Assembles Incorrectly
  180.  
  181.  Product Version(s): 5.10
  182.  Operating System:   MS-DOS
  183.  Flags: ENDUSER | buglist5.10
  184.  Last Modified: 23-MAY-1988    ArticleIdent: Q29735
  185.  
  186.     The following program demonstrates a problem with the LES
  187.  instructions in MASM Version 5.10.
  188.     The first LES instruction (Parm1) assembles correctly, but the
  189.  second instruction (Parm2) generates an "immediate mode illegal"
  190.  message.
  191.     The only difference between the two instructions is the order of
  192.  the arguments. In earlier versions of MASM, they produced identical
  193.  code.
  194.  
  195.     The problem is with the type operator and the way it handles
  196.  registers inside brackets ([]). The type operator makes things a
  197.  constant on the left of the expression.
  198.     Parm1 works because it handles registers inside brackets
  199.  differently. "Type" turns bp into a constant; +10 then turns it back
  200.  into an addressing mode.
  201.     However, in Parm2, bp+10 has been turned into an addressing mode,
  202.  which is then turned into a constant by "type x". This difference is
  203.  demonstrated in the following code:
  204.  
  205.                .model   small
  206.  
  207.  x             struc
  208.  y             dd        ?
  209.  x             ends
  210.  
  211.  Parm1         equ       dword ptr [bp+type x+10]
  212.  Parm2         equ       dword ptr [bp+10+type x]
  213.  
  214.                .code
  215.  
  216.  begin:        les       di,Parm1
  217.                les       di,Parm2
  218.  
  219.                end       begin
  220.  
  221.  
  222.  10. Including a File that Contains CTRL+Z Causes Error Message
  223.  
  224.  Product Version(s): 5.10
  225.  Operating System:   MS-DOS
  226.  Flags: ENDUSER | buglist5.10
  227.  Last Modified: 12-JAN-1989    ArticleIdent: Q29791
  228.  
  229.  Problem:
  230.  
  231.  When I include a file that ends with a CTRL+Z, the error message
  232.  "A2106: Line Too Long" appears.
  233.  
  234.  Response:
  235.  
  236.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  237.  researching this problem and will post new information as it becomes
  238.  available.
  239.  
  240.  You can work around this problem by using the following DOS copy
  241.  command:
  242.  
  243.  copy oldfilename /a newfilename
  244.  
  245.  This procedure copies the old filename to the new filename up to, but
  246.  not including, the CTRL+Z.
  247.  
  248.  
  249.  11. Error Message A2051 Incorrectly Generated
  250.  
  251.  Product Version(s): 5.10
  252.  Operating System:   MS-DOS
  253.  Flags: ENDUSER | buglist5.10
  254.  Last Modified: 12-JAN-1989    ArticleIdent: Q30377
  255.  
  256.  The code given below generates the following error message:
  257.  
  258.  A2051: Operand not in current CS ASSUME segment
  259.  
  260.  The error is caused by the JE NEAR PTR statement. However, the first
  261.  jump statement assembles without error. Both statements should or
  262.  should not assemble as they generate full 16-bit fixup records.
  263.  
  264.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  265.  researching this problem and will post new information as it becomes
  266.  available.
  267.  
  268.  You can work around this problem by not using the PTR operator in the
  269.  JE instruction.
  270.  
  271.  The following code demonstrates the problem:
  272.  
  273.     .386
  274.     PGROUP  group   CODE,NCODE
  275.     CODE    segment use16 byet public 'prog'
  276.             assume  cs:PGROUP
  277.             jmp     SYM
  278.             je      near ptr SYM
  279.     CODE    ends
  280.     NCODE   segment use16 byte public 'prog'
  281.             assume  cs:PGROUP
  282.     SYM:
  283.     NCODE   ends
  284.             end
  285.  
  286.  
  287.  12. Structure Prototype Allowed to be Referenced in Program
  288.  
  289.  Product Version(s): 5.10
  290.  Operating System:   MS-DOS
  291.  Flags: ENDUSER | buglist5.10
  292.  Last Modified: 23-MAY-1988    ArticleIdent: Q30378
  293.  
  294.     The following code defines a structure-type "mouse", but does not
  295.  declare "mouse" as a location or instance of the structure:
  296.  
  297.          .MODEL SMALL
  298.     mouse struc
  299.  
  300.     cat  dw  11
  301.     dog  dw  12
  302.  
  303.     mouse ends
  304.         .DATA
  305.     duck    mouse   <>
  306.         .CODE
  307.     start: mov ax,@data
  308.            mov ds,ax
  309.            mov ax,mouse.dog
  310.  
  311.     END start
  312.  
  313.     The assembler allows access to the structure. The line "mov ax,
  314.  mouse.dog" generates the following:
  315.  
  316.     mov ax,2
  317.  
  318.     Microsoft is researching this problem and will post new information
  319.  as it becomes available.
  320.  
  321.  
  322.  
  323.  13. Structure References Using '.' Cause Confusion
  324.  
  325.  Product Version(s): 5.10
  326.  Operating System:   MS-DOS
  327.  Flags: ENDUSER | buglist5.10
  328.  Last Modified: 23-MAY-1988    ArticleIdent: Q30379
  329.  
  330.     Variable names in the assembler can begin with following the
  331.  character:
  332.  
  333.     '.'
  334.  
  335.     Structure references use the character '.' as an add operator. This
  336.  means the label '.cat' is different than the element 'cat' in a
  337.  structure.
  338.     The assembler can become confused using distinguishing the two
  339.  uses in a program, and can generate the following error message:
  340.  
  341.     Error A2028: Operator expected' occurs on 'mov ax,duck.cat'
  342.  
  343.     Microsoft is researching this problem and will post new information
  344.  as it becomes available.
  345.  
  346.     The following is an example program:
  347.  
  348.         .MODEL SMALL
  349.     mouse  struc
  350.     cat     dw   1
  351.     dog     dw   2
  352.     mouse  ends
  353.         .DATA
  354.     duck    mouse  <>
  355.         .CODE
  356.     start:  mov  ax,@data
  357.             mov  ds,ax
  358.     .cat    dw   4
  359.             mov  ax,duck.cat
  360.      END start
  361.  
  362.  
  363.  14. Text Macros Cannot Serve as Data-Definition Replacements
  364.  
  365.  Product Version(s): 5.10
  366.  Operating System:   MS-DOS
  367.  Flags: ENDUSER | buglist5.10
  368.  Last Modified: 23-MAY-1988    ArticleIdent: Q30380
  369.  
  370.     A text macro cannot be used to select data-definition directives.
  371.  The following program demonstrates this problem:
  372.  
  373.      .MODEL SMALL
  374.      .CODE
  375.  start: mov ax,@data
  376.         mov ds,ax
  377.  
  378.  gets   equ   <DW>
  379.  boat   gets   3
  380.      END start
  381.  
  382.   More Information:
  383.     The following assembler error message is generated on the "boat
  384.  gets 3" line:
  385.  
  386.     A2105 Expected: instruction, directive, or label
  387.  
  388.     Microsoft is researching this problem and will post new information
  389.  as it becomes available.
  390.  
  391.  
  392.  
  393.  15. Command Line Option /E Generates a Bad Fixup Record
  394.  
  395.  Product Version(s): 5.10
  396.  Operating System:   MS-DOS
  397.  Flags: ENDUSER | buglist5.10
  398.  Last Modified: 23-MAY-1988    ArticleIdent: Q30381
  399.  
  400.     The assembler will generate bad fixup records for floating point
  401.  instructions.
  402.     An example of this problem is the "FMUL" instruction, which will
  403.  generate the following fixup record:
  404.  
  405.  FIXUP
  406.   003:    fixup  seg  rel  offset     offset  0     fixup on 0xde9b
  407.           frame  loc  target ext "FIDRQQ"
  408.  
  409.     The frame method "loc" means Intel frame method number four. This
  410.  means the fixup frame is the same as the segment of the location.
  411.     For floating point symbols this is meaningless, particularly in
  412.  OS/2 and Windows. The frame method should be changed to frame method
  413.  number five. Frame method number five would make the frame and the
  414.  target segment the same.
  415.     The LINK utility will ignore the frame method.
  416.  
  417.     Microsoft is researching this problem and will post new information
  418.  as it becomes available.
  419.  
  420.  
  421.  
  422.  16. Command Line Option /Z Is Ignored after Processing
  423.  
  424.  Product Version(s): 5.10
  425.  Operating System:   MS-DOS
  426.  Flags: ENDUSER | buglist5.10
  427.  Last Modified: 23-MAY-1988    ArticleIdent: Q30382
  428.  
  429.     The /Z command line option tells the assembler to print out any
  430.  offending lines and any error messages it generates. The switch will
  431.  work up to the first include statement.
  432.     When an include file is processed a flag is cleared by mistake.
  433.     The workaround for this problem is to bracket the include directive
  434.  by the .XLIST or .LIST directive. Do not include a .LIST directive in
  435.  the include file. This process will guarantee that the flag is set
  436.  after the include file is processed.
  437.     Microsoft is researching this problem and will post new information
  438.  as it becomes available.
  439.  
  440.  
  441.  17. SUBSTR Directive Will Not Work if Target Is the Same as Source
  442.  
  443.  Product Version(s): 5.10
  444.  Operating System:   MS-DOS
  445.  Flags: ENDUSER | buglist5.10
  446.  Last Modified: 23-MAY-1988    ArticleIdent: Q30383
  447.  
  448.     The SUBSTR assignment to A in the following program should not be
  449.  different than the SUBSTR assignment to B:
  450.  
  451.      .MODEL SMALL
  452.      .CODE
  453.  A   equ    <abcdef>
  454.  B   substr A,4
  455.  A   substr A,4
  456.      END
  457.  
  458.     In this program, the assignment to B is "abcdef". The assignment to
  459.  A is "def".
  460.     Microsoft is researching this problem and will post new information
  461.  as it becomes available.
  462.  
  463.  
  464.  
  465.  18. MOV with Type Operator Generates Incorrect Opcodes
  466.  
  467.  Product Version(s): 5.10
  468.  Operating System:   MS-DOS
  469.  Flags: ENDUSER | buglist5.10
  470.  Last Modified: 23-MAY-1988    ArticleIdent: Q30385
  471.  
  472.     The MOV instruction, using indirect addressing, and the Type
  473.  operator generate incorrect opcodes.
  474.  
  475.     The first MOV instruction generates the opcode "B8FFF4", which is a
  476.  move-immediate instruction. The assembler should generate the opcode
  477.  "8B44F4".  This opcode is generated on the second move instruction.
  478.     MASM Version 5.00 generates the correct code for both MOV
  479.  instructions. The following code demonstrates the problem:
  480.  
  481.  seg_1  segment  para  public  'code'
  482.         assume cs:seg_1
  483.  test_str struc
  484.  test_f1  dw  ?
  485.  test_f2  dw  ?
  486.  test_f3  db  8 dup (?)
  487.  test_str ends
  488.  main_entry proc
  489.         mov  ax,word ptr [si] - type test_str
  490.  ;
  491.  ;      This alternate generation works
  492.  ;
  493.         mov  ax,word ptr { si - type test_str]
  494.  main_entry endp
  495.  seg_1  ends
  496.         end
  497.  
  498.     Microsoft is researching this problem and will post new information
  499.  as it becomes available.
  500.  
  501.  
  502.  
  503.  19. .DATA Directive Causes _DATA Segment Not to Align Paragraph
  504.  
  505.  Product Version(s): 5.10
  506.  Operating System:   MS-DOS
  507.  Flags: ENDUSER |
  508.  Last Modified: 23-MAY-1988    ArticleIdent: Q30386
  509.  
  510.     The .DATA directive word aligns the _DATA segment. The .MODEL
  511.  directive defines the _TEXT segment before the _DATA segment.
  512.  Therefore, when the simplified segment directives are used, _DATA does
  513.  not start at a paragraph boundary.
  514.  
  515.     The following sample code demonstrates this problem:
  516.  
  517.     .MODEL small
  518.     .DATA
  519.     org 0h
  520.     t1 db "table 1"
  521.     org 100h
  522.     t2 db "table 2"
  523.     .CODE
  524.     mov  ax, dgroup
  525.     mov  ds, ax
  526.     mov  bx, offset t1
  527.     mov  cx, offset t2
  528.     end
  529.  
  530.     DGROUP begins at the previous paragraph boundary, but _DATA, the
  531.  first segment in DGROUP, actually starts at DGROUP:0006. Therefore,
  532.  the offset of t2 could evaluate to _DATA:0100h. This is equivalent to
  533.  DGROUP:0106h.
  534.  
  535.  
  536.  20. EXTRN Data Items Placed Outside Segment
  537.  
  538.  Product Version(s): 5.10
  539.  Operating System:   MS-DOS
  540.  Flags: ENDUSER | buglist5.10
  541.  Last Modified: 23-MAY-1988    ArticleIdent: Q30398
  542.  
  543.     The EXTRN statement can be placed outside of a segment declaration.
  544.  When this is done, the item has no segment attributes, so it
  545.  automatically matches the DS register with the item regardless of the
  546.  active ASSUME statements.
  547.     When the EXTRN statement is contained within a segment, the active
  548.  ASSUME statement applies to the data item.
  549.     To avoid this problem, you should define all EXTRN data items
  550.  inside a segment.
  551.     Microsoft is researching this problem and will post new information
  552.  as it becomes available.
  553.  
  554.     The following example demonstrates the problem caused by the
  555.  current behavior of EXTRN data items:
  556.  
  557.     If you write a .COM program that assumes DS:NOTHING and ES:NOTHING
  558.  and declare all data items inside segments, MASM will put CS:
  559.  overrides on all data items being accessed.
  560.     If, to correct the problem, you decide to split the file into two
  561.  modules and declare the data items shared with the EXTRN statement at
  562.  the top of each module outside segments (this will not change the
  563.  ASSUME statements), the DS register will be associated with all data
  564.  items by default because you declared all EXTRN items outside
  565.  segments.
  566.  
  567.  
  568.  21. Warning A4001: Extra Characters on Line
  569.  
  570.  Product Version(s): 5.10
  571.  Operating System:   MS-DOS
  572.  Flags: ENDUSER | buglist5.10
  573.  Last Modified: 23-MAY-1988    ArticleIdent: Q30409
  574.  
  575.     The following code generates the assembler warning, "A4001: Extra
  576.  Characters on Line":
  577.  
  578.     .MODEL small
  579.     .CODE
  580.     mul ah,10
  581.     end
  582.  
  583.     Microsoft is researching this problem and will post new information
  584.  as it becomes available.
  585.  
  586.  
  587.  22. Omitting Range Keyword after LABEL Directive Causes Errors
  588.  
  589.  Product Version(s): 5.10
  590.  Operating System:   MS-DOS
  591.  Flags: ENDUSER | buglist5.10
  592.  Last Modified: 23-MAY-1988    ArticleIdent: Q30412
  593.  
  594.     When a LABEL directive is used without a range keyword, it will
  595.  cause an "Unknown type specifier" error. This error will correctly
  596.  occur if the LABEL directive is the first statement in the segment.
  597.     However, if you also have executable statements prior to the LABEL
  598.  directive in the code segment, error messages will incorrectly occur
  599.  on every statement.
  600.     The following program demonstrates the problem:
  601.  
  602.     .MODEL small
  603.     .CODE
  604.     main    proc
  605.             mov ax, 1
  606.             pt1 label
  607.     main    endp
  608.     end     main
  609.  
  610.     The "mov ax, 1" statement will incorrectly generate the error
  611.  message "Symbol not defined: AX." The statement "pt1 label" will
  612.  generate an "Unknown type specifier" error as well.
  613.  
  614.     Microsoft is researching this problem and will post new information
  615.  as it becomes available.
  616.  
  617.  
  618.  23. Only First LOCAL Variable Generates CodeView Information
  619.  
  620.  Product Version(s): 5.10
  621.  Operating System:   MS-DOS
  622.  Flags: ENDUSER | buglist5.10
  623.  Last Modified: 23-MAY-1988    ArticleIdent: Q30416
  624.  
  625.     Only the first LOCAL variable on a line will generate CodeView
  626.  information in the following assembler source code:
  627.  
  628.     .MODEL small
  629.     .CODE
  630.     main    proc
  631.     local   first:word
  632.     local   second:word,third:word
  633.     local   fourth:word
  634.     ret
  635.     main    endp
  636.             end main
  637.  
  638.     Microsoft is researching this problem and will post new information
  639.  as it becomes available.
  640.  
  641.  
  642.  24. Error Message Generated when Include File Has CTRL+Z
  643.  
  644.  Product Version(s): 5.10
  645.  Operating System:   MS-DOS
  646.  Flags: ENDUSER | buglist5.10
  647.  Last Modified: 12-JAN-1989    ArticleIdent: Q30417
  648.  
  649.  When assembling a source file with an include file that contains a
  650.  CTRL+Z, the assembler generates the error message, "A2106: line too
  651.  long."
  652.  
  653.  A workaround is to use the MS-DOS Copy command with the "/a" option,
  654.  as in the following:
  655.  
  656.  copy /a test.asm test2.asm
  657.  
  658.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  659.  researching this problem and will post new information as it becomes
  660.  available.
  661.  
  662.  
  663.  25. ASSUME Directive Using SEG Operator on Structure Causes Error
  664.  
  665.  Product Version(s): 5.10
  666.  Operating System:   MS-DOS
  667.  Flags: ENDUSER | buglist5.10
  668.  Last Modified: 23-MAY-1988    ArticleIdent: Q30419
  669.  
  670.     When the ASSUME directive uses the SEG operator, it causes an
  671.  error.
  672.     The statement "cmp byte PTR fred.d1,0" in the following program
  673.  incorrectly generates the "A2068: Cannot address with segment
  674.  register" error message.
  675.     The program assembles correctly if the statement is modified to
  676.  "cmp byte es:fred.d1,0."
  677.     Microsoft is researching this problem and will post new information
  678.  as it becomes available.
  679.  
  680.     The following program demonstrates the problem:
  681.  
  682.     .MODEL LARGE,C
  683.  
  684.     dog struc
  685.     d1  db  0
  686.     dog ends
  687.  
  688.     .FARDATA
  689.     COMM fred:dog
  690.  
  691.     .CODE
  692.     cat proc
  693.     assume es:SEG fred
  694.     cmp byte PTR fred.d1,0
  695.     ret
  696.     cat endp
  697.     end
  698.  
  699.  
  700.  26. LOCAL Directive Gives Misleading Error without .MODEL Language
  701.  
  702.  Product Version(s): 5.10
  703.  Operating System:   MS-DOS
  704.  Flags: ENDUSER | buglist5.10
  705.  Last Modified: 23-MAY-1988    ArticleIdent: Q30420
  706.  
  707.     The LOCAL directive may give a misleading error message without
  708.  specifying a language on the .MODEL directive.
  709.     The error message "Extra characters on line" is generated on the
  710.  LOCAL directive in the following code:
  711.  
  712.  .MODEL small
  713.  .code
  714.  main    proc
  715.          local first:word
  716.          mov ax,4c00h
  717.          int 21h
  718.  main    endp
  719.          end main
  720.  
  721.     The example will work correctly if you change ".MODEL small" to
  722.  ".MODEL small,c'".
  723.  
  724.     Microsoft is researching this problem and will post new information
  725.  as it becomes available.
  726.  
  727.  
  728.  27. Extra Line-Feed Character Generated in Four-Digit Listing File
  729.  
  730.  Product Version(s): 5.1O
  731.  Operating System:   MS-DOS
  732.  Flags: ENDUSER | buglist5.10
  733.  Last Modified: 23-MAY-1988    ArticleIdent: Q30421
  734.  
  735.     If the date in the file-header listing has four digits (e.g.
  736.  1/2/88), MASM will produce a file listing with extra line-feed
  737.  characters on the page headings.
  738.     For example, compare the following listings, differing only by
  739.  their dates:
  740.  
  741.  Listing 1:
  742.  Microsoft (R) Macro Assembler Version 5.10          1/2/88 19:55:07
  743.                                                      Page    1-1
  744.  Listing 2:
  745.  Microsoft (R) Macro Assembler Version 5.10          1/23/88 19:55:07
  746.                                                      Page    1-1
  747.  
  748.     Microsoft is researching this problem and will post new information
  749.  as it becomes available.
  750.  
  751.  
  752.  
  753.  28. % Operator Used in a Macro Call Generates Incorrect Output
  754.  
  755.  Product Version(s): 5.10
  756.  Operating System:   MS-DOS
  757.  Flags: ENDUSER | buglist5.10
  758.  Last Modified: 23-MAY-1988    ArticleIdent: Q30422
  759.  
  760.     The following program, which contains a macro call using the %
  761.  operator and a %out in the macro, will not always print out "assume
  762.  nothing:"
  763.  
  764.  string  equ <assume nothing>
  765.  
  766.  usestr  macro   str
  767.          %out    str
  768.          endm
  769.  
  770.          usestr  %string
  771.          .
  772.          .
  773.          .
  774.          .
  775.          usestr  %string
  776.  
  777.  end
  778.  
  779.     Microsoft is researching this problem and will post new information
  780.  as it becomes available.
  781.  
  782.  
  783.  
  784.  29. CV2206 WARNING: Corrupt Debug OMF Detected in FOO.OBJ...
  785.  
  786.  Product Version(s): 5.10   | 5.10
  787.  Operating System:   MS-DOS | OS/2
  788.  Flags: ENDUSER |
  789.  Last Modified:  6-AUG-1990    ArticleIdent: Q64438
  790.  
  791.  When loading a Microsoft Macro Assembler (MASM) program into CodeView
  792.  version 3.00, the following warning is received:
  793.  
  794.     CV2206 WARNING: Corrupt debug OMF detected in FOO.OBJ, discarding
  795.     source line information
  796.  
  797.  In this example, the program was assembled and linked with CodeView
  798.  information.
  799.  
  800.  The warning is caused because the program was written with full
  801.  segment declarations and the CODE segment was not declared class
  802.  'code'.
  803.  
  804.  The problem does not appear when using dot-segment declarations.
  805.  
  806.  The following code causes this error:
  807.  
  808.    stack   segment stack para 'stack'
  809.            db      100 dup (?)
  810.    stack   ends
  811.  
  812.    text    segment
  813.            assume   cs:text
  814.  
  815.    main    proc
  816.            ret
  817.    main    endp
  818.  
  819.    text    ends
  820.            end main
  821.  
  822.  The following code does not cause this error:
  823.  
  824.    stack   segment stack para 'stack'
  825.            db      100 dup (?)
  826.    stack   ends
  827.  
  828.    text    segment  'code'
  829.            assume   cs:text
  830.  
  831.    main    proc
  832.            ret
  833.    main    endp
  834.  
  835.    text    ends
  836.            end main
  837.  
  838.  
  839.  30. IRPC Directive and & Operator Used in Macro Behave Incorrectly
  840.  
  841.  Product Version(s): 5.10
  842.  Operating System:   MS-DOS
  843.  Flags: ENDUSER | buglist5.10
  844.  Last Modified: 12-JAN-1989    ArticleIdent: Q30424
  845.  
  846.     The following program demonstrates a problem with the IRPC
  847.  directive and the substitute operator, &, used in a macro.
  848.  
  849.     The program produces duplicate labels generated from "foo&i". The
  850.  duplicate labels are "fooay", "fooby", "foocy", "foody", "fooey", and
  851.  "foofy".
  852.     The problem occurs when the "a" macro calls the "b" macro with the
  853.  values 0-f. The b macro then calls the "dog" macro, using the
  854.  hexadecimal values 0-f for each parameter, respectively. When the "x"
  855.  parameter for the dog macro is a-f, the & substitute operator does not
  856.  work with "y". As a result, the above labels are duplicated multiple
  857.  times.
  858.     Microsoft is researching this problem and will post new information
  859.  as it becomes available.
  860.  
  861.  a macro
  862.      irpc x,0123456789abcdef
  863.      b x
  864.      endm
  865.      endm
  866.  
  867.  b macro
  868.      irpc y,0123456789abcdef
  869.      dog x&y
  870.      endm
  871.      endm
  872.  
  873.  dog macro i
  874.  foo&i:
  875.      push bp
  876.      mov bp,0&i&h
  877.      jmp reflect
  878.      endm
  879.  
  880.  code segment para
  881.      assume cs:code
  882.      start:
  883.      a
  884.  reflect:
  885.  code ends
  886.  end start
  887.  
  888.  
  889.  31. Structures and Segment Overrides
  890.  
  891.  Product Version(s): 4.00 5.10
  892.  Operating System:   MS-DOS
  893.  Flags: ENDUSER | buglist4.00
  894.  Last Modified: 17-JUN-1988    ArticleIdent: Q30491
  895.  
  896.  Problem:
  897.     When I do a segment override, using structures, I get an "Invalid
  898.  Object Module" error when I link.
  899.  
  900.  Response:
  901.     This is a known problem in Version 4.00 of MASM. This problem was
  902.  corrected in Version 5.10.
  903.     The following example illustrates the problem:
  904.  
  905.  ;
  906.  ; This is broken under 4.00 w\link 3.x.
  907.  ;
  908.  NODE struc
  909.       integer  dw ?
  910.       next     dw ?
  911.  NODE ends
  912.  ;
  913.  ;
  914.  _DATA  segment
  915.  _DATA  ends
  916.  ;
  917.  ;
  918.  _TEXT segment
  919.        mov si, offset _DATA:next ;   IT WORKS with ds:next
  920.        mov ax, 4C00h             ;   Exit to DOS
  921.        int 21h
  922.  _TEXT ends
  923.        end
  924.  
  925.  
  926.  32. LOCAL Directive with Structure Type
  927.  
  928.  Product Version(s): 5.10
  929.  Operating System:   MS-DOS
  930.  Flags: ENDUSER | buglist5.10
  931.  Last Modified: 10-JUL-1990    ArticleIdent: Q30492
  932.  
  933.     Page 42 of the MASM 5.10 update states that the LOCAL directive
  934.  accepts a name of a structure defined by a STRUC structure declaration
  935.  such as the one below:
  936.  
  937.  xy   STRUC
  938.          x     DW   ?
  939.          y     DW   ?
  940.  xy   ENDS
  941.  
  942.  foo  PROC               ;Assembler responds with
  943.       LOCAL   abc : xy   ;error A2003: Unknown type specifier
  944.  
  945.     Microsoft is researching this problem and will post new information
  946.  as it becomes available.
  947.  /*MSINTERNAL
  948.  /*CONFIRMED BY: ROLANDS
  949.  /*BUGLIST INFO:
  950.  /*RAID DATABASE: M600
  951.  /*BUG NUMBER: 788
  952.  /*
  953.  
  954.  
  955.  33. EXTRN Misspelled in Manual
  956.  
  957.  Product Version(s): 5.00 5.10 | 5.10
  958.  Operating System:   MS-DOS    | OS/2
  959.  Flags: ENDUSER | docerr
  960.  Last Modified: 12-JAN-1989    ArticleIdent: Q30493
  961.  
  962.  In the "Microsoft Macro Assembler Programmer's Guide" there are
  963.  misspelled EXTRNs, as follows:
  964.  
  965.  Page 90:  EXTR   xvariable:FAR
  966.            EXTR   xprocedure:PROC
  967.  
  968.  Page 95:  EXTR   xvariable:FAR
  969.  
  970.  The EXTRNs should be as follows:
  971.  
  972.  Page 90:  EXTRN  xvariable:FAR
  973.            EXTRN  xprocedure:PROC
  974.  
  975.  Page 95:  EXTRN  xvariable:FAR
  976.  
  977.  
  978.  34. Segment Relative Versus Group Relative
  979.  
  980.  Product Version(s): 5.10
  981.  Operating System:   MS-DOS
  982.  Flags: ENDUSER |
  983.  Last Modified: 23-MAY-1988    ArticleIdent: Q30500
  984.  
  985.     The following sample code will be used to explain segment relative
  986.  and group relative:
  987.  
  988.  dgroup  GROUP   aseg,cseg
  989.  ASSUME  cs:dgroup,ds:dgroup
  990.  aseg    SEGMENT public  byte    'CODE'
  991.          org 100h
  992.          start:
  993.          data_pointer    dw  the_data
  994.  aseg    ends
  995.  cseg    SEGMENT public  byte    'CODE'
  996.          the_data    label   byte
  997.  cseg    ends
  998.          end start
  999.  
  1000.     When defining data, fixups are relative to the start of the
  1001.  segment. The variable data_pointer will have an address relative to
  1002.  the start of the aseg segment. If you want the variable to have an
  1003.  address relative to the start of the group, you can explicitly state
  1004.  the offset relative to dgroup as follows.
  1005.  
  1006.  data_pointer    dw  offset  dgroup:the_data
  1007.  
  1008.     The exception is when you are using simplified segment directives.
  1009.  In that case, group relative fixups always are used rather than
  1010.  segment relative.
  1011.     In code segments, fixups are relative to either segment or group
  1012.  depending on the ASSUME statements. In other words, the ASSUME
  1013.  STATEMENT is checked before the fixup is generated. The exception here
  1014.  is the same as above. When using simplified segment directives, group
  1015.  relative fixups are the default.
  1016.  
  1017.     The OFFSET operator is segment relative and is discussed further in
  1018.  a separate article.
  1019.  
  1020.  
  1021.  35. .RADIX 16 Directive and Real Number Initialization Statement
  1022.  
  1023.  Product Version(s): 5.10
  1024.  Operating System:   MS-DOS
  1025.  Flags: ENDUSER | buglist5.10
  1026.  Last Modified: 23-MAY-1988    ArticleIdent: Q30502
  1027.  
  1028.     When .RADIX 16 directive is used, a real number initialization
  1029.  statement will generate the error "non-digit in number." The following
  1030.  is an example:
  1031.  
  1032.  .MODEL small
  1033.  .RADIX 16
  1034.  .data
  1035.  sym dd 1.0
  1036.  end
  1037.  
  1038.     The problem does not occur under MASM Version 4.00 or 5.00, but
  1039.  does occur under MASM Versions 5.00a and MASM 5.10.
  1040.  
  1041.     Microsoft is researching this problem and will post new information
  1042.  as it becomes available.
  1043.  
  1044.  
  1045.  36. OFFSET Operator Is Segment Relative
  1046.  
  1047.  Product Version(s): 5.10
  1048.  Operating System:   MS-DOS
  1049.  Flags: ENDUSER |
  1050.  Last Modified: 23-MAY-1988    ArticleIdent: Q30517
  1051.  
  1052.     The OFFSET operator is segment relative. The GROUP operator must be
  1053.  used to make the OFFSET operator group relative.
  1054.     The following is an example of using the OFFSET operator:
  1055.  
  1056.  group_1 GROUP seg_1,seg_2,seg_3
  1057.  
  1058.  seg_1 SEGMENT word public 'data'
  1059.  assume ds:group_1
  1060.          dw  0
  1061.  item1   dw  20 dup(0)
  1062.  
  1063.  seg_1 ends
  1064.  
  1065.  seg_2 SEGMENT word public 'code'
  1066.  assume cs:group_1
  1067.  
  1068.  func1   PROC    NEAR
  1069.          mov ax, offset item1
  1070.          lea ax, item1
  1071.          mov ax, offset group_1:item1
  1072.          mov ax, offset item2
  1073.          lea ax, item2
  1074.          mov ax, offset group_1:item2
  1075.  
  1076.  func1   ENDP
  1077.  
  1078.  seg_2  ENDS
  1079.  
  1080.  seg_3  SEGMENT  word  public  'data2'
  1081.  assume ds:group_1
  1082.  item2   dw  0
  1083.  seg_3  ENDS
  1084.  
  1085.     In the first move instruction, item1 will have the offset of 0002
  1086.  relative to the start of seg_1 segment. The next move instruction is
  1087.  using the group name to force the evaluation of item1 relative to the
  1088.  start of the group. The offset for item1 will be 0002 because seg_1 is
  1089.  the first segment in the group.
  1090.     The third move instruction containing item2 will have an offset
  1091.  0002 relative to the start of the seg_3 segment. Due to the alignment
  1092.  of the seg_3 segment, which is word aligned, the offset for item2 is
  1093.  not 0000. The fourth move instruction forces the item2 offset to be
  1094.  calculated from the beginning of the group. The seg_3 segment is not
  1095.  the first segment in the group but the third segment. The offset for
  1096.  item2 will be 0042.
  1097.  
  1098.  
  1099.  37. Fix-Up Overflow Caused By Extrn Statements and .Fardata
  1100.  
  1101.  Product Version(s): 5.10
  1102.  Operating System:   MS-DOS
  1103.  Flags: ENDUSER |
  1104.  Last Modified: 12-JAN-1989    ArticleIdent: Q30576
  1105.  
  1106.     The following assembler modules produce a fix-up overflow error
  1107.  message during linking.
  1108.     When linking these two modules together, the .fardata-simplified
  1109.  segment directive will cause a link-error fix-up overflow.
  1110.     Every module with a .fardata segment is defining a different
  1111.  .fardata segment. The linker will keep the segments separate.
  1112.  Therefore, declaring the fvar variable external in module 2 generates
  1113.  the problem. The extrn far data item, fvar, should be declared outside
  1114.  the .fardata segment.
  1115.  
  1116.  Module 1
  1117.  
  1118.  .model large
  1119.  .stack
  1120.  .data
  1121.  public gvar
  1122.  .fardata
  1123.  public fvar
  1124.  fvar  db  55h
  1125.  
  1126.  .code
  1127.  extrn t2:proc
  1128.  start: mov ax,@DATA
  1129.         mov ds,ax
  1130.         mov ax,@FARDATA
  1131.         mov es,ax
  1132.  
  1133.         call dword ptr t2
  1134.  end start
  1135.  
  1136.  Module 2
  1137.  
  1138.  .model large
  1139.  .data
  1140.  extrn gvar:byte
  1141.  .fardata
  1142.  extrn fvar:byte
  1143.  
  1144.  .code
  1145.      public t2
  1146.  t2  proc   far
  1147.      mov bl, es:fvar
  1148.      ret FAR
  1149.  t2  endp
  1150.      end
  1151.  
  1152.  
  1153.  
  1154.  38. Predefined Text Macros Are Case Sensitive
  1155.  
  1156.  Product Version(s): 5.10
  1157.  Operating System:   MS-DOS
  1158.  Flags: ENDUSER |
  1159.  Last Modified: 12-JAN-1989    ArticleIdent: Q30579
  1160.  
  1161.     When assembling in Microsoft Macro Assembler Version 5.10 with the
  1162.  /ML and predefined text macros, each word in the name of the text
  1163.  macro must begin with an uppercase letter.
  1164.     In MASM Version 5.00, you can use a predefined text macro, such as
  1165.  @filename, when assembling with the /ML switch. In MASM Version 5.10,
  1166.  use @FileName with the /ML switch.
  1167.  
  1168.     This convention does not apply to the predefined equates used with
  1169.  segment directives, such as the equate @curseg.
  1170.  
  1171.  
  1172.  
  1173.  39. Real-Number Data in IEEE Format
  1174.  
  1175.  Product Version(s): 5.10
  1176.  Operating System:   MS-DOS
  1177.  Flags: ENDUSER |
  1178.  Last Modified: 12-JAN-1989    ArticleIdent: Q30601
  1179.  
  1180.     By default, the Microsoft Macro Assembler Version 5.10 assembles
  1181.  real-number data in IEEE format. The previous versions of the
  1182.  assemblers used the Microsoft binary format by default.
  1183.  
  1184.     The following is the IEEE format for encoding 4- and 8-byte real
  1185.  numbers.
  1186.  
  1187.  Short Real Number
  1188.    31      23      15      7       0
  1189.   _________________________________
  1190.  |_|_______|_______|_______|_______|
  1191.  ^ ^       ^                       ^
  1192.  | |       |                       |
  1193.  | Exponent|                       |
  1194.  |         |Mantissa ------------->|
  1195.  |Sign
  1196.  
  1197.     The parts of the real numbers are described below:
  1198.  
  1199.     1. Sign (0 for positive or 1 for negative) is in the upper bit of
  1200.  the first byte.
  1201.     2. Exponent is in the next bits in sequence (8 bits for a short
  1202.  real number or 11 bits for a long real number).
  1203.     3. All except the first-set bit of Mantissa are in the remaining
  1204.  bits of the variable (13 bits for short real numbers, and 52 bits for
  1205.  long real numbers). Because the first significant bit is known to be
  1206.  set, it does not need to be stored.
  1207.  
  1208.     This information is documented on Pages 132-133 of the "Microsoft
  1209.  Macro Assembler Programmer's Guide."
  1210.  
  1211.  
  1212.  
  1213.  40. MASM 5.10 MIXED.DOC: Converting Mixed-Language Source Files
  1214.  
  1215.  Product Version(s): 5.10   | 5.10
  1216.  Operating System:   MS-DOS | OS/2
  1217.  Flags: ENDUSER |
  1218.  Last Modified: 25-MAY-1988    ArticleIdent: Q30784
  1219.  
  1220.     The following information is from the Microsoft Macro Assembler
  1221.  Version 5.10 MIXED.DOC file.
  1222.  
  1223.  Converting Mixed-Language Source Files
  1224.     This directory contains mixed-language example programs and macros.
  1225.     The following source files are the sample programs from Chapter 6,
  1226.  "Assembly-to-High-Level Interface," of the Mixed-Language Programming
  1227.  Guide:
  1228.  
  1229.     BA.ASM       Assembly module to be called from BASIC
  1230.     CA.ASM       Assembly module to be called from C
  1231.     FA.ASM       Assembly module to be called from FORTRAN
  1232.     PA.ASM       Assembly module to be called from Pascal
  1233.     BAMAIN.BAS   BASIC main program that calls assembly module
  1234.     CAMAIN.C     C main program that calls assembly module
  1235.     FAMAIN.FOR   FORTRAN main program that calls assembly module
  1236.     PAMAIN.PAS   Pascal main program that calls assembly module
  1237.  
  1238.     In addition, the following files are provided:
  1239.  
  1240.     POWER2.ASM   Macro version of assembly module that can be called
  1241.                  from BASIC, C, FORTRAN, or Pascal.
  1242.     MIXED.INC    Mixed language macros.
  1243.     MIXED.DOC    This file.
  1244.  
  1245.  
  1246.  41. MASM 5.10 MIXED.DOC: Macros Supported in MIXED.INC
  1247.  
  1248.  Product Version(s): 5.10   | 5.10
  1249.  Operating System:   MS-DOS | OS/2
  1250.  Flags: ENDUSER |
  1251.  Last Modified: 17-JUN-1988    ArticleIdent: Q30785
  1252.  
  1253.     The following information is from the Microsoft Macro Assembler
  1254.  Version 5.10 MIXED.DOC file.
  1255.  
  1256.  Converting Mixed-Language Source Files
  1257.     The version of MIXED.INC provided with MASM 5.10 is smaller than the
  1258.  MASM 5.00 version because most of the functionality has now been built
  1259.  into MASM and the macros are no longer needed. The following macros
  1260.  are still supported in MIXED.INC:
  1261.  
  1262.     Macro   Purpose
  1263.  
  1264.     ifFP    Assembles statement if the memory model uses far data
  1265.  
  1266.     FP      Provides ES override if the memory model uses far data
  1267.  
  1268.     pLes    Loads data (through ES for far data)
  1269.  
  1270.     pLds    Loads data (through DS for far data)
  1271.  
  1272.     To use these macros with MASM 5.10, you should include MIXED.INC
  1273.  after using .MODEL. The macro syntax is shown below:
  1274.  
  1275.  ifFP  statement
  1276.     Assembles the statement if the memory model uses far data. This
  1277.  macro can be used to push segment registers or take other action that
  1278.  is only required for far data. For example,
  1279.  
  1280.     ifFP     push  ds
  1281.  
  1282.  pushes the DS register in compact, large, and huge memory models, but
  1283.  has no effect in small and medium models.
  1284.  
  1285.  FPoperand
  1286.     Gives an ES override if the memory model uses far data. In models
  1287.  that use near data, FP is null. For example,
  1288.  
  1289.     mov      ax,FP[bx]
  1290.  
  1291.  assembles as
  1292.  
  1293.     mov      ax,es:[bx]
  1294.  
  1295.  in compact, large, and huge memory models, but as
  1296.  
  1297.     mov      ax,[bx]
  1298.  
  1299.  in small and medium models.
  1300.  
  1301.  pLes  register,address
  1302.  pLds  register,address
  1303.     Loads a pointer from the specified address to the specified
  1304.  register. If the memory model uses far data, the segment portion of
  1305.  the address will be moved into ES or DS, depending on the macro used.
  1306.  For example,
  1307.  
  1308.     pLes    bx,arg1
  1309.  
  1310.  is assembled as
  1311.  
  1312.     les     bx,arg1
  1313.  
  1314.  in compact, large, and huge memory models, but as
  1315.  
  1316.     mov     bx,arg1
  1317.  
  1318.  in small and medium models.
  1319.  
  1320.  
  1321.  42. MASM 5.10 MIXED.DOC: Compatiblity with Undocumented Macros
  1322.  
  1323.  Product Version(s): 5.10   | 5.10
  1324.  Operating System:   MS-DOS | OS/2
  1325.  Flags: ENDUSER |
  1326.  Last Modified: 17-JUN-1988    ArticleIdent: Q30786
  1327.  
  1328.     The following information is from the Microsoft Macro Assembler
  1329.  Version 5.10 MIXED.DOC file.
  1330.  
  1331.  Converting Mixed-Language Source Files
  1332.     The other macros in the MASM 5.00 version of MIXED.INC are provided
  1333.  for compatibility with MASM 5.00, but are not documented. The rest of
  1334.  this file discusses compatibility options for source code that uses
  1335.  5.00 high-level-language macros. If you did not own MASM 5.00, you
  1336.  should ignore the rest of this file. Do not use the other macros in
  1337.  MIXED.INC.
  1338.     You can use the following macros if you have source code that uses
  1339.  the macros provided with MASM 5.00.
  1340.  
  1341.     Macro      Purpose
  1342.  
  1343.     setModel   Sets memory model passed from a DOS command line. No
  1344.                longer needed because the expression operator now enables
  1345.                you to evaluate text macros passed from the command line
  1346.                directly.
  1347.  
  1348.     hProc      Initializes a procedure. Replaced by new attributes of
  1349.                the PROC directive when you specify a language argument to
  1350.                the .MODEL directive.
  1351.  
  1352.     hLocal     Initializes local variables. Replaced by new functionality
  1353.                of the LOCAL directive.
  1354.  
  1355.     hRet       Returns from a procedure. Replaced by new functionality
  1356.                of the RET instruction.
  1357.  
  1358.     hEndp      Terminates a procedure. Replaced by new functionality of
  1359.                the ENDP directive.
  1360.  
  1361.     The 5.10 versions of these macros are different than the MASM 5.00
  1362.  versions. The new macros use new MASM features to simulate the same
  1363.  functionality more efficiently. Do not use the MIXED.INC provided with
  1364.  MASM 5.00. It will not work under MASM 5.10.
  1365.  
  1366.  
  1367.  43. MASM 5.10 MIXED.DOC: Converting Old Macros of MASM 5.00
  1368.  
  1369.  Product Version(s): 5.10   | 5.10
  1370.  Operating System:   MS-DOS | OS/2
  1371.  Flags: ENDUSER |
  1372.  Last Modified: 17-JUN-1988    ArticleIdent: Q30787
  1373.  
  1374.     The following information is from the Microsoft Macro Assembler
  1375.  Version 5.10 MIXED.DOC file.
  1376.  
  1377.  Converting Mixed-Language Source Files
  1378.     Rather than use the old macros, you may want to convert your source
  1379.  files to use the built-in mixed language features of MASM 5.10. The
  1380.  conversion is straightforward and can be done easily with a text
  1381.  editor.
  1382.     The following changes can be made to source files that use macros
  1383.  from the 5.0 MIXED.INC. The source file POWER2.ASM on the MASM 5.10
  1384.  distribution disk is an example of a converted source file. You can
  1385.  compare it with the POWER2.ASM supplied with MASM 5.00.
  1386.     You must define a memory model argument and a language argument
  1387.  to the .MODEL directive to use the new mixed-language features of MASM
  1388.  5.10. You can do this within the source file:
  1389.  
  1390.     .MODEL small, c
  1391.  
  1392.     Alternately, you can pass the arguments in from the command line
  1393.  using /D. In MASM 5.00, you had to use the setModel macro to receive a
  1394.  model argument passed on the command line. You only needed to define
  1395.  the language symbol "cLang" for C; no definition was needed for other
  1396.  languages.
  1397.     The 5.00 source line to accept the argument would be:
  1398.  
  1399.     setModel
  1400.  
  1401.     For MASM 5.10, change to:
  1402.  
  1403.     %      .MODEL model,lang
  1404.  
  1405.     Notice that the expression operator (%) is required so that MASM
  1406.  can evaluate text arguments passed from the command line.
  1407.     The 5.00 command line to define C small model would be:
  1408.  
  1409.     MASM /MX /Dmodel=small /DcLang power2;
  1410.  
  1411.     For MASM 5.1, change this to:
  1412.  
  1413.     MASM /MX /Dmodel=small /Dlang=C power2;
  1414.  
  1415.     Replace references to the hProc macro with the PROC directive.
  1416.  Remember, new features of the PROC directive only work when a language
  1417.  argument is given for the .MODEL directive. The 5.00 macro syntax was:
  1418.  
  1419.     hProc  <name [NEAR|FAR]> [,<USES reglist>] [,arglist]
  1420.  
  1421.     The 5.10 syntax is:
  1422.  
  1423.     name PROC [NEAR|FAR] [,USES reglist] [,arglist]
  1424.  
  1425.     The syntax for each MASM 5.00 argument in the arglist was
  1426.  
  1427.     argument[:[NEAR|FAR] type]
  1428.  
  1429.  where the type could be BYTE, WORD, DWORD, FWORD, QWORD, TBYTE, or PTR
  1430.  (to indicate that the variable is a pointer).
  1431.     The syntax for each MASM 5.10 argument is:
  1432.  
  1433.     argument[:[[NEAR|FAR] PTR] type]
  1434.  
  1435.  where the type can be BYTE, WORD, DWORD, FWORD, QWORD, TBYTE, or a
  1436.  structure type. Note that structure types can now be given. Also, PTR
  1437.  is part of the syntax rather than a type. If PTR is given with a type,
  1438.  then it means that the variable is a pointer to a variable of the
  1439.  given type. This information makes no difference in what MASM
  1440.  assembles, but it can be used by the CodeView debugger.
  1441.     For example, consider the following MASM 5.00 source line:
  1442.  
  1443.     hProc   <doTask FAR>, <USES si di>, count:BYTE, array:PTR, number
  1444.  
  1445.     It should be changed to the following for MASM 5.10:
  1446.  
  1447.     doTask  PROC FAR USES si di, count:BYTE, array:PTR WORD, number
  1448.  
  1449.     Notice that the array is now declared as pointer to a word (or an
  1450.  array of words). In the 5.00 syntax it was simply a pointer to an
  1451.  object of undefined size.
  1452.  
  1453.     o Replace references to the hLocal macro with the LOCAL directive.
  1454.  The syntax for the 5.00 hLocal macro was:
  1455.  
  1456.     hLocal  varlist
  1457.  
  1458.     The MASM 5.1 syntax is:
  1459.  
  1460.     LOCAL   varlist
  1461.  
  1462.     The syntax for each 5.00 variable was:
  1463.  
  1464.     variable[:[NEAR|FAR] type]
  1465.  
  1466.     The syntax for each 5.10 variable is:
  1467.  
  1468.     variable[[count]][:[[NEAR|FAR] PTR] type]
  1469.  
  1470.     The difference is the same as the difference for arguments to the
  1471.  PROC directive. In addition, you can allocate local arrays by
  1472.  specifying a count (in brackets) following the variable name. For
  1473.  example:
  1474.  
  1475.     LOCAL   work[20]:WORD, string:PTR BYTE
  1476.  
  1477.     This allocates a local array of 20 words called "work" and a
  1478.  pointer to byte (called "string").
  1479.  
  1480.     o Replace references to the hRet macro with the RET instruction.
  1481.  
  1482.     o Replace references to the hEndp macro with the ENDP directive
  1483.  preceded by the procedure name. For example, change
  1484.  
  1485.     hEndp
  1486.  
  1487.  to
  1488.  
  1489.     procname ENDP
  1490.  
  1491.     Under MASM 5.10, labels within a procedure are local to the
  1492.  procedure if the language argument is given for the .MODEL directive.
  1493.  For example, if you use the label "exit:" in one procedure, you can
  1494.  use it again in another procedure. A label inside a procedure can be
  1495.  made global to the source file by putting two colons after it
  1496.  (example, "glabel::"). Under MASM 5.00 all labels were global to the
  1497.  source file.
  1498.     Note that the 5.00 macros did not automatically handle 80386
  1499.  features such as 32-bit pointers. The 5.10 features do. For example, if
  1500.  you use the .386 directive before the .MODEL directive to enable
  1501.  32-bit segments, near pointers declared with PTR will be 32 bits wide
  1502.  and far pointers will be 48 bits wide.
  1503.  
  1504.  
  1505.  44. MASM 5.10 OS2.DOC: Calling OS/2 Macros
  1506.  
  1507.  Product Version(s): 5.10   | 5.10
  1508.  Operating System:   MS-DOS | OS/2
  1509.  Flags: ENDUSER |
  1510.  Last Modified: 25-MAY-1988    ArticleIdent: Q30800
  1511.  
  1512.     The following information is from the Microsoft Macro Assembler
  1513.  Version 5.10 OS2.DOC file.
  1514.  
  1515.  Calling OS/2 Macros
  1516.     You can simplify calls of OS/2 systems services by using the
  1517.  macros. The OS/2 macros are organized into groups that can be enabled
  1518.  by including the file OS2.INC and defining constants associated with
  1519.  each group. For example, to enable file management macros, put the
  1520.  following lines in the source file where the macros will be used:
  1521.  
  1522.  INCL_DOSFILEMGR EQU 1
  1523.  INCLUDE os2.inc
  1524.  
  1525.     Note that the constant must be defined before the include file is
  1526.  specified. The groups of macros and the constants associated with each
  1527.  are described later in this file.
  1528.     Macros have the name of the OS/2 call preceded by an at sign (@).
  1529.  For example, the macro to call the DosFindNext service is called
  1530.  @DosFindNext.
  1531.     Parameters are passed to macros by listing them on the same line as
  1532.  the macro name in much the same way as in most high-level languages.
  1533.  For example, you could use the following lines to call the
  1534.  @DosFindNext macro:
  1535.  
  1536.  dHandle   DW      -1            ; Directory handle
  1537.  dResult   FILEFINDBUF <>        ; Structure for results
  1538.  dlResult  EQU     $ - dResult   ;   length of result
  1539.  dCount    DW      1             ; Find one file at a time
  1540.            .
  1541.            .
  1542.            .
  1543.            @DosFindNext [dHandle], dResult, dlResult, dCount
  1544.  
  1545.     When passing memory locations as arguments, you can specify the
  1546.  contents of the specified variable by enclosing it in brackets. In the
  1547.  command line above, the value of the word variable dHandle (-1) is
  1548.  passed as the first argument.
  1549.     To pass the far address of a variable, give the argument without
  1550.  brackets. The addresses of dResult and dCount are passed in the
  1551.  command-line above. Note that dResult is defined as a structure of
  1552.  type FILEFINDBUF. The FILEFINDBUF structure is defined in the include
  1553.  file.
  1554.     You can pass word values in registers or constants by listing them
  1555.  without brackets. For example, dlResult is a constant in the example.
  1556.  If the file handle were in register DX instead of in the variable
  1557.  dHandle, you could substitute the register name. You cannot pass
  1558.  doubleword constants. For example, to pass a doubleword zero, you must
  1559.  first store the value in a variable.
  1560.     The macros do type checking. An error will be generated if you pass
  1561.  an argument of an invalid size or if you pass the wrong number of
  1562.  arguments. All arguments are expected to be word or doubleword values.
  1563.  Addresses are always far, and are thus passed as doublewords.
  1564.     Note that the macros cannot check to see that you are actually
  1565.  passing an an address when required, since the macro has no way of
  1566.  knowing whether you are passing the address as a doubleword pointer
  1567.  variable or as a label specifying an address.
  1568.     If you wish to pass a value stored in a byte variable or register,
  1569.  you must expand this value to a word before passing. For example, use
  1570.  CBW to expand a byte in AL to a word in AX.
  1571.     Most valid operands can be passed as arguments. For example, the
  1572.  following are valid arguments:
  1573.  
  1574.      [es:[di]]              ; Contents of a word indirect memory operand
  1575.      <[DWORD PTR es:[di]]>  ; Contents of a doubleword indirect memory operand
  1576.      <SIZE var1>            ; A constant
  1577.      es:table[bx]           ; Address of an indirect memory operand
  1578.  
  1579.     Note that arguments containing spaces or tabs must be enclosed in
  1580.  angle brackets so that the macro will see them as a single argument.
  1581.     The macros assume that DS=SS. If you change either of these
  1582.  registers temporarily, you should restore the register before passing
  1583.  arguments. The macros may change the contents of AX or BX, so you
  1584.  should save any important values in these registers before using an
  1585.  OS/2 macro.
  1586.  
  1587.  
  1588.  45. MASM 5.10 OS2.DOC: OS/2 Call Summary - Overview
  1589.  
  1590.  Product Version(s): 5.10   | 5.10
  1591.  Operating System:   MS-DOS | OS/2
  1592.  Flags: ENDUSER |
  1593.  Last Modified: 25-MAY-1988    ArticleIdent: Q30801
  1594.  
  1595.     The following information is from the Microsoft Macro Assembler
  1596.  Version 5.10 OS2.DOC file.
  1597.  
  1598.  OS/2 Call Summary
  1599.     The OS/2 calls are listed below. The constant symbols associated
  1600.  with each group of macros are shown before the listings. The listings
  1601.  consist of the macro name followed by a one-line description. A second
  1602.  line shows the arguments expected by the macro. The following symbols
  1603.  are used to indicate the type of each argument:
  1604.  
  1605.      W     Word
  1606.      D     Doubleword
  1607.      PB    Pointer to byte
  1608.      PW    Pointer to word
  1609.      PD    Pointer to doubleword
  1610.      PZ    Pointer to ASCIIZ string
  1611.      PS    Pointer to structure
  1612.  
  1613.     If the macro expects the address of a structure as one of its
  1614.  arguments, the structure will be listed below the argument line. See
  1615.  the include files for listings of structure fields. The include files
  1616.  also contain definitions for constants often passed to specific
  1617.  macros.
  1618.     This document makes no attempt to explain the purpose or function
  1619.  of the OS/2 systems calls. The calls are described in detail in
  1620.  manuals published separately by Microsoft and in some third-party
  1621.  books and magazine articles.
  1622.  
  1623.  
  1624.  46. MASM 5.10 OS2.DOC: OS/2 Call Summary - @DosBeep, @DosExit
  1625.  
  1626.  Product Version(s): 5.10   | 5.10
  1627.  Operating System:   MS-DOS | OS/2
  1628.  Flags: ENDUSER |
  1629.  Last Modified: 27-MAY-1988    ArticleIdent: Q30802
  1630.  
  1631.     The following information is from the Microsoft Macro Assembler
  1632.  Version 5.10 OS2.DOC file:
  1633.  
  1634.  OS/2 Call Summary:
  1635.     The following macros are included unconditionally:
  1636.  
  1637.     @DosBeep - Generates sound from speaker
  1638.     Parameters - Frequency:W, Duration:W
  1639.  
  1640.     @DosExit - Terminates a thread
  1641.     Parameters - ActionCode:W, ResultCode:W
  1642.  
  1643.  
  1644.  47. MASM 5.10 OS2.DOC: OS/2 Call Summary - Error Number Constant
  1645.  
  1646.  Product Version(s): 5.10   | 5.10
  1647.  Operating System:   MS-DOS | OS/2
  1648.  Flags: ENDUSER |
  1649.  Last Modified: 25-MAY-1988    ArticleIdent: Q30803
  1650.  
  1651.     The following information is from the Microsoft Macro Assembler
  1652.  Version 5.10 OS2.DOC file.
  1653.  
  1654.  OS/2 Call Summary:
  1655.     Named error number constant - INCL_ERRORS
  1656.  
  1657.  
  1658.  48. MASM 5.10 OS2.DOC: OS/2 Call Summary - Process Control
  1659.  
  1660.  Product Version(s): 5.10   | 5.10
  1661.  Operating System:   MS-DOS | OS/2
  1662.  Flags: ENDUSER |
  1663.  Last Modified: 26-MAY-1988    ArticleIdent: Q30804
  1664.  
  1665.     The following information is from the Microsoft Macro Assembler
  1666.  Version 5.10 OS2.DOC file.
  1667.  
  1668.  OS/2 Call Summary
  1669.  Processes control constant - INCL_DOSPROCESS
  1670.  
  1671.     @DosCreateThread - Creates an asynchronous thread
  1672.     Parameters - PgmAddress:D, ThreadID:PW, NewThreadStack:PB
  1673.  
  1674.     @DosResumeThread - Restarts a suspended thread
  1675.     Parameters - ThreadID:W
  1676.  
  1677.     @DosSuspendThread - Suspends a thread
  1678.     Parameters - ThreadID:W
  1679.  
  1680.     @DosCWait - Makes thread wait for child process to terminate
  1681.     Parameters - ActionCode:W, WaitOption:W, ReturnCodes:PS, ProcessIDWord:PD,
  1682.                  ProcessID:W
  1683.     Structure - RESULTCODES
  1684.  
  1685.     @DosSleep - Suspends current thread for specified interval
  1686.     Parameters - Interval:D
  1687.  
  1688.     @DosEnterCritSec - Disables other threads
  1689.     Parameters - none
  1690.  
  1691.     @DosExitCritSec - Reenables other threads
  1692.     Parameters - none
  1693.  
  1694.     @DosExitList - Maintains list of routines to be executed when thread ends
  1695.     Parameters - FnCode:W, RtnAddress:PW
  1696.  
  1697.     @DosExecPgm - Requests execution of a child program
  1698.     Parameters - ObjNameBuf:PB, ObjNameBufL:W, AsyncTraceFlags:W,
  1699.                  ArgPointer:PZ, EnvPointer:PZ, ReturnCodes:PD, PgmPointer,PZ
  1700.  
  1701.     @DosGetPid - Gets process identification
  1702.     Parameters - Pid:PS
  1703.     Structure - PIDINFO
  1704.  
  1705.     @DosGetPrty - Returns the priority of a thread
  1706.     Parameters - Scope:W, Priority:PW, ID:W
  1707.  
  1708.     @DosSetPrty - Sets the priority of a child process or thread
  1709.     Parameters - Scope:W, PriorityClass:W, PriorityDelta:W, ID:W
  1710.  
  1711.     @DosKillProcess - Terminates a process and returns its termination code
  1712.     Parameters - ActionCode:W, ProcessID:W
  1713.  
  1714.  
  1715.  49. MASM 5.10 OS2.DOC: OS/2 Call Summary - Segment Information
  1716.  
  1717.  Product Version(s): 5.10   | 5.10
  1718.  Operating System:   MS-DOS | OS/2
  1719.  Flags: ENDUSER |
  1720.  Last Modified: 26-MAY-1988    ArticleIdent: Q30805
  1721.  
  1722.     The following information is from the Microsoft Macro Assembler
  1723.  Version 5.10 OS2.DOC file.
  1724.  
  1725.  OS/2 Call Summary
  1726.  Information segment constant - INCL_DOSPROCESS
  1727.  
  1728.     @DosGetInfoSeg - Returns the addresses of the global and local segment
  1729.     Parameters - GlobalSeg:PW, LocalSeg:PW
  1730.     Structures - The returned segments contain the addresses of the GINFOSEG
  1731.                  and LINFOSEG structures
  1732.  
  1733.  
  1734.  50. MASM 5.10 OS2.DOC: OS/2 Call Summary - File Management
  1735.  
  1736.  Product Version(s): 5.10   | 5.10
  1737.  Operating System:   MS-DOS | OS/2
  1738.  Flags: ENDUSER |
  1739.  Last Modified: 26-MAY-1988    ArticleIdent: Q30806
  1740.  
  1741.     The following information is from the Microsoft Macro Assembler
  1742.  Version 5.10 OS2.DOC file.
  1743.  
  1744.  OS/2 Call Summary
  1745.  File management constant - INCL_DOSFILEMGR
  1746.  
  1747.     @DosOpen - Opens a file (creating it if necessary)
  1748.     Parameters - FileName:PZ, Handle:PW, ActionTaken:PW, Size:D,
  1749.                  FileAttribute:W, OpenFlag:W, OpenMode:@, Reserved:D
  1750.  
  1751.     @DosClose - Closes a file handle
  1752.     Parameters - FileHandle:W
  1753.  
  1754.     @DosRead - Reads bytes from a file to a buffer
  1755.     Parameters - FileHandle:W, BufferArea:PB, BufferLength:W, ByteRead:PW
  1756.  
  1757.     @DosWrite - Writes bytes synchronously from a buffer to a file
  1758.     Parameters - FileHandle:W, BufferAddress:PB, BufferLength:W,
  1759.                  BytesWritten:PW
  1760.  
  1761.     @DosDelete - Deletes a file
  1762.     Parameters - FileName:PZ, Reserved:D
  1763.  
  1764.     @DosDupHandle - Returns a new duplicate file handle for an open file
  1765.     Parameters - OldFileHandle:W, NewFileHandle:PW
  1766.  
  1767.     @DosQFHandState - Gets the state of the specified file
  1768.     Parameters - FileHandle:W, FileHandleState:PW
  1769.  
  1770.     @DosSetFHandState - Sets the state of a file
  1771.     Parameters - FileHandle:W, FileHandleState:W
  1772.  
  1773.     @DosQHandType - Determines whether a handle references a file or a device
  1774.     Parameters - FileHandle:W, HandType:PW, FlagWord:PW
  1775.  
  1776.     @DosReadAsync - Reads bytes from a file to a buffer asynchronously
  1777.     Parameters - FileHandle:W, RamSemaphore:PD, ReturnCode:PW, BufferArea:PB,
  1778.                  BufferLength:W, BytesRead:PW
  1779.  
  1780.     @DosWriteAsync - Writes bytes asynchronously from a buffer to a file
  1781.     Parameters - FileHandle:W, RamSemaphore:PD, ReturnCode:PW,
  1782.                  BufferAddress:PB, BufferLength:W, BytesWritten:PW
  1783.  
  1784.     @DosFindFirst - Finds the first directory entry matching a file
  1785.                     specification
  1786.     Parameters - FileName:PZ, DirHandle:PW, Attribute:W, ResultBuf:PS
  1787.                  ResultBufLen:W, SearchCount:PW, Reserved:D
  1788.     Structure - FILEFINDBUF
  1789.  
  1790.     @DosFindNext - Finds the next directory entry matching a file specificatio
  1791.     Parameters - DirHandle:W, ResultBuf:PS, ResultBufLen:W, SerachCount:PW
  1792.     Structure - FILEFINDBUF
  1793.  
  1794.     @DosFindClose - Closes a directory search handle
  1795.     Parameters - DirHandle:W
  1796.  
  1797.     @DosNewSize - Changes the size of a file
  1798.     Parameters - FileHandle:W, Size:D
  1799.  
  1800.     @DosBufReset - Flushes a file buffer and updates directory information
  1801.     Parameters - FileHandle:W
  1802.  
  1803.     @DosChgFilePtr - Moves the read/write pointer according to a specified
  1804.                      method
  1805.     Parameters - FileHandle:W, Distance:D, MoveType:W, NewPointer:PD
  1806.  
  1807.     @DosFileLocks - Locks or unlocks a range in an open file
  1808.     Parameters - FileHandle:W, UnlockRange:PD, LockRange:PD
  1809.  
  1810.     @DosMove - Moves (or renames) a specified file
  1811.     Parameters - OldFilename:PZ, NewFileName:PZ, Reserved:D
  1812.  
  1813.     @DosMkdir - Creates a directory
  1814.     Parameters - DirName:PZ, Reserved:D
  1815.  
  1816.     @DosRmdir - Removes a subdirectory from a disk
  1817.     Parameters - DirName:PZ, Reserved:D
  1818.  
  1819.     @DosSelectDisk - Selects a specified drive as the new default drive
  1820.     Parameters - DriveNumber:W
  1821.  
  1822.     @DosQCurDisk - Returns the current drive
  1823.     Parameters - DriveNumber:PW, LogicalDriveMap:PD
  1824.  
  1825.     @DosChdir - Changes to a specified directory
  1826.     Parameters - DirName:PZ, Reserved:D
  1827.  
  1828.     @DosQCurDir - Retrieves the full path of the current directory
  1829.     Parameters - DriveNumber:W, DirPath:PB, DirPathLen:PW
  1830.  
  1831.     @DosQFSInfo - Retrieves information from a file system device
  1832.     Parameters - DriveNumber:W, FSInfoLevel:W, FSInfoBuf:PB, FSInfoBufSize:W
  1833.     Structure - For GDInfoLevel 1, point FSInfoBuf to FSALLOCATE
  1834.  
  1835.     @DosSetFSInfo - Sets information for a file system device
  1836.     Parameters - DriveNumber:W, FSInfoLevel:W, FSInfoBuf:PB, FSInfoBufSize:W
  1837.  
  1838.     @DosQVerify - Returns the value of the verify flag
  1839.     Parameters - VerifySetting:PW
  1840.  
  1841.     @DosSetVerify - Sets the verify flag
  1842.     Parameters - VerifySetting:W
  1843.  
  1844.     @DosSetMaxFH - Defines the maximum number of file handles
  1845.     Parameters - NumberHandles:W
  1846.  
  1847.     @DosQFileInfo - Returns information about a file
  1848.     Parameters - FileHandle:W, FileInfoLevel:W, FileInfoBuf:PB,
  1849.                  FileInfoBufSize:B
  1850.     Structure - At FileInfoLevel 1, can point FileInfoBuf to FILESTATUS
  1851.  
  1852.     @DosSetFileInfo - Specifies information for a file
  1853.     Parameters - FileHandle:W, FileInfoLevel:W, FileInfoBuf:PB,
  1854.                  FileInfoBufSize:W
  1855.     Structure - At FileInfoLevel 1, can point FileInfoBuf to FILESTATUS
  1856.  
  1857.     @DosQFileMode - Retrieves the mode (attribute) of a file
  1858.     Parameters - FileName:PZ, Attribute:PW, Reserved:D
  1859.  
  1860.     @DosSetFileMode - Changes the mode (attribute) of a file
  1861.     Parameters - Filename:PZ, Attribute:W, Reserved:D
  1862.  
  1863.  
  1864.  51. MASM 5.10 OS2.DOC: OS/2 Call Summary - Memory Management
  1865.  
  1866.  Product Version(s): 5.10   | 5.10
  1867.  Operating System:   MS-DOS | OS/2
  1868.  Flags: ENDUSER |
  1869.  Last Modified: 26-MAY-1988    ArticleIdent: Q30807
  1870.  
  1871.     The following information is from the Microsoft Macro Assembler
  1872.  Version 5.10 OS2.DOC file>
  1873.  
  1874.  OS/2 Call Summary
  1875.  Memory management constant - INCL_DOSMEMMGR
  1876.  
  1877.     @DosAllocSeg - Allocates a segment of memory
  1878.     Parameters - Size:W, Selector:PW, AllocFlags:W
  1879.  
  1880.     @DosReallocSeg - Changes the size of an allocated segment
  1881.     Parameters - Size:W, Selector:W
  1882.  
  1883.     @DosFreeSeg - Deallocates a segment
  1884.     Parameters - Selector:W
  1885.  
  1886.     @DosGiveSeg - Gives another process access to a shared memory segment
  1887.     Parameters - CallerSegHandle:W, ProcessID:W, RecipientSegHandle:PW
  1888.  
  1889.     @DosGetSeg - Gets access to a shared memory segment
  1890.     Parameters - Selector:W
  1891.  
  1892.     @DosAllocHuge - Allocates memory potentially requiring multiple segments
  1893.     Parameters - NumSeg:W, Size:W, Selector:PW, ShareInd:W, MaxNumSeg:W
  1894.  
  1895.     @DosReallocHuge - Changes memory amount previously allocated by
  1896.                       DosAllocHuge
  1897.     Parameters - NumSet:W, Size:W, Selector:W
  1898.  
  1899.     @DosGetHugeShift - Returns a shift count used to derive selectors to
  1900.                        huge memory allocated with DosAllocHuge
  1901.     Parameters - ShiftCount:PW
  1902.  
  1903.     @DosAllocShrSeg - Allocates a shared memory segment
  1904.     Parameters - Size:W, Name:PZ, Selector:PW
  1905.  
  1906.     @DosLockSeg - Locks a discardable segment in memory
  1907.     Parameters - Selector:W
  1908.  
  1909.     @DosUnlockSeg - Unlocks a discardable segment
  1910.     Parameters - Selector:W
  1911.  
  1912.     @DosGetShrSeg - Allows a process to access a previously allocated shared
  1913.                     memory segment and increments the segment reference count
  1914.     Parameters - Name:PZ, Selector:PW
  1915.  
  1916.     @DosMemAvail - Returns the size of the largest block of free memory
  1917.     Parameters - MemAvailSize:PD
  1918.  
  1919.     @DosCreateCSAlias - Creates an executable alias for a data type descriptor
  1920.                         passed as input
  1921.     Parameters - DataSelector:W, CodeSelector:PW
  1922.  
  1923.     @DosSubAlloc - Allocates memory from within a segment that was previously
  1924.                    allocated and initialized with DosSubSet
  1925.     Parameters - SegSelector:W, BlockOffset:PW, Size:W
  1926.  
  1927.     @DosSubFree - Frees memory previously allocated with DosSubAlloc
  1928.     Parameters - SegSelector:W, BlockOffset:W, Size:W
  1929.  
  1930.     @DosSubSet - Initializes a segment for suballocation, or changes the size
  1931.                  of a previous suballocation
  1932.     Parameters - SegSelector:W, BlockOffset:W, Size:W
  1933.  
  1934.  
  1935.  52. MASM 5.10 OS2.DOC: OS/2 Call Summary - Semaphores
  1936.  
  1937.  Product Version(s): 5.10   | 5.10
  1938.  Operating System:   MS-DOS | OS/2
  1939.  Flags: ENDUSER |
  1940.  Last Modified: 26-MAY-1988    ArticleIdent: Q30808
  1941.  
  1942.     The following information is from the Microsoft Macro Assembler
  1943.  Version 5.10 OS2.DOC file.
  1944.  
  1945.  OS/2 Call Summary
  1946.  Semaphore constant - INCL_DOSSEMAPHORES
  1947.  
  1948.     @DosSemClear - Unconditionally clears a semaphore
  1949.     Parameters - SemHandle:D
  1950.  
  1951.     @DosSemSet - Unconditionally sets a semaphore
  1952.     Parameters - SemHandle:D
  1953.  
  1954.     @DosSemWait - Blocks current thread until a specified semaphore is cleared
  1955.     Parameters - SemHandle:D, Timeout:D
  1956.  
  1957.     @DosSemSetWait - Sets a specified semaphore and blocks current thread
  1958.                      until the semaphore is cleared
  1959.     Parameters - SemHandle:D, Timeout:D
  1960.  
  1961.     @DosSemRequest - Obtains a semaphore
  1962.     Parameters - SemHandle:D, Timeout:D
  1963.  
  1964.     @DosCreateSem - Creates a system semaphore
  1965.     Parameters - NoExclusive:W, SemHandle:PD, SemName:PZ
  1966.  
  1967.     @DosOpenSem - Opens a semaphore and assigns it a handle
  1968.     Parameters - SemHandle:PD, SemName:PZ
  1969.  
  1970.     @DosCloseSem - Closes a system semaphore
  1971.     Parameters - SemHandle:D
  1972.  
  1973.     @DosMuxSemWait - Blocks the current thread until one or more specified
  1974.                      semaphores is cleared
  1975.     Parameters - IndexNum:PW, ListAddr:PS, Timeout:D
  1976.     Structure - MUXSEMLIST (which contains MUXSEM structures)
  1977.  
  1978.  
  1979.  53. MASM 5.10 OS2.DOC: OS/2 Call Summary - Module Management
  1980.  
  1981.  Product Version(s): 5.10   | 5.10
  1982.  Operating System:   MS-DOS | OS/2
  1983.  Flags: ENDUSER |
  1984.  Last Modified: 27-MAY-1988    ArticleIdent: Q30809
  1985.  
  1986.     The following information is from the Microsoft Macro Assembler
  1987.  Version 5.10 OS2.DOC file.
  1988.  
  1989.  OS/2 Call Summary
  1990.  Module management constant - INCL_DOSMODULEMGR
  1991.  
  1992.     @DosLoadModule - Loads a dynamic-link module and assigns it a handle
  1993.     Parameters - ObjNameBufAdd:PD, ObjNameBufL:W, ModuleName:PZ,
  1994.                  ModuleHandle:PW
  1995.  
  1996.     @DosFreeModule - Frees a reference to a dynamic-link module
  1997.     Parameters - ModuleHandle:W
  1998.  
  1999.     @DosGetProcAddr - Returns the far address of a procedure within a
  2000.                       dynamic-link module
  2001.     Parameters - ModuleHandle:W, ProcName:PZ, ProcAddress:PD
  2002.  
  2003.     @DosGetModHandle - Tests whether a specified dynamic-link module is loaded
  2004.     Parameters - ModuleName:PZ, ModuleHandle:PW
  2005.  
  2006.     @DosGetModName - Returns the complete pathname of a specified module
  2007.     Parameters - ModuleHandle:W, BufferLength:W, Buffer:PB
  2008.  
  2009.  
  2010.  54. MASM 5.10 OS2.DOC: OS/2 Call Summary - Resource Management
  2011.  
  2012.  Product Version(s): 5.10   | 5.10
  2013.  Operating System:   MS-DOS | OS/2
  2014.  Flags: ENDUSER |
  2015.  Last Modified: 26-MAY-1988    ArticleIdent: Q30810
  2016.  
  2017.     The following information is from the Microsoft Macro Assembler
  2018.  Version 5.10 OS2.DOC file.
  2019.  
  2020.  OS/2 Call Summary
  2021.  Resource management constant - INCL_DOSRESOURCES
  2022.  
  2023.     @DosGetResource - Returns the selector of a specified resource segment
  2024.     Parameters - ModHandle:W, TypeID:W, NameID:W, Selector:PW
  2025.  
  2026.  
  2027.  55. MASM 5.10 OS2.DOC: OS/2 Call Summary - National Lang. Support
  2028.  
  2029.  Product Version(s): 5.10   | 5.10
  2030.  Operating System:   MS-DOS | OS/2
  2031.  Flags: ENDUSER |
  2032.  Last Modified:  1-JUN-1988    ArticleIdent: Q30811
  2033.  
  2034.     The following information is from the Microsoft Macro Assembler
  2035.  Version 5.10 OS2.DOC file.
  2036.  
  2037.  OS/2 Call Summary
  2038.  National language support constant - INCL_DOSNLS
  2039.  
  2040.     @DosGetCtryInfo - Obtains country-dependent formatting information
  2041.     Parameters - Length:W, CountryCode:PS, MemoryBuffer:PS, DataLength:PW
  2042.     Structures - COUNTTRYCODE, COUNTRYINFO
  2043.  
  2044.     @DosGetDBCSEv - Obtains the DBCS environmental vector from COUNTRY.SYS
  2045.     Parameters - Length:W, CountryCode:PS, MemoryBuffer:PW
  2046.     Structure - COUNTRYCODE
  2047.  
  2048.     @DosCaseMap - Does case mapping on an ASCII string
  2049.     Parameters - Length:W, CountryCode:PS, String:PB
  2050.     Structure - COUNTRYCODE
  2051.  
  2052.     @DosGetCollate - Obtains an ASCII collating sequence table from
  2053.                      COUNTRY.SYS
  2054.     Parameters - Length:W, CountryCode:PS, MemoryBuffer:PB, DataLength:PW
  2055.     Structure - COUNTRYCODE
  2056.  
  2057.     @DosGetCp - Queries the current code page and the prepared system code
  2058.                 pages
  2059.     Parameters - Length:W, CodePageList:PW, DataLength:PW
  2060.  
  2061.     @DosSetCp - Sets the code page
  2062.     Parameters - CodePage:W, Reserved:W
  2063.  
  2064.  
  2065.  56. MASM 5.10 OS2.DOC: OS/2 Call Summary - Signal Management
  2066.  
  2067.  Product Version(s): 5.10   | 5.10
  2068.  Operating System:   MS-DOS | OS/2
  2069.  Flags: ENDUSER |
  2070.  Last Modified: 26-MAY-1988    ArticleIdent: Q30812
  2071.  
  2072.     The following information is from the Microsoft Macro Assembler
  2073.  Version 5.10 OS2.DOC file.
  2074.  
  2075.  OS/2 Call Summary
  2076.  Signal management constant - INCL_DOSSIGNALS
  2077.  
  2078.     @DosSetSigHandler - Establishes a signal handler
  2079.     Parameters - RoutineAddress:D, PrevAddress:PD, PrevAction:PW, Action:W,
  2080.                  SigNumber:W
  2081.  
  2082.     @DosFlagProcess - Sets an external event flag on another process
  2083.     Parameters - ProcessID:W, Action:W, FlagNum:W, FlagArg:W
  2084.  
  2085.     @DosHoldSignal - Temporarily enables or disables signal processing
  2086.     Parameters - ActionCode:W
  2087.  
  2088.     @DosSendSignal - Sends a CTRL-C or CTRL-BREAK signal
  2089.     Parameters - ProcessID:W, SigNumber:W
  2090.  
  2091.  
  2092.  57. MASM 5.10 OS2.DOC: OS/2 Call Summary - Monitor Management
  2093.  
  2094.  Product Version(s): 5.10   | 5.10
  2095.  Operating System:   MS-DOS | OS/2
  2096.  Flags: ENDUSER |
  2097.  Last Modified: 26-MAY-1988    ArticleIdent: Q30813
  2098.  
  2099.     The following information is from the Microsoft Macro Assembler
  2100.  Version 5.10 OS2.DOC file.
  2101.  
  2102.  OS/2 Call Summary
  2103.  Monitor management constant - INCL_DOSMONITORS
  2104.  
  2105.     @DosMonOpen - Initiates device monitoring and assigns a monitor handle
  2106.     Parameters - DevName:PZ, Handle:PW
  2107.  
  2108.     @DosMonClose - Terminates device monitoring
  2109.     Parameters - Handle:W
  2110.  
  2111.     @DosMonReg - Establishes input and output buffers to monitor an I/O stream
  2112.     Parameters - Handle:W, BufferI:PB, BufferO:PB, PosFlag:W, Index:W
  2113.  
  2114.     @DosMonRead - Waits for and reads input from the monitor buffer
  2115.     Parameters - BufferI:PB, WaitFlag:W, DataBuffer:PB, ByteCnt:PW
  2116.  
  2117.     @DosMonWrite - Writes data to the output buffer of a monitor
  2118.     Parameters - BufferO:PB, DataBuffer:PB, ByteCnt:W
  2119.  
  2120.  
  2121.  58. MASM 5.10 OS2.DOC: OS/2 Call Summary - Queue Management
  2122.  
  2123.  Product Version(s): 5.10   | 5.10
  2124.  Operating System:   MS-DOS | OS/2
  2125.  Flags: ENDUSER |
  2126.  Last Modified: 26-MAY-1988    ArticleIdent: Q30814
  2127.  
  2128.     The following information is from the Microsoft Macro Assembler
  2129.  Version 5.10 OS2.DOC file.
  2130.  
  2131.  OS/2 Call Summary
  2132.  Queue management constant - INCL_DOSQUEUES
  2133.  
  2134.     @DosMakePipe - Creates a pipe
  2135.     Parameters - ReadHandle:PW, WriteHandle:PW, PipeSize:W
  2136.  
  2137.     @DosCloseQueue - Closes a queue
  2138.     Parameters - QueueHandle:W
  2139.  
  2140.     @DosCreateQueue - Creates and opens a queue
  2141.     Parameters - QueueHandle:PW, QueuePrt:W, QueueName:PZ
  2142.  
  2143.     @DosOpenQueue - Opens a queue
  2144.     Parameters - OwnerPID:PW, QueueHandle:PW, QueueName:PZ
  2145.  
  2146.     @DosPeekQueue - Retrieves, but does not remove, a queue element
  2147.     Parameters - QueueHandle:W, Request:PD, DataLength:PW, DataAddress:PD
  2148.                  ElementCode:PW, NowWait:W, ElemPriority:PB, SemHandle:D
  2149.  
  2150.     @DosPurgeQueue - Purges a queue of all elements
  2151.     Parameters - QueueHandle:W
  2152.  
  2153.     @DosQueryQueue - Finds the size of (number of elements in) a queue
  2154.     Parameters - QueueHandle:W, NumberElements:PW
  2155.  
  2156.     @DosReadQueue - Reads and removes an element from a queue
  2157.     Parameters - QueueHandle:W, Request:PD, DataLength:PW, DataAddress:PD
  2158.                  ElementCode:W, NoWait:W, ElemPriority:PW, SemHandle:D
  2159.  
  2160.     @DosWriteQueue - Adds an element to a queue
  2161.     Parameters - QueueHandle:W, Request:W, DataLength:W, DataBuffer:PB,
  2162.                  ElemPriority:W
  2163.  
  2164.  
  2165.  59. MASM 5.10 OS2.DOC: OS/2 Call Summary - Miscellaneous Functions
  2166.  
  2167.  Product Version(s): 5.10   | 5.10
  2168.  Operating System:   MS-DOS | OS/2
  2169.  Flags: ENDUSER |
  2170.  Last Modified: 26-MAY-1988    ArticleIdent: Q30815
  2171.  
  2172.     The following information is from the Microsoft Macro Assembler
  2173.  Version 5.10 OS2.DOC file.
  2174.  
  2175.  OS/2 Call Summary
  2176.  Miscellaneous functions constant - INCL_DOSMISC
  2177.  
  2178.     @DosError - Enables OS/2 to receive hard-error notification without
  2179.                 generating a hard-error signal
  2180.     Parameters - Flag:W
  2181.  
  2182.     @DosSetVec - Registers an address to be used when an exception occcurs
  2183.     Parameters - VecNum:W, RoutineAddress:D, PrevAddress:PD
  2184.  
  2185.     @DosGetMessage - Retrieves a message from a message file and inserts
  2186.                      variable information into the message
  2187.     Parameters - IvTable:PD, IvCount:W, DataArea:PB, DataLength:W,
  2188.                  MsgNumber:W, FileName:PZ, MsgLength:PW
  2189.  
  2190.     @DosErrClass - Enables recognition and processing of error (exit) codes
  2191.     Parameters - Code:W, Class:PW, Action:PW, Locus:PW
  2192.  
  2193.     @DosInsMessage - Inserts variable text string information into a message
  2194.     Parameters - IvTable:PD, IvCount:W, MsgInput:PZ, MsgInLength:W,
  2195.                  DataArea:PW, DataLength:W, MsgLength:PW
  2196.  
  2197.     @DosPutMessage - Outputs a message from a buffer to a specified handle
  2198.     Parameters - FileHandle:W, MessageLength:W, MessageBuffer:PB
  2199.  
  2200.     @DosGetEnv - Gets the segment of the environment string and the
  2201.                  offset within it of the command line
  2202.     Parameters - EnvPointer:PW, CmdOffset:PW
  2203.  
  2204.     @DosScanEnv - Searches an environment segment for an environment variable
  2205.     Parameters - EnvVarName:PZ, ResultPointer:PD
  2206.  
  2207.     @DosSearchPath - Enables applications to find files in specified
  2208.                      directories
  2209.     Parameters - Control:W, PathRef:PZ, Filename:PZ, ResultBuffer:PB,
  2210.                  ResultBufferLen:W
  2211.  
  2212.     @DosGetVersion - Gets the current DOS version
  2213.     Parameters - VersionWord:PW
  2214.  
  2215.     @DosGetMachineMode - Tells whether the processor is in real or
  2216.                          protected mode
  2217.     Parameters - MachineMode:PB
  2218.  
  2219.  
  2220.  60. MASM 5.10 OS2.DOC: OS/2 Call Summary - Date/Time Management
  2221.  
  2222.  Product Version(s): 5.10   | 5.10
  2223.  Operating System:   MS-DOS | OS/2
  2224.  Flags: ENDUSER |
  2225.  Last Modified: 26-MAY-1988    ArticleIdent: Q30816
  2226.  
  2227.     The following information is from the Microsoft Macro Assembler
  2228.  Version 5.10 OS2.DOC file.
  2229.  
  2230.  OS/2 Call Summary
  2231.  Date and time management constant - INCL_DOSDATETIME
  2232.  
  2233.     @DosGetDateTime - Gets the current date and time
  2234.     Parameters - DateTime:PS
  2235.     Structure - DATETIME
  2236.  
  2237.     @DosSetDateTime - Sets the date and time
  2238.     Parameters - DateTime:PS
  2239.     Structure - DATETIME
  2240.  
  2241.     @DosTimerAsync - Starts a timer that is asynchronous to the launching
  2242.                      thread
  2243.     Parameters - TimeInterval:D, SemHandle:D, Handle:PW
  2244.  
  2245.     @DosTimerStart - Starts a periodic interval timer
  2246.     Parameters - TimeInterval:D, SemHandle:D, Handle:PW
  2247.  
  2248.     @DosTimerStop - Stops an interval or asynchronous timer
  2249.     Parameters - Handle:W
  2250.  
  2251.  
  2252.  61. MASM 5.10 OS2.DOC: OS/2 Call Summary - Session Management
  2253.  
  2254.  Product Version(s): 5.10   | 5.10
  2255.  Operating System:   MS-DOS | OS/2
  2256.  Flags: ENDUSER |
  2257.  Last Modified: 26-MAY-1988    ArticleIdent: Q30817
  2258.  
  2259.     The following information is from the Microsoft Macro Assembler
  2260.  Version 5.10 OS2.DOC file.
  2261.  
  2262.  OS/2 Call Summary
  2263.  Session management constant - INCL_DOSSESMGR
  2264.  
  2265.     @DosStartSession - Starts a new session
  2266.     Parameters - StartData:PS, SessID:PW, PID:PW
  2267.     Structure - STARTDATA
  2268.  
  2269.     @DosSetSession - Sets status of a child process
  2270.     Parameters - SessID:W, StatusData:PS
  2271.     Structure - STATUSDATA
  2272.  
  2273.     @DosSelectSession - Enables a parent process to switch a child to
  2274.                         foreground
  2275.     Parameters - SessID,W, Reserved:D
  2276.  
  2277.     @DosStopSession - Terminates session previously started with
  2278.                       DosStartSession
  2279.     Parameters - TargetOption:W, SessID:W, Reserved:D
  2280.  
  2281.  
  2282.  62. MASM 5.10 OS2.DOC: OS/2 Call Summary - Device Driver
  2283.  
  2284.  Product Version(s): 5.10   | 5.10
  2285.  Operating System:   MS-DOS | OS/2
  2286.  Flags: ENDUSER |
  2287.  Last Modified: 26-MAY-1988    ArticleIdent: Q30818
  2288.  
  2289.     The following information is from the Microsoft Macro Assembler
  2290.  Version 5.10 OS2.DOC file.
  2291.  
  2292.  OS/2 Call Summary
  2293.  Device driver constant - INCL_DOSDEVICES
  2294.  
  2295.     @DosDevConfig - Gets information about attached devices
  2296.     Parameters - DeviceInfo:PB, Item:W, Parameter:W
  2297.  
  2298.     @DosDevIOCtl - Performs control functions on a specified device
  2299.     Parameters - Data:PB, ParmList:PB, Function:W, Category:W, Handle:W
  2300.  
  2301.     @DosSystemService - Requests a special function from the system
  2302.     Parameters - ServiceCategory:W, RequestPacket:PB, ResponsePacket:PB
  2303.  
  2304.     @DosCLIAccess - Requests privilege to disable (CLI) or enable (STI)
  2305.                     interrupts
  2306.     Parameters - None
  2307.  
  2308.     @DosPortAccess - Requests or releases privilege for I/O port access
  2309.     Parameters - Reserved:W, TypeOfAccess:W, FirstPort:W, LastPort:W
  2310.  
  2311.     @DosPhysicalDisk - Obtains information on partitionable disks
  2312.     Parameters - Function:W, DataPtr:D, DataLength:W, ParmPtr:D, ParmLength:W
  2313.  
  2314.  
  2315.  63. MASM 5.10 OS2.DOC: OS/2 Call Summary - Keyboard Input
  2316.  
  2317.  Product Version(s): 5.10   | 5.10
  2318.  Operating System:   MS-DOS | OS/2
  2319.  Flags: ENDUSER |
  2320.  Last Modified: 26-MAY-1988    ArticleIdent: Q30819
  2321.  
  2322.     The following information is from the Microsoft Macro Assembler
  2323.  Version 5.10 OS2.DOC file.
  2324.  
  2325.  OS/2 Call Summary
  2326.  Keyboard input constant - INCL_KBD
  2327.  
  2328.     @KbdRegister - Registers a keyboard subsystem within a screen group
  2329.     Parameters - ModuleName:PZ, EntryPoint:PZ, FunctionMask:D
  2330.  
  2331.     @KbdCharIn - Returns a character/scan code from the keyboard
  2332.     Parameters - CharData:PS, IOWait:W, KbdHandle:W
  2333.     Structure - KBDKEYINFO
  2334.  
  2335.     @KbdPeek - Returns a character and scan code, if available, without
  2336.                removing it from the keystroke buffer
  2337.     Parameters - CharData:PS, KbdHandle:W
  2338.     Structure - KBDKEYINFO
  2339.  
  2340.     @KbdStringIn - Reads a character string from the keyboard
  2341.     Parameters - CharBuffer:PB, Length:PS, IOWait:W, KbdHandle:W
  2342.     Structure - STRINGINBUF
  2343.  
  2344.     @KbdFlushBuffer - Clears the keystroke buffer
  2345.     Parameters - KbdHandle:W
  2346.  
  2347.     @KbdSetStatus - Sets the characteristics of the keyboard
  2348.     Parameters - Structure:PS, KbdHandle:W
  2349.     Structure - KBDINFO
  2350.  
  2351.     @KbdGetStatus - Gets status information about the keyboard
  2352.     Parameters - Structure:PS, KbdHandle:W
  2353.     Structure - KBDINFO
  2354.  
  2355.     @KbdOpen - Creates a new logical keyboard
  2356.     Parameters - KbdHandle:PW
  2357.  
  2358.     @KbdClose - Ends a logical keyboard
  2359.     Parameters - KbdHandle:W
  2360.  
  2361.     @KbdSetCp - Sets the code page identifier for a logical keyboard
  2362.     Parameters - Reserved:W, CodePageID:W, KbdHandle:W
  2363.  
  2364.     @KbdGetCp - Retrieves the code page identifier for the logical keyboard
  2365.     Parameters - Reserved:D, CodePageID:PW, KbdHandle:W
  2366.  
  2367.     @KbdGetCp - Ends a logical keyboard
  2368.     Parameters - KbdHandle:W
  2369.  
  2370.     @KbdFreeFocus - Frees the logical-to-physical bond created by KbdGetFocus
  2371.     Parameters - KbdHandle:W
  2372.  
  2373.     @KbdGetFocus - Binds the logical keyboard to the physical keyboard
  2374.     Parameters - IOWait:W, KbdHandle:W
  2375.  
  2376.     @KbdSynch - Synchronizes access to the keyboard subsystem
  2377.     Parameters - IOWait:W
  2378.  
  2379.     @KbdXlate - Translates a scan code and its shift states into an ASCII code
  2380.     Parameters - XlateRecord:PS, KbdHandle:W
  2381.     Structure - KBDTRANSLATE
  2382.  
  2383.     @KbdSetCustXt - Installs a custom translate table for the logical keyboard
  2384.     Parameters - CodePage:PW, KbdHandle:W
  2385.  
  2386.  
  2387.  64. MASM 5.10 OS2.DOC: OS/2 Call Summary - Mouse Input
  2388.  
  2389.  Product Version(s): 5.10   | 5.10
  2390.  Operating System:   MS-DOS | OS/2
  2391.  Flags: ENDUSER |
  2392.  Last Modified: 26-MAY-1988    ArticleIdent: Q30820
  2393.  
  2394.     The following information is from the Microsoft Macro Assembler
  2395.  Version 5.10 OS2.DOC file.
  2396.  
  2397.  OS/2 Call Summary
  2398.  Mouse input constant - INCL_MOU
  2399.  
  2400.     @MouRegister - Registers a mouse subsystem or environment manager
  2401.     Parameters - ModuleName:PZ, EntryName:PZ, Mask:D
  2402.  
  2403.     @MouDeRegister - Deregisters a mouse subsystem or environment manager
  2404.     Parameters - None
  2405.  
  2406.     @MouFlushQue - Flushes the mouse event queue
  2407.     Parameters - DeviceHandle:W
  2408.  
  2409.     @MouGetHotKey - Queries to determine which physical key (button) is the
  2410.                     system hot key
  2411.     Parameters - ButtonMask:PW, DeviceHandle:W
  2412.  
  2413.     @MouSetHotKey - Tells the mouse driver which physical key (button) is
  2414.                     the system hot key
  2415.     Parameters - ButtonMask:PW, DeviceHandle:W
  2416.  
  2417.     @MouGetPtrPos - Gets the coordinates (row and column) of the mouse pointer
  2418.     Parameters - PtrPos:PS, DeviceHandle:W
  2419.     Structure - PTRLOC
  2420.  
  2421.     @MouSetPtrPos - Sets new coordinates for the mouse pointer image
  2422.     Parameters - PtrPos:PS, DeviceHandle:W
  2423.     Structure - PTRLOC
  2424.  
  2425.     @MouSetPtrShape - Sets the shape and size for the mouse pointer image
  2426.     Parameters - PtrBuffer:PB, PtrDefRec:PS, DeviceHandle:W
  2427.     Structure - PTRSHAPE
  2428.  
  2429.     @MouGetPtrShape - Copies the pointer shape for the screen group
  2430.     Parameters - PtrBuffer:PB, PtrDefRec:PS, DeviceHandle:W
  2431.     Structure - PTRSHAPE
  2432.  
  2433.     @MouGetDevStatus - Returns the status flags for the mouse device driver
  2434.     Parameters - DeviceStatus:PW, DeviceHandle:W
  2435.  
  2436.     @MouGetNumButtons - Returns the number of buttons
  2437.     Parameters - NumberOfButtons:PW, DeviceHandle:W
  2438.  
  2439.     @MouGetNumMickeys - Returns the number of mickeys per centimeter
  2440.     Parameters - NumberOfMickeys:PW, DeviceHandle:W
  2441.  
  2442.     @MouReadEventQue - Reads an event from the pointing device event queue
  2443.                        into the mouse event queue
  2444.     Parameters - Event:PS, NoWait:PW, DeviceHandle:W
  2445.     Structure - MOUEVENTINFO
  2446.  
  2447.     @MouGetNumQueEl - Returns the status for the event queue
  2448.     Parameters - QueDataRecord:PS, DeviceHandle:W
  2449.     Structure - MOUQUEINFO
  2450.  
  2451.     @MouGetEventMask - Returns an event mask for the current pointing device
  2452.     Parameters - EventMask:PW, DeviceHandle:W
  2453.  
  2454.     @MouSetEventMask - Assigns a new event mask to the current pointing device
  2455.     Parameters - EventMask:PW, DeviceHandle:W
  2456.  
  2457.     @MouGetScaleFact - Gets scaling factors for the current pointing device
  2458.     Parameters - ScaleStruct:PS, DeviceHandle:W
  2459.     Structure - SCALEFACT
  2460.  
  2461.     @MouSetScaleFact - Assigns scaling factors for the current pointing device
  2462.     Parameters - ScaleStruct:PS, DeviceHandle:W
  2463.     Structure - SCALEFACT
  2464.  
  2465.     @MouOpen - Opens the mouse device for the current screen group
  2466.     Parameters - DriverName:PZ, DeviceHandle:PW
  2467.  
  2468.     @MouClose - Closes the mouse device for the current screen group
  2469.     Parameters - DeviceHandle:W
  2470.  
  2471.     @MouRemovePtr - Notifies the mouse device driver that a specified area is
  2472.                     for the exclusive use of the application
  2473.     Parameters - PtrArea:PS, DeviceHandle:W
  2474.     Structure - NOPTRRECT
  2475.  
  2476.     @MouDrawPtr - Releases an area previously restricted to the pointer
  2477.                   image for use by the mouse device driver
  2478.     Parameters - DeviceHandle:W
  2479.  
  2480.     @MouSetDevStatus - Sets the pointing device driver status flags
  2481.     Parameters - DeviceStatus:PW, DeviceHandle:W
  2482.  
  2483.     @MouInitReal - Initializes the real-mode mouse device driver
  2484.     Parameters - DriverName:PZ
  2485.  
  2486.  
  2487.  65. MASM 5.10 OS2.DOC: OS/2 Call Summary - Video Output
  2488.  
  2489.  Product Version(s): 5.10   | 5.10
  2490.  Operating System:   MS-DOS | OS/2
  2491.  Flags: ENDUSER |
  2492.  Last Modified: 26-MAY-1988    ArticleIdent: Q30821
  2493.  
  2494.     The following information is from the Microsoft Macro Assembler
  2495.  Version 5.10 OS2.DOC file.
  2496.  
  2497.  OS/2 Call Summary
  2498.  Video output constant - INCL_VIO
  2499.  
  2500.     @VioRegister - Registers a video subsystem within a screen group
  2501.     Parameters - ModuleName:PZ, EntryPoint:PZ, FunctionMask1:D, FunctionMask2:
  2502.  
  2503.     @VioDeRegister - Deregisters a previously registered video subsystem
  2504.     Parameters - None
  2505.  
  2506.     @VioGetBuf - Returns the address of the logical video buffer
  2507.     Parameters - LVBPtr:PD, Length:PW, VioHandle:W
  2508.  
  2509.     @VioGetCurPos - Returns the cursor position
  2510.     Parameters - Row:PW, Column:PW, VioHandle:W
  2511.  
  2512.     @VioSetCurPos - Sets the cursor position
  2513.     Parameters - Row:W, Column:W, VioHandle:W
  2514.  
  2515.     @VioGetCurType - Returns the cursor type
  2516.     Parameters - CursorData:PS, VioHandle:W
  2517.     Structure - VIOCURSORINFO
  2518.  
  2519.     @VioSetCurType - Sets the cursor type
  2520.     Parameters - CursorData:PS, VioHandle:W
  2521.     Structure - VIOCURSORINFO
  2522.  
  2523.     @VioGetMode - Returns display mode information
  2524.     Parameters - ModeData:PS, VioHandle:W
  2525.     Structure - VIOMODEINFO
  2526.  
  2527.     @VioSetMode - Sets the display mode
  2528.     Parameters - ModeData:PS, VioHandle:W
  2529.     Structure - VIOMODEINFO
  2530.  
  2531.     @VioGetPhysBuf - Returns the address of the physical video buffer
  2532.     Parameters - Structure:PS, Reserved:W
  2533.     Structure - VIOPHYSBUF
  2534.  
  2535.     @VioReadCellStr - Reads a string of character-attributes (cells)
  2536.                       from screen
  2537.     Parameters - CellStr:PW, Length:PW, Row:W, Column:W, VioHandle:W
  2538.  
  2539.     @VioReadCharStr - Reads a string of characters from screen
  2540.     Parameters - CharStr:PB, Length:PW, Row:W, Column:W, VioHandle:W
  2541.  
  2542.     @VioWrtCellStr - Writes a string of character-attributes (cells) to
  2543.                      screen
  2544.     Parameters - CellStr:PB, Length:W, Row:W, Column:W, VioHandle:W
  2545.  
  2546.     @VioWrtCharStr - Writes a string of characters to screen
  2547.     Parameters - CharStr:PB, Length:W, Row:W, Column:W, VioHandle:W
  2548.  
  2549.     @VioScrollDn - Scrolls the current screen down
  2550.     Parameters - TopRow:W, LeftCol:W, BotRow:W, RightCol:W, Lines:W
  2551.                  Cell:PW, VioHandle:W
  2552.  
  2553.     @VioScrollUp - Scrolls the current screen up
  2554.     Parameters - TopRow:W, LeftCol:W, BotRow:W, RightCol:W, Lines:W
  2555.                  Cell:PW, VioHandle:W
  2556.  
  2557.     @VioScrollLf - Scrolls the current screen left
  2558.     Parameters - TopRow:W, LeftCol:W, BotRow:W, RightCol:W, Lines:W
  2559.                  Cell:PW, VioHandle:W
  2560.  
  2561.     @VioScrollRt - Scrolls the current screen right
  2562.     Parameters - TopRow:W, LeftCol:W, BotRow:W, RightCol:W, Lines:W
  2563.                  Cell:PW, VioHandle:W
  2564.  
  2565.     @VioWrtNAttr - Writes an attribute to the screen a specified number of
  2566.                    times
  2567.     Parameters - Attr:PB, Times:W, Row:w, Column:W, VioHandle:W
  2568.  
  2569.     @VioWrtNCell - Writes a character-attribute (cell) to the screen
  2570.                    a specified number of times
  2571.     Parameters - Cell:PW, Times:W, Row:w, Column:W, VioHandle:W
  2572.  
  2573.     @VioWrtNChar - Writes a character to the screen a specified number of
  2574.                    times
  2575.     Parameters - Char:PB, Times:W, Row:w, Column:W, VioHandle:W
  2576.  
  2577.     @VioWrtTTy - Writes a character string from the current cursor position
  2578.     Parameters - CharString:PB, Length:W, VioHandle:W
  2579.  
  2580.     @VioWrtCharStrAtt - Writes a string of characters with a repeated
  2581.                         attribute to screen
  2582.     Parameters - CharStr:PB, Length:W, Row:W, Column:W, Attr:PB, VioHandle:W
  2583.  
  2584.     @VioShowBuf - Updates the physical display with the logical video buffer
  2585.     Parameters - Offset:W, Length:W, VioHandle:W
  2586.  
  2587.     @VioSetAnsi - Activates or deactivates ANSI support
  2588.     Parameters - Indicator:W, VioHandle:W
  2589.  
  2590.     @VioGetAnsi - Returns the current ANSI state (on or off)
  2591.     Parameters - Indicator:PW, VioHandle:W
  2592.  
  2593.     @VioPrtSc - Copies the contents of the screen to the printer
  2594.     Parameters - VioHandle:W
  2595.  
  2596.     @VioPrtScToggle - Toggles whether session manager input is sent to printer
  2597.     Parameters - VioHandle:W
  2598.  
  2599.     @VioSavRedrawWait - Notifies a process that it must save or redraw
  2600.                         its screen
  2601.     Parameters - SavRedrawIndic:W, NotifyType:PW, VioHandle:W
  2602.  
  2603.     @VioSavRedrawUndo - Cancels a VioSavRedrawWait issued by another thread
  2604.                         within the same process
  2605.     Parameters - OwnerIndic:W, KillIndic:W, VioHandle:W
  2606.  
  2607.     @VioModeWait - Notifies a graphics application that it must restore its
  2608.                    video mode
  2609.     Parameters - RequestType:W, NotifyType:PW, Reserved:W
  2610.  
  2611.     @VioModeUndo - Enables one thread within a process to cancel a VioModeWait
  2612.                    issued by another thread in the same process
  2613.     Parameters - OwnerIndic:W, KillIndic:W, Reserved:W
  2614.  
  2615.     @VioScrLock - Locks the screen for I/O
  2616.     Parameters - WaitFlag:W, Status:PB, VioHandle:W
  2617.  
  2618.     @VioScrUnLock - Unlocks the screen for I/O
  2619.     Parameters - VioHandle:W
  2620.  
  2621.     @VioPopUp - Requests a temporary screen to display a message
  2622.     Parameters - WaitFlags:PW, VioHandle:W
  2623.  
  2624.     @VioEndPopUp - Releases a temporary screen obtained from a previous
  2625.                    VioPopUp
  2626.     Parameters - VioHandle:W
  2627.  
  2628.     @VioGetConfig - Returns the configuration of the video display
  2629.     Parameters - Reserved:W, ConfigData:PS, VioHandle:W
  2630.     Structure - VIOCONFIGINFO
  2631.  
  2632.     @VioGetFont - Returns either the font table of the specified size, or the
  2633.                   font currently in use
  2634.     Parameters - RequestBlock:PS, VioHandle:W
  2635.     Structure - VIOFONTINFO
  2636.  
  2637.     @VioSetFont - Downloads a display font
  2638.     Parameters - RequestBlock:PS, VioHandle:W
  2639.     Structure - VIOFONTINFO
  2640.  
  2641.     @VioGetCp - Returns the code page being used by the specified handle
  2642.     Parameters - Reserved:W, CodePageID:PW, VioHandle:W
  2643.  
  2644.     @VioSetCp - Sets the code page to be used by the specified handle
  2645.     Parameters - Reserved:W, CodePageID:W, VioHandle:W
  2646.  
  2647.     @VioGetState - Returns the current setting of either the palette registers
  2648.                    overscan (border) color, or blink/background intensity
  2649.                    switch
  2650.     Parameters - RequestBlock:PS, VioHandle:W
  2651.     Structures - VIOPALSTATE, VIOOVERSCAN, or VIOINTENSITY
  2652.  
  2653.     @VioSetState - Sets either the palette registers, overscan (border) color,
  2654.                    or blink/background intensity switch
  2655.     Parameters - RequestBlock:PS, VioHandle:W
  2656.     Structures - VIOPALSTATE, VIOOVERSCAN, or VIOINTENSITY
  2657.  
  2658.  
  2659.  66. Accessing MASM Structure Fields in a Multimodule Program
  2660.  
  2661.  Product Version(s): 5.00 5.10
  2662.  Operating System:   MS-DOS
  2663.  Flags: ENDUSER |
  2664.  Last Modified: 12-JAN-1989    ArticleIdent: Q30887
  2665.  
  2666.  To use a structure, defined in one module with the STRUC operator, in
  2667.  another module with the Macro Assembler, you must take into account
  2668.  the fact that the structure definition must be available to both
  2669.  modules at assemble time. The ".structfield" operator can than be used
  2670.  on any label.
  2671.  
  2672.  The following program demonstrates the use of a structure in a
  2673.  two-module program.
  2674.  
  2675.  ; Source file 1:
  2676.  
  2677.  EXTRN changecow:NEAR                ; Near function call
  2678.  
  2679.  animals    STRUC                    ; Structure definition
  2680.      cat    db    "catfield      "
  2681.      dog    db    "dogfield      "   ; Field widths of 15 characters
  2682.      cow    db    "cowfield      "
  2683.  animals    ENDS
  2684.  
  2685.  .MODEL small
  2686.  
  2687.  .DATA
  2688.             PUBLIC zoo
  2689.  zoo        animals   <"felix","spot","Holstein">  ; Initialize fields
  2690.  
  2691.  .CODE
  2692.  main:      mov ax, @data            ; Make data addressable
  2693.             mov ds,ax
  2694.             mov es,ax                ; For string moves
  2695.  
  2696.             call changecow           ; Change "Holstein" to "Daisy"
  2697.             retf
  2698.             END main
  2699.  
  2700.  ; Source file 2:
  2701.  ;    In source file 2, structure definition must be available for the
  2702.  ; field offsets. (Normally it would be placed in an include file,
  2703.  ; then the INCLUDE operator would be used; however, for sake of
  2704.  ; clarity, the structure definition has been placed in both files).
  2705.  ;    The structure information must be included here to correctly
  2706.  ; associate the fields with the offset. The structure name does not
  2707.  ; need to be "animals"; however, the structure fields should
  2708.  ; correspond.
  2709.  
  2710.  animals    STRUC                    ; Structure definition
  2711.      cat    db    "catfield      "
  2712.      dog    db    "dogfield      "   ; Field widths of 15 characters
  2713.      cow    db    "cowfield      "
  2714.  animals    ENDS
  2715.  
  2716.  .MODEL small
  2717.  
  2718.  .DATA
  2719.  EXTRN zoo:NEAR                       ; Let assembler know about zoo
  2720.  newcow    db     "Daisy         "    ; Replace cow with new name
  2721.  lenname   EQU    $ - newcow          ; Length of new name
  2722.  
  2723.  .CODE
  2724.            PUBLIC changecow           ; Changes cow field to "Daisy"
  2725.  changecow PROC
  2726.            mov     di, offset zoo.cow ; es:di should now point to destination
  2727.            mov     si, offset newcow  ; ds:si should now point to the source
  2728.            mov     cx, lenname        ; Length of new string
  2729.            rep     movsb              ; Do replacement
  2730.            ret
  2731.  changecow ENDP
  2732.            END
  2733.  
  2734.  
  2735.  67. MASM 5.10 RUNME.EXE Does Not Set Up for a Two-Floppy System
  2736.  
  2737.  Product Version(s): 5.10   | 5.10
  2738.  Operating System:   MS-DOS | OS/2
  2739.  Flags: ENDUSER |
  2740.  Last Modified: 12-JAN-1989    ArticleIdent: Q31000
  2741.  
  2742.     The RUNME.EXE on the MASM 5.10 distribution disk labeled "MS OS/2
  2743.  and MS-DOS Macro Assemblers" is only for a hard-disk installation; it
  2744.  will not set up the product on a two-floppy system.
  2745.     The programmer's guide, Page 9, describes a disk configuration that
  2746.  is suggested for a two-floppy system. Copy the files by hand to
  2747.  working disks.
  2748.  
  2749.  
  2750.  68. KBDINFO Incorrectly Defined
  2751.  
  2752.  Product Version(s): 5.10
  2753.  Operating System:   MS-DOS
  2754.  Flags: ENDUSER |
  2755.  Last Modified: 12-JAN-1989    ArticleIdent: Q30898
  2756.  
  2757.     The KBDINFO structure found in BSESUB.H is incorrectly defined, as
  2758.  follows:
  2759.  
  2760.                  KBDINFO struc
  2761.                          kbxl_cb                 db ?
  2762.                          kbxl_fsMask             db ?
  2763.                          kbxl_chTurnAround       db ?
  2764.                          kbxl_fdInterim          db ?
  2765.                          kbxl_fsState            dw ?
  2766.                  KBDINFO ends
  2767.  
  2768.     The members of the structure should all be declared as words (dw)
  2769.  rather than bytes.
  2770.  
  2771.  
  2772.  
  2773.  69. MASM 5.10 EXT.DOC: Overview
  2774.  
  2775.  Product Version(s): 5.10   | 5.10
  2776.  Operating System:   MS-DOS | OS/2
  2777.  Flags: ENDUSER |
  2778.  Last Modified: 12-JAN-1989    ArticleIdent: Q31515
  2779.  
  2780.     The following information is from the MASM Version 5.10 EXT.DOC
  2781.  file.
  2782.  
  2783.  /*
  2784.  EXT.DOC
  2785.     This file documents each of the low-level editing functions that
  2786.  can be called from a Microsoft-Editor C extension.
  2787.     The types COL and LINE, formally declared in the file EXT.H, are
  2788.  short and long integers, respectively. A variable of type COL refers
  2789.  to a column in a file, and a variable of type LINE refers to a line
  2790.  (in other words, a row) in a file. Numbering for both COL and LINE
  2791.  variables begins with 0. Therefore, line 0 is the first line in the
  2792.  file.
  2793.  */
  2794.  
  2795.  
  2796.  70. MASM 5.10 EXT.DOC: Replace - Edits Character in File
  2797.  
  2798.  Product Version(s): 5.10   | 5.10
  2799.  Operating System:   MS-DOS | OS/2
  2800.  Flags: ENDUSER |
  2801.  Last Modified: 12-JAN-1989    ArticleIdent: Q31516
  2802.  
  2803.     The following information is from the MASM Version 5.10 EXT.DOC
  2804.  file.
  2805.     Please note that numbering for both COL and LINE variables begins
  2806.  with 0.
  2807.  
  2808.  /*  Replace - edits a character in a file
  2809.   *
  2810.   * The Replace function inserts character c at position (x, y)
  2811.   * in the file pFile. If fInsert equals TRUE (-1) the function
  2812.   * moves remaining characters on the line over by one space. If
  2813.   * fInsert equals FALSE (0) function replaces the character at
  2814.   * specified position. The function takes no action if fInsert
  2815.   * equals FALSE, and c is identical to the character at specified
  2816.   * position.
  2817.   *
  2818.   *  c           Character to place into the file
  2819.   *  x, y        Column and row (respectively) of position of insertion
  2820.   *  pFile       Handle to file being modified
  2821.   *  fInsert     If TRUE (-1), inserts before character at specified
  2822.   *              position; otherwise, overwrites character at specified
  2823.   *              position
  2824.   *
  2825.   *  returns     TRUE if line is successfully edited, FALSE if line is too
  2826.   *              long
  2827.   */
  2828.  flagType pascal Replace (c, x, y, pFile, fInsert)
  2829.  char c;
  2830.  COL  x;
  2831.  LINE y;
  2832.  PFILE pFile;
  2833.  flagType fInsert;
  2834.  
  2835.  
  2836.  71. MASM 5.10 EXT.DOC: Movecur: Moves Cursor to Specified Location
  2837.  
  2838.  Product Version(s): 5.10   | 5.10
  2839.  Operating System:   MS-DOS | OS/2
  2840.  Flags: ENDUSER |
  2841.  Last Modified: 12-JAN-1989    ArticleIdent: Q31517
  2842.  
  2843.     The following information is from the MASM Version 5.10 EXT.DOC
  2844.  file.
  2845.     Please note that numbering for both COL and LINE variables begins
  2846.  with 0.
  2847.  
  2848.  /* MoveCur - moves the cursor to a specified location in the current
  2849.   * file. The MoveCur function moves the cursor to specified position
  2850.   * within the current file. If the cursor is within the same window,
  2851.   * then no window movement occurs. Otherwise, the cursor is placed at
  2852.   * a common position specified by the numeric switch "hike."
  2853.   *
  2854.   *  x           Column where cursor is to appear in file
  2855.   *  y           Line (row) where cursor is to appear in file
  2856.   */
  2857.  void pascal MoveCur (x, y)
  2858.  COL  x;
  2859.  LINE y;
  2860.  
  2861.  
  2862.  72. MASM 5.10 EXT.DOC: DelLine - Deletes Lines from a File
  2863.  
  2864.  Product Version(s): 5.10   | 5.10
  2865.  Operating System:   MS-DOS | OS/2
  2866.  Flags: ENDUSER |
  2867.  Last Modified: 12-JAN-1989    ArticleIdent: Q31518
  2868.  
  2869.     The following information is from the MASM Version 5.10 EXT.DOC
  2870.  file.
  2871.     Please note that numbering for both COL and LINE variables begins
  2872.  with 0.
  2873.  
  2874.  /*  DelLine - deletes lines from a file
  2875.   *
  2876.   *  The DelLine function deletes lines yStart through yEnd, inclusive,
  2877.   * in the file pFile.
  2878.   *
  2879.   *  pfile       Handle to file from which lines are to be deleted
  2880.   *  yStart      First line to be deleted
  2881.   *  yEnd        Last line to be deleted
  2882.   */
  2883.  void pascal DelLine (pfile, yStart, yEnd)
  2884.  PFILE pfile;
  2885.  LINE yStart, yEnd;
  2886.  
  2887.  
  2888.  73. MASM 5.10 EXT.DOC: DelBox - Deletes a "Box" from a File
  2889.  
  2890.  Product Version(s): 5.10   | 5.10
  2891.  Operating System:   MS-DOS | OS/2
  2892.  Flags: ENDUSER |
  2893.  Last Modified: 12-JAN-1989    ArticleIdent: Q31519
  2894.  
  2895.     The following information is from the MASM Version 5.10 EXT.DOC
  2896.  file.
  2897.     Please note that numbering for both COL and LINE variables begins
  2898.  with 0.
  2899.  
  2900.  /*  DelBox - deletes a rectangular area (box) from a file
  2901.   *
  2902.   *  The DelBox function deletes all spaces in the box delimited
  2903.   *  by the positions (xLeft, yTop) and (xRight, yBottom). The
  2904.   *  box includes both corners specified in the function call.
  2905.   *
  2906.   *  pFile               Handle to file to be modified
  2907.   *  xLeft, yTop         Column and line of start of box
  2908.   *  xRight, yBottom     Column and line of end of box
  2909.   */
  2910.  void pascal DelBox (pFile, xLeft, yTop, xRight, yBottom)
  2911.  PFILE pFile;
  2912.  COL  xLeft, xRight;
  2913.  LINE yTop, yBottom;
  2914.  
  2915.  
  2916.  74. MASM 5.10 EXT.DOC: DelStream - Deletes Text Stream from File
  2917.  
  2918.  Product Version(s): 5.10   | 5.10
  2919.  Operating System:   MS-DOS | OS/2
  2920.  Flags: ENDUSER |
  2921.  Last Modified: 12-JAN-1989    ArticleIdent: Q31520
  2922.  
  2923.     The following information is from the MASM Version 5.10 EXT.DOC
  2924.  file.
  2925.     Please note that numbering for both COL and LINE variables begins
  2926.  with 0.
  2927.  
  2928.  /*  DelStream - deletes a stream of text from a file
  2929.   *
  2930.   *  The DelStream function deletes the stream of text beginning with
  2931.   *  position (xStart, yStart), up to but not including position
  2932.   *  (xEnd, yEnd), within file pFile.
  2933.   *
  2934.   *  pFile               Handle to file to be modified
  2935.   *  xStart, yStart      Column and line of start of stream
  2936.   *  xEnd, yEnd          Column and line of end of stream
  2937.   */
  2938.  void pascal DelStream (pFile, xStart, yStart, xEnd, yEnd)
  2939.  PFILE pFile;
  2940.  COL  xStart, xEnd;
  2941.  LINE yStart, yEnd;
  2942.  
  2943.  
  2944.  75. MASM 5.10 EXT.DOC: GetLine - Retrieves Line of Text
  2945.  
  2946.  Product Version(s): 5.10   | 5.10
  2947.  Operating System:   MS-DOS | OS/2
  2948.  Flags: ENDUSER |
  2949.  Last Modified: 12-JAN-1989    ArticleIdent: Q31521
  2950.  
  2951.     The following information is from the MASM Version 5.10 EXT.DOC
  2952.  file.
  2953.     Please note that numbering for both COL and LINE variables begins
  2954.  with 0.
  2955.  
  2956.  /*  GetLine - retrieves a line of text
  2957.   *
  2958.   *  The GetLine function retrieves a line of text from the specified
  2959.   *  file and places the text in the specified buffer. The text has
  2960.   *  all tabs expanded into spaces, and no carriage-return or line-feed
  2961.   *  character is included. Lines requested beyond the end of the file
  2962.   *  are considered empty.
  2963.   *
  2964.   *  line        Number of the line to be retrieved
  2965.   *  buf         Buffer for text of the line
  2966.   *  pfile       Handle of file from which the line is to be retrieved
  2967.   *
  2968.   *  returns     The number of characters retrieved
  2969.   */
  2970.  int pascal GetLine (line, buf, pfile)
  2971.  LINE line;
  2972.  char far *buf;
  2973.  PFILE pfile;
  2974.  
  2975.  
  2976.  76. MASM 5.10 EXT.DOC: AddFile - Creates File Buffer
  2977.  
  2978.  Product Version(s): 5.10   | 5.10
  2979.  Operating System:   MS-DOS | OS/2
  2980.  Flags: ENDUSER |
  2981.  Last Modified: 12-JAN-1989    ArticleIdent: Q31522
  2982.  
  2983.     The following information is from the MASM Version 5.10 EXT.DOC
  2984.  file.
  2985.     Please note that numbering for both COL and LINE variables begins
  2986.  with 0.
  2987.  
  2988.  /*  AddFile - creates a file buffer
  2989.   *
  2990.   *  The AddFile function creates and initializes a file buffer. The
  2991.   *  contents are initially empty. A new file is not placed on disk
  2992.   *  until the FileWrite function is called.
  2993.   *
  2994.   *  p           Character pointer to name
  2995.   *
  2996.   *  returns     Handle to internal file structure
  2997.   */
  2998.  PFILE pascal AddFile (p)
  2999.  char far *p;
  3000.  
  3001.  
  3002.  77. MASM 5.10 EXT.DOC: DelFile - Deletes Contents of File
  3003.  
  3004.  Product Version(s): 5.10   | 5.10
  3005.  Operating System:   MS-DOS | OS/2
  3006.  Flags: ENDUSER |
  3007.  Last Modified: 12-JAN-1989    ArticleIdent: Q31523
  3008.  
  3009.     The following information is from the MASM Version 5.10 EXT.DOC
  3010.  file.
  3011.     Please note that numbering for both COL and LINE variables begins
  3012.  with 0.
  3013.  
  3014.  /*  DelFile - deletes contents of file
  3015.   *
  3016.   *  The DelFile function deletes the entire contents of an internal
  3017.   *  file buffer. The effect of deleting contents can be made
  3018.   *  permanent by calling the FileWrite function, which replaces the
  3019.   *  contents of the file on disk with the contents of the internal
  3020.   *  file buffer.
  3021.   *
  3022.   *  pFile       Handle to file that is to be cleared
  3023.   */
  3024.  void pascal DelFile (pFile)
  3025.  PFILE pFile;
  3026.  
  3027.  
  3028.  78. MASM 5.10 EXT.DOC: FileNameToHandle - Returns Handle
  3029.  
  3030.  Product Version(s): 5.10   | 5.10
  3031.  Operating System:   MS-DOS | OS/2
  3032.  Flags: ENDUSER |
  3033.  Last Modified: 12-JAN-1989    ArticleIdent: Q31524
  3034.  
  3035.     The following information is from the MASM Version 5.10 EXT.DOC
  3036.  file.
  3037.     Please note that numbering for both COL and LINE variables begins
  3038.  with 0.
  3039.  
  3040.  /*  FileNameToHandle - returns handle corresponding to the file name
  3041.   *
  3042.   *  The FileNameToHandle function searches for the specified file
  3043.   *  and returns a handle to the file if found. If pName points to a
  3044.   *  zero-length string, then the function returns a handle to the
  3045.   *  current file. Otherwise, the function searches for the file named by
  3046.   *  pName which may include a complete path. If pName not found and
  3047.   *  pShortName is not a NULL pointer, then the function scans the information
  3048.   *  file for a file name that matches pShortName. If a match is found,
  3049.   *  then the function uses the complete path name in the information file.
  3050.   *
  3051.   *  pName       Pointer to name of file
  3052.   *  pShortName  Pointer to short name of file (this parameter may be NULL)
  3053.   *
  3054.   *  Returns     Handle to specified file (if found) or NULL.
  3055.   */
  3056.  PFILE pascal FileNameToHandle (pName, pShortName)
  3057.  char far *pName, *pShortName;
  3058.  
  3059.  
  3060.  79. MASM 5.10 EXT.DOC: CopyStream - Copies Stream of Text
  3061.  
  3062.  Product Version(s): 5.10   | 5.10
  3063.  Operating System:   MS-DOS | OS/2
  3064.  Flags: ENDUSER |
  3065.  Last Modified: 12-JAN-1989    ArticleIdent: Q31525
  3066.  
  3067.     The following information is from the MASM Version 5.10 EXT.DOC
  3068.  file.
  3069.     Please note that numbering for both COL and LINE variables begins
  3070.  with 0.
  3071.  
  3072.  /*  CopyStream - copies a stream of text
  3073.   *
  3074.   *  The CopyStream function copies the stream of text (including
  3075.   *  newlines) beginning at position (xStart, yStart), up to but not
  3076.   *  including position (xEnd, yEnd). The stream of text is inserted
  3077.   *  into the destination file just before position (xDst, yDst). If the
  3078.   *  source-file handle is NULL, a blank space is inserted.
  3079.   *
  3080.   *  pFileSrc            Source file handle
  3081.   *  pFileDst            Destination file handle
  3082.   *  xStart, yStart      Column and line of beginning of copy
  3083.   *  xEnd, yEnd          Column and line of end of copy
  3084.   *  xDst, yDst          Column and line of destination of copy
  3085.   */
  3086.  void pascal CopyStream (pFileSrc, pFileDst, xStart, yStart, xEnd, yEnd,
  3087.  xDst, yDst)
  3088.  PFILE pFileSrc, pFileDst;
  3089.  COL  xStart, xEnd, xDst;
  3090.  LINE yStart, yEnd, yDst;
  3091.  
  3092.  
  3093.  80. MASM 5.10 EXT.DOC: PFileToTop - Makes File Visible in Window
  3094.  
  3095.  Product Version(s): 5.10   | 5.10
  3096.  Operating System:   MS-DOS | OS/2
  3097.  Flags: ENDUSER |
  3098.  Last Modified: 12-JAN-1989    ArticleIdent: Q31526
  3099.  
  3100.     The following information is from the MASM Version 5.10 EXT.DOC
  3101.  file.
  3102.     Please note that numbering for both COL and LINE variables begins
  3103.  with 0.
  3104.  
  3105.  /*  pFileToTop - makes the specified file visible in the current
  3106.   *  window
  3107.   *  In effect, the pFileToTop function selects a file as the current
  3108.   *  file and makes it visible in the current window. The function
  3109.   *  accomplishes this operation by moving the specified file handle to
  3110.   *  the top of the "stack" of file handles attached to the current
  3111.   *  window.
  3112.   *
  3113.   *  pFileTmp    Handle of file to bring to top of stack
  3114.   */
  3115.  void pascal pFileToTop (pFileTmp)
  3116.  PFILE pFileTmp;
  3117.  
  3118.  
  3119.  81. MASM 5.10 EXT.DOC: FileRead - Reads File Contents into Buffer
  3120.  
  3121.  Product Version(s): 5.10   | 5.10
  3122.  Operating System:   MS-DOS | OS/2
  3123.  Flags: ENDUSER |
  3124.  Last Modified: 12-JAN-1989    ArticleIdent: Q31527
  3125.  
  3126.     The following information is from the MASM Version 5.10 EXT.DOC
  3127.  file.
  3128.     Please note that numbering for both COL and LINE variables begins
  3129.  with 0.
  3130.  
  3131.  /*  FileRead - reads the contents of a file into the file buffer
  3132.   *
  3133.   *  The FileRead function reads the contents of the specified disk
  3134.   *  file and stores them in the internal file buffer specified by pFile.
  3135.   *  The old contents of the file buffer are lost.
  3136.   *
  3137.   *  name        Pointer to name of file to be read
  3138.   *  pFile       Handle to internal file to receive contents
  3139.   *
  3140.   *  returns     TRUE (-1) if successful; FALSE (0) if file could not
  3141.   *  be read
  3142.   */
  3143.  flagType pascal FileRead (name, pFile)
  3144.  char far *name;
  3145.  PFILE pFile;
  3146.  
  3147.  
  3148.  82. MASM 5.10 EXT.DOC: FileWrite - Writes Buffer Contents to Disk
  3149.  
  3150.  Product Version(s): 5.10   | 5.10
  3151.  Operating System:   MS-DOS | OS/2
  3152.  Flags: ENDUSER |
  3153.  Last Modified: 12-JAN-1989    ArticleIdent: Q31528
  3154.  
  3155.     The following information is from the MASM Version 5.10 EXT.DOC
  3156.  file.
  3157.     Please note that numbering for both COL and LINE variables begins
  3158.  with 0.
  3159.  
  3160.  /*  FileWrite - writes buffer contents out to disk
  3161.   *
  3162.   *  The FileWrite function writes the contents of the specified file
  3163.   *  buffer out to the disk file specified by savename. If savename is a
  3164.   *  NULL pointer, then the function writes the file buffer out to the disk
  3165.   *  file with the same name. The FileWrite function first writes contents
  3166.   *  to a temporary file; if the write operation is successful, then the
  3167.   *  temporary file is renamed to the destination file.
  3168.   *
  3169.   *  savename    Pointer to name of file to be overwritten
  3170.   *  pFile       Handle to file buffer to write
  3171.   */
  3172.  flagType pascal FileWrite (savename, pFile)
  3173.  char far *savename;
  3174.  PFILE pFile;
  3175.  
  3176.  
  3177.  83. MASM 5.10 EXT.DOC: DoMessage - Outputs String on Dialog Line
  3178.  
  3179.  Product Version(s): 5.10   | 5.10
  3180.  Operating System:   MS-DOS | OS/2
  3181.  Flags: ENDUSER |
  3182.  Last Modified: 12-JAN-1989    ArticleIdent: Q31529
  3183.  
  3184.     The following information is from the MASM Version 5.10 EXT.DOC
  3185.  file.
  3186.     Please note that numbering for both COL and LINE variables begins
  3187.  with 0.
  3188.  
  3189.  /*  DoMessage - outputs a string on the dialog line
  3190.   *
  3191.   *  The DoMessage function prints the specified string on the dialog
  3192.   *  line.
  3193.   *
  3194.   *  pStr        Pointer to character string to print
  3195.   *
  3196.   *  returns     Number of characters written
  3197.   *
  3198.   */
  3199.  int pascal DoMessage (pStr)
  3200.  char far * pStr;
  3201.  
  3202.  
  3203.  84. MASM 5.10 EXT.DOC: PutLine - Places Line of Text in File
  3204.  
  3205.  Product Version(s): 5.10   | 5.10
  3206.  Operating System:   MS-DOS | OS/2
  3207.  Flags: ENDUSER |
  3208.  Last Modified: 12-JAN-1989    ArticleIdent: Q31530
  3209.  
  3210.     The following information is from the MASM Version 5.10 EXT.DOC
  3211.  file.
  3212.     Please note that numbering for both COL and LINE variables begins
  3213.  with 0.
  3214.  
  3215.  /*  PutLine - places a line of text into a file
  3216.   *
  3217.   *  The PutLine function places the indicated buffer string into
  3218.   *  the specified file, replacing an existing line. If the specified
  3219.   *  line is out of range, then the PutLine function enlarges the
  3220.   *  file, and inserts as many blank lines as needed at the end of
  3221.   *  the file. The buffer line should have no carriage return or line
  3222.   *  feed; the PutLine function adds a newline automatically.
  3223.   *
  3224.   *  line        Number of line to be replaced
  3225.   *  buf         Buffer with line of text to be placed in file
  3226.   *  pfile       Handle to file
  3227.   */
  3228.  void pascal PutLine (line, buf, pfile)
  3229.  LINE line;
  3230.  char far *buf;
  3231.  PFILE pfile;
  3232.  
  3233.  
  3234.  85. MASM 5.10 EXT.DOC: FileLength - Returns Number of Lines in Fil
  3235.  
  3236.  Product Version(s): 5.10   |
  3237.  Operating System:   MS-DOS | OS/2
  3238.  Flags: ENDUSER |
  3239.  Last Modified: 12-JAN-1989    ArticleIdent: Q31531
  3240.  
  3241.     The following information is from the MASM Version 5.10 EXT.DOC
  3242.  file.
  3243.     Please note that numbering for both COL and LINE variables begins
  3244.  with 0.
  3245.  
  3246.  /*  FileLength - returns the number of lines in the file
  3247.   *
  3248.   *  The FileLength function is particularly useful for global
  3249.   *  operations, in which it is necessary to know where the end of the
  3250.   *  file is.
  3251.   *
  3252.   *  pFile       Handle to file
  3253.   *
  3254.   *  returns     Number of lines in file
  3255.   */
  3256.  LINE pascal FileLength (pFile)
  3257.  PFILE pFile;
  3258.  
  3259.  
  3260.  86. MASM 5.10 EXT.DOC: GetCursor - Returns Current Cursor Position
  3261.  
  3262.  Product Version(s): 5.10   | 5.10
  3263.  Operating System:   MS-DOS | OS/2
  3264.  Flags: ENDUSER |
  3265.  Last Modified: 12-JAN-1989    ArticleIdent: Q31532
  3266.  
  3267.     The following information is from the MASM Version 5.10 EXT.DOC
  3268.  file.
  3269.     Please note that numbering for both COL and LINE variables begins
  3270.  with 0.
  3271.  
  3272.  /*  GetCursor - returns the current cursor position
  3273.   *
  3274.   *  The GetCursor function indicates current cursor position by
  3275.   *  modifying the integers that px and py point to. The function
  3276.   *  sets *px to the current cursor column, and *py to the current
  3277.   *  cursor line.
  3278.   *
  3279.   *  px          Pointer to column-position variable
  3280.   *  py          Pointer to line-position variable
  3281.   */
  3282.  void pascal GetCursor (px, py);
  3283.  COL  far *px;
  3284.  LINE far *py;
  3285.  
  3286.  
  3287.  87. MASM 5.10 EXT.DOC: ReadCmd - Returns Next Command from User
  3288.  
  3289.  Product Version(s): 5.10   | 5.10
  3290.  Operating System:   MS-DOS | OS/2
  3291.  Flags: ENDUSER |
  3292.  Last Modified: 12-JAN-1989    ArticleIdent: Q31533
  3293.  
  3294.     The following information is from the MASM Version 5.10 EXT.DOC
  3295.  file.
  3296.     Please note that numbering for both COL and LINE variables begins
  3297.  with 0.
  3298.  
  3299.  /*  ReadCmd  - returns next command from user
  3300.   *
  3301.   *  The ReadCmd waits for input from the user. The next keystroke is
  3302.   *  translated into a function that is not executed. Instead, the
  3303.   *  editor passes information about the function in the form of a
  3304.   *  structure of type cmdDesc. This structure is declared in the file
  3305.   *  EXT.H and is described in Chapter 8 of the Microsoft Editor
  3306.   *  User's Guide. Once intercepted, the keystroke cannot be placed
  3307.   *  back for execution.
  3308.   *
  3309.   *  returns  Pointer to cmdDesc structure corresponding to next keystroke
  3310.   */
  3311.  PCMD pascal ReadCmd ();
  3312.  
  3313.  
  3314.  88. MASM 5.10 EXT.DOC: ReadChar - Returns Next Raw Keystroke
  3315.  
  3316.  Product Version(s): 5.10   | 5.10
  3317.  Operating System:   MS-DOS | OS/2
  3318.  Flags: ENDUSER |
  3319.  Last Modified: 12-JAN-1989    ArticleIdent: Q31534
  3320.  
  3321.     The following information is from the MASM Version 5.10 EXT.DOC
  3322.  file.
  3323.     Please note that numbering for both COL and LINE variables begins
  3324.  with 0.
  3325.  
  3326.  /*  ReadChar - returns next raw keystroke
  3327.   *
  3328.   *  The ReadChar intercepts the next keystroke from the user. No action
  3329.   *  is taken, but information about the keystroke is passed. Once
  3330.   *  intercepted, the keystroke cannot be placed back for execution.
  3331.   *
  3332.   *  returns     a long value containing information on the keystroke:
  3333.   *
  3334.   *              byte 0: ASCII code for character
  3335.   *              byte 1: scan code for character
  3336.   *              byte 2: shift info for character:
  3337.   *                          (S)HIFT, (C)TRL, (A)LT, (N)UMLOCK
  3338.   *                          Format is: SxCAxNxx
  3339.   *              byte 3: 0
  3340.   *
  3341.   *  In the format for byte 2, each "x" indicates an unused bit. The
  3342.   *  bits S, C, A, and N are each on or off, depending on the associated
  3343.   *  condition. For example, if the SHIFT, CTRL, and ALT conditions are
  3344.   *  all on, but not the NUMLOCK condition, then byte 2 will be returned as
  3345.   *  10110000. Note: the "N" bit is always 0, unless the the key pressed
  3346.   *  is on the numeric keypad.
  3347.   */
  3348.  long pascal ReadChar();
  3349.  
  3350.  
  3351.  89. MASM 5.10 EXT.DOC: KbUnHook - Disable M's Logical Keyboard
  3352.  
  3353.  Product Version(s): 5.10   | 5.10
  3354.  Operating System:   MS-DOS | OS/2
  3355.  Flags: ENDUSER |
  3356.  Last Modified: 12-JAN-1989    ArticleIdent: Q31535
  3357.  
  3358.     The following information is from the MASM Version 5.10 EXT.DOC
  3359.  file.
  3360.     Please note that numbering for both COL and LINE variables begins
  3361.  with 0.
  3362.  
  3363.  /*  KbUnHook - Disable Microsoft Editor's logical keyboard
  3364.   *
  3365.   *  The KbUnHook function changes the "focus" of the keyboard so that
  3366.   *  keyboard input is no longer read by the editor. When attempting to
  3367.   *  use system-level calls to read from the keyboard, it is necessary to
  3368.   *  first call this function.
  3369.   *
  3370.   *  In particular, it is necessary to call the KbUnHook function before
  3371.   *  transferring control to a program that reads from the keyboard.
  3372.   */
  3373.  void pascal KbUnHook();
  3374.  
  3375.  
  3376.  90. MASM 5.10 EXT.DOC: KbHook - Enable M's Logical Keyboard
  3377.  
  3378.  Product Version(s): 5.10   | 5.10
  3379.  Operating System:   MS-DOS | OS/2
  3380.  Flags: ENDUSER |
  3381.  Last Modified: 12-JAN-1989    ArticleIdent: Q31536
  3382.  
  3383.     The following information is from the MASM Version 5.10 EXT.DOC
  3384.  file.
  3385.     Please note that numbering for both COL and LINE variables begins
  3386.  with 0.
  3387.  
  3388.  /*  KbHook - Enable Microsoft Editor's logical keyboard
  3389.   *
  3390.   *  The KbHook function reverses the effect of the KbUnHook function
  3391.   *  (described above), and restores normal keyboard-input reading
  3392.   *  by the editor.
  3393.   */
  3394.  void pascal KbHook();
  3395.  
  3396.  
  3397.  91. MASM 5.10 EXT.DOC: CopyLine - Copies Lines from File to File
  3398.  
  3399.  Product Version(s): 5.10   | 5.10
  3400.  Operating System:   MS-DOS | OS/2
  3401.  Flags: ENDUSER |
  3402.  Last Modified: 12-JAN-1989    ArticleIdent: Q31537
  3403.  
  3404.     The following information is from the MASM Version 5.10 EXT.DOC
  3405.  file.
  3406.     Please note that numbering for both COL and LINE variables begins
  3407.  with 0.
  3408.  
  3409.  /*  CopyLine - copies lines from one file to another
  3410.   *
  3411.   *  The CopyLine function copies lines yStart through yEnd, inclusive,
  3412.   *  and inserts them into the destination file just before line yDst. If
  3413.   *  the handle to the source file is NULL, then the function inserts a
  3414.   *  blank line into the destination file (in that case, yStart and yEnd
  3415.   *  are ignored).
  3416.   *
  3417.   *  pFileSrc    Handle to source file
  3418.   *  pFileDst    Handle to destination file
  3419.   *  yStart      First line to be copied
  3420.   *  yEnd        Last line to be copied
  3421.   *  yDst        Destination of copy
  3422.   */
  3423.  void pascal CopyLine (pFileSrc, pFileDst, yStart, yEnd, yDst)
  3424.  PFILE pFileSrc, pFileDst;
  3425.  LINE yStart, yEnd, yDst;
  3426.  
  3427.  
  3428.  92. MASM 5.10 EXT.DOC: RemoveFile - Frees Attached File Resources
  3429.  
  3430.  Product Version(s): 5.10   | 5.10
  3431.  Operating System:   MS-DOS | OS/2
  3432.  Flags: ENDUSER |
  3433.  Last Modified: 12-JAN-1989    ArticleIdent: Q31538
  3434.  
  3435.     The following information is from the MASM Version 5.10 EXT.DOC
  3436.  file.
  3437.     Please note that numbering for both COL and LINE variables begins
  3438.  with 0.
  3439.  
  3440.  /*  RemoveFile - frees up all resources attached to a particular file
  3441.   *
  3442.   *  The RemoveFile function removes a file handle from memory, along
  3443.   *  with the file buffer and all other memory-resident information about
  3444.   *  the file. Calling this function helps to free up main memory, but it
  3445.   *  has no effect on the file as stored on disk.
  3446.   *
  3447.   *  pFileRem    File handle to be removed
  3448.   */
  3449.  flagType pascal RemoveFile (pFileRem)
  3450.  PFILE    pFileRem;
  3451.  
  3452.  
  3453.  93. MASM 5.10 EXT.DOC: CopyBox - Copies "Box" from File to File
  3454.  
  3455.  Product Version(s): 5.10   | 5.10
  3456.  Operating System:   MS-DOS | OS/2
  3457.  Flags: ENDUSER |
  3458.  Last Modified: 13-JUN-1988    ArticleIdent: Q31539
  3459.  
  3460.     The following information is from the MASM Version 5.10 EXT.DOC
  3461.  file.
  3462.     Please note that numbering for both COL and LINE variables begins
  3463.  with 0.
  3464.  
  3465.  /*  CopyBox - copies a rectangular area (box) from one file to another
  3466.   *
  3467.   * The CopyBox function copies the box delimited by positions
  3468.   * (xLeft, yTop) and (xRight, yBottom) in the source file and inserts
  3469.   * this box just before position (xDst, yDst) in the destination file.
  3470.   * If the the source-file handle is NULL, a blank space is inserted.
  3471.   * The box in the source file includes both corners specified in the
  3472.   * function call.
  3473.   *
  3474.   *  pFileSrc            Handle to source file
  3475.   *  pFileDst            Handle to destination file
  3476.   *  xLeft, yTop         Column and line of beginning of copy
  3477.   *  xRight, yBottom     Column and line of end of copy
  3478.   *  xDst, yDst          Column and line of destination of copy
  3479.   */
  3480.  void pascal CopyBox (pFileSrc, pFileDst, xLeft, yTop, xRight,
  3481.                       yBottom, xDst, yDst)
  3482.  PFILE pFileSrc, pFileDst;
  3483.  COL  xLeft, xRight, xDst;
  3484.  LINE yTop, yBottom, yDst;
  3485.  
  3486.  
  3487.  94. MASM 5.10 EXT.DOC: Display - Updates the Physical Display
  3488.  
  3489.  Product Version(s): 5.10   | 5.10
  3490.  Operating System:   MS-DOS | OS/2
  3491.  Flags: ENDUSER |
  3492.  Last Modified: 13-JUN-1988    ArticleIdent: Q31540
  3493.  
  3494.     The following information is from the MASM Version 5.10 EXT.DOC
  3495.  file.
  3496.     Please note that numbering for both COL and LINE variables begins
  3497.  with 0.
  3498.  
  3499.  /*  Display - updates the physical display
  3500.   *
  3501.   * The Display function refreshes the screen, by examining editing
  3502.   * changes and making the minimum screen changes necessary.  A
  3503.   * keystroke interrupts the function and causes immediate return.
  3504.   * You do not normally need to use the Display function to see the
  3505.   * results of an edit on the screen. The function is typically useful
  3506.   * when you have an SWI_SPECIAL function that alters a file directly.
  3507.   */
  3508.  void pascal Display ()
  3509.  
  3510.  
  3511.  95. MASM 5.10 EXT.DOC: SetKey - Associates Editor Function w/Key
  3512.  
  3513.  Product Version(s): 5.10   | 5.10
  3514.  Operating System:   MS-DOS | OS/2
  3515.  Flags: ENDUSER |
  3516.  Last Modified: 12-JAN-1989    ArticleIdent: Q31541
  3517.  
  3518.     The following information is from the MASM Version 5.10 EXT.DOC
  3519.  file.
  3520.     Please note that numbering for both COL and LINE variables begins
  3521.  with 0.
  3522.  
  3523.  /*  SetKey - associates an editor function with a keystroke
  3524.   *
  3525.   * The SetKey function creates a function assignment. Any current
  3526.   * assignment to the keystroke is discarded and each time that
  3527.   * particular keystroke is received, the corresponding editor function
  3528.   * will be invoked.
  3529.   *
  3530.   *  pFunction   Pointer to name of string being assigned
  3531.   *  pKey        Pointer to keystroke
  3532.   *
  3533.   *  returns     TRUE (-1) if a successful assignment was made; FALSE (0)
  3534.   *              otherwise
  3535.   */
  3536.  flagType pascal SetKey (pFunction, pKey)
  3537.  char far *pFunction, *pKey;
  3538.  
  3539.  
  3540.  96. MASM 5.10 EXT.DOC: BadArg - Displays "Bad Argument" Message
  3541.  
  3542.  Product Version(s): 5.10   | 5.10
  3543.  Operating System:   MS-DOS | OS/2
  3544.  Flags: ENDUSER |
  3545.  Last Modified: 13-JUN-1988    ArticleIdent: Q31542
  3546.  
  3547.     The following information is from the MASM Version 5.10 EXT.DOC
  3548.  file.
  3549.     Please note that numbering for both COL and LINE variables begins
  3550.  with 0.
  3551.  
  3552.  /*  BadArg - displays a message that a bad argument has been received
  3553.   *
  3554.   *  The "bad argument" message is printed on the dialog line.
  3555.   */
  3556.  flagType pascal BadArg (void);
  3557.  
  3558.  
  3559.  97. MASM 5.10 EXT.DOC: FExecute - Executes an MS-Editor Macro
  3560.  
  3561.  Product Version(s): 5.10   | 5.10
  3562.  Operating System:   MS-DOS | OS/2
  3563.  Flags: ENDUSER |
  3564.  Last Modified: 13-JUN-1988    ArticleIdent: Q31543
  3565.  
  3566.     The following information is from the MASM Version 5.10 EXT.DOC
  3567.  file.
  3568.     Please note that numbering for both COL and LINE variables begins
  3569.  with 0.
  3570.  
  3571.  /*  fExecute - executes a Microsoft-Editor macro
  3572.   *
  3573.   * The fExecute function executes a macro, using the standard rules
  3574.   * for macro execution (see the Microsoft Editor User's Guide for
  3575.   * details).
  3576.   *  pStr        Pointer to macro string to execute
  3577.   *
  3578.   *  returns     Return value of last executed macro
  3579.   */
  3580.  flagType pascal fExecute (pStr)
  3581.  char far *pStr;
  3582.  
  3583.  
  3584.  98. Sign-Extended Register and Immediate from of AND/OR/XOR
  3585.  
  3586.  Product Version(s): 5.00 5.10
  3587.  Operating System:   MS-DOS
  3588.  Flags: ENDUSER |
  3589.  Last Modified: 12-JAN-1989    ArticleIdent: Q31598
  3590.  
  3591.     The Microsoft Macro Assembler will generate sign-extended encodings
  3592.  whenever possible. The following are MASM instructions that will
  3593.  produce sign-extended encodings:
  3594.  
  3595.  Assembler           Sign-Extended               Nonsign-Extended
  3596.  Instructions        Encodings                   Encodings
  3597.  
  3598.  AND bx, 0ffffh      83 E3 FF                    81 E3 FFFF
  3599.  ADD bx, 0001h       83 C3 01                    81 C3 0001
  3600.  ADC bx, 0fh         83 D3 0F                    81 D3 000F
  3601.  OR  bx, 1           83 CB 01                    81 CB 0001
  3602.  SBB bx, 0ffffh      83 DB FF                    81 DB FFFF
  3603.  SUB bx, 3           83 EB 03                    81 EB 0003
  3604.  XOR bx, 0002h       83 F3 02                    81 F3 0002
  3605.  CMP bx, 0fff2h      83 FB F2                    81 FB FFF2
  3606.  
  3607.     MASM will choose the sign-extended version of the instruction
  3608.  because of the 1-byte savings in the encoding. The
  3609.  8088/8086/80186/80286 processors do support the sign-extended
  3610.  encoding, but documentation on this feature is limited. The support of
  3611.  sign-extended encoding is documented in the "8086/8088/80186/80188
  3612.  Programmer's Pocket Reference Guide" on Page 43.
  3613.  
  3614.  
  3615.  99. @data Group Override Produces Phase Error A2006
  3616.  
  3617.  Product Version(s): 5.10    | 5.10a
  3618.  Operating System:   MS-DOS  | OS/2
  3619.  Flags: ENDUSER | buglist5.10
  3620.  Last Modified: 12-NOV-1990    ArticleIdent: Q65244
  3621.  
  3622.  Page 91 of the "Microsoft Macro Assembler 5.1 Programmer's Guide"
  3623.  states that the @data text equate represents the group name.
  3624.  
  3625.  This implies that the code statement with the GROUP override
  3626.  
  3627.     mov ax, dgroup:[di]
  3628.  
  3629.  is equal to the following:
  3630.  
  3631.     mov ax, @data:[di]
  3632.  
  3633.  However, the code below generates the following error:
  3634.  
  3635.     A2006: phase error between passes
  3636.  
  3637.  The following is a sample code:
  3638.  
  3639.  .model small
  3640.  .code
  3641.  
  3642.  delta   proc
  3643.  
  3644.          mov   ax, @data:[di]
  3645.  
  3646.  delta   endp
  3647.  
  3648.          end
  3649.  
  3650.  Microsoft has confirmed this to be a problem in the Macro Assembler
  3651.  version 5.10a. We are researching this problem and will post new
  3652.  information here as it becomes available.
  3653.  
  3654.  
  3655.  100. .CONST Directive Creates a DATA Class Instead of a CONST Class
  3656.  
  3657.  Product Version(s): 5.10   | 5.10
  3658.  Operating System:   MS-DOS | OS/2
  3659.  Flags: ENDUSER | buglist5.10
  3660.  Last Modified: 20-JUL-1988    ArticleIdent: Q32684
  3661.  
  3662.     Page 93 of the "Microsoft Macro Assembler Programmer's Guide"
  3663.  states that the .CONST directive will produce a segment with CONST
  3664.  class; however, the .CONST directive will generate a segment with
  3665.  class DATA.
  3666.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3667.  are researching this problem and will post new information as it
  3668.  becomes available.
  3669.  
  3670.  
  3671.  101. More Than 127 Segments Will Generate Bad Object Record
  3672.  
  3673.  Product Version(s): 5.10   | 5.10
  3674.  Operating System:   MS-DOS | OS/2
  3675.  Flags: ENDUSER | buglist5.10
  3676.  Last Modified: 15-JUL-1988    ArticleIdent: Q32686
  3677.  
  3678.     When a macro assembler program has more than 127 segments and
  3679.  it is compiled with the /Zd switch, an invalid object module is
  3680.  produced. The object module contains an invalid LINUM record caused
  3681.  by the segment index field.
  3682.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3683.  are researching this problem and will post new information as it
  3684.  becomes available.
  3685.  
  3686.  
  3687.  
  3688.  102. Error Message A4100: Impure Memory Reference
  3689.  
  3690.  Product Version(s): 5.10   | 5.10
  3691.  Operating System:   MS-DOS | OS/2
  3692.  Flags: ENDUSER | buglist5.10
  3693.  Last Modified: 15-JUL-1988    ArticleIdent: Q32691
  3694.  
  3695.     MASM incorrectly generates the error message "A4100: Impure memory
  3696.  reference" on the following source code:
  3697.  
  3698.  .286
  3699.  CODE segment
  3700.       ASSUME cs:code
  3701.       var1   db    ?
  3702.       DIV    var1
  3703.  CODE ends
  3704.  
  3705.      The DIV instruction incorrectly generates the error message. This
  3706.  error occurs when the ".386" directive is used instead of the ".286"
  3707.  directive and the "dw" directive is used instead of the "db"
  3708.  directive. Also, if the ".386" directive is used with the "dd"
  3709.  directive, the DIV instruction will generate the error message again.
  3710.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3711.  are researching this problem and will post new information as it
  3712.  becomes available.
  3713.  
  3714.  
  3715.  
  3716.  103. RUNME Program Looks for Drive A Only
  3717.  
  3718.  Product Version(s): 5.10   | 5.10
  3719.  Operating System:   MS-DOS | OS/2
  3720.  Flags: ENDUSER | buglist5.10
  3721.  Last Modified: 15-JUL-1988    ArticleIdent: Q32753
  3722.  
  3723.     The MASM setup program is called RUNME. During the setup process,
  3724.  the RUNME program will only look to Drive A for the setup files.
  3725.  Computers with only a Drive B cannot run the setup program.
  3726.     A workaround is to use the MS-DOS Assign command as follows:
  3727.  
  3728.     assign b=a
  3729.  
  3730.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3731.  are researching this problem and will post new information as it
  3732.  becomes available.
  3733.  
  3734.  
  3735.  104. Forward Reference to Segment Name Gives Phase Error
  3736.  
  3737.  Product Version(s): 5.00  5.10 5.10A
  3738.  Operating System:   MS-DOS | OS/2
  3739.  Flags: ENDUSER | buglist5.10
  3740.  Last Modified: 10-JUL-1990    ArticleIdent: Q32762
  3741.  
  3742.     A forward reference to a segment name in MASM will incorrectly
  3743.  give a "A2006: Phase error between passes" error.
  3744.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3745.  are researching this problem and will post new information as it
  3746.  becomes available.
  3747.     A workaround is to declare empty segments at the top of your MASM
  3748.  source code, defining all segments in the order needed.
  3749.  
  3750.     The following source example demonstrates the problem:
  3751.  
  3752.  CSEG segment para public 'CODE'
  3753.       assume CS:CSEG
  3754.  main proc near
  3755.       mov bx,seg sseg               ;will generate phase error
  3756.       ret
  3757.  main endp
  3758.  CSEG ends
  3759.  SSEG segment stack 'STACK'
  3760.       db 100h dup(?)
  3761.  SSEG ends
  3762.  end  main
  3763.  
  3764.     The above example would have the following empty segments declared
  3765.  at the top of the source file:
  3766.  
  3767.  CSEG segment para public 'CODE'
  3768.  CSEG ends
  3769.  SSEG segment stack 'STACK'
  3770.  SSEG ends
  3771.  
  3772.     Because the SSEG segment is declared before the MOV instruction
  3773.  is assembled, the phase error is eliminated. The CSEG segment
  3774.  is also declared to ensure that the ordering of the two segments
  3775.  is unchanged.
  3776.     For more information about ordering of segments, refer to the
  3777.  "Microsoft Macro Assembler Programmer's Guide" and the "Microsoft
  3778.  CodeView and Utilities Guide."
  3779.  
  3780.  
  3781.  
  3782.  105. Segments of Type COMMON Are Incorrectly Overlapped
  3783.  
  3784.  Product Version(s): 5.10   | 5.10
  3785.  Operating System:   MS-DOS | OS/2
  3786.  Flags: ENDUSER | buglist5.10
  3787.  Last Modified: 15-JUL-1988    ArticleIdent: Q32764
  3788.  
  3789.     Segments of type COMMON are combined instead of overlapped. MASM
  3790.  should not combine them; it should pass them through separately for the
  3791.  linker to handle.
  3792.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3793.  are researching this problem and will post new information as it
  3794.  becomes available.
  3795.  
  3796.  
  3797.  
  3798.  106. LOCAL Directive Incorrect for Large Types
  3799.  
  3800.  Product Version(s): 5.10   | 5.10
  3801.  Operating System:   MS-DOS | OS/2
  3802.  Flags: ENDUSER | buglist5.10 | fixlist5.10A
  3803.  Last Modified: 10-JUL-1990    ArticleIdent: Q32773
  3804.  
  3805.     The LOCAL directive allocates two bytes too few when applied to
  3806.  data items with type larger than word.
  3807.     Microsoft has confirmed this to be a problem in Version 5.10.
  3808.  The 5.10A MASM update is available as an applications note, from
  3809.  Microsoft Product Support Services.
  3810.  
  3811.     The following source example demonstrates the problem:
  3812.  
  3813.  .model large
  3814.  .code
  3815.  foo    proc
  3816.         local l1:byte
  3817.         local l2:word
  3818.         local l4:dword
  3819.         local l6:fword
  3820.         local l8:qword
  3821.         local l10:tword
  3822.         ret
  3823.  foo    endp
  3824.  end
  3825.  
  3826.     The listing file below illustrates the incorrect offsets generated:
  3827.  
  3828.  L1 ........................ TEXT    BYTE PTR [BP]-2
  3829.  L10........................ TEXT    TBYTE PTR [BP]-24
  3830.  L2......................... TEXT    WORD PTR [BP]-4
  3831.  L4......................... TEXT    DWORD PTR [BP]-6
  3832.  L6......................... TEXT    FWORD PTR [BP]-10
  3833.  L8......................... TEXT    QWORD PTR [BP]-16
  3834.  
  3835.  
  3836.  
  3837.  107. Language Names Declared as PUBLIC Cause Error
  3838.  
  3839.  Product Version(s): 5.10   | 5.10
  3840.  Operating System:   MS-DOS | OS/2
  3841.  Flags: ENDUSER | buglist5.10
  3842.  Last Modified: 15-JUL-1988    ArticleIdent: Q32777
  3843.  
  3844.     Starting with Macro Assembler Version 5.10, language names cannot
  3845.  be declared PUBLIC. The language names affected are BASIC, C,
  3846.  FORTRAN, and PASCAL. The error message displayed does not correctly
  3847.  display the name of the offending label. The following example
  3848.  demonstrates the problem:
  3849.  
  3850.  .model small
  3851.  .data
  3852.  public c
  3853.  test.asm(17): error A2009:Symbol not defined:
  3854.  c  db  1
  3855.  end
  3856.  
  3857.     Note that the use of "c" as a variable is allowed. Microsoft has
  3858.  confirmed this to be a problem in Version 5.10. We are researching
  3859.  this problem and will post new information as it becomes available.
  3860.  
  3861.  
  3862.  
  3863.  108. Illegal Instruction under CodeView
  3864.  
  3865.  Product Version(s): 5.10   | 5.10
  3866.  Operating System:   MS-DOS | OS/2
  3867.  Flags: ENDUSER | buglist5.10
  3868.  Last Modified: 19-JUL-1988    ArticleIdent: Q32779
  3869.  
  3870.      When the following program is assembled with the /Zi switch,
  3871.  linked with the /CO switch, and traced under CodeView, an illegal
  3872.  instruction occurs:
  3873.  
  3874.  _text segment
  3875.  assume cs:_text
  3876.         db 08h,0c1h
  3877.  _text ends
  3878.  end
  3879.  
  3880.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3881.  are researching this problem and will post new information as it
  3882.  becomes available.
  3883.  
  3884.  
  3885.  109. BSESUB.INC Contains Incorrect Declarations
  3886.  
  3887.  Product Version(s): 5.10   | 5.10
  3888.  Operating System:   MS-DOS | OS/2
  3889.  Flags: ENDUSER | buglist5.10
  3890.  Last Modified: 15-JUL-1988    ArticleIdent: Q32810
  3891.  
  3892.     In BSESUB.INC, the KBDINFO structure fields should all be declared
  3893.  with the DW directive; however, the fields are declared by the DB
  3894.  directive instead. Also, the fsShift field should be declared with DW
  3895.  directive instead of the DD directive.
  3896.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3897.  are researching this problem and will post new information as it
  3898.  becomes available.
  3899.  
  3900.  
  3901.  
  3902.  110. Address-Size and Operand-Size Override Generated
  3903.  
  3904.  Product Version(s): 5.10   | 5.10
  3905.  Operating System:   MS-DOS | OS/2
  3906.  Flags: ENDUSER | buglist5.10
  3907.  Last Modified: 15-JUL-1988    ArticleIdent: Q32811
  3908.  
  3909.     MASM will generate both an address-size and operand-size override
  3910.  for a far call from a USE16 segment to a USE32 segment. Only the
  3911.  operand-size override is necessary.
  3912.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3913.  are researching this problem and will post new information as it
  3914.  becomes available.
  3915.  
  3916.     The  following source code demonstrates the problem:
  3917.  
  3918.                          .386
  3919.                          s32 segment USE32
  3920.                              assume cs:@CurSeg
  3921.                              p   proc
  3922.                              p   endp
  3923.                          s32 ends
  3924.                          s16 segment USE16
  3925.                              assume cs:@CurSeg
  3926.  67|66|9A 00000000           call    far ptr p
  3927.                          s16 ends
  3928.                          end
  3929.  
  3930.     The opcodes generated for the Call instruction are shown at the
  3931.  left of the instruction. The address-size prefix is 67 and the
  3932.  operand-size prefix is 66.
  3933.  
  3934.  
  3935.  
  3936.  111. Literal Character Operator (!) in Text Equate
  3937.  
  3938.  Product Version(s): 5.10   | 5.10
  3939.  Operating System:   MS-DOS | OS/2
  3940.  Flags: ENDUSER | buglist5.10
  3941.  Last Modified: 15-JUL-1988    ArticleIdent: Q32812
  3942.  
  3943.    The literal character operator (!) does not allow a right angle
  3944.  bracket to be placed in a text equate. For example, the following
  3945.  line will cause an error:
  3946.  
  3947.      a     equ    < !> >
  3948.  
  3949.     The warning message A4001: "Extra characters on line" will be
  3950.  generated by the assembler.
  3951.     Microsoft has confirmed this to be a problem in Version 5.10. We
  3952.  are researching this problem and will post new information as it
  3953.  becomes available.
  3954.  
  3955.  
  3956.  112. New Command-Line Option /LA
  3957.  
  3958.  Product Version(s):
  3959.  Operating System:   5.10   | 5.10
  3960.  Flags: MS-DOS | OS/2
  3961.  Last Modified: 22-JUL-1988    ArticleIdent: Q32832
  3962.  ENDUSER |
  3963.  
  3964.     Version 5.10 of the Macro Assembler includes a new command-line
  3965.  option that shows all code generated by MASM.
  3966.     The command-line option /LA displays the results of the simplified
  3967.  segment directives and code generated by the high-level language
  3968.  support features. The following is a sample source file with simplified
  3969.  segment directives and a fragment of the listing file created by using
  3970.  /LA:
  3971.  
  3972.       .model small
  3973.       .data
  3974.       .code
  3975.       end
  3976.  
  3977.       .model small
  3978.       assume cs:@code,ds:@data,ss:@data
  3979.       .data
  3980.       _DATA segment 'DATA'
  3981.       .code
  3982.       @CurSeg ends
  3983.       _TEXT segment  'CODE'
  3984.       end
  3985.       @CurSeg ends
  3986.  
  3987.  
  3988.  113. Line-Continuation Character Added
  3989.  
  3990.  Product Version(s): 5.10   | 5.10
  3991.  Operating System:   MS-DOS | OS/2
  3992.  Flags: ENDUSER |
  3993.  Last Modified: 15-JUL-1988    ArticleIdent: Q32834
  3994.  
  3995.     The line-continuation character (\) has been added to the
  3996.  Microsoft Macro Assembler. A program line can now extend over
  3997.  more than one physical line.
  3998.     The backslash must be the last character in the line. Using the
  3999.  line-continuation character, you may have program lines up to 512
  4000.  characters. Physical lines are still limited to 128 characters.
  4001.  
  4002.  
  4003.  
  4004.  114. .TYPE Operator Has New Bit Settings
  4005.  
  4006.  Product Version(s): 5.10   | 5.10
  4007.  Operating System:   MS-DOS | OS/2
  4008.  Flags: ENDUSER |
  4009.  Last Modified: 15-JUL-1988    ArticleIdent: Q32836
  4010.  
  4011.     In previous versions of the Microsoft Macro Assembler, the .TYPE
  4012.  operator uses only bits 0, 1, 5, and 7. In MASM Versions 5.10, the use
  4013.  of bits 2, 3 and 4 has been added.
  4014.     The following is a chart of bit assignments:
  4015.  
  4016.      Bit Position        If Bit=0            If Bit=1
  4017.  
  4018.      0               Not program related     Program related
  4019.      1               Not data related        Data related
  4020.      2               Not a constant value    Constant value
  4021.      3               Addressing mode is not  Addressing mode is direct
  4022.                          direct
  4023.      4               Not a register          Expression is a register
  4024.      5               Not defined             Defined
  4025.      7               Local or public scope   External scope
  4026.  
  4027.      For more information on the .TYPE operator please refer to the
  4028.  "Microsoft Macro Assembler 5.10 Programmer's Guide."
  4029.  
  4030.  
  4031.  
  4032.  115. LOCAL Directive Requires Language Parameter
  4033.  
  4034.  Product Version(s): 5.10   | 5.10
  4035.  Operating System:   MS-DOS | OS/2
  4036.  Flags: ENDUSER | buglist5.10
  4037.  Last Modified: 15-JUL-1988    ArticleIdent: Q32858
  4038.  
  4039.     The LOCAL directive used inside a procedure requires a language
  4040.  parameter in the .MODEL directive. The warning A4001: "Extra characters
  4041.  on line" will be incorrectly generated by the assembler.
  4042.     The following is an example:
  4043.  
  4044.      .model small
  4045.      .code
  4046.      proc1 proc
  4047.      local x:dword
  4048.      proc1 endp
  4049.      end
  4050.  
  4051.     The statement "local x:dword" will generate the warning.
  4052.     The workaround for this problem is to specify a language parameter.
  4053.  To correct the program above, replace the statement ".model small"
  4054.  with ".model small,fortran".
  4055.     Microsoft has confirmed this to be a problem in Version 5.10. We
  4056.  are researching this problem and will post new information as it
  4057.  becomes available.
  4058.  
  4059.  
  4060.  116. Using /LA and .FARDATA? Generates Incorrect Listing File
  4061.  
  4062.  Product Version(s): 5.10   | 5.10
  4063.  Operating System:   MS-DOS | OS/2
  4064.  Flags: ENDUSER | buglist5.10
  4065.  Last Modified: 19-JUL-1988    ArticleIdent: Q32860
  4066.  
  4067.     The MASM command-line option /LA will show all code generated by
  4068.  the high-level-language features. When the .FARDATA? directive is
  4069.  used, the code generated in the listing file places the "@CurSeg ends"
  4070.  statement in the wrong place.
  4071.     Microsoft has confirmed this to be a problem in Version 5.10. We
  4072.  are researching this problem and will post new information as it
  4073.  becomes available.
  4074.  
  4075.     The following is an assembler source and listing file:
  4076.  
  4077.      .model small
  4078.      .fardata?
  4079.      .data
  4080.      end
  4081.  
  4082.      .model small
  4083.      assume cs:@code,ds:@data,ss:@data
  4084.      .fardata?
  4085.      FAR_BSS segment 'FAR_BSS'
  4086.      .data
  4087.      _DATA segment 'DATA'
  4088.      @CurSeg ends
  4089.      end
  4090.      @CurSeg ends
  4091.  
  4092.      first "@CurSeg ends" statement should be place before the _DATA
  4093.  segment is declared.
  4094.  
  4095.  
  4096.  
  4097.  117. Invalid Operation and Inexact Result in Control Word
  4098.  
  4099.  Product Version(s): 5.10   | 5.10
  4100.  Operating System:   MS-DOS | OS/2
  4101.  Flags: ENDUSER |
  4102.  Last Modified: 12-JAN-1989    ArticleIdent: Q32865
  4103.  
  4104.     A good source of information for the 80287 Control and Status Words
  4105.  is the INTEL 80286 and 80287 Programmer's Reference Manual.
  4106.     The article below gives a brief summary of the information found in
  4107.  the INTEL reference concerning the Invalid Operation and Inexact
  4108.  Result exceptions.
  4109.  
  4110.     When the 80287 processor attempts a numeric operation with invalid
  4111.  operands or produces a result that cannot be represented, the
  4112.  processor will check certain numeric exceptions. Among the exceptions
  4113.  checked are Invalid Operation and Inexact Result.
  4114.     The 80287 reports an Invalid Operation if any of the following
  4115.  occurs:
  4116.  
  4117.     An attempt to load a register that is not empty (stack overflow).
  4118.     An attempt to pop an operand from an empty register (stack underflow).
  4119.     An operand is a NaN.
  4120.     The operands cause the operation to be indeterminate (square root
  4121.     of negative number,0/0).
  4122.  
  4123.     If the result of an operation is not exactly representable in the
  4124.  destination format, the 80287 rounds the number and reports the
  4125.  precision exception. For example, the fraction 1/3 cannot be precisely
  4126.  represented in binary form.
  4127.     The 80287's system of real numbers may be closed by either two
  4128.  models of infinity. The two models are projective and affine closure.
  4129.  The default means of closure is projective.
  4130.     When projective closure is selected, the NPX treats the special
  4131.  values +infinity and -infinity as a single unsigned infinity. In the
  4132.  affine mode, the NPX respects the signs of infinity.
  4133.     While affine mode may provide more information than projective
  4134.  mode, there are occasions when the sign may represent misinformation.
  4135.  Projective mode, on the other hand, provides less information, but
  4136.  never returns misinformation.
  4137.  
  4138.  
  4139.  118. Comment Strings Should Not Overlap Onto the Next Line
  4140.  
  4141.  Product Version(s): 5.10   | 5.10
  4142.  Operating System:   MS-DOS | OS/2
  4143.  Flags: ENDUSER | docerr
  4144.  Last Modified: 12-JAN-1989    ArticleIdent: Q32882
  4145.  
  4146.     On Pages 22 and 23 of the "Microsoft Macro Assembler 5.1 Updates
  4147.  and Microsoft Editor" manual there is an example using various text
  4148.  macros called SaveRegs and RestRegs. In this example, there are
  4149.  comment strings that overlap onto the next line because of wrap
  4150.  around.
  4151.     Please note that this is wrap around from the comment, and not a
  4152.  new instruction.
  4153.  
  4154.  
  4155.  
  4156.  119. No Symbolic Information Generated for Procedure Labels
  4157.  
  4158.  Product Version(s): 5.10   | 5.10
  4159.  Operating System:   MS-DOS | OS/2
  4160.  Flags: ENDUSER | buglist5.10
  4161.  Last Modified: 22-JUL-1988    ArticleIdent: Q32885
  4162.  
  4163.     MASM does not generate an object-module record that allows a break
  4164.  point to be set at a procedure label under CodeView. The following
  4165.  code demonstrates this problem:
  4166.  
  4167.      .model compact
  4168.      .code
  4169.      routine proc
  4170.      mov ax,ax
  4171.      routine endp
  4172.      end
  4173.  
  4174.     The source code was assembled and linked as follows:
  4175.  
  4176.  masm /ZI file.asm;
  4177.  link /CO file;
  4178.  cv file
  4179.  
  4180.     In CodeView, entering "bp routine" gives the "Unknown symbol" error
  4181.  message.
  4182.     Microsoft has confirmed this to be a problem in Version 5.10. We
  4183.  are researching this problem and will post new information as it
  4184.  becomes available.
  4185.  
  4186.  
  4187.  
  4188.  120. Automatic Labels for Jump Instructions
  4189.  
  4190.  Product Version(s): 5.10   | 5.10
  4191.  Operating System:   MS-DOS | OS/2
  4192.  Flags: ENDUSER | jmp
  4193.  Last Modified: 22-JUL-1988    ArticleIdent: Q33067
  4194.  
  4195.     The Macro Assembler provides a way to generate automatic labels
  4196.  for jump instructions.
  4197.     To define the local label to be jumped to, use two at signs (@@)
  4198.  followed by a colon (:). The jump instruction's operand field can
  4199.  either use @B (back) or @F (forward). The @B will jump to the nearest
  4200.  preceding local label and the @F will jump to the nearest following
  4201.  label.
  4202.     The example below illustrates this feature:
  4203.  
  4204.      cmp ax,cx
  4205.      jge @F
  4206.      .
  4207.      .
  4208.      .
  4209.  @@:
  4210.      .
  4211.      .
  4212.      .
  4213.      jle @B
  4214.  
  4215.     The jump instruction @F will jump to @@: and the jump instruction @B
  4216.  will jump back to @@.
  4217.     Section 3.3 of the "Microsoft Macro Assembler 5.1 Updates and
  4218.  Microsoft Editor" manual discusses this new feature.
  4219.  
  4220.  
  4221.  121. Enhancements to Help Use Procedures in MASM
  4222.  
  4223.  Product Version(s): 5.10   | 5.10
  4224.  Operating System:   MS-DOS | OS/2
  4225.  Flags: ENDUSER |
  4226.  Last Modified: 12-JAN-1989    ArticleIdent: Q33359
  4227.  
  4228.     A series of enhancements were made in MASM Version 5.10 to make
  4229.  procedure definitions easier and more high-level-language compatible.
  4230.  These enhancements comprise the following:
  4231.  
  4232.     USES register-list
  4233.     Parameters
  4234.     LOCAL variables.
  4235.  
  4236.     The implementation of the parameters requires a language to be
  4237.  specified so the parameter order can be determined (for any procedures
  4238.  with two or more parameters). The other enhancements are not language
  4239.  specific.
  4240.     However, these features are intended as a package; therefore, the
  4241.  extended features are not recognized if no language is specified.
  4242.  
  4243.  
  4244.  122. Programmer's Guide FREE ST(num) Reference Is Incorrect
  4245.  
  4246.  Product Version(s): 5.00 5.10
  4247.  Operating System:   MS-DOS
  4248.  Flags: ENDUSER | docerr
  4249.  Last Modified: 12-JAN-1989    ArticleIdent: Q33382
  4250.  
  4251.     On Page 406 of the "Microsoft Macro Assembler Programmer's Guide,"
  4252.  the FREE ST(num) instruction is incorrectly stated. It should read
  4253.  FFREE ST(num).
  4254.  
  4255.  
  4256.  123. STOS Instruction Must Have String Pointed to ES:DI
  4257.  
  4258.  Product Version(s): 5.10   | 5.10
  4259.  Operating System:   MS-DOS | OS/2
  4260.  Flags: ENDUSER |
  4261.  Last Modified: 12-JAN-1989    ArticleIdent: Q34371
  4262.  
  4263.     The STOS instruction must have the string pointed to by ES:DI. The
  4264.  following command will not generate a warning that an attempt to
  4265.  override the DI register was made even though it will continue to
  4266.  expect the string to be pointed to by ES:DI:
  4267.  
  4268.     STOS  WORD PTR ES:[SI]
  4269.  
  4270.  
  4271.  
  4272.  124. Documentation Error on the LGDT Instruction
  4273.  
  4274.  Product Version(s): 5.10   | 5.10
  4275.  Operating System:   MS-DOS | OS/2
  4276.  Flags: ENDUSER | docerr
  4277.  Last Modified: 12-JAN-1989    ArticleIdent: Q34375
  4278.  
  4279.     The "Microsoft Macro Assembler 5.10 Reference Guide" states that
  4280.  the LGDT instruction only takes a memory 64 operand while the Intel
  4281.  manual states the LGDT instruction takes a memory 48 operand.
  4282.     The MASM Reference is incorrect. The correct operand size is memory
  4283.  48. These instructions load essentially a 2-field structure whose
  4284.  total size is 48 bits. The first two bytes are the limit field and the
  4285.  last four bytes are the base field. This can be defined using the DF
  4286.  directive, or by defining a structure as described.
  4287.  
  4288.  
  4289.  125. Function Pointers
  4290.  
  4291.  Product Version(s): 5.10   | 5.10
  4292.  Operating System:   MS-DOS | OS/2
  4293.  Flags: ENDUSER |
  4294.  Last Modified: 12-JAN-1989    ArticleIdent: Q34377
  4295.  
  4296.     The following sample program illustrates function pointers, C and
  4297.  MASM, from a MASM point of view.
  4298.     It takes the address of the function (in this example, the address
  4299.  is loaded into ES:DX) and moves it into a 4-byte variable; it then
  4300.  does a far call to that address.
  4301.     In this example it seems odd to call a function in this manner
  4302.  because the function is defined locally and its name in known;
  4303.  however, what if the name of the function was not known? What if you
  4304.  were programming a device driver and all that was know was the entry
  4305.  point of the function?
  4306.     Lets say the entry point was given in ES:DX. Using the following
  4307.  technique, a name could be given to the address of the function and
  4308.  the function could be called like any other function.
  4309.  
  4310.     The following sample program demonstrates this information:
  4311.  
  4312.  ;
  4313.  ;
  4314.  ;    NAME:  fptr.asm
  4315.  ;
  4316.  ;    This program illustrates how to implement a function pointer
  4317.  ;    in MACRO Assembler.
  4318.  ;
  4319.  ;    This technique is the same as the C compiler would generate
  4320.  ;    if you were to get an assembly listing of a C program that
  4321.  ;    contained a pointer to a function.
  4322.  ;
  4323.  ;
  4324.  dosseg
  4325.  .model small
  4326.  
  4327.  .data
  4328.       fptr dd 1 dup(?)   ; set aside four bytes for function address
  4329.  
  4330.  .code
  4331.  ;
  4332.  ;   MACRO Definitions
  4333.  ;
  4334.  FARCALL MACRO func_ptr
  4335.              call dword ptr func_ptr  ; call by 4-byte far function reference
  4336.          ENDM
  4337.  
  4338.  DosExit MACRO
  4339.               mov  ax, 4C00h    ; ah = 4Ch ( dos exit interrupt) al = 0
  4340.               int  21h
  4341.          ENDM
  4342.  ;
  4343.  ;   FUNCTION Definitions
  4344.  ;
  4345.       PUBLIC _ClrScr
  4346.  _ClrScr PROC FAR
  4347.  
  4348.       push bp          ; save bp
  4349.       mov  bp, sp      ; get sp
  4350.       push bx          ; save registers
  4351.       push cx
  4352.       push dx
  4353.  
  4354.       mov ax, 0700h    ;  ah = 7,  al = 0
  4355.       mov bx, 0700h    ;  bh = 7,  bl = 0
  4356.       xor cx, cx       ;  cx = 0
  4357.       mov dx, 184Fh    ;  dh = 24, dl = 79, decimal
  4358.       int 10h
  4359.  
  4360.       mov ax, 0200h    ; ah = 2, al = 0
  4361.       xor bx, bx       ; bx = 0
  4362.       xor dx, dx       ; dx = 0
  4363.       int 10h
  4364.  
  4365.       xor  ax, ax      ; function returns void
  4366.  
  4367.       pop  dx          ; restore registers
  4368.       pop  cx
  4369.       pop  bx
  4370.  
  4371.       mov  sp, bp      ; reset sp
  4372.       pop  bp          ; restore bp
  4373.  
  4374.       ret              ; return
  4375.  
  4376.  _ClrScr ENDP
  4377.  
  4378.  BEGIN:     ; main part of the program
  4379.  
  4380.      ; Get address of the function
  4381.  
  4382.      mov  dx, SEG _ClrScr
  4383.      mov  es, dx
  4384.      mov  dx, OFFSET _ClrScr   ; es:dx is the address of the function
  4385.  
  4386.      ; Load function address into fptr
  4387.  
  4388.      mov  WORD PTR fptr, dx    ; low word of fptr is the
  4389.                                ; offset of the function
  4390.      mov  WORD PTR fptr+2, es  ; high word of fptr is the
  4391.                                ; segment of the function
  4392.  
  4393.      ; Call the function via a function pointer
  4394.  
  4395.      FARCALL fptr              ; call function. FARCALL is a macro
  4396.                                ; defined above
  4397.  
  4398.      ; Exit to DOS
  4399.  
  4400.      DosExit                   ; Exit to DOS. DosExit is a macro
  4401.                                ; defined above
  4402.  
  4403.  END BEGIN
  4404.  
  4405.  
  4406.  126. Making Multiple Initialized Far Data Segments
  4407.  
  4408.  Product Version(s): 5.00 5.10 | 5.10
  4409.  Operating System:   MS-DOS    | OS/2
  4410.  Flags: ENDUSER |
  4411.  Last Modified: 12-JAN-1989    ArticleIdent: Q34379
  4412.  
  4413.  Questions:
  4414.     How can I make multiple initialized far data segments with the
  4415.  Macro Assembler Version 5.00 or 5.10?
  4416.  
  4417.  Response:
  4418.     You can have multiple initialized far-data segments by using the
  4419.  .fardata Segment_Name directive, as documented on Page 88 of the
  4420.  "Microsoft Macro Assembler 5.1 Programmers Guide."
  4421.     The sample program below demonstrates using two intialized far-data
  4422.  segments. The program size is very large (131k) due to the large
  4423.  amount of data that is being stored.
  4424.     The following is the sample program:
  4425.  
  4426.  ; The contents of SrcBuff will be copied to DesBuff
  4427.           .model large
  4428.           .fardata
  4429.  SrcBuff  db    65535 dup (65)      ; First Initialized far segment
  4430.  
  4431.           .fardata BufSeg           ; Name 2nd fardata segment BufSeg
  4432.  DestBuff db    65535 dup (66)
  4433.  
  4434.           .code
  4435.  main:
  4436.           mov  ax, @fardata         ; Make ds:si point to SrcBuff
  4437.           mov  ds, ax
  4438.           mov  si, 0
  4439.  
  4440.           mov  ax, BufSeg           ; Make es:di point to DestBuff
  4441.           mov  es, ax
  4442.           mov  di, 0
  4443.  
  4444.           mov  cx, 0ffffh           ; Initialize full segment
  4445.  
  4446.           rep  movsb                ; Automatically inc si & di
  4447.                                     ; Dec cx till 0
  4448.           retf
  4449.           end  main
  4450.  
  4451.  
  4452.  127. MASM 5.10 MACRO.DOC: Process Control
  4453.  
  4454.  Product Version(s): 5.10   | 5.10
  4455.  Operating System:   MS-DOS | OS/2
  4456.  Flags: ENDUSER |
  4457.  Last Modified: 12-JAN-1989    ArticleIdent: Q34454
  4458.  
  4459.  The following information was taken from the MASM 5.10 MACRO.DOC file.
  4460.  
  4461.  PROCESS CONTROL
  4462.  
  4463.  @Exit (4Ch)
  4464.  
  4465.  Exits to DOS with return code
  4466.  
  4467.  Syntax:         @Exit [#return]
  4468.  
  4469.  Argument:       return      = 8-bit code to return to DOS; if
  4470.                                none given, AL is used
  4471.  Return:         None
  4472.  Registers used: AX
  4473.  
  4474.  @Exec (4Bh)
  4475.  
  4476.  Executes a child process or an overlay
  4477.  
  4478.  Syntax:         @Exec path, params [,[segpath] [,[segparams]
  4479.                  [,overlay]]]
  4480.  
  4481.  Arguments:      path        = Offset of ASCIIZ filespec to be
  4482.                                executed
  4483.                  params      = Offset of process parameter block
  4484.                  segpath     = Segment of filespec (DS if none given)
  4485.                  segparams   = Segment of parameter block (ES if none
  4486.                                given)
  4487.                  overlay     = If not defined, normal process
  4488.                                executed; if defined, overlay executed
  4489.  Return:         If carry set, error code
  4490.  Registers used: AX, SI, and DI; DS and ES if corresponding
  4491.                  segments given
  4492.  
  4493.  @GetRet (4Dh)
  4494.  
  4495.  Gets the return code of a child process
  4496.  
  4497.  Syntax:         @GetRet
  4498.  
  4499.  Argument:       None
  4500.  Return:         Return code in AX
  4501.  Register used:  AX
  4502.  
  4503.  @TSR (31h)
  4504.  
  4505.  Terminates a program, but leaves it resident in memory
  4506.  
  4507.  Syntax:         @TSR paragraphs [,#return]
  4508.  
  4509.  Arguments:      return      = Code to return to DOS; if none, AL
  4510.                                used
  4511.                  paragraphs  = Memory in paragraphs (16 bytes) to
  4512.                                allocate for resident program
  4513.  Return:         None
  4514.  Registers used: AX and DX
  4515.  
  4516.  
  4517.  128. MASM 5.10 MACRO.DOC: BIOS Macro Syntax, Description
  4518.  
  4519.  Product Version(s): 5.10   | 5.10
  4520.  Operating System:   MS-DOS | OS/2
  4521.  Flags: ENDUSER |
  4522.  Last Modified: 12-JAN-1989    ArticleIdent: Q34455
  4523.  
  4524.  The following information was taken from the MASM 5.10 MACRO.DOC file.
  4525.  
  4526.  BIOS Macro Syntax and Description
  4527.  
  4528.  MODE, PAGE, AND COLOR CONTROL
  4529.  
  4530.  @GetMode (I 10h F 0Fh)
  4531.  
  4532.  Gets the current video mode and page
  4533.  
  4534.  Syntax:         @GetMode
  4535.  
  4536.  Arguments:      None
  4537.  Return:         AL          = Mode
  4538.                  AH          = Width in characters
  4539.                  BH          = Page
  4540.  Registers used: AX and BH
  4541.  
  4542.  @SetMode (I 10h F 00h)
  4543.  
  4544.  Gets the current video mode and page
  4545.  
  4546.  Syntax:         @SetMode mode
  4547.  
  4548.  Arguments:      mode        = 8-bit video mode
  4549.  Return:         none
  4550.  Registers used: AX
  4551.  
  4552.  @SetColor (I 10h F 0Bh)
  4553.  
  4554.  Sets the background color
  4555.  
  4556.  Syntax:         @SetColor color
  4557.  
  4558.  Arguments:      color       = 8-bit background color (0-15);
  4559.                                border color in text modes
  4560.  Return:         none
  4561.  Registers used: AX and BX
  4562.  
  4563.  @SetPalet (I 10h F 0Bh)
  4564.  
  4565.  Sets the color palette
  4566.  
  4567.  Syntax:         @SetPalet color
  4568.  
  4569.  Arguments:      color       = 8-bit color palette (0-1 for modes
  4570.  5 and 6)
  4571.  Return:         none
  4572.  Registers used: AX and BX
  4573.  
  4574.  @SetPage (I 10h F 05h)
  4575.  
  4576.  Sets the video page
  4577.  
  4578.  Syntax:         @SetPage page
  4579.  
  4580.  Arguments:      page        = 8-bit page number; 0-3 for modes 2
  4581.                                and 3
  4582.  Return:         none
  4583.  Registers used: AX
  4584.  
  4585.  
  4586.  129. Call to @Mkthread Macro Results in Phase Error
  4587.  
  4588.  Product Version(s): 5.10   | 5.10
  4589.  Operating System:   MS-DOS | OS/2
  4590.  Flags: ENDUSER | buglist5.10
  4591.  Last Modified: 12-JAN-1989    ArticleIdent: Q34664
  4592.  
  4593.  The program below generates a phase error on the call to the @Mkthread
  4594.  macro that only includes the line "mov cx, seg fproc". The similar
  4595.  MASM statements do not generate a phase error.
  4596.  
  4597.  The problem has nothing to do with the macro. The difference between
  4598.  the MASM statements is moving into CX versus AX.
  4599.  
  4600.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  4601.  researching this problem and will post new information as it becomes
  4602.  available.
  4603.  
  4604.  To work around this problem, change the macro line to the following:
  4605.  
  4606.  MOV CX, WORD PTR (SEG PROG)
  4607.  
  4608.  The following sample code demonstrates the problem:
  4609.  
  4610.  .model large
  4611.  @mkthread    macro      prog
  4612.               mov cx,seg prog
  4613.               endm
  4614.  
  4615.  .code
  4616.  mov ax, seg fproc
  4617.  @mkthread fproc
  4618.  
  4619.  fproc       proc
  4620.  mov ax,seg fproc
  4621.  fproc       endp
  4622.  end
  4623.  
  4624.  
  4625.  130. No Warning on Immediate Value Out of Range
  4626.  
  4627.  Product Version(s): 5.10   | 5.10
  4628.  Operating System:   MS-DOS | OS/2
  4629.  Flags: ENDUSER |
  4630.  Last Modified: 12-JAN-1989    ArticleIdent: Q34667
  4631.  
  4632.  In the following instruction MASM doesn't warn that an immediate value
  4633.  is too large:
  4634.  
  4635.  add structure.element[edi],immediate value
  4636.  
  4637.  The element is byte wide, but the immediate value is much larger than
  4638.  256. The assembler creates a byte add instruction, silently truncating
  4639.  the high part of the immediate value.
  4640.  
  4641.  MASM generally generates error messages on values out of range. MASM
  4642.  does not generate an out of range error message when the immediate
  4643.  value could be a signed number (e.g. 0ffffff75h) that is -8bH. The
  4644.  assembler can't tell if the immediate value is a negative number or an
  4645.  unsigned number that is out of bounds. In this case, MASM will not
  4646.  generate an error message.
  4647.  
  4648.  
  4649.  131. FWAIT Prefixes Generated for Processor Control Instructions
  4650.  
  4651.  Product Version(s): 5.10   | 5.10
  4652.  Operating System:   MS-DOS | OS/2
  4653.  Flags: ENDUSER | buglist5.10
  4654.  Last Modified: 12-JAN-1989    ArticleIdent: Q34774
  4655.  
  4656.  For a 80287 or 80387, MASM should not be generating FWAIT prefixes for
  4657.  processor control instructions that do not have no-wait forms,
  4658.  including the following:
  4659.  
  4660.  FLDCW, FLDENV, FRSTOR, FINCSTP, FDECSTP, FFREE, and FNOP.
  4661.  
  4662.  The following is an example of the wait incorrectly generated by MASM for
  4663.  the FLDCW instruction:
  4664.  
  4665.  .386
  4666.  .387
  4667.  .model small
  4668.  .data
  4669.  d1 dw 0
  4670.  .code
  4671.  fldcw d1
  4672.  end
  4673.  
  4674.  The fldcw generates the opcodes "9B D9 2D" when it should only
  4675.  generate "D9 2D" without the "9B" wait.
  4676.  
  4677.  Microsoft has confirmed this to be problem in Version 5.10. We are
  4678.  researching this problem and will post new information as it becomes
  4679.  available.
  4680.  
  4681.  
  4682.  132. MASM Generates Stack Overflow on Code with Redefinition
  4683.  
  4684.  Product Version(s): 5.10   | 5.10
  4685.  Operating System:   MS-DOS | OS/2
  4686.  Flags: ENDUSER | buglist5.10
  4687.  Last Modified: 12-JAN-1989    ArticleIdent: Q34930
  4688.  
  4689.  The following example causes MASM to generate the error message,
  4690.  "run-time error R6000 - stack overflow":
  4691.  
  4692.              .model   small
  4693.              .code
  4694.  
  4695.        xx    equ      <nop>
  4696.  
  4697.        xx    macro
  4698.              nop
  4699.              endm
  4700.  
  4701.              xx
  4702.  
  4703.              end
  4704.  
  4705.  The workaround is to remove the redefinition "xx".
  4706.  
  4707.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  4708.  researching this problem and will post new information as it becomes
  4709.  available.
  4710.  
  4711.  
  4712.  133. Segment Combine Type AT with Equate Variable Causes Problem
  4713.  
  4714.  Product Version(s): 5.10
  4715.  Operating System:   MS-DOS
  4716.  Flags: ENDUSER | buglist5.10
  4717.  Last Modified: 12-JAN-1989    ArticleIdent: Q34937
  4718.  
  4719.  The sample code below demonstrates a problem with the equate directive
  4720.  and the segment combine type AT.
  4721.  
  4722.  The segment bios_seg incorrectly evaluates to 0 in the mov
  4723.  instruction. If the equate statement is located before the bios-seg
  4724.  segment definition, the segment bios_seg correctly evaluates to 40h.
  4725.  
  4726.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  4727.  researching this problem and will post new information as it becomes
  4728.  available.
  4729.  
  4730.  The following is a sample code:
  4731.  
  4732.  code segment public 'code'
  4733.  assume cs:code
  4734.  
  4735.  bios_seg segment at BIOS
  4736.  
  4737.  bios_seg ends
  4738.  
  4739.  BIOS  equ 40h
  4740.  
  4741.  start:
  4742.    mov ax,bios_seg
  4743.  
  4744.  code ends
  4745.  end start
  4746.  
  4747.  
  4748.  134. Multiple Communal Definitions Incorrectly Allowed
  4749.  
  4750.  Product Version(s): 5.10   | 5.10
  4751.  Operating System:   MS-DOS | OS/2
  4752.  Flags: ENDUSER | buglist5.10
  4753.  Last Modified: 12-JAN-1989    ArticleIdent: Q34979
  4754.  
  4755.  MASM is incorrectly allowing multiple communal definitions of a single
  4756.  variable. The COMDEF record produced by MASM in the object module
  4757.  contains the definition from the last COMM directive. The problem
  4758.  occurs on code similar to the following:
  4759.  
  4760.  comm c1:byte:44
  4761.  comm far c1:byte:22
  4762.  comm far c1:byte:11
  4763.  comm c1:byte:33
  4764.  
  4765.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  4766.  researching this problem and will post new information as it becomes
  4767.  available.
  4768.  
  4769.  
  4770.  135. MASM 5.10 MACRO.DOC: Calling Macros in DOS.INC, BIOS.INC
  4771.  
  4772.  Product Version(s): 5.10   | 5.10
  4773.  Operating System:   MS-DOS | OS/2
  4774.  Flags: ENDUSER |
  4775.  Last Modified: 12-JAN-1989    ArticleIdent: Q34466
  4776.  
  4777.  The following information was taken from the MASM 5.10 MACRO.DOC file.
  4778.  
  4779.  Calling Macros in DOS.INC and BIOS.INC
  4780.  
  4781.  You are responsible for saving and restoring registers used in macros.
  4782.  The "Registers used" field identifies registers to save.
  4783.  
  4784.  Macros that accept address parameters use internal macros that allow
  4785.  you to specify addresses in several ways. The macro automatically
  4786.  identifies the type of the argument and handles it appropriately. For
  4787.  example, assume the following declarations:
  4788.  
  4789.    String    DB   "test$"
  4790.    pString   DW   Str
  4791.    fpString  DD   Str
  4792.  
  4793.  Given these values, the macro @DispStr (which displays the string at
  4794.  DS:DX) has the following effects:
  4795.  
  4796.    Kind of argument          Example               Value loaded
  4797.  
  4798.    Label of byte variable    @DispStr String       DS:OFFSET String
  4799.    Near pointer variable     @DispStr pString      DS:pString
  4800.    Far pointer variable      @DispStr fpString
  4801.    fpString[2]:fpString[0]
  4802.    Constant                  @DispStr 0            DS:0
  4803.    Pointer in register       @DispStr si           DS:SI
  4804.    Near Pointer with segment @DispStr pString,es   ES:pString
  4805.    Constant with segment     @DispStr 0,es         ES:0
  4806.    Register with segment     @DispStr di,es        ES:DI
  4807.  
  4808.  Note that if a far pointer or a segment is given, DS must be saved
  4809.  before the macro call and restored afterward. Segments may be given as
  4810.  registers, constants, or word variables.
  4811.  
  4812.  In syntax, parameters enclosed in brackets are optional. Paramaters
  4813.  sometimes have a leading symbol to indicate that the argument must
  4814.  have a certain type, as shown below:
  4815.  
  4816.    Leading Symbol   Example      Limitation
  4817.  
  4818.          #          #return      Must be constant
  4819.          &          &vector      Must be offset address as described
  4820.                                  above
  4821.          $          $terminator  May be constant or register, but not
  4822.                                  memory
  4823.  
  4824.  Parameters with no leading symbol may be constants, registers, or
  4825.  variables. Parameters are 16-bit except where noted in the
  4826.  description.
  4827.  
  4828.  Symbols must be previously defined before they can be passed as
  4829.  arguments to most of the DOS macros. Generally this means that data
  4830.  must be declared before code in the source file.
  4831.  
  4832.  
  4833.  136. MASM 5.10 MACRO.DOC: DOS Macro Syntax and Description
  4834.  
  4835.  Product Version(s): 5.10   | 5.10
  4836.  Operating System:   MS-DOS | OS/2
  4837.  Flags: ENDUSER |
  4838.  Last Modified: 12-JAN-1989    ArticleIdent: Q34467
  4839.  
  4840.  The following information was taken from the MASM 5.10 MACRO.DOC file.
  4841.  
  4842.  DOS Macro Syntax and Description
  4843.  
  4844.  KEYBOARD INPUT
  4845.  
  4846.  @GetKey (01h, 07h, 08h, 0Ch)
  4847.  
  4848.  Gets a keystroke from the keyboard
  4849.  
  4850.  Syntax:         @GetKey [#echo] [,[#break] [,#clearbuf]]
  4851.  
  4852.  Arguments:      echo        = nonzero to echo keystroke -
  4853.                                default yes
  4854.                  break       = nonzero to accept Control-C - default
  4855.                                yes
  4856.                  clearbuf    = nonzero to clear keyboard buffer -
  4857.                                default no
  4858.                  (Arguments may be omitted to get defaults)
  4859.  Return:         ASCII code of key in AL
  4860.  Registers used: AX used for all, DL used if echo on and ctrl
  4861.  -c off
  4862.  
  4863.  @GetStr (0Ah)
  4864.  
  4865.  Gets a string from the keyboard
  4866.  
  4867.  Syntax:         @GetStr &buffer [,[$terminator] [,[#limit]
  4868.  [,segment]]]
  4869.  
  4870.  Arguments:      buffer      = Offset of buffer where string will
  4871.                                be stored
  4872.                      Byte 1  = Maximum length of string (before call)
  4873.                      Byte 2  = Actual length of string (after call)
  4874.                      Byte 3+ = Bytes of string
  4875.                  terminator  = Terminating byte - usually null (0) or
  4876.  $ (24h)
  4877.                  limit       = Maximum length of string (if not given
  4878.                                as argument, must be in buffer before
  4879.                                macro call)
  4880.                  segment     = Segment of buffer (DS if not given)
  4881.  Return:         Pointer to string in SI, length of string in BX
  4882.  Registers used: AX, DX, BX, SI
  4883.  
  4884.  
  4885.  137. Misleading Error Message, A2102, on USE16 Segment
  4886.  
  4887.  Product Version(s): 5.10   | 5.10
  4888.  Operating System:   MS-DOS | OS/2
  4889.  Flags: ENDUSER | docerr
  4890.  Last Modified: 12-JAN-1989    ArticleIdent: Q34985
  4891.  
  4892.  The error message A2102, Segment near (or at) 64K limit, is displayed
  4893.  when a USE16 data segment exceeds 64K. The documentation refers to the
  4894.  80286's problem with code segments larger than 65500, which is
  4895.  misleading.
  4896.  
  4897.  
  4898.  138. MASM 5.10 MACRO.DOC: Device I/O
  4899.  
  4900.  Product Version(s): 5.10   | 5.10
  4901.  Operating System:   MS-DOS | OS/2
  4902.  Flags: ENDUSER |
  4903.  Last Modified: 12-JAN-1989    ArticleIdent: Q34469
  4904.  
  4905.  The following information was taken from the MASM 5.10 MACRO.DOC file.
  4906.  
  4907.  DEVICE I/O
  4908.  
  4909.  @Read (3Fh)
  4910.  
  4911.  Reads data from a file or device
  4912.  
  4913.  Syntax:         @Read &buffer, length [,[handle] [,segment]]
  4914.  
  4915.  Arguments:      buffer      = Offset of buffer where data will
  4916.                                be stored
  4917.                  length      = Length of data in bytes
  4918.                  handle      = File or device handle; if none given,
  4919.                                keyboard (handle 0) is assumed
  4920.                  segment     = Segment of address string (DS if not
  4921.                                given)
  4922.  Return:         If carry clear, bytes read in AX
  4923.  Registers used: Always AX, DX, BX, and CX; DS if segment
  4924.                  changed
  4925.  
  4926.  @Write (40h)
  4927.  
  4928.  Writes data to a file or device
  4929.  
  4930.  Syntax:         @Write &buffer, length, [,[handle] [,segment]]
  4931.  
  4932.  Arguments:      buffer      = Offset of buffer where data is
  4933.                                stored
  4934.                  length      = Length of data in bytes
  4935.                  handle      = File or device handle; if none given,
  4936.  screen
  4937.                                (handle 1) is assumed
  4938.                  segment     = Segment of address string (DS if not
  4939.                                given)
  4940.  Return:         If carry clear, bytes written in AX
  4941.  Registers used: Always AX, DX, BX, and CX; DS if segment
  4942.                  changed
  4943.  
  4944.  
  4945.  139. MASM 5.10 MACRO.DOC: File Control
  4946.  
  4947.  Product Version(s): 5.10   | 5.10
  4948.  Operating System:   MS-DOS | OS/2
  4949.  Flags: ENDUSER |
  4950.  Last Modified: 12-JAN-1989    ArticleIdent: Q34470
  4951.  
  4952.     The following information was taken from the MASM 5.10 MACRO.DOC
  4953.  file.
  4954.  
  4955.  FILE CONTROL
  4956.  
  4957.  @MakeFil (3Ch, 5Ah, 5Bh)
  4958.  
  4959.  Creates a file
  4960.  
  4961.  Syntax:         @MakeFil &path [,[attrib] [,[segment] [,#kind]]]
  4962.  
  4963.  Arguments:      path        = ASCIIZ string of file
  4964.                  attrib      = File atrribute (0 is default if none
  4965.                                given)
  4966.                  segment     = Segment of address string (DS if not
  4967.                                given)
  4968.                  kind        = If none given, a file is always
  4969.                                created even if one already exists. Under
  4970.                                DOS 3+ "tmp" can be given to create a
  4971.                                unique file or "new" to create file only
  4972.                                if one doesn't already exist.
  4973.  Return:         If carrry clear, file handle in AX
  4974.  Registers used: Always AX, DX, and CX; DS if segment changed
  4975.  
  4976.  @OpenFil (3Dh)
  4977.  
  4978.  Opens a file for input or output
  4979.  
  4980.  Syntax:         @OpenFil &path, #access [,segment]
  4981.  
  4982.  Arguments:      path        = ASCIIZ string of file
  4983.                  access      = File access code
  4984.                  segment     = Segment of address string (DS if not
  4985.  given)
  4986.  Return:         If carrry set, error code in AX
  4987.  Registers used: Always AX and DX; DS if segment changed
  4988.  
  4989.  @ClosFil (3Eh)
  4990.  
  4991.  Closes an open file handle
  4992.  
  4993.  Syntax:         @ClosFil handle
  4994.  
  4995.  Arguments:      handle      = Previously opened file handle
  4996.  Return:         If carrry set, error code in AX
  4997.  Registers used: AX and BX
  4998.  
  4999.  @DelFil (41h)
  5000.  
  5001.  Deletes a specified file
  5002.  
  5003.  Syntax:         @DelFil &path [,segment]
  5004.  
  5005.  Arguments:      path        = Offset of ASCIIZ filespec
  5006.                  segment     = Segment of path (DS if none given)
  5007.  Return:         If carrry set, error code in AX
  5008.  Registers used: AX and DX; DS if segment changed
  5009.  
  5010.  @MoveFil (56h)
  5011.  
  5012.  Moves or renames a file by changing its path specification.
  5013.  
  5014.  Syntax:         @MoveFil &old, &new [,[segold] [,segnew]]
  5015.  
  5016.  Arguments:      old         = Offset of file spec to be renamed
  5017.                  new         = Offset of new file spec
  5018.                  segold      = Segment of old name (DS if none given)
  5019.                  segnew      = Segment of new name (ES if none given)
  5020.  Return:         If carry set, error code in AX
  5021.  Registers used: AX, DX, and DI; DS and ES if corresponding
  5022.  segments changed
  5023.  
  5024.  @GetFirst (4Eh) and @GetNext (4Fh)
  5025.  
  5026.  Parses file specifications (optionally including wild cards)
  5027.  into file names
  5028.  
  5029.  Syntax:         @GetFirst &path [,[attribute] [,segment]]
  5030.                  @GetNext
  5031.  
  5032.  Arguments:      path        = Offset of ASCIIZ filespec (can
  5033.                                have wild cards)
  5034.                  attribute   = File attribute to search for (0 for
  5035.                                normal if none given)
  5036.                  segment     = Segment of path (DS if none given)
  5037.  Return:         If carrry set, error code in AX
  5038.  Registers used: @GetFirst   = AX, CX, and DX; DS if segment
  5039.  changed
  5040.                  @GetNext    = AX only
  5041.  
  5042.  @GetDTA (1Ah) and @SetDTA (2Fh)
  5043.  
  5044.  Gets or sets the Disk Transfer Address (DTA)
  5045.  
  5046.  Syntax:         @GetDTA
  5047.                  @SetDTA &buffer [,segment]
  5048.  
  5049.  Arguments:      buffer      = Offset of new DTA buffer
  5050.                  segment     = Segment of new DTA buffer (DS if none
  5051.  given)
  5052.  Return:         @GetDTA     = ES:BX points to DTA
  5053.                  @SetDTA     = None
  5054.  Registers used: AX for both; DS and DX for @SetDTA; ES and
  5055.  BX for @GetDTA
  5056.  
  5057.  @GetFilSz (42h)
  5058.  
  5059.  Gets the file size by moving the file pointer to end of the
  5060.  file. Note that the file pointer is reset to zero. Thus this macro
  5061.  should not be called during operations that move the pointer.
  5062.  
  5063.  Syntax:         @GetFilSz handle
  5064.  
  5065.  Arguments:      handle      = Previously opened file handle
  5066.  Return:         If carrry clear, file length in DX:AX
  5067.  Registers used: AX, BX, CX, and DX
  5068.  
  5069.  @MovePrtAbs and @MovePtrRel (42h)
  5070.  
  5071.  Moves the file pointer in an open file. The pointer can be
  5072.  moved to an absolute position, or relative to its current position.
  5073.  
  5074.  Syntax:         @MovePrtAbs handle [,distance]
  5075.                  @MovePrtRel handle [,distance]
  5076.  
  5077.  Arguments:      handle      = Previously opened file handle
  5078.                  distance    = Distance to move pointer - must be a
  5079.                                16-bit constant or a 16- or 32-bit variable;
  5080.                                or leave blank and set distance in CX:DX
  5081.                                before macro call
  5082.  Return:         If carrry clear, file pointer position in DX:AX
  5083.  Registers used: AX, BX, CX, and DX
  5084.  
  5085.  
  5086.  140. MASM 5.10 MACRO.DOC: Directory Control
  5087.  
  5088.  Product Version(s): 5.10   | 5.10
  5089.  Operating System:   MS-DOS | OS/2
  5090.  Flags: ENDUSER |
  5091.  Last Modified: 12-JAN-1989    ArticleIdent: Q34471
  5092.  
  5093.  The following information was taken from the MASM 5.10 MACRO.DOC file.
  5094.  
  5095.  DIRECTORY CONTROL
  5096.  
  5097.  @MkDir, (39h), @RmDir (3Ah), and @ChDir (3Bh)
  5098.  
  5099.  Creates, deletes, or changes to the specified directory
  5100.  
  5101.  Syntax:         @MkDir &path [,segment]
  5102.                  @RmDir &path [,segment]
  5103.                  @ChDir &path [,segment]
  5104.  
  5105.  Arguments:      path        = Offset of ASCIIZ string to
  5106.                  segment     = Segment of path (DS if none given)
  5107.  Return:         If carrry set, error code in AX
  5108.  Registers used: AX and DX; DS if segment changed
  5109.  
  5110.  @GetDir (47h)
  5111.  
  5112.  Returns the current directory of the specified drive
  5113.  
  5114.  Syntax:         @GetDir &path [,[drive] [,segment]]
  5115.  
  5116.  Arguments:      buffer      = Offset of buffer to receive ASCIIZ
  5117.  directory
  5118.                  drive       = 8-bit drive number - 0=current, 1=A,
  5119.  2=B,    etc.
  5120.                                (0 if none given)
  5121.                  segment     = Segment of path (DS if none given)
  5122.  Return:         If carrry set, error code in AX
  5123.  Registers used: AX, SI, and DL; DS if segment changes
  5124.  
  5125.  
  5126.  141. MASM 5.10 MACRO.DOC: Drive Control
  5127.  
  5128.  Product Version(s): 5.10   | 5.10
  5129.  Operating System:   MS-DOS | OS/2
  5130.  Flags: ENDUSER |
  5131.  Last Modified: 12-JAN-1989    ArticleIdent: Q34472
  5132.  
  5133.  The following information was taken from the MASM 5.10 MACRO.DOC file.
  5134.  
  5135.  DRIVE CONTROL
  5136.  
  5137.  @GetDrv (0Eh) and @SetDrv (19h)
  5138.  
  5139.  Gets or sets the current drive
  5140.  
  5141.  Syntax:         @GetDrv
  5142.                  @SetDrv drive
  5143.  
  5144.  Argument:       drive       = 8-bit drive number (0=A, 1=B,
  5145.  etc.)
  5146.  Return:         @GetDrv     = Drive number in AL (0=A, 1=B,
  5147.  etc.)
  5148.                  @SetDrv     = Number of drives in AL
  5149.  Registers used: AX for both; DL for @SetDrv
  5150.  
  5151.  @ChkDrv (36h)
  5152.  
  5153.  Gets various data about a disk
  5154.  
  5155.  Syntax:         @ChkDrv [drive]
  5156.  
  5157.  Argument:       drive       = 8-bit drive number (0=current,A=1,
  5158.                                B=2, etc.); if none given, current
  5159.                                assumed
  5160.  Return:         AX          = Sectors per cluster (-1 if drive
  5161.                                invalid)
  5162.                  BX          = Available clusters
  5163.                  CX          = Bytes per sector
  5164.                  DX          = Clusters per drive
  5165.  Registers used: AX, BX, CX, and DX
  5166.  
  5167.  
  5168.  142. MASM 5.10 MACRO.DOC: Miscellaneous
  5169.  
  5170.  Product Version(s): 5.10   | 5.10
  5171.  Operating System:   MS-DOS | OS/2
  5172.  Flags: ENDUSER |
  5173.  Last Modified: 12-JAN-1989    ArticleIdent: Q34473
  5174.  
  5175.  The following information was taken from the MASM 5.10 MACRO.DOC file.
  5176.  
  5177.  MISCELLANEOUS
  5178.  
  5179.  @GetDate (2Ah) and @SetDate (2Bh)
  5180.  
  5181.  Gets or sets the system date
  5182.  
  5183.  Syntax:         @GetDate
  5184.                  @SetDate month, day, year
  5185.  
  5186.  Arguments:      year        = 16-bit year (1980-2099)
  5187.                  month       = 8-bit month (1-12)
  5188.                  day         = 8-bit day (1-31)
  5189.  Return:         For @GetDate:
  5190.                          AL  = Day of week (0 = Sunday, 1 = Monday, etc.)
  5191.                          CX  = Year (1980-2099)
  5192.                          DL  = Month (1-12)
  5193.                          DH  = Day (1-31)
  5194.                  For @SetDate:
  5195.                          AL  = If date was valid 0, else -1
  5196.  Registers used: AX, CX, and DX
  5197.  
  5198.  @GetTime (2Ch) and @SetTime (2Dh)
  5199.  
  5200.  Gets or sets the system time
  5201.  
  5202.  Syntax:         @GetTime
  5203.                  @SetTime hour,minute,second,hundredth
  5204.  
  5205.  Arguments:      hour        = 8-bit hour (0-23)
  5206.                  minute      = 8-bit hour (0-59)
  5207.                  second      = 8-bit hour (0-59)
  5208.                  hundredth   = 8-bit hour (0-99)
  5209.  Return:         For @GetTime:
  5210.                          CL  = Hour (0-23)
  5211.                          CH  = Minute (0-59)
  5212.                          DL  = Second (0-59)
  5213.                          DH  = Hundredth (0-99)
  5214.                  For @SetTime:
  5215.                          AL  = If time was valid 0, else -1
  5216.  Registers used: AX, CX, and DX
  5217.  
  5218.  @GetVer (30h)
  5219.  
  5220.  Gets the DOS version
  5221.  
  5222.  Syntax:         @GetVer
  5223.  
  5224.  Argument:       None
  5225.  Return:         AL          = Major version (0 for versions prior to
  5226.                                2.0)
  5227.                  AH          = Minor version
  5228.                  BH          = OEM serial number
  5229.                  BL:CX       = 24-bit user number
  5230.  Register used:  AX, BX, and CX
  5231.  
  5232.  @GetInt (35h) and @SetInt (25h)
  5233.  
  5234.  Gets or sets the vector for a specified interrupt routine
  5235.  
  5236.  Syntax:         @GetInt #interrupt
  5237.                  @SetInt #interrupt, &vector [,segment]
  5238.  
  5239.  Arguments:      interrupt   = 8-bit interrupt number
  5240.                  vector      = Offset of interrupt routine
  5241.                  segment     = Segment of routine - if none given, DS
  5242.                                assumed for data; segment ignored for
  5243.                                code labels
  5244.  Return:         @GetInt     = None
  5245.                  @SetInt     = ES:BX points to interrupt routine
  5246.  Registers used: AX for both; ES and BX for @GetInt; DS and
  5247.  DS for @SetInt
  5248.  
  5249.  
  5250.  143. Mixing \ and / in Command Line Causes Problems
  5251.  
  5252.  Product Version(s): 5.10   | 5.10
  5253.  Operating System:   MS-DOS | OS/2
  5254.  Flags: ENDUSER | buglist5.10 | fixlist5.10A
  5255.  Last Modified: 10-JUL-1990    ArticleIdent: Q34500
  5256.  
  5257.  When mixing \ and / on the MASM command line, MASM will sometimes give
  5258.  incorrect results and hang. The following command line causes these
  5259.  problems (the command lines are broken up for readability only):
  5260.  
  5261.  masm
  5262.       -I\sl200qr\sl
  5263.       -Mx
  5264.       -DVERS_DDQR
  5265.       -I\sl200qr/sl/cmerge/src/Common
  5266.         \sl200qr/sl/cmerge/src/Common/comsup.asm ;
  5267.  
  5268.  The command line causes the option -Mx to be ignored. MASM also hangs
  5269.  on some assembler files.
  5270.  
  5271.  In this case, MASM was incorrectly extracting the base name; it wrote
  5272.  the full path into an array big enough only for an 8.3 filename, thus
  5273.  overwriting many global flags.
  5274.  
  5275.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  5276.  researching this problem and will post new information as it becomes
  5277.  available.
  5278.  
  5279.  
  5280.  
  5281.  144. word Causes "Illegal Operand Size" Warning
  5282.  
  5283.  Product Version(s): 5.10   | 5.10
  5284.  Operating System:   MS-DOS | OS/2
  5285.  Flags: ENDUSER |
  5286.  Last Modified: 12-JAN-1989    ArticleIdent: Q34501
  5287.  
  5288.  The following command causes the warning "illegal operand size:"
  5289.  
  5290.  lds  dx, word ptr [bp+6]
  5291.  
  5292.  However, using dword assembles clean.
  5293.  
  5294.  The line is from the code below. The procedure foo function
  5295.  receives a pointer to a string and writes it to the screen.
  5296.  
  5297.  It accept dword and not word because the LDS assembler instruction
  5298.  reads and stores a far pointer specified by the source-memory operand.
  5299.  Using the word type should cause a warning with small model.
  5300.  The following sample code demonstrates the problem:
  5301.  
  5302.   .model     medium
  5303.  
  5304.   .code
  5305.              PUBLIC  _foo
  5306.  _foo        PROC
  5307.              push    bp
  5308.              mov     bp, sp
  5309.  
  5310.              lds     dx, word ptr [bp+6]    ;causes 'illegal operand size'.
  5311.                                             ;but not with use of 'dword'
  5312.  
  5313.              mov     ah, 40h
  5314.              mov     bx, 1
  5315.              mov     cx, 17
  5316.              int     21h
  5317.  
  5318.              pop     bp
  5319.              ret
  5320.  _foo        ENDP
  5321.              END
  5322.  
  5323.  
  5324.  145. Proc Directive Will Not Work with Structure Type
  5325.  
  5326.  Product Version(s): 5.10   | 5.10
  5327.  Operating System:   MS-DOS | OS/2
  5328.  Flags: ENDUSER | docerr
  5329.  Last Modified: 12-JAN-1989    ArticleIdent: Q34503
  5330.  
  5331.  Page 38 of the "Microsoft Macro Assembler 5.10 Update" guide
  5332.  incorrectly states that "the type is the type of the argument and may
  5333.  be word, dword, fword, qword, tbyte or the name of a structure defined
  5334.  by a STRUC structure declaration."
  5335.  
  5336.  The support of the STRUC type has not been added to MASM Version 5.10.
  5337.  Microsoft will correct the documentation in the next release.
  5338.  
  5339.  The following program illustrates the use of the STRUC type
  5340.  that is not supported:
  5341.  
  5342.  .model small,c
  5343.  .data
  5344.  t1 STRUC
  5345.    f1  dw 0
  5346.  t1 ENDS
  5347.  .code
  5348.  h1  PROC arg1:t1
  5349.  end
  5350.  
  5351.  To work around this problem, use the PTR type in the Proc argument.
  5352.  Instead of using
  5353.  
  5354.  h1 PROC arg1:t1
  5355.  
  5356.  the procedure should be declared as follows:
  5357.  
  5358.  h1 PROC arg1:PTR t1
  5359.  
  5360.  No syntax checking is done on t1.
  5361.  
  5362.  
  5363.  146. MASM 5.10 MACRO.DOC: Character and Cursor Control
  5364.  
  5365.  Product Version(s): 5.10   | 5.10
  5366.  Operating System:   MS-DOS | OS/2
  5367.  Flags: ENDUSER |
  5368.  Last Modified: 12-JAN-1989    ArticleIdent: Q34575
  5369.  
  5370.  The following information was taken from the MASM Version 5.10
  5371.  MACRO.DOC file.
  5372.  
  5373.  CHARACTER AND CURSOR CONTROL
  5374.  
  5375.  @GetCur (I 10h F 04h)
  5376.  
  5377.  Gets the cursor position and size
  5378.  
  5379.  Syntax:         @GetCur [page]
  5380.  
  5381.  Arguments:      page        = 8-bit page with cursor (if none, 0
  5382.  assumed)
  5383.  Return:         DL          = Column
  5384.                  DH          = Row
  5385.                  CL          = Starting scan line
  5386.                  CH          = Ending scan line
  5387.  Registers used: AX, DX, CX, and BH
  5388.  
  5389.  @SetCurPos (I 10h F 02h)
  5390.  
  5391.  Sets the cursor position
  5392.  
  5393.  Syntax:         @SetCurSz [column] [,[row] [,page]]
  5394.  
  5395.  Arguments:      column      = 8-bit column; if none, DL used
  5396.                  row         = 8-bit row; if none, DH used
  5397.                  page        = 8-bit page with cursor (if none, 0
  5398.                                assumed)
  5399.  Return:         none
  5400.  Registers used: AX, DX, and BH
  5401.  
  5402.  @SetCurSz (I 10h F 01h)
  5403.  
  5404.  Sets the cursor size and shape by specifying active scan lines. The
  5405.  CGA adapter the lines are 0-7. The monochrome adapter has lines
  5406.  0-13.
  5407.  
  5408.  Syntax:         @SetCurSz startline, endline
  5409.  
  5410.  Arguments:      startline   = 8-bit starting scan line (default C
  5411.  GA=6; MA=12)
  5412.                  endline     = 8-bit ending scan line (default CGA=7;
  5413.  MA=13)
  5414.  Return:         none
  5415.  Registers used: AX and CX
  5416.  
  5417.  @GetChAtr (I 10h F 08h)
  5418.  
  5419.  Gets the character and attribute at the cursor location
  5420.  
  5421.  Syntax:         @GetChAtr [page]
  5422.  
  5423.  Arguments:      page        = 8-bit page to check (if none, 0
  5424.  assumed)
  5425.  Return:         AH          = Attribute
  5426.                  AL          = ASCII character
  5427.  Registers used: AX and BH
  5428.  
  5429.  @PutChAtr (I 10h F 09h) and @PutCh (I 10h F 0Ah)
  5430.  
  5431.  Puts one or more characters and attributes at the current cursor
  5432.  position. For @PutCh, the current attribute is used in text modes and
  5433.  any specified attribute is ignored.
  5434.  
  5435.  Syntax:         @PutChAtr [character] [,[attrib] [,[page]
  5436.  [,count]]]
  5437.  
  5438.  Arguments:      character   = 8-bit ASCII character to put; if
  5439.                                none, AL used
  5440.  
  5441.                  attrib      = 8-bit attribute to put; if none, BL
  5442.                                used
  5443.                  page        = 8-bit page to put on (if none, 0
  5444.                                assumed)
  5445.                  count       = Number to put (if none, 1 assumed)
  5446.  Return:         AH          = Attribute
  5447.                  AL          = ASCII character
  5448.  Registers used: AX, BX, CX
  5449.  
  5450.  @Scroll (I 10h F 06h and 07h)
  5451.  
  5452.  Scrolls a specified window up or down
  5453.  
  5454.  Syntax:         @Scroll dist [,[attr] [,[uprow [,[upcol [,[dnrow]
  5455.                  [,dncol]]]]]
  5456.  Arguments:      dist        = 8-bit number of lines to scroll;
  5457.                                positive scrolls down; negative scrolls
  5458.                                up; 0 clears
  5459.                  attr        = 8-bit attribute for blank lines (if
  5460.                                none, 07h)
  5461.                  uprow       = Upper left row (if none, CH used)
  5462.                  upcol       = Upper left column (if none, CL used)
  5463.                  dnrow       = Lower right row (if none, DH used)
  5464.                  dncol       = Lower right column (if none, DL used)
  5465.  Return:         none
  5466.  Registers used: AX, CX, DX, and BH
  5467.  
  5468.  @Cls (I 10h F 06, 08h, and 02h)
  5469.  
  5470.  Clears the screen of the current page
  5471.  
  5472.  Syntax:         @Cls
  5473.  
  5474.  Arguments:      None
  5475.  Return:         None
  5476.  Registers used: AX, BX, CX, and DX
  5477.  
  5478.  
  5479.  147. MASM 5.10 MACRO.DOC: Memory Control
  5480.  
  5481.  Product Version(s): 5.10   | 5.10
  5482.  Operating System:   MS-DOS | OS/2
  5483.  Flags: ENDUSER |
  5484.  Last Modified: 12-JAN-1989    ArticleIdent: Q34576
  5485.  
  5486.  The following information was taken from the MASM Version 5.10
  5487.  MACRO.DOC file.
  5488.  
  5489.  MEMORY CONTROL
  5490.  
  5491.  @FreeBlok (49h)
  5492.  
  5493.  Frees a block of memory
  5494.  
  5495.  Syntax:         @FreeBlok [segment]
  5496.  
  5497.  Argument:       segment     = Starting address of memory to be
  5498.                                freed; if none, ES address assumed
  5499.  Return:         If carry set, error code in AX
  5500.  Register used:  AX; ES if segment given
  5501.  
  5502.  @GetBlok (48h)
  5503.  
  5504.  Allocates a block of memory
  5505.  
  5506.  Syntax:         @GetBlok paragraphs
  5507.  
  5508.  Argument:       paragraphs  = Paragraphs (16 bytes) of memory
  5509.  wanted
  5510.  Return:         AX and ES   = Segment address of allocated
  5511.  memory
  5512.                  BX          = Paragraphs actually allocated (may be
  5513.                                less than requested if memory is short)
  5514.  Register used:  AX and BX
  5515.  
  5516.  @ModBlok (48h)
  5517.  
  5518.  Modifies an allocated block of memory
  5519.  
  5520.  Syntax:         @ModBlok paragraphs [,segment]
  5521.  
  5522.  Argument:       paragraphs  = Paragraphs (16 bytes) of memory
  5523.  wanted
  5524.                  segment     = Starting address of memory to be
  5525.  freed;
  5526.                                if none, ES address assumed
  5527.  Return:         If carry set, error code in AX, else:
  5528.                          ES  = Segment address of allocated memory
  5529.                          BX  = If carry is clear, paragraphs allocated
  5530.  Register used:  AX and BX; ES if segment given
  5531.  
  5532.  
  5533.  148. MASM 5.10 MACRO.DOC: Output
  5534.  
  5535.  Product Version(s): 5.10   | 5.10
  5536.  Operating System:   MS-DOS | OS/2
  5537.  Flags: ENDUSER |
  5538.  Last Modified: 12-JAN-1989    ArticleIdent: Q34577
  5539.  
  5540.  The following information was taken from the MASM Version 5.10
  5541.  MACRO.DOC file.
  5542.  
  5543.  OUTPUT
  5544.  
  5545.  @DispCh (02h)
  5546.  
  5547.  Displays one or more characters to screen
  5548.  
  5549.  Syntax:         @DispCh char [,char]...
  5550.  
  5551.  Arguments:      char        = 8-bit ASCII code
  5552.  Return:         Code in AL
  5553.  Registers used: AX and DL
  5554.  
  5555.  @PrtCh (05h)
  5556.  
  5557.  Prints one or more characters to LPT1
  5558.  
  5559.  Syntax:         @PrtCh char [,char]...
  5560.  
  5561.  Arguments:      char        = 8-bit ASCII code
  5562.  Return:         Code in AL
  5563.  Registers used: AX and DL
  5564.  
  5565.  @DispStr (09h)
  5566.  
  5567.  Displays a $-terminated string
  5568.  
  5569.  Syntax:         @DispStr &address [,segment]
  5570.  
  5571.  Arguments:      address     = Address of string terminated by
  5572.  "$" (24h)
  5573.                  segment     = Segment of address string (DS if not
  5574.  given)
  5575.  Return:         None
  5576.  Registers used: AX and DS
  5577.  
  5578.  
  5579.  149. Nested Dups in Structure Cause Recursive Loop
  5580.  
  5581.  Product Version(s): 5.10   | 5.10
  5582.  Operating System:   MS-DOS | OS/2
  5583.  Flags: ENDUSER | buglist5.10
  5584.  Last Modified: 12-JAN-1989    ArticleIdent: Q35113
  5585.  
  5586.  The following code uses nested dup operators in a structure
  5587.  initialization:
  5588.  
  5589.  seltable SELENTRY MINSELS/4 dup (,.,3 dup (<SEL_UNUSED>))
  5590.  
  5591.  MASM goes into a recursive loop at the calculation of the size. You
  5592.  can work around this problem by having three instances listed, as
  5593.  follows:
  5594.  
  5595.  seltable SELENTRY MINSELS/4 dup (<>,<SEL_UNUSED>,<SEL_UNUSED>,
  5596.     <SEL_UNUSED>)
  5597.  
  5598.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  5599.  researching this problem and will post new information as it becomes
  5600.  available.
  5601.  
  5602.  
  5603.  150. Comparison of a Constant and a Relocatable Are Not Allowed
  5604.  
  5605.  Product Version(s): 5.10   | 5.10
  5606.  Operating System:   MS-DOS | OS/2
  5607.  Flags: ENDUSER |
  5608.  Last Modified: 12-JAN-1989    ArticleIdent: Q35114
  5609.  
  5610.  The comparison of a constant (left-hand side) and a relocatable
  5611.  (right-hand side) are not allowed. The following is an example:
  5612.  
  5613.  .errnz 0FFFFh-(MAXSELS * size SELENTRY) GT seltable-1
  5614.  
  5615.  A workaround for this problem that will direct the assembler to
  5616.  generate the correct opcodes is to use the segment name that contains
  5617.  the structure seltable, as follows:
  5618.  
  5619.  .errnz data:0FFFFh-(MAXSELS * size SELENTRY) GT seltable -1
  5620.  
  5621.  
  5622.  151. Line Parsing Order for MASM: Looks Up Second Token First
  5623.  
  5624.  Product Version(s): 5.x    | 5.10
  5625.  Operating System:   MS-DOS | OS/2
  5626.  Flags: ENDUSER |
  5627.  Last Modified: 12-JAN-1989    ArticleIdent: Q35128
  5628.  
  5629.  The Microsoft Macro Assembler always looks up the second token on the
  5630.  line first. In the case below, it sees "specb". Because that is a
  5631.  structure definition, MASM assumes the line declares a structure
  5632.  instance with "MOV" being the label. At this point, MASM errors on
  5633.  trying to use reserved symbol "MOV" as a structure instance label. The
  5634.  assumption is reasonable and would be hard to modify the way MASM
  5635.  parses.
  5636.  
  5637.  The following sample code demonstrates the problem:
  5638.  
  5639.  _DATA SEGMENT
  5640.  specb STRUC
  5641.          buff  DW  ?
  5642.  specb ENDS
  5643.  _DATA ENDS
  5644.  
  5645.  _CODE SEGMENT
  5646.  ASSUME CS:code
  5647.  start:
  5648.      mov specb.buff,AX
  5649.  _CODE ENDS
  5650.  
  5651.  END start
  5652.  
  5653.  
  5654.  152. Proc Directive with Uses Option and Nine Registers
  5655.  
  5656.  Product Version(s): 5.10   | 5.10
  5657.  Operating System:   MS-DOS | OS/2
  5658.  Flags: ENDUSER | SR# G880831-2870 buglist5.10
  5659.  Last Modified: 13-JAN-1989    ArticleIdent: Q35214
  5660.  
  5661.  The assembler fragment (for MASM Version 5.10) below displays two
  5662.  problems when assembled.
  5663.  
  5664.  The problem seems to be the use of more than eight registers in a
  5665.  "proc uses" clause.
  5666.  
  5667.  A workaround for this problem is to specify only eight registers in
  5668.  the uses option and include in your procedure the pushes and pops for
  5669.  any other registers to be saved.
  5670.  
  5671.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  5672.  researching this problem and will post new information as it becomes
  5673.  available.
  5674.  
  5675.  The following assembler fragment demonstrates this problem:
  5676.  
  5677.  foo proc uses ax bx cx dx ds cs ss bp
  5678.  foo endp
  5679.  end
  5680.  
  5681.  When assembled as is, MASM returns an out of memory error:
  5682.  
  5683.  Microsoft (R) Macro Assembler Version 5.10
  5684.  Copyright (C) Microsoft Corp 1981, 1988.  All rights reserved.
  5685.  
  5686.  masm.err(12): Out of memory
  5687.  
  5688.  When assembled as a part of the complete module, it returns the error:
  5689.  
  5690.  Microsoft (R) Macro Assembler Version 5.10
  5691.  Copyright (C) Microsoft Corp 1981, 1988.  All rights reserved.
  5692.  
  5693.  rd.ASM(84): warning A4016: Reserved word used as symbol: BP
  5694.  rd.ASM(89): error A2009: Symbol not defined: BP(ASCII 016)
  5695.  
  5696.    47898 Bytes symbol space free
  5697.  
  5698.        1 Warning Errors
  5699.        1 Severe  Errors
  5700.  
  5701.  
  5702.  153. Real-Number Encoding Needs Exact Number of Digits
  5703.  
  5704.  Product Version(s): 5.10   | 5.10
  5705.  Operating System:   MS-DOS | OS/2
  5706.  Flags: ENDUSER | SR# S880913-6
  5707.  Last Modified: 12-JAN-1989    ArticleIdent: Q35507
  5708.  
  5709.  In MASM, real numbers are initialized by using DD, DQ, and DT
  5710.  directives. The number of digits for encoded numbers declared with DD,
  5711.  DQ, and DT must be 8, 16, and 20 digits, respectively. If a leading 0
  5712.  is supplied, the number must be 9, 17, or 21 digits.
  5713.  
  5714.  For example, the following MASM line generates the assembler
  5715.  warning A4057: Illegal size for operand:
  5716.  
  5717.  _x     DQ   0000000000r
  5718.  
  5719.  The real number should be defined with exactly 17 digits.
  5720.  MASM will correctly evaluate the constant, but the warning
  5721.  is telling the user the number of digits used is not correct.
  5722.  Information concerning real-number constants can be found
  5723.  in the "Microsoft Macro Assembler 5.10 Programmer's Guide."
  5724.  
  5725.  
  5726.  154. External Addresses in "=" Directive Documentation Error
  5727.  
  5728.  Product Version(s): 5.00 5.10 | 5.10
  5729.  Operating System:   MS-DOS    | OS/2
  5730.  Flags: ENDUSER | docerr
  5731.  Last Modified: 12-JAN-1989    ArticleIdent: Q35803
  5732.  
  5733.  On Page 214, section 11.1.1, of the "Microsoft Macro Assembler
  5734.  Programmer's Guide," the documentation indicates the equal-sign (=)
  5735.  directive may be used with expressions that evaluate to an address. If
  5736.  the address refers to an external label, the error A2052 will be
  5737.  issued from the assembler.
  5738.  
  5739.  MASM has a restriction with the "=" directive that should be
  5740.  documented. The use of "=" directive with expressions that evaluate to
  5741.  an address is not allowed. The EQU directive should be used instead.
  5742.  
  5743.  
  5744.  155. .code Directive with Segment Name Documentation Error
  5745.  
  5746.  Product Version(s): 5.00 5.10 | 5.10
  5747.  Operating System:   MS-DOS    | OS/2
  5748.  Flags: ENDUSER | docerr
  5749.  Last Modified: 12-JAN-1989    ArticleIdent: Q35804
  5750.  
  5751.  On Page 89, section 5.1.4, of the "Microsoft Macro Assembler
  5752.  Programmer's Guide," the last line of the second paragraph states
  5753.  "Name will be ignored if given with small or compact models."
  5754.  
  5755.  This information is a documentation error. If a name is given with the
  5756.  .code directive, a syntax error will be generated by the assembler.
  5757.  
  5758.  
  5759.  156. Align Directive Aligns Off Start of Segment
  5760.  
  5761.  Product Version(s): 5.10   | 5.10
  5762.  Operating System:   MS-DOS | OS/2
  5763.  Flags: ENDUSER |
  5764.  Last Modified: 12-JAN-1989    ArticleIdent: Q35880
  5765.  
  5766.  The ALIGN directive adds the necessary bytes to pad the current offset
  5767.  to be divisible by 16.
  5768.  
  5769.  In the example below, the offset of the first byte of d1 is 0;
  5770.  therefore, the offset of the last is 31. Thus, 1 byte of padding is
  5771.  necessary to "align on a paragraph boundary," i.e., make the current
  5772.  offset divisible by 16.
  5773.  
  5774.  The following example demonstrates this information:
  5775.  
  5776.  e.data
  5777.  d1   db 'This is to pad the data segment'
  5778.  align 16
  5779.  
  5780.  
  5781.  
  5782.  157. Name Directive No Longer Supported
  5783.  
  5784.  Product Version(s): 5.00 5.10
  5785.  Operating System:   MS-DOS
  5786.  Flags: ENDUSER |
  5787.  Last Modified: 12-JAN-1989    ArticleIdent: Q35881
  5788.  
  5789.  The Name directive was available in MASM Version 4.00. The directive,
  5790.  Name modulename, sets the name of the current module to modulename. A
  5791.  module name is used by the linker when displaying error messages.
  5792.  
  5793.  In MASM Versions 5.00 and 5.10, the old directive does not generate an
  5794.  assembler error because Microsoft wants to have downward compatibility
  5795.  with MASM Version 4.00 source files. The directive does not generate
  5796.  any extra information for MASM Versions 5.00 and 5.10.
  5797.  
  5798.  
  5799.  158. Warning A5114: Operand Size Does Not Match Segment Word Size
  5800.  
  5801.  Product Version(s): 5.00 5.10
  5802.  Operating System:   MS-DOS
  5803.  Flags: ENDUSER |
  5804.  Last Modified: 12-JAN-1989    ArticleIdent: Q35882
  5805.  
  5806.  The MASM warning A5114: "Operand size does not match segment word
  5807.  size" occurs when using 32-bit operands in USE16 segments. The warning
  5808.  is only generated on push and pop instructions using an operand with
  5809.  the size other than the size of the segment. For example, using dword
  5810.  push in a USE16 segment or using a word push in a USE32 segment. The
  5811.  warning is not generated for any other use of 32-bit operands.
  5812.  
  5813.  The warning message may have been added to aid the programmer trying
  5814.  to convert code from 16-bit segments to 32-bit segments. The warning
  5815.  message should only occur in 32-bit segments when 16-bit push/pop
  5816.  operands are given, and not in the converse situation.
  5817.  
  5818.  Microsoft is researching the subject and will post more information
  5819.  when available.
  5820.  
  5821.  
  5822.  159. Public Labels Are Prefixed with Underscore Incorrectly
  5823.  
  5824.  Product Version(s): 5.10   | 5.10
  5825.  Operating System:   MS-DOS | OS/2
  5826.  Flags: ENDUSER | buglist5.10
  5827.  Last Modified: 20-NOV-1990    ArticleIdent: Q35883
  5828.  
  5829.  When you assemble the following program with MASM Version 5.10 and
  5830.  examine the public labels, you will find an underscore prefixed to the
  5831.  public labels. The structure declaration is the cause of the problem.
  5832.  The problem is related to the space before the comma in the structure
  5833.  initialization. MASM wasn't skipping it, causing a host of problems.
  5834.  
  5835.  The workaround to this problem is to remove the space.
  5836.  
  5837.  Another symptom of the problem occurs during link-time, the linker
  5838.  generates unresolved externals for all public labels with underscores
  5839.  prefixed.
  5840.  
  5841.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  5842.  researching this problem and will post new information as it becomes
  5843.  available.
  5844.  
  5845.  The following sample code demonstrates the problem:
  5846.  
  5847.  ;*******************************************************************
  5848.  FooStruc STRUC
  5849.  Label1      db      "LPT"
  5850.  Label2      db      ?
  5851.              db      "    "
  5852.  FooStruc ENDS
  5853.  
  5854.  DSEG SEGMENT
  5855.  FooData1 FooStruc < , "1">
  5856.  FooData2 FooStruc < , "2">
  5857.  DSEG ENDS
  5858.  
  5859.  CSEG SEGMENT
  5860.      ASSUME CS:CSEG, DS:DSEG
  5861.  
  5862.  PUBLIC FooProc
  5863.  FooProc PROC NEAR
  5864.  
  5865.          mov     ax, OFFSET DSEG:FooData2
  5866.  
  5867.  FooProc ENDP
  5868.  
  5869.  CSEG ENDS
  5870.  
  5871.          END
  5872.  ;*************************************************************
  5873.  
  5874.  
  5875.  160. Error L2002: Fixup Overflow for MASM and C
  5876.  
  5877.  Product Version(s): 5.10
  5878.  Operating System:   MS-DOS
  5879.  Flags: ENDUSER |
  5880.  Last Modified: 12-JAN-1989    ArticleIdent: Q38216
  5881.  
  5882.  If the variable exp_data is declared in MASM as follows
  5883.  
  5884.  .data
  5885.      EXTRN _exp_data:WORD
  5886.  
  5887.  and declared in C as follows, the error L2002: fixup overflow is
  5888.  generated:
  5889.  
  5890.   .
  5891.   .
  5892.   .
  5893.   int exp_data;
  5894.  
  5895.   main()
  5896.   {...
  5897.   }
  5898.  
  5899.  This error occurs because the assembler declaration puts _exp_data in
  5900.  the _data logical segment in dgroup. The C declaration, however, will
  5901.  put _exp_data in the FAR_BSS as it is an uninitialized global data
  5902.  item in large model.
  5903.  
  5904.  One way to eliminate this error is to initialize _exp_data in C. This
  5905.  will put it in the _data logical segment in dgroup as well.
  5906.  
  5907.  Another work around is to delcare _exp_data in MASM outside of the
  5908.  .data directive. This will put _exp_data into the FAR_BSS in
  5909.  large-memory model.
  5910.  
  5911.  
  5912.  161. Expressions in Define Statements
  5913.  
  5914.  Product Version(s): 5.10   | 5.10
  5915.  Operating System:   MS-DOS | OS/2
  5916.  Flags: ENDUSER |
  5917.  Last Modified: 12-JAN-1989    ArticleIdent: Q38935
  5918.  
  5919.  In all versions of Microsoft Macro Assembler earlier than Version
  5920.  5.10, you could not have greater than 16-bit arithmetic in define
  5921.  statements. This has been changed in Version 5.10.
  5922.  
  5923.  In all versions before Version 5.10, you could use constants of
  5924.  greater than 16 bits; however, you could not put an arithmetic
  5925.  expression to obtain a number larger than 16 bits.
  5926.  
  5927.  The following is an example:
  5928.  
  5929.  DD 86400     <-  correct.
  5930.  DD 60*60*24  <-  incorrect. This would be truncated at the
  5931.                              16-bit value.
  5932.  
  5933.  This feature has been implemented in Version 5.10 so that both of the
  5934.  above declarations will yield the same answer.
  5935.  
  5936.  
  5937.  162.
  5938.  
  5939.  Product Version(s): 5.00 5.10 | 5.10
  5940.  Operating System:   MS-DOS    | OS/2
  5941.  Flags: ENDUSER | docerr
  5942.  Last Modified: 12-JAN-1989    ArticleIdent: Q38936
  5943.  
  5944.  The code fragment in section 7.1.3 on Page 147 of the "Microsoft Macro
  5945.  Assembler Programmer's Guide" causes a warning A4031: "Operand types
  5946.  must match." There is an error in the example.
  5947.  
  5948.  Change the line below
  5949.  
  5950.     mov ax, [bx].month
  5951.  
  5952.  to the following:
  5953.  
  5954.     mov ah, [bx].month
  5955.  
  5956.  Because the structure field month is defined as a byte, the assignment
  5957.  to a word register generates the operand-mismatch warning message. The
  5958.  change to a byte register resolves the warning. The following is also
  5959.  acceptable:
  5960.  
  5961.     mov ax, word ptr [bx].month
  5962.  
  5963.  
  5964.  163. Addressing above 1 Megabyte
  5965.  
  5966.  Product Version(s): 5.00   | 5.10
  5967.  Operating System:   MS-DOS | OS/2
  5968.  Flags: ENDUSER | reference words
  5969.  Last Modified: 12-JAN-1989    ArticleIdent: Q39370
  5970.  
  5971.  Question:
  5972.  
  5973.  The 80286 is capable of addressing a maximum of 16 megabytes of
  5974.  memory; however, with 16-bit segment and offset registers, I can only
  5975.  reach 1 megabyte. How can I address this extra memory?
  5976.  
  5977.  Response:
  5978.  
  5979.  When the 80286 is in real mode, it is not possible to reach that
  5980.  memory -- you are limited to 1 megabyte. To use that space, you have
  5981.  to put the processor into protected mode by using IBM ROM BIOS Call -
  5982.  Interupt 15 function 89h.
  5983.  
  5984.  For more information about this interrupt, call IBM hardware support
  5985.  at (800) 426-2468. This information is not covered in the DOS
  5986.  Encyclopedia.
  5987.  
  5988.  
  5989.  164. Exe2bin Will Not Support exe Files Created with dosseg
  5990.  
  5991.  Product Version(s): 5.10   | 5.10
  5992.  Operating System:   MS-DOS | OS/2
  5993.  Flags: ENDUSER |
  5994.  Last Modified: 12-JAN-1989    ArticleIdent: Q39173
  5995.  
  5996.  When creating a com file, the exe2bin utility will not accept an
  5997.  executable file if the file was created using the dosseg directive
  5998.  in MASM.
  5999.  
  6000.  This behavior occurs because the dosseg directive places 16 bytes at
  6001.  the beginning of the executable to ensure proper byte alignment. This
  6002.  format is not acceptable to exe2bin. To work around this problem, do
  6003.  not use the dosseg directive when creating an executable to be
  6004.  converted into com format.
  6005.  
  6006.  
  6007.  165. An Example of Declaring a Communal Variable of a Record Type
  6008.  
  6009.  Product Version(s): 5.00 5.10 | 5.10
  6010.  Operating System:   MS-DOS    | OS/2
  6011.  Flags: ENDUSER |
  6012.  Last Modified: 12-JAN-1989    ArticleIdent: Q39235
  6013.  
  6014.  Question :
  6015.  
  6016.  How can I declare a communal variable that has a record type?
  6017.  
  6018.  Response:
  6019.  
  6020.  Declare the variable with the size matching the size of the record
  6021.  type defined in the same source file. There is no need to specify that
  6022.  the variable has the predefined record type.
  6023.  
  6024.  The following sample program demonstrates this information:
  6025.  
  6026.  ; module 1
  6027.          .model small
  6028.          dosseg
  6029.  extrn   proc2:proc
  6030.          .stack 100h
  6031.          .data
  6032.  color   record   blink:1, back:3, intense:1, fore:3
  6033.          comm     near pixel:byte     ; use "byte" because
  6034.                                       ; color has size byte.
  6035.          .code
  6036.  start:  mov ax, @data
  6037.          mov ds, ax
  6038.  
  6039.          mov pixel, color <1,2,1,3> ; now the variable pixel
  6040.                                     ; should have the value "abh",
  6041.                                     ; which matches the
  6042.                                     ; pattern 1,010,1,011
  6043.          call proc2
  6044.          mov ax, 4c00h
  6045.          int 21h
  6046.          end start
  6047.  
  6048.  ******************************
  6049.  ; module 2
  6050.          .model small
  6051.          dosseg
  6052.          .stack 100h
  6053.          .data
  6054.  color   record   blink:1, back:3, intense:1, fore:3
  6055.          comm     near pixel:byte
  6056.          .code
  6057.          public proc2
  6058.  proc2   proc
  6059.          mov ah, 0
  6060.          mov ah, pixel  ; ah should have the value "abh"
  6061.          ret
  6062.  proc2   endp
  6063.          end
  6064.  
  6065.  
  6066.  166. Proc with ARG Directive Requires Language in .MODEL
  6067.  
  6068.  Product Version(s): 5.00   | 5.10
  6069.  Operating System:   MS-DOS | OS/2
  6070.  Flags: ENDUSER |
  6071.  Last Modified: 12-JAN-1989    ArticleIdent: Q39371
  6072.  
  6073.  The program below, which uses the PROC directive, will not assemble
  6074.  correctly unless you use a language parameter with the .MODEL
  6075.  directive. The "Microsoft Macro Assembler Programmer's Guide" does not
  6076.  say that the language parameter is required when using the PROC
  6077.  directive.
  6078.  
  6079.  The language parameter on the .MODEL directive enables the PROC
  6080.  extensions, changes the scope of code labels within procedures, and
  6081.  may affect naming. When the language parameter is left off, the PROC
  6082.  directive will only accept a NEAR or FAR specifier.
  6083.  
  6084.  The following is a sample program:
  6085.  
  6086.          .model large
  6087.  ;       .model large, c  ; This line will permit correct assembly.
  6088.          .code
  6089.  myadd   proc arg1:ptr, arg2:ptr
  6090.          les bx, arg1
  6091.          les dx, arg2
  6092.          ret
  6093.  myadd   endp
  6094.          end
  6095.  
  6096.  The following errors are generated during assembly:
  6097.  
  6098.  A2022: Operand must be type specifier
  6099.  A2009: Symbol not defined: ARG1
  6100.  A2009: Symbol not defined: ARG2
  6101.  
  6102.  
  6103.  167. MOV mem,accum and MOV accum,mem Formats Incorrectly Documented
  6104.  
  6105.  Product Version(s): 5.00 5.10
  6106.  Operating System:   MS-DOS
  6107.  Flags: ENDUSER |
  6108.  Last Modified: 12-JAN-1989    ArticleIdent: Q39372
  6109.  
  6110.  There is a documentation error on Page 77 of the "Microsoft Macro
  6111.  Assembler 5.1 Reference" manual (spiral-bound book). In the
  6112.  next-to-bottom big box, the MOV mem,accum and MOV accum,mem formats of
  6113.  the MOV instruction are incorrectly documented. The manual describes
  6114.  the binary format of these instructions as 101000dw, where a value of
  6115.  1 for d means to move from memory to AX and 0 for d means to move from
  6116.  AX to memory (as described on Page 27 of the same manual).
  6117.  
  6118.  This is reversed, as shown on Page 3-118 of "Intel's iAPX 86/88,
  6119.  186/188 User's Manual (Programmer's Reference)" and as assembled
  6120.  properly by MASM.
  6121.  
  6122.  Note: The Intel manual shows the bit patterns for these two types of
  6123.  the instruction separately. The memory to AX form has bit 1 (the d bit
  6124.  in our documentation) set to 0; the AX to memory form has bit 1 set to
  6125.  1.
  6126.  
  6127.  
  6128.  168. Warnings and Incorrect Code from Register Mismatch
  6129.  
  6130.  Product Version(s): 5.10
  6131.  Operating System:   MS-DOS
  6132.  Flags: ENDUSER |  buglist5.10
  6133.  Last Modified: 12-JAN-1989    ArticleIdent: Q39373
  6134.  
  6135.  The code below is correctly flagged as an error in MASM Version 5.00,
  6136.  but is passed in Version 5.10.
  6137.  
  6138.  Macro Assembler Version 5.10 fails to generate an error on the MOV
  6139.  instruction using the 8-bit registers (AH, BH, CH, DH, AL, BL, CL, DL)
  6140.  with segement registers (CS, DS, ES, SS). The code generated is also
  6141.  in error. Each of the (8-bit) byte registers maps to the set (SP, DI,
  6142.  BP, SI, AX, BX, CX, DX).
  6143.  
  6144.  "Warning A4057: Illegal size for operand" is incorrectly generated.
  6145.  The correct message should be "Error A2019: Wrong type of register."
  6146.  
  6147.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  6148.  researching this problem and will post new information as it becomes
  6149.  available.
  6150.  
  6151.  The following sample code demonstrates the problem:
  6152.  
  6153.  _TEXT   segment word public 'CODE'
  6154.                                  ; Generated code
  6155.          mov     ds, ah          ; mov   ds, sp
  6156.          mov     ds, bh          ; mov   ds, di
  6157.          mov     ds, ch          ; mov   ds, bp
  6158.          mov     ds, dh          ; mov   ds, si
  6159.  
  6160.          mov     ds, al          ; mov   ds, ax
  6161.          mov     ds, bl          ; mov   ds, bx
  6162.          mov     ds, cl          ; mov   ds, cx
  6163.          mov     ds, dl          ; mov   ds, dx
  6164.  
  6165.          mov     ah, 4ch
  6166.          int     21h
  6167.  _TEXT   ends
  6168.          end
  6169.  
  6170.  
  6171.  169. RET Statement Label Appears on RET Listing, Not on First POP
  6172.  
  6173.  Product Version(s): 5.10   | 5.10
  6174.  Operating System:   MS-DOS | OS/2
  6175.  Flags: ENDUSER |
  6176.  Last Modified: 12-JAN-1989    ArticleIdent: Q39374
  6177.  
  6178.  When the /LA option is used to list an RET statement that has a label
  6179.  and is contained in a PROC that has a USES clause and/or parameters,
  6180.  the label for the RET statement will be shown in the listing on the
  6181.  RET rather then on the first POP generated by MASM for the RET.
  6182.  
  6183.  Although the listing looks incorrect, the code generated and the value
  6184.  of the label are both correct. A jump to the label will in fact go to
  6185.  the first POP instruction, not directly to the RET instruction.
  6186.  
  6187.  Because the generated code is correct, no workaround is necessary to
  6188.  produce properly assembled code. A workaround to produce correct
  6189.  listings is to move the label to an otherwise blank line just before
  6190.  the RET instruction, as shown below.
  6191.  
  6192.  The USES clause tells MASM which registers the PROC changes. MASM then
  6193.  generates appropriate PUSH instructions at the PROC entry and POP
  6194.  instructions just before each RET. Using parameters on the PROC
  6195.  statement also causes PUSH and POP instructions for BP to be
  6196.  generated. When the /LA option is used to show the added instructions
  6197.  generated for the RET instruction, the listing shows the original
  6198.  source line, including the label, after the POP instruction(s) which
  6199.  are inserted by MASM. However, MASM assembles the code correctly so
  6200.  that the label actually refers to the first added POP instruction.
  6201.  Running the program under CodeView, checking the object code generated
  6202.  for jumps, and checking the value of the label on the RET in the
  6203.  symbol listing at the end of the program all confirm that MASM is
  6204.  producing correct code.
  6205.  
  6206.  The workaround to produce a correct listing is to change
  6207.  
  6208.     JUMPHERE:   RET
  6209.  
  6210.  to the following:
  6211.  
  6212.     JUMPHERE:
  6213.                 RET
  6214.  
  6215.  When this is done, the label will appear before the POP instructions.
  6216.  
  6217.  The sample code below illustrates the problem. Note: The the first
  6218.  three lines are necessary for using the "USES" directive. The
  6219.  following is the sample code:
  6220.  
  6221.          dosseg
  6222.          .model small,c
  6223.          .code
  6224.  foo     proc uses si di bp
  6225.          jz there
  6226.  there:  ret
  6227.  foo     endp
  6228.          end
  6229.  ........................................................................
  6230.  masm /LA ... :
  6231.  
  6232.         1                                        dosseg
  6233.         2                                        .model small,c
  6234.         3                                assume cs:@code,ds:@data,ss:@data
  6235.         4                                        .code
  6236.         5 0000                           _TEXT segment 'CODE'
  6237.         6 0000                           foo     proc uses si di bp
  6238.         7 0000  56                       push SI
  6239.         8 0001  57                       push DI
  6240.         9 0002  55                       push BP
  6241.        10 0003  74 00                            jz there
  6242.        11 0005  5D                       pop BP
  6243.        12 0006  5F                       pop DI
  6244.        13 0007  5E                       pop SI
  6245.        14 0008  C3                       there:  ret
  6246.        15 0009                           foo     endp
  6247.        16                                        end
  6248.        17 0009                           @CurSeg ends
  6249.  
  6250.  
  6251.  170. SMSW, SGDT, SIDT, SLDT, VERR, VERW Do Not Assemble
  6252.  
  6253.  Product Version(s): 5.00   | 5.10
  6254.  Operating System:   MS-DOS | OS/2
  6255.  Flags: ENDUSER | docerr buglist5.00
  6256.  Last Modified: 12-JAN-1989    ArticleIdent: Q39439
  6257.  
  6258.  The ".286" and ".386" operands do not allow the following to assemble:
  6259.  
  6260.     SMSW, SGDT, SIDT, SLDT, VERR, and VERW
  6261.  
  6262.  One or two error messages are generated for each occurrence of these
  6263.  instructions.
  6264.  
  6265.  Microsoft has confirmed this to be a problem in Version 5.00. We are
  6266.  researching this problem and will post new information as it becomes
  6267.  available.
  6268.  
  6269.  Page 412 (section 20.3) of the "Microsoft Macro Assembler Programmer's
  6270.  Guide" is incorrect in saying that these instructions require
  6271.  "privileged mode." Also, SMSW is spelled incorrectly (as "SMCW").
  6272.  These instructions are allowed in all modes; however, behavior may
  6273.  differ between real and protected modes.
  6274.  
  6275.  The reference guide is also incorrect on several addressing points.
  6276.  See the Intel "80286 and 80287 Programmer's Reference Manual" for more
  6277.  information.
  6278.  
  6279.  The following is a sample program:
  6280.  
  6281.  ........................................................................
  6282.  ; The following program demonstrates :
  6283.  dosseg
  6284.  .286
  6285.  .model large
  6286.  .data
  6287.  table   dw 64 dup (?)
  6288.  .code
  6289.  start:
  6290.          SMSW ax
  6291.          SGDT table
  6292.          SIDT table
  6293.          SLDT ax
  6294.          VERR ax
  6295.          VERW ax
  6296.  
  6297.          end start
  6298.  
  6299.  ......................................................................
  6300.  
  6301.  C> masm test,,,;
  6302.  Microsoft (R) Macro Assembler Version 5.10
  6303.  Copyright (C) Microsoft Corp 1981, 1988.  All rights reserved.
  6304.  
  6305.  test.ASM(6): error A2105: Expected: instruction, directive, or label
  6306.  test.ASM(7): error A2105: Expected: instruction, directive, or label
  6307.  test.ASM(8): error A2105: Expected: instruction, directive, or label
  6308.  test.ASM(9): error A2105: Expected: instruction, directive, or label
  6309.  test.ASM(10): error A2105: Expected: instruction, directive, or label
  6310.  test.ASM(11): error A2105: Expected: instruction, directive, or label
  6311.  
  6312.    24002 Bytes symbol space free
  6313.  
  6314.        0 Warning Errors
  6315.        6 Severe  Errors
  6316.  .......................................................................
  6317.  
  6318.  
  6319.  171. MASM Supports the 386SX Chip
  6320.  
  6321.  Product Version(s): 5.10   | 5.10
  6322.  Operating System:   MS-DOS | OS/2
  6323.  Flags: ENDUSER |
  6324.  Last Modified: 12-JAN-1989    ArticleIdent: Q39440
  6325.  
  6326.  Microsoft Macro Assembler supports the new 386SX chip, which takes a
  6327.  32-bit program and processes it to 16-bit. The hardware bus is
  6328.  different, but the machine instructions are the same.
  6329.  
  6330.  
  6331.  172. The ORG Directive and Actual Offsets
  6332.  
  6333.  Product Version(s): 5.10
  6334.  Operating System:   MS-DOS
  6335.  Flags: ENDUSER |
  6336.  Last Modified: 12-JAN-1989    ArticleIdent: Q39441
  6337.  
  6338.  The ORG directive in MASM does not necessarily produce an actual
  6339.  offset that matches the offset specified by "ORG XXX". For example, if
  6340.  you use "ORG 100h" in your program, the following code will not always
  6341.  begin at the 100h offset relative to the start of the segment.
  6342.  
  6343.  When you are using a .COM source file and there is only one module,
  6344.  the "ORG 100h" will result in an actual offset of 100h for the code
  6345.  that follows the ORG statement. This behavior also occurs with
  6346.  segments with AT combine type (in which case segments are not combined
  6347.  by the linker, and no data or code is defined).
  6348.  
  6349.  However, if you have multiple modules and/or you are not dealing with
  6350.  a .COM source file, the "ORG 100h" produces an actual offset, which is
  6351.  somewhat greater than 100h.
  6352.  
  6353.  This behavior occurs because the linker, in these circumstances, will
  6354.  do some padding that you have no control over.
  6355.  
  6356.  In the following illustration (which deals with the source modules
  6357.  below), note that the ORG instruction increments the local offset by
  6358.  100h, resulting in the offset of the PUSH instruction in foo2 being
  6359.  100h (that's what it would report in the listing file). However, when
  6360.  these modules are linked, all the portions of segment code are
  6361.  concatenated. Thus, foo2.asm:code:100h is converted into code:113h.
  6362.  The order of concatenation is the order of linking.
  6363.  
  6364.  The following example illustrates the scenario:
  6365.  
  6366.       Actual                      Offset
  6367.       offset                      from start
  6368.       from                        of segment
  6369.       code                        code in module
  6370.       -------                     ---------------
  6371.               +-----------------+
  6372.       0117    |   ret           | 0105
  6373.       0116    |   pop           | 0103    foo2.asm
  6374.       0114    |   mov           | 0101
  6375.       0113    |   push          | 0100
  6376.       0013    |   org           | 0000
  6377.               +-----------------+
  6378.       0012    |   ret           | 0004
  6379.       0011    |   pop           | 0003    foo1.asm
  6380.       000F    |   mov           | 0001
  6381.       000E    |   push          | 0000
  6382.               +-----------------+
  6383.       000C    |   int           | 000C
  6384.       0009    |   mov           | 0009    foomain.asm
  6385.       0006    |   call          | 0006
  6386.       0003    |   call          | 0003
  6387.       0000    |   mov           | 0000
  6388.               +-----------------+
  6389.                   segment code
  6390.  
  6391.  |---------------foomain.asm:       |---------------foo1.asm:
  6392.    code segment                         PUBLIC  _foo
  6393.    assume cs:code                       code segment
  6394.                                         assume cs:code
  6395.            mov     ax, 0a0ah            _foo proc
  6396.  
  6397.            extrn   _foo:proc                push    bp
  6398.            extrn   _foo2:proc               mov     bp, sp
  6399.  
  6400.            call    _foo                     pop     bp
  6401.            call    _foo2                    ret
  6402.  
  6403.            mov     ax, 4c00h            _foo    ENDP
  6404.            int     21h                  code ends
  6405.    code ends
  6406.  
  6407.            END                          END
  6408.  
  6409.  |---------------foo2.asm:
  6410.     code segment
  6411.     assume cs:code
  6412.             org     100h
  6413.  
  6414.             PUBLIC  _foo2
  6415.     _foo2    PROC
  6416.  
  6417.             push    bp
  6418.             mov     bp, sp
  6419.  
  6420.             pop     bp
  6421.             ret
  6422.  
  6423.     _foo2    ENDP
  6424.     code ends
  6425.             END
  6426.  
  6427.  
  6428.  173. asub and ctest Defined Incorrectly in MASM Programmer's Guide
  6429.  
  6430.  Product Version(s): 5.10   | 5.10
  6431.  Operating System:   MS-DOS | OS/2
  6432.  Flags: ENDUSER | docerr
  6433.  Last Modified: 12-JAN-1989    ArticleIdent: Q39442
  6434.  
  6435.  There is a documentation error on Page 91 of the "Microsoft Mixed
  6436.  Language Programming Guide" for Microsoft C, FORTRAN, and MASM. In
  6437.  figure 6.7, the assembly procedure "asub" should be defined as
  6438.  
  6439.     _asub PROC
  6440.  
  6441.  not as follows:
  6442.  
  6443.     PROC asub
  6444.  
  6445.  Also, the call to "ctest" should appear as
  6446.  
  6447.     call _ctest
  6448.  
  6449.  not as follows:
  6450.  
  6451.     call ctest
  6452.  
  6453.  
  6454.  174. Use of Parentheses for Operator Precedence Necessary
  6455.  
  6456.  Product Version(s): 5.00   | 5.10
  6457.  Operating System:   MS-DOS | OS/2
  6458.  Flags: ENDUSER |
  6459.  Last Modified: 12-JAN-1989    ArticleIdent: Q39443
  6460.  
  6461.  You may be able to correct "Illegal size for operand" errors by
  6462.  careful use of parentheses.
  6463.  
  6464.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  6465.  researching this problem and will post new information as it becomes
  6466.  available.
  6467.  
  6468.  The following code demonstrates warnings, errors, and their solution:
  6469.  
  6470.  dosseg
  6471.  .model small,c
  6472.  .data
  6473.  
  6474.  .code
  6475.  foo PROC buffer:FAR PTR BYTE
  6476.  
  6477.             mov     bx, WORD PTR buffer[0]
  6478.             mov     ds, WORD PTR buffer[2]
  6479.  
  6480.  ; MASM gives an operand-size error. This is a precedence problem that
  6481.  ; you can correct with parentheses:
  6482.  
  6483.             mov     bx, WORD PTR (buffer[0])
  6484.             mov     ds, WORD PTR (buffer[2])
  6485.  
  6486.  foo ENDP
  6487.  
  6488.  end
  6489.  ......................................................................
  6490.  masm test,,,;
  6491.  Microsoft (R) Macro Assembler Version 5.10
  6492.  Copyright (C) Microsoft Corp 1981, 1988.  All rights reserved.
  6493.  
  6494.  test.ASM(9): warning A4057: Illegal size for operand
  6495.  test.ASM(10): error A2057: Illegal size for operand
  6496.  
  6497.    23666 Bytes symbol space free
  6498.  
  6499.        1 Warning Errors
  6500.        1 Severe  Errors
  6501.  .......................................................................
  6502.  
  6503.  
  6504.  175. The Stack Grows into Low Memory
  6505.  
  6506.  Product Version(s): 5.10
  6507.  Operating System:   MS-DOS
  6508.  Flags: ENDUSER | docerr
  6509.  Last Modified: 12-JAN-1989    ArticleIdent: Q39444
  6510.  
  6511.  On Page 300 of the "Microsoft Macro Assembler Programmer's Guide," the
  6512.  first paragraph incorrectly states that "it is possible to return the
  6513.  stack to its original status by subtracting the correct number of
  6514.  words from the SP register." Instead, after pushing values onto the
  6515.  stack, it is possible to return the stack to its original status by
  6516.  adding the correct number of words to the SP register.
  6517.  
  6518.  Also, the first example on Page 300 uses the SUB command to restore
  6519.  the stack pointer. The ADD command should be used instead.
  6520.  
  6521.  
  6522.  176. The IN Instruction Receives Data from a Port
  6523.  
  6524.  Product Version(s): 5.10
  6525.  Operating System:   MS-DOS
  6526.  Flags: ENDUSER | docerr
  6527.  Last Modified: 12-JAN-1989    ArticleIdent: Q39445
  6528.  
  6529.  On Page 300 of the "Microsoft Macro Assembler Programmer's Guide," the
  6530.  fourth paragraph incorrectly states that the IN instruction is used to
  6531.  send data to a port. Instead, the IN instruction is used to receive
  6532.  data from a port.
  6533.  
  6534.  
  6535.  177. Division Operators "/" with .186, .286, and .386
  6536.  
  6537.  Product Version(s): 5.00 5.10 | 5.10
  6538.  Operating System:   MS-DOS    | OS/2
  6539.  Flags: ENDUSER | calculation operator, division
  6540.  Last Modified: 12-JAN-1989    ArticleIdent: Q39446
  6541.  
  6542.  To use calculation operators on constant values larger than 17 bits,
  6543.  ".386" has to be enabled. Otherwise, the assembler may generate error
  6544.  "A2029 : Division by 0 or overflow."
  6545.  
  6546.  Please refer to Page 174 of the "Microsoft Macro Assembler
  6547.  Programmer's Guide" in the section "Using Operators" for more specific
  6548.  information. The program below demonstrates this information.
  6549.  
  6550.  When 80386 is enabled by using .386, the program will be assembled
  6551.  without any error message. Then the program has to run on a 80386
  6552.  machine.
  6553.  
  6554.  The following is the sample program:
  6555.  
  6556.      ; sample program
  6557.      .186
  6558.      .model small
  6559.      .data
  6560.      dd  989680h/4h          ; the constant value is more than 17 bits.
  6561.      .code
  6562.      end
  6563.  ...................................................................
  6564.  masm test,,,;
  6565.  Microsoft (R) Macro Assembler Version 5.10
  6566.  Copyright (C) Microsoft Corp 1981, 1988.  All rights reserved.
  6567.  
  6568.  test.ASM(7): error A2029: Division by 0 or overflow
  6569.  
  6570.    23918 Bytes symbol space free
  6571.  
  6572.        0 Warning Errors
  6573.        1 Severe  Errors
  6574.  
  6575.  
  6576.  178. Comparing String Arguments in Macros
  6577.  
  6578.  Product Version(s): 5.00 5.10 | 5.10
  6579.  Operating System:   MS-DOS    | OS/2
  6580.  Flags: ENDUSER | eq if directive ifidn arguments
  6581.  Last Modified: 12-JAN-1989    ArticleIdent: Q39517
  6582.  
  6583.  When using IF directives, relational operators could be used to form
  6584.  the conditions. Note: The relational operators treat the expressions
  6585.  as follows:
  6586.  
  6587.     EQ and NE treat their operators as 16-bit numbers
  6588.  
  6589.     LT, LE, GT, and GE treat their operators as 17-bit numbers.
  6590.  
  6591.  The relational operators cannot be used for comparing string
  6592.  arguments. It is often necessary to compare string arguments in
  6593.  MACROs. IFIDN and IFDIF directives are available for this purpose.
  6594.  IFIDN grants assembly if two arguments are identical; IFDIF grants
  6595.  assembly if two arguments are different. The syntax is as follows:
  6596.  
  6597.      IFIDN <argument1>,<argument2>
  6598.      IFDIF <argument1>,<argument2>
  6599.  
  6600.  Please refer to "Microsoft Macro Assembler Programmer's Guide" in the
  6601.  section "Assembling Conditionally" for more specific information.
  6602.  
  6603.  
  6604.  179. EXTR Examples incorrect in MASM Programmer's Guide
  6605.  
  6606.  Product Version(s): 5.10   | 5.10
  6607.  Operating System:   MS-DOS | OS/2
  6608.  Flags: ENDUSER | DOCERR
  6609.  Last Modified: 12-JAN-1989    ArticleIdent: Q39518
  6610.  
  6611.  There are a number of errors in example 2 on Page 90 of the "Microsoft
  6612.  MASM 5.1 Programmer's Guide."
  6613.  
  6614.  The following lines
  6615.  
  6616.     EXTR    xvariable:FAR
  6617.  
  6618.     EXTR    xprocedure:PROC
  6619.  
  6620.  should be as follows:
  6621.  
  6622.     EXTRN   xvariable:FAR
  6623.  
  6624.     EXTRN   xprocedure:PROC
  6625.  
  6626.  Please use this as a model. It was not intended to be linked and run.
  6627.  
  6628.  
  6629.  180. Using Conditional-Assembly to Assemble for COM or EXE File
  6630.  
  6631.  Product Version(s): 4.00 5.00 5.10
  6632.  Operating System:   MS-DOS
  6633.  Flags: ENDUSER |
  6634.  Last Modified: 12-JAN-1989    ArticleIdent: Q39519
  6635.  
  6636.  By using assembler symbols, macros, and conditional-assembly,
  6637.  assembling a file to a COM or EXE file is easy. The following is the
  6638.  solution:
  6639.  
  6640.  ifdef   COM
  6641.  ending  macro   text
  6642.          end     start
  6643.  endm
  6644.  else
  6645.  ending  macro   text
  6646.          end
  6647.  endm
  6648.  endif
  6649.  
  6650.  _text   segment 'code'
  6651.          assume cs:_text
  6652.  start:  mov     ax, 08000h
  6653.          mov     ds, ax
  6654.          ...
  6655.  _text   ends
  6656.  
  6657.          ending
  6658.  
  6659.  Use MASM /DCOM /MX foo.asm for assembling into a COM file. Or use
  6660.  MASM /MX foo.asm for EXE files.
  6661.  
  6662.  This example assembles code depending on whether the assembler symbol
  6663.  COM is defined or not. COM files must have an entry point so the END
  6664.  directive requires a start address; whereas, EXE files do not require
  6665.  an entry point.
  6666.  
  6667.  Under MASM Version 4.00, you can accomplish this with a simple
  6668.  conditional-assembly block at the end as follows:
  6669.  
  6670.  ifdef   com
  6671.          end     start
  6672.  endif
  6673.          end
  6674.  
  6675.  MASM Version 5.10 flags this as an error, which it should according to
  6676.  Page 79 of the "Microsoft Macro Assembler 5.1 Programmer's Guide."
  6677.  "Any statements following the END directive are ignored by the
  6678.  assembler." The error occurs because the endif is not being recognized
  6679.  and "Number of open conditionals: 1" error is displayed.
  6680.  
  6681.  
  6682.  181. Passing an Integer from C to MASM, Returning a Double
  6683.  
  6684.  Product Version(s): 5.10
  6685.  Operating System:   MS DOS
  6686.  Flags: ENDUSER | S_C
  6687.  Last Modified: 12-JAN-1989    ArticleIdent: Q39520
  6688.  
  6689.  The following MASM program shows how to receive an integer from a C
  6690.  program, then pass the value back to the C program as a double. Note:
  6691.  This routine was composed for the large-memory model and assumes that
  6692.  a coprocessor exists on the system.
  6693.  
  6694.  Below is the C program that calls the MASM routine. It should be
  6695.  compiled for large-memory model and either 8087 or emulator-math
  6696.  library.
  6697.  
  6698.  The following is the sample program:
  6699.  
  6700.  #include <stdio.h>
  6701.  
  6702.  extern double abc(int x);
  6703.  
  6704.  main()
  6705.  {
  6706.  
  6707.  int x;
  6708.  double y;
  6709.  
  6710.  x=7;
  6711.  y=abc(x);
  6712.  printf("%lf is the value of y\n", y);
  6713.  
  6714.  }
  6715.  
  6716.  Below is the MASM routine. The main piece to this program is the
  6717.  filled instruction that transforms the integer to a floating-point
  6718.  real, then pushes the value on the co-processor stack. The other point
  6719.  is to obtain the segment and offset of the __fac variable. Anything
  6720.  over 2 bytes cannot be stored in the AX register, so C will look to
  6721.  the memory location pointed to by DX:AX.
  6722.  
  6723.  The following is the MASM routine:
  6724.  
  6725.          .MODEL LARGE,C ;C so Masm will use C naming conventions
  6726.          .DATA
  6727.          .CODE
  6728.  EXTRN _fac:QWORD       ; __fac is the global variable used by C
  6729.                         ; for storing floating point accumulations
  6730.          PUBLIC  abc
  6731.  abc     PROC FAR
  6732.          push    bp
  6733.          mov     bp,sp
  6734.          fild    WORD PTR [bp+6]
  6735.          mov     dx,SEG _fac
  6736.          mov     es,dx
  6737.          fstp    QWORD PTR es:_fac  ; this pops the value off of
  6738.          mov     ax,OFFSET _fac     ; the co-processor and puts it
  6739.          fwait                      ; in __fac
  6740.          mov     sp,bp
  6741.          pop     bp
  6742.          ret
  6743.  
  6744.  abc     ENDP
  6745.          END
  6746.  
  6747.  
  6748.  182. How to Declare Externals in MASM
  6749.  
  6750.  Product Version(s): 5.00 5.10 | 5.10
  6751.  Operating System:   MS-DOS    | OS/2
  6752.  Flags: ENDUSER |
  6753.  Last Modified: 12-JAN-1989    ArticleIdent: Q39523
  6754.  
  6755.  The following are the rules for declaring externals in MASM:
  6756.  
  6757.  1. NEAR code labels must be declared in the code segment
  6758.     from which they are accessed.
  6759.  
  6760.  2. Although FAR code labels can be declared anywhere in the source
  6761.     code, it is recommended they be declared outside of any segments.
  6762.     You may declare them at the top of your program after the .MODEL
  6763.     directive.
  6764.  
  6765.  3. Any external data in the DGROUP data segment, must be declared in
  6766.     the segment in which it is defined. You may need to create a dummy
  6767.     data segment for the external declaration.
  6768.  
  6769.  4. Data items declared in .FARDATA segment, that need to be referenced
  6770.     as externals, should be declared out of any segments. Otherwise,
  6771.     fixup-overflow errors may occur during linking. Note: This
  6772.     conflicts with the rules indicated on Page 162 of "Microsoft Macro
  6773.     Assembler Programmer's Guide" for Versions 5.x.
  6774.  
  6775.  
  6776.  183. TSR in Assembly
  6777.  
  6778.  Product Version(s): 5.00 5.10
  6779.  Operating System:   MS-DOS
  6780.  Flags: ENDUSER |
  6781.  Last Modified: 12-JAN-1989    ArticleIdent: Q39524
  6782.  
  6783.  Terminate and stay resident (TSR) programs consist of RAM-resident and
  6784.  transient portions. When a TSR is executed, the transient portion
  6785.  initializes data and installs the interrupt handlers; the transient
  6786.  portion only takes place once. On exit, the transient code executes a
  6787.  MS-DOS TSR function to leave the RAM-resident portion in memory. The
  6788.  RAM-resident portion of the code is now ready and waiting to be
  6789.  invoked.
  6790.  
  6791.  Typically a TSR is invoked by another program by a sequence of
  6792.  keystrokes, or by a system interrupt. The following is an example of a
  6793.  TSR that displays the system time in the upper-right corner of the
  6794.  screen. During the transient portion, the TSR replaces the
  6795.  system-timer interrupt code with its own code and saves the old
  6796.  address so the original system-timer interrupt can be invoked by the
  6797.  new code. The system-timer interrupt occurs approximately 19 times a
  6798.  second, and is required for the system to execute correctly. The
  6799.  RAM-resident portion of the TSR first invokes the original
  6800.  system-timer interrupt, then calls Interrupt 1AH function 02H to
  6801.  obtain the current time. The time is then displayed in the upper-right
  6802.  corner of the screen.
  6803.  
  6804.  The following sample program demonstrates this behavior:
  6805.  
  6806.  _text   segment para public 'CODE'
  6807.          org     100h
  6808.          .286                    ; Used for PUSHA and POPA intstuctions
  6809.                                  ; If 8086 you will need to explictly
  6810.                                  ; push all the registers on the stack
  6811.          assume  cs:_text,ds:_text
  6812.  start:
  6813.          jmp     initialize
  6814.  old_timer       dd  ?           ; space for old timer vector
  6815.  timer_int       proc    far
  6816.          sti                     ; enable interupts
  6817.          assume  ds:nothing
  6818.          pushf                   ; put flags on stack
  6819.          call    old_timer
  6820.          push    ax              ; save registers
  6821.          push    cx
  6822.          push    dx
  6823.          mov     ah,02h
  6824.          int     1ah             ; get time  Returns:
  6825.                                  ; ch = hours in BCD
  6826.                                  ; cl = minutes in BCD
  6827.                                  ; dh = seconds in BCD
  6828.                                  ; dl  ignored
  6829.          call    print_drv       ; call time to read time
  6830.          pop     dx
  6831.          pop     cx
  6832.          pop     ax              ; restore registers
  6833.          iret
  6834.  timer_int       endp
  6835.  
  6836.  print_drv       proc    near
  6837.          assume  cs:_text,ds:_text
  6838.          pusha                   ; Save registers
  6839.          push    es              ; Save Segment registers
  6840.          push    ds
  6841.          mov     bx,cs
  6842.          mov     ds,bx           ; data seg = code seg
  6843.          call    getpos
  6844.          push    bx              ; save cursor on stack
  6845.          mov     bx,41h
  6846.          call    setpos          ; move cursor to right hand corner
  6847.          call    display_time
  6848.          pop     bx
  6849.          call    setpos          ; restore cursor
  6850.          pop     ds              ; restore Segment registers
  6851.          pop     es              ; restore registers
  6852.          popa
  6853.          ret
  6854.  print_drv       endp
  6855.  
  6856.  display_time proc near
  6857.          assume cs:_text,ds:_text
  6858.          push   ax
  6859.          push   bx
  6860.          push   cx
  6861.          push   si
  6862.          mov    ax,cs           ; Data Seg = Code Seg
  6863.          mov    ds,ax
  6864.  ;   Output hours
  6865.          mov        bx,cx       ; move hours to bx
  6866.          mov        al,bh
  6867.          mov        cl,4        ; Set shift count to 4
  6868.          shr        ax,cl       ; rotate to low nybble
  6869.          and        ax,000FH    ; Mask out all but low nybble
  6870.          mov        si,ax       ; Use low nybble as index into
  6871.          mov        al,byte ptr asciitab  [si] ; asciitable
  6872.          call       dchar       ; print 1st digit of hours
  6873.          mov        al,bh
  6874.          and        ax,000FH    ; Mask out all but low nybble
  6875.          mov        si,ax       ; Use low nybble as index into
  6876.          mov        al,byte ptr asciitab  [si] ; asciitable
  6877.          call       dchar
  6878.          call       dcolon
  6879.  
  6880.  ;   Output Minutes
  6881.          mov        al,bl        ; move hours to bx
  6882.          mov        cl,4         ; Set shift count to 8
  6883.          shr        ax,cl        ; rotate to low nybble
  6884.          and        ax,000FH     ; Mask out all but low nybble
  6885.          mov        si,ax        ; Use low nybble as index into
  6886.          mov        al,byte ptr asciitab  [si] ; asciitable
  6887.          call       dchar        ; print 1st digit of hours
  6888.          mov        al,bl
  6889.          and        ax,000FH     ; Mask out all but low nybble
  6890.          mov        si,ax        ; Use low nybble as index into
  6891.          mov        al,byte ptr asciitab  [si] ; asciitable
  6892.          call       dchar        ; print 1st digit of hours
  6893.          call       dcolon
  6894.  
  6895.  ;   Output Seconds
  6896.          mov        al,dh        ; move hours to bx
  6897.          mov        cl,4         ; Set shift count to 4
  6898.          shr        ax,cl        ; rotate to low nybble
  6899.          and        ax,000FH     ; Mask out all but low nybble
  6900.          mov        si,ax        ; Use low nybble as index into
  6901.          mov        al,byte ptr asciitab  [si] ; asciitable
  6902.          call       dchar        ; print 1st digit of hours
  6903.          mov        al,dh
  6904.          and        ax,000FH     ; Mask out all but low nybble
  6905.          mov        si,ax        ; Use low nybble as index into
  6906.          mov        al,byte ptr asciitab  [si] ; asciitable
  6907.          call       dchar
  6908.  
  6909.          pop     si
  6910.          pop     cx
  6911.          pop     bx
  6912.          pop     ax
  6913.          ret
  6914.  display_time endp
  6915.  
  6916.  ; Get the current cursor position and return it in BX
  6917.  getpos  proc    near
  6918.          push    ax
  6919.          push    cx
  6920.          push    dx
  6921.  
  6922.          mov     ah,03h
  6923.          mov     bh,0    ; page zero
  6924.          int     10h
  6925.          mov     bx,dx   ; Return the positon in BX
  6926.  
  6927.          pop     dx
  6928.          pop     cx
  6929.          pop     ax
  6930.          ret
  6931.  getpos  endp
  6932.  
  6933.  ; Set the current cursor postion to the vaule in BX
  6934.  setpos  proc    near
  6935.          push    ax
  6936.          push    bx
  6937.          push    dx
  6938.  
  6939.          mov     ah,02h  ; use int 10h function 2 to set cursor position
  6940.          mov     dx,bx
  6941.          mov     bh,0
  6942.          int     10h
  6943.  
  6944.          pop     dx
  6945.          pop     bx
  6946.          pop     ax
  6947.          ret
  6948.  setpos endp
  6949.  
  6950.  dcolon  proc near
  6951.          mov     al,':'
  6952.          call    dchar
  6953.          ret
  6954.  dcolon  endp
  6955.  
  6956.  ; Display the character contained in Al
  6957.  dchar   proc near
  6958.          push    ax
  6959.          push    bx
  6960.          mov     bh,1
  6961.          mov     ah,0eh
  6962.          int     10h
  6963.          pop     bx
  6964.          pop     ax
  6965.          ret
  6966.  dchar   endp
  6967.  
  6968.  asciitab:     db      '0123456789',0
  6969.  ; The following section  of code executes during initial program
  6970.  ; execution.
  6971.  initialize:
  6972.                  assume ds:_text
  6973.                  mov bx,cs               ; data_seg = code_seg
  6974.                  mov ds,bx
  6975.  
  6976.                  mov     al,08h          ; get vector of interrupt timer
  6977.                  mov     ah,35h          ;
  6978.                  int     21h
  6979.                  mov     word ptr old_timer, bx ; save vector
  6980.                  mov     word ptr old_timer[2],es
  6981.  
  6982.                  mov     dx,offset timer_int
  6983.                  mov     al,08h
  6984.                  mov     ah,25h          ; replace system interrupt
  6985.                  int     21h             ; with our timer_int
  6986.  
  6987.                  mov     dx,offset initialize  ; terminate and stay resident
  6988.                  int     27h                   ; int 21h would work
  6989.  _text   ends
  6990.          end start
  6991.  
  6992.  
  6993.  184. ARPL (Protected Mode Only) Produces Incorrect Code
  6994.  
  6995.  Product Version(s): 5.00   | 5.10
  6996.  Operating System:   MS-DOS | OS/2
  6997.  Flags: ENDUSER | buglist5.10
  6998.  Last Modified: 12-JAN-1989    ArticleIdent: Q39525
  6999.  
  7000.  MASM Versions 5.10 and earlier have the register operands reversed for
  7001.  ARPL as follows:
  7002.  
  7003.     ARPL AX, CX
  7004.  
  7005.  It should have an operand byte of C1 instead of C8.
  7006.  
  7007.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  7008.  researching this problem and will post new information as it becomes
  7009.  available.
  7010.  
  7011.  The following code demonstrates this problem and should assemble to
  7012.  "63 C1":
  7013.  
  7014.  dosseg
  7015.  .model small
  7016.  .386p
  7017.  .code
  7018.  
  7019.  start:
  7020.          ARPL AX, CX
  7021.          end start
  7022.  
  7023.  .........................................................................
  7024.         1                                dosseg
  7025.         2                                .model small
  7026.         3                                assume cs:@code,ds:@data,ss:@data
  7027.         4                                .386p
  7028.         5                                .code
  7029.         6 0000                           _TEXT segment 'CODE'
  7030.         7
  7031.         8 0000                           start:
  7032.         9 0000  63 C8                            ARPL AX, CX
  7033.        10                                        end start
  7034.        11 0002                           @CurSeg ends
  7035.  ..........................................................................
  7036.  
  7037.  
  7038.  185. How to Declare External struct in MASM
  7039.  
  7040.  Product Version(s): 5.00 5.10 | 5.10
  7041.  Operating System:   MS-DOS    | OS/2
  7042.  Flags: ENDUSER | struc external
  7043.  Last Modified: 12-JAN-1989    ArticleIdent: Q39526
  7044.  
  7045.  Question:
  7046.  
  7047.  In mixed-language programming with MASM and C, how can I declare an
  7048.  external variable that is of a "struct" type declared in the C module?
  7049.  
  7050.  Response:
  7051.  
  7052.  You may declare a type with STRUC directive in your MASM module with
  7053.  the same memory-storage template as the "struct" type declared in your
  7054.  C module. You also can declare the variable as external with WORD type
  7055.  if it is a near data, or DWORD type if it is a far data.
  7056.  
  7057.  Note: In C, the packed struct type and the unpacked struct type have
  7058.  different storage in memory. As a result, the template constructed in
  7059.  your MASM module has to match the memory storage exactly. (See the
  7060.  sample program below.) Please refer to the "Microsoft Mixed-Language
  7061.  Programming Guide" (Section 9.2, "Structure, Records, and User-Defined
  7062.  Types") for more specific information regarding the C storage method.
  7063.  
  7064.  You can access the fields of the structure in the assembly module by
  7065.  using the "." operator.
  7066.  
  7067.  The sample program below demonstrates this information:
  7068.  
  7069.  /* sample program, c module */
  7070.  
  7071.  struct record {
  7072.      char byte_1 ;
  7073.      unsigned int word_1 ;
  7074.      char byte_2 ;
  7075.      unsigned int word_2 ;
  7076.      } rec = {0x41, 0xffff, 0x42, 0xeeee} ;
  7077.  
  7078.  void proc_rec(void) ;
  7079.  
  7080.  main()
  7081.  {
  7082.  proc_rec() ;
  7083.  }
  7084.  
  7085.  /* end of the C module */
  7086.  
  7087.  Any template you may create in MASM with STRUC directive has to
  7088.  have unique field names through the MASM module. The field names
  7089.  represent the offset relative to the beginning of the structure. They
  7090.  do not have to be literally the same field names of the structure
  7091.  defined in the C module.
  7092.  
  7093.  The following sample program demonstrates this information:
  7094.  
  7095.  ; sample program, MASM module
  7096.  
  7097.          .model small
  7098.          DOSSEG
  7099.          .data
  7100.  foo     struc
  7101.  byte_1  db   ?      ; if dw is used, next padding byte is not needed.
  7102.  junk_1  db   ?      ; necessary padding, unused byte
  7103.  word_1  dw   ?
  7104.  byte_2  db   ?
  7105.  junk_2  db   ?      ; necessary padding, unused byte
  7106.  word_2  dw   ?
  7107.  foo     ends
  7108.  
  7109.  extrn   _rec:word       ; extrn  _rec:foo   is illeage
  7110.  
  7111.          .code
  7112.          public _proc_rec
  7113.  _proc_rec  proc  near
  7114.          mov ax, _rec.word_1
  7115.          mov bx, _rec.word_2
  7116.          mov cl, _rec.byte_1
  7117.          mov ch, _rec.byte_2
  7118.          ret
  7119.  _proc_rec  endp
  7120.          end
  7121.  
  7122.  ; end of Masm module
  7123.  
  7124.  
  7125.  186. DUP Is a Reserved Word in MASM
  7126.  
  7127.  Product Version(s): 5.10   | 5.10
  7128.  Operating System:   MS-DOS | OS/2
  7129.  Flags: ENDUSER | docerr
  7130.  Last Modified: 12-JAN-1989    ArticleIdent: Q39527
  7131.  
  7132.  The table of reserved words in MASM on Page 69 of the "Microsoft Macro
  7133.  Assembler Programmer's Guide" does not include DUP. DUP is an operator
  7134.  for defining arrays, buffers and other data structures consisting of
  7135.  multiple data objects of the same size. DUP cannot be used as a
  7136.  variable. For example, the following statement allocates the string
  7137.  "Test " five times for a total of 20 bytes:
  7138.  
  7139.     DB   5 DUP ("Test ")
  7140.  
  7141.  
  7142.  187. Error A2105 with PUSHA and POPA Instructions
  7143.  
  7144.  Product Version(s): 5.10
  7145.  Operating System:   MS-DOS
  7146.  Flags: ENDUSER |
  7147.  Last Modified: 12-JAN-1989    ArticleIdent: Q40192
  7148.  
  7149.  MASM generates the following error message if the PUSHA or POPA
  7150.  instructions are used without a prior .186, .286, or .386 directive:
  7151.  
  7152.     A2105: Expected: instruction, directive, or label
  7153.  
  7154.  This error does not clearly indicate exactly what the problem is. By
  7155.  default, the Macro Assembler generates code for the 8086 processor,
  7156.  for which these instructions have not been implemented.
  7157.  
  7158.  Page 302 of the "Macro Assembler 5.1 Programmer's Guide" states that
  7159.  these instructions are implemented only for the 80186, 80286, and
  7160.  80386 processors.
  7161.  
  7162.  If you have an 8086-based computer, you will have to push and pop the
  7163.  registers individually, using PUSH and POP. If you have a 80186,
  7164.  80286, or 80386-based computer, add the appropriate directive to the
  7165.  code.
  7166.  
  7167.  
  7168.  188. Intra-Segment Near Calls in MASM
  7169.  
  7170.  Product Version(s): 4.00 5.00 5.10
  7171.  Operating System:   MS-DOS
  7172.  Flags: ENDUSER |
  7173.  Last Modified: 12-JAN-1989    ArticleIdent: Q40095
  7174.  
  7175.  Question:
  7176.  
  7177.  When there is an intra-module near call in a MASM program, as in the
  7178.  following example, why does the assembler generate a self-relative,
  7179.  intra-segment fixup?
  7180.  
  7181.  foo proc near
  7182.      ...
  7183.  foo ends
  7184.  
  7185.  bar proc near
  7186.      call foo
  7187.  bar endp
  7188.  
  7189.  These are unnecessary as indicated in Intel's "8086 Relocatable
  7190.  Object Module Formats," Appendix 4, which states the following:
  7191.  
  7192.     "Self-Relative references within a single LSEG do not require a fixup,
  7193.     the translator puts the appropriate value in LOCATION."
  7194.  
  7195.  The assembler does not have this problem with near JMPs, only with
  7196.  CALLs.
  7197.  
  7198.  Response:
  7199.  
  7200.  It is correct that Intel states that it is not necessary to perform a
  7201.  fixup for intra-segment calls. However, it is not forbidden to do so.
  7202.  Microsoft is making efforts to optimize the assembler without causing
  7203.  a lack of control by the programmer over the code. While some people
  7204.  desire a given optimization, there are others who would decry it as a
  7205.  loss of control over their code. There are keywords that allow you to
  7206.  force various types of calls and jumps such as the SHORT keyword. Yu
  7207.  may want to check these to see if they offer the control you need.
  7208.  
  7209.  The workaround for generation of any special opcode is to use the
  7210.  "dw" or "db" directive in the code segment. The following can be
  7211.  assembled [2A D2] or [28 D2]:
  7212.  
  7213.     sub dl,dl
  7214.  
  7215.  To get the second generation, you must enter the following:
  7216.  
  7217.     db 28h, 0d2h
  7218.  
  7219.  
  7220.  189. Phase Error Generated on Instructions Using Equate Variable
  7221.  
  7222.  Product Version(s): 5.10   | 5.10
  7223.  Operating System:   MS-DOS | OS/2
  7224.  Flags: ENDUSER |
  7225.  Last Modified: 20-APR-1989    ArticleIdent: Q40452
  7226.  
  7227.  When the SAVESIDI is not equated in the following code, the statements
  7228.  mov bl,q[bp] and mov bx,q+2[bp] cause a phase error on the label
  7229.  intret:
  7230.  
  7231.      P equ 4
  7232.      SPTR  equ 5
  7233.  
  7234.      ifndef SAVESIDI
  7235.      SAVESIDI equ 1
  7236.      endif
  7237.  
  7238.      code segment
  7239.      assume cs:code
  7240.      q       equ     (P + 4 * SAVESIDI + 2 * SPTR + 2)
  7241.  
  7242.      int86 proc
  7243.          mov     BL,q[BP]        ;interrupt number
  7244.          mov     BX,q+2[BP]              ;input registers
  7245.      inret:
  7246.      int86 endp
  7247.      code ends
  7248.      end
  7249.  
  7250.  You must define labels used in expressions on both passes. On pass 1
  7251.  SAVESIDI isn't defined, so it gets the value of 1. On pass 2 it is
  7252.  defined; therefore, you get a phase error.
  7253.  
  7254.  The following is the standard workaround for IFDEF label type
  7255.  statements. The added lines are highlighted by ">>".
  7256.  
  7257.      P equ 4
  7258.      SPTR  equ 5
  7259.  
  7260.      ifndef SAVESIDI
  7261.      SAVESIDI equ 1
  7262.  >>  else
  7263.  >>  SAVESIDI equ SAVESIDI
  7264.      endif
  7265.  
  7266.      code segment
  7267.      assume cs:code
  7268.      q       equ     (P + 4 * SAVESIDI + 2 * SPTR + 2)
  7269.  
  7270.      int86 proc
  7271.          mov     BL,q[BP]        ;interrupt number
  7272.          mov     BX,q+2[BP]              ;input registers
  7273.      intret:
  7274.      int86 endp
  7275.      code ends
  7276.      end
  7277.  
  7278.  
  7279.  190. Include in MASM Source Effects /Z
  7280.  
  7281.  Product Version(s): 5.10   | 5.10
  7282.  Operating System:   MS-DOS | OS/2
  7283.  Flags: ENDUSER |
  7284.  Last Modified: 24-APR-1989    ArticleIdent: Q40462
  7285.  
  7286.  After the call to the include file, you cannot use /Z options to
  7287.  generate source lines when errors occur if a MASM source file contains
  7288.  an include instruction.
  7289.  
  7290.  The following source demonstrates this situation if it is assembled:
  7291.  
  7292.  masm /Z m9.asm;
  7293.  
  7294.  dosseg
  7295.  .model small
  7296.  .data
  7297.  .code
  7298.      xxx ds,si
  7299.      include m8.asm
  7300.      xxx ds,si
  7301.  
  7302.  end
  7303.  
  7304.  As long as m8.asm contains any characters, the output of the assemble
  7305.  is as follows:
  7306.  
  7307.  Microsoft (R) Macro Assembler Version 5.10
  7308.  Copyright (C) Microsoft Corp 1981, 1988.  All rights reserved.
  7309.  
  7310.                                      xxx ds,si
  7311.  m9.asm(8): error A2105: Expected: instruction, directive, or label
  7312.  m9.asm(10): error A2105: Expected: instruction, directive, or label
  7313.  
  7314.    49254 Bytes symbol space free
  7315.  
  7316.        0 Warning Errors
  7317.        2 Severe  Errors
  7318.  
  7319.  If the instruction "include m8.asm" is commented out, the output of
  7320.  the assembler is as follows:
  7321.  
  7322.  Microsoft (R) Macro Assembler Version 5.10
  7323.  Copyright (C) Microsoft Corp 1981, 1988.  All rights reserved.
  7324.  
  7325.                                      xxx ds,si
  7326.  m9.asm(8): error A2105: Expected: instruction, directive, or label
  7327.                                      xxx ds,si
  7328.  m9.asm(10): error A2105: Expected: instruction, directive, or label
  7329.  
  7330.    49390 Bytes symbol space free
  7331.  
  7332.        0 Warning Errors
  7333.        2 Severe  Errors
  7334.  
  7335.  
  7336.  191. Erroneous 8086 Opcode for Logical AND Instruction
  7337.  
  7338.  Product Version(s): m5.10 5.10a | 5.10 5.10a
  7339.  Operating System:   MS-DOS     | OS/2
  7340.  Flags: ENDUSER | buglist5.10
  7341.  Last Modified: 12-JUN-1990    ArticleIdent: Q61054
  7342.  
  7343.  Problem:
  7344.  
  7345.  I bought an operating system for a V25 processor that runs with the
  7346.  INTEL 8086 instruction set. The operating system source code was
  7347.  assembled with MASM 5.10 and the .8086 directive. The instruction runs
  7348.  on an 8086 machine, but the machine with the V25 processor hangs at
  7349.  the following instruction:
  7350.  
  7351.        AND Word Ptr [S+10], -5 ; Opcode generated is
  7352.                                ; 83 64 0A FB
  7353.  
  7354.  Response:
  7355.  
  7356.  In Appendix A-4 of the INTEL 8086/8088 programmer's reference manual
  7357.  (1986 edition), there is no opcode for AND that begins with 83. There
  7358.  is an opcode for AND that begins with 81. The opcode for AND reads as
  7359.  follows:
  7360.  
  7361.     81 64 0A 00 FB
  7362.  
  7363.  However, there is an opcode for a sign-extended immediate instruction
  7364.  in the 80386 instruction set that has the first byte of the opcode as
  7365.  83.
  7366.  
  7367.  The V25 adheres strictly to INTEL's 8086 standard and will not accept
  7368.  an 80386 instruction rather than an 8086 instruction.
  7369.  
  7370.  Microsoft has confirmed this to be a problem in MASM Version 5.10. We
  7371.  are researching this problem and will post new information here as it
  7372.  becomes available.
  7373.  
  7374.  
  7375.  192. MASM Does Not Support 80386 Flat Model
  7376.  
  7377.  Product Version(s): 4.00 5.00 5.10
  7378.  Operating System:   MS-DOS
  7379.  Flags: ENDUSER |
  7380.  Last Modified: 24-APR-1989    ArticleIdent: Q40572
  7381.  
  7382.  The Microsoft Macro Assembler Version 5.10 does not support
  7383.  programming in the flat model. The flat model is a memory-organization
  7384.  model on the Intel 80386 chip that allows full 32-bit addressing and
  7385.  segments greater than 64K.
  7386.  
  7387.  Microsoft Macro Assembler supports only the tiny-, small-, compact-,
  7388.  medium-, and large-memory model. For more information on the flat
  7389.  model, consult Intel's "80386 Programmer's Reference Manual."
  7390.  
  7391.  
  7392.  193. Mnemonic Letters Indicating Types of Jumps Documentation Error
  7393.  
  7394.  Product Version(s): 5.00   | 5.10
  7395.  Operating System:   MS-DOS | OS/2
  7396.  Flags: ENDUSER | docerr
  7397.  Last Modified: 24-APR-1989    ArticleIdent: Q40627
  7398.  
  7399.  Page 336 of the "Microsoft Macro Assembler Programmer's Guide"
  7400.  incorrectly associates the mnemonic letters "G" and "L" with jumps on
  7401.  unsigned comparisons, and the letters "A" and "B" with jumps on signed
  7402.  comparisons.
  7403.  
  7404.  The two sets of letters should be reversed with their respective
  7405.  comparisons to form the following, correct table:
  7406.  
  7407.     Letter        Meaning
  7408.  
  7409.     J             Jump
  7410.     G             Greater than (for signed comparisons)
  7411.     L             Less than (for signed comparisons)
  7412.     A             Above (for unsigned comparisons)
  7413.     B             Below (for unsigned comparisons)
  7414.     E             Equal
  7415.     N             Not
  7416.  
  7417.  
  7418.  194. Using "Low" in Conjunction with the "Offset" Operator
  7419.  
  7420.  Product Version(s): 5.10
  7421.  Operating System:   MS-DOS
  7422.  Flags: ENDUSER | buglist5.10 H_MASM 5.10
  7423.  Last Modified: 24-APR-1989    ArticleIdent: Q40852
  7424.  
  7425.  Problem:
  7426.  
  7427.  When attempting to use the "low" in conjunction with the "offset"
  7428.  operator, I get the following error message:
  7429.  
  7430.     error message A2042: Constant expected
  7431.  
  7432.  The following is a code example that generates the error message:
  7433.  
  7434.   = 1234           data_equ equ     1234h        ;equate data
  7435.   0000             cseg     segment para public
  7436.                            assume  cs:cseg, ds:cseg  ss:stack
  7437.  
  7438.   0000             testlow  proc    far
  7439.  
  7440.   0000  E9 01FF R  start:   jmp     begin
  7441.   0003  00         data_a   db      0
  7442.  
  7443.   0004  11 03 R            db      11h, low offset data_a
  7444.  testlow.asm(29): error A2042: Constant expected
  7445.  
  7446.  Response:
  7447.  
  7448.  This problem has been confirmed with MASM Version 5.10. Microsoft is
  7449.  researching this problem and will post new information as it becomes
  7450.  available.
  7451.  
  7452.  Please note that the same function has been checked against MASM
  7453.  Versions 5.00 and 4.00, and assembled without error.
  7454.  
  7455.  
  7456.  195. Setting Page Width of Printed Listing
  7457.  
  7458.  Product Version(s): 5.10   | 5.10
  7459.  Operating System:   MS-DOS | OS/2
  7460.  Flags: ENDUSER |
  7461.  Last Modified: 24-APR-1989    ArticleIdent: Q42290
  7462.  
  7463.  The PAGE directive allows you to set the width and length of the
  7464.  printed page, or generate a page break in the listing. This is
  7465.  particularly useful when the listing wraps around to the next line and
  7466.  you have a wide carriage printer.
  7467.  
  7468.  The syntax is PAGE [[length],width] where length must be in the range
  7469.  of 10-255 lines and width must be in the range of 60-132 characters.
  7470.  The default page length is 50 lines and the default width is 80
  7471.  characters.
  7472.  
  7473.  To set the width to 132 characters, use the following command within
  7474.  the source code:
  7475.  
  7476.     PAGE ,132
  7477.  
  7478.  For more information, see Pages 243-244 of the "Microsoft Macro
  7479.  Assembler 5.1 Programmer's Guide."
  7480.  
  7481.  
  7482.  196. Direct Memory Addressing
  7483.  
  7484.  Product Version(s): 4.x 5.00 5.10 | 5.10
  7485.  Operating System:   MS-DOS         | OS/2
  7486.  Flags: ENDUSER |
  7487.  Last Modified: 24-APR-1989    ArticleIdent: Q42729
  7488.  
  7489.  Question:
  7490.  
  7491.  When I try to do a direct memory operation with the instruction MOV
  7492.  AX,[1000], the Macro Assembler generates a move instruction with the
  7493.  immediate value of 1000 rather than a direct memory access of the
  7494.  location 1000. How can I do a direct memory access instruction?
  7495.  
  7496.  Response:
  7497.  
  7498.  A segment register must be specified for a direct memory operand that
  7499.  contains a constant with no label, as in the following
  7500.  
  7501.     MOV AX,DS:[1000]
  7502.  
  7503.  This example will not insert a segment override prefix into the
  7504.  assemble code because the instruction uses the DS register by default.
  7505.  Use of any segment register other than the default register would
  7506.  insert the override prefix.
  7507.  
  7508.  For more information, see Section 14.3.1 on Direct Memory Operands,
  7509.  Page 276 in the MASM 5.10 programmer's guide.
  7510.  
  7511.  
  7512.  197. Stack Considerations When Calling Procedures in MASM
  7513.  
  7514.  Product Version(s): 5.10   | 5.10
  7515.  Operating System:   MS-DOS | OS/2
  7516.  Flags: ENDUSER |
  7517.  Last Modified: 30-AUG-1989    ArticleIdent: Q44512
  7518.  
  7519.  When calling procedures in Microsoft Macro Assembler, you must watch
  7520.  the stack manipulations within the called procedure.
  7521.  
  7522.  If several items are PUSHed onto the stack, they must be POPped off in
  7523.  the same number. This is necessary because when the RET is encountered
  7524.  at the end of the procedure, it expects the return address to be on
  7525.  the top of the stack.
  7526.  
  7527.  This problem can be avoided by temporarily storing the return address
  7528.  in a location other than the stack and then PUSHing it back on before
  7529.  the RET. However, because the results may not be consistent, this
  7530.  workaround is not recommended.
  7531.  
  7532.  
  7533.  198. MASM Calling C Making MASM Main Routine
  7534.  
  7535.  Product Version(s): 5.10
  7536.  Operating System:   MS-DOS
  7537.  Flags: ENDUSER |
  7538.  Last Modified: 30-AUG-1989    ArticleIdent: Q44923
  7539.  
  7540.  You can make a program that starts with MASM and calls C. This method
  7541.  of programming is not recommended because starting with MASM will
  7542.  mean that the C start-up code will not be executed, which may cause
  7543.  future problems calling some of the C library functions. Run-time
  7544.  error messages may be affected as well as routines that use system
  7545.  symbols.
  7546.  
  7547.  The following is an example of the macro-assembler main routine
  7548.  which calls a C routine.
  7549.  
  7550.          .MODEL LARGE,C
  7551.          .CODE
  7552.          EXTRN CSUB
  7553.  MAIN    PROC           ; Must call main (_main without ,C)
  7554.          PUSH     AX             ; Push argument on stack
  7555.          PUSH     BX             ; Push another argument
  7556.          CALL     CSUB   ; Call C subroutine
  7557.          ADD   SP,4      ; Fix-up stack after C subroutine
  7558.  MAIN ENDP
  7559.          END            ; Do not specify starting location
  7560.  
  7561.  
  7562.  199. Some Coprocessor Instructions Not Emulated
  7563.  
  7564.  Product Version(s): 4.x 5.00 5.10a
  7565.  Operating System:   MS-DOS | OS/2
  7566.  Flags: ENDUSER |
  7567.  Last Modified: 30-AUG-1989    ArticleIdent: Q45146
  7568.  
  7569.  The emulator libraries included with the languages do not support all
  7570.  coprocessor instructions. The following error message results from
  7571.  unsupported coprocessor instructions:
  7572.  
  7573.     run-time error M6107: MATH
  7574.     - floating-point error: unemulated
  7575.  
  7576.  The following is a list of unemulated coprocessor instructions:
  7577.  
  7578.     FBLD   -  (emulated in XENIX 386 but not MS-DOS, OS/2)
  7579.     FBSTP  -  (emulated in XENIX 386 but not MS-DOS, OS/2)
  7580.     FCOS
  7581.     FDECSTP
  7582.     FINCSTP
  7583.     FINIT  -  (emulated in XENIX 386 but not MS-DOS, OS/2)
  7584.     FLDENV -  (emulated in XENIX 386 but not MS-DOS, OS/2)
  7585.     FNOP   -  (emulated in XENIX 386 but not MS-DOS, OS/2)
  7586.     FPREM1
  7587.     FRSTOR
  7588.     FSAVE
  7589.     FSETPM
  7590.     FSIN
  7591.     FSINCOS
  7592.     FSTENV -  (emulated in XENIX 386 but not MS-DOS, OS/2)
  7593.     FUCOM
  7594.     FUCOMP
  7595.     FUCOMPP
  7596.     FXTRACT
  7597.  
  7598.  Also, some of the No-Wait forms of instructions are not emulated (e.g.
  7599.  FNSTENV, FNINIT).
  7600.  
  7601.  
  7602.  200. MASM: Linker Error L2002: Fixup Overflow
  7603.  
  7604.  Product Version(s): 5.10
  7605.  Operating System:   MS-DOS
  7606.  Flags: ENDUSER |
  7607.  Last Modified: 30-AUG-1989    ArticleIdent: Q46378
  7608.  
  7609.  The following message occurs when data defined in the data segment is
  7610.  accessed with a CS segment override:
  7611.  
  7612.  foo.OBJ(foo.ASM) : error L2002: fixup overflow at 0012 in segment _TEXT
  7613.  pos: 658 Record type: 73EE
  7614.  frm seg _TEXT, tgt seg _DATA
  7615.  
  7616.  Code Sample
  7617.  -----------
  7618.  
  7619.         .DATA
  7620.  old_dma_vect    dd      0
  7621.         .CODE
  7622.  ;
  7623.  capture proc
  7624.        .
  7625.          mov     word ptr cs:old_dma_vect,bx  ;(This line caused the error)
  7626.        .
  7627.          end capture
  7628.  
  7629.  
  7630.  201. Passing a Constant from C to Assembly with a Header File
  7631.  
  7632.  Product Version(s): 5.10 5.10a
  7633.  Operating System:   MS-DOS
  7634.  Flags: ENDUSER |
  7635.  Last Modified:  3-JUL-1990    ArticleIdent: Q63039
  7636.  
  7637.  The example below illustrates how to pass a constant value between C
  7638.  and Assembly without passing the constant as a parameter. This
  7639.  information also applies to Microsoft C for OS/2 versions 5.10 and
  7640.  6.00.
  7641.  
  7642.  The constant in C is given the type identifier "const" and placed in a
  7643.  header file. This makes the constant public. Within the assembly
  7644.  module, the variable is declared as "extrn" in two places.
  7645.  
  7646.  At the top of the assembly module it indicates to the assembler that
  7647.  the variable is declared externally. It then needs to be declared
  7648.  within the procedure. This allows the language translator (assembler)
  7649.  to provide the right correction record for the linker to resolve.
  7650.  
  7651.  The following code illustrates the above:
  7652.  
  7653.  #include <stdio.h>
  7654.  #include "test.h"     /*Header file with constant declared*/
  7655.  
  7656.  extern void testor();
  7657.  
  7658.  main()
  7659.  
  7660.  {
  7661.  
  7662.   printf("Selec is initially %xH\n", selec);
  7663.  
  7664.   testor();
  7665.  
  7666.   printf("Selec is modified to %xH\n", selec);
  7667.  
  7668.   }
  7669.  
  7670.  The contents of the header file "test.h" are as follows:
  7671.  
  7672.     const int selec = 0x77;
  7673.  
  7674.  The following is the assembly module that is called:
  7675.  
  7676.  extrn _selec:far               ;selec declared extrn
  7677.  dgroup    group dataseg
  7678.  dataseg   segment para public 'data'
  7679.  dataseg   ends
  7680.  
  7681.  codeseg   segment para public 'code'
  7682.  codeseg   ends
  7683.  
  7684.  codeseg   segment
  7685.  
  7686.            public _testo
  7687.  _testor proc far
  7688.  
  7689.            extrn  _selec:far            ;selec declared extrn
  7690.            push    bp
  7691.            mov     bp,sp
  7692.  
  7693.            assume  ds:dgroup
  7694.            mov ax, dgroup
  7695.            mov ds, ax
  7696.  
  7697.            lea bx, dgroup:_selec  ;underscore added for compatibility
  7698.                                   ;with C language conventions
  7699.  
  7700.            mov ax, word ptr dgroup:[bx] ;viewed through CodeView ax=77H
  7701.  
  7702.            mov word ptr[bx], 0A8H       ;value in selec changed to A8H
  7703.  
  7704.            pop     bp
  7705.  
  7706.            ret
  7707.  
  7708.  _testor endp
  7709.  
  7710.  codeseg ends
  7711.  
  7712.       end
  7713.  
  7714.  The following is the makefile used to compile and link the above
  7715.  files:
  7716.  
  7717.  all=1.obj 2.obj
  7718.                         ;update pseudo-target ensures a
  7719.                         ;compile and link each time make is invoked
  7720.  update: 1.c
  7721.      cl /Zi /AL /c 1.c
  7722.  
  7723.  update: 2.asm
  7724.      masm /Zi 2.asm;
  7725.  
  7726.  update: $(all)
  7727.      link /co /M  $(all),,1,/nod llibcer;
  7728.  
  7729.  
  7730.  202. MASM ALIGN Directive May Not Work Properly
  7731.  
  7732.  Product Version(s):
  7733.  Operating System:   5.00 5.10 5.10a | 5.00 5.10 5.10a
  7734.  Flags: MS-DOS          | OS/2
  7735.  Last Modified: 30-AUG-1989    ArticleIdent: Q46919
  7736.  ENDUSER |
  7737.  
  7738.  The ALIGN directive for MASM may not work properly. It aligns values 2
  7739.  bytes beyond where they should be aligned, e.g. if ALIGN 4 is being
  7740.  used, values align only at the following offsets:
  7741.  
  7742.      02h, 06h, 0Ah, 0Eh, ... etc.
  7743.  
  7744.  If ALIGN 16 (decimal) is being used, values are aligned only at the
  7745.  following offsets:
  7746.  
  7747.      02h, 12h, 22h, 32h, ... etc.
  7748.  
  7749.  This is not a problem for word alignment. ALIGN 2 has the same effect as
  7750.  the EVEN directive.
  7751.  
  7752.  Microsoft is researching this problem and will post new information as
  7753.  it becomes available.
  7754.  
  7755.  
  7756.  203. MASM Err Msg: Error L2002: Fixup Overflow
  7757.  
  7758.  Product Version(s): 5.10
  7759.  Operating System:   MS-DOS
  7760.  Flags: ENDUSER |
  7761.  Last Modified: 12-SEP-1989    ArticleIdent: Q47456
  7762.  
  7763.  The following message occurs when data defined in the data segment is
  7764.  overridden with a Segment Override using the code segment register:
  7765.  
  7766.  foo.OBJ(foo.ASM): error L2002: fixup overflow at 0012 in segment_TEXT
  7767.  pos: 658 Record type: 73EE
  7768.  frm seg _TEXT, tgt seg _DATA
  7769.  
  7770.  This error occurs when you incorrectly try to access data in the code
  7771.  segment rather than in the data segment in the following line:
  7772.  
  7773.          mov     word ptr cs:old_dma_vect,bx     ;
  7774.  
  7775.  The line should be as follows:
  7776.  
  7777.       mov        word ptr ds:old_dma_vect,bx   ;
  7778.  
  7779.  Code Sample:
  7780.  
  7781.        .DATA
  7782.  old_dma_vect    dd      0
  7783.         .CODE
  7784.  ;
  7785.  capture proc
  7786.        .
  7787.        .
  7788.        .
  7789.          mov     word ptr cs:old_dma_vect,bx     ; (INCORRECT)
  7790.       mov        word ptr ds:old_dma_vect,bx   ; (CORRECT)
  7791.        .
  7792.          end capture
  7793.  
  7794.  
  7795.  204. MASM Err Msg: REP OUTSW Is a 386-Only Instruction
  7796.  
  7797.  Product Version(s): 5.00 5.10 | 5.00 5.10
  7798.  Operating System:   MS-DOS    | OS/2
  7799.  Flags: ENDUSER |
  7800.  Last Modified: 30-AUG-1989    ArticleIdent: Q47504
  7801.  
  7802.  Using the REP OUTSW instruction generates the following error:
  7803.  
  7804.     A2066: Must have instruction after prefix.
  7805.  
  7806.  This problem occurs because the default assembly mode is 8086,
  7807.  but the REP OUTSW is a 80386 instruction.
  7808.  
  7809.  To enable the assembler to assemble properly, the .386 or .386P
  7810.  directive must be previously placed in the source code.
  7811.  
  7812.  
  7813.  205. Error in Macro Example in MASM 5.10 Update Manual
  7814.  
  7815.  Product Version(s): 5.10
  7816.  Operating System:   MS-DOS
  7817.  Flags: ENDUSER | docerr
  7818.  Last Modified:  2-MAR-1990    ArticleIdent: Q49245
  7819.  
  7820.  The macro example on Page Update-23 in the "Microsoft Macro Assembler
  7821.  5.1: Updates and Microsoft Editor" has an error in it. The macro in
  7822.  the example is called RESTREGS.
  7823.  
  7824.  The current example reads as follows:
  7825.  
  7826.     The INSTR directive returns the position of a string within
  7827.     another string.
  7828.  
  7829.      restregs    MACRO
  7830.         numloc   instr  regpushed,"#"
  7831.                .
  7832.                .
  7833.                .
  7834.                  ENDM
  7835.  
  7836.  The second line should read as follows:
  7837.  
  7838.          numloc  instr  regpushed,<#>
  7839.  
  7840.  This example does not work correctly on MASM Version 5.10 but does
  7841.  work on MASM Version 5.10a. This is due to a problem with the SUBSTR
  7842.  directive in MASM 5.10 with regard to assigning a string a substring
  7843.  of itself.
  7844.  
  7845.  
  7846.  206. Using Offset with a Group of Data Segments
  7847.  
  7848.  Product Version(s): 5.10a
  7849.  Operating System:   MS-DOS
  7850.  Flags: ENDUSER | quickassembler quick assembler qasm
  7851.  Last Modified: 16-MAR-1990    ArticleIdent: Q49246
  7852.  
  7853.  When using the OFFSET directive to refer to a variable defined in a
  7854.  segment that is part of a group, the offset generated is from the
  7855.  beginning of the segment instead of the beginning of the group. The
  7856.  group is defined properly and DS is assumed to be pointing to the
  7857.  group.
  7858.  
  7859.  This problem occurs in Microsoft Macro Assembler Version 5.10a and in
  7860.  QuickAssembler Version 2.00.
  7861.  
  7862.  The following example demonstrates this problem:
  7863.  
  7864.  dgroup   group data1,data2
  7865.           assume cs:code,ds:dgroup
  7866.  
  7867.  data1    segment   para  public  'data'
  7868.  var1       dw      0
  7869.             dw      0
  7870.  data1    ends
  7871.  
  7872.  data2    segment   para  public  'data'
  7873.  var2       dw      0
  7874.  data2    ends
  7875.  
  7876.  code     segment   'code'
  7877.  start:   mov       bx,offset var1
  7878.           mov       bx,offset var2         <--incorrect
  7879.           mov       bx,offset dgroup:var2  <--works all cases
  7880.           lea       bx,var2                <--also works
  7881.  code     ends
  7882.           end       start
  7883.  
  7884.  When the segment align type is PARA or PAGE, the above code will be
  7885.  incorrect. The offset directive generates an offset relative to the
  7886.  beginning of the segment instead of the beginning of the group. When
  7887.  the segment align type is BYTE,WORD or DWORD, the correct offset from
  7888.  the group beginning is generated.
  7889.  
  7890.  Please note the following:
  7891.  
  7892.  1. By default the Assembler uses PARA align.
  7893.  
  7894.  2. When a segment override is used in the OFFSET expression (as in the
  7895.     above example), the correct offset is then generated.
  7896.  
  7897.  3. The LEA instruction also generates the correct offset.
  7898.  
  7899.  
  7900.  207. MASM Linker Err Msg: L1083: Cannot Open Run File Under OS/2
  7901.  
  7902.  Product Version(s): 5.10a
  7903.  Operating System:   OS/2
  7904.  Flags: ENDUSER |
  7905.  Last Modified: 29-MAR-1990    ArticleIdent: Q49322
  7906.  
  7907.  When linking a Macro Assembler program that is currently running in
  7908.  another session, the linker returns the following error:
  7909.  
  7910.     L1083 CANNOT OPEN RUN FILE
  7911.  
  7912.  This error disappears when the program that is running is closed.
  7913.  
  7914.  This error occurs because OS/2 may want to discard the program's code
  7915.  segment and reload it later. If the linker writes a new EXE file and
  7916.  OS/2 reloads the code segment, it will be different and cause the
  7917.  accompanying problems.
  7918.  
  7919.  
  7920.  208. MASM Err Msg A2063, Name in .MODEL SMALL Not Ignored
  7921.  
  7922.  Product Version(s): 5.10
  7923.  Operating System:   MS-DOS
  7924.  Flags: ENDUSER | docerr
  7925.  Last Modified: 29-MAR-1990    ArticleIdent: Q49699
  7926.  
  7927.  Page 89 of the "Microsoft Macro Assembler 5.0 for the MS-DOS Operating
  7928.  System: Programmer's Guide" incorrectly states that the name is
  7929.  ignored if given with small or compact models.
  7930.  
  7931.  With .MODEL SMALL or .MODEL COMPACT, the name for code segments is not
  7932.  ignored, but does produce the following error:
  7933.  
  7934.     A2063: Operand Combination Illegal
  7935.  
  7936.  On the other hand, .MODEL MEDIUM inserts a _text or append an _text to
  7937.  a name.
  7938.  
  7939.  
  7940.  209. MASM Err Msg: A2056: Immediate Mode Illegal
  7941.  
  7942.  Product Version(s): 5.00 5.10 | 5.00 5.10
  7943.  Operating System:   MS-DOS    | OS/2
  7944.  Flags: ENDUSER |
  7945.  Last Modified: 29-MAR-1990    ArticleIdent: Q49701
  7946.  
  7947.  The following information is from Page 437 of the "Microsoft Macro
  7948.  Assembler 5.0 for the MS-DOS Operating System: Programmer's Guide":
  7949.  
  7950.     An immediate operand was supplied to an instruction that cannot use
  7951.     immediate data. For example, the following statement is illegal:
  7952.  
  7953.        mov ds,DGROUP
  7954.  
  7955.     You must move the segment address into a general register and then
  7956.     move it from that register to DS.
  7957.  
  7958.  
  7959.  210. PROC Directive Requires Language Parameter
  7960.  
  7961.  Product Version(s): 5.10   | 5.10
  7962.  Operating System:   MS-DOS | OS/2
  7963.  Flags: ENDUSER | buglist5.10
  7964.  Last Modified: 29-MAR-1990    ArticleIdent: Q49703
  7965.  
  7966.  If the PROC directive is used with arguments and a language specifier
  7967.  is not used, the following warning is generated:
  7968.  
  7969.     A4001: Extra characters on line
  7970.  
  7971.  The following is an example:
  7972.  
  7973.      .model small
  7974.      .code
  7975.      public foo
  7976.      foo proc uses di si, arg1:word
  7977.      foo endp
  7978.      end
  7979.  
  7980.  The statement "foo proc uses di si, arg1:word" generates the warning.
  7981.  
  7982.  The workaround for this problem is to specify a language parameter. To
  7983.  correct the program above, replace the statement ".model small" with
  7984.  ".model small,language" where language is either FORTRAN, PASCAL,
  7985.  BASIC, or C.
  7986.  
  7987.  Microsoft has confirmed this to be a problem in Macro Assembler
  7988.  Version 5.10. We are researching this problem and will post new
  7989.  information here as it becomes available.
  7990.  
  7991.  
  7992.  211. Labeling Variables with Multiple Names in MASM 5.00, 5.10
  7993.  
  7994.  Product Version(s): 5.00 5.10 | 5.00 5.10
  7995.  Operating System:   MS-DOS    | OS/2
  7996.  Flags: ENDUSER |
  7997.  Last Modified: 29-MAR-1990    ArticleIdent: Q49705
  7998.  
  7999.  You can multiply define a memory location by using the LABEL
  8000.  directive. The following information comes from Pages 136-137 of the
  8001.  "Microsoft Macro Assembler 5.0 for the MS-DOS Operating System:
  8002.  Programmer's Guide":
  8003.  
  8004.     name LABEL type
  8005.  
  8006.     The name is the symbol assigned to the variable, and type is the
  8007.     variable size. The type can be any one of the following type
  8008.     specifiers:  BYTE, WORD, DWORD, FWORD, QWORD, or TBYTE. It can also
  8009.     be the name of a previously defined structure.
  8010.  
  8011.  The following is an example of declaring two names for the same
  8012.  variable:
  8013.  
  8014.  rainbow LABEL WORD
  8015.  wizard  DW ?
  8016.  
  8017.  In this case, rainbow and wizard point to the same word in memory.
  8018.  
  8019.  
  8020.  212. Shifting (SHL) Using an 8-Bit Constant
  8021.  
  8022.  Product Version(s): 5.10   | 5.10
  8023.  Operating System:   MS-DOS | OS/2
  8024.  Flags: ENDUSER |
  8025.  Last Modified: 29-MAR-1990    ArticleIdent: Q49707
  8026.  
  8027.  Problem:
  8028.  
  8029.  Page 96 of the "Microsoft Macro Assembler for MS OS/2 and MS-DOS
  8030.  Operating Systems: Version 5.1 Update" says that I can use the
  8031.  shift-left instruction (SHL) with an 8-bit constant. Yet, when I
  8032.  assemble my source code, I get the following error:
  8033.  
  8034.     A2052: Improper operand type
  8035.  
  8036.  Response:
  8037.  
  8038.  The third paragraph on Page 96 states the following:
  8039.  
  8040.     On the 8088 and 8086, the source operand can be either CL or 1. On
  8041.     the 80186-80386 processors, the source operand can be CL or an
  8042.     8-bit constant.
  8043.  
  8044.  To use the 8-bit constant, you must specify that you are writing 186,
  8045.  286, or 386 code. The assembler assumes the worst and defaults to the
  8046.  8088 options and doesn't accept the 8-bit constant.
  8047.  
  8048.  The following code generates the error:
  8049.  
  8050.  .model small
  8051.  .code
  8052.  shl bl,2
  8053.  end
  8054.  
  8055.  To correct the problem, use the .186, .286, or .386 directive such as
  8056.  the following:
  8057.  
  8058.  .model small
  8059.  .286
  8060.  .code
  8061.  shl bl,2
  8062.  end
  8063.  
  8064.  
  8065.  213. Jumping to an Absolute Addresss with MASM
  8066.  
  8067.  Product Version(s): 5.00 5.10 | 5.00 5.10
  8068.  Operating System:   MS-DOS    | OS/2
  8069.  Flags: ENDUSER | bios rom
  8070.  Last Modified: 29-MAR-1990    ArticleIdent: Q49900
  8071.  
  8072.  The Microsoft Macro Assembler will not let you jump directly to a
  8073.  hexadecimal address; the jump must be done indirectly. If you try to
  8074.  assemble the following, you will receive the error message "A2038:
  8075.  left operand must have segment":
  8076.  
  8077.         jmp 0FFFFh:0000h
  8078.  
  8079.  To make this jump, you must create a pointer to point to the offset
  8080.  inside the segment in question. For example:
  8081.  
  8082.      bios segment at 0FFFFh
  8083.      org 0
  8084.      reset label far
  8085.      bios ends
  8086.  
  8087.  Then, any one of the following three jump instructions will perform
  8088.  the jump to offset 0000h within segment FFFFh (the opcode that is
  8089.  generated is EA 0000 ----):
  8090.  
  8091.      jmp far ptr reset
  8092.      jmp bios:reset
  8093.      jmp reset
  8094.  
  8095.  This process is covered on Page 101 of the "Microsoft Macro Assembler
  8096.  Programmer's Guide." The second paragraph states the following:
  8097.  
  8098.     An AT segment typically contains no code or initialized data.
  8099.     Instead, it represents an address template that can be placed over
  8100.     code or data already in memory, such as a screen buffer or other
  8101.     absolute memory locations defined by hardware. The linker will not
  8102.     generate any code or data for AT segments, but existing code or
  8103.     data can be accessed by name if it is given a label in an AT
  8104.     segment.
  8105.  
  8106.  
  8107.  214. Indirect Far Jump/Call in MASM 5.10
  8108.  
  8109.  Product Version(s): 5.10
  8110.  Operating System:   MS-DOS
  8111.  Flags: ENDUSER |
  8112.  Last Modified: 29-MAR-1990    ArticleIdent: Q50405
  8113.  
  8114.  The following example demonstrates how to generate an indirect far
  8115.  call or jump in MASM:
  8116.  
  8117.  .model large
  8118.  
  8119.  .data
  8120.  jumptable   dd    routine1
  8121.              dd    routine2
  8122.  
  8123.  .code
  8124.  start:   mov    ax,@data
  8125.           mov    ds,ax
  8126.           call   dword ptr  jumptable
  8127.           jmp    dword ptr  jumptable+4
  8128.           ret
  8129.  
  8130.  cseg     segment  word public 'code'
  8131.  routine1 proc
  8132.             ret
  8133.  routine1 endp
  8134.  
  8135.  routine2 proc
  8136.             ret
  8137.  routine2 endp
  8138.  cseg     ends
  8139.  
  8140.           end    start
  8141.  
  8142.  
  8143.  215. @MakeFil Macro Spelled Wrong on MASM 5.10 CodeView Tutorial
  8144.  
  8145.  Product Version(s): 5.10
  8146.  Operating System:   MS-DOS
  8147.  Flags: ENDUSER | MAKEFILE docerr
  8148.  Last Modified: 29-MAR-1990    ArticleIdent: Q50862
  8149.  
  8150.  In the file MACRO.DOC on the "Microsoft CodeView for MS-DOS with
  8151.  Tutorial" disk for Microsoft Macro Assembler Version 5.10, there is a
  8152.  documentation error that incorrectly calls the macro @MakeFil.
  8153.  
  8154.  The macro is defined in the DOS.INC include file, also on the MS-DOS
  8155.  CodeView disk. In the DOS.INC include file, the @MakeFil macro has
  8156.  been labeled as @MakFil, not @MakeFil.
  8157.  
  8158.  To use this macro correctly, either change the DOS.INC include file
  8159.  macro label to @MakeFil, or call the macro as @MakFil.
  8160.  
  8161.  
  8162.  216. Using a Macro to Determine the Current Segment
  8163.  
  8164.  Product Version(s): 5.10 5.10a
  8165.  Operating System:   MS-DOS
  8166.  Flags: ENDUSER |
  8167.  Last Modified: 29-MAR-1990    ArticleIdent: Q58864
  8168.  
  8169.  The following macro can be used to determine the segment from which
  8170.  the macro is called during assembly of a source file.
  8171.  
  8172.  In the following example, the "findseg" macro is called from within
  8173.  two individual segments named code1 and code2, respectively. The macro
  8174.  then uses IF statements to determine the segment. Then, depending upon
  8175.  the segment, any desired code can be assembled.
  8176.  
  8177.          findseg macro segname
  8178.            ifidn <code1>, <segname> ; if in segment code1
  8179.                    :                ; do what is desired
  8180.            endif
  8181.  
  8182.            ifidn <code2>, <segname> ; if in segment code2
  8183.                    :                ; do what is desired
  8184.            endif
  8185.            endm                     ; end macro
  8186.  
  8187.            findseg code1   ;macro call in segment code1
  8188.                       .
  8189.                       .
  8190.                       .
  8191.            findseg code2   ;macro call in segment code2
  8192.  
  8193.  Note that invoking the findseg macro with the @curseg equate as a
  8194.  macro argument will not yield a true condition for the ifidn
  8195.  expression. The value of "segname" is resolved to the string "@curseg"
  8196.  which, in the example, is identical to "code1".
  8197.  
  8198.  
  8199.  217. Sample to Test Math Coprocessor Instructions FLD FADD FSTP FST
  8200.  
  8201.  Product Version(s): 5.10
  8202.  Operating System:   MS-DOS
  8203.  Flags: ENDUSER |
  8204.  Last Modified: 29-MAR-1990    ArticleIdent: Q59127
  8205.  
  8206.  The following code was used to view coprocessor instructions on an
  8207.  80386 machine with an 80387 coprocessor. It is a combination of the
  8208.  examples on Pages 384 and 385 of "Microsoft Macro Assembler 5.1
  8209.  for the MS-DOS Operating System Programmer's Guide."
  8210.  
  8211.                 .model small
  8212.                 .386
  8213.                 .387
  8214.                 .stack 100h
  8215.                 .data
  8216.        m1       dd   1.0
  8217.        m2       dd   2.0
  8218.                 .code
  8219.        start    proc
  8220.                 mov ax, @data ;load address of segment
  8221.                 mov ds,  ax   ;     register
  8222.                 fld   m1      ;push m1 into st(0)
  8223.                 fld   m2      ;push m2 into st(0)
  8224.                 fadd  m1      ;add m2 to st(0)
  8225.                 fstp  m1      ;pop st(0) into m1
  8226.                 fst   m2      ;copy st(0) into m2
  8227.  
  8228.                 fld1          ;push 1 into st(0)
  8229.                 fldpi         ;push pi into st(0)
  8230.                 fadd          ;add st(0) and st(1)
  8231.                               ;and pop, place result in st(0)
  8232.        start    endp
  8233.                 end  start
  8234.  
  8235.  While assembling the above code, the .386 and .387 directives must be
  8236.  placed below the .model directive to generate 16-bit segments. If
  8237.  placed above the .model directive, 32-bit segments will be generated
  8238.  and will produce erroneous results, as 32-bit segments cannot be run
  8239.  under DOS.
  8240.  
  8241.  While running the code through CodeView, the number 7 entered in the
  8242.  dialog box displays a dump of the present status of the chip.
  8243.  
  8244.  
  8245.  218. SYS0491/SYS1107 When Running MASM Under OS/2
  8246.  
  8247.  Product Version(s): 5.10
  8248.  Operating System:   MS-DOS
  8249.  Flags: ENDUSER |
  8250.  Last Modified: 29-MAR-1990    ArticleIdent: Q59266
  8251.  
  8252.  When assembling code with the Macro-Assembler in OS/2, there are
  8253.  certain files and libraries that need to be included, so that the code
  8254.  can be run under OS/2. These include the DOSCALLS.LIB library and the
  8255.  OS2.INC include file. Dosexit is called as opposed to the traditional
  8256.  int 21h that is used in DOS.
  8257.  
  8258.  The following is a template of the basics needed to have workable code
  8259.  under OS/2:
  8260.  
  8261.  ------------------------------------
  8262.  includelib doscalls.lib
  8263.  include os2.inc
  8264.  dosseg
  8265.        .MODEL [small,medium,large,etc.]
  8266.  extrn dosexit:far
  8267.  
  8268.  {BODY OF SOURCE CODE}
  8269.  
  8270.  call dosexit
  8271.  ------------------------------------
  8272.  
  8273.  A "SYS1107: The system cannot complete the process" will occur if a
  8274.  MASM executable is run without the above include libraries and files.
  8275.  A "SYS0491: The specified parameter for the session type is not
  8276.  correct" error will be generated if a MASM executable file, without
  8277.  the above include libraries and files, is brought into CodeView. The
  8278.  dosexit replaces the standard DOS int 21h exit that is normal for DOS
  8279.  MASM executables. The DOSCALLS.LIB and OS2.INC include files are
  8280.  located on the MS OS/2 TOOLS disk that comes with MASM 5.10.
  8281.  
  8282.  
  8283.  219. Problems with Using TYPE Operator and SI Index Register
  8284.  
  8285.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  8286.  Operating System:   MS-DOS     | OS/2
  8287.  Flags: ENDUSER | buglist5.10a
  8288.  Last Modified: 29-MAR-1990    ArticleIdent: Q59374
  8289.  
  8290.  There is a problem when using the type operator referenced from a
  8291.  variable and the SI register.
  8292.  
  8293.  The following commented code can be assembled to demonstrate the
  8294.  problem.
  8295.  
  8296.   .model small
  8297.   .stack 800h                 ; Allocate 2K stack space
  8298.   .data
  8299.   var1 dw 0
  8300.   .code
  8301.   main proc
  8302.   mov ax,@data                ; This line and the next are required to
  8303.   mov ds,ax                   ; access the data segment properly.
  8304.  
  8305.   ; Each of the following CMP instructions should produce the exact same
  8306.   ; code. The first three items do not produce the correct code.
  8307.   ;
  8308.   ; The opcode portion of the instruction is 3b84 in the correct examples
  8309.   ; and 3b06 in the incorrect examples.
  8310.   ;
  8311.   ; The type operator returns a number that represents the type of an
  8312.   ; expression. This is normally the size of the variable.
  8313.   ; For example, a variable declared as dw will cause TYPE to return
  8314.   ; the number 2.
  8315.  
  8316.   cmp ax,var1[si]+type var1   ; Incorrect code generated
  8317.   cmp ax,var1[si]+(type var1) ; Incorrect code generated
  8318.   cmp ax,var1[si]+[type var1] ; Incorrect code generated
  8319.   cmp ax,type var1+var1[si]   ; correct code generated
  8320.   cmp ax,var1[si+type var1]   ; correct code generated
  8321.   cmp ax,var1[si]+2           ; correct code generated
  8322.   cmp ax,var1[si+2]           ; correct code generated
  8323.  
  8324.   main endp
  8325.   end main
  8326.  
  8327.  Microsoft is researching this problem and will post new information
  8328.  here as it becomes available.
  8329.  
  8330.  
  8331.  220. Assembly Main Module Calling a C Function
  8332.  
  8333.  Product Version(s): 5.10
  8334.  Operating System:   MS-DOS
  8335.  Flags: ENDUSER | S_QuickASM
  8336.  Last Modified: 29-MAR-1990    ArticleIdent: Q59438
  8337.  
  8338.  It is possible to call C function from an Assembly main program. It is
  8339.  not recommended because the functionality of the C code will be
  8340.  limited. Since most C run-time functions call either the C startup
  8341.  code or the C stack check routine, it usually is not possible to make
  8342.  any C run-time calls.
  8343.  
  8344.  When compiling the C source code, it is important to use the /Gs
  8345.  switch to disable stack checking and add the following line to the C
  8346.  source code to tell the compiler/linker to not link in the startup
  8347.  code.
  8348.  
  8349.     int _acrtused = 0;
  8350.  
  8351.  The following is sample code to demonstrate how to write an Assembly
  8352.  main module calling a C function.
  8353.  
  8354.  Code Example
  8355.  ------------
  8356.  
  8357.  ; Assembly switch: MASM /Mx
  8358.  
  8359.  .MODEL MEDIUM,C
  8360.  
  8361.    EXTRN  ptrmsg:PROC
  8362.  
  8363.  .STACK 100h
  8364.  
  8365.  .DATA
  8366.    arg1 DB 65
  8367.    arg2 DW 5
  8368.  
  8369.  .CODE
  8370.  
  8371.  main   PROC
  8372.         mov   ax, @data           ; Set up DGROUP
  8373.         mov   ds, ax              ; DS pointing to DGROUP
  8374.         xor   ax, ax              ; Clear ax register
  8375.         mov   ax, OFFSET arg2
  8376.         push  ax                  ; Push second argument
  8377.         mov   ax, OFFSET arg1
  8378.         push  ax                  ; Push first argument
  8379.         call  ptrmsg              ; Call C function
  8380.         add   sp,4                ; Restore stack pointer
  8381.         mov   ax, 4C00h
  8382.         int   21h                 ; Terminate program
  8383.  main   ENDP
  8384.         END
  8385.  
  8386.  -------------------------------
  8387.  
  8388.  /* Compiler line: cl /Gs /c /AM      */
  8389.  
  8390.  int _acrtused = 0;             /* Do not bring in the startup code */
  8391.  
  8392.  void ptrmsg (char *a, int *b)
  8393.  {
  8394.      *a += 1;
  8395.      *b += 1;
  8396.  }
  8397.  
  8398.  
  8399.  221. "A4100: Impure Memory Reference" Incorrectly Generated
  8400.  
  8401.  Product Version(s): 5.00 5.10 5.10a | 5.00 5.10 5.10a
  8402.  Operating System:   MS-DOS          | OS/2
  8403.  Flags: ENDUSER | buglist5.10
  8404.  Last Modified: 29-MAR-1990    ArticleIdent: Q59567
  8405.  
  8406.  The /P option tells MASM to generate warning messages if data is
  8407.  stored in the code segment when privileged instructions are in use.
  8408.  
  8409.  Writing data to the code segment is acceptable in real mode; however,
  8410.  it may cause problems in protected mode. If MASM is invoked with the
  8411.  /P option and finds an impure memory reference, such as in the
  8412.  following code
  8413.  
  8414.                 .code
  8415.         c_word  DW        ?
  8416.                 .
  8417.                 .
  8418.                 mov       cs:c_word,data
  8419.  
  8420.  it will generate a warning similar to the following:
  8421.  
  8422.     filename.asm(???): warning A4100: Impure memory reference
  8423.  
  8424.  MASM may incorrectly generate the warning message. The following
  8425.  example demonstrates this problem:
  8426.  
  8427.          .model small
  8428.          .286p
  8429.          .code
  8430.  
  8431.          mov     al,cs:[bp]
  8432.          mul     word ptr cs:[bp+2]
  8433.          end
  8434.  
  8435.  MASM incorrectly flags the line that does the multiplication. MASM
  8436.  also incorrectly generates the A4100 warning message if the .286,
  8437.  .386, and .386p directives are in effect.
  8438.  
  8439.  Microsoft has confirmed this to be a problem in Version 5.10. We are
  8440.  researching this problem and will post new information here as it
  8441.  becomes available.
  8442.  
  8443.  
  8444.  222. LOCAL Directive with a Structure
  8445.  
  8446.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  8447.  Operating System:   MS-DOS     | OS/2
  8448.  Flags: ENDUSER | buglist5.10 fixlist5.10a
  8449.  Last Modified: 10-JUL-1990    ArticleIdent: Q59585
  8450.  
  8451.  Problem:
  8452.  
  8453.  On Page Update-42 of the "Microsoft Macro Assembler for MS OS/2 and
  8454.  MS-DOS Operating Systems Version 5.1 Update" manual, it states that
  8455.  you can use the LOCAL directive with a structure. When this is done,
  8456.  you may receive the following errors:
  8457.  
  8458.     A2003 Unknown Type Specifier
  8459.     A2010 Syntax Error
  8460.  
  8461.  The following code demonstrates this problem:
  8462.  
  8463.          .model small,c
  8464.          .stack 100h
  8465.  
  8466.          parms struc
  8467.                  p1 dw ?
  8468.                  p2 dw ?
  8469.          parms ends
  8470.  
  8471.          .code
  8472.  
  8473.          call test_func
  8474.  
  8475.          test_func proc
  8476.               LOCAL stuff:parms ;A2003 Unknown type specifier
  8477.               mov ax,0ffffh
  8478.               mov stuff.p1,ax   ;A2010 Syntax error
  8479.               mov stuff.p2,ax   ;A2010 Syntax error
  8480.               ret
  8481.          test_func endp
  8482.  
  8483.          end
  8484.  
  8485.  Response:
  8486.  
  8487.  Microsoft has confirmed this to be a problem and will post additional
  8488.  information as it becomes available.
  8489.  
  8490.  To avoid the A2003 Unknown type specifier error, include the PTR
  8491.  keyword in the LOCAL directive. For example:
  8492.  
  8493.          LOCAL stuff:ptr parms
  8494.  
  8495.  To avoid the A2010 Syntax error, use the MASM 5.10a update assembler.
  8496.  To obtain MASM5.10A, contact Microsoft Product Support at
  8497.  (206) 454-2030.
  8498.  /*MSINTERNAL
  8499.  /*CONFIRMED BY: ROLANDS
  8500.  /*BUGLIST INFO
  8501.  /*RAID DATABASE: MASM600
  8502.  /*BUG NUMBER: 788
  8503.  /*
  8504.  
  8505.  
  8506.  223. MASM Err Msg: A2006: Phase Error Forward Referencing...
  8507.  
  8508.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  8509.  Operating System:   MS-DOS     | OS/2
  8510.  Flags: ENDUSER | buglist5.10
  8511.  Last Modified: 12-JUL-1990    ArticleIdent: Q59754
  8512.  
  8513.  Using the "SEG" directive in conjunction with forward reference to a
  8514.  procedure or a segment name will produce the error "A2006 : phase
  8515.  error between passes."
  8516.  
  8517.  The assembler incorrectly places a "NOP" instruction in the code
  8518.  generated during Pass 1. This NOP is not generated in Pass 2, so the
  8519.  assembler generates a phase error. This phase error most often will be
  8520.  against the first subsequent instruction that is associated with a
  8521.  fixup (an instruction that contains any address, such as a JMP
  8522.  <label>, CALL <label>, or MOV <reg>,<label>).
  8523.  
  8524.  Microsoft has confirmed this to be a problem in the Microsoft Macro
  8525.  Assembler Version 5.10. We are researching this problem and will post
  8526.  new information here as it becomes available.
  8527.  
  8528.  The following code produces the errors. The errors do not occur when
  8529.  the ax register is used. They occur when the bx, cx, and dx registers
  8530.  are used.
  8531.  
  8532.  _TEXT           SEGMENT PARA PUBLIC 'CODE'
  8533.                  ASSUME CS:_TEXT
  8534.  
  8535.                  mov     cx, SEG PROC1     ;error using cx, bx or dx
  8536.  
  8537.                  mov     ax, SEG PROC1     ;no error using ax
  8538.  
  8539.                  mov     cx, SEG STACKSEG ;error using cx, bx, or dx
  8540.  
  8541.                  mov     ax, SEG STACKSEG ;no error using ax
  8542.  
  8543.  STACKSEG                SEGMENT PARA PUBLIC 'STACK'
  8544.                  DB 100 DUP (?)
  8545.  STACKSEG                ENDS
  8546.  
  8547.  PROC1           PROC    FAR
  8548.                  nop
  8549.  PROC1           ENDP
  8550.  _TEXT           ENDS
  8551.                  END
  8552.  
  8553.  To work around this problem, introduce a NOP that is seen by the
  8554.  assembler only during the second pass. The following code assembles
  8555.  without an error:
  8556.  
  8557.  filler macro                      ;macro that codes a nop
  8558.          if2                          ;in the second pass of the
  8559.          nop                          ;assembler
  8560.          endif
  8561.          endm
  8562.  
  8563.  _TEXT           SEGMENT PARA PUBLIC 'CODE'
  8564.                  ASSUME CS:_TEXT
  8565.  
  8566.                  mov     cx, SEG PROC1
  8567.                  filler
  8568.  
  8569.                  mov     cx, SEG STACKSEG
  8570.                  filler
  8571.  
  8572.  STACKSEG                SEGMENT PARA PUBLIC 'STACK'
  8573.                  DB 100 DUP (?)
  8574.  STACKSEG                ENDS
  8575.  
  8576.  PROC1           PROC    FAR
  8577.                  nop
  8578.  PROC1           ENDP
  8579.  _TEXT           ENDS
  8580.                  END
  8581.  
  8582.  
  8583.  224. Multiply Defined Structures and /Zi Option Locks Assembler
  8584.  
  8585.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  8586.  Operating System:   MS-DOS     | OS/2
  8587.  Flags: ENDUSER | buglist5.10a
  8588.  Last Modified: 19-APR-1990    ArticleIdent: Q60072
  8589.  
  8590.  If the assembler source file has a structure declared twice with the
  8591.  same name, and the /Zi option is used, the assembler will go into an
  8592.  infinite loop.
  8593.  
  8594.  The following file demonstrates the problem:
  8595.  
  8596.  junk struc     ; Declaration of Structure
  8597.  junk ends
  8598.  junk struc     ; Repeat Declaration of Structure
  8599.  junk ends
  8600.  end            ; End of Assembler file
  8601.  
  8602.  Microsoft has confirmed this to be a problem in MASM 5.10a. We are
  8603.  researching this problem and will post new information here as it
  8604.  becomes available.
  8605.  
  8606.  
  8607.  225. Error A2057 with Include File DOS.INC and .386 Directive
  8608.  
  8609.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  8610.  Operating System:   MS-DOS     | OS/2
  8611.  Flags: ENDUSER | buglist5.10 buglist5.10a
  8612.  Last Modified: 19-APR-1990    ArticleIdent: Q60267
  8613.  
  8614.  The error "A2057: Illegal size of operand" occurs with the use of the
  8615.  DOS.INC include file and the .386 or .386P directive.
  8616.  
  8617.  The DOS.INC files are provided on Disk 2 of the MASM Version 5.10
  8618.  disks for simplified use of the DOS calls.
  8619.  
  8620.  Microsoft has confirmed this to be a problem with MASM 5.10. We are
  8621.  researching this problem and will post new information here as it
  8622.  becomes available.
  8623.  
  8624.  The following assembly listing produces the error mentioned above:
  8625.  
  8626.          DOSSEG
  8627.          title   test1
  8628.          .386P
  8629.  
  8630.          include     \include\dos.inc
  8631.  
  8632.  _datas  segment word 'data'
  8633.  mess            db      'Hi,there'
  8634.  messlen         equ     $-mess
  8635.  _datas  ends
  8636.  
  8637.          assume cs:_codes
  8638.  _codes  segment word 'code'
  8639.  start:  mov     ax,_datas
  8640.                  mov     ds,ax           ;set data segment to point
  8641.                                                  ;to message
  8642.  
  8643.                  @write  mess,messlen    ; here is where the
  8644.                                                          ; offset error is
  8645.                  @exit
  8646.  
  8647.  _codes  ends
  8648.                  end     start
  8649.  
  8650.  No errors occur if the use16 use type is used in the segment
  8651.  statement. This generates a 16-bit offset for the DOS.INC macros
  8652.  (where a 32-bit offset is generated without the USE 16, and produces
  8653.  an error).
  8654.  
  8655.  The following code demonstrates the segment use type to overcome the
  8656.  error:
  8657.  
  8658.          DOSSEG
  8659.          title   test1
  8660.          .386P
  8661.  
  8662.          include     \include\dos.inc
  8663.  
  8664.  _datas  segment use16 word 'data'
  8665.  mess            db      'Hi,there'
  8666.  messlen         equ     $-mess
  8667.  _datas  ends
  8668.  
  8669.          assume cs:_codes
  8670.  _codes  segment word 'code'
  8671.  start:  mov     ax,_datas
  8672.                  mov     ds,ax           ; set data segment to point
  8673.                                          ; to message
  8674.  
  8675.                  @write  mess,messlen    ; here is where the
  8676.                                          ; offset error is
  8677.                  @exit
  8678.  
  8679.  _codes  ends
  8680.                  end     start
  8681.  
  8682.  
  8683.  226. MASM 5.10 Setup Shows Blank Display on LCD/Monochrome Monitor
  8684.  
  8685.  Product Version(s): 5.10   | 5.10
  8686.  Operating System:   MS-DOS | OS/2
  8687.  Flags: ENDUSER |
  8688.  Last Modified: 13-APR-1990    ArticleIdent: Q60307
  8689.  
  8690.  When running the RUNME setup program for Microsoft Macro Assembler
  8691.  Version 5.10, the setup program changes the screen colors. On LCD
  8692.  displays and some monochrome displays, the colors that the setup
  8693.  program changes to are not visible. Therefore, when the setup program
  8694.  is run, you can't see anything on the screen. The program is running
  8695.  properly, but the text color is the same as the background color.
  8696.  
  8697.  On the MS OS/2 and MS-DOS Macro Assemblers setup disk, there is a file
  8698.  that holds all of the commands that the setup program RUNME uses. The
  8699.  file is called SETUP.SUS and the first line in that file is as
  8700.  follows:
  8701.  
  8702.     CLS a: 30 "Microsoft(R) MASM 5.10 Setup"
  8703.  
  8704.  To have the setup program use the standard colors of the operating
  8705.  system, remove the "a: 30" from the file and rerun RUNME. This will
  8706.  correct the problem.
  8707.  
  8708.  The new line should be as follows:
  8709.  
  8710.     CLS "Microsoft(R) MASM 5.10 Setup"
  8711.  
  8712.  
  8713.  227. Using the C Emulator Library with an Assembly Program
  8714.  
  8715.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  8716.  Operating System:   MS-DOS     | OS/2
  8717.  Flags: ENDUSER |
  8718.  Last Modified: 12-JUN-1990    ArticleIdent: Q60429
  8719.  
  8720.  An Assembler module may use a C emulator library if the assembler
  8721.  module is called by a main C module. The C emulator library must be
  8722.  used during the linking of the assembler and C modules.
  8723.  
  8724.  Linking with the emulator library ensures that the assembler will have
  8725.  floating-point math support with or without a a math coprocessor.
  8726.  
  8727.  The math functions in the C run-time library require floating-point
  8728.  support to perform calculations with real numbers. This support can be
  8729.  provided by the floating-point emulator libraries that accompany your
  8730.  compiler software or by an 8087 or 80287 coprocessor.
  8731.  
  8732.  The assembler module -- if run as a stand-alone module, without a math
  8733.  coprocessor, and linked to an emulator library -- generates emulator
  8734.  interrupts for floating-point math code, but will not run because the
  8735.  interrupts will not be initialized. The C start-up code is necessary
  8736.  to initialize the interrupts. If you want to run the assembler module
  8737.  as stand-alone, you must write your own emulator library.
  8738.  
  8739.  With C, /FPi is the default switch. This switch selects the emulator
  8740.  math package and generates inline floating-point instructions.
  8741.  
  8742.     CL /c calling.c
  8743.  
  8744.  The assembler module is assembled with the following command, where
  8745.  (by default) code is generated for a math coprocessor (if
  8746.  floating-point instructions are used)
  8747.  
  8748.     MASM /E called.asm
  8749.  
  8750.  where CALLING.C and CALLED.ASM are the calling and called modules,
  8751.  respectively.
  8752.  
  8753.  While programming in the QuickC environment, /FPi must be specified in
  8754.  the Global Custom Flags field of the Assembler Flags Dialog box
  8755.  (reached through the Options menu). This allows the C emulator library
  8756.  to be used for all the assembler modules.
  8757.  
  8758.  
  8759.  228. .MODEL Directive Makes All Procedure Names Public
  8760.  
  8761.  Product Version(s): 5.10   | 5.10
  8762.  Operating System:   MS-DOS | OS/2
  8763.  Flags: ENDUSER | .MODEL PUBLIC
  8764.  Last Modified:  4-MAY-1990    ArticleIdent: Q61502
  8765.  
  8766.  When you use the .MODEL directive followed by a parameter (for
  8767.  example, C, FORTRAN, etc.), there is no means of having the procedures
  8768.  considered private.
  8769.  
  8770.  The Microsoft Macro Assembler automatically makes all procedure names
  8771.  PUBLIC. This is a feature of the assembler. This information can be
  8772.  found on Page 34 in the "High-Level-Language Support" section of the
  8773.  "Microsoft Macro Assembler" version 5.1 update manual.
  8774.  
  8775.  An example using the C parameter following the .MODEL directive is as
  8776.  follows:
  8777.  
  8778.       ;PUBLIC myadd was required in version 5.0 of MASM to declare
  8779.       ;     the procedure public.
  8780.  
  8781.  .MODEL MEDIUM,C
  8782.  
  8783.           .CODE
  8784.  myadd         PROC arg1:WORD, arg2:WORD
  8785.  
  8786.           mov   ax,arg1
  8787.           add   ax,arg2
  8788.  
  8789.           ret
  8790.  
  8791.  myadd         ENDP
  8792.           END
  8793.  
  8794.  
  8795.  229. Passing a LONG INT in C to an Assembly Module
  8796.  
  8797.  Product Version(s): 5.10 5.10a
  8798.  Operating System:   MS-DOS
  8799.  Flags: ENDUSER |
  8800.  Last Modified: 21-MAY-1990    ArticleIdent: Q61590
  8801.  
  8802.  The following code demonstrates passing a LONG INT (4 bytes) via a
  8803.  LONG pointer (4 bytes) to an assembly routine that accesses the LONG
  8804.  integer.
  8805.  
  8806.  Each integer is incremented in the assembly routine and its new value
  8807.  returned to the calling C program.
  8808.  
  8809.  The code is as follows:
  8810.  
  8811.  *********************************************************
  8812.  
  8813.  #include <stdio.h>
  8814.  #include <process.h>
  8815.  #include<conio.h>
  8816.  
  8817.   extern void stuff (long *, long *);
  8818.  
  8819.  main()
  8820.  {
  8821.    long *n1,*n2;               /*4 byte pointers*/
  8822.  
  8823.    long int t1 = 9999999L; /*4 byte variables*/
  8824.    long int t2 = 2256789L;
  8825.  
  8826.   n1 = &t1;
  8827.   n2 = &t2;
  8828.  
  8829.                                /*initial values*/
  8830.    printf("The values are  %ld and  %ld\n ", *n1, *n2);
  8831.  
  8832.    printf("Incrementing values...\n");
  8833.    stuff(n1,n2);
  8834.  
  8835.                /*values returned by the assembly routine*/
  8836.    printf("The values are  %ld and  %ld\n ", *n1, *n2);
  8837.  
  8838.  }
  8839.  
  8840.  ========================================================
  8841.  
  8842.  .LALL
  8843.  .model large,C
  8844.  .data
  8845.  .code
  8846.    stuff proc far arg1:dword, arg2:dword
  8847.      push es                ;save registers
  8848.      push si
  8849.      les si,arg1            ;load in es:si the seg:offset of
  8850.                             ; n1
  8851.      inc word ptr es:[si]
  8852.      jnc doarg2
  8853.      inc word ptr es:[si+2] ;if carry then increment the high
  8854.                             ; word of n1
  8855.  doarg2:
  8856.      les si,arg2            ;load in es:si the seg:offset of
  8857.                             ; n2
  8858.      inc word ptr es:[si]
  8859.      jnc finis
  8860.      inc word ptr es:[si+2] ;if carry then increment the high
  8861.                             ;word of n2
  8862.  finis:
  8863.      pop si                 ;restore registers
  8864.      pop es
  8865.      mov sp,bp
  8866.      ret
  8867.    stuff endp
  8868.  
  8869.    end
  8870.  
  8871.  *********************************************************
  8872.  *Makefile 'new':-
  8873.  *
  8874.  *all=1.obj 2.obj    (macro for all the obj's)
  8875.  *
  8876.  *1.obj: 1.c         (compiles the C module)
  8877.  *  cl /AL /c 1.c
  8878.  *
  8879.  *2.obj: 2.asm       (assembles the Assembler module)
  8880.  *  masm 2.asm,,2;
  8881.  *
  8882.  *1.exe: $(all)      (links modules with library)
  8883.  *   link /co $(all),,1,/nod llibcer;  (emulator lib name)
  8884.  *
  8885.  *Command Line to run makefile:  MAKE new
  8886.  *
  8887.  *********************************************************
  8888.  
  8889.  
  8890.  230. EXE2BIN.EXE File Does Not Come with PC-DOS 3.30, 4.00 and 4.01
  8891.  
  8892.  Product Version(s): 5.00 5.10
  8893.  Operating System:   MS-DOS
  8894.  Flags: ENDUSER | docerr
  8895.  Last Modified: 29-MAY-1990    ArticleIdent: Q62136
  8896.  
  8897.  Page 19 of the "Microsoft Macro Assembler 5.1 Programmer's Guide"
  8898.  incorrectly states that "(EXE2BIN.EXE file) is not included in the
  8899.  Macro Assembler package, but it does come with the MS-DOS and PC-DOS
  8900.  operating systems." The Macro Assembler package comes with MS-DOS,
  8901.  but does not come with PC-DOS versions 3.30, 4.00, and 4.01.
  8902.  
  8903.  The following is an example:
  8904.  
  8905.     EXE2BIN comes with:    Works with:         Does not work with:
  8906.     -------------------    ----------          -------------------
  8907.  
  8908.     1. MS-DOS 3.30         MS-DOS 3.30         MS-DOS 4.00 & 4.01
  8909.                            PC-DOS 3.30         PC-DOS 4.00 & 4.01
  8910.  
  8911.     2. MS-DOS 4.40 & 4.41  MS-DOS 4.00 & 4.01  MS-DOS 3.30
  8912.                            PC-DOS 4.00 & 4.01  PC-DOS 3.30
  8913.  
  8914.        Note: You will get the message "Incorrect DOS version."
  8915.  
  8916.  The EXE2BIN.EXE files that come with MS-DOS versions 4.00 and 4.01 are
  8917.  identical. They have been tested by using the COMP command.
  8918.  
  8919.  
  8920.  231. Trapping a Keystroke and Displaying Its Extended Scan Code
  8921.  
  8922.  Product Version(s): 5.10 5.10a
  8923.  Operating System:   MS-DOS
  8924.  Flags: ENDUSER | S_C
  8925.  Last Modified: 12-NOV-1990    ArticleIdent: Q64439
  8926.  
  8927.  The following example causes a main C program to call an assembly
  8928.  routine to print the ASCII code and the extended code resulting from a
  8929.  keystroke.
  8930.  
  8931.  For example, if you press the A key, the output is an ASCII 61 and an
  8932.  extended code of 1E indicating the position of the key. If F1 is
  8933.  pressed, there is no ASCII equivalent for it, and a 0 is returned for
  8934.  the ASCII code and hex 3B for the extended code.
  8935.  
  8936.  The following is the example:
  8937.  
  8938.  ******************************************************
  8939.  #include <stdio.h>
  8940.  extern key_read(int*, int*);
  8941.  
  8942.  void main(void)
  8943.  {
  8944.     int *ascii_ptr, *scan_ptr, num, num1;
  8945.     num=0;
  8946.     num1=0;
  8947.     ascii_ptr = #               // initialize pointers to zero
  8948.     scan_ptr = &num1;
  8949.  
  8950.     key_read(ascii_ptr, scan_ptr);  // call assembly routine
  8951.  
  8952.  // print the high byte - ASCII code, and the low byte - extended
  8953.  // code of the character placed in the keyboard buffer
  8954.  
  8955.     printf("The ASCII code is hex %x or decimal %d\n", *ascii_ptr,"
  8956.            " *ascii_ptr);
  8957.     printf("The EXTENDED Code is hex %x "
  8958.            "or decimal %d\n", *scan_ptr, *scan_ptr);
  8959.  }
  8960.  
  8961.  ******************************************************
  8962.  .model small,c
  8963.  .data
  8964.  
  8965.  .code
  8966.         public  key_read
  8967.  key_read proc
  8968.           push  bp          ;save the base pointer
  8969.           mov   bp, sp
  8970.  
  8971.  ; Invoke Int 21h Function Ch to clear the keyboard buffer before
  8972.  ; accepting a keystroke.
  8973.  
  8974.           mov   ah, 0CH
  8975.           mov   al, 0
  8976.           int   21h
  8977.  
  8978.  ; Invoke Int 16h Function 0h to place the character code in the AX
  8979.  ; register.
  8980.  
  8981.           mov   ah, 0H
  8982.           int   16H
  8983.  
  8984.           mov   bx, [bp+4]  ;ASCII returned
  8985.           mov   [bx], al
  8986.  
  8987.           mov   bx, [bp+6]  ;Extended code returned
  8988.           mov   [bx], ah
  8989.  
  8990.           pop   bp
  8991.           ret
  8992.  
  8993.  key_read endp
  8994.           end
  8995.  
  8996.  ********************************************************
  8997.  Contents of Makefile:
  8998.  
  8999.  1.obj: 1.c
  9000.       cl /Zi /c 1.c
  9001.  
  9002.  2.obj: 2.asm
  9003.       masm /Zi 2.asm;
  9004.  
  9005.  .exe: 1.obj 2.obj
  9006.       link /co 1 2,,,/nod slibcer;
  9007.  *********************************************************
  9008.  
  9009.  A keystroke is sensed by the keyboard microprocessor that deposits an
  9010.  8-bit scan code at Port A of the 8255 peripheral interface chip. (Bit
  9011.  1=1 when the key contact is made; 0 when the key is released.)
  9012.  
  9013.  Following the scan code, keyboard Interrupt 9H is invoked and a 2-byte
  9014.  character code is placed in the keyboard buffer. The status of the
  9015.  SHIFT and toggle keys is stored in memory and is checked before the
  9016.  character code is generated. This allows for uppercase or lowercase
  9017.  characters.
  9018.  
  9019.  The upper byte of the character code contains an ASCII code if one is
  9020.  generated; the lower byte contains the extended code, depending on the
  9021.  position of the key pressed.
  9022.  
  9023.  A few key combinations do not generate scan codes: <CTRL+BREAK>,
  9024.  <CTRL+ALT+DEL>, <PRINT SCREEN>, and <ALT+SYSRQ> on a 286 computer.
  9025.  These combinations cause special predefined results.
  9026.  
  9027.  
  9028.  232. Passing a Structure from C to Assembly
  9029.  
  9030.  Product Version(s): 5.10 5.10a
  9031.  Operating System:   MS-DOS
  9032.  Flags: ENDUSER | Struc
  9033.  Last Modified: 12-JUN-1990    ArticleIdent: Q62626
  9034.  
  9035.  The code sample below illustrates how to pass a structure from a C
  9036.  module to an assembly module. This code makes it possible to access
  9037.  the structure fields within the assembly module using the "." field
  9038.  operator.
  9039.  
  9040.  Within the assembly module a structure is declared. This structure is
  9041.  used as a template by the assembler to resolve accessing the fields of
  9042.  the structure. The structure may be given any label name.
  9043.  
  9044.  The following is the sample code:
  9045.  
  9046.  #include <stdio.h>
  9047.  #include "d:\testm\struc\alpha.h" /*include file & path*/
  9048.  
  9049.  /*Contents of the Header File*/
  9050.  /*=================================*/
  9051.  /*struct foo{
  9052.   *      int num;
  9053.   *      char one[5];
  9054.   *      }
  9055.   */
  9056.  
  9057.  struct foo good,*f_ptr;
  9058.  extern void ptr_proc(struct foo*);
  9059.  
  9060.  main()
  9061.  
  9062.  {
  9063.  f_ptr = &good;
  9064.   good.one[0]='R';  /*hex 52*/
  9065.   good.one[2]='O';  /*hex 4F*/
  9066.   good.num=0x0b12;
  9067.   ptr_proc (f_ptr);
  9068.  
  9069.  /*Incremented Values on returning to C*/
  9070.  /*====================================*/
  9071.  
  9072.  printf("Good.one[0] is now  %c\n", good.one[0]);
  9073.  
  9074.  printf("Good.one[2] is now  %c\n", good.one[2]);
  9075.  
  9076.  printf("Good.num is now %x\n",  good.num);
  9077.  
  9078.  }
  9079.  
  9080.  /*************************************************/
  9081.  
  9082.   ; Contents of the DELTA.INC Include file. The structure provides a
  9083.   ; template that the assembler recognizes.
  9084.  
  9085.   ;  delta struc
  9086.   ;        num dw ?
  9087.   ;        one db 5 dup (?)
  9088.   ;  delta ends
  9089.  
  9090.  .model small,C
  9091.  .data
  9092.  
  9093.  .code
  9094.  
  9095.  ptr_proc proc
  9096.  
  9097.         push bp
  9098.         mov bp,sp
  9099.  
  9100.         include d:\testm\struc\DELTA.INC
  9101.  
  9102.         mov bx,offset [bp+4].num
  9103.         mov ax, word ptr[bx].num
  9104.         inc [bx].num
  9105.  
  9106.         mov di,word ptr[bx].one
  9107.         inc [bx].one
  9108.  
  9109.         mov ax, word ptr[bx+2].one
  9110.         inc [bx+2].one
  9111.  
  9112.         pop bp
  9113.         ret
  9114.  
  9115.  ptr_proc endp
  9116.  
  9117.         end
  9118.   /**************************************************/
  9119.  
  9120.  The following MAKE file "new" was used:
  9121.  
  9122.  all = 1.obj 2.obj
  9123.  
  9124.  1.obj: 1.c
  9125.       CL /c 1.c
  9126.  
  9127.  2.obj: 2.asm
  9128.       MASM 2.asm;
  9129.  
  9130.  1.exe: $(all)
  9131.       link $(all),,,/nod slibcer;
  9132.  
  9133.  The command line was: MAKE new
  9134.  
  9135.  /******************************************************/
  9136.  
  9137.  The output is as follows:
  9138.  
  9139.     Good.one[0] is now  S
  9140.     Good.one[2] is now  P
  9141.     Good.num is now b13
  9142.  
  9143.  
  9144.  233. IRET Can't Be Used with proc USES
  9145.  
  9146.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  9147.  Operating System:   MS-DOS     | OS/2
  9148.  Flags: ENDUSER |
  9149.  Last Modified: 17-OCT-1990    ArticleIdent: Q64535
  9150.  
  9151.  A procedure that uses the USES keyword cannot return by using IRET.
  9152.  The USES statement pushes the specified registers on the stack upon
  9153.  entry and pops them before exiting a procedure. If the USES keyword is
  9154.  used with a procedure that ends with an IRET instruction, the pushes
  9155.  will be generated for the procedure, but the pops will not.
  9156.  
  9157.  The following code demonstrates the problem:
  9158.  
  9159.  The Source File
  9160.  ---------------
  9161.  
  9162.  .model large,c
  9163.  
  9164.  .code
  9165.  proctest segment 'CODE'
  9166.  
  9167.  first proc far uses di si bp
  9168.        mov si,3
  9169.        mov di,4
  9170.        iret
  9171.  first end
  9172.        end first
  9173.  
  9174.  The Assembled Listing
  9175.  ---------------------
  9176.  
  9177.  assume cs:@code,ds:@data,ss:@data
  9178.  
  9179.  proctest_TEXT segment 'CODE'
  9180.  
  9181.  first  proc far uses di si bp
  9182.  
  9183.  push DI
  9184.  push SI
  9185.  push BP
  9186.        mov si,3
  9187.        mov di,4
  9188.                      <--- missing pops for bp,si, and di
  9189.        iret
  9190.  first  endp
  9191.        end  first
  9192.  @CurSeg ends
  9193.  
  9194.  
  9195.  234. How to Create Overlays with Macro Assembler
  9196.  
  9197.  Product Version(s): 5.10 5.10a
  9198.  Operating System:   MS-DOS
  9199.  Flags: ENDUSER |
  9200.  Last Modified: 12-NOV-1990    ArticleIdent: Q66054
  9201.  
  9202.  The following code illustrates the creation of an overlay with an
  9203.  assembly module. The first procedure _main in the root module calls
  9204.  the procedure rt2 in the overlaid module.
  9205.  
  9206.  It is possible to create overlays while linking with the medium- and
  9207.  large-memory model libraries.
  9208.  
  9209.  The Overlay Manager is a part of a higher-level language's run-time
  9210.  library (C for instance). While linking, this library must be used if
  9211.  the code for the Overlay Manager is to be linked with the program.
  9212.  
  9213.  Page 285 of the "Microsoft Macro Assembler 5.1 CodeView and Utilities
  9214.  Guide" explains the use of overlays with assembly-language modules.
  9215.  Only modules with a 32-bit (long) call/ret instruction can be
  9216.  overlaid. Routines called should be declared as FAR. The linker is
  9217.  unable to produce overlay modules that can be called indirectly with
  9218.  function pointers. The root module is the resident (nonoverlaid)
  9219.  portion of the program, and the overlaid module is the transient
  9220.  portion.
  9221.  
  9222.  There are two segments created by the linker. The Overlay_Area and the
  9223.  Overlay_Data. The size of the Overlay_Area (class "code") is
  9224.  determined by the Overlay_End statement that points to the end of the
  9225.  Overlay_Area segment. The Overlay_Data is placed in DGROUP. The two
  9226.  segments can be viewed in a MAP file.
  9227.  
  9228.  LINK sets the Overlay_Area to fit the largest overlay. Only the code
  9229.  is overlaid. The Overlay_Data is initialized by LINK with information
  9230.  about the executable file and information useful to the run-time
  9231.  Overlay Manager (for example, number of overlays).
  9232.  
  9233.  LINK replaces all FAR calls from root to overlay, or overlay to
  9234.  overlay with the following information:
  9235.  
  9236.  1. A software interrupt (usually INT 3FH, which can be overridden
  9237.     the /OVERLAYINTERRUPT option on the LINK line).
  9238.  
  9239.  2. The overlay number.
  9240.  
  9241.  3. The offset into the overlay segment.
  9242.  
  9243.  This information provides the overlay manager with a mechanism to do
  9244.  the following:
  9245.  
  9246.  1. Load a specified overlay into memory.
  9247.  
  9248.  2. Transfer control to a specified offset within an overlay.
  9249.  
  9250.  If you need to modify the behavior of the Overlay Manager, the source
  9251.  code is available as part of the Microsoft C run-time source code,
  9252.  which can be ordered through Microsoft Sales and Service by calling
  9253.  (800) 426-9400.
  9254.  
  9255.  Code Example
  9256.  ------------
  9257.  
  9258.  ;main module      (1.asm)
  9259.  
  9260.  assume cs:cseg,ds:dseg,ss:sseg
  9261.  
  9262.  DSEG segment word public
  9263.  line02  db 'In the Root module'
  9264.          db (13)         ;CR
  9265.          db (10)         ;LF
  9266.          db (36)         ;$ String Terminator
  9267.  DSEG ends
  9268.  
  9269.  EXTRN rt2:far
  9270.  
  9271.  cseg segment byte public
  9272.  public _main            ;necessary as the run-time library
  9273.                          ;following the entry point at _astart
  9274.                          ;calls _main (in C startup module crt0.asm)
  9275.  _main   proc   FAR
  9276.     mov  ax,DSEG
  9277.     mov  ds,ax
  9278.     mov  ah,09           ;String output Function 09H
  9279.     mov  dx,seg line02
  9280.     mov  ds,dx
  9281.     mov  dx,offset line02
  9282.     int  21h             ;Invoking DOS Interrupt 21H
  9283.  
  9284.     call rt2             ;Call to the Overlay Procedure
  9285.     mov  ah,4Ch          ;Function 4CH return to DOS
  9286.     int  21h
  9287.  _main   endp
  9288.  
  9289.  cseg ends
  9290.  
  9291.  sseg segment stack
  9292.          db 20 dup (0)
  9293.  sseg ends
  9294.     end
  9295.  
  9296.  ------------------------------------
  9297.  ;overlaid module  (2.asm)
  9298.  
  9299.  ;assume cs:c1seg,ds:d1seg
  9300.  
  9301.  D1SEG segment word public
  9302.  line03  db 'In the Overlaid module'
  9303.          db (13)
  9304.          db (10)
  9305.          db (36)
  9306.  D1SEG ends
  9307.  
  9308.  public rt2
  9309.  c1seg segment byte public
  9310.  
  9311.  rt2   proc   FAR
  9312.     mov  ax,D1SEG
  9313.     mov  ds,ax
  9314.     mov  ah,09
  9315.     mov  dx,seg line03
  9316.     mov  ds,dx
  9317.     mov  dx,offset line03
  9318.     int  21h
  9319.     ret
  9320.  rt2   endp
  9321.  
  9322.  c1seg ends
  9323.     end
  9324.  
  9325.  ------------------------------------
  9326.  
  9327.  The following are commands to assemble and link:
  9328.  
  9329.  MASM /MX 1.asm;
  9330.  MASM /MX 2.asm;
  9331.  LINK /NOI /NOD 1.obj + (2.obj),,,slibcer;
  9332.  
  9333.  Notes
  9334.  -----
  9335.  
  9336.  Consider the following:
  9337.  
  9338.  1. Either use Segmented Linker version 5.01.20 or later, or OverLay
  9339.     Linker version 3.64 or later.
  9340.  
  9341.  2. Use the appropriate run-time library from C version 6.00 and C
  9342.     versions 5.x (medium or large).
  9343.  
  9344.  3. Use /MX and /NOI to preserve case sensitivity.
  9345.  
  9346.  Output from .EXE occurs in the following:
  9347.  
  9348.  1. In the Root module
  9349.  
  9350.  2. In the Overlaid module
  9351.  
  9352.  
  9353.  235. Repeat Prefix (REP) Documentation Error
  9354.  
  9355.  Product Version(s): 5.00   | 5.10
  9356.  Operating System:   MS-DOS | OS/2
  9357.  Flags: ENDUSER | docerr
  9358.  Last Modified: 12-NOV-1990    ArticleIdent: Q66170
  9359.  
  9360.  On Page 368 of the "Microsoft Macro Assembler Programmer's Guide," the last
  9361.  sentence in the second paragraph from the bottom states the following:
  9362.  
  9363.     Segment overrides can be used safely when interrupts are turned
  9364.     off, when a string instruction is used without a segment override,
  9365.     or when a 80386 processor is used.
  9366.  
  9367.  It should read as follows:
  9368.  
  9369.     Segment overrides can be used safely when interrupts are turned
  9370.     off, when a string instruction is used without a repeat prefix, or
  9371.     when a 80386 processor is used.
  9372.  
  9373.  The repeat prefix may be used safely with segment overrides if a CLI
  9374.  instruction is performed before the REP instruction and a STI
  9375.  instruction is performed after it. This process shuts off interrupts
  9376.  during the REP instruction that contains a segment override. Clearing
  9377.  interrupts in this manner is only needed for instructions with segment
  9378.  overrides that are preceded with REP.
  9379.  
  9380.  Please note that the execution of a repeated instruction can take a
  9381.  considerable amount of time; you may not want to have interrupts shut
  9382.  off for that much time. It is the programmer's responsibility to
  9383.  ensure that interrupts are not missed while interrupts are off.
  9384.  
  9385.  A better alternative if you are moving a large amount of data is to
  9386.  change the DS register for the duration of the repeated instruction
  9387.  (so that the segment override is not needed) and restore it
  9388.  afterwards.
  9389.  
  9390.  The following is an example of using the CLI instruction to disable
  9391.  interrupts and using the STI instruction to re-enable them:
  9392.  
  9393.      ;   set SI and DI
  9394.  
  9395.      MOV CX, 20   ; relatively small number of bytes--won't take long
  9396.      CLI
  9397.      REP MOVS dest,ES:source
  9398.      STI
  9399.  
  9400.      ;   ...
  9401.  
  9402.  The following is an example of temporarily using the DS register to
  9403.  avoid the segment override:
  9404.  
  9405.      ;   set SI and DI
  9406.  
  9407.      MOV  CX, 4000h ; lots to move -- this will take some time
  9408.      PUSH DS        ; save for later
  9409.      PUSH ES        ; same as ES: override -- change for other overrides
  9410.      POP  DS        ; load into DS
  9411.      REP  MOVS dest, source
  9412.      POP  DS        ; restore DS
  9413.  
  9414.  
  9415.  236. C and c Are Illegal Symbols in MASM 5.10 and 5.10a
  9416.  
  9417.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  9418.  Operating System:   MS-DOS     | OS/2
  9419.  Flags: ENDUSER |
  9420.  Last Modified: 12-NOV-1990    ArticleIdent: Q66497
  9421.  
  9422.  If you assemble the code below with the Microsoft Macro Assembler
  9423.  version 5.10 or 5.10a, the following error is generated:
  9424.  
  9425.     error A2009: Symbol not defined:
  9426.  
  9427.  This error occurs because "c" or "C" can be used in your .MODEL
  9428.  statement to identify that you are doing mixed-language programming
  9429.  with C. This process makes C a reserved symbol, and therefore it
  9430.  cannot be used in your program.
  9431.  
  9432.  This behavior is by design and is not considered a problem with the
  9433.  Microsoft Macro Assembler.
  9434.  
  9435.  Code Example
  9436.  ------------
  9437.  
  9438.  public c
  9439.  
  9440.  c PROC FAR
  9441.  c ENDP
  9442.  
  9443.  end
  9444.  
  9445.  Workaround
  9446.  ----------
  9447.  
  9448.  Change "c" or "C" to something else.
  9449.  
  9450.  
  9451.  237. MASM Instructions Operand Size Documented Wrong
  9452.  
  9453.  Product Version(s): 5.00 5.10 | 5.10
  9454.  Operating System:   MS-DOS    | OS/2
  9455.  Flags: ENDUSER | docerr
  9456.  Last Modified:  6-FEB-1991    ArticleIdent: Q67439
  9457.  
  9458.  In the "Microsoft Macro Assembler 5.1 Reference" manual, a number of
  9459.  instructions indicate that their operand size is a mem64 when they
  9460.  should indicate an operand size of mem48. The instructions are
  9461.  documented incorrectly as LGDT, LIDT, LLDT, SGDT, SIDT, and SLDT.
  9462.  These instructions require the FWORD PTR operator and not the QWORD
  9463.  PTR operator. If the QWORD PTR operator is used, the Microsoft Macro
  9464.  Assembler (MASM) will generate the following warning:
  9465.  
  9466.     warning A4057: illegal size for operand
  9467.  
  9468.  These instructions are privileged 286 and 386 instructions that are
  9469.  used to load and save the protected mode descriptor table registers.
  9470.  These registers are only 6 bytes long, even though descriptor table
  9471.  entries are normally 8 bytes.
  9472.  
  9473.  
  9474.  238. Tracing into a Macro When Debugging Assembly Programs
  9475.  
  9476.  Product Version(s): 5.10   | 5.10
  9477.  Operating System:   MS-DOS | OS/2
  9478.  Flags: ENDUSER | S_QUICKASM
  9479.  Last Modified:  6-FEB-1991    ArticleIdent: Q67440
  9480.  
  9481.  When you use a macro in an assembly-language routine and you are
  9482.  debugging, you cannot trace into the macro definition as you can with
  9483.  a procedure. The debugger simply executes the macro call (steps over
  9484.  it) as if it were a single instruction.
  9485.  
  9486.  This behavior is by design. There is no symbolic information
  9487.  generated to allow the debugger to step into the macro. If you are
  9488.  using CodeView, you can switch to assembler mode (not source mode) and
  9489.  single step through the code. However, if you are using Microsoft
  9490.  Quick Assembler, you will have to expand the macro before assembly if
  9491.  you want to step through the code.
  9492.  
  9493.  Note: There is a CodeView update for Quick Assembler version 2.51
  9494.  owners. Call Microsoft Sales and Service at (800) 426-9400 for more
  9495.  information.
  9496.  
  9497.  
  9498.  239. Conditional Jump Instruction Is Incorrectly Documented
  9499.  
  9500.  Product Version(s): 5.00 5.10 | 5.10
  9501.  Operating System:   MS-DOS    | OS/2
  9502.  Flags: ENDUSER | docerr
  9503.  Last Modified:  6-FEB-1991    ArticleIdent: Q67757
  9504.  
  9505.  Page 336 of the "Microsoft Macro Assembler 5.1 Programmer's Guide"
  9506.  shipped with MASM version 5.00 and 5.10 has a table that lists the
  9507.  various conditional jump instructions, what each means, and whether
  9508.  each acts on a signed or unsigned value. The table has the
  9509.  signed/unsigned values mixed up.
  9510.  
  9511.  The table currently states:
  9512.  
  9513.     Letter  Meaning
  9514.     ------  -------
  9515.  
  9516.      J      Jump
  9517.      G      Greater than (for unsigned comparisons)
  9518.      L      Less than (for unsigned comparisons)
  9519.      A      Above (for signed comparisons)
  9520.      B      Below (for signed comparisons)
  9521.      E      Equal
  9522.      N      Not
  9523.  
  9524.  It should read:
  9525.  
  9526.     Letter  Meaning
  9527.     ------  -------
  9528.  
  9529.      J      Jump
  9530.      G      Greater than (for signed comparisons)
  9531.      L      Less than (for signed comparisons)
  9532.      A      Above (for unsigned comparisons)
  9533.      B      Below (for unsigned comparisons)
  9534.      E      Equal
  9535.      N      Not
  9536.  
  9537.  
  9538.  240. MASM Err Msg: Unable to Open Input File: options.asm
  9539.  
  9540.  Product Version(s): 5.10   | 5.10
  9541.  Operating System:   MS-DOS | OS/2
  9542.  Flags: ENDUSER |
  9543.  Last Modified:  6-FEB-1991    ArticleIdent: Q67758
  9544.  
  9545.  The MASM fatal error "Unable to open input file: options.ASM" occurs
  9546.  when the MASM environment variable "MASM" is set to "options". After
  9547.  the variable has been set to "options", it needs to be cleared. This
  9548.  can be done as follows:
  9549.  
  9550.     SET MASM=<ret>
  9551.  
  9552.  When the Runme program is executed to install MASM, it tells you
  9553.  to set your AUTOEXEC.BAT file as follows:
  9554.  
  9555.     MOUSE                 (load mouse driver if you have a mouse)
  9556.     SET PATH=d:\masm...   (directory containing MASM and utilities)
  9557.     SET INCLUDE=d:\masm...(directory containing include files)
  9558.     SET LIB=d:\masm....   (directory containing library and object files)
  9559.     SET MASM=options      (standard assembly options)
  9560.     SET LINK=options      (standard link options)
  9561.     SET TMP=tempDir       (LINK work directory - use RAM disk if available)
  9562.  
  9563.  People often set their AUTOEXEC.BAT files literally as the Runme program
  9564.  shows.
  9565.  
  9566.  
  9567.  241. Bad Object File Generated with MASM 5.10
  9568.  
  9569.  Product Version(s): 5.10   | 5.10
  9570.  Operating System:   MS-DOS | OS/2
  9571.  Flags: ENDUSER | buglist5.10
  9572.  Last Modified:  6-FEB-1991    ArticleIdent: Q67760
  9573.  
  9574.  The following mixed-language program does not assemble properly under
  9575.  MASM version 5.10. The assembler doesn't generate the correct .OBJ
  9576.  record for the linker to resolve the reference properly. When the
  9577.  .EXE is built, the _foo variable is located in the NULL segment
  9578.  instead of the _DATA segment. Therefore, instead of the residing 1
  9579.  byte apart, they are actually 42h bytes apart.
  9580.  
  9581.  Removing the ASSUME statements from the assembly code eliminates the
  9582.  problem. These ASSUME statements are not necessary.
  9583.  
  9584.  Microsoft has confirmed this to be a problem in MASM version 5.10. We
  9585.  are researching this problem and will post new information here as it
  9586.  becomes available.
  9587.  
  9588.  Sample Code
  9589.  -----------
  9590.  
  9591.    dosseg
  9592.    .model small
  9593.  
  9594.    .data
  9595.    assume ds: nothing
  9596.    public _foo
  9597.  _foo db 1
  9598.    assume ds: @data
  9599.    public _bar
  9600.  _bar db 2
  9601.  
  9602.    .code
  9603.    public _func
  9604.  _func proc
  9605.    mov ax, offset _bar
  9606.    sub ax, offset _foo
  9607.    ret
  9608.  _func endp
  9609.  
  9610.    end
  9611.  
  9612.  #include <stdio.h>
  9613.  extern char foo;
  9614.  extern char bar;
  9615.  
  9616.  main ()
  9617.  {
  9618.    printf ("C distance of bar - foo = %X\n", &bar - &foo);
  9619.    printf ("MASM distance of bar - foo = %X\n", func ());
  9620.  }
  9621.  
  9622.  
  9623.  242. STRUC Defined Structures Cannot Be Tested
  9624.  
  9625.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  9626.  Operating System:   MS-DOS     | OS/2
  9627.  Flags: ENDUSER | buglist5.10a
  9628.  Last Modified:  6-FEB-1991    ArticleIdent: Q67787
  9629.  
  9630.  The STRUC command in MASM does not allow for the definition of nested
  9631.  structures. The example code below shows a nested structure definition
  9632.  which gives the following error:
  9633.  
  9634.     test.ASM(10): error A2078: Directive illegal in structure
  9635.  
  9636.  Sample Code
  9637.  -----------
  9638.  
  9639.  .MODEL SMALL
  9640.  .DATA
  9641.  foo STRUC
  9642.          f1 db ?
  9643.          f2 db ?
  9644.  foo ENDS
  9645.  
  9646.  goo STRUC
  9647.          f3 db ?
  9648.          s1 foo <>          ;; this is the nested structure
  9649.                             ;; declaration that is illegal
  9650.  goo ENDS
  9651.  
  9652.  end
  9653.  
  9654.  Microsoft has confirmed this to be a problem in MASM versions 5.10 and
  9655.  5.10a. We are researching this problem and will post new information
  9656.  here as it becomes available.
  9657.  
  9658.  
  9659.  243. IRP Directive Has Single Line Limit of 120 Characters
  9660.  
  9661.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  9662.  Operating System:   MS-DOS     | OS/2
  9663.  Flags: ENDUSER | buglist5.10a
  9664.  Last Modified:  6-FEB-1991    ArticleIdent: Q67788
  9665.  
  9666.  The IRP (Instruction Repeat) directive in MASM has a single line limit
  9667.  of 120 characters. The example code below shows a macro with an IRP
  9668.  that has 125 characters. The result of this program is an error
  9669.  message that states:
  9670.  
  9671.          End of file encountered on input file
  9672.          Number of open conditionals:14
  9673.          End of file encountered on input file
  9674.  
  9675.  This error occurs because the assembler is looking for a closing
  9676.  bracket (>), but the line is over the limit of 120 characters. As a
  9677.  result, the assembler accepts the rest of the code to be part of the
  9678.  IRP parameters. By shortening the final parameter to be within the
  9679.  limit (change TP$_EOS to TP), the bracket is read correctly and the
  9680.  remainder of the program is assembled with no errors.
  9681.  
  9682.  NOTE: In this example, the IRP argument list is stated in three lines;
  9683.  however, it should be all on the same line to cause the error. The
  9684.  120-character limit is only on the same line. A workaround is to
  9685.  continue the argument on the next line as seen below.
  9686.  
  9687.  Microsoft has confirmed this to be a problem in MASM version 5.10 and
  9688.  5.10a. We are researching this problem and will post new information
  9689.  here as it becomes available.
  9690.  
  9691.  Sample Code
  9692.  -----------
  9693.  
  9694.  $tran   macro   keyword
  9695.     irpc TP$_DUMMY,<keyword>
  9696.        ifidn <&TP$_DUMMY>,<T>
  9697.           irp TP$_DUMMY2,<TP$_ANY,TP$_ALPHA,TP$_DIGIT,
  9698.                          TP$_STRING,TP$_SYMBOL,TP$_BLANK,TP$_DECIMAL,
  9699.                          TP$_OCTAL,TP$_HEX,TP$_LAMBDA,TP$_EOS>
  9700.              %out TP$_DUMMY2
  9701.           endm
  9702.        endif
  9703.     endm
  9704.  endm
  9705.  
  9706.     $tran     if_anything_cmd
  9707.  end
  9708.  
  9709.  
  9710.  244. MASM Aligns on 4-Byte Boundary After Offset 8000h
  9711.  
  9712.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  9713.  Operating System:   MS-DOS     | OS/2
  9714.  Flags: ENDUSER | buglist5.10 buglist5.10a
  9715.  Last Modified:  6-FEB-1991    ArticleIdent: Q68071
  9716.  
  9717.  The module below demonstrates a problem with the Macro-Assembler. If
  9718.  an EVEN directive is used after an offset of 8000h within a segment,
  9719.  the assembler will try to align the next instruction or data element
  9720.  on a 4-byte boundary. In other words, more bytes for padding will be
  9721.  added than are necessary to achieve even alignment.
  9722.  
  9723.  Microsoft has confirmed this to be a problem in MASM versions 5.10 and
  9724.  5.10a. We are researching this problem and will post new information
  9725.  here as it becomes available.
  9726.  
  9727.  Sample Code
  9728.  -----------
  9729.  
  9730.   _TEXT SEGMENT
  9731.     ASSUME CS:_TEXT
  9732.     clc
  9733.     even
  9734.     clc
  9735.     org 8000h
  9736.     clc
  9737.     even
  9738.     clc
  9739.  
  9740.   _TEXT ENDS
  9741.   ENDS
  9742.  
  9743.  ASSEMBLY LISTING
  9744.  ----------------
  9745.  
  9746.  Code Generated   Source
  9747.  --------------   ------
  9748.  
  9749.  F8               clc
  9750.  90               even
  9751.  F8               clc
  9752.                   org 8000h
  9753.  F8               clc
  9754.  87 DB 90         even
  9755.  F8               clc
  9756.  
  9757.  
  9758.  245. Language Parameter with .MODEL Directive Doesn't Preserve Case
  9759.  
  9760.  Product Version(s): 5.10 5.10a | 5.10 5.10a
  9761.  Operating System:   MS-DOS     | OS/2
  9762.  Flags: ENDUSER | s_quickasm
  9763.  Last Modified:  6-FEB-1991    ArticleIdent: Q68072
  9764.  
  9765.  The .MODEL directive can be followed by a language parameter that
  9766.  determines naming, calling, and returning conventions that are used
  9767.  by the specified language. The example below demonstrates the syntax.
  9768.  
  9769.  Although the language type determines the naming convention, it does
  9770.  not determine the case of any names used. For example if the statement
  9771.  ".MODEL SMALL, C" is used, case sensitivity of names is not preserved,
  9772.  even though C preserves case by default. However, an underscore is
  9773.  added in front of any names. Similarly, if the statement ".MODEL
  9774.  SMALL, PASCAL" is used in a program, all names are not forced to
  9775.  uppercase (the default for Pascal).
  9776.  
  9777.  To ensure proper case sensitivity, use the command line option /MX
  9778.  (preserves case in public and external names), /MU
  9779.  (converts names to uppercase), or /ML (preserves case in names).
  9780.  
  9781.  Sample Code
  9782.  -----------
  9783.  
  9784.     .model small,c ; <--- Language specifier
  9785.     .code
  9786.  
  9787.     foo proc
  9788.         ret
  9789.     end
  9790.  
  9791.  
  9792.  246. .MODEL Directive Forces DOSSEG Segment Ordering in MASM
  9793.  
  9794.  Product Version(s): 5.00 5.10 5.10a | 5.10 5.10a
  9795.  Operating System:   MS-DOS          | OS/2
  9796.  Flags: ENDUSER | S_QUICKASM
  9797.  Last Modified:  6-FEB-1991    ArticleIdent: Q68562
  9798.  
  9799.  The .MODEL assembler directive forces the segments in the resulting
  9800.  executable program to be ordered as if the DOSSEG directive had been
  9801.  used. This will override any other directives used to organize
  9802.  segments in an executable program. The code below demonstrates this
  9803.  behavior.
  9804.  
  9805.  Because of this, the options below will be ignored:
  9806.  
  9807.     /A and /S command line switches
  9808.     .ALPHA and .SEQ assembler directives
  9809.  
  9810.  This behavior is not documented and no warnings or errors are
  9811.  generated.
  9812.  
  9813.  This behavior is also true with QuickAssembler versions 2.01 and 2.51.
  9814.  The .MODEL assembler directive was designed for use in mixed-language
  9815.  programming. Because of this, it will automatically order the segments
  9816.  in a way compatible with the way higher-level language compilers order
  9817.  them. This will happen even if the <,language> option on the .MODEL
  9818.  directive is not used.
  9819.  
  9820.  Sample Code:
  9821.  
  9822.  The map file created from the linker is included below.
  9823.  
  9824.  .MODEL medium
  9825.  .286
  9826.  .SEQ
  9827.  .STACK 100h
  9828.  
  9829.  A SEGMENT WORD PUBLIC 'DATA'
  9830.  
  9831.  test_data DW 10
  9832.  
  9833.  A ENDS
  9834.  
  9835.  B SEGMENT WORD PUBLIC 'CODE'
  9836.  
  9837.          mov ax,1
  9838.  
  9839.  B ENDS
  9840.          END
  9841.  
  9842.  Map file:
  9843.  
  9844.  Start  Stop   Length Name                        Class
  9845.  00000H 00000H 00000H _TEXT                       CODE
  9846.  00000H 00002H 00003H B                           CODE
  9847.  00004H 00004H 00000H _DATA                       DATA
  9848.  00004H 00005H 00002H A                           DATA
  9849.  00010H 0010FH 00100H STACK                       STACK
  9850.  
  9851.  Origin   Group
  9852.  0000:0   DGROUP
  9853.  
  9854.  When the .MODEL and .STACK directives are removed (.STACK must be
  9855.  removed because it requires .MODEL), the following map file results.
  9856.  Note that the segments appear in the proper order in this case.
  9857.  
  9858.  Start  Stop   Length Name                        Class
  9859.  00000H 00001H 00002H A                           DATA
  9860.  00002H 00004H 00003H B                           CODE
  9861.  
  9862.  
  9863.  247. How to Reboot Your Machine Within a MASM 5.10 Application
  9864.  
  9865.  Product Version(s): 5.10
  9866.  Operating System:   MS-DOS
  9867.  Flags: ENDUSER | S_QUICKASM
  9868.  Last Modified:  6-FEB-1991    ArticleIdent: Q68805
  9869.  
  9870.  You can perform a complete reboot (cold boot) on an 8086-based machine
  9871.  by jumping to the address F000:FFF0. This action also reboots many
  9872.  80286 and 80386 machines. The address contains a jump instruction that
  9873.  leads to the machine's initialization code. For this method to
  9874.  succeed, your machine must be in real-mode operation.
  9875.  
  9876.  To prevent a memory check on IBM and many compatibles (warm boot), you
  9877.  should store the value 0 x 1234 in the memory location at 0040:0072.
  9878.  On 100-percent IBM BIOS compatible machines, an alternative method
  9879.  is to call int 19h instead of jumping to the address mentioned
  9880.  above.
  9881.  
  9882.  Code Example
  9883.  ------------
  9884.  
  9885.      .MODEL SMALL
  9886.      .CODE
  9887.  
  9888.  Start:
  9889.      mov ax, @data                 ; Load ds with data segment
  9890.      mov ds, ax
  9891.  
  9892.      mov ax, 40h                   ; These three lines cause a memory
  9893.      mov es, ax                    ; test NOT to be performed. To
  9894.      mov WORD PTR es:[72h], 1234h  ; do a memory test, remove them.
  9895.  
  9896.      jmp DWORD PTR b_vec           ; Jump to the reboot address
  9897.  
  9898.      .DATA
  9899.  b_vec   DW 0FFF0h                 ; Offset of reboot vector
  9900.          DW 0F000h                 ; Segment of reboot vector
  9901.      .STACK
  9902.      END Start
  9903.  
  9904.  
  9905.  248. Warning A4057 When Using Local Variables
  9906.  
  9907.  Product Version(s): 5.10   | 5.10
  9908.  Operating System:   MS-DOS | OS/2
  9909.  Flags: ENDUSER | buglist5.10 fixlist5.10a
  9910.  Last Modified:  6-FEB-1991    ArticleIdent: Q68873
  9911.  
  9912.  The code below produces the following error:
  9913.  
  9914.     Warning A4057: illegal size for operand
  9915.  
  9916.  This warning is falsely generated and does not occur with version
  9917.  5.10a of the Microsoft Macro Assembler (MASM).
  9918.  
  9919.  The variable arg1, shown in the code below, is a local variable that
  9920.  is defined as a double word. The warning occurs when arg1 is used as
  9921.  a WORD PTR. This is acceptable and should not be flagged.
  9922.  
  9923.  Microsoft has confirmed this to be a problem in MASM
  9924.  version 5.10. This problem was corrected in version 5.10a.
  9925.  
  9926.  Sample Code
  9927.  -----------
  9928.  
  9929.      .MODEL small,c
  9930.      .CODE
  9931.  
  9932.      Begin proc arg1:dword
  9933.        mov ax, word ptr arg1
  9934.        ret
  9935.      Begin endp
  9936.      end Begin
  9937.  
  9938.  
  9939.  249. DWORD Local Variables Use Wrong Offset in MASM
  9940.  
  9941.  Product Version(s): 5.10   | 5.10
  9942.  Operating System:   MS-DOS | OS/2
  9943.  Flags: ENDUSER | buglist5.10 fixlist5.10a
  9944.  Last Modified:  6-FEB-1991    ArticleIdent: Q68945
  9945.  
  9946.  When using the LOCAL directive in the Microsoft Macro Assembler (MASM)
  9947.  version 5.10 to declare stack space for a DWORD variable, the offset
  9948.  that is generated for the variable is [BP-2]. This may result in the
  9949.  saved value of the BP register to be overwritten when a value is
  9950.  stored in the DWORD local variable.
  9951.  
  9952.  Microsoft has confirmed this to be a problem in MASM version 5.10.
  9953.  This problem was corrected in version 5.10a.
  9954.  
  9955.  Beginning with MASM 5.10, if the optional language parameter is used
  9956.  with the .MODEL directive, the LOCAL directive may be used to declare
  9957.  local variables for a procedure (PROC). When the LOCAL directive is
  9958.  used in a procedure, stack space is set aside for the number and size
  9959.  of the local variables that were declared. For example, upon
  9960.  executing the first line of the sample assembly routine below, the
  9961.  stack frame appears as follows if assembled with MASM 5.10:
  9962.  
  9963.        ----------
  9964.        | Return | 2 bytes
  9965.        | address|
  9966.        ----------
  9967.        | Saved  | 2 bytes
  9968.        |   BP   |
  9969.        ----------
  9970.        | storage| 2 bytes
  9971.  SP--> | for foo|
  9972.        ----------
  9973.  
  9974.  The problem is that DWORD needs four bytes of storage. Because the
  9975.  "saved BP" is at a higher memory location than the storage of foo, foo
  9976.  will "overflow" into the saved BP area. Using MASM 5.10a will solve
  9977.  the problem by properly allocating 4 bytes of storage for a DWORD.
  9978.  
  9979.  Sample Code
  9980.  -----------
  9981.  
  9982.          .MODEL SMALL, C
  9983.          PUBLIC C myproc
  9984.          .CODE
  9985.  
  9986.  myproc  PROC
  9987.          LOCAL   foo:DWORD
  9988.          nop
  9989.          ret
  9990.  myproc  ENDP
  9991.  
  9992.          END
  9993.  
  9994.  
  9995.  250. Long Command Line Generates Protection Violation in MASM
  9996.  
  9997.  Product Version(s): 5.10
  9998.  Operating System:   OS/2
  9999.  Flags: ENDUSER | buglist5.10 fixlist5.10a
  10000.  Last Modified: 11-FEB-1991    ArticleIdent: Q69123
  10001.  
  10002.  Executing the Microsoft Macro Assembler (MASM) version 5.10 with a
  10003.  parameter list greater than 129 characters generates a protection
  10004.  violation under OS/2.
  10005.  
  10006.  The following example illustrates the problem:
  10007.  
  10008.     MASM /Mx /Zi .\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\
  10009.     .\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\
  10010.     .\.\.\.\.\t.asm;
  10011.  
  10012.  Workarounds
  10013.  -----------
  10014.  
  10015.  The following lists two valid workarounds:
  10016.  
  10017.  1. Shorten the command line by using the MASM environment
  10018.     variable to declare options (that is, set MASM=/Mx /Zi).
  10019.  
  10020.  2. Contact Microsoft Product Support Services by calling (206)
  10021.     454-2030 and ask for the incremental update MASM 5.10a.
  10022.  
  10023.  Microsoft has confirmed this to be a problem in MASM version 5.10.
  10024.  This problem was corrected in version 5.10a.
  10025.  
  10026.  
  10027.  
  10028.  
  10029.  
  10030.  
  10031.  Microsoft QuickAssembler
  10032.  =============================================================================
  10033.  
  10034.  
  10035.  1. New Command-Line Options in Qasm
  10036.  
  10037.  Product Version(s): 2.01
  10038.  Operating System:   MS-DOS
  10039.  Flags: ENDUSER |
  10040.  Last Modified: 26-JUN-1989    ArticleIdent: Q44742
  10041.  
  10042.  Quick Assembler recognizes the new ML-style options to be similar and
  10043.  consistent with CL options. Qasm does not recognize old-style options
  10044.  (MASM Version 5.10 and previous).
  10045.  
  10046.  Like CL, if the /c switch is not specified, the linker is invoked
  10047.  following a successful assembly. Unlike old-style Macro Assembler
  10048.  options, Qasm switches are case sensitive.
  10049.  
  10050.  The following are the switches which the Quick Assembler supports:
  10051.  
  10052.  /a        Alphabetical segment order (was /A)
  10053.  /c        Assemble only (new switch)
  10054.  /D        Define symbol (was /Dsym[=value])
  10055.  /Ez       Displays error lines on the screen (was /Z)
  10056.  /FPi      Generate emulator calls (was /E)
  10057.  /help     Print help listing (was /H)
  10058.  /I        Include path (was /I)
  10059.  /l        Generate a listing file with the default name (was /L)
  10060.  /L[cr]    Specifies flags for the linker (new switch)
  10061.  /Fefile   Names the output .EXE file (new switch)
  10062.  /Flfile   Generate a listing file with specified name (new switch)
  10063.  /Fofile   Name the output .OBJ file (new switch)
  10064.  /M[uxl]   Controls case sensitivity (was /M[uxl]
  10065.  /s        Sequential segment order (was /S)
  10066.  /Sa       List all lines (was /La..implies listing is on)
  10067.  /Sd       Create pass 1 listing (was /D) (implies listing is on)
  10068.  /Se       Listing is editor oriented (new switch) (implies listing is on)
  10069.  /Sn       Suppresses symbol table in list file (was /N)
  10070.            (implies listing is on)
  10071.  /Sp       Listing is printer oriented (new switch)
  10072.            (implies listing is on)
  10073.  /Sq       Generate line-number index in listing (new switch)
  10074.            (implies listing is on)
  10075.  /Sx       Suppresses listing of false conditionals (was /X)
  10076.            (implies listing is on)
  10077.  /t        Suppresses messages for successful assembly (was /T)
  10078.  /v        Verbose messages  (was /V)
  10079.  /W[012]   Warning level setting 0, 1, or 2 (was /W[012])
  10080.  /Z[di]    Generate debug information (was /Z[di])
  10081.  
  10082.  
  10083.  2. Major Changes between QuickC 2.00 and Quick Assembler
  10084.  
  10085.  Product Version(s): 2.01
  10086.  Operating System:   MS-DOS
  10087.  Flags: ENDUSER |
  10088.  Last Modified: 26-JUN-1989    ArticleIdent: Q44743
  10089.  
  10090.  The following lists the major changes between QuickC 2.00 and Quick
  10091.  Assembler 2.01:
  10092.  
  10093.   1. Quick Assembler 2.01 is bundled with a modified QuickC which has
  10094.      version number 2.01 (this can be found by typing QCL at the DOS
  10095.      command prompt).
  10096.  
  10097.   2. Quick Assembler is a super-set of QuickC. It contains ALL of the
  10098.      functionality and capabilities of QuickC, with the additional power
  10099.      of a quick assembler.
  10100.  
  10101.   3. Quick Assembler does not exist without a QuickC 2.01. It is a
  10102.      bundled package. There will continue to be a stand alone QuickC
  10103.      2.00 package, but no stand alone Quick Assembler.
  10104.  
  10105.   4. No Floppy Disk Support: Quick Assembler requires a hard disk. It
  10106.      does not support execution on a floppy disk system.
  10107.  
  10108.   5. New Type Casts for debugging: BY, WO, DW are used by CodeView to
  10109.      simulate MASM <type> PTR. These type casts are now acceptable to
  10110.      the Watch expression evaluator in the Quick environment.
  10111.  
  10112.      Note: BY <reg>      is the same as * (char *) <reg>
  10113.            BY <addrexpr> is same as  * (char *) <addrexpr>
  10114.            BY <var>      is the same as * (char *) &<var>
  10115.  
  10116.      WO and DW behave analogously, with WO equivalent to * (int*) and
  10117.      DW equivalent to * (long *).
  10118.  
  10119.   6. Segmentation Support: The colon ':' operator is recognized
  10120.      as indicating a full segmented address in Watch expressions. The
  10121.      segment portion can be either a segment register or a numeric
  10122.      value.
  10123.  
  10124.   8. .COM File Production and Debugging: Quick Assembler allows for
  10125.      both the production and debugging of .COM files. LINK.EXE has been
  10126.      modified to check if /TINY and /CODEVIEW are both specified. If
  10127.      so, the symbolic information will be emitted into a separate .DEB
  10128.      file (instead of placing it in the .EXE file as per normal).
  10129.  
  10130.      The debugger checks the extension of the file it is loading, and
  10131.      if it is a .COM, the debugger will get CodeView information from
  10132.      the .DEB file.
  10133.  
  10134.      Note: This support of .COM files is currently restricted to the
  10135.      Quick Assembler and does not extend to the QuickC portion of the
  10136.      package. Microsoft is actively pursuing extending the .COM support
  10137.      to a future release of QuickC.
  10138.  
  10139.   9. Ten-Byte Real Support: In assembly, ten-byte reals may be defined
  10140.      using the DT directive. Support has been added to allow Watches of
  10141.      ten-byte reals, and to allow their values to be modified using
  10142.      Debug.Modify Value. As in CodeView, they will not be allowed in
  10143.      expressions.
  10144.  
  10145.  10. Screen Swapping: The debugger will force screen swapping when
  10146.      tracing a file with a .ASM extension so that direct output is not
  10147.      misplaced.
  10148.  
  10149.  11. First Trace into Assembly Programs: The first Trace into a pure
  10150.      assembly program (i.e., no C startup code) will actually execute the
  10151.      first statement. This differs from CodeView and the way the QuickC
  10152.      debugger operates on .C files.
  10153.  
  10154.  12. Qasm will be called by QCL: The Quick Assembler will be directly
  10155.      callable through QCL. This means that when a *.ASM file is
  10156.      specified to QCL it will invoke Qasm with all arguments passed
  10157.      through unchanged.
  10158.  
  10159.  
  10160.  3. What is Quick Assembler?
  10161.  
  10162.  Product Version(s): 2.01
  10163.  Operating System:   MS-DOS
  10164.  Flags: ENDUSER |
  10165.  Last Modified: 26-JUN-1989    ArticleIdent: Q44744
  10166.  
  10167.  Question: What is Quick Assembler?
  10168.  
  10169.  Quick Assembler is, simply put, QuickC 2.00 with the addition of a
  10170.  Quick Assembler which is completely functional within the Quick
  10171.  environment. You can edit, assemble, and debug pure assembly programs
  10172.  with the benefit of Online Assembly Help. It also is designed to make
  10173.  mixed-language programming even easier and faster than before.
  10174.  
  10175.  This package has all the capabilities of QuickC 2.00 with the added
  10176.  performance enhancement of a full assembler.
  10177.  
  10178.  Quick Assembler does NOT replace the Inline Assembler. It is a full
  10179.  assembler which supports pure assembly source. The Inline Assembler is
  10180.  still available as a feature of QuickC.
  10181.  
  10182.  Quick Assembler is NOT a stand-alone package. It is bundled with
  10183.  specific QuickC 2.01 packages. There is a fulfillment package for
  10184.  owners of QuickC 2.00 which allows the upgrading to QuickC/Quick
  10185.  Assembler.
  10186.  
  10187.  
  10188.  4. /AT Tiny Model and Quick Assembler
  10189.  
  10190.  Product Version(s): 2.01
  10191.  Operating System:   MS-DOS
  10192.  Flags: ENDUSER |
  10193.  Last Modified: 26-JUN-1989    ArticleIdent: Q44745
  10194.  
  10195.  The Tiny model is supported by the Quick Assembler Version 2.01 to
  10196.  allow for the creation of .COM files. This support alleviates the
  10197.  required use of EXE2BIN. This memory model is supported in the
  10198.  following way:
  10199.  
  10200.  1. Segment _TEXT will be included as the first segment of DGROUP.
  10201.  
  10202.  2. An "assume" will be done of all segment registers to DGROUP.
  10203.  
  10204.  3. The code segment will be opened, and an ORG 100h done.
  10205.  
  10206.  As a result of this change, constructs that result in segment fixups
  10207.  will be flagged as errors where possible. This includes use of a
  10208.  segment as an immediate value, and the use of the SEG operator, as in
  10209.  the following example:
  10210.  
  10211.     1. MOV    ax, _DATA
  10212.     2. MOV    ax, SEG MySymbol
  10213.  
  10214.  In the above example, the following new error message will be
  10215.  generated in Tiny model:
  10216.  
  10217.     error 116: Segment reference illegal in tiny model.
  10218.  
  10219.  Please note that this support for .COM files currently resides only in
  10220.  the Quick Assembler portion of this package. The possibility of
  10221.  embedding this support within Quick C is under review and will be
  10222.  considered for inclusion in a future release.
  10223.  
  10224.  
  10225.  5. .MODEL and FAR_STACK, LOCAL_STACK in Quick Assembler
  10226.  
  10227.  Product Version(s): 2.01
  10228.  Operating System:   MS-DOS
  10229.  Flags: ENDUSER |
  10230.  Last Modified: 26-JUN-1989    ArticleIdent: Q44746
  10231.  
  10232.  Prior to Quick Assembler Version 2.01, the .MODEL directive expanded
  10233.  into instructions that assumed that SS=DS=DGROUP. This situation is
  10234.  not upheld at the start of a stand-alone assembly program (initially,
  10235.  SS is set to the stack segment, and SP is set to the size of the
  10236.  stack). The startup code of all Microsoft high-level languages sets
  10237.  SS=DGROUP and adjusts SP accordingly.
  10238.  
  10239.  Two new attributes have been added to the .MODEL directive:
  10240.  
  10241.  1. FAR_STACK
  10242.  
  10243.  2. LOCAL_STACK  (the default, if neither is specified)
  10244.  
  10245.  These new options are designed to simplify setting up segments for
  10246.  DS=SS and DS!=SS.
  10247.  
  10248.  LOCAL_STACK is the default, and will direct .MODEL and .STACK to
  10249.  behave as they have previously, i.e., set up segments assuming DS=SS.
  10250.  
  10251.  FAR_STACK will direct the .MODEL and .STACK to do the correct setup
  10252.  for a DS!=SS environment.
  10253.  
  10254.  The following lists the expansion of a sample .MODEL and .STACK
  10255.  directive:
  10256.  
  10257.  .MODEL small = _data  SEGMENT WORD PUBLIC 'data'
  10258.                 dgroup GROUP  _data
  10259.                 _data  ENDS
  10260.                 _text  SEGMENT WORD PUBLIC 'text'
  10261.                 _text  ENDS
  10262.                        ASSUME cs:_text, ds:_data, ss:dgroup
  10263.  
  10264.  .STACK 100h  = stack  SEGMENT PARA STACK 'stack'
  10265.                 dgroup GROUP  stack
  10266.                        org 100h
  10267.                 stack  ENDS
  10268.  
  10269.  This setup assumes that DS==SS, which is the default. Specifying
  10270.  ".MODEL small, LOCAL_STACK" expands to the same instructions.
  10271.  
  10272.  If you specify FAR_STACK in the above example, the expansion is as
  10273.  follows:
  10274.  
  10275.  .MODEL small, FAR_STACK
  10276.                 _data  SEGMENT WORD PUBLIC 'data'
  10277.                 dgroup GROUP  _data
  10278.                 _data  ENDS
  10279.                 _text  SEGMENT WORD PUBLIC 'text'
  10280.                 _text  ENDS
  10281.                        ASSUME cs:_text, ds:_data, ss:NOTHING
  10282.  
  10283.  .STACK 100h
  10284.                 stack  SEGMENT PARA STACK 'stack'
  10285.                        ASSUME  SS:stack
  10286.                        org 100h
  10287.                 stack  ENDS
  10288.  
  10289.  Please note that the stack segment is not placed in DGROUP when
  10290.  FAR_STACK is specified. Additionally, the "assume" generated by the
  10291.  .MODEL assumes NOTHING for SS, and the .STACK performs an "assume" to
  10292.  the stack segment.
  10293.  
  10294.  An error is generated if FAR_STACK is specified along with the TINY
  10295.  memory model.
  10296.  
  10297.  
  10298.  6. Differences between Quick Assembler and Macro Assembler
  10299.  
  10300.  Product Version(s): 2.01
  10301.  Operating System:   MS-DOS
  10302.  Flags: ENDUSER |
  10303.  Last Modified: 26-JUN-1989    ArticleIdent: Q44747
  10304.  
  10305.  The following article lists the major changes between the Microsoft
  10306.  Quick Assembler Versions (Qasm) 2.01 and the Macro Assembler.
  10307.  
  10308.  1. Quick Assembler Supports Only Real Mode 286
  10309.  
  10310.     Qasm supports all Intel assembly instructions that lie within
  10311.     the scope of real mode 80286. This means the directives .386,
  10312.     .386p, .387, and .286p will be recognized; however, they produce
  10313.     one of the following two errors:
  10314.  
  10315.        A2119:    80386 processor not supported.
  10316.        A2120:    Privileged instructions not supported.
  10317.  
  10318.  2. .MODEL TINY Is Supported to Allow for .COM Files
  10319.  
  10320.     The Tiny model is now supported by the Quick Assembler and the
  10321.     linker shipped with Qasm. This means that EXE2BIN is not needed for
  10322.     .COM file production.
  10323.  
  10324.  3. .MODEL Changes and Additional Features
  10325.  
  10326.     To assist you in writing code that can be easily switched between
  10327.     memory models, a new predefined equate, @MODEL, is available. This
  10328.     equate has the following values:
  10329.  
  10330.        1 = TINY.  2 = SMALL. 3 = MEDIUM.
  10331.        4 = COMPACT. 5 = LARGE.  6 = HUGE.
  10332.  
  10333.     The following code fragment shows how this equate can be used to
  10334.     switch between small and tiny models:
  10335.  
  10336.  .model    <specified model>
  10337.  .data
  10338.  .code
  10339.  
  10340.  start:
  10341.            if @MODEL NE 1      ; if not TINY model
  10342.            mov  ax, @data
  10343.            mov  ds, ax
  10344.            endif
  10345.            .
  10346.            .
  10347.  
  10348.  4. FAR_STACK and LOCAL_STACK attributes to .MODEL
  10349.  
  10350.        .Model Small, c, FAR_STACK
  10351.        .Model Small, c, LOCAL_STACK
  10352.  
  10353.     LOCAL_STACK is the default and directs .MODEL and .STACK to behave
  10354.     as they have done in the past, i.e., set up the segments for an
  10355.     SS = DS environment.
  10356.  
  10357.     FAR_STACK instructs Qasm to perform the correct setup for a
  10358.     SS!= DS environment.
  10359.  
  10360.  5. New Directive .STARTUP
  10361.  
  10362.     .STARTUP expands to the correct code for the given model and
  10363.     FAR/LOCAL_STACK value. This expansion includes initializing DS,
  10364.     SS, and SP when necessary. It also defines a start address
  10365.     label and directs the END directive to use this start label.
  10366.  
  10367.     This directive is designed only for stand-alone programs. It should
  10368.     not be used for code that is mixed with higher-level languages such
  10369.     as C, FORTRAN, etc., because it conflicts with their startup
  10370.     code.
  10371.  
  10372.     Likewise, this directive should be used for stand-alone DOS
  10373.     programs. The load conditions for OS/2 are different.
  10374.  
  10375.     6. /P1 switch Implies a One-Pass Assembly
  10376.  
  10377.     Qasm supports a one-pass assembly run as well as the standard
  10378.     two-pass assembly run.
  10379.  
  10380.     A listing cannot be produced when the single-pass option is chosen,
  10381.     i.e., /Fl and /a are not tolerated when the /P1 option is given).
  10382.  
  10383.  7. Screen-Oriented Listing File
  10384.  
  10385.     /Se is a new option that instructs Qasm to generate a listing
  10386.     file that is oriented to the screen rather than a disk file. Use of
  10387.     this option implies the following:
  10388.  
  10389.     a. No page headers or formfeeds will be inserted.
  10390.  
  10391.     b. The first argument to the PAGE command will have no effect.
  10392.  
  10393.     c. The default PAGE's second argument will be 255.
  10394.  
  10395.     d. TITLE and SUBTTL directives will be ignored.
  10396.  
  10397.  8. /Sp Is the Counter Option to /Se
  10398.  
  10399.     /Sp produces a printer-oriented listing file.
  10400.  
  10401.  9. Object Code Improvements
  10402.  
  10403.     Near JMPs and CALLs to nonexternal labels used to have associated
  10404.     FIXUPs generated. Qasm now calculates the relative displacement
  10405.     internally, rather than having the linker do it. This process
  10406.     saves 7 bytes per JMP/CALL in terms of .obj size.
  10407.  
  10408.     Shorthand fixup forms are now used. If the frame is equal to the
  10409.     target, a frame=target form of fixup is used, and the frame datum
  10410.     is not needed. Similarly, if the frame is equal to the location,
  10411.     the frame=location form is used.
  10412.  
  10413.     Threads are now defined, and thread fixups are used where possible.
  10414.  
  10415.  All of these changes should decrease the size of the resultant object.
  10416.  Savings in size should range from 5 to 20 percent.
  10417.  
  10418.  
  10419.  
  10420.  7. Error C4096: "Unkown Warning" May Be Caused by C1.ERR Omission
  10421.  
  10422.  Product Version(s): 2.01
  10423.  Operating System:   MS-DOS
  10424.  Flags: ENDUSER | docerr
  10425.  Last Modified: 28-JUN-1989    ArticleIdent: Q45680
  10426.  
  10427.  An error was made in the file C1.ERR, which is included in the
  10428.  Microsoft QuickAssembler package, where one error listing was omitted.
  10429.  
  10430.  This omission produces the following warning whenever you compile a C
  10431.  program and have the "Generate Com file" option chosen in the menu
  10432.  Options.Make.Linker Flags:
  10433.  
  10434.     C4096: UNKNOWN WARNING
  10435.            Contact Microsoft Technical Support
  10436.  
  10437.  This warning is not "unknown"; rather, it is just omitted. Actually, C4096
  10438.  means the following:
  10439.  
  10440.     C4096    "-AT treated as -AS"
  10441.  
  10442.  To correct this problem, you need only insert the following line in
  10443.  the file C1.ERR:
  10444.  
  10445.     C4096    "-AT treated as -AS"
  10446.  
  10447.  You should insert this line into the file so that it is correctly
  10448.  ordered (i.e., C4096 should follow C4095...).
  10449.  
  10450.  This ommission will be corrected in subsequent releases of the
  10451.  QuickAssembler package.
  10452.  
  10453.  
  10454.  8. -P1 One-Pass Assembly Can Result in A2006 Phase Error
  10455.  
  10456.  Product Version(s): 2.01
  10457.  Operating System:   MS-DOS
  10458.  Flags: ENDUSER | buglist2.01
  10459.  Last Modified: 26-JUL-1989    ArticleIdent: Q46380
  10460.  
  10461.  A phase error message is generated by the QuickAssembler Version 2.01
  10462.  if the -P1 one pass assembly option is chosen and the following
  10463.  scenario is fulfilled:
  10464.  
  10465.  1. On any binary arithmetic instruction (AND, ADD, OR, CMP, SUB, XOR,
  10466.     SBB, ADC) where the first operand contains a forward reference to a
  10467.     WORD data label
  10468.  
  10469.  2. The second operand is a nonforward referenced symbolic immediate
  10470.     whose value could be represented in a sign-extended byte (i.e.,
  10471.     007fh, 0ff84h, -1, 12, but not 0081h since it sign-extends to
  10472.     0ff81h)
  10473.  
  10474.  Any of the following actions will resolve this error:
  10475.  
  10476.  1. Use -P2.
  10477.  
  10478.  2. Define the data label before the point of reference.
  10479.  
  10480.  3. Use a BYTE PTR type cast operation on the immediate symbol (i.e.,
  10481.     "cmp foo, byte ptr bar").
  10482.  
  10483.  Microsoft has confirmed this to be a problem in QuickAssembler Version
  10484.  2.01. We are researching this problem and will post new information as
  10485.  it becomes available.
  10486.  
  10487.  The following example will reproduce this problem:
  10488.  
  10489.  TRUE            equ     1               ; Boolean True value
  10490.  CSEG    SEGMENT PARA PUBLIC 'CODE'
  10491.          ASSUME  CS:CSEG,DS:CSEG,SS:CSEG ; Already set by DOS loader (COM File
  10492.          ASSUME  CS:CSEG,SS:CSEG         ; Already set by DOS loader (COM File
  10493.  
  10494.          org     100h
  10495.  entry:                                  ; Program entry point
  10496.  queueScreen proc near                   ; Procedure declaration
  10497.          cmp     cs:screenQueued,TRUE    ; screenQueued is forward referenced.
  10498.          ret
  10499.  queueScreen endp
  10500.  
  10501.  screenQueued    dw      0
  10502.  
  10503.  CSEG    ENDS
  10504.          END     entry
  10505.  
  10506.  to resolve the phase error in this specific example, do one of the
  10507.  following:
  10508.  
  10509.  1. Select -P2, the two-pass assembly option.
  10510.  
  10511.  2. Change the following line
  10512.  
  10513.        cmp     cs:screenQueued, TRUE
  10514.  
  10515.     to the following:
  10516.  
  10517.        cmp     cs:screenQueued, byte ptr TRUE
  10518.  
  10519.  3. Move the definition of screenQueued so that it is defined prior to
  10520.     the compare instruction, for example:
  10521.  
  10522.                  screenQueued    dw      0
  10523.                  .
  10524.                  .
  10525.                  .
  10526.                  cmp     cs:screenQueued, TRUE
  10527.  
  10528.  Any of these solutions will work around this phase error problem in
  10529.  this specific example. These solutions prevent many phase errors from
  10530.  occurring when assembling similar kinds of data references with either
  10531.  QuickAssembler or MASM since the source of phase errors is usually due
  10532.  to the assembler making an incorrect assumption about the type of a
  10533.  variable that is referred to before it is defined.
  10534.  
  10535.  
  10536.  
  10537.  9. QuickAssembler 2.01 PACKING.LST
  10538.  
  10539.  Product Version(s): 2.01
  10540.  Operating System:   MS-DOS
  10541.  Flags: ENDUSER | distribution directory disks
  10542.  Last Modified: 26-JUL-1989    ArticleIdent: Q46840
  10543.  
  10544.  The following is the packing list file (PACKING.LST) for the
  10545.  QuickC/QuickAssembler Version 2.01 5.25-inch disk set:
  10546.  
  10547.  Disk 1 : QuickAssembler/QuickC Setup
  10548.  
  10549.  Files                       Description
  10550.  -----                       -----------
  10551.  
  10552.  PACKING.LST                 Packing list (this file)
  10553.  SETUP.EXE                   Setup program for QuickC with QuickAssembler
  10554.  README.DOC                  Release notes for QuickC with QuickAssembler
  10555.  HELPMAKE.EXE                Creates and customizes help files
  10556.  MSHERC.COM                  TSR -- supports Hercules card graphics
  10557.  FIXSHIFT.COM                Fixes BIOS bug for some Compaq and other keyboard
  10558.  
  10559.  DOSPATCH\PATCH320.DOC       Patch files for MS-DOS 3.20 and PC-DOS 3.20
  10560.  DOSPATCH\SETRHS.EXE         " -- Read the .DOC files for details
  10561.  DOSPATCH\RMRHS.EXE          " "
  10562.  DOSPATCH\STKPAT.BAT         " "
  10563.  DOSPATCH\STKPAT.SCR         " "
  10564.  DOSPATCH\PATCH87.DOC        " "
  10565.  DOSPATCH\PATCH87.EXE        " "
  10566.  
  10567.  SAMPLES\SAMPLES.DOC         Sample C programs
  10568.  SAMPLES\GRDEMO.C            " -- Read SAMPLES.DOC for details
  10569.  SAMPLES\GRDEMO.MAK          " "
  10570.  SAMPLES\MENU.C              " "
  10571.  SAMPLES\MENU.H              " "
  10572.  SAMPLES\TURTLE.C            " "
  10573.  SAMPLES\TURTLE.H            " "
  10574.  SAMPLES\LIFE.C              " "
  10575.  SAMPLES\TOOLS.C             " "
  10576.  SAMPLES\TOOLS.H             " "
  10577.  SAMPLES\LIFE.MAK            " "
  10578.  SAMPLES\CRLF.C              " "
  10579.  
  10580.  Disk 2 : Learning the QuickC Integrated Environment
  10581.  
  10582.  Files                       Description
  10583.  -----                       -----------
  10584.  
  10585.  LEARN.COM                   On-line tutorial and introduction to QuickC
  10586.  LC.PGM                      Tutorial support files
  10587.  QCCBT.CTX                   " "
  10588.  QCCBT.SCN                   " "
  10589.  QCCBT.SOB                   " "
  10590.  LINK.EXE                    Special linker for Windows and OS/2 developers
  10591.  
  10592.  Disk 3 : Integrated Development Environment 1
  10593.  
  10594.  Files                       Description
  10595.  -----                       -----------
  10596.  
  10597.  QC.EXE                      QuickCintegrated programming environment
  10598.  QC.INI                      Default .INI file for QuickC
  10599.  
  10600.  Disk 4 : Integrated Development Environment 2
  10601.  
  10602.  Files                       Description
  10603.  -----                       -----------
  10604.  
  10605.  QCC.OVL                     QuickCoverlay for the integrated environment
  10606.  C1.ERR                      Compiler error messages for QC and QCL
  10607.  NMAKE.EXE                   Stand-alone program maintenance utility
  10608.  
  10609.  INCLUDE\ASSERT.H            Include files
  10610.  INCLUDE\BIOS.H              "  -- Read the beginning of each file for details
  10611.  INCLUDE\CONIO.H             " "
  10612.  INCLUDE\CTYPE.H             " "
  10613.  INCLUDE\DIRECT.H            " "
  10614.  INCLUDE\DOS.H               " "
  10615.  INCLUDE\ERRNO.H             " "
  10616.  INCLUDE\FCNTL.H             " "
  10617.  INCLUDE\FLOAT.H             " "
  10618.  INCLUDE\GRAPH.H             " "
  10619.  INCLUDE\IO.H                " "
  10620.  INCLUDE\LIMITS.H            " "
  10621.  INCLUDE\MALLOC.H            " "
  10622.  INCLUDE\MATH.H              " "
  10623.  INCLUDE\MEMORY.H            " "
  10624.  INCLUDE\PGCHART.H           " "
  10625.  INCLUDE\PROCESS.H           " "
  10626.  INCLUDE\SEARCH.H            " "
  10627.  INCLUDE\SETJMP.H            " "
  10628.  INCLUDE\SHARE.H             " "
  10629.  INCLUDE\SIGNAL.H            " "
  10630.  INCLUDE\STDARG.H            " "
  10631.  INCLUDE\STDDEF.H            " "
  10632.  INCLUDE\STDIO.H             " "
  10633.  INCLUDE\STDLIB.H            " "
  10634.  INCLUDE\STRING.H            " "
  10635.  INCLUDE\TIME.H              " "
  10636.  INCLUDE\VARARGS.H           " "
  10637.  
  10638.  INCLUDE\SYS\LOCKING.H       " "
  10639.  INCLUDE\SYS\STAT.H          " "
  10640.  INCLUDE\SYS\TIMEB.H         " "
  10641.  INCLUDE\SYS\TYPES.H         " "
  10642.  INCLUDE\SYS\UTIME.H         " "
  10643.  
  10644.  Disk 5 : Utilities
  10645.  
  10646.  Files                       Description
  10647.  -----                       -----------
  10648.  
  10649.  CRLF.EXE                    Removes CTRL characters and inserts CR/LFs
  10650.  LINK.EXE                    Linker
  10651.  ILINK.EXE                   Incremental linker
  10652.  ILINKSTB.OVL                Ilink overlay
  10653.  LIB.EXE                     Library maintenance utility
  10654.  ERRORS.HLP                  Help on error messages
  10655.  QCC.DAT                     Data file used by QC environment
  10656.  MOUSE.COM                   Microsoft mouse driver - Version 6.24a
  10657.  MKKEY.EXE                   Creates customized keyboard command files
  10658.  BRIEF.KEY                   Keyboard files
  10659.  EMACS.KEY                   " "
  10660.  EPSILON.KEY                 " "
  10661.  ME.KEY                      " "
  10662.  QC.KEY                      " "
  10663.  
  10664.  Disk 6 : Microsoft Quick Advisor
  10665.  
  10666.  Files                       Description
  10667.  -----                       -----------
  10668.  
  10669.  QC.HLP                      Help on C and library functions
  10670.  
  10671.  Disk 7 : Command-Line Compiler
  10672.  
  10673.  Files                       Description
  10674.  -----                       -----------
  10675.  
  10676.  QCCOM.EXE                   Command-line compiler
  10677.  QCL.EXE                     Driver for command-line compiler
  10678.  QCL.HLP                     Help on QCL
  10679.  CL.ERR                      Error messages for QCL and QC
  10680.  GRAPHICS.HLP                Help on graphics functions
  10681.  
  10682.  Disk 8 : Libraries 1
  10683.  
  10684.  Files                       Description
  10685.  -----                       -----------
  10686.  
  10687.  SLIBC.LIB                   Library for small model
  10688.  SLIBFP.LIB                  Floating-point math library (small model)
  10689.  SVARSTCK.OBJ                Small model competing heap/stack object file
  10690.  MLIBC.LIB                   Library for medium model
  10691.  MLIBFP.LIB                  Floating-point math library (medium model)
  10692.  MVARSTCK.OBJ                Medium model competing heap/stack object file
  10693.  
  10694.  Disk 9 : Libraries 2
  10695.  
  10696.  Files                       Description
  10697.  -----                       -----------
  10698.  
  10699.  BINMODE.OBJ                 Changes default file I/O mode from text to binary
  10700.  SETARGV.OBJ                 Allows wildcards in command-line arguments
  10701.  RMFIXUP.OBJ                 Removes interrupts; forces coprocessor math
  10702.  DBUSED.OBJ                  Needed when linking with C 5.10 OS/2 libraries
  10703.  EM.LIB                      FP math library for software emulation of 8087
  10704.  LIBH.LIB                    General helper library
  10705.  GRAPHICS.LIB                Low-level graphics library
  10706.  PGCHART.LIB                 Presentation graphics library
  10707.  CLIBC.LIB                   Library for compact model
  10708.  CLIBFP.LIB                  Floating-point math library (compact model)
  10709.  CVARSTCK.OBJ                Compact model competing heap/stack object file
  10710.  
  10711.  Disk 10 : Libraries 3/fonts
  10712.  
  10713.  Files                       Description
  10714.  -----                       -----------
  10715.  
  10716.  87.LIB                      Floating-Point math library for 8087 coprocessor
  10717.  LLIBC.LIB                   Library for large model
  10718.  LLIBFP.LIB                  Floating-point math library (large model)
  10719.  LVARSTCK.OBJ                Large model competing heap/stack object file
  10720.  
  10721.  FONT\COURB.FON              Font files
  10722.  FONT\HELVB.FON              " "
  10723.  FONT\MODERN.FON             " "
  10724.  FONT\ROMAN.FON              " "
  10725.  FONT\SCRIPT.FON             " "
  10726.  FONT\TMSRB.FON              " "
  10727.  
  10728.  NOTES.HLP                   User-defined help file
  10729.  
  10730.  Disk 11 : Quickassembler 1
  10731.  
  10732.  Files                       Description
  10733.  -----                       -----------
  10734.  
  10735.  QAS.OVL                     QuickAssembler overlay
  10736.  
  10737.  SAMPLES\QASAMPLE.DOC        Sample C and Assembler programs
  10738.  SAMPLES\FILEDEMO.MAK        " -- Read QASAMPLE.DOC for details
  10739.  SAMPLES\FILEDEMO.C          " "
  10740.  SAMPLES\FILE.ASM            " "
  10741.  SAMPLES\MATHDEMO.MAK        " "
  10742.  SAMPLES\MATHDEMO.C          " "
  10743.  SAMPLES\MATH.ASM            " "
  10744.  SAMPLES\MISCDEMO.MAK        " "
  10745.  SAMPLES\MISCDEMO.ASM        " "
  10746.  SAMPLES\MISC.ASM            " "
  10747.  SAMPLES\COMMON.ASM          " "
  10748.  SAMPLES\DEMO.H              " "
  10749.  SAMPLES\DEMO.INC            " "
  10750.  SAMPLES\CHRTDEMO.C          " "
  10751.  SAMPLES\CHRTDEMO.H          " "
  10752.  SAMPLES\CHRTSUPT.C          " "
  10753.  SAMPLES\CHRTOPT.C           " "
  10754.  SAMPLES\CHRTDEMO.MAK        " "
  10755.  
  10756.  Disk 12 : Quickassembler 2
  10757.  
  10758.  Files                       Description
  10759.  -----                       -----------
  10760.  
  10761.  QA.HLP                      Help on the QuickAssembler - Part 1 of 2
  10762.  
  10763.  Disk 13 : Quickassembler 3
  10764.  
  10765.  Files                       Description
  10766.  -----                       -----------
  10767.  
  10768.  QA1.HLP                     Help on the QuickAssembler - Part 2 of 2
  10769.  QCENV.HLP                   Help on the QuickC environment
  10770.  
  10771.  
  10772.  10. .DBG File Needed to Debug .COM File
  10773.  
  10774.  Product Version(s): 2.01
  10775.  Operating System:   MS-DOS
  10776.  Flags: ENDUSER |
  10777.  Last Modified: 26-JUL-1989    ArticleIdent: Q47029
  10778.  
  10779.  To debug a .COM file produced with the QuickAssembler, the linker
  10780.  places necessary symbolic information in a file with the extension
  10781.  .DBG. If this file is deleted, no error message is issued, but the
  10782.  QuickAssembler will report that the program does not contain debug
  10783.  information. At this point, it asks if you would like to rebuild with
  10784.  the debug information. In general, you should do this rebuild so that
  10785.  you can use the full power of the QuickAssembler debugger.
  10786.  
  10787.  If you choose not to rebuild by selecting "No", then any debugging
  10788.  command that requires debugging information, including breakpoints and
  10789.  displays of variables by name, will be unavailable. Because of this,
  10790.  Microsoft recommends rebuilding to include debugging information
  10791.  before debugging.
  10792.  
  10793.  
  10794.  
  10795.  11. .COM File Example Produces Warning
  10796.  
  10797.  Product Version(s): 2.01
  10798.  Operating System:   MS-DOS
  10799.  Flags: ENDUSER |
  10800.  Last Modified: 26-JUL-1989    ArticleIdent: Q47030
  10801.  
  10802.  Page 80 of the "QuickAssembler Programmer's Guide" contains an example
  10803.  of a .COM file. This example produces a nonfatal warning if assembled
  10804.  and run. The warning reads as follows:
  10805.  
  10806.     warning A5132: .Startup found without matching .Exit
  10807.  
  10808.  Accessing Quick Help reveals that the use of the .Startup directive
  10809.  should be used in conjunction with an .Exit directive. To eliminate
  10810.  this warning, place an .Exit directive on the line preceding the END
  10811.  statement in the example shown in the "QuickAssembler Programmer's
  10812.  Guide." The warning issued is a nonfatal warning. The program should
  10813.  function correctly.
  10814.  
  10815.  
  10816.  12. .Startup Not Interchangeable with ORG Instruction, Tiny Model
  10817.  
  10818.  Product Version(s): 2.01
  10819.  Operating System:   MS-DOS
  10820.  Flags: ENDUSER | docerr
  10821.  Last Modified: 26-JUL-1989    ArticleIdent: Q47031
  10822.  
  10823.  Page 80 of the "QuickAssembler Programmer's Guide" implies that the
  10824.  .Startup directive in a tiny model program can be readily replaced
  10825.  with an ORG 100h instruction. This is not true. The .Startup directive
  10826.  does more than just generate an ORG 100h in the tiny memory model. If
  10827.  you try to replace .Startup with ORG 100h, you get the following error
  10828.  during the link phase:
  10829.  
  10830.     LINK : fatal error L2051: start address not equal to 0x100 for /TINY
  10831.  
  10832.  In all memory models, the .Startup directive generates necessary
  10833.  start-up code for the given memory model and stack type. It also
  10834.  initializes DS, SS, and SP, as necessary.
  10835.  
  10836.  Be sure to use .Exit as well as .Startup to avoid other errors.
  10837.  
  10838.  
  10839.  13. QuickC Hangs When Running .COM if "SET LINK=/CO"
  10840.  
  10841.  Product Version(s): 2.01
  10842.  Operating System:   MS-DOS
  10843.  Flags: ENDUSER | buglist2.01 S_QuickC
  10844.  Last Modified: 10-OCT-1989    ArticleIdent: Q47233
  10845.  
  10846.  The QuickC (QC) Version 2.01 environment hangs if you perform the
  10847.  following steps:
  10848.  
  10849.  1. Set the link environment variable at the DOS prompt with the /CO
  10850.     option (i.e., "d:\> set link=/CO").
  10851.  
  10852.  2. Enter the QuickAssembler (QA) environment with an assembly file in
  10853.     .COM format.
  10854.  
  10855.  3. Assemble and link the source code.
  10856.  
  10857.  4. Run the program in the environment; at this point you're now hung.
  10858.  
  10859.     Run this program at the DOS prompt, and the program executes
  10860.     properly without hanging.
  10861.  
  10862.  To resolve this problem, you must remove the link environment variable,
  10863.  delete the .COM file, and then reassemble/link the assembly source.
  10864.  
  10865.  Microsoft has confirmed this to be a problem with Version 2.01 of
  10866.  QuickC/QuickAssembler. We are researching this problem and will post
  10867.  new information as it becomes available.
  10868.  
  10869.  Note: It is not necessary to set the link environment variable
  10870.  with the /CO CodeView option since this facility is offered within
  10871.  the QuickC shell. This can be set by selecting the following:
  10872.  
  10873.     OPTIONS.Make.Linker Flags.CodeView Information
  10874.  
  10875.  The following source code demonstrates this problem:
  10876.  
  10877.  ;Program: HANG.COM
  10878.  ;Purpose: Demonstrates hanging problem in QuickC 2.01.
  10879.  .MODEL  TINY
  10880.  .DATA
  10881.  
  10882.  msg     DB      "Hello, world.", 13, 10, "$"
  10883.  
  10884.  .CODE
  10885.                  org 100h
  10886.  entry:                                       ; Program entry point
  10887.  HELLO proc near
  10888.                  nop
  10889.                  mov     ah, 9h               ; Request DOS Function 9
  10890.                  mov     dx, OFFSET msg       ; Load DX with offset of string
  10891.  
  10892.                  int     21h                  ; Display String
  10893.  
  10894.                  mov     ax, 4C00h
  10895.                  int     21h
  10896.  
  10897.  HELLO endp
  10898.  END entry
  10899.  
  10900.  The hang occurs before the first instruction is executed. QC switches
  10901.  to the output screen, displays the "HANG.COM" title, and hangs.
  10902.  
  10903.  The .COM file is polluted when you assemble with the link=/CO
  10904.  environment variable set from DOS. This can be demonstrated by the
  10905.  fact that if you hang your machine as noted above, reboot (without
  10906.  link=/CO env var), and then run HANG.COM from within QA (without
  10907.  reassembling), you again successfully hang your computer.
  10908.  
  10909.  
  10910.  14. QuickC and QuickAssembler Cannot Debug Code in Include Files
  10911.  
  10912.  Product Version(s): 2.01
  10913.  Operating System:   MS-DOS
  10914.  Flags: ENDUSER | docerr S_QuickC S_CodeView
  10915.  Last Modified: 10-OCT-1989    ArticleIdent: Q49067
  10916.  
  10917.  The QuickC and QuickAssembler environment debuggers do not allow the
  10918.  debugging of executable code in include files. The problem occurs when
  10919.  stepping through the program using the F8 key. When the debugger
  10920.  encounters the line containing the include statement, the debugger
  10921.  attempts to execute the code that is outside of the main module, with
  10922.  unpredictable results.
  10923.  
  10924.  The explanation of the include directive for assembly programs on Page
  10925.  240 of the Microsoft "QuickAssembler Programmer's Guide" is unclear.
  10926.  This explanation notes that "any standard code can be placed in an
  10927.  include file." However, it is not mentioned in this explanation that
  10928.  subsequent problems will arise when attempting to debug these
  10929.  routines.
  10930.  
  10931.  This problem is related to the way in which symbolic information is
  10932.  coded and is a known limitation of the QuickAssembler and QuickC
  10933.  debuggers, as well as the CodeView debugger.
  10934.  
  10935.  The solution to this problem is to include only macros, equates, and
  10936.  standard segment definitions in the include files when debugging.
  10937.  
  10938.  
  10939.  15. QuickAssembler Error Messages Are Not in Manuals
  10940.  
  10941.  Product Version(s): 2.01 2.51
  10942.  Operating System:   MS-DOS
  10943.  Flags: ENDUSER |
  10944.  Last Modified: 15-AUG-1990    ArticleIdent: Q61588
  10945.  
  10946.  Error messages for QuickAssembler versions 2.01 and 2.51 are available
  10947.  only through online help. The "Microsoft QuickAssembler Programmer's
  10948.  Guide" contains no error messages and the "Microsoft QuickC Toolkit"
  10949.  manual contains only QuickC compiler, command- line, run-time, LINK,
  10950.  LIB, NMAKE, and HELPMAKE errors.
  10951.  
  10952.  To obtain information on QuickAssembler errors, use the online help in
  10953.  the QuickC environment. The following are two different ways to do
  10954.  this:
  10955.  
  10956.  1. Type the error number in the environment and press the F1 key or
  10957.     press the right mouse button.
  10958.  
  10959.  2. After compiling, when error messages are viewable in the ERROR
  10960.     window, either place the cursor on the error number and press the
  10961.     F1 key or press the right mouse button.
  10962.  
  10963.  For example, if you want to obtain extra information on the Assembler
  10964.  error "A2009: Symbol not defined," type A2009 from within the QuickC
  10965.  environment and press the F1 key. A help window will pop up with
  10966.  information concerning the A2009 error.
  10967.  
  10968.  
  10969.  16. /Ta Switch Is Not Used By QuickC with QuickAssembler
  10970.  
  10971.  Product Version(s): 2.00 2.01 2.50 2.51
  10972.  Operating System:   MS-DOS
  10973.  Flags: ENDUSER | docerr buglist2.01 buglist2.51
  10974.  Last Modified: 14-DEC-1990    ArticleIdent: Q67511
  10975.  
  10976.  Page 100 of the Microsoft QuickC "Toolkit" manual states that the
  10977.  /Ta"filename" option is used to specify an assembly file to assemble,
  10978.  even if the file does not have a .ASM extension. It also states that
  10979.  the Microsoft Macro Assembler will be used to assemble the file. For
  10980.  the QuickC with QuickAssembler product, this is incorrect.
  10981.  
  10982.  The /Ta switch is used by QuickC version 2.00 and 2.50 to allow
  10983.  assembly files to be assembled by MASM. QuickC with QuickAssembler
  10984.  versions 2.01 and 2.51 ignore the switch. This causes a problem
  10985.  because the filename specified after the /Ta switch will be
  10986.  interpreted as an option, and the following error message will be
  10987.  generated:
  10988.  
  10989.     command line fatal error A1017: unknown option: file.ext
  10990.  
  10991.  The only workaround for this avoid the /Ta switch all together and
  10992.  specify all assembler files with the .ASM file extension.
  10993.  
  10994.  Microsoft has confirmed this to be a problem in QuickC with
  10995.  QuickAssembler versions 2.01 and 2.51. We are researching this problem
  10996.  and will post new information here as it becomes available.
  10997.  
  10998.  
  10999.  17. Use /Ln When Creating .COM Files from Command Line
  11000.  
  11001.  Product Version(s): 2.51
  11002.  Operating System:   MS-DOS
  11003.  Flags: ENDUSER | s_quickc docerr
  11004.  Last Modified:  6-FEB-1991    ArticleIdent: Q67756
  11005.  
  11006.  When using the command line version of QuickC with QuickAssembler
  11007.  version 2.51 to create a .COM file from a .ASM file, it is necessary
  11008.  to specify the /Ln switch to stop the C run time from being linked in.
  11009.  If the /Ln switch is not used, the run-time library CRTCOM.LIB is
  11010.  added to the link line and the following unresolved external error
  11011.  messages will be generated:
  11012.  
  11013.     _main
  11014.     __setargv
  11015.     __setenvp
  11016.     __nullcheck
  11017.     __fptrap
  11018.     __acrtmsg
  11019.  
  11020.  Page 383 of the "Programmer's Guide" for QuickC with QuickAssembler
  11021.  doesn't mention this in the example command line.
  11022.  
  11023.  
  11024.  18. PUBLIC Keyword Necessary in Most Multiple Modules Programs
  11025.  
  11026.  Product Version(s): 2.01
  11027.  Operating System:   MS-DOS
  11028.  Flags: ENDUSER | docerr
  11029.  Last Modified: 17-JUL-1990    ArticleIdent: Q50349
  11030.  
  11031.  According to Page 173 of the "QuickAssembler Programmer's Guide," a
  11032.  function must be declared PUBLIC in the case of full segment
  11033.  definitions, but is not needed when using simplified segments. This is
  11034.  only partially correct. Simplified segment directives must be used
  11035.  with a language declaration to resolve external symbols to avoid the
  11036.  need for the PUBLIC keyword. If a high level language is not
  11037.  specified, the PUBLIC keyword must be included on every symbol that
  11038.  will be accessed from another module.
  11039.  
  11040.  
  11041.  19. Formatted Listings Are Not Created in Environment
  11042.  
  11043.  Product Version(s): 2.01
  11044.  Operating System:   MS-DOS
  11045.  Flags: ENDUSER |
  11046.  Last Modified: 21-MAR-1990    ArticleIdent: Q51651
  11047.  
  11048.  Creating formatted listings to include page breaks and page headers is
  11049.  not possible within the Quick Assembler environment.
  11050.  
  11051.  It might appear that this could be done because within the Quick
  11052.  Assembler environment, you can choose to have a listing created and
  11053.  then view that listing after it has been created.
  11054.  
  11055.  It then follows that this listing would be of the same format as the
  11056.  one that can be created from the command line (using QCL). However,
  11057.  this is not the case. The listings that are created within the
  11058.  environment do not contain either page headers or page breaks.
  11059.  
  11060.  If you want to put page breaks in the document, a comment can
  11061.  be entered as follows:
  11062.  
  11063.     ; [ALT 12]
  11064.  
  11065.  This will put the formfeed character into the document and cause the
  11066.  listing to page forward when it is printed.
  11067.  
  11068.  
  11069.  20. QuickAssembler 2.01 Cannot Debug Code in INCLUDELIB Libraries
  11070.  
  11071.  Product Version(s): 2.01
  11072.  Operating System:   MS-DOS
  11073.  Flags: ENDUSER | buglist2.01
  11074.  Last Modified: 18-DEC-1989    ArticleIdent: Q50521
  11075.  
  11076.  Due to the INCLUDELIB directive, the QuickAssembler cannot debug
  11077.  source code in libraries that are linked in. When tracing into the
  11078.  library that is included with the directive, the debugger stops
  11079.  execution of the program and reassembles the source for the library
  11080.  routine. This is not the expected behavior of the assembler/debugger,
  11081.  but the following workarounds are quite simple.
  11082.  
  11083.  The first option is to debug the library routine before placing it in
  11084.  the library. To do this, include the file in the program list, which
  11085.  then links the object file instead of the library. In this form, the
  11086.  routine can be traced into and the code can be debugged. When the
  11087.  modules have been debugged, they can then be included in a library
  11088.  that is linked in by use of the INCLUDELIB directive. After the
  11089.  routines are included in the library, use the F10 key to step over the
  11090.  calls to routines in the library. This executes the routine without
  11091.  trying to display the source for it.
  11092.  
  11093.  Another workaround is to put the library in the program list instead
  11094.  of using INCLUDELIB. By including the library in the program list,
  11095.  QuickAssembler will debug source code that is in the library routine.
  11096.  Therefore, you can trace into the source code (even when it is
  11097.  included in a library) without problem. Use this option if you want to
  11098.  trace into any function in your program (meaning routines in both
  11099.  object modules and libraries.
  11100.  
  11101.  Microsoft has confirmed this to be a problem with QuickAssembler
  11102.  Version 2.01. We are researching this problem and will post new
  11103.  information as it becomes available.
  11104.  
  11105.  Below is a sample program (consisting of two files) that demonstrates
  11106.  the problem:
  11107.  
  11108.  ******** FILE 1 ********
  11109.  
  11110.  ;  HELLO.ASM
  11111.  ;
  11112.  ;  This is a simple hello world program that will use
  11113.  ;  both DOS display string and DOS Write functions.
  11114.  
  11115.  TITLE  HELLO
  11116.  DOSSEG
  11117.  ; Uncomment the following INCLUDELIB statement, then step through the
  11118.  ; CALL WRT line to step into the code for WRT. This will cause the
  11119.  ; problem.
  11120.  ;INCLUDELIB wrt.lib
  11121.  .MODEL SMALL
  11122.  .DATA
  11123.  MSG      DB   "Hello World",0Dh,0Ah,24h
  11124.  
  11125.  .STACK 800H
  11126.  
  11127.  .CODE
  11128.                  EXTRN WRT:PROC
  11129.  .STARTUP
  11130.                  PUSH  DX
  11131.                  PUSH  CX
  11132.                  PUSH  BX
  11133.  
  11134.                  MOV   AH, 09h           ; DOS DISPLAY STRING
  11135.                  MOV   DX, OFFSET MSG    ; ADDRESS OF STRING
  11136.                  INT   21h
  11137.  
  11138.                  CALL  WRT               ; MAKE THE WRITE CALL!
  11139.  
  11140.      XOR   AL,AL             ; SET UP RETURN CODE
  11141.  .EXIT
  11142.                  END
  11143.  
  11144.  ******** FILE 2 ********
  11145.  
  11146.  ; WRT.ASM
  11147.  ;
  11148.  ; Assemble this file and put it into a library called WRT.LIB. (This
  11149.  ; can be done by typing LIB WRT.LIB+WRT.OBJ; after you have assembled
  11150.  ; WRT.ASM.
  11151.  ;
  11152.  ; This file MUST be linked to the above program to avoid unresolved
  11153.  ; externals. Either link the .OBJ file or the .LIB file with a program
  11154.  ; list, OR uncomment the INCLUDELIB directive above.
  11155.  
  11156.  TITLE  WRT
  11157.  DOSSEG
  11158.  .MODEL SMALL
  11159.  .DATA
  11160.  MYNAME   DB   "John Smith",0Dh, 0Ah,24h
  11161.  LNAME    EQU  $-MYNAME-1
  11162.  
  11163.  .CODE
  11164.  PUBLIC WRT
  11165.  WRT   PROC
  11166.                  MOV   AH, 40h           ; DOS WRITE FUNCTION
  11167.                  MOV   BX, 01h           ; HANDLE FOR STDOUT
  11168.                  MOV   CX, LNAME         ; NUMBER OF CHARACTER TO WRITE
  11169.                  MOV   DX, OFFSET MYNAME ; OFFSET OF STRING TO PRINT
  11170.                  INT   21h
  11171.  
  11172.                  RET
  11173.  WRT   ENDP
  11174.                  END
  11175.  
  11176.  
  11177.  21. Generating .COM Files with QuickAssembler Can Cause Link Error
  11178.  
  11179.  Product Version(s): 2.01
  11180.  Operating System:   MS-DOS
  11181.  Flags: ENDUSER | docerr
  11182.  Last Modified: 17-JAN-1990    ArticleIdent: Q51751
  11183.  The QuickC Version 2.01 compiler (i.e., QuickAssembler) can and will
  11184.  generate .COM files for assembly language programs. Current support
  11185.  for the TINY model (.COM files) is not extended to C programs. Thus,
  11186.  the program must be in assembly language source code, not in C source
  11187.  code.
  11188.  
  11189.  Both the assembler and linker in QuickC 2.01 support the TINY memory
  11190.  model. The C module does not support the TINY memory model.
  11191.  
  11192.  The information contained in the README.DOC, Part 5, Subsection 386,
  11193.  states the following:
  11194.  
  11195.     "...the following command lines each produce a file with a .COM
  11196.      extension:
  11197.  
  11198.        QCL /AT sample.asm /link /TINY
  11199.        QCL /Fesample.com sample.asm /link /TINY  ..."
  11200.  
  11201.  The second command successfully generates a .COM file, but the first
  11202.  command generates the following error message:
  11203.  
  11204.     LINK: fatal error L1093: CRTCOM.OBJ: object not found
  11205.  
  11206.  Typing the following also generates the same error message:
  11207.  
  11208.     qcl /AT sample.asm
  11209.  
  11210.  The following are four ways to correctly generate a .COM file:
  11211.  
  11212.  1. Type the following as listed in the README.DOC.:
  11213.  
  11214.        QCL /Fesample.com sample.asm /link /TINY
  11215.  
  11216.  2. Type the following:
  11217.  
  11218.        qcl /AT /c sample.asm
  11219.  
  11220.     Then, type the following:
  11221.  
  11222.        link /TINY sample.obj
  11223.  
  11224.  3. Through the menu options in the environment, make the following
  11225.     selections:
  11226.  
  11227.        Options.Make.Linker_Flags.Global_Flags.Generate .COM file
  11228.  
  11229.     Note: Full menus must be activated and then Options.Make.
  11230.     Linker_Flags.Debug_Flags.Incremental_Link must be disabled.
  11231.  
  11232.  4. Type the following:
  11233.  
  11234.        QCL sample.asm /link /TINY
  11235.  
  11236.     This creates a sample.EXE file that is actually in the .COM format.
  11237.     It should be renamed immediately to SAMPLE.COM. This method is also
  11238.     correctly listed in the README.DOC.
  11239.  
  11240.  Note: The source code must also contain the ".MODEL tiny" directive
  11241.  for all of the above methods.
  11242.  
  11243.  Microsoft is researching this problem and will post new information
  11244.  here as it becomes available.
  11245.  
  11246.  
  11247.  22. A1022 Error If Include Environment Variable Is Not Set
  11248.  
  11249.  Product Version(s): 2.51
  11250.  Operating System:   MS-DOS
  11251.  Flags: ENDUSER | buglist2.51
  11252.  Last Modified: 11-MAY-1990    ArticleIdent: Q61790
  11253.  
  11254.  In QuickC with QuickAssembler version 2.51, when using QCL.EXE to
  11255.  compile assembly language programs, if the INCLUDE environment
  11256.  variable is not set, the following error is generated:
  11257.  
  11258.     command line fatal error A1022: source file name not specified
  11259.  
  11260.  This problem does not occur in the QuickC with QuickAssembler
  11261.  environment (QC.EXE) or with QuickC with QuickAssembler version 2.01.
  11262.  
  11263.  Microsoft has confirmed this to be a problem with QuickAssembler
  11264.  version 2.51. We are researching this problem and will post new
  11265.  information here as it becomes available.
  11266.  
  11267.  The following DOS commands reproduce the "A1022: source file name not
  11268.  specified" error:
  11269.  
  11270.     SET INCLUDE=
  11271.     QCL test.asm
  11272.  
  11273.  To compile programs successfully, set the INCLUDE environment variable
  11274.  to the QuickC with QuickAssembler INCLUDE directory; for example, SET
  11275.  INCLUDE=D:\QCQA\INCLUDE.
  11276.  
  11277.  
  11278.  23. QuickAssembler Does Not Support 64K Data Segments
  11279.  
  11280.  Product Version(s): 2.01
  11281.  Operating System:   MS-DOS
  11282.  Flags: ENDUSER  | buglist2.01
  11283.  Last Modified: 17-JAN-1990    ArticleIdent: Q51977
  11284.  
  11285.  When attempting to create a data segment that is equal to 65536 bytes,
  11286.  QuickAssembler (QA) will generate an object file that does not link.
  11287.  After assembling a program with 65536 bytes of data, the error L1103
  11288.  is generated at link time. This problem occurs with any of the linkers
  11289.  provided with Microsoft QuickC with QuickAssembler. The Microsoft
  11290.  Macro Assembler produces a valid object module under similar
  11291.  conditions.
  11292.  
  11293.  The following is sample code:
  11294.  
  11295.  ; DATA.ASM
  11296.  ; To see the problem, uncomment the second declaration and compile
  11297.  ; using the QCL DATA.ASM
  11298.  
  11299.         .model small
  11300.         .data
  11301.  ok     db 65535 dup(?)
  11302.  ; bad  db ?
  11303.    end
  11304.  
  11305.  The problem lies in the size of data segment the QuickAssembler
  11306.  generates. Using the Microsoft Macro Assembler, the segment size
  11307.  requested in the object module is 10000 for a 64K segment. This same
  11308.  64K segment is given length 0 (zero) (rounded at 16-bits) by the
  11309.  QuickAssembler.
  11310.  
  11311.  Microsoft has confirmed this to be a problem in Version 2.01. We are
  11312.  researching this problem and will post new information here as it
  11313.  becomes available.
  11314.  
  11315.  
  11316.  24. Manual Set Up for QuickAssembler on 3.5-Inch, 720K Floppies
  11317.  
  11318.  Product Version(s): 2.01
  11319.  Operating System:   MS-DOS
  11320.  Flags: ENDUSER |
  11321.  Last Modified: 17-JAN-1990    ArticleIdent: Q52200
  11322.  
  11323.  The following information describes how to set up Microsoft QuickC
  11324.  with QuickAssembler Version 2.01 on a 3.5-inch 720K disk.
  11325.  
  11326.  Since the QuickC with QuickAssembler Setup program requires a hard
  11327.  drive to work properly, this information describes how to manually set
  11328.  up QuickC with QuickAssembler on 3.5-inch 720K floppy disks.
  11329.  
  11330.  Disk 1: Integrated Environment
  11331.  ------------------------------
  11332.  
  11333.     File                     Source Disk
  11334.     ----                     -----------
  11335.  
  11336.     QC.EXE                   Integrated Development Environment
  11337.     QCC.OVL                  QuickAssembler 2
  11338.     QAS.OVL                  Integrated Development Environment
  11339.     QCC.DAT                  Utilities/Microsoft Quick Advisor
  11340.     C1.ERR                   Integrated Development Environment
  11341.     LINK.EXE                 Utilities/Microsoft Quick Advisor
  11342.     ILINK.EXE                Utilities/Microsoft Quick Advisor
  11343.     ILINKSTB.OVL             Utilities/Microsoft Quick Advisor
  11344.  
  11345.  Disk 2: Command Line Compiler
  11346.  -----------------------------
  11347.  
  11348.     File                     Source Disk
  11349.     ----                     -----------
  11350.  
  11351.     QCL.EXE                  Command-Line Compiler/Libraries 1
  11352.     QCL.HLP                  Command-Line Compiler/Libraries 1
  11353.     QCENV.HLP                QuickAssembler 2
  11354.     QCCOM.EXE                Command-Line Compiler/Libraries 1
  11355.     C1.ERR                   Integrated Development Environment
  11356.     LINK.EXE                 Utilities/Microsoft Quick Advisor
  11357.     ILINK.EXE                Utilities/Microsoft Quick Advisor
  11358.     ILINKSTB.OVL             Utilities/Microsoft Quick Advisor
  11359.  
  11360.  Disk 3: QuickC Help Files
  11361.  -------------------------
  11362.  
  11363.     File                     Source Disk
  11364.     ----                     -----------
  11365.  
  11366.     CL.HLP                   Command-Line Compiler/Libraries 1
  11367.     ERRORS.HLP               Utilities/Microsoft Quick Advisor
  11368.     GRAPHICS.HLP             Command-Line Compiler/Libraries 1
  11369.     NOTES.HLP                Libraries 2/Fonts
  11370.     QC.HLP                   Utilities/Microsoft Quick Advisor
  11371.     README.DOC               Setup and Learning the Integrated Environment
  11372.  
  11373.  Disk 4: QuickAssembler Help Files
  11374.  ---------------------------------
  11375.  
  11376.     File                     Source Disk
  11377.     ----                     -----------
  11378.  
  11379.     CL.HLP                   Command-Line Compiler/Libraries 1
  11380.     ERRORS.HLP               Utilities/Microsoft Quick Advisor
  11381.     GRAPHICS.HLP             Command-Line Compiler/Libraries 1
  11382.     NOTES.HLP                Libraries 2/Fonts
  11383.     QA.HLP                   QuickAssembler 2
  11384.     README.DOC               Setup and Learning the Integrated Environment
  11385.  
  11386.  Disk 5: Libraries and Include Files
  11387.  -----------------------------------
  11388.  
  11389.  Copy the following files onto this disk:
  11390.  
  11391.     *   xLIBC.LIB           ("x" can be S, M, C, or L)
  11392.     *   xLIBFP.LIB          ("x" can be S, M, C, or L)
  11393.     *   EM.LIB or           (For emulator library)
  11394.     *   87.LIB              (For 80x87 Library)
  11395.     *   LIBH.LIB
  11396.         GRAPHICS.LIB        (Optional)
  11397.         PGCHART.LIB         (Optional)
  11398.         LIB.EXE
  11399.  
  11400.  Note: The libraries with an "*" next to them are the component
  11401.  libraries that must be in the build library. GRAPHICS.LIB and
  11402.  PGCHART.LIB are optional libraries and do not need to be in the
  11403.  combined library.
  11404.  
  11405.  The following is an example of how to build a small memory model
  11406.  emulator library with graphics and pgchart libraries included:
  11407.  
  11408.     >LIB SLIBCE.LIB
  11409.  
  11410.     Microsoft (R) Library Manager  Version 3.14
  11411.     Copyright (C) Microsoft Corp 1983-1989.  All rights reserved
  11412.  
  11413.     Library does not exist.  Create? (y/n) y
  11414.     Operations:+SLIBC.LIB +SLIBFP.LIB +EM.LIB +LIBH.LIB&
  11415.     Operations:+GRAPHICS.LIB +PGCHART.LIB
  11416.     List file:<PRESS RETURN>
  11417.  
  11418.  The environment variable settings corresponding to this set up are as
  11419.  follows:
  11420.  
  11421.     SET PATH=A:\;B:\
  11422.     SET LIB=B:\
  11423.     SET INCLUDE=B:\INCLUDE
  11424.     SET TMP=B:\
  11425.  
  11426.  Start QuickC with Integrated Environment in Drive A and the Help disk
  11427.  for either QuickC or QuickAssembler in Drive B. It is necessary to swap
  11428.  the Help disk with the Libraries and Include Files disk during compile
  11429.  and link time.
  11430.  
  11431.  To compile from the command line, insert the Command Line Compiler
  11432.  Disk into Drive A and the Libraries and Include Files in Drive B.
  11433.  
  11434.  Note: A similar procedure may be followed for manually setting up
  11435.  QuickC with QuickAssembler Fulfillment Kit on 3.5-inch disks, except that
  11436.  the libraries do not need to be built. The existing libraries from
  11437.  QuickC 2.00 can be used for QuickC with QuickAssembler Version 2.01.
  11438.  
  11439.  
  11440.  25. JMP Back More Than 128 Bytes Not Flagged
  11441.  
  11442.  Product Version(s): 2.01
  11443.  Operating System:   MS-DOS
  11444.  Flags: ENDUSER | s_quickc buglist2.01
  11445.  Last Modified: 12-FEB-1990    ArticleIdent: Q57484
  11446.  
  11447.  The QuickC/QuickAssembler compiler Version 2.01 does not flag an
  11448.  attempt to make a short jump backwards further than 128 bytes when one
  11449.  pass assembly is enabled. The compiler produces an object file, but it
  11450.  is erroneous. If incremental linking is enabled, the file will not
  11451.  link properly and the following error message will be returned:
  11452.  
  11453.     SOURCE.OBJ (source.asm) : error L2002:  Fixup overflow at 1 in segment
  11454.     _TEXT : pos: 175 record type: 9C
  11455.  
  11456.  If standard linking is enabled, the file will link, but the program
  11457.  will not run properly.
  11458.  
  11459.  One pass assembly is enabled by default, both inside and outside the
  11460.  environment. Two pass assembly can be enabled by toggling the "One
  11461.  Pass Assembly" switch inside the environment. It can also be enabled
  11462.  by using the undocumented /P2 switch outside the environment. Two pass
  11463.  assembly catches the error and produces the desired message.
  11464.  
  11465.  Microsoft has confirmed this to be a problem in QuickC Version 2.01.
  11466.  We are researching this problem and will post new information here as
  11467.  it becomes available.
  11468.  
  11469.  The following source code assembles without errors with one pass
  11470.  enabled but should generate an error on a short backward jump of
  11471.  further than 128 bytes.
  11472.  
  11473.            .model small
  11474.  
  11475.            .code
  11476.  
  11477.  start:    mov ax, DGROUP
  11478.            mov ds, ax
  11479.            xor cx, cx
  11480.  
  11481.  back:     inc cx
  11482.            cmp cx, 2
  11483.            jmp done
  11484.  
  11485.            xor ax,ax       ; You need 60 or so of these pups.
  11486.            xor ax,ax
  11487.            .
  11488.            .
  11489.            .
  11490.            xor ax,ax
  11491.            xor ax,ax
  11492.  
  11493.            jmp short back
  11494.  
  11495.  done:     mov ax, 4c00h
  11496.            int 21h
  11497.  
  11498.            end start
  11499.  
  11500.  
  11501.  26. How to Get Sample Programs in QuickAssembler 2.51
  11502.  
  11503.  Product Version(s): 2.51
  11504.  Operating System:   MS-DOS
  11505.  Flags: ENDUSER |
  11506.  Last Modified: 11-JUL-1990    ArticleIdent: Q63703
  11507.  
  11508.  Question:
  11509.  
  11510.  Why do I get a beep when I try to select a sample assembly program
  11511.  under QuickAssembler version 2.51?
  11512.  
  11513.  Response:
  11514.  
  11515.  For all sample programs that are not listed in uppercase, you must
  11516.  place your cursor on the filename and click the right mouse button. If
  11517.  a mouse is not available, use the TAB key to get the the topic and
  11518.  then press F1.
  11519.  
  11520.  Note: Programs listed in uppercase are programs that have their own
  11521.  help contexts. Therefore, they can be selected by clicking on the left
  11522.  mouse button, or by pressing ENTER after placing the cursor on the
  11523.  filename. Programs listed in lowercase are accessed via the hyperlink,
  11524.  meaning you MUST select the right mouse button.
  11525.  
  11526.  
  11527.  27. QuickAssembler Doesn't Generate Debug Information
  11528.  
  11529.  Product Version(s): 2.51
  11530.  Operating System:   MS-DOS
  11531.  Flags: ENDUSER | buglist2.51
  11532.  Last Modified: 12-NOV-1990    ArticleIdent: Q64441
  11533.  
  11534.  The Microsoft QuickAssembler that comes with Microsoft QuickC version
  11535.  2.51 does not generate debug information if assembled from the command
  11536.  line (either with QCL or NMAKE).
  11537.  
  11538.  If the file is assembled inside the integrated environment, the debug
  11539.  information is generated.
  11540.  
  11541.  Microsoft has confirmed this to be a problem with version 2.51. We are
  11542.  researching this problem and will post new information here as it
  11543.  becomes available.
  11544.  
  11545.  
  11546.  28. Screen Output Fails When Using Animate with Assembly Files
  11547.  
  11548.  Product Version(s): 2.51
  11549.  Operating System:   MS-DOS
  11550.  Flags: ENDUSER | buglist2.51
  11551.  Last Modified: 17-OCT-1990    ArticleIdent: Q65591
  11552.  
  11553.  While debugging an assembler program under Microsoft QuickAssembler
  11554.  version 2.51, if Animate is selected from the Run menu, the code below
  11555.  will not print anything to the output screen if Screen Swap is set to
  11556.  On in the Options Run/Debug menu.
  11557.  
  11558.  Sample Code
  11559.  -----------
  11560.  
  11561.          TITLE   HELLO
  11562.          .MODEL  small, c
  11563.          DOSSEG
  11564.  
  11565.          .STACK  100h
  11566.  
  11567.          .DATA
  11568.  msg     DB      "Hello, world.", 13, 10, "$"
  11569.  
  11570.          .CODE
  11571.          .STARTUP
  11572.  
  11573.          mov     ah, 9h
  11574.          mov     dx, OFFSET msg
  11575.  
  11576.          int     21h
  11577.  
  11578.          .EXIT   0
  11579.  
  11580.          END
  11581.  
  11582.  The following are three valid workarounds:
  11583.  
  11584.  1. In the Run menu, disable Animate.
  11585.  
  11586.  2. Make sure Screen Swap is set to On, and then trace (F8) or Step
  11587.     (F10) through the program instead.
  11588.  
  11589.  Microsoft has confirmed this to be a problem with QuickAssembler
  11590.  version 2.51. We are researching this problem and will post new
  11591.  information here as it becomes available.
  11592.  
  11593.  
  11594.  29. Error L2029 with Unresolved Externals in CRTCOM.LIB
  11595.  
  11596.  Product Version(s): 2.51
  11597.  Operating System:   MS-DOS
  11598.  Flags: ENDUSER |
  11599.  Last Modified: 31-JAN-1991    ArticleIdent: Q68689
  11600.  
  11601.  If you are attempting to build a .COM file from a .ASM file and you
  11602.  get the following unresolved external references on the link step, you
  11603.  may have included CRTCOM.LIB in error:
  11604.  
  11605.     _main            __NMSG_WRITE
  11606.     __FF_MSGBANNER   __nullcheck
  11607.     __setenvp        __fptrap
  11608.     __setargv        __acrtmsg
  11609.  
  11610.  This file is automatically included on the link line if the link
  11611.  options are set to generate a .COM file from a .C file. To change this,
  11612.  choose Make from the Options menu, choose the Linker Flags menu, and
  11613.  change "Generate .COM file" to ASM.
  11614.  
  11615.  
  11616.  
  11617.  
  11618.  
  11619.  
  11620.  Microsoft Programmer's Work Bench [Development Environment]
  11621.  =============================================================================
  11622.  
  11623.  
  11624.  1. Using the Features of PWB to Build a Program with Overlays
  11625.  
  11626.  Product Version(s): 1.00   | 1.00
  11627.  Operating System:   MS-DOS | OS/2
  11628.  Flags: ENDUSER |
  11629.  Last Modified: 18-APR-1990    ArticleIdent: Q60050
  11630.  
  11631.  A MAKE file built with PWB can be modified (within reason) with the
  11632.  user supplied information section. This section, coded as
  11633.  
  11634.     # << User_supplied_information >>
  11635.  
  11636.  can contain other instructions that PWB (actually NMAKE or NMK) is
  11637.  supposed to carry out during the MAKE cycle. All instructions that
  11638.  follow this "fence" are not changed by PWB.
  11639.  
  11640.  The following instructions detail two implementations of that "fence"
  11641.  to allow PWB to build a program that uses overlays.
  11642.  
  11643.  While the following steps appear tedious, they are simple in practice.
  11644.  
  11645.  Once the changes are made, the only time you need to edit the MAKE
  11646.  file directly is to change your overlay structure, or to add or delete
  11647.  modules. When adding or deleting modules, you must both edit the
  11648.  program list with Make.Edit Program List and modify the commands in
  11649.  the user section. If you are only modifying the overlay structure, you
  11650.  change just the user section.
  11651.  
  11652.  The overlay structure in the example is as follows:
  11653.  
  11654.     HELLO.OBJ  (root)
  11655.         |
  11656.         +----A.OBJ (first  overlay)
  11657.         |
  11658.         +----B.OBJ (second overlay)
  11659.  
  11660.  All of the .OBJs are built from .C files with the same base name.
  11661.  
  11662.  1. Use PWB to build the program list in the normal way. This step is
  11663.     the same for any new program list.
  11664.  
  11665.     a. Start PWB.
  11666.  
  11667.     b. Choose Make.Set Program List and specify a new name -- HELLO.MAK
  11668.        in this example.
  11669.  
  11670.     c. Add HELLO.C, A.C, and B.C to the list. (If you have additional
  11671.        .C or .OBJ files, you would add them as well.) When all the
  11672.        files are listed, select Set Dependencies.
  11673.  
  11674.     d. Choose Options.Build Options and click on the Set Initial
  11675.        Build Options button and select DOS EXE.
  11676.  
  11677.     e. From Options.Compile Options, select the proper memory model.
  11678.  
  11679.     f. From Options.Link Options.Set Debug Options, turn off
  11680.        Incremental Link.
  11681.  
  11682.     g. From the Options.Browse Options dialog box, turn Generate Browse
  11683.        Information on.
  11684.  
  11685.     h. Choose Make.Rebuild All to make sure that the program builds
  11686.        properly without overlays. If it doesn't, review your work in
  11687.        previous steps.
  11688.  
  11689.  2. Now that you have a working program list, add the non-PWB
  11690.     information to the end.
  11691.  
  11692.     a. Choose Make.Clear Program List so that you can edit the MAKE
  11693.        file. Attempting to edit the current program list results in the
  11694.        message "No-edit file may not be modified."
  11695.  
  11696.     b. Choose File.Open to open the MAKE file so you can modify it.
  11697.  
  11698.     c. Go to the end of the file and start a blank line.
  11699.  
  11700.        Starting in column 1, add the following line:
  11701.  
  11702.           # << User_supplied_information >>
  11703.  
  11704.        Be sure to enter the line exactly as shown -- spacing is
  11705.        significant. This line is a "fence". Everything below the fence
  11706.        is yours and is not modified by PWB. Conversely, you should not
  11707.        modify anything above the fence because that section belongs to PWB.
  11708.  
  11709.     d. Below the fence starting in column one, add the pseudo-target:
  11710.  
  11711.           OVERLAID : $(OBJS)
  11712.  
  11713.        Be sure it starts column 1. Do not put a blank line after this line.
  11714.  
  11715.     e. Copy the command section from the $(PROJ).EXE description block
  11716.        to immediately follow the pseudo-target. The command section begins
  11717.        on the line following the line that reads
  11718.  
  11719.           $(PROJ).exe : $(OBJS)
  11720.  
  11721.        and ends at the next blank line. Do not copy the $(PROJ).EXE
  11722.        line, and do not leave a blank after the target. After you have
  11723.        copied the commands, your file should appear as follows:
  11724.  
  11725.           ... PWB section here, unmodified ...
  11726.  
  11727.           # << User_supplied_information >>
  11728.  
  11729.           OVERLAID : $(OBJS)
  11730.           !IF $(DEBUG)                    # copy of commands...
  11731.                   $(LRF) @<<$(PROJ).lrf
  11732.           $(RT_OBJS: = +^
  11733.           ) $(OBJS: = +^
  11734.           )
  11735.           $@
  11736.           ...
  11737.  
  11738.     f. Use the following procedure to modify the commands to link an
  11739.        overlaid EXE instead of a normal EXE.
  11740.  
  11741.        Note: There are two subsections in this section: a debug section
  11742.        that starts at the first "!IF $(DEBUG)" and ends at "!ELSE", and
  11743.        a release section that starts after the "!ELSE" and ends at the
  11744.        first "!ENDIF".
  11745.  
  11746.        You need to make the following modifications to both
  11747.        subsections.
  11748.  
  11749.        i. Delete the line that reads as follows:
  11750.  
  11751.              ) $(OBJS: = +^
  11752.  
  11753.           After the right parenthesis on the line that moved up, put
  11754.           your list of .OBJ files with parentheses to indicate which
  11755.           ones go in which overlays. If you need to use more than one
  11756.           line for all of your objects, be sure to put a plus sign (+)
  11757.           at the end of each line except the last.
  11758.  
  11759.       ii. Replace "$@" on the next line with "$(PROJ).EXE".
  11760.  
  11761.           In our example,
  11762.  
  11763.                  $(LRF) @<<$(PROJ).lrf
  11764.              $(RT_OBJS: = +^
  11765.              ) $(OBJS: = +^     # delete this line
  11766.              )                  # append OBJ list here ...
  11767.              $@                 # replace this line with $(PROJ).EXE
  11768.  
  11769.           becomes:
  11770.  
  11771.                  $(LRF) @<<$(PROJ).lrf
  11772.              $(RT_OBJS: = +^
  11773.              ) hello.obj +
  11774.              (a.obj) +
  11775.              (b.obj)
  11776.              $(PROJ).exe
  11777.  
  11778.           Remember to make the changes in both branches of the !IF
  11779.           $(DEBUG).
  11780.  
  11781.     g. The last step is to modify the browser database build commands.
  11782.        These are the two lines at the very end of the file that begin
  11783.        with "$(NMAKEBSC...". PWB adds and deletes these lines in the
  11784.        PWB section as you turn browser information on and off.
  11785.  
  11786.        Since PWB won't delete and add these lines in the user section,
  11787.        enclose them in !IF $(BROWSE)...!ENDIF so they'll be executed
  11788.        only when you ask for browse information. You also need to
  11789.        delete the "$(NMFLAGS)" macro from the second line to prevent
  11790.        infinite NMAKE recursion.
  11791.  
  11792.        The following lines
  11793.  
  11794.           $(NMAKEBSC1) MAKEFLAGS=
  11795.           $(NMAKEBSC2) $(NMFLAGS) -f $(PROJFILE) $(PROJ).bsc
  11796.  
  11797.        become:
  11798.  
  11799.           !IF $(BROWSE)
  11800.               $(NMAKEBSC1) MAKEFLAGS=
  11801.               $(NMAKEBSC2) -f $(PROJFILE) $(PROJ).bsc
  11802.           !ENDIF
  11803.  
  11804.        If you need special NMAKE options for building the browser
  11805.        database, just add them where you removed $(NMFLAGS).
  11806.  
  11807.  3. Reactivate the MAKE file by selecting Make.Set Program List.
  11808.  
  11809.  4. With these changes, if you select Make.Rebuild All, you will still
  11810.     get a non-overlaid program because PWB normally builds the first
  11811.     target in the MAKE file. To build the overlaid program, modify the
  11812.     command line passed to NMAKE so that NMAKE builds your overlay
  11813.     target rather than the regular EXE. Select Options.NMAKE Options
  11814.     and specify "OVERLAID" as the target by putting it in the NMAKE
  11815.     options box, or use Make.Build Target.
  11816.  
  11817.  5. With "OVERLAID" in Options.NMAKE Options you can build your program
  11818.     by either selecting Make.Rebuild All or Make.Build *.EXE, as usual.
  11819.     If you want to build a non-overlaid program, delete "OVERLAID" from
  11820.     the NMAKE options box.
  11821.  
  11822.     Note that if you use debug options with overlays you will get a
  11823.     linker warning L4047. This warning, and the dialog box that says
  11824.     that CRT0DAT.ASM can't be found, are normal when building overlaid
  11825.     programs for debugging and can be ignored. You can debug the overlaid
  11826.     program normally, with full debugging information available.
  11827.  
  11828.     This MAKE file behaves almost identically to a regular PWB MAKE
  11829.     file. The only differences are that NMAKE options are NOT  passed
  11830.     to the browser build unless you add them to the browser build line,
  11831.     and that you must edit the user supplied section if you add or
  11832.     delete modules from the project.
  11833.  
  11834.  
  11835.  2.
  11836.  
  11837.  Product Version(s): 1.00   | 1.00
  11838.  Operating System:   MS-DOS | OS/2
  11839.  Flags: ENDUSER | buglist1.00 fixlist1.10 s_c
  11840.  Last Modified:  5-FEB-1991    ArticleIdent: Q60392
  11841.  
  11842.  TOOLS.PRE is a sample Programmer's WorkBench (PWB) initialization file
  11843.  that is installed (and modified) when C 6.00 is installed by running
  11844.  the Setup program. On pages 19 and 20 of "Microsoft C: Installing and
  11845.  Using the Professional Development System," it states that the
  11846.  contents of TOOLS.PRE can be merged with an existing TOOLS.INI file,
  11847.  if one exists, or it can be renamed to TOOLS.INI, if there isn't one.
  11848.  To work correctly, you must make sure that the contents of this file
  11849.  are preceded by a PWB tag (for example, [PWB]) because the supplied
  11850.  TOOLS.PRE lacks this tag.
  11851.  
  11852.  When merging the PWB 1.00 TOOLS.PRE file into an existing TOOLS.INI
  11853.  file, a [PWB] tag should be added just above the area where the file
  11854.  is merged. For example:
  11855.  
  11856.  [PWB]
  11857.    .
  11858.    .
  11859.    .
  11860.    (TOOLS.PRE contents)
  11861.    .
  11862.    .
  11863.    .
  11864.  
  11865.  [NEXT-TAG]
  11866.  
  11867.  If TOOLS.PRE is being renamed to TOOLS.INI, the tag should be added as
  11868.  the first line in the file. In either case, failure to add the tag
  11869.  will result in PWB ignoring the initialization information.
  11870.  
  11871.  Microsoft has confirmed this to be a problem in PWB version 1.00. This
  11872.  problem was corrected in PWB version 1.10.
  11873.  
  11874.  
  11875.  3. How to Abort Compilation When Using PWB
  11876.  
  11877.  Product Version(s): 1.00   | 1.00
  11878.  Operating System:   MS-DOS | OS/2
  11879.  Flags: ENDUSER | s_c
  11880.  Last Modified: 17-JUL-1990    ArticleIdent: Q60500
  11881.  
  11882.  Question:
  11883.  
  11884.  How do I abort a compile that is in progress when using the
  11885.  Programmer's WorkBench (PWB) environment?
  11886.  
  11887.  Response:
  11888.  
  11889.  Under MS-DOS (or the OS/2 3.x compatibility box), use CTRL+C to abort.
  11890.  
  11891.  Under OS/2, use "Arg Meta Compile" to abort a compilation taking place
  11892.  in the background.
  11893.  
  11894.  The default keystrokes for Arg Meta Compile are ALT+A F9 CTRL+F3.
  11895.  
  11896.  You can also create a macro and assign it to a key to abort the
  11897.  compile process. Below is a sample macro that you could place in your
  11898.  TOOLS.INI file under the [pwb] tag.
  11899.  
  11900.     [pwb]
  11901.     Abort:=Arg Meta Compile
  11902.     Abort:Ctrl+F5
  11903.  
  11904.  Note: In either OS/2 or MS-DOS, the ESC key and CTRL+BREAK do not
  11905.  abort a compilation.
  11906.  
  11907.  
  11908.  4. PWB Makefiles Are Read-Only When Set as Active Program List
  11909.  
  11910.  Product Version(s): 1.00   | 1.00
  11911.  Operating System:   MS-DOS | OS/2
  11912.  Flags: ENDUSER |
  11913.  Last Modified: 25-MAY-1990    ArticleIdent: Q60749
  11914.  
  11915.  When you choose the Make.Set Program List option within the
  11916.  Programmer's WorkBench (PWB) environment to set a program list for the
  11917.  current project, the makefile associated with the current program list
  11918.  is marked as read-only and is not editable.
  11919.  
  11920.  Code Example
  11921.  ------------
  11922.  
  11923.  // FOO.C
  11924.  
  11925.  #include <stdio.h>
  11926.  void main ( void )
  11927.  {
  11928.     printf ( "Foobar\n" ) ;
  11929.  }
  11930.  
  11931.  1. Using the above sample program, choose the Make.Set Program List
  11932.     menu options and call the program list FOO.MAK.
  11933.  
  11934.  2. Save the list.
  11935.  
  11936.  3. Choose the File.Open menu, and enter FOO.MAK as the file you want
  11937.     to open.
  11938.  
  11939.  4. Place your cursor anywhere in the file and press ENTER. You will be
  11940.     greeted with the following a pop-up message:
  11941.  
  11942.        No-edit file may not be modified.
  11943.  
  11944.  If you want to edit the makefile, choose the Make.Clear Program List
  11945.  options, and you can edit the makefile as you want.
  11946.  
  11947.  
  11948.  5. Why Zero-Length .SBR Files Are Left on the Disk by the PWB
  11949.  
  11950.  Product Version(s): 1.00   | 1.00
  11951.  Operating System:   MS-DOS | OS/2
  11952.  Flags: ENDUSER |
  11953.  Last Modified: 16-JAN-1991    ArticleIdent: Q61056
  11954.  
  11955.  When using the Source Browser functionality within the Programmer's
  11956.  WorkBench, you can expect to have zero-length .SBR files on your disk.
  11957.  This is by design of the PWBRMAKE utility.
  11958.  
  11959.  PWBRMAKE.EXE is a utility that converts the .SBR files created by the
  11960.  compiler for each program module into a single database file that can
  11961.  be read by the Programmer's WorkBench (PWB) Source Browser. The
  11962.  resulting Source Browser database file has the extension .BSC.
  11963.  
  11964.  When a Source Browser database (a .BSC file) is built from .SBR files,
  11965.  the .SBR files are truncated to zero length to save disk space since
  11966.  they can be quite large. .SBR files are truncated to zero length,
  11967.  rather than being deleted, because PWBRMAKE performs incremental
  11968.  updates to the database and, therefore, needs the time and date stamp
  11969.  from the files.
  11970.  
  11971.  When you rebuild part of your project, new .SBR files are built for
  11972.  those modules. Each .SBR file that has not been re-created during a
  11973.  build is included as a zero-length file. This tells PWBRMAKE that the
  11974.  file has no new contribution to make to the database, so no update of
  11975.  that part of the database is required.
  11976.  
  11977.  
  11978.  6. Do Not Start Programmer's WorkBench by Typing PWBED
  11979.  
  11980.  Product Version(s): 1.00
  11981.  Operating System:   MS-DOS
  11982.  Flags: ENDUSER |
  11983.  Last Modified: 11-JUL-1990    ArticleIdent: Q61307
  11984.  
  11985.  You cannot start the Programmer's WorkBench by typing PWBED. This is
  11986.  incorrect. Type PWB to start the Programmer's WorkBench environment.
  11987.  
  11988.  In the REAL MODE directory specified during setup, there will be two
  11989.  executables for the PWB, PWB.COM and PWBED.EXE. PWB.COM actually
  11990.  spawns PWBED.EXE. If you use PWBED to start the PWB, it will consume
  11991.  approximately 500K of memory. By executing a DOS SHELL from within the
  11992.  PWB and running CHKDSK, you will notice there is very little memory
  11993.  left.
  11994.  
  11995.  When you invoke the PWB the correct way (by typing PWB), then shell-
  11996.  out and do a CHKDSK, you will see that the PWB has only consumed
  11997.  approximately 8K of available memory.
  11998.  
  11999.  The PWB appears to work correctly if you invoke it with PWBED.
  12000.  However, since it is using so much memory, you will receive memory
  12001.  problems, such as "out of memory," "cannot compile," or "cannot
  12002.  build." These are caused because there is not enough memory to spawn
  12003.  either NMAKE, the compiler, or the linker.
  12004.  
  12005.  
  12006.  7. Steps Needed to Make Source Browser Usable
  12007.  
  12008.  Product Version(s): 1.00    | 1.00
  12009.  Operating System:   MS-DOS  | OS/2
  12010.  Flags: ENDUSER |
  12011.  Last Modified: 11-JUL-1990    ArticleIdent: Q61309
  12012.  
  12013.  Before using the Browse menu options, you must first define and build
  12014.  the database the Source Browser will use. If this database is not
  12015.  already built, all options on the Browse menu will be grayed out and
  12016.  unusable.
  12017.  
  12018.  The following steps must be taken to define a database that is usable
  12019.  by the Source Browser menu options:
  12020.  
  12021.  1. Generate a program list using the Set Program List command in the
  12022.     Make menu. The PWB creates one internally if you do not specify one
  12023.     and the program only uses one source file. If a program is larger
  12024.     than one source file and a program list is not set, it is
  12025.     impossible to generate a Source Browser database.
  12026.  
  12027.  2. Choose Browse Options from the Options menu. You must select the
  12028.     Generate Browse Information field in the dialog box to create the
  12029.     Source Browser database.
  12030.  
  12031.  3. Build your program using the Make Menu option. You MUST have a
  12032.     successful build (compile AND link) of the program for a Source
  12033.     Browser database to be generated.
  12034.  
  12035.  The Browse Menu options should now be available for use.
  12036.  
  12037.  If, after taking the steps outlined above, the Browse Menu options
  12038.  are still unavailable for use, query on the following keywords:
  12039.  
  12040.     Browse and Options and Unavailable and Strange and Circumstances
  12041.  For printed documentation explaining the setup and use of the Source
  12042.  Browser, see Pages 50-52 of "Installing and Using the Professional
  12043.  Development System." You can also find information about the Source
  12044.  Browser in the online help under Programmer's WorkBench, Using the PWB
  12045.  Source Browser.
  12046.  
  12047.  
  12048.  8. SYS2070 Issued When Executing PWB.EXE for the First Time
  12049.  
  12050.  Product Version(s): 1.00
  12051.  Operating System:   OS/2
  12052.  Flags: ENDUSER |
  12053.  Last Modified: 13-JUN-1990    ArticleIdent: Q61572
  12054.  
  12055.  When running the Programmer's WorkBench (PWB) for the first time, the
  12056.  following OS/2 system error may be issued:
  12057.  
  12058.     Session Title:
  12059.     PWBED.EXE
  12060.  
  12061.     SYS2070: The system could not demand load the
  12062.     application's segment. MSHELP HELPSHRINK is in error.
  12063.     For additional detailed information also see message SYS0127
  12064.  
  12065.  This system error is caused by the PWB's use of a version of
  12066.  MSHELP.DLL that is not as current as the one that was shipped with C
  12067.  version 6.00. For the PWB to function correctly, the correct version
  12068.  of MSHELP.DLL must be in the LIBPATH.
  12069.  
  12070.  The README.DOC on the C version 6.00 Setup/Compiler 1 Disk warns of
  12071.  this potential problem, and suggests that QuickHelp (QH) be terminated
  12072.  as a background keyboard monitor before Setup is run.
  12073.  
  12074.  This problem is usually caused as a result of the Setup program not
  12075.  being able to copy its version of MSHELP.DLL over the old version of
  12076.  MSHELP.DLL. If another process (most likely a detached session of
  12077.  QH.EXE) was accessing this file during the execution of Setup, the
  12078.  Setup program will issue a message similar to the following:
  12079.  
  12080.     ERROR: Could not create file C:\OS2\DLL\mshelp.dll
  12081.     ERROR: File copy failed: A:\the PWB\mshelp.dll to C:\OS2\dll\mshelp.dll
  12082.  
  12083.  To solve this problem, take the following steps:
  12084.  
  12085.  1. Disable QH as a keyboard monitor:
  12086.  
  12087.     a. Press ALT+Q (to invoke QH).
  12088.  
  12089.     b. Press O (for the Options menu).
  12090.  
  12091.     c. Press T (to Terminate the monitor).
  12092.  
  12093.  2. Copy the up-to-date version of MSHELP.DLL from the distribution
  12094.     disk:
  12095.  
  12096.     a. Insert the Setup/Compiler 1 Disk into Drive A.
  12097.  
  12098.     b. Change the default Drive A.
  12099.  
  12100.     c. Run Setup with the /copy option by typing the following:
  12101.  
  12102.           setup /copy
  12103.  
  12104.     d. Press ENTER
  12105.  
  12106.     e. Press ENTER again (unless the setup files are in a drive other
  12107.        than A).
  12108.  
  12109.     f. At the prompt asking for the name of the file to copy, type
  12110.        MSHELP.DLL and press ENTER.
  12111.  
  12112.     g. At the prompt asking for the name of the directory to which to
  12113.        copy this file, type the directory in which the old MSHELP.DLL
  12114.        is located (most likely C:\OS2\DLL).
  12115.  
  12116.     h. Setup should then ask for the Programmer's WorkBench/Utilities
  12117.        for OS/2 Disk to be inserted into the setup drive.
  12118.  
  12119.     i. When Setup is finished copying the file, press ENTER at the
  12120.        next prompt.
  12121.  
  12122.  The PWB should now start up correctly.
  12123.  
  12124.  
  12125.  9. U1355 Bad Command or File Name
  12126.  
  12127.  Product Version(s): 1.00   | 1.00
  12128.  Operating System:   MS-DOS | OS/2
  12129.  Flags: ENDUSER | docerr filename
  12130.  Last Modified: 27-SEP-1990    ArticleIdent: Q61607
  12131.  
  12132.  The following undocumented error may occur when attempting to run an
  12133.  executable file such as CL.EXE, LINK.EXE, NMAKE.EXE, etc., from inside
  12134.  the Programmer's WorkBench (PWB).
  12135.  
  12136.     U1355 Bad Command or File Name
  12137.  
  12138.  The error occurs because the directory containing the .EXE file is not
  12139.  specified in the search path or an incorrect LINK.EXE is being
  12140.  executed.
  12141.  
  12142.  This problem can be corrected by adding the missing directory name(s)
  12143.  to the path in the AUTOEXEC.BAT or STARTUP.CMD and rebooting, or
  12144.  executing NEW-VARS.BAT or NEW-VARS.CMD. If an incorrect linker is the
  12145.  problem, the search path can be rearranged to find the new version of
  12146.  the linker first, or the old linkers can be deleted or renamed.
  12147.  Finally, it may be necessary to delete the CURRENT.STS and PROG.STS
  12148.  files before the PWB will work correctly. This error is not documented
  12149.  in the PWB online help.
  12150.  
  12151.  
  12152.  10. Saving Compiler Results File in the PWB
  12153.  
  12154.  Product Version(s): 1.00   | 1.00
  12155.  Operating System:   MS-DOS | OS/2
  12156.  Flags: ENDUSER |
  12157.  Last Modified: 25-MAY-1990    ArticleIdent: Q61636
  12158.  
  12159.  The Programmer's WorkBench (PWB) deletes the compiler results file
  12160.  upon exiting the PWB. In DOS or OS/2, the file can be saved if the
  12161.  compiler results window is made current and the File.Save As menu
  12162.  option is selected.
  12163.  
  12164.  The compiler results file will appear similar to the following:
  12165.  
  12166.     +++ PWB  [E:\] Rebuild
  12167.             NMAKE  /z /a /f E:\pwb.mak
  12168.          cl /c /W4 /Fm /Ot /FoGLOBL.obj GLOBL.C
  12169.     Microsoft (R) C Optimizing Compiler Version 6.00
  12170.     Copyright (c) Microsoft Corp 1984-1990. All rights reserved.
  12171.  
  12172.     GLOBL.C
  12173.          echo @GLOBL.lrf > NUL
  12174.          link @GLOBL.lrf
  12175.  
  12176.     Microsoft (R) Segmented-Executable Linker  Version 5.10
  12177.     Copyright (C) Microsoft Corp 1984-1990.  All rights
  12178.     reserved.
  12179.  
  12180.     Object Modules [.OBJ]: GLOBL.obj,GLOBL.exe,NUL, /NOD:SLIBCE
  12181.     SLIBCEP , /NOI /BATCH /EXE /FAR /PACKC;
  12182.  
  12183.  
  12184.  11. Programmer's WorkBench Edit Switch Is Unimplemented
  12185.  
  12186.  Product Version(s): 1.00   | 1.00
  12187.  Operating System:   MS-DOS | OS/2
  12188.  Flags: ENDUSER | docerr
  12189.  Last Modified: 14-MAY-1990    ArticleIdent: Q61642
  12190.  
  12191.  The edit switch for the Programmer's WorkBench (PWB), documented on
  12192.  Page 79 of the version 6.00 "Microsoft C Reference" manual, is
  12193.  unimplemented in PWB version 1.00. The switch is designed to set the
  12194.  active file as read-only so that it cannot be edited.
  12195.  
  12196.  If you add an option in your TOOLS.INI file under the PWB tag to read
  12197.  either
  12198.  
  12199.     Edit:yes
  12200.     Edit:no
  12201.  
  12202.  PWB will return an error message saying "Edit is not an editor
  12203.  switch."
  12204.  
  12205.  As a workaround, invoke PWB with the /r option to open up the current
  12206.  file as read-only.
  12207.  
  12208.  
  12209.  12. Certain Key Sequences Cause R6003 or SYS1943 in PWB 1.00
  12210.  
  12211.  Product Version(s): 1.00   | 1.00
  12212.  Operating System:   MS-DOS | OS/2
  12213.  Flags: ENDUSER | buglist1.00 fixlist1.10
  12214.  Last Modified:  4-FEB-1991    ArticleIdent: Q61660
  12215.  
  12216.  In the Programmer's Workbench (PWB) version 1.00, it has been observed
  12217.  that certain unusual editing sequences can cause the following errors:
  12218.  
  12219.  In DOS:
  12220.  
  12221.     Run-time error R6003 - integer divide by 0
  12222.  
  12223.  In OS/2:
  12224.  
  12225.     SYS1943 protection violation, trap number 13
  12226.  
  12227.  The following sequences reproduce the errors:
  12228.  
  12229.     Procedure                             Keystrokes
  12230.     ---------                             ----------
  12231.  
  12232.  1. Bring up several files.               ALT+F O x3
  12233.     Select the Options menu.              ALT+O
  12234.     Select Linker options.                L
  12235.     Select Set Debug Options.             ALT+G
  12236.     Pull up help on the options.          F1
  12237.     Arg-refresh through several files.    ALT+A SHIFT+F7 x3
  12238.     Escape back to the Editor screen.     ESC x3
  12239.  
  12240.  2. Select the Options menu.              ALT+O
  12241.     Select Editor Settings.               S (or K)
  12242.     Go down thirteen lines.               DOWN ARROW key x13
  12243.     Backspace.                            BACKSPACE
  12244.     Undo.                                 ALT+BACKSPACE
  12245.  
  12246.  Note: Step 2 reproduces only the R6003 error in DOS, not the SYS1943
  12247.  error.
  12248.  
  12249.  
  12250.  13. PWB 1.00 Requires Decimal Value for Stack Size in LINK Options
  12251.  
  12252.  Product Version(s): 1.00    | 1.00
  12253.  Operating System:   MS-DOS  | OS/2
  12254.  Flags: ENDUSER | buglist1.00 fixlist1.10
  12255.  Last Modified:  5-FEB-1991    ArticleIdent: Q61871
  12256.  
  12257.  In the Programmer's WorkBench (PWB) version 1.00, there is a problem
  12258.  with changing a program's stack size in some situations. When
  12259.  specifying the stack size in the Link Options dialog box (from the
  12260.  Options menu), you must enter the value in the form of a decimal
  12261.  integer. Although the Help menu tells you this field accepts positive
  12262.  integers in octal and hexadecimal form, PWB 1.00 will not accept them.
  12263.  
  12264.  When an octal or hexadecimal value is entered in the stack-size field,
  12265.  any digits specified as A-F are discarded and replaced by 0 (zero). If
  12266.  digits precede a letter, the digits are retained and the letters are
  12267.  discarded.
  12268.  
  12269.  Microsoft has confirmed this to be a problem in PWB version 1.00. This
  12270.  problem was corrected in PWB version 1.10.
  12271.  
  12272.  
  12273.  14. SYS0002 Produced If MSHELP.DLL Not Installed
  12274.  
  12275.  Product Version(s): 1.00
  12276.  Operating System:   OS/2
  12277.  Flags: ENDUSER | pwbhelp
  12278.  Last Modified: 23-JAN-1991    ArticleIdent: Q61955
  12279.  
  12280.  Under OS/2, if MSHELP.DLL is not installed correctly or is not on the
  12281.  LIBPATH, the following error may appear in a window when starting the
  12282.  Programmer's WorkBench (PWB):
  12283.  
  12284.                      Cannot Autoload Extension
  12285.                      e:\c600\binp\pwbhelp.pxt
  12286.  MSHELP:  SYS0002:  The system cannot find the file specified
  12287.  
  12288.                          < OK >   < Help >
  12289.  
  12290.  Make sure that the latest version of MSHELP.DLL (the one that was
  12291.  included with the Microsoft C Compiler version 6.00) is installed in a
  12292.  directory contained in your LIBPATH.
  12293.  
  12294.  If this file was not copied off the disks during setup, you can
  12295.  execute the following command with your Setup disk in Drive A:
  12296.  
  12297.     a:setup /copy
  12298.  
  12299.  Specify the file MSHELP.DLL at the prompt, then specify the
  12300.  destination directory.
  12301.  
  12302.  The default for SETUP.EXE is to put OS/2 DLLs in the C:\OS2\DLL
  12303.  directory. If you choose to install the DLLs in some other directory,
  12304.  you must edit the LIBPATH in your CONFIG.SYS file and restart the
  12305.  system.
  12306.  
  12307.  
  12308.  15. Enabling of Source Browser Menu Related to .BSC and .MAK Files
  12309.  
  12310.  Product Version(s): 1.00   | 1.00
  12311.  Operating System:   MS-DOS | OS/2
  12312.  Flags: ENDUSER |
  12313.  Last Modified: 29-MAY-1990    ArticleIdent: Q61968
  12314.  
  12315.  The Source Browser feature of the Programmer's WorkBench (PWB) is
  12316.  enabled or disabled depending upon the existence of a database file
  12317.  (.BSC file) AND a program list (.MAK file). The existence of a .BSC
  12318.  database file alone does not guarantee that the Browse menu will be
  12319.  enabled for all modules in a project, even if the .BSC file was built
  12320.  from .SBR files for every module. The setting of a program list is
  12321.  also required.
  12322.  
  12323.  Thus, if a .BSC file is built outside of the PWB with PWBRMAKE, then
  12324.  upon entering the PWB, the Browser will be enabled for only one module
  12325.  at most (see below). The easiest method to enable the Browse menu for
  12326.  ALL modules is to select "Set program list" on the Make menu, then
  12327.  type in the base name of the .BSC file (with the .MAK or no extension)
  12328.  when it prompts you for the filename. If the .MAK file you enter does
  12329.  not exist, then the dialog box appears for adding files to the program
  12330.  list, whereas you can just select "Save List" without actually adding
  12331.  any files. At this point, the Browser menu will be enabled for all
  12332.  files you bring up into the PWB editor.
  12333.  
  12334.  The existence of a Source Browser database file means that the Browse
  12335.  menu will be enabled for a source file with a matching base name of
  12336.  the .BSC file.
  12337.  
  12338.  For example, assume a project consists of several modules, with the
  12339.  main source module called PROJECT.C. In addition, assume a Browser
  12340.  database file called PROJECT.BSC is built from the .SBR Browser
  12341.  information files produced by the compiler for every module in this
  12342.  project. If the file PROJECT.C is brought up in the PWB, the Browse
  12343.  menu will be enabled because the base name (PROJECT) is the same as
  12344.  the base name of the database file PROJECT.BSC.
  12345.  
  12346.  On the other hand, if any of the other source files in the project are
  12347.  opened in the PWB, the Browse menu will be disabled because the base
  12348.  names do not match the base name of the database file. Also, if
  12349.  PROJECT.C is made the current file (which enables the Browse menu) and
  12350.  an option is selected on the browse Menu, such as "Goto Reference"
  12351.  (which causes a jump to a different module), the Browse menu will
  12352.  become disabled. The only way to re-enable the Browse menu in this
  12353.  case is to make PROJECT.C the current file again.
  12354.  
  12355.  The way to enable the Browse menu for all modules is to set a program
  12356.  list to a file with the .MAK extension and the same base name as the
  12357.  .BSC file. Thus, in the example above, setting the program list to
  12358.  PROJECT.MAK will enable the Browse menu for all modules. In fact, this
  12359.  connection between the .BSC file and the .MAK file enables the Browse
  12360.  menu for the modules in the current project, and for ANY file opened
  12361.  under the PWB.
  12362.  
  12363.  The result is that if you bring up a file in the editor that is
  12364.  completely unrelated to the current project (and may not even have a
  12365.  related .BSC file), you can still use the Browse menu options.
  12366.  However, in this situation, the information available from the Browser
  12367.  still only pertains to the original project.
  12368.  
  12369.  In summary, the .MAK file and .BSC file relationship is based solely
  12370.  on the file existence, NOT the file contents. The program list does
  12371.  NOT need to contain the names of the modules in the current project
  12372.  (or even be an actual makefile) for the Browser to function.
  12373.  
  12374.  
  12375.  16. Modifying TOOLS.INI May Have No Effect on PWB Environment
  12376.  
  12377.  Product Version(s): 1.00   | 1.00
  12378.  Operating System:   MS-DOS | OS/2
  12379.  Flags: ENDUSER |
  12380.  Last Modified: 17-JUL-1990    ArticleIdent: Q62170
  12381.  
  12382.  Changing settings in the TOOLS.INI file to modify the behavior of the
  12383.  Programmer's WorkBench (PWB) may not work under certain circumstances.
  12384.  For instance, if you decide to change the PWB to 50-line mode by
  12385.  setting "height:50" in the TOOLS.INI file, it will not work if the PWB
  12386.  was previously used in the 25- or 43-line mode.
  12387.  
  12388.  This is because some environment information is also recorded in the
  12389.  CURRENT.STS file, which is read in after the TOOLS.INI file --
  12390.  overriding the TOOLS.INI settings.
  12391.  
  12392.  The following are three workarounds for this problem:
  12393.  
  12394.  1. Use the /DS switch when invoking the PWB. This will ignore the
  12395.     CURRENT.STS file. However, this option also causes the current file
  12396.     history (of files being edited) to be ignored.
  12397.  
  12398.  2. Delete the CURRENT.STS file. This also causes the current list of
  12399.     programs being edited to be ignored.
  12400.  
  12401.  3. The better option is to select Editor Settings from the Options
  12402.     menu. When the list of editor switch settings appears, it can be
  12403.     changed and saved to the TOOLS.INI file by pressing SHIFT+F2. This
  12404.     will save the settings and cause the selection to take effect.
  12405.  
  12406.  
  12407.  17. Reversing Mouse Buttons in the PWB Cannot Be Done
  12408.  
  12409.  Product Version(s): 1.00   | 1.00
  12410.  Operating System:   MS-DOS | OS/2
  12411.  Flags: ENDUSER |
  12412.  Last Modified: 25-JUL-1990    ArticleIdent: Q62330
  12413.  
  12414.  Currently under the Programmer's WorkBench (PWB) released with version
  12415.  6.00 of the Microsoft C Optimizing Compiler, it is not possible to
  12416.  reverse the functionality of the mouse buttons.
  12417.  
  12418.  It is possible to change the functionality of the mouse buttons under
  12419.  OS/2 and DOS, but this will be overridden by the PWB environment.
  12420.  
  12421.  
  12422.  18. Attempting to Expand a Help Dialog Box Hangs DOS
  12423.  
  12424.  Product Version(s): 1.00   | 1.00
  12425.  Operating System:   MS-DOS | OS/2
  12426.  Flags: ENDUSER | buglist1.00
  12427.  Last Modified: 25-JUL-1990    ArticleIdent: Q62331
  12428.  
  12429.  When one of the pull-down menus in the Programmer's WorkBench (PWB)
  12430.  version 1.00 is selected (File, Edit, View, etc.) and then F1 is
  12431.  chosen for help on that menu, a small help screen appears. If CTRL+F10
  12432.  is chosen in an attempt to expand the window to full screen, the
  12433.  machine will hang under DOS. If the machine doesn't hang, it may
  12434.  require another invocation of CTRL+F10 to cause the problem.
  12435.  
  12436.  Under OS/2, the machine may not hang, but the PWB's functionality will
  12437.  be disrupted and attempts to free oneself may cause a GP fault. It may
  12438.  be possible to exit the PWB, but at the very least, the CURRENT.STS
  12439.  file will be corrupted so that future entrances to PWB will result in
  12440.  very odd window configurations.
  12441.  
  12442.  Microsoft has confirmed this to be a problem with the PWB version
  12443.  1.00. We are researching this problem and will post new information
  12444.  here as it becomes available.
  12445.  
  12446.  
  12447.  19. PWB Doesn't Update Mark Location If Mark Moves Up or Left
  12448.  
  12449.  Product Version(s): 1.00 | 1.00
  12450.  Operating System:   OS/2 | 1.00
  12451.  Flags: ENDUSER | buglist1.00
  12452.  Last Modified: 13-JUN-1990    ArticleIdent: Q62388
  12453.  
  12454.  If you set a mark in a file, and that location then moves upward or
  12455.  toward the left in the file, PWB does not reset the mark location;
  12456.  however, it does correctly update marks that move downward or to the
  12457.  right in the file.
  12458.  
  12459.  Consider the following file:
  12460.  
  12461.  /* Test.dat */
  12462.  test1
  12463.  
  12464.  test2
  12465.  
  12466.  test3
  12467.  
  12468.  Place the cursor on the "2" in test2. Choose the Search.Define Mark
  12469.  menu option. Name the mark "mark1" and press ENTER. Now, move the
  12470.  cursor to another location in the file. Choose the Search.Go To Mark
  12471.  option from the menus. Go to "mark1". Note that the cursor is back on
  12472.  the "2" in test2.
  12473.  
  12474.  Next, add another blank line between test1 and test2. Again, move your
  12475.  cursor and go to mark1. Note that the cursor is back on the "2" in
  12476.  test2.
  12477.  
  12478.  Now, delete both the lines between test1 and test2. Select the
  12479.  Search.Go To Mark option from the menus. Note that the cursor is on
  12480.  the same location as it was before you deleted these lines. The same
  12481.  behavior will happen if you delete any of the characters before the
  12482.  "2" in the test2 line.
  12483.  
  12484.  Microsoft has confirmed this to be a problem in the Programmer's
  12485.  WorkBench (PWB) version 1.00. We are researching this problem and will
  12486.  post new information here as it becomes available.
  12487.  
  12488.  
  12489.  20. PWB 1.00 "Set Dependencies" Fails with Spaces in #include Line
  12490.  
  12491.  Product Version(s): 1.00   | 1.00
  12492.  Operating System:   MS-DOS | OS/2
  12493.  Flags: ENDUSER | buglist1.00 fixlist1.10 s_c
  12494.  Last Modified:  5-FEB-1991    ArticleIdent: Q62578
  12495.  
  12496.  The Programmer's WorkBench (PWB) version 1.00 (shipped with C version
  12497.  6.00) includes a "Set Dependencies" option in the "Set Program List"
  12498.  window. This option automatically sets up build dependencies for all
  12499.  include files used in the current project. This option will fail with
  12500.  a message that the include file does not exist if there are embedded
  12501.  spaces between the left angle bracket (<) and the include-file name in
  12502.  an include directive line.
  12503.  
  12504.  The Set Dependencies option will work correctly if the space(s) are
  12505.  removed or if a new build option is added to the TOOLS.INI file.
  12506.  
  12507.  Although embedded spaces are legal in C programming syntax, the
  12508.  Programmer's WorkBench fails to parse the include line correctly if
  12509.  spaces exist before the filename. The following line of code shows the
  12510.  situation where the "Set Dependencies" error will occur:
  12511.  
  12512.     #include < stdio.h >
  12513.  
  12514.  The space before the "s" in stdio.h prevents PWB from finding the
  12515.  STDIO.H include file. (The trailing space after stdio.h does not
  12516.  affect the behavior of "Set Dependencies".)
  12517.  
  12518.  The full text of the error message window for the line above is as
  12519.  follows:
  12520.  
  12521.          stdio.h does not exist
  12522.     Cannot build its dependency tree.
  12523.     Abort dependency lists generation?
  12524.          <Yes>    <No>    <Help>
  12525.  
  12526.  Selecting <Help> displays a help screen that describes the problem as
  12527.  being either a mistyped filename or a nonexistent file, but the actual
  12528.  file DOES exist. Removing the embedded space will correct the problem.
  12529.  
  12530.  You can also add two new "build" lines to the TOOLS.INI file to make
  12531.  the PWB recognize include directives that contain spaces. These lines
  12532.  should be included under the section with the [PWB] tag, and should
  12533.  have the following syntax:
  12534.  
  12535.     build: include .c                                              \
  12536.         "^[ \t]*#[ \t]*include[ \t]*\"[ \t]*\\([^\"]+[ \t]*\\)\""  \
  12537.         case
  12538.     build: include .c                                              \
  12539.        "^[ \t]*#[ \t]*include[ \t]*<[ \t]*\\([^>]+\\)[ \t]*>"      \
  12540.         case system
  12541.  
  12542.  (Note: These build switch statements are broken down into multiple
  12543.  lines with the line continuation character (\) because of space
  12544.  limitations; you may enter each of them into the TOOLS.INI file on a
  12545.  single line, rather than multiple lines.)
  12546.  
  12547.  There is one drawback to this workaround; you will still get the error
  12548.  message shown above because the "old" build switch is applied before
  12549.  the new one. To have the new build switch take effect, you need to
  12550.  select "No" when prompted to abort the dependency list generation.
  12551.  Once you have selected "No" for each file with spaces in the include
  12552.  directive, the dependencies will then be generated correctly.
  12553.  
  12554.  Microsoft has confirmed this to be a problem in the Programmer's
  12555.  WorkBench version 1.00. This problem was corrected in the Programmer's
  12556.  WorkBench version 1.10.
  12557.  
  12558.  
  12559.  21. PWB 1.10 Dialog Boxes May Blink After Dialog Help Is Obtained
  12560.  
  12561.  Product Version(s): 1.10
  12562.  Operating System:   MS-DOS
  12563.  Flags: ENDUSER | buglist1.10 flicker
  12564.  Last Modified: 19-FEB-1991    ArticleIdent: Q69347
  12565.  
  12566.  When working with the Programmer's WorkBench (PWB) version 1.10 under
  12567.  DOS, there are several instances where a dialog box may start flashing
  12568.  incorrectly. This situation occurs when you obtain help on a PWB
  12569.  informational pop-up dialog box and then return from the Help dialog
  12570.  screen. At this point you may find that the original dialog box is
  12571.  rapidly blinking.
  12572.  
  12573.  This problem may occur when trying to get help on a topic for which
  12574.  there is no help, trying to use an unassigned key, or when PWB informs
  12575.  you that you changed a file but didn't save it before you tried to
  12576.  exit. In each of these cases, PWB gives you a pop-up dialog box
  12577.  informing you of the situation. If you get help on this informational
  12578.  dialog box and then press ESC or click Cancel, the original dialog box
  12579.  will start blinking.
  12580.  
  12581.  This is not normal behavior, however, PWB is still fully functional
  12582.  and you may proceed by selecting an appropriate choice from the
  12583.  flashing dialog box.
  12584.  
  12585.  Microsoft has confirmed this to be a problem in the Programmer's
  12586.  WorkBench version 1.10. We are researching this problem and will post
  12587.  new information here as it becomes available.
  12588.  
  12589.  
  12590.  22. R6000 Stack Overflow After Deleting Current Makefile
  12591.  
  12592.  Product Version(s): 1.00   | 1.00
  12593.  Operating System:   MS-DOS | OS/2
  12594.  Flags: ENDUSER |
  12595.  Last Modified: 25-JUL-1990    ArticleIdent: Q62668
  12596.  
  12597.  If you are viewing your makefile in a window in PWB 1.00, then delete
  12598.  the makefile from a shell; attempting to make the window containing
  12599.  the makefile active will cause a run-time error R6000, stack overflow.
  12600.  
  12601.  To duplicate this problem, bring up a sample program and set the
  12602.  program list to that file's makefile. Next, open up another window
  12603.  and open the makefile in that window. Now, either from the Run.Run
  12604.  <DOS-OS/2> Command menu or the File.<DOS-OS/2> Shell, delete that
  12605.  makefile.
  12606.  
  12607.  After returning back to the PWB, make the window containing the
  12608.  makefile the active program list either by pressing the F6 key to
  12609.  toggle windows or by clicking the left mouse button in that window.
  12610.  
  12611.  You will be faced with a popup message saying "File has been deleted
  12612.  from disk. Delete from memory?" Answering "yes" brings up the popup
  12613.  six to eight more times. Then, PWB will abort to the system prompt
  12614.  with an R6000 (stack overflow) error message and another message, "File
  12615.  has been deleted from disk."
  12616.  
  12617.  Microsoft has confirmed this to be a problem in PWB version 1.00. We
  12618.  are researching this problem and will post new information here as it
  12619.  becomes available.
  12620.  
  12621.  
  12622.  23. PWB 1.00 Extensions Only Return True Under DOS
  12623.  
  12624.  Product Version(s): 1.00
  12625.  Operating System:   MS-DOS
  12626.  Flags: ENDUSER | buglist1.00
  12627.  Last Modified: 15-AUG-1990    ArticleIdent: Q63052
  12628.  
  12629.  Extensions written for use by the Programmer's WorkBench (PWB) version
  12630.  1.00 under the DOS operating system are recognized as returning true
  12631.  regardless of their actual return values.
  12632.  
  12633.  The use of return values as a way of providing conditional jumps
  12634.  inside PWB macros is a common practice that is affected by the above
  12635.  limitation for PWB extensions. The following sample extension and
  12636.  macro demonstrate the above problem. Once installed, both the foo()
  12637.  and foo2() functions will be seen as returning true to PWB.
  12638.  
  12639.  Sample Code
  12640.  -----------
  12641.  
  12642.  // foo.c
  12643.  
  12644.  #include <string.h>
  12645.  #include <stdlib.h>
  12646.  #include <ext.h>
  12647.  
  12648.  PWBFUNC foo( unsigned argData, ARG far *pArg, flagType fMeta );
  12649.  PWBFUNC foo2( unsigned argData, ARG far *pArg, flagType fMeta);
  12650.  
  12651.  // Switches.
  12652.  struct swiDesc swiTable[] =
  12653.  {
  12654.     { NULL, NULL, 0 }
  12655.  };
  12656.  
  12657.  // Commands.
  12658.  struct cmdDesc cmdTable[] =
  12659.  {
  12660.     { "foo", foo, 0, NOARG },
  12661.     { "foo2",foo2,0, NOARG },
  12662.     { NULL, NULL, 0, 0 }
  12663.  };
  12664.  
  12665.  void EXTERNAL WhenLoaded()
  12666.  {
  12667.      SetKey( "foo",         "alt+f" );
  12668.      SetKey( "foo2",       "ctrl+f" );
  12669.      return;
  12670.  }
  12671.  
  12672.  PWBFUNC foo( unsigned argData, ARG far *pArg, flagType fMeta )
  12673.  {
  12674.   return(FALSE);  /* FALSE is defined as 0 in ext.h */
  12675.  }
  12676.  
  12677.  PWBFUNC foo2( unsigned argData, ARG far *pArg, flagType fMeta)
  12678.  {
  12679.   return(TRUE);   /* TRUE is defined as 1 in ext.h  */
  12680.  }
  12681.  
  12682.  // End of foo.c
  12683.  
  12684.  ; macros in tools.ini to test foo and foo2
  12685.  
  12686.  load foo
  12687.  
  12688.  test:=foo ->loc1 arg "true" message => :>loc1 arg "false" message
  12689.  test2:=foo2 ->loc2 arg "true" message => :>loc2 arg "false" message
  12690.  
  12691.  test:alt+t
  12692.  test2:ctrl+2
  12693.  
  12694.  Microsoft has confirmed this to be a problem with PWB version 1.00. We
  12695.  are researching this problem and will post new information here as it
  12696.  becomes available.
  12697.  
  12698.  
  12699.  24. PWB Text Highlight with Mouse Acts Strange After Search
  12700.  
  12701.  Product Version(s): 1.00   | 1.00
  12702.  Operating System:   MS-DOS | OS/2
  12703.  Flags: ENDUSER |
  12704.  Last Modified: 15-AUG-1990    ArticleIdent: Q63059
  12705.  
  12706.  The click-and-drag method of selecting text with the mouse in the
  12707.  Programmer's Workbench (PWB) sometimes works incorrectly when used
  12708.  after a search function.
  12709.  
  12710.  To reproduce this problem, do the following:
  12711.  
  12712.  1. Select a word in the text using the mouse (double-click on a single
  12713.     word).
  12714.  
  12715.  2. Execute the search function (select the Search menu, choose Find,
  12716.     then OK).
  12717.  
  12718.  3. Now try to highlight the text a few lines below the word you used
  12719.     to search on (using the click-and-drag method).
  12720.  
  12721.  The text will be highlighted starting at the original word that was
  12722.  searched for, rather than at the starting mouse position.
  12723.  
  12724.  To work around this problem, click the left button anywhere in the
  12725.  text window, then perform the text highlight.
  12726.  
  12727.  Microsoft has confirmed this to be a problem with the Programmer's
  12728.  Workbench version 1.00. We are researching this problem and will post
  12729.  new information here as it becomes available.
  12730.  
  12731.  
  12732.  25. PWB Does Not Return from DOS Shell with ";" in TMP
  12733.  
  12734.  Product Version(s): 1.00
  12735.  Operating System:   MS-DOS
  12736.  Flags: ENDUSER |
  12737.  Last Modified: 25-JUL-1990    ArticleIdent: Q62702
  12738.  
  12739.  If there is a semicolon ";" in your TMP environment variable, you may
  12740.  not be able to return to the Programmer's Workbench by typing "exit"
  12741.  after selecting "DOS Shell" from the File menu in PWB.
  12742.  
  12743.  Since the TMP environment variable is used to specify a single
  12744.  directory rather than a path, the semicolon character should not be
  12745.  used.
  12746.  
  12747.  To re-create this situation, type the following at the command line:
  12748.  
  12749.     set TMP=C:\TMP;
  12750.  
  12751.  Then select DOS Shell from within PWB. Typing "exit" on the DOS
  12752.  command line will not bring you back into PWB.
  12753.  
  12754.  To correct the problem, remove the semicolon from the end of the TMP
  12755.  environment variable.
  12756.  
  12757.  
  12758.  26. PWB BACKUP.BAK Does Not Create Backup of Source File Correctly
  12759.  
  12760.  Product Version(s): 1.00   | 1.00
  12761.  Operating System:   MS-DOS | OS/2
  12762.  Flags: ENDUSER| buglist1.00
  12763.  Last Modified: 24-JUL-1990    ArticleIdent: Q63234
  12764.  
  12765.  Version 1.00 of the Programmer's Workbench does not create a backup of
  12766.  your source file correctly if the PROJECT.MAK has the same base name
  12767.  as the SOURCE.C file. When you build or rebuild the project, the file
  12768.  saved as your backup is a copy of the CURRENT.STS file.
  12769.  
  12770.  A workaround to this problem is to name your PROJECT.MAK with a
  12771.  different base name than your SOURCE.C file. This will still save a
  12772.  copy of your CURRENT.STS file with the base name of the PROJECT.MAK.
  12773.  However, it will correctly save a backup of the SOURCE.C as
  12774.  SOURCE.BAK.
  12775.  
  12776.  Microsoft has confirmed this to be a problem in version 1.00 of the
  12777.  Programmer's Workbench and will post new information here as it
  12778.  becomes available.
  12779.  
  12780.  
  12781.  
  12782.  27. PWB menukey Switch Resets to ALT When Shelling Out to DOS
  12783.  
  12784.  Product Version(s): 1.00
  12785.  Operating System:   MS-DOS
  12786.  Flags: ENDUSER | buglist1.00
  12787.  Last Modified: 10-JUL-1990    ArticleIdent: Q63267
  12788.  
  12789.  If the "menukey" switch in the DOS version of the Programmer's
  12790.  Workbench (PWB) version 1.00 is set to anything other than ALT (which
  12791.  is the default), it will be redefined to the ALT key after shelling
  12792.  out to DOS. This means the menukey switch will lose its assignment
  12793.  anytime you choose Compile, Run Program, Debug Program, or DOS Shell.
  12794.  
  12795.  The menukey switch determines which keystroke activates the PWB main
  12796.  menu bar. The ALT key is normally used for this, but menukey can be
  12797.  redefined to any keystroke. For example, menukey is automatically
  12798.  defined to F9 if you select Brief Editor emulation when installing the
  12799.  Programmer's WorkBench.
  12800.  
  12801.  Whenever you invoke any function (such as Build) that goes out to DOS
  12802.  for execution and then returns, the menukey switch is reset to ALT, so
  12803.  that both ALT AND the user-defined keystroke invoke the menu.
  12804.  
  12805.  To work around this problem, you can use the Restart command to invoke
  12806.  a macro that redefines the menukey to the desired value each time you
  12807.  return from a DOS SHELL command, which will then keep ALT from
  12808.  activating the menu. For example, to make it so that F9 is always
  12809.  reset as the only menukey, put the following line in the PWB tagged
  12810.  section of the TOOLS.INI file:
  12811.  
  12812.     restart:= arg "menukey:F9" assign
  12813.  
  12814.  Since the Restart command, if it exists in TOOLS.INI, is invoked
  12815.  automatically when returning from a SHELL command, this guarantees
  12816.  that the key assignment will always remain consistent.
  12817.  
  12818.  Microsoft has confirmed that the automatic reactivation of ALT as the
  12819.  menukey is a problem with the Programmer's WorkBench version 1.00. We
  12820.  are researching this problem and will post new information here as it
  12821.  becomes available.
  12822.  
  12823.  
  12824.  28. PWB: Print Does Not Put CR/LF at EOL If Text Selected
  12825.  
  12826.  Product Version(s): 1.00   | 1.00
  12827.  Operating System:   MS-DOS | OS/2
  12828.  Flags: ENDUSER | buglist1.00
  12829.  Last Modified: 25-JUL-1990    ArticleIdent: Q63318
  12830.  
  12831.  Using the Programmer's Workbench version 1.00, when a region of text
  12832.  is selected and the Print function is invoked, the resulting output
  12833.  contains linefeed characters (0x0A) at the end of each line, rather
  12834.  than a carriage return/linefeed (<CR><LF>) combination (0x0D and
  12835.  0x0A).
  12836.  
  12837.  Some printer drivers do not recognize this as a valid end-of-line
  12838.  (EOL) character and do not print correctly.
  12839.  
  12840.  To reproduce this problem, open a file that contains the <CR><LF>
  12841.  combination at the end of each line. Highlight a region of text in the
  12842.  file and from the File menu choose Print. Tab to the second field and
  12843.  type in the following:
  12844.  
  12845.     copy %s test.txt
  12846.  
  12847.  This will copy the region of selected to the file TEST.TXT. Using a
  12848.  standard hex file viewer, you can see that the end of a line is
  12849.  denoted by a single 0A. If you look at the original file using the hex
  12850.  viewer, it will contain 0A 0D at the end of each line.
  12851.  
  12852.  The Programmer's Workbench will recognize this type of file (with a
  12853.  single 0A at each end of line) and display it correctly if you try to
  12854.  open it within the Workbench, but many printer drivers do not
  12855.  understand this type of file.
  12856.  The workaround for this problem is to write a program that translates
  12857.  each 0x0A found in the output file to the bytes 0x0D and 0x0A, or use
  12858.  a printer driver that understands this type of file. In fact, most
  12859.  printers have an escape sequence or dip switch to make it recognize
  12860.  this type of file.
  12861.  
  12862.  Microsoft has confirmed this to be a problem with the Programmer's
  12863.  Workbench version 1.00. We are researching this problem and will
  12864.  post new information here as it becomes available.
  12865.  
  12866.  
  12867.  29. Unknown Function psrch with Brief Emulation in PWB
  12868.  
  12869.  Product Version(s): 1.00   | 1.00
  12870.  Operating System:   MS-DOS | OS/2
  12871.  Flags: ENDUSER |
  12872.  Last Modified: 25-JUL-1990    ArticleIdent: Q63319
  12873.  
  12874.  When using the Brief emulation feature of the Programmer's WorkBench
  12875.  version 1.00, reinitialization of the TOOLS.INI file will cause a
  12876.  number of unknown functions to appear when you try to use them. In
  12877.  short, most of the unknown functions that may be reported are related
  12878.  to search features such as the psearch switch. The error message
  12879.  associated with this search feature is commonly "Unknown function
  12880.  psrch."
  12881.  
  12882.  This error occurs only after you use the Initialize function.
  12883.  
  12884.  The Initialize function discards current macro definitions and rereads
  12885.  the appropriate section of TOOLS.INI. This is not exactly the same as
  12886.  restarting PWB; the Autostart macro is not executed after Initialize.
  12887.  The BRIEF emulation depends on the Autostart macro to define the
  12888.  search functions.
  12889.  
  12890.  To recover the definition of the missing macros, execute the toggle_re
  12891.  BRIEF emulation macro (CTRL+F6). To avoid having to remember to
  12892.  execute this macro, you can add this to the main section of TOOLS.INI:
  12893.  
  12894.     reinit:=Initialize Autostart
  12895.     reinit:Shift+F8
  12896.  
  12897.  Or you can define the macros as follows:
  12898.  
  12899.     psrch:=arg arg "String to Search for" prompt ->can
  12900.                                             psearch => :>can cancel
  12901.     msrch:=arg arg "String to Search for" prompt ->can
  12902.                                             msearch => :>can cancel
  12903.     qrepl:=arg arg qreplace
  12904.     srchname:="REoff"
  12905.  
  12906.  
  12907.  30. Problems Viewing README.DOC Inside PWB Online Help and QH
  12908.  
  12909.  Product Version(s): 1.00
  12910.  Operating System:   MS-DOS
  12911.  Flags: ENDUSER  |
  12912.  Last Modified: 15-AUG-1990    ArticleIdent: Q63661
  12913.  
  12914.  Problems can occur when attempting to access the README.DOC from
  12915.  within the DOS versions of Programmer's WorkBench (PWB) or QH via the
  12916.  online help.
  12917.  
  12918.  When attempting to view the README.DOC file using the online help
  12919.  inside the DOS version of PWB, the messages "Error displaying help"
  12920.  and then "Cannot process cross reference" may be displayed in
  12921.  successive dialog boxes.
  12922.  
  12923.  When attempting to view the README.DOC file from within QH, the
  12924.  message "The database README.DOC is not open, or the topic is not
  12925.  found" may be displayed.
  12926.  
  12927.  Again, these problems are found only in the DOS version of PWB and QH.
  12928.  Access of the README.DOC in this manner does not produce errors under
  12929.  the OS/2 versions of PWB or QH.
  12930.  
  12931.  The following are two possible workarounds for the problem in PWB:
  12932.  
  12933.  1. The README.DOC can be loaded into the help system by typing the
  12934.     following
  12935.  
  12936.        arg "$PATH:readme.doc!" arg pwbhelp
  12937.  
  12938.     with default keys:
  12939.  
  12940.        Alt+A $PATH:readme.doc! F1
  12941.  
  12942.     Note that this method may fail if there is another file named
  12943.     README.DOC in the path before the C 6.00 README.DOC. If this is the
  12944.     case, the other README.DOC will be loaded instead of the C 6.00
  12945.     README.DOC. This method can also fail if there is not enough memory
  12946.     to load the file into the help system.
  12947.  
  12948.  2. If the previous method fails, the C 6.00 README.DOC can be loaded
  12949.     into PWB as a normal text file via the File.Open menu option. The
  12950.     README.DOC can be found in the C 6.00 bound executable directory
  12951.     (for example, C:\C600\BINB).
  12952.  
  12953.  The following are three possible workarounds for the problem in QH:
  12954.  
  12955.  1. Inside QH, select View.Search, type "$PATH:readme.doc!" and press
  12956.     ENTER. Again, this will bring up the first README.DOC on the path.
  12957.  
  12958.  2. You can also select File.Open and load the the file by giving the
  12959.     full path and filename of the C 6.00 README.DOC. QH allows you to
  12960.     open any text file under 64K in size.
  12961.  
  12962.  3. To enable direct access of the README.DOC from within QH via the
  12963.     README.DOC button, it is necessary to point the QH environment
  12964.     variable to the directory where the README.DOC is located. For
  12965.     example:
  12966.  
  12967.        set qh=c:\c600\binb\readme.doc
  12968.  
  12969.     The QH environment variable is not documented in the C 6.00 printed
  12970.     or online documentation.
  12971.  
  12972.  Microsoft is researching this problem and will post new information
  12973.  here as it becomes available.
  12974.  
  12975.  
  12976.  31. CTRL+NUM/ May be Read as CTRL+/ in DOS with NUM LOCK On
  12977.  
  12978.  Product Version(s): 1.00 1.10 | 1.00 1.10
  12979.  Operating System:   MS-DOS    | OS/2
  12980.  Flags: ENDUSER | buglist1.10
  12981.  Last Modified: 15-NOV-1990    ArticleIdent: Q66740
  12982.  
  12983.  In versions 1.00 and 1.10 of Programmer's WorkBench (PWB), the
  12984.  CTRL+NUM/ (CTRL+/ on the numeric keypad) and ALT+NUM/ (ALT+/ on the
  12985.  numeric keypad) combinations may be interpreted as CTRL+/ and ALT+/
  12986.  (on the main keyboard). This problem happens only in DOS or the OS/2
  12987.  DOS 3.x box, and only on certain computers. This behavior will cause
  12988.  any macro or function assigned to CTRL+NUM/ or ALT+NUM/ to not execute
  12989.  when NUM LOCK is on.
  12990.  
  12991.  To reproduce this problem, assign a function or macro to CTRL+NUM/.
  12992.  Then execute the TELL function (CTRL+T by default) and press CTRL+NUM/.
  12993.  The TELL function prompts for a keystroke, then displays the name of
  12994.  the keystroke and the function assigned to it. With NUM LOCK on, TELL
  12995.  will return the following:
  12996.  
  12997.     unassigned:Ctrl+/.
  12998.  
  12999.  With NUM LOCK off, TELL will return the following:
  13000.  
  13001.     <function name>:Ctrl+num/.
  13002.  
  13003.  This behavior is identical for the ALT+NUM/ key name, but works
  13004.  properly for all other key names on the numeric keypad.
  13005.  
  13006.  If NUM LOCK is off, or if the protected-mode version of PWB is run,
  13007.  this behavior does not occur.
  13008.  
  13009.  This behavior has been observed on the following machines:
  13010.  
  13011.     Northgate 386-33
  13012.     PS/2 Model 70
  13013.     PS/2 Model 80-311
  13014.  
  13015.  Microsoft has confirmed this to be a problem in PWB version 1.00 and
  13016.  1.10. We are researching this problem and will post new information
  13017.  here as it becomes available.
  13018.  
  13019.  
  13020.  32. PWB Command-Line Option /DP Is Documented But Not Implemented
  13021.  
  13022.  Product Version(s): 1.00   | 1.00
  13023.  Operating System:   MS-DOS | OS/2
  13024.  Flags: ENDUSER | docerr
  13025.  Last Modified: 27-JUL-1990    ArticleIdent: Q63951
  13026.  
  13027.  The /DP switch for the Programmer's WorkBench (PWB), documented on
  13028.  Page 49 of the version 6.00 "Microsoft C Reference," is not
  13029.  implemented in version 1.00 of the PWB. This switch is designed to
  13030.  ignore the most recent program list upon starting the PWB.
  13031.  
  13032.  The /DP switch is mentioned only in the "Microsoft C Reference" and
  13033.  not in the online help.
  13034.  
  13035.  Upon invocation, the Programmer's WorkBench version 1.00 does not
  13036.  automatically set the program list to the last program list used.
  13037.  Therefore, the /DP command-line switch was not implemented because it
  13038.  would have no purpose.
  13039.  
  13040.  With the PWB version 1.00, there is no way to have the last program
  13041.  list set automatically at startup.
  13042.  
  13043.  
  13044.  33. With the "deflang" Switch PWB Prompts for Setting Program List
  13045.  
  13046.  Product Version(s): 1.00   | 1.00
  13047.  Operating System:   MS-DOS | OS/2
  13048.  Flags: ENDUSER | docerr
  13049.  Last Modified:  3-AUG-1990    ArticleIdent: Q64353
  13050.  
  13051.  As documented on Page 79 of the "Microsoft C Reference" shipped with C
  13052.  version 6.00 and in the online help, the "deflang" switch in the
  13053.  Programmer's WorkBench (PWB) sets the default filename extension for
  13054.  list boxes in PWB dialog boxes. Another (undocumented) feature of this
  13055.  switch is to enable you to be prompted to "Set Program List?" when
  13056.  loading a source file with a .MAK file associated with it in the
  13057.  current directory.
  13058.  
  13059.  By default, "deflang" is not set. You can set the deflang switch in
  13060.  the [PWB] tagged section of the TOOLS.INI file, for example:
  13061.  
  13062.     deflang:C
  13063.  
  13064.  This changes the default filename extension in the PWB's dialog boxes
  13065.  (such as Open in the File menu) from "*.*" to "*.c", so that only
  13066.  files with the .c extension show up by default. Other languages can be
  13067.  specified as well, as shown below:
  13068.  
  13069.     Switch Setting     Extension
  13070.     --------------     ---------
  13071.  
  13072.     no value            .*
  13073.     C                   .c
  13074.     Asm                 .asm
  13075.     BASIC               .bas
  13076.     FORTRAN             .for
  13077.     Pascal              .pas
  13078.     COBOL               .cbl
  13079.     LISP                .lsp
  13080.  
  13081.  Note that the online documentation specifies "Assembler" as the switch
  13082.  to use for .ASM files, but this is incorrect. "Asm" is the correct
  13083.  switch to use to make Assembler the default language.
  13084.  
  13085.  The deflang switch also enables you to be prompted as to whether or
  13086.  not the program list should be set automatically. If you load a file
  13087.  that has the extension specified by the "deflang" switch and you also
  13088.  have a .MAK file with the same base filename in the same directory,
  13089.  the PWB will prompt you about loading the program list.
  13090.  
  13091.  For example, assume that deflang is set to C and FOO.MAK and FOO.C are
  13092.  in the same directory. If you type PWB FOO.C at the command-prompt,
  13093.  the PWB will pause when loading and prompt with "Set Program List?
  13094.  FOO.MAK". At this point you can specify <yes> or <no>.
  13095.  
  13096.  When already in the PWB, if you select Open from the File menu, and
  13097.  select FOO.C as the file to open, the PWB will also prompt you at this
  13098.  point regarding whether or not you want FOO.MAK loaded as the program
  13099.  list, but only if NO program list is currently set.
  13100.  
  13101.  
  13102.  34. Can't Resize a Window with a Macro in PWB
  13103.  
  13104.  Product Version(s): 1.00   | 1.00
  13105.  Operating System:   MS-DOS | OS/2
  13106.  Flags: ENDUSER |
  13107.  Last Modified: 30-AUG-1990    ArticleIdent: Q64433
  13108.  
  13109.  A window cannot be resized using the "resize" function in a macro.
  13110.  After Programmer's WorkBench (PWB) performs the resize function, it
  13111.  waits for the you to respond with the UP ARROW or DOWN ARROW key.
  13112.  Functions that are placed in the macro after the resize function are
  13113.  ignored. If "record on" is selected and you try to record the resizing
  13114.  of a window, the macro will stop recording until the ENTER key on the
  13115.  numeric keypad is pressed.
  13116.  
  13117.  The following is an example:
  13118.  
  13119.     resizeit:= cancel arg arg nextmsg window resize up up up NumEnter
  13120.  
  13121.  The above example stops at the resize function and waits for you to
  13122.  resize the window. The remaining functions are ignored.
  13123.  
  13124.  To make a window a specified size, move the cursor to a location on
  13125.  the screen and then open the window with the "window" function.
  13126.  
  13127.  The following is an example of a macro that opens the "<compile>"
  13128.  window with a specified size:
  13129.  
  13130.  compile_size:= up up up up up up up up up up
  13131.  resize_it:=cancel meta down compile_size arg window window arg \
  13132.             "<compile>" setfile window
  13133.  resize_it:ALT+U
  13134.  
  13135.  Note: The size of the compile window can be adjusted by changing the
  13136.  number of ups on the compile_size line.
  13137.  
  13138.  
  13139.  35. PWB Hangs When Run with Some Communication Programs Under OS/2
  13140.  
  13141.  Product Version(s): 1.00
  13142.  Operating System:   OS/2
  13143.  Flags: ENDUSER |
  13144.  Last Modified: 30-AUG-1990    ArticleIdent: Q64435
  13145.  
  13146.  When running Programmer's WorkBench (PWB) under OS/2 while
  13147.  simultaneously running communication programs, PWB will appear to
  13148.  hang. To correct the problem, terminate any communication programs and
  13149.  PWB will resume as normal.
  13150.  
  13151.  
  13152.  36. "Cannot Open File current.$" May Mean Incorrect INIT Variable
  13153.  
  13154.  Product Version(s): 1.00   | 1.00
  13155.  Operating System:   MS-DOS | OS/2
  13156.  Flags: ENDUSER |
  13157.  Last Modified: 17-DEC-1990    ArticleIdent: Q64566
  13158.  
  13159.  When using the Programmer's Workbench (PWB), the following message may
  13160.  appear as a pop-up dialog box when selecting Compile or DOS Shell (or
  13161.  OS/2 Shell for OS/2):
  13162.  
  13163.     +----- Cannot open file! -----+
  13164.     |   D:\TEST\SRC\X\current.$   |
  13165.     |  No such file or directory  |
  13166.     |-----------------------------|
  13167.     |      < OK >   < Help >      |
  13168.     +-----------------------------+
  13169.  
  13170.  One cause for this error is an incorrect setting of the INIT
  13171.  environment variable. To remedy the situation, exit PWB and make sure
  13172.  that the INIT environment variable is set to a valid directory name
  13173.  (for example, a directory that exists).
  13174.  
  13175.  To reproduce this message, set your INIT environment variable to an
  13176.  invalid directory, for instance (if a directory named X does not exist
  13177.  on your drive):
  13178.  
  13179.     SET INIT=X
  13180.  
  13181.  Then start PWB and try to compile a program. The message will appear
  13182.  in the middle of the screen.
  13183.  
  13184.  One possible reason why your INIT environment variable may be set
  13185.  incorrectly, even if your AUTOEXEC.BAT sets it correctly, is that you
  13186.  might have run out of environment space in the setting of the
  13187.  variable. You can refer to the "MS-DOS Encyclopedia," Article 2, for
  13188.  more information about increasing your environment space.
  13189.  
  13190.  
  13191.  37. How to Use the PWB with the Windows 3.00 SDK
  13192.  
  13193.  Product Version(s): 1.00   | 1.00
  13194.  Operating System:   MS-DOS | OS/2
  13195.  Flags: ENDUSER |
  13196.  Last Modified: 15-AUG-1990    ArticleIdent: Q64788
  13197.  
  13198.  Detailed step-by-step instructions on how to set up the Programmer's
  13199.  WorkBench (PWB) for use with the Windows version 3.00 Software
  13200.  Development Kit (SDK) can be found in a file provided with the SDK
  13201.  called PWBINFO.WRI.
  13202.  
  13203.  The file explains how to set PWB switches so that Windows applications
  13204.  can be built from within PWB. The file also explains how to access the
  13205.  SDK's online help.
  13206.  
  13207.  This file can be viewed and printed with the WRITE program, which is
  13208.  packaged with the Windows 3.00 package.
  13209.  
  13210.  
  13211.  38. Tips for Using the Microsoft Advisor Online Help
  13212.  
  13213.  Product Version(s): 1.00 1.10 | 1.00 1.10
  13214.  Operating System:   MS-DOS    | OS/2
  13215.  Flags: ENDUSER | s_quickc s_c s_qh
  13216.  Last Modified: 23-JAN-1991    ArticleIdent: Q64829
  13217.  
  13218.  The following are some tips for more effectively using the online
  13219.  documentation included with the Microsoft C Compiler version 6.00
  13220.  Programmer's Workbench (PWB) as well as the Microsoft Advisor
  13221.  command-line help system:
  13222.  
  13223.  1. Finding help on a topic for which the exact name is not known.
  13224.  
  13225.     If the exact spelling of a topic is not known, the help for that
  13226.     topic can't be accessed directly (for instance, by using the F1 key
  13227.     in PWB), but it can usually be found indirectly.
  13228.  
  13229.     By using the table of contents and selecting links that pertain to
  13230.     the subject in question, the topic can usually be found. To get to
  13231.     the table of contents from within QuickHelp, select the Categories
  13232.     menu, then "C 6.00".  From within PWB, choose the Help menu, then
  13233.     select Contents.
  13234.  
  13235.     If you know the general spelling of the topic, an alphabetical
  13236.     index is available by choosing Index from the main contents screen.
  13237.  
  13238.  2. "Paging" through the online documentation.
  13239.  
  13240.     The online documentation can be "paged through" like you would page
  13241.     through a manual.
  13242.  
  13243.     In PWB, CTRL+F1 takes you from one topic to the next sequential
  13244.     topic in the help file. In QuickHelp, Choose Next or Back from the
  13245.     View menu to move in either direction.
  13246.  
  13247.  3. Scanning a list of available topics (as in a printed index).
  13248.  
  13249.     There are alphabetical indices for every major component of the
  13250.     product. Just choose Index from the main contents screen and select
  13251.     the appropriate topic.
  13252.  
  13253.  4. Techniques for using the online help.
  13254.  
  13255.     For more information on how to use the help system, as well as on
  13256.     the general organization and structure of the help system, choose
  13257.     Using Help from the main contents screen.
  13258.  
  13259.     For additional help, see Chapter 4, "Using the On-Line Reference,"
  13260.     of the "Microsoft C Installing and Using the Professional
  13261.     Development System" manual that comes with C version 6.00.
  13262.  
  13263.  5. Printing out the online help files.
  13264.  
  13265.     By using the HELPMAKE utility, the help files can be decoded to
  13266.     readable text files, which can then be printed. For more
  13267.     information about the HELPMAKE utility, see Chapter 7 of the
  13268.     "Microsoft C Advanced Programming Techniques" manual that comes
  13269.     with C version 6.00.
  13270.  
  13271.  
  13272.  39. Predefined Identifiers in Microsoft C 6.00
  13273.  
  13274.  Product Version(s): 6.00   | 6.00
  13275.  Operating System:   MS-DOS | OS/2
  13276.  Flags: ENDUSER | s_quickhelp s_c s_utils
  13277.  Last Modified: 24-OCT-1990    ArticleIdent: Q65472
  13278.  
  13279.  The following information is contained in the online help for the
  13280.  Microsoft C Compiler version 6.00.
  13281.  
  13282.  This information below can be accessed by using the following steps:
  13283.  
  13284.  1. Obtain help on the text "cl" using either the F1 key from the
  13285.     Programmer's WorkBench, or by using "qh cl" from the DOS or OS/2
  13286.     command lines.
  13287.  
  13288.  2. Select Preprocessor Options, then Predefined Identifiers.
  13289.  The compiler automatically defines identifiers useful in writing
  13290.  portable programs. You can use these identifiers to compile code
  13291.  sections conditionally. These identifiers are always defined unless
  13292.  otherwise stated.
  13293.  
  13294.     Identifier       Target Identified
  13295.     ----------       -----------------
  13296.  
  13297.     MSDOS            MS-DOS operating system
  13298.     M_I86            Member of the I86 processor family
  13299.     M_I86mM          Memory model type
  13300.                      <m> = T    Tiny
  13301.                            S    Small (default)
  13302.                            C    Compact model
  13303.                            M    Medium model
  13304.                            L    Large model
  13305.                            H    Huge model
  13306.     M_I8086          8088 or 8086 processor; default or with /G0
  13307.                         option
  13308.     M_I286           80286 processor; defined with /G1 or /G2 option
  13309.     _MSC_VER         Identifies the version of Microsoft C
  13310.     NO_EXT_KEYS      Disables Microsoft-specific language extensions
  13311.                         and extended keywords; defined only with /Za
  13312.                         option
  13313.     _CHAR_UNSIGNED   Changes default char type to unsigned; defined
  13314.                         only with /J option
  13315.  
  13316.  The _MSC_VER identifier has a value of 600 for the Microsoft C Compiler
  13317.  version 6.00. This identifier is not defined in Microsoft C versions
  13318.  5.10 and earlier.
  13319.  
  13320.  
  13321.  40. How to Add Other Language Compilers to PWB's Build Options
  13322.  
  13323.  Product Version(s): 1.00 1.10 | 1.00 1.10
  13324.  Operating System:   MS-DOS    | OS/2
  13325.  Flags: ENDUSER | s_pascal b_basiccom s_c h_masm h_fortran b_cobol
  13326.  Last Modified: 24-OCT-1990    ArticleIdent: Q65568
  13327.  
  13328.  The Programmer's WorkBench (PWB) is an environment capable of
  13329.  utilizing different compilers for mixed-language programming. When
  13330.  installed during BASIC version 7.10 setup, PWB version 1.10 shows
  13331.  build options for the BASIC language only. However, it is possible to
  13332.  include other language compilers to utilize the full features of the
  13333.  PWB utility.
  13334.  
  13335.  The following information applies to the Programmer's WorkBench
  13336.  version 1.10 utility supplied with Microsoft BASIC Professional
  13337.  Development System (PDS) version 7.10 for MS-DOS and MS OS/2.
  13338.  
  13339.  Note that the 1.00 version of PWB is shipped with Microsoft C
  13340.  Professional Development System (PDS) version 6.00. The steps below
  13341.  should also apply to PWB version 1.00.
  13342.  
  13343.  The Programmer's WorkBench (PWB.EXE) is an advanced development
  13344.  environment capable of integrating several language compilers,
  13345.  NMAKE.EXE, LINK.EXE, and the CodeView debugger. It offers the ability
  13346.  to accomplish tasks, such as program development under protected mode
  13347.  and mixed-language programming. This ability is not available in the
  13348.  QuickBASIC extended development environment (QBX.EXE).
  13349.  
  13350.  Two special files, PWBC.PX$ (for protected mode OS/2) and PWBC.MX$
  13351.  (for DOS mode), reside on the BASIC PDS 7.10 disks and support the
  13352.  option of using the C compiler in PWB. Since SETUP.EXE (in BASIC PDS
  13353.  7.10) does not copy PWBC.PX$ and PWBC.MX$ during installation, these
  13354.  files must be unpacked and transferred to your machine, for example to
  13355.  the \BINP subdirectory located in the \BC7 directory. (Note: The
  13356.  UNPACK.EXE utility is found on disk 1 of the BASIC PDS package.) After
  13357.  unpacking, the files will have the names PWBC.PXT and PWBC.MXT.
  13358.  
  13359.  Next, the following command lines must be added to the TOOLS.INI file
  13360.  to make the C compiler available to PWB:
  13361.  
  13362.     [pwb - .BAS .BI]
  13363.        LOAD: LogicalDrive:\[Path]\PWBC.PXT
  13364.  
  13365.  For further information about installing PWBC.PXT and PWBC.MXT, see
  13366.  Page 54 of the "Microsoft BASIC 7.1: Getting Started" manual.
  13367.  
  13368.  If you want to program in languages other than BASIC or C [such as
  13369.  Microsoft Macro Assembler (MASM), Microsoft Pascal, Microsoft FORTRAN,
  13370.  or Microsoft COBOL 3.00/3.00a], the following steps will insert the
  13371.  initial build options to include other languages to PWB's build
  13372.  options menu. In the example below, options to include the MASM.EXE
  13373.  assembler are specified. If some other language's compiler is desired,
  13374.  substitute appropriate changes for that compiler, where noted in the
  13375.  specified areas:
  13376.  
  13377.   1. In PWB, go to the Options menu and select Build Options.
  13378.  
  13379.   2. Choose Save Current Build Options.
  13380.  
  13381.   3. Enter a meaningful message, such as "Options to Include MASM" in
  13382.      the window's edit field (if some other language is desired, change
  13383.      MASM to the appropriate name). Select the OK button from the "Save
  13384.      Current Build Options" and "Build Options" windows.
  13385.  
  13386.   4. Open the "TOOLS.INI" file in the PWB utility and go down to the
  13387.      bottom of the file. Somewhere near the bottom should be the tag
  13388.      "[PWB-Build Options: Options to Include MASM]" (or the language
  13389.      that was specified).
  13390.  
  13391.   5. In this section, add the following NMAKE instructions:
  13392.  
  13393.         build: inference .asm.obj masm_asm_obj
  13394.         build: command masm_asm_obj "masm $<;"
  13395.  
  13396.      Note: For languages other than MASM, distinguish a variable name
  13397.      in the inference rule to be used in the commands line (such as
  13398.      masm_asm_obj has been used above) and then specify the appropriate
  13399.      compiler in the commands line within the quotation marks. The
  13400.      special filename macro specified in the quotation marks, "$<",
  13401.      applies the command to any object that has an out-of-date
  13402.      executable file.
  13403.  
  13404.   6. Press SHIFT+F8 to reinitialize the file and then close it.
  13405.  
  13406.   7. Go to the File menu and select New (it is a good idea to close any
  13407.      files that are currently open before this step).
  13408.  
  13409.   8. Go to the Options menu and select Build Options.
  13410.  
  13411.   9. Choose Initial Build Options.
  13412.  
  13413.  10. Select the "Options to Include MASM" option (it should be near the
  13414.      bottom of the list).
  13415.  
  13416.  After completing these instructions, the PWB utility will now be ready
  13417.  to compile assembler along with BASIC source code, provided that paths
  13418.  to the necessary compilers are furnished.
  13419.  
  13420.  
  13421.  41. PWB Err Msg: Out of Local Memory. Unable to Recover.
  13422.  
  13423.  Product Version(s): 1.00
  13424.  Operating System:   MS-DOS
  13425.  Flags: ENDUSER |
  13426.  Last Modified: 17-OCT-1990    ArticleIdent: Q65913
  13427.  
  13428.  When setting a program list inside of the Programmer's WorkBench
  13429.  (PWB), the following message may occur:
  13430.  
  13431.     Out of Local Memory.  Unable to Recover.
  13432.  
  13433.  The error is printed on the screen and the PWB exits to DOS. This
  13434.  error may occur when the program list contains too many names. To
  13435.  resolve the problem, combine object modules into libraries whenever
  13436.  possible. Remove the .OBJ files from the program list and replace them
  13437.  with the new libraries. This will reduce the number of object modules
  13438.  that need to be defined in the program list.
  13439.  
  13440.  Another method that sometimes helps to alleviate the error is to open
  13441.  the File menu and close as many unneeded files as possible. This
  13442.  should be done before setting the program list.
  13443.  
  13444.  
  13445.  42. Situation Where PWB Online Help Text Disappears
  13446.  
  13447.  Product Version(s): 1.00 1.10 | 1.00 1.10
  13448.  Operating System:   MS-DOS    | OS/2
  13449.  Flags: ENDUSER | SR# S901010-118 B_BasicCom S_C B_cobol
  13450.  Last Modified: 24-OCT-1990    ArticleIdent: Q66229
  13451.  
  13452.  When requesting help in Microsoft Programmer's WorkBench (PWB)
  13453.  versions 1.00 and 1.10, the following sequence of events will cause
  13454.  the Help screen text to disappear, leaving only the hyperlinks.
  13455.  
  13456.  This information applies to Programmer's WorkBench version 1.00 (which
  13457.  comes with Microsoft C Professional Development System version 6.00
  13458.  for MS-DOS and MS OS/2), and to Programmer's WorkBench version 1.10
  13459.  (which comes with Microsoft COBOL Professional Development System
  13460.  version 4.00 and with Microsoft BASIC Professional Development System
  13461.  (PDS) version 7.10 for MS-DOS and MS OS/2).
  13462.  
  13463.  Microsoft has confirmed this to be a problem in PWB. We are
  13464.  researching this problem and will post new information here as it
  13465.  becomes available.
  13466.  Follow these steps to reproduce the problem:
  13467.  
  13468.  1. From the DOS or OS/2 prompt, enter PWB. From the File menu, select
  13469.     New. Type PLINES and request help by pressing F1 or single-clicking
  13470.     the right mouse button.
  13471.  
  13472.  2. In the Help dialog, double-click the left mouse button with the
  13473.     cursor on the hyperlink "Using PWB Functions."
  13474.  
  13475.  3. Double-click the left mouse button with the cursor on the hyperlink
  13476.     "PWB Functions by Category."
  13477.  
  13478.  4. Double-click the left mouse button with the cursor on the hyperlink
  13479.     "Moving Through Files."
  13480.  
  13481.  5. The vertical scroll bar will show that you are at the bottom of the
  13482.     dialog. Press PGUP and you will notice that the hyperlinks to Up,
  13483.     Index, Contents, and Back have disappeared. Double-click the left
  13484.     mouse button with the cursor on any of these empty hyperlinks; the
  13485.     text on the screen will disappear, with empty hyperlinks appearing
  13486.     on the screen.
  13487.  
  13488.  
  13489.  43. How to Insert Spaces Before a Block of Text in PWB
  13490.  
  13491.  Product Version(s): 1.00   | 1.00
  13492.  Operating System:   MS-DOS | OS/2
  13493.  Flags: ENDUSER | S_EDITOR
  13494.  Last Modified: 24-OCT-1990    ArticleIdent: Q66231
  13495.  
  13496.  It is sometimes desirable to indent or move over a block of text in
  13497.  the Programmer's WorkBench (PWB) or the M Editor. The following steps
  13498.  can be used to insert spaces before a block of text to indent it:
  13499.  
  13500.  1. Get into boxarg mode. You can select this mode from the Edit menu
  13501.     under the Programmer's Workbench, or select the boxstream function
  13502.     under the Microsoft Editor.
  13503.  
  13504.  2. Highlight the area you want to contain the spaces. This may be
  13505.     anywhere in the file.
  13506.  
  13507.  3. Select the linsert function. By default, this is CTRL+N.
  13508.  
  13509.  The highlighted area should now be moved over and replaced by spaces.
  13510.  
  13511.  You don't have to be in boxarg mode for this to work; linsert always
  13512.  treats its argument as a boxarg regardless of the current mode.
  13513.  However, the highlight on the screen won't match the area that is
  13514.  going to be inserted unless you use boxarg mode.
  13515.  
  13516.  Also, ldelete can be used to unindent a block of text. However, you
  13517.  must be in boxarg or streamarg mode for it to work correctly. In
  13518.  linearg mode, it will delete entire lines.
  13519.  
  13520.  
  13521.  44. PWB's Use of Expanded Memory
  13522.  
  13523.  Product Version(s): 1.00 1.10
  13524.  Operating System:   MS-DOS
  13525.  Flags: ENDUSER |
  13526.  Last Modified: 23-OCT-1990    ArticleIdent: Q66308
  13527.  
  13528.  The DOS version of the Programmer's WorkBench (PWB) will utilize
  13529.  expanded memory to swap its own segment overlays if it detects that
  13530.  expanded memory is available in the system. When PWB needs a new
  13531.  overlay, the existing overlay in memory is first copied into expanded
  13532.  memory. If there is not enough room in expanded memory to copy the
  13533.  overlay, the least recently used overlay is discarded to make room for
  13534.  it. This scheme allows most overlays to be read from expanded memory
  13535.  instead of from disk.
  13536.  
  13537.  Note that this is the only method by which PWB will take advantage of
  13538.  available expanded memory, and that PWB versions 1.00 and 1.10 have no
  13539.  internal provisions to make use of extended memory in any way.
  13540.  
  13541.  
  13542.  45. PWB May Exit to DOS If TMP Not Set Correctly
  13543.  
  13544.  Product Version(s): 1.00 1.10
  13545.  Operating System:   MS-DOS
  13546.  Flags: ENDUSER | buglist1.00 buglist1.10
  13547.  Last Modified: 24-OCT-1990    ArticleIdent: Q66309
  13548.  
  13549.  If the tmp environment variable is set only to a drive (with no path
  13550.  specified), the PWB may "crash" out to DOS when a compile is
  13551.  attempted. The screen will still show the PWB, but there will be a
  13552.  prompt displayed.
  13553.  
  13554.  This problem may be reproduced using the following procedure:
  13555.  
  13556.  1. Set up the environment to run the PWB.
  13557.  
  13558.  2. Set the tmp environment variable to the current drive, without
  13559.     specifying a path. For example:
  13560.  
  13561.        SET TMP=C:
  13562.  
  13563.  3. Execute the PWB and create or load a simple source file.
  13564.  
  13565.  4. Attempt to compile the source file. (Note: If the COMPILE option is
  13566.     not available on the make menu, make sure the file has a name with a
  13567.     .c extension.)
  13568.  
  13569.  Microsoft has confirmed this to be a problem with the Programmer's
  13570.  WorkBench versions 1.00 and 1.10. We are researching this problem and
  13571.  will post new information here as it becomes available.
  13572.  
  13573.  
  13574.  46. MASM Build Switches for PWB 1.10
  13575.  
  13576.  Product Version(s): 1.10    | 1.10
  13577.  Operating System:   MS-DOS  | OS/2
  13578.  Flags: ENDUSER |
  13579.  Last Modified:  5-DEC-1990    ArticleIdent: Q66339
  13580.  
  13581.  When setting a program list containing .ASM files in Programmer's
  13582.  WorkBench (PWB) version 1.10, the following error message occurs:
  13583.  
  13584.     Program List: file 'filename' will be ignored
  13585.     File type unused by current build options
  13586.  
  13587.  The .ASM files are not recognized because PWB 1.10 does not contain
  13588.  build switches specific to any language. Build switches are now loaded
  13589.  from language extension files (.MXT for DOS and .PXT for OS/2). If you
  13590.  have an assembly language extension file, you will not see this error
  13591.  message. Language extensions are not necessary and are only a
  13592.  convenience for controlling the build process; only the build switches
  13593.  are really needed.
  13594.  
  13595.  The following build switches can be added to a tagged section in your
  13596.  TOOLS.INI file. To use these build options, first choose your language
  13597.  options from the Options Build Options menu, then initialize this
  13598.  section by typing {arg} tag_name {reinitialize} (type the following to
  13599.  invoke the sample build switch below:
  13600.  
  13601.     ALT+A asm_rules SHIFT+F8
  13602.  
  13603.  These switches can also be added to a custom set of build options
  13604.  saved by Save Current Build Options. They may then be initialized by
  13605.  choosing Build Options from the Options menu, and then selecting Set
  13606.  Initial Build Options to choose the new custom language options.
  13607.  
  13608.  Sample Build Switches
  13609.  ---------------------
  13610.  
  13611.  [pwb-asm_rules]
  13612.  ;
  13613.  ;   MASM build rules
  13614.  ;
  13615.  build:macro ASM "MASM"
  13616.  build:macro AFLAGS_G "/Mx /T"
  13617.  build:macro AFLAGS_D "/Zi"
  13618.  build:macro AFLAGS_R ""
  13619.  build:inference .asm.obj as_asm_obj
  13620.  build:release command as_asm_obj  \
  13621.              "$(ASM) $(AFLAGS_G) $(AFLAGS_R) $<, $@;"
  13622.  build:debug command as_asm_obj  \
  13623.              "$(ASM) $(AFLAGS_G) $(AFLAGS_D) $<, $@;"
  13624.  build:include .asm "^[ \t]*include[ \t]+\\([^ \t]+\\)"
  13625.  build:include .inc "^[ \t]*include[ \t]+\\([^ \t]+\\)"
  13626.  
  13627.  These assembly flags can then be modified from PWB by using the
  13628.  following macros. The macros must be assigned to keystrokes to be
  13629.  activated. This can be done using the <ASSIGN> pseudo file. They can
  13630.  then be used to redefine the flags to pass to MASM.
  13631.  
  13632.  ;
  13633.  ;   MASM option-setting macros
  13634.  ;
  13635.  setAFG:= arg "Global MASM Options?"  prompt -> cancel lasttext home \
  13636.          "build:macro AFLAGS_G \"" endline "\"" assign
  13637.  
  13638.  setAFD:= arg "Debug MASM Options?"   prompt -> cancel lasttext home \
  13639.          "build:macro AFLAGS_D \"" endline "\"" assign
  13640.  
  13641.  setAFR:= arg "Release MASM Options?" prompt -> cancel lasttext home \
  13642.          "build:macro AFLAGS_R \"" endline "\"" assign
  13643.  
  13644.  
  13645.  47. Unexpected Behavior with the /Gt Switch and the PWB
  13646.  
  13647.  Product Version(s): 1.00   | 1.00
  13648.  Operating System:   MS-DOS | OS/2
  13649.  Flags: ENDUSER | S_C
  13650.  Last Modified: 15-JAN-1991    ArticleIdent: Q66828
  13651.  
  13652.  Adding the /Gt compiler switch with an argument to the Additional
  13653.  Options section of the C Compiler Options on the Programmer's
  13654.  WorkBench (PWB) Options menu can cause the value of the argument to be
  13655.  changed or dropped.
  13656.  
  13657.  Microsoft has confirmed this to be a problem in the Programmer's
  13658.  WorkBench version 1.00. We are researching this problem and will post
  13659.  new information here as it becomes available.
  13660.  
  13661.  When you add the /Gt switch with an argument (for example, /Gt30) and
  13662.  click OK, then immediately go back into the Compiler Options dialog
  13663.  box; you will see that the /Gt30 switch you just set is now /Gt3.
  13664.  
  13665.  If you set a /Gt switch and specify a value, it will compile with that
  13666.  correct value because it was written to the file on disk that is used
  13667.  to build the program.
  13668.  
  13669.  If you go back in and look at the compiler options and see that the
  13670.  value is incorrect and Cancel the options dialog, you will still
  13671.  compile with your initial correct /Gt value.
  13672.  
  13673.  You will compile with the incorrect /Gt value only if you make another
  13674.  change in that dialog and select OK. This is because you changed the
  13675.  options, so PWB rewrites the options to the file on disk. In the case
  13676.  of /Gt, that option is written incorrectly and from that point on, you
  13677.  will compile with the incorrect /Gt value.
  13678.  
  13679.  Not all values of /Gt are incorrect. The most common incorrect values
  13680.  end in zero. The following are examples where the problem occurs:
  13681.  
  13682.     /Gt40 will turn into /Gt4
  13683.     /Gt0  will turn into /Gt
  13684.     /Gt20 will turn into /Gt
  13685.  
  13686.  Some other values that get changed are the following:
  13687.  
  13688.     /Gt113 will turn into /Gt3
  13689.     /Gt305 will turn into /Gt35
  13690.     /Gt14  will turn into /Gt4
  13691.     /Gt22  will turn into /Gt
  13692.  
  13693.  As a possible work around, do not set /Gt in the PWB, and set the
  13694.  environment variable CL to the desired threshold, as in the following
  13695.  example:
  13696.  
  13697.     set cl=/Gt40
  13698.  
  13699.  This value will be read by the compiler when it is called from the
  13700.  PWB.
  13701.  
  13702.  Also, you can set the /Gt switch on the Additional Options line in
  13703.  either Set Debug Options or Set Release Options, rather than the
  13704.  global Additional Options.
  13705.  
  13706.  
  13707.  48. REsearch() Function Prototype Not Found in EXT.H Header File
  13708.  
  13709.  Product Version(s): 1.00 1.10 | 1.00 1.10
  13710.  Operating System:   MS-DOS    | OS/2
  13711.  Flags: ENDUSER | buglist1.00 buglist1.10
  13712.  Last Modified:  4-DEC-1990    ArticleIdent: Q67274
  13713.  
  13714.  The Programmer's WorkBench (PWB) function REsearch(), although
  13715.  included in EXTSUP.LIB, is not prototyped in the EXT.H header file. To
  13716.  call REsearch(), use the following prototype:
  13717.  
  13718.  int REsearch( PFILE pFile, flagType fForward, flagType fAll,
  13719.                flagType fCase, flagType fWrap, char _far *pattern,
  13720.                fl *pflStart );
  13721.  
  13722.  For more information, see online help.
  13723.  
  13724.  Microsoft has confirmed this to be a problem in PWB versions 1.00 and
  13725.  1.10. We are researching this problem and will post new information
  13726.  here as it becomes available.
  13727.  
  13728.  
  13729.  49. PWB Help Crashes When Using "Moving Through a File"
  13730.  
  13731.  Product Version(s): 1.10   | 1.10
  13732.  Operating System:   MS-DOS | OS/2
  13733.  Flags: ENDUSER | buglist1.10
  13734.  Last Modified: 14-DEC-1990    ArticleIdent: Q67361
  13735.  
  13736.  When using the online help through the Programmer's WorkBench (PWB),
  13737.  the help system will crash if you do the following:
  13738.  
  13739.  1. After entering help, choose Contents.
  13740.  
  13741.  2. Select the Microsoft Advisor from the list of contents.
  13742.  
  13743.  3. Select the Programmer's WorkBench button followed by the "Moving
  13744.     Through a File" selection.
  13745.  
  13746.  At this point a header will appear on the screen and the elevator for
  13747.  the window will appear as though it is at the bottom of a page.
  13748.  
  13749.  The page can be scrolled up and the contents viewed, especially if
  13750.  highlighted, but the menu items at the top will be blacked out
  13751.  (although they are present). From this point, no further help can be
  13752.  accessed.
  13753.  
  13754.  If you exit help and then reenter, nothing will come up.
  13755.  Re-initializing does not reinstate the help system. Only shelling out,
  13756.  exiting, and reentering will allow you to access the help system.
  13757.  
  13758.  Microsoft has confirmed this to be a problem in the Programmer's
  13759.  WorkBench version 1.10. We are researching this problem and will post
  13760.  new information here as it becomes available.
  13761.  
  13762.  
  13763.  50. PWB Hangs with Novell NetWare
  13764.  
  13765.  Product Version(s): 1.00 1.11
  13766.  Operating System:   MS-DOS
  13767.  Flags: ENDUSER | s_quickc s_codeview s_c
  13768.  Last Modified: 14-DEC-1990    ArticleIdent: Q67483
  13769.  
  13770.  On certain installations of a Novell network, the network will cause
  13771.  the Programmer's WorkBench (PWB) to hang. This problem may also occur
  13772.  in CodeView or QuickC. The hang usually occurs when an attempt is made
  13773.  to use the mouse.
  13774.  
  13775.  If you have a peripheral (such as a mouse) that uses Interrupt Request
  13776.  Level (IRQ) 3, and your system is part of a network using Novell
  13777.  NetWare version 2.15 or earlier, your system may hang when you load
  13778.  QuickC, PWB, or CodeView. As a temporary solution, set your peripheral
  13779.  to use another interrupt. For more information, contact your Novell
  13780.  NetWare dealer.
  13781.  
  13782.  If taking these steps does not solve the problem, please contact
  13783.  Microsoft Product Support Services.
  13784.  
  13785.  
  13786.  51. PWB Menu Hyperlink in PWB.HLP is Inconsistent in Version 1.10
  13787.  
  13788.  Product Version(s): 1.10   | 1.10
  13789.  Operating System:   MS-DOS | OS/2
  13790.  Flags: ENDUSER |
  13791.  Last Modified: 23-JAN-1991    ArticleIdent: Q67614
  13792.  
  13793.  When selecting help on the Programmer's WorkBench (PWB) version 1.10
  13794.  from the Categories menu in QuickHelp version 1.70, the help screen
  13795.  for Microsoft Advisor Help System is presented instead. This behavior
  13796.  may be duplicated by following the procedure outlined below:
  13797.  
  13798.  1. Start QuickHelp without an argument to get help on any topic. This
  13799.     will bring up the main help screen.
  13800.  
  13801.  2. Select the Programmer's WorkBench choice under the Categories menu.
  13802.  
  13803.  Instead of bringing up the help screen for Programmer's WorkBench, you
  13804.  will see the screen for the Microsoft Advisor Help System.
  13805.  
  13806.  If the PWB.HLP help file is decoded using helpmake as follows
  13807.  
  13808.     helpmake /D /T /Opwb.doc pwb.hlp
  13809.  
  13810.  we can see that the reason for this is that the .context directive for
  13811.  Programmer's WorkBench appears in the wrong section in the decoded
  13812.  help file. The following line
  13813.  
  13814.     .context Programmer's Workbench
  13815.  
  13816.  appears above the section for "Microsoft Advisor Contents." To correct
  13817.  the problem, move the .context directive for Programmer's WorkBench to
  13818.  the proper section, which is the "Programmer's WorkBench Contents."
  13819.  
  13820.  The helpfile must then be recompressed, as follows:
  13821.  
  13822.     helpmake /E7 /T /Opwb.hlp pwb.doc
  13823.  
  13824.  The choice of /E7 is shown here for demonstration purposes only, and
  13825.  is strictly arbitrary in this case. If maximum compression is desired,
  13826.  the numerical argument to the /E switch may be left off, or /E15 may
  13827.  be specified. Maximum compression will restore the database as close
  13828.  to its original size and state as possible.
  13829.  
  13830.  
  13831.  52. "missing ':' in ->" Caused by Control Character
  13832.  
  13833.  Product Version(s): 1.00 1.10 | 1.00 1.10
  13834.  Operating System:   MS-DOS    | OS/2
  13835.  Flags: ENDUSER |
  13836.  Last Modified: 14-DEC-1990    ArticleIdent: Q67736
  13837.  
  13838.  When invoking the Programmer's WorkBench (PWB), if there is a control
  13839.  character at the end of the TOOLS.INI file, [usually a CTRL+Z (ASCII
  13840.  26) end-of-file marker] and you only have a [pwb] tagged section, an
  13841.  error message will appear stating "missing ':' in ->". Note that the
  13842.  "->" is the graphic right-arrow symbol.
  13843.  
  13844.  This is not a problem in the PWB. A control character is a legal macro
  13845.  name. The message indicates that a macro definition or key assignment
  13846.  is expected after the character. To keep this message from appearing,
  13847.  place the tag
  13848.  
  13849.     [end]
  13850.  
  13851.  before the control character at the end of your TOOLS.INI file. With
  13852.  this tag at the end of the file, you always suppress the message, even
  13853.  if you edit TOOLS.INI with an editor that inserts CTRL+Z's at the end
  13854.  of the file. This is because the -> symbol must be within the [pwb]
  13855.  tagged section for this error message to be displayed, and the [end]
  13856.  tag forces the -> into its own tagged section.
  13857.  
  13858.  Simply deleting the control character will work until you edit the
  13859.  file with an editor that replaces the CTRL+Z, then this message
  13860.  reappears. This may also when using the COPY command to concatenate
  13861.  files.
  13862.  
  13863.  
  13864.  53. Inconsistent Error Attempting to Load Nonexistent Extension
  13865.  
  13866.  Product Version(s): 1.00 1.10
  13867.  Operating System:   OS/2
  13868.  Flags: ENDUSER |
  13869.  Last Modified: 28-DEC-1990    ArticleIdent: Q67777
  13870.  
  13871.  When attempting to load a Programmer's WorkBench extension through a
  13872.  macro definition in the TOOLS.INI file, if the extension file does not
  13873.  exist, or is not in the current path, the following error message is
  13874.  displayed in a dialog box:
  13875.  
  13876.     pwbhelp:  SYS0123:  A file name or volume label contains an
  13877.                         incorrect character
  13878.  
  13879.  This error message should indicate that the extension file could not
  13880.  be found; however, the message is generated by the OS/2 operating
  13881.  system's DLL loading code, and therefore, cannot be changed by PWB.
  13882.  
  13883.  The following error message is generated in the DOS version of PWB,
  13884.  which displays this message in a dialog box:
  13885.  
  13886.     No such file or directory
  13887.  
  13888.  To correct the problem, make sure that the directory in which the
  13889.  extension resides is in the current path.
  13890.  
  13891.  
  13892.  54. PWB May Record Incorrect Paths for Dependencies in Makefile
  13893.  
  13894.  Product Version(s): 1.00 1.10  | 1.00 1.10
  13895.  Operating System:   MS-DOS     | OS/2
  13896.  Flags: ENDUSER | buglist1.00 buglist1.10
  13897.  Last Modified:  6-FEB-1991    ArticleIdent: Q67780
  13898.  
  13899.  Creating a program list with dependencies in directories other than
  13900.  the project (makefile) directory may result in the Programmer's
  13901.  WorkBench (PWB) recording the wrong paths to these dependencies.
  13902.  
  13903.  The following steps illustrate the problem:
  13904.  
  13905.  1. Create subdirectories named TEST and TESTA under the same
  13906.     directory, with sample files FOO.C in TEST and GOO.C in TESTA.
  13907.  
  13908.  2. Invoke PWB from the TESTA directory.
  13909.  
  13910.  3. Create a program list.
  13911.  
  13912.  4. Add FOO.C and GOO.C with full path.
  13913.  
  13914.  5. Save the list.
  13915.  
  13916.  The resulting makefile will contain the line:
  13917.  
  13918.     OBJS = goo.c foo.c
  13919.  
  13920.  The correct line should read:
  13921.  
  13922.     OBJS = goo.c ..\TEST\foo.c
  13923.  
  13924.  Changing the location of the project makefile or changing the names of
  13925.  the subdirectories will generate the correct paths for dependencies in
  13926.  the makefile.
  13927.  
  13928.  Microsoft has confirmed this to be a problem in the Programmer's
  13929.  WorkBench versions 1.00 and 1.10. We are researching this problem and
  13930.  will post new information here as it becomes available.
  13931.  
  13932.  
  13933.  55. PWB Extensions in DOS Cannot Shell to DOS
  13934.  
  13935.  Product Version(s): 1.00 1.10
  13936.  Operating System:   MS-DOS
  13937.  Flags: ENDUSER |
  13938.  Last Modified:  6-FEB-1991    ArticleIdent: Q67792
  13939.  
  13940.  Extensions written for the Programmer's WorkBench (PWB) that require a
  13941.  call to the operating system do not work correctly under DOS. One
  13942.  example of this is the FILTER.C sample extension packaged with
  13943.  Microsoft C 6.00.
  13944.  
  13945.  When PWB.COM is executed under DOS, it spawns the main editor
  13946.  (PWBED.EXE). PWBED.EXE is cleared from memory when a DOS shell is
  13947.  executed from within the editor. Once the shell has completed,
  13948.  PWBED.EXE is reloaded from disk and initialized. The initialization is
  13949.  what causes the problem because it also initializes any extensions to
  13950.  the editor at the same time. This means that any information that the
  13951.  extension was keeping track of is lost.
  13952.  
  13953.  
  13954.  56. Not Enough Core Message Caused by Lack of Memory
  13955.  
  13956.  Product Version(s): 1.00 1.10
  13957.  Operating System:   MS-DOS
  13958.  Flags: ENDUSER |
  13959.  Last Modified:  6-FEB-1991    ArticleIdent: Q68070
  13960.  
  13961.  When loading the Programmer's WorkBench (PWB), a message box may
  13962.  appear on the screen containing the message "Cannot Autoload
  13963.  Extension, not enough core." The extension file that could not be
  13964.  loaded will be indicated. You need to free more memory so that the
  13965.  extensions can be loaded.
  13966.  
  13967.  
  13968.  57. Windows DLL Build Options Ignore .RC Files in PWB 1.10
  13969.  
  13970.  Product Version(s): 1.10   | 1.10
  13971.  Operating System:   MS-DOS | OS/2
  13972.  Flags: ENDUSER | buglist1.10 S_C P_WINSDK
  13973.  Last Modified: 11-JAN-1991    ArticleIdent: Q68155
  13974.  
  13975.  In the Programmer's WorkBench version 1.10, the default build options
  13976.  for creating a Windows DLL will ignore any .RC files included in the
  13977.  Program List, and therefore, will not build them into the project.
  13978.  
  13979.  Use the following steps to correct this problem:
  13980.  
  13981.   1. If there is a Program List currently set, clear it.
  13982.  
  13983.   2. Set the Main Language to C.
  13984.  
  13985.   3. Set the Initial Build Options to Windows DLL.
  13986.  
  13987.   4. Create a new Program List containing all the files you want in your
  13988.      project.
  13989.  
  13990.   5. Save the Program List. At this point, PWB will tell you that your
  13991.      .RC file will be ignored. Choose OK when that dialog box appears.
  13992.  
  13993.   6. Choose Editor Settings from the Options menu.
  13994.  
  13995.   7. Find the line that starts:
  13996.  
  13997.         build: target $(PROJ).dll
  13998.  
  13999.   8. Change the word "res_dll" on that line to "rc_dll".
  14000.  
  14001.   9. Move the cursor off that line to highlight the change. Press SHIFT+F2
  14002.      to save the new settings.
  14003.  
  14004.  10. Press F2 to exit the ASSIGN pseudofile.
  14005.  
  14006.  11. Choose Edit Program List from the Make menu.
  14007.  
  14008.  12. Choose Save List. The .RC file will now be saved in the Program
  14009.      List and used as expected.
  14010.  
  14011.  After these steps are taken, the settings will be saved in the .STS
  14012.  file for that project, and will remain correct as long as Set Initial
  14013.  Build Options is never selected when this Program List is set. In
  14014.  order to keep from repeating these steps for future projects, the
  14015.  build options should be saved under a descriptive name, such as
  14016.  "Corrected Windows DLL Settings." They can then be chosen for any
  14017.  future Windows DLLs.
  14018.  
  14019.  Microsoft has confirmed this to be a problem in the Programmer's
  14020.  WorkBench version 1.10. We are researching this problem and will post
  14021.  new information here as it becomes available.
  14022.  
  14023.  
  14024.  58. PWB Build Switch Reference Available as an Application Note
  14025.  
  14026.  Product Version(s): 1.00 1.10 | 1.00 1.10
  14027.  Operating System:   MS-DOS    | OS/2
  14028.  Flags: ENDUSER | appnote softlib SW0330
  14029.  Last Modified: 29-JAN-1991    ArticleIdent: Q68367
  14030.  
  14031.  The "PWB Build Switch Reference" contains detailed descriptions and
  14032.  examples for customizing PWB build switches.
  14033.  
  14034.  The Programmer's WorkBench (PWB) can build various types of projects
  14035.  based on the information contained in "build switches." These build
  14036.  switches are interpreted by PWB in order to create a makefile for a
  14037.  project. The switches are normally set for you by PWB for common types
  14038.  of projects, but you may define your own build switches to handle an
  14039.  advanced project where you require more control over the build
  14040.  process. For example, customized build switches will allow you to
  14041.  utilize different languages, to incorporate other tools into a
  14042.  project, or to build new kinds of targets.
  14043.  
  14044.  Although build switch customization is documented in the PWB online
  14045.  help, the information is somewhat limited. Therefore, an application
  14046.  note was created to cover the customization process in detail. The
  14047.  title of this application note is "PWB Build Switch Reference" and it
  14048.  can be obtained by calling Microsoft Product Support Services at (206)
  14049.  637-7096.
  14050.  
  14051.  The "PWB Build Switch Reference" can also be found in the Software/
  14052.  Data Library (as file SW0330.ARC) by searching on the keyword SW0330,
  14053.  the Q number of this article, or S12875. SW0330 was archived using the
  14054.  PKware file-compression utility.
  14055.  
  14056.  Note that the application note found in the Software/Data Library is
  14057.  an ordinary text file, which lacks the typefaces and formatting of the
  14058.  printed version that is available by calling Microsoft Product Support
  14059.  Services. Because the printed application note is clearer and easier
  14060.  to follow, it is highly recommended that you call for the printed
  14061.  version, and that you use the downloaded version only as an interim
  14062.  copy.
  14063.  
  14064.  Also note that you normally DO NOT need to modify build switches just
  14065.  to customize the compile and link operations -- this can generally be
  14066.  done by selecting commands from the Options menu. By selecting options
  14067.  from the Compile or LINK Options dialog boxes, the correct build
  14068.  switches are automatically modified to contain the desired
  14069.  information.
  14070.  
  14071.  
  14072.  59. Brown Screen Color Changes to Yellow After Running PWB
  14073.  
  14074.  Product Version(s): 1.00 1.10
  14075.  Operating System:   MS-DOS
  14076.  Flags: ENDUSER | s_c buglist1.00 buglist1.10 remapping
  14077.  Last Modified:  6-FEB-1991    ArticleIdent: Q69064
  14078.  
  14079.  After running PWB, the brown screen color changes to yellow until the
  14080.  system is rebooted or the video mode is reset.
  14081.  
  14082.  For example, if you run PWB and then run the Microsoft editor, the
  14083.  brown characters will appear yellow.
  14084.  
  14085.  To work around this problem, you can create a batch file called
  14086.  PWB.BAT. In this file, you can start PWB and then reset the video
  14087.  mode. For example:
  14088.  
  14089.      pwb.bat
  14090.              pwb %1 %2 %3 %4
  14091.              mode co80,25
  14092.  
  14093.  Microsoft has confirmed this to be a problem in PWB versions 1.00 and
  14094.  1.10. We are researching this problem and will post new information
  14095.  here as it becomes available.
  14096.  
  14097.  
  14098.  60. Reinitializing After Changing Editor Settings Is Very Slow
  14099.  
  14100.  Product Version(s): 1.10   | 1.10
  14101.  Operating System:   MS-DOS | OS/2
  14102.  Flags: ENDUSER |
  14103.  Last Modified: 11-FEB-1991    ArticleIdent: Q69142
  14104.  
  14105.  The current editor settings in the Programmer's WorkBench (PWB) may be
  14106.  changed by choosing Editor Settings from the Options menu, making a
  14107.  change to the <assign> pseudofile, and then saving that file. If
  14108.  SHIFT+F8 (initialize) is pressed while the <assign> pseudofile is
  14109.  still displayed, PWB may appear as though it is hung; it is actually
  14110.  reinitializing each statement of the editor settings (<assign>)
  14111.  pseudofile.
  14112.  
  14113.  The following steps will reproduce this behavior:
  14114.  
  14115.  1. Enter PWB and select the Options menu.
  14116.  
  14117.  2. Choose the Editor Settings menu.
  14118.  
  14119.  3. Make a change in the <assign> pseudofile and then save it.
  14120.  
  14121.  4. Press the "initialize" keystroke combination (SHIFT+F8) and a popup
  14122.     box will appear stating "reinitializing...". The reinitialization
  14123.     is actually taking place but it is very slow because PWB is
  14124.     rebuilding the <assign> pseudofile for each entry in your TOOLS.INI
  14125.     file.
  14126.  
  14127.  This behavior does not occur in PWB version 1.00. Version 1.10
  14128.  includes a change to the earlier version; you can see a new assignment
  14129.  (made via "arg textarg <assign>") immediately updated if you are
  14130.  viewing the <assign> pseudofile.
  14131.  
  14132.  This is expected behavior because the <assign> pseudofile is meant to
  14133.  show the settings that were in effect at the time the file was
  14134.  displayed. It is not recommended that it be dynamically updated except
  14135.  via the mechanism of actually editing the file. If you changed a
  14136.  setting via "arg textarg assign" (ALT+A textarg ALT+=), a better way
  14137.  to view your new setting(s) is by using "refresh" (SHIFT+F7), or by
  14138.  switching away and back again via "setfile" (F2).
  14139.  
  14140.  
  14141.  61. PWB Ignores Certain Compiler Switches in Additional Options
  14142.  
  14143.  Product Version(s): 1.00 1.10 | 1.00 1.10
  14144.  Operating System:   MS-DOS    | OS/2
  14145.  Flags: ENDUSER | s_c
  14146.  Last Modified: 25-FEB-1991    ArticleIdent: Q69145
  14147.  
  14148.  The compiler switches
  14149.  
  14150.     /Fo, /Fe, /F hexnum, /Fm, and /link link-info
  14151.  
  14152.  are ineffective when entered in the Additional Options field of the C
  14153.  Compiler Options dialog box from the Options menu of the Programmer's
  14154.  Workbench (PWB). This is the intended behavior. The functionality of
  14155.  all of these switches is provided through the Compiler, Link, and
  14156.  Build Options dialog boxes from the Options menu.
  14157.  
  14158.  The /Fo switch is overridden by PWB as it creates the .MAK file needed
  14159.  to build the project. To perform this function correctly:
  14160.  
  14161.  1. Set a program list from the Make menu.
  14162.  2. Choose Build Options from the Options menu.
  14163.  3. Choose the Build Directory button.
  14164.  4. Enter the destination path in that field, such as:
  14165.  
  14166.        C:\C600\PROJECT\
  14167.  
  14168.  5. Rebuild the project, and both the .EXE and .OBJ files will be placed
  14169.     in that directory.
  14170.  
  14171.  The other switches are used only to pass information to the linker
  14172.  when the CL command is used outside PWB without the /c option. Because
  14173.  PWB always compiles and links separately, these switches are lost. To
  14174.  utilize these switches from within PWB, select the appropriate options
  14175.  in the Link Options dialog box from the Options menu.
  14176.  
  14177.  
  14178.  62. How to Increase the Size of the PWB Build Status Box Under DOS
  14179.  
  14180.  Product Version(s): 1.00 1.10
  14181.  Operating System:   MS-DOS
  14182.  Flags: ENDUSER | window dialog
  14183.  Last Modified: 22-FEB-1991    ArticleIdent: Q69475
  14184.  
  14185.  In the DOS version of the Microsoft Programmer's WorkBench (PWB)
  14186.  versions 1.00 and 1.10, the status box displayed in the center of the
  14187.  screen during a compile can be made larger by increasing the length of
  14188.  the command being executed.
  14189.  
  14190.  When Build or Rebuild All is selected from the Make menu in PWB, a
  14191.  build status box appears on the screen showing the command currently
  14192.  being executed. Unfortunately, this box is often too small and the
  14193.  current command being displayed gets truncated. One way to increase
  14194.  the size of this box is to increase the length of the NMAKE command
  14195.  line.
  14196.  
  14197.  To increase the length of the NMAKE command line, add the following
  14198.  text (without the quotation marks) to the NMAKE Options dialog box,
  14199.  which can be selected from the Options menu:
  14200.  
  14201.     "                                                /NOLOGO"
  14202.  
  14203.  Be sure to include the spaces when you type this line. Then, when you
  14204.  select Build or Rebuild All from the Make menu, the build status box
  14205.  will be almost as wide as the screen, allowing most of the subsequent
  14206.  commands to fit completely into the box.
  14207.  
  14208.  If you use the PWB "compile" command, or choose the Compile File
  14209.  option from the Make menu, the build status box behaves similarly --
  14210.  the longer the command to be executed command, the larger the box will
  14211.  be.
  14212.  
  14213.  
  14214.  
  14215.  
  14216.  
  14217.  
  14218.  Microsoft CodeView
  14219.  =============================================================================
  14220.  
  14221.  
  14222.  1. Sequential Mode Not Available in CodeView Version 3.00
  14223.  
  14224.  Product Version(s): 3.00 3.01 3.11  | 3.00 3.01 3.11
  14225.  Operating System:   MS-DOS          | OS/2
  14226.  Flags: ENDUSER |
  14227.  Last Modified:  6-FEB-1991    ArticleIdent: Q69065
  14228.  
  14229.  The CodeView sequential mode (/T option) is not available in CodeView
  14230.  version 3.00.
  14231.  
  14232.  In CodeView versions 2.30 and earlier, the /T option caused the
  14233.  debugger to operate in "sequential mode," which means that only a
  14234.  command-line interface was available. You could then type the command
  14235.  "=COM1" to redirect the input and output to the COM port, which
  14236.  allowed debugging via a remote terminal.
  14237.  
  14238.  The /T option and the "=COM1" command are not available in CodeView
  14239.  3.00, 3.10, and 3.11 because of the new windowing environment used in
  14240.  these versions.
  14241.  
  14242.  However, you can still redirect CodeView output to COM1 using the
  14243.  Redirected Output command.
  14244.  
  14245.  The Redirected Output command causes the CodeView debugger to write
  14246.  all subsequent command output to a device, such as another terminal, a
  14247.  printer, or a file. The term "output" includes not only the output
  14248.  from commands but also the command characters that are echoed as you
  14249.  type them.
  14250.  
  14251.  The second greater-than symbol (optional) appends the output to an
  14252.  existing file. If you redirect output to an existing file without this
  14253.  symbol, the existing file will be replaced. For example:
  14254.  
  14255.     >>COM1
  14256.  
  14257.  In the example above, output is redirected to the device designated as
  14258.  COM1 (probably a remote terminal). You might want to enter this
  14259.  command, for example, when you are debugging a graphics program and
  14260.  want CodeView commands to be displayed on a remote terminal while the
  14261.  program display appears on the originating terminal.
  14262.  
  14263.     >>OUTFILE.TXT
  14264.  
  14265.  In the example above, output is redirected to the file OUTFILE.TXT.
  14266.  This command is helpful in keeping a permanent record of a CodeView
  14267.  session.
  14268.  
  14269.  
  14270.  2. How Interrupts Are Handled in CodeView
  14271.  
  14272.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30
  14273.  Operating System:   MS-DOS
  14274.  Flags: ENDUSER | TAR55548
  14275.  Last Modified:  9-AUG-1989    ArticleIdent: Q11817
  14276.  
  14277.  Question:
  14278.  
  14279.  How does CodeView handle interrupt vectors? Does it mask any
  14280.  interrupts when it runs?
  14281.  
  14282.  Response:
  14283.  
  14284.  CodeView saves and restores about 60 interrupt vectors as a safety
  14285.  feature. However, it only redirects the following nine vectors for its
  14286.  own use:
  14287.  
  14288.     0       Divide By 0
  14289.     1       Single Step
  14290.     2       NMI
  14291.     3       Breakpoint
  14292.     9       Keyboard
  14293.     21H     DOS functions
  14294.     22H     DOS terminate
  14295.     23H     ^C
  14296.     24H     Critical Error
  14297.  
  14298.  The remaining estimated 51 vectors are never altered by CodeView
  14299.  unless something else (e.g. the program being debugged) alters them
  14300.  after CodeView has started up. In this case, CodeView restores them to
  14301.  their original value as it exits.
  14302.  
  14303.  When you enter G(o) and let your program run, CodeView relinquishes
  14304.  control and lets all interrupts (except the nine listed above) flow
  14305.  into your application for processing. However, when you hit a
  14306.  breakpoint, the 8259 Programmable Interrupt Controller is masked. This
  14307.  prevents interrupts from coming into your application while your
  14308.  program is suspended. If you enter G(o) again, CodeView reenables
  14309.  interrupts to your application.
  14310.  
  14311.  To avoid a bug in the 8086 family, CodeView masks the interrupt
  14312.  controller during T(race) commands and some P(rogram step) commands.
  14313.  CodeView Versions 2.00 and above solve this restriction by emulating
  14314.  the interrupts for your application.
  14315.  
  14316.  You normally do not single-step or trace real-time code, so this
  14317.  should not be a problem for developers writing interrupt-driven code.
  14318.  However, it is something you should be aware of if you are depending
  14319.  on interrupts to get to your application. For example, it will not
  14320.  work if you enter "T 1000" and expect your program to catch and
  14321.  process interrupts during the trace. You will need to set a breakpoint
  14322.  at the instruction with which you are concerned, then enter G(o).
  14323.  
  14324.  
  14325.  3. Debugging Routines That Are in Libraries
  14326.  
  14327.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30 | 2.20 2.30
  14328.  Operating System:   MS-DOS                        | OS/2
  14329.  Flags: ENDUSER | TAR55321
  14330.  Last Modified: 21-AUG-1989    ArticleIdent: Q11877
  14331.  
  14332.  Question:
  14333.  
  14334.  When CodeView attempts to debug a function from a library module, it
  14335.  is unable to find the source even when that module was compiled with
  14336.  -Zi. It prompts me to "Enter Directory for Program (CR for None)?". I
  14337.  enter the directory in which PROGRAM.C resides, but CodeView cannot
  14338.  find it. Is there any solution other than not placing modules I wish
  14339.  to debug in libraries?
  14340.  
  14341.  Response:
  14342.  
  14343.  This is a consequence of the way the LIB utility works. When adding an
  14344.  object module to a library, LIB records only the source file's base
  14345.  name, not its extension. Therefore, "c:\c\source\module1.c" becomes
  14346.  "c:\c\source\module1" (no extension). When you are debugging an
  14347.  application that calls "module1", CodeView attempts to find
  14348.  "c:\c\source\module1". However, it does not accept the filename you
  14349.  give because the file is really named "module1.c".
  14350.  
  14351.  One way to work around this restriction is to rename your source file
  14352.  from "c:\c\source\module1.c" to "c:\c\source\module1" (no extension)
  14353.  after you have compiled it and put it into a library. This way, the
  14354.  actual name will match the name CodeView is searching for.
  14355.  
  14356.  Another solution is to use Library Manager Version 3.07 (which came
  14357.  with MASM 5.00) or later; this solves the problem by not stripping the
  14358.  file's extension as it is put into a library.
  14359.  
  14360.  
  14361.  4. CVP May Generate a Trap B with Large Programs Under OS/2 1.30
  14362.  
  14363.  Product Version(s): 2.20 2.30 3.00 3.10 3.11
  14364.  Operating System:   OS/2
  14365.  Flags: ENDUSER | gp fault protection violation
  14366.  Last Modified: 25-FEB-1991    ArticleIdent: Q69348
  14367.  
  14368.  Debugging a large application with CodeView under OS/2 version 1.30
  14369.  may result in a Trap B system error. Trap B is a "segment not present"
  14370.  exception, which results from changes that were made to this version
  14371.  of the operating system.
  14372.  
  14373.  In version 1.30 of OS/2, the code for DosPTrace() was made swappable,
  14374.  while in previous versions it was not. DosPTrace() is part of the OS/2
  14375.  API that allows a parent process to control the execution of a child
  14376.  process, and to access the child process's memory directly to insert
  14377.  breakpoints or change data.
  14378.  
  14379.  Because CodeView relies heavily on DosPTrace(), problems arise if this
  14380.  code is swapped from memory. The majority of problems occur when
  14381.  execution reaches a breakpoint while the DosPTrace() code is not
  14382.  present; control should then jump to code that is not currently in
  14383.  RAM.
  14384.  
  14385.  Because large programs (or heavily loaded systems) tend to result in
  14386.  more swapping, this problem appears much more readily when debugging
  14387.  large applications.
  14388.  
  14389.  The only sure workaround for this problem is to turn off swapping
  14390.  while debugging, but it also may help to increase or free up available
  14391.  memory. To disable swapping, modify the MEMMAN switch in CONFIG.SYS as
  14392.  follows:
  14393.  
  14394.     MEMMAN=NOSWAP
  14395.  
  14396.  To increase available memory, either install more memory in the
  14397.  computer itself or terminate all other unnecessary processes before
  14398.  debugging (to remove them from memory).
  14399.  
  14400.  This problem is the result of a design change with OS/2 1.30 and is
  14401.  not a problem with CodeView. This change is being reconsidered for
  14402.  future versions of OS/2. New information will be posted here as it
  14403.  becomes available.
  14404.  
  14405.  
  14406.  5. Using Two Monitors with CodeView
  14407.  
  14408.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30 | 2.20 2.30
  14409.  Operating System:   MS-DOS                        | OS/2
  14410.  Flags: ENDUSER | TAR56465
  14411.  Last Modified: 11-SEP-1989    ArticleIdent: Q11966
  14412.  
  14413.  Question:
  14414.  
  14415.  How do I use CodeView with two monitors? Where is this option
  14416.  documented?
  14417.  
  14418.  Response:
  14419.  
  14420.  Invoke CodeView with the following command:
  14421.  
  14422.     CV /2 PROGRAM
  14423.  
  14424.  This command tells CodeView to put its display on your secondary
  14425.  monitor and lets your program's output go to the default display. This
  14426.  option is documented in the "CodeView Options" section of the
  14427.  "Microsoft CodeView and Utilities Software Development Tools for the
  14428.  MS-DOS Operating System" manual in all products except Microsoft C
  14429.  Version 4.00, where it is documented in the README file.
  14430.  
  14431.  You must have two monitors and two display adapters to use this
  14432.  feature. You must have a monochrome and a non-monochrome monitor;
  14433.  because a monochrome monitor's video memory is in a different
  14434.  location than a CGA, EGA, or VGA's. This is how CodeView implements
  14435.  the /2 option, by writing to both sets of video memory.
  14436.  
  14437.  When you use the /2 option, your program's display appears on the
  14438.  current default adapter and monitor, while the debugging display
  14439.  appears on the secondary adapter and monitor. You can switch which
  14440.  monitor is the current default adapter with the MS-DOS MODE command.
  14441.  "MODE MONO" causes standard output to go to the MDA, while "MODE CO80"
  14442.  causes standard output to go to your CGA, EGA, or VGA.
  14443.  
  14444.  For example, if you have both a CGA and an MDA, you might want to set
  14445.  the CGA up as the default adapter. You could then debug a graphics
  14446.  program with the graphics display appearing on the graphics monitor
  14447.  and the debugging display appearing on the monochrome adapter.
  14448.  
  14449.  
  14450.  6. /L Must Give Full Pathname to .DLL Unless in Current Directory
  14451.  
  14452.  Product Version(s): 2.20 2.30 | 2.20 2.30
  14453.  Operating System:   MS-DOS    | OS/2
  14454.  Flags: ENDUSER |
  14455.  Last Modified: 16-AUG-1989    ArticleIdent: Q47937
  14456.  
  14457.  When debugging dynamic link modules with CodeView Protect (CVP), you
  14458.  must use the /L switch. Before invoking CVP, make certain that the
  14459.  .DLL is in the LIBPATH specified in the CONFIG.SYS file. When invoking
  14460.  CVP with the /L switch, if the .DLL is not located in the current
  14461.  directory, you must specify the full drive and pathname to the DLL. An
  14462.  example is the following:
  14463.  
  14464.     CVP /L d:\os2\dll\stdll.dll stmain.exe
  14465.  
  14466.  In this example, the full drive and pathname are given for the DLL to
  14467.  be debugged. If the full pathname is not given, CodeView will come up.
  14468.  However, you will be unable to step into the DLL. CodeView will simply
  14469.  step over that call.
  14470.  
  14471.  
  14472.  7. CodeView Cannot Trace into Single-Line Functions
  14473.  
  14474.  Product Version(s): 2.20 2.30 | 2.20 2.30
  14475.  Operating System:   MS-DOS    | OS/2
  14476.  Flags: ENDUSER |
  14477.  Last Modified: 15-SEP-1989    ArticleIdent: Q47624
  14478.  
  14479.  CodeView Versions 2.20 and 2.30 do not trace into a function that is
  14480.  contained in a single line of code. For example, if the following
  14481.  program is compiled and loaded into CodeView, an attempt to trace into
  14482.  the function funct() results in the trace stepping over the function,
  14483.  rather than tracing into it.
  14484.  
  14485.  Sample Program
  14486.  --------------
  14487.  
  14488.  /* SIMPLE.C ... a very simplistic sample program                    */
  14489.  
  14490.  int funct(void);
  14491.  int x;
  14492.  
  14493.  void main(void)
  14494.  {
  14495.    x = funct()
  14496.   }
  14497.  
  14498.  /* single-line function. It does nothing more than return a value.  */
  14499.  
  14500.  int funct(void){return 1;}
  14501.  
  14502.  If the above function is modified so that it performs exactly the same
  14503.  task but is located on multiple lines, as follows, then CodeView
  14504.  handles it correctly:
  14505.  
  14506.  int funct(void)
  14507.   {
  14508.     return 1;
  14509.    }
  14510.  
  14511.  
  14512.  
  14513.  8. Trace Stops on Line Following a Loop Before Loop Is Done
  14514.  
  14515.  Product Version(s): 2.20 2.30 | 2.20 2.30
  14516.  Operating System:   MS-DOS    | OS/2
  14517.  Flags: ENDUSER | S_C
  14518.  Last Modified: 15-SEP-1989    ArticleIdent: Q47625
  14519.  
  14520.  In trace mode, CodeView stops on the line following a loop that does
  14521.  not have open and close braces ({}), before the loop is done.
  14522.  
  14523.  When tracing through a loop without the braces ({}), the trace stops
  14524.  on the statement immediately following the loop each time through the
  14525.  loop, giving the impression that the statement is being executed
  14526.  inside the loop. Actual program execution is correct.
  14527.  
  14528.  The following program was compiled with C Version 5.10 with the
  14529.  command line
  14530.  
  14531.     cl /Zi /Od program.c
  14532.  
  14533.  and run using CodeView 2.20, as follows:
  14534.  
  14535.      cv program.exe
  14536.  
  14537.  The trace stops at the printf each time through the loop even though
  14538.  printf is not part of the loop, but does not print anything until the
  14539.  end of the program.
  14540.  
  14541.  Sample Program
  14542.  --------------
  14543.  
  14544.  #include <stdio.h>
  14545.  
  14546.  void main(void)
  14547.  {
  14548.      int i;
  14549.      int count;
  14550.  
  14551.      count = 0;
  14552.  
  14553.      for(i=0;i<3;i++)
  14554.          if(i)
  14555.              count++;
  14556.  
  14557.      printf("Count is %d\n",count);
  14558.  }
  14559.  
  14560.  
  14561.  9. The 37th Call Added to the Calls Menu Corrupts CodeView Screen
  14562.  
  14563.  Product Version(s): 2.20   | 2.20
  14564.  Operating System:   MS-DOS | OS/2
  14565.  Flags: ENDUSER | buglist2.20 fixlist2.30
  14566.  Last Modified: 10-NOV-1989    ArticleIdent: Q50496
  14567.  
  14568.  The CodeView Calls menu shows the current depth of function calls as
  14569.  well as the line number the routine was called from and the parameters
  14570.  passed. The current routine is always at the top and the routine from
  14571.  which the current routine was called is directly below.
  14572.  
  14573.  The routines in the Calls menu are first labeled 0-9, and if you are
  14574.  nested more than ten levels deep, CodeView labels the next 26 calls
  14575.  A-Z, for a display that can accept 36 levels of subroutine calls. If
  14576.  you exceed this limit and then select the Calls menu, the CodeView
  14577.  display becomes corrupted.
  14578.  
  14579.  If the display is corrupted in this manner, the Redraw ("@") dialog
  14580.  command can be used to restore the display to it's original state.
  14581.  
  14582.  The Stack Trace dialog command (K) has the same function as the Calls
  14583.  menu and correctly handles nesting of more than 36 levels deep.
  14584.  
  14585.  Microsoft has confirmed this to be a problem with CodeView Version
  14586.  2.20. This problem was corrected in Version 2.30.
  14587.  
  14588.  
  14589.  10. Quickwatch Seems to Hang When Expanding Very Large Arrays
  14590.  
  14591.  Product Version(s): 3.00 3.10 3.11 | 3.00 3.10 3.11
  14592.  Operating System:   MS-DOS         | OS/2
  14593.  Flags: ENDUSER | s_quickc
  14594.  Last Modified:  6-FEB-1991    ArticleIdent: Q68010
  14595.  
  14596.  When expanding an element in a large array (usually greater than 1000
  14597.  elements, but system dependent), the quickwatch function appears to
  14598.  hang. This apparent problem is caused by the time it takes to re-align
  14599.  the data in the window, and is actually normal operation. If you place
  14600.  the same array element in the Watch Window, it will expand instantly.
  14601.  
  14602.  
  14603.  11. Structures Declared with Near, Far, Pascal, and Fortran
  14604.  
  14605.  Product Version(s): 2.20 2.30 | 2.20 2.30
  14606.  Operating System:   MS-DOS    | OS/2
  14607.  Flags: ENDUSER | S_C S_QuickC buglist2.20 buglist2.30
  14608.  Last Modified: 16-AUG-1989    ArticleIdent: Q47694
  14609.  
  14610.  CodeView is unable to display elements of structures declared with the
  14611.  following keywords:
  14612.  
  14613.     near
  14614.     far
  14615.     pascal
  14616.     fortran
  14617.  
  14618.  Using ?? to display a structure yields the structure table with only
  14619.  one value inside. This value is the first element in the structure.
  14620.  Using w? or ? yields the following error message:
  14621.  
  14622.     Operand types incorrect for this operation
  14623.  
  14624.  Microsoft has confirmed this to be a problem with CodeView Versions
  14625.  2.20 and 2.30. We are researching this problem and will post new
  14626.  information as it becomes available.
  14627.  
  14628.  To work around this problem, recompile without these keywords, or
  14629.  obtain the address of the structure element and put a watch on the
  14630.  memory location.
  14631.  
  14632.  Consider the following large model program:
  14633.  
  14634.  struct { int x;
  14635.           int y;
  14636.           int z;} near a;    /* or far, pascal, fortran */
  14637.  
  14638.  void main(void)
  14639.  {
  14640.    a.x = 1;
  14641.  }
  14642.  
  14643.  To put a watch on a.x, you could issue the following commands:
  14644.  
  14645.  ? &a
  14646.  0x0345:0000       <- result is the address of the structure
  14647.  ww 0x0345:0x0     <- address of x
  14648.  ww 0x0345:0x2     <- address of y (two byte int from x)
  14649.  
  14650.  This puts a watch on the first and second elements (x and y) in the
  14651.  structure.
  14652.  
  14653.  
  14654.  12. Older Vega VGAs Hang CodeView When in VGA Mode
  14655.  
  14656.  Product Version(s): 2.10 2.20 2.30 | 2.20 2.30
  14657.  Operating System:   MS-DOS         | OS/2
  14658.  Flags: ENDUSER |
  14659.  Last Modified: 14-AUG-1989    ArticleIdent: Q27212
  14660.  
  14661.  Question:
  14662.  
  14663.  Why does my old Vega VGA card cause CodeView to hang when I start it
  14664.  in VGA mode? It works properly when I start CodeView when the card is
  14665.  in CGA mode.
  14666.  
  14667.  Response:
  14668.  
  14669.  Some of the older Vega VGAs do not work correctly with CodeView. The
  14670.  Vega VGA card uses the same maskable interrupt for detecting graphics
  14671.  mode as CodeView.
  14672.  
  14673.  We recommend that you contact Vega by calling 1 (800) 248-1850 for
  14674.  advice if you experience this problem.
  14675.  
  14676.  
  14677.  13. Ambiguous Documentation of Enter ASCII (EA) Command
  14678.  
  14679.  Product Version(s): 2.10 2.20 | 2.10 2.20
  14680.  Operating System:   MS-DOS    | OS/2
  14681.  Flags: ENDUSER |
  14682.  Last Modified: 16-AUG-1989    ArticleIdent: Q47764
  14683.  
  14684.  In the "Microsoft C 5.1 Optimizing Compiler" manual, the "CodeView and
  14685.  Utilities" section does not thoroughly document the EA command for
  14686.  CodeView. The following is a more complete explanation:
  14687.  
  14688.     EA address [list]
  14689.  
  14690.     The Enter ASCII (EA) command modifies array to the value of [list].
  14691.     Address refers to what you want to modify. [list] refers to a
  14692.     string literal such as "hello". EA will copy [list] to array. Thus,
  14693.     if you specify address by giving an array, such as an array of
  14694.     characters, the array will have [list] copied into it. However, if
  14695.     you were to give a pointer to a character, then the bytes that make
  14696.     up the pointer will be directly modified, not the block of memory
  14697.     the pointer is pointing at.
  14698.  
  14699.  Consider the following examples:
  14700.  
  14701.  char array[] = "Hello";
  14702.  char *ptr    = "Hello";
  14703.  
  14704.  >EA array "Hi"
  14705.  >EA ptr   "Hi"
  14706.  
  14707.  The result is that the array would contain "Hillo", and ptr will be
  14708.  pointing to some unknown memory location.
  14709.  
  14710.  The array is considered a constant pointer to a block of memory, and
  14711.  as such, any operations on it can only affect the block of memory.
  14712.  However, ptr is a variable; therefore, any operations on it affect the
  14713.  value of ptr, which happens to be a two- or four-byte number. That
  14714.  number happens to refer to a location in memory.
  14715.  
  14716.  If you want to changed the block of memory that ptr points to, you
  14717.  must do the following:
  14718.  
  14719.     >EA &ptr[0] "Hi"
  14720.  
  14721.  Essentially, this takes the address of the character that ptr is
  14722.  pointing at, gives a constant address, and thus modifies the block of
  14723.  memory there. To clarify, imagine you have a character located some
  14724.  place in memory. To move a character, you must make a copy of it to
  14725.  some other memory location; it is not possible to take its address and
  14726.  modify the address directly to change where the character is located.
  14727.  Thus, the address of that character is always a constant value. ptr[0]
  14728.  happens to be a character located someplace in memory. As such, the
  14729.  address of that specific character is a constant value. Since a
  14730.  constant cannot be modified, EA changes the block of memory starting
  14731.  at where the constant pointer is pointing.
  14732.  
  14733.  
  14734.  14. Debugging of DLLs That Do Not Have the .DLL Extension
  14735.  
  14736.  Product Version(s): 2.30   | 2.30
  14737.  Operating System:   MS-DOS | OS/2
  14738.  Flags: ENDUSER |
  14739.  Last Modified: 21-AUG-1989    ArticleIdent: Q47938
  14740.  
  14741.  CodeView Protect (CVP) Version 2.30 has the ability to debug DLLs that
  14742.  are called with DosLoadModule(). DosLoadModule() can load DLLs that
  14743.  do not have the .DLL extension. However, CVP 2.30 cannot debug DLLs
  14744.  that do not have the .DLL extension. If you want to debug DLLs that
  14745.  are called with DosLoadModule, they must have the .DLL extension.
  14746.  
  14747.  Microsoft is aware of this limitation with CodeView Protect 2.30. We
  14748.  are researching this problem and will post new information as it
  14749.  becomes available.
  14750.  
  14751.  
  14752.  15. Resident Software May Cause "Internal Debugger Error 80"
  14753.  
  14754.  Product Version(s): 1.x 2.00 2.10 2.10 2.30
  14755.  Operating System:   MS-DOS
  14756.  Flags: ENDUSER |
  14757.  Last Modified: 29-AUG-1989    ArticleIdent: Q47989
  14758.  
  14759.  Question:
  14760.  
  14761.  Sometimes when I run CodeView, I get an "Internal Debugger Error 80"
  14762.  message. What causes this?
  14763.  
  14764.  Response:
  14765.  
  14766.  Internal Debugger Error messages are usually caused by problems in
  14767.  your MS-DOS environment; the most likely cause is the presence of
  14768.  memory-resident software, commonly referred to as TSRs (terminate-
  14769.  and-stay-resident software).
  14770.  
  14771.  For example, running CodeView with Borland's Sidekick loaded has been
  14772.  known to cause "Internal Debugger Error 80" and "R6002: Floating Point
  14773.  not loaded" error messages. "Internal Debugger Error 80" has also been
  14774.  reported when CodeView was run with Software Solutions' "Software
  14775.  Carousel" loaded into memory.
  14776.  
  14777.  CodeView Versions 2.00 and later have become increasingly more
  14778.  sensitive to TSRs. If you receive an Internal Debugger Error message,
  14779.  or you are experiencing strange problems within CodeView, make sure
  14780.  you are running CodeView with no memory-resident software loaded
  14781.  (including, but not limited to, device drivers, screen savers,
  14782.  keyboard enhancers, command-line editors, etc.). Disabling your
  14783.  resident software, but not rebooting, may not completely remove its
  14784.  interference, so be sure to "boot clean" when trying to resolve a
  14785.  problem of this type.
  14786.  
  14787.  If you continue to receive the error message without memory-resident
  14788.  programs, try running CodeView on some other program to see if the
  14789.  error is related to particular code. If the error is related to the
  14790.  specific code, and you are unable to determine the cause, you may want
  14791.  to call Microsoft Product Support for assistance at (206) 454-2030.
  14792.  
  14793.  If the error is not dependent on your code, the problem might be the
  14794.  particular sequence of CodeView commands you execute. Make a note of
  14795.  what operations you performed, i.e., the sequence of Trace, Go, Watch,
  14796.  Tracepoint, etc., commands that were issued, and contact Microsoft
  14797.  Product Support via phone, letter, or Microsoft OnLine.
  14798.  
  14799.  
  14800.  16. CVP Restart Command (Dialog Version) Doesn't Properly Set argc
  14801.  
  14802.  Product Version(s): 2.20 2.30 | 2.20 2.30
  14803.  Operating System:   MS-DOS    | OS/2
  14804.  Flags: ENDUSER | buglist2.20 buglist2.30
  14805.  Last Modified: 28-AUG-1989    ArticleIdent: Q48000
  14806.  
  14807.  When using the dialog version of the Restart command, you can restart
  14808.  your program with command-line arguments; however, under CodeView
  14809.  Protect (CVP) Versions 2.20 and 2.30, argc does not get properly set.
  14810.  
  14811.  The Dialog Restart command is often used to restart a program with
  14812.  command line arguments. For example, you could use the following:
  14813.  
  14814.     L arg1 arg2 arg3
  14815.  
  14816.  This example restarts the current executable file, retaining any
  14817.  breakpoints, watchpoints, and tracepoints, with arg1, arg2, and arg3
  14818.  loaded into argv[1], argv[2], and argv[3], respectively. Argv[0] is
  14819.  always set to the name of the current executable file. Argc, at this
  14820.  point, should be set to four. The problem presents itself here; argc
  14821.  either remains unchanged from the value it was initially set to when
  14822.  CodeView was started, or is decremented by one. If, for example,
  14823.  CodeView is started with two command-line arguments (argc would then
  14824.  be set to three) and then executed, the previous example argc (which
  14825.  should then set argc to four) would remain unchanged. When using the
  14826.  Dialog Restart command and specifying fewer arguments than were
  14827.  specified at start up, argc sometimes is decremented by one.
  14828.  
  14829.  Microsoft has confirmed this to be a problem with CodeView Versions
  14830.  2.20 and 2.30. We are researching this problem and will post new
  14831.  information as it becomes available.
  14832.  
  14833.  
  14834.  17. Cannot Load CTRL+Z-Terminated Files with Less than 129 Bytes
  14835.  
  14836.  Product Version(s): 1.00 1.10 2.00 2.10
  14837.  Operating System:   MS-DOS
  14838.  Flags: ENDUSER | buglist1.00 buglist1.10 buglist2.00 buglist2.10 qfbv
  14839.  Last Modified:  4-NOV-1988    ArticleIdent: Q26548
  14840.  
  14841.  Problem:
  14842.  
  14843.  When using the F(ile) O(pen) command to load a text file which has
  14844.  less than 129 bytes and is terminated with a hex 1A (decimal 26,
  14845.  CTRL+Z, EOF), CodeView issues the error message "Not a text file." If
  14846.  the CTRL+Z character is removed, or if the file size is 129 bytes or
  14847.  greater, CodeView has no problem loading it.
  14848.  
  14849.  Response:
  14850.  
  14851.  Microsoft has confirmed this to be a problem in Version 1.00, 1.10,
  14852.  2.00, and 2.10. We are researching this problem and will post new
  14853.  information as it becomes available.
  14854.  
  14855.  
  14856.  18. Debugging High Resolution EGA or VGA Graphics
  14857.  
  14858.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30 | 2.20 2.30
  14859.  Operating System:   MS-DOS                        | OS/2
  14860.  Flags: ENDUSER | TAR61178
  14861.  Last Modified: 14-AUG-1989    ArticleIdent: Q23308
  14862.  
  14863.  Question:
  14864.  
  14865.  I am trying to debug a program that does EGA or VGA graphics. When I
  14866.  continue from a breakpoint after the program has painted the screen,
  14867.  the screen is not as it was before the breakpoint. I think that all
  14868.  colors have been turned to black, but I am not sure.
  14869.  
  14870.  I tried this procedure with no switches, with /s, and with /t. The
  14871.  program is using the EGA in 640x350 16-color mode. Is this supposed to
  14872.  work? If it does not work, why not? What will you do about supporting
  14873.  the higher modes for the new machines such as the Personal System 2
  14874.  series from IBM?
  14875.  
  14876.  Response:
  14877.  
  14878.  This behavior is partly related to the size of the buffer that
  14879.  CodeView creates for storing screen information. If you are running on
  14880.  a CGA, EGA or VGA board, this buffer is by default 16K. If you are running
  14881.  on a monochrome board, this buffer is by default 4K. As you are
  14882.  finding, 16K is simply not enough memory for a color image using
  14883.  640x350 resolution (the maximum resolution supported would be
  14884.  640x200).
  14885.  
  14886.  One of the reasons why CodeView does not have the ability to handle
  14887.  the buffer requirements of an EGA image is that the EGA registers are
  14888.  write only. There is no way for CodeView to detect what mode the EGA
  14889.  currently is in so it can adjust the size accordingly. Also note that
  14890.  with the different resolutions the image is stored in different memory
  14891.  locations. The black on black characters may simply be a blank image
  14892.  because CodeView cannot tell that the resolution is different and
  14893.  therefore the image is located elsewhere.
  14894.  
  14895.  With the PS/2 machines this is not an issue because the EGA registers
  14896.  have read capability. We are reviewing this with regard to future
  14897.  implementations of CodeView.
  14898.  
  14899.  The following are some ways to work around this current limitation:
  14900.  
  14901.  1. Try writing a routine that will place the display in the desired
  14902.     mode before you invoke CodeView. CodeView will be able to judge
  14903.     which mode is currently in effect and can locate the image in the
  14904.     correct area of memory. Note that the image will not be displayed
  14905.     in color. You will only see the higher resolution since the buffer
  14906.     is not big enough.
  14907.  
  14908.  2. Debug your applications that run in high resolution graphics with a
  14909.     second monitor (use the /2 switch). Since the display is going to a
  14910.     different screen, CodeView will not have to worry about changing
  14911.     the video modes or the buffering.
  14912.  
  14913.  
  14914.  19. CodeView Version 2.20 Is Called CVPCK.EXE by DOS Version 2.10
  14915.  
  14916.  Product Version(s): 2.20
  14917.  Operating System:   MS-DOS
  14918.  Flags: ENDUSER | CV CVPCK CVPACK 2.x
  14919.  Last Modified: 21-SEP-1989    ArticleIdent: Q48689
  14920.  
  14921.  Question:
  14922.  
  14923.  When trying to invoke CodeView Version 2.20 under DOS Version 2.10 or
  14924.  2.11, I get the messages "Cannot Find CVPCK.EXE" and "Please enter new
  14925.  program spec:". How can I get CodeView 2.20 to work under DOS Versions
  14926.  2.1x?
  14927.  
  14928.  Response:
  14929.  
  14930.  If you rename CV.EXE to CVPCK.EXE, you can run CodeView Version 2.20
  14931.  under DOS Version 2.10 or 2.11. You must also rename CV.HLP to C.HLP
  14932.  to make the on-line help accessible.
  14933.  
  14934.  CodeView Version 2.20 is included with C Version 5.10, FORTRAN Version
  14935.  4.10, Pascal Version 4.00, and Macro Assembler (MASM) Version 5.10.
  14936.  
  14937.  Many people mistakenly assume that CodeView is actually looking for
  14938.  CVPACK.EXE, which also comes with the software packages listed above.
  14939.  If you rename CVPACK.EXE to CVPCK.EXE and then try to run CVPCK.EXE,
  14940.  you will receive the error message "overlay not found." If you receive
  14941.  this error, delete CVPCK.EXE, copy both CV.EXE and CVPACK.EXE from the
  14942.  installation disks, and follow the instructions above.
  14943.  
  14944.  Under DOS Versions 3.x, a C program's name is available from argv[0].
  14945.  Under DOS Versions 2.x, argv[0] always equals the letter "C", so
  14946.  programs that need to find themselves under DOS Versions 2.x also have
  14947.  their own names hard coded as the filename to locate. Unfortunately,
  14948.  the hard-coded name within CodeView Version 2.20 is "CVPCK.EXE", so
  14949.  this is what it looks for under DOS Versions 2.x.
  14950.  
  14951.  
  14952.  20. CodeView String Search Length Limited to 19 Characters
  14953.  
  14954.  Product Version(s): 2.10 2.20 2.30 | 2.10 2.20 2.30
  14955.  Operating System:   MS-DOS         | OS/2
  14956.  Flags: ENDUSER | SR# G890810-24574 P_WinSDK
  14957.  Last Modified: 19-SEP-1989    ArticleIdent: Q48863
  14958.  
  14959.  CodeView Versions 2.20 and 2.30 and CodeView for Windows Version 2.10
  14960.  have a 19-character limit in the "Find..." option of the Search menu,
  14961.  even though the dialog box is much longer than 19 characters. Entering
  14962.  a search string longer than 19 characters results in one of two error
  14963.  messages.
  14964.  
  14965.  If the search string entered is 20 or 21 characters long, CodeView
  14966.  displays the erroneous message "No match of regular expression," even
  14967.  if the search string does exist in the file. If the search string is
  14968.  22 characters or more in length, CodeView displays the more
  14969.  appropriate message "Regular expression too long."
  14970.  
  14971.  Although 19 characters sometimes can be limiting, CodeView does
  14972.  substring searches so that searching for the following
  14973.  
  14974.     AFunctionWithAVeryL
  14975.  
  14976.  finds the following string:
  14977.  
  14978.     AFunctionWithAVeryLongName
  14979.  
  14980.  You will have problems only if you have both of the following and
  14981.  you are trying to locate one, but not the other:
  14982.  
  14983.     AFunctionWithAVeryLongName()
  14984.     AFunctionWithAVeryLongParameterList(a,b,c,d,e,f,g,h,i,j)
  14985.  
  14986.  In this case, you won't be able to specify search strings long enough
  14987.  to distinguish between the two. However, you can repeatedly use the
  14988.  Next command from the Search menu to find the next occurrence of the
  14989.  following:
  14990.  
  14991.     AFunctionWithAVeryL
  14992.  
  14993.  The Next command will find whichever of the above two function names
  14994.  that comes next in the source file.
  14995.  
  14996.  
  14997.  21. Files, Environment Inaccessible Only While Running under CVP
  14998.  
  14999.  Product Version(s): 2.20
  15000.  Operating System:   OS/2
  15001.  Flags: ENDUSER |
  15002.  Last Modified: 30-NOV-1989    ArticleIdent: Q49313
  15003.  
  15004.  Due to combined problems in both protected-mode CodeView (CVP) Version
  15005.  2.20 and OS/2 Version 1.00 or 1.10, programs that correctly access
  15006.  data files and/or system environment information could fail when
  15007.  attempting this same access while running under CVP 2.20. This is
  15008.  strictly a protected-mode problem and is unrelated to the use of
  15009.  CodeView under MS-DOS. The sample program at the end of this article
  15010.  can be used to demonstrate this problem.
  15011.  
  15012.  The system environment information includes such items as the path and
  15013.  other environment variables, as well as the current working directory
  15014.  for each disk drive. This information is normally available to an
  15015.  executing program, but for a program being debugged with CVP 2.20
  15016.  running under OS/2 1.00 or 1.10, most of this environment information
  15017.  is inaccessible.
  15018.  
  15019.  This inaccessibility is a result of environment handling problems in
  15020.  both CVP 2.20 and OS/2 Version 1.00. Since CodeView is run from the
  15021.  command prompt, all the current environment information is available
  15022.  to CodeView itself, but the program being debugged is given its own
  15023.  new screen group in which to run. It is in this new screen group that
  15024.  the current environment information is lost because it is not carried
  15025.  over by either OS/2 or CodeView.
  15026.  
  15027.  Although the OS/2 problem has been corrected in Version 1.10, the
  15028.  CodeView problem still prevents access to the environment. Therefore,
  15029.  upgrading either CodeView or OS/2 alone does not solve the problem.
  15030.  Only with CodeView Version 2.30 running under OS/2 Version 1.10 is the
  15031.  problem eliminated.
  15032.  
  15033.  There may be some environment information available to the program
  15034.  being debugged, but only if it was set in the CONFIG.SYS file at start
  15035.  up. Since each new screen group is begun with a copy of the original
  15036.  start-up system environment, any SET commands carried out in the
  15037.  CONFIG.SYS file will then be duplicated for all subsequent screen
  15038.  groups.
  15039.  
  15040.  Otherwise, if a program needs access to environment variables that
  15041.  were set in the current screen group where CodeView will be invoked,
  15042.  then the only way to make the information available while debugging is
  15043.  to temporarily hard code the information into the program. After
  15044.  debugging, the program can be changed back to using the actual
  15045.  environment strings.
  15046.  
  15047.  The only other alternative to temporarily hard code the environment
  15048.  information into the program is to set the environment variables in the
  15049.  CONFIG.SYS file at boot time, rather than setting them in the current
  15050.  screen group.
  15051.  
  15052.  The only reason a file access will fail only while the program is
  15053.  running under CodeView is if the program is assuming the file is in
  15054.  the current working directory on the current or another drive.
  15055.  
  15056.  If this is the case, then one of the following workarounds may be used
  15057.  to gain access to files while debugging:
  15058.  
  15059.  1. Use full pathnames for all file accesses, since this alleviates any
  15060.     dependency on knowing the current working directory for the drive
  15061.     that is being accessed. If it is not feasible to have hard-coded
  15062.     pathnames in the completed program, at least adding the full paths
  15063.     temporarily will allow debugging.
  15064.  
  15065.  2. Put the files to be accessed in the root directory of the boot
  15066.     drive. This allows them to be found even under CodeView because
  15067.     with no environment information, the current working directory
  15068.     defaults to the root of the boot drive.
  15069.  
  15070.  3. Use a two-monitor debugging setup and start CodeView with the /2
  15071.     option. In this situation, CVP does not need to start a new screen
  15072.     group for the program being debugged because it can run it on the
  15073.     second monitor. Thus, the current environment information is
  15074.     available to both programs because they are both running in the
  15075.     current screen group.
  15076.  
  15077.     For more information about debugging with a two-monitor setup, query
  15078.     on the following:
  15079.  
  15080.        CodeView two monitor debugging
  15081.  
  15082.  The following C program can be used to demonstrate this environment
  15083.  problem:
  15084.  
  15085.  Program Example:
  15086.  ---------------
  15087.  
  15088.      /* TEST.C - shows inaccessible files under CodeView
  15089.  
  15090.         Compile with : CL /Zi /Od test.c
  15091.         Run with : test <filename>      where <filename> is any file
  15092.                         in the current directory.  The file will be
  15093.                         opened properly.
  15094.         Begin CVP with : CVP test <filename>     where <filename> is
  15095.                         the same as before. The file will not be
  15096.                         found when the program is run or traced.
  15097.      */
  15098.  
  15099.      #include <stdio.h>
  15100.      void main(int, char *[]);
  15101.  
  15102.      void main(int argc, char *argv[])
  15103.      {
  15104.          FILE *dfile ;
  15105.  
  15106.          if ((dfile = fopen(argv[1], "rb")) == NULL) {
  15107.              perror ("") ;
  15108.              printf ("Cannot open file '%s'.\n\n", argv[1]) ;
  15109.          }
  15110.          else {
  15111.              printf("File %s opened OK.\n\n", argv[1]) ;
  15112.              fclose (dfile) ;
  15113.          }
  15114.      }
  15115.  
  15116.  
  15117.  22. COM Port Time-Out Halts Redirection of CVP to Remote Terminal
  15118.  
  15119.  Product Version(s): 2.20 2.30
  15120.  Operating System:   OS/2
  15121.  Flags: ENDUSER |
  15122.  Last Modified: 27-OCT-1989    ArticleIdent: Q49376
  15123.  
  15124.  When using protected-mode CodeView (CVP) under OS/2, there is a
  15125.  problem with the serial communications (COM) ports timing out after 60
  15126.  to 90 seconds of inactivity. This time-out makes it essentially
  15127.  impossible to do remote terminal debugging with CVP. Once the time-out
  15128.  occurs, no further input is accepted from the remote terminal. The
  15129.  only workaround is to quit CodeView and begin again, or to do a break
  15130.  and then restart the redirection to the COM port.
  15131.  
  15132.  The CodeView Debugger allows redirection of input and output to a file
  15133.  or device. This procedure is commonly used to set up a remote (dumb)
  15134.  terminal for CodeView input and output, while the PC screen is used
  15135.  for displaying the program input and output. The terminal is connected
  15136.  through a COM port, which eliminates the need for a second video
  15137.  adapter as is required when using two monitors with the /2 option.
  15138.  Entering "=COM1" at the CodeView command prompt enables input and
  15139.  output redirection to the device designated as COM1.
  15140.  
  15141.  This debugging arrangement works great with CodeView under MS-DOS, but
  15142.  it becomes unworkable with CVP under OS/2 because the internal calls
  15143.  that are used to set up the redirection do not account for time-outs
  15144.  due to inactivity. Thus, if you are entering commands from the remote
  15145.  terminal at a steady pace, everything proceeds smoothly. However, if you
  15146.  stop and wait for more than about 60 seconds without doing any input,
  15147.  the port will time-out and leave you stranded because the keyboard no
  15148.  longer responds.
  15149.  
  15150.  In a normal debugging session, it is quite likely that there would be
  15151.  many instances greater than 60 seconds where input is not yet needed
  15152.  or desired; therefore, this situation quickly becomes intolerable. The
  15153.  only way to regain control is to enter CTRL+C at the PC keyboard,
  15154.  which ends the redirection. At that point, you could enter "=COM1"
  15155.  again on the PC keyboard to restart the redirection if you so desired.
  15156.  
  15157.  
  15158.  23. CVP 2.30 Does Not Allow Pathnames for DLLs Specified with /L
  15159.  
  15160.  Product Version(s): 2.30
  15161.  Operating System:   OS/2
  15162.  Flags: ENDUSER | buglist2.30
  15163.  Last Modified: 10-OCT-1989    ArticleIdent: Q49377
  15164.  
  15165.  Protected-mode CodeView (CVP) Version 2.30 allows debugging of dynamic
  15166.  link libraries (DLLs) by specifying their names on the command line
  15167.  with the /L switch. Because of a problem exclusive to CVP 2.30, this
  15168.  particular version of the debugger does not allow a pathname to be
  15169.  used with /L to specify the DLL's location in another directory.
  15170.  Therefore, all DLLs to be debugged with CVP 2.30 must reside in the
  15171.  current working directory.
  15172.  
  15173.  Since DLLs are also required to be in a directory that is on the
  15174.  LIBPATH, two copies of the DLL may need to be resident on the disk,
  15175.  unless the current working directory is also a LIBPATH directory.
  15176.  
  15177.  Microsoft has confirmed this to be a problem with CodeView Version
  15178.  2.30. We are researching this problem and will post new information as
  15179.  it becomes available.
  15180.  
  15181.  When tracing a program under CodeView that calls DLLs, the only way to
  15182.  trace into the code of a particular DLL is if the DLL was specified
  15183.  ahead of time on the command line with /L when CVP was invoked. If a
  15184.  program statement is traced that calls a DLL that was not specified by
  15185.  /L, then CodeView executes all the code in the DLL and returns control
  15186.  back at the line following the call to the DLL. Thus, the call is
  15187.  handled as if the step command, rather than the trace command, had
  15188.  been used.
  15189.  
  15190.  You can indicate only one DLL with the /L switch, so debugging
  15191.  multiple DLLs requires multiple /L switches. Normally, the switch is
  15192.  followed by a space and the name of the DLL to be debugged, and if the
  15193.  DLL is not located in the current directory, a path may precede the
  15194.  DLL name. It is only with CVP 2.30 that this becomes a problem because
  15195.  a pathname is not recognized with this version, so tracing into the
  15196.  DLL is prevented.
  15197.  
  15198.  Unfortunately, CodeView does not display error messages for improper
  15199.  use of the /L switch, so if the DLL is not found, there is no message
  15200.  indicating this. Instead, CodeView does not allow debugging of the
  15201.  improperly specified DLL. Use of a pathname with /L with CVP 2.30
  15202.  causes this same behavior.
  15203.  
  15204.  The only workaround for DLL debugging with CVP 2.30 is to keep a copy
  15205.  of the DLL in the current working directory from which CodeView is
  15206.  invoked. Thus, if the current directory is not a directory specified
  15207.  on the LIBPATH, there must be two copies of the DLL on the disk. It is
  15208.  very important that the two copies are exactly the same because
  15209.  differing code makes any attempts at debugging very difficult and
  15210.  confusing.
  15211.  
  15212.  A common practice is to put a period (.) as the first directory on
  15213.  the LIBPATH because this makes the current working directory a LIBPATH
  15214.  directory, eliminating the need for two copies of the DLL. More
  15215.  information on this practice can be found by querying on the
  15216.  following words:
  15217.  
  15218.     CodeView DLL debugging and libpath
  15219.  
  15220.  
  15221.  24. Label Finding Command Does Whole Word Search, Not Text Search
  15222.  
  15223.  Product Version(s): 2.20 2.30 | 2.20 2.30
  15224.  Operating System:   MS-DOS    | OS/2
  15225.  Flags: ENDUSER |
  15226.  Last Modified: 27-OCT-1989    ArticleIdent: Q49378
  15227.  
  15228.  In CodeView Versions 2.20 and 2.30, under the Search menu is the Label
  15229.  option for searching for a label. Unlike the Find option, which
  15230.  searches the source code for any regular expression, the Label option
  15231.  searches the executable code for an assembly language label.
  15232.  
  15233.  This search is not a text search and does not accept regular
  15234.  expressions. The only way to find a label is to specify the entire
  15235.  label name as the search string. In addition, if the Case Sense option
  15236.  is selected on the Options menu, the label is found only if the case
  15237.  of each character matches exactly.
  15238.  
  15239.  For example, if you want to find the code for the standard C
  15240.  stack-checking function "_chkstk", choose Search Label, and type in
  15241.  "__chkstk" (without the quotation marks), and press ENTER. This
  15242.  switches you into assembly mode, if you weren't there already, and
  15243.  puts the line with the __chkstk label at the top of the window. The
  15244.  two underscores are required since C appends an underscore to the
  15245.  front of all labels and the original function name is "_chkstk".
  15246.  
  15247.  You will receive the error message "Unknown Symbol" if the label
  15248.  cannot be found or if you mistype or incompletely type the correct
  15249.  name. For example, "_chkstk", "chkstk", "__chk", and "__chkstks" all
  15250.  fail to find a match in the above example. If Case Sense is on,
  15251.  searching for the label "__CHKSTK" also results in failure.
  15252.  
  15253.  
  15254.  25. The Assemble Command with ADD Instructions
  15255.  
  15256.  Product Version(s): 2.20 2.30  | 2.20 2.30
  15257.  Operating System:   MS-DOS | OS/2
  15258.  Flags: ENDUSER | buglist2.20 buglist2.30
  15259.  Last Modified:  9-AUG-1989    ArticleIdent: Q40225
  15260.  
  15261.  Problem:
  15262.  
  15263.  In CodeView, I'm using the assemble command to change my ADD
  15264.  instruction, and it changes all the code from that point on.
  15265.  
  15266.  Response:
  15267.  
  15268.  If you had the instruction ADD AL,44, for example, and you wanted to
  15269.  change the 44 to 45 (or any other number), you could use the Assemble
  15270.  command to do it. The Microsoft Macro Assembler generates a 04 44 for
  15271.  that instruction; however, when changing the 44 to 45, CodeView
  15272.  generates an 80 C0 45, which is still the correct instruction of ADD
  15273.  AL,45. However, it's a 3-byte instruction. Inserting one extra byte
  15274.  into your code will cause each op code from that point on to be off by
  15275.  one.
  15276.  
  15277.  Microsoft has confirmed this to be a problem in Versions 2.20
  15278.  and 2.30 of CodeView. We are researching this problem and will
  15279.  post new information as it becomes available.
  15280.  
  15281.  
  15282.  
  15283.  26. CV Prior to 3.00 Needs /S for Mouse to Appear in OS/2 DOS Box
  15284.  
  15285.  Product Version(s): 1.00 1.10 1.11 2.00 2.10 2.20 2.30 2.35
  15286.  Operating System:   MS-DOS
  15287.  Flags: ENDUSER |
  15288.  Last Modified:  6-FEB-1991    ArticleIdent: Q23646
  15289.  
  15290.  With all versions of real-mode CodeView (CV) earlier than version
  15291.  3.00, the mouse cursor does not display when running in a DOS session
  15292.  under OS/2 in the DOS compatibility box.
  15293.  
  15294.  The situation exists because the mouse draws the pointer only in video
  15295.  page zero, while CodeView uses video page one. This problem is caused
  15296.  by OS/2 itself because the mouse cursor works normally under DOS.
  15297.  
  15298.  To work around this limitation with CV 1.x or 2.x, invoke CodeView
  15299.  with the /S switch so screen swapping is used as the method of screen
  15300.  exchange. This method forces CodeView to swap in and out of page zero.
  15301.  
  15302.  Beginning with version 3.00, CodeView detects whether it is running in
  15303.  a DOS session under OS/2, and if so, automatically starts up with /S
  15304.  as the default in order to make the mouse visible.
  15305.  
  15306.  
  15307.  27. CVPACK /p Causes a More Complete Packing
  15308.  
  15309.  Product Version(s): 2.20
  15310.  Operating System:   MS-DOS
  15311.  Flags: ENDUSER |
  15312.  Last Modified: 28-MAR-1989    ArticleIdent: Q38020
  15313.  
  15314.  When you are unable to load your program into CodeView, try packing
  15315.  the program with CVPACK.EXE. If you want a more complete packing of
  15316.  your executable, then run CVPACK.EXE with the /p option. This option
  15317.  will take longer to run, but it will generate better results.
  15318.  
  15319.  The /p option for CVPACK.EXE is documented on Page update-17 in the
  15320.  "Microsoft C 5.1 Optimizing Compiler, CodeView and Utilities,
  15321.  Microsoft Editor Mixed-Language Programmer's Guide."
  15322.  
  15323.  Normally, CVPACK discards unused debugging information and appends
  15324.  it to the file. With the /p option, CVPACK discards the unused
  15325.  debugging information, then proceeds to sort it throughout the
  15326.  executable file.
  15327.  
  15328.  
  15329.  28. Mouse Cursor Disappears After Right Click
  15330.  
  15331.  Product Version(s): 2.20 2.30 | 2.20 2.30
  15332.  Operating System:   MS-DOS    | OS/2
  15333.  Flags: ENDUSER |
  15334.  Last Modified: 14-AUG-1989    ArticleIdent: Q38021
  15335.  
  15336.  Problem:
  15337.  
  15338.  I have just clicked my right mouse button to acknowledge a pop-up
  15339.  message and my mouse cursor has disappeared. I had just clicked my
  15340.  right mouse button before for another operation.
  15341.  
  15342.  Note: This also occurs when you hit any button on the three button
  15343.  Logitech mouse.
  15344.  
  15345.  Response:
  15346.  
  15347.  To get your mouse cursor back again, redraw the screen with the "@"
  15348.  command.
  15349.  
  15350.  
  15351.  29. CVP 2.30 Hangs When /O Is Specified, but Child Is Not Debugged
  15352.  
  15353.  Product Version(s): 2.30
  15354.  Operating System:   OS/2
  15355.  Flags: ENDUSER | buglist2.30
  15356.  Last Modified: 27-OCT-1989    ArticleIdent: Q49381
  15357.  
  15358.  Beginning with protected-mode CodeView (CVP) Version 2.30, you can
  15359.  debug child processes from within a parent process's CodeView session
  15360.  by invoking CodeView with the /O switch. When the program is executed
  15361.  to the point where the child process is invoked, CodeView displays a
  15362.  prompt showing you the child's process ID (PID) and asks, "Do you wish
  15363.  to debug (y/n)?". Entering "y" brings up the child process and allows
  15364.  you to debug it. Pressing "n" should cause the child to execute
  15365.  without any debugging.
  15366.  
  15367.  Unfortunately, there is a problem in CVP 2.30 that causes CodeView to
  15368.  hang if you answer no to debugging the child. The only workaround is
  15369.  to always answer yes when prompted to debug a child process, or to
  15370.  invoke CodeView without the /O switch because this prevents the prompt
  15371.  entirely.
  15372.  
  15373.  Microsoft has confirmed this to be a problem with CodeView Version
  15374.  2.30. We are researching this problem and will post new information as
  15375.  it becomes available.
  15376.  
  15377.  If the program you are debugging is not a Presentation Manager (PM)
  15378.  application, you may be able to kill the CodeView session if it should
  15379.  hang as a result of answering "n" to the debugging child process. You
  15380.  must switch to the Task Manager and use it to close the hung CodeView
  15381.  session. If you are working on a PM application, the only workaround
  15382.  may be to reboot the computer.
  15383.  
  15384.  
  15385.  30. Cannot Debug Code in Overlays in Small or Compact Model
  15386.  
  15387.  Product Version(s): 2.10 2.20 2.30
  15388.  Operating System:   MS-DOS
  15389.  Flags: ENDUSER |
  15390.  Last Modified: 14-AUG-1989    ArticleIdent: Q27128
  15391.  
  15392.  Question:
  15393.  
  15394.  I have a C program, compiled with Microsoft C Version 5.00, which
  15395.  consists of several modules linked together as overlays. I am not able
  15396.  to trace into code in the overlays. I compiled in the default memory
  15397.  model. What is wrong?
  15398.  
  15399.  Response:
  15400.  
  15401.  The modules must be compiled in medium or large memory model to be
  15402.  overlaid. In the default model (small), or in the compact model, there
  15403.  is only one code segment, which cannot be overlaid. The main module is
  15404.  always resident and cannot be overlaid. You must use the compile
  15405.  option /AH, /AL, or /AM.
  15406.  
  15407.  
  15408.  31. Code that Will Hang IBM XTs or Compatibles
  15409.  
  15410.  Product Version(s): 1.00
  15411.  Operating System:   MS-DOS
  15412.  Flags: ENDUSER | TAR57675 buglist1.00
  15413.  Last Modified:  8-NOV-1988    ArticleIdent: Q23856
  15414.  
  15415.  Problem:
  15416.  
  15417.  The following code will hang IBM XTs or compatibles if specific
  15418.  commands are issued when inside of CodeView:
  15419.  
  15420.     #include <stdio.h>
  15421.     main()
  15422.     {
  15423.          int n;
  15424.          double f;
  15425.  
  15426.          while(1)   {
  15427.                     scanf("%d",&n);
  15428.                 f=1.0;
  15429.                 while (n>1) f=f*n--;
  15430.                    printf("%.101g%c",f,'\n');
  15431.                     }
  15432.     }
  15433.  
  15434.  For the program to fail in CodeView, first set a breakpoint at
  15435.  instruction f=1.0. Issue the Go command, then the P command.
  15436.  
  15437.  Response:
  15438.  
  15439.  This is corrected in CodeView version 2.20.
  15440.  
  15441.  A workaround is to place a breakpoint at the instruction before or
  15442.  after the assignment to f.
  15443.  
  15444.  
  15445.  32. /DOSSEG Link Switch Fails to Make CodeView .exe
  15446.  
  15447.  Product Version(s): 2.20 2.30
  15448.  Operating System:   MS-DOS
  15449.  Flags: ENDUSER |
  15450.  Last Modified:  9-AUG-1989    ArticleIdent: Q38163
  15451.  
  15452.  Question:
  15453.  
  15454.  CodeView is failing on an .exe produced using the /DOSSEG linker
  15455.  switch. CodeView responded to an attempt to run with this .exe
  15456.  with a "not enough space" diagnostic. What is the problem?
  15457.  
  15458.  Response:
  15459.  
  15460.  The modules below demonstrate the problem. In this case, compiling the
  15461.  C source module and assembling the MASM source module with the
  15462.  appropriate CodeView switches, then linking with the /CO /DO switches
  15463.  generates a bad .exe. The problem is that CodeView displays source
  15464.  with extended ASCII characters.
  15465.  
  15466.  To work around this problem, put .DOSSEG in the MASM modules
  15467.  being linked, and omit the /DO switch rather that trying to
  15468.  force the linker to do the work. Also, switching the order of
  15469.  the linker switches may solve the problem.
  15470.  
  15471.  The following example demonstrates the problem:
  15472.  
  15473.  #include <stdio.h>
  15474.  main ()
  15475.    {
  15476.    long int getds(void), getdsq(void);
  15477.    printf("ds.DATA  = %lX\nds.DATA? = %lX\n",getds(),getdsq());
  15478.    }
  15479.  
  15480.  **************************************************************
  15481.  ;        DOSSEG could be put here
  15482.          .MODEL  small
  15483.          .DATA
  15484.  array   dd      0
  15485.          .DATA?
  15486.  arrayq  dd      ?
  15487.          .CODE
  15488.          PUBLIC  _getds,_getdsq
  15489.  _getds  PROC
  15490.          mov     ax,SEG array
  15491.          mov     dx,ds
  15492.          ret
  15493.  _getds  ENDP
  15494.  _getdsq PROC
  15495.          mov     ax,SEG arrayq
  15496.          mov     dx,ds
  15497.          ret
  15498.  _getdsq ENDP
  15499.          END
  15500.  
  15501.  
  15502.  33. 3270 ERMA Emulator
  15503.  
  15504.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30
  15505.  Operating System:   MS-DOS
  15506.  Flags: ENDUSER |
  15507.  Last Modified:  9-AUG-1989    ArticleIdent: Q24200
  15508.  
  15509.  Question:
  15510.     Does CodeView support the 3270 ERMA emulator?
  15511.  
  15512.  Response:
  15513.     CodeView does not directly support any other program. In this case,
  15514.  the 3270 ERMA emulator would have to accommodate CodeView. CodeView
  15515.  performs some hardware specific routines (e.g. checking to see if an
  15516.  EGA is present) and makes some assumptions on the state of the
  15517.  machine. If another program changes the state of the machine, it may
  15518.  not work with CodeView. It has been reported that CodeView will hang
  15519.  if the 3270 ERMA emulator is enabled; we recommend you disable the
  15520.  emulator before running CodeView.
  15521.  
  15522.  
  15523.  34. Flipping and Swapping Screens
  15524.  
  15525.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30
  15526.  Operating System:   MS-DOS
  15527.  Flags: ENDUSER |
  15528.  Last Modified:  9-AUG-1989    ArticleIdent: Q24201
  15529.  
  15530.  Question:
  15531.     What is the difference between flipping and swapping in CodeView?
  15532.  
  15533.  Response:
  15534.     Both are ways of maintaining two alternate screens for display on
  15535.  one monitor. The difference is in the way the task is accomplished.
  15536.     When swapping is selected, CodeView allocates a 16K buffer (a 4K
  15537.  buffer for a monochrome adapter) to hold the alternate screen. When
  15538.  the other screen is required, CodeView swaps the screen into the
  15539.  display buffer and places the other screen into the storage buffer.
  15540.  Swapping takes memory and time, but it does not have the limitations
  15541.  of flipping.
  15542.     Flipping uses the video-display pages of the graphics adapter to
  15543.  store each screen of text. When the alternate screen is required, the
  15544.  other page is selected. Flipping is much faster than swapping and does
  15545.  not require the 16K buffer. However, it cannot be used with a
  15546.  monochrome adapter, or with programs that display graphics or use the
  15547.  video pages.
  15548.  
  15549.  
  15550.  35. CODEVIEW.DOC Incorrectly States /E Uses Extended Memory
  15551.  
  15552.  Product Version(s): 2.20
  15553.  Operating System:   MS-DOS
  15554.  Flags: ENDUSER | docerr
  15555.  Last Modified: 10-NOV-1988    ArticleIdent: Q27763
  15556.  
  15557.  The CODEVIEW.DOC file included in Microsoft C Version 5.10 states that
  15558.  the /E switch enables use of extended memory for CodeView's symbol
  15559.  table.
  15560.  
  15561.  This is a documentation error in the CODEVIEW.DOC file. CodeView uses
  15562.  expanded, not extended memory.
  15563.  
  15564.  
  15565.  36. WINDOWCOMPAT Directs CodeView to Create a Window
  15566.  
  15567.  Product Version(s): 2.20 2.30
  15568.  Operating System:   OS/2
  15569.  Flags: ENDUSER | S_C
  15570.  Last Modified: 10-NOV-1989    ArticleIdent: Q49423
  15571.  
  15572.  The WINDOWCOMPAT directive in a linker definition file can cause
  15573.  strange behavior in non-Presentation Manager (PM) programs being
  15574.  debugged under CodeView. WINDOWCOMPAT is one of three application
  15575.  types that can be specified after the NAME directive. WINDOWCOMPAT is
  15576.  used for OS/2 programs that use VIO, MOU, and KBD calls and can be
  15577.  used inside a PM window or as a separate screen group.
  15578.  
  15579.  Debugging a non-PM application that was linked with the WINDOWCOMPAT
  15580.  option instructs CodeView to create a PM window to run the program. In
  15581.  some cases this feature could be desirable, but for most debugging, a
  15582.  PM window is only cumbersome. The way to work around this feature is
  15583.  to relink without the WINDOWCOMPAT directive.
  15584.  
  15585.  
  15586.  37. The CodeView Port Input Command Example Is Unclear
  15587.  
  15588.  Product Version(s): 2.20 2.30 | 2.20 2.30
  15589.  Operating System:   MS-DOS    | OS/2
  15590.  Flags: ENDUSER | H_MASM H_FORTRAN S_Pascal
  15591.  Last Modified: 27-OCT-1989    ArticleIdent: Q49537
  15592.  
  15593.  The CodeView example for port input command is unclear in the
  15594.  following manuals:
  15595.  
  15596.  1. Page 150 of Microsoft C 5.10 "CodeView And Utilities, Microsoft
  15597.     Editor, Mixed Language Programming Guide"
  15598.  
  15599.  2. Page 150 of Microsoft Macro Assembler 5.10 CodeView and Utilities
  15600.  
  15601.  3. Page 150 of Microsoft Pascal 4.00 CodeView and Utilities
  15602.  
  15603.  4. Page 127 of Microsoft FORTRAN 5.10 CodeView and Utilities
  15604.  
  15605.  The example assumes the radix is in hexadecimal. To set the radix to
  15606.  hexadecimal, type in the following command:
  15607.  
  15608.     >n16
  15609.  
  15610.  After setting the radix to hexadecimal, the example works properly.
  15611.  
  15612.  If the radix is not in hexadecimal, a "0x" must be present for
  15613.  CodeView to recognize the value as a hex format. The following example
  15614.  shows how to use the port input command if CodeView is not in
  15615.  hexadecimal radix:
  15616.  
  15617.     >I 0x2f8
  15618.  
  15619.  
  15620.  38. The Difference Among Watch, Watchpoint, and Tracepoint
  15621.  
  15622.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30 | 2.20 2.30
  15623.  Operating System:   MS-DOS                        | OS/2
  15624.  Flags: ENDUSER |
  15625.  Last Modified: 14-AUG-1989    ArticleIdent: Q24225
  15626.  
  15627.  Question:
  15628.  
  15629.  What is the difference between a watch, a watchpoint, and a
  15630.  tracepoint?
  15631.  
  15632.  Response:
  15633.  
  15634.  A "watch" command will monitor an expression or a range of memory
  15635.  addresses, and update the watch window each time the expression or any
  15636.  location in the range changes. Using a watch never will cause program
  15637.  execution to stop; it simply "watches" unconditionally.
  15638.  
  15639.  A "watchpoint" monitors an expression (and an expression only) during
  15640.  program execution. It will update its value in the watch window
  15641.  whenever it changes. However, when the watchpoint expression becomes
  15642.  true (nonzero), program execution is stopped.
  15643.  
  15644.  A "tracepoint" monitors an expression or a range of memory addresses
  15645.  and displays the expression or the range being monitored in the watch
  15646.  window. It will stop program execution when the expression or any
  15647.  location in the range changes. Please note that writing over the old
  15648.  value at a memory location with the same value is not considered a
  15649.  change.
  15650.  
  15651.  The following example summarizes this information:
  15652.  
  15653.  Command     Object To Watch          Conditionally    Condition To
  15654.                                       Stops            Stop On
  15655.  -------     ---------------          -------------    ------------
  15656.  
  15657.  WATCH       expression or            No               (none)
  15658.              range of memory
  15659.  
  15660.  WATCHPOINT  expression               Yes             expression becomes
  15661.                                                       true (nonzero)
  15662.  
  15663.  TRACEPOINT  expression or            Yes             expression or
  15664.              range of memory                          in range changes
  15665.                                                       location
  15666.  
  15667.  Note: the "monitoring" described above is done in only window mode. If
  15668.  sequential mode is being used, you must use the Watch List command to
  15669.  see the values of any of the three types of watch statements.
  15670.  
  15671.  
  15672.  39. Tracking Down a Null Pointer Assignment Error
  15673.  
  15674.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30 | 2.20 2.30
  15675.  Operating System:   MS-DOS                        | OS/2
  15676.  Flags: ENDUSER | S_C
  15677.  Last Modified: 21-AUG-1989    ArticleIdent: Q24270
  15678.  
  15679.  Question:
  15680.  
  15681.  I consistently get the error number R6001 "null pointer assignment"
  15682.  when I run my program. How can I use CodeView to determine the point
  15683.  at which the null pointer assignment is occurring?
  15684.  
  15685.  Response:
  15686.  
  15687.  Use a tracepoint, which can be set to watch a range of memory up to
  15688.  128 bytes. It will halt the execution of the program when any value in
  15689.  this range is changed. If you set a tracepoint over the entire range
  15690.  of the null segment, the program will halt immediately after the
  15691.  instruction that wrote over the null segment.
  15692.  
  15693.  The location of the null segment is available in the link maps of
  15694.  Microsoft compilers. It starts at DS:0 and is 42H bytes long. The
  15695.  Microsoft copyright notice is written there at program startup and
  15696.  if this area is written to during the course of the program, the
  15697.  error r6001 is generated. The most common cause of this error is
  15698.  using a pointer that has not been initialized to point to a memory
  15699.  area. Pointers that have not had space allocated for them (using
  15700.  malloc for example) or that have not been assigned to a specific
  15701.  data element (arrays or structures for example) are considered
  15702.  uninitialized.
  15703.  
  15704.  An example of using CodeView to determine where an unitialized pointer
  15705.  is being used follows:
  15706.  
  15707.  g main                  /* go to the beginning of main() */
  15708.  n16                     /* switch to hexadecimal (base 16) */
  15709.  tpb DS:0 DS:42          /* set a Trace Point of type Byte starting
  15710.                                at address DS:0 and extending to DS:42 */
  15711.  
  15712.  When any value in the specified range changes, CodeView will stop the
  15713.  execution of your program. The previously executed line was probably
  15714.  the line that caused the R6001 error.
  15715.  
  15716.  
  15717.  40. How to Successfully Debug VioPopUp() Code with CodeView
  15718.  
  15719.  Product Version(s): 2.20 2.30 2.35
  15720.  Operating System:   OS/2
  15721.  Flags: ENDUSER |
  15722.  Last Modified: 27-FEB-1990    ArticleIdent: Q58647
  15723.  
  15724.  Debugging programs that take advantage of OS/2's VioPopUp() call can
  15725.  present a potentially dangerous situation. Due to the nature of the
  15726.  VioPopUp() call, any attempts to trace into the VioPopUp call will cause
  15727.  your machine to hang. The workaround for this difficulty is to set a
  15728.  breakpoint outside of the VioPopUp() call [after the VioEndPopUp()], and
  15729.  then press F5 to instruct CodeView to execute to the next breakpoint.
  15730.  
  15731.  The VioPopUp() call brings forward a temporary pop-up text screen group
  15732.  that can be used to display text information without altering the
  15733.  context of the foreground screen. When a VioPopUp() call is executed, the
  15734.  current foreground screen group loses the keyboard focus to the pop-up
  15735.  screen. Therefore, when you trace into a VioPopUp() call, the pop-up
  15736.  text comes forward and CodeView, running in the foreground, loses the
  15737.  keyboard focus and cannot execute a trace instruction. At this time,
  15738.  CTRL+ESC or ALT+ESC will not change the deadlock situation and the
  15739.  only alternative is to reboot.
  15740.  
  15741.  To work around this problem, it is essential that you do NOT step into
  15742.  a VioPopUp call. Instead, press F5 to execute to the next breakpoint.
  15743.  Setting the breakpoint AFTER the VioEndPopUp() call is critical.
  15744.  
  15745.  
  15746.  41. Capabilities of Real Mode CodeView and the 386
  15747.  
  15748.  Product Version(s): 2.00
  15749.  Operating System:   MS-DOS
  15750.  Flags: ENDUSER | s_c, h_masm, h_fortran, s_pascal
  15751.  Last Modified:  1-DEC-1988    ArticleIdent: Q38205
  15752.  
  15753.  The information below discusses the CodeView debugger and its use
  15754.  of 80386 hardware capabilities.
  15755.  
  15756.  The DOS CodeView does not keep track of any of this information because
  15757.  DOS does not use any of these features. Essentially, a 386 running DOS
  15758.  is just a very fast PC and CodeView treats it as such.
  15759.  
  15760.  The OS/2 CodeView does not have the privilege to track many of the
  15761.  OS/2 functionality.
  15762.  
  15763.  The following is a list of CodeView behaviors:
  15764.  
  15765.  1. CodeView does not keep track of task states.
  15766.  
  15767.  2. CodeView does not handle privilege levels.
  15768.  
  15769.  3. CodeView Version 2.20 makes limited use of the 386 debug
  15770.     registers. Previous versions do not use these registers.
  15771.  
  15772.  4. CodeView does not keep track of interrupt gates and trap gates.
  15773.  
  15774.  5. CodeView cannot operate in both real and Virtual 86 mode.
  15775.  
  15776.  6. CodeView cannot trace to protected mode and back to real mode.
  15777.  
  15778.  7. CodeView does not handle traces in protected mode.
  15779.  
  15780.  
  15781.  42. Flip/Swap Setting Crucial to Debugging PM Apps with Children
  15782.  
  15783.  Product Version(s): 2.30
  15784.  Operating System:   OS/2
  15785.  Flags: ENDUSER |
  15786.  Last Modified: 10-NOV-1989    ArticleIdent: Q50514
  15787.  
  15788.  Using protected mode CodeView (CVP) to debug Presentation Manager (PM)
  15789.  programs that spawn one or more child processes can be rather
  15790.  difficult. CVP works correctly for debugging just the parent PM
  15791.  process, but once you begin CodeView with the /O option to specify
  15792.  that you also want to debug child processes, you may find that you
  15793.  hang the computer quite regularly during your debugging session.
  15794.  
  15795.  CodeView itself does not have a problem with PM programs even if they
  15796.  do invoke child processes. It is only when you use the /O switch to
  15797.  debug the children at the same time that you run into difficulty. This
  15798.  is because of problems with CodeView conflicting with the OS/2 kernel
  15799.  as you bring a process to the foreground for debugging, while a
  15800.  system-dependent process like the PM parent is relegated to the
  15801.  background where it can become blocked.
  15802.  
  15803.  For example, if the parent gets to a point where it is waiting on a
  15804.  message, but it is not in the foreground, there is no way to get the
  15805.  focus back to this waiting process and you are essentially hung. The
  15806.  parent cannot process the message because it must be in the foreground
  15807.  to do so, and CodeView cannot continue until the message is processed,
  15808.  so it just waits.
  15809.  
  15810.  The key to debugging the parent and child processes of a PM program at
  15811.  the same time is the setting of Flip/Swap on the Options menu. Under
  15812.  CodeView, Flip/Swap ON forces messaging, Flip/Swap OFF does not.
  15813.  Therefore, you must turn Flip/Swap on and off as you go, depending on
  15814.  which particular part of the program you are currently debugging. The
  15815.  Flip/Swap setting is crucial in determining whether you hang the
  15816.  system or not.
  15817.  
  15818.  The ability to debug child processes from the parent's CodeView
  15819.  session became an available option beginning with CVP Version 2.30. By
  15820.  specifying the /O switch on the command line, CVP allows you to trace
  15821.  into child processes. (See the CVP 2.30 Note below if you are using
  15822.  that particular version of CodeView.)
  15823.  
  15824.  As far as actually debugging child processes in PM programs, you must
  15825.  proceed in an exacting manner. Unfortunately, the specifics are
  15826.  different for every program, so an all-encompassing set of debugging
  15827.  procedures cannot be devised. Nevertheless, the following general
  15828.  guidelines can be used for debugging most PM applications with their
  15829.  accompanying child processes:
  15830.  
  15831.   1. It is only with the /O option that any of this becomes critical.
  15832.  
  15833.   2. You need to debug in a full screen and not a PM window.
  15834.  
  15835.   3. Remember, Flip/Swap ON forces messaging, Flip/Swap OFF does not.
  15836.      Therefore, while you begin debugging in the parent program, you
  15837.      should have Flip/Swap ON, since you need messaging whenever you
  15838.      are doing any of the window initialization routines.
  15839.  
  15840.   4. Set a breakpoint in the parent somewhere after the window
  15841.      initialization code, but before the call to start the child
  15842.      process. It varies, but it usually works to put the breakpoint at
  15843.      the "while get message - dispatch message" loop or in the
  15844.      ClientWndProc procedure at the main switch statement.
  15845.  
  15846.   5. You must make sure that the breakpoint is placed in a position
  15847.      where you will stop at it before the prompt appears to ask you if
  15848.      you want to debug the child, but after ALL the window
  15849.      initialization has been completed. You will also probably need to
  15850.      set another breakpoint at the point where the parent program is
  15851.      going to begin executing again after you have finished working
  15852.      with the child.
  15853.  
  15854.   6. Do a GO, and when the breakpoint is reached, turn Flip/Swap OFF.
  15855.      Make sure that the prompt to debug the child is not already
  15856.      visible or you will lock up.
  15857.  
  15858.   7. Do a GO (or some traces) and you should get the prompt to debug
  15859.      the child. Answer "Y" and you should be able to debug the child
  15860.      process at this point.
  15861.  
  15862.   8. Use the Process command (the "|") to gain access to the child.
  15863.      Never use CTRL+ESC or ALT+ESC to switch to the other processes
  15864.      because these will almost assuredly cause you to hang.
  15865.  
  15866.   9. Go ahead and set breakpoints, watches, etc. in the child and do
  15867.      your debugging.
  15868.  
  15869.  10. After the child process is completed, use the Quit command to exit
  15870.      the child process's CodeView screen or use the Process command to
  15871.      reselect the parent process.
  15872.  
  15873.  11. Once you have returned to the parent process, and before you do a
  15874.      Restart (or load), or before you do ANY other window
  15875.      initialization, you MUST turn Flip/Swap ON again.
  15876.  
  15877.  12. Remember to always be aware of where you are in the program and
  15878.      what the current state of Flip/Swap is, since turning Flip/Swap on
  15879.      or off at the wrong time will almost always cause you to hang.
  15880.  
  15881.  Again, this is only the general outline of steps to follow and each
  15882.  application requires different specific steps. Don't be too surprised
  15883.  if you still run into occasional lock-ups.
  15884.  
  15885.  CVP 2.30 Note: When using the /O switch with CVP Version 2.30, there
  15886.  is a bug that may also cause you to hang. The problem involves using
  15887.  /O on the command line and then saying "No" when asked if you want to
  15888.  debug the child. So, with this version of CodeView, you should always
  15889.  answer "Yes" when asked if you wish to debug the child.
  15890.  
  15891.  For more information on this problem, use the following query:
  15892.  
  15893.     CodeView 2.30 hangs debugging child processes
  15894.  
  15895.  
  15896.  43. Can't Debug .COM Files in Source Mode
  15897.  
  15898.  Product Version(s): 2.00 2.10 2.20 2.30
  15899.  Operating System:   MS-DOS
  15900.  Flags: ENDUSER |
  15901.  Last Modified:  9-AUG-1989    ArticleIdent: Q38288
  15902.  
  15903.  The .COM format files created with the Microsoft Macro Assembler
  15904.  cannot contain symbolic and source-line information for the CodeView
  15905.  debugger. You can only debug these files in assembly mode.
  15906.  
  15907.  
  15908.  44. CODEVIEW.DOC File Error: Mouse Works with the /2 Option
  15909.  
  15910.  Product Version(s): 2.20
  15911.  Operating System:   MS-DOS
  15912.  Flags: ENDUSER |
  15913.  Last Modified:  8-NOV-1988    ArticleIdent: Q27764
  15914.  
  15915.  Question:
  15916.     The CODEVIEW.DOC file included with Microsoft C Version 5.10 states
  15917.  that using the /2 switch disables mouse support on the debugging
  15918.  display. Is this true?
  15919.  
  15920.  Response:
  15921.     This is an error in the CODEVIEW.DOC file.
  15922.     CodeView does support the mouse when using the /2 switch. In fact,
  15923.  if you are debugging a program which itself uses the mouse, using the
  15924.  /2 switch will allow you to use the mouse on CodeView's debugging
  15925.  screen as well as your application's output screen.
  15926.  
  15927.  
  15928.  45. "?CANNOT DISPLAY" After Column 135 in Command Window
  15929.  
  15930.  Product Version(s): 3.00 3.11 | 3.00 3.11 3.50
  15931.  Operating System:   MS-DOS    | OS/2
  15932.  Flags: ENDUSER |
  15933.  Last Modified:  6-FEB-1991    ArticleIdent: Q68696
  15934.  
  15935.  The code below demonstrates a limitation of the CodeView debugger.
  15936.  When the command "?y" is executed in the COMMAND window, the structure
  15937.  "y" is displayed. However, CodeView displays the structure only to
  15938.  column 135 and then prints "?CANNOT DISPLAY," ignoring the rest of the
  15939.  elements in the structure. The output appears as follows:
  15940.  
  15941.     --------------------------command----------------------------
  15942.    |>?y                                                          |
  15943.    |{this_field_01=0x0000, ... ,this_field_07=?CANNOT DISPLAY    |
  15944.    |                        ^                 ^                  |
  15945.    |                        |                 |                  |
  15946.    |                  Fields 2-6 displayed    Column 135         |
  15947.    |                                                             |
  15948.     -------------------------------------------------------------
  15949.  
  15950.                        CodeView Command Window
  15951.  
  15952.  To view all elements of a structure, you should use the QUICK WATCH
  15953.  function. In the example below, the contents of the whole structure
  15954.  can be seen by typing "??y". A dialog box will appear on the screen
  15955.  showing the contents of the structure. By scrolling down in the dialog
  15956.  box, the contents of every element of the structure can be seen. The
  15957.  structure contents are displayed as follows:
  15958.  
  15959.            --------------- Quick Watch -----------------
  15960.           |                                             |
  15961.           |-y                                           |
  15962.           |   this_field_01=0                           |
  15963.           |   this_field_02=0                           |
  15964.           |   this_field_03=0                           |
  15965.           |   this_field_04=0                           |
  15966.           |   this_field_05=0                           |
  15967.           |   this_field_06=0                           |
  15968.           |   this_field_07=0                           |
  15969.           |   this_field_08=0                           |
  15970.           |   this_field_09=0                           |
  15971.           |   this_field_10=0                           |
  15972.           |   this_field_11=0                           |
  15973.           |   this_field_12=0                           |
  15974.           |   this_field_13=0                           |
  15975.           |   this_field_14=0                           |
  15976.           |   this_field_15=0                           |
  15977.            ---------------------------------------------
  15978.  
  15979.                        Quick Watch of Variable
  15980.  
  15981.  Sample Code
  15982.  -----------
  15983.  
  15984.  struct x {
  15985.     int this_field_01;
  15986.     int this_field_02;
  15987.     int this_field_03;
  15988.     int this_field_04;
  15989.     int this_field_05;
  15990.     int this_field_06;
  15991.     int this_field_07;
  15992.     int this_field_08;
  15993.     int this_field_09;
  15994.     int this_field_10;
  15995.     int this_field_11;
  15996.     int this_field_12;
  15997.     int this_field_14;
  15998.     int this_field_15;
  15999.     int this_field_16;
  16000.     int this_field_17;
  16001.     int this_field_18;
  16002.     int this_field_19;
  16003.     int this_field_20;
  16004.  };
  16005.  
  16006.  main()
  16007.  {
  16008.      struct x y;
  16009.  }
  16010.  
  16011.  
  16012.  46. Debugging PM Apps with Two Monitors Does Not Require /2 Switch
  16013.  
  16014.  Product Version(s): 2.20 2.30
  16015.  Operating System:   OS/2
  16016.  Flags: ENDUSER |
  16017.  Last Modified: 17-JUL-1990    ArticleIdent: Q49824
  16018.  
  16019.  Problem:
  16020.  
  16021.  I am using CodeView to debug my Presentation Manager (PM) program and
  16022.  I am using the /2 switch to redirect the CodeView screen to a
  16023.  monochrome monitor. When I press F5 to start my program, a protection
  16024.  violation occurs, but it works correctly when I run it from the OS/2
  16025.  command line.
  16026.  
  16027.  Response:
  16028.  
  16029.  The /2 switch for CodeView is not supported for Presentation Manager
  16030.  application debugging. However, you may redirect the CodeView screen to
  16031.  a monochrome monitor if you do the following:
  16032.  
  16033.  1. Start a full-screen command prompt.
  16034.  
  16035.  2. At the prompt, type the following command (this puts the prompt on
  16036.     the monochrome monitor):
  16037.  
  16038.        mode mono
  16039.  
  16040.     Note: You must be in a 25-line screen mode before you attempt the
  16041.     mode mono. If you are in a 43- or 50-line mode, the display is
  16042.     corrupted.
  16043.  
  16044.  3. At the prompt, type the following command, where "appname" is your
  16045.     application's name:
  16046.  
  16047.        cvp appname
  16048.  
  16049.  4. After you are finished debugging, you can return the prompt to your
  16050.     primary display by typing the following command:
  16051.  
  16052.        mode co80
  16053.  
  16054.  
  16055.  47. How CodeView Interprets Values (octal, decimal, hexadecimal)
  16056.  
  16057.  Product Version(s): 1.x 2.00 2.10 2.20 | 2.20
  16058.  Operating System:   MS-DOS             | OS/2
  16059.  Flags: ENDUSER |
  16060.  Last Modified: 23-NOV-1988    ArticleIdent: Q38299
  16061.  
  16062.  Problem:
  16063.  
  16064.  When trying to watch a portion of memory, I have a problem with
  16065.  the following command at the dialog prompt:
  16066.  
  16067.     WW DS:0050 L 4.
  16068.  
  16069.  I thought this should have created a watch on the four words starting
  16070.  at offset 0x50. It actually set the watch starting at 0x28, CodeView
  16071.  interpreted the number as if it had been in base 8. Using the N
  16072.  command to change the radix doesn't make any difference.
  16073.  
  16074.  Response:
  16075.  
  16076.  In this case, the 0's before the offset cause CodeView to evaluate the
  16077.  expression in octal. CodeView provides three different prefixes for
  16078.  numbers to use an explicit base: 0 signifies octal, 0n signifies
  16079.  decimal, and 0x signifies hexadecimal. The current radix setting will
  16080.  have no bearing on numbers entered with these prefixes; however, it
  16081.  will affect those without prefixes.
  16082.  
  16083.  The lines below have different meanings when setting watches.
  16084.  The left column is the command, while the right column is an example
  16085.  of the display produced in the watch window. Radix is assumed to be 10.
  16086.  
  16087.  The following is an example:
  16088.  
  16089.  1. ww 50               50    :  0067:0032  6942
  16090.  
  16091.  2. ww 050              050   :  0067:0028  6328
  16092.  
  16093.  3. ww 0n50             0n50  :  0067:0032  6942
  16094.  
  16095.  4. ww 0x50             0x50  :  0067:0050  6163
  16096.  
  16097.  The first command sets the watch at the address specified using the
  16098.  current radix. This address will change when you use the N command to
  16099.  change the radix; the 50 on the left of the watch remains the same;
  16100.  however, the offset in the address will change to watch 50 in the new
  16101.  base. This address will always be displayed in hexadecimal, but 50
  16102.  will be evaluated differently.
  16103.  
  16104.  Examples 2 through 4 show watches being set in octal, decimal, and
  16105.  hexadecimal modes, respectively. These addresses will never change
  16106.  with a change of radix.
  16107.  
  16108.  Notice that watches 1 and 3 match. This is because by default CodeView
  16109.  is in base 10, so 50 and 0n50 evaluate to the same thing. Using N 8 will
  16110.  cause watches 1 and 2 to match, and N 16 will match 1 and 4.
  16111.  
  16112.  
  16113.  48. Interrupt Conflict with Greenleaf Libraries
  16114.  
  16115.  Product Version(s): 2.20    | 2.20
  16116.  Operating System:   MS-DOS  | OS/2
  16117.  Flags: ENDUSER | CV CVP
  16118.  Last Modified: 23-NOV-1988    ArticleIdent: Q38314
  16119.  
  16120.  The Greenleaf Comm Library, a collection of asynchronous
  16121.  communications functions for use with the C compiler, causes severe
  16122.  complications with CodeView (e.g. crashes, lockups) due to interrupt
  16123.  conflicts. Greenleaf Software is aware of this difficulty and will
  16124.  advise customers of the incompatibility.
  16125.  
  16126.  No workarounds are available. Greenleaf Software is located in
  16127.  Carrollton, TX, and can be reached at (214) 248-2561.
  16128.  
  16129.  
  16130.  49. CodeView Gives "Illegal Instruction" on Clone 386
  16131.  
  16132.  Product Version(s): 2.20
  16133.  Operating System:   MS-DOS
  16134.  Flags: ENDUSER | CV
  16135.  Last Modified: 23-NOV-1988    ArticleIdent: Q38317
  16136.  
  16137.  Some clones that are not entirely IBM-compatible under CodeView may
  16138.  give an "illegal instruction" message upon executing Go (F5), and then
  16139.  hang, requiring a warm boot. If the instruction being called illegal
  16140.  is FINIT or FNINIT, the particular ROM BIOS probably has a built-in
  16141.  387 emulator. Either turn off the emulator, or set the environment
  16142.  variable SET NO87=(some string).
  16143.  
  16144.  
  16145.  
  16146.  50. Thirty-Two-Bit Register Not Visible under OS/2
  16147.  
  16148.  Product Version(s): 2.20
  16149.  Operating System:   OS/2
  16150.  Flags: ENDUSER |
  16151.  Last Modified: 23-NOV-1988    ArticleIdent: Q38375
  16152.  
  16153.  Thirty-two-bit registers are not viewable (using F2) under CVP even if
  16154.  you have an 80386-based machine. This is not a problem with CodeView;
  16155.  it is a limitation.
  16156.  
  16157.  Real mode CodeView (CV) DOES support viewing 32-bit registers. This
  16158.  is because of the unprotected and generally more flexible nature of
  16159.  DOS. Using the full 32-bits of the 80386 under OS/2 is considered
  16160.  hazard-prone and is not supported by CVP.
  16161.  
  16162.  
  16163.  
  16164.  51. CodeView Instruction Pointer Miscounts Very Long Lines
  16165.  
  16166.  Product Version(s): 2.20
  16167.  Operating System:   MS-DOS
  16168.  Flags: ENDUSER | buglist2.20
  16169.  Last Modified:  1-DEC-1988    ArticleIdent: Q38382
  16170.  
  16171.  CodeView may display the "current instruction" highlight on the wrong
  16172.  line if the source file contains lines that are very long.
  16173.  
  16174.  The compiler counts the long lines as one line, but CodeView counts
  16175.  the very long lines as two lines. This makes the line number
  16176.  calculations incorrect and causes the "current line" highlight to
  16177.  appear on the wrong line. This problem does not occur if the source
  16178.  lines are less than 251 characters in length.
  16179.  
  16180.  Because the Microsoft Editor breaks lines that are longer than 250
  16181.  characters, this problem does not occur if you create and maintain
  16182.  your source files with the Microsoft Editor.
  16183.  
  16184.  Microsoft has confirmed this to be a problem in CodeView Version 2.20.
  16185.  We are researching this problem and will post new information as it
  16186.  becomes available.
  16187.  
  16188.  
  16189.  52. CodeView Requires PUBLIC to Trace MASM Program in Source Mode
  16190.  
  16191.  Product Version(s): 2.20
  16192.  Operating System:   MS-DOS
  16193.  Flags: ENDUSER | H_MASM
  16194.  Last Modified:  3-MAY-1989    ArticleIdent: Q44006
  16195.  
  16196.  A MASM program that runs perfectly from a DOS prompt refuses to trace
  16197.  in source mode inside of CodeView. The program single-steps in
  16198.  assembly mode, but an attempt to trace into the code in source mode
  16199.  results in the program terminating upon reaching the first data
  16200.  declaration.
  16201.  
  16202.  In addition, the program does not come up in source mode when CodeView
  16203.  is started, but can be changed into source mode with "View" "Source".
  16204.  
  16205.  This problem happens when the code and data segments are not declared
  16206.  as "PUBLIC". The code is valid and executes perfectly inside of
  16207.  CodeView or from a DOS prompt. However, CodeView cannot follow the
  16208.  logic at a source level.
  16209.  
  16210.  A program constructed in the following manner exhibits the symptoms
  16211.  described above:
  16212.  
  16213.  TITLE    myprog
  16214.  
  16215.  StackSeg Segment STACK
  16216.  .
  16217.  .
  16218.  .
  16219.  DataSeg  Segment DATA
  16220.  .
  16221.  .
  16222.  .
  16223.  CodeSeg  Segment CODE
  16224.  .
  16225.  .
  16226.  .
  16227.  END      myprog
  16228.  
  16229.  However, if the following minor changes are made to the program, and
  16230.  the segments are declared as "PUBLIC", CodeView can trace through the
  16231.  program in source mode:
  16232.  
  16233.  TITLE    myprog
  16234.  
  16235.  StackSeg Segment STACK
  16236.  .
  16237.  .
  16238.  .
  16239.  DataSeg  Segment WORD PUBLIC 'DATA'
  16240.  .
  16241.  .
  16242.  .
  16243.  CodeSeg  Segment WORD PUBLIC 'CODE'
  16244.  .
  16245.  .
  16246.  .
  16247.  END      myprog
  16248.  
  16249.  
  16250.  53. Cannot Use /2 Switch on IBM PS/2 in CodeView
  16251.  
  16252.  Product Version(s): 2.10 2.20  2.30 | 2.20 2.30
  16253.  Operating System:   MS-DOS | OS/2
  16254.  Flags: ENDUSER | SR# G881031-5515
  16255.  Last Modified:  9-AUG-1989    ArticleIdent: Q38865
  16256.  
  16257.  To use the /2 switch with CodeView, your computer must be equipped
  16258.  with a monochrome display (MDA) and a color display (CGA/EGA/VGA). The
  16259.  IBM PS/2 computers aren't currently configurable this way because they
  16260.  come with built-in VGAs or MDAs, but not both.
  16261.  
  16262.  If a hardware vendor starts selling MDAs that can be added to systems
  16263.  with built-in VGAs, this problem will be solved. An MDA card is
  16264.  needed that plugs into the PS/2 and works correctly in conjunction
  16265.  with the built-in VGA so that PS/2 owners can have a dual-monitor
  16266.  system.
  16267.  
  16268.  Currently, there is no solution to this debugging restriction other
  16269.  than using CodeView through the com port in sequential mode (/T) with
  16270.  a debugging terminal.
  16271.  
  16272.  
  16273.  54. CodeView Does Not Support Debugging Spawned Process
  16274.  
  16275.  Product Version(s): 2.20 2.30
  16276.  Operating System:   MS-DOS
  16277.  Flags: ENDUSER |
  16278.  Last Modified: 26-FEB-1990    ArticleIdent: Q58653
  16279.  
  16280.  The following are several reasons why CodeView doesn't provide
  16281.  debugging support for spawned processes under DOS:
  16282.  
  16283.  1. DOS is not a multitasking operating system. CodeView cannot start
  16284.     another thread/process to watch the execution of the spawned
  16285.     process.
  16286.  
  16287.  2. DOS does not provide debugging support for the DOS BIOS calls (int
  16288.     21h). Since all spawn() and exec() functions under DOS have to go
  16289.     through the BIOS to run, CodeView cannot follow the spawned
  16290.     program.
  16291.  
  16292.  3. DOS only recognizes 640K of memory; therefore, there is
  16293.     insufficient memory to debug a large program, since both the parent
  16294.     and child processes have to reside in memory at the same time.
  16295.  
  16296.  
  16297.  55. Display Settings for Compaq Gas Plasma Screen
  16298.  
  16299.  Product Version(s): 1.00 2.10 2.20 | 2.20
  16300.  Operating System:   MS-DOS         | OS/2
  16301.  Flags: ENDUSER |
  16302.  Last Modified:  6-DEC-1988    ArticleIdent: Q38866
  16303.  
  16304.  The default monitor settings for CodeView do not work properly with
  16305.  the Compaq gas plasma display adapter. Invoking CodeView with the /b
  16306.  switch corrects the problem.
  16307.  
  16308.  
  16309.  56. CodeView: Watchpoints and Tracepoints with Enumerated Types
  16310.  
  16311.  Product Version(s): 2.20   | 2.20
  16312.  Operating System:   MS-DOS | OS/2
  16313.  Flags: ENDUSER | s_c
  16314.  Last Modified: 28-MAR-1989    ArticleIdent: Q42601
  16315.  
  16316.  CodeView will not display the members of an enumerated type as they
  16317.  are declared in a C program. Only the integer representations of these
  16318.  types of variables can be shown. The following is an example:
  16319.  
  16320.  /*  Example enumerated type.
  16321.   */
  16322.  
  16323.  enum e_type
  16324.  {
  16325.      var1,
  16326.      var2,
  16327.      var3
  16328.  };
  16329.  
  16330.  enum e_type foo = var1;
  16331.  
  16332.  CodeView will not display "var1", "var2", or "var3" when watching a
  16333.  variable of type e_type, such as foo. CodeView will instead show the
  16334.  integer values of the variable: 0, 1, and 2, respectively. In order to
  16335.  watch the variable foo, you must explicitly display its value as an
  16336.  integer. The following command will add the proper watch:
  16337.  
  16338.      w? foo,d
  16339.  
  16340.  To set a watchpoint or a tracepoint on the same variable, further type
  16341.  casts must be made. These lines will produce watchpoints and
  16342.  tracepoints on foo, as follows:
  16343.  
  16344.      wp? *(int *)&foo == 1
  16345.      tp? *(int *)&foo
  16346.  
  16347.  Trying to set a watchpoint without the proper type cast will result in
  16348.  the following error:
  16349.  
  16350.      Operand types incorrect for this operation
  16351.  
  16352.  Setting a tracepoint on foo without this type cast will set the
  16353.  tracepoint but will only show "?CANNOT DISPLAY" in the watch window.
  16354.  Going through the right steps will display the current integer value
  16355.  of the variable, as it should.
  16356.  
  16357.  
  16358.  57. "?CANNOT DISPLAY" Error Not Documented in CodeView Documents
  16359.  
  16360.  Product Version(s): 2.00 2.10 2.20 2.30 | 2.20 2.30
  16361.  Operating System:   MS-DOS              | OS/2
  16362.  Flags: ENDUSER | TAR64267 docerr
  16363.  Last Modified: 21-AUG-1989    ArticleIdent: Q24877
  16364.  
  16365.  Problem:
  16366.  
  16367.  When trying to evaluate (?), a function that returns void, I get the
  16368.  error "?CANNOT DISPLAY". I cannot find this error message in the
  16369.  "Microsoft CodeView Utilities and Editor" manual.
  16370.  
  16371.  Response:
  16372.  
  16373.  This error message is not contained in the CodeView manual.
  16374.  
  16375.  The "?CANNOT DISPLAY" error message will be displayed in cases where
  16376.  the expression evaluator cannot return a value, such as a function
  16377.  returning void.
  16378.  
  16379.  
  16380.  58. Watch Bytes (wb) Command Can Be Used to Watch a Buffer in HEX
  16381.  
  16382.  Product Version(s): 2.20 2.30 | 2.20 2.30
  16383.  Operating System:   MS-DOS    | OS/2
  16384.  Flags: ENDUSER |
  16385.  Last Modified: 17-JUL-1990    ArticleIdent: Q50224
  16386.  
  16387.  Question:
  16388.  
  16389.  Is there a way to keep tabs on the contents of a buffer via a watch
  16390.  command? We want to observe the contents of a 20-character buffer in
  16391.  HEX. The buffer is not necessarily null terminated.
  16392.  
  16393.  Response:
  16394.  
  16395.  The way to watch a buffer in CodeView in hexadecimal with the Watch
  16396.  command is to use Watch Bytes (wb) as follows:
  16397.  
  16398.     >wb *buffer L 10  ; this will watch the first 10 bytes of
  16399.                         buffer in HEX
  16400.  
  16401.  For the given example, you should follow the previous command with the
  16402.  following:
  16403.  
  16404.     >wb *(buffer + 10) L 10  ; this will watch the next 10
  16405.                                bytes in HEX.
  16406.  
  16407.  Please note that both the length specifier as well as the number 10
  16408.  used to offset the pointer in the second command are taken in the
  16409.  current radix. The example above assumes a radix of 10. You can
  16410.  explicitly specify the base of the number in hex as follows:
  16411.  
  16412.     >wb *buffer L 0x0a
  16413.     >wb *(buffer + 0x0a) L 0x0a
  16414.  
  16415.  For more information on the wb command in CodeView, see the "Microsoft
  16416.  CodeView and Utilities, Microsoft Editor, Mixed-Language Programming
  16417.  Guide" manual.
  16418.  
  16419.  
  16420.  59. Specifying Both /T and /W Disables Mouse
  16421.  
  16422.  Product Version(s): 2.20    | 2.20
  16423.  Operating System:   MS-DOS  | OS/2
  16424.  Flags: ENDUSER |
  16425.  Last Modified:  6-DEC-1988    ArticleIdent: Q38867
  16426.  
  16427.  If you invoke CodeView with the following, the use of your mouse is
  16428.  disabled:
  16429.  
  16430.     CV /T /W program
  16431.  
  16432.  Don't specify the /T switch. Using /T with /W produces mutually
  16433.  exclusive modes of operation.
  16434.  
  16435.  
  16436.  60. Illegal Instruction in CodeView
  16437.  
  16438.  Product Version(s): 1.x 2.00 2.10 2.20 | 2.20
  16439.  Operating System:   MS-DOS             | OS/2
  16440.  Flags: ENDUSER | S_C h_fortran S_PASCAL
  16441.  Last Modified:  6-DEC-1988    ArticleIdent: Q38868
  16442.  
  16443.  Question:
  16444.  
  16445.  When I compile and link my C program and try to run it under CodeView,
  16446.  execution stops on the open curly brace of main. The view then goes to
  16447.  assembly, and the message "Illegal instruction" appears in the dialog
  16448.  window. Is there something wrong with the startup code?
  16449.  
  16450.  Response:
  16451.  
  16452.  This error can be produced when the main module of a program is
  16453.  compiled for one memory model and is then explicitly linked with a
  16454.  library for a different model. When the startup code is linked to the
  16455.  entry point of the program, different size instructions are used for
  16456.  the different memory models. If the program expects one size and the
  16457.  linker links in a different size, the startup instructions will be
  16458.  misinterpreted and result in this error.
  16459.  
  16460.  
  16461.  61. Entering Double Words at a Prompt Prevents Reloading Program
  16462.  
  16463.  Product Version(s): 2.20 2.30
  16464.  Operating System:   MS-DOS
  16465.  Flags: ENDUSER| | S_C S_PASCAL H_FORTRAN H_MASM buglist2.30
  16466.  Last Modified: 30-NOV-1989    ArticleIdent: Q50410
  16467.  
  16468.  When using the Enter Double word (ED) command within the CodeView
  16469.  symbolic debugger and allowing the debugger to prompt, you will
  16470.  prevent the debugger from reloading your executable (using the L
  16471.  command). This problem occurs only when you allow the debugger to
  16472.  prompt you for the double word and you enter a double word.
  16473.  
  16474.  This problem can manifest itself in several ways, depending on the
  16475.  version and on other unpredictable circumstances. Symptoms of the
  16476.  problem include the following:
  16477.  
  16478.  1. Giving the message "No such file/directory"
  16479.  
  16480.  2. Giving the message "Arg list too long"
  16481.  
  16482.  3. Generating an internal debugger error 7
  16483.  
  16484.  Valid workarounds consist of entering words (not double words) at the
  16485.  prompt, or entering double words on the command line (without being
  16486.  prompted).
  16487.  
  16488.  Microsoft has confirmed this to be a problem with CodeView Version
  16489.  2.30. We are researching this problem and will post new information
  16490.  here as it becomes available.
  16491.  
  16492.  
  16493.  62. CodeView 2.20 Does Not Allow Routine.Variable Specification
  16494.  
  16495.  Product Version(s): 2.20   | 2.20
  16496.  Operating System:   MS-DOS | OS/2
  16497.  Flags: ENDUSER | S_PASCAL S_C H_FORTRAN H_MASM DOCERR
  16498.  Last Modified: 10-NOV-1989    ArticleIdent: Q50698
  16499.  
  16500.  On Pages 91-92 of the "CodeView and Utilities" manual that accompanied
  16501.  C 5.10 and Pascal 4.00 for CodeView Version 2.20, the period is
  16502.  documented as being useful as a specifier of local variables in parent
  16503.  functions. The syntax is stated to be as follows:
  16504.  
  16505.     routine_name.variable_name
  16506.  
  16507.  However, this feature was not implemented in Version 2.20 of CodeView.
  16508.  It was implemented in CodeView Version 2.30 (which accompanied FORTRAN
  16509.  5.00).
  16510.  
  16511.  This feature is useful in all languages, but particularly helpful in
  16512.  Pascal because of the "nested-scoping" (the ability of a function to
  16513.  access variables from the routine that called it) that occurs in
  16514.  Pascal.
  16515.  
  16516.  To use this feature in CodeView 2.30, you must be in either the
  16517.  routine where the variable is defined or in a routine that is a child
  16518.  (or grandchild, etc.) of that routine. After entering the proper
  16519.  routine, any variable name can be referenced with a routine and
  16520.  variable name (see example below).
  16521.  
  16522.  program first (input, output) ;
  16523.  var a: integer ;            { Available throughout the program }
  16524.  
  16525.      procedure second ;
  16526.      var b: integer ;        { Available in second and third }
  16527.  
  16528.          procedure third ;
  16529.          var c: integer ;    { Available in third }
  16530.  
  16531.          begin
  16532.              a := 3 ;
  16533.              b := 3 ;
  16534.              c := 3 ;
  16535.          end ;
  16536.  
  16537.      begin
  16538.          a := 2 ;
  16539.          b := 2 ;
  16540.          third ;
  16541.      end ;
  16542.  
  16543.  begin
  16544.      a := 1 ;                { Cannot watch second/third variables }
  16545.      second ;
  16546.  end.
  16547.  
  16548.  When in procedure third, you can place a watch on the variables in
  16549.  procedure second in the following manner:
  16550.  
  16551.  w? second.b
  16552.  
  16553.  This will display the variable in procedure second. This variable
  16554.  cannot be displayed from the main program, however.
  16555.  
  16556.  
  16557.  63. Using a Debugging Terminal with CodeView
  16558.  
  16559.  Product Version(s): 2.20
  16560.  Operating System:   MS-DOS
  16561.  Flags: ENDUSER |
  16562.  Last Modified: 12-JAN-1989    ArticleIdent: Q39179
  16563.  
  16564.  It is possible to use either a dumb terminal or another machine (PC or
  16565.  Macintosh, running a communications package at 9600 baud) as a
  16566.  debugging terminal for CodeView. To take advantage of this option, do
  16567.  the following:
  16568.  
  16569.  1. Connect the second terminal to the com port (COM1 or COM2).
  16570.  
  16571.  2. Initialize the communications package to set up the
  16572.     second machine as a dumb terminal. Set the baud rate at
  16573.     9600.
  16574.  
  16575.  3. Start CodeView in either window or sequential mode.
  16576.  
  16577.  4. Redirect either the output ( >COM1 ) or both input and output
  16578.     ( =COM1 ) to the second terminal.
  16579.  
  16580.     If you redirect just the output to the second terminal, you will
  16581.     see the debugging output on the second terminal, and program output
  16582.     on the primary terminal. If you redirect input and output, you will
  16583.     also be able input program information (responses to prompts,
  16584.     input from the keyboard, etc.) on the primary terminal, and input
  16585.     CodeView information on the secondary terminal.
  16586.  
  16587.  5. Set your options and run the program.
  16588.  
  16589.  
  16590.  64. Pascal Version of CodeView Version 2.20
  16591.  
  16592.  Product Version(s): 2.20   | 2.20
  16593.  Operating System:   MS-DOS | OS/2
  16594.  Flags: ENDUSER | S_PasCal
  16595.  Last Modified: 14-AUG-1989    ArticleIdent: Q39181
  16596.  
  16597.  CodeView Version 2.20 is different for Pascal then the rest of the
  16598.  languages. The Pascal version of CodeView 2.20 is the only version
  16599.  that has the Pascal Expression Evaluator. The way you can determine
  16600.  whether you are running the Pascal version is that Pascal will appear
  16601.  under the Languages menu.
  16602.  
  16603.  If you have multiple Microsoft Languages, you do not have to keep
  16604.  multiple versions of CodeView on your system. CodeView Version 2.20 is
  16605.  compatible with all of our languages. However, there is one exception
  16606.  -- if you are using Microsoft Pascal, make sure you use the version
  16607.  that came with Pascal. It is the only version that has the Pascal
  16608.  Expression Evaluator and all of the other language evaluators.
  16609.  
  16610.  To check if the version you have is the Pascal version, invoke
  16611.  CodeView and pull down the Languages menu. If it lists Pascal in the
  16612.  menu, you are using the Pascal version that is compatible with all of
  16613.  the Microsoft languages.
  16614.  
  16615.  
  16616.  65. "." on the LIBPATH Eases DLL Debugging, But Not for CVP 2.20
  16617.  
  16618.  Product Version(s): 2.20 2.30
  16619.  Operating System:   OS/2
  16620.  Flags: ENDUSER |
  16621.  Last Modified: 10-NOV-1989    ArticleIdent: Q50711
  16622.  
  16623.  When debugging OS/2 DLLs with protected mode CodeView (CVP), you must
  16624.  specify each DLL on the command line with an /L switch, and the DLL
  16625.  must be in the current directory as well as in a directory on the
  16626.  LIBPATH as set in CONFIG.SYS.
  16627.  
  16628.  For ease of debugging, if you put a period ("."), which means the
  16629.  current directory, as one of the directories on your LIBPATH, then a
  16630.  DLL in the current directory will also be on the LIBPATH and you won't
  16631.  need to have two copies of a DLL present on disk for debugging.
  16632.  
  16633.  This method only works for versions of CVP beginning with 2.30. CVP
  16634.  Version 2.20 will not recognize DLLs in a "." LIBPATH directory.
  16635.  
  16636.  If a copy of the DLL called by the program being debugged is not in
  16637.  the current working directory, you will not be able to trace into the
  16638.  DLL. If a copy of the DLL is not in a LIBPATH directory, CodeView will
  16639.  not be able to find the DLL. In this case, instead of coming up in the
  16640.  usual "debugging mode," CodeView immediately exits and returns to the
  16641.  command prompt after several seconds.
  16642.  
  16643.  Many DLL debugging problems arise from the fact that the copy of a DLL
  16644.  that is on the LIBPATH may be inadvertently out of date compared to
  16645.  the version in the current directory that is being used for debugging.
  16646.  By putting a period on the LIBPATH, the current directory becomes a
  16647.  LIBPATH directory and only one copy of the DLL needs to exist, thus
  16648.  eliminating any DLL update inconsistencies.
  16649.  
  16650.  
  16651.  66. CodeView Trace Skips Statement Following Switch Statement
  16652.  
  16653.  Product Version(s): 2.20 2.30 | 2.20 2.30
  16654.  Operating System:   MS-DOS    | OS/2
  16655.  Flags: ENDUSER | buglist2.20 buglist2.30
  16656.  Last Modified:  7-MAR-1990    ArticleIdent: Q59315
  16657.  
  16658.  CodeView incorrectly maps assembly level instructions to source code
  16659.  in the first statement following a switch statement with seven or more
  16660.  cases.
  16661.  
  16662.  As shown in the code sample below, the statement following the switch
  16663.  is executed correctly, but CodeView steps over the statement while
  16664.  tracing in source mode. In mixed source and assembly mode, the
  16665.  statement following the switch may be traced into.
  16666.  
  16667.  Sample Code
  16668.  -----------
  16669.  
  16670.  # include<stdio.h>
  16671.  
  16672.  void main(void)
  16673.  {
  16674.  
  16675.     short tag, marker;
  16676.  
  16677.     marker = 0;
  16678.     tag = 5;
  16679.  
  16680.     switch(tag){
  16681.        case 1:
  16682.           break;
  16683.        case 2:
  16684.           break;
  16685.        case 3:
  16686.           break;
  16687.        case 4:
  16688.           break;
  16689.        case 5:
  16690.           break;
  16691.        case 6:
  16692.           break;
  16693.        case 7:
  16694.           break;
  16695.        default:
  16696.           break;
  16697.     }
  16698.  
  16699.        marker = 2;
  16700.  
  16701.  }
  16702.  
  16703.  
  16704.  67. Using CodeView to Create Disassembled Program Listings
  16705.  
  16706.  Product Version(s): 2.20 2.30 | 2.20 2.30
  16707.  Operating System:   MS-DOS    | OS/2
  16708.  Flags: ENDUSER |
  16709.  Last Modified: 12-APR-1990    ArticleIdent: Q51323
  16710.  
  16711.  The following steps can be used to create an assembly listing of a
  16712.  program with CodeView:
  16713.  
  16714.  1. Begin CodeView in sequential mode by using the /T command-line
  16715.     switch.
  16716.  
  16717.  2. Specify a listing file to redirect CodeView output to by typing the
  16718.     redirection operator ">" followed by a filename at the dialog
  16719.     prompt. You may redirect the output directly to a printer by
  16720.     specifying the printer after the ">" (e.g., >PRN).
  16721.  
  16722.     (Note: From this point on, commands will not be viewable.)
  16723.  
  16724.  3. Use the Unassemble command "U" to disassemble the code and send a
  16725.     listing of the program to the output file. If you do not specify
  16726.     the starting address and the range to unassemble, CodeView will
  16727.     unassemble the next eight lines of code. See the CodeView
  16728.     documentation for more information on the Unassemble command.
  16729.  
  16730.  You can use this method on any files, whether or not they contain
  16731.  CodeView information. In this regard, you can create assembly listings
  16732.  of programs that were not created with a Microsoft compiler. Please
  16733.  also note that you cannot create assembly listings of instructions
  16734.  other than 8086 instructions.
  16735.  
  16736.  
  16737.  68. Debugging DLLs with Codeview
  16738.  
  16739.  Product Version(s): 2.20 2.30
  16740.  Operating System:   OS/2
  16741.  Flags: ENDUSER |
  16742.  Last Modified: 18-DEC-1989    ArticleIdent: Q51764
  16743.  
  16744.  To debug most DLLs (Dynamic Link Libraries) in CodeView, CVP
  16745.  (protected mode CodeView) Version 2.20 or later is required. For DLLs
  16746.  loaded via DosLoadModule(), CVP Version 2.30 or later is required.
  16747.  
  16748.  Invoke CodeView with the /L switch as follows:
  16749.  
  16750.     cvp /L dll1name /L dll2name main.exe
  16751.  
  16752.  Make sure that each DLL you want to trace into is specified by the /L
  16753.  option.
  16754.  
  16755.  CodeView cannot debug DLLs that have either IOPL or EXECUTEONLY
  16756.  specified with the CODE directive in the associated definition (.DEF)
  16757.  file. For DLLs that require these controls, the Kernel Debugger
  16758.  supplied with the SDK is required.
  16759.  
  16760.  Note: With CVP 2.30, pathnames cannot be specified for DLLs;
  16761.  therefore, the DLL must reside in the current directory. For more
  16762.  information, query on the following:
  16763.  
  16764.      CODEVIEW DLL LIBPATH
  16765.  
  16766.  
  16767.  69. Debugging Bound Applications
  16768.  
  16769.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 | 1.11 2.02.02 2.20 2.30
  16770.  Operating System:   MS-DOS                   | OS/2
  16771.  Flags: ENDUSER | TAR63888
  16772.  Last Modified: 14-AUG-1989    ArticleIdent: Q25219
  16773.  
  16774.  CodeView does not support the debugging of bound applications in real
  16775.  mode. However, CVP in protected mode will allow you to debug such
  16776.  applications.
  16777.  
  16778.  
  16779.  70. No Symbolic Information Generated for Pascal Units
  16780.  
  16781.  Product Version(s): 2.20   | 2.20
  16782.  Operating System:   MS-DOS | OS/2
  16783.  Flags: ENDUSER | s_pascal
  16784.  Last Modified: 12-JAN-1989    ArticleIdent: Q39811
  16785.  
  16786.  The Microsoft Pascal Compiler Version 4.00 generates no symbolic
  16787.  debugging information for Pascal Units. As a result, when tracing
  16788.  through a Pascal program Unit, attempting to access any local
  16789.  variables by using trace/watchpoints, dumps, examines, etc. yields a
  16790.  "symbol unknown" error.
  16791.  
  16792.  The only workaround is to transform the program Units into Modules.
  16793.  
  16794.  
  16795.  71. "Internal Debugger Error: 0" When Watching Structure Members
  16796.  
  16797.  Product Version(s): 2.20 2.30 | 2.20 2.30
  16798.  Operating System:   MS-DOS    | OS/2
  16799.  Flags: ENDUSER | buglist2.30 cv
  16800.  Last Modified: 29-DEC-1989    ArticleIdent: Q51834
  16801.  
  16802.  When watching a member of a structure using the "w?" or "?" commands,
  16803.  it is possible to get the message "internal debugger error: 0". When
  16804.  this happens, the only way to view the contents of the member is to
  16805.  use the "D" or "??" commands.
  16806.  
  16807.  Code Example
  16808.  ------------
  16809.  
  16810.  typedef struct {
  16811.     char *(*instruction)[];
  16812.     } *structype;
  16813.  
  16814.  structype mac;
  16815.  
  16816.  void main (void)
  16817.  {
  16818.  }
  16819.  
  16820.  If you set a watch on an element of the structure variable in the
  16821.  above program such as "w? mac->instruction[0]" (without the quotation
  16822.  marks) you'll get the message "internal debugger error: 0." Use the
  16823.  dump command "D" or the special "??" structure viewing command to look
  16824.  at the contents of the member.
  16825.  
  16826.  Microsoft has confirmed this to be a problem in CodeView Version 2.30.
  16827.  We are researching this problem and will post new information here as
  16828.  it becomes available.
  16829.  
  16830.  
  16831.  72. Incorrect Error Generated for Very Small COM Files
  16832.  
  16833.  Product Version(s): 2.00 2.10 2.20 2.30
  16834.  Operating System:   MS-DOS
  16835.  Flags: ENDUSER | TAR65183 buglist2.00
  16836.  Last Modified: 21-AUG-1989    ArticleIdent: Q25365
  16837.  
  16838.  Problem:
  16839.  
  16840.  If my COM file is less than 8 bytes long and I try to load it into
  16841.  CodeView, I get the error message "Invalid executable file format -
  16842.  please relink."
  16843.  
  16844.  Response:
  16845.  
  16846.  This problem occurs only on COM files less than 8 bytes in length.
  16847.  
  16848.  Microsoft has confirmed this to be a problem with CodeView Version
  16849.  2.00. We are researching this problem and will post new information as
  16850.  it becomes available.
  16851.  
  16852.  
  16853.  73. Dual-Monitor Setup Requires 8-Bit Data Paths for Both Monitors
  16854.  
  16855.  Product Version(s): 1.00 2.00 2.10 2.20 2.30 | 2.20 2.30
  16856.  Operating System:   MS-DOS                   | OS/2
  16857.  Flags: ENDUSER | s_c s_pascal h_fortran h_masm b_basiccom
  16858.  Last Modified: 21-MAR-1990    ArticleIdent: Q51870
  16859.  
  16860.  When writing to a system that has a dual-monitor setup, you must make
  16861.  sure that both the monochrome monitor and the color monitor are using
  16862.  an 8-bit data path. In any dual-monitor write scheme, both display
  16863.  cards must be configured to write to a common data path (either both
  16864.  8-bit or both 16-bit mode). Today's monochrome adapters use 8-bit
  16865.  paths exclusively.
  16866.  
  16867.  Most display cards that use a 16-bit mode can autosense whether they
  16868.  are being written to in a dual-monitor mode, but some cards, such as
  16869.  the ATI VGA Wonder card, do not sense for this situation; therefore,
  16870.  you must set the card to an 8-bit path manually.
  16871.  
  16872.  If you are using dual monitors and you experience strange behavior
  16873.  such as garbage or blinking characters on the monochrome screen, make
  16874.  sure that your 16-bit video card is running in 8-bit mode.
  16875.  
  16876.  The most common use for a dual-monitor setup is for debugging graphics
  16877.  applications in CodeView.
  16878.  
  16879.  
  16880.  74. Retrieving Previously Entered Commands
  16881.  
  16882.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30 | 2.20 2.30
  16883.  Operating System:   MS-DOS                        | OS/2
  16884.  Flags: ENDUSER | TAR65921
  16885.  Last Modified: 14-AUG-1989    ArticleIdent: Q25539
  16886.  
  16887.  Question:
  16888.  
  16889.  Is there a method to retrieve commands after typing them in once? For
  16890.  instance, if I type "d some_data_area l 40", I would like to retrieve
  16891.  the command without having to retype it. A suggested method would be
  16892.  to allow the user to scroll on the command, then press a key to make
  16893.  the command active.
  16894.  
  16895.  Response:
  16896.  
  16897.  The only way to retrieve commands is to highlight them with the mouse
  16898.  and press the INS key. This method inserts the command into the
  16899.  command line. We are considering making an easier way to scroll
  16900.  through the commands and may implement it in a future version.
  16901.  
  16902.  
  16903.  75. system() Call May Cause CodeView to Terminate Process
  16904.  
  16905.  Product Version(s): 2.20 2.30
  16906.  Operating System:   MS-DOS
  16907.  Flags: ENDUSER | buglist2.20 buglist2.30
  16908.  Last Modified: 22-JAN-1990    ArticleIdent: Q57867
  16909.  
  16910.  Using real-mode CodeView to trace over the system() run-time function
  16911.  will cause the debugger to terminate the parent process upon return
  16912.  from the child process in certain situations where the child does a
  16913.  multiple directory-level traversal.
  16914.  
  16915.  Instead of tracing, use the "Go" Command (F5) to run past the system()
  16916.  call. This procedure allows the program to run to completion.
  16917.  
  16918.  The program below demonstrates this problem, but it requires that
  16919.  TREE.COM be somewhere in the path. Compile the code with the /Zi and
  16920.  /Od options and use CodeView to trace into the program, using F8.
  16921.  After TREE.COM executes, CodeView will display the "Program terminated
  16922.  normally" message, preventing the last printf() from being executed.
  16923.  
  16924.  Microsoft has confirmed this to be a problem with CodeView Versions
  16925.  2.20 and 2.30. We are researching this problem and will post new
  16926.  information here as it becomes available.
  16927.  
  16928.  Code Example
  16929.  ------------
  16930.  
  16931.  #include <process.h>
  16932.  #include <stdio.h>
  16933.  
  16934.  void main (void)
  16935.  {
  16936.          printf ("This is the beginning of the program\n");
  16937.          printf ("Calling TREE.COM\n");
  16938.          system ("tree");
  16939.  
  16940.          /* This line will never be executed */
  16941.          printf ("Back from spawn\n");
  16942.  }
  16943.  
  16944.  
  16945.  76. CodeView Versions 2.10 to 2.30 Use Four Extra File Handles
  16946.  
  16947.  Product Version(s): 2.30 2.20 2.10 2.00
  16948.  Operating System:   MS-DOS
  16949.  Flags: ENDUSER |
  16950.  Last Modified: 19-JAN-1990    ArticleIdent: Q25950
  16951.  
  16952.  Problem:
  16953.  
  16954.  CodeView Versions 2.00 to 2.30 seem to be using four additional file
  16955.  handles. The following program attempts to open 20 files, reporting
  16956.  its success or failure after each attempt:
  16957.  
  16958.      #include <stdio.h>
  16959.      #include <string.h>
  16960.      #include <stdlib.h>
  16961.  
  16962.      main()
  16963.      {
  16964.              FILE *streams[20];
  16965.              int i;
  16966.              char buffer[12];
  16967.              char *p;
  16968.  
  16969.              for (i = 0; i < 20; i++) {
  16970.                      p = itoa(i, buffer, 10);
  16971.                      p = strcat(buffer, ".dat");
  16972.                      streams[i] = fopen(buffer, "w+");
  16973.                      printf("streams[%d] = %d\n", i, streams[i]);
  16974.              }
  16975.      }
  16976.  
  16977.  Running outside of CodeView, the call to fopen() fails after 15
  16978.  streams have been opened. Running in CodeView Versions 1.x, the call
  16979.  fails after 15 files have been opened. However, in CodeView Versions
  16980.  2.00 to 2.30, it fails after 11 file handles have been opened.
  16981.  
  16982.  Response:
  16983.  
  16984.  CodeView Versions 2.00 to 2.30 require four file handles for their own
  16985.  use. Remember that MS-DOS itself has five preopened file handles. If
  16986.  you want to open more than 15 files, follow the steps specified in the
  16987.  C Version 5.10 README.DOC to modify the C start-up code to allow
  16988.  opening more than 20 files.
  16989.  
  16990.  
  16991.  77. Copying Text from Display Window to Dialog Window
  16992.  
  16993.  Product Version(s): 2.20   | 2.20
  16994.  Operating System:   MS-DOS | OS/2
  16995.  Flags: ENDUSER |
  16996.  Last Modified: 12-JAN-1989    ArticleIdent: Q40110
  16997.  
  16998.  Question:
  16999.  
  17000.  Is it possible to copy text from the display window down to the dialog
  17001.  window to use at the command line in Microsoft CodeView?
  17002.  
  17003.  Response:
  17004.  
  17005.  Yes, if you have a mouse. You can highlight with the mouse the section
  17006.  of text you would like to copy and press the INSERT key. The
  17007.  highlighted text will appear in the dialog box.
  17008.  
  17009.  This is very useful if you have very long variable names that you want
  17010.  to watch and don't want to retype the long variable name each time.
  17011.  Simply type a w? on the command line, then highlight the variable name
  17012.  with the mouse and press the INSERT key.
  17013.  
  17014.  Strange behavior can occur if you use the SHIFT key in combination
  17015.  with the INSERT key. For example, if you use the INSERT key on the
  17016.  extended keyboard along with the SHIFT key, it works the same as using
  17017.  INSERT alone. However, if you turn NUM LOCK off on the keypad so you
  17018.  can you the INSERT key with the SHIFT key, you will get a zero instead
  17019.  of the string of text. To get the string of text, you have to turn NUM
  17020.  LOCK on. This seems backwards because with NUM LOCK on you would
  17021.  expect to get a zero, but you get the text.
  17022.  
  17023.  The workaround is not to use the SHIFT key in conjunction with the
  17024.  INSERT key. INSERT alone works correctly.
  17025.  
  17026.  
  17027.  78. OS2PATCH for CVP Not Needed in OS/2 Version 1.10.
  17028.  
  17029.  Product Version(s): 2.20 2.30
  17030.  Operating System:   OS/2
  17031.  Flags: ENDUSER |
  17032.  Last Modified: 14-NOV-1988    ArticleIdent: Q30976
  17033.  
  17034.     The OS2PATCH supplied with CodeView (protected) Versions 2.20 and
  17035.  2.30 allows you to use command 7 on machines with math coprocessors.
  17036.  This patch works only with OS/2 Version 1.00. The PTRACE feature was
  17037.  updated in Version 1.10, so this patch is not needed in OS/2 Version
  17038.  1.10.
  17039.     This patch only works on IBMs version of OS/2 1.00.  If they have
  17040.  a different version have them talk to the people who they received
  17041.  OS/2 from.  If it was from us then they need to systems languages
  17042.  support.
  17043.     Please refer to the file OS2PATCH.DOC for more information.
  17044.  
  17045.  
  17046.  
  17047.  79. I/O Redirection Under CV Not Supported Prior to Version 2.30
  17048.  
  17049.  Product Version(s): 1.x 2.10 2.20 2.30 | 2.20 2.30
  17050.  Operating System:   MS-DOS             | OS/2
  17051.  Flags: ENDUSER |
  17052.  Last Modified: 23-JAN-1990    ArticleIdent: Q57870
  17053.  In versions of CodeView earlier than Version 2.30, it was not possible
  17054.  to redirect the input or output of the program being debugged. For
  17055.  example, a "filter" program that takes input from a file specified by
  17056.  the input redirection operator ("<") is hindered by this limitation
  17057.  under pre-2.30 CodeView because there is no way to specify that you
  17058.  want the redirection to apply to the application rather than to
  17059.  CodeView itself.
  17060.  
  17061.  In CodeView (CV) or protected-mode CodeView (CVP) Version 2.30,
  17062.  redirection on the command line following the program name is directed
  17063.  to the program being debugged. For example, invoking CodeView 2.30
  17064.  with the following command line
  17065.  
  17066.     CV test < test.dat
  17067.  
  17068.  causes all input to the program TEST.EXE to be read from the file
  17069.  TEST.DAT.
  17070.  
  17071.  Redirecting I/O to CodeView itself is useful for involved debugging
  17072.  sessions where many CodeView dialog commands can be put into a
  17073.  separate text file that is automatically read by CodeView during
  17074.  debugging. For instance, this method will allow a complicated
  17075.  debugging scenario to be accurately repeated any number of times.
  17076.  Prior to CV and CVP 2.30, this was the only type of redirection
  17077.  supported while debugging.
  17078.  
  17079.  Starting with CodeView 2.30, you can redirect I/O to both the
  17080.  application being debugged and to CodeView. The CodeView redirection
  17081.  is done with the /C command-line option, or from within CV itself with
  17082.  the redirection dialog commands ("<" and ">"). Since the /C switch
  17083.  allows you to specify CV dialog commands on the command line, you can
  17084.  specify the redirection at this point. For example, the following
  17085.  command line
  17086.  
  17087.     CV "/C<cv.dat" test < test.dat
  17088.  
  17089.  brings up CodeView with TEST.EXE as in the example above (with the
  17090.  TEST.EXE input coming from TEST.DAT), but this time CodeView also
  17091.  reads the debugging instructions to perform from the file CV.DAT.
  17092.  
  17093.  
  17094.  80. /2 and /O Switches Not Compatible
  17095.  
  17096.  Product Version(s): 2.30
  17097.  Operating System:   OS/2
  17098.  Flags: ENDUSER |
  17099.  Last Modified:  9-NOV-1988    ArticleIdent: Q30978
  17100.  
  17101.     The UTILITY.DOC states that the /O switch is not compatible with
  17102.  the /2 switch. However, the SDK Installation Notes file uses the
  17103.  following code as the example of how to debug child processes:
  17104.  
  17105.      cvp /2 /O <program> <program arguments>
  17106.  
  17107.     This file recommends that the /2 switch be used when debugging PM
  17108.  applications. The UTILITY.DOC file is correct. You cannot use the /2
  17109.  and /O switches at the same time.
  17110.  
  17111.  
  17112.  81. CVP Prompts "SYS0197 OS/2 Not Configured..." Error Message
  17113.  
  17114.  Product Version(s): 2.20
  17115.  Operating System:   OS/2
  17116.  Flags: ENDUSER |
  17117.  Last Modified:  9-NOV-1988    ArticleIdent: Q31658
  17118.  
  17119.     When loading CodeView protected mode (CVP), the "SYS0197 OS/2 not
  17120.  configured to run this application" error message may appear. A
  17121.  request for help on 0197 prompts the "requires input/output privilege"
  17122.  message. You need to set IOPL=YES in CONFIG.SYS to run CVP.
  17123.  
  17124.     The following information is from the section titled "Microsoft(R)
  17125.  CodeView(R) Debugger" of the Microsoft C Version 5.10 UTILITY.DOC
  17126.  file, the FORTRAN Version 4.10 CVREADME.DOC file, and the Microsoft
  17127.  Macro Assembler Version 5.10 README.DOC file.
  17128.  
  17129.  CONFIG.SYS Setting for CVP
  17130.     To run the protected-mode CodeView debugger (CVP.EXE), you must
  17131.  have the following line in your CONFIG.SYS file:
  17132.  
  17133.     IOPL=YES
  17134.  
  17135.  
  17136.  
  17137.  82. Methods for Debugging Large Programs within the 640K DOS Limit
  17138.  
  17139.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30
  17140.  Operating System:   MS-DOS
  17141.  Flags: ENDUSER |
  17142.  Last Modified: 12-FEB-1990    ArticleIdent: Q57941
  17143.  Because of the 640K limit under DOS, it is common to run out of memory
  17144.  when trying to debug large programs with CodeView. CodeView requires
  17145.  over 200K of RAM, not including the program being debugged. In
  17146.  addition, the symbolic information added by compiling with the /Zi
  17147.  switch greatly increases the executable size of the program you are
  17148.  trying to debug.
  17149.  
  17150.  The following is a list of the possible ways of getting around the
  17151.  limited memory problems for debugging:
  17152.  
  17153.  1. Include full symbolic information only in those modules that
  17154.     contain source code that you are currently trying to debug. In
  17155.     other words, compile only those modules with the /Zi switch. For
  17156.     the other modules, compile with the /Zd option, to put only line
  17157.     number information in the object files.
  17158.  
  17159.  2. Use overlays to swap parts of your code in and out, even if it is
  17160.     just during the development process. You can always link without
  17161.     overlays once your application is debugged.
  17162.  
  17163.  3. If you have expanded memory, use it by invoking CodeView with the
  17164.     /E switch. To work properly with CodeView, you should have LIM EMS
  17165.     3.2 or (preferably) 4.0. Expanded memory is used for storing the
  17166.     symbolic information, which can be a great percentage of your .EXE
  17167.     size.
  17168.  
  17169.  4. Use the CVPACK utility, which is documented in the Update Section
  17170.     of the C 5.1 "Microsoft CodeView and Utilities Software Development
  17171.     Tools for MS OS/2 and MS-DOS Operating Systems Update" manual.
  17172.     CVPACK will compress the debug information in the file by removing
  17173.     duplicate references. Use the /p option to achieve maximum
  17174.     compression.
  17175.  
  17176.  In trying to obtain a workable solution, you can use any combination
  17177.  of the above methods. If adequate debugging is still impossible, then
  17178.  you might look into the following possibilities:
  17179.  
  17180.  5. Switch to the OS/2 operating system. This may be limited as far as
  17181.     how much real mode program debugging you can do, depending on how
  17182.     compatible your application is with protected mode requirements.
  17183.  
  17184.  6. You might look into MagicCV from Nu-Mega Technologies of New
  17185.     Hampshire. MagicCV requires a 386-based computer because it uses
  17186.     virtual-86 mode of the processor to run CodeView in extended
  17187.     memory. This method reportedly allows CodeView to use only about 8K
  17188.     of conventional DOS memory. It should be noted that Microsoft does
  17189.     not endorse MagicCV or make any claims as to its usage. The
  17190.     information is offered only as a potential option. Nu-Mega can be
  17191.     reached at (603) 888-2386.
  17192.  
  17193.  
  17194.  83. Problems with CodeView and Logitech Mouse with Older Drivers
  17195.  
  17196.  Product Version(s): 2.00 2.10 2.20
  17197.  Operating System:   MS-DOS
  17198.  Flags: ENDUSER |
  17199.  Last Modified: 23-JAN-1990    ArticleIdent: Q31918
  17200.  
  17201.  Incompatibility problems have been reported with Logitech's mouse and
  17202.  CodeView. Some of the problems encountered are as follows:
  17203.  
  17204.  1. The Logitech mouse fails to function correctly with CodeView
  17205.     Version 2.20 when in 43-line mode. The characters within
  17206.     highlighted cells are incorrect until they are unhighlighted.
  17207.  
  17208.  2. When in either 43-line or 25-line mode, garbage characters are
  17209.     occasionally found at the DOS prompt following an exit from
  17210.     CodeView.
  17211.  
  17212.  The problems seem to be with Versions 3.20 and earlier of the Logitech
  17213.  mouse driver. An update of the mouse driver is available that corrects
  17214.  these problems. Logitech can be reached at (415) 795-0427. Logitech
  17215.  also has a bulletin board service, which may contain the latest driver
  17216.  and can be reached at (415) 795-0408.
  17217.  
  17218.  A Microsoft Mouse or 100 percent Microsoft-compatible mouse is
  17219.  required for use with CodeView. In addition, you must use Microsoft's
  17220.  mouse driver Version 6.00 or later, or a driver that exactly emulates
  17221.  these Microsoft drivers.
  17222.  
  17223.  
  17224.  84. Using the T Command to Echo CodeView Output
  17225.  
  17226.  Product Version(s): 2.00 2.10 2.20
  17227.  Operating System:   MS-DOS
  17228.  Flags: ENDUSER |
  17229.  Last Modified: 16-NOV-1988    ArticleIdent: Q31919
  17230.  
  17231.     To generate and record a history of the source lines stepped
  17232.  through in the course of a debugging session, do the following:
  17233.  
  17234.     1. Start CodeView in sequential mode using the /T option.
  17235.     2. While in sequential mode, enter the Redirect Output (>) command,
  17236.  followed by a filename. If no filename is specified, then stdout will
  17237.  be assumed.
  17238.     3. If you wish to view the output as it is redirected, precede the
  17239.  redirection operator with the echo command (T).
  17240.     4. If a second redirection operator is specified, the redirection
  17241.  file is appended to rather than truncated before output.
  17242.  
  17243.     For more information on output redirection, refer to the "System
  17244.  Commands" section of the "Microsoft CodeView and Utilities" manual.
  17245.  
  17246.     The following example demonstrates this process:
  17247.  
  17248.  CV> T > log.dat  or T >> log.dat
  17249.  CV> t
  17250.  CV> t
  17251.  CV> t
  17252.  CV> .
  17253.  CV> .
  17254.  CV> .
  17255.  CV> q
  17256.  
  17257.     The lines traced will be written both to the console and to the log
  17258.  file.
  17259.  
  17260.  
  17261.  85. CHAIN Statement in Compiled BASIC Not Supported by CodeView
  17262.  
  17263.  Product Version(s): 2.20
  17264.  Operating System:   MS-DOS
  17265.  Flags: ENDUSER | B_QuickBas B_BasicCom
  17266.  Last Modified: 16-NOV-1988    ArticleIdent: Q32265
  17267.  
  17268.     In Microsoft CodeView, when debugging compiled BASIC programs that
  17269.  CHAIN, you can view only the first program executed (the one given in
  17270.  the CV command line). The modules that are CHAINed-to cannot be viewed
  17271.  or stepped through, and their variables cannot be looked at, even if
  17272.  these modules are successfully executed. In fact, you cannot gain any
  17273.  information about the CHAINed modules, other than whether or not they
  17274.  execute correctly, unless you execute them separately in CodeView.
  17275.     This information applies to QuickBASIC Versions 4.00 and 4.00b,
  17276.  and the Microsoft BASIC Compiler Version 6.00 for MS-DOS and OS/2.
  17277.  
  17278.  
  17279.  
  17280.  86. CodeView Cannot Debug Source Code in Include Files
  17281.  
  17282.  Product Version(s): 1.00 1.10 1.11 2.00 2.02.02 2.10 2.20
  17283.  Operating System:   MS-DOS
  17284.  Flags: ENDUSER |
  17285.  Last Modified:  9-NOV-1988    ArticleIdent: Q34922
  17286.  
  17287.  CodeView cannot debug source code in include files. This information
  17288.  is documented on Page 7 of the "Microsoft CodeView and Utilities"
  17289.  manual. The explanation for the restriction on include files says "You
  17290.  will not be able to use the CodeView debugger to debug source code in
  17291.  include files."
  17292.  
  17293.  This information means programs with include files that contain
  17294.  executable statements cannot be debugged with CodeView.
  17295.  
  17296.  The usual symptom of this problem is that after tracing or otherwise
  17297.  trying to execute your program, you will be viewing one of your
  17298.  include files instead of your normal source code. Repeated attempts
  17299.  to view the main or other source files will result in viewing the
  17300.  include file again.
  17301.  
  17302.  This is program design for the product. Microsoft's compilers do not
  17303.  generate symbolic information for code in include files. As a result,
  17304.  CodeView is confused by the discrepancies, and the subsequent behavior
  17305.  is unpredictable. Include files only can contain prototypes,
  17306.  declarations, #defines or #includes, etc.
  17307.  
  17308.  (Note that these items are all "nonexecutable" statements )
  17309.  
  17310.  Although it is valid C code, include files must not contain
  17311.  initializations or function definitions or other executable statements
  17312.  for CodeView to be able to debug your programs properly.
  17313.  
  17314.  
  17315.  87. No Symbolic Information Generated for Pascal Units
  17316.  
  17317.  Product Version(s): 2.10 2.20 2.30 | 2.20 2.30
  17318.  Operating System:   MS-DOS         | OS/2
  17319.  Flags: ENDUSER | s_pascal
  17320.  Last Modified:  8-MAR-1990    ArticleIdent: Q57943
  17321.  
  17322.  The Microsoft Pascal Compiler Version 4.00 does not generate symbolic
  17323.  debugging information for Pascal units. As a result, when tracing
  17324.  through a Pascal program unit, any attempt to access local variables
  17325.  by using trace/watchpoints, dumps, examines, etc. yields a "symbol
  17326.  unknown" error.
  17327.  
  17328.  The only workaround is to transform the program units into modules.
  17329.  
  17330.  
  17331.  88. CVP Accessing I/O Ports
  17332.  
  17333.  Product Version(s): 2.20 2.30
  17334.  Operating System:   OS/2
  17335.  Flags: ENDUSER | buglist2.20 buglist2.30
  17336.  Last Modified: 14-AUG-1989    ArticleIdent: Q36885
  17337.  
  17338.  In the "Microsoft CodeView and Utilities Software Development Tools
  17339.  for the MS-DOS Operating System," Sections 6.6 and 10.5 discuss the
  17340.  Port Input and Port Output commands respectively. These commands
  17341.  function correctly in CV under MS-DOS. However, CVP under OS/2
  17342.  generates a protection violation when trying to access a port. The
  17343.  port input and output commands do not function in CVP Version 2.20
  17344.  under OS/2.
  17345.  
  17346.  Microsoft has confirmed this to be a problem in Version 2.20. We are
  17347.  researching this problem and will post new information as it becomes
  17348.  available.
  17349.  
  17350.  
  17351.  89. Using CodeView to Examine FORTRAN Arrays
  17352.  
  17353.  Product Version(s): 2.20 2.30 | 2.20 2.30
  17354.  Operating System:   MS-DOS    | OS/2
  17355.  Flags: ENDUSER |
  17356.  Last Modified: 14-AUG-1989    ArticleIdent: Q37548
  17357.  
  17358.  Question:
  17359.  
  17360.  I have allocated memory for a three-dimensional array in FORTRAN. How
  17361.  can I examine the contents of a row using CodeView?
  17362.  
  17363.  Response:
  17364.  
  17365.  You can use CodeView to display a single element of the array using
  17366.  ?arrayname(x,x,x), where "arrayname" consists of the first six
  17367.  characters of the array name and "(x,x,x)" must be a valid cell in the
  17368.  array.
  17369.  
  17370.  There is no way to display more than one cell of the array using this
  17371.  command. To display many cells, you must do a memory dump of the
  17372.  addresses where the array is stored. Use the examine command (X) to
  17373.  get the starting address of the array, and dump (D) to dump the
  17374.  elements.
  17375.  
  17376.  FORTRAN stores array elements in column-major order. Use the following
  17377.  formula to determine the address where any cell (i,j,k) is stored,
  17378.  where Max_Row is the maximum i possible and Max_Col is the maximum j
  17379.  possible:
  17380.  
  17381.      MemAddr = start_addr+(size of elements)*
  17382.                       (Max_Row((k-1)(Max_Col)+(j-1))+(i-1))
  17383.  
  17384.  "Size of elements" is the number of bytes of each element in the
  17385.  array.
  17386.  
  17387.  
  17388.  90. CodeView Unexpectedly Exits to DOS
  17389.  
  17390.  Product Version(s): 2.10 2.20
  17391.  Operating System:   MS-DOS
  17392.  Flags: ENDUSER |
  17393.  Last Modified:  8-APR-1990    ArticleIdent: Q37566
  17394.  
  17395.  When debugging a program with CodeView, certain operations cause it to
  17396.  exit to DOS without giving any warning or error message. Some of the
  17397.  things that cause this behavior are trying to access help, setting a
  17398.  watch variable, and returning from a DOS shell.
  17399.  
  17400.  This problem occurs because not enough file handles are being
  17401.  allocated at boot time with "files=XX" in CONFIG.SYS. An error message
  17402.  is printed, but then over written before most people can see it.
  17403.  
  17404.  The solution is to make sure files are set to 20 in CONFIG.SYS.
  17405.  
  17406.  
  17407.  91. How CodeView Handles DosExitList Routines
  17408.  
  17409.  Product Version(s): 2.20
  17410.  Operating System:   OS/2
  17411.  Flags: ENDUSER |
  17412.  Last Modified: 12-JAN-1989    ArticleIdent: Q40270
  17413.  
  17414.  Question:
  17415.  
  17416.  CodeView does not seem to be executing my DosExitList. What should I
  17417.  do to execute the exit list?
  17418.  
  17419.  Response:
  17420.  
  17421.  If you are in your program and issue the GO command, your program
  17422.  executes to the end of your application, giving the message "Thread
  17423.  terminated normally." At this point, you can use the GO command or
  17424.  trace into your exit routine. However, if you would like to quit your
  17425.  program and go to your exit handler in the middle of executing your
  17426.  program, you have two choices.
  17427.  
  17428.  When you quit CodeView ("q"), your code including your DosExitList
  17429.  will not be executed. The first method to execute your DosExitList is
  17430.  the safest, but you are not able to trace through your exit routine.
  17431.  When you want to exit, type the following:
  17432.  
  17433.     ? myexithandler()
  17434.  
  17435.  This command executes the function "myexithandler", which is your
  17436.  DosExitList routine. After this command has been performed, you can
  17437.  quit CodeView ("q") because all of your cleanup has been accomplished.
  17438.  
  17439.  The second method, which is less reliable, is to modify the instruction
  17440.  pointer (IP) so that you can effectively jump to the end of your
  17441.  program. Before you do this, make certain that you are not in a
  17442.  subfunction. If you are not in main(), jumping to the end of the
  17443.  program causes problems with the stack. While in your main() routine,
  17444.  enter the following at the CodeView command line, where XXXX is the
  17445.  value of the IP when you are at the last curly brace at the end of
  17446.  your program:
  17447.  
  17448.     R IP XXXX
  17449.  
  17450.  This command causes a jump to the last curly brace; you can step
  17451.  through your program from there. This method allows you to step
  17452.  through your exit routine, but it is a little more risky.
  17453.  
  17454.  
  17455.  92. You Cannot Display Past Column 71 in CodeView
  17456.  
  17457.  Product Version(s): 2.20   | 2.20
  17458.  Operating System:   MS-DOS | OS/2
  17459.  Flags: ENDUSER |
  17460.  Last Modified: 20-JAN-1989    ArticleIdent: Q40428
  17461.  
  17462.  Can I view my code beyond column 71 in CodeView like I can in the
  17463.  Microsoft editor?
  17464.  
  17465.  In CodeView Version 2.20, you cannot scroll your code to the right.
  17466.  You should either rewrite the source code or, if you used tabs in the
  17467.  source code, reduce the tab size with the # dialog command, as
  17468.  described on Page 240 of the "Microsoft CodeView and Utilities"
  17469.  manual.
  17470.  
  17471.  
  17472.  
  17473.  93. Display Command Returns Incorrect Result for FORTRAN Function
  17474.  
  17475.  Product Version(s): 2.20 2.30 | 2.20 2.30
  17476.  Operating System:   MS-DOS    | OS/2
  17477.  Flags: ENDUSER | buglist2.20 buglist2.30
  17478.  Last Modified: 14-AUG-1989    ArticleIdent: Q40586
  17479.  
  17480.  The display command does not return correct values for the
  17481.  user-defined FORTRAN real functions in Microsoft CodeView.
  17482.  
  17483.  The display command calls integer functions and returns correct
  17484.  results.
  17485.  
  17486.  Microsoft has confirmed this to be a problem in Version 2.20. We are
  17487.  researching this problem and will post new information as it becomes
  17488.  available.
  17489.  
  17490.  The display command is discussed in Chapter 6 of the "Microsoft
  17491.  CodeView and Utilities" manual. The valid FORTRAN expressions for
  17492.  CodeView are discussed in the Chapter 4 of the same manual.
  17493.  
  17494.  
  17495.  94. CodeView Does Not Work with Grouped Code Segments
  17496.  
  17497.  Product Version(s): 2.20   | 2.20
  17498.  Operating System:   MS-DOS | OS/2
  17499.  Flags: ENDUSER | H_MASM
  17500.  Last Modified:  9-FEB-1989    ArticleIdent: Q40784
  17501.  
  17502.  When using MASM it is possible to associate various segments into a
  17503.  group; DGROUP is an example of this technique. Grouped data or stack
  17504.  segments do not affect CodeView, but CodeView does not recognize
  17505.  grouped code segments. The program will execute correctly under
  17506.  CodeView, but none of the CodeView functions will be available on the
  17507.  second and subsequent segments in the code group.
  17508.  
  17509.  The following code segment illustrates this behavior:
  17510.  
  17511.  codegroup  GROUP ASEG,BSEG
  17512.          assume cs:codegroup
  17513.  
  17514.  ASEG    SEGMENT WORD PUBLIC 'CODE'
  17515.  A:
  17516.          mov ax,1
  17517.          mov ax,1
  17518.          JMP B
  17519.  ASEG    ends
  17520.  
  17521.  ;   Will not be able to single step through this section
  17522.  BSEG    SEGMENT WORD PUBLIC 'CODE'
  17523.  B:      mov ax,1
  17524.          mov ax,1
  17525.          mov ax,1
  17526.          int 21h
  17527.  BSEG    ends
  17528.          end A
  17529.  
  17530.  Once the program executes into the BSEG segment, all CodeView
  17531.  functionality will be lost. You cannot set any breakpoints or single
  17532.  step through the BSEG segment of code. It appears that CodeView does
  17533.  not store any symbolic information for the BSEG segment. Any attempt
  17534.  to single step through this section of code will result in CodeView
  17535.  executing the BSEG segment of code until the program is completed.
  17536.  
  17537.  Microsoft is researching this problem and will post new information as
  17538.  it becomes available.
  17539.  
  17540.  
  17541.  95. CodeView and Video Pages
  17542.  
  17543.  Product Version(s): 2.00 2.10 2.20 | 2.20
  17544.  Operating System:   MS-DOS         | OS/2
  17545.  Flags: ENDUSER |
  17546.  Last Modified:  2-MAR-1989    ArticleIdent: Q41101
  17547.  
  17548.  Question:
  17549.  
  17550.  Is there anyway to specify which video page CodeView uses? I have an
  17551.  application that uses video page one; I am not able to use CodeView
  17552.  with it because CodeView also uses video page one.
  17553.  
  17554.  Response:
  17555.  
  17556.  CodeView does not allow you to specify which video page it will use.
  17557.  As a result, any application that uses video page one conflicts with
  17558.  CodeView and the screen becomes corrupted.
  17559.  
  17560.  The recommend work around in this situation is to use the two monitor
  17561.  option for CodeView. This option allows CodeView to send the
  17562.  application's output to one screen while using the first screen for
  17563.  its own output.
  17564.  
  17565.  Another less desirable workaround would be to avoid the use of video
  17566.  page one in programs that will be used under CodeView.
  17567.  
  17568.  
  17569.  
  17570.  96. Removing CodeView Information from .LIBs and .EXEs
  17571.  
  17572.  Product Version(s): 2.20   | 2.20
  17573.  Operating System:   MS-DOS | OS/2
  17574.  Flags: ENDUSER | SR# G890207-11424
  17575.  Last Modified:  2-MAR-1989    ArticleIdent: Q41371
  17576.  
  17577.  Question:
  17578.  
  17579.  Is there a way to remove CodeView symbols from a .LIB or .EXE file?
  17580.  
  17581.  Response:
  17582.  
  17583.  Although there is no utility that removes CodeView information from
  17584.  libraries, EXEPACK will remove CodeView information from .EXE files in
  17585.  the course of packing them. You can also remove information from an
  17586.  .EXE file by relinking it without the /CODEVIEW option.
  17587.  
  17588.  The only way to remove CodeView information from a library is to
  17589.  recompile the source modules and use the LIB utility to rebuild the
  17590.  library.
  17591.  
  17592.  
  17593.  97. CodeView: Debugging Presentation Manager Printer Drivers
  17594.  
  17595.  Product Version(s): 2.20 2.30
  17596.  Operating System:   OS/2
  17597.  Flags: ENDUSER |
  17598.  Last Modified: 28-MAR-1989    ArticleIdent: Q42780
  17599.  
  17600.  To debug OS/2 Presentation Manager (PM) printer drivers, you must use
  17601.  the kernel debugger. Currently, PM printer drivers fall under the same
  17602.  category as lower-level device drivers. These device drivers cannot be
  17603.  debugged using the current version of CodeView.
  17604.  
  17605.  
  17606.  98. Dump Command on Arrays in FORTRAN Gives Syntax Error
  17607.  
  17608.  Product Version(s): 1.10 2.20 | 2.20
  17609.  Operating System:   MS-DOS    | OS/2
  17610.  Flags: ENDUSER | H_FORTRAN buglist2.20 buglist2.30
  17611.  Last Modified: 21-AUG-1989    ArticleIdent: Q42942
  17612.  
  17613.  Microsoft CodeView Versions 2.20 and 2.30 gives a "Syntax error" when
  17614.  attempting to use the Dump command on an array of dimension greater
  17615.  than 1.
  17616.  
  17617.  For example, issuing the DI i(1,3) command to dump the contents of an
  17618.  array element fails.
  17619.  
  17620.  To work around this problem use one of the following methods:
  17621.  
  17622.  1. Use the "?" command, as follows:
  17623.  
  17624.        ? i(1,3)
  17625.  
  17626.  2. Enclose each dimension index within parentheses and omit the comma,
  17627.     as follows:
  17628.  
  17629.        DI i((1)(3))
  17630.  
  17631.     DI i(1(3)) and DI i((1)3) are also acceptable.
  17632.  
  17633.     A three dimensional example would look like the following:
  17634.  
  17635.        DI j(1(2)3)
  17636.  
  17637.     Any permutation of the parenthesis around the index is sufficient.
  17638.  
  17639.  Microsoft has confirmed this to be a problem in Versions 2.20 and
  17640.  2.30. We are researching this problem and will post new information as
  17641.  it becomes available.
  17642.  
  17643.  
  17644.  99. CodeView Protect: /43 Switch Doesn't Work on VGA Adapters
  17645.  
  17646.  Product Version(s): 2.20
  17647.  Operating System:   OS/2
  17648.  Flags: ENDUSER | buglist2.20
  17649.  Last Modified: 18-APR-1989    ArticleIdent: Q43043
  17650.  
  17651.  The /43 switch for CodeView, used to debug in 43 line mode, is ignored
  17652.  when a VGA video adapter is being used under OS/2. This switch works
  17653.  properly as documented in DOS, or when an EGA adapter is being used.
  17654.  The /50 switch, used to debug in 50 line mode, also works properly as
  17655.  documented.
  17656.  
  17657.  If you wish to use CodeView Version 2.20 in 43 line mode under OS/2,
  17658.  the MODE command can be used first to set the entire screen group into
  17659.  43 line mode. Using MODE 80,43 at the OS/2 prompt will accomplish this
  17660.  result. Starting CodeView without any switches will then cause it to
  17661.  use the current video mode.
  17662.  
  17663.  Microsoft has confirmed this to be a problem in CodeView Protect
  17664.  Version 2.20. This feature is under review and will be considered for
  17665.  inclusion in a future release.
  17666.  
  17667.  
  17668.  100. CV: K Command in Secondary Module Sets Breakpoints in Main
  17669.  
  17670.  Product Version(s): 2.20   | 2.20
  17671.  Operating System:   MS-DOS | OS/2
  17672.  Flags: ENDUSER | buglist2.20
  17673.  Last Modified:  6-APR-1989    ArticleIdent: Q43170
  17674.  
  17675.  In some cases the K (call stack) command will cause CodeView to become
  17676.  uncertain as to where to set breakpoints.
  17677.  
  17678.  If an attempt to set a breakpoint is made in a module of a
  17679.  multi-module program immediately after using the K command then the
  17680.  breakpoint will be set in the module containing main() instead of in
  17681.  the current module.
  17682.  
  17683.  If the corresponding line in the first module is not an executable
  17684.  line then CodeView will issue the expected beep to indicate that the
  17685.  breakpoint could not be set.
  17686.  
  17687.  If the corresponding line is an executable line then there will be no
  17688.  indication at all that the breakpoint has been set until that module
  17689.  is again in view. At that point the breakpoint will be highlighted as
  17690.  usual. This behavior will occur in any module accessed after the one
  17691.  containing main().
  17692.  
  17693.  Breakpoints will be set properly after using the K command if any
  17694.  stepping is performed, the view is changed, or the Calls menu is
  17695.  accessed.
  17696.  
  17697.  Microsoft is researching this problem and will post new information as
  17698.  it becomes available.
  17699.  
  17700.  
  17701.  101. Vertical Scroll Inactive with MODE CO40 and Dual Monitors
  17702.  
  17703.  Product Version(s): 2.x
  17704.  Operating System:   MS-DOS
  17705.  Flags: ENDUSER | S_C buglist2.20
  17706.  Last Modified: 18-APR-1989    ArticleIdent: Q43260
  17707.  
  17708.  While debugging a program using Microsoft CodeView and dual monitors,
  17709.  the vertical scroll bar is disabled when the video mode is set to
  17710.  40-line color text. This occurs if the mode is set either at the
  17711.  command line
  17712.  
  17713.     MODE CO40
  17714.  
  17715.  or from within a program as follows:
  17716.  
  17717.     _setvideomode(_TEXTC40);
  17718.  
  17719.  The scroll bar remains inactive until the mode is changed. This
  17720.  problem does not occur on a single monitor system or in any other
  17721.  video modes.
  17722.  
  17723.  Microsoft has confirmed this to be a problem in Version 2.20. We are
  17724.  researching the problem and will post new information as it becomes
  17725.  available.
  17726.  
  17727.  The following program demonstrates the problem:
  17728.  
  17729.  #include <graph.h>
  17730.  
  17731.  void main (void)
  17732.  {
  17733.    _setvideomode(_TEXTC40);
  17734.    _setvideomode(DEFAULTMODE);
  17735.  }
  17736.  
  17737.  
  17738.  
  17739.  102. Selecting Text for Use with Commands
  17740.  
  17741.  Product Version(s): 2.20 2.30 | 2.20 2.30
  17742.  Operating System:   MS-DOS    | OS/2
  17743.  Flags: ENDUSER | docerr insert
  17744.  Last Modified:  9-APR-1990    ArticleIdent: Q59408
  17745.  
  17746.  In CodeView Versions 2.20 and 2.30, you supposedly can press the left
  17747.  mouse button to highlight the command to be copied, and then press the
  17748.  INS key to copy the command. However, this method works only with the
  17749.  mouse and not with the keyboard.
  17750.  
  17751.  On Page 64 of the "Microsoft FORTRAN CodeView and Utilities User's
  17752.  Guide" Version 5.0 manual, it incorrectly states that you can copy any
  17753.  text that appears in any window. This is incorrect because you can
  17754.  only copy text in the command window.
  17755.  
  17756.  
  17757.  103. CodeView: View Command Fails with Underscore in Filenames
  17758.  
  17759.  Product Version(s): 2.20   | 2.20
  17760.  Operating System:   MS-DOS | OS/2
  17761.  Flags: ENDUSER | buglist2.20
  17762.  Last Modified:  3-MAY-1989    ArticleIdent: Q43508
  17763.  
  17764.  Assume that two source files, MAINPROG.C and FILE_NAM.C, have been
  17765.  compiled with CodeView information. The main function in MAINPROG.C
  17766.  calls a function in FILE_NAM.C.
  17767.  
  17768.  When the following command is executed in CodeView, CodeView responds
  17769.  with "syntax error":
  17770.  
  17771.     V.FILE_NAM.C
  17772.  
  17773.  When FILE_NAM.C is renamed and recompiled as FILENAM.C, the following
  17774.  command works properly, and the source code in FILENAM.C is displayed:
  17775.  
  17776.     V.FILENAM.C
  17777.  
  17778.  Attempts to open a file with an underscore character will work
  17779.  correctly through the "Open" menu in CodeView, but will fail with the
  17780.  View command.
  17781.  
  17782.  Microsoft has confirmed this to be a problem in Version 2.20. We are
  17783.  researching this problem and will post new information as it becomes
  17784.  available.
  17785.  
  17786.  
  17787.  104. Cannot Set Breakpoint on an Executable Line with CodeView 3.00
  17788.  
  17789.  Product Version(s): 3.00   | 3.00
  17790.  Operating System:   MS-DOS | OS/2
  17791.  Flags: ENDUSER |
  17792.  Last Modified: 19-APR-1990    ArticleIdent: Q60338
  17793.  
  17794.  If you cannot set a breakpoint on a particular line of code, make sure
  17795.  you have used the -Zi and -Od options to create executable code that
  17796.  has full CodeView debugging capabilities.
  17797.  
  17798.  Some code in the executable is concatenated if the -Od option is not
  17799.  used.
  17800.  
  17801.  Sample Code
  17802.  -----------
  17803.  
  17804.  #include <stdio.h>
  17805.  
  17806.  int foo();
  17807.  
  17808.  void main (void)
  17809.  {
  17810.     int a,b,c;
  17811.  
  17812.     a = foo();/* this line would be concatenated into the next */
  17813.     b = a + c;/* line to look like b=(a=foo())+c.              */
  17814.  }
  17815.  
  17816.  int foo()
  17817.  {
  17818.     return(10);
  17819.  }
  17820.  
  17821.  
  17822.  105. Commands Invoked with "?" Command Must Be Compiled with /Zi
  17823.  
  17824.  Product Version(s): 2.20   | 2.20
  17825.  Operating System:   MS-DOS | OS/2
  17826.  Flags: ENDUSER |
  17827.  Last Modified:  3-MAY-1989    ArticleIdent: Q43556
  17828.  
  17829.  Invoking C functions in CodeView using the "?" command works as
  17830.  expected as long as the function is contained in a module that was
  17831.  compiled with /Zi for the CodeView information. However, if you invoke
  17832.  a run-time library function, CodeView returns the error message
  17833.  "syntax error."
  17834.  
  17835.  The reason for the error message is that the module containing the
  17836.  library function is not compiled with the CodeView option /Zi. The
  17837.  error message is not dependent on the fact that the function is in the
  17838.  library rather than being user-defined. If a user-defined function is
  17839.  contained in a module that is compiled without /Zi for the CodeView
  17840.  information and you try to invoke it with the "?" command, CodeView
  17841.  will return the same error message.
  17842.  
  17843.  The "?" command is formally referred to in the CodeView Utilities
  17844.  menu as the Display Expression command.
  17845.  
  17846.  
  17847.  106. CodeView May Single Step onto a Comment Line
  17848.  
  17849.  Product Version(s): 2.20   | 2.20
  17850.  Operating System:   MS-DOS | OS/2
  17851.  Flags: ENDUSER | buglist2.20
  17852.  Last Modified:  2-JUN-1989    ArticleIdent: Q43601
  17853.  
  17854.  When using CodeView to single step the following program, the current
  17855.  execution line will be put on the first comment line. CodeView should
  17856.  always skip over the comment line.
  17857.  
  17858.  The program is compiled as required for running in CodeView. The
  17859.  compiling command used could be the following:
  17860.  
  17861.     cl /Zi /Od test.c
  17862.  
  17863.  Microsoft has confirmed this to be a problem with CodeView Version
  17864.  2.20. We are researching the problem and will post new information as
  17865.  it becomes available.
  17866.  
  17867.  This problem has no effect on the application program's performance.
  17868.  
  17869.  The following is the program:
  17870.  
  17871.  /*   test.c   */
  17872.  #include <stdio.h>
  17873.  int i = 1 ;
  17874.  void main (void)
  17875.  {
  17876.  if ( i )
  17877.       i = 0 ;
  17878.       /* first comment line */
  17879.  else
  17880.       /* more comment */
  17881.       i = 1 ;
  17882.  }
  17883.  
  17884.  
  17885.  107. Returning Control to CodeView
  17886.  
  17887.  Product Version(s): 2.20
  17888.  Operating System:   MS-DOS
  17889.  Flags: ENDUSER | CONTROL-C CONTROL+C CONTROL+BREAK CONTROL-BREAK ^C ^BREAK
  17890.  Last Modified:  3-MAY-1989    ArticleIdent: Q43648
  17891.  
  17892.  The following are two software methods of returning control to
  17893.  CodeView during program execution:
  17894.  
  17895.  1. Use the debug interrupt, interrupt 03, in your code. Interrupt 03
  17896.     is called a microprocessor (or logical) interrupt. It is the
  17897.     interrupt that CodeView uses to make breakpoints. Hard code
  17898.     interrupt 03 into your code in selected places where you want to
  17899.     return control to CodeView. The following sample program will
  17900.     demonstrate the technique. Note that a macro could easily be
  17901.     constructed to insert breakpoints where desired.
  17902.  
  17903.          #include <dos.h>
  17904.          #include <stdio.h>
  17905.  
  17906.          void main()
  17907.          {
  17908.              union REGS    inregs;
  17909.              int           i = 1;
  17910.  
  17911.              for( ;; )
  17912.              {
  17913.                  printf( "Loop iteration: %d\n", i++ );
  17914.                  int86( 0x03, &inregs, &inregs );
  17915.              }
  17916.  
  17917.  2. Use CTRL+C and CTRL+BREAK to return control to CodeView. This is
  17918.     a useful method for breaking out of a program is currently running
  17919.     or that has locked up.  The position in the source code to which
  17920.     you are returned depends on when you hit the ^C and what caused
  17921.     the system to hang, e.g. an infinite loop, a bad pointer, etc.
  17922.     Execution may be continued from this point in the usual manner
  17923.     (F5, F8, F10, etc.).
  17924.  
  17925.     Under OS/2 CTRL+BREAK does not return control to CodeView. CTRL+C
  17926.     may be used to abort a normally executing program but you cannot
  17927.     continue to debug from that point as you can in DOS.
  17928.  
  17929.  There is no hardware interrupt that will return control to CodeView.
  17930.  
  17931.  
  17932.  108. Cannot Open Source File Under CVP
  17933.  
  17934.  Product Version(s): 2.20
  17935.  Operating System:   OS/2
  17936.  Flags: ENDUSER | buglist2.20 buglist2.30 buglist2.4.1
  17937.  Last Modified: 18-SEP-1989    ArticleIdent: Q45135
  17938.  
  17939.  Problem:
  17940.  
  17941.  When using CodeView Protect (CVP) Version 2.20, I trace my program
  17942.  through a number of source files and after some number of files CVP is
  17943.  no longer able to open source files. When CVP gets into this
  17944.  situation, it automatically goes into mixed mode -- displaying line
  17945.  numbers but no source text. In this state, trying to use the "v"
  17946.  command to look at another (not previously looked at) file results in
  17947.  a red message box telling me that CVP can't open the file.
  17948.  
  17949.  Response:
  17950.  
  17951.  This is a problem with CVP Version 2.20 and 2.30. CVP is running into a
  17952.  file limit. To work around this problem, before you step out of the first
  17953.  module, open the source file containing the code you wish to debug and
  17954.  set a breakpoint there. Now "go" to this location by pressing the F5
  17955.  key. This procedure allows you to start debugging at a location deep
  17956.  into the file without opening multiple source files.
  17957.  
  17958.  Microsoft has confirmed this to be a problem with CodeView versions
  17959.  2.20 and 2.30. We are researching this problem and will post new
  17960.  information as it becomes available.
  17961.  
  17962.  
  17963.  109. Incorrect Handling of SP Can Cause CodeView to Corrupt Stack
  17964.  
  17965.  Product Version(s): 2.20 2.30 | 2.20 2.30
  17966.  Operating System:   MS-DOS    | OS/2
  17967.  Flags: ENDUSER |
  17968.  Last Modified:  7-JUN-1989    ArticleIdent: Q45183
  17969.  
  17970.  CodeView will use your program's stack for temporary variables in
  17971.  between assembly instructions. Thus, when writing an assembly language
  17972.  program, if you forget to increase the stack pointer (SP) to point
  17973.  beyond the memory locations you are using on the stack, CodeView will
  17974.  overwrite that memory.
  17975.  
  17976.  This is expected behavior. Even if CodeView did not use the stack, you
  17977.  would still have to increment the stack pointer to keep your program
  17978.  from overwriting your variables when you make a call, or with any
  17979.  operation that pushes values on the stack.
  17980.  
  17981.  
  17982.  110. Switching Out of PM Application Hangs System under Codeview
  17983.  
  17984.  Product Version(s): 2.20
  17985.  Operating System:   OS/2
  17986.  Flags: ENDUSER |
  17987.  Last Modified: 16-MAY-1989    ArticleIdent: Q44418
  17988.  
  17989.  Question:
  17990.  
  17991.  I am using CodeView to debug my Presentation Manager (PM) application.
  17992.  Why does my machine sometimes hang when I use CTRL+ESC to switch to
  17993.  the OS/2 program selector?
  17994.  
  17995.  Response:
  17996.  
  17997.  Presentation Manager applications require the use of the Presentation
  17998.  Manager shell. To debug PM applications, CodeView must put hooks into
  17999.  the Presentation Manager before the PM application is executed. This
  18000.  process works properly while inside CodeView, but if you try to switch
  18001.  back to the program selector, PM is in an unknown execution state.
  18002.  
  18003.  Therefore, to switch out of CodeView while debugging a PM application,
  18004.  you must first restart or end the program inside CodeView. This tells
  18005.  CodeView to restore the Presentation Manager to its original
  18006.  condition.
  18007.  
  18008.  
  18009.  111. SYS0317 Caused by Running CVP on a DOS Application
  18010.  
  18011.  Product Version(s): 2.20
  18012.  Operating System:   OS/2
  18013.  Flags: ENDUSER |
  18014.  Last Modified: 31-MAY-1989    ArticleIdent: Q44707
  18015.  
  18016.  The following message results from running a DOS application under
  18017.  Microsoft CodeView Version 2.20 or 2.30 for protected mode:
  18018.  
  18019.     SYS0317: The system cannot find message 0491
  18020.     in message file OSO001.MSG
  18021.  
  18022.  The screen is then cleared and the OS/2 prompt returns.
  18023.  
  18024.  
  18025.  112. /43 Starts CodeView with Screen Swapping Enabled
  18026.  
  18027.  Product Version(s): 2.20 2.30 | 2.20 2.30
  18028.  Operating System:   MS-DOS    | OS/2
  18029.  Flags: ENDUSER |
  18030.  Last Modified:  7-JUN-1989    ArticleIdent: Q45185
  18031.  
  18032.  When CodeView is started with the /43 switch to bring it up in 43-line
  18033.  mode, screen swapping is automatically enabled. This behavior is by
  18034.  design, although it is not stated in the documentation for the
  18035.  product.
  18036.  
  18037.  
  18038.  113. Setting a Breakpoint Highlights More Than One Line
  18039.  
  18040.  Product Version(s): 2.20
  18041.  Operating System:   MS-DOS
  18042.  Flags: ENDUSER | buglist2.20
  18043.  Last Modified:  7-JUN-1989    ArticleIdent: Q45241
  18044.  
  18045.  When setting a breakpoint, CodeView may highlight two or more lines of
  18046.  code when you do the following:
  18047.  
  18048.  1. Compile C program (e.g., "Hello, world") with /Zi /Od.
  18049.  
  18050.  2. Load CodeView with 50 line mode (in VGA mode) as follows:
  18051.  
  18052.        cv /50 hello.c).
  18053.  
  18054.  3. Display mixed source and assembly.
  18055.  
  18056.  4. Move the cursor to the edit window and scroll down two or three
  18057.     pages of start-up assembly code.
  18058.  
  18059.  5. Set and remove breakpoints at arbitrary locations. In some cases,
  18060.     multiple lines will be highlighted and the display altered. The
  18061.     code itself is not changed. To restore the altered display, page
  18062.     down and then page up to the altered location.
  18063.  
  18064.  CVP does display this problem.
  18065.  
  18066.  Microsoft has confirmed this to be a problem in CodeView Version 2.20.
  18067.  We are researching this problem and will post more new as it becomes
  18068.  available.
  18069.  
  18070.  After setting a breakpoint that highlights more than one line of code,
  18071.  using the BL command will list only the one breakpoint you set.
  18072.  
  18073.  
  18074.  114. "No Symbolic Information" May Be Caused by Using Wrong Linker
  18075.  
  18076.  Product Version(s): 1.00 1.10 2.00 2.10 2.20 2.30 2.35 | 2.20 2.30 2.35
  18077.  Operating System:   MS-DOS                             | OS/2
  18078.  Flags: ENDUSER | S_LINK
  18079.  Last Modified: 19-SEP-1990    ArticleIdent: Q59540
  18080.  
  18081.  To debug programs at the source level with CodeView, it is critical
  18082.  that a proper version of LINK be used. Particular versions of CodeView
  18083.  are matched to particular versions of LINK and using a version of LINK
  18084.  newer than the versions matched to a particular version of CodeView
  18085.  will prevent CodeView from recognizing the symbolic information in the
  18086.  .EXE file.
  18087.  
  18088.  This mismatch will cause CodeView to come up in assembly mode and
  18089.  produce the message "No Symbolic Information," even though the source
  18090.  files may have been compiled and linked with the correct options for
  18091.  CodeView symbolic debugging.
  18092.  
  18093.  The difference between the linkers is in the way they store symbolic
  18094.  information in .EXE files. A newer version of CodeView generally can
  18095.  always display symbolic information for programs produced with
  18096.  previous versions of LINK, but the opposite is NOT true. Using a more
  18097.  recent linker with an older version of CodeView is where potential
  18098.  problems arise.
  18099.  
  18100.  The following information applies to both real-mode CodeView (CV) and
  18101.  protected-mode CodeView (CVP).
  18102.  
  18103.  Versions of CodeView prior to Version 3.00 cannot display symbolic
  18104.  information for .EXE files produced with LINK 5.10. In other words,
  18105.  if LINK 5.10 (supplied with C 6.00) is used for linking, then
  18106.  CodeView 3.00 is the ONLY matched version of CodeView that can
  18107.  display the program's symbolic information.
  18108.  
  18109.  CodeView Version 2.35 is matched to LINK 5.05 (both were released with
  18110.  BASIC 7.00). Therefore, CodeView 2.35 is the ONLY version of CodeView
  18111.  that can display symbolic information for a program linked with LINK
  18112.  5.05.
  18113.  
  18114.  For CodeView Versions 2.00, 2.10, 2.20, and 2.30, any linker with a
  18115.  version number from 3.60 to 5.03 is acceptable.
  18116.  
  18117.  For CodeView Versions 1.00 and 1.10, LINK versions later than or equal
  18118.  to 3.51, but earlier than 3.60, must be used.
  18119.  
  18120.  
  18121.  115. Mouse Disabled When Single-Stepping over Video Mode Change
  18122.  
  18123.  Product Version(s): 2.20 2.30
  18124.  Operating System:   OS/2
  18125.  Flags: ENDUSER | buglist2.20 buglist2.30
  18126.  Last Modified: 21-JUN-1989    ArticleIdent: Q45617
  18127.  
  18128.  When CodeView is run in the OS/2 compatibility box with screen
  18129.  swapping enabled (started with either /s or /43), single-stepping (F8)
  18130.  over a _setvideomode() call or an INT 10 call to change the video mode
  18131.  to a graphics mode causes the mouse cursor to disappear. Exiting
  18132.  CodeView and running another mouse-driven program reveals that the
  18133.  mouse has been completely disabled in the compatibility box. The only
  18134.  way to regain the mouse is to reboot the computer. Attempting to
  18135.  reload the mouse by typing "mouse" at a prompt results in the
  18136.  following message:
  18137.  
  18138.     Session Title: DOS Command Prompt
  18139.  
  18140.  This error occurs because a DOS mode program changes an interrupt
  18141.  vector that is owned by the system causing the program to end.
  18142.  
  18143.  The behavior described above applies to tracing in SOURCE mode.
  18144.  Attempting to trace in assembly language or mixed mode through the
  18145.  code that changes the video mode produces erratic results, which range
  18146.  from hanging the DOS box to halting the entire system with an
  18147.  "internal processing error."
  18148.  
  18149.  Microsoft has confirmed this to be a problem in CodeView Versions 2.20
  18150.  and 2.30. We are researching this problem and will post new information
  18151.  as it becomes available.
  18152.  
  18153.  The following program illustrates the problem:
  18154.  
  18155.  #include <graph.h>
  18156.  
  18157.  void main(void)
  18158.  {
  18159.    _setvideomode(_ERESCOLOR);    /* when this line is executed, the  */
  18160.                                  /* mouse cursor will disappear.     */
  18161.    _setvideomode(_DEFAULTMODE);
  18162.  
  18163.  }
  18164.  
  18165.  
  18166.  116. CodeView "??" Command Can't Show All of Large Structures
  18167.  
  18168.  Product Version(s): 2.20 2.30 | 2.20 2.30
  18169.  Operating System:   MS-DOS    | OS/2
  18170.  Flags: ENDUSER | SR# G890607-19918
  18171.  Last Modified:  8-AUG-1989    ArticleIdent: Q45624
  18172.  
  18173.  Question:
  18174.  
  18175.  How can I view structures with many members in CodeView with the "??"
  18176.  command? It shows only those members that fit on the screen. Is there
  18177.  some trick I haven't found?
  18178.  
  18179.  Response:
  18180.  
  18181.  Unfortunately, the "??" command is limited in this respect -- there is
  18182.  no way to view the last members of a large structure with this
  18183.  command. This feature is under review and will be considered for
  18184.  inclusion in a future release.
  18185.  
  18186.  Instead, however, you can view each element of the structure by itself
  18187.  by dereferencing the struct and element, i.e., "?structname.field".
  18188.  
  18189.  There are at least two ways to work around the problem in CodeView
  18190.  Versions 2.20 and 2.30. One way is to shrink or nest the structures.
  18191.  Another workaround is to use the "?" or Watch command to look at the
  18192.  individual member(s) you want to see.
  18193.  
  18194.  
  18195.  117. Problem Debugging StartSession from a Child Process
  18196.  
  18197.  Product Version(s): 2.30
  18198.  Operating System:   OS/2
  18199.  Flags: ENDUSER | buglist2.30
  18200.  Last Modified:  9-AUG-1989    ArticleIdent: Q45707
  18201.  
  18202.  When a program spawns another program that starts a new session,
  18203.  CodeView has difficulty stepping into that new session. This process
  18204.  is shown graphically in the following diagram:
  18205.  
  18206.         --------------        -------------------
  18207.     A --| DosExecPgm |--> B --| DosStartSession |--> C
  18208.         --------------        -------------------
  18209.  
  18210.  The following describes how to duplicate this process and re-create
  18211.  the problem:
  18212.  
  18213.  1. Invoke CodeView on Program A with offspring debugging enabled, as
  18214.     follows:
  18215.  
  18216.        CVP /O A
  18217.  
  18218.  2. Program A calls DosExecPgm to spawn Program B. Trace into Program B
  18219.     by pressing F8 on the DosExecPgm function. You will be informed
  18220.     that a new process has begun and you will be asked if you wish to
  18221.     debug it. Answer yes and switch to the newly created CodeView
  18222.     session.
  18223.  
  18224.  3. Program B calls DosStartSession to begin a new session. The program
  18225.     that will execute in that session is Program C. Attempt to trace
  18226.     into the new session by pressing F8 on the DosStartSession function.
  18227.  
  18228.  The problem is demonstrated in Step 3. CodeView does not give you the
  18229.  opportunity to debug Program C as it should. Further, when Program B
  18230.  has completed execution and CodeView returns back to Program A, the
  18231.  first single step will inform you that a new process has been started.
  18232.  This message should have been presented on the call to
  18233.  DosStartSession.
  18234.  
  18235.  CodeView has no difficulty stepping into a new session when the
  18236.  initial program being debugged is Program B. To work around this
  18237.  problem, invoke CodeView on Program B with the /O switch.
  18238.  
  18239.  Microsoft has confirmed this to be a problem with CodeView Version
  18240.  2.30. We are researching this problem and will post new information
  18241.  as it becomes available.
  18242.  
  18243.  The following three modules demonstrate this problem:
  18244.  
  18245.  //***********************************************************
  18246.  // A.C - spawn a child from here.
  18247.  
  18248.  #define INCL_BASE
  18249.  #include <os2.h>
  18250.  
  18251.  void main (void)
  18252.  {
  18253.    char        failbuf[80];
  18254.    RESULTCODES ExecCode;
  18255.  
  18256.    DosExecPgm (failbuf, 40, EXEC_ASYNC, NULL, NULL, &ExecCode, "B.EXE");
  18257.    VioWrtTTY ("End of A.\r\n", 11, 0);
  18258.  }
  18259.  
  18260.  //***********************************************************
  18261.  // B.C - start a new session from here.
  18262.  
  18263.  #define INCL_BASE
  18264.  #include <os2.h>
  18265.  #include <string.h>
  18266.  
  18267.  void main (void)
  18268.  {
  18269.    USHORT    Disk;
  18270.    ULONG     Drives;
  18271.    BYTE      SessionProg [80];
  18272.    USHORT    MaxLen = sizeof(SessionProg)-14;
  18273.    STARTDATA StartData;
  18274.    USHORT    Session;
  18275.    USHORT    Process;
  18276.  
  18277.    // Build program name to run in new session.
  18278.    DosQCurDisk (&Disk, &Drives);
  18279.    strcpy (SessionProg, "*:\\");
  18280.    SessionProg[0] = (char) ('A' + Disk - 1);
  18281.    DosQCurDir (0, SessionProg + strlen(SessionProg), &MaxLen);
  18282.    strcat (SessionProg, "\\C.EXE");
  18283.  
  18284.    StartData.Length      = sizeof(STARTDATA);
  18285.    StartData.Related     = 1;
  18286.    StartData.FgBg        = 0;
  18287.    StartData.TraceOpt    = 0;
  18288.    StartData.PgmTitle    = "Test Session";
  18289.    StartData.PgmName     = SessionProg;
  18290.    StartData.PgmInputs   = "sample param";
  18291.    StartData.TermQ       = NULL;
  18292.    StartData.Environment = NULL;
  18293.    StartData.InheritOpt  = 0;
  18294.    StartData.SessionType = 1;
  18295.    StartData.IconFile    = NULL;
  18296.    StartData.PgmHandle   = 0;
  18297.  
  18298.    DosStartSession (&StartData, &Session, &Process);
  18299.    VioWrtTTY ("End of B.\r\n", 11, 0);
  18300.  }
  18301.  
  18302.  //***********************************************************
  18303.  // C.C - the test session.
  18304.  
  18305.  #define INCL_VIO
  18306.  #include <os2.h>
  18307.  
  18308.  void main (void)
  18309.  {
  18310.    VioWrtTTY ("In test session", 15, 0);
  18311.  }
  18312.  
  18313.  
  18314.  118. CodeView Skips Over a Line of Source Code
  18315.  
  18316.  Product Version(s): 2.20 2.30 | 2.20 2.30
  18317.  Operating System:   MS-DOS    | OS/2
  18318.  Flags: ENDUSER | S_QuickC
  18319.  Last Modified: 14-AUG-1989    ArticleIdent: Q46010
  18320.  
  18321.  After setting a breakpoint on the indicated line in the program below
  18322.  and executing the program, CodeView executes that line without
  18323.  stopping. Likewise, if you single step through the code, CodeView
  18324.  steps past that line. This problem also occurs in the QuickC
  18325.  integrated debugger.
  18326.  
  18327.  The workaround is to flip your source into mixed mode and set the
  18328.  breakpoint on the correct assembly line.
  18329.  
  18330.  This is due to the fact that CodeView is line-based and the C compiler
  18331.  is token-based. This will not be corrected; it is a restriction.
  18332.  
  18333.  Sample Program
  18334.  --------------
  18335.  
  18336.  int i, j, k, l;
  18337.  
  18338.  void main(void)
  18339.  {
  18340.      for(i = 0; i < 20; i++)
  18341.      {
  18342.          j = 0;
  18343.          for(k = 0; k < 20; k++)
  18344.              if(j == 0)
  18345.                  break;
  18346.  
  18347.          j = 1; /*** set breakpoint here ***/
  18348.      }
  18349.  
  18350.      l = 0;
  18351.  }
  18352.  
  18353.  
  18354.  119. Capabilities and Limits of the /R switch on 80386 Machines
  18355.  
  18356.  Product Version(s): 2.20 2.30 2.35 3.00 | 2.20 2.30 2.35 3.00
  18357.  Operating System:   MS-DOS              | OS/2
  18358.  Flags: ENDUSER | 386
  18359.  Last Modified: 12-APR-1990    ArticleIdent: Q46448
  18360.  
  18361.  The /R command line switch for CodeView beginning with Version 2.20 is
  18362.  used only on 80386 machines. The /R switch tells CodeView to use the
  18363.  four debug registers available on the 80386 chip, and also allows
  18364.  hardware breakpoints. This causes CodeView to run faster when
  18365.  performing debugger-intensive steps such as monitoring a tracepoint.
  18366.  
  18367.  The /R switch works under DOS and OS/2's DOS compatibility box. It is
  18368.  an unrecognized switch under OS/2. The /R switch speeds operation of
  18369.  Tracepoint but not Watchpoint or Breakpoint commands.
  18370.  
  18371.  Note: because there are only four debug registers, only four
  18372.  tracepoints (of up to 4 bytes each) may be specified when utilizing
  18373.  these registers. Specifying any combination of tracepoints greater
  18374.  than 16 bytes will require CodeView to use software tracepoints rather
  18375.  than the debug registers and all performance gains will be lost.
  18376.  
  18377.  
  18378.  120. Using CodeView /2 with Hercules Graphics Cards and Libraries
  18379.  
  18380.  Product Version(s): 2.20 2.30
  18381.  Operating System:   MS-DOS
  18382.  Flags: ENDUSER |
  18383.  Last Modified: 16-OCT-1990    ArticleIdent: Q46949
  18384.  
  18385.  Using CodeView in the dual-monitor mode with a Hercules graphics card
  18386.  as the primary (application) monitor requires the Hercules card to be
  18387.  configured in the half mode. Using the Hercules graphics library, the
  18388.  monitor must be configured using the config(0) function call. This
  18389.  function call is a part of the Hercules graphics library and does not
  18390.  use Microsoft graphics library or the MSHERC.COM program. Therefore,
  18391.  this information applies only if you are using the Hercules graphics
  18392.  libraries. This is NOT the same as using the /h switch with CodeView.
  18393.  
  18394.  The first page of the Hercules graphics display card is mapped to
  18395.  memory location B0000 (same as MDA), and the second page is mapped to
  18396.  B8000. The CGA/EGA/VGA also use B8000 as the beginning of their video
  18397.  memory. CodeView uses these two different address to run in the
  18398.  dual-monitor mode, sending the application output to the primary
  18399.  address, usually located at B8000, and the CodeView information to the
  18400.  secondary monitor, usually located at B0000.
  18401.  
  18402.  This works well until a Hercules graphics card is used as the primary
  18403.  monitor (in graphics mode) and the CGA/EGA/VGA card is used as the
  18404.  secondary monitor. The Hercules graphics card uses both pages (one at
  18405.  B0000 and the other at B8000) in the full mode. Therefore, use
  18406.  config(0) and only the first page (B0000) will be used and CodeView
  18407.  will function properly in dual-monitor mode.
  18408.  
  18409.  
  18410.  121. DEF File Entry of EXECUTEONLY Causes Problems with CVP
  18411.  
  18412.  Product Version(s): 2.20 2.30
  18413.  Operating System:   OS/2
  18414.  Flags: ENDUSER |
  18415.  Last Modified: 30-AUG-1989    ArticleIdent: Q47103
  18416.  
  18417.  Question:
  18418.  
  18419.  When I step into my DLL, I can see and step through the source code
  18420.  correctly. I also can look at local variables. However, I cannot set
  18421.  breakpoints in the DLL. Also, when I try to look at the disassembled
  18422.  code I see the following:
  18423.  
  18424.     ??? No Code ???
  18425.  
  18426.  I am using the correct Compile and Link options. Why is CodeView
  18427.  acting strangely?
  18428.  
  18429.  Response:
  18430.  
  18431.  In the .DEF file for the DLL, you had the EXECUTEONLY attribute as
  18432.  opposed to the default EXECUTEREAD. When you choose EXECUTEONLY,
  18433.  CodeView cannot read the code segment as it must to work correctly.
  18434.  Removing the EXECUTEONLY attribute corrects the problem.
  18435.  
  18436.  
  18437.  122. OS/2 SDK Version of CVP 2.30 Won't Debug DosLoadModule DLLs
  18438.  
  18439.  Product Version(s): 2.30
  18440.  Operating System:   OS/2
  18441.  Flags: ENDUSER |
  18442.  Last Modified: 11-JUL-1990    ArticleIdent: Q59610
  18443.  
  18444.  The OS/2 version 1.10 Software Development Kit (SDK) includes a
  18445.  prerelease version of protected-mode CodeView (CVP) version 2.30. This
  18446.  version is identical to the regular retail release of CVP 2.30, except
  18447.  that it does not allow the debugging of DLLs loaded with
  18448.  DosLoadModule. The regular retail version of CVP 2.30 is included with
  18449.  FORTRAN 5.00 and the OS/2 Presentation Manager Toolkit for OS/2
  18450.  version 1.10. This release DOES support debugging DLLs loaded at run
  18451.  time with DosLoadModule.
  18452.  
  18453.  The prerelease version of CVP 2.30 released in the OS/2 SDK may be
  18454.  identified by a file date of 2-24-89. The regular release version is
  18455.  dated 3-21-89. The file date is the only discernible difference
  18456.  between these two versions since the files themselves are exactly the
  18457.  same size.
  18458.  
  18459.  
  18460.  123. Minimum Extended Memory (384K) Causes CV 3.00 to Use Extra RAM
  18461.  
  18462.  Product Version(s): 3.00
  18463.  Operating System:   MS-DOS
  18464.  Flags: ENDUSER | docerr HIMEM
  18465.  Last Modified: 27-SEP-1990    ArticleIdent: Q59890
  18466.  
  18467.  Real-mode CodeView (CV) Version 3.00 is documented as being able to
  18468.  run in extended memory as long as there is at least 384K of extended
  18469.  memory available. This 384K minimum is accurate as far as CV being
  18470.  able to utilize the extended memory, but it is not enough for CodeView
  18471.  to remove all of itself from conventional RAM. In fact, a system
  18472.  configuration with only 384K extended memory will result in LESS
  18473.  memory being available for the debuggee (the program being debugged)
  18474.  than if no extended memory is utilized at all.
  18475.  
  18476.  The CodeView 3.00 documentation states that "if HIMEM.SYS or another
  18477.  extended-memory driver is installed, all but 16K of CodeView, plus all
  18478.  of the symbolic information for the program you are debugging, are
  18479.  placed in extended memory." But, for CodeView to truly work with this
  18480.  16K "footprint" in conventional memory, a minimum of approximately
  18481.  600K extended memory must be available.
  18482.  
  18483.  When no extended memory is available, CodeView normally utilizes
  18484.  overlays to keep as much of itself out of memory as possible, so that
  18485.  the debuggee can have more space to load. (The new /Dnnn option
  18486.  actually allows you to specify the size of the overlays -- a bigger
  18487.  overlays means CV runs faster, but a smaller overlays mean a bigger
  18488.  program can be loaded for debugging.)
  18489.  
  18490.  Once CodeView detects extended memory, it assumes that overlays are no
  18491.  longer needed, since CV itself and the debuggee's symbolic information
  18492.  will both (supposedly) be loaded into extended memory. However, the
  18493.  result may be that CodeView seems to get bigger because what Codeview
  18494.  can't fit into extended memory is loaded into conventional memory.
  18495.  
  18496.  Since no overlays are used, this can result in a much larger
  18497.  footprint. For instance, if the minimum of 384K extended memory is all
  18498.  that is available, then the footprint will be well over 200K.
  18499.  Obviously, as the amount of extended memory is increased from 384K,
  18500.  the footprint will shrink accordingly.
  18501.  
  18502.  The /X command-line option instructs CodeView to use extended memory.
  18503.  However, CV will automatically detect extended memory and use it if it
  18504.  is available. Consequently, if the /X option is not specified, CodeView
  18505.  will still use extended memory.
  18506.  
  18507.  Thus, if you have a limited amount of extended memory and decide to
  18508.  run CodeView in conventional RAM only, you have two options. You can
  18509.  explicitly specify /D (for example, /D16) to tell CodeView to use
  18510.  overlays, or you can remove (or comment out) the line in your
  18511.  CONFIG.SYS file that loads the extended memory driver (HIMEM.SYS) and
  18512.  reboot.
  18513.  
  18514.  
  18515.  124. If COMSPEC Is Invalid, Invoking DOS Shell May Hang Machine
  18516.  
  18517.  Product Version(s): 2.x 3.00
  18518.  Operating System:   MS-DOS
  18519.  Flags: ENDUSER | s_quickc s_pwb s_quickasm s_editor
  18520.  Last Modified: 19-APR-1990    ArticleIdent: Q60748
  18521.  
  18522.  If you set your COMSPEC environment variable to point to an invalid
  18523.  command interpreter, and then shell out of any DOS application, your
  18524.  machine will hang. This problem occurs because the file that COMSPEC
  18525.  points to is assumed to be a valid command interpreter and cannot be
  18526.  checked for validity.
  18527.  
  18528.  This is expected behavior. Because .COM files have no standard file
  18529.  header structure, they cannot be checked for validity. Therefore, DOS
  18530.  must assume that whatever the COMSPEC environment variable points to
  18531.  must be a valid command interpreter, and can do no further error
  18532.  checking.
  18533.  
  18534.  This behavior can easily be demonstrated in any program that allows
  18535.  you to access a DOS shell, including CodeView, Programmer's WorkBench
  18536.  (PWB), the Microsoft Editor (M), and the Quick environments. Type the
  18537.  following line at the DOS prompt:
  18538.  
  18539.     set comspec=a:\foo.c ; Invalid command.com file
  18540.  
  18541.  Then enter a DOS application and shell out. Your machine will hang,
  18542.  and you may receive strange error messages.
  18543.  
  18544.  If you are running under OS/2, you will be warned about an invalid
  18545.  command interpreter when you attempt to shell to the operating system.
  18546.  Under OS/2, the system expects an .EXE file to be the command
  18547.  interpreter, and .EXE files have a standard, recognizable structure
  18548.  that can be checked.
  18549.  
  18550.  
  18551.  125. /I Documented Incorrectly in "Advanced Programming Techniques"
  18552.  
  18553.  Product Version(s): 3.00   | 3.00
  18554.  Operating System:   MS-DOS | OS/2
  18555.  Flags: ENDUSER | docerr
  18556.  Last Modified: 19-APR-1990    ArticleIdent: Q60829
  18557.  
  18558.  In Section 9.7, "Controlling CodeView with Command-Line Options," on
  18559.  Page 204 of the "Microsoft C Advanced Programming Techniques" manual,
  18560.  it incorrectly states that the /I switch (used to turn the nonmaskable
  18561.  interrupts and 8259 interrupts on or off) is followed by either a 1 or
  18562.  a 2 (either /I1 or /I2).
  18563.  
  18564.  The correct switch options are /I0 to trap these interrupts, or /I1 to
  18565.  ignore these interrupts. Both the online documentation and the
  18566.  "Microsoft C Reference" give this correct usage of the /I switch.
  18567.  
  18568.  
  18569.  126. OS/2 1.20 Requirements for Dual-Monitor Debugging
  18570.  
  18571.  Product Version(s): 2.x 3.00
  18572.  Operating System:   OS/2
  18573.  Flags: ENDUSER | PM
  18574.  Last Modified: 17-JUL-1990    ArticleIdent: Q60866
  18575.  
  18576.  To do dual-monitor debugging under OS/2 Version 1.20 with CodeView,
  18577.  make sure that you have the correct display DLLs specified in your
  18578.  CONFIG.SYS file.
  18579.  
  18580.  For example, the following three lines in your OS/2 CONFIG.SYS file
  18581.  specify the device drivers needed to use a VGA and a monochrome
  18582.  adapter:
  18583.  
  18584.     set video_devices=bvh_vga,bvh_mpa
  18585.     set bvh_vga=device(bvhvga)
  18586.     set bvh_mpa=device(bvhmpa)
  18587.  
  18588.  If you have a CGA or an EGA monitor and adapter for your primary
  18589.  (color) display, replace device(bvhvga) with device(bvhcga) or
  18590.  device(bvhega), depending on your adapter type.
  18591.  
  18592.  Next, make sure that both of the BVH*.DLL files (in the above case,
  18593.  BVHVGA.DLL and BVHMPA.DLL) specified in the device(name) section are
  18594.  in your LIBPATH. OS/2 setup places these files in your C:\OS2\DLL
  18595.  directory by default.
  18596.  
  18597.  Note: You can substitute any name for bvh_vga or bvh_mpa, as long as
  18598.  those two placeholders match up with the name tab in the set
  18599.  <name>=device... lines.
  18600.  
  18601.  Remember, the two monitors must be unique for OS/2 to determine which
  18602.  monitor is which. For instance, debugging with two VGA monitors will
  18603.  not work because OS/2 and, therefore, CodeView will be unable to
  18604.  determine which adapter/monitor is the primary adapter/monitor and
  18605.  which is the secondary adapter/monitor.
  18606.  
  18607.  This point is critical to remember when considering dual-monitor
  18608.  debugging on a microchannel machine (for example, an IBM PS/2 Model 50
  18609.  and above). Since there are currently no microchannel monochrome
  18610.  adapter cards on the market, the only alternative is to use a VGA and
  18611.  an 8514 as the two monitors. The following are the matching three
  18612.  lines for your OS/2 CONFIG.SYS file for that scenario:
  18613.  
  18614.     set video_devices=bvh_vga,bvh_8514
  18615.     set bvh_8514=device(bvh8514)
  18616.     set bvh_vga=device(bvhvga)
  18617.  
  18618.  Using this setup, the 8514 monitor displays the graphics output (or
  18619.  the Presentation Manager screen) and the VGA is the debug monitor and
  18620.  displays all text output.
  18621.  
  18622.  
  18623.  127. Debugging Large DOS Applications in CodeView 3.0 with /X /E /D
  18624.  
  18625.  Product Version(s): 3.00
  18626.  Operating System:   MS-DOS
  18627.  Flags: ENDUSER |
  18628.  Last Modified: 15-MAY-1990    ArticleIdent: Q61473
  18629.  
  18630.  CodeView version 3.00 includes enhanced support for debugging
  18631.  applications under DOS. CodeView 3.00 may access extended memory or
  18632.  expanded memory, or the size of the overlay swap area that CodeView
  18633.  uses may be adjusted.
  18634.  
  18635.  CodeView 3.00 offers three command-line parameters (/X, /E, and /D)
  18636.  for specifying memory utilization. If you DO NOT specify the /X, /E,
  18637.  or /D options when you start a CodeView session, CodeView will
  18638.  automatically search for extended memory. If CodeView finds extended
  18639.  memory, it will place the symbolic information and most of itself into
  18640.  extended memory (as long as enough extended memory is available).
  18641.  
  18642.  If there is no extended memory on your system, Codeview will search
  18643.  for expanded memory. If there is expanded memory, Codeview will place
  18644.  the symbolic information for your program in expanded memory.
  18645.  
  18646.  If there is no extended or expanded memory on your machine, CodeView
  18647.  will load itself, your application, and symbolic information for your
  18648.  program in base memory.
  18649.  
  18650.  Since CodeView does this automatic scan for extended and expanded
  18651.  memory, the /X and /E switches are needed only if you explicitly want
  18652.  to specify the use of one form of memory or the other and you do not
  18653.  want to enter CodeView if this memory type is not available.
  18654.  
  18655.  CodeView's /X option tells the debugger to load into extended memory
  18656.  ONLY, and to return an error message if extended memory is not
  18657.  available on your system. This message has the following form:
  18658.  
  18659.     CV1302 Error: /X : HIMEM.SYS not loaded
  18660.  
  18661.  CodeView's /E option tells the debugger to access expanded memory
  18662.  ONLY, and to return an error message if there is no expanded memory on
  18663.  your machine. This message has the following form:
  18664.  
  18665.     CV1304 Error: /E : EMM driver not loaded
  18666.  
  18667.  CodeView's /D option specifies that CodeView should use disk overlays.
  18668.  When you use this option, you can also specify a decimal size in
  18669.  kilobytes between 16K and 128K to explicitly set the overlay swap area
  18670.  size. The default size of the swap area is 64K if /D is used but no
  18671.  size is explicitly specified. If extended and expanded memory are not
  18672.  available, /D will not need to be specified for the default 64K
  18673.  overlay swap area to be used.
  18674.  
  18675.  A larger overlay swap area allows CodeView to run faster because it
  18676.  doesn't have to swap to disk as frequently as with a smaller swap
  18677.  area, but it means more memory is used up by CodeView itself. A
  18678.  smaller swap area allows you to debug larger applications under DOS,
  18679.  but CodeView runs slower because of the more frequent need to swap
  18680.  code from disk to memory.
  18681.  
  18682.  
  18683.  128. P70 Display Creates Problems Under CodeView and PWB
  18684.  
  18685.  Product Version(s): 3.00
  18686.  Operating System:   OS/2
  18687.  Flags: ENDUSER | buglist3.00 S_PWB S_Editor
  18688.  Last Modified: 15-AUG-1990    ArticleIdent: Q61557
  18689.  
  18690.  CodeView version 3.00 and Programmer's WorkBench (PWB) version 1.00
  18691.  have problems recognizing the built-in monitor of IBM P70 portables
  18692.  under OS/2. Symptoms of this problem include the following error
  18693.  messages:
  18694.  
  18695.     Product     Error Message
  18696.     -------     -------------
  18697.  
  18698.     CodeView    Internal Debugger Error 0 at load time
  18699.     PWB         Inability to change from 43-line mode
  18700.  
  18701.  Microsoft has confirmed this to be a problem with CodeView version
  18702.  3.00. We are researching this problem and will post new information
  18703.  here as it becomes available.
  18704.  
  18705.  This problem is directly related to the video configuration of the IBM
  18706.  P70. In its documentation, IBM mentions briefly that it might be
  18707.  necessary to type MODE CO80 to make some software recognize the
  18708.  built-in plasma display. An added condition for PWB and CodeView is
  18709.  the necessity of being in 43-line mode. PWB automatically places you
  18710.  in 43-line mode no matter what you previous mode was and thus gets
  18711.  around this limitation. If you attempts to change the height switch
  18712.  while editing, PWB doesn't complain but still stays in 43-line mode.
  18713.  
  18714.  CodeView cannot make the mode change in the same way that PWB can. If
  18715.  invoked without the above considerations, CodeView will crash with an
  18716.  Internal Debugger Error 0. The following are several ways to work
  18717.  around this problem if want to use CodeView with this type of
  18718.  configuration.
  18719.  
  18720.  1. Type MODE CO80 or BW80 and invoke CodeView with the /43 switch.
  18721.  
  18722.  2. Type MODE CO80,43 or BW80,43 before invoking CodeView.
  18723.  
  18724.  3. Use an external monitor with the built-in VGA port.
  18725.  
  18726.  4. Invoke CodeView from PWB, which makes the change automatically.
  18727.  
  18728.  
  18729.  129. CodeView Does Not Reset Initial Graphics Mode on Exit
  18730.  
  18731.  Product Version(s): 2.x 3.00    | 2.x 3.00
  18732.  Operating System:   MS-DOS      | OS/2
  18733.  Flags: ENDUSER |
  18734.  Last Modified: 29-MAY-1990    ArticleIdent: Q61611
  18735.  
  18736.  When CodeView exits, it leaves the screen in the current video mode
  18737.  and does not reset the mode to the mode that was active when CodeView
  18738.  was initially loaded.
  18739.  
  18740.  This behavior is by design. However, if you start CodeView with the /s
  18741.  option to enable screen swapping, the video mode that was active when
  18742.  CodeView was loaded will be reset because CodeView has separate
  18743.  swappable video memory pages to hold the output screen as well as the
  18744.  CodeView screen.
  18745.  
  18746.  
  18747.  130. CV 3.00 Gives R6000, Hangs When Accessing Help During Start-Up
  18748.  
  18749.  Product Version(s): 3.00
  18750.  Operating System:   MS-DOS
  18751.  Flags: ENDUSER | buglist3.00 fixlist3.10
  18752.  Last Modified:  5-FEB-1991    ArticleIdent: Q61919
  18753.  
  18754.  Accessing help in the "Enter directory for filename.c (cr for none)?"
  18755.  window results in the following error in CodeView version 3.00:
  18756.  
  18757.     run-time error R6000
  18758.     -stack overflow
  18759.  
  18760.  Then, the machine hangs requiring a cold reboot.
  18761.  
  18762.  To reproduce the error, do the following:
  18763.  
  18764.  1. Compile and link a program with symbolic information for CodeView.
  18765.  
  18766.  2. Delete or rename the source file and then go into CodeView. A
  18767.     window will appear asking you to "Enter directory for filename.c
  18768.     (cr for none)?".
  18769.  
  18770.  3. Choose the Help option at the bottom of the window. The run-time
  18771.     error message will be printed over the CodeView screen and the machine
  18772.     will be hung.
  18773.  
  18774.  The problem does not occur under OS/2.
  18775.  
  18776.  Microsoft has confirmed this to be a problem in CodeView version 3.00.
  18777.  This problem was corrected in CodeView version 3.10.
  18778.  
  18779.  
  18780.  131. CodeView 3.00 Fades with Monochrome VGA
  18781.  
  18782.  Product Version(s): 3.00   | 3.00
  18783.  Operating System:   MS-DOS | OS/2
  18784.  Flags: ENDUSER |
  18785.  Last Modified: 11-JUL-1990    ArticleIdent: Q61970
  18786.  
  18787.  If you invoke CodeView version 3.00 on certain machines with
  18788.  monochrome VGA monitors and then trace through several lines of code,
  18789.  the screen will fade and become unreadable. Exiting and re-entering
  18790.  CodeView refreshes the screen, but the screen immediately starts to
  18791.  fade again.
  18792.  
  18793.  This problem is caused by an error in the video ROM BIOS and has been
  18794.  verified to occur on the following machines:
  18795.  
  18796.  l. PS/2 Model P70 with monochrome VGA
  18797.  
  18798.  2. Siemens with Video 7 monochrome VGA
  18799.  
  18800.  3. Northgate 386 with Video 16 monochrome VGA
  18801.  
  18802.  The following are different methods of working around this problem:
  18803.  
  18804.  1. Switch into color mode using the mode CO80 command (may not have
  18805.     any effect).
  18806.  
  18807.  2. From the options menu inside Codeview, turn flip/swap off using
  18808.     the screen-swap option.
  18809.  
  18810.     If you don't want to give up flip/swap functionality, try option 3.
  18811.  
  18812.  3. If the video BIOS is replaceable, replace it with an updated video
  18813.     BIOS.
  18814.  
  18815.  4. If the video BIOS is not replaceable, replace the card.
  18816.  
  18817.  
  18818.  132. CodeView 3.00 Hangs on gets() with Screen Swap Off
  18819.  
  18820.  Product Version(s): 3.00   | 3.00
  18821.  Operating System:   MS-DOS | OS/2
  18822.  Flags: ENDUSER | s_c s_quickc s_quickasm
  18823.  Last Modified: 25-JUL-1990    ArticleIdent: Q62663
  18824.  
  18825.  CodeView 3.00 will hang if you step or execute past a call to the
  18826.  gets() run-time routine if the Screen Swap option is turned off.
  18827.  
  18828.  Sample Code
  18829.  -----------
  18830.  
  18831.  #include <stdio.h>
  18832.  
  18833.  char string[256];
  18834.  
  18835.  void main (void)
  18836.  {
  18837.      printf ( "Enter a string: ") ;
  18838.      gets ( string ) ;
  18839.      printf ( "Echoing : %s\n", string) ;
  18840.  }
  18841.  
  18842.  Compile the above file with the following:
  18843.  
  18844.     cl /Od /Zi test.c
  18845.  
  18846.  Bring the file up in CodeView, then select the Options.Screen Swap
  18847.  option. Next, step past the gets() call. Under DOS, your machine will
  18848.  hang, and under OS/2, the current screen group will be hung.
  18849.  
  18850.  
  18851.  133. DosSetMaxFH Between 0-39 Fails Under CodeView 3.00
  18852.  
  18853.  Product Version(s): 3.00
  18854.  Operating System:   OS/2
  18855.  Flags: ENDUSER | buglist3.00
  18856.  Last Modified: 25-JUL-1990    ArticleIdent: Q62666
  18857.  
  18858.  OS/2's DosSetMaxFH routine can be called to reset the OS/2 default
  18859.  limit of a maximum of 20 open file handles to a larger number. By
  18860.  definition, DosSetMaxFH fails when trying to set the number smaller
  18861.  than the current maximum amount of handles. Under OS/2, the default
  18862.  maximum number of files is 20, so a DosSetMaxFH to a number between
  18863.  0-19 should fail.
  18864.  
  18865.  However, under CodeView 3.00, calling DosSetMaxFH with a number
  18866.  between 0-39 will return a fail value.
  18867.  
  18868.  Sample Code
  18869.  -----------
  18870.  
  18871.  /* compile with : cl /Od /Zi file.c */
  18872.  
  18873.  #define INCL_DOSFILEMGR
  18874.  
  18875.  #include <stdio.h>
  18876.  #include <os2.h>
  18877.  
  18878.  void main(void)
  18879.  {
  18880.     int i;
  18881.     for ( i = 0 ; i < 1000 ; i ++ )
  18882.  
  18883.     if ( DosSetMaxFH ( i ) )
  18884.     {
  18885.        printf ( " DosSetMaxFH to %d failed!\n ",i ) ;
  18886.     }
  18887.  }
  18888.  
  18889.  This program prints the error message on parameters from 0 to 39.
  18890.  
  18891.  You can call the DosSetMaxFH routine to set at least 40 file handles
  18892.  to work around this problem.
  18893.  
  18894.  
  18895.  134. CV Limits Input of Period Character (2Eh) into Memory Window
  18896.  
  18897.  Product Version(s): 3.00 3.10 | 3.00 3.10
  18898.  Operating System:   MS-DOS    | OS/2
  18899.  Flags: ENDUSER | buglist3.00 buglist3.10 decimal point dot
  18900.  Last Modified: 31-AUG-1990    ArticleIdent: Q65241
  18901.  
  18902.  When viewing memory in byte format in a memory window in CodeView
  18903.  version 3.00 or 3.10, you cannot change the value of a byte in memory
  18904.  to the hexadecimal value 2E. The hex value 2E has an ASCII character
  18905.  equivalent of the period ("."). In CodeView, a period is used to
  18906.  display any nondisplayable character (for example, null, a carriage
  18907.  return, control characters, etc.), which means the period character
  18908.  can sometimes have special meaning to CodeView when it appears in a
  18909.  memory window.
  18910.  
  18911.  Because of the special usage of the period character in a memory
  18912.  window, CodeView does not allow periods to be typed directly into
  18913.  memory. In CodeView 3.00, attempts to change a byte value to 2E
  18914.  results in either the 2 or the E being entered and the other digit
  18915.  being ignored, depending on which value you enter first. In CodeView
  18916.  3.10, both the 2 and the E are returned to their original values once
  18917.  they have both been entered. If you move to the right side of the
  18918.  memory window where the ASCII equivalents are shown and you try to
  18919.  type in a period there, CodeView will also ignore that input.
  18920.  
  18921.  If you switch the memory window so that you are viewing memory in
  18922.  ASCII mode, actual periods can be typed in to any memory location.
  18923.  However, there is a problem with this because ALL other periods on the
  18924.  same line, which really represent various nondisplayable ASCII
  18925.  characters, are all converted to 2Es.
  18926.  
  18927.  If you use are viewing memory in a format other than bytes or ASCII,
  18928.  CodeView will allow a 2E to be entered. The workaround, then, if a
  18929.  period needs to be entered into memory, is to choose a different
  18930.  viewing mode other than ASCII or byte-mode, and then enter the period
  18931.  in the desired location as the value 2E. You can cycle through the
  18932.  available memory viewing modes by repeatedly pressing SHIFT+F3, or you
  18933.  can select the desired mode from the Memory Window option on the
  18934.  Options menu.
  18935.  
  18936.  Microsoft has confirmed this to be a problem in CodeView versions 3.00
  18937.  and 3.10. We are researching this problem and will post new
  18938.  information here as it becomes available.
  18939.  
  18940.  
  18941.  135. CV 3.00 Incorrectly Documents helpbuffer Switch as helpbuffers
  18942.  
  18943.  Product Version(s): 3.00   | 3.00
  18944.  Operating System:   MS-DOS | OS/2
  18945.  Flags: ENDUSER | docerr
  18946.  Last Modified: 25-FEB-1991    ArticleIdent: Q63236
  18947.  
  18948.  In the "Configure CodeView" section of the online help for CodeView
  18949.  version 3.00, the "helpbuffer" switch is incorrectly listed as
  18950.  follows:
  18951.  
  18952.     helpbuffers:<size>
  18953.  
  18954.  This switch should be spelled as follows:
  18955.  
  18956.     helpbuffer:<size>
  18957.  
  18958.  CodeView will not recognize the first spelling. The correct spelling
  18959.  was incorporated into the online help beginning with CodeView version
  18960.  3.10.
  18961.  
  18962.  
  18963.  136. CodeView Crashes in DOS on "Drive Not Ready" Error
  18964.  
  18965.  Product Version(s): 3.00
  18966.  Operating System:   MS-DOS
  18967.  Flags: ENDUSER | buglist3.00
  18968.  Last Modified: 25-JUL-1990    ArticleIdent: Q64026
  18969.  
  18970.  CodeView version 3.00 may hang after encountering a "Drive Not Ready"
  18971.  error. This error may occur if a file is opened on Drive A and a disk
  18972.  is not in the drive.
  18973.  
  18974.  To reproduce this problem, compile the following program with CodeView
  18975.  options (cl /Zi /Od):
  18976.  
  18977.     main () {
  18978.       FILE *fp;
  18979.       fp = fopen("a:\readme.doc","r");
  18980.     }
  18981.  
  18982.  If you run the program in CodeView version 3.00 without a disk in
  18983.  Drive A and press F5 to run the program, the following error will
  18984.  appear:
  18985.  
  18986.     Not ready reading drive A
  18987.     Abort, Retry, Fail?
  18988.  
  18989.  Regardless of what is typed, the machine will hang and you must do a
  18990.  cold reboot to remedy the crash.
  18991.  
  18992.  Note: CodeView versions 2.20 and 2.30 do not hang the machine if the
  18993.  above steps are executed. The fopen() just returns a NULL. OS/2 also
  18994.  handles the error correctly in versions 2.20, 2.30, and 3.00 of
  18995.  CodeView.
  18996.  
  18997.  Microsoft has confirmed this to be a problem with CodeView version
  18998.  3.00. We are researching this problem and will post new information
  18999.  here as it becomes available.
  19000.  
  19001.  
  19002.  137. CV1319 Error May Be Caused by CodeView DOS Extender
  19003.  
  19004.  Product Version(s): 3.00
  19005.  Operating System:   MS-DOS
  19006.  Flags: ENDUSER | buglist3.00 fixlist3.10
  19007.  Last Modified: 31-AUG-1990    ArticleIdent: Q65242
  19008.  
  19009.  Real-mode CodeView (CV) version 3.00 (shipped with Microsoft C 6.00)
  19010.  may encounter problems on certain computers when extended memory is
  19011.  utilized for debugging programs. These problems involve the processing
  19012.  of interrupts while CodeView 3.00's internal DOS extender is being
  19013.  used to run CodeView in protected mode in conjunction with HIMEM.SYS,
  19014.  the extended memory (XMS) driver.
  19015.  
  19016.  The problems manifest themselves in various ways, due to both the
  19017.  varied interrupt handling speeds of different machines and the varied
  19018.  interactions of CodeView itself running in protected mode while the
  19019.  DOS program being debugged is still being run in real mode. The most
  19020.  common error is a protection violation, which shows up in CodeView as
  19021.  either a CV1319 error (internal error - unrecoverable fault) or as a
  19022.  system hang. The errors usually occur when you are paging through the
  19023.  code or manipulating the mouse.
  19024.  
  19025.  Registered Microsoft C 6.00 owners who are experiencing any of these
  19026.  problems with CodeView version 3.00 are encouraged to call Microsoft
  19027.  Technical Support at (206) 637-7096 to obtain information concerning a
  19028.  possible correction for these errors. However, there may be some cases
  19029.  where the only solution is to obtain a newer computer BIOS or to use
  19030.  CodeView without extended memory.
  19031.  Most reported problems have involved IBM PS/2 computers, but a number
  19032.  of these problems have also been reported on computers with an AMI
  19033.  BIOS. Note that CodeView version 3.10 includes modifications that are
  19034.  expected to eliminate most of these interrupt problems, but in some
  19035.  instances (especially with older AMI BIOS machines), an update of the
  19036.  BIOS may be the only solution.
  19037.  
  19038.  The easiest workaround to these protected-mode errors is to start
  19039.  CodeView without the use of extended memory. This can be done by
  19040.  removing the line in CONFIG.SYS that loads the HIMEM.SYS driver (and
  19041.  then rebooting the computer). Another option, if HIMEM is already
  19042.  loaded, is to start CodeView with the /D command-line option to
  19043.  specify explicitly that CodeView should use disk overlays, rather than
  19044.  extended or expanded memory. (Otherwise, if extended memory is
  19045.  available, CodeView will use the /X option by default.)
  19046.  
  19047.  Because these problems can occur only when CodeView is running in
  19048.  protected mode in extended memory, and because CodeView 3.00 requires
  19049.  HIMEM.SYS in order to run in protected mode, the problems are often
  19050.  mistakenly attributed to HIMEM.SYS. In reality, HIMEM.SYS is not
  19051.  responsible for the errors because it is just the memory manager that
  19052.  CodeView utilizes to get at extended memory. The errors are the result
  19053.  of an interrupt handling incompatibility between certain hardware
  19054.  configurations and the DOS extender built into CodeView.
  19055.  
  19056.  Microsoft has confirmed this to be a problem in CodeView version 3.00.
  19057.  This problem has been corrected in version 3.10.
  19058.  
  19059.  
  19060.  138. Label/Function Search Command Fails Under Codeview 3.00/3.10
  19061.  
  19062.  Product Version(s): 3.00 3.10 | 3.00 3.10
  19063.  Operating System:   MS-DOS    | OS/2
  19064.  Flags: ENDUSER | buglist3.00 buglist3.10
  19065.  Last Modified: 31-AUG-1990    ArticleIdent: Q65312
  19066.  
  19067.  Under CodeView versions 3.00 and 3.10, the Label/Function search
  19068.  command is described in the online help as performing a search of the
  19069.  current source window for an assembly-language label or function name.
  19070.  If the label is found, the debugger should switch from source to
  19071.  assembly mode to display a label in a library routine or assembly
  19072.  language module.
  19073.  
  19074.  In reality, this command fails with a message "Error - Unknown
  19075.  Symbol". The debugger does not switch into assembly mode. This problem
  19076.  can be reproduced by selecting Search from the CodeView menu, then
  19077.  selecting Label/Function and typing in "__chkstk" (without the
  19078.  quotation marks).
  19079.  
  19080.  Microsoft has confirmed this to be a problem with CodeView Versions
  19081.  3.00 and 3.10. We are researching this problem and will post new
  19082.  information here as it becomes available.
  19083.  
  19084.  
  19085.  139. Cannot Enable A20! with Orchid 386s
  19086.  
  19087.  Product Version(s): 3.00
  19088.  Operating System:   MS-DOS
  19089.  Flags: ENDUSER |
  19090.  Last Modified: 17-DEC-1990    ArticleIdent: Q65360
  19091.  
  19092.  Using HIMEM.SYS version 2.50 with Orchid 386/25 motherboards with the
  19093.  caching controllers can cause the following error message:
  19094.  
  19095.     Cannot enable A20!
  19096.  
  19097.  Orchid Technology has verified that this is a problem with the PAL
  19098.  chip on these motherboards. Customers who are experiencing this
  19099.  problem should call Orchid Technology at (415) 683-0300 for an update
  19100.  of their PAL chip. Please have the revision of the motherboard on hand
  19101.  when calling.
  19102.  
  19103.  
  19104.  140. Mouse Cursor on Wrong Monitor During Dual-Monitor Debugging
  19105.  
  19106.  Product Version(s): 3.00 3.10
  19107.  Operating System:   MS-DOS
  19108.  Flags: ENDUSER | H_MOUSE
  19109.  Last Modified: 17-SEP-1990    ArticleIdent: Q65528
  19110.  
  19111.  Under certain conditions, when invoking real-mode CodeView (CV) in
  19112.  dual-monitor mode with /2, the mouse cursor appears on the wrong
  19113.  monitor. When this occurs, a "sprite" mouse cursor appears on the
  19114.  monitor that the application is to run on, while the secondary monitor
  19115.  where CodeView is running does not have a mouse cursor. Several
  19116.  workarounds to this problem are given below.
  19117.  
  19118.  The sprite mouse cursor is a "graphic" arrow cursor similar to that in
  19119.  Windows 3.00 or OS/2 Presentation Manager (PM), as opposed to the
  19120.  traditional "text" block cursor that usually appears when running
  19121.  CodeView or the Programmer's WorkBench (PWB).
  19122.  
  19123.  The problem of the mouse appearing on the wrong monitor occurs only on
  19124.  computers that have "extended register" video boards, such as some of
  19125.  the Video 7 VGA cards. Certain mouse drivers enable the sprite cursor
  19126.  when they detect these extended video registers. Because a monochrome
  19127.  monitor cannot support this extended mode mouse cursor, the cursor
  19128.  fails to switch to the secondary monitor when focus is switched to
  19129.  that monitor after CodeView is invoked with the /2 switch.
  19130.  
  19131.  The following are three possible workarounds to this problem:
  19132.  
  19133.  1. Upgrade to mouse driver version 7.04 or later. This version
  19134.     provides a new switch, /Y, which can be used with either the
  19135.     MOUSE.COM program or the MOUSE.SYS device driver. The /Y switch
  19136.     tells the mouse driver to disable the sprite cursor. The mouse
  19137.     driver update can be obtained free of charge by contacting
  19138.     Microsoft Product Support Services at (206) 637-7096.
  19139.  
  19140.  2. If a mouse driver earlier than version 7.04 is used, the problem
  19141.     may be worked around by creating a batch file or adding the
  19142.     following commands to the AUTOEXEC.BAT file:
  19143.  
  19144.        mode mono
  19145.        mouse
  19146.        mode co80
  19147.  
  19148.     These commands will switch focus to the monochrome monitor while
  19149.     the mouse is being invoked and then will switch the focus back to
  19150.     the color monitor. This method will prevent the mouse driver from
  19151.     detecting the extended registers and using the sprite cursor.
  19152.  
  19153.  3. Disable the extended video registers. Check the video card
  19154.     documentation to see if this method is possible with your
  19155.     particular card.
  19156.  
  19157.  
  19158.  141. CV May Come Up Only in Monochrome with 8514/A Display Adapter
  19159.  
  19160.  Product Version(s): 3.00 3.10
  19161.  Operating System:   MS-DOS
  19162.  Flags: ENDUSER | appnote SV0337.ARC B_QuickBas
  19163.  Last Modified: 16-OCT-1990    ArticleIdent: Q65701
  19164.  
  19165.  Real-mode CodeView (CV) may display only in monochrome (black and
  19166.  white) mode on some systems with an 8514 or color VGA monitor attached
  19167.  to an 8514/A display adapter. On these systems, the installation of an
  19168.  8514/A video card causes the BIOS video functions to return an
  19169.  incorrect value indicating that a monochrome VGA monitor is attached,
  19170.  rather than a color monitor.
  19171.  
  19172.  This same BIOS information contributes to the way in which these
  19173.  versions of CodeView (and various other programs) detect the type of
  19174.  video adapter present; thus, CodeView may incorrectly determine that
  19175.  it is running on a monochrome system and may display the screen only
  19176.  in black and white.
  19177.  
  19178.  Workaround
  19179.  ----------
  19180.  
  19181.  As a workaround, an application note titled "8514/A Monochrome to
  19182.  Color Patch" is available from Microsoft Product Support Services by
  19183.  calling (206) 637-7096. This application note contains a program,
  19184.  which may be run before CodeView is invoked and which will configure
  19185.  the BIOS information correctly for CodeView to come up in color.
  19186.  The program is also available in the Software/Data Library by querying
  19187.  on SV0337, the Q number of the article, or S12719. SV0337 was archived
  19188.  using the PKware file-conversion utility.
  19189.  
  19190.  This monochrome video problem is specific to DOS, and therefore, does
  19191.  not occur with protected-mode CodeView (CVP) under OS/2. However, the
  19192.  problem may appear if real-mode CodeView is run in the DOS
  19193.  compatibility box under OS/2. In addition, the problem may occur with
  19194.  other software, such as Microsoft QuickBASIC.
  19195.  
  19196.  With CodeView, another symptom of this problem is that the program
  19197.  output screen (which can be accessed by pressing F4) will usually
  19198.  appear as dark blue characters on a black background. This screen is
  19199.  essentially unreadable and remains this way even after CodeView is
  19200.  terminated. Typing MODE CO80 at the DOS prompt after exiting CV should
  19201.  restore the system to the default colors.
  19202.  
  19203.  Microsoft intends to change the video detection routine in future
  19204.  software releases in order to circumvent this problem. Although the
  19205.  problem is not specifically caused by CodeView, a more sophisticated
  19206.  video detection routine will determine what video adapter and monitor
  19207.  are present without relying on the possibly inaccurate BIOS data.
  19208.  
  19209.  
  19210.  142. CV /E Avoids Windows 3.00 386 Enhanced Mode Protection Error
  19211.  
  19212.  Product Version(s): 2.35 3.00 3.10
  19213.  Operating System:   MS-DOS
  19214.  Flags: ENDUSER | SR# S900919-57 B_QuickBas B_BasicCom W_Win3
  19215.  Last Modified: 24-OCT-1990    ArticleIdent: Q65934
  19216.  
  19217.  When you start Microsoft CodeView under Windows 3.00 in a 386 enhanced
  19218.  mode DOS box, the following error message is displayed:
  19219.  
  19220.     You have attempted to run protected-mode application under 386
  19221.     enhanced mode. To run the application, exit and run Windows using
  19222.     either the WIN /s or the WIN /r command.
  19223.  
  19224.  However, using WIN /s or /r is unnecessary. To avoid the error
  19225.  message, start CodeView with the /E option to tell CodeView that
  19226.  expanded memory is available, as follows:
  19227.  
  19228.     CV /E
  19229.  
  19230.  This information applies to Microsoft CodeView versions 2.35, 3.00,
  19231.  and 3.10 for MS-DOS.
  19232.  Note that CodeView version 2.35 is shipped with Microsoft BASIC
  19233.  Professional Development System (PDS) version 7.00; CodeView version
  19234.  3.00 is shipped with Microsoft C Compiler PDS version 6.00; and
  19235.  CodeView 3.10 is shipped with Microsoft BASIC PDS version 7.10.
  19236.  
  19237.  You may find that after the error message is generated, if you return
  19238.  to the DOS box and wait a few seconds, CodeView will start up. To
  19239.  avoid the error message, start CodeView as follows with the expanded
  19240.  memory (/E) switch (where <filename.exe> is the name of the program
  19241.  you want to debug):
  19242.  
  19243.     CV /E <filename.exe>
  19244.  
  19245.  To increase the size of programs that can be loaded into CodeView in
  19246.  conjunction with the /E switch, you can create a PIF file for CodeView
  19247.  and specify -1 for the Expanded Memory KB Limit, which instructs
  19248.  Windows to give the program all the EMS that it needs.
  19249.  
  19250.  CodeView will run without the above error message in a Windows 3.00
  19251.  DOS box in standard mode, WIN /S.
  19252.  
  19253.  
  19254.  143. CV1319 Error May Be Caused by Generic Breakpoints
  19255.  
  19256.  Product Version(s): 3.00   | 3.10
  19257.  Operating System:   MS-DOS | OS/2
  19258.  Flags: ENDUSER |
  19259.  Last Modified: 24-OCT-1990    ArticleIdent: Q66215
  19260.  
  19261.  In some situations a program will hang with the CodeView
  19262.  initialization error CV1319 even though the program runs correctly
  19263.  outside of CodeView. Deleting any generic breakpoints in the
  19264.  CURRENT.STS file may resolve this problem. The following is an
  19265.  example:
  19266.  
  19267.     [debug-]
  19268.           genericbp='E 0x47:0x0007
  19269.  
  19270.  The problem is that when you recompile your program, the code moves
  19271.  and the absolute breakpoint may now be set in the middle of a
  19272.  multibyte instruction rather than the beginning of the instruction.
  19273.  
  19274.  Additional Workaround
  19275.  ---------------------
  19276.  
  19277.  Invoke CodeView with the /TSF ("Toggle StateFileread") option. This
  19278.  option will either read or ignore the CURRENT.STS file based on what
  19279.  the statefileread switch is set to in the TOOLS.INI file.
  19280.  
  19281.  For example, if the statefileread switch is set to "yes" (the default)
  19282.  and CodeView is invoked with the /TSF option, the CURRENT.STS file
  19283.  will be ignored.
  19284.  
  19285.  
  19286.  144. Running Out of Memory in CodeView with /X
  19287.  
  19288.  Product Version(s): 3.00 3.10 3.11
  19289.  Operating System:   MS-DOS
  19290.  Flags: ENDUSER |
  19291.  Last Modified: 24-OCT-1990    ArticleIdent: Q66230
  19292.  
  19293.  Under some circumstances, CodeView may still run out of memory while
  19294.  debugging large applications with the /X switch invoked to take
  19295.  advantage of extended memory with HIMEM.SYS. The debug information
  19296.  gets expanded when CodeView loads the program, so the following
  19297.  suggestions may help the problem:
  19298.  
  19299.  1. Don't use the quick compile (/qc) option. The symbolic information
  19300.     created by the quick compiler may expand much more when loaded by
  19301.     CodeView than the symbolic information created by the standard
  19302.     compiler. In addition, the quick compiler may create some duplicate
  19303.     debug references in the executable file. These duplicate references
  19304.     can take up significant memory when CodeView loads the program.
  19305.  
  19306.  2. Use the CVPACK utility, which is documented in the online
  19307.     documentation and on Page 21 of the "Microsoft C Reference" manual.
  19308.     CVPACK will compress the debug information in the file by removing
  19309.     duplicate references. Use the /P option to achieve maximum
  19310.     compression.
  19311.  
  19312.  
  19313.  145. CodeView Fails to Return Value in ES
  19314.  
  19315.  Product Version(s): 3.00 3.10 3.11
  19316.  Operating System:   MS-DOS
  19317.  Flags: ENDUSER | buglist3.00 buglist3.10 buglist3.11
  19318.  Last Modified:  9-NOV-1990    ArticleIdent: Q66507
  19319.  
  19320.  When CodeView is running in extended memory and a call is made to
  19321.  interrupt 15h function C0h, the value in the ES register is not
  19322.  changed. This interrupt call should return the segment of the system
  19323.  configuration table in the ES register. If CodeView is run with the /D
  19324.  or /E option, a value is returned in the ES register as it should be.
  19325.  
  19326.  Microsoft has confirmed this to be a problem in CodeView versions
  19327.  3.00, 3.10, and 3.11. We are researching this problem and will post
  19328.  new information here as it becomes available.
  19329.  
  19330.  Sample Code
  19331.  -----------
  19332.  
  19333.  main ()
  19334.    {
  19335.     _asm mov ah, 0xC0
  19336.    _asm int 0x15
  19337.    }
  19338.  
  19339.  
  19340.  146. Memory Requirements for Real-Mode CodeView (CV.EXE)
  19341.  
  19342.  Product Version(s): 3.00 3.10 3.11 | 3.00 3.10 3.11
  19343.  Operating System:   MS-DOS         | OS/2
  19344.  Flags: ENDUSER |
  19345.  Last Modified: 11-NOV-1990    ArticleIdent: Q66513
  19346.  
  19347.  Real-mode versions of CodeView (CV) beginning with version 3.00 offer
  19348.  a number of ways to utilize available memory in order to make the
  19349.  greatest amount of conventional memory available to the program being
  19350.  debugged. The amount of memory actually used depends on the
  19351.  command-line options specified as well as the configuration of the
  19352.  system used for debugging.
  19353.  
  19354.  The following table shows the size of CodeView in standard DOS memory
  19355.  with each of the memory-specific command-line options (see the "More
  19356.  Information" section below for further details):
  19357.  
  19358.     Option  RAM Usage                   Option  RAM Usage
  19359.     ------  ---------                   ------  ---------
  19360.  
  19361.      /X       16K                       /D16     210K
  19362.      /E      192K                       /D32     225K
  19363.      /D      256K (same as /D64)        /D128    320K
  19364.  
  19365.  The following descriptions of the three memory-related CodeView
  19366.  options explain the ways in which each option affects memory
  19367.  utilization in addition to the respective amounts of conventional
  19368.  memory that CodeView requires with each. (This information pertains
  19369.  only to CodeView versions 3.00 and later -- versions of CodeView
  19370.  earlier than 3.00 require approximately 230K of RAM specifically for
  19371.  CodeView.)
  19372.  
  19373.  /X - Specifies that CodeView should utilize extended memory. Assuming
  19374.       that enough extended memory is available, this option moves both
  19375.       the symbolic information and most of CV itself into extended
  19376.       memory. Allowing CV to be loaded into high memory requires that
  19377.       approximately 16K to 19K of "control" code remain in conventional
  19378.       memory, thus all free conventional RAM over 19K is available to
  19379.       load the program to be debugged (the "debuggee").
  19380.  
  19381.  /E - Specifies that CodeView should utilize expanded memory. Assuming
  19382.       that enough expanded memory is available, this option moves both
  19383.       the symbolic information and CodeView's own overlays into
  19384.       expanded memory. The size of the CV "root" without the extra
  19385.       overlayed code is approximately 192K. Since the overlays do not
  19386.       cause any additional overhead with /E, all free conventional RAM
  19387.       over 192K is available to load the debuggee.
  19388.  
  19389.  /D - Specifies that CodeView should utilize disk overlays in
  19390.       conventional memory. By default, this option creates a 64K buffer
  19391.       area for loading disk overlays. With the 192K root, the 64K
  19392.       buffer means CV will take about 256K of conventional memory with
  19393.       /D. In addition, the symbolic information must also be loaded
  19394.       into conventional memory; therefore, since symbolic data varies
  19395.       with each program, it is not possible to specify the amount of
  19396.       memory available for the debuggee alone.
  19397.  
  19398.       The /D option can also be specified with a value that indicates
  19399.       the size of the overlay buffer area. This parameter can be any
  19400.       value from 16 to 128, which represents an overlay buffer size
  19401.       from 16K to 128K. Specifying /D16 will minimize CodeView's size
  19402.       with disk overlays to approximately 210K. This maximizes the
  19403.       amount of conventional memory that will be available to load the
  19404.       debuggee and the symbolic information. At the other extreme,
  19405.       /D128 causes CV to use approximately 320K of conventional RAM.
  19406.       This provides faster CodeView execution speed, but it will only
  19407.       work with smaller debuggees.
  19408.  
  19409.  Note: CodeView will default to the best memory usage possible. In
  19410.  other words, if NO memory usage option is specified, CV will try to
  19411.  use extended memory. If extended memory is unavailable, CV looks for
  19412.  expanded memory. CV will use disk overlays on its own only if expanded
  19413.  memory is not found.
  19414.  
  19415.  
  19416.  147. CV2206 Warning: Corrupt OMF Detected in <filename>
  19417.  
  19418.  Product Version(s): 2.x 3.00 3.10 | 2.x 3.00 3.10
  19419.  Operating System:   MS-DOS        | OS/2
  19420.  Flags: ENDUSER | S_MASM H_MASM
  19421.  Last Modified: 11-NOV-1990    ArticleIdent: Q66702
  19422.  
  19423.  When trying to debug a Macro Assembler program with CodeView, the
  19424.  following message may appear:
  19425.  
  19426.     CV2206 Warning: Corrupt debug OMF detected in <filename>,
  19427.        discarding source line information
  19428.  
  19429.  The error occurs when code segments are not of class "CODE". Page 104
  19430.  of the "Macro Assembler 5.10 Programmer's Guide" states the following:
  19431.  
  19432.     The CodeView debugger also expects code segments to have the class
  19433.     name 'CODE'. If you fail to assign a class type to a code segment,
  19434.     or if you give it a class type other than 'CODE', then labels may
  19435.     not be properly aligned for symbolic debugging.
  19436.  
  19437.  This is also mentioned in the "CodeView and Utilities" manual under
  19438.  section 1.3.8 titled "Preparing Assembly Programs."
  19439.  
  19440.  The following is an example of the problem:
  19441.  
  19442.  _text segment para public   ; 'CODE' should be added to this line
  19443.  
  19444.  begin    proc
  19445.        mov ah, 4ch
  19446.        int 21h
  19447.  begin    endp
  19448.  
  19449.  _text ends
  19450.        end begin
  19451.  
  19452.  
  19453.  148. How to Execute a Function From the Command or Watch Window
  19454.  
  19455.  Product Version(s): 2.x 3.00 3.10 3.11 | 2.x 3.00 3.10 3.11
  19456.  Operating System:   MS-DOS             | OS/2
  19457.  Flags: ENDUSER | docerr s_c 6.00 6.00a
  19458.  Last Modified:  4-DEC-1990    ArticleIdent: Q67007
  19459.  
  19460.  Page 201 of the "Advanced Programming Techniques" (APT) manual that
  19461.  accompanies Microsoft C versions 6.00 and 6.00a states that "any C
  19462.  function in your program (whether user-written or from the library)
  19463.  can be called from the Command window or the Watch window."
  19464.  
  19465.  This statement is not completely true. Actually, only functions
  19466.  compiled with full CodeView symbolic information can be called. This
  19467.  restriction eliminates all of the C run-time functions from being
  19468.  executed in this manner because they contain no symbolic information.
  19469.  A simple example of how to call a C run-time function is shown below.
  19470.  
  19471.  If an attempt is made to execute a function that has not been compiled
  19472.  with symbolic information via the Command window, the following error
  19473.  will be displayed in the Command window:
  19474.  
  19475.     CV1017 Error: Syntax error
  19476.  
  19477.  In CodeView versions 2.x, an "unknown symbol" error is displayed in
  19478.  the Command window.
  19479.  
  19480.  If an attempt is made to add the function to the Watch window via the
  19481.  Watch menu and the "Add Watch" command, CodeView will ignore the entry
  19482.  and beep. In versions 2.x, CodeView will give an "unknown symbol"
  19483.  error.
  19484.  
  19485.  The APT gives an example of calling a C function from the Command
  19486.  window via the following command:
  19487.  
  19488.     ?funcname (varlist)
  19489.  
  19490.  This command will only invoke the function and display its return
  19491.  value in the Command window. To add the function to the Watch window,
  19492.  a slightly different command must be used, as follows:
  19493.  
  19494.     w?funcname (varlist)
  19495.  
  19496.  The function name can also be added to the Watch window by choosing
  19497.  the Watch menu and the "Add Watch" command, and typing only the
  19498.  function name plus its variable list enclosed in parenthesis. Neither
  19499.  the "w" or the "?" are needed in this situation.
  19500.  
  19501.  It is important to note that you should be sure that the screen
  19502.  flip/swap option on the Options menu is turned on if the function you
  19503.  execute performs any screen input or output.
  19504.  
  19505.  For example, if you want to call a C run-time function or any other
  19506.  function that does not contain CodeView symbolic information, you must
  19507.  create a shell function that calls the desired function itself and
  19508.  gives the same return value.
  19509.  
  19510.  Therefore, if you wanted to call the C run-time function sqrt()
  19511.  directly from the CodeView Command window or Watch window, you would
  19512.  create a shell function that resembles the following:
  19513.  
  19514.  1. #include <math.h>
  19515.  2. double my_sqrt(double x)
  19516.  3. {
  19517.  4.    return(sqrt(x)) ;
  19518.  5. }
  19519.  
  19520.  You would then compile this function with CodeView information by
  19521.  compiling with the /Zi switch, and then link it into your program
  19522.  being sure to include /CO in your link command. Note that your program
  19523.  does not need to make a call to the function in order for it to be
  19524.  available for direct execution.
  19525.  
  19526.  To execute this function from the Command window, enter the following
  19527.  command:
  19528.  
  19529.     ?my_sqrt(4.0)
  19530.  
  19531.  The return value should be displayed on the next line in the Command
  19532.  window. In this example, 2.0000000000000 should be displayed as a
  19533.  result of the square root of 4.0.
  19534.  
  19535.  To add the function to the Watch window via the Command window, you
  19536.  would enter the following command:
  19537.  
  19538.     w?my_sqrt(4.0)
  19539.  
  19540.  The function could also be added to the watch window by choosing the
  19541.  "Add Watch" command from the Watch menu and entering the following at
  19542.  the Add Watch prompt:
  19543.  
  19544.     my_sqrt(4.0)
  19545.  
  19546.  When a function is added to the Watch window, that function is
  19547.  executed any time the Watch window is updated.
  19548.  
  19549.  Although these examples show a constant value as the parameter to the
  19550.  function, any variable that is in scope at the time could be entered
  19551.  as a parameter.
  19552.  
  19553.  
  19554.  149. Syntax Error When Watching Variables That Begin with "P"
  19555.  
  19556.  Product Version(s): 2.20 2.30 | 2.20 2.30
  19557.  Operating System:   MS-DOS    | OS/2
  19558.  Flags: ENDUSER | buglist2.10 buglist2.20 fixlist3.00
  19559.  Last Modified: 18-NOV-1990    ArticleIdent: Q67008
  19560.  
  19561.  When the following command is entered in the Command window to watch a
  19562.  variable that begins with the letter "p", the result is a syntax
  19563.  error:
  19564.  
  19565.  > W pvariable
  19566.  
  19567.  The syntax for watching a memory location is W[type] range, where the
  19568.  type and range specify the format and length of memory to be
  19569.  displayed, respectively.
  19570.  
  19571.  When no type is declared, as in the above example, the default type is
  19572.  used. The default type will be the last type used by a Dump, Enter,
  19573.  Watch Memory, or Tracepoint Memory command. If none of these commands
  19574.  has been used during the session, the default type is byte.
  19575.  
  19576.  The workaround for this problem is to explicitly declare a type in the
  19577.  watch statement, for example:
  19578.  
  19579.  > WB pvariable.
  19580.  
  19581.  Microsoft has confirmed this to be a problem in Microsoft CodeView
  19582.  versions 2.x. This problem has been corrected in Microsoft CodeView
  19583.  version 3.00.
  19584.  
  19585.  Additional keywords: buglist2.30 buglist2.35
  19586.  
  19587.  
  19588.  150. CV1017: Syntax Error Can Be Caused by a Leading Zero
  19589.  
  19590.  Product Version(s): 3.00 3.10 3.11 | 3.00 3.10 3.11
  19591.  Operating System:   MS-DOS         | OS/2
  19592.  Flags: ENDUSER |
  19593.  Last Modified:  4-JAN-1991    ArticleIdent: Q67160
  19594.  
  19595.  Since CodeView treats all values with a leading zero as octal numbers,
  19596.  the following error is reported when the value is not a valid octal
  19597.  number:
  19598.  
  19599.     CV1017: syntax error
  19600.  
  19601.  To enter a number in hexadecimal form, the value must be preceded with
  19602.  "0x" (without the quotation marks). If the value is a number in
  19603.  decimal form, any leading zeros should be dropped.
  19604.  
  19605.  You can also use the "0n" prefix to specify decimal numbers,
  19606.  independent of the current radix.
  19607.  
  19608.  
  19609.  151. CodeView Asks for Path to a Source File Without Extension
  19610.  
  19611.  Product Version(s): 2.x 3.00 3.10 3.11 3.50
  19612.  Operating System:   MS-DOS
  19613.  Flags: ENDUSER | s_lib s_utility
  19614.  Last Modified:  4-DEC-1990    ArticleIdent: Q67271
  19615.  
  19616.  If an old version of the LIB utility is used to store OBJ modules in a
  19617.  library, the extension may not be stored. This can cause a problem if
  19618.  a module is compiled with debug information and an .EXE is built for
  19619.  CodeView to debug. When CodeView attempts to open the source file for
  19620.  the module in the library, it will fail because there is no extension.
  19621.  It will then prompt you for the filename.
  19622.  
  19623.  This is a problem with the Microsoft LIB utilities earlier than version
  19624.  3.08 and some third-party library managers. Beginning with LIB version
  19625.  3.08, the full filename is stored in the library.
  19626.  
  19627.  
  19628.  152. CodeView Does Not Debug kbhit() Correctly
  19629.  
  19630.  Product Version(s): 3.00 3.10 3.11  | 3.00 3.10 3.11
  19631.  Operating System:   MS-DOS          | OS/2
  19632.  Flags: ENDUSER | buglist3.00 buglist3.10 buglist3.11
  19633.  Last Modified:  4-DEC-1990    ArticleIdent: Q67360
  19634.  
  19635.  When setting a breakpoint between the kbhit() function and a function
  19636.  to read a character from the input stream, CodeView will grab the
  19637.  character from the input stream when the breakpoint is executed.
  19638.  
  19639.  The following code example demonstrates the problem. If a breakpoint
  19640.  is placed on the line containing the getch() function, the character
  19641.  input from the keyboard will be placed in CodeView before the getch()
  19642.  function is actually stepped over. You will not be prompted for the
  19643.  character when you step over the getch() function. The character you
  19644.  typed to stop the kbhit() loop will be used for the getch() function
  19645.  call when that line is executed.
  19646.  
  19647.  Microsoft has confirmed this to be a problem in CodeView versions
  19648.  3.00, 3.10, and 3.11. We are researching this problem and will post
  19649.  new information as it becomes available.
  19650.  
  19651.  Sample Code
  19652.  -----------
  19653.  
  19654.  #include <stdio.h>
  19655.  #include <conio.h>
  19656.  
  19657.  void main(void)
  19658.  {
  19659.          int a;
  19660.  
  19661.          do {
  19662.                  printf(".");
  19663.          } while(!kbhit());
  19664.  
  19665.          a = getch();         // put breakpoint here
  19666.  
  19667.          printf("%c\n", a);
  19668.  }
  19669.  
  19670.  
  19671.  
  19672.  
  19673.  
  19674.  
  19675.  Microsoft Linker
  19676.  =============================================================================
  19677.  
  19678.  
  19679.  1. Corrupted Library Causes Error L1102
  19680.  
  19681.  Product Version(s): 3.61 3.64 3.65 | 5.01.20 5.01.21
  19682.  Operating System:   MS-DOS         | OS/2
  19683.  Flags: ENDUSER |
  19684.  Last Modified:  6-DEC-1988    ArticleIdent: Q38201
  19685.  
  19686.  The link error "L1102: unexpected end-of-file" is generated when the
  19687.  linker attempts to resolve externals in a corrupted or null-length
  19688.  library.
  19689.  
  19690.  This error most commonly occurs with a combined library, mlibx.lib,
  19691.  that is corrupted during the library creation stage of SETUP. Make
  19692.  sure to check the \LIB subdirectory for odd or null size libraries.
  19693.  Library rebuilding is needed if insufficiently-sized libraries are
  19694.  found.
  19695.  
  19696.  The L1102 error can also be generated if you inadvertently type in the
  19697.  name of a used library at the "list file" prompt, as follows:
  19698.  
  19699.     Run File  [SPUD.EXE]:      main.exe
  19700.     List File [NUL.MAP]:       libname.lib    (generates faulty library)
  19701.     Libraries [.LIB]:          libname.lib
  19702.     Definition File [NUL.DEF]: main.def
  19703.  
  19704.  This process creates a map listing with the specified library name in
  19705.  the current working directory. Because this directory is searched
  19706.  before the directory specified in the LIB environment variable, the
  19707.  incorrect library containing the map listing is used during linkage,
  19708.  causing the error L1102.
  19709.  
  19710.  
  19711.  2. /I Linker Option Should Read /INF
  19712.  
  19713.  Product Version(s): 3.61 3.65
  19714.  Operating System:   MS-DOS
  19715.  Flags: ENDUSER | docerr
  19716.  Last Modified: 18-OCT-1988    ArticleIdent: Q30515
  19717.  
  19718.  Pages 266 and 267 of the "Microsoft C Optimizing Compiler CodeView and
  19719.  Utilities" manual for Versions 5.00 and 5.10 incorrectly list the
  19720.  shortened name of the /INFORMATION option as /I.
  19721.  
  19722.  If /I is given as an option, the result is an error stating that /I is
  19723.  an unrecognized option.
  19724.  
  19725.  The correct shortened name for /INFORMATION is /INF.
  19726.  
  19727.  
  19728.  3. Maximum Libraries LINK Can Handle
  19729.  
  19730.  Product Version(s): 3.x 5.01.20 5.01.21
  19731.  Operating System:   MS-DOS
  19732.  Flags: ENDUSER |
  19733.  Last Modified: 18-OCT-1988    ArticleIdent: Q31986
  19734.  
  19735.     LINK can handle no more than 32 libraries, i.e., on the LIBRARY
  19736.  prompt, you can specify up to 32 libraries.
  19737.     If you have more libraries, you have two choices: combine libraries
  19738.  or specify some of them at the object modules prompt. In the second
  19739.  case, LINK will treat the library as a collection of object modules,
  19740.  all of which should be included in your .EXE file.
  19741.  
  19742.  
  19743.  4. Maximum Number of Object Modules LINK Allows
  19744.  
  19745.  Product Version(s): 3.x 5.01.20 5.01.21
  19746.  Operating System:   MS-DOS
  19747.  Flags: ENDUSER |
  19748.  Last Modified: 18-OCT-1988    ArticleIdent: Q31987
  19749.  
  19750.     There is no limit to the number of object modules LINK allows;
  19751.  however, LINK can operate only in certain limits imposed by the amount
  19752.  of available resources.
  19753.  
  19754.  
  19755.  5. The Meaning of an Invalid Object Module
  19756.  
  19757.  Product Version(s): 3.x 5.01.20 5.01.21
  19758.  Operating System:   MS-DOS
  19759.  Flags: ENDUSER |
  19760.  Last Modified: 13-OCT-1988    ArticleIdent: Q31988
  19761.  
  19762.  An invalid object-module error message means that an object module
  19763.  does not conform to Microsoft object format. The description of object
  19764.  format can be found in "MS-DOS Encyclopedia Part E: Programming Tools
  19765.  Article 19: Object Module."
  19766.  
  19767.  
  19768.  6. Object Modules Handled by LINK
  19769.  
  19770.  Product Version(s): 3.x 5.01.20 5.01.21
  19771.  Operating System:   MS-DOS
  19772.  Flags: ENDUSER |
  19773.  Last Modified: 15-JUL-1988    ArticleIdent: Q31989
  19774.  
  19775.     Successive versions of LINK always are backward compatible, but not
  19776.  necessarily upward compatible, i.e., the most recent versions should
  19777.  link any existing object module, but not necessarily any future object
  19778.  module.
  19779.     To solve this problem, update to the latest version of LINK.
  19780.  
  19781.  
  19782.  
  19783.  7. How LINK Orders and Combines Segments
  19784.  
  19785.  Product Version(s): 3.x 5.01.20 5.01.21
  19786.  Operating System:   MS-DOS
  19787.  Flags: ENDUSER |
  19788.  Last Modified: 15-JUL-1988    ArticleIdent: Q31991
  19789.  
  19790.     Every segment belongs to a named class such as 'CODE', 'DATA', or
  19791.  'BSS'. LINK orders all segments with the same class name contiguously.
  19792.     Within each class, segments are placed in the same order as LINK
  19793.  encounters them. Segment classes are placed in the order they appear.
  19794.  If you do not give a class name when you define a segment in assembly,
  19795.  the segment gets the null class, which is treated like any other segment.
  19796.  If the /DOSSEG option is given, or one of the Microsoft language run-time
  19797.  libraries is used, LINK imposes the following additional order:
  19798.  
  19799.        code (class ending in 'CODE')
  19800.        far data (everything but DGROUP and 'CODE')
  19801.        DGROUP - the default data segment
  19802.            class 'BEGDATA' (special runtime segment)
  19803.            near initialized data (everything but 'BSS' and 'STACK')
  19804.            near BSS--uninitialized data  (class 'BSS')
  19805.            stack
  19806.  
  19807.  
  19808.  
  19809.  8. Link Error L1053 Symbol Table Overflow
  19810.  
  19811.  Product Version(s): 3.x 5.01.20 5.01.21
  19812.  Operating System:   MS-DOS
  19813.  Flags: ENDUSER |
  19814.  Last Modified: 13-OCT-1988    ArticleIdent: Q31992
  19815.  
  19816.  Question:
  19817.  
  19818.  I am receiving link error L1053: symbol table overflow. What is the
  19819.  limit of the symbol table?
  19820.  
  19821.  Response:
  19822.  
  19823.  Under MS-DOS, this limit using the DOS-only linker (Versions
  19824.  3.x) is dependent on the amount of available memory in your computer.
  19825.  LINK can use all conventional memory available under DOS (up to 640K).
  19826.  
  19827.  Under OS/2, the segmented-executable linker (Versions 5.x and above)
  19828.  has no limit on the size of the symbol table because it extends the
  19829.  symbol table in virtual memory.
  19830.  
  19831.  
  19832.  9. Temporary Files Created at Link Time
  19833.  
  19834.  Product Version(s): 3.x 5.01.20 5.01.21
  19835.  Operating System:   MS-DOS
  19836.  Flags: ENDUSER |
  19837.  Last Modified: 22-JUL-1988    ArticleIdent: Q31993
  19838.  
  19839.     The linker creates a temporary file when it runs out of memory to
  19840.  hold the symbol table or the load image and run-time relocations of
  19841.  the program being linked.
  19842.  
  19843.  
  19844.  
  19845.  10. How Overlays Are Set Up By the Linker
  19846.  
  19847.  Product Version(s): 3.x 4.06 4.07 5.01.20 5.01.21 5.03
  19848.  Operating System:   MS-DOS
  19849.  Flags: ENDUSER |
  19850.  Last Modified: 26-JAN-1990    ArticleIdent: Q31994
  19851.  
  19852.  The overlay linker uses an interrupt to call in overlaid files. By
  19853.  default, the interrupt number used for passing control to overlays is
  19854.  63 (3f hex).
  19855.  
  19856.  The linker links the Microsoft overlay manager from the standard
  19857.  Microsoft language run-time libraries. The linker assigns segments to
  19858.  overlays based on the grouping you indicate. It replaces
  19859.  overlay-to-overlay far calls and root-to-overlay far calls with an
  19860.  interrupt sequence that calls the overlay manager. The overlay manager
  19861.  swaps overlays if necessary and returns control to the program.
  19862.  
  19863.  The linker replaces root-to-overlay and overlay-to-overlay far calls
  19864.  with the following sequence:
  19865.  
  19866.     INT     3Fh         ; can change # with /OVERLAYINTERRUPT:#
  19867.     DB      ?           ; target overlay segment number, where
  19868.                         ; every non-root code segment is numbered
  19869.                         ; starting at 1
  19870.     DW      ?           ; target offset within segment
  19871.  
  19872.  The interrupt handler is set to the overlay manager code that swaps
  19873.  out the resident overlay if necessary and swaps in the target overlay,
  19874.  then jumps to the target address. The overlay manager does nothing
  19875.  unusual in servicing the interrupts; it does not disable interrupts.
  19876.  However, it may issue INT 21h calls to swap overlays.
  19877.  
  19878.  The overlay manager assumes that once your initialization code has
  19879.  been executed, DS and SS will always be the same. Furthermore, it
  19880.  assumes you will initialize DS and SS to the value of DGROUP (the
  19881.  default data segment defined by Microsoft languages). Note that your
  19882.  program also must have a stack segment.
  19883.  
  19884.  A more detailed description of the overlay manager can be found on
  19885.  Page 715 of the "MS-DOS Encyclopedia," "Article 20: The Microsoft
  19886.  Object Linker."
  19887.  
  19888.  
  19889.  11. Why the First Module in the Code Segment Starts at Offset 16
  19890.  
  19891.  Product Version(s): 3.x 4.06 4.07 5.01.21 5.03 | 5.01.21 5.03
  19892.  Operating System:   MS-DOS                     | OS/2
  19893.  Flags: ENDUSER | s_c s_quickc s_quickasm h_masm h_fortran
  19894.  Last Modified: 14-FEB-1990    ArticleIdent: Q58688
  19895.  
  19896.  Question:
  19897.  
  19898.  Under some circumstances, I get 16 zero bytes at the beginning of my
  19899.  code segment. I'm linking with my own replacement C library with
  19900.  start-up code. The entry point to this start-up module is the first
  19901.  item in the module, and it always ends up at offset 16. Why is this?
  19902.  
  19903.  Response:
  19904.  
  19905.  The linker will insert 16 bytes at the beginning of the code segment
  19906.  if it determines that you are using standard segment naming
  19907.  conventions (/MS-DOSSEG) and the NULL segment is not explicitly
  19908.  removed (/NONULLSMS-DOSSEG). In your case, the linker assumes that you
  19909.  need support for signal() and allocates the first 16 bytes for it.
  19910.  
  19911.  Note: This will always be done for C programs by the compiler.
  19912.  
  19913.  
  19914.  12. Linker Outputs Information with Invalid Object Module
  19915.  
  19916.  Product Version(s): 3.x 5.01.20 5.01.21
  19917.  Operating System:   MS-DOS
  19918.  Flags: ENDUSER |
  19919.  Last Modified: 15-JUL-1988    ArticleIdent: Q31999
  19920.  
  19921.     When an invalid object-module error message occurs, some
  19922.  information about the record and the position is printed.
  19923.     This information includes the object record type and the relative
  19924.  position of the record in the .OBJ file. There is little you can do
  19925.  with this information; it is mainly for compiler and assembler
  19926.  developers to point to the wrong object record.
  19927.  
  19928.  
  19929.  13. Incremental Linking
  19930.  
  19931.  Product Version(s): 3.x 5.01.20 5.01.21
  19932.  Operating System:   MS-DOS
  19933.  Flags: ENDUSER |
  19934.  Last Modified: 15-JUL-1988    ArticleIdent: Q32000
  19935.  
  19936.     The following is a description of the incremental-linking process.
  19937.     Your file is built from a set of .OBJ files. Each .OBJ file is
  19938.  produced by the compiler or assembler from a source file. If a set of
  19939.  .OBJ files is large, then linking time can be long. If you change only
  19940.  one source file (i.e., in your set of .OBJ files you have one new .OBJ
  19941.  file), you can link all .OBJs one more time, or patch your .EXE file
  19942.  with the new .OBJ file. This patching is called incremental linking.
  19943.     Incremental linking only is supported for OS/2 and Windows
  19944.  programs.
  19945.  
  19946.  
  19947.  
  19948.  14. Explanation of a MAP File
  19949.  
  19950.  Product Version(s): 3.x 5.01.20 5.01.21
  19951.  Operating System:   MS-DOS
  19952.  Flags: ENDUSER |
  19953.  Last Modified: 15-JUL-1988    ArticleIdent: Q32001
  19954.  
  19955.     A MAP file gives you a picture of how your code and data are
  19956.  arranged in memory when the program is loaded.
  19957.     First you get the list of segments in the order in which they will
  19958.  be loaded into memory. For each segment, you have its starting
  19959.  address, length, name, and class. Following the segments are groups,
  19960.  each specifying the starting address of the group.
  19961.     If you specify the /MAP switch and list filename, in the MAP you
  19962.  will get two lists of public symbols in your program. The first list
  19963.  will be sorted alphabetically, the second by addresses.
  19964.     If you specify the /LINENUMBERS switch, then in the MAP, you will
  19965.  get line numbers and the associated addresses of your source program.
  19966.  To produce line numbers in the MAP, give LINK an object file with
  19967.  line-number information. Use the /Zd option with any Microsoft
  19968.  compiler to include line numbers in the object file.
  19969.     Information from the MAP will help you debug your program and
  19970.  understand how the program is loaded into memory.
  19971.  
  19972.  
  19973.  15. L1087: "Unexpected End-of-File on Scratch File"
  19974.  
  19975.  Product Version(s): 3.x 5.x  | 5.10
  19976.  Operating System:   MS-DOS   | OS/2
  19977.  Flags: ENDUSER |
  19978.  Last Modified: 13-OCT-1988    ArticleIdent: Q34669
  19979.  
  19980.  The Link Utility generates the error message L1087: "unexpected
  19981.  end-of-file on scratch file" when a disk with the temporary linker
  19982.  output file has been removed. This information is documented in the
  19983.  "Microsoft Macro Assembler CodeView and Utilities Guide."
  19984.  
  19985.  The error message L1087 also can be caused by insufficient memory
  19986.  available on the disk that contains the temporary linker output file.
  19987.  The disk can be a hard disk, floppy disk, or RAM disk.
  19988.  
  19989.  
  19990.  16. Assigning Addresses to Overlay Segments
  19991.  
  19992.  Product Version(s): 3.x 5.01.20 5.01.21
  19993.  Operating System:   MS-DOS
  19994.  Flags: ENDUSER |
  19995.  Last Modified: 15-JUL-1988    ArticleIdent: Q32003
  19996.  
  19997.     The linker assigns only code segments (identified by class names
  19998.  ending in "CODE") to overlays. Data segments go in the root. The
  19999.  particular overlay the segment goes in is determined by the module
  20000.  that first defines the segment.
  20001.  
  20002.     Note that the linker assigns segments, not object modules, to
  20003.  overlays. Therefore, if you have the following command
  20004.  
  20005.      LINK A+(B+C)
  20006.  
  20007.  where
  20008.  
  20009.      A   defines public SEG1
  20010.      B   defines public SEG2
  20011.      C   defines public SEG1
  20012.  
  20013.  then C's contribution to SEG1 goes in the root, not in the first
  20014.  overlay, because SEG1 was first defined in a root module.
  20015.     The linker orders all segments as it normally would, ignoring the
  20016.  overlays and using the class and combine-type rules described
  20017.  elsewhere. The linker then assigns addresses for every segment in the
  20018.  root up to the first overlay segment. Before the first overlay
  20019.  segment, it defines a special empty segment called OVERLAY_AREA. Then
  20020.  for each overlay it assigns addresses for every segment in the overlay
  20021.  so that the first segment in the overlay starts at OVERLAY_AREA. One
  20022.  particular overlay will end at a higher address than all the others;
  20023.  at this address, the linker defines a special empty segment called
  20024.  OVERLAY_END. Finally, the linker assigns addresses for all remaining
  20025.  segments in the root so that the first one starts at OVERLAY_END. The
  20026.  load image looks like the following:
  20027.  
  20028.          ------------+-> 0000
  20029.          |           |
  20030.          |  root     |
  20031.          |           |
  20032.          +-----------+-> OVERLAY_AREA
  20033.          |  overlay  |
  20034.          |  area     |
  20035.          |           |
  20036.          +-----------+-> OVERLAY_END
  20037.          |  root     |
  20038.          +-----------+
  20039.  
  20040.     The resultant MAP file has some different contents than the
  20041.  pre-overlay file. All items listed are declared as "res", meaning
  20042.  resident. The items contained within the overlay modules are also
  20043.  declared as "res".
  20044.     At the top of the MAP file, the segments are listed in the exact
  20045.  order in which they will be in the load image, and each segment is
  20046.  identified as being in a particular overlay or the root.
  20047.     Every symbol marked "res" is in a root segment and every symbol
  20048.  marked "ovl" is in an overlay segment. If symbols are not where you
  20049.  think they ought to be, remember the linker assigns segments, not
  20050.  modules, to overlays.
  20051.     For more information on overlays, refer to the 1988 "MS-DOS
  20052.  Encyclopedia."
  20053.  
  20054.  
  20055.  17. Link Error L1089
  20056.  
  20057.  Product Version(s): 3.51 3.55 3.60 3.61 3.64 3.65 5.01.20 5.01.21
  20058.  Operating System:   MS-DOS
  20059.  Flags: ENDUSER |
  20060.  Last Modified: 22-JUL-1988    ArticleIdent: Q32829
  20061.  
  20062.     If you are receiving the following error message, check to see if
  20063.  the TMP environment variable is set correctly:
  20064.  
  20065.     L1089   'filename' : cannot open response file
  20066.  
  20067.    If the TMP variable is not set, temporary files cannot be created
  20068.  and this error may occur.
  20069.  
  20070.  
  20071.  
  20072.  18. Cannot Overlay Small-Model Code
  20073.  
  20074.  Product Version(s): 3.60 3.61 3.64 3.65 5.01.20 5.01.21
  20075.  Operating System:   MS-DOS
  20076.  Flags: ENDUSER |
  20077.  Last Modified: 12-OCT-1988    ArticleIdent: Q34294
  20078.  
  20079.  Problem:
  20080.  
  20081.  I have specified overlays for my small-model code, but the link map
  20082.  shows that no overlays are produced.
  20083.  
  20084.  Response:
  20085.  
  20086.  You cannot overlay small-model code. You must change the memory model
  20087.  to medium, large, or huge. Page 285 of the "Microsoft CodeView
  20088.  Utilities" manual that comes with C Versions 5.00 and 5.10, MASM
  20089.  Versions 5.00 and 5.10, and Pascal Version 4.00, and Page 135 of the
  20090.  "Microsoft FORTRAN Optimizing Compiler User's Guide" states that you
  20091.  can overlay only modules to which control is transferred and returned
  20092.  by a standard 8086 long (32-bit) call/return instruction.
  20093.  
  20094.  
  20095.  19. Link Error 4051
  20096.  
  20097.  Product Version(s): 3.60 3.61 3.64 3.65 5.01.20 5.01.21
  20098.  Operating System:   MS-DOS
  20099.  Flags: ENDUSER |
  20100.  Last Modified: 22-JUL-1988    ArticleIdent: Q32831
  20101.  
  20102.     If you receive link error 4051, check the following:
  20103.  
  20104.     1. Is the LIB environment variable set correctly? Check
  20105.        for spaces around the equal sign or any extra characters
  20106.        at the end of the line.
  20107.     2. Which version of the linker is being used? Old versions of
  20108.        the linker do not recognize the LIB environment variable.
  20109.           Make sure the linker being used is the one that came with
  20110.        the product.
  20111.     3. Are the library names being asked for component libraries or
  20112.        combined libraries? Libraries compiled under C Version 4.00 or
  20113.        earlier have component library names embedded in the .OBJ files.
  20114.        With later versions of the C compiler, combined libraries are used
  20115.        and the component libraries will not be found.
  20116.           This behavior also exist when upgrading from Pascal Versions 3.32
  20117.        or earlier to Pascal Versions 4.00 or greater.
  20118.           The work-around for this behavior is to recompile all .OBJ file
  20119.       (and libraries) with the new compiler or to use the /NOD switch
  20120.       when linking, and specify all the libraries (combined and otherwise)
  20121.       to be used. The following is an example:
  20122.  
  20123.              link /NOD  test,,,llibce.lib;
  20124.  
  20125.     4. Is the correct library available for the math option chosen?
  20126.     FORTRAN defaults to the co-processor library (e.g. LLIBFOR7.LIB).
  20127.     C and Pascal default to the emulator math library (e.g. SLIBCE.LIB
  20128.     and LIBPASE.LIB)
  20129.  
  20130.  
  20131.  
  20132.  20. LINK /CO /DO in OS/2 Gives Protection Violation
  20133.  
  20134.  Product Version(s): 5.01.21 | 5.01.21
  20135.  Operating System:   MS-DOS  | OS/2
  20136.  Flags: ENDUSER | buglist5.01.21
  20137.  Last Modified: 13-OCT-1988    ArticleIdent: Q34374
  20138.  
  20139.  The Microsoft Segmented Link Utility Version 5.01.21 will
  20140.  incorrectly generate a protection violation under OS/2 when the
  20141.  command line uses the options /CO /DO, respectively.
  20142.  
  20143.  OS/2 gives the message SYS1943: "A program caused a protection
  20144.  violation." The SYS1811 violation follows, indicating the process has
  20145.  stopped.
  20146.  
  20147.  The work around for this problem is to order the switches differently.
  20148.  Instead of including /CO /DO in the command line, the command line can
  20149.  be reorder to /DO /CO.
  20150.  
  20151.  Microsoft has confirmed this to be a problem in Version 5.01.21. We are
  20152.  researching this problem and will post new information as it becomes
  20153.  available.
  20154.  
  20155.  
  20156.  21. /NOE Option for Redefinition Error L2044
  20157.  
  20158.  Product Version(s): 3.x 5.x | 5.10
  20159.  Operating System:   MS-DOS  | OS/2
  20160.  Flags: ENDUSER |
  20161.  Last Modified: 13-OCT-1988    ArticleIdent: Q34502
  20162.  
  20163.  The /NOEXTDICTIONARY switch tells the linker NOT to take advantage of
  20164.  additional information recorded in Extended Dictionary in the library
  20165.  file. This additional information describes which module in the library
  20166.  calls any other module from the same library, saving linker number
  20167.  of passes through the library file to pick up all required modules.
  20168.  
  20169.  If you have a call in your code to the library function FOO and FOO
  20170.  calls another function BAR from the same library, then at processing
  20171.  time of FOO, the linker will pull out BAR. This process occurs because
  20172.  the extended dictionary has a link between FOO and BAR.
  20173.  
  20174.  Linking without /NOE causes the following error if you want to pull
  20175.  FOO in from the library but you want to provide its own BAR:
  20176.  
  20177.  L2044 BAR : symbol multiply defined, use /NOE
  20178.  
  20179.  This error resulted from the linker pulling FOO and BAR from the
  20180.  same library, then later it sees BAR coming from user .OBJ file.
  20181.  
  20182.  Using /NOE in this case prevents the linker from pulling out
  20183.  BAR from the library, so your BAR routine is used instead.
  20184.  
  20185.  If you have genuine symbol redefinition, then when linking with /NOE
  20186.  you will see the following error:
  20187.  
  20188.  L2025 BAR : symbol defined more than once
  20189.  
  20190.  
  20191.  22. L2001 Fixups without Data
  20192.  
  20193.  Product Version(s): 3.65 5.01.21 | 5.01.21
  20194.  Operating System:   MS-DOS       | OS/2
  20195.  Flags: ENDUSER |
  20196.  Last Modified: 12-OCT-1988    ArticleIdent: Q35155
  20197.  
  20198.  The Link Utility can generate the linker error message L2001:
  20199.  fixup(s) without data. In the manual, the linker error is described
  20200.  as follows:
  20201.  
  20202.  A FIXUPP record occurred without a data record immediately
  20203.  preceding it. This is probably a compiler error. (See
  20204.  the "Microsoft MS-DOS Programmer's Reference" for more information
  20205.  on FIXUPP.
  20206.  
  20207.  In most cases, the error message is generated from an
  20208.  assembly-language program that doesn't make sense from the linker's
  20209.  point of view, but is convenient for users. The following is an
  20210.  example:
  20211.  
  20212.      extrn   foo:word
  20213.  
  20214.      ABSEG   segment at 123          ; absolute segment
  20215.  
  20216.      dw      offset DGROUP:foo       ; offset portion of address of "foo"
  20217.  
  20218.      ABSEG   ends
  20219.  
  20220.  This tells the linker to fix up a location in ABSEG with the address
  20221.  of foo. But ABSEG is an absolute segment and has no data to be fixed
  20222.  up.
  20223.  
  20224.  Another example is when you include the same STRUC definitions in both
  20225.  absolute and non-absolute segments, so that the STRUC definitions
  20226.  contain relocatable addresses.
  20227.  
  20228.  
  20229.  
  20230.  23. Setting the Overlay Interrupt (/O) in LINK
  20231.  
  20232.  Product Version(s): 3.61 3.65
  20233.  Operating System:   MS-DOS
  20234.  Flags: ENDUSER | docerr
  20235.  Last Modified: 20-JAN-1989    ArticleIdent: Q40408
  20236.  
  20237.  Question:
  20238.  
  20239.  Page 272, Section 12.2.12, of the "Microsoft CodeView and Utilities
  20240.  Software Development Tools for the MS-DOS Operating System" manual
  20241.  states that you can change the default overlay interrupt. The default
  20242.  interrupt is 3F hexadecimal. Is the manual correct? Do you have to
  20243.  change the interrupt if you have a program that uses overlays and it
  20244.  spawns a program that also uses overlays?
  20245.  
  20246.  Doesn't the compiler save interrupts? Suppose both Programs A and B
  20247.  use overlays and A spawns B. If B is a Microsoft C Version 5.00 or
  20248.  5.10 program, shouldn't it restore the original INT 3F address when it
  20249.  exits? Thus, everything should work correctly without
  20250.  /OVERLAYINTERRUPT.
  20251.  
  20252.  Response:
  20253.  
  20254.  You are correct; the C Versions 5.00 and 5.10 compiler saves and
  20255.  restores the interrupt so there should be no conflict. The C Versions
  20256.  5.00 and C 5.10 manual is incorrect. This switch need only be used if
  20257.  you are linking a program with overlays, and INT 3F is being used by
  20258.  something else when you run the program. For example, INT 3F might be
  20259.  used to communicate with a hardware board or a TSR might use it;
  20260.  however, this is unlikely.
  20261.  
  20262.  This option is for advanced users who know their configurations well
  20263.  enough to know who is using which interrupt vectors and know there is
  20264.  a conflict.
  20265.  
  20266.  
  20267.  24. LINK Environment Variable Ignored When Linking Through CL
  20268.  
  20269.  Product Version(s): 5.00 5.10 | 5.10
  20270.  Operating System:   MS-DOS    | OS/2
  20271.  Flags: ENDUSER | S_C S_QuickC
  20272.  Last Modified: 15-AUG-1989    ArticleIdent: Q47503
  20273.  
  20274.  Problem:
  20275.  
  20276.  To increase the size of my stack, when I set an environment variable
  20277.  called LINK equal to /ST:4096, it doesn't work correctly when I link
  20278.  using CL.
  20279.  
  20280.  Response:
  20281.  
  20282.  Before CL spawns the linker, it clears the environment of all
  20283.  variables except LIB. Consequently, the LINK environment variable
  20284.  doesn't exist when the linker is invoked, and any options that were
  20285.  specified by it are not seen. When linking with CL, any desired linker
  20286.  options should be specified on the CL command line after the /link
  20287.  switch.
  20288.  
  20289.  The same behavior is seen with the command line compilers from QuickC
  20290.  Version 1.00 and 1.01, but not with QuickC 2.00 or QuickAssembler.
  20291.  
  20292.  
  20293.  25. Why Unitialized Global Variables Don't Appear in C 5.10
  20294.  
  20295.  Product Version(s): 3.65
  20296.  Operating System:   MS-DOS
  20297.  Flags: ENDUSER | SR# G881021-5044
  20298.  Last Modified:  6-DEC-1988    ArticleIdent: Q38725
  20299.  
  20300.  Questions:
  20301.  
  20302.  Why don't uninitialized global variables show up in the library
  20303.  listing when the module containing them has been placed in the
  20304.  library? It appears that the librarian does not "see" uninitialized
  20305.  global variables.
  20306.  
  20307.  If my main program declares an extern, and an .OBJ with which its
  20308.  linked declares it globally (without extern), but doesn't initialize
  20309.  it, the symbol appears in the link map and space is allocated for it
  20310.  in the .EXE. This behavior seems different from previous versions of
  20311.  the compiler. If the .OBJ file is placed as a library rather than
  20312.  linked explicitly, the symbol does not appear in the .EXE. Why does it
  20313.  behave differently?
  20314.  
  20315.  Response:
  20316.  
  20317.  In Version 5.00 of the C Compiler, we introduced a new concept into
  20318.  our linking process called "communal data." Communal data can be
  20319.  declared in many modules, but only one copy of the data will exist
  20320.  in the linked .EXE file. (It is similar to the concept of COMMON
  20321.  blocks in FORTRAN.)
  20322.  
  20323.  In C, data declared outside of a function without a storage class is
  20324.  now considered to be communal data. (This is a change from previous
  20325.  versions.) Communal data declarations generate no definitions, just
  20326.  declarations; whereas initialized, or global, data declarations
  20327.  generate both definitions and declarations.
  20328.  
  20329.  Communal declarations may refer to a global definition. If they do,
  20330.  the linker simply adjusts the address as necessary. However, if
  20331.  there is no global definition of the variable, the linker combines
  20332.  the declarations into one definition and allocates the appropriate
  20333.  amount of space. For example, it is legal to declare
  20334.  
  20335.     int x;
  20336.  
  20337.  in several different modules without a corresponding
  20338.  
  20339.     int x = 0;
  20340.  
  20341.  Communal declarations are NOT copied into libraries. (This is
  20342.  documented on Page 84 of the "Microsoft C Language Reference Manual.")
  20343.  If you want the variable to appear in a library, it MUST be
  20344.  initialized so that it is global rather than communal. Communal
  20345.  variables are not included in libraries because they can cause
  20346.  strange conflicts. For example, let's suppose you
  20347.  unwittingly used a variable name that was also the name of a communal
  20348.  variable in your library. At link time, the linker would allocate
  20349.  only ONE copy of that variable without generating any warning.
  20350.  
  20351.  The symptom would be that your variable would mysteriously change
  20352.  every time you called the library function that used the communal
  20353.  variable. This problem would be a very difficult to trace.
  20354.  
  20355.  Now that we understand communal variables and how they interact with
  20356.  libraries, we can answer your questions.
  20357.  
  20358.  The first question was basically, "Why don't my communal variables
  20359.  show up in the library listing?" Because communal data is not placed
  20360.  into the library, it won't show up in the listing.
  20361.  
  20362.  The second question was, "How come the communal variable shows up in
  20363.  the .EXE file if I link it from an .OBJ file but not from a .LIB
  20364.  file?" It shows up from the .OBJ file because the communal variable
  20365.  is allocated space by the linker if it doesn't resolve to a global
  20366.  definition. It does NOT appear in the link produced by the .LIB file
  20367.  because it does not appear in the library dictionary.
  20368.  
  20369.  Note: this behavior is the result of doing something we ask you not to
  20370.  do; namely, putting communal data in a library. Data intended to be
  20371.  placed in a library must be initialized.
  20372.  
  20373.  
  20374.  26. Example of Using a Response File with LINK
  20375.  
  20376.  Product Version(s): 3.65   | 5.01.20
  20377.  Operating System:   MS-DOS | OS/2
  20378.  Flags: ENDUSER |
  20379.  Last Modified: 20-JAN-1989    ArticleIdent: Q40429
  20380.  
  20381.  The following is a small example of using a response file with LINK.
  20382.  
  20383.  A response file contains responses to the LINK prompts. The responses
  20384.  must be in the same order as the LINK prompts.
  20385.  
  20386.  LINK treats the input from the response file just as if you had
  20387.  entered it in response to prompts or in a command line. It treats any
  20388.  carriage-return-linefeed combination in the response file the same as
  20389.  if you had pressed the ENTER key in response to a prompt or included a
  20390.  comma in a command line.
  20391.  
  20392.  Note: You cannot put comments in response files.
  20393.  
  20394.  The following is an example of a file named RESPONSE.ONE:
  20395.  
  20396.  file1 file2 file3 file4
  20397.  /pause /map
  20398.  filelist
  20399.  graphics.lib
  20400.  
  20401.  Type the following at the command line:
  20402.  
  20403.     LINK @response.one
  20404.  
  20405.  
  20406.  27. Error L2025: Symbol Defined More than Once
  20407.  
  20408.  Product Version(s): 5.10   | 5.10
  20409.  Operating System:   MS-DOS | OS/2
  20410.  Flags: ENDUSER |
  20411.  Last Modified: 20-JAN-1989    ArticleIdent: Q40485
  20412.  
  20413.  Problem:
  20414.  
  20415.  I cannot link a function name in my object file with a library
  20416.  containing that same function name and have the resulting EXE call my
  20417.  function and not the library's.
  20418.  
  20419.  I am using /NOE; however, I receive the following error:
  20420.  
  20421.  (...): error L2025: (my function name) : symbol defined more than once
  20422.   pos: (some number) Record type: 53E8
  20423.  
  20424.  Response:
  20425.  
  20426.  You can only perform this task if the function name is an individual
  20427.  module. The following procedure demonstrates the error:
  20428.  
  20429.  1. Create a file CALL.C that calls functions A() and B().
  20430.  
  20431.  2. Create functions A() and B() in fileA.c and fileB.c, and compile
  20432.     them to objects.
  20433.  
  20434.  3. Do the following to create TEST.LIB:
  20435.  
  20436.        LIB TEST +fileA +fileB, test.lst
  20437.  
  20438.  4. Change B() in fileB.c and compile the following:
  20439.  
  20440.        cl call.c fileB.c test.lib /link /NOE /INF
  20441.  
  20442.     You will have an EXE that calls A() from the library and B() from
  20443.     your modified fileB.c.
  20444.  
  20445.  5. Combine fileA.c and fileB.c into one file called TEST.C.
  20446.  
  20447.  6. Compile to object code.
  20448.  
  20449.  7. Delete the old TEST.LIB, and do the following:
  20450.  
  20451.        LIB TEST +test, test.lst
  20452.  
  20453.     (Normally you would change fileB.c, but this is not necessary here.)
  20454.  
  20455.        cl call.c fileB.c test.lib /link /NOE /INF
  20456.  
  20457.  You will receive the following error:
  20458.  
  20459.  TEST.LIB(test.c) : error L2025: _B : symbol defined more than once
  20460.   pos: 13E Record type: 53E8
  20461.  There was 1 error detected
  20462.  
  20463.  When you encounter this error, it is usually because the function you
  20464.  are trying to overwrite is part of a set appearing in one module.
  20465.  
  20466.  The library listing looks as follows in the first case:
  20467.  
  20468.  _A................fileA             _B................fileB
  20469.  
  20470.  fileA             Offset: 00000010H  Code and data size: 95H
  20471.    _A
  20472.  
  20473.  fileB             Offset: 000002a0H  Code and data size: 92H
  20474.    _B
  20475.  
  20476.  You will be able to replace A() or B(). The listing in the
  20477.  second example looks as follows:
  20478.  
  20479.  _A................test              _B................test
  20480.  
  20481.  test              Offset: 00000010H  Code and data size: deH
  20482.    _A                _B
  20483.  
  20484.  You will not be able to replace either A() or B() without removing the
  20485.  TEST module with the LIB utility. You may have to provide replacements
  20486.  for both functions and not just the one you want to change. For more
  20487.  information, query on the following words in this KnowledgeBase:
  20488.  
  20489.     L2029 unresolved externals
  20490.  
  20491.  
  20492.  28. Default for NODATA When Using the _export Keyword
  20493.  
  20494.  Product Version(s): 5.01.21 | 5.01.21
  20495.  Operating System:   MS-DOS  | OS/2
  20496.  Flags: ENDUSER | buglist5.10.21 buglist5.02 fixlist5.03
  20497.  Last Modified: 21-AUG-1989    ArticleIdent: Q47826
  20498.  
  20499.  Question:
  20500.  
  20501.  What is the default for NODATA when using the _export keyword? The
  20502.  _export keyword is used to mark functions in DLLs for export. It
  20503.  appears that for real-mode windows, for normal applications, _export
  20504.  does not use NODATA. However, for DLLs (also for real-mode windows)
  20505.  _export marks the function NODATA. How does the keyword _export mark
  20506.  functions (NODATA or not).
  20507.  
  20508.  Response:
  20509.  
  20510.  The default as issued by the compiler is not NODATA, i.e., the
  20511.  exported routine is assumed to use the shared data segment.
  20512.  Unfortunately, the linker has a problem that causes it to mistakenly
  20513.  assume NODATA for all exports declared from the .OBJ file.
  20514.  
  20515.  Microsoft has confirmed this to be a problem with LINK Version 5.01.21
  20516.  and 5.02. The problem was corrected in LINK Version 5.03 and later.
  20517.  
  20518.  In OS/2 this should not make any difference. In Windows, the program
  20519.  loader looks for the -Gw sequence in the prolog of the exported entry
  20520.  and replaces it with a sequence to load DS. The _loadds keyword will
  20521.  generate the load-DS sequence in the first place.
  20522.  
  20523.  In any case, a workaround is to not use the _export keyword and
  20524.  declare the routine in EXPORTS in the .DEF file.
  20525.  
  20526.  
  20527.  29. No Default Extension for a Linker Response File
  20528.  
  20529.  Product Version(s): 3.55 3.60 3.61 3.64 3.65  | 5.01.21 5.01.21
  20530.  Operating System:   MS-DOS                    | OS/2
  20531.  Flags: ENDUSER |
  20532.  Last Modified:  2-MAR-1989    ArticleIdent: Q41611
  20533.  
  20534.  The Microsoft Overlay Linker does not have a default extension for a
  20535.  response file; unlike Phoenix's PLINK, which uses a default .LNK
  20536.  extension.
  20537.  
  20538.  This information also applies to the Microsoft Segmented-Executable
  20539.  Linker.
  20540.  
  20541.  
  20542.  30. Ambiguous Switch /PAC with QuickC 2.00 Linker
  20543.  
  20544.  Product Version(s): 4.06
  20545.  Operating System:   MS-DOS
  20546.  Flags: ENDUSER | s_quickc b_quickbas docerr
  20547.  Last Modified: 22-JAN-1990    ArticleIdent: Q42027
  20548.  
  20549.  Using the /PAC switch with LINK Version 4.06 results in the
  20550.  following error:
  20551.  
  20552.     fatal error L1001: PAC : option name ambiguous
  20553.  
  20554.  This same option works correctly on Versions 3.65 and 5.01.21, and is
  20555.  documented as being a valid shorthand name for /PACKCODE on Page 131
  20556.  of the "QuickC Tool Kit."
  20557.  
  20558.  The problem is due to a conflict with an option that is not documented
  20559.  in the Tool Kit, but is displayed when LINK is invoked with /HELP. The
  20560.  option that causes the ambiguity is /PACKDATA, which causes data
  20561.  segments to be combined.
  20562.  
  20563.  The shortest version of /PACKCODE that can be used is /PACKC.
  20564.  Similarly, /PACKD is the shortest version of /PACKDATA that can be
  20565.  used.
  20566.  
  20567.  
  20568.  31. /CO before /DO Causes Problems in LINK
  20569.  
  20570.  Product Version(s): 3.65 4.06 5.01
  20571.  Operating System:   MS-DOS
  20572.  Flags: ENDUSER | h_masm s_pascal h_fortran buglist3.65 buglist5.01
  20573.  Last Modified: 28-MAR-1989    ArticleIdent: Q42212
  20574.  
  20575.  When compiling or assembling with the /Zi switch to include CodeView
  20576.  symbolic information and linking with /CO to preserve it, the
  20577.  placement of the /DO switch is crucial. If the /CO switch is specified
  20578.  before /DO, the following behavior may occur when running CodeView:
  20579.  
  20580.     Message                                Behavior
  20581.  
  20582.     Enter directory for  (cr for none)?    When CodeView is executed,
  20583.                                            no source code will appear.
  20584.  
  20585.     Unable to open file
  20586.  
  20587.     Internal debugger error: 13            When attempting to change
  20588.                                            from assembly view to source
  20589.                                            CodeView. Hanging of the
  20590.                                            machine when executing
  20591.                                            CodeView.
  20592.  
  20593.  If switching the order of the /CO and the /DO switches does not
  20594.  take care of the problem then you have to put the .DOSSEG into
  20595.  your MASM routines and not use the /DO switch.
  20596.  
  20597.  Microsoft has confirmed this to be a problem in Versions 3.65 and
  20598.  5.01. We are researching this problem and will post new information as
  20599.  it becomes available.
  20600.  
  20601.  While LINK Version 5.01 may be used in OS/2, the /DO switch has no
  20602.  meaning. Using it, however, causes the linker to GP fault if /CO
  20603.  precedes /DO.
  20604.  
  20605.  
  20606.  
  20607.  32. Unimplemented Switch /BI with QuickC 2.00 Linker
  20608.  
  20609.  Product Version(s): 4.06
  20610.  Operating System:   MS-DOS
  20611.  Flags: ENDUSER | S_QUICKC
  20612.  Last Modified: 24-JAN-1990    ArticleIdent: Q42849
  20613.  
  20614.  The /BINARY switch for Link Version 4.06 is documented on Page 122 of
  20615.  the "Microsoft QuickC Tool Kit" as a switch used to create .COM files
  20616.  for assembly-language programs. Its shorthand version is /BI. This
  20617.  switch is an alternative to creating .EXE files and then running them
  20618.  through EXE2BIN.
  20619.  
  20620.  This switch is currently not implemented, a fact documented in the
  20621.  README.DOC on line 665, "Creating a .COM file." Using it will result
  20622.  in the following error:
  20623.  
  20624.      fatal error L1002: BINARY : unrecognized option name
  20625.  
  20626.  
  20627.  33. How /NOE (No Extended Dictionary) Is Used by the Linker
  20628.  
  20629.  Product Version(s): 3.65 4.06 5.01 | 5.01
  20630.  Operating System:   MS-DOS         | OS/2
  20631.  Flags: ENDUSER | S_C H_FORTRAN S_QUICKC
  20632.  Last Modified:  6-APR-1989    ArticleIdent: Q43009
  20633.  
  20634.  This article contains information about the LINK option /NOE and how
  20635.  it relates to the three following topics:
  20636.  
  20637.  1. The Extended Dictionary and how LINK uses it
  20638.  
  20639.  2. The definition of genuine redefinition
  20640.  
  20641.  3. Why redefinitions are not detected in some situations
  20642.  
  20643.  The LINK option /NOE stands for No Extended Dictionary.
  20644.  
  20645.  What is the extended dictionary and how does LINK use it? How does
  20646.  LINK use the extended dictionary?
  20647.  
  20648.  LINK uses the extended dictionary to speed up library searching. For
  20649.  example, if the library module A calls functions in module B and
  20650.  module C, the extended dictionary tells LINK that, if your program
  20651.  requires module A from library, it will also require modules B and C.
  20652.  According to this information, LINK pulls in the three modules A, B,
  20653.  and C all at once. This way, LINK doesn't have to search the library a
  20654.  second time to resolve references from module A to modules B and C.
  20655.  
  20656.  What is a genuine redefinition?
  20657.  
  20658.  The ERRMSG.DOC file states that when linker error L2044 occurs, the
  20659.  /NOE switch should be used. When linker error L2025 occurs, the
  20660.  program has a genuine redefinition problem.
  20661.  
  20662.  A genuine redefinition is any redefinition that has nothing to do with
  20663.  the extended dictionary. A redefinition error that occurs when you
  20664.  specify the /NOE switch indicates a genuine redefinition, as in the
  20665.  following example:
  20666.  
  20667.      FOO.OBJ:
  20668.          defines "_foo"
  20669.          calls "_libfunc"
  20670.  
  20671.      Module A: (in XYZ.LIB):
  20672.          defines "_libfunc"
  20673.          defines "_foo"
  20674.  
  20675.  If you run "LINK foo /NOE,,,xyz.lib", the L2025 error will be produced
  20676.  because module A is pulled in and redefines the symbol "_foo".
  20677.  
  20678.  When LINK encounters the redefinition while processing a library
  20679.  module, it assumes that the error might go away if you were to add the
  20680.  /NOE switch. This would be true if the symbols were defined like this
  20681.  as follows:
  20682.  
  20683.      FOO.OBJ:
  20684.          defines "_foo"
  20685.          calls "_libfunc"
  20686.  
  20687.      Module A (in XYZ.LIB):
  20688.          defines "_libfunc"
  20689.          calls "_foo"
  20690.  
  20691.      Module B ( in XYZ.LIB ):
  20692.          defines "_foo"
  20693.  
  20694.  The extended dictionary tells LINK to link modules A and B, even
  20695.  though module B should not be linked because "_foo" is already
  20696.  defined. In this case, the /NOE switch will eliminate the error.
  20697.  
  20698.  LINK cannot figure out when the error is due to the extended
  20699.  dictionary and when it is not; therefore, it assumes that the extended
  20700.  dictionary will cause a redefinition error when processing a library
  20701.  module.
  20702.  
  20703.  Please note that redefinitions not detected in some situations. For
  20704.  example, when the function 'printf' is redefined in a program module
  20705.  and the module is linked with SLIBCER.LIB without using the /NOE
  20706.  switch, LINK does not complain about the redefinition at all. LINK
  20707.  does not detect a redefinition because the module that defines printf
  20708.  in the library is not pulled in; thus, there is no redefinition.
  20709.  
  20710.  If your program module redefines a library function that is also
  20711.  called by other library functions used by your program, you will get a
  20712.  redefinition error. The extended dictionary specifies which library
  20713.  modules call routines in other library modules. Consider a
  20714.  "second-level" function to be any library function called by a library
  20715.  function in another module. For example, spawnve and _setargv are
  20716.  second-level functions because they are called by other library
  20717.  functions; printf is not. You can get a redefinition error only if you
  20718.  redefine a second-level library function called by some first-level
  20719.  routine being linked into your program.
  20720.  
  20721.  
  20722.  34. Producing an _TEXT Segment for Multiple Object Modules
  20723.  
  20724.  Product Version(s): 3.x 4.06 | 5.01.20 5.01.21
  20725.  Operating System:   MS-DOS   | OS/2
  20726.  Flags: ENDUSER | S_C
  20727.  Last Modified:  6-APR-1989    ArticleIdent: Q43128
  20728.  
  20729.  In a map file, a <modulename>_TEXT will be produced for each logical
  20730.  code segment in your program. Since small and compact model programs
  20731.  have only one code segment, you only get one logical segment, _TEXT.
  20732.  Medium- and large-model programs, however, will have a separate
  20733.  logical segment for each object module in the program, and thus produce
  20734.  a <modulename>_TEXT for each logical segment.
  20735.  
  20736.  To generate a map file, use the /M option with LINK or the /Fm option
  20737.  with CL.
  20738.  
  20739.  The following is an example map file generated when compiling a
  20740.  program with two object modules in small-memory model:
  20741.  
  20742.   Start  Stop   Length Name                   Class
  20743.   00000H 016EAH 016EBH _TEXT                  CODE
  20744.   ...
  20745.  
  20746.  The following is an example map file generated when compiling the same
  20747.  program with two object modules in large-memory model:
  20748.  
  20749.   Start  Stop   Length Name                   Class
  20750.   00000H 0000DH 0000EH MAPL_TEXT              CODE
  20751.   0000EH 00023H 00016H MAP2_TEXT              CODE
  20752.   00024H 01B2CH 01B09H _TEXT                  CODE
  20753.   ...
  20754.  
  20755.  MAPL_TEXT and MAP2_TEXT come from the files MAPL.OBJ and MAP2.OBJ,
  20756.  respectively. The _TEXT is the Microsoft run-time library and any
  20757.  third-party libraries.
  20758.  
  20759.  
  20760.  
  20761.  35. LINK: Renaming Overlayed Executables Will Cause Problems
  20762.  
  20763.  Product Version(s): 5.01.21
  20764.  Operating System:   DOS
  20765.  Flags: ENDUSER | s_C s_Pascal h_FORTRAN
  20766.  Last Modified:  6-APR-1989    ArticleIdent: Q43139
  20767.  
  20768.  When the Microsoft linker creates an executable file with overlays,
  20769.  the name of that EXE is hard coded into the file for use by the overlay
  20770.  manager. The Microsoft linker only creates internal overlays, i.e.,
  20771.  rather than producing FOO.EXE, FOO1.OVL, and FOO2.OVL, the two
  20772.  overlays are contained in FOO.EXE.
  20773.  
  20774.  If the executable is renamed at any point after linking, the overlay
  20775.  manager will still use the hard-coded name found in the EXE to locate
  20776.  the overlays, and will fail with the following prompt:
  20777.  
  20778.     Cannot find <oldname>
  20779.     Please enter new program spec:
  20780.  
  20781.  In order to change the name of the executable without receiving this
  20782.  error, it must be relinked and given the new name at that time.
  20783.  
  20784.  
  20785.  36. LINK: Creating and Accessing _edata and _end
  20786.  
  20787.  Product Version(s): 3.X 4.06 | 5.01.20 5.01.21
  20788.  Operating System:   MS-DOS   | OS/2
  20789.  Flags: ENDUSER | s_c
  20790.  Last Modified:  6-APR-1989    ArticleIdent: Q43165
  20791.  
  20792.  LINK creates the two symbols _edata and _end when the LINK option
  20793.  /DOSSEG is used. If a program is compiled by a Microsoft high-level
  20794.  language compiler, or if an assembly program written in Microsoft MASM
  20795.  uses .DOSSEG directive, LINK uses this option automatically.
  20796.  
  20797.  LINK gives _edata the address of the beginning of BSS segment and
  20798.  gives _end the address of the end of BSS segment. Since the STACK
  20799.  segment is directly above the BSS segment, the address of _end also
  20800.  marks the lowest address of the STACK segment.
  20801.  
  20802.  To obtain the addresses for these two symbols, declare the following
  20803.  in your C program:
  20804.  
  20805.  unsigned char edata, end ;
  20806.  
  20807.  The addresses, &edata and &end, can now be used to locate _BSS and
  20808.  STACK. They can also be examined in CodeView. Modifying these two
  20809.  variables is not recommended.
  20810.  
  20811.  Note: The segment BSS referred to in this article actually includes
  20812.  the segment C_COMMON. However in a map file created by LINK, BSS and
  20813.  C_COMMON are listed as two separate segments.
  20814.  
  20815.  
  20816.  
  20817.  37. Linker Options /PADDATA and /PADCODE
  20818.  
  20819.  Product Version(s): 4.06
  20820.  Operating System:   MS-DOS
  20821.  Flags: ENDUSER | S_QuickC docerr
  20822.  Last Modified: 18-SEP-1989    ArticleIdent: Q44928
  20823.  
  20824.  Question:
  20825.  
  20826.  I ran the linker Version 4.06 that comes with the Microsoft QuickC
  20827.  Compiler Version 2.00 with the /help option as follows:
  20828.  
  20829.     LINK /HELP
  20830.  
  20831.  I noticed two switches for which I couldn't find documentation:
  20832.  /PADDATA and /PADCODE. What are these options for?
  20833.  
  20834.  Response:
  20835.  
  20836.  The /PADC[ODE]:padsize option causes LINK to add filler bytes to the
  20837.  end of each code module. The option is followed by a colon and the
  20838.  number of bytes to add. (Decimal radix is assumed, but you can specify
  20839.  special octal or hexadecimal numbers by using a C-language prefix.)
  20840.  Thus, the following adds an additional 256 bytes to each code module:
  20841.  
  20842.     /PADCODE:256
  20843.  
  20844.  The default size for code-module padding is 0 bytes.
  20845.  
  20846.  The /PADD[ATA]:padsize option performs a function similar to
  20847.  /PADCODE, except that it specifies padding for data segments (or data
  20848.  modules, if the program uses small or medium-memory models). Thus,
  20849.  the following adds an additional 32 bytes to each data module:
  20850.  
  20851.     /PADDATA:32
  20852.  
  20853.  The default size for data-segment padding is 16 bytes. Note that if
  20854.  you specify too large a value for padsize, you may exceed the 64K
  20855.  limitation on the size of the default data segment.
  20856.  
  20857.  These two options are quite useful when used in conjunction with
  20858.  QuickC Version 2.00's incremental linking option. Using them correctly
  20859.  increases the incremental linking speed of a program.
  20860.  
  20861.  These two options are documented on Page 64 in the update section of
  20862.  the Microsoft C Optimizing Compiler Version 5.10 "CodeView and
  20863.  Utilities, Microsoft Editor, Mixed-Language Programming Guide" manual.
  20864.  
  20865.  
  20866.  38. Linker Error L2013 May Be a Result of a Problem in MASM 5.10
  20867.  
  20868.  Product Version(s): 3.x 4.06 4.07 5.01.21 5.02 5.03 5.05
  20869.  Operating System:   MS-DOS
  20870.  Flags: ENDUSER | h_masm
  20871.  Last Modified: 27-DEC-1990    ArticleIdent: Q59894
  20872.  
  20873.  The error message for linker error L2013 is as follows:
  20874.  
  20875.     error L2013 LIDATA record too large
  20876.        pos: xxx Record type: 743C
  20877.  
  20878.  In the README.DOC file that comes with MASM version 5.10, Microsoft C
  20879.  version 5.10, and the "Microsoft FORTRAN CodeView and Utilities User's
  20880.  Guide" version 5.00 manual, the recommended course of action is to
  20881.  call Microsoft Product Support at (206) 637-7096.
  20882.  
  20883.  The error is a result of an invalid object module. This is a known
  20884.  problem in MASM 5.10. The most likely cause is a duplication of some
  20885.  large data item, such as a structure.
  20886.  
  20887.  The easiest workaround is to break up the duplication(s) into smaller
  20888.  parts.
  20889.  
  20890.  
  20891.  39. LINK 5.02 Should Not Be Used with ILINK 1.10
  20892.  
  20893.  Product Version(s): 5.02
  20894.  Operating System:   MS-DOS
  20895.  Flags: ENDUSER | S_QuickC
  20896.  Last Modified: 30-AUG-1989    ArticleIdent: Q45536
  20897.  
  20898.  LINK Version 5.02, which comes as a secondary linker for QuickC 2.00,
  20899.  should not be used with ILINK Version 1.10, which also comes with
  20900.  QuickC 2.00.
  20901.  
  20902.  Inside the QuickC environment, this combination has caused problems
  20903.  with floating point-values being printed with printf. Outside of the
  20904.  environment, the same executable results in math error M6104.
  20905.  
  20906.  The source code below prints "FP = 0.00000" instead of "FP =
  20907.  5.020000". Running from the DOS prompt, in this case, produces the
  20908.  same results.
  20909.  
  20910.  Source Code
  20911.  -----------
  20912.  
  20913.      #include <stdio.h>
  20914.  
  20915.      void main( void )
  20916.      {
  20917.          float fp = 5.02F;
  20918.  
  20919.          printf( "FP = %f\n", fp );
  20920.      }
  20921.  
  20922.  LINK Version 4.06 should be used if ILINK is also to be used. If it is
  20923.  necessary to use Version 5.02 of the linker, incremental linking
  20924.  should be disabled from within the environment.
  20925.  
  20926.  Microsoft is researching this problem and will post new information as
  20927.  it becomes available.
  20928.  
  20929.  
  20930.  40. Linker Errors L4013, L2048, and L4038: Overlaying in OS/2
  20931.  
  20932.  Product Version(s): 5.01.20 | 5.03
  20933.  Operating System:   MS-DOS  | OS/2
  20934.  Flags: ENDUSER | S_C H_Fortran
  20935.  Last Modified: 21-JUN-1989    ArticleIdent: Q45619
  20936.  
  20937.  The linker does not overlay files when linking with protected mode
  20938.  run-time libraries. If told to overlay a program that is being linked
  20939.  with a protected mode run-time library, the linker responds with one
  20940.  or more of the following errors:
  20941.  
  20942.     LINK : warning L4013: invalid option for new-format executable file
  20943.     ignored
  20944.     LINK : error L2048: Microsoft Overlay Manager module not found
  20945.     LINK : warning L4038: program has no starting address
  20946.  
  20947.  possibly followed by (in DOS):
  20948.  
  20949.     run-time error R6001
  20950.     - null pointer assignment
  20951.  
  20952.  or possibly followed by (in OS/2):
  20953.  
  20954.     A general protection (GP) fault. It may also go into an infinite
  20955.     loop after creating the temporary file (for large executables).
  20956.  
  20957.  The workaround is to create two versions of the executable, an
  20958.  overlayed DOS version and a non-overlayed OS/2 version.
  20959.  
  20960.  Microsoft is researching this problem and will post new information as
  20961.  it becomes available.
  20962.  
  20963.  
  20964.  41. Link Error L1005: /PACKCODE: Packing Limit Exceeds 65,536
  20965.  
  20966.  Product Version(s): 3.65
  20967.  Operating System:   MS-DOS
  20968.  Flags: ENDUSER | docerr
  20969.  Last Modified: 21-JUN-1989    ArticleIdent: Q45724
  20970.  
  20971.  The Microsoft Overlay Linker Version 3.65 presents the following error
  20972.  message when the /PACKCODE: switch is used with a value greater than
  20973.  65,536 (64K):
  20974.  
  20975.     Link Fatal Error L1005:
  20976.  
  20977.  No error message text is supplied, and the error cannot be referenced
  20978.  in the Microsoft C 5.10 "CodeView and Utilities, Microsoft Editor,
  20979.  Mixed-Language Programming Guide." The error message should read as
  20980.  follows:
  20981.  
  20982.     Link Fatal Error L1005: /PACKCODE: Packing Limit Exceeds 65,536
  20983.  
  20984.  The error is reported correctly by the Microsoft QuickC Linker Version
  20985.  4.06 and all 5.0x versions of the Microsoft Segmented-Executable
  20986.  Linker. It is correctly documented in the Version 2.00 "Microsoft
  20987.  QuickC Tool Kit," on Page 278, and on Page 373 of the Version 5.00
  20988.  "Microsoft FORTRAN, Microsoft CodeView and Utilities User's Guide"
  20989.  manual, as follows:
  20990.  
  20991.     The value supplied with the /PACKCODE option exceeds the limit of
  20992.     65,536 bytes.
  20993.  
  20994.  
  20995.  42. What the /HIGH and /DS Linker Options Do
  20996.  
  20997.  Product Version(s): 3.65
  20998.  Operating System:   MS-DOS
  20999.  Flags: ENDUSER | SR# G890607-19979
  21000.  Last Modified: 13-JUL-1989    ArticleIdent: Q46745
  21001.  
  21002.  Question:
  21003.  
  21004.  I would like information on the /HIGH and /DS options of the linker.
  21005.  Specifically, what changes are needed in the .EXE file to tell the
  21006.  loader to put it high?
  21007.  
  21008.  Response:
  21009.  
  21010.  Basically, these are hold-over features from DOS Version 1.00 and from
  21011.  the original Microsoft/IBM Pascal and FORTRAN Compilers -- they're of
  21012.  little or no use under DOS 2.00 and later. Specifically, programs
  21013.  linked with the /HIGH switch are allocated all of the memory in the
  21014.  machine and cannot release unneeded memory back to DOS; therefore, no
  21015.  other program can be loaded into memory.
  21016.  
  21017.  The /HIGH switch sets both the minalloc and maxalloc fields in the .EXE
  21018.  header to zero. This combination of values causes the loader to load
  21019.  the program in high memory.
  21020.  
  21021.  /DSALLOCATE (or /DS) causes DGROUP to be "shifted" upwards so that the
  21022.  high address in the group is always FFFFh. Offsets into DGROUP are
  21023.  adjusted appropriately.
  21024.  
  21025.  These switches are strictly incompatible with our current high-level
  21026.  languages -- the only possible use for them is in a MASM program.
  21027.  Microsoft doesn't recommend using them at all unless you know
  21028.  precisely what you're doing.
  21029.  
  21030.  There is good documentation on what the /HIGH and /DSALLOCATE switches
  21031.  do, as well as how the loader works, in the "MS-DOS Encyclopedia,"
  21032.  starting on Page 719. (This excellent reference manual is now less
  21033.  expensive and available in paperback).
  21034.  
  21035.  
  21036.  43. How Minimum Load Size Is Calculated
  21037.  
  21038.  Product Version(s): 3.65
  21039.  Operating System:   MS-DOS
  21040.  Flags: ENDUSER | SR# G890607-19979
  21041.  Last Modified: 13-JUL-1989    ArticleIdent: Q46774
  21042.  
  21043.  The MS-DOS program loader uses the following formula to calculate the
  21044.  number of 16-byte paragraphs to use when loading a program:
  21045.  
  21046.     TotPages * 20h - NumHeader + 10h + MaxAlloc
  21047.  
  21048.  The formula calculates the number of 16-byte paragraphs, unless
  21049.  there's not enough memory, in which case all the available memory is
  21050.  used. If there are not at least
  21051.  
  21052.     TotPages * 20h - NumHeader + 10h + MinAlloc
  21053.  
  21054.  paragraphs available, DOS cannot and will not load the program.
  21055.  
  21056.  The 20h is the size of a page in paragraphs, which is the size of a
  21057.  page (512 bytes) divided by the size of a paragraph (16 bytes).
  21058.  
  21059.  The 10h is the size in paragraphs of the 256-byte Program Segment
  21060.  Prefix that precedes all programs in memory.
  21061.  
  21062.  All of the values used in the formulae shown above are words (shown in
  21063.  the following) that are stored in standard Intel low-byte-first format
  21064.  in the .EXE file header:
  21065.  
  21066.     Value           Name used by EXEHDR             Offset in .EXE header
  21067.     -----           -------------------             ---------------------
  21068.  
  21069.     TotPages        Pages in file                   4 - 5
  21070.     NumHeader       Paragraphs in header            8 - 9
  21071.     MinAlloc        Extra paragraphs needed         0Ah - 0Bh
  21072.     MaxAlloc        Extra paragraphs wanted         0Ch - 0Dh
  21073.  
  21074.  For more information, refer to a good MS-DOS reference such as the
  21075.  "MS-DOS Encyclopedia."
  21076.  
  21077.  
  21078.  44. L1074 Name: Group Larger Than 64K Bytes
  21079.  
  21080.  Product Version(s): 4.06
  21081.  Operating System:   MS-DOS
  21082.  Flags: ENDUSER | S_C S_QuickC
  21083.  Last Modified: 24-JUL-1989    ArticleIdent: Q46996
  21084.  
  21085.  The Microsoft QuickC Compiler Version 2.00 returns the following
  21086.  linker error message when the size of DGROUP (the default data
  21087.  segment) exceeds 64K:
  21088.  
  21089.     L1074 name: group larger than 64K bytes
  21090.  
  21091.  This error is documented on Page 282 of the "Microsoft QuickC Tool
  21092.  Kit" manual as follows:
  21093.  
  21094.     The given group exceeds the limit of 65,536 bytes.
  21095.  
  21096.     Reduce the size of the group, or remove any unneeded segments from
  21097.     the group (refer to the map file for a listing of segments).
  21098.  
  21099.  There are four ways to resolve this data segment overflow when using
  21100.  QuickC:
  21101.  
  21102.  1. Reduce the stack size in order to reduce the size of DGROUP. In the
  21103.     environment this can be done in the Options.Make.Linker Flags menu.
  21104.     Outside the environment this can be done at compile time with the
  21105.     "/F hexnum" switch, where hexnum is the size of the requested stack
  21106.     in hexadecimal format. Outside the environment, at link time, this
  21107.     can be done with the "/ST:decnum" switch, where decnum is the size
  21108.     of the requested stack in decimal format.
  21109.  
  21110.  2. Declare data with the FAR keyword to move it out of DGROUP.
  21111.  
  21112.     Note: In the small and medium memory models the Microsoft run-time
  21113.     library functions can no longer be used with this data. You must
  21114.     copy this far to a near heap location, before you use the run-time
  21115.     routines on this data.
  21116.  
  21117.  3. Outside the environment, compile in the compact, large, or huge
  21118.     memory models with the "/GtX" switch, where X is a data threshold.
  21119.     All data items larger than X bytes are moved out of DGROUP into a
  21120.     far data segment.
  21121.  
  21122.  4. Reduce the amount of data declared in the program. In the compact,
  21123.     large, and huge memory models, try dynamically allocating space for
  21124.     the data. Memory can also be dynamically allocated outside DGROUP
  21125.     in the small and medium memory models by using _fmalloc() but, as
  21126.     stated in Number 2, the run-time library functions do not work with
  21127.     this data.
  21128.  
  21129.     Reduce the amount of string literals in this default data segment by
  21130.     reading from a data file at run time, or in C 5.00, by using the
  21131.     /Gt patch to allow string literals to be moved from the _CONST
  21132.     segment in DGROUP into a far segment.
  21133.  
  21134.  
  21135.  45. /CP:X Is Not Valid When Linking Protected-Mode Programs
  21136.  
  21137.  Product Version(s): 5.01.21 | 5.01.21
  21138.  Operating System:   MS-DOS  | OS/2
  21139.  Flags: ENDUSER | docerr
  21140.  Last Modified: 26-JUL-1989    ArticleIdent: Q47036
  21141.  
  21142.  Question:
  21143.  
  21144.  I cannot seem to get the /CPARMAXALLOC linker option to work when I
  21145.  link for OS/2 protected mode. When linking a real-mode application, it
  21146.  works correctly. Also, when I type "link /help" in protected mode, the
  21147.  output indicates that this is a valid option. However, when I try to
  21148.  use this option for a protected-mode application, the linker produces
  21149.  the following warning:
  21150.  
  21151.     LINK : warning L4013: invalid option for new-format executable file
  21152.                           ignored
  21153.  
  21154.  What am I doing wrong and what does this error message mean?
  21155.  
  21156.  Response:
  21157.  
  21158.  As documented on Page 27 in the update section of the Microsoft C
  21159.  Optimizing Compiler Version 5.10 "CodeView and Utilities, Microsoft
  21160.  Editor, Mixed-Language Programming Guide" manual, the /CPARMAXALLOC
  21161.  option is for real-mode applications only. The "link /help" indicates
  21162.  that this is a valid option because this option IS valid whenever
  21163.  you're linking real-mode applications, regardless of whether the
  21164.  linker is running under OS/2 or DOS. (By the same token, it is invalid
  21165.  when you're linking a protected-mode application, regardless of which
  21166.  operating system you're using.)
  21167.  
  21168.  This error message was omitted from the documentation. It indicates
  21169.  that one of the options that the linker was passed is invalid.
  21170.  
  21171.  This option is not supported in a protected-mode application because
  21172.  the functionality of it is done automatically by the linker.
  21173.  Protected-mode applications are not given a 64K default data segment;
  21174.  they are only allocated the space that they need. This is documented
  21175.  on Page 33 of the same section and manual listed above.
  21176.  
  21177.  
  21178.  46. Cannot Use Overlays in a Bound Application
  21179.  
  21180.  Product Version(s): 5.01.21 5.03 | 5.01.21 5.03
  21181.  Operating System:   MS-DOS       | OS/2
  21182.  Flags: ENDUSER |
  21183.  Last Modified: 30-AUG-1989    ArticleIdent: Q47104
  21184.  
  21185.  Question:
  21186.  
  21187.  How can I incorporate overlays into my bound application?
  21188.  
  21189.  Response:
  21190.  
  21191.  You cannot use overlays in a bound application. To bind an
  21192.  application, you must first have a runnable OS/2 executable; then, you
  21193.  use the BIND utility to make it run in both OS/2 and DOS. OS/2
  21194.  executables do not understand overlays so you cannot incorporate them
  21195.  into an OS/2 executable. Hence, you cannot use overlays in a bound
  21196.  program.
  21197.  
  21198.  
  21199.  47. Linker Error L1063 and Linking Over 1000 Object Modules
  21200.  
  21201.  Product Version(s): 5.01.21 5.03
  21202.  Operating System:   OS/2
  21203.  Flags: ENDUSER | S_C S_CodeView
  21204.  Last Modified: 16-AUG-1989    ArticleIdent: Q47931
  21205.  
  21206.  Question:
  21207.  
  21208.  When attempting to link a large OS/2 application consisting of over
  21209.  1500 object modules with C 5.10's Link 5.01.21 or FORTRAN 5.00's Link
  21210.  5.03 by using the options /co /map:2078 /noe /se:2078 /packcode, I get
  21211.  the link error "L1063 out of memory for CodeView information." Only
  21212.  one of the .C source files was compiled with /Zi. All were compiled
  21213.  with /AL. Linking without /co (CodeView information) successfully
  21214.  produces a 700K executable file (.EXE), but I need to do some
  21215.  debugging with CVP.
  21216.  
  21217.  What is the L1063 error, and how can I work around it?
  21218.  
  21219.  Response:
  21220.  
  21221.  Information on L1063 is not in the C 5.10 text files or documentation,
  21222.  but it is in Pascal 4.00's README.DOC and in FORTRAN 4.10's
  21223.  CVREADME.DOC as noted in another article in this knowledge base. The
  21224.  following reiterates the error message and its description:
  21225.  
  21226.     L1063 out of memory for CodeView information
  21227.  
  21228.     The linker was given too many object files with debug information,
  21229.     and the linker ran out of space to store it. Reduce the number of
  21230.     object files that have debug information.
  21231.  
  21232.  In this case, it is not the number of modules with CodeView
  21233.  information that is causing the problems exactly; it is the great
  21234.  number of modules and trying to link in any CodeView information.
  21235.  
  21236.  The following are ways to workaround this linker limitation:
  21237.  
  21238.  1. The most effective method is to demodularize your application. That
  21239.     is, put more functions into fewer .C source files.
  21240.  2. Reduce the linker option /se: value to as low as possible for the
  21241.     number of logical segments in the application.
  21242.  3. Link the object files from the current working directory. If you
  21243.     must use different directories for your .OBJs, make the pathnames
  21244.     as short as possible.
  21245.  
  21246.  
  21247.  48. Description of a Linker .MAP File
  21248.  
  21249.  Product Version(s): 3.60 3.61 3.64 3.65 5.01.20 5.01.21 5.03  | 5.01.20 5.01.
  21250.  Operating System:   MS-DOS                                    | OS/2
  21251.  Flags: ENDUSER | S_C S_PasCal H_FORTRAN
  21252.  Last Modified: 19-SEP-1989    ArticleIdent: Q47960
  21253.  
  21254.  A .MAP file generated by the linker is a listing of the addresses and
  21255.  names of a program, as follows:
  21256.  
  21257.     Logical Segments
  21258.     Groups (defined collections of logical segments)
  21259.     Public Symbols listed by name
  21260.     Public Symbols listed again by their relative address
  21261.     Entry Point address (first executable instruction)
  21262.  
  21263.  A linker .MAP file (with a .MAP file extension) contains the address,
  21264.  size, name, and class of logical code and data segments. (One or more
  21265.  logical segments of either code or data can be combined into a
  21266.  physical segment of either code or data, respectively, by the linker.)
  21267.  
  21268.  In DOS or real-mode OS/2, the addresses are 20-bit hex addresses that
  21269.  are RELATIVE to the beginning of the program's load image. In
  21270.  protected-mode OS/2, the hex addresses are in 32-bit segment
  21271.  selector:offset notation (16 bits for the segment selector and 16 bits
  21272.  for the offset) starting with segment selector 1.
  21273.  
  21274.  The _TEXT segment names of class CODE are the code in your object
  21275.  files. The various forms of near logical data segments are described
  21276.  in the DGROUP diagram, which you probably already have. (Briefly,
  21277.  _DATA is initialized near global data, _BSS is uninitialized near
  21278.  "static" data, C_COMMON is uninitialized near data, and CONST is for
  21279.  floating point constants. FAR_DATA and HUGE_DATA are global
  21280.  initialized far and huge data, respectively, and FAR_BSS is global
  21281.  unitialized far or huge data.)
  21282.  
  21283.  Next in the .MAP is the ORIGIN (address) and name of the defined
  21284.  groups of logical segments, notably DGROUP, which is used in our
  21285.  high-level languages for grouping many logical data segments into the
  21286.  "default" physical data segment. The name "default" data segment
  21287.  refers to the fact the the DS register will point to this segment by
  21288.  default so that offset (near) addressing can be used without loading
  21289.  the DS register. Groups allow multiple logical segments to be
  21290.  associated with the same starting address, so near (non-far) data in
  21291.  Microsoft high-level languages is addressed relative to DGROUP.
  21292.  
  21293.  Following the segment descriptions, under the heading of "Publics by
  21294.  Name", the names of Public symbols (i.e., global or extern functions,
  21295.  including numerous internal C library functions, and variables) are
  21296.  listed in ASCII order (capital letters first, then lowercase letters,
  21297.  and finally underscores) along with their hex relative segment:offset
  21298.  addresses (or segment selector:offset in protected-mode OS/2). Public
  21299.  symbols are then listed again, in order of their relative
  21300.  segment:offset addresses under the heading "Publics by Value".
  21301.  
  21302.  Only Public (e.g. global) symbols such as function and variable names
  21303.  appear in the .MAP. No "static" functions or data, "auto" storage
  21304.  class data (e.g. local function data), or data types are listed in the
  21305.  .MAP.
  21306.  
  21307.  A high-level language such as C creates many logical segments in
  21308.  DGROUP for "internal" (e.g. undocumented) purposes, calls numerous
  21309.  internal library functions, and refers to variables for the main
  21310.  program initialization and start-up code. C refers to additional
  21311.  initialization functions and variables for the library functions that
  21312.  your program explicitly calls, still more for floating point
  21313.  functions, as well as termination functions.
  21314.  
  21315.  To get an idea of the functions automatically linked in from the C
  21316.  library, generate and compare .MAP files for simple source modules
  21317.  such as foo(){} or main(){}, main(){puts("hi");}, and a small program
  21318.  that performs floating point arithmetic or calls a C library floating
  21319.  point math function that calls "fp..." routines.
  21320.  
  21321.  The "Program entry point" is the last item in the .MAP file. It refers
  21322.  to the segment:offset address of the first instruction of the program
  21323.  to be executed, relative to the lowest memory address in the .EXE load
  21324.  image.
  21325.  
  21326.  For more information on the entry point, please use the following
  21327.  query:
  21328.  
  21329.     .map file's program entry point
  21330.  
  21331.  
  21332.  49. Linker Can Indiscriminately Bind Different Types
  21333.  
  21334.  Product Version(s): 1.x 2.x 3.x 4.x 5.01 5.02 5.03 | 5.01
  21335.  Operating System:   MS-DOS                         | OS/2
  21336.  Flags: ENDUSER | S_C S_QuickC S_QuickASM S_Pascal S_QuickPas
  21337.  Last Modified:  2-AUG-1990    ArticleIdent: Q48204
  21338.  
  21339.  The object module format used by the Microsoft languages contains a
  21340.  record type that is used to bind symbol definitions to symbol
  21341.  references in other modules. This record is known as a "fixup." As
  21342.  defined by Intel, the fixup record type contains no information as to
  21343.  the type of data that is to be fixed up. Under certain circumstances,
  21344.  this can cause unexpected and undesired binding at link time. The code
  21345.  below demonstrates such an instance:
  21346.  
  21347.      /*----- FILE1.C -----*/
  21348.  
  21349.      void bar( void );
  21350.  
  21351.      void main( void )
  21352.      {
  21353.          bar();
  21354.      }
  21355.  
  21356.      /*----- FILE2.C -----*/
  21357.  
  21358.      int bar;
  21359.  
  21360.  These files both compile without error. When compiled for a model with
  21361.  a single code segment, linker error L2003 is produced saying that an
  21362.  intersegment self-relative fixup was attempted. If a multiple code
  21363.  segment model is used, no link errors are produced. Although a clean
  21364.  link can be obtained, the resultant EXE does not perform as expected
  21365.  due to the fact that the function reference of bar in FILE1.C has been
  21366.  bound to the integer definition of bar in FILE2.C.
  21367.  
  21368.  The linker has no way of determining the types of the reference to,
  21369.  and definition of, bar. This is a limitation of the object file
  21370.  format. If an include file was used to prototype bar and was then
  21371.  included in both files, the compiler could have detected the
  21372.  redefinition of bar.
  21373.  
  21374.  This information applies to all 1.x, 2.x, and 3.x versions of LINK
  21375.  including 3.60, 3.61, 3.64, and 3.65, as well as LINK Versions 4.06,
  21376.  4.07, 5.01, 5.02, and 5.03.
  21377.  
  21378.  
  21379.  50. Novell Network Software May Cause L1084 Error
  21380.  
  21381.  Product Version(s): 5.03
  21382.  Operating System:   MS-DOS
  21383.  Flags: ENDUSER | h_fortran h_masm s_c s_pascal
  21384.  Last Modified: 23-JAN-1990    ArticleIdent: Q57304
  21385.  
  21386.  The resident software used to access a Novell network may cause the
  21387.  following error when linking large programs:
  21388.  
  21389.     L1084:  Cannot create temporary file
  21390.  
  21391.  This problem was observed with Netware versions 2.10 SFT and 2.15 of
  21392.  the Novell network software.
  21393.  
  21394.  
  21395.  51. Relationship between Map File Addresses and Location in Memory
  21396.  
  21397.  Product Version(s): 3.61 3.65
  21398.  Operating System:   MS-DOS
  21399.  Flags: ENDUSER |
  21400.  Last Modified: 19-SEP-1989    ArticleIdent: Q48241
  21401.  
  21402.  In situations where memory is very short or where CodeView interacts
  21403.  with your program, it is sometimes necessary to use the DEBUG.COM
  21404.  program supplied with DOS.
  21405.  
  21406.  Using DEBUG is more difficult than using SYMDEB or CodeView because
  21407.  DEBUG has no symbolic features. You must use the map produced by the
  21408.  /M option when you link with a standard DOS overlay linker (i.e., not
  21409.  a segmented executable linker) to locate specific parts of your
  21410.  program.
  21411.  
  21412.  However, since DOS relocates programs when it loads them, the
  21413.  addresses given in the map need conversion before you can use them.
  21414.  
  21415.  This conversion is simple: DOS adds the address of the start segment
  21416.  (defined below) to each segment address in the load map. The offsets
  21417.  never change from the values shown in the link map -- only the
  21418.  segments change.
  21419.  
  21420.  The start segment is the base address of the Program Segment Prefix
  21421.  (PSP) plus the size of the PSP in paragraphs. Since the PSP is always
  21422.  100h (256) bytes long, the size of the PSP is 10h paragraphs.
  21423.  
  21424.  Note: DOS puts the base segment address of the PSP in DS and in ES
  21425.  when a program begins execution.
  21426.  
  21427.  For example, assume that the link map says that the function _funct is
  21428.  at 0004:05A0 (all values in hex) and that the global variable _errno
  21429.  is at 0192:00E3. Suppose further that when the program is loaded into
  21430.  DEBUG, the DS and ES registers contain 2BA5 -- the segment address of
  21431.  the PSP. (Use the R command to display the values of the registers.)
  21432.  
  21433.  The start segment for loading the program will be 2BB5 -- the value of
  21434.  the PSP base address (2BA5) + 10h to allow for the 10h paragraph
  21435.  length of the PSP (100h bytes).
  21436.  
  21437.  Thus, the function _funct will be located as follows:
  21438.  
  21439.     0004:05A0   -- address of _funct in the link map
  21440.     2BB5        -- start segment address (PSP + 10h)
  21441.     ---------
  21442.     2BB9:05A0
  21443.  
  21444.  And _errno will be located as follows:
  21445.  
  21446.     0192:00E3   -- address of _funct in the link map
  21447.     2BB5        -- start segment address (PSP + 10h)
  21448.     ---------
  21449.     2D47:00E3
  21450.  
  21451.  Use this calculation on any address in the link map to find where the
  21452.  symbol is located in memory when actually loaded.
  21453.  
  21454.  The H (Hex Arithmetic) command in DEBUG can be helpful when performing
  21455.  these calculations, as can a hex calculator with constant feature.
  21456.  
  21457.  
  21458.  52. Warning L4014: /PACKDATA: Option Ignored for Real Mode
  21459.  
  21460.  Product Version(s): 4.06 4.07 5.02 5.03 | 5.02 5.03
  21461.  Operating System:   MS-DOS              | OS/2
  21462.  Flags: ENDUSER |
  21463.  Last Modified: 21-SEP-1989    ArticleIdent: Q48839
  21464.  
  21465.  /PACKDATA is incorrectly listed as an available switch for LINK
  21466.  Versions 4.06 and 4.07. LINK Version 4.06 comes with the QuickC
  21467.  compiler, and LINK Version 4.07 comes with the QuickAssembler.
  21468.  
  21469.  The /PACKDATA option is valid ONLY for segmented-executable files --
  21470.  OS/2 or Windows; it has no meaning for DOS. Real mode executable means
  21471.  a DOS-only program. To use the /PACKDATA switch, create a .DEF file
  21472.  with at least the following statement:
  21473.  
  21474.     NAME    MyProtectModeProgram
  21475.  
  21476.  This switch is implemented in segmented-executable LINK Versions 5.02
  21477.  and later.
  21478.  
  21479.  
  21480.  53. /NOI Switch May Cause L2022 and L2029 in PM Programs
  21481.  
  21482.  Product Version(s): 5.10   | 5.10
  21483.  Operating System:   MS-DOS | OS/2
  21484.  Flags: ENDUSER |
  21485.  Last Modified: 27-OCT-1989    ArticleIdent: Q49008
  21486.  
  21487.  I am compiling and linking a Presentation Manager (PM) program from
  21488.  Charles Petzold's "Programming the OS/2 Presentation Manager" and I
  21489.  get the following link errors:
  21490.  
  21491.     LINK : error L2022: ClientWndProc (alias ClientWndProc) : export
  21492.            undefined
  21493.  
  21494.          : error L2029 : 'ClientWndProc' : unresolved external
  21495.  
  21496.  I get the same errors when compiling WELCOME1.C from the companion
  21497.  disk to "Programming the OS/2 Presentation Manager."
  21498.  
  21499.  The /NOI switch instructs the linker to preserve case. If you are
  21500.  using the /NOI switch, the linker will generate these errors because
  21501.  EXPENTRY (the export entry point) is defined in OS2DEF.H as follows:
  21502.  
  21503.     #define EXPENTRY far pascal
  21504.  
  21505.  The "pascal" keyword instructs the compiler to use the left-to-right
  21506.  calling sequence for the functions that it modifies. The keyword also
  21507.  causes the conversion of the function's name to uppercase letters.
  21508.  
  21509.  All window procedures are defined as EXPENTRY. Thus, the name of your
  21510.  window procedure is converted to uppercase letters. In your .DEF, you
  21511.  export your window procedures as follows:
  21512.  
  21513.     EXPORTS         ClientWndProc
  21514.  
  21515.  Because of the /NOI switch, the linker does not view ClientWndProc and
  21516.  CLIENTWNDPROC as being equal. Consequently, you get the first error
  21517.  message "export undefined."
  21518.  
  21519.  The second error message is generated because ClientWndProc (mixed
  21520.  uppercase and lowercase letters) is not recognized as being defined,
  21521.  so the linker considers it an "unresolved external."
  21522.  
  21523.  Removing the /NOI switch from your link line corrects both errors.
  21524.  
  21525.  
  21526.  54. LINK 5.03 and Later Require EXETYPE WINDOWS in .DEF File
  21527.  
  21528.  Product Version(s): 5.03
  21529.  Operating System:   MS-DOS
  21530.  Flags: ENDUSER |
  21531.  Last Modified: 17-JUL-1990    ArticleIdent: Q49445
  21532.  
  21533.  Microsoft LINK (LINK.EXE) versions 5.03 and later require that the
  21534.  WINDOWS descriptor be placed in the EXETYPE section of your project's
  21535.  .DEF (definitions) file if you are developing a Windows' application.
  21536.  
  21537.  This marks a change from previous linkers' behavior, which would allow
  21538.  the programmer to fail in specifying the type of executable to be
  21539.  created, but still produce a Windows-compatible .EXE file. This
  21540.  failure is no longer acceptable to LINK Versions 5.03 and later.
  21541.  
  21542.  If you fail to inform the linker (via the .DEF file) that you are
  21543.  creating a Windows executable, the linker reaches completion but the
  21544.  resulting .EXE does not execute.
  21545.  
  21546.  To specify the executable type, you must create a .DEF file and submit
  21547.  this to the linker at link time. For example, if you had a project
  21548.  called WINTEST.C, you must modify WINTEST.DEF so that it contains the
  21549.  following line:
  21550.  
  21551.     EXETYPE   WINDOWS
  21552.  
  21553.  The default EXETYPE is OS/2, as stated in the "Microsoft FORTRAN,
  21554.  CodeView and Utilities User's Guide" packaged with FORTRAN Version
  21555.  5.00.
  21556.  
  21557.  For further information regarding the definitions file and other
  21558.  descriptors, consult Section 7, "Using Module-Definition Files," in
  21559.  the "CodeView and Utilities, Microsoft Editor, Mixed Language
  21560.  Programming Guide" (Update Section) for C 5.10.
  21561.  
  21562.  LINK Version 5.03 is shipped with the FORTRAN version 5.00 package.
  21563.  
  21564.  
  21565.  55. Long TMP Environment Variable Causes L1089
  21566.  
  21567.  Product Version(s): 5.03   | 5.03
  21568.  Operating System:   MS-DOS | OS/2
  21569.  Flags: ENDUSER | h_fortran
  21570.  Last Modified:  6-DEC-1989    ArticleIdent: Q48869
  21571.  
  21572.  L1089 occurs when the LINK Utility Version 5.03 is called from FORTRAN
  21573.  Version 5.00 and the TMP environment variable is set to a long
  21574.  pathname.
  21575.  
  21576.  Normal troubleshooting indicates that the TMP variable is corrupt, but
  21577.  this is not the case. It seems that the temporary filename is being
  21578.  truncated.
  21579.  
  21580.  The following sequence produces the error if the subdirectory
  21581.  D:\COMPILER\FORTRAN5\TMP\ already exists:
  21582.  
  21583.  SET TMP=d:\compiler\fortran5\tmp
  21584.  fl sieve.for
  21585.  
  21586.  LINK : fatal error L1089: D:\COMPILER\FORTRAN5\TMP\000054l
  21587.  : cannot open response file
  21588.  
  21589.  This problem occurs in FORTRAN 5.00 and Link 5.03.
  21590.  
  21591.  
  21592.  56. L2041: Stack Plus Data Exceeds 64K -- Documentation Supplement
  21593.  
  21594.  Product Version(s): 3.65 4.06 | 5.01.21
  21595.  Operating System:   MS-DOS    | OS/2
  21596.  Flags: ENDUSER  | s_pascal h_fortran h_masm s_c s_quickc s_quickasm s_error d
  21597.  Last Modified: 30-NOV-1989    ArticleIdent: Q50130
  21598.  
  21599.  The following indicates that there is more than 64K of stack and data
  21600.  to be put into the 64K DGROUP (default data segment):
  21601.  
  21602.     L2041    stack plus data exceeds 64K
  21603.  
  21604.              The combined size of the program stack segment plus DGROUP
  21605.              was greater than 64K; as a result, the program will not
  21606.              load up correctly.
  21607.  
  21608.  To correct this problem, do the following:
  21609.  
  21610.  1. If the file(s) was compiled with C 5.00, a large amount of string
  21611.     literal data in the program may cause this error. Unlike C 5.10,
  21612.     5.00 cannot move string literals out of DGROUP with the /Gt option.
  21613.     This problem can be corrected with the "C 5.00 /Gt Fix" application
  21614.     note, which is available from Microsoft Product Support Services by
  21615.     calling (206) 454-2030.
  21616.  
  21617.  2. Reduce the stack size.
  21618.  
  21619.  3. Use a large data model (compact, large, or huge). Try applying the
  21620.     /Gt compilation option to lower the threshold.
  21621.  
  21622.  4. Use the FAR keyword to move data out of DGROUP.
  21623.  
  21624.  This error is documented in "Linker Error Messages" in the "Microsoft
  21625.  QuickC Compiler for IBM Personal Computers and Compatibles
  21626.  Programmer's Guide," Section D.4, Page 374. It is also in the file
  21627.  ERRMSG.DOC on Compiler Disk 1 for Microsoft C Version 5.10, on the
  21628.  Setup disk for Microsoft C Version 5.00, in the file README.DOC on
  21629.  Disk 1 for Microsoft Macro Assembler Version 5.10, and in the file
  21630.  CVREADME.DOC on the CodeView for MS-DOS disk for Microsoft FORTRAN
  21631.  Version 4.10. It is not found in the "CodeView and Utilities,
  21632.  Microsoft Editor, Mixed-Language Programming Guide" manual.
  21633.  
  21634.  Nonfatal errors indicate problems in the executable file. LINK
  21635.  produces the executable file. Nonfatal error messages have the
  21636.  following format:
  21637.  
  21638.     location : error L2xxx: messagetext
  21639.  
  21640.  In these messages, location is the input file associated with the
  21641.  error, or LINK if there is no input file. If the input file is an .OBJ
  21642.  or .LIB file and has a module name, the module name is enclosed in
  21643.  parentheses.
  21644.  
  21645.  Additional reference words: appnote
  21646.  
  21647.  
  21648.  57. Link Error L2028 Caused by HEAPSIZE, STACKSIZE and DGROUP Size
  21649.  
  21650.  Product Version(s): 5.01.21 | 5.01.21
  21651.  Operating System:   MS-DOS  | OS/2
  21652.  Flags: ENDUSER | docerr
  21653.  Last Modified: 17-JUL-1990    ArticleIdent: Q49935
  21654.  
  21655.  The error L2028 "Automatic data segment plus heap exceeds 64K" was
  21656.  omitted from the linker error messages in the "CodeView and Utilities,
  21657.  Microsoft Editor, Mixed-Language Programming Guide" manual that
  21658.  accompanies Microsoft C 5.10. This error occurs when the stack and
  21659.  data plus the near heap exceeds 64K. The near heap size is set with
  21660.  the HEAPSIZE option in the .DEF file.
  21661.  
  21662.  The error can be corrected by using one of the following methods:
  21663.  
  21664.  1. Reducing the amount of data in the default data segment.
  21665.  
  21666.  2. Decreasing the stack size that was set by /ST:xxxx at the link line
  21667.     or by the STACKSIZE option in the .DEF file.
  21668.  
  21669.  3. Decreasing the amount of near heap that is being requested with the
  21670.     HEAPSIZE option in .DEF file.
  21671.  
  21672.  
  21673.  58. Specifying Link Options with "-" Causes L4046, L1083, or U1013
  21674.  
  21675.  Product Version(s): 5.01.21
  21676.  Operating System:   OS/2
  21677.  Flags: ENDUSER |
  21678.  Last Modified: 10-NOV-1989    ArticleIdent: Q50333
  21679.  
  21680.  LINK command line switches must begin with the linker's option
  21681.  character, the forward slash (/). While it is valid to begin
  21682.  compilation switches with a dash (-), the same is not true for the
  21683.  linker.
  21684.  
  21685.  Code Example
  21686.  ------------
  21687.  
  21688.  #--------------------
  21689.  # test make file
  21690.  #--------------------
  21691.  
  21692.  test.obj : test.c test.h
  21693.       cl -c -Zi -G2sw -W3 test.c
  21694.  
  21695.  test.exe : test.obj test.def
  21696.       link test, -CO -align:16, NUL, os2, test
  21697.  
  21698.  You type:
  21699.          make test
  21700.  
  21701.  Microsoft (R) Program Maintenance Utility  Version 4.07
  21702.  Copyright (C) Microsoft Corp 1984-1988. All rights reserved.
  21703.  
  21704.    link test, -CO -align:16, NUL, os2, test
  21705.  
  21706.  Microsoft (R) Segmented-Executable Linker  Version 5.01.21
  21707.  Copyright (C) Microsoft Corp 1984-1988.  All rights reserved.
  21708.  
  21709.  TEST.DEF(12) : warning L4046: module name different from output file name
  21710.  LINK : fatal error L1083: cannot open run file
  21711.  test(16) : fatal error U1013: 'link test, -CO -align:16, NUL, os2, test'
  21712.           : error 2
  21713.  
  21714.  
  21715.  59. /PACKCODE Incompatible with IOPL Segments with LINK 5.01.21
  21716.  
  21717.  Product Version(s): 5.01.21
  21718.  Operating System:   OS/2
  21719.  Flags: ENDUSER | S_C
  21720.  Last Modified: 10-NOV-1989    ArticleIdent: Q50702
  21721.  
  21722.  LINK Version 5.01.21 does not support the combination of using the
  21723.  /PACKCODE switch and having code segments declared as IOPL (i.e., as
  21724.  having I/O privilege).
  21725.  
  21726.  When combining segments as directed by the /PACKCODE option, LINK
  21727.  5.01.21 will combine the IOPL segment(s) with other segments that do
  21728.  not have I/O privilege. The result is an invalid executable that
  21729.  returns the system error SYS1059 when it is invoked.
  21730.  
  21731.  The lack of ability to combine these options is a limitation of this
  21732.  particular linker version. LINK Version 5.03 allows the combination of
  21733.  /PACKCODE and IOPL segments without a problem.
  21734.  
  21735.  
  21736.  60. LINK : Warning L4011 Caused By Invalid /PACKCODE Group Size
  21737.  
  21738.  Product Version(s): 3.65 4.06 4.07 5.01.21 5.03 | 5.01.21 5.03
  21739.  Operating System:   MS-DOS                      | OS/2
  21740.  Flags: ENDUSER | S_C S_QUICKC S_QUICKASM S_PASCAL DOCERR
  21741.  Last Modified: 10-NOV-1989    ArticleIdent: Q50705
  21742.  
  21743.  The LINK code packing option, /PAC[:n], groups together neighboring
  21744.  code segments into the same segment of maximum size "n" bytes. The
  21745.  results of using /PAC will only be reliable when "n" is in the range
  21746.  of 0 to 65500. Page 278 of the "Microsoft C 5.1 CodeView and
  21747.  Utilities" reference manual states the default value for "n" is 65530.
  21748.  This is incorrect.
  21749.  
  21750.  The linkers from the following products were tested with the /PAC
  21751.  option to determine their behavior with various values of "n":
  21752.  
  21753.     C 5.10
  21754.     Pascal 4.00
  21755.     FORTRAN 5.00
  21756.     QuickC 1.01
  21757.     QuickC 2.00
  21758.     QuickASM 2.01
  21759.  
  21760.  Note: Linkers were checked in both real and protected mode where
  21761.  appropriate.
  21762.  
  21763.  The following table shows the acceptable values that can be used with
  21764.  the /PAC[:n] option and what error message will occur when the value
  21765.  of "n" is out of range:
  21766.  
  21767.  ----------------------------------------------------------------------
  21768.  Value of "n"      LINK Vers.   Error Message
  21769.  ----------------------------------------------------------------------
  21770.  0 to 65500        3.65         No Errors/Warnings
  21771.                    4.06         No Errors/Warnings
  21772.                    4.07         No Errors/Warnings
  21773.                    5.01.21      No Errors/Warnings
  21774.                    5.03         No Errors/Warnings
  21775.  
  21776.  65501 to 65536    3.65         LINK : warning L4011:
  21777.                    4.06         LINK : warning L4011: PACKCODE value
  21778.                                 exceeding 65500 unreliable
  21779.                    4.07         (same as above)
  21780.                    5.01.21      (same as above)
  21781.                    5.03         (same as above)
  21782.  
  21783.  65537 and over    3.65         LINK : fatal error L1005:
  21784.                    4.06         LINK : fatal error L1005: packing limit
  21785.                                 exceeds 65536 bytes
  21786.                    4.07         (same as above)
  21787.                    5.01.21      (same as above)
  21788.                    5.03         (same as above)
  21789.  ----------------------------------------------------------------------
  21790.  
  21791.  Note : With LINK Version 5.03 and later, the /PAC option has been
  21792.  changed to /PACKC to differentiate /PACKC[ODE] from the new
  21793.  /PACKD[ATA] option.
  21794.  
  21795.  
  21796.  61. How and When to Specify Stack Size (Clarification)
  21797.  
  21798.  Product Version(s): 3.65 4.06 4.07 | 5.01.21
  21799.  Operating System:   MS-DOS         | OS/2
  21800.  Flags: ENDUSER |
  21801.  Last Modified: 30-NOV-1989    ArticleIdent: Q50950
  21802.  
  21803.  Question:
  21804.  
  21805.  When I want to specify a certain stack size for a program, should I
  21806.  use the /F compiler option, the /ST linker option, or both?
  21807.  
  21808.  Response:
  21809.  
  21810.  This depends on how you are compiling and linking. If you using the CL
  21811.  command to compile and link, the /F compiler option is all that is
  21812.  necessary. This option will pass the correct size of the stack to the
  21813.  linker.
  21814.  
  21815.  On the other hand, if you are invoking the compiler and the linker
  21816.  separately (as in a make file), the /ST link option can be used to get
  21817.  the desired stack size. The /ST link option is documented on Page 123
  21818.  of the "Microsoft C Optimizing Compiler User's Guide."
  21819.  
  21820.  No stack information is stored in the object module. Therefore, using
  21821.  the /F and /c (compile only) options together and then invoking link
  21822.  separately will not generate the desired stack size. The /F compile
  21823.  option is documented on Page 102 of the "Microsoft C Optimizing
  21824.  Compiler User's Guide."
  21825.  
  21826.  
  21827.  62. Linking Method May Result in Unexpected Increase in .EXE Size
  21828.  
  21829.  Product Version(s): 3.x 4.06 4.07 5.01.21 5.03 | 5.01.21 5.03
  21830.  Operating System:   MS-DOS                     | OS/2
  21831.  Flags: ENDUSER |
  21832.  Last Modified: 21-FEB-1990    ArticleIdent: Q58689
  21833.  
  21834.  Question:
  21835.  
  21836.  When my program is linked in the following manner
  21837.  
  21838.     link  file1.obj file2.obj library.lib;
  21839.  
  21840.  the resulting executable file is much larger than if the program is
  21841.  linked this way:
  21842.  
  21843.     link  file1.obj file2.obj,,,library.lib;
  21844.  
  21845.  What causes the difference in size?
  21846.  
  21847.  Response:
  21848.  
  21849.  This is expected behavior, the difference in size is due to the
  21850.  difference in linking method.
  21851.  
  21852.  The first method has the library name in the same field as the object
  21853.  files. Libraries entered in this field are called "load libraries" as
  21854.  opposed to "regular libraries." Link automatically links in every
  21855.  object module in a load library; it does not search for unresolved
  21856.  external references first.
  21857.  
  21858.  The effect of using a load library is exactly the same as if you had
  21859.  entered all the names of the library's object modules as separate
  21860.  object files on the link command line. This feature is useful if you
  21861.  are developing software using many modules and want to avoid having to
  21862.  retype each module on the LINK command line.
  21863.  
  21864.  With the second method, LINK links in only the objects from the
  21865.  library that are required for program execution.
  21866.  
  21867.  Please see documentation on LINK, such as Section 12.1.2 of the
  21868.  Microsoft C 5.1 "CodeView and Utilities Software Development Tools for
  21869.  the MS-DOS Operating System" manual (Page 257) for more information.
  21870.  
  21871.  
  21872.  63. Linker Uses Library Sequence to Resolve External References
  21873.  
  21874.  Product Version(s):
  21875.  Operating System:   1.x 2.x 3.x 4.06 4.07 5.01.21 5.02 5.03 | 5.01.21 5.02 5.
  21876.  Flags: MS-DOS                                  | OS/2
  21877.  Last Modified: 26-FEB-1990    ArticleIdent: Q57706
  21878.  ENDUSER |
  21879.  
  21880.  "The MS-DOS Encyclopedia," Pages 407 and 408, states the following:
  21881.  
  21882.     When a public symbol required to resolve an external reference is
  21883.     declared more than once among the object modules in the input
  21884.     libraries, LINK uses the first object module that contains the
  21885.     public symbol. This means that the actual executable code or data
  21886.     associated with a particular external reference can be varied by
  21887.     changing the order in which LINK processes its input libraries...
  21888.  
  21889.     Each individual library is searched repeatedly (from first library
  21890.     to last, in the sequence in which they are input to LINK) until no
  21891.     further external references can be resolved.
  21892.  
  21893.  The following simple case demonstrates the concept:
  21894.  
  21895.     Module MAIN   Library A     Library B1    Library C     Library B2
  21896.     +---------+   +----------+  +----------+  +----------+  +----------+
  21897.     | calls A |   | contains |  | contains |  | contains |  | contains |
  21898.     +---------+   |    A,    |  |    B     |  |    C,    |  |    B     |
  21899.                   | calls  C |  +----------+  | calls  B |  +----------+
  21900.                   +----------+                +----------+
  21901.  
  21902.  The linker determines which copy of Module B to use depending on the
  21903.  library sequence. For example, when you link with the following, the
  21904.  Module B from Library B2 is selected:
  21905.  
  21906.     LINK MAIN,,,A B1 C B2;
  21907.  
  21908.  The linker looks first in Library C and, unable to resolve the
  21909.  reference, proceeds to the next library, B2. If the linker is still
  21910.  unable to resolve the reference, it continues searching at Library A.
  21911.  
  21912.  A slightly more complex case, when Library A contains both Module A
  21913.  and Module B, produces different results, as shown below:
  21914.  
  21915.     Module MAIN   Library A     (remove B1)   Library C     Library B2
  21916.     +---------+   +----------+                +----------+  +----------+
  21917.     | calls A |   | contains |                | contains |  | contains |
  21918.     +---------+   |    A,    |                |    C,    |  |    B     |
  21919.                   | calls  C |                | calls  B |  +----------+
  21920.                   +----------+                +----------+
  21921.                   | contains |
  21922.                   |    B     |
  21923.                   +----------+
  21924.  
  21925.  Link with "LINK MAIN,,,A C B2;". In this case, Module B from Library A
  21926.  is selected.
  21927.  
  21928.  Although the linker always follows the same rules for resolution, it
  21929.  gets more difficult to determine which version of a module will be
  21930.  selected in more complex cases. When feasible, you can avoid this
  21931.  problem by putting your selected versions in an .OBJ instead of an
  21932.  .LIB. The linker uses any .OBJs to resolve references before it
  21933.  uses libraries.
  21934.  
  21935.  For more information, refer to "The MS-DOS Encyclopedia," Article 20:
  21936.  "The Microsoft Object Linker," in the "Object Module Order" section,
  21937.  Pages 703-706.
  21938.  
  21939.  
  21940.  64. Calling Overlaid Functions Through Pointers Not Supported
  21941.  
  21942.  Product Version(s): 1.x 2.x 3.x 4.06 4.07 5.01.21 5.02 5.03
  21943.  Operating System:   MS-DOS
  21944.  Flags: ENDUSER | S_C S_QuickC
  21945.  Last Modified: 30-JAN-1990    ArticleIdent: Q58098
  21946.  
  21947.  LINK does not support using function pointers for calling functions in
  21948.  overlays unless the function is being called from within the same
  21949.  overlay. If an overlaid function is being called from the root or from
  21950.  a different overlay, then the call must not be made through a pointer.
  21951.  
  21952.  LINK cannot support calling overlaid functions indirectly through
  21953.  pointers because the address of the indirect function is determined at
  21954.  load time.
  21955.  
  21956.  In a program with overlays, a normal function call (that is, not a
  21957.  call through a pointer) is recognized by the linker and an interrupt
  21958.  call is placed into the .EXE in place of the function call. When the
  21959.  function is called at run time, the interrupt directs control to the
  21960.  overlay manager. The overlay manager checks whether the right overlay
  21961.  is loaded into memory, loads it if necessary, and calls the function.
  21962.  Because there is a fixup record in the .OBJ for the function call, the
  21963.  linker can set everything up correctly.
  21964.  
  21965.  On the other hand, with a function pointer, the compiler creates a
  21966.  fixup record for the address that the pointer references. However,
  21967.  there is no indication in the fixup record that this address is for a
  21968.  function. Therefore, if you link the function in as an overlay, the
  21969.  linker does not insert a call to the overlay manager and instead does
  21970.  a standard fixup.
  21971.  
  21972.  As a result, if you indirectly call a function located in a not-as-yet
  21973.  loaded overlay, the overlay does not get loaded. Nevertheless, control
  21974.  is still transferred to the address at which the function is thought
  21975.  to reside, which can only mean disaster for the executing program.
  21976.  
  21977.  
  21978.  65. /PAU Linker Option Doesn't Function in Some Versions of LINK
  21979.  
  21980.  Product Version(s): 3.61 3.65 3.69 5.01.20 5.05 | 5.01.20 5.05
  21981.  Operating System:   MS-DOS                      | OS/2
  21982.  Flags: ENDUSER |
  21983.  Last Modified: 21-FEB-1990    ArticleIdent: Q58781
  21984.  
  21985.  The /PAU (PAUSE) linker option tells LINK to pause in the link session
  21986.  and display a message before it writes the executable file to disk,
  21987.  allowing you to insert a new disk on which to store the executable
  21988.  file.
  21989.  
  21990.  In Microsoft LINK.EXE Versions 3.61, 3.65, 3.69, 5.01.20, and 5.05,
  21991.  the /PAU linker option does not pause the link session.
  21992.  
  21993.  Microsoft is researching this problem and will post new information
  21994.  here as it becomes available.
  21995.  
  21996.  In versions where the /PAU linker option functions correctly, LINK
  21997.  displays the following message before it creates the executable file:
  21998.  
  21999.     About to generate .EXE file
  22000.     Change diskette in drive ___ and press <ENTER>
  22001.  
  22002.  LINK resumes processing after the ENTER key is pressed.
  22003.  
  22004.  
  22005.  66. /INC and Overlays Are Not Supported at the Same Time
  22006.  
  22007.  Product Version(s): 5.01.20 5.01.21 5.02 5.03
  22008.  Operating System:   MS-DOS
  22009.  Flags: ENDUSER | docsup
  22010.  Last Modified: 15-MAY-1990    ArticleIdent: Q59279
  22011.  
  22012.  LINK.EXE does not support the use of /INCREMENTAL (or /INC) switch and
  22013.  overlays at the same time. This is because ILINK.EXE, which is invoked
  22014.  by the /INC option, does not support overlays. One of the two
  22015.  operations is ignored.
  22016.  
  22017.  The linker produces a working executable file, but one of the
  22018.  following WARNING messages may be produced:
  22019.  
  22020.     L4013: Overlays: option ignored for segmented-executable file
  22021.     L4014: /INCREMENTAL : Option ignored for realmode executable file
  22022.  
  22023.  If no warning message is produced, the linker takes an unpredictable
  22024.  path. If this is the case, the executable file that is produced could
  22025.  be corrupted and should NOT be relied upon.
  22026.  
  22027.  
  22028.  67. Incomplete EXPORTS List May Cause L2022 and L2029
  22029.  
  22030.  Product Version(s): 3.65
  22031.  Operating System:   MS-DOS
  22032.  Flags: ENDUSER |
  22033.  Last Modified: 12-MAR-1990    ArticleIdent: Q59385
  22034.  
  22035.  Compiling and linking a Windows program and receiving the following
  22036.  two link errors can be caused by an incomplete EXPORTS list:
  22037.  
  22038.     LINK : error L2022: ProcedureName : export undefined
  22039.     LINK : error L2029: 'ProcedureName' : unresolved external
  22040.  
  22041.  Windows programming involves the creation of a .DEF (definitions)
  22042.  file. All Windows procedures to be exported must be listed in this
  22043.  file. The following is an example:
  22044.  
  22045.     EXPORTS     ProcedureName
  22046.  
  22047.  When this list is incomplete, the L2022 error is generated. The L2029
  22048.  error can be generated if the case of the EXPORT line doesn't match
  22049.  the case of the actual function.
  22050.  
  22051.  Listing all procedures to be exported in the .DEF file prevents both
  22052.  of these errors.
  22053.  
  22054.  Note: These errors can also occur with Presentation Manager programs
  22055.  or programs that use DLLs under OS/2.
  22056.  
  22057.  
  22058.  68. Why the /HIGH Switch Is Not Used with High-Level Languages
  22059.  
  22060.  Product Version(s): 3.65
  22061.  Operating System:   MS-DOS
  22062.  Flags: ENDUSER |
  22063.  Last Modified: 15-MAR-1990    ArticleIdent: Q59535
  22064.  
  22065.  The linker option /HIGH is used with assembly language programs to
  22066.  load an .EXE file as high as possible in memory. Without the /HIGH
  22067.  option, LINK places the .EXE file as low as possible.
  22068.  
  22069.  /HIGH is not used with high-level languages because it prohibits the
  22070.  use of dynamic memory allocation by the program. Furthermore, C
  22071.  run-time start-up code specifies /DOSSEG, which forces low load and
  22072.  Microsoft run-time segment layout.
  22073.  
  22074.  When a program is linked with /HIGH, MS-DOS loads the program at the
  22075.  highest possible memory location available, usually 0xFFF0. All memory
  22076.  between the program's segments (which are high) and the program's PSP
  22077.  (which is low) is now considered program RAM, owned by the program.
  22078.  You can no longer allocate or free that memory.
  22079.  
  22080.  Therefore, calls to routines such as malloc() and free() fail. This
  22081.  causes problems for the following reasons:
  22082.  
  22083.  1. Some memory is dynamically allocated during function calls from
  22084.     high-level languages.
  22085.  
  22086.  2. The memory structure required by Microsoft high-level languages for
  22087.     tracking used/freed memory is not available.
  22088.  
  22089.  You can use /HIGH if you write your own start-up code, but your
  22090.  programs cannot call most of the routines from the C run-time library.
  22091.  
  22092.  The only reason /HIGH is still available to the linker is that early
  22093.  versions of Microsoft FORTRAN and Microsoft Pascal generated code that
  22094.  had to be linked with /DSALLOCATE, which relocates all addresses
  22095.  within DGROUP in such a way that the last byte in the group has the
  22096.  offset 0xFFFF. The /HIGH switch is used in conjunction with the
  22097.  /DS(ALLOCATE) switch.
  22098.  
  22099.  For more information, search the knowledge base with the following
  22100.  query:
  22101.  
  22102.     S_LINK and /HIGH and /DS
  22103.  
  22104.  You can also read the section "Using the /HIGH and /DSALLOCATE
  22105.  Switches" on Page 719 ff in the "MS-DOS Encyclopedia."
  22106.  
  22107.  
  22108.  69. OS/2 Module Definition File Syntax
  22109.  
  22110.  Product Version(s): 5.01.21 5.02 5.03 5.05
  22111.  Operating System:   OS/2
  22112.  Flags: ENDUSER | S_C
  22113.  Last Modified: 16-MAR-1990    ArticleIdent: Q59536
  22114.  
  22115.  The following is extracted from Ray Duncan's "Advanced OS/2
  22116.  Programming," Page 737:
  22117.  
  22118.     Module definition (DEF) files are simple ASCII text files that are
  22119.     interpreted by the linker during the construction of an application
  22120.     program, dynlink library, or device driver. The directives in DEF
  22121.     files cause information to be built into the executable file's
  22122.     header, which is later interpreted by the system when the program,
  22123.     library, or driver is loaded.
  22124.  
  22125.     Enter all DEF file directives and keywords in uppercase letters.
  22126.     File, segment, group, and procedure names can be lowercase or
  22127.     uppercase. Lines beginning with a semicolon (;) are treated as
  22128.     comments.
  22129.  
  22130.     Figure E-1. DEF file directives documented in Appendix E
  22131.     --------------------------------------------------------
  22132.  
  22133.     CODE        Assigns characteristics to code segments
  22134.     DATA        Assigns characteristics to data segments
  22135.     DESCRIPTION Embeds text in executable file
  22136.     EXETYPE     Specifies host operating system
  22137.     EXPORTS     Names functions exported for dynamic linking by other
  22138.                 programs
  22139.     HEAPSIZE    Specifies initial size of local heap (C programs only)
  22140.     IMPORTS     Names functions that will be dynamically linked at load
  22141.                 time
  22142.     LIBRARY     Builds dynlink library or device driver
  22143.     NAME        Builds application program
  22144.     OLD         Specifies ordinal compatibility with previous version of
  22145.                 dynlink library
  22146.     PROTMODE    Flags file as executable in protected mode only
  22147.     REALMODE    Allows file to be executed in real mode
  22148.     SEGMENTS    Assigns characteristics to selected segments
  22149.     STACKSIZE   Specifies size of stack used by primary thread
  22150.     STUB        Embeds MS-DOS-compatible program in new executable file
  22151.  
  22152.  For further information, refer to Appendix E, Module Definition File
  22153.  Syntax, in "Advanced OS/2 Programming" or Chapter 19, Using Module-
  22154.  Definition Files, in the "Microsoft FORTRAN CodeView and Utilities
  22155.  User's Guide," packaged with FORTRAN Version 5.00.
  22156.  
  22157.  
  22158.  70. Linker Error L4047 May Be Benign
  22159.  
  22160.  Product Version(s): 5.10    | 5.10
  22161.  Operating System:   MS-DOS  | OS/2
  22162.  Flags: ENDUSER |
  22163.  Last Modified: 18-APR-1990    ArticleIdent: Q59936
  22164.  
  22165.  The following linker error may be a benign error if it occurs with an
  22166.  application that links with the C Version 6.00 start-up code:
  22167.  
  22168.     L4047 - Multiple code segments in module of overlayed program
  22169.             incompatible with /CO
  22170.  
  22171.  This is a new error for LINK Version 5.10 and is to be expected.
  22172.  
  22173.  If an application is built with the C Version 6.00 run-time library,
  22174.  there is a second segment to hold floating-point math routines. This
  22175.  segment (EMULATOR_TEXT) does not have any CodeView information in it.
  22176.  However, from the linker's perspective, the extra segment MAY be an
  22177.  error and it is warning the user of such. In this case, it is a benign
  22178.  warning message.
  22179.  
  22180.  
  22181.  71. NODATA and pwords Parameters Reversed in EXPORT Statement Docs
  22182.  
  22183.  Product Version(s): 5.01.21 5.02 5.03 5.05 5.10 | 5.01.21 5.02 5.03 5.05 5.10
  22184.  Operating System:   MS-DOS                      | OS/2
  22185.  Flags: ENDUSER | docerr
  22186.  Last Modified: 25-MAY-1990    ArticleIdent: Q61605
  22187.  
  22188.  The EXPORT statement used in module definition (.DEF) files is
  22189.  incorrectly documented in several places with the last two parameters
  22190.  reversed. The "pwords" parameter should be the last parameter, but it
  22191.  is listed second from the end. The "NODATA" parameter is listed last,
  22192.  but should be second from the end. The correct EXPORT statement syntax
  22193.  is as follows:
  22194.  
  22195.     entryname [=internalname] [@ord[RESIDENTNAME]] [NODATA] [pwords]
  22196.  
  22197.  Note that the "pwords" parameter is listed as "iopl-parmwords" in some
  22198.  of the documentation.
  22199.  
  22200.  The documentation with the incorrect EXPORT statement syntax with
  22201.  reversed parameters is as follows:
  22202.  
  22203.  - The C version 6.00 online help for LINK under the EXPORT statement
  22204.    syntax
  22205.  
  22206.  - On Page 334 of "The Microsoft CodeView and Utilities User's
  22207.    Guide" for version 2.30 in Section 19.9, "The EXPORTS
  22208.    Statement" (shipped with FORTRAN 5.00 and BASIC PDS 7.00)
  22209.  
  22210.  - On Page Update-52 of "The Microsoft CodeView and Utilities
  22211.    Update" for version 2.20 in Section 7.8, "The EXPORTS
  22212.    Statement" (shipped with C 5.10, MASM 5.10, and Pascal 4.00)
  22213.  
  22214.  
  22215.  72. Fatal /nologo and /e Switch Interaction
  22216.  
  22217.  Product Version(s): 1.20   | 1.20
  22218.  Operating System:   MS-DOS | OS/2
  22219.  Flags: ENDUSER | buglist1.20
  22220.  Last Modified: 22-JUN-1990    ArticleIdent: Q62375
  22221.  
  22222.  Using the /nologo switch in conjunction with /e switch can cause ILINK
  22223.  version 1.20 to fail. The problem will occur when an incremental link
  22224.  cannot be performed and the command specified by the /e switch is
  22225.  performed instead. If the /e switch is preceded anywhere on the
  22226.  command line by /nologo, then the link will fail.
  22227.  
  22228.  For example, the following command line
  22229.  
  22230.      ILINK /nologo /e "link hello;" hello.exe
  22231.  
  22232.  where hello.obj exists but hello.exe doesn't, will produce the
  22233.  following messages:
  22234.  
  22235.     Microsoft (R) Segmented-Executable Linker  Version 5.10
  22236.     Copyright (C) Microsoft Corp 1984-1990.  All rights reserved.
  22237.  
  22238.     LINK : fatal error L1089:  : cannot open response file
  22239.     ILINK : warning L4252: file '/e.exe' does not exist
  22240.     ILINK : performing full link
  22241.     ILINK : fatal error L1233: 'link' returned 2
  22242.  
  22243.  Placing the /nologo switch after the /e switch on the command line
  22244.  will alleviate the problem.
  22245.  
  22246.  Microsoft has confirmed this to be a problem with LINK version 1.20.
  22247.  We are researching this problem and will post new information here as
  22248.  it becomes available.
  22249.  
  22250.  
  22251.  73. L4050 Incorrectly Documented in Online Help
  22252.  
  22253.  Product Version(s): 5.10   | 5.10
  22254.  Operating System:   MS-DOS | OS/2
  22255.  Flags: ENDUSER | docerr buglist5.10 S_PWB
  22256.  Last Modified: 24-JUL-1990    ArticleIdent: Q63235
  22257.  
  22258.  When linking a very small program with /EXEPACK, Microsoft LINKer
  22259.  version 5.10 sometimes gives the following error message:
  22260.  
  22261.     LINK: warning L4050: file not suitable for /EXEPACK; relink without
  22262.  
  22263.  The online Help documentation returns the following incorrect
  22264.  information:
  22265.  
  22266.     LINK warning L4050
  22267.  
  22268.     too many public symbols for sorting
  22269.  
  22270.     The linker uses the stack and all available memory in the near
  22271.     heap to sort public symbols for the /MAP option. If the number of
  22272.     public symbols exceeds the space available for them, this warning
  22273.     is issued and the symbols are not sorted in the map file but are
  22274.     listed in an arbitrary order.
  22275.  
  22276.     Reduce the number of symbols.
  22277.  
  22278.  The correct documentation for this error (except the number) is as
  22279.  follows and can be found in the online Help under L1114:
  22280.  
  22281.     Fatal LINK error L1114
  22282.  
  22283.     file not suitable for /EXEPACK; relink without
  22284.  
  22285.     For the linked program, the size of the packed load image plus
  22286.     packing overhead was larger than that of the unpacked load image.
  22287.  
  22288.     Relink without the /EXEPACK option.
  22289.  
  22290.  Because of its noncritical nature, this LINKer error was changed from
  22291.  its previous status of a fatal error to a simple warning in LINK
  22292.  version 5.10. The warning associated with L4050 in earlier versions of
  22293.  the LINKer will rarely appear in LINK 5.10, but if it does, it will
  22294.  have the number L4070.
  22295.  
  22296.  
  22297.  
  22298.  74. Parenthesis in Filename May Cause L1027: Unmatched Parenthesis
  22299.  
  22300.  Product Version(s): 3.x 4.06 4.07 5.01.21 5.03 5.05 5.10 | 5.01.21 5.03 5.05
  22301.  Operating System:   MS-DOS                               | OS/2
  22302.  Flags: ENDUSER |
  22303.  Last Modified: 10-JUL-1990    ArticleIdent: Q63624
  22304.  
  22305.  When linking object files into executable programs, the error L1027:
  22306.  "Unmatched left/right parenthesis" may be incorrectly generated for
  22307.  files that contain a parenthesis in the filename. This will only occur
  22308.  when the object module is in the current directory and either of the
  22309.  following conditions is true:
  22310.  
  22311.  1. If the object module being linked has a left parenthesis as the
  22312.     first character in its name, but NOT a right parenthesis as the last
  22313.     character.
  22314.  
  22315.  2. If an object filename has a right parenthesis as the last
  22316.     character in the name, but NOT a left parenthesis as the first.
  22317.  
  22318.  If the object module is NOT in the current directory, then the L1027
  22319.  error will occur only if the second condition above is true.
  22320.  
  22321.  This information applies to all versions of LINK.EXE that support
  22322.  overlays.
  22323.  
  22324.  Normally, parentheses are put around the names of one or more object
  22325.  modules when linking to inform LINK that the enclosed modules are to
  22326.  be in an overlay. Therefore, if a left (or right) parenthesis comes
  22327.  immediately before (or after) the name of an object module, LINK will
  22328.  expect a right (or left) parenthesis immediately after (or before) the
  22329.  name. If the parentheses do not match, a fatal L1027 error will be
  22330.  generated.
  22331.  
  22332.  For example, the following LINK command line causes an "Unmatched left
  22333.  parenthesis" error when the object module ABC.OBJ is in the current
  22334.  directory:
  22335.  
  22336.     link (abc;
  22337.  
  22338.  However, if ABC.OBJ is in a subdirectory, then the parenthesis is
  22339.  embedded in the middle of the path/filename string and no error is
  22340.  generated, as shown below:
  22341.  
  22342.     link temp\(abc;
  22343.  
  22344.  For the same reason, a file ABC).OBJ will NOT give an error if linked
  22345.  with the following line:
  22346.  
  22347.     link abc).obj;
  22348.  
  22349.  On the other hand, leaving off the .OBJ extension will result in the
  22350.  L1027 error:
  22351.  
  22352.     link abc);
  22353.  
  22354.  By the same reasoning, the placement of a left or right parenthesis in
  22355.  the middle of an object filename does not cause an error. The
  22356.  following three LINK lines all work correctly:
  22357.  
  22358.     link a(bc;
  22359.     link a()bc;
  22360.     link a)bc;
  22361.  
  22362.  
  22363.  75. ILINK 1.20 and 1.21 Are Not Backwards Compatible
  22364.  
  22365.  Product Version(s): 1.20 1.21 | 1.20 1.21
  22366.  Operating System:   MS-DOS    | OS/2
  22367.  Flags: ENDUSER |
  22368.  Last Modified: 24-OCT-1990    ArticleIdent: Q65817
  22369.  
  22370.  Using ILINK version 1.20 or 1.21, after doing a full link using a
  22371.  bound linker earlier than version 5.10 or a DOS linker earlier than
  22372.  version 4.10, causes the following message:
  22373.  
  22374.     ILINK : warning L4267: invalid .ILK file
  22375.     ILINK : performing full link
  22376.  
  22377.  If you use the ILINK version that came with the linker you are using,
  22378.  the .ILK file will be recognized correctly. ILINK versions 1.20 and
  22379.  1.21 are not "backwards compatible" and will not work correctly with
  22380.  earlier .ILK files.
  22381.  
  22382.  
  22383.  76. Unexpected DOS Error: 14 Generated by Using /INC
  22384.  
  22385.  Product Version(s): 5.10
  22386.  Operating System:   MS-DOS
  22387.  Flags: ENDUSER | s_quickc s_c
  22388.  Last Modified: 24-OCT-1990    ArticleIdent: Q66055
  22389.  
  22390.  Programs linked with the /INC (Prepare for Incremental Link) switch
  22391.  cause the following error if the program is executed using the
  22392.  Microsoft Windows version 3.00 Run command:
  22393.  
  22394.     Unexpected DOS error: 14.
  22395.  
  22396.  The Run command is located on the File menu in both the Windows
  22397.  Program Manager and the File Manager. If the program is run from a
  22398.  prompt in real DOS or in a DOS session of Windows 3.00, it executes
  22399.  properly.
  22400.  
  22401.  While this seems like a problem with the Microsoft Linker, Windows 3.0
  22402.  is actually at fault here. The use of the /INC switch causes the
  22403.  linker to create a segmented executable. When Windows attempts to run
  22404.  this .exe, it fails to recognize that it is a full screen application
  22405.  (ie: not a windows app) and subsequently tries to execute it as a
  22406.  Windows application. This bug has been entered into the Windows bug
  22407.  database and should be fixed in a future release.
  22408.  
  22409.  Note: This may appear to be a problem with QuickC and/or C version
  22410.  6.00 if the incremental link option is turned on. In fact, it is a
  22411.  linking issue, not a compiler issue.
  22412.  
  22413.  To workaround this problem, turn off the /INC switch.
  22414.  
  22415.  
  22416.  77. Response Filename Cannot Exceed 32 Characters
  22417.  
  22418.  Product Version(s): 5.01.21 5.03 5.05 | 5.01.21 5.03 5.05
  22419.  Operating System:   MS-DOS            | OS/2
  22420.  Flags: ENDUSER | buglist5.01.21 buglist5.03 buglist5.05 fixlist5.10
  22421.  Last Modified: 12-NOV-1990    ArticleIdent: Q66698
  22422.  
  22423.  When using a complete path specification for a response file with
  22424.  LINK.EXE versions 5.01.21, 5.03, and 5.05, there is a limit of 32
  22425.  characters that cannot be exceeded. The following example illustrates
  22426.  this:
  22427.  
  22428.     LINK @d:\c600\files\project\test\myfile.lnk
  22429.  
  22430.  This will fail with the following error:
  22431.  
  22432.     LINK : Fatal error L1089 : D:\C600\FILES\PROJECT\TEST\MYFIL :
  22433.          cannot open response file
  22434.  
  22435.  In LINK version 5.10, this limit has been increased to 255 characters.
  22436.  
  22437.  
  22438.  78. Linker Does Not Search Specified Drive for Libraries
  22439.  
  22440.  Product Version(s): 5.01.21 5.03 5.05 5.10 5.11  | 5.01.21 5.03 5.05 5.10 5.1
  22441.  Operating System:   MS-DOS                       | OS/2
  22442.  Flags: ENDUSER | buglist5.01.21 buglist5.03 buglist5.05 buglist5.10 buglist5.
  22443.  Last Modified: 12-NOV-1990    ArticleIdent: Q66699
  22444.  
  22445.  A library name can be embedded into an .OBJ module for the linker to
  22446.  search to resolve external references. This library name can either be
  22447.  the library name itself or the full path to the library. In the case
  22448.  of the full path to the library, the linker cannot handle a drive
  22449.  specifier.
  22450.  
  22451.  For example, with Microsoft C, the #pragma comment command is used to
  22452.  specify the library. If the following line is used
  22453.  
  22454.     #pragma comment (lib, "c:\C600\LIB\graphics.lib")
  22455.  
  22456.  the compiler will add a COMENT record to the .OBJ instructing the
  22457.  linker to search the C600\LIB subdirectory on drive C for the
  22458.  GRAPHICS.LIB library.
  22459.  
  22460.  The problem is that the linker will not search drive C but will
  22461.  instead search the default drive. When the library and/or path is not
  22462.  found, it will prompt for the path to the library. This is an error.
  22463.  
  22464.  Microsoft has confirmed this to be a problem in the Segmented Linker
  22465.  versions 5.01.21, 5.03, 5.05, 5.10, and 5.11. We are researching this
  22466.  problem and will post new information here as it becomes available.
  22467.  
  22468.  
  22469.  79. L2002 When Creating a Dynamic Link Library
  22470.  
  22471.  Product Version(s): 5.10 5.11
  22472.  Operating System:   OS/2
  22473.  Flags: ENDUSER | buglist5.10 buglist5.11
  22474.  Last Modified:  4-DEC-1990    ArticleIdent: Q67004
  22475.  
  22476.  The code sample below produces the following error when compiled and
  22477.  linked with the following switches:
  22478.  
  22479.  cl /c /Gs /Alfu /ML foo.c
  22480.  
  22481.  link foo.obj, foo.dll,,, foo.def;
  22482.  
  22483.  Error
  22484.  -----
  22485.  
  22486.     L2002: fix-up overflow at 2 in segment FOO_TEXT
  22487.      frm seg _DATA, tgt seg _DATA, tgt offset 0
  22488.  
  22489.  This error is produced when creating a dynamic link library and
  22490.  specifying _loadds on function entry (either with the /Au switch or
  22491.  the _loadds keyword). If each segment that comprises the default data
  22492.  segment is of zero length, the linker will return this error. In
  22493.  earlier linkers, the error wasn't generated.
  22494.  
  22495.  The following are three possible workarounds:
  22496.  
  22497.  1. If the function does not contain any static data, compile with the
  22498.     option /Aw (DS not reloaded on function entry) and/or remove the
  22499.     _loadds keyword from the function declaration.
  22500.  
  22501.  2. Turn on stack checking (compile without /Gs option).
  22502.  
  22503.  3. Declare data so at least one of the segments in DGROUP is not zero
  22504.     length.
  22505.  
  22506.     a. For _DATA, declare initialized global or static data.
  22507.  
  22508.     b. For _CONST, declare a constant in the program.
  22509.  
  22510.     c. For _BSS, declare uninitialized static data.
  22511.  
  22512.  Microsoft has confirmed this to be a problem in versions 5.10 and
  22513.  5.11. We are researching this problem and will post new information
  22514.  here as it becomes available.
  22515.  
  22516.  Sample Code
  22517.  -----------
  22518.  
  22519.  void foo(int i)
  22520.  {
  22521.     char c;
  22522.  
  22523.     c=i;
  22524.  }
  22525.  
  22526.  
  22527.  80. NOF Is Default for LINK, Not /F as C "Reference" States
  22528.  
  22529.  Product Version(s): 5.10   | 5.10
  22530.  Operating System:   MS-DOS | OS/2
  22531.  Flags: ENDUSER | docerr S_C
  22532.  Last Modified:  4-JAN-1991    ArticleIdent: Q67085
  22533.  
  22534.  On pages 30 and 31 of the "Microsoft C Reference" manual shipped with
  22535.  C versions 6.00 and 6.00a, there are contradictory references to the
  22536.  far-call translation options available for LINK. On page 30 under the
  22537.  /F[ARCALLTRANSLATION] option, far-call translations are listed as
  22538.  being "turned on by default." On the other hand, on page 31 under the
  22539.  /NOF[ARCALLTRANSLATION] option, far-calls are listed as being "off by
  22540.  default."
  22541.  
  22542.  The statement on page 30 is the one that is incorrect because the
  22543.  correct default for far-call translations is "off." Far calls are done
  22544.  only when /F is explicitly specified to LINK.
  22545.  
  22546.  Note that when the CL command is used to invoke LINK, CL itself is
  22547.  responsible for passing the /F option to the linker.
  22548.  
  22549.  
  22550.  81. EXE Checksum Incorrect If linked with /CO or /E
  22551.  
  22552.  Product Version(s): 3.xx 4.0x 4.10 5.0x 5.10 5.13 | 5.0x 5.10 5.13
  22553.  Operating System:   MS-DOS                        | OS/2
  22554.  Flags: ENDUSER |
  22555.  Last Modified:  6-FEB-1991    ArticleIdent: Q67795
  22556.  
  22557.  According to "The MS-DOS Encyclopedia," a DOS .EXE file contains a
  22558.  checksum value in the .EXE file header. This checksum value should
  22559.  allow the summation of all words in the .EXE file to equal FFFFh.
  22560.  However, if you use the /Exepack or the /COdeview options when linking
  22561.  a program, the checksum value will not be calculated correctly.
  22562.  Current versions of MS-DOS ignore this checksum so this will not cause
  22563.  any noticeable problems.
  22564.  
  22565.  Sample Code:
  22566.  ------------
  22567.  
  22568.  #include <stdio.h>
  22569.  #include <stdlib.h>
  22570.  
  22571.  main (int argc, char * argv[])
  22572.  {
  22573.     FILE * fp;
  22574.     unsigned int nxt= 0, sum= 0;
  22575.     unsigned char bl, bh;
  22576.  
  22577.     if (argc != 2)
  22578.        exit (-1);
  22579.     if ((fp= fopen (argv[1], "rb"))== NULL)
  22580.        exit (-1);
  22581.     while (! feof(fp))
  22582.     {
  22583.        bl= fgetc (fp);
  22584.        if (! feof(fp))
  22585.           bh= fgetc (fp);
  22586.        else
  22587.           {
  22588.           bl= 0;
  22589.           bh= 0;
  22590.           }
  22591.        sum= sum+ nxt;
  22592.        nxt= (unsigned int) bh* 256U+ (unsigned int) bl;
  22593.     }
  22594.     nxt&= 0xFF;
  22595.     sum+= nxt;
  22596.     printf ("sum = %X\n", sum);
  22597.  }
  22598.  
  22599.  
  22600.  82. L1008: "Segment Limit Too High" May Be Caused by Missing Colon
  22601.  
  22602.  Product Version(s): 3.x 4.06 4.07 5.01.21 5.03 5.05 5.10 | 5.01.21 5.03 5.05
  22603.  Operating System:   MS-DOS                               | OS/2
  22604.  Flags: ENDUSER |
  22605.  Last Modified: 17-DEC-1990    ArticleIdent: Q46733
  22606.  
  22607.  When linking, the following error may be caused by incorrectly
  22608.  specifying the parameters for the /SE switch on the link command line
  22609.  with the colon:
  22610.  
  22611.     LINK : fatal error L1008: SE: segment limit set too high
  22612.  
  22613.  To generate the error, link using the /SE switch, then insert a space
  22614.  and the number of segments for the linker to use, such as the
  22615.  following:
  22616.  
  22617.     LINK /SE 1024
  22618.  
  22619.  The correct syntax for the /SE option is with a colon separating the
  22620.  switch from the numeric argument as follows:
  22621.  
  22622.     LINK /SE:1024
  22623.  
  22624.  
  22625.  83. The Purpose of Module Definition Files
  22626.  
  22627.  Product Version(s): 5.01.21 5.02 5.03 5.05 5.10 5.13 | 5.01.21 5.02 5.03 5.05
  22628.  Operating System:   MS-DOS                           | OS/2
  22629.  Flags: ENDUSER |
  22630.  Last Modified: 17-DEC-1990    ArticleIdent: Q27134
  22631.  
  22632.  Module-definition files (.DEF) are used by LINK when building Windows
  22633.  and OS/2 programs and dynamic-link libraries (DLLs). A .DEF file
  22634.  describes the name, size, format, functions, and segments of an
  22635.  application or DLL.
  22636.  
  22637.  A module-definition file contains one or more module statements. Each
  22638.  module statement defines an attribute of the executable file. The
  22639.  module statements and the attributes they define are listed below:
  22640.  
  22641.  Statement         Attribute
  22642.  ---------         ---------
  22643.  
  22644.  NAME              Name and type of application
  22645.  LIBRARY           Name of dynamic-link library
  22646.  DESCRIPTION       One-line description of the module
  22647.  CODE              Default attributes for code segments
  22648.  DATA              Default attributes for data segments
  22649.  SEGMENTS          Attributes for specific segments
  22650.  STACKSIZE         Local-stack size, in bytes
  22651.  EXPORTS           Exported functions
  22652.  IMPORTS           Imported functions
  22653.  STUB              Adds a DOS Version 3.x executable file to the beginning
  22654.                    of the module, usually to terminate the program when
  22655.                    run in real mode
  22656.  HEAPSIZE          Local-heap size, in bytes
  22657.  PROTMODE          Specifies that the module runs only in OS/2 protected
  22658.                    mode
  22659.  REALMODE          Specifies that the module is for real-mode Windows.
  22660.  OLD               Preserves export ordinal information from a previous
  22661.                    version of the library
  22662.  
  22663.  The following rules govern the use of these statements in a module-
  22664.  definitions file:
  22665.  
  22666.  1. If you use either a NAME or a LIBRARY statement, it must precede
  22667.     all other statements in the module-definition file.
  22668.  
  22669.  2. You can include source-level comments in the module-definition
  22670.     file, by beginning a line with a semicolon (;). The OS/2 utilities
  22671.     ignore each such comment line.
  22672.  
  22673.  3. Module-definition keywords (such as NAME, LIBRARY, and SEGMENTS)
  22674.     must be entered in uppercase letters.
  22675.  
  22676.  For more information, refer to the utility reference or online help
  22677.  that accompanied your particular compiler or assembler.
  22678.  
  22679.  
  22680.  84. Working Around Link Error "L1064: Out of Memory"
  22681.  
  22682.  Product Version(s): 5.03 5.05 5.10 5.13 | 5.03 5.05 5.10 5.13
  22683.  Operating System:   MS-DOS              | OS/2
  22684.  Flags: ENDUSER |
  22685.  Last Modified: 17-DEC-1990    ArticleIdent: Q45718
  22686.  
  22687.  The linker error "L1064: Out Of Memory" is new with LINK version 5.03,
  22688.  which was first shipped to individuals using IMSL libraries with
  22689.  FORTRAN 4.10, and was then shipped with FORTRAN 5.00. The description
  22690.  of the error is as follows (from the "Microsoft FORTRAN, Microsoft
  22691.  CodeView and Utilities User's Guide"):
  22692.  
  22693.     The linker was not able to allocate enough memory from the
  22694.     operating system to link the program. On OS/2 try increasing the
  22695.     swap space. Otherwise, reduce the size of the program in terms of
  22696.     code, data, and symbols. On OS/2, consider splitting the program
  22697.     into dynalink libraries.
  22698.  
  22699.  In DOS, the only ways to work around the error are the following:
  22700.  
  22701.  1. Remove any memory-resident software or device drivers that may be
  22702.     limiting the available memory of the machine.
  22703.  
  22704.  2. Reduce the program size, as described above.
  22705.  
  22706.  In OS/2, the easiest way to work around the error is to increase the
  22707.  swap space, as follows:
  22708.  
  22709.  1. Close other screen groups and remove other processes from
  22710.     memory to free up both RAM and swap space on the swap drive.
  22711.  
  22712.  2. Create more free disk space on the drive that is pointed to by
  22713.     the SWAPPATH setting in the CONFIG.SYS file. (Delete or move files,
  22714.     or change the setting to a drive with more free space.)
  22715.  
  22716.  3. Possibly DECREASE the swap value set by the SWAPPATH variable (do
  22717.     this with caution -- read below).
  22718.  
  22719.  Explanation of the SWAPPATH Setting in CONFIG.SYS
  22720.  -------------------------------------------------
  22721.  
  22722.  Swapping must be enabled via the MEMMAN setting in CONFIG.SYS for the
  22723.  SWAPPATH setting to be acknowledged at all (usually "MEMMAN=SWAP" or
  22724.  "MEMMAN=SWAP,MOVE").
  22725.  
  22726.  The default setting for SWAPPATH after setting up OS/2 is usually as
  22727.  follows:
  22728.  
  22729.     SWAPPATH=C:\OS2\SYSTEM 512
  22730.  
  22731.  The drive setting indicates the drive and directory where the space
  22732.  for the swapper file will be allocated. If no SWAPPATH variable is
  22733.  set, the swapper file is allocated in the root directory on the boot
  22734.  drive. The number that follows indicates the amount of free space
  22735.  which must be left on this drive when the swapper file has grown to
  22736.  its maximum size. (This number, by itself, says nothing about the
  22737.  maximum size of the swapper file.) Given the settings above, the
  22738.  maximum size of the swapper file can be easily calculated by the
  22739.  following:
  22740.  
  22741.     (free space on Drive C) - (SWAPPATH value) = max. swap file size
  22742.  
  22743.  Therefore, increasing the SWAPPATH value DECREASES the amount of space
  22744.  available for the swapper file.
  22745.  
  22746.  The swapper value can be decreased, and the system will allow values
  22747.  down to 0 (zero). However, because OS/2 does time-slicing between
  22748.  processes and may need to write to the disk in question, decreasing
  22749.  the swapper value below 512K (the system default) is not recommended.
  22750.  This workaround should be used only if you have the value set to
  22751.  greater than 512K (the range of valid values is from 0 to 32,767). If
  22752.  this is the case, set the SWAPPATH value to 512 and reboot the
  22753.  machine. If this method does not solve the problem, you must clear
  22754.  space on the hard disk by deleting or moving files.
  22755.  
  22756.  
  22757.  85. Patches Available for Running Utilities Under Novell NetWare
  22758.  
  22759.  Product Version(s): 5.10
  22760.  Operating System:   MS-DOS
  22761.  Flags: ENDUSER | appnote SC0381.ARC s_codeview s_pwb s_c
  22762.  Last Modified:  6-FEB-1991    ArticleIdent: Q68659
  22763.  
  22764.  When LINK version 5.10 is run under a Novell network, LINK may fail
  22765.  with the following error:
  22766.  
  22767.     L1085: cannot open temporary file
  22768.  
  22769.  In addition, the C version 6.00 Setup program (SETUP.EXE), the
  22770.  Programmer's WorkBench (PWB) for DOS versions 1.00 and 1.10, and
  22771.  real-mode CodeView (CV.EXE) versions 3.00, 3.10, and 3.11 may all hang
  22772.  when run under some Novell NetWare software.
  22773.  
  22774.  These problems are directly related to the network software, but may
  22775.  be corrected with a set of patch files available from Microsoft as an
  22776.  application note titled "Network Patches for Utilities" (SC0381).
  22777.  Application notes can be obtained by calling Microsoft Product Support
  22778.  Services at (206) 637-7096.
  22779.  
  22780.  The "Network Patches for Utilities" application note can also be found
  22781.  in the Software/Data Library by searching on the keyword SC0381, the Q
  22782.  number of this article, or S12898. SC0381 was archived using the
  22783.  PKware file-compression utility.
  22784.  
  22785.  The following is the complete text of the application note, which
  22786.  includes the details of the problems mentioned above:
  22787.  
  22788.  ======================================================================
  22789.                      Network Patches for Utilities
  22790.  ======================================================================
  22791.  
  22792.  The enclosed Network Patches for Microsoft Utilities disk contains the
  22793.  following five files:
  22794.  
  22795.     README.DOC
  22796.     CVPATCH.EXE
  22797.     PWBPATCH.EXE
  22798.     SETUPFIX.EXE
  22799.     LINK.EXE
  22800.  
  22801.  These files solve conflicts with certain network setups. Please be
  22802.  sure to make backup copies of the original files.
  22803.  
  22804.  Network Patch Files
  22805.  -------------------
  22806.  
  22807.  When run under certain network software, some Microsoft utilities may
  22808.  hang. The enclosed patch files are designed to correct these problems
  22809.  for CodeView versions 3.00, 3.10, and 3.11; the Programmer's WorkBench
  22810.  (PWB) versions 1.00 and 1.10; and the C 6.00 Setup program.
  22811.  
  22812.  To install the patches, first copy the patch files (PWBPATCH.EXE,
  22813.  CVPATCH.EXE, and SETUPFIX.EXE) to the directories where you have
  22814.  installed PWB, CodeView, and Setup, respectively. Each patch assumes
  22815.  that the utility file it is to patch is in the same directory.
  22816.  
  22817.  Run SETUPFIX.EXE to patch SETUP.EXE. The original file will be saved
  22818.  as SETUP.BAK. Run CVPATCH.EXE to patch CV.EXE. The original file will
  22819.  be saved as CV.BAK. Run PWBPATCH.EXE to patch PWBED.EXE. The original
  22820.  file will be saved as PWBED.BAK. The patched utilities should run free
  22821.  of network interference.
  22822.  
  22823.  Microsoft LINK Version 5.13
  22824.  ---------------------------
  22825.  
  22826.  LINK version 5.13 includes code to work around another problem that
  22827.  sometimes occurs when running on a network. On large projects, the
  22828.  linker needs to open some temporary files to work around DOS memory
  22829.  limitations. LINK version 5.10 (supplied with C 6.00) will sometimes
  22830.  fail in its attempts to open a temporary file when run under certain
  22831.  network software.
  22832.  
  22833.  The problem actually lies in the network software, not the linker.
  22834.  When the network is loaded, the return value from an open call
  22835.  sometimes gets corrupted. When the call fails, it is because an "Out
  22836.  of handles" error (EMFILE) is returned as a "No such file or
  22837.  directory" error (ENOENT). If this occurs, LINK 5.10 halts with an
  22838.  "L1085: cannot open temporary file" error.
  22839.  
  22840.  LINK 5.13 includes a change to correct for the above situation (even
  22841.  though the problem is in the network software). When LINK version 5.13
  22842.  receives an ENOENT error on a failed open call, it will still try to
  22843.  free some file handles and reopen the temporary file, regardless of
  22844.  the error returned.
  22845.  
  22846.  To make the correction, locate LINK version 5.10 and replace it with
  22847.  LINK version 5.13 from the enclosed disk. Again, be sure to save a
  22848.  backup copy of the original file (LINK 5.10).
  22849.  
  22850.  
  22851.  86. L2025 LINK Error May Be Caused by Conflicting Library Routines
  22852.  
  22853.  Product Version(s): 3.x 4.06 4.07 5.0x 5.10 5.13 | 5.01.21 5.02 5.03 5.10 5.1
  22854.  Operating System:   MS-DOS                       | OS/2
  22855.  Flags: ENDUSER | s_lib
  22856.  Last Modified: 24-JAN-1991    ArticleIdent: Q44465
  22857.  
  22858.  All variables and routines in a module within a library will be linked
  22859.  into a program when any single variable or routine residing in that
  22860.  module is referenced. This can cause the following linker error if two
  22861.  or more modules contain definitions for the same symbol:
  22862.  
  22863.     L2025  symbol defined more than once
  22864.  
  22865.  For example, in the diagram below, module1 contains routines "a", "b",
  22866.  and "c". The module2 contains routines "c", "d", and "e". When main()
  22867.  references "a" and "e", the linker links module1 and module2 from the
  22868.  library. This results in "c" being defined twice. Removing "c" from
  22869.  one of the modules, recompiling the module, and replacing the module
  22870.  in the library with the LIB utility operator "-+" will prevent "c"
  22871.  from being multiply defined.
  22872.  
  22873.                          +-----------+
  22874.                          |           |
  22875.                          | calls "a" |
  22876.                          | calls "e" |
  22877.                        / |           | \
  22878.                       /  +-----------+  \
  22879.                      /       main()      \
  22880.                     v                     v
  22881.                 +-------+             +-------+
  22882.                 |   a   |             |   c   |
  22883.                 |   b   |             |   d   |
  22884.                 |   c   |             |   e   |
  22885.                 |       |             |       |
  22886.                 +-------+             +-------+
  22887.                  module1               module2
  22888.  
  22889.  For each routine you want to be linked separately, compile a separate
  22890.  object file and add it to the library.
  22891.  
  22892.  
  22893.  
  22894.  
  22895.  
  22896.  
  22897.  Microsoft `M' Editor
  22898.  =============================================================================
  22899.  
  22900.  
  22901.  1. How to Put Microsoft Editor (M or MEP) into 43-Line Mode
  22902.  
  22903.  Product Version(s): 1.00   | 1.00
  22904.  Operating System:   MS-DOS | OS/2
  22905.  Flags: ENDUSER |
  22906.  Last Modified:  1-SEP-1988    ArticleIdent: Q28580
  22907.  
  22908.  To use the Microsoft Editor (M.EXE or MEP.EXE) in EGA 43-line mode,
  22909.  the TOOLS.INI file must be modified to include the following
  22910.  statement:
  22911.  
  22912.  HEIGHT:41
  22913.  
  22914.  (The number 41 is used because the last two lines are used by the
  22915.  editor as status/error lines. See Page 59 of the "Microsoft Editor for
  22916.  MS OS/2 and MS-DOS: User's Guide".)
  22917.  
  22918.  Once the TOOLS.INI is modified, the editor must be re-initialized.
  22919.  This process is done with the Initialize command. The default key
  22920.  stroke for this command is SHIFT+F8. Appendix A lists the values for
  22921.  the other .INI files provided with the editor. The following example
  22922.  demonstrates this process:
  22923.  
  22924.  1. Load TOOLS.INI.
  22925.  2. Modify TOOLS.INI.
  22926.  3. Save the file (ARG ARG SETFILE or leave and re-enter).
  22927.  4. Use the Initialize command (SHIFT+F8).
  22928.  
  22929.  After the initialization, the changes in the TOOLS.INI become active
  22930.  and the 43-line mode is in use.
  22931.  
  22932.  M.EXE runs in MS-DOS real mode, and MEP.EXE runs in OS/2 protected
  22933.  mode.
  22934.  
  22935.  
  22936.  2. Creating Macros for the Microsoft Editor
  22937.  
  22938.  Product Version(s): 1.00   | 1.00
  22939.  Operating System:   MS-DOS | OS/2
  22940.  Flags: ENDUSER |
  22941.  Last Modified:  1-SEP-1988    ArticleIdent: Q23051
  22942.  
  22943.  Macros for the Microsoft Editor are sequences of editor functions. For
  22944.  example, a macro to delete the word to the right of the cursor is
  22945.  defined as follows:
  22946.  
  22947.  worddelete:=arg meta pword sdelete
  22948.  
  22949.  The above macro is named "worddelete". To associate "worddelete" with
  22950.  a particular keystroke, the following command is needed:
  22951.  
  22952.  worddelete:ALT+W
  22953.  
  22954.  The macro "worddelete" is now bound to the keystroke "ALT+W". Note
  22955.  that the macro definition (i.e., ":=") resembles a Pascal assignment
  22956.  statement, but the keybinding uses a colon to delimit the macro name
  22957.  from the key to which it is assigned. The following is another
  22958.  example:
  22959.  
  22960.  filestamp:=curfilenam curfileext " - " curdate " " curtime
  22961.  filestamp:ALT+S
  22962.  
  22963.  This macro creates a file-time stamp that contains the filename, the
  22964.  current date, and the current time; it is assigned to the keystroke
  22965.  "ALT+S".
  22966.  
  22967.  
  22968.  3. File Size Limitations for the Microsoft Editor
  22969.  
  22970.  Product Version(s): 1.00   | 1.00
  22971.  Operating System:   MS-DOS | OS/2
  22972.  Flags: ENDUSER | TAR62237
  22973.  Last Modified: 29-AUG-1988    ArticleIdent: Q23609
  22974.  
  22975.  Question:
  22976.  
  22977.  What is the largest file the Microsoft Editor can load?
  22978.  
  22979.  Response:
  22980.  
  22981.  The size of the file is controlled by the operating system, not by
  22982.  the editor. The editor will read in a file of any number of bytes;
  22983.  however, you are limited by the temporary file space.
  22984.  
  22985.  The size of the drive pointed to by the TMP variable is the limiting
  22986.  factor. Because TMP often points to a (relatively small) RAM drive,
  22987.  such as VDISK or MS-RAMDRIVE, this is the most common file size
  22988.  limitation.
  22989.  
  22990.  A safe rule-of-thumb is that your TMP drive may need to be up to
  22991.  two times the size of the file being edited.
  22992.  
  22993.  The maximum number of lines a file can contain is 0x7FFFFFFF, but you
  22994.  will run out of disk space before you have too many lines.
  22995.  
  22996.  Both MS-DOS and OS/2 currently limit disk size (hence, file size)
  22997.  to 64K sectors, which normally is 32 megabytes.
  22998.  
  22999.  
  23000.  4. Unassigning Predefined Keys
  23001.  
  23002.  Product Version(s): 1.00   | 1.00
  23003.  Operating System:   MS-DOS | OS/2
  23004.  Flags: ENDUSER | TAR62300
  23005.  Last Modified:  1-SEP-1988    ArticleIdent: Q23754
  23006.  
  23007.  The following are two ways to unassign a predefined key:
  23008.  
  23009.  1. Assign the key to a different function.
  23010.  2. Assign the key to the "unassigned" function.
  23011.  
  23012.  If ALT+A currently is assigned to the ARG function, you can assign
  23013.  it to another function by putting the following line in your
  23014.  TOOLS.INI file:
  23015.  
  23016.  NewFunct:ALT+A
  23017.  
  23018.  If you don't want ALT+A to be assigned to any function, place the following
  23019.  line in your TOOLS.INI file:
  23020.  
  23021.  Unassigned:ALT+A.
  23022.  
  23023.  
  23024.  5. Error C1015 "Can't Open Include File" with MEP
  23025.  
  23026.  Product Version(s): 1.00
  23027.  Operating System:   OS/2
  23028.  Flags: ENDUSER | S_C buglist1.00
  23029.  Last Modified:  2-NOV-1988    ArticleIdent: Q35140
  23030.  
  23031.  The example program below generates the following error:
  23032.  
  23033.  Error C1015 "Can't open include file"
  23034.  
  23035.  The program must be compiled with one of the output-file switches
  23036.  (such as /Fc) or through a make file to generate this error.
  23037.  
  23038.  The include file os2.h opens two other include files: os2def.h and
  23039.  bse.h. The bse.h include file, in turn, opens three other include
  23040.  files: bsedos.h, bsesub.h, and bseerr.h.
  23041.  
  23042.  Microsoft has confirmed this to be a problem in Version 1.00. We are
  23043.  researching this problem and will post new information as it becomes
  23044.  available.
  23045.  
  23046.  The compiler attempts to open the last include file and generates the
  23047.  C1015 error. The total file count at this point is 15, as follows:
  23048.  
  23049.   1. stdin
  23050.   2. stdout
  23051.   3. stdprn
  23052.   4. stderror
  23053.   5. stdaux
  23054.   6. MEP
  23055.   7. source
  23056.   8. listing file
  23057.   9. os2.h
  23058.  10. os2 def.h
  23059.  11. bse.h
  23060.  12. bsedos.h
  23061.  13. bsesub.h
  23062.  14. bseerr.h
  23063.  15. tmp file
  23064.  
  23065.  The following sample code demonstrates the problem:
  23066.  
  23067.  #define INCL_BASE
  23068.  #include <os2.h>
  23069.  
  23070.  void main (void)
  23071.  void main (void)
  23072.  {
  23073.  }
  23074.  
  23075.  
  23076.  
  23077.  6. Maximum Number of Defined Macros Allowed in TOOLS.INI File
  23078.  
  23079.  Product Version(s): 1.00   | 1.00
  23080.  Operating System:   MS-DOS | OS/2
  23081.  Flags: ENDUSER | TAR63148
  23082.  Last Modified: 17-MAY-1988    ArticleIdent: Q24696
  23083.  
  23084.  Question:
  23085.     Is there a maximum number of macros, predefined and user-defined,
  23086.  allowed in the TOOLS.INI file?
  23087.  
  23088.  Response:
  23089.     The maximum number of defined macros allowed is 1024.
  23090.  
  23091.  
  23092.  7. BRIEF TOOLS.INI File Assigns Two Commands to F5 in M.EXE
  23093.  
  23094.  Product Version(s): 1.00    | 1.00
  23095.  Operating System:   MS-DOS  | OS/2
  23096.  Flags: ENDUSER |
  23097.  Last Modified:  1-SEP-1988    ArticleIdent: Q30474
  23098.  
  23099.  Problem:
  23100.  
  23101.  After I configure the Microsoft M.EXE Editor in the BRIEF mode and
  23102.  invoke Psearch (F5 key), I receive the following error message:
  23103.  
  23104.  "Invalid argument."
  23105.  
  23106.  However, Msearch (ALT+F5) functions correctly.
  23107.  
  23108.  Response:
  23109.  
  23110.  The BRIEF TOOLS.INI file assigns two commands to F5. The first
  23111.  occurrence in the file is for Psearch and the second is for
  23112.  DeleteWindow.
  23113.  
  23114.  To correct the problem, one of the commands should be mapped to a
  23115.  different key. Make sure the new key is not already in use.
  23116.  
  23117.  The following is an example of the incorrect portion of the
  23118.  BRIEF.INI file:
  23119.  
  23120.     ; TOOLS.INI file for BRIEF(tm) configuration
  23121.     [M]
  23122.            .
  23123.            .
  23124.            .
  23125.     Psearch:F5
  23126.            .
  23127.            .
  23128.            .
  23129.     ; WINDOWS
  23130.     ;
  23131.     ; Delete Current Window is F5
  23132.     DeleteWindow:=meta window
  23133.     DeleteWindow:F5
  23134.     ;
  23135.     ;
  23136.     ;
  23137.     ; BRIEF is a trademark of UnderWare, INC.
  23138.  
  23139.  
  23140.  8. Assigning Key Sequence to ENTER and BACKSPACE Keys
  23141.  
  23142.  Product Version(s): 1.00   | 1.00
  23143.  Operating System:   MS-DOS | OS/2
  23144.  Flags: ENDUSER |
  23145.  Last Modified: 29-AUG-1988    ArticleIdent: Q25407
  23146.  
  23147.  Functions can be assigned to the ENTER and BKSP (BACKSPACE) keys in
  23148.  the TOOLS.INI file, as in the following example:
  23149.  
  23150.  emacsnewl:enter
  23151.  emacscdel:bksp
  23152.  
  23153.  Consult Chapter 6 of the "Microsoft Editor User's Guide," titled
  23154.  "Function Assignments and Macros."
  23155.  
  23156.  
  23157.  9. CALLTREE Ignores Conditional Compilation Statements in Editor
  23158.  
  23159.  Product Version(s): 1.00   | 1.00
  23160.  Operating System:   MS-DOS | OS/2
  23161.  Flags: ENDUSER | S_C H_MASM
  23162.  Last Modified: 17-MAY-1989    ArticleIdent: Q44417
  23163.  
  23164.  The CALLTREE utility provided with the Microsoft Editor can be used to
  23165.  produce a graphical call-tree listing of a project. The following
  23166.  command line is an example of this utility. This command line creates
  23167.  a file called CALLS.TXT showing the relationship of the functions
  23168.  found in the four C source files shown below:
  23169.  
  23170.     calltree /c calls.txt main.c sub1.c sub2.c sub3.c
  23171.  
  23172.  If any of the files use conditional compilation directives, these are
  23173.  disregarded by CALLTREE and any functions that would not have been
  23174.  called appear in the call listing. An example of code that produces a
  23175.  misleading call listing is shown below. Although only one set of calls
  23176.  is compiled, both sets show up in the file produced by CALLTREE.
  23177.  
  23178.      void main( void )
  23179.      {
  23180.      #ifdef DEBUG
  23181.          dshow();
  23182.          ddone();
  23183.      #else
  23184.          fshow();
  23185.          fdone();
  23186.      #endif
  23187.      }
  23188.  
  23189.  To avoid this situation, a preprocessor listing should be produced
  23190.  using the /P switch with CL, and CALLTREE should then be run on the
  23191.  resultant file.
  23192.  
  23193.  This is a limitation of the utility. CALLTREE is meant to be a
  23194.  general-purpose tool for C and assembly programs, and is not designed
  23195.  to do any parsing or syntax checking.
  23196.  
  23197.  
  23198.  10. Microsoft Editor Fails to Find TOOLS.INI Using DOS Version 2.x
  23199.  
  23200.  Product Version(s): 1.00
  23201.  Operating System:   MS-DOS
  23202.  Flags: ENDUSER |
  23203.  Last Modified: 20-OCT-1988    ArticleIdent: Q28590
  23204.  
  23205.  Problem:
  23206.  
  23207.  When running the M.EXE editor under DOS Versions 2.x, the editor does
  23208.  not find the TOOLS.INI file. The error reported is "Unable to Read
  23209.  TOOLS.INI[]".
  23210.  
  23211.  The following demonstrates the problem:
  23212.  
  23213.  1. Rename QUICK.INI to TOOLS.INI.
  23214.  2. Set the environment variable INIT to the directory c:\mytools
  23215.     as follows:
  23216.  
  23217.     SET INIT=c:\mytools
  23218.  
  23219.  3. Load the M.EXE editor. It will come up with default settings,
  23220.     instead of reading TOOLS.INI.
  23221.  
  23222.  When running DOS Version 3.20 on an IBM PC AT, M.EXE correctly finds
  23223.  the TOOLS.INI file.
  23224.  
  23225.  Response:
  23226.  
  23227.  M.EXE and MEP.EXE use their startup name to find the right section in
  23228.  TOOLS.INI. For example, if you rename the editor to Z, it will look
  23229.  for [z] instead of [m] in the editor's section in TOOLS.INI.
  23230.  
  23231.  This process occurs in all cases except under DOS Versions 2.x. Under
  23232.  any 2.x version of DOS, the name of your program is not available, and
  23233.  instead, the compiler provides the arbitrary name "C".
  23234.  
  23235.  To work around this limitation in DOS Versions 2.x, change the
  23236.  editor's tagged section in TOOLS.INI file to use the tag [c] instead
  23237.  of [m]. If it is necessary to share files with DOS Versions 3.x
  23238.  systems, the editor's section in TOOLS.INI can be tagged [m c].
  23239.  
  23240.  The editor uses the same method to name the following, where * is
  23241.  replaced by the editor name or by "C" under DOS Versions 2.x:
  23242.  
  23243.  1. The virtual memory file, *-XXXX.VM
  23244.  2. The history-and-state file, *.TMP
  23245.  3. The compiler message file, *.MSG
  23246.  
  23247.  
  23248.  11. Using Full Pathnames to Compile Programs with M or MEP
  23249.  
  23250.  Product Version(s): 1.00   | 1.00
  23251.  Operating System:   MS-DOS | OS/2
  23252.  Flags: ENDUSER | TAR75085
  23253.  Last Modified: 20-OCT-1988    ArticleIdent: Q29150
  23254.  
  23255.  The full pathname of a file is not transferred to the compiler when an
  23256.  ARG COMPILE is executed in the Microsoft Editor for MS-DOS and OS/2.
  23257.  The following is an example:
  23258.  
  23259.  1. Invoke M.EXE as follows:
  23260.  
  23261.  M \c5\source\test.c
  23262.  
  23263.  2. Compile the program with ARG COMPILE. (The default value is
  23264.     ALT+A SHIFT+F3). The following line is displayed:
  23265.  
  23266.     CL /c /Zep /D LINT_ARGS test.c
  23267.  
  23268.     The full pathname is not given.
  23269.  
  23270.  If you plan on compiling from other directories, you should define
  23271.  the compile command using the %|F option. The default option %s uses
  23272.  only the filename. For example, the TOOLS.INI file could be modified
  23273.  as follows to get the default compile with the full pathname:
  23274.  
  23275.  extmake:c cl /c /Zep /D LINT_ARGS %|F
  23276.  
  23277.  You also can select portions of the full pathname, and use the name
  23278.  more than once, as in the following example:
  23279.  
  23280.  %d|F - obtains the drive (and colon)
  23281.  %p|F - obtains the path
  23282.  %f|F - obtains the filename (no extension)
  23283.  %e|F - obtains the extension
  23284.  
  23285.  You can combine the "dpfe" any way you wish, as in the following:
  23286.  
  23287.  %dpf|F.xyz
  23288.  
  23289.  This combination produces the drive, path, and filename, with the
  23290.  extension .XYZ added to the filename.
  23291.  
  23292.  
  23293.  12. Editor "User's Guide" C-Extension Sample Generates Warnings
  23294.  
  23295.  Product Version(s): 1.00   | 1.00
  23296.  Operating System:   MS-DOS | OS/2
  23297.  Flags: ENDUSER |
  23298.  Last Modified: 12-JUL-1988    ArticleIdent: Q29730
  23299.  
  23300.  Problem:
  23301.      When I compile the sample program on Page 85 of the "Microsoft
  23302.  Editor for MS OS/2 and MS-DOS: User's Guide," I get two warning
  23303.  messages.
  23304.     These warning messages are generated on the following two sections
  23305.  of the sample program:
  23306.  
  23307.     1. struct swiDesc swiTable [] = {
  23308.              { NULL, NULL, NULL }
  23309.         };
  23310.  
  23311.     2. struct cmdDesc cmdTable [] = {
  23312.              { "Upper", Upper, 0, BOXSTR | TEXTARG },
  23313.              { NULL, NULL, NULL, NULL }
  23314.         };
  23315.  
  23316.  Response:
  23317.    These warnings will not cause a problem. You can, however, make the
  23318.  following two changes:
  23319.  
  23320.     1. struct swiDesc swiTable [] = {
  23321.              { NULL, NULL, 0 }
  23322.         };
  23323.  
  23324.     2. struct cmdDesc cmdTable [] = {
  23325.              { "Upper", Upper, 0, BOXSTR | TEXTARG },
  23326.              { NULL, NULL, 0, 0 }
  23327.         };
  23328.  
  23329.  
  23330.  13. Missing Semicolon on Line 17 of Example on Page 85 in Manual
  23331.  
  23332.  Product Version(s): 1.00   | 1.00
  23333.  Operating System:   MS-DOS | OS/2
  23334.  Flags: ENDUSER | docerr
  23335.  Last Modified: 29-AUG-1988    ArticleIdent: Q29731
  23336.  
  23337.     On Page 85 of the "Microsoft Editor for MS OS/2 and MS-DOS: User's
  23338.  Guide," there is a missing semicolon on line 17.
  23339.     The following line is incorrect:
  23340.  
  23341.     cfile = FileNameToHandle("", NULL)
  23342.  
  23343.     It should read as follows:
  23344.  
  23345.     cfile = FileNameToHandle("", NULL);
  23346.  
  23347.  
  23348.  14. M.EXE Editor Macro to Join Current Line with Next Line
  23349.  
  23350.  Product Version(s): 1.00    | 1.00
  23351.  Operating System:   MS-DOS  | OS/2
  23352.  Flags: ENDUSER |
  23353.  Last Modified: 29-AUG-1988    ArticleIdent: Q30030
  23354.  
  23355.     The following macro will join the current line with the following
  23356.  line, leaving one space between the last character on the current line
  23357.  and the first character of the next line.
  23358.     Place the following three lines in the [M] and/or [MEP] section(s)
  23359.  of your TOOLS.INI file, or enter them from the keyboard using the
  23360.  ASSIGN function (ALT+= in the default keyboard setup):
  23361.  
  23362.     ;Macro to join current line with next line.
  23363.         join:=endline right arg down begline sdelete
  23364.         join:alt+j
  23365.  
  23366.     The following is a description of how the join macro works:
  23367.  
  23368.     1. Endline moves one place beyond the last character on the current
  23369.        line.
  23370.     2. Right moves one character further, to insert a space.
  23371.     3. arg introduces the argument to the next command (in this case,
  23372.        sdelete).
  23373.     4. down begline moves to the first character on the next line.
  23374.  
  23375.     This process defines a Streamarg for the command sdelete (S stands
  23376.  for Stream).
  23377.     Note that sdelete should be used, not ldelete, because the down
  23378.  begline sequence would have defined either a Linearg or a Boxarg,
  23379.  neither of which would join the lines.
  23380.     Use sdelete because it closes the stream of characters and/or white
  23381.  space between the starting cursor position and the ending cursor
  23382.  position.
  23383.  
  23384.  
  23385.  15. Microsoft Editor Macro Moves Text with TAB Key
  23386.  
  23387.  Product Version(s): 1.00   | 1.00
  23388.  Operating System:   MS-DOS | OS/2
  23389.  Flags: ENDUSER |
  23390.  Last Modified:  6-JAN-1989    ArticleIdent: Q30033
  23391.  
  23392.  The TAB key only moves the cursor. It does not move both the cursor
  23393.  and the text under the cursor (as it does in QuickC, Word, and many
  23394.  other editors).
  23395.  
  23396.  To move text and the cursor, put the following macro in your TOOLS.INI
  23397.  file in the [M] and/or [MEP] section(s):
  23398.  
  23399.     ;Macro to tab with insertion, as in QuickC and Word
  23400.         emacstab:=arg tab sinsert tab
  23401.         emacstab:ctrl+tab
  23402.  
  23403.  The "emacstab" macro (there is no significance to the name other than
  23404.  its similarity to M.EXE's EMACSNEWL and EMACSDEL functions) is invoked
  23405.  by pressing CTRL+TAB.
  23406.  
  23407.  Note: assigning this macro to CTRL+TAB will only function on
  23408.  enhanced-style keyboards. Older-style keyboards must use another set
  23409.  of keys for this macro assignment. On the older keyboards, assigning
  23410.  this macro to CTRL+TAB causes the macro to be ignored.
  23411.  
  23412.  The emacstab macro functions as follows:
  23413.  
  23414.  1. The Arg command introduces the argument (in this case, a
  23415.     "stream" arg).
  23416.  
  23417.  2. The Tab command moves you one tab stop to the right.
  23418.  
  23419.  3. The Sinsert command moves the highlighted text over to the tab
  23420.     stop.
  23421.  
  23422.  This macro leaves your cursor back where it started, so one more TAB
  23423.  moves your cursor to the right (on top of the shifted text).
  23424.  
  23425.  
  23426.  16. C Extension to Make Psearch Prompt for an Input in M.EXE
  23427.  
  23428.  Product Version(s): 1.00
  23429.  Operating System:   OS/2
  23430.  Flags: ENDUSER |
  23431.  Last Modified: 23-MAY-1988    ArticleIdent: Q30285
  23432.  
  23433.  Question:
  23434.     I wish to emulate the Brief Psearch (Plus Search) with the M.EXE
  23435.  editor. I want Psearch to prompt me to enter a search string. Can this
  23436.  be done with a macro or do I have to use a Microsoft C extension?
  23437.  
  23438.  Response:
  23439.      This emulation cannot be done with macros. However, it can be done
  23440.  with Microsoft C extensions.
  23441.      The following is an example of how to do so in a Microsoft C
  23442.  extension:
  23443.  
  23444.      1. Use DoMessage() to output a string saying something similar to
  23445.  the following:
  23446.  
  23447.      "Please enter the search string:"
  23448.  
  23449.      2. Use KbUnHook() to disable M.EXE's "logical keyboard." This
  23450.  gives you the "focus" of the keyboard so that keyboard input is no
  23451.  longer read by the editor, thus freeing you to input a string from the
  23452.  user.
  23453.      3. Parse the keyboard input and then process it appropriately by
  23454.  invoking the Psearch function.
  23455.      4. Use KbHook() to reenable the logical keyboard in M.
  23456.  
  23457.      The following is an alternate method:
  23458.  
  23459.      Use "ReadChar()" instead of "KbUnHook()" and "KbHook()."
  23460.  (Mentioned in steps two and four above.)
  23461.  
  23462.      For more information on the functions available for writing C
  23463.  extensions, please read the files EXT.DOC and EXT.H that are included
  23464.  with the Microsoft Editor Version 1.00.
  23465.      For general information on programming C extensions, please
  23466.  consult Chapter 8 of the "Microsoft Editor User's Guide."
  23467.      Appendix A of the "Microsoft Editor User's Guide" provides a
  23468.  comprehensive list of editing functions such as Psearch.
  23469.      Psearch searches forward for the previously defined string or
  23470.  pattern. Msearch (Minus Search) searches backward for the previously
  23471.  defined string or pattern.
  23472.  
  23473.  
  23474.  17. Debug Shown on M.EXE Help Screen Is Not a Supported Switch
  23475.  
  23476.  Product Version(s): 1.00   | 1.00
  23477.  Operating System:   MS-DOS | OS/2
  23478.  Flags: ENDUSER | docerr
  23479.  Last Modified: 15-JUN-1988    ArticleIdent: Q30365
  23480.  
  23481.     The Debug numeric switch that appears in the information file of
  23482.  the help screen in the Microsoft Editor Version 1.00 has not been
  23483.  implemented.
  23484.     There is no function associated with Debug.
  23485.  
  23486.  
  23487.  18. M.EXE C Extensions Documented in UTILITY.DOC, Not README.DOC
  23488.  
  23489.  Product Version(s): 1.00
  23490.  Operating System:   OS/2
  23491.  Flags: ENDUSER | docerr
  23492.  Last Modified: 26-MAY-1988    ArticleIdent: Q30534
  23493.  
  23494.     Page 70 of the "Microsoft Editor User's Guide" incorrectly states
  23495.  the following:
  23496.  
  23497.     "To create a successful C extension, you need to follow these
  23498.  guidelines:
  23499.         1. Check the README.DOC file to see what functions you can call
  23500.  from the standard C run-time library."
  23501.  
  23502.     Contrary to the above manual statement, C extensions are documented
  23503.  in UTILITY.DOC on the release disk, not in the README.DOC.
  23504.  
  23505.  
  23506.  
  23507.  19. Making Assignments to PLUS, MINUS and PRINT SCREEN Keys
  23508.  
  23509.  Product Version(s): 1.00   | 1.00
  23510.  Operating System:   MS-DOS | OS/2
  23511.  Flags: ENDUSER | tar66615
  23512.  Last Modified:  1-SEP-1988    ArticleIdent: Q31485
  23513.  
  23514.  It is possible to make key assignments to the PLUS, MINUS, and
  23515.  PRINT SCREEN keys on the numeric keypad.
  23516.  
  23517.  For more information on function assignments, macros, and keystrokes,
  23518.  consult section 6.2.1 of "The Microsoft Editor User's Guide."
  23519.  
  23520.  
  23521.  20. How to Load a C Extension that Is Not in Current Directory
  23522.  
  23523.  Product Version(s): 1.00
  23524.  Operating System:   OS/2
  23525.  Flags: ENDUSER | TAR75933 docerr
  23526.  Last Modified:  8-JUN-1988    ArticleIdent: Q30826
  23527.  
  23528.     Page 84 of the "Microsoft Editor for OS/2 and MS-DOS User's Guide"
  23529.  incorrectly infers that the M.EXE editor will search for a C-extension
  23530.  module along the DOS PATH under MS-DOS or OS/2 real mode when you
  23531.  place the following statement in the TOOLS.INI file:
  23532.  
  23533.     load:myext.exe
  23534.  
  23535.     To search for a C-extension module along the DOS PATH, you must
  23536.  instead use the following load switch syntax in the TOOLS.INI file:
  23537.  
  23538.     load:{$ENVAR: | dos path}filename.ext
  23539.  
  23540.  where you have the option of using $ENVAR: (a DOS environment
  23541.  variable) or an explicit directory path specification.
  23542.     You can prefix your filename with $PATH: or $INIT:. For example,
  23543.  "$PATH:filename.ext" means the "filename.ext" is to be found in the
  23544.  directories in the DOS PATH. This format is valid in any filename
  23545.  context. The following example will go to the STDIO.H file that
  23546.  actually is being used by the compiler:
  23547.  
  23548.     <arg> "$INCLUDE:stdio.h" <setfile>
  23549.  
  23550.     Also, when operating under OS/2, $ENVAR:, the explicit DOS path,
  23551.  and the extension on the filename are ignored. Instead, filename.DLL
  23552.  is searched for in your LIBPATH. Please note that LIBPATH under OS/2
  23553.  is not an environment variable. LIBPATH is a directive in the
  23554.  CONFIG.OS2 file.
  23555.     The following are examples of using the load switch in TOOLS.INI:
  23556.  
  23557.     ; load 'my.ext' from the current directory.
  23558.     ; Under OS/2, load my.dll from LIBPATH.
  23559.     load:my.ext
  23560.  
  23561.     ; load 'your.ext' from either the current directory or one
  23562.     ; of the directories on path
  23563.     ; Under OS/2, load 'your.dll' from LIBPATH
  23564.     load:$PATH:your.ext
  23565.  
  23566.     ; load 'c:\init\ourext'.
  23567.     ; Under OS/2, load 'ourext.dll' from LIBPATH
  23568.     load:c:\init\ourext
  23569.  
  23570.  
  23571.  
  23572.  21. An Example Where a Protect Mode C Extension Will Not Load
  23573.  
  23574.  Product Version(s): 1.00
  23575.  Operating System:   OS/2
  23576.  Flags: ENDUSER | TAR76121 TAR76251
  23577.  Last Modified:  8-JUN-1988    ArticleIdent: Q30827
  23578.  
  23579.  Problem:
  23580.     I am trying to create an extension to the MEP.EXE editor. I am
  23581.  unable to get the editor to load my C extension. To simplify things I
  23582.  tried to get the editor to load the sample SKEL; however, I was
  23583.  unsuccessful. I receive the following error messages when loading:
  23584.  
  23585.     "cannot load skel - invalid argument"
  23586.     "skel is an illegal setting"
  23587.  
  23588.     My LIBPATH is c:\os2\dll and skel.dll is placed there. If skel.dll
  23589.  is not in my libpath I would get the error "no such file or
  23590.  directory". My MAKE and DEF files for SKEL are as follows:
  23591.  
  23592.  SKEL MAKE FILE
  23593.  #
  23594.  # Makefile for the MEP Editor Extensions
  23595.  #
  23596.  SYS=\os2\dll
  23597.  
  23598.  .c.obj:
  23599.   cl -c -Gs -Asfu -G2 -Lp $*.c
  23600.  
  23601.  .obj.dll:
  23602.   link  /NOI /NOD exthdrp.obj $*.obj,$*.dll,nul.map,,$*.def;
  23603.  
  23604.  skel.obj:    skel.c skel
  23605.  
  23606.  skel.dll:    skel.obj skel.def
  23607.  
  23608.  $(SYS)\skel.dll:  skel.dll
  23609.         copy skel.dll $(SYS)
  23610.  
  23611.  SKEL DEF FILE
  23612.  
  23613.  LIBRARY  SKEL
  23614.  
  23615.  EXPORTS
  23616.   _ModInfo
  23617.   SKEL
  23618.  
  23619.  Response:
  23620.     The extension is not loaded because the DEF file is incorrect. The
  23621.  file should be as follows:
  23622.  
  23623.  SKEL.DEF:
  23624.     LIBRARY
  23625.  
  23626.     EXPORTS
  23627.             _ModInfo
  23628.             EntryPoint
  23629.  
  23630.     This file should be used with all the extensions that are written.
  23631.  It need not be modified.
  23632.  
  23633.  
  23634.  
  23635.  22. Tags Let You Use the Same TOOLS.INI File for M and MEP
  23636.  
  23637.  Product Version(s): 1.00
  23638.  Operating System:   OS/2
  23639.  Flags: ENDUSER | TAR76127
  23640.  Last Modified:  8-JUN-1988    ArticleIdent: Q30828
  23641.  
  23642.  Question:
  23643.     I have the same commands for M and for MEP. I want to load the
  23644.  QUICKHELP utility if I am running OS/2. However, in my TOOLS.INI file,
  23645.  if I put in the following information, MEP never reads the rest of
  23646.  the TOOL.INI file:
  23647.  
  23648.     [mep]
  23649.      load:qhmep
  23650.     [m mep]
  23651.      rest of the commands
  23652.      .
  23653.      .
  23654.  
  23655.     How should I do this without making two (almost identical) files,
  23656.  one for [m] and one for [mep]?
  23657.  
  23658.  Response:
  23659.     Through the use of tags, it is possible to use the same TOOLS.INI
  23660.  file in both protect mode and real mode/DOS. The tag must specify the
  23661.  program name along with the version of the operating system as in the
  23662.  following example:
  23663.  
  23664.     [m-3.2]    => MS-DOS 3.2
  23665.     [m-10.0]   => OS/2 1.0 protect mode
  23666.     [m-10.0R]  => OS/2 1.0 real mode
  23667.     [m-10.10]  => OS/2 1.1 protect mode
  23668.     [m-10.10R] => OS/2 1.1 real mode
  23669.  
  23670.     The following change should be made to your TOOLS.INI file:
  23671.  
  23672.         [m mep]
  23673.                  commands that are non operating system dependent
  23674.              .
  23675.              .
  23676.              .
  23677.  
  23678.         [mep-10.0]
  23679.              load:qhmep
  23680.  
  23681.     The number used in the tag is the major and minor version number of
  23682.  of the operating system being used. Under OS/2 this information can be
  23683.  found by calling the API routine DosGetVersion. The call can be made
  23684.  from any language that supports the use of the API,including C Version
  23685.  5.10, MASM Version 5.10, FORTRAN Version 4.10, PASCAL Version 4.10,
  23686.  and BASCOM Version 6.00. Under DOS, this information is displayed with
  23687.  the DOS VER command.
  23688.  
  23689.  
  23690.  23. Setting TMPSAV in TOOLS.INI file; M.TMP Cannot Be Suppressed
  23691.  
  23692.  Product Version(s): 1.00
  23693.  Operating System:   OS/2
  23694.  Flags: ENDUSER | TAR76606
  23695.  Last Modified:  8-JUN-1988    ArticleIdent: Q30829
  23696.  
  23697.  Question:
  23698.     How do I get the Microsoft Editor (both ME and MEP) to not create
  23699.  and use the M.TMP to record past editing sessions?
  23700.     I have tried setting the switch tmpsave:0 in the TOOLS.INI file,
  23701.  but this does not solve the problem. Is there some other switch I have
  23702.  not set properly or a way to exit without creating M.TMP?
  23703.  
  23704.  Response:
  23705.     There is no way to prevent the creation of the temporary file.
  23706.     The TMPSAV switch is used to control the maximum number of files
  23707.  about which information is kept between editing sessions. This
  23708.  information includes the cursor position and window layouts.
  23709.     When you edit one of these files again, the screen starts up as you
  23710.  left it. The default value is 20. If TMPSAV is set to 0, it causes all
  23711.  files to be saved. All other numeric values refer to the number of
  23712.  files that will be saved. The /t option specifies that any files
  23713.  edited are temporary; they are not saved in the M.TMP file.
  23714.  
  23715.  
  23716.  
  23717.  24. Protected-Mode C Extensions Fail with "Protection Fault"
  23718.  
  23719.  Product Version(s): 1.00 | 1.00
  23720.  Operating System:   MS-DOS | OS/2
  23721.  Flags: ENDUSER | docerr
  23722.  Last Modified: 29-AUG-1988    ArticleIdent: Q31009
  23723.  
  23724.  Problem:
  23725.     I am writing C extensions for the protected mode of OS/2. All my
  23726.  extensions fail with a general-protection fault. The sample program on
  23727.  Page 85 of the "Microsoft Editor for MS OS/2 and MS-DOS: User's Guide"
  23728.  also fails.
  23729.  
  23730.  Response:
  23731.     Page 78 of the "Microsoft Editor for MS OS/2 and MS-DOS: User's
  23732.  Guide" incorrectly states that the second argument is a NULL pointer.
  23733.     The programs are crashing because the incorrect value is being
  23734.  passed to the FileNameToHandle routine. This routine requires a
  23735.  pointer to a null string, not a null pointer.
  23736.     For example, the following statement
  23737.  
  23738.     cfile=FileNameTohandle("",NULL);
  23739.  
  23740.  should read as follows:
  23741.  
  23742.     cfile=FileNameTohandle("","");
  23743.  
  23744.  
  23745.  25. Two Toned Colors in <assign> Pseudo File Can Occur
  23746.  
  23747.  Product Version(s): 1.02    | 1.02
  23748.  Operating System:   MS-DOS  | OS/2
  23749.  Flags: ENDUSER | buglist1.02
  23750.  Last Modified: 29-JAN-1990    ArticleIdent: Q58029
  23751.  
  23752.  The <assign> pseudo file can consist of lines in blocks that alternate
  23753.  in color starting at the middle of the file. This appears as if you've
  23754.  changed multiple editor options, which have just been activated, when
  23755.  no changes were actually made. This does not affect the way M.EXE (or
  23756.  MEP.EXE) operates.
  23757.  
  23758.  To see the blocks of alternating color, follow the steps below:
  23759.  
  23760.  1. Invoke the editor.
  23761.  
  23762.  2. Press ALT+A <ASSIGN> F2, which implies ARG <ASSIGN> SETFILE.
  23763.  
  23764.  3. Press ALT+BACKSPACE, which implies UNDO.
  23765.  
  23766.  4. Press F9 ALT+BACKSPACE, which implies META UNDO.
  23767.  
  23768.  5. Page down until you see the colored blocks.
  23769.  
  23770.  Microsoft has confirmed this to be a problem with the Microsoft Editor
  23771.  Version 1.02. We are researching this problem and will post new
  23772.  information here as it becomes available.
  23773.  
  23774.  
  23775.  26. Return Type for ReadCmd Is PSWI, Not PCMD
  23776.  
  23777.  Product Version(s): 1.00 | 1.00
  23778.  Operating System:   OS/2 | MS-DOS
  23779.  Flags: ENDUSER | docerr
  23780.  Last Modified: 12-JAN-1989    ArticleIdent: Q31143
  23781.  
  23782.  Page 7 of the EXT.DOC file, located in the SOURCE\ME\EXT directory of
  23783.  the Microsoft C Optimizing Compiler Version 5.10, incorrectly lists
  23784.  the return type for the ReadCmd command as being PCMD.
  23785.  
  23786.  The correct return type is PSWI, which is documented in the EXT.H
  23787.  file.
  23788.  
  23789.  
  23790.  27. MEP Crashes OS/2 when Switching from Real-Mode Screen Group
  23791.  
  23792.  Product Version(s): 1.00   | 1.00
  23793.  Operating System:   MS-DOS | OS/2
  23794.  Flags: ENDUSER |  TAR75546 TAR76522
  23795.  Last Modified: 28-OCT-1988    ArticleIdent: Q31144
  23796.  
  23797.  When running in OS/2 protected mode, the system may crash when
  23798.  switching between protected mode and real mode and using the ALT+ESC
  23799.  sequence. It may take several iterations of ALT+ESC before the failure
  23800.  occurs.
  23801.  
  23802.  The system crashes when switching from the real-mode session into a
  23803.  protected-mode session that is running MEP. When the system crash
  23804.  occurs, the following message appears:
  23805.  
  23806.      TRAP 000D
  23807.  
  23808.      <register contents>
  23809.  
  23810.      The system detected an internal processing error
  23811.      at location # 3430:0590
  23812.      Exception while in kernel mode
  23813.  
  23814.      The system is stopped
  23815.  
  23816.  This is not a problem in MEP; it is a problem in OS/2.
  23817.  
  23818.  You can work around this problem by not running MEP in the original
  23819.  ("default") protected-mode screen group. Instead, start a second
  23820.  protected-mode screen group and run MEP there. To move to the second
  23821.  protected-mode screen group, do the following:
  23822.  
  23823.  1. Press ALT+ESC from real mode to get to the original
  23824.     protected-mode screen group.
  23825.  
  23826.  2. Press ALT+ESC again to get to the MEP screen group.
  23827.  
  23828.  Running MEP in a second screen group prevents you from switching
  23829.  directly from real mode into the MEP screen group.
  23830.  
  23831.  Another workaround for this problem is to use the CTRL+ESC hotkey
  23832.  rather than the ALT+ESC command to leave the real-mode screen group.
  23833.  The CTRL+C hotkey brings you back to the program selector. Once
  23834.  there, you can select the next screen group by using the mouse or
  23835.  cursor keys.
  23836.  
  23837.  
  23838.  28. "Unable to Read TOOLS.INI" Message Appears in OS/2 with MEP
  23839.  
  23840.  Product Version(s): 1.00
  23841.  Operating System:   OS/2
  23842.  Flags: ENDUSER |
  23843.  Last Modified:  8-JUN-1988    ArticleIdent: Q31155
  23844.  
  23845.      MEP.EXE, the OS/2 version of the Microsoft editor, will give the
  23846.  following message when the INITIALIZE function is invoked (i.e.,
  23847.  SHIFT-F8 in the default keyboard setup):
  23848.  
  23849.     "Unable to read TOOLS.INI"
  23850.  
  23851.     This message will appear if the editor's name is left as MEP while
  23852.  the TOOLS.INI tag for the editor is labeled [M]. The two names must
  23853.  match.
  23854.     To correct the problem, either rename the editor to M, or label the
  23855.  tag [MEP].
  23856.     The tag can be set to [M MEP] if you wish to use the same TOOLS.INI
  23857.  settings for both real-mode and protected-mode versions of the editor.
  23858.  
  23859.  
  23860.  29. Purpose of ECH.EXE with the Microsoft Editor
  23861.  
  23862.  Product Version(s): 1.00
  23863.  Operating System:   OS/2
  23864.  Flags: ENDUSER |
  23865.  Last Modified:  8-JUN-1988    ArticleIdent: Q31280
  23866.  
  23867.     ECH.EXE is used by the editor to generate the list of files you
  23868.  receive when you do <arg> "*.C" <setfile>.
  23869.  
  23870.  
  23871.  
  23872.  30. NOSOFTCR Parameter in TOOLS.INI Disables Auto Indentation
  23873.  
  23874.  Product Version(s): 1.00
  23875.  Operating System:   OS/2
  23876.  Flags: ENDUSER | tar69375
  23877.  Last Modified: 14-JUN-1988    ArticleIdent: Q31486
  23878.  
  23879.     The automatic indentation at the beginning of lines can be
  23880.  disabled.
  23881.     The NOSOFTCR parameter prohibits the Microsoft Editor from making
  23882.  indentation "guesses." NOSOFTCR is specified in the TOOLS.INI file, as
  23883.  follows:
  23884.  
  23885.     nosoftcr:
  23886.  
  23887.  
  23888.  
  23889.  31. Features Supported when Editing TextArgs in Microsoft Editor
  23890.  
  23891.  Product Version(s): 1.00
  23892.  Operating System:   OS/2
  23893.  Flags: ENDUSER | tar69726
  23894.  Last Modified:  6-JAN-1989    ArticleIdent: Q31487
  23895.  
  23896.  When editing TextArgs, not all editing features are supported. The
  23897.  following features are supported:
  23898.  
  23899.  QUOTE, INSERT, SDELETE, RIGHT, LEFT, UP, DOWN, HOME, and END
  23900.  
  23901.  When an unsupported feature is entered, the editor will beep. Macros
  23902.  may be used, but they can contain only supported features.
  23903.  
  23904.  The END key allows you to find the length of the search/replace
  23905.  string; pressing ARG clears the entire string.
  23906.  
  23907.  
  23908.  32. UTILITY.DOC: Filetab Switch Expands Tabs
  23909.  
  23910.  Product Version(s): 1.00 | 1.00
  23911.  Operating System:   OS/2 | MS-DOS
  23912.  Flags: ENDUSER | tar71845
  23913.  Last Modified: 16-JUN-1988    ArticleIdent: Q31488
  23914.  
  23915.     Information about the filetab switch can be found in the
  23916.  UTILITY.DOC file that comes with the Microsoft BASIC Compiler Version
  23917.  6.00, the Microsoft C Compiler Version 5.10, the Microsoft FORTRAN
  23918.  Compiler Version 4.10 and the README.DOC for Microsoft MASM Version
  23919.  5.10.
  23920.     The filetab switch is a numeric switch that determines how the
  23921.  editor translates tabs when loading a file into memory. The value of
  23922.  the switch gives the number of spaces associated with each tab column.
  23923.     For example, the setting "filetab:4" assumes a tab column every four
  23924.  positions on each line of a file.
  23925.     Every time the editor finds a tab character in a file, it loads the
  23926.  buffer with the number of spaces necessary to get to the next tab
  23927.  column. Depending on the value of the entab switch, the editor also
  23928.  uses the filetab switch to determine how to convert spaces into tabs
  23929.  when writing a file.
  23930.     The default value of filetab is eight (8).
  23931.  
  23932.  
  23933.  
  23934.  33. Tabs Expanded to Eight Spaces; Filetab Switch Changes Spacing
  23935.  
  23936.  Product Version(s): 1.00   | 1.00
  23937.  Operating System:   MS-DOS | OS/2
  23938.  Flags: ENDUSER | Tar70793
  23939.  Last Modified:  1-SEP-1988    ArticleIdent: Q31489
  23940.  
  23941.  Question:
  23942.  
  23943.  Why are tabs expanded to eight spaces even though I set the tabstop
  23944.  variable and the entab switch?
  23945.  
  23946.  Response:
  23947.  
  23948.  Neither the tabstops or the entab switch affect how tabs are expanded
  23949.  when the file is read. The filetab switch is used to determine how
  23950.  many spaces to expand each tab. For example, "filetab:4" will expand
  23951.  each tab in the file to four spaces.
  23952.  
  23953.  The entab switch controls how the editor converts multiple spaces
  23954.  into tabs when a line is changed or a file is saved. The default is
  23955.  one (1). The following chart shows different values and their
  23956.  meanings:
  23957.  
  23958.  Value   Meaning
  23959.  
  23960.  0       Tabs are not used to represent white space.
  23961.  1       All multiple spaces outside of quoted strings
  23962.          are converted to tabs (default).
  23963.  2       All multiple spaces are converted to tabs.
  23964.  
  23965.  Tabstops control the number of spaces between each logical tabstop
  23966.  for the editor. The default is four (4).
  23967.  
  23968.  
  23969.  34. Resizing Windows
  23970.  
  23971.  Product Version(s): 1.00   | 1.00
  23972.  Operating System:   MS-DOS | OS/2
  23973.  Flags: ENDUSER | tar63957
  23974.  Last Modified:  1-SEP-1988    ArticleIdent: Q31490
  23975.  
  23976.  It is not possible to directly resize windows in the Microsoft Editor.
  23977.  A window can only be opened or closed. To resize a window, it must be
  23978.  closed and then reopened. Direct resizing of windows is not currently
  23979.  possible.
  23980.  
  23981.  This feature is under review and will be considered for inclusion in a
  23982.  future release.
  23983.  
  23984.  
  23985.  35. Parentheses Matching in Microsoft Editor; Arg Meta PBal
  23986.  
  23987.  Product Version(s): 1.00
  23988.  Operating System:   OS/2
  23989.  Flags: ENDUSER | tar63957
  23990.  Last Modified: 31-OCT-1988    ArticleIdent: Q31491
  23991.  
  23992.  The Microsoft Editor has the capability of matching parentheses
  23993.  without altering the current file. Meta PBal prevents the file from
  23994.  being edited while balancing parentheses and brackets.
  23995.  
  23996.  The following are various other options for Pbal:
  23997.  
  23998.  1. Pbal: Scan backwards through the file, balancing parentheses and
  23999.     brackets. The first unbalanced one is highlighted when found. If it
  24000.     is found and is not visible, the editor displays the matching line,
  24001.     with the highlighted matching character. Note that the search does
  24002.     not include the current cursor position, and that the scan only
  24003.     looks for more left brackets or parentheses than right, not just an
  24004.     unequal amount.
  24005.  
  24006.  2. Arg Pbal: Performs similarly to Pbal, except that it scans
  24007.     forward in the file and looks for more right brackets or parentheses
  24008.     than left.
  24009.  
  24010.  3. Arg Meta Pbal: Performs similarly to Arg Pbal except that the
  24011.     file is not updated.
  24012.  
  24013.  
  24014.  36. Editing Nonexisting Files with the Microsoft Editor
  24015.  
  24016.  Product Version(s): 1.00
  24017.  Operating System:   OS/2
  24018.  Flags: ENDUSER | tar62913
  24019.  Last Modified: 16-JUN-1988    ArticleIdent: Q31492
  24020.  
  24021.     If the Microsoft Editor is invoked to edit a nonexisting file, it
  24022.  creates a file with a length of zero in the DELETED directory in
  24023.  addition to creating a new file. This occurs with the backup switch
  24024.  set to "undel" (the default) in the TOOLS.INI file.
  24025.     This behavior is expected and is program design for the product.
  24026.  When the Microsoft Editor is invoked to edit an existing file, the
  24027.  previous version is moved to the DELETED directory.
  24028.     The EXP command allows you to remove this file, and all other files
  24029.  from the DELETED directory.
  24030.  
  24031.  
  24032.  
  24033.  37. Macro to Toggle HOME Key
  24034.  
  24035.  Product Version(s): 1.00
  24036.  Operating System:   OS/2
  24037.  Flags: ENDUSER | tar66615
  24038.  Last Modified: 12-JAN-1989    ArticleIdent: Q31493
  24039.  
  24040.  You can create a macro to do the following:
  24041.  
  24042.  1. Press HOME key (cursor goes to beginning of line).
  24043.  
  24044.  2. Press HOME key again (cursor goes to top of window).
  24045.  
  24046.  3. Press HOME key again (cursor goes to top of buffer).
  24047.  
  24048.  This technique usually is used to create a toggle key, but it is
  24049.  equally applicable to the desired three-step toggle. The technique is
  24050.  as follows:
  24051.  
  24052.  home1:= begline arg "home2:f10" assign
  24053.  home2:= home arg "home3:f10" assign
  24054.  home3:= mark arg "home1:f10" assign
  24055.  home1:f10
  24056.  
  24057.  After following this procedure, the F10 key will toggle among begline,
  24058.  home, and mark.
  24059.  
  24060.  
  24061.  38. Inserting Time and Date into Files
  24062.  
  24063.  Product Version(s): 1.00   | 1.00
  24064.  Operating System:   MS-DOS | OS/2
  24065.  Flags: ENDUSER |
  24066.  Last Modified:  1-MAY-1989    ArticleIdent: Q40176
  24067.  
  24068.  To write a macro to insert the time and date into your file, use the
  24069.  following insert commands:
  24070.  
  24071.     Command     Action
  24072.  
  24073.     Curdate     Inserts current date
  24074.     Curday      Inserts current day of the week
  24075.     Curfile     Inserts current filename
  24076.     Curfileext  Inserts current file extension
  24077.     Curfilenam  Inserts base name of current file
  24078.     Curtime     Inserts current time
  24079.     Curuser     Inserts name specified in USER environment variable
  24080.  
  24081.  The following macro can be inserted into your TOOLS.INI to insert the
  24082.  filename, time, and date:
  24083.  
  24084.  ;Macro for time and date.
  24085.      Header:= Curfilenam tab Curtime tab Curdate
  24086.      Header:Alt+H
  24087.  
  24088.  
  24089.  39. Macro to Enter Form Feed or Control Characters in Editor
  24090.  
  24091.  Product Version(s): 1.00 | 1.00
  24092.  Operating System:   DOS  | OS/2
  24093.  Flags: ENDUSER | tar62237
  24094.  Last Modified:  1-NOV-1988    ArticleIdent: Q31495
  24095.  
  24096.  The form-feed characters and control characters below can be entered
  24097.  in a file being edited by the Microsoft Editor.
  24098.  
  24099.  The following macro inserts a linefeed, (CTRL+L), and a newline, and
  24100.  binds it to the F6 key. To enter a CTRL+L, use the Graphic assignment
  24101.  on Page 48 of the "Microsoft Editor User's Guide" when editing your
  24102.  TOOLS.INI file:
  24103.  
  24104.  graphic:ctrl+l
  24105.  
  24106.  FFM:="L" newline   ; Instead of the L shown here, insert a CTRL+L
  24107.  FFM:F6             ; with the quote function "CTRL+P CTRL+L"
  24108.  
  24109.  The macro below allows you to enter control key values. The
  24110.  following line binds "quote" to F5. Quote allows you to enter any key
  24111.  as input (i.e., control key values, etc). This means if you type "F5"
  24112.  followed by a "CTRL+X", you will see a "\030" instead of "arg":
  24113.  
  24114.  quote:F5.
  24115.  
  24116.  
  24117.  40. "Unsupported Video Mode" When Loading Microsoft Editor
  24118.  
  24119.  Product Version(s): 1.00 1.02 | 1.00 1.02
  24120.  Operating System:   MS-DOS    | OS/2
  24121.  Flags: ENDUSER |
  24122.  Last Modified: 28-JUL-1989    ArticleIdent: Q31498
  24123.  
  24124.  It is possible when loading M.EXE or MEP.EXE to receive an
  24125.  "Unsupported video mode, please change modes and restart" error
  24126.  message. This message may mean that the hardware is not supported.
  24127.  
  24128.  Graphics cards supported in this situation include IBM's CGA, EGA,
  24129.  MCGA, MDPA, and VGA and the Hercules card. An example of an
  24130.  unsupported system is the 8514 video adapter.
  24131.  
  24132.  In MS-DOS (or OS/2 real mode), the Microsoft Editor (M) supports the
  24133.  8514/A graphics card, but in OS/2 protected mode, MEP Version 1.00
  24134.  does not support this graphics card. A "video mode not supported"
  24135.  error message occurs in protected mode.
  24136.  
  24137.  The Microsoft Editor Version 1.02 supports the 8514/A graphics card in
  24138.  both real and protected mode. This version is currently available with
  24139.  FORTRAN 5.00.
  24140.  
  24141.  
  24142.  41. Environment Variables Used by the Microsoft Editor
  24143.  
  24144.  Product Version(s): 1.00
  24145.  Operating System:   OS/2
  24146.  Flags: ENDUSER |
  24147.  Last Modified: 16-JUN-1988    ArticleIdent: Q31547
  24148.  
  24149.     The Microsoft Editor uses the following environment variables:
  24150.  
  24151.     1. TMP: This directory stores all temporary files.
  24152.     2. INIT: This directory stores the TOOLS.INI, M.TMP, and temporary
  24153.  files if TMP is not set.
  24154.  
  24155.     Please note, if neither environment variable is set, all temporary
  24156.  files except M.TMP are written to the root directory of the disk being
  24157.  used. M.TMP is written to the current directory.
  24158.     The environment variables usually are set in the AUTOEXEC.BAT file.
  24159.  For example the following lines can be placed in the AUTOEXEC.BAT
  24160.  file:
  24161.  
  24162.      SET INIT=c:\init
  24163.      SET TMP=c:\temp
  24164.  
  24165.     Also, if the TMP environment variable ends with a semicolon, the
  24166.  temporary files (i.e., swapping files) will not be created. The editor
  24167.  will try to use the semicolon in the name of the file that is created.
  24168.  
  24169.  
  24170.  42. Editor Utilities DOS Version 2.x and 8086/8 Corrections
  24171.  
  24172.  Product Version(s): 1.00
  24173.  Operating System:   OS/2
  24174.  Flags: ENDUSER | appnote
  24175.  Last Modified:  6-JAN-1989    ArticleIdent: Q31801
  24176.  
  24177.  The following files are included in this application note:
  24178.  
  24179.     MEGREP.EXE, RM.EXE, UNDEL.EXE, ECH.EXE and EXP.EXE.
  24180.  
  24181.  These files are replacements for the original utilities that were
  24182.  shipped with the Microsoft Editor Version 1.00. They have been updated
  24183.  to correct two specific problems only; they do not include any additional
  24184.  functionality over the originals.
  24185.  
  24186.  These files correct the problem of embedded 286 instructions that
  24187.  prevented the programs from correctly running on 8086 and 8088
  24188.  machines (the machines would hang). The files also have been updated
  24189.  to correct problems when used with DOS Version 2.x.
  24190.  
  24191.  To install the files, copy the files from the appnote disk over the
  24192.  files (of the same names) that are installed on the machine.
  24193.  
  24194.  This application note can be obtained by calling Microsoft Product
  24195.  Support Services at (206) 454-2030.
  24196.  
  24197.  
  24198.  43. Preventing Generation of Tabs in the Edited Disk Files
  24199.  
  24200.  Product Version(s): 1.00   | 1.00
  24201.  Operating System:   MS-DOS | OS/2
  24202.  Flags: ENDUSER |
  24203.  Last Modified: 25-JUL-1988    ArticleIdent: Q32033
  24204.  
  24205.     It is impossible to search for a tab or replace a string with a tab
  24206.  in the M editor.
  24207.     When a file is being edited, there are no tab characters in the
  24208.  file. When the M editor reads from disk to memory, it converts tabs to
  24209.  spaces. When it writes from memory to disk, it converts spaces to tabs
  24210.  (unless you set the ENTAB switch to 0).
  24211.     This may create problems when devices other than your machine
  24212.  access the file. For example, if you edit a source file on your IBM PC
  24213.  with the M editor, then try to compile the source file on a mainframe,
  24214.  the source file may not compile because of the tabs in the disk file
  24215.  created by the M editor.
  24216.     The solution is to set ENTAB to 0 in the TOOLS.INI file; this value
  24217.  will prevent tabs from being used to represent white space when
  24218.  writing from memory to disk.
  24219.     For more information on the ENTAB switch, please refer to Table 7.2
  24220.  on Page 59 of the "Microsoft Editor User's Guide."
  24221.  
  24222.  
  24223.  44. M Hangs on Tandy 2000 with MS-DOS Version 2.11
  24224.  
  24225.  Product Version(s): 1.00
  24226.  Operating System:   MS-DOS
  24227.  Flags: ENDUSER |
  24228.  Last Modified:  1-SEP-1988    ArticleIdent: Q32052
  24229.  
  24230.  M, the Microsoft Editor for MS-DOS, hangs when run on a Tandy 2000
  24231.  computer running MS-DOS Version 2.11.
  24232.  
  24233.  M does not support the Tandy 2000. There is no workaround to this
  24234.  incompatibility.
  24235.  
  24236.  
  24237.  45. Scrolling One Line at a Time
  24238.  
  24239.  Product Version(s): 1.00   | 1.00
  24240.  Operating System:   MS-DOS | OS/2
  24241.  Flags: ENDUSER |  buglist1.00
  24242.  Last Modified: 20-OCT-1988    ArticleIdent: Q32053
  24243.  
  24244.  Problem:
  24245.  
  24246.  The editor jumps seven lines at a time when I Scroll off the top or
  24247.  bottom of the screen. I want it to Scroll one line at a time, but it
  24248.  Scrolls four lines at a time when I set VSCROLL to 1.
  24249.  
  24250.  Response:
  24251.  
  24252.  Hike and Scroll are designed to be independent functions; however,
  24253.  they are incorrectly tied together.
  24254.  
  24255.  Microsoft has confirmed this to be a problem in Version 1.00 of the
  24256.  editor. We are researching this problem and will post new information
  24257.  as it becomes available.
  24258.  
  24259.  A workaround to this problem is to set both VSCROLL and HIKE to 1 in
  24260.  your TOOLS.INI file in the [M] section, as in the following example:
  24261.  
  24262.  [M]
  24263.      hike:1
  24264.      vscroll:1
  24265.  
  24266.  
  24267.  46. Installing M with Msetup
  24268.  
  24269.  Product Version(s): 1.00    | 1.00
  24270.  Operating System:   MS-DOS  | OS/2
  24271.  Flags: ENDUSER | h_fortran
  24272.  Last Modified: 19-JUL-1988    ArticleIdent: Q32094
  24273.  
  24274.  Question:
  24275.     The FORTRAN Version 4.10 setup program did not install the
  24276.  Microsoft Editor. I could not find any documentation on how to use
  24277.  msetup in the UTILITIES.DOC. How do I set up the Editor?
  24278.  
  24279.  Response:
  24280.     To run the msetup program, place the "Microsoft Editor" disk in
  24281.  Drive A and type "msetup". A help screen will be displayed showing
  24282.  the syntax for using msetup. An example of running msetup is as
  24283.  follows:
  24284.  
  24285.     A:>msetup c: \m \init \binp
  24286.  
  24287.     This procedure will install the M Editor and M tools (MEGREP, ECH,
  24288.  UNDEL, etc.) in the M directory, TOOLS.INI in the INIT directory, and
  24289.  MEP in a BINP directory. If you do not specify any directories, the
  24290.  program will use default directories. It will show these default
  24291.  directories on the screen and prompt you for any changes. These
  24292.  directories must be created before running msetup; otherwise, it will
  24293.  not be installed correctly.
  24294.     Please note that when the msetup prompts you for the type of
  24295.  emulation to use for the TOOLS.INI file, a TOOLS.INI file will not be
  24296.  created if you type a "0" for the default tools (the defaults are
  24297.  already built into Editor). If any of the other emulations are used,
  24298.  msetup will rename the appropriate file to TOOLS.INI and install it.
  24299.  
  24300.  
  24301.  47. Exit Does Not Save Files when NoAutosave Is Set
  24302.  
  24303.  Product Version(s): 1.00   | 1.00
  24304.  Operating System:   MS-DOS | OS/2
  24305.  Flags: ENDUSER |
  24306.  Last Modified: 31-OCT-1988    ArticleIdent: Q32095
  24307.  
  24308.  When the boolean switch Autosave is disabled (by setting it to
  24309.  NoAutosave), a file will not be saved when exiting the editor.
  24310.  
  24311.  As documented on Page 61 of the "Microsoft Editor User's Guide," when
  24312.  the Autosave switch is turned on, the current file is saved when the
  24313.  user switches away from it. When Autosave is off (NoAutosave), the
  24314.  file must be explicitly saved when desired; this can be done by
  24315.  entering Arg Arg Setfile (ALT+A ALT+A F2 in the default keyboard
  24316.  setup).
  24317.  
  24318.  
  24319.  48. Arg *.* Setfile: "Bad Command or Filename" Error
  24320.  
  24321.  Product Version(s): 1.00   | 1.00
  24322.  Operating System:   MS-DOS | OS/2
  24323.  Flags: ENDUSER | tar78150
  24324.  Last Modified: 29-AUG-1988    ArticleIdent: Q32224
  24325.  
  24326.     Entering the command Arg *.* Setfile causes M to display a list of
  24327.  all files in the current directory.
  24328.     ECH.EXE is a utility used to generate the list of files for ARG
  24329.  textarg SETFILE. If this utility cannot be found, you will receive a
  24330.  message saying "Bad command or filename." ECH.EXE must be located in a
  24331.  directory on the path.
  24332.  
  24333.  
  24334.  49. Using the SHORTNAMES Switch
  24335.  
  24336.  Product Version(s): 1.00   | 1.00
  24337.  Operating System:   MS-DOS | OS/2
  24338.  Flags: ENDUSER | tar78150
  24339.  Last Modified: 31-MAR-1989    ArticleIdent: Q32225
  24340.  
  24341.  SHORTNAMES is a boolean switch. When it is set (the default), if you
  24342.  type <arg> "foo" <setfile>, you will be sent to the first file in your
  24343.  history list with the base name "foo". You do not have to specify the
  24344.  full pathname for a file in another directory. If there is no
  24345.  d:\path\foo.xxx anywhere in your file history, you only get foo.
  24346.  
  24347.  If you have a file "foo" in your current directory, SHORTNAMES still
  24348.  tries to find a file in your history list first. The history of files
  24349.  is stored in M.TMP. The number of files saved is determined by the
  24350.  TMPSAV switch.
  24351.  
  24352.  To disable this feature, set noshortnames: in your TOOLS.INI file.
  24353.  
  24354.  To avoid this behavior without changing the switch value, include a
  24355.  period in the path specification. For example, enter <arg> "foo."
  24356.  <setfile>, which will look only in the current directory. The presence
  24357.  of any path character (".", etc.) disables the SHORTNAMES feature for
  24358.  the file being referenced.
  24359.  
  24360.  
  24361.  50. Cancel Clears the Type-Ahead Buffer
  24362.  
  24363.  Product Version(s): 1.00   | 1.00
  24364.  Operating System:   MS-DOS | OS/2
  24365.  Flags: ENDUSER | tar75933
  24366.  Last Modified: 19-JUL-1988    ArticleIdent: Q32226
  24367.  
  24368.     The Cancel command clears the type-ahead buffer. This is a feature
  24369.  of the editor and is not considered a problem.
  24370.     Cancel is mapped to the ESC key in the default keyboard setup.
  24371.  
  24372.  
  24373.  51. Loading a TAGGED Section Reinitializes the Editor
  24374.  
  24375.  Product Version(s): 1.00   | 1.00
  24376.  Operating System:   MS-DOS | OS/2
  24377.  Flags: ENDUSER | buglist1.00 tar76973
  24378.  Last Modified: 29-AUG-1988    ArticleIdent: Q32228
  24379.  
  24380.  When a TAGGED section is initialized (<arg> "section name"
  24381.  <initialize>), all current macros are destroyed before
  24382.  reinitialization.
  24383.  
  24384.  The curdate, curtime, etc., macros are reset, your extmake: settings
  24385.  are set to the default, and the OS-dependent and video-dependent
  24386.  sections of TOOLS.INI are read in. If you type <initialize>, the main
  24387.  section is read in place of the TAGGED section.
  24388.  
  24389.  Microsoft has confirmed this to be a problem in Version 1.00. We
  24390.  are researching this problem and will post new information as it
  24391.  becomes available.
  24392.  
  24393.  
  24394.  
  24395.  52. The extmake Compile Switch Is Case Sensitive
  24396.  
  24397.  Product Version(s): 1.00   | 1.00
  24398.  Operating System:   MS-DOS | OS/2
  24399.  Flags: ENDUSER | buglist1.00
  24400.  Last Modified:  1-MAY-1989    ArticleIdent: Q32242
  24401.  
  24402.  The following extmake entry will be ignored, causing the default
  24403.  command line to be used:
  24404.  
  24405.  extmake:C cl /c /Zi /Od %s
  24406.  
  24407.  Microsoft has confirmed this to be a problem in Version 1.00. We
  24408.  are researching this problem and will post new information as it
  24409.  becomes available.
  24410.  
  24411.  Although there is no case sensitivity for the extmake switch name, the
  24412.  extension specified ("C" in this example) must be in lowercase. If the
  24413.  extension is not in lowercase, the help screen will show a separate
  24414.  entry for that extension, as follows:
  24415.  
  24416.     C   cl /c /Zi /Od %s
  24417.     c   cl /c /Zep /D LINT_ARGS %s
  24418.  
  24419.  The second command line will be used when compiling a C program.
  24420.  
  24421.  
  24422.  53. Loading Tagged Sections in OS/2 Version 1.10
  24423.  
  24424.  Product Version(s): 1.00
  24425.  Operating System:   OS/2
  24426.  Flags: ENDUSER | docerr
  24427.  Last Modified: 29-AUG-1988    ArticleIdent: Q33348
  24428.  
  24429.  Problem:
  24430.  
  24431.  I have followed the instructions on Page 64 of the "Microsoft Editor
  24432.  User's Guide" for loading tagged sections in OS/2, but the editor
  24433.  never loads this section. My TOOLS.INI file has a tag titled [M MEP]
  24434.  containing assignments for both protected and real modes and a tag
  24435.  titled [M-10.0] for OS/2 protected-mode assignments. I am running
  24436.  Microsoft OS/2 Version 1.10.
  24437.  
  24438.  Response:
  24439.  
  24440.  Your [M-10.0] tag is not loaded in OS/2 Version 1.10 because [M-10.0]
  24441.  means OS/2 Version 1.00. The version number should be changed from
  24442.  10.0 to 10.10; your tag should be [M-10.10]. If you want the tag to
  24443.  work correctly for both OS/2 Versions 1.00 and 1.10, create a tag
  24444.  titled [M-10.0 M-10.10].
  24445.  
  24446.  This information is not contained in the "Microsoft Editor User's
  24447.  Guide."
  24448.  
  24449.  
  24450.  54. C.TMP Files in Current Directory
  24451.  
  24452.  Product Version(s): 1.00
  24453.  Operating System:   MS-DOS
  24454.  Flags: ENDUSER |
  24455.  Last Modified:  2-SEP-1988    ArticleIdent: Q34251
  24456.  
  24457.  Question:
  24458.  
  24459.  Every time I edit a file with the Microsoft Editor, I receive a C.TMP
  24460.  file in that directory. I am using DOS Version 2.10. Why is it
  24461.  creating this file?
  24462.  
  24463.  Response:
  24464.  
  24465.  The C.TMP file is where the editor keeps its information about
  24466.  previous files that have been edited. This file normally is called
  24467.  M.TMP; however, due to a limitation of DOS Versions 2.x, the editor
  24468.  believes its name is C rather than M.
  24469.  
  24470.  The files are placed in the directory where the file was edited
  24471.  because unless the INIT environment variable is set, the .TMP file is
  24472.  written to the current directory.
  24473.  
  24474.  When using M on DOS Versions 2.x, change the tag field of the TOOLS.INI
  24475.  from [M] to [C] and set the INIT environment variable to the directory
  24476.  that contains TOOLS.INI.
  24477.  
  24478.  
  24479.  
  24480.  55. How to Perform Spell Checking in M
  24481.  
  24482.  Product Version(s): 1.00   | 1.00
  24483.  Operating System:   MS-DOS | OS/2
  24484.  Flags: ENDUSER |
  24485.  Last Modified: 29-AUG-1988    ArticleIdent: Q34274
  24486.  
  24487.  Question:
  24488.     Does the Microsoft Editor have any spell checking capabilities?
  24489.  
  24490.  Response:
  24491.     The M editor does not have built-in spell checking. If you have a
  24492.  separate spell-check program you can write a macro to invoke it on
  24493.  your current file.
  24494.     For example, you could use the spell checker that comes with
  24495.  Microsoft Word Version 4.00 by doing the following:
  24496.  
  24497.      [M]
  24498.          ...
  24499.          Spell:=Arg "spell-am " Curfile Shell
  24500.          Spell:ALT+S
  24501.  
  24502.     The macro works as follows:
  24503.  
  24504.     1. Arg introduces an argument to the shell command.
  24505.     2. "spell-am" is the name of the spell-check utility
  24506.        included in Word Version 4.00.
  24507.     3. Curfile is the name of the current file you are editing. Note
  24508.        the space at the end of "spell-am "; this space is needed so the
  24509.        argument you pass to Shell is "spell-am YourCurrentFile" instead
  24510.        of "spell-amYourCurrentFile".
  24511.     4. The Shell command invokes COMMAND.COM and passes it the
  24512.        spell-am command. When spell-am completes its spell-check,
  24513.        it will return to the editor.
  24514.  
  24515.  
  24516.  56. Changing Height Switch Not Sufficient to Change Video Modes
  24517.  
  24518.  Product Version(s): 1.00   | 1.00
  24519.  Operating System:   MS-DOS | OS/2
  24520.  Flags: ENDUSER |
  24521.  Last Modified:  1-SEP-1988    ArticleIdent: Q34411
  24522.  
  24523.  Microsoft Editor does not immediately change video modes (CGA/EGA/VGA)
  24524.  when changing the numeric switch HEIGHT: to either 23, 41, or 48 in the
  24525.  TOOLS.INI file.
  24526.  
  24527.  For the new height setting to take effect, one of the following must
  24528.  be done:
  24529.  
  24530.  1. The INITIALIZE function can be invoked to force the editor to
  24531.     update its settings based on the switch values in TOOLS.INI. This
  24532.     will reset the video-display configuration. (INITIALIZE is ALT+F10
  24533.     for Quick and EPSILON emulation, SHIFT+F10 for BRIEF emulation, or
  24534.     SHIFT+F8 for the default emulation).
  24535.  
  24536.  2. The assignment can be made directly to the editor by invoking
  24537.     <arg> height:41 <assign>. In the default keyboard configuration,
  24538.     this would be ALT+A "height:41" ALT+=.
  24539.  
  24540.  3. While editing the "height:41" line in TOOLS.INI, move to the
  24541.     beginning of the line and enter <arg> <assign>, which is ALT+A
  24542.     ALT+= in the default keyboard assignments.
  24543.  
  24544.  The video mode is stored in the M.TMP file in the directory pointed to
  24545.  by the TMP environment variable; if TMP is not set, M.TMP is placed in
  24546.  the current default directory. Invoking the INITIALIZE function causes
  24547.  M to reset the settings in M.TMP based on the settings in TOOLS.INI.
  24548.  
  24549.  
  24550.  57. Accessing Switch Values in C Extensions
  24551.  
  24552.  Product Version(s): 1.00   | 1.00
  24553.  Operating System:   MS-DOS | OS/2
  24554.  Flags: ENDUSER |
  24555.  Last Modified:  2-SEP-1988    ArticleIdent: Q35025
  24556.  
  24557.  There is no direct function call to access switch values defined in
  24558.  the editor, such as rmargin or vscroll or hike, in your C Extension.
  24559.  However, you can find the value by using fExecute() to switch to the
  24560.  help file, then use the psearch or msearch functions to locate
  24561.  rmargin. At the end of that line you will find the value associated
  24562.  with rmargin.
  24563.  
  24564.  The following is an example:
  24565.  
  24566.  fExecute("Arg \"<assign>\" Setfile");  /* switch to "<assign>" file   */
  24567.  fExecute("Mark");                      /* go to beginning of it       */
  24568.  fExecute("Arg \"rmargin\" Psearch");   /* search for "rmargin"        */
  24569.  fExecute("Pword");                     /* get the number after it     */
  24570.  
  24571.  You also can use the GetLine() function to read through the <assign>
  24572.  file; this method involves more coding, but it will run faster than
  24573.  using fExecute() to execute macros.
  24574.  
  24575.  
  24576.  58. Passing Textargs to M with the /E Switch
  24577.  
  24578.  Product Version(s): 1.00   | 1.00
  24579.  Operating System:   MS-DOS | OS/2
  24580.  Flags: ENDUSER |
  24581.  Last Modified:  1-SEP-1988    ArticleIdent: Q35028
  24582.  
  24583.  Question:
  24584.  
  24585.  How can I pass textargs to the editor using the /e command-line
  24586.  switch?
  24587.  
  24588.  Response:
  24589.  
  24590.  Type in the name of the function you want the editor to execute. If
  24591.  you want to use more than one function, enclose the functions in
  24592.  double-quotation marks. If your functions require arguments, use the C
  24593.  syntax for specifying quotation marks within strings, i.e., the
  24594.  backslash escape character (\). Thus, a double-quotation mark within
  24595.  a string is specified with \".
  24596.  
  24597.  The following examples demonstrate various methods of passing
  24598.  command-line arguments to M:
  24599.  
  24600.  m /e psearch myfile
  24601.  
  24602.  This example invokes the Microsoft Editor on the file "myfile",
  24603.  passing it the command "psearch" to be executed immediately. The
  24604.  psearch will search for whatever string was last specified (in the
  24605.  search buffer).
  24606.  
  24607.  m /e "mark psearch" myfile
  24608.  
  24609.  This example again edits "myfile", but this time it passes two
  24610.  commands to M: "mark" and "psearch". The Mark command goes to the
  24611.  beginning of the file, and psearch searches forward for an occurrence
  24612.  of the search-string (which must have been specified in a previous
  24613.  search).
  24614.  
  24615.  m /e "arg \"search string\" psearch" myfile
  24616.  
  24617.  This example passes the editor the following string:
  24618.  
  24619.  "arg "search string" psearch"
  24620.  
  24621.  The \" characters are a C escape sequence that evaluates to a
  24622.  double-quotation mark ("); as a result, the entire string has a string
  24623.  embedded in it. The effect of this command is to tell the editor to
  24624.  search for the literal text "search string".
  24625.  
  24626.  m /e "arg \"\\\"a quoted search string\\\"\" psearch" myfile
  24627.  
  24628.  This is the most complicated case of argument passing. It
  24629.  passes the following string to the editor:
  24630.  
  24631.  "arg "\"a quoted search string\"" psearch"
  24632.  
  24633.  This command searches for the QUOTED literal text ""a quoted search
  24634.  string"".  The "\" and \"" are necessary to cause M itself to postpone
  24635.  evaluation of the double-quotation marks until actual search time.
  24636.  
  24637.  
  24638.  59. A Workaround for the MGREP Problem in M/MEP Version 1.02
  24639.  
  24640.  Product Version(s): 1.02   | 1.02
  24641.  Operating System:   MS-DOS | OS/2
  24642.  Flags: ENDUSER |
  24643.  Last Modified: 29-JAN-1991    ArticleIdent: Q68386
  24644.  
  24645.  In the M/MEP Editor version 1.02, there is a problem in the MGREP
  24646.  function; it will fail to find some matches to the query in the file.
  24647.  (This is due to certain regular-expression matches failing when they
  24648.  shouldn't.) Below is a macro that will use the MEGREP.EXE utility to
  24649.  search for a string, and return the results in the compile window. The
  24650.  benefits are:
  24651.  
  24652.  1. It should be faster, especially under OS/2.
  24653.  
  24654.  2. If run under OS/2, it will be a background process enabling you
  24655.     to continue working.
  24656.  
  24657.  Macro Code
  24658.  ----------
  24659.  
  24660.  Add the following to your TOOLS.INI file. You can then assign it to a
  24661.  keystroke, if desired:
  24662.  
  24663.  megreplist:="*.c *.h"
  24664.  mg1:=copy arg "<megrep>" setfile mark emacsnewl mark paste begline
  24665.  mg2:="arg arg \"megrep \\\"" endline "\\\" " megreplist
  24666.  mg3:=" \" compile" begline arg endline execute setfile
  24667.  megrep:= mg1 mg2 mg3
  24668.  
  24669.  The following is another option, which avoids using an extra
  24670.  pseudo-file:
  24671.  
  24672.  megreplist:="*.c *.h"
  24673.  mg:= copy arg "<clipboard>" setfile            \
  24674.       begfile "megrep \"" endline "\" " megreplist  \
  24675.       begline arg arg endline compile setfile
  24676.  
  24677.  Notes
  24678.  -----
  24679.  
  24680.  1. The first macro is in three parts due to line-length limits of the
  24681.     knowledge base; the macro could be just one line. The second macro
  24682.     uses line continuation characters to achieve the same result as
  24683.     breaking up the first macro.
  24684.  
  24685.  2. The macro assumes that all files on disk are up to date.
  24686.  
  24687.  
  24688.  60. MHELP Driver Not Completely Compatible with QuickC Help Files
  24689.  
  24690.  Product Version(s): 1.02   | 1.02
  24691.  Operating System:   MS-DOS | OS/2
  24692.  Flags: ENDUSER | s_quickc buglist1.02
  24693.  Last Modified:  5-MAR-1990    ArticleIdent: Q58603
  24694.  
  24695.  The MHELP driver cannot process some cross-references inherent to the
  24696.  QuickC Versions 2.00 and 2.01 help files. Results range from the MHELP
  24697.  message "Cannot Process Cross Reference," to hanging the computer. In
  24698.  general, direct reference to a QuickC help file from within the editor
  24699.  is fine. However, moving around within the help file system using the
  24700.  built-in cross-references produces unpredictable results.
  24701.  
  24702.  The MHELP driver seems unable to access unformatted text files such as
  24703.  header, source, and DOC files. For example, QuickC allows you to
  24704.  access both the README.DOC file and QuickC header files from within
  24705.  the help system. Attempting these feats from within M leads to one of
  24706.  the following problems:
  24707.  
  24708.  1. "Cannot Process Cross Reference," if file not found.
  24709.  
  24710.  2. DOS will hang the machine if the file is found.
  24711.  
  24712.  3. OS/2 may cause a SYS 1943 protection violation if the file is
  24713.     found.
  24714.  
  24715.  The M editor also cannot use the <back> menu option to access a
  24716.  previously viewed help file. Attempting this yields the message
  24717.  "Cannot Process Cross Reference" at the bottom of the screen. The
  24718.  syntax of the <back> cross-reference in unencrypted help form is
  24719.  help file to access the previous help screen. This undocumented
  24720.  feature is not allowed in MHELP.
  24721.  
  24722.  Certain series of cross references cause sporadic errors. You should
  24723.  be careful to avoid internal cross-referencing within the QC help
  24724.  files. The problem can be shown with the following sequence using the
  24725.  QuickC and QuickAssembler help files from within the M Editor.
  24726.  
  24727.     <arg> seg <F1> <TAB> <RETURN> <TAB> <RETURN> <TAB>
  24728.  
  24729.  This example reaches the help-contents window via the "seg" example
  24730.  program. Upon reaching this point, it may hang DOS with the run-time
  24731.  error R6003 or R6001. OS/2 displays a black box in the upper-right
  24732.  corner of the screen and may crash at this point.
  24733.  
  24734.  Microsoft has confirmed this to be a problem with the M Editor Version
  24735.  1.02. We are researching this problem and will post new information
  24736.  here as it becomes available.
  24737.  
  24738.  
  24739.  61. Compiling in M Produces No .OBJ File
  24740.  
  24741.  Product Version(s): 1.00   | 1.00
  24742.  Operating System:   MS-DOS | OS/2
  24743.  Flags: ENDUSER |
  24744.  Last Modified: 20-OCT-1988    ArticleIdent: Q35233
  24745.  
  24746.  If compilation from within the editor gives no .OBJ file when the
  24747.  same compilation outside of M succeeds in creating an object module,
  24748.  check the CONFIG.SYS files setting.
  24749.  
  24750.  In one case, a user had "files=25" while running under DOS Version
  24751.  3.20, which doesn't support a file setting greater than 20. If files
  24752.  exceed 20, DOS uses its default of eight files. When the user set
  24753.  "files=20" an .OBJ was created from a compilation within M.
  24754.  
  24755.  
  24756.  62. Creating Windows in M and MEP
  24757.  
  24758.  Product Version(s): 1.00   | 1.00
  24759.  Operating System:   MS-DOS | OS/2
  24760.  Flags: ENDUSER |
  24761.  Last Modified:  1-MAY-1989    ArticleIdent: Q35235
  24762.  
  24763.  Question:
  24764.  
  24765.  How can I create multiple windows and edit multiple files with the
  24766.  Microsoft Editor?
  24767.  
  24768.  Response:
  24769.  
  24770.  Both horizontal and vertical windows can be created. You can have up
  24771.  to eight windows on the screen.
  24772.  
  24773.  To create a horizontal window, position the cursor on the screen where
  24774.  you would like the window break and press ARG WINDOW (ALT+A F6 in the
  24775.  default).
  24776.  
  24777.  This process creates a new window with a copy of the file you were
  24778.  currently editing. You then can load a different file into that window
  24779.  (ARG SETFILE ALT+A F2).
  24780.  
  24781.  To create a vertical window, position the cursor on the screen where
  24782.  you would like the window break and press ARG ARG WINDOW (ALT+A ALT+A
  24783.  F6 in the default). You then can load a different file into the
  24784.  window.
  24785.  
  24786.  Once you have several windows on the screen you can move around from
  24787.  window to window using the WINDOW command (F6 in the default setup).
  24788.  
  24789.  See also section 4.6 of the "Microsoft Editor User's Guide."
  24790.  
  24791.  Note: Each window must have a minimum of five lines and 10 columns to be
  24792.  created.
  24793.  
  24794.  
  24795.  63. M Does Not Respond to Changes in the Height Switch
  24796.  
  24797.  Product Version(s): 1.00   | 1.00
  24798.  Operating System:   MS-DOS | OS/2
  24799.  Flags: ENDUSER |
  24800.  Last Modified: 31-MAR-1989    ArticleIdent: Q35252
  24801.  
  24802.  The Microsoft Editor does not change video modes (EGA/VGA) when
  24803.  changing the numeric switch height to either 23, 41, or 48 in the
  24804.  TOOLS.INI file.
  24805.  
  24806.  The INITIALIZE function must be invoked to reset the video display
  24807.  configuration. (INITIALIZE = ALT+F10 for Quick and EPSILON emulation,
  24808.  SHIFT+F10 for BRIEF emulation, or SHIFT+F8 for the default emulation).
  24809.  
  24810.  The video mode also is stored in the M.TMP file in the directory
  24811.  pointed to by the INIT environmental variable or the current default
  24812.  directory.
  24813.  
  24814.  
  24815.  64. Toggling Display Modes: 25-, 43-, and 50-Row Modes
  24816.  
  24817.  Product Version(s): 1.00   | 1.00
  24818.  Operating System:   MS-DOS | MS-DOS
  24819.  Flags: ENDUSER |
  24820.  Last Modified: 14-NOV-1988    ArticleIdent: Q37628
  24821.  
  24822.  The following Microsoft Editor macro allows you to toggle the EGA
  24823.  display between 25-row mode and 43-row mode by pressing ALT+E:
  24824.  
  24825.  ;Macro to toggle 25/43 line EGA modes
  24826.      to23:=arg "height:23" assign
  24827.      to41:=arg "height:41" assign
  24828.      toggle23:=to23 arg "toggle41:alt+e" assign
  24829.      toggle41:=to41 arg "toggle23:alt+e" assign
  24830.      toggle41:alt+e
  24831.  
  24832.  The example below is a variation of the above macro. It allows you to
  24833.  toggle the VGA display between 25-row mode, 43-row mode, and 50-row
  24834.  mode by pressing ALT+E. Instead of switching back and forth between
  24835.  two modes, it cycles through all three.
  24836.  
  24837.  The macro is as follows:
  24838.  
  24839.  ;Macro to toggle 25/43/50 line VGA modes
  24840.      to23:=arg "height:23" assign
  24841.      to41:=arg "height:41" assign
  24842.      to48:=arg "height:48" assign
  24843.      toggle23:=to23 arg "toggle41:alt+e" assign
  24844.      toggle41:=to41 arg "toggle48:alt+e" assign
  24845.      toggle48:=to48 arg "toggle23:alt+e" assign
  24846.      toggle41:alt+e
  24847.  
  24848.  These macros should be placed in your TOOLS.INI file as described
  24849.  in Chapters 6 and 7 of the "Microsoft Editor User's Guide."
  24850.  
  24851.  Note: the "toggle" functions in these macros not only set the video
  24852.  mode, they also change the assignment of function ALT+E. This makes
  24853.  these macros similar to self-modifying code. For example, "toggle23"
  24854.  not only sets the video mode to 23-rows (with a call to "to23"), it
  24855.  also assigns ALT+E to "toggle41" by using the following sequence:
  24856.  
  24857.     arg "toggle41:alt+e" assign
  24858.  
  24859.  This technique is very useful in learning to write macros.
  24860.  
  24861.  
  24862.  65. "Softer" Should Be "Softcr" in M 1.0 User's Guide
  24863.  
  24864.  Product Version(s):
  24865.  Operating System:   1.00   | 1.00
  24866.  Flags: MS-DOS | OS/2
  24867.  Last Modified: 18-DEC-1989    ArticleIdent: Q35256
  24868.  ENDUSER | docerr
  24869.  
  24870.  On Page 61 of the "Microsoft Editor User's Guide," there is a
  24871.  documentation error. Softcr is listed as Softer; the correct listing
  24872.  is Softcr.
  24873.  
  24874.  
  24875.  66. Why Compiling after Editing in M Shows Old Errors
  24876.  
  24877.  Product Version(s): 1.00   | 1.00
  24878.  Operating System:   MS-DOS | OS/2
  24879.  Flags: ENDUSER |
  24880.  Last Modified: 20-OCT-1988    ArticleIdent: Q35258
  24881.  
  24882.  When using the M editor (either M.EXE or MEP.EXE) to correct compiler
  24883.  or assembler errors, and then compiling/assembling from within M using
  24884.  the COMPILE function, it is possible to get the old set of errors
  24885.  returned. If the errors occur, check that the autosave switch is set
  24886.  correctly. If autosave is off, the corrections are not saved before
  24887.  compilation.
  24888.  
  24889.  When turned on, the autosave boolean initialization switch causes the
  24890.  current file to be saved whenever it is switched away from. The
  24891.  default value is on, i.e., the files are automatically saved. The
  24892.  setting can be changed from within the editor using Arg textarg Assign
  24893.  or else in TOOLS.INI.
  24894.  
  24895.  In either case, specify noautosave: to prevent automatic saving of
  24896.  files, or autosave: to restore automatic file saving.
  24897.  
  24898.  
  24899.  67. How to Read the Contents of the M Editor Clipboard
  24900.  
  24901.  Product Version(s): 1.00   | 1.00
  24902.  Operating System:   MS-DOS | OS/2
  24903.  Flags: ENDUSER |
  24904.  Last Modified: 31-MAR-1989    ArticleIdent: Q35259
  24905.  
  24906.  The Clipboard is contained in a pseudofile named <clipboard>. It can
  24907.  be loaded the same way any other file is loaded. The contents of the
  24908.  Clipboard pseudofile can be examined in several ways.
  24909.  
  24910.  The pseudofile <clipboard> can be loaded with the command sequence Arg
  24911.  textarg Setfile, which is ALT-A <clipboard> F2 in default keystrokes.
  24912.  This process loads the named file. The contents of the clipboard then
  24913.  can be seen on the screen, and even can be edited and saved as a
  24914.  separate file.
  24915.  
  24916.  The file also can be loaded by bringing up the information file with
  24917.  the INFORMATION function (SHIFT-F1).
  24918.  
  24919.  Finally, if the clipboard is the file most recently switched from, the
  24920.  SETFILE function (F2) alone will call it up.
  24921.  
  24922.  The information file describes the nature of the Clipboard contents in
  24923.  two ways. The Clipboard line appears in the form in the list of
  24924.  files, as follows:
  24925.  
  24926.  <clipboard>                    *n lines
  24927.  
  24928.  Additionally, at the bottom of the information file is a line that
  24929.  gives information in one of two ways, as follows:
  24930.  
  24931.  n lines in line clipboard
  24932.  
  24933.  n lines in box clipboard
  24934.  
  24935.  This information indicates whether the Clipboard holds a block of text
  24936.  or a stream of text.
  24937.  
  24938.  
  24939.  68. How to Write Selected Text to a File in M Editor
  24940.  
  24941.  Product Version(s): 1.00   | 1.00
  24942.  Operating System:   MS-DOS | OS/2
  24943.  Flags: ENDUSER |
  24944.  Last Modified:  1-NOV-1988    ArticleIdent: Q35260
  24945.  
  24946.  To write a block or stream of text from a file currently being edited
  24947.  to another file (either new or currently existing), do the following:
  24948.  
  24949.  1. Select text by using Arg (ALT+A) and the cursor movement keys.
  24950.  
  24951.  2. Put the text block or stream into the Clipboard by using the
  24952.     functions Copy (CTRL+INSERT, or + on the keypad) or Ldelete
  24953.     (CTRL+Y) or Sdelete (DELETE).
  24954.  
  24955.  3. Load the desired new file (see the "Working with Multiple Files"
  24956.     section of the "Microsoft Editor" manual).
  24957.  
  24958.  4. Paste (SHIFT+INSERT) the contents of the Clipboard into the new
  24959.     file.
  24960.  
  24961.  When writing to a file that does not yet exist, another procedure can
  24962.  be used, as follows:
  24963.  
  24964.  1. Write the selected text to the Clipboard as described above.
  24965.  
  24966.  2. Use Setfile to load the <clipboard> pseudofile the same way that
  24967.     other files are loaded.
  24968.  
  24969.  3. When the Clipboard contents appear on the screen, save the file to
  24970.     the desired new filename with Arg Arg textarg Setfile (ALT+A ALT+A
  24971.     filename F2). If a file by that name already exists, it will be
  24972.     overwritten.
  24973.  
  24974.  4. Return to the originally edited file with Setfile (F2).
  24975.  
  24976.  The second method can be put into a macro in one of the following two
  24977.  ways:
  24978.  
  24979.  1. Create a macro definition for copying to a file of prespecified name
  24980.     by using, for example, the following:
  24981.  
  24982.  sendtofil:=copy arg "<clipboard>" setfile arg arg "foo.txt" setfile
  24983.  setfile
  24984.  
  24985.  Assign the macro to a keystroke with an argument of the following
  24986.  form, for example:
  24987.  
  24988.  sendtofil:alt+s.
  24989.  
  24990.  This macro can be placed in TOOLS.INI, or can be the textarg in the
  24991.  command to enter a macro, as follows:
  24992.  
  24993.  Arg textarg Assign (ALT+A textarg ALT+=).
  24994.  
  24995.  2. Create a macro definition for copying to a file of any name by
  24996.     using two macros in sequence, for example, as follows:
  24997.  
  24998.  send1:=copy arg "<clipboard>" setfile arg arg
  24999.  send2:=setfile setfile
  25000.  
  25001.  Enter and assign them as described above. To execute this set of
  25002.  macros, select the text block or stream, execute the first macro, type
  25003.  the desired filename, then execute the second macro.
  25004.  
  25005.  
  25006.  69. Macro to Print Part or All of a File from within M
  25007.  
  25008.  Product Version(s): 1.00  1.02 | 1.00 1.02
  25009.  Operating System:   MS-DOS     | OS/2
  25010.  Flags: ENDUSER |
  25011.  Last Modified: 21-AUG-1989    ArticleIdent: Q35261
  25012.  
  25013.  Microsoft Editor Version 1.00 contains no built-in primitives for
  25014.  printing; there is no actual "print" command. However, a set of steps
  25015.  can be performed involving the shell function, and a macro can be
  25016.  written to execute the steps conveniently. The 1.02 version of the
  25017.  Microsoft Editor does contain a print function. For more information
  25018.  on Version 1.02's print function, please see Section 4.9, "Printing a
  25019.  File," in the "Microsoft Editor User's Guide for MS OS/2 and MS-DOS
  25020.  Operating Systems."
  25021.  
  25022.  The following is a sample macro for the 1.00 Editor:
  25023.  
  25024.     print1:=copy arg "<clipboard>" setfile
  25025.     print2:=arg arg "PRINT.TMP" setfile
  25026.     print3:=arg "print PRINT.TMP" shell
  25027.     print4:=arg "del PRINT.TMP" shell setfile
  25028.     print:=print1 print2 print3 print4
  25029.  
  25030.  Note: The DOS PRINT command is a resident program. If you shell out of
  25031.  M and invoke the PRINT command for the first time, PRINT will be
  25032.  loaded above M and you will fragment memory. To prevent this, invoke
  25033.  the PRINT command before entering M, so that it will be loaded into
  25034.  low memory.
  25035.  
  25036.  The following explains the above example:
  25037.  
  25038.  1. copy: This copies the currently selected region into the
  25039.     clipboard. This way, you can select a region, using a boxarg or
  25040.     linearg, and then execute this macro to print it. Because the
  25041.     selected region defines what is to be printed, it can be modified
  25042.     to suit your needs.
  25043.  
  25044.  2. arg "<clipboard>" setfile: This loads the <clipboard> pseudo file
  25045.     as the current file.
  25046.  
  25047.  3. arg arg "PRINT.TMP" setfile: This saves the contents of the current
  25048.     file (which is now <clipboard>) to the file PRINT.TMP.
  25049.  
  25050.  4. arg "print PRINT.TMP" shell: This executes a DOS shell that prints
  25051.     PRINT.TMP.
  25052.  
  25053.  5. arg "del PRINT.TMP" shell setfile: This executes a DOS shell that
  25054.     deletes PRINT.TMP, then uses Setfile to return to the original file.
  25055.  
  25056.  
  25057.  70. The Difference between M and MEP
  25058.  
  25059.  Product Version(s): 1.00   | 1.00
  25060.  Operating System:   MS-DOS | OS/2
  25061.  Flags: ENDUSER | appnote
  25062.  Last Modified:  6-JAN-1989    ArticleIdent: Q35522
  25063.  
  25064.  The following information is taken from an application note called
  25065.  "Microsoft Editor Questions and Answers." The application note also is
  25066.  available from Microsoft Product Support Services by calling (206)
  25067.  454-2030.
  25068.  
  25069.  The Difference between M and MEP?
  25070.  
  25071.  M.EXE is the Microsoft Editor that runs under DOS or MS OS/2 real
  25072.  mode. MEP.EXE runs under MS OS/2 protected mode only. You may want to
  25073.  rename MEP.EXE to M.EXE. Functionally, the two editors are the same,
  25074.  except for slight differences in background compilation.
  25075.  
  25076.  
  25077.  71. Reassigning Default Keystrokes for Editor Functions
  25078.  
  25079.  Product Version(s): 1.00   | 1.00
  25080.  Operating System:   MS-DOS | OS/2
  25081.  Flags: ENDUSER | appnote
  25082.  Last Modified:  6-JAN-1989    ArticleIdent: Q35523
  25083.  
  25084.  The following information is taken from an application note called
  25085.  "Microsoft Editor Questions and Answers." The application note also is
  25086.  available from Microsoft Product Support Services by calling (206)
  25087.  454-2030.
  25088.  
  25089.  Reassigning the Default Keystrokes for Editor Functions
  25090.  
  25091.  The function can simply be assigned to an unused keystroke, as
  25092.  follows:
  25093.  
  25094.  Home:Ctrl+H
  25095.  
  25096.  Consult your "Microsoft Editor User's Guide" for valid keystroke
  25097.  combinations. If necessary, you can unassign a keystroke by assigning
  25098.  it to the function Unassigned, as follows:
  25099.  
  25100.  Unassigned:Ctrl+Home
  25101.  
  25102.  
  25103.  72. Separating TOOLS.INI Entries for M
  25104.  
  25105.  Product Version(s): 1.00   | 1.00
  25106.  Operating System:   MS-DOS | OS/2
  25107.  Flags: ENDUSER | appnote
  25108.  Last Modified:  6-JAN-1989    ArticleIdent: Q35524
  25109.  
  25110.  The following information is taken from an application note called
  25111.  "Microsoft Editor Questions and Answers." The application note also is
  25112.  available from Microsoft Product Support Services by calling (206)
  25113.  454-2030.
  25114.  
  25115.  Making Separate TOOLS.INI Entries for M if You Want to Have Different
  25116.  Configurations for M Running Under DOS, OS/2 Real Mode, or OS/2
  25117.  Protected Mode, or a Combination of the Three
  25118.  
  25119.  Various combinations of tags can be used in TOOLS.INI to set up
  25120.  different configurations for different environments. Each environment
  25121.  has its own recognized tag. The following is an example:
  25122.  
  25123.  Environment:                  Tag:
  25124.  
  25125.  MS-DOS                        [M-3.30] (your particular
  25126.                                         DOS version)
  25127.  OS/2 real mode                [M-10.0R]
  25128.  OS/2 protected mode           [M-10.0]
  25129.  
  25130.  The following is an examples of combinations:
  25131.  
  25132.  MS-DOS and OS/2 real mode     [M-3.30 M-10.0R]
  25133.  OS/2 real and protected mode  [M-10.0R M-10.0]
  25134.  
  25135.  If you have renamed M.EXE, the "M" used in the tag must be replaced
  25136.  with the name you are using for the editor. However, each M-XX.XX
  25137.  sub-tag only can appear once in a tag. For example, if you used the
  25138.  double tags above, and you were running M in OS/2 real mode, only the
  25139.  information from first tag would be loaded.
  25140.  
  25141.  By using these tags, only certain sections will be loaded from
  25142.  TOOLS.INI to initialize the editor, depending on the environment in
  25143.  which the editor is running. The statements in the [M] section are
  25144.  always loaded.
  25145.  
  25146.  
  25147.  73. Loading a New File into the Editor
  25148.  
  25149.  Product Version(s): 1.00   | 1.00
  25150.  Operating System:   MS-DOS | OS/2
  25151.  Flags: ENDUSER | appnote
  25152.  Last Modified:  6-JAN-1989    ArticleIdent: Q35525
  25153.  
  25154.  The following information is taken from an application note called
  25155.  "Microsoft Editor Questions and Answers." The application note is
  25156.  available from Microsoft Product Support Services by calling (206)
  25157.  454-2030
  25158.  
  25159.  Loading a New File into the Editor
  25160.  
  25161.  Loading a new file into the editor can be done by using the keystrokes
  25162.  corresponding to the following functions:
  25163.  
  25164.  Arg textarg Setfile, where textarg is the name of the file you wish to
  25165.  load.
  25166.  
  25167.  
  25168.  74. Exiting without Saving
  25169.  
  25170.  Product Version(s): 1.00   | 1.00
  25171.  Operating System:   MS-DOS | OS/2
  25172.  Flags: ENDUSER | appnote
  25173.  Last Modified:  6-JAN-1989    ArticleIdent: Q35526
  25174.  
  25175.  The following information is taken from an application note called
  25176.  "Microsoft Editor Questions and Answers." The application note is
  25177.  available from Microsoft Product Support Services by calling (206)
  25178.  454-2030.
  25179.  
  25180.  How to Exit without Saving
  25181.  
  25182.  Normally, when the keystroke for exit is invoked, the file will be
  25183.  saved before exiting. However, typing the keystroke for "Meta" before
  25184.  the exit keystroke allows you to exit without saving your file.
  25185.  
  25186.  
  25187.  75. Merging Two Files Together
  25188.  
  25189.  Product Version(s): 1.00   | 1.00
  25190.  Operating System:   MS-DOS | OS/2
  25191.  Flags: ENDUSER | appnote
  25192.  Last Modified:  6-JAN-1989    ArticleIdent: Q35527
  25193.  
  25194.  The following information is taken from an application note called
  25195.  "Microsoft Editor Questions and Answers." The application note also is
  25196.  available from Microsoft Product Support Services by calling (206)
  25197.  454-2030.
  25198.  
  25199.  How to Merge Two Files Together
  25200.  
  25201.  A separate file can be merged into the current file by using the
  25202.  keystrokes corresponding to the following functions:
  25203.  
  25204.     Arg Arg textarg Paste, where textarg is the name of file to be merged.
  25205.  
  25206.  
  25207.  76. Placing Control Characters in Text of File
  25208.  
  25209.  Product Version(s): 1.00   | 1.00
  25210.  Operating System:   MS-DOS | OS/2
  25211.  Flags: ENDUSER | appnote
  25212.  Last Modified:  6-JAN-1989    ArticleIdent: Q35528
  25213.  
  25214.  The following information is taken from an application note called
  25215.  "Microsoft Editor Questions and Answers." The application note also is
  25216.  available from Microsoft Product Support Services by calling (206)
  25217.  454-2030.
  25218.  
  25219.  Placing Control Characters in the Text of My File
  25220.  
  25221.  The editor function "Quote" can be used to place special characters in
  25222.  your text. Use the keystroke assigned to "Quote", then enter the
  25223.  combination of keys necessary to produce the character. For example, a
  25224.  Form Feed would be a combination of the CTRL key and the L key.
  25225.  
  25226.  
  25227.  77. Compiling the Program Currently Loaded in Editor
  25228.  
  25229.  Product Version(s): 1.00   | 1.00
  25230.  Operating System:   MS-DOS | OS/2
  25231.  Flags: ENDUSER | appnote
  25232.  Last Modified:  6-JAN-1989    ArticleIdent: Q35529
  25233.  
  25234.  The following information is taken from an application note called
  25235.  "Microsoft Editor Questions and Answers." The application note is
  25236.  available from Microsoft Product Support Services by calling (206)
  25237.  454-2030.
  25238.  
  25239.  How to Compile the Program Currently Loaded in the Editor
  25240.  
  25241.  The current file can be compiled by using the keystrokes corresponding
  25242.  to the following functions:
  25243.  
  25244.     Arg Arg textarg Compile, where textarg is the compiler command
  25245.     line typed as you normally would outside of the editor; however,
  25246.     the filename does not have to be the current file.
  25247.  
  25248.  The text switch "extmake" can be entered in TOOLS.INI to associate a
  25249.  frequently used command line with a particular file extension. The
  25250.  following is an example:
  25251.  
  25252.     extmake:c cl /Zi /Od %s
  25253.  
  25254.  The %s will be replaced with the current filename.
  25255.  
  25256.  
  25257.  78. Differences between the vscroll and hike Numeric Switches
  25258.  
  25259.  Product Version(s): 1.00   | 1.00
  25260.  Operating System:   MS-DOS | OS/2
  25261.  Flags: ENDUSER | appnote
  25262.  Last Modified:  6-JAN-1989    ArticleIdent: Q35530
  25263.  
  25264.  The following information is taken from an application note called
  25265.  "Microsoft Editor Questions and Answers." The application note also is
  25266.  available from Microsoft Product Support Services by calling (206)
  25267.  454-2030.
  25268.  
  25269.  The Differences between the vscroll and hike Numeric Switches
  25270.  
  25271.  The vscroll switch determines how many lines are vertically scrolled
  25272.  when the cursor is moved to a location not visible in (outside of) the
  25273.  current window but within vscroll lines of the edge of the current
  25274.  window.
  25275.  
  25276.  The hike switch determines the cursor position when an editing
  25277.  function moves the cursor more than vscroll lines beyond the edge of
  25278.  the current window. In this case, the cursor would appear hike lines
  25279.  from the top of the window.
  25280.  
  25281.  Note: Currently, these switches are broken. Even when vscroll is
  25282.  correctly set to 1, hike will overide it if hike has a greater value
  25283.  than vscroll. Until this problem is corrected, both switches must be
  25284.  set to 1 to scroll one line at a time.
  25285.  
  25286.  
  25287.  79. Making the Editor Default to Insert Mode
  25288.  
  25289.  Product Version(s): 1.00   | 1.00
  25290.  Operating System:   MS-DOS | OS/2
  25291.  Flags: ENDUSER | appnote
  25292.  Last Modified:  6-JAN-1989    ArticleIdent: Q35531
  25293.  
  25294.  The following information is taken from an application note called
  25295.  "Microsoft Editor Questions and Answers." The application also is
  25296.  available from Microsoft Product Support Services by calling (206)
  25297.  454-2030.
  25298.  
  25299.  How to Make the Editor Default to Insert Mode
  25300.  
  25301.  The boolean switch "Enterinsmode" can be set in the TOOLS.INI file to
  25302.  allow the editor to start up in insert mode rather than overtype mode.
  25303.  This switch is off by default, but can be set by adding the following
  25304.  entry to TOOLS.INI:
  25305.  
  25306.     enterinsmode:
  25307.  
  25308.  
  25309.  80. Saving Files Under a Different Name
  25310.  
  25311.  Product Version(s): 1.00   | 1.00
  25312.  Operating System:   MS-DOS | OS/2
  25313.  Flags: ENDUSER | appnote
  25314.  Last Modified:  6-JAN-1989    ArticleIdent: Q35532
  25315.  
  25316.  The following information is taken from an application note called
  25317.  "Microsoft Editor Questions and Answers." The application note also is
  25318.  available from Microsoft Product Support Services by calling (206)
  25319.  454-2030.
  25320.  
  25321.  How to Save Your File Under a Different Name
  25322.  
  25323.  Saving a file under a different name can be done by including a
  25324.  textarg when saving a file without exiting, as follows:
  25325.  
  25326.     Arg Arg textarg Setfile, where textarg is the filename you wish to
  25327.     save the file under.
  25328.  
  25329.  
  25330.  81. "Unable to Open Swapping File c:\temp\m-0029.vm"
  25331.  
  25332.  Product Version(s): 1.00   | 1.00
  25333.  Operating System:   MS-DOS | OS/2
  25334.  Flags: ENDUSER | appnote
  25335.  Last Modified:  6-JAN-1989    ArticleIdent: Q35533
  25336.  
  25337.  The following information is taken from an application note called
  25338.  "Microsoft Editor Questions and Answers." The application note also is
  25339.  available from Microsoft Product Support Services by calling (206)
  25340.  454-2030.
  25341.  
  25342.  "Unable to Open Swapping File c:\temp\m-0029.vm No Such File or
  25343.  Directory" Error
  25344.  
  25345.  The editor assumes that environment variables are set so that
  25346.  important editor information can be loaded from and saved to your
  25347.  disk. The following is an example:
  25348.  
  25349.     SET INIT=c:\init
  25350.     SET TMP=c:\temp
  25351.  
  25352.  In this example, c:\temp would be the directory that would hold
  25353.  temporary or swapping files, usually named M-0029.VM. This file is
  25354.  used to allow the editor to switch to previous files. C:\INIT would
  25355.  hold TOOLS.INI and M.TMP. The swapping file also would be stored here
  25356.  if the TMP variable was not set. If neither of these variables is
  25357.  set, the swapping file would be stored in the root directory and M.TMP
  25358.  would be stored in the current directory.
  25359.  
  25360.  However, if the TMP variable is set to a directory that does not
  25361.  exist, or if extra characters were included after the "p" in "c:\temp"
  25362.  such as a space or a semicolon, the swapping file will not be created
  25363.  and the error above will be generated.
  25364.  
  25365.  
  25366.  82. Why the Editor Cannot Find or Load TOOLS.INI
  25367.  
  25368.  Product Version(s): 1.00   | 1.00
  25369.  Operating System:   MS-DOS | OS/2
  25370.  Flags: ENDUSER | appnote
  25371.  Last Modified:  6-JAN-1989    ArticleIdent: Q35534
  25372.  
  25373.  The following information is taken from an application note called
  25374.  "Microsoft Editor Questions and Answers." The application note also is
  25375.  available from Microsoft Product Support Services by calling (206)
  25376.  454-2030.
  25377.  
  25378.  Why the Editor Can't Find or Load the TOOLS.INI File
  25379.  
  25380.  There are several reasons this problem may occur. First of all, you
  25381.  may have never created a TOOLS.INI file. If TOOLS.INI is not in the
  25382.  working directory, the INIT environment variable must specify the
  25383.  directory that contains this file. Within the TOOLS.INI file, there
  25384.  must be a tag that has the same name as the editor (M.EXE), as
  25385.  follows:
  25386.  
  25387.     [m]
  25388.  
  25389.  If you have renamed the editor you also must rename the tag. Entries
  25390.  concerning the editor then would follow after this tag. Under DOS
  25391.  Versions 2.x, the Microsoft Editor looks for a [c] tag rather an [m]
  25392.  tag or whatever you have renamed M.EXE to.
  25393.  
  25394.  
  25395.  83. Keeping the Editor from Saving Backup Files
  25396.  
  25397.  Product Version(s): 1.00   | 1.00
  25398.  Operating System:   MS-DOS | OS/2
  25399.  Flags: ENDUSER | appnote
  25400.  Last Modified:  6-JAN-1989    ArticleIdent: Q35535
  25401.  
  25402.  The following information is taken from an application note called
  25403.  "Microsoft Editor Questions and Answers." The application note also is
  25404.  available from Microsoft Product Support Services by calling (206)
  25405.  454-2030.
  25406.  
  25407.  How to Keep the Editor from Saving Backup Files
  25408.  
  25409.  The text switch "Backup" determines what happens to old copies of
  25410.  files that are modified. If you do not wish to keep any backup files,
  25411.  a value of "none" can be given, as follows:
  25412.  
  25413.     Backup:none
  25414.  
  25415.  Backup files can be saved in two ways. A value of "bak" will save the
  25416.  previous version of the file with a .BAK extension. A value of "undel"
  25417.  will save a history of old copies of your file in a hidden directory
  25418.  disk space.
  25419.  
  25420.  Older copies can be restored by using UNDEL.EXE. Typing "undel" will
  25421.  list all the backup copies; "undel <filename>" will either restore the
  25422.  file, or if there is more than one backup, it will allow you to choose
  25423.  which version you would like to restore. Because these files take up
  25424.  actual disk space, they should be periodically removed from the disk
  25425.  by using EXP.EXE. Typing "exp" will delete these files permanently.
  25426.  
  25427.  
  25428.  84. How to Write and Use C Extensions
  25429.  
  25430.  Product Version(s): 1.00   | 1.00
  25431.  Operating System:   MS-DOS | OS/2
  25432.  Flags: ENDUSER | appnote
  25433.  Last Modified:  6-JAN-1989    ArticleIdent: Q35536
  25434.  
  25435.  The following information is taken from an application note called
  25436.  "Microsoft Editor Questions and Answers." The application note also is
  25437.  available from Microsoft Product Support Services by calling (206)
  25438.  454-2030.
  25439.  
  25440.  C Extensions and How to Write and Use Them
  25441.  
  25442.  C extensions allow you to further customize the editor by creating new
  25443.  editor functions and switches through programs that you write in the C
  25444.  programming language. They are much more powerful than macros because
  25445.  macros depend on the existence of editor functions.
  25446.  
  25447.  C extensions are compiled with a special memory-model that does not
  25448.  use a main() function, but rather uses special names and structures
  25449.  that the editor alone recognizes. They are linked with an object
  25450.  module that makes low-level functions used within the editor itself
  25451.  available to be called by your C extension. The file produced from
  25452.  linking is separate from the main program but is loaded into memory
  25453.  with the editor. The editor then will call your module whenever you
  25454.  invoke one of your C extension functions.
  25455.  
  25456.  
  25457.  85. Developing Macros
  25458.  
  25459.  Product Version(s): 1.00   | 1.00
  25460.  Operating System:   MS-DOS | OS/2
  25461.  Flags: ENDUSER | appnote
  25462.  Last Modified:  4-MAY-1989    ArticleIdent: Q35537
  25463.  
  25464.  The following information is taken from an application note called
  25465.  "Microsoft Editor Questions and Answers." The application note also is
  25466.  available from Microsoft Product Support Services by calling (206)
  25467.  454-2030.
  25468.  
  25469.  Develop my Own Macros
  25470.  
  25471.  Developing a macro is similar to programming in a high-level language.
  25472.  Each macro represents a command. Instead of a collection of library
  25473.  routines, you have a collection of editor functions. You begin with an
  25474.  idea of a process that you would like to be performed by simply
  25475.  pressing one keystroke.
  25476.  
  25477.  Suppose you would like to be able to move the cursor to the lower-left
  25478.  corner of the editing window. You know you can do this "manually" with
  25479.  the arrow keys that are assigned to the "Left" and "Down" editor
  25480.  functions. However, it can be simplified more. "Meta Down" moves the
  25481.  cursor to the bottom of the window; "Meta Begline" moves the cursor to
  25482.  the first column of the line. Together, these functions will do the
  25483.  job.
  25484.  
  25485.  This macro must now be given a unique name, for example, "Bottom". The
  25486.  TOOLS.INI statement would look as follows:
  25487.  
  25488.     Bottom:=Meta Begline Meta Down
  25489.  
  25490.  A macro also can be a combination of other macros. The following is an
  25491.  example:
  25492.  
  25493.     Waydown:=Meta Down
  25494.     Wayleft:=Meta Begline
  25495.     Bottom:=Waydown Wayleft
  25496.  
  25497.  Suppose that the "Meta Begline" command did not exist. You would need
  25498.  to find some way to know that the cursor is in the first column.
  25499.  Almost all of the editor functions have boolean (TRUE/FALSE) Return
  25500.  Values that can be useful in developing macros.
  25501.  
  25502.  For the "Bottom" macro, you know that "Begline" will at least move the
  25503.  cursor to the first nonblank character on the line. Any further cursor
  25504.  movement would have to be done using "Left". "Left" returns TRUE when
  25505.  the cursor moves and FALSE when the cursor does not move.
  25506.  
  25507.  You would want to move left until the cursor does not move anymore,
  25508.  i.e., move left until "Left" returns FALSE. The editor allows you to
  25509.  do this with Macro Conditionals. The following is an example:
  25510.  
  25511.     Bottom:=Begline :>LT Left +>LT Meta Down
  25512.  
  25513.     :>LT   defines a label LT
  25514.     +>LT   if Left returns TRUE, go to label LT
  25515.            if Left returns FALSE, continue
  25516.  
  25517.  Macro Conditionals and a table of Return Values can be found in the
  25518.  "Microsoft Editor User's Guide."
  25519.  
  25520.  The final step is to assign the macro to a keystroke, as follows:
  25521.  
  25522.     Bottom:CTRL+END
  25523.  
  25524.  
  25525.  86. Saving without Exiting
  25526.  
  25527.  Product Version(s): 1.00   | 1.00
  25528.  Operating System:   MS-DOS | OS/2
  25529.  Flags: ENDUSER | appnote
  25530.  Last Modified:  6-JAN-1989    ArticleIdent: Q35538
  25531.  
  25532.  The following information is taken from an application note called
  25533.  "Microsoft Editor Questions and Answers." The application note also is
  25534.  available from Microsoft Product Support Services by calling (206)
  25535.  454-2030.
  25536.  
  25537.  Saving without Exiting
  25538.  
  25539.  You can save a file without exiting by using the keystrokes
  25540.  corresponding to the following functions:
  25541.  
  25542.     Arg Arg Setfile.
  25543.  
  25544.  A macro can be written to perform these functions in one keystroke
  25545.  (Alt+S), as follows:
  25546.  
  25547.     Save:=Arg Arg Setfile
  25548.     Save:Alt+S
  25549.  
  25550.  
  25551.  87. None Assignment Must Be Lowercase
  25552.  
  25553.  Product Version(s): 1.00   | 1.00
  25554.  Operating System:   MS-DOS | OS/2
  25555.  Flags: ENDUSER |
  25556.  Last Modified:  1-NOV-1988    ArticleIdent: Q35648
  25557.  
  25558.  When using the backup:none option in the TOOLS.INI file, the none
  25559.  cannot begin with a capitol N.
  25560.  
  25561.  The "None is an illegal setting" error will be generated if you have
  25562.  Backup:None (capitol N) in the TOOLS.INI file.
  25563.  
  25564.  The correct form is backup:none
  25565.  
  25566.  
  25567.  88. Width Function Not implemented
  25568.  
  25569.  Product Version(s): 1.00   | 1.00
  25570.  Operating System:   MS-DOS | OS/2
  25571.  Flags: ENDUSER |
  25572.  Last Modified: 20-OCT-1988    ArticleIdent: Q35649
  25573.  
  25574.  Some graphics cards allow the monitor to go into modes greater than 80
  25575.  columns. The Microsoft Editor has a function called Width to allow
  25576.  more than 80 columns, however, this function has not yet been
  25577.  implemented.
  25578.  
  25579.  This feature is under review and will be considered for inclusion in
  25580.  a future release.
  25581.  
  25582.  
  25583.  89. M on an AMDEK System 88 XT Clone
  25584.  
  25585.  Product Version(s): 1.00
  25586.  Operating System:   MS-DOS
  25587.  Flags: ENDUSER |
  25588.  Last Modified: 30-SEP-1988    ArticleIdent: Q35817
  25589.  
  25590.  Problem:
  25591.  
  25592.  When running M on an AMDEK System 88, which is an XT clone, the M
  25593.  editor hangs the machine requiring a warm boot. The machine was using
  25594.  an EPC Keyboard that is an AT style keyboard.
  25595.  
  25596.  Response:
  25597.  
  25598.  This is a known incompatibility with this hardware configuration and M
  25599.  Version 1.00. AMDEK is aware of this problem and has a patch that they
  25600.  can send you. To obtain a patch, call AMDEK at (408) 435-2832. The
  25601.  patch contains the following three files:
  25602.  
  25603.  READ.ME
  25604.  CLREPC.EXE
  25605.  SETEPC.EXE.
  25606.  
  25607.  The problem is that M was checking the keyboard, which in this case
  25608.  was an AT style keyboard, and assuming it was running on an AT clone.
  25609.  This situation caused the hang.
  25610.  
  25611.  By running SETEPC.EXE, a switch is set so M sees the keyboard as a XT
  25612.  keyboard and everything functions properly. CLREPC.EXE clears this
  25613.  switch.
  25614.  
  25615.  
  25616.  90. Placing the NULL Character in a File with M/MEP
  25617.  
  25618.  Product Version(s): 1.00   | 1.00
  25619.  Operating System:   MS-DOS | OS/2
  25620.  Flags: ENDUSER |
  25621.  Last Modified: 20-OCT-1988    ArticleIdent: Q35819
  25622.  
  25623.  Problem:
  25624.  
  25625.  I would like to place the null character in a file using M or MEP. I
  25626.  have tried using the Quote function and successfully put other
  25627.  non-printable characters in the file, such as the bell character.
  25628.  However, attempts to place a null in the file with the Quote function
  25629.  were ignored. Is this possible?
  25630.  
  25631.  Response:
  25632.  
  25633.  No. Placing null characters in a file with M/MEP is not possible. The
  25634.  editor uses null-terminated strings internally, as well as NULL return
  25635.  values from some character functions. Because the editor uses the null
  25636.  character, you are not allowed to use null.
  25637.  
  25638.  
  25639.  91. Case Sensitivity of Switches
  25640.  
  25641.  Product Version(s): 1.00
  25642.  Operating System:   MS-DOS
  25643.  Flags: ENDUSER |
  25644.  Last Modified: 31-OCT-1988    ArticleIdent: Q36415
  25645.  
  25646.  The BACKUP text switch is case sensitive with the arguments given it.
  25647.  The arguments "undel", "bak", and "none" need to be lowercase, otherwise
  25648.  an error will be reported.
  25649.  
  25650.  
  25651.  
  25652.  92. Intitialize function is Shift+F8
  25653.  
  25654.  Product Version(s): 1.00   | 1.00
  25655.  Operating System:   MS-DOS | OS/2
  25656.  Flags: ENDUSER | docerr
  25657.  Last Modified:  2-NOV-1988    ArticleIdent: Q36567
  25658.  
  25659.  There is a documentation error on Page 64 of the "Microsoft Editor for
  25660.  MS OS/2 and MS-DOS Operating Systems User's Guide". The line
  25661.  
  25662.  3. Invoke the Initialize function (press F10).
  25663.  
  25664.  should read as follows :
  25665.  
  25666.  3. Invoke the Initialize function (press SHIFT+F8)
  25667.  
  25668.  The F10 should be replaced with SHIFT+F8. SHIFT+8 is the default.
  25669.  
  25670.  
  25671.  93. Percent (%) Character in Filenames
  25672.  
  25673.  Product Version(s): 1.00   | 1.00
  25674.  Operating System:   MS-DOS | OS/2
  25675.  Flags: ENDUSER | buglist1.00
  25676.  Last Modified: 20-OCT-1988    ArticleIdent: Q36570
  25677.  
  25678.  The Microsoft Editor cannot handle a percent sign as the first
  25679.  character in the filename (%test.dat). While this is a valid DOS
  25680.  filename, it will cause garbage to be printed on the status line and
  25681.  may generate a run-time error.
  25682.  
  25683.  Microsoft has confirmed this to be a problem in Version 1.00. We are
  25684.  researching this problem and will post new information as it becomes
  25685.  available.
  25686.  
  25687.  If you fill a line with 250 characters (the maximum), then press HOME
  25688.  to go to the beginning of the line and delete the line by pressing
  25689.  CTRL-Y, the editor will crash with the following error:
  25690.  
  25691.          run-time error R6003
  25692.          -integer divide by 0
  25693.  
  25694.  Both of the above problems only occur when a percent sign is used as
  25695.  the first character in the filename. To work around this problem, do
  25696.  not use the percent sign as the first character.
  25697.  
  25698.  
  25699.  
  25700.  94. How Tabs Are Treated in the Microsoft Editor
  25701.  
  25702.  Product Version(s): 1.00   | 1.00
  25703.  Operating System:   MS-DOS | OS/2
  25704.  Flags: ENDUSER |
  25705.  Last Modified: 14-OCT-1988    ArticleIdent: Q36580
  25706.  
  25707.  Problem:
  25708.  
  25709.  Some text editors preserve tab characters automatically. These editors
  25710.  maintain tabs (ASCII 9 characters) as they are stored in a file, and
  25711.  distinguish between tab characters and spaces.
  25712.  
  25713.  The Microsoft Editor translates tab characters into spaces. This
  25714.  behavior only affects lines that you modify. If you load and save a
  25715.  file without changing any lines of text, the lines are written back to
  25716.  disk with all tab characters and spaces intact. Only the modified
  25717.  lines are affected by this conversion.
  25718.  
  25719.  It is not possible to disable this translation of tab characters into
  25720.  spaces in a modified line.
  25721.  
  25722.  In the Microsoft Editor, "tab"  is both a function name and the name
  25723.  of a key. The TAB key is assigned to the tab function by default. As a
  25724.  function, tab is nothing more than a move-to-next-column movement
  25725.  function. The placement of columns in determined by the TABSTOPS
  25726.  switch.
  25727.  
  25728.  When ever you edit a line, tab characters are translated to space
  25729.  characters using the FILETAB switch. So modified lines in the file are
  25730.  stored in the editor with spaces only. The FILETAB switch determines
  25731.  how the editor translates tab characters to spaces when reading in a
  25732.  line of text. If ENTAB is set to 1 or 2, then FILETAB also determines
  25733.  how the editor translates spaces to tabs when you save the file to
  25734.  disk. (Again, only modified lines are affected.)
  25735.  
  25736.  If you need to view the tabs as they are situated in your file you can
  25737.  use the TABDISP switch to show you which spaces will be compressed
  25738.  into a tab character at the next write to the disk file.
  25739.  
  25740.  
  25741.  95. 43- and 50-Line Modes
  25742.  
  25743.  Product Version(s): 1.00   | 1.00
  25744.  Operating System:   MS-DOS | OS/2
  25745.  Flags: ENDUSER |
  25746.  Last Modified: 20-OCT-1988    ArticleIdent: Q36613
  25747.  
  25748.  The M editor can make use of the 43-line EGA text mode and 50-line VGA
  25749.  text mode. The "height" numeric switch in the TOOLS.INI file specifies
  25750.  the number of lines used in the editing window; however, this number
  25751.  does NOT include the dialog and status display lines. Thus, to use 43
  25752.  lines of text you must set height=41; to use 50 lines you must set
  25753.  height=48.
  25754.  
  25755.  
  25756.  96. Microsoft System Journal M macros Fail
  25757.  
  25758.  Product Version(s): 1.00 1.01 | 1.00 1.01
  25759.  Operating System:   MS-DOS    | OS/2
  25760.  Flags: ENDUSER |
  25761.  Last Modified: 20-OCT-1988    ArticleIdent: Q36798
  25762.  
  25763.  In the September 1988 issue of the "MS System Journal," the article
  25764.  entitled "Customizing the Features of the M Editor Using Macros and C
  25765.  Extensions" contains erroneous examples.
  25766.  
  25767.  Both of the macros below fail in Version 1.00. Only the Bigprint macro
  25768.  fails in Version 1.01.
  25769.  
  25770.  The following is an example:
  25771.  
  25772.  Macro 1)
  25773.  
  25774.  ;print selected text macro
  25775.  print1:= copy arg "<clipboard>" setfile
  25776.  print2:= arg arg "TEMP.DAT" setfile setfile
  25777.  print3:= arg "PRINT TEMP.DAT" shell
  25778.  print4:= arg "DEL TEMP.DAT" shell
  25779.  printa:=print1 print2 print3 print4
  25780.  Printa:alt+P
  25781.  
  25782.  The above macro is supposed to print selected text. In M Version 1.00
  25783.  it works correctly the first time it is called from inside a file.
  25784.  However, it fails on subsequent calls to the macro prior to exiting
  25785.  the file. It does work correctly in the unreleased Version 1.01
  25786.  referenced in the article.
  25787.  
  25788.  The following macro is supposed to print the entire file. Instead, it
  25789.  prints only the line on which the cursor sits when the macro is
  25790.  called. As mentioned above, this fails in both Versions 1.00 and the
  25791.  unreleased Version 1.01 referred to in the article on Pages 59-72.
  25792.  
  25793.  The following is an example:
  25794.  
  25795.  Macro 2)
  25796.  
  25797.  ;bigprint macro to print entire file
  25798.  select1:= arg ppage
  25799.  select2:= arg arg "endoffile" mark
  25800.  select3:= arg mpage
  25801.  select4:= arg "endoffile"
  25802.  selectall:= select1 select2 select3 select4
  25803.  bigprint:=meta +>nometa cancel selectall meta :>nometa meta printa
  25804.  
  25805.  bigprint:Alt+z
  25806.  ;end of bigfoot macro.
  25807.  
  25808.  
  25809.  97. meta Anomalous Behavior
  25810.  
  25811.  Product Version(s): 1.00   | 1.00
  25812.  Operating System:   MS-DOS | OS/2
  25813.  Flags: ENDUSER | buglist1.00
  25814.  Last Modified: 31-OCT-1988    ArticleIdent: Q37072
  25815.  
  25816.  The following macros written for the M editor exhibit anomalous
  25817.  behavior for the function modifier meta. It appears that meta cannot
  25818.  modify itself, as demonstrated by the following macros.
  25819.  
  25820.  Microsoft has confirmed this to be a problem in Version 1.00. We are
  25821.  researching this problem and will post new information as it becomes
  25822.  available.
  25823.  
  25824.  Consider the following macros:
  25825.  
  25826.     MetaTest:= meta meta +> "meta off"=>0 :>1 "meta on":>0
  25827.     MetaTest:alt+0
  25828.     ; the above macro is supposed to check to see if the function
  25829.     ; modifier meta, invoked by the F9 key, is on or off. Compare
  25830.     ; the results of this macro with the macro immediately following.
  25831.     MetaTest1:= meta +> "meta off"=>0 :>1 "meta on":>0
  25832.     MetaTest1:alt+1
  25833.     ; the MetaTest1 macro fails to differ from the MetaTest macro in
  25834.     ; a significant manner. in contrast, consider the following
  25835.     ; macro, employing the insetmode function modifier.
  25836.     InsertTest:=insertmode insertmode +> "ins off"=>0 :>1 "ins on":>0
  25837.     InsertTest:alt+2.
  25838.  
  25839.  
  25840.  98. MASM m.exe Is Different than FORTRAN m.exe when Using DOS Comp
  25841.  
  25842.  Product Version(s): 1.00   | 1.00
  25843.  Operating System:   MS-DOS | OS/2
  25844.  Flags: ENDUSER | h_fortran
  25845.  Last Modified:  6-JAN-1989    ArticleIdent: Q38015
  25846.  
  25847.  Question:
  25848.  
  25849.  When I do a Comp command at the DOS prompt, why do the FORTRAN Version
  25850.  4.10 and MASM Version 5.10 packages contain m.exe files that differ at
  25851.  offset 15F9F, where the MASM m gives 37 and the FORTRAN m gives 38?
  25852.  Which one should I use for mixed-language programming?
  25853.  
  25854.  Response:
  25855.  
  25856.  This behavior is an error that was discovered after MASM Version 5.10
  25857.  was released, but before FORTRAN Version 4.10 was shipped. You can see
  25858.  this by invoking the editor and entering SHIFT+F1, which gives you
  25859.  file information. The date given in the MASM file is Jan. 29, 1987
  25860.  (hex37) when it should be Jan. 29, 1988 (hex 38). Other than this
  25861.  character in the date, they are identical, so you can use either one
  25862.  for mixed-language programming.
  25863.  
  25864.  
  25865.  99. Selecting Large Text Blocks with Microsoft Editor
  25866.  
  25867.  Product Version(s): 1.00   | 1.00
  25868.  Operating System:   MS-DOS | OS/2
  25869.  Flags: ENDUSER |
  25870.  Last Modified:  4-MAY-1989    ArticleIdent: Q38309
  25871.  
  25872.  Question:
  25873.  
  25874.  When I want to select a large block of code for the clipboard, I press
  25875.  ALT+A, then the DOWN ARROW key until I reach the last line I want to
  25876.  select. This process is very slow if the block I am selecting is
  25877.  several pages long (almost a whole file). Is there a way to move
  25878.  faster to select a block than by using the CURSOR key (such as the
  25879.  equivalent of ^K-B and ^K-K in Wordstar)?
  25880.  
  25881.  Response:
  25882.  
  25883.  CTRL+PGDN (Ppara) serves this purpose, as documented on Pages 91 and
  25884.  104 of the "Microsoft Editor for MS OS/2 and MS-DOS Operating Systems:
  25885.  User's Guide." This key sequence will move you to a new paragraph each
  25886.  time you press the keys. If the movement sequence you want to use
  25887.  contains an Arg, it is either used by the command or canceled.
  25888.  
  25889.  A faster method is to define a couple of macros to help out. First, we
  25890.  need a macro that will mark the beginning spot in the text, as
  25891.  follows:
  25892.  
  25893.     txtmark:=arg arg "first" mark
  25894.     txtmark:alt+t
  25895.  
  25896.  The second macro automates using the mark as an argument, as follows:
  25897.  
  25898.    callmark:=arg "first"
  25899.    callmark:alt+u
  25900.  
  25901.  You can put these lines in your TOOLS.INI file.
  25902.  
  25903.  To use this pair, move to the first spot, press ALT+T, then move up or
  25904.  down using any movement keys to the second spot. Finally, press ALT+U
  25905.  and press a key that allows a markarg as an argument. (The Copy and
  25906.  Ldelete functions are among these.) Note: no highlighting occurs, so
  25907.  you'll have to be careful.
  25908.  
  25909.  Note: if you want the argument to be entire lines rather than a box,
  25910.  the cursor MUST be in the same column when you press ALT+U as it was
  25911.  when you pressed ALT+T. If you put it in a different column, you will
  25912.  be selecting a box argument rather than a line argument.
  25913.  
  25914.  
  25915.  100. Moving to the Beginning of the Line with Microsoft Editor
  25916.  
  25917.  Product Version(s): 1.00   | 1.00
  25918.  Operating System:   MS-DOS | OS/2
  25919.  Flags: ENDUSER |
  25920.  Last Modified:  6-JAN-1989    ArticleIdent: Q38310
  25921.  
  25922.  Question:
  25923.  
  25924.  Is there a way to go to column 1 of the screen with a key sequence
  25925.  instead of pressing the LEFT ARROW key until the cursor stops at
  25926.  column 1? I find myself wasting a lot of time doing this repetitive
  25927.  chore. The HOME key only takes me to the beginning of the text on the
  25928.  line, not the beginning of the line, which is where I want to be if I
  25929.  want to delete a line, for example. I currently use ^K-S with the
  25930.  Wordstar extension.
  25931.  
  25932.  Response:
  25933.  
  25934.  Meta Begline (F9 HOME in the standard configuration) will do it. If
  25935.  you'd like it on one key, you can assign the functions to a key using
  25936.  the macro facility.
  25937.  
  25938.  
  25939.  101. Inserting a Line from Clipboard into File with Editor
  25940.  
  25941.  Product Version(s): 1.00   | 1.00
  25942.  Operating System:   MS-DOS | OS/2
  25943.  Flags: ENDUSER |
  25944.  Last Modified: 15-MAY-1989    ArticleIdent: Q38311
  25945.  
  25946.  Question:
  25947.  
  25948.  I am confused by the way a line is inserted from the clipboard into a
  25949.  file. It seems to depend on whether Insert is On or Off. Also, it
  25950.  sometimes pushes the other lines down and sometimes it pushes the
  25951.  existing line to the right. I see no consistency to all this. Can you
  25952.  explain the concepts?
  25953.  
  25954.  Response:
  25955.  
  25956.  The Insert mode has no bearing on line insertion. However, how you
  25957.  delete the line has a lot to do with it. In general, don't use the
  25958.  DEL key for multiple-character deletions. It is usually assigned to
  25959.  the sdelete function, which always deletes a stream of text, as
  25960.  documented on Page 107 of the "Microsoft Editor for MS OS/2 and MS-DOS
  25961.  Operating Systems: User's Guide."
  25962.  
  25963.  A stream is all of the text between the place where the cursor was
  25964.  when you typed Arg and where it is when you press sdelete, regardless
  25965.  of the beginning and ending cursor columns or how many lines are
  25966.  contained in the region. Whenever you mark an area and press sdelete
  25967.  (the DEL key), you will delete the STREAM you have marked, even
  25968.  though the region highlighted may look different.
  25969.  
  25970.  It's usually best to use CTRL+Y (Ldelete) for deletions which begin
  25971.  and end on different lines. Note that the COPY key (CTRL+INS) does not
  25972.  accept stream arguments, therefore, it always copies the highlighted
  25973.  area.
  25974.  
  25975.  
  25976.  102. Use a Colon when Assigning a Macro to a Keystroke
  25977.  
  25978.  Product Version(s): 1.00   | 1.00
  25979.  Operating System:   MS-DOS | OS/2
  25980.  Flags: ENDUSER | docerr
  25981.  Last Modified: 12-JAN-1989    ArticleIdent: Q39574
  25982.  
  25983.  There is a documentation error on Page 50 of the "Microsoft Editor
  25984.  User's Guide." Section 6.3.2 incorrectly shows a semicolon when
  25985.  assigning a macro to a keystroke as follows:
  25986.  
  25987.     Header;ALT+H
  25988.  
  25989.  The correct example should contain a colon as follows:
  25990.  
  25991.     Header:ALT+H
  25992.  
  25993.  
  25994.  103. Quote Function and Typing in Graphic Characters in M
  25995.  
  25996.  Product Version(s): 1.00   | 1.00
  25997.  Operating System:   MS-DOS | OS/2
  25998.  Flags: ENDUSER |
  25999.  Last Modified: 16-MAY-1989    ArticleIdent: Q39806
  26000.  
  26001.  Question:
  26002.  
  26003.  I want to input some graphics characters in the M editor. However,
  26004.  when I try to input the ASCII character 31 using the ALT key and the
  26005.  numeric keypad, the M editor beeps and displays the following message:
  26006.  
  26007.     "ctrl+_ is not assigned to any editor function"
  26008.  
  26009.  For the ASCII character 30, the M editor displays the following
  26010.  message:
  26011.  
  26012.     "ctrl+^ is not assigned to any editor function."
  26013.  
  26014.  How can I input those characters?
  26015.  
  26016.  Response:
  26017.  
  26018.  Use the editing Quote function in the M editor. The Quote function is
  26019.  associated with CTRL+P by default. After the Quote function is
  26020.  invoked, the following keystroke is taken literally. This function is
  26021.  mentioned in the "Microsoft Editor for MS OS/2 and MS-DOS Operating
  26022.  Systems User's Guide" on Page 105.
  26023.  
  26024.  The first 32 characters in the ASCII character set have two
  26025.  conflicting uses. As standard ASCII characters, they are used for
  26026.  communications control and printer control. They are also used by IBM
  26027.  to represent some useful graphics characters.
  26028.  
  26029.  Using the Quote function in the M editor can prevent these ASCII
  26030.  characters from being interrupted as control characters.
  26031.  
  26032.  
  26033.  104. M Hangs if the textarg Given to ArgCompile Is Incomplete
  26034.  
  26035.  Product Version(s): 1.00
  26036.  Operating System:   MS-DOS
  26037.  Flags: ENDUSER |
  26038.  Last Modified: 12-JAN-1989    ArticleIdent: Q40235
  26039.  
  26040.  If you want to compile a program inside the M editor using the
  26041.  following command, textarg should contain the full compile line as
  26042.  typed at the DOS prompt:
  26043.  
  26044.     Arg Arg textarg ArgCompile
  26045.  
  26046.  The following is an example:
  26047.  
  26048.     cl /Zi /Od demo.for
  26049.  
  26050.  If textarg contains just the name of the program (demo), the hard disk
  26051.  light will come on and the message "compilation complete" will appear
  26052.  on the bottom of the screen even though demo.for was not compiled.
  26053.  
  26054.  If textarg contains the full program name (demo.for), your computer
  26055.  hangs if you press SHIFT+F3. Sometimes, there will be lost clusters
  26056.  and allocation errors as reported by chkdsk.
  26057.  
  26058.  This problem was not encountered under OS/2.
  26059.  
  26060.  
  26061.  
  26062.  105. Redirecting Errors to an Error File in M
  26063.  
  26064.  Product Version(s): 1.00   | 1.00
  26065.  Operating System:   MS-DOS | OS/2
  26066.  Flags: ENDUSER |
  26067.  Last Modified:  1-MAY-1989    ArticleIdent: Q40177
  26068.  
  26069.  Under DOS, M Version 1.00 will store the error messages in the M.MSG
  26070.  file. This file is located in the directory the TMP environment
  26071.  variable points to. If TMP is not set, this file is located in
  26072.  the current working directory. Under OS/2, MEP uses named pipes, so
  26073.  there is no file to look at.
  26074.  
  26075.  
  26076.  106. FileWrite() Function Fails to Write Back Out to the File
  26077.  
  26078.  Product Version(s): 1.00   | 1.00
  26079.  Operating System:   MS-DOS | OS/2
  26080.  Flags: ENDUSER |
  26081.  Last Modified: 15-MAY-1989    ArticleIdent: Q40356
  26082.  
  26083.  Problem:
  26084.  
  26085.  I have a problem using the FileWrite Function programming with the M
  26086.  and MEP Editor Version 1.00. I want to read a file (EXAMPLE.DOC) and
  26087.  write exactly the same in a new file (FOO.DOC).
  26088.  
  26089.  Response:
  26090.  
  26091.  To test the example below, you only have to create a file named
  26092.  EXAMPLE.DOC. See the compiler switches at the end of this article. The
  26093.  second file FOO.DOC is created, but it is never written to it always
  26094.  has zero length.
  26095.  
  26096.  This is a problem with MEP Version 1.00's FileWrite() function. This
  26097.  is one of the problems that kept the filter extension described in the
  26098.  "Microsoft Systems Journal" September 1988 from working in Version
  26099.  1.00.
  26100.  
  26101.  Microsoft has confirmed this to be a problem in Version 1.00. We are
  26102.  researching this problem and will post new information as it becomes
  26103.  available.
  26104.  
  26105.  The following is a short example where the problem (Function FileWrite
  26106.  does not write) occurs:
  26107.  
  26108.  #include "ext.h"
  26109.  #define TRUE    -1
  26110.  #define FALSE   0
  26111.  #define NULL    ((char *) 0)
  26112.  
  26113.  flagType pascal EXTERNAL Write(
  26114.  unsigned int argData,
  26115.  ARG far * pArg,
  26116.  flagType fMeta)
  26117.  {
  26118.      flagType flg;
  26119.      PFILE pFile;
  26120.      char  *p = "EXAMPLE.DOC";
  26121.      char  *w = "FOO.DOC";
  26122.  
  26123.      if((pFile = FileNameToHandle(p,NULL)) == 0)
  26124.      {
  26125.          pFile = AddFile(p);
  26126.          FileRead(p, pFile);
  26127.      }
  26128.      flg = FileWrite(w, pFile);
  26129.      return (flg);
  26130.  }
  26131.  
  26132.  struct swiDesc  swiTable[] ={
  26133.      { NULL, NULL, 0 }
  26134.  };
  26135.  
  26136.  struct cmdDesc  cmdTable[] ={
  26137.      {"Write", Write, 0, NOARG },
  26138.      {NULL,  NULL, 0, 0}
  26139.  };
  26140.  
  26141.  void EXTERNAL WhenLoaded (void)
  26142.  {
  26143.      SetKey("Write", "alt+w");
  26144.      DoMessage("Write function now loaded.");
  26145.  }
  26146.  
  26147.  /*
  26148.  
  26149.  *** Compiler switches I used ***
  26150.  
  26151.  cl /c /Gs /Asfu %1.c
  26152.  cl /Lp /AC /Fe%1.dll exthdrp.obj %1.obj skel.def
  26153.  
  26154.    */
  26155.  
  26156.  
  26157.  107. Optimizing C or QuickC 2.00 Required for Writing C Extensions
  26158.  
  26159.  Product Version(s): 1.00   | 1.00
  26160.  Operating System:   MS-DOS | OS/2
  26161.  Flags: ENDUSER | S_C S_QuickC
  26162.  Last Modified: 17-MAY-1989    ArticleIdent: Q39997
  26163.  
  26164.  Question:
  26165.  
  26166.  I would like to customize the Microsoft Editor by writing C
  26167.  extensions. Can I use QuickC Version 1.00, QuickC Version 1.01, or
  26168.  QuickC Version 2.00?
  26169.  
  26170.  Response:
  26171.  
  26172.  No. You must use the Microsoft C Version 4.00 Optimizing Compiler or a
  26173.  later version to write C extensions to the Microsoft Editor. QuickC
  26174.  Versions 1.00 and 1.01 cannot be used because they do not support the
  26175.  required switch /Asfu.
  26176.  
  26177.  However, Version 2.00 does support the /Asfu switch when using QCL.
  26178.  Therefore, you can use Version 2.00 and QCL to create C extensions.
  26179.  
  26180.  For more information, see Pages 68 and 83 of the "Microsoft Editor for
  26181.  MS OS/2 and MS-DOS Operating Systems: User's Guide."
  26182.  
  26183.  
  26184.  108. Search and Replace Macro for M Editor
  26185.  
  26186.  Product Version(s): 1.00   | 1.00
  26187.  Operating System:   MS-DOS | OS/2
  26188.  Flags: ENDUSER |
  26189.  Last Modified: 12-JAN-1989    ArticleIdent: Q39998
  26190.  
  26191.  Question:
  26192.  
  26193.  Can you write a macro to perform a search and replace on a particular
  26194.  string? When I try to do so, the replace function prompts me for a
  26195.  string argument. I want the replace function to read the string from
  26196.  the macro.
  26197.  
  26198.  Response:
  26199.  
  26200.  The following is an example of a replace macro that accepts its
  26201.  argument from inside the macro:
  26202.  
  26203.     myreplace:=replace "oldtext" newline "newtext" newline
  26204.  
  26205.  When the myreplace macro is invoked, all the occurrences of "oldtext"
  26206.  string, from the cursor position to the end of the file, are replaced
  26207.  with the "newtext" string. The use of the newline function allows the
  26208.  macro to respond to the replace-function prompt for a string argument.
  26209.  
  26210.  To define the myreplace macro and assign it to the F12 key, enter the
  26211.  following keystrokes from inside the M editor:
  26212.  
  26213.     ALT+A
  26214.     MyReplace:=replace "oldtext" newline "newtext" newline
  26215.     ALT+=
  26216.  
  26217.     ALT+A
  26218.     MyReplace:F12
  26219.  
  26220.  To execute the myreplace macro, press the F12 key.
  26221.  
  26222.  
  26223.  109. M.TMP Reset When Window Closed
  26224.  
  26225.  Product Version(s): 1.00   | 1.00
  26226.  Operating System:   MS-DOS | OS/2
  26227.  Flags: ENDUSER | mep buglist1.00
  26228.  Last Modified: 15-MAY-1989    ArticleIdent: Q40681
  26229.  
  26230.  Question:
  26231.  
  26232.  When I invoke the M editor, open a second window (arg F6 or arg arg
  26233.  F6), and close the first window (meta F6), my M.TMP file is reset. The
  26234.  only file in my M.TMP file is the one that I edited to perform this
  26235.  operation. Is there a way to prevent this from happening?
  26236.  
  26237.  Response:
  26238.  
  26239.  This phenomena occurs whenever you close a window that has had a file
  26240.  opened in it. Hence, if you open a file in the second window, then
  26241.  close the second window, M.TMP is reset. To avoid this behavior, don't
  26242.  close a window in which a file has been opened.
  26243.  
  26244.  Microsoft has confirmed this to be a problem in Version 1.00. We are
  26245.  researching this problem and will post new information as it becomes
  26246.  available.
  26247.  
  26248.  
  26249.  
  26250.  110. QHMEP.DLL Remaps Two Keys in MEP Version 1.00
  26251.  
  26252.  Product Version(s): 1.00
  26253.  Operating System:   OS/2
  26254.  Flags: ENDUSER | buglist1.00
  26255.  Last Modified: 16-MAY-1989    ArticleIdent: Q41324
  26256.  
  26257.  Problem:
  26258.  
  26259.  I have remapped the keys CTRL+S and CTRL+P in MEP Version 1.00 to the
  26260.  psearch and up functions. After loading the extension QHMEP.DLL, which
  26261.  comes with the Version 1.06 OS/2 SDK, the two keys CTRL+S and CTRL+P
  26262.  are not mapped to psearch and up anymore. Furthermore, these keys
  26263.  cannot be reassigned back to psearch and up. I seem to be locked out
  26264.  of using these keys.
  26265.  
  26266.  Response:
  26267.  
  26268.  This problem occurs because the editor is taking over these keys,
  26269.  preventing them from being reassigned.
  26270.  
  26271.  Microsoft has confirmed this to be a problem in MEP Version 1.00. We are
  26272.  researching this problem and will post new information as it becomes
  26273.  available.
  26274.  
  26275.  
  26276.  
  26277.  111. Useful Macros for the Microsoft Editor
  26278.  
  26279.  Product Version(s): 1.00    |  1.00
  26280.  Operating System:   MS-DOS  | OS/2
  26281.  Flags: ENDUSER |
  26282.  Last Modified: 16-MAY-1989    ArticleIdent: Q40755
  26283.  
  26284.  Below are macros for the Microsoft Editor that allow you to save a
  26285.  marked portion of a file and insert it into another file. Also, there
  26286.  are macros that speed up marking large areas of text.
  26287.  
  26288.  To save a marked area of a file, mark the area and invoke this macro
  26289.  by typing ALT+V. Note that although the macro is broken onto two lines
  26290.  here, you should put it on one line in your TOOLS.INI file.
  26291.  
  26292.  savemark:=copy arg "command /c del c:\\t" shell arg "\\t" setfile
  26293.            refresh paste setfile
  26294.  savemark:alt+v
  26295.  
  26296.  A one-key way to include the file in another file is to use the macro
  26297.  by typing ALT+I:
  26298.  
  26299.  insertmark:=arg arg "\\t" paste
  26300.  insertmark:alt+i
  26301.  
  26302.  To mark the top and bottom of the text area, use these macros. Type
  26303.  ALT+T to place the marker, then ALT+U to use it. Type CTRL+INS or
  26304.  CTRL+Y to copy or delete the text. Note that if your cursor is not in
  26305.  the same column when you type ALT+U as when you typed ALT+T, the area
  26306.  marked will be a box rather than a set of lines. Note also that the
  26307.  marked area will NOT show up on the screen.
  26308.  
  26309.  tempmark:=arg arg "temp" mark
  26310.  usemark:=arg "temp"
  26311.  tempmark:alt+t
  26312.  usemark:alt+u
  26313.  
  26314.  
  26315.  
  26316.  112. Using Brief Emulation and Tags in TOOLS.INI
  26317.  
  26318.  Product Version(s): 1.00   | 1.00
  26319.  Operating System:   MS-DOS | OS/2
  26320.  Flags: ENDUSER | buglist1.00
  26321.  Last Modified: 17-MAY-1989    ArticleIdent: Q41475
  26322.  
  26323.  If you invoke a tagged section from your TOOLS.INI when using the
  26324.  Microsoft editor with brief keystroke emulation, some of the key
  26325.  assignments will revert back to the default.
  26326.  
  26327.  Microsoft has confirmed this to be a problem in Version 1.00. We are
  26328.  researching this problem and will post new information as it becomes
  26329.  available.
  26330.  
  26331.  As demonstrated in the following example, some of the keystrokes are
  26332.  reassigned to the default keystrokes if you rename the BRIEF.INI file
  26333.  to be TOOLS.INI and then add a new tag section:
  26334.  
  26335.  [m-mono]
  26336.      height:23
  26337.      fgcolor:07
  26338.      errcolor:0F
  26339.      stacolor:70
  26340.      infcolor:70
  26341.  
  26342.  Start editing a file, then bring in this new tag field by typing the
  26343.  following:
  26344.  
  26345.     arg "mono" shift+f10
  26346.  
  26347.  The following demonstrates this behavior and all compile lines revert
  26348.  to default:
  26349.  
  26350.     window             will change from F1 to unassigned
  26351.     help               will change from ALT+H to F1
  26352.     argcompile         will change from ALT+F10 to F5
  26353.     save               will change from ALT+W to undefined
  26354.     linemark           will change from ALT+I to undefined
  26355.     linetotop          will change from CTRL+T to undefined
  26356.     leftsideofwindow   will change from SHIFT+HOME to undefined
  26357.     rightsideofwindow  will change from SHIFT+END to undefined
  26358.     createhorizwindow  will change from F3 to undefined
  26359.     createvertwin      will change from F4 to undefined
  26360.     deletewindow       will change from F5 to undefined
  26361.  
  26362.  
  26363.  
  26364.  113. Minimum Requirements for Writing a M Extension
  26365.  
  26366.  Product Version(s): 1.00   | 1.00
  26367.  Operating System:   MS-DOS | OS/2
  26368.  Flags: ENDUSER |
  26369.  Last Modified: 16-MAY-1989    ArticleIdent: Q42241
  26370.  
  26371.  Question:
  26372.  
  26373.  What files and software do I need to be able to write an extension for
  26374.  the Microsoft Editor?
  26375.  
  26376.  Response:
  26377.  
  26378.  To create C extensions, you need to have the following files and
  26379.  software present in your current directory (or directories listed in
  26380.  the PATH or INCLUDE environment variables, as appropriate):
  26381.  
  26382.  1. The Microsoft C Optimizing Compiler Version 4.00 or later;
  26383.     or Microsoft QuickC Version 2.00
  26384.  
  26385.  2. The Microsoft Overlay Linker Version 3.60 or later; or the
  26386.     Microsoft Segmented-Executable Linker Version 5.01
  26387.  
  26388.  3. EXTHDR.OBJ (supplied with the editor) or EXTHDRP.OBJ (a file
  26389.     supplied with the editor for creating protected-mode extensions)
  26390.  
  26391.  4. EXT.H header file provided with the editor
  26392.  
  26393.  5. SKEL.DEF, the standard definitions file supplied with the editor;
  26394.     to be used with all extension
  26395.  
  26396.  You need a minimum 150K of available memory for the editor to load a C
  26397.  extension at run time in addition to the size of the extension itself.
  26398.  
  26399.  
  26400.  114. 43- and 50-Line Modes with the IBM 8514 Monitor
  26401.  
  26402.  Product Version(s): 1.00 1.02
  26403.  Operating System:   MS-DOS
  26404.  Flags: ENDUSER | buglist1.00 fixlist1.02
  26405.  Last Modified: 28-JUL-1989    ArticleIdent: Q42365
  26406.  
  26407.  The Microsoft Editor does not go into 43- or 50-line line mode on the
  26408.  IBM 8514 monitor.
  26409.  
  26410.  Version 1.00 of the Microsoft Editor does not support higher line
  26411.  modes with the IBM 8514 monitor. Regardless of the switch setting you
  26412.  give in the TOOLS.INI file, it always comes up in 25-line mode.
  26413.  
  26414.  For example, setting the height:41 or height:48 switch in the
  26415.  TOOLS.INI file results in the Microsoft Editor coming up in 25-line
  26416.  mode.
  26417.  
  26418.  Microsoft has confirmed this to be a problem in Version 1.00 of the
  26419.  Microsoft Editor. This problem was corrected in the Microsoft Editor
  26420.  Version 1.02.
  26421.  
  26422.  
  26423.  115. Savecur and Restcur Save Relative Position in File, on Screen
  26424.  
  26425.  Product Version(s): 1.00   | 1.00
  26426.  Operating System:   MS-DOS | OS2
  26427.  Flags: ENDUSER |
  26428.  Last Modified: 17-MAY-1989    ArticleIdent: Q42758
  26429.  
  26430.  The Microsoft Editor functions Savecur and Restcur save the current
  26431.  cursor position relative to the file and the screen. Therefore, the
  26432.  screen will be restored exactly as it appeared when the Savecur
  26433.  function was invoked.
  26434.  
  26435.  The following macros were intended to scroll the screen up and down
  26436.  while leaving the cursor position relative to the terminal screen to
  26437.  be stationary:
  26438.  
  26439.  ReposDown:=Savecur Meta Up Up Restcur
  26440.  ReposDown:Ctrl+Down
  26441.  
  26442.  ReposUp:=Savecur Meta Down Down Restcur
  26443.  ReposUp:Ctrl+Up
  26444.  
  26445.  Because Savecur and Restcur preserve and restore the cursor position
  26446.  relative to the screen, the macros appear to do nothing. But actually,
  26447.  each executes correctly. For example, the ReposDown does the following:
  26448.  
  26449.  1. Savecur : saves the current position relative to the file and the
  26450.               screen
  26451.  
  26452.  2. Meta Up : moves the cursor to the top of the screen
  26453.  
  26454.  3. Up      : moves the cursor up one line, (thus scrolling the screen
  26455.               down one line)
  26456.  
  26457.  4. Restcur : restores the screen to the original configuration
  26458.               (appears as if nothing had happened)
  26459.  
  26460.  One way to achieve the desired result is to use the Mark function. The
  26461.  Mark function saves the current location in the file. The relative
  26462.  screen position is not preserved, whereas the Savecur and Restcur
  26463.  functions do save the relative screen position.
  26464.  
  26465.  The following macros give the desired result:
  26466.  
  26467.  ReposDown:=Arg Arg "tag" Mark Meta Up Up Arg "tag" Mark Up
  26468.  ReposDown:Ctrl+Up
  26469.  
  26470.  ReposUp:=Arg Arg "tag" Mark Meta Down Down Arg "tag" Mark Down
  26471.  ReposUp:Ctrl+Down
  26472.  
  26473.  The word "tag" is an arbitrary tagname for the Mark function.
  26474.  
  26475.  
  26476.  116. Copy Is a Reserved Word
  26477.  
  26478.  Product Version(s): 1.00   | 1.00
  26479.  Operating System:   MS-DOS | OS/2
  26480.  Flags: ENDUSER |
  26481.  Last Modified: 17-MAY-1989    ArticleIdent: Q42763
  26482.  
  26483.  The word copy is a reserved word in the Microsoft Editor. If you write
  26484.  an M extension and name it "copy", the editor will load but not
  26485.  execute your extension.
  26486.  
  26487.  If you name the function (for example) cpy rather than copy, it will
  26488.  work correctly.
  26489.  
  26490.  The following declaration incorrectly uses the reserved word "copy."
  26491.  Renaming the the function "cpy" will resolve the problem:
  26492.  
  26493.  flagType pascal EXTERNAL copy (argData, Parg, fMeta)
  26494.  unsigned int argData;
  26495.  ARG far *Parg;
  26496.  flagType fMeta;
  26497.  
  26498.  
  26499.  
  26500.  117. A C Extension to Select an Arbitrary Number of Lines of Text
  26501.  
  26502.  Product Version(s): 1.00
  26503.  Operating System:   MS-DOS
  26504.  Flags: ENDUSER | extension highlight select
  26505.  Last Modified:  1-JUN-1989    ArticleIdent: Q43006
  26506.  
  26507.  To select an arbitrary number of lines of text in the Microsoft
  26508.  Editor, I must use the Arg function, then use the DOWN ARROW key until
  26509.  the desired number of lines are selected. This is inconvenient if more
  26510.  than a few lines are to be selected.
  26511.  
  26512.  This article provides a simple editor extension that selects the
  26513.  number of lines you specify.
  26514.  
  26515.  For information on loading the function, refer to the M editor
  26516.  reference manual.
  26517.  
  26518.  To invoke the function, use the Arg key to introduce the argument
  26519.  (i.e., the number of lines to be selected), then press the key
  26520.  assigned to the function. In Version 1.00 of M, the selected text will
  26521.  not be highlighted.   In Version 1.02 of M, the selected text will be
  26522.  highlighted, however further cursor movements will change the selected
  26523.  area without altering the highlighted area.
  26524.  
  26525.  ================ Make file ===============
  26526.  
  26527.  BASE=select
  26528.  CFLAGS=-c -W2 -Asfu -Gs
  26529.  LINKFLAGS=/NOI /NOD
  26530.  
  26531.  $(BASE).obj : $(BASE).c
  26532.      cl $(CFLAGS) $(BASE).c
  26533.  
  26534.  $(BASE).exe : $(BASE).obj
  26535.      link exthdr.obj $(BASE), $(BASE), \
  26536.      $(LINKFLAGS),clibcer.lib;
  26537.  
  26538.  ================ select.c ================
  26539.  
  26540.  #include "ext.h"
  26541.  #include <stdlib.h>
  26542.  
  26543.  #define TRUE    -1
  26544.  #define FALSE   0
  26545.  #define NULL    ((char *) 0)
  26546.  
  26547.  flagType pascal EXTERNAL Select (argData, pArg, fMeta)
  26548.  unsigned int argData;
  26549.  ARG far * pArg;
  26550.  flagType fMeta;
  26551.  {
  26552.      int  nCount, i ;
  26553.  
  26554.      if (pArg->argType == TEXTARG)
  26555.          if (nCount = atoi (pArg->arg.textarg.pText))
  26556.              {
  26557.              for (i = 0 ; i < nCount ; i++)
  26558.                  fExecute ("Arg Down") ;
  26559.              }
  26560.  
  26561.      return TRUE;
  26562.  }
  26563.  
  26564.  struct swiDesc  swiTable[] =
  26565.  {
  26566.      {   NULL, NULL, NULL    }
  26567.  };
  26568.  
  26569.  struct cmdDesc  cmdTable[] =
  26570.  {
  26571.      {"Select", Select, 0, TEXTARG},
  26572.      {NULL,  NULL, NULL, NULL}
  26573.  };
  26574.  
  26575.  WhenLoaded ()
  26576.  {
  26577.       SetKey("SELECT","ALT+B");
  26578.       return TRUE;
  26579.  }
  26580.  
  26581.  
  26582.  118. Cannot Use Standard Device Names as Filenames
  26583.  
  26584.  Product Version(s): 1.00   | 1.00
  26585.  Operating System:   MS-DOS | OS/2
  26586.  Flags: ENDUSER |
  26587.  Last Modified: 17-MAY-1989    ArticleIdent: Q43074
  26588.  
  26589.  You cannot use the standard device names (COMx, LPTx, and CON) as the
  26590.  base filename in the Microsoft Editor.
  26591.  
  26592.  For example, the command "M COM1.C" under DOS will attempt to open the
  26593.  communications port for editing and will hang the computer.
  26594.  
  26595.  This information has been tested for the following devices: COM1,
  26596.  COM2, LPT1, LPT2, CON. The different devices give slightly different
  26597.  results. COM1 and COM2 will hang the computer immediately, but the
  26598.  others will give errors or hang when the file is saved.
  26599.  
  26600.  The protect-mode editor behaves in the same fashion.
  26601.  
  26602.  
  26603.  119. Accessing Predefined Switches in C-Extension
  26604.  
  26605.  Product Version(s): 1.02   |  1.02
  26606.  Operating System:   MS-DOS | OS/2
  26607.  Flags: ENDUSER | FindSwitch
  26608.  Last Modified: 17-MAY-1989    ArticleIdent: Q43436
  26609.  
  26610.  When writing a C extension for Microsoft Editor Version 1.02, you can
  26611.  access the predefined editor switches through the function
  26612.  FindSwitch(). FindSwitch() is intended to be used to access the values
  26613.  of the predefined editor switches, not to modify the values. Modifying
  26614.  the switches through FindSwitch() has undefined results.
  26615.  
  26616.  The following code fragment retrieves the value of the switch
  26617.  "tabstops" for use in your C extension:
  26618.  
  26619.  #include "ext.h"
  26620.        .
  26621.        .
  26622.        .
  26623.  
  26624.  PSWI pTabStops ;
  26625.  int  nTabStops ;
  26626.        .
  26627.        .
  26628.        .
  26629.  
  26630.  pTabStops = FindSwitch ("tabstops") ;
  26631.  nTabStops = *(pTabStops->act.ival) ;
  26632.  
  26633.  Any change to the value of the switch "tabstops" made outside your
  26634.  C extension will be reflected in the value of nTabStops inside your
  26635.  C extension.
  26636.  
  26637.  You can find the FindSwitch() prototype in the include file EXT.H. The
  26638.  function FindSwitch() is not available in the Microsoft Editor Version
  26639.  1.00.
  26640.  
  26641.  The structure, swiTable, consists of a series of structures, each
  26642.  structure describing a user-defined switch. The purpose of swiTable is
  26643.  to add user-defined, not predefined, switches. It is incorrect to name
  26644.  the predefined switches in the switch table. For that reason the
  26645.  following example is incorrect as it names "tabstops," a predefined
  26646.  switch:
  26647.  
  26648.  struct swiDesc swiTable [] =
  26649.   {
  26650.    {"tabstops", &nTabStops, NUMERIC | RADIX10}   /*  INCORRECT  */
  26651.    { NULL, NULL, 0}
  26652.   } ;
  26653.  
  26654.  Do not modify the predefined switches through the switch table. You
  26655.  can change the values of the predefined switches from within an
  26656.  editing session or in TOOLS.INI.
  26657.  
  26658.  
  26659.  120. The Editor Can Be Very Slow When MEP Memory Limit Is Pushed
  26660.  
  26661.  Product Version(s): 1.00 1.02
  26662.  Operating System:   OS/2
  26663.  Flags: ENDUSER |
  26664.  Last Modified: 17-MAY-1989    ArticleIdent: Q44000
  26665.  
  26666.  Problem:
  26667.  
  26668.  I have a file FOO, which is 21733 bytes long and contains 850 lines.
  26669.  When I perform the following steps the compiler appears to hang. In
  26670.  fact, however, the compiler is being forced to go to disk for its own
  26671.  memory management.
  26672.  
  26673.  When performing the steps described below with the README.DOC from C
  26674.  Version 5.10 (which is 64964 bytes) and running on a 16mHz machine,
  26675.  after Arg Refresh, it took almost 30 seconds for MEP to return
  26676.  control.
  26677.  
  26678.  This problem is due to the fact that MEP does its own memory
  26679.  management. When you do Arg Refresh, MEP must reread the buffer
  26680.  containing the modified file from disk. In addition, MEP must store
  26681.  back to disk the buffer containing the last block of text pasted to
  26682.  the file. This swapping of two large files is what causes the delay.
  26683.  
  26684.  Microsoft has confirmed this lack of speed to be a limitation with
  26685.  Version 1.00 and 1.02 of the Microsoft Editor. We are researching this
  26686.  problem  and will post new information as it becomes available.
  26687.  
  26688.  To duplicate this problem, perform the following steps:
  26689.  
  26690.  1. Invoke the following to run the editor:
  26691.  
  26692.        [C:\]m foo
  26693.  
  26694.  2. Make some changes to modify the buffer.
  26695.  
  26696.  3. Issue the following command to the editor:
  26697.  
  26698.        arg "bar" setfile
  26699.  
  26700.     The editor responds "File c:\bar does not exist, create?"
  26701.  
  26702.  4. Respond "y" for yes. You are now in bar's buffer.
  26703.  
  26704.  5. Issue the following command to read in the original contents of the
  26705.     file:
  26706.  
  26707.        arg arg "foo" paste
  26708.  
  26709.     This process should work correctly.
  26710.  
  26711.  6. If you now want to get rid of the new buffer, issue the following
  26712.     command:
  26713.  
  26714.        arg refresh
  26715.  
  26716.     The editor responds with something similar to the following:
  26717.  
  26718.        "Do you really want to delete the buffer?"
  26719.  
  26720.  7. Respond "y" for yes.
  26721.  
  26722.     The editor appears to hang.
  26723.  
  26724.  
  26725.  121. Why Syntax Errors Might Not Display While Compiling in M
  26726.  
  26727.  Product Version(s): 1.00   | 1.00
  26728.  Operating System:   MS-DOS | OS/2
  26729.  Flags: ENDUSER |
  26730.  Last Modified:  1-MAY-1989    ArticleIdent: Q43647
  26731.  
  26732.  Question:
  26733.  
  26734.  While inside the Microsoft Editor, I compiled a program that I know
  26735.  contained syntax errors. The message "Compilation Complete - return
  26736.  code is x" (where "x" is an integer value) appeared, signifying that
  26737.  an error had occurred while compiling.
  26738.  
  26739.  I pressed SHIFT+F3 to display those errors and the message "No more
  26740.  compilation messages" was displayed on the bottom of the screen. Why
  26741.  aren't my program's error messages displayed inside the editor?
  26742.  
  26743.  Response:
  26744.  
  26745.  You see error messages only if the compiler or linker runs correctly
  26746.  and passes the error messages in the correct format to the editor; if
  26747.  the compiler itself fails, you will not see any messages.
  26748.  
  26749.  Because M spawns the compiler, you could be running out of file
  26750.  handles. You know that the system has run out file handles if the
  26751.  M.MSG file is not created. Setting files=20 in your CONFIG.SYS file
  26752.  should correct the problem.
  26753.  
  26754.  Other possible causes for not getting error messages are as follows:
  26755.  
  26756.  1. You could be running out of memory. You can check this by shelling
  26757.     out of M.EXE (with SHIFT+F9) and issuing the DOS CHKDSK command to
  26758.     display the available memory.
  26759.  
  26760.  2. The compiler might not be able to find the specified file.
  26761.     Consider the following example, in which you invoke M.EXE as
  26762.     follows:
  26763.  
  26764.        C:\> M c:\c5\source\test.c
  26765.  
  26766.     If you compile the program with ARG COMPILE, the information line
  26767.     displays the following:
  26768.  
  26769.        CL /c /Zep /D LINT_ARGS test.c.
  26770.  
  26771.     The compiler will not find TEST.C in the current directory, so an
  26772.     error is returned.
  26773.  
  26774.     For more information, query on the following phrases:
  26775.  
  26776.        Microsoft Editor
  26777.        full path
  26778.  
  26779.  3. The EXTMAKE switches might have been incorrectly modified in the
  26780.     TOOLS.INI file, as in the following example:
  26781.  
  26782.        EXTMAKE:bas BC /Zi /O %s
  26783.  
  26784.     The line above is incorrect because it is missing a semicolon (;)
  26785.     at the end. The command line following the extension must be complete.
  26786.     Both the Microsoft BASIC Compiler and MASM will prompt you for
  26787.     additional information if a semicolon is not at the end of the line.
  26788.  
  26789.  4. Make sure the options used are valid for the compiler. In the
  26790.     following example, the option /Fa is an invalid option for the
  26791.     QCL.EXE compiler:
  26792.  
  26793.        QCL /Fa filename.c
  26794.  
  26795.  5. The compiler must be in the current path. If the compiler fails to
  26796.     execute, due to some problem external to the editor, M will
  26797.     display the ambiguous message "No more compilation messages."
  26798.  
  26799.     A good way to check the validity of the Compile command and to check
  26800.     for the presence of the compiler is to type in the compile line with
  26801.     all of the options directly from DOS.
  26802.  
  26803.  
  26804.  122. MEP GP Faults After Consecutive Searches.
  26805.  
  26806.  Product Version(s): 1.00
  26807.  Operating System:   OS/2
  26808.  Flags: ENDUSER | buglist1.00
  26809.  Last Modified:  1-JUN-1989    ArticleIdent: Q44887
  26810.  
  26811.  MEP gets an access violation and crashes after several searches for a
  26812.  string.
  26813.  
  26814.  Microsoft has confirmed this to be a problem with MEP.EXE Version
  26815.  1.00. This problem was corrected in MEP.EXE Version 1.02.
  26816.  
  26817.  Note: Version 1.02 of the Microsoft Editor is only available with
  26818.  FORTRAN 5.00. The documentation required for M and MEP Version 1.02
  26819.  make it impossible to release except with a major language release.
  26820.  
  26821.  The text file that caused MEP to fail was 54400 bytes and contained
  26822.  the string "error" in 81 different locations. To reproduce this
  26823.  problem, search for the string "error". The default keystrokes are
  26824.  
  26825.     Arg "error" F3
  26826.  
  26827.  for the first search, and the following for each additional search:
  26828.  
  26829.     F3
  26830.  
  26831.  On the 81st search, the Microsoft Editor for Protect, generates a
  26832.  General Protection Violation.
  26833.  
  26834.  
  26835.  123. Status Line Input with a Blinking Cursor
  26836.  
  26837.  Product Version(s): 1.00   | 1.00
  26838.  Operating System:   MS-DOS | OS/2
  26839.  Flags: ENDUSER | GETINPUT.ARC S12311.EXE
  26840.  Last Modified: 13-SEP-1989    ArticleIdent: Q44925
  26841.  
  26842.  Question:
  26843.  
  26844.  Is it possible in the Microsoft Editor to write an extension that will
  26845.  accept a line of input from the user, preferably from the status line?
  26846.  
  26847.  Response:
  26848.  
  26849.  Version 1.02 of the Microsoft Editor offers a very convenient way to
  26850.  do this. The GetString() callback function performs exactly this type
  26851.  of input. Version 1.00 of the Editor, however, does not have such a
  26852.  callback. It is possible to put together a routine that reads user
  26853.  input using the ReadChar() function in M Version 1.00. However, since
  26854.  ReadChar() waits for the next available character, there is no
  26855.  convenient way to flash a cursor during input when using this
  26856.  approach.
  26857.  
  26858.  The function provided below is a status-line input routine that does
  26859.  provide a flashing cursor. It uses the KbHook() and KbUnHook()
  26860.  functions to prevent the editor from scanning the keyboard and then
  26861.  reads the keyboard directly using the kbhit() and getch() functions
  26862.  from the C run-time library.
  26863.  
  26864.  An example C extension that demonstrates this function is available
  26865.  in the Software\Data Library. This file can be found by searching on
  26866.  the keyword GETINPUT, the Q number of this article, or S12311.
  26867.  GETINPUT was archived using the PKware file-compression utility.
  26868.  
  26869.  Status-Line Input Routine
  26870.  -------------------------
  26871.  
  26872.  #include "ext.h"
  26873.  #include <stdio.h>
  26874.  #include <string.h>
  26875.  #include <stdlib.h>
  26876.  #include <conio.h>
  26877.  
  26878.  #define TRUE            1
  26879.  #define FALSE           0
  26880.  
  26881.  typedef unsigned        BOOL;
  26882.  
  26883.  char *GetInput( int BufLen, char *theBuffer );
  26884.  
  26885.  /* GetInput provides a means of getting user input from the status line
  26886.   * with a blinking cursor in a manner similar to M 1.02's GetString().
  26887.   * KbUnHook is used to capture keyboard input. KbHook restores normal
  26888.   * keyboard reading to the editor.
  26889.   *
  26890.   * Receives:    BufLen - Length of input buffer
  26891.   *              theBuffer - Pointer to input buffer
  26892.   *
  26893.   * Returns:     A pointer to the modified buffer, or NULL if ESC was
  26894.   *              used to cancel input.
  26895.   */
  26896.  char *GetInput(
  26897.      int             BufLen,
  26898.      char            *theBuffer )
  26899.  {
  26900.      char            Key;                        /* ASCII code of key */
  26901.      int             i = 0;                      /* Position in buffer */
  26902.      BOOL            CursorOn = TRUE;            /* State of cursor */
  26903.      int             FlashCount = 0;             /* Cursor state counter */
  26904.      int             CursorToggleCount = 100;    /* Iterations between changes
  26905.                                                     in cursor state */
  26906.      char            *r;                         /* Return pointer */
  26907.  
  26908.      /* Unhook the keyboard so that the editor no longer intercepts
  26909.       * keystrokes.
  26910.       */
  26911.      KbUnHook();
  26912.  
  26913.      /* Get keyboard input from user, stopping when ESC or ENTER is hit.
  26914.       * Characters not in the range of 32 to 127 are ignored.  Backspace
  26915.       * will work properly.  No more than (BufLen - 2) characters may
  26916.       * be entered.
  26917.       */
  26918.      do
  26919.      {
  26920.          /* Flash a cursor while waiting for the next keypress.
  26921.           */
  26922.          while( !kbhit() )
  26923.          {
  26924.              if( ++FlashCount == CursorToggleCount )
  26925.              {
  26926.                  FlashCount = 0;
  26927.                  CursorOn = !CursorOn;
  26928.                  if( CursorOn )
  26929.                  {
  26930.                      strcat( theBuffer, "_" );
  26931.                      DoMessage( theBuffer );
  26932.                  }
  26933.                  else
  26934.                  {
  26935.                      theBuffer[i] = '\0';
  26936.                      DoMessage( theBuffer );
  26937.                  }
  26938.              }
  26939.          }
  26940.  
  26941.          /* Snarf the key
  26942.           */
  26943.          Key = (char)getch();
  26944.  
  26945.          /* Handle backspace.
  26946.           */
  26947.          if( (Key == 8) && (i > 0) )
  26948.          {
  26949.              theBuffer[--i] = '\0';
  26950.              DoMessage( theBuffer );
  26951.          }
  26952.  
  26953.          /* Handle normal character.
  26954.           */
  26955.          if( (Key >=32) && (Key <= 127) && (i < BufLen - 2) )
  26956.          {
  26957.              theBuffer[i++] = Key;
  26958.              theBuffer[i] = '\0';
  26959.              DoMessage( theBuffer );
  26960.          }
  26961.      } while( (Key != 13) && (Key != 27) );
  26962.  
  26963.      /* If ESC was pressed, toss the input and NULL the input buffer,
  26964.       * else perform a little cleanup.
  26965.       */
  26966.      if( Key == 27 )
  26967.      {
  26968.          theBuffer[0] = '\0';
  26969.          DoMessage( theBuffer );
  26970.          r = NULL;
  26971.      }
  26972.      else
  26973.      {
  26974.          if( CursorOn )
  26975.              theBuffer[i] = '\0';
  26976.          DoMessage( theBuffer );
  26977.          r = theBuffer;
  26978.      }
  26979.  
  26980.      /* Restore normal keyboard input.
  26981.       */
  26982.      KbHook();
  26983.  
  26984.      return( r );
  26985.  }
  26986.  
  26987.  
  26988.  124. CALLTREE Produces No Warnings When Out of Disk Space
  26989.  
  26990.  Product Version(s): 1.00   | 1.00
  26991.  Operating System:   MS-DOS | OS/2
  26992.  Flags: ENDUSER | S_C H_MASM H_Fortran S_PasCal
  26993.  Last Modified: 23-JUN-1989    ArticleIdent: Q45618
  26994.  
  26995.  The CALLTREE.EXE utility shipped with the Microsoft Editor (included
  26996.  with MASM, Optimizing C, FORTRAN, and Pascal) does not produce a
  26997.  warning if it runs out of disk space while writing output files. It
  26998.  simply closes the file being currently written and attempts to produce
  26999.  the next file. If the disk has no space free, the file will be created
  27000.  and closed with a length of 0 (zero) bytes. No error messages are
  27001.  produced in any case.
  27002.  
  27003.  Microsoft is aware of this limitation of CallTree. The error checking
  27004.  and messages features are under review and will be considered for
  27005.  inclusion in a future release.
  27006.  
  27007.  
  27008.  125. Documentation Errors in "Configuring On-Line Help" for M 1.02
  27009.  
  27010.  Product Version(s): 1.02   | 1.02
  27011.  Operating System:   MS-DOS | OS/2
  27012.  Flags: ENDUSER | docerr
  27013.  Last Modified: 11-SEP-1989    ArticleIdent: Q46272
  27014.  
  27015.  There are several documentation errors in the section "Configuring
  27016.  On-Line Help" on Page 101 of the "Microsoft Editor User's Guide for MS
  27017.  OS/2 and MS-DOS Operating Systems." This is the documentation for the
  27018.  Microsoft Editor (M) Version 1.02, which first became available with
  27019.  FORTRAN Version 5.00. These errors prevent access to M help. The
  27020.  documentation says to add the following tagged section to your
  27021.  TOOLS.INI file:
  27022.  
  27023.     [m-help.mxt mep-help.mxt]
  27024.     helpfiles:path\file.hlp
  27025.  
  27026.  The tag header should be as follows:
  27027.  
  27028.     [m-help mep-mhelp]
  27029.  
  27030.  Including ".mxt" prevents M from accessing help.
  27031.  
  27032.  Also, in the paragraph labeled Number 2 that describes installation
  27033.  for on-line Help when running under OS/2 protected mode only, there is
  27034.  a misprint. The following sentence refers to a nonexistent file
  27035.  "MHELP.DLL":
  27036.  
  27037.     MHELP.DLL is an extension to the editor.
  27038.  
  27039.  The correct file is MHELP.PXT, so the sentence should read as follows:
  27040.  
  27041.     MHELP.PXT is an extension to the editor.
  27042.  
  27043.  
  27044.  126. CMD.EXE Shell Fails with Incorrect COMSPEC
  27045.  
  27046.  Product Version(s): 1.00 1.02
  27047.  Operating System:   OS/2
  27048.  Flags: ENDUSER |
  27049.  Last Modified: 26-SEP-1989    ArticleIdent: Q47763
  27050.  
  27051.  Question:
  27052.  
  27053.  When I attempt to shell out of the MEP editor environment via the
  27054.  Shell editor function (SHIFT+F9), why does the following message
  27055.  appear at the bottom of the screen?
  27056.  
  27057.     Spawn failed on C:\OS2\CMD.EXE   - No such file or directory
  27058.  
  27059.  Response:
  27060.  
  27061.  The problem is usually due to an incorrect setting of the COMSPEC
  27062.  environment variable in the CONFIG.SYS file. A faulty setting of this
  27063.  variable, which informs the operating system of the command
  27064.  interpreter's location, prevents the DOS EXEC system call from finding
  27065.  and executing the command interpreter. Use the following procedure to
  27066.  eliminate the problem:
  27067.  
  27068.  1. Verify that the CMD.EXE file is in the directory specified by the
  27069.     COMSPEC environment variable.
  27070.  
  27071.  2. Ensure the syntax correctness of the COMSPEC setting. There should
  27072.     be no spaces on either side of the equal sign, and a carriage
  27073.     return must appear immediately following the last character of the
  27074.     path and filename setting.
  27075.  
  27076.         Correct example:       SET COMSPEC=C:\OS2\CMD.EXE<cr>
  27077.  
  27078.         Incorrect examples:    SET COMSPEC = C:\OS2\CMD.EXE<cr>
  27079.                                SET COMSPEC=C:\OS2\CMD.EXE;<cr>
  27080.                                SET COMSPEC=C:\OS2\CMD.EXE<space><cr>
  27081.  
  27082.  Under MEP 1.02, the COMSPEC environment variable is used to locate the
  27083.  command interpreter. If the command interpreter is not found according
  27084.  to the COMSPEC variable, the "Spawn failed...." error message is
  27085.  displayed. MEP Version 1.02 does not use the PATH environment variable
  27086.  for additional searching of CMD.EXE.
  27087.  
  27088.  Under MEP Version 1.00, however, the PATH variable is used when the
  27089.  CMD.EXE is not found via the COMSPEC setting. Hence, if the spawn
  27090.  failure error occurs when attempting to shell out of the MEP 1.00
  27091.  environment, examine the COMSPEC setting and also verify that CMD.EXE
  27092.  is traversed by the search path of the PATH environment variable in
  27093.  the CONFIG.SYS.
  27094.  
  27095.  
  27096.  127. Curtime Function Pulls In Time Editor Was Invoked
  27097.  
  27098.  Product Version(s): 1.00 | 1.00
  27099.  Operating System:   OS/2 | MS-DOS
  27100.  Flags: ENDUSER | buglist1.00 fixlist1.02
  27101.  Last Modified: 28-JUL-1989    ArticleIdent: Q46790
  27102.  
  27103.  The Microsoft Editor Version 1.00 does not implement the Curtime
  27104.  function correctly. The manual states that the current time will be
  27105.  inserted at the cursor when this function is invoked. Actually, the
  27106.  time the editor was invoked is inserted at the cursor. To get around
  27107.  this problem, simply initialize the editor before calling the Curtime
  27108.  function.
  27109.  
  27110.  Microsoft has confirmed this to be a problem in Version 1.00. This
  27111.  problem was corrected in Version 1.02 of the Microsoft Editor.
  27112.  
  27113.  The following macro illustrates how the Curtime function is invoked.
  27114.  This macro should be placed in the TOOLS.INI file under the [m] tag.
  27115.  
  27116.     time:=Curtime
  27117.     time:ALT+T
  27118.  
  27119.  When editing a file, pressing ALT+T inserts the time that the editor
  27120.  was loaded at the cursor. To obtain the current system time, either
  27121.  invoke the Initialize function by pressing SHIFT+F8 before ALT+T, or
  27122.  change the macro as follows:
  27123.  
  27124.     time:=Initialize Curtime
  27125.     time:ALT+T
  27126.  
  27127.  Now, pressing ALT+T inserts the current system time at the cursor.
  27128.  
  27129.  This function is documented on Pages 30 and 96 of the "Microsoft
  27130.  Editor User's Guide," which is contained in the "CodeView and
  27131.  Utilities, Microsoft Editor, Mixed-Language Programming Guide" manual
  27132.  from the Microsoft C Optimizing Compiler Version 5.10.
  27133.  
  27134.  
  27135.  128. QUICK.INI Needs Modification for Use with M 1.02 or MEP 1.02
  27136.  
  27137.  Product Version(s): 1.02   | 1.02
  27138.  Operating System:   MS-DOS | OS/2
  27139.  Flags: ENDUSER |
  27140.  Last Modified: 28-JUL-1989    ArticleIdent: Q46802
  27141.  
  27142.  To use the QUICK.INI file provided with the Microsoft M Editor Version
  27143.  1.02 as the TOOLS.INI file, it is necessary to make two modifications
  27144.  to the file. Without the modifications the editor gives the following
  27145.  error messages:
  27146.  
  27147.     Argcompile is not an editor function               press any key...
  27148.     Help is not an editor function                     press any key...
  27149.  
  27150.  To get past the Argcompile error message, add the following line to
  27151.  the TOOLS.INI file before the Argcompile:F5 line:
  27152.  
  27153.     Argcompile:=arg compile
  27154.  
  27155.  The Argcompile macro is also defined in the TOOLS.PRE file provided
  27156.  with the editor. The Help:F1 line is a leftover from previous versions
  27157.  of the editor and is not implemented in this version. To eliminate the
  27158.  Help error message, either delete or comment out the Help:F1 line.
  27159.  
  27160.  
  27161.  129. Documentation Error for "Mark" Functions in M User's Guide
  27162.  
  27163.  Product Version(s): 1.02   | 1.02
  27164.  Operating System:   MS-DOS | OS/2
  27165.  Flags: ENDUSER | docerr
  27166.  Last Modified:  2-AUG-1989    ArticleIdent: Q47236
  27167.  
  27168.  On Page 179 of the Version 1.02 "Microsoft Editor for MS OS/2 and
  27169.  MS-DOS Operating Systems: User's Guide," there is a documentation
  27170.  error. In the section of the reference table describing the "Mark"
  27171.  function, the marker deletion and marker definition descriptions are
  27172.  reversed. To define a marker at the cursor position, the correct
  27173.  syntax is Arg Arg textarg Mark. To delete a marker definition, the
  27174.  syntax is Arg Arg textarg Meta Mark. The entries SHOULD appear as
  27175.  follows:
  27176.  
  27177.     Entry                         Function
  27178.     -----                         --------
  27179.  
  27180.     Arg Arg textarg Mark          Defines a file marker at the
  27181.                                   initial cursor position. This
  27182.                                   does not record the file marker
  27183.                                   in the file specified by the
  27184.                                   markfile switch, but allows you
  27185.                                   to refer to this position as
  27186.                                   textarg.
  27187.  
  27188.     Arg Arg textarg Meta Mark     Deletes a marker definition.
  27189.  
  27190.  On Page 39, the reference to Arg Arg textarg Mark is correct.
  27191.  
  27192.  
  27193.  130. CopyBox Function Doesn't Work Across Files
  27194.  
  27195.  Product Version(s): 1.00   | 1.00
  27196.  Operating System:   MS-DOS | OS/2
  27197.  Flags: ENDUSER | S_C S_Pascal H_Fortran H_MASM
  27198.  Last Modified: 26-SEP-1989    ArticleIdent: Q47765
  27199.  
  27200.  CopyBox is a C-extension function for the Microsoft editor that is
  27201.  designed to copy square regions of text from one location to another,
  27202.  including to another file.
  27203.  
  27204.  This function works properly when copying to the same file, but fails
  27205.  when copying to another file. The function appears to work
  27206.  successfully, but the copied text does not appear in the target file.
  27207.  This lack of functionality has been corrected in Version 1.02 of the
  27208.  editor.
  27209.  
  27210.  You can work around this problem by using the GetLine and PutLine
  27211.  functions. A line can be read from the source file, trimmed to get the
  27212.  proper portion of the line, and then written to the target file. This
  27213.  procedure must be followed for each line of the box to copy.
  27214.  
  27215.  
  27216.  131. Getting SYS2070 While Using MEP
  27217.  
  27218.  Product Version(s): 1.02
  27219.  Operating System:   OS/2
  27220.  Flags: ENDUSER | MEP
  27221.  Last Modified: 26-SEP-1989    ArticleIdent: Q47767
  27222.  
  27223.  Problem:
  27224.  
  27225.  When I start MEP, I receive the following error:
  27226.  
  27227.       |---------------------------------------------------------------|
  27228.       | SYS2070: The system could not demand load the                 |
  27229.       | application's segment. MSHELP HELPGETINFO is in error.        |
  27230.       | For additional detailed information also see message SYS0127. |
  27231.       |---------------------------------------------------------------|
  27232.       |                     End the program                           |
  27233.       |_______________________________________________________________|
  27234.  
  27235.  After selecting "End the program," I receive the following message:
  27236.  
  27237.     A non-recoverable error occurred.
  27238.     The process ended.
  27239.  
  27240.  Response:
  27241.  
  27242.  The MEP program is picking up an old version of MSHELP.DLL. The likely
  27243.  source is from the OS/2 Presentation Manager Toolkit. To correct this
  27244.  problem, replace the old MSHELP.DLL with the current MSHELP.DLL.
  27245.  
  27246.  If there is no MSHELP.DLL on the LIB path, then MEP loads and seems to
  27247.  function correctly, but there will be no help available.
  27248.  
  27249.  
  27250.  132. Possible Explanation for "Cannot Close This Window" Error
  27251.  
  27252.  Product Version(s): 1.00   | 1.00
  27253.  Operating System:   MS-DOS | OS/2
  27254.  Flags: ENDUSER |
  27255.  Last Modified: 26-SEP-1989    ArticleIdent: Q47770
  27256.  
  27257.  Problem:
  27258.  
  27259.  Under M Version 1.00 I have two horizontal windows open, each viewing
  27260.  separate files. When I attempt to close a window (META+WINDOW or F9+F6),
  27261.  I sometimes get the error message "Cannot close this window." Under
  27262.  seemingly similar conditions, this error message does not occur and
  27263.  the window closes properly.
  27264.  
  27265.  Response:
  27266.  
  27267.  This message occurs when you attempt to close a window that contains
  27268.  modified text. If you want to abandon edits on the file, you can
  27269.  reread the file using SHIFT+F7 and then successfully close the window.
  27270.  
  27271.  
  27272.  133. ECH.EXE Utility Is Used Internally by the Microsoft Editor
  27273.  
  27274.  Product Version(s): 1.00   | 1.00
  27275.  Operating System:   MS-DOS | OS/2
  27276.  Flags: ENDUSER |
  27277.  Last Modified: 26-SEP-1989    ArticleIdent: Q47772
  27278.  
  27279.  ECH.EXE is a character echoing utility that is included with the
  27280.  Microsoft Editor (M) Version 1.00. This utility is mentioned in the
  27281.  appendix of the editor's user guide simply because it is an external
  27282.  file.
  27283.  
  27284.  The file is used with the Setfile command using wildcards. When
  27285.  issuing the command "Arg *.* Setfile", M will use ECH.EXE to display
  27286.  the files in alphabetical order. If ECH.EXE is not found in the
  27287.  current path, the message "NO MATCHING FILES" is generated.
  27288.  
  27289.  If this error message occurs in a subdirectory that does contain
  27290.  files, then ECH.EXE is not being found.
  27291.  
  27292.  M 1.02 does not use this external file. The utility has been
  27293.  incorporated into the editor.
  27294.  
  27295.  
  27296.  134. Invoking M or MEP with the /D Switch Prevents Initialization
  27297.  
  27298.  Product Version(s): 1.00 1.02 | 1.00 1.02
  27299.  Operating System:   MS-DOS    | OS/2
  27300.  Flags: ENDUSER | reinitialize
  27301.  Last Modified: 26-SEP-1989    ArticleIdent: Q48687
  27302.  
  27303.  Invoking the Microsoft M editor with the /D switch to prevent it from
  27304.  initializing from the TOOLS.INI file also prevents the Initialization
  27305.  function (SHIFT+F8) from reading the TOOLS.INI file.
  27306.  
  27307.  There is currently no workaround for this designed limitation other
  27308.  than to exit the editor and re-invoke M without using the /D switch.
  27309.  
  27310.  
  27311.  135. Microsoft Editor (M) Version 1.02: On-Line Help Not Loaded
  27312.  
  27313.  Product Version(s): 1.02
  27314.  Operating System:   MS-DOS
  27315.  Flags: ENDUSER |
  27316.  Last Modified: 26-SEP-1989    ArticleIdent: Q48130
  27317.  
  27318.  Trying to access on-line help after initializing (reloading the editor
  27319.  settings from TOOLS.INI) generates the following message:
  27320.  
  27321.     Online Help Not Loaded
  27322.  
  27323.  The following steps will demonstrate the problem:
  27324.  
  27325.  1. M (Start the editor, with or without a file.)
  27326.  
  27327.  2. F1 (Request on-line help -- success.)
  27328.  
  27329.  3. SHIFT+F8 (Initialize editor settings.)
  27330.  
  27331.  4. F1 (Request on-line help -- receive error message.)
  27332.  
  27333.  Microsoft is researching this problem and will post new information
  27334.  as it becomes available.
  27335.  
  27336.  
  27337.  136. Invalid Arg Filename Followed By F2 Causes Screen Error
  27338.  
  27339.  Product Version(s): 1.00   | 1.00
  27340.  Operating System:   MS-DOS | OS/2
  27341.  Flags: ENDUSER | buglist1.00
  27342.  Last Modified: 26-SEP-1989    ArticleIdent: Q48871
  27343.  
  27344.  When trying to read in a file with the Arg Setfile function, an
  27345.  improper filename returns an operating system error. If the Microsoft
  27346.  editor (M) is in split-screen mode, any horizontal divider bars are
  27347.  lost in MEP. The error contains the two following lines, which cause
  27348.  the screen to scroll one position erroneously:
  27349.  
  27350.     Next filSYS1041: The name specified is not recognized as an
  27351.     internal or external command, operable program, or batch file.
  27352.  
  27353.  In M, screen integrity is preserved, but the following error is
  27354.  returned:
  27355.  
  27356.     Bad command or filename.
  27357.  
  27358.  For example, invoke arg (ALT+A) to start an argument and enter about
  27359.  20 or so shifted numbers (e.g. ^&%$&^%$^%$#^%$#^%$@%(^&*(*^&&*), and
  27360.  then invoke Setfile (F2).
  27361.  
  27362.  The screen becomes corrupted and the next keystroke may crash the
  27363.  editor with an integer divide by 0 (zero).
  27364.  
  27365.  Microsoft has confirmed this to be a problem with the Microsoft Editor
  27366.  Version 1.00. We are researching this problem and will post new
  27367.  information as it becomes available.
  27368.  
  27369.  
  27370.  137. How to Search and Replace Control Characters with M Editor
  27371.  
  27372.  Product Version(s): 1.00 1.01 1.02 | 1.00 1.01 1.02
  27373.  Operating System:   MS-DOS         | OS/2
  27374.  Flags: ENDUSER |
  27375.  Last Modified: 10-OCT-1989    ArticleIdent: Q49010
  27376.  
  27377.  To search for and replace control characters with the M editor, use
  27378.  the following procedure:
  27379.  
  27380.  1. Invoke the search and replace function (CTRL+\).
  27381.  
  27382.     The editor prompts with "Query Search String:".
  27383.  
  27384.  2. Invoke the quote function (CTRL+P).
  27385.  
  27386.  3. Type the control character and press ENTER.
  27387.  
  27388.     The editor prompts with "Replace string:".
  27389.  
  27390.  4. Invoke the quote function.
  27391.  
  27392.  5. Type the control character.
  27393.  
  27394.  
  27395.  138. Background Color Greater Than Seven Causes Region to Blink
  27396.  
  27397.  Product Version(s): 1.00 1.02 | 1.00 1.02
  27398.  Operating System:   MS-DOS    | OS/2
  27399.  Flags: ENDUSER |
  27400.  Last Modified: 26-FEB-1990    ArticleIdent: Q57585
  27401.  
  27402.  It is possible to configure both the background and foreground color
  27403.  of the various text items that the Microsoft Editor (M) displays. If
  27404.  you attempt to set the background color to a color greater than seven,
  27405.  the color region blinks. This behavior, however unusual, is expected,
  27406.  and is documented in the "Microsoft Editor for MS OS/2 and MS-DOS
  27407.  User's Guide" on Page 87.
  27408.  
  27409.  The following M Editor color switches control the colors of various
  27410.  text display regions:
  27411.  
  27412.     Switch        Controls
  27413.     ------        --------
  27414.  
  27415.     hgcolor       Background and text color
  27416.     hgcolor       Search highlight colors
  27417.     infocolor     Information message colors
  27418.     selcolor      Cursor highlight colors
  27419.     stacolor      Status line colors
  27420.     wdcolor       Window border colors
  27421.  
  27422.  The following are the colors these switches can be set to:
  27423.  
  27424.     Black                 0
  27425.     Blue                  1
  27426.     Green                 2
  27427.     Cyan                  3
  27428.     Red                   4
  27429.     Magenta               5
  27430.     Brown                 6
  27431.     Light Gray            7
  27432.     Dark Gray             8   Will blink when set to background
  27433.     Light Blue            9   Will blink when set to background
  27434.     Light Green           A   Will blink when set to background
  27435.     Light Cyan            B   Will blink when set to background
  27436.     Light Red             C   Will blink when set to background
  27437.     Light Magenta         D   Will blink when set to background
  27438.     Light Yellow          E   Will blink when set to background
  27439.     White                 F   Will blink when set to background
  27440.  
  27441.  These colors are set in your TOOLS.INI as follows:
  27442.  
  27443.                 +------------------- Background Color
  27444.                 |
  27445.                 v
  27446.  
  27447.     colorswitch:BF <---------------- Foreground Color
  27448.  
  27449.  The following example, inserted in your TOOLS.INI, sets the foreground
  27450.  and background colors of the editing windows (90 percent of the
  27451.  screen):
  27452.  
  27453.     fgcolor:62 < ------------------- Green
  27454.  
  27455.             ^
  27456.             |
  27457.             +----------------------- Brown
  27458.  
  27459.  
  27460.  139. M Editor Version 1.00 Does Not Clear Compiler Error Buffer
  27461.  
  27462.  Product Version(s): 1.00   | 1.00
  27463.  Operating System:   MS-DOS | OS/2
  27464.  Flags: ENDUSER  | buglist1.00 fixlist1.02
  27465.  Last Modified: 11-OCT-1989    ArticleIdent: Q49536
  27466.  
  27467.  When using the compile function from within the editor, the errors
  27468.  stored in memory are not cleared. Thus, if you do not go through all
  27469.  errors with the nextmsg function, the errors remain even if another
  27470.  compile is done. Therefore, if the second compile process does not
  27471.  produce any errors, the errors from the previous compile show up and
  27472.  put the cursor on an unpredictable line.
  27473.  
  27474.  To work around this problem, make sure you look at all of your error
  27475.  messages from each compile.
  27476.  
  27477.  Microsoft has confirmed this to be a problem with the Microsoft Editor
  27478.  Version 1.00. This problem was corrected in Version 1.02 of the
  27479.  Editor.
  27480.  
  27481.  
  27482.  140. Configuring On-Line Help for M 1.02
  27483.  
  27484.  Product Version(s): 1.02   | 1.02
  27485.  Operating System:   MS-DOS | OS/2
  27486.  Flags: ENDUSER |
  27487.  Last Modified: 30-NOV-1989    ArticleIdent: Q49576
  27488.  
  27489.  The following is the correct way to configure on-line help for the
  27490.  Microsoft Editor (M) Version 1.02 for both MS-DOS (real mode) and
  27491.  OS/2 (protected mode).
  27492.  
  27493.  Copy files from the distribution disk, as follows:
  27494.  
  27495.  1. Under MS-DOS real mode, copy M.HLP and MHELP.MXT to any directory
  27496.     specified in the PATH environment variable in the AUTOEXEC.BAT
  27497.     file.
  27498.  
  27499.  2. Under OS/2 protected mode, copy M.HLP and MHELP.PXT to any
  27500.     directory specified in the PATH environment variable in the
  27501.     STARTUP.CMD file. Also copy MSHELP.DLL to any directory listed in
  27502.     the LIBPATH variable in the CONFIG.SYS file.
  27503.  
  27504.  3. For both DOS and OS/2, perform both the preceding steps.
  27505.  
  27506.  Other Microsoft products include .HLP files that the editor can
  27507.  read. If you want to add additional .HLP files to help, you must
  27508.  include the following tagged section in your TOOLS.INI:
  27509.  
  27510.  1. Include the following tagged section:
  27511.  
  27512.        [M-MHELP]                    ; For DOS real mode
  27513.  
  27514.        [MEP-MHELP]                  ; For OS/2 protected mode
  27515.  
  27516.        [M-MHELP MEP-MHELP]          ; For both DOS and OS/2
  27517.  
  27518.  2. Add the following switch to load in the help files:
  27519.  
  27520.        Helpfiles: M.HLP .BAS:C:\QB\QB.HLP .C.H:C:\QC\QC.HLP .PAS:C:\QP\QP.HLP
  27521.  
  27522.     This is an example of help files that are loaded upon startup of M
  27523.     or MEP. Help searches QB.HLP first when the file has a .BAS
  27524.     extension, QC.HLP when the current file has a .C or .H extension,
  27525.     and QP.HLP when the current file has a .PAS extension. Please note
  27526.     that these help files come with their respective language, not M
  27527.     1.02.
  27528.  
  27529.  For more information on this topic, refer to the Microsoft Editor for
  27530.  MS OS/2 and MS-DOS Operating Systems: User's Guide" that accompanies
  27531.  with M 1.02.
  27532.  
  27533.  
  27534.  141. Undocumented Switch "Sethelp" for M Version 1.02
  27535.  
  27536.  Product Version(s): 1.02   | 1.02
  27537.  Operating System:   MS-DOS | OS/2
  27538.  Flags: ENDUSER | docerr
  27539.  Last Modified: 24-JAN-1991    ArticleIdent: Q50012
  27540.  
  27541.  If you have the M (or MEP) Editor version 1.02 configured for online
  27542.  help, you can use the undocumented "Sethelp" switch to load additional
  27543.  help files within the editor by using the following syntax:
  27544.  
  27545.     Arg textarg Sethelp      ;ALT+A textarg ALT+S
  27546.  
  27547.  Textarg corresponds to the full pathname of the .HLP file you want to
  27548.  load. By default, the sethelp function is mapped ALT+S.
  27549.  
  27550.  For example, load the QC.HLP help file that comes with QuickC with the
  27551.  following command:
  27552.  
  27553.     ALT+A D:\QC\QC.HLP ALT+S
  27554.  
  27555.  Now you could place the cursor on printf (or any other C language item
  27556.  that is in the Help file) and press F1 to get help on that topic.
  27557.  
  27558.  
  27559.  142. Printing Double Quotation Marks from within an M Editor Macro
  27560.  
  27561.  Product Version(s): 1.00 1.02 | 1.00 1.02
  27562.  Operating System:   MS-DOS    | OS/2
  27563.  Flags: ENDUSER |
  27564.  Last Modified: 30-NOV-1989    ArticleIdent: Q50223
  27565.  
  27566.  To get double quotation marks ("") printed from within a macro in the
  27567.  M Editor, use the backslash key (\) followed by the double quotation
  27568.  marks (""). The following example (placed in the correct section of
  27569.  the TOOLS.INI file) demonstrates how this is done:
  27570.  
  27571.     text:=arg "say \"hello\"" paste
  27572.     text:alt+z
  27573.  
  27574.  In this case, pressing ALT+Z inserts the following string into your
  27575.  text, with the double quotation marks around the word hello.
  27576.  
  27577.     say "hello"
  27578.  
  27579.  
  27580.  143. Controlling the Use of Tabs in the Microsoft Editor
  27581.  
  27582.  Product Version(s): 1.00 1.02 | 1.00 1.02
  27583.  Operating System:   MS-DOS    | OS/2
  27584.  Flags: ENDUSER |
  27585.  Last Modified: 30-NOV-1989    ArticleIdent: Q50588
  27586.  
  27587.  The Microsoft Editor (M) provides the following two ways of using tab
  27588.  characters:
  27589.  
  27590.  1. Treat tabs as real characters.
  27591.  
  27592.  2. Convert each tab into a series of spaces. This is controlled
  27593.  through the use of the "realtabs" switch. Other switches may also
  27594.  effect the way tabs appear to be handled by the editor.
  27595.  
  27596.  The following chart, taken from Section 7.2.6 of "Microsoft Editor for
  27597.  MS OS/2 and MS-DOS User's Guide" describes the switches dealing with
  27598.  tabs.
  27599.  
  27600.  1. realtabs
  27601.  
  27602.     On by default, controls whether or not tabs are treated as real tab
  27603.     characters.
  27604.  
  27605.  2. entab
  27606.  
  27607.     Controls the extent to which the editor converts a series of tabs
  27608.     and spaces to tabs when saving a file. The following are the valid
  27609.     choices:
  27610.  
  27611.        0 - The editor does not replace spaces by tabs. If realtabs is off,
  27612.            tabs are converted to spaces.
  27613.  
  27614.        1 - (default) The editor can replace a series of tabs and spaces by
  27615.            tabs when the tabs fall outside of quoted strings.
  27616.  
  27617.        2 - The editor will replace all series of tabs and spaces with
  27618.            tabs.
  27619.  
  27620.     Note: The entab switch only effects the lines you modify during the
  27621.     current editing session.
  27622.  
  27623.  3. filetab
  27624.  
  27625.     Controls the meaning of tab characters on a disk file. If realtabs
  27626.     is on, the filetab switch determines tab alignment. If realtabs is
  27627.     off, the filetab switch determines how the editor translates tab
  27628.     characters to spaces when a line of text is modified.
  27629.  
  27630.     If entab, as described above, is set to 1 or 2, filetab also
  27631.     determines how the editor translates spaces to tabs when you save
  27632.     the file to disk.
  27633.  
  27634.     Note: The filetab switch only effects the lines you modify during
  27635.     the current editing session.
  27636.  
  27637.  4. tabalign
  27638.  
  27639.     When off (the default), the cursor may be placed anywhere inside a
  27640.     column of a tab character. If turned on, along with realtabs, the
  27641.     cursor is placed to the first column position of tab characters.
  27642.  
  27643.  5. tabstops
  27644.  
  27645.     Determines the size of columns associated with the TAB and BACKTAB
  27646.     ( SHIFT+TAB) keys. This only moves the cursor and has no effect on
  27647.     the actual tab character. The default value is 4.
  27648.  
  27649.     The following example sets up tabs so that they act the same way
  27650.     they do in other editors, such as QuickC or Word:
  27651.  
  27652.        realtabs:yes
  27653.        tabalign:yes
  27654.        graphic:tab
  27655.        trailspace:yes
  27656.        filetab:4
  27657.  
  27658.  The trailspace switch is needed to use tabs on blank lines. The
  27659.  tabdisp switch may also be used with realtabs to make the tab
  27660.  characters visible on the screen.
  27661.  
  27662.  
  27663.  144. Mhelp Function Is Always Assigned to SHIFT+F1
  27664.  
  27665.  Product Version(s): 1.02   | 1.02
  27666.  Operating System:   MS-DOS | OS/2
  27667.  Flags: ENDUSER |
  27668.  Last Modified: 17-JUL-1990    ArticleIdent: Q50642
  27669.  
  27670.  In the Microsoft Editor (M) Version 1.02, the mhelp function is like
  27671.  any other function that can be assigned to any key. However, mhelp is
  27672.  always assigned to SHIFT+F1 unless this key is unassigned using the
  27673.  unassigned keyword in the m-mhelp block of the TOOLS.INI file.
  27674.  
  27675.  It is perfectly acceptable to assign the mhelp to any key, and it will
  27676.  work properly with that keystroke. However, in addition to the newly
  27677.  assigned key, the mhelp function is always assigned to SHIFT+F1. This
  27678.  assignment can be taken out by placing the following line in the
  27679.  [M-MHELP] section of the TOOLS.INI file:
  27680.  
  27681.     [M-MHELP]
  27682.     unassigned:shift+f1
  27683.  
  27684.  
  27685.  145. Adding helpwindow in TOOLS.INI as a Switch
  27686.  
  27687.  Product Version(s): 1.02   | 1.02
  27688.  Operating System:   MS-DOS | OS/2
  27689.  Flags: ENDUSER |
  27690.  Last Modified: 30-NOV-1989    ArticleIdent: Q50644
  27691.  
  27692.  To get the Microsoft Editor (M) to recognize helpwindow as a switch in
  27693.  the TOOLS.INI file, the switch must be under the [M-MHELP] or
  27694.  [MEP-MHELP] tag section. The example below shows what a TOOLS.INI file
  27695.  might look like:
  27696.  
  27697.     [M-MHELP MEP-MHELP]
  27698.     nohelpwindow:
  27699.  
  27700.     [M MEP]
  27701.       .
  27702.       .
  27703.  
  27704.  The helpwindow switch can also be set in the environment by typing the
  27705.  following:
  27706.  
  27707.     <arg> nohelpwindow: <assign>
  27708.  
  27709.  
  27710.  146. Searching in the M Editor with Regular Expressions
  27711.  
  27712.  Product Version(s): 1.00 1.02 | 1.00 1.02
  27713.  Operating System:   MS-DOS    | OS/2
  27714.  Flags: ENDUSER |
  27715.  Last Modified: 30-NOV-1989    ArticleIdent: Q51324
  27716.  
  27717.  Question:
  27718.  
  27719.  When using the M Editor, every time I execute a search command using a
  27720.  Regular Expression, the editor takes the command literally and doesn't
  27721.  recognize the textarg as a Regular Expression. How can I get this
  27722.  search to work?
  27723.  
  27724.  Response:
  27725.  
  27726.  The correct method is as follows:
  27727.  
  27728.        arg arg textarg <search_function>
  27729.  
  27730.                arg -> ALT+A
  27731.            textarg -> A Regular Expression (i.e., ^S[te].*end)
  27732.  <search_function> -> Psearch, Msearch, Replace, Qreplace
  27733.  
  27734.  For more information, see Chapter 5, Pages 51-63, in the "Microsoft
  27735.  FORTRAN Microsoft Editor User's Guide."
  27736.  
  27737.  
  27738.  147. mgreplist Incorrectly Documented As megreplist in Example
  27739.  
  27740.  Product Version(s): 1.02
  27741.  Operating System:   MS-DOS
  27742.  Flags: ENDUSER | docerr
  27743.  Last Modified: 15-MAR-1990    ArticleIdent: Q51622
  27744.  
  27745.  The examples given on Pages 180 and 181 of the FORTRAN "Microsoft
  27746.  Editor User's Guide" incorrectly identifies the megreplist command as
  27747.  mgreplist. The documentation shows the following:
  27748.  
  27749.     megreplist:="DATA.FIL *.FOR $INCLUDE:*.H"
  27750.  
  27751.  This should be the following:
  27752.  
  27753.     mgreplist:="DATA.FIL *.FOR $INCLUDE:*.H"
  27754.  
  27755.  The megreplist macro does not exist and should be changed to
  27756.  mgreplist.
  27757.  
  27758.  The example above sets mgreplist to a series of files to be searched
  27759.  when Mgrep is called. If the textarg string (specified as an argument
  27760.  to Mgrep) is found in any of these files, the instance will be
  27761.  reported in the pseudo file <compile>. All succeeding calls to Mgrep
  27762.  will reset this file.
  27763.  
  27764.  The following are the files that are searched in the above example:
  27765.  
  27766.  1. DATA.FIL.
  27767.  
  27768.  2. Any file in the current directory with a .FOR extension.
  27769.  
  27770.  3. Any file along the INCLUDE environment variable path with a .H
  27771.     extension.
  27772.  
  27773.  
  27774.  148. C Extensions: Link Errors on __acrtused and _main Explained
  27775.  
  27776.  Product Version(s): 1.00    | 1.02
  27777.  Operating System:   MS-DOS  | OS/2
  27778.  Flags: ENDUSER |
  27779.  Last Modified: 21-DEC-1989    ArticleIdent: Q51636
  27780.  Question :
  27781.  
  27782.  I am writing a C extension for the Microsoft Editor (M). When I link,
  27783.  I get the following error message:
  27784.  
  27785.     c:\usr\lib\CLIBCE.LIB(dos\crt0.asm)
  27786.             error  L2044:  __acrtused
  27787.             symbol multiply defined, use /NOE  pos
  27788.             1CC Record type: 53E4
  27789.  
  27790.     LINK : error L2029: Unresolved externals:
  27791.     _main in file(s):  c:\usr\lib\CLIBCE.LIB(dos\crt0.asm)
  27792.     Two errors were detected.
  27793.  
  27794.  I am compiling and linking as follows:
  27795.  
  27796.     cl /c /Gs /Asfu c_extension.c
  27797.     link /NOI /NOE exthdr.obj c_extension.obj, c_extension;
  27798.  
  27799.  These options seem to be correct according to the Editor manuals. Why
  27800.  am I getting these linker errors?
  27801.  
  27802.  Response:
  27803.  
  27804.  The linker gives these error messages if you are linking with a
  27805.  run-time function that must be initialized from the C start-up source
  27806.  code. This start-up source code is not used within a C extension.
  27807.  
  27808.  The art of writing C extensions for M Version 1.00 is documented in
  27809.  Chapter 8 of the Editor section of the "CodeView and Utilities,
  27810.  Microsoft Editor, Mixed-Language Programming Guide," which is included
  27811.  with C 5.00, C 5.10, Pascal 4.00, FORTRAN 4.10, and MASM 5.10.
  27812.  References to M Version 1.02 extensions are discussed in Chapter 8 of
  27813.  the "Microsoft Editor User's Guide," which came with FORTRAN 5.00.
  27814.  
  27815.  Please contact Microsoft Product Support Services at (800) 454-2030 to
  27816.  obtain an application note that discusses further techniques of writing C
  27817.  extensions for the Microsoft Editor.
  27818.  
  27819.  
  27820.  149. U1013 Link: Error 2: Not Enough Memory for Exec in M
  27821.  
  27822.  Product Version(s): 1.00 1.02
  27823.  Operating System:   MS-DOS
  27824.  Flags: ENDUSER | s_nmake s_make
  27825.  Last Modified: 23-JAN-1991    ArticleIdent: Q57653
  27826.  
  27827.  Question:
  27828.  
  27829.  In DOS, I am spawning either MAKE or NMAKE within the Microsoft Editor
  27830.  (M), and I receive an error message from the Editor on the status line
  27831.  saying "U1013 : Link file.obj: Error 2." What does this error mean and
  27832.  how do I get around it?
  27833.  
  27834.  Response:
  27835.  
  27836.  The U1013 error means that one of the procedures called by MAKE or
  27837.  NMAKE returned a nonzero error code. In this case, the error can be
  27838.  understood as M's equivalent of a "Not enough memory for exec" error,
  27839.  meaning that there is not enough memory for the parent process to
  27840.  execute a child process. The error typically occurs when you spawn
  27841.  either MAKE or NMAKE from within the Editor, the compilation is
  27842.  complete, and the link process is beginning.
  27843.  
  27844.  If you receive this error, you may be able to free up memory by
  27845.  removing any TSRs and unnecessary device drivers. However, the best
  27846.  workaround would be to use MAKE or NMAKE to link your file outside of
  27847.  M, because M will have problems exec'ing the linker in any sizable
  27848.  application due to the size of LINK and MAKE.
  27849.  
  27850.  
  27851.  150. Mgrep Can Skip Occurrences of Pattern When Using Mgreplist
  27852.  
  27853.  Product Version(s): 1.02   | 1.02
  27854.  Operating System:   MS-DOS | OS/2
  27855.  Flags: ENDUSER | buglist1.02
  27856.  Last Modified: 16-JAN-1990    ArticleIdent: Q57705
  27857.  
  27858.  "Mgrep" may find every other occurrence of a search string when used
  27859.  to search a list of input files defined my the "mgreplist" macro.
  27860.  
  27861.  Mgrep searches all files defined by the mgreplist macro, then writes
  27862.  the location of a match to the <compile> pseudo file. When using
  27863.  either regular expression search patterns or standard search strings,
  27864.  mgrep may post every other occurrence of the matched string to the
  27865.  <compile> pseudo file. This also causes SHIFT+F3 to display every
  27866.  other match in the file being searched.
  27867.  
  27868.  To see the problem, set the mgreplist:="test.dat" where TEST.DAT
  27869.  contains the following:
  27870.  
  27871.     #include1
  27872.     #include2
  27873.     #include3
  27874.     #include4
  27875.     #include5
  27876.     #include6
  27877.     #include7
  27878.     #include8
  27879.     #include9
  27880.     #include10
  27881.     #include11
  27882.     #include12
  27883.  
  27884.  Invoke the mgrep search on the string "include" and then press
  27885.  SHIFT+F3 to view the next match. You will see that only every other
  27886.  occurrence of "include" is found. Also, if you view the <compile>
  27887.  pseudo file it will only contain a list every other occurrence of
  27888.  "include".
  27889.  
  27890.  
  27891.  151. M "Keyboard" Switch Doesn't Work As Documented
  27892.  
  27893.  Product Version(s): 1.02
  27894.  Operating System:   MS-DOS
  27895.  Flags: ENDUSER | S_FORTRAN buglist1.02
  27896.  Last Modified: 20-JAN-1990    ArticleIdent: Q57750
  27897.  
  27898.  The Microsoft Editor (M) Version 1.02 "keyboard" switch, documented on
  27899.  Page 198 of the the "Microsoft Editor User's Guide for MS OS/2 and
  27900.  MS-DOS Operating Systems," does not work as documented.
  27901.  
  27902.  The switch was implemented to allow control of which BIOS keyboard
  27903.  calls are used to get keystrokes. The "compatible" setting uses the
  27904.  standard INT 16H, AH = 0 to get keystrokes. The "enhanced" setting
  27905.  uses INT 10H, allowing the F11 and F12 keys to be read, and allowing
  27906.  you to use old versions of packages that may fail when your keyboard
  27907.  is treated as enhanced.
  27908.  
  27909.  If you set the "keyboard" option in your TOOLS.INI file by adding a
  27910.  line reading
  27911.  
  27912.     keyboard:"compatible"
  27913.  
  27914.  and then bring up the editor, M accepts the setting, but fails to set
  27915.  correctly. If you press SHIFT+F1 for help and choose Current
  27916.  Assignments, the list of current key assignments is given. The
  27917.  keyboard switch will now be set to the following:
  27918.  
  27919.     keyboard::enhanced
  27920.  
  27921.  Note the double colon, and that the compatible option has been
  27922.  changed to enhanced.
  27923.  
  27924.  If you try to set the option within the editor by entering the
  27925.  following, the editor returns the same options as above:
  27926.  
  27927.     ALT+A keyboard:compatible ALT+=
  27928.  
  27929.  Microsoft has confirmed this to be a problem in the Microsoft Editor
  27930.  Version 1.02. We are researching this problem and will post new
  27931.  information here as it becomes available.
  27932.  
  27933.  
  27934.  152. Incorrect Message from "searchall" with Regular Expressions
  27935.  
  27936.  Product Version(s): 1.02   | 1.02
  27937.  Operating System:   MS-DOS | OS/2
  27938.  Flags: ENDUSER | M MEP buglist1.02
  27939.  Last Modified: 23-JAN-1990    ArticleIdent: Q57932
  27940.  
  27941.  The Microsoft Editor searchall function (that is, SHIFT+F6) may return
  27942.  the following invalid error message when using regular expressions:
  27943.  
  27944.     +'pattern' not found
  27945.  
  27946.  'pattern' is the actual regular expression for which the search was
  27947.  requested.
  27948.  
  27949.  In this situation, searchall still finds all occurrences of the search
  27950.  pattern correctly -- only the message is incorrect.
  27951.  
  27952.  
  27953.  153. Version 1.02 of M and MEP Incorrectly Reports Version As 1.2
  27954.  
  27955.  Product Version(s): 1.02   | 1.02
  27956.  Operating System:   MS-DOS | OS/2
  27957.  Flags: ENDUSER | docerr
  27958.  Last Modified: 26-FEB-1990    ArticleIdent: Q58687
  27959.  
  27960.  If you access help for the Microsoft Editor (M/MEP) Version 1.02, the
  27961.  version is incorrectly displayed as 1.2, rather than 1.02. This
  27962.  incorrect version number appears in both the internal online help and
  27963.  when invoking help from the command line with the /? switch.
  27964.  
  27965.  The following information is incorrectly displayed when using the /?
  27966.  command-line switch for help:
  27967.  
  27968.     Microsoft (R) Editor Version 1.2
  27969.     Copyright (C) Microsoft Corp 1987-1989. All rights reserved
  27970.     Usage: [/D] [/e cmd-string] [/m mark] [/r] [[/t] filename]*
  27971.  
  27972.  
  27973.  154. Quote Function (CTRL+P) Can Fail to Work Properly
  27974.  
  27975.  Product Version(s): 1.00 1.02 | 1.00 1.02
  27976.  Operating System:   MS-DOS    | OS/2
  27977.  Flags: ENDUSER | buglist1.00 buglist1.02
  27978.  Last Modified: 26-FEB-1990    ArticleIdent: Q58720
  27979.  
  27980.  The Quote function (CTRL+P) in conjunction with CTRL+I or CTRL+T fails
  27981.  to display the valid character associated with that key sequence. For
  27982.  CTRL+P with CTRL+I, a space character (Hex 20) results instead of the
  27983.  correct foreground color rectangle with a background color dot (hex
  27984.  09). For CTRL+P with CTRL+T, a lowercase "a" with an accent mark (hex
  27985.  A0) results instead of the paragraph sign (hex 14).
  27986.  
  27987.  The Quote function reads one keystroke from the keyboard and treats it
  27988.  literally. This is useful for inserting text into a file that happens
  27989.  to be assigned to an editor function. For example, the key sequence
  27990.  Quote (CTRL+P) CTRL+A displays a happy face character.
  27991.  
  27992.  For the Quote CTRL+I sequence, the only workaround is to use a Quote
  27993.  TAB key sequence. This puts the correct hex value in that position
  27994.  (09H), but the correct character is not displayed and the tab is
  27995.  treated as a tab by the M Editor.
  27996.  
  27997.  For the Quote CTRL+T sequence, there is no workaround.
  27998.  
  27999.  Microsoft has confirmed this to be a problem with the M Editor Versions
  28000.  1.00 and 1.02. We are researching this problem and will post new
  28001.  information here as it becomes available.
  28002.  
  28003.  
  28004.  
  28005.  155. Replacing Normal String Takes Longer Than Regular Expression
  28006.  
  28007.  Product Version(s): 1.00 1.02 | 1.00 1.02
  28008.  Operating System:   MS-DOS    | OS/2
  28009.  Flags: ENDUSER | buglist1.00 buglist1.02
  28010.  Last Modified: 15-MAR-1990    ArticleIdent: Q59085
  28011.  
  28012.  Replacing a regular expression takes less time than replacing a normal
  28013.  string in the Microsoft M Editor, Versions 1.00 and 1.02. To
  28014.  demonstrate the time difference, perform test replacements in the
  28015.  following manner:
  28016.  
  28017.  1. Load the M Editor with a large file -- greater than 5000 lines.
  28018.  
  28019.  2. Perform and time a replacement on a regular expression, one that
  28020.     fails to match in the file, for example:
  28021.  
  28022.        arg arg CTRL+L     zzzz   <- search for this regular expression
  28023.                           zzzz   <- replace with this regular expression
  28024.  
  28025.  3. Perform and time a replacement on a normal string (one that fails
  28026.     to match in the file), for example:
  28027.  
  28028.        arg CTRL+L     zzzz   <- search for this string
  28029.                       zzzz   <- replace with this string
  28030.  
  28031.  The string replacement may take twice as long as the
  28032.  regular-expression replacement. To obtain the higher replace speed,
  28033.  use the regular-expression replacement (arg arg CTRL+L) even when you
  28034.  are not fully using the regular-expression syntax.
  28035.  
  28036.  Note that a psearch on a regular expression psearch is NOT quicker
  28037.  than a psearch on a normal string.
  28038.  
  28039.  Microsoft has confirmed this to be a problem in Versions 1.00 and
  28040.  1.02. We are researching this problem and will post new information
  28041.  here as it becomes available.
  28042.  
  28043.  For details on regular expression, refer to the "Microsoft Editor
  28044.  User's Guide," Chapter 5, "Regular Expressions."
  28045.  
  28046.  
  28047.  156. Incorrect Version Numbers Cause Tagged Sections to Be Ignored
  28048.  
  28049.  Product Version(s): 1.00 1.02 | 1.00 1.02
  28050.  Operating System:   MS-DOS    | OS/2
  28051.  Flags: ENDUSER | pwb
  28052.  Last Modified: 25-MAY-1990    ArticleIdent: Q59256
  28053.  
  28054.  With the Microsoft Editor (M) or the Programmers WorkBench (PWB), it
  28055.  is possible to include information in your TOOLS.INI file that is
  28056.  specific to the operating system you are using. For information on how
  28057.  to create sections with tags, see the "Microsoft Editor User's Guide,"
  28058.  Section 7.5.1. However, you must be sure to include a trailing 0
  28059.  (zero) on the label for OS/2 versions 1.10 or 1.20. Failure to do so
  28060.  causes these sections to be ignored by the Editor.
  28061.  
  28062.  The following headers cause the tagged sections to be ignored when
  28063.  running under OS/2 version 1.10:
  28064.  
  28065.     [M-10.0 M-10.1]
  28066.     fgcolor:0B
  28067.     hgcolor:30
  28068.     stacolor:0E
  28069.  
  28070.     [M-3.30 M-10.0R M-10.1R]
  28071.     fgcolor:0E
  28072.     hgcolor:E0
  28073.     stacolor:0B
  28074.  
  28075.  The tags must be rewritten as follows:
  28076.  
  28077.     [M-10.0 M-10.10]
  28078.     fgcolor:0B
  28079.     hgcolor:30
  28080.     stacolor:0E
  28081.  
  28082.     [M-3.30 M-10.0R M-10.10R]
  28083.     fgcolor:0E
  28084.     hgcolor:E0
  28085.     stacolor:0B
  28086.  
  28087.  Furthermore, the tagged sections must not be placed in the middle of
  28088.  an [M] or [M MEP] tagged section. They must be placed before or after
  28089.  the [M] or [M MEP] sections. Failure to do this causes information
  28090.  located below these sections to be ignored in the DOS compatibility
  28091.  box.
  28092.  
  28093.  Note: For the PWB, the above examples would change to PWB-xxxx instead
  28094.  of M-xxx.
  28095.  
  28096.  
  28097.  157. Unassigning Help Keystrokes Must Be Done Under
  28098.  
  28099.  Product Version(s): 1.02   | 1.02
  28100.  Operating System:   MS-DOS | OS/2
  28101.  Flags: ENDUSER |
  28102.  Last Modified: 13-MAR-1990    ArticleIdent: Q59494
  28103.  
  28104.  It is possible with the Microsoft Editor Version 1.02 to disable
  28105.  an assigned keystroke so that it invokes no editor function at all.
  28106.  The keystroke can then be assigned to any other function or macro. By
  28107.  putting the disable information in the M Editor section of the
  28108.  TOOLS.INI file, the changes will be in effect whenever the Editor is
  28109.  invoked. For further information, see the Version 1.02 edition of
  28110.  "Microsoft Editor User's Guide," Section 6.2.3, Page 70.
  28111.  
  28112.  To regularly disable a keystroke that has been assigned to any preset
  28113.  Editor HELP function, such as F1 or SHIFT+F1, the command must be
  28114.  placed under the [M-MHELP MEP-MHELP] tag in TOOLS.INI -- not under the
  28115.  [M MEP] tag.
  28116.  
  28117.  For example, to disable the keystroke for F1, include the following
  28118.  line in your TOOLS.INI file:
  28119.  
  28120.     unassigned:F1
  28121.  
  28122.  Placing this line under the section tagged [M MEP] rather than the
  28123.  [M-MHELP MEP-MHELP] tag causes this command to be ignored. This is
  28124.  also applicable to the undocumented "sethelp" function, whose default
  28125.  keystroke is ALT+S. You can unassign ALT+S, as well as reassign a
  28126.  different keystroke to "sethelp", but it must be done under the
  28127.  [M-MHELP MEP-MHELP] tag.
  28128.  
  28129.  
  28130.  158. Using RIGHT ARROW on Dialog Line Locks Keyboard or GP Faults
  28131.  
  28132.  Product Version(s): 1.02   | 1.02
  28133.  Operating System:   MS-DOS | OS/2
  28134.  Flags: ENDUSER | buglist1.02
  28135.  Last Modified: 15-MAY-1990    ArticleIdent: Q59527
  28136.  
  28137.  Manipulating text on the dialog line must be handled differently in
  28138.  the Microsoft Editor (M) Version 1.00 than in 1.02. If you use an M
  28139.  Version 1.00 procedure in M Version 1.02 under DOS, the keyboard will
  28140.  lock up and alternating screens of jumbled characters may appear on
  28141.  the screen. Under OS/2, you will get a GP fault resulting in the
  28142.  termination of MEP by the operating system.
  28143.  
  28144.  The problem can be observed by using the following steps from within
  28145.  the editor:
  28146.  
  28147.  Note: Remember that under DOS your machine will hang!
  28148.  
  28149.  1. Press ALT+A to invoke the <arg> function.
  28150.  
  28151.  2. Type any character (for example, the letter "d").
  28152.  
  28153.  3. Hold down the RIGHT ARROW key. When the text in the dialog line has
  28154.     scrolled off the left side of the screen, in M 1.00 the editor will
  28155.     issue a beep. In M 1.02, the machine will lock in DOS or GP fault
  28156.     in OS/2. This problem occurs even if you omit Step 2, but it is
  28157.     more difficult to see the error.
  28158.  
  28159.  To retain the same functionality in M 1.02, instead of using the RIGHT
  28160.  ARROW key to move the cursor to the right, use the SPACEBAR. Using
  28161.  the SPACEBAR rather than the RIGHT ARROW key allows you to take
  28162.  advantage of the maximum arg line limit without the error.
  28163.  
  28164.  Microsoft has confirmed this to be a problem in Version 1.02. We are
  28165.  researching this problem and will post new information here as it
  28166.  becomes available.
  28167.  
  28168.  
  28169.  159. Reference to "Push" Function Incorrect Editor User's Guide
  28170.  
  28171.  Product Version(s): 1.00   | 1.00
  28172.  Operating System:   MS-DOS | OS/2
  28173.  Flags: ENDUSER | docerr
  28174.  Last Modified: 17-JUL-1990    ArticleIdent: Q60339
  28175.  
  28176.  On Page 61 of the "Microsoft Editor User's Guide" for Microsoft C
  28177.  5.10, there is a documentation error. It is stated that the Boolean
  28178.  switch Savescreen is "for use with the Push and Exit functions." Since
  28179.  there is no "Push" function, this should read "for use with the Shell
  28180.  and Exit functions."
  28181.  
  28182.  
  28183.  160. Prototype in User's Guide for tglcase() Is Incorrect
  28184.  
  28185.  Product Version(s): 1.02    | 1.02
  28186.  Operating System:   MS-DOS  | OS/2
  28187.  Flags: ENDUSER | docerr
  28188.  Last Modified: 15-APR-1990    ArticleIdent: Q60487
  28189.  
  28190.  In the sample program for a C extension on Page 126 of the "Microsoft
  28191.  Editor User's Guide" for Microsoft FORTRAN 5.00 and Microsoft BASIC
  28192.  PDS Version 7.00, the prototype for tglcase() is incorrect.
  28193.  
  28194.  The function is prototyped as follows:
  28195.  
  28196.     flagType pascal EXPORT tglcase (unsigned int, ARG far *, flagType);
  28197.  
  28198.  It should be as follows:
  28199.  
  28200.     flagType pascal EXTERNAL tglcase (unsigned int, ARG far *, flagType);
  28201.  
  28202.  Note: The word EXTERNAL replaces EXPORT.
  28203.  
  28204.  
  28205.  161. Creating a Compile Window Macro for the M Editor Version 1.02
  28206.  
  28207.  Product Version(s): 1.02   | 1.02
  28208.  Operating System:   MS-DOS | OS/2
  28209.  Flags: ENDUSER |
  28210.  Last Modified: 27-JUL-1990    ArticleIdent: Q63950
  28211.  
  28212.  The macro below creates a "compile window" in either the M or MEP
  28213.  Editor version 1.02 when you press ALT+C. Note that a compile window
  28214.  is helpful for viewing general compilation errors and errors generated
  28215.  from utilities that were invoked.
  28216.  
  28217.  The following macro, CompWindow, can be added to the [M] or [MEP]
  28218.  tagged section of the TOOLS.INI file to create a compile window:
  28219.  
  28220.     CompWindow:= savecur home meta down  \
  28221.                  up up up up arg window  \
  28222.                  window arg "<compile>" setfile  \
  28223.                  window restcur
  28224.  
  28225.     CompWindow: alt+c
  28226.  
  28227.  The CompWindow macro above creates a compile window by performing the
  28228.  following steps:
  28229.  
  28230.  1. Use the "savcur" function to save the current position of the
  28231.     cursor.
  28232.  
  28233.  2. Use the "home" function to place the cursor in the upper-left
  28234.     corner of the screen. This function guarantees that the cursor will
  28235.     be in a left-most position when the compile window is created.
  28236.  
  28237.  3. Use the "meta down" function to move the cursor to the bottom of
  28238.     the window without changing the column position.
  28239.  
  28240.  4. Use "up up up up arg window" functions to create a horizontal
  28241.     window four lines above the bottom of the screen. A larger compile
  28242.     window can be created by adding more "up" functions to this line in
  28243.     the macro.
  28244.  
  28245.  5. Use the 'arg "<compile>" setfile' function to create a
  28246.     dynamic-compile log. More information concerning the
  28247.     dynamic-compile log can be found on Pages 47-48 of the "Microsoft
  28248.     Editor User's Guide."
  28249.  
  28250.  6. Finally, the original position of the cursor is restored in the
  28251.     original window by using the "window restcur" functions.
  28252.  
  28253.  7. The macro is assigned to the ALT+C keystroke, although any unused
  28254.     keystroke may be used.
  28255.  
  28256.  Error messages will now be displayed in the compile window when
  28257.  running a compilation or invoking a utility.
  28258.  
  28259.  
  28260.  162. C 6.00 UNDEL.EXE Is Not Compatible with the Microsoft Editor
  28261.  
  28262.  Product Version(s): 1.00 1.02 | 1.00 1.02
  28263.  Operating System:   MS-DOS    | OS/2
  28264.  Flags: ENDUSER |
  28265.  Last Modified: 25-JUL-1990    ArticleIdent: Q64024
  28266.  
  28267.  If backup copies of files are stored in the \DELETED subdirectory by
  28268.  the M Editor, typing "undel" should bring up a listing of backup
  28269.  copies. However, if the C 6.00 version of UNDEL.EXE is used, the
  28270.  following message will be displayed: "
  28271.  
  28272.     0(0) bytes in 0 deleted files.
  28273.  
  28274.  The C 5.10 version of UNDEL.EXE will successfully bring up a listing
  28275.  of backup copies saved by either the M Editor or the Programmer's
  28276.  WorkBench (PWB).
  28277.  
  28278.  This problem can be reproduced by setting the text backup switch in
  28279.  the M section of the TOOLS.INI file to "undel". After saving various
  28280.  copies, backups are added to the \DELETED subdirectory and a listing
  28281.  can be brought up by using the C 5.10 UNDEL.EXE. Using the C 6.00
  28282.  version of UNDEL.EXE causes the erroneous message listed above to be
  28283.  displayed. This incompatibility was caused by adding OS/2 version 1.20
  28284.  filename support to UNDEL.EXE and EXP.EXE.
  28285.  
  28286.  As a workaround, rename the C 5.10 UNDEL.EXE to UNDEL51.EXE and the C
  28287.  6.00 UNDEL.EXE to UNDEL60.EXE.
  28288.  
  28289.  
  28290.  163. Invalid Switch and Extensions in Brief Emulation
  28291.  
  28292.  Product Version(s): 1.02   | 1.02
  28293.  Operating System:   MS-DOS | OS/2
  28294.  Flags: ENDUSER |
  28295.  Last Modified:  6-FEB-1991    ArticleIdent: Q67762
  28296.  
  28297.  The M editor version 1.02 comes with a BRIEF.INI file, which contains
  28298.  the key settings for Brief emulation. If you want Brief emulation, you
  28299.  must rename this file to "TOOLS.INI". This file will generate the
  28300.  following three messages when M loads the TOOLS.INI file during
  28301.  initialization:
  28302.  
  28303.     mhctx is not an editor switch
  28304.     load:$PATH:ulcase - no such file or directory
  28305.     load:$PATH:justify - no such file or directory
  28306.  
  28307.  The messages are caused by the following three lines:
  28308.  
  28309.     Line 223: "mhctx:Alt+H"
  28310.     Line 263: "load:$PATH:ulcase"
  28311.     Line 369: "load:$PATH:justify"
  28312.  
  28313.  Deleting these three lines will not change the performance of the M
  28314.  editor, and will eliminate the messages they cause when M is
  28315.  initialized.
  28316.  
  28317.  
  28318.  
  28319.  
  28320.  
  28321.  
  28322.  Microsoft NMake [Make Utility]
  28323.  =============================================================================
  28324.  
  28325.  
  28326.  1. NMAKE and the Backslash "\" Character
  28327.  
  28328.  Product Version(s): 1.00   | 1.00
  28329.  Operating System:   MS-DOS | OS/2
  28330.  Flags: ENDUSER |
  28331.  Last Modified:  3-MAY-1989    ArticleIdent: Q43064
  28332.  
  28333.  The backslash "\" character in NMAKE has two different meanings
  28334.  depending on how it is used. One of its uses is as a line-continuation
  28335.  character. The other use is as a path specifier.
  28336.  
  28337.  The primary use of "\" is as a line continuation-character. For
  28338.  example, if you have a dependency line that extends more than one
  28339.  line, use the "\" character to continue to the next line. It is
  28340.  correct to include a space prior to the "\" or to append it to the
  28341.  last dependent, as in the following examples:
  28342.  
  28343.  FOO : obj1 obj2 obj3 obj4 obj5 \  (CORRECT)
  28344.  obj6 obj7...etc.
  28345.  
  28346.  FOO : obj1 obj2 obj3 obj4 obj5\   (CORRECT)
  28347.  obj6 obj7...etc.
  28348.  
  28349.  The "\" character is also used as a path specifier. When "\" is the
  28350.  last character on the line and is meant as a path specifier, you must
  28351.  precede it with the caret "^" character to tell NMAKE to override its
  28352.  meaning as a line-continuation character.
  28353.  
  28354.  The following macro definition is an example demonstrating the use of
  28355.  "\" as a path specifier:
  28356.  
  28357.  exe_dir = c:\bin^\    (CORRECT)
  28358.  
  28359.  exe_dir = c:\bin\     (INCORRECT)
  28360.  
  28361.  The following will be interpreted as a line-continuation character.
  28362.  
  28363.  exe_dir = c:\bin\     (INCORRECT)
  28364.  
  28365.  Preceding the "\" with another "\" will nullify the meaning as a
  28366.  line-continuation character. However, when this macro is expanded,
  28367.  both backslashes will appear, producing an incorrect path.
  28368.  
  28369.  
  28370.  2. NMAKE Is Case Sensitive
  28371.  
  28372.  Product Version(s): 1.00
  28373.  Operating System:   MS-DOS
  28374.  Flags: ENDUSER |
  28375.  Last Modified:  3-MAY-1989    ArticleIdent: Q43999
  28376.  
  28377.  It is not clearly stated in the manual that NMAKE IS case sensitive.
  28378.  Case sensitivity is imposed on the following:
  28379.  
  28380.  1. Macros
  28381.  
  28382.     For instance, if you define "TEXT" as a macro, you must use $(TEXT)
  28383.     to insert it. If $(text) is used, the macro is undefined and
  28384.     nothing happens.
  28385.  
  28386.  2. Predefined Macros (.SUFFIXES;.PRECIOUS, CC, etc.)
  28387.  
  28388.     Predefined macros such as .SUFFIXES must be in all in uppercase
  28389.     letters. If you use .suffixes, NMAKE returns the error ".suffixes
  28390.     too long: truncated to 8.3".
  28391.  
  28392.  3. File extensions
  28393.  
  28394.     When adding file extensions to the .SUFFIXES list, you must
  28395.     preserve case. For example, to add the file extension .dll to the
  28396.     suffix list, you would put the following line in your makefile:
  28397.  
  28398.        .SUFFIXES : .dll
  28399.  
  28400.     Then, all files with the .dll extension must have the .dll
  28401.     extension in lowercase letters.
  28402.  
  28403.  
  28404.  3. NMAKE Uses "makefile " Ignoring File Name on Command Line
  28405.  
  28406.  Product Version(s): 1.00
  28407.  Operating System:   MS-DOS
  28408.  Flags: ENDUSER | S_QuickC
  28409.  Last Modified: 10-NOV-1989    ArticleIdent: Q44777
  28410.  
  28411.  When using NMAKE, you normally put the makefile's name on the command
  28412.  line as follows:
  28413.  
  28414.     NMAKE test.mak
  28415.  
  28416.  Although this works correctly for most cases, if there is a file named
  28417.  "makefile." in the current working directory, NMAKE uses that file
  28418.  instead of the one specified on the command line.
  28419.  
  28420.  To be sure NMAKE uses the makefile specified on the command line, you
  28421.  must have a /F switch before the makefile name as follows:
  28422.  
  28423.     NMAKE /F test.mak
  28424.  
  28425.  This is expected behavior, as documented on Page 156 of the "Microsoft
  28426.  QuickC ToolKit" manual for QuickC Version 2.00.
  28427.  
  28428.  
  28429.  4. Modifications for an Existing Make File Used with MAKE
  28430.  
  28431.  Product Version(s): 1.00   | 1.10
  28432.  Operating System:   MS-DOS | OS/2
  28433.  Flags: ENDUSER | s_quickc  s_c  h_FORTRAN
  28434.  Last Modified: 16-JAN-1990    ArticleIdent: Q44130
  28435.  
  28436.  Question:
  28437.  
  28438.  What modifications need to be made to an existing make file that was
  28439.  used with MAKE, and why?
  28440.  
  28441.  Response:
  28442.  
  28443.  To use NMAKE on make files originally designed for MAKE, the first
  28444.  descriptor block (target:dependent) must be a pseudotarget (see QuickC
  28445.  Version 2.00 ToolKit, Sections 7.3.5 and 7.5) that lists all of the
  28446.  original make targets in the file as the dependent files. The
  28447.  following is an example:
  28448.  
  28449.     ALL : test.exe test1.exe test2.exe
  28450.  
  28451.  The reason you must include a pseudotarget descriptor block as the
  28452.  first descriptor block in a make file is that the previous MAKE
  28453.  utility tested EACH descriptor block sequentially throughout the file.
  28454.  NMAKE, however, tests only the FIRST descriptor block unless targets
  28455.  are specifically listed on the NMAKE command line. By using a
  28456.  pseudotarget, ALL in the above example, NMAKE must now assume
  28457.  that each dependent is out of date and attempt to make it. NMAKE now
  28458.  searches the make file for each dependent file listed (test.exe,
  28459.  test1.exe, and test2.exe) to see if a descriptor block exists for it.
  28460.  This causes NMAKE to behave just like MAKE.
  28461.  
  28462.  Example:
  28463.  -------
  28464.  
  28465.     ALL : test.exe test1.obj
  28466.  
  28467.     test1.obj : test1.c
  28468.             cl /c test1.c
  28469.  
  28470.     test.exe : test.obj test1.obj
  28471.             link test test1;
  28472.  
  28473.  Without the pseudotarget, NMAKE tests only the first descriptor block
  28474.  and ignores any following descriptor block.
  28475.  
  28476.  
  28477.  5. How to Specify Paths in Inference Rules in NMAKE
  28478.  
  28479.  Product Version(s): 1.00   | 1.10
  28480.  Operating System:   MS-DOS | OS/2
  28481.  Flags: ENDUSER | s_quickc  s_c  h_FORTRAN
  28482.  Last Modified: 23-MAR-1990    ArticleIdent: Q44131
  28483.  
  28484.  Question:
  28485.  
  28486.  How to I specify paths in inference rules?
  28487.  
  28488.  Response:
  28489.  
  28490.  Note: For a complete description of this feature, see QuickC Version 2.00
  28491.  Toolkit, Section 7.3.3. One of the most powerful new features of
  28492.  NMAKE is that it allows paths to be specified in an inference rule.
  28493.  
  28494.  The syntax of an inference rule without paths is as follows:
  28495.  
  28496.     .fromext.toext:
  28497.  
  28498.  This syntax is somewhat limited, however, because both the "fromfile"
  28499.  and the "tofile" are evaluated as if they existed in the current
  28500.  directory. With NMAKE, a path specifier may be added to an inference
  28501.  rule by doing the following:
  28502.  
  28503.     {frompath}.fromext{topath}.toext:
  28504.  
  28505.  Note: If you use a path on one element of the inference rule, you must
  28506.  use it on both. For instance, if you want to compare any .c file in
  28507.  the current directory with its .obj file in my object directory, the
  28508.  inference rule would look like the following:
  28509.  
  28510.  {.}.c{c:\objects}.obj:
  28511.          cl /c $<;
  28512.  
  28513.  Note that the fromext (.c) has to be preceded with a path. In the case
  28514.  of the current directory, the ".", or current directory works nicely.
  28515.  
  28516.  When NMAKE encounters a descriptor block that has no commands
  28517.  following, it will look for an inference rule that matches the
  28518.  descriptor block. When checking for matching, NMAKE expects that the
  28519.  base name of both the target and the dependents be the same. Also, the
  28520.  paths must match exactly. In other words, the following descriptor
  28521.  line would not use the inference rule just defined because the paths
  28522.  do not match on the .obj file:
  28523.  
  28524.     test.obj : test.c
  28525.  
  28526.  In this case, the predefined inference rule for .c.obj: would be
  28527.  invoked. To invoke the inference rule just defined, the descriptor
  28528.  line would be as follows:
  28529.  
  28530.     c:\objects\test.obj : test.c
  28531.  
  28532.  
  28533.  6. Multiple Targets in NMAKE Do Not Work
  28534.  
  28535.  Product Version(s): 2.00
  28536.  Operating System:   MS-DOS
  28537.  Flags: ENDUSER | buglist2.00 docerr S_QUICKC
  28538.  Last Modified:  2-JUN-1989    ArticleIdent: Q44757
  28539.  
  28540.  Multiple targets in the QuickC Version 2.00 NMAKE utility do not work
  28541.  properly. The example on the top of Page 167 of the "Microsoft QuickC
  28542.  Tool Kit" manual shows that each target listed before the dependencies
  28543.  should be evaluated; however, only the first target is evaluated, and
  28544.  the others are ignored. Make files that are simplified even more
  28545.  respond the same way.
  28546.  
  28547.  The following make file demonstrates the problem:
  28548.  
  28549.      target1.exe target2.exe: depend1.obj depend2.obj
  28550.          echo $@
  28551.  
  28552.  For the make file to work properly, change the file to the
  28553.  following:
  28554.  
  28555.      BUILD: target1.exe target2.exe
  28556.  
  28557.      target1.exe: depend1.obj depend2.obj
  28558.          echo $@
  28559.  
  28560.      target2.exe: depend1.obj depend2.obj
  28561.          echo $@
  28562.  
  28563.  Microsoft has confirmed this to be a problem in QuickC Version 2.00.
  28564.  We are researching this problem and will post new information as it
  28565.  becomes available.
  28566.  
  28567.  
  28568.  
  28569.  7. Modifying a QuickC 2.00 Make File to Run MAKE
  28570.  
  28571.  Product Version(s): 1.00   | 1.10
  28572.  Operating System:   MS-DOS | OS/2
  28573.  Flags: ENDUSER | s_quickc  s_c  h_FORTRAN
  28574.  Last Modified: 26-MAY-1989    ArticleIdent: Q44133
  28575.  
  28576.  Question:
  28577.  
  28578.  What modifications must I make to a make file generated by QuickC
  28579.  Version 2.00 so that I can run NMAKE on it and use my Microsoft C
  28580.  Version 5.10?
  28581.  
  28582.  Response:
  28583.  
  28584.  Only a few modifications must be made to allow a make file generated
  28585.  by QuickC to invoke C Version 5.10. The following three items need to
  28586.  be changed:
  28587.  
  28588.  1. Change the CC macro from qcl to cl. To do this, locate the
  28589.     following line in the make file generated by QuickC and change qcl
  28590.     to cl:
  28591.  
  28592.        CC=qcl
  28593.  
  28594.  2. Take out references to ilink. The ilink references are embedded
  28595.     into your make file if you have the ilink option turned on in your
  28596.     environment. The following line in the make file
  28597.  
  28598.        ilink -a -e "link $(LFLAGS) @$(PROJ).crf" $(PROG)
  28599.  
  28600.     must be changed to the following:
  28601.  
  28602.        link "$(LFGLAGS) @$(PROJ).crf" $(PROG)
  28603.  
  28604.  3. Remove any compiler switches in the make file that cl will not
  28605.     recognize. To eliminate this problem, turn off incremental compile
  28606.     in the QuickC environment prior to making the make file.
  28607.  
  28608.  
  28609.  8. NMAKE Version 1.00 with "!" and User and Predefined Macros
  28610.  
  28611.  Product Version(s): 1.00
  28612.  Operating System:   MS-DOS
  28613.  Flags: ENDUSER | S_QuickC buglist1.00 fixlist1.01
  28614.  Last Modified: 30-NOV-1989    ArticleIdent: Q48859
  28615.  
  28616.  The following NMAKE file does not produce the correct results when
  28617.  using NMAKE Version 1.00, which is supplied with the Microsoft QuickC
  28618.  compiler Version 2.00. The file replaces the user-defined macro in the
  28619.  second command line with the predefined macro in the first command
  28620.  line. The workarounds are as follows:
  28621.  
  28622.  1. Remove the "!" at the beginning of the first command line, which
  28623.     causes the command to be executed for each dependent file if the
  28624.     command uses one of the special macros $? or $**.
  28625.  
  28626.  2. Do not use a predefined macro for the first command.
  28627.  
  28628.  3. Do not use the predefined macro $**, a complete list of dependent
  28629.     files, for the dependent files in the first command line.
  28630.  
  28631.  4. Do not use a user-defined macro in the second command line.
  28632.  
  28633.  5. Update to the Microsoft QuickAssembler package, which is shipped
  28634.     with NMAKE Version 1.01, in which this problem is corrected.
  28635.  
  28636.  More information on the NMAKE utility can be found starting on Page
  28637.  155 of the "Microsoft QuickC Toolkit" manual. The following is the
  28638.  NMAKE file that fails:
  28639.  
  28640.  SOURCE=test.c
  28641.  
  28642.  test.exe: $(SOURCE)
  28643.      !$(CC) $**
  28644.      copy $(SOURCE) new
  28645.  
  28646.  This produces the following output:
  28647.  
  28648.  cl test.c
  28649.  copy cl new
  28650.  
  28651.  The following is the NMAKE file with the first workaround:
  28652.  
  28653.  SOURCE=test.c
  28654.  
  28655.  test.exe: $(SOURCE)
  28656.      $(CC) $**
  28657.      copy $(SOURCE) new
  28658.  
  28659.  This produces the following correct output:
  28660.  
  28661.  cl test.c
  28662.  copy test.c new
  28663.  
  28664.  The following is the NMAKE file with the second workaround:
  28665.  
  28666.  SOURCE=test.c
  28667.  
  28668.  test.exe: $(SOURCE)
  28669.      !cl $**
  28670.      copy $(SOURCE) new
  28671.  
  28672.  This also produces the correct output.
  28673.  
  28674.  The following is the NMAKE file with the third workaround:
  28675.  
  28676.  SOURCE=test.c
  28677.  
  28678.  test.exe: $(SOURCE)
  28679.      !$(CC) $(SOURCE)
  28680.      copy $(SOURCE) new
  28681.  
  28682.  This also produces the correct output.
  28683.  
  28684.  The following is the NMAKE file with the fourth workaround:
  28685.  
  28686.  SOURCE=test.c
  28687.  
  28688.  test.exe: $(SOURCE)
  28689.      !$(CC) $(SOURCE)
  28690.      copy test.c new
  28691.      copy $(SOURCE) new
  28692.  
  28693.  This produces the following output:
  28694.  
  28695.  cl test.c
  28696.  copy test.c new
  28697.  copy test.c new
  28698.  
  28699.  
  28700.  9. Incrementally Updating Libraries with NMAKE
  28701.  
  28702.  Product Version(s): 1.00 1.01 1.10 1.11 1.12 | 1.11 1.12
  28703.  Operating System:   MS-DOS                   | OS/2
  28704.  Flags: ENDUSER |
  28705.  Last Modified: 25-FEB-1991    ArticleIdent: Q48862
  28706.  
  28707.  The repetition modifier "!" (without the quotation marks) provided in
  28708.  NMAKE allows libraries to be maintained and incrementally updated very
  28709.  easily. By using this modifier with the special macro for dependents
  28710.  out-of-date with the target (for example, "$?"), the library update
  28711.  becomes an automated part of modifying a project.
  28712.  
  28713.  The following NMAKE makefile keeps FOO.LIB up-to-date based on the
  28714.  four object files listed in the OBJS macro. These object files can be
  28715.  based on C or assembly source files. The list of source-file types can
  28716.  be extended by adding the appropriate inference rules to the
  28717.  description file.
  28718.  
  28719.  Sample NMAKE Makefile
  28720.  ---------------------
  28721.  
  28722.      #
  28723.      # List of object files to be kept in library
  28724.      #
  28725.      OBJS = foo1.obj foo2.obj foo3.obj foo4.obj
  28726.  
  28727.      .c.obj:
  28728.          cl /c $?
  28729.  
  28730.      .asm.obj:
  28731.          masm $?;
  28732.  
  28733.      foo.lib : $(OBJS)
  28734.          !lib foo.lib -+ $?;
  28735.  
  28736.  The command for the library dependency line uses a predefined macro
  28737.  and a special NMAKE directive. Placing "$?" on the end of the LIB line
  28738.  expands to the list of all dependents that are out-of-date with the
  28739.  target. This list combined with "!" causes the LIB line to be executed
  28740.  once for each member in the list.
  28741.  
  28742.  If FOO1.OBJ and FOO3.OBJ are out-of-date with respect to FOO.LIB, "$?"
  28743.  evaluates to "FOO1.OBJ FOO3.OBJ". With "!", the following commands are
  28744.  executed:
  28745.  
  28746.     lib foo.lib -+ foo1.OBJ;
  28747.     lib foo.lib -+ foo3.OBJ;
  28748.  
  28749.  
  28750.  10. Explanation of Why NMAKE May Not Produce .OBJ and .EXE Files
  28751.  
  28752.  Product Version(s): 1.00 1.10 1.11 | 1.00 1.11
  28753.  Operating System:   MS-DOS         | OS/2
  28754.  Flags: ENDUSER |
  28755.  Last Modified: 27-OCT-1989    ArticleIdent: Q49502
  28756.  
  28757.  Question:
  28758.  
  28759.  When using the NMAKE utility, no warnings occur and the compiler
  28760.  appears to execute properly; however, the .OBJ and .EXE files are not
  28761.  created.
  28762.  
  28763.  If I use the MAKE utility on the same .MAK file, I get the following
  28764.  two warnings:
  28765.  
  28766.     warning U4000: Target does not exist.
  28767.  
  28768.     warning U4001: Dependent does not exist; Target not built.
  28769.  
  28770.  The first warning message is a standard warning that I would expect.
  28771.  Why is there a second and why aren't the .OBJ and .EXE files created?
  28772.  
  28773.  Response:
  28774.  
  28775.  Remove unexpected trailing characters from the .MAK file.
  28776.  
  28777.  This problem can occur because extra characters occur at the end of a
  28778.  line within the .MAK file. Common mistakes such as placing a trailing
  28779.  semicolon in the CL compile line or in the dependency line can cause
  28780.  this behavior. This applies to any unexpected characters, not just
  28781.  semicolons.
  28782.  
  28783.  The following example demonstrates the problem:
  28784.  
  28785.     file.obj: file.c <ENTER>
  28786.        CL /c /Lp file.c;  <-- Semicolon CANNOT be used with the CL command.
  28787.  
  28788.     file.exe: file.obj <ENTER>
  28789.        LINK file;      <-- OK, Semicolon CAN be used with the LINK command.
  28790.  
  28791.  Removing the semicolon at the end of the CL line eliminates the
  28792.  problem.
  28793.  
  28794.  
  28795.  11. Command Line Too Long in Makefile Can Cause Error: U1082
  28796.  
  28797.  Product Version(s): 1.00 1.01 1.10 1.11 1.12 | 1.11 1.12
  28798.  Operating System:   MS-DOS                   | OS/2
  28799.  Flags: ENDUSER | s_make
  28800.  Last Modified: 24-JAN-1991    ArticleIdent: Q49757
  28801.  
  28802.  NMAKE and MAKE require that all commands issued after a target
  28803.  dependency are less than the DOS command-line limit of 128 characters.
  28804.  If the command is too long, you may receive the following error
  28805.  
  28806.     U1082:  Not enough memory '...' cannot execute '...'
  28807.  
  28808.  where '...' is the command that was attempted. This problem most
  28809.  likely occurs with the link command line and can be easily resolved
  28810.  with a response file. Response files are documented in the utilities
  28811.  manual or the online help supplied with each compiler.
  28812.  
  28813.  
  28814.  12. Special Macros Not Recognized in NMAKE Inline Files
  28815.  
  28816.  Product Version(s): 1.00 1.01 | 1.00 1.01
  28817.  Operating System:   MS-DOS    | OS/2
  28818.  Flags: ENDUSER |
  28819.  Last Modified: 10-NOV-1989    ArticleIdent: Q50693
  28820.  
  28821.  When you use special macros to indicate targets or dependents in
  28822.  inline files, NMAKE Version 1.00 will generate the error message
  28823.  U4108, "special macro undefined." These special macros are $@, $*,
  28824.  $**, and $?.
  28825.  
  28826.  To prevent the problem, avoid use of these special macros in inline
  28827.  files. Instead of using those << inline files, create the response
  28828.  file in a separate NMAKE target, and redirect TYPE and ECHO commands
  28829.  to the desired file.
  28830.  
  28831.  $@ refers to the full name of the target, base plus extension. $*
  28832.  refers only to the base name of the target.
  28833.  
  28834.  $** represents the complete list of dependent files for the target. $?
  28835.  represents only the dependents that are out of date relative to the
  28836.  target.
  28837.  
  28838.  The following makefile will generate U4018 for $**:
  28839.  
  28840.  #makefile test
  28841.  FOO.EXE: *.OBJ
  28842.      LINK @<<FOO.LRF
  28843.  $**;
  28844.  <<
  28845.  
  28846.  To avoid the problem, break this up into two steps, the makefile and a
  28847.  linker response file with output redirected:
  28848.  
  28849.  #makefile test
  28850.  FOO.EXE: *.OBJ FOO.LRF
  28851.      LINK @FOO.LRF
  28852.  
  28853.  FOO.LRF: *.OBJ
  28854.      echo $**; >FOO.LRF
  28855.  
  28856.  
  28857.  13. Inference Rule May Fail If Blank Command Line Contains Spaces
  28858.  
  28859.  Product Version(s): 1.00 1.01 1.10 1.11 1.12 | 1.11 1.12
  28860.  Operating System:   MS-DOS                   | OS/2
  28861.  Flags: ENDUSER |
  28862.  Last Modified: 24-JAN-1991    ArticleIdent: Q50383
  28863.  
  28864.  When using inference rules in an NMAKE description file, the target/
  28865.  dependency line must be followed by a blank line (no space
  28866.  characters); otherwise, the inference rule commands will not be
  28867.  executed. NMAKE checks this line for any ASCII characters; if ANY
  28868.  characters exist, NMAKE will ignore the inference rule and try to
  28869.  execute the line, even if it contains only a space or spaces.
  28870.  
  28871.  The following is a simple example, which demonstrates this problem:
  28872.  
  28873.  .c.exe:
  28874.    cl $**
  28875.  
  28876.  ALL : main.exe
  28877.  
  28878.  main.exe : main.c
  28879.  <space>
  28880.  
  28881.  Nothing happens if this description file is passed to NMAKE because
  28882.  the space character will cause NMAKE to assume there are explicit
  28883.  commands following the target/dependency line, causing it to ignore
  28884.  the inference rule. Note that this is expected behavior for NMAKE.
  28885.  
  28886.  MAKE version 4.x inference rules/description blocks do not exhibit
  28887.  this behavior. This is something to keep in mind when converting
  28888.  description files from MAKE to NMAKE.
  28889.  
  28890.  
  28891.  14. Using "." for Path in Inference Rules Causes U1073
  28892.  
  28893.  Product Version(s): 1.00 1.01 | 1.01
  28894.  Operating System:   MS-DOS    | OS/2
  28895.  Flags: ENDUSER | buglist1.01
  28896.  Last Modified: 18-DEC-1989    ArticleIdent: Q51723
  28897.  
  28898.  NMAKE does not accept a dot (.) to identify the current directory in
  28899.  inference rule paths. When specifying paths for each of the
  28900.  extensions, using the following form
  28901.  
  28902.     {frompath}.fromextension{topath}.toextension
  28903.  
  28904.  and using "{.}" (without the quotation marks) to indicate the current
  28905.  directory for the "topath", causes the following error:
  28906.  
  28907.     NMAKE : fatal error U1073: don't know how to make 'filename.ext'
  28908.  
  28909.  To work around this, the current directory for topath must be
  28910.  specified with "{}". However, both notations are acceptable when
  28911.  specifying the "frompath".
  28912.  
  28913.  The following makefile causes the error:
  28914.  
  28915.  .SUFFIXES: .h .c .obj .exe
  28916.  
  28917.  #macros
  28918.  a=tools.h
  28919.  jbo=grdemo.obj turtle.obj menu.obj
  28920.  cc=qcl -c
  28921.  
  28922.  #inference rules
  28923.  {d:\qc2\work}.c{.}.obj:          #*** the '{.}' must be '{}' ***
  28924.   $(cc) $<
  28925.  
  28926.  {}.obj{d:\qc2\lib}.exe:
  28927.   link $(**R),,, graphics.lib;
  28928.  
  28929.  #target-dependencies
  28930.  run: d:\qc2\lib\grdemo.exe
  28931.  
  28932.  d:\qc2\lib\*.obj: d:\qc2\work\*.c
  28933.  
  28934.  d:\qc2\lib\grdemo.exe: $(jbo)
  28935.  
  28936.  
  28937.  15. Redirecting NMAKE 1.00/1.01 Output with -p Gives False Errors
  28938.  
  28939.  Product Version(s): 1.00 1.01
  28940.  Operating System:   MS-DOS
  28941.  Flags: ENDUSER | buglist1.00 buglist1.01 fixlist 1.11
  28942.  Last Modified: 24-JAN-1991    ArticleIdent: Q57500
  28943.  
  28944.  Redirecting the output of NMAKE version 1.00 or 1.01 can cause
  28945.  inference rules to fail if all of the following conditions are met:
  28946.  
  28947.  1. The inference rules are in uppercase letters.
  28948.  2. The -p option is used.
  28949.  3. The output is redirected.
  28950.  
  28951.  This problem is somewhat obscure, and it can be frustrating if you
  28952.  unwittingly meet all of these conditions. The error message displayed
  28953.  depends on the inference rule used, but it resembles the following:
  28954.  
  28955.     NMAKE : warning U4017: ignoring rule .C.OBJ (extension not in
  28956.             .SUFFIXES)
  28957.  
  28958.  The above error message is displayed with the following description
  28959.  file initiated with the command "NMAKE -p > out.txt":
  28960.  
  28961.  Description File
  28962.  ----------------
  28963.  
  28964.  # start
  28965.  
  28966.  .C.OBJ:
  28967.    cl $*
  28968.  
  28969.  main.obj : main.c
  28970.  
  28971.  # end
  28972.  
  28973.  Microsoft has confirmed this to be a problem in NMAKE versions 1.00
  28974.  and 1.01. This problem was corrected in NMAKE version 1.11.
  28975.  
  28976.  
  28977.  16. Missing Right Parenthesis in Sample NMAKE File Hangs Machine
  28978.  
  28979.  Product Version(s): 1.00
  28980.  Operating System:   MS-DOS
  28981.  Flags: ENDUSER | h_fortran s_quickc s_quickasm buglist1.00
  28982.  Last Modified: 15-MAR-1990    ArticleIdent: Q59069
  28983.  
  28984.  If you forget the right parenthesis in an IF "$(flag)"=="comparison"
  28985.  line in a makefile and run the makefile through NMAKE, you can receive
  28986.  machine hangs or corrupt COMMAND.COM messages under DOS or an Internal
  28987.  Processing Error under OS/2.
  28988.  
  28989.  Microsoft has confirmed this to be a problem with Version 1.00. We are
  28990.  researching this problem and will post new information here as it
  28991.  becomes available.
  28992.  
  28993.  The following makefile, simplified from the sample makefile on Page
  28994.  172 of the "QuickC ToolKit" manual, demonstrates this problem:
  28995.  
  28996.  debug=Y
  28997.  CC=qcl
  28998.  !CMDSWITCHES +D
  28999.  HELLO.EXE : HELLO.OBJ
  29000.  !IFDEF debug
  29001.  !   IF "$(debug"=="y"
  29002.                  LINK /CO hello;
  29003.  !   ELSE
  29004.                  LINK hello;
  29005.  !   ENDIF
  29006.  !ELSE
  29007.  !   ERROR Macro named debug is not defined.
  29008.  !ENDIF
  29009.  
  29010.  Adding a right parenthesis after "$(debug solves the problem.
  29011.  
  29012.  The error seems to occur because NMAKE does not recognize the end of
  29013.  the line and continues to parse the line until the end of the file. A
  29014.  customer has reported receiving "U1076, Line too long" messages,
  29015.  followed by a DOS level error reading "Invalid COMMAND.COM - system
  29016.  halted."
  29017.  
  29018.  Testing the same problem under an OS/2 1.20 DOS Box returned Internal
  29019.  Processing Errors and halted the system with no other error messages.
  29020.  
  29021.  
  29022.  17. NMAKE 1.01 Does Not Properly Expand Wildcard Arguments
  29023.  
  29024.  Product Version(s): 1.01   | 1.01
  29025.  Operating System:   MS-DOS | OS/2
  29026.  Flags: ENDUSER |
  29027.  Last Modified: 15-MAY-1990    ArticleIdent: Q59254
  29028.  
  29029.  NMAKE version 1.01 doesn't properly expand wildcard command-line arguments.
  29030.  For example, if we were to have a makefile that looked similar to the
  29031.  following
  29032.  
  29033.  a.exe : a.c
  29034.      echo cl a.c
  29035.  
  29036.  b.exe : b.c
  29037.      echo cl b.c
  29038.  
  29039.  And we were to say:
  29040.  
  29041.  NMAKE *.exe /A
  29042.  
  29043.  NMAKE wouldn't properly expand "*.exe" to equate to both a.exe and
  29044.  b.exe; it would merely build only the first target in the list.
  29045.  
  29046.  NMAKE versions 1.00 and 1.10 do not exhibit this behavior.
  29047.  
  29048.  
  29049.  18. NMAKE /D /C Switches Suppress Modification Date
  29050.  
  29051.  Product Version(s): 1.00 1.01 1.10 1.11
  29052.  Operating System:   MS-DOS
  29053.  Flags: ENDUSER | buglist1.00 buglist1.01 buglist1.10 buglist1.11
  29054.  Last Modified: 18-NOV-1990    ArticleIdent: Q59384
  29055.  
  29056.  When using the NMAKE /D and /C switches together, the modification
  29057.  date of each file will not be displayed when the date is checked. A
  29058.  short description of each switch is described as follows:
  29059.  
  29060.     /D  Displays the modification date of each file when the date is
  29061.         checked.
  29062.  
  29063.     /C  Suppresses the NMAKE copyright message and prevents nonfatal
  29064.         error or warning messages from being displayed.
  29065.  
  29066.  Microsoft has confirmed this to be a problem with NMAKE Versions 1.00,
  29067.  1.01, and 1.10. We are researching this problem and will post new
  29068.  information here as it becomes available.
  29069.  
  29070.  
  29071.  19. Trouble with Filenames Containing a Dollar Sign ($)
  29072.  
  29073.  Product Version(s): 1.01    | 1.01
  29074.  Operating System:   MS-DOS  | OS/2
  29075.  Flags: ENDUSER | buglist1.01
  29076.  Last Modified: 14-MAR-1990    ArticleIdent: Q59409
  29077.  
  29078.  If you use a filename that contains a dollar sign ($) in a NMAKE
  29079.  description file, you can use the escape character (^) to tell NMAKE
  29080.  that the dollar sign is part of your filename, not a macro character.
  29081.  However, using the escape character within an inline response file
  29082.  does not work and you must use the double dollar sign ($$).
  29083.  
  29084.  Consider the following NMAKE description file:
  29085.  
  29086.      all:test^$.exe;
  29087.  
  29088.      test^$.obj: test^$.c
  29089.         cl /c test^$.c
  29090.  
  29091.      test^$.exe: test^$.obj
  29092.         link @<<
  29093.               test^$.obj,
  29094.               test^$.exe,
  29095.               NUL,;
  29096.      <<
  29097.  
  29098.  In this file, the escape character (^) is used to tell NMAKE that the
  29099.  $ is part of the filename TEST$.* and is not denoting the use of a
  29100.  macro. When TEST$.C is compiled, everything works correctly until you
  29101.  get to the inline response file for LINK. NMAKE does not interpret the
  29102.  ^ character, but instead passes it on to LINK.EXE. LINK then tries to
  29103.  link TEST^$.OBJ instead of TEST$.OBJ and fails. If you eliminate the ^
  29104.  to pass TEST$.OBJ to link, NMAKE fails with an error about an invalid
  29105.  macro.
  29106.  
  29107.  NMAKE is in error here. NMAKE should do one of two things when parsing
  29108.  the inline response file.
  29109.  
  29110.  1. NMAKE should interpret the ^ to leave the $ as part of the filename.
  29111.  
  29112.  2. NMAKE should ignore the $ so that you can just list TEST$.OBJ
  29113.     because it doesn't make sense to have macros in external response
  29114.     files when parsing an inline response file.
  29115.  
  29116.  Microsoft has confirmed this to be a problem with NMAKE Version 1.01.
  29117.  We are researching this problem and will post new information here as
  29118.  it becomes available.
  29119.  
  29120.  The following are two suggested workarounds:
  29121.  
  29122.  1. Use an external response file. Then your link line would appear
  29123.     similar to link @FILE.RES and you could put TEST$.OBJ directly in
  29124.     the response file.
  29125.  
  29126.  2. Use $$ as the escape sequence instead of ^$ in the inline response
  29127.     file. For example, change
  29128.  
  29129.        link @<<
  29130.            test^$.obj,
  29131.            test^$.exe,
  29132.            NUL,;
  29133.        <<
  29134.  
  29135.     to the following
  29136.  
  29137.        link @<<
  29138.            test$$.obj,
  29139.            test$$.exe,
  29140.            NUL,;
  29141.        <<
  29142.  
  29143.     and NMAKE will correctly pass TEST$.OBJ to the linker.
  29144.  
  29145.  
  29146.  20. In What Order Does NMAKE Build Files?
  29147.  
  29148.  Product Version(s): 1.00   | 1.00
  29149.  Operating System:   MS-DOS | OS/2
  29150.  Flags: ENDUSER |
  29151.  Last Modified: 15-MAY-1990    ArticleIdent: Q59420
  29152.  
  29153.  Question:
  29154.  
  29155.  I need to have my source files built in a particular order but I can't
  29156.  get NMAKE to build them that way. NMAKE seems to build the source
  29157.  files in the order it wants. What is the order in which NMAKE builds
  29158.  files?
  29159.  
  29160.  It is definitely possible to specify the order in which NMAKE builds
  29161.  your files.
  29162.  
  29163.  The first thing NMAKE does is check the command line. You can specify
  29164.  the targets in the order you want them built and NMAKE will build them
  29165.  in that order. If NMAKE doesn't find any targets on the command line,
  29166.  it builds the first target in the description file.
  29167.  
  29168.  NMAKE will build all of the dependents in the order in which they are
  29169.  specified on the first target line. For most description files, the
  29170.  first target in the file is the ALL:FILENAME.EXE pseudotarget. In this
  29171.  case, NMAKE will build FILENAME.EXE, and then the order depends on the
  29172.  dependency for FILENAME.EXE.
  29173.  
  29174.  This can be more clearly explained in the following examples:
  29175.  
  29176.  Example 1
  29177.  ---------
  29178.  
  29179.  Consider the following description file:
  29180.  
  29181.              all:three.obj two.obj one.obj main.exe
  29182.  
  29183.              one.obj:one.c
  29184.                  cl /c one.c
  29185.  
  29186.              two.obj:two.c
  29187.                  cl /c two.c
  29188.  
  29189.              three.obj:three.c
  29190.                  cl /c three.c
  29191.  
  29192.              main.exe:three.obj one.obj two.obj
  29193.                  link one two three, main;
  29194.  
  29195.  In this example, the files are compiled in the order: THREE.C, TWO.C,
  29196.  ONE.C. After those three files are compiled, the link for MAIN.EXE is
  29197.  executed. They are executed in that order because that is the explicit
  29198.  order given in the first target in the file and NMAKE builds the first
  29199.  target in the file when nothing is specified on the command line.
  29200.  
  29201.  Example 2
  29202.  ---------
  29203.  
  29204.  Now, consider the following description file that has been slightly
  29205.  modified from the one shown in Example 1 above:
  29206.  
  29207.              all:main.exe
  29208.  
  29209.              one.obj:one.c
  29210.                  cl /c one.c
  29211.  
  29212.              two.obj:two.c
  29213.                  cl /c two.c
  29214.  
  29215.              three.obj:three.c
  29216.                  cl /c three.c
  29217.  
  29218.              main.exe:three.obj one.obj two.obj
  29219.                  link one two three, main;
  29220.  
  29221.  In this example the files are compiled in the order: THREE.C, ONE.C,
  29222.  TWO.C. After that, the link statement will then be executed because
  29223.  there is nothing specified on the command line, so NMAKE will build
  29224.  the first target in the file, which is MAIN.EXE. When NMAKE looks at
  29225.  what it needs to build MAIN.EXE, it sees the list of dependents and
  29226.  builds them in that order.
  29227.  
  29228.  In summary, NMAKE looks first on the command line. If nothing is found
  29229.  there, it builds the first target in the description file by building
  29230.  each of its dependents in the order specified. If the dependent of the
  29231.  first target specifies another target, the dependents of that target
  29232.  are built in the order they are specified and so on.
  29233.  
  29234.  
  29235.  21. Multiple Dependency Blocks Are Not Cumulative
  29236.  
  29237.  Product Version(s): 1.00 1.01 1.10 1.11 | 1.01 1.10 1.11
  29238.  Operating System:   MS-DOS              | OS/2
  29239.  Flags: ENDUSER |
  29240.  Last Modified: 16-OCT-1990    ArticleIdent: Q59526
  29241.  
  29242.  Question:
  29243.  
  29244.  Specifying a target in multiple dependency blocks seems to confuse
  29245.  NMAKE. If my make file says something similar to the following
  29246.  
  29247.  FOO.EXE:: FOO1.obj
  29248.  FOO.EXE:: FOO2.obj
  29249.  FOO.EXE:: FOO3.obj
  29250.    link foo.exe
  29251.  
  29252.  FOO.EXE:: FOO.RES
  29253.    RC FOO.RES FOO.EXE
  29254.  
  29255.  and FOO1.OBJ and FOO2.OBJ are newer than FOO.EXE but FOO3.OBJ is not,
  29256.  FOO.EXE will not be built. To further confuse the issue, the following
  29257.  is the output from running NMAKE with the /d (display file dates)
  29258.  option:
  29259.  
  29260.  C:\>NMAKE /d foo.mak
  29261.  
  29262.    foo.exe                    Wed Mar 07 08:42:38 1990
  29263.      foo1.obj                 Thu Mar 08 15:25:44 1990
  29264.  ** foo1.obj newer than foo.exe
  29265.      foo2.obj                 Wed Mar 08 08:38:56 1990
  29266.  ** foo2.obj newer than foo.exe
  29267.      foo3.obj                 Thu Mar 01 09:49:52 1990
  29268.      foo.res                  Thu Mar 01 09:49:52 1990
  29269.  'foo.exe' is up-to-date.
  29270.  
  29271.  Obviously, NMAKE realizes the foo1 and foo2 .OBJs are newer, but
  29272.  FOO.EXE is never linked. Why not?
  29273.  
  29274.  Response:
  29275.  
  29276.  The multiple dependency construct, indicated by a double colon (::)
  29277.  following the target, is very useful in NMAKE because it allows the
  29278.  programmer to specify what operations are to take place on a target
  29279.  based on various dependents. For instance, in PM (Presentation
  29280.  Manager) programming the MAKE file can indicate that if the .OBJs
  29281.  change, execute the linker to rebuild the application. On the other
  29282.  hand, if all that changes is the resource file, only the resource
  29283.  compiler needs to be executed.
  29284.  
  29285.  However, there is a limitation to this feature. The command block for
  29286.  a target-dependency group MUST immediately follow it. They are not
  29287.  cumulative like normal dependency blocks. Therefore, one workaround to
  29288.  the above example is the following:
  29289.  
  29290.  FOO.EXE:: FOO1.obj
  29291.    link foo.exe
  29292.  
  29293.  FOO.EXE:: FOO2.obj
  29294.    link foo.exe
  29295.  
  29296.  FOO.EXE:: FOO3.obj
  29297.    link foo.exe
  29298.  
  29299.  FOO.EXE:: FOO.RES
  29300.    RC FOO.RES FOO.EXE
  29301.  
  29302.  The second alternative is to put all the dependencies on the same
  29303.  line as the target, for example:
  29304.  
  29305.  FOO.EXE:: FOO1.obj FOO2.obj FOO3.obj
  29306.    link foo.exe
  29307.  
  29308.  FOO.EXE:: FOO.RES
  29309.    RC FOO.RES FOO.EXE
  29310.  
  29311.  
  29312.  22. A Complete Example of Utilizing Paths in NMAKE
  29313.  
  29314.  Product Version(s): 1.00 1.01 1.11
  29315.  Operating System:   MS-DOS
  29316.  Flags: ENDUSER |
  29317.  Last Modified: 18-APR-1990    ArticleIdent: Q60340
  29318.  
  29319.  The make file shown below is an NMAKE example of using paths in
  29320.  macros, inference rules, and target dependencies (descriptor blocks).
  29321.  This is a working example of what is described on Page 298 of the
  29322.  "Microsoft FORTRAN CodeView and Utilities User's Guide" and Page 168
  29323.  of the "Microsoft QuickC Tool Kit."
  29324.  
  29325.  This make file compares the modification dates of the .H and the .C
  29326.  files with the .OBJ files, and the .OBJ files with the .EXE files. If
  29327.  any of the dependent files have changed more recently than the target
  29328.  files, the specified series of commands is executed. The .H and the
  29329.  .C files in the work directory are compared to the .OBJ files of the
  29330.  lib directory.
  29331.  
  29332.  If any of the source file(s) have changed since the last .OBJ was
  29333.  .created, then it is recompiled and copied from the current
  29334.  directory to the lib directory. The .OBJ files in the lib directory
  29335.  are compared to the .EXE files in the current directory. If any of the
  29336.  .OBJ files have changed since the last .EXE was created, then the
  29337.  .OBJs are relinked.
  29338.  
  29339.  Sample Make File
  29340.  ----------------
  29341.  
  29342.  #macros
  29343.  
  29344.  objdir =d:\qc2\lib
  29345.  wrkdir =d:\qc2\work
  29346.  list   =$(objdir)\grdemo.obj $(objdir)\turtle.obj \
  29347.  $(objdir)\menu.obj
  29348.  cc     =qcl -c
  29349.  
  29350.  #inference rules
  29351.  
  29352.  #compile
  29353.  {$(wrkdir)}.c{$(objdir)}.obj:
  29354.   $(cc) $<
  29355.   copy $(*F).obj $(*R).obj
  29356.   erase $(*F).obj
  29357.  
  29358.  #link
  29359.  {$(objdir)}.obj{}.exe:
  29360.   link $(**R);
  29361.  
  29362.  #target-dependencies
  29363.  
  29364.  run: grdemo.exe
  29365.  
  29366.  $(objdir)\*.obj: $(wrkdir)\$$(@B).c $(wrkdir)\menu.h \
  29367.  $(wrkdir)\turtle.h
  29368.  
  29369.  grdemo.exe: $(list)
  29370.  
  29371.  
  29372.  23. NMAKE May Invoke MASM Instead of the C Compiler
  29373.  
  29374.  Product Version(s): 1.00 1.01 1.11 | 1.01 1.11
  29375.  Operating System:   MS-DOS         | OS/2
  29376.  Flags: ENDUSER | docsup s_pwb h_fortran
  29377.  Last Modified: 17-JUL-1990    ArticleIdent: Q60746
  29378.  
  29379.  When using an NMAKE file in combination with adding /Fa to the
  29380.  compiler options within Programmer's WorkBench (PWB), NMAKE will
  29381.  invoke the Macro Assembler, if it is in the current search path.
  29382.  
  29383.  This does not occur the first time you build your application, but it
  29384.  does occur the second time, and thereafter, because of the generation
  29385.  of the .ASM created by the compiler.
  29386.  
  29387.  Files with the .ASM extension have a predefined inference rule within
  29388.  NMAKE to invoke MASM. However, the inference rule for .ASM files takes
  29389.  place before the rule for files with the .C or .OBJ extension.
  29390.  Therefore, if you have a filename with the same base name, but one has
  29391.  an .ASM extension and the other has a .C extension (as is the case
  29392.  with the /FA switch), the .ASM file will be assembled before the .C
  29393.  file will be compiled. Since the assembly step generates an .OBJ file
  29394.  that is newer than the .C file, the .C file is never compiled.
  29395.  
  29396.  Use the following procedures to work around this behavior:
  29397.  
  29398.  1. The best workaround is to use /Fa [LSTFILE.EXT] with a filename
  29399.     included as a compiler option, instead of allowing the /Fa option
  29400.     to default to its <filename>.ASM.
  29401.  
  29402.     Example: /Fa <filename>.ASC
  29403.  
  29404.     In using this method, the .C file will be compiled, instead of the
  29405.     .ASM version being assembled.
  29406.  
  29407.  2. Use the /Fc compiler option in place of the /Fa option (if you just
  29408.     want to look at an assembly source listing). This produces a .COD
  29409.     file (combined assembly and C source listing).
  29410.  
  29411.  3. Use the /R switch for the NMAKE invocation to ignore inference
  29412.     rules and macros that are predefined or defined in the TOOLS.INI
  29413.     file.
  29414.  
  29415.  For a more in-depth discussion on the /R switch and its effects, see
  29416.  the following references:
  29417.  
  29418.  1. The "Microsoft C Advanced Programming Techniques" reference manual
  29419.  
  29420.     Page(s) 112-114 Predefined macros
  29421.             118-119 Predefined inference rules
  29422.             125     /R Switch
  29423.  
  29424.  2. The "Microsoft FORTRAN, CodeView and Utilities User's Guide"
  29425.  
  29426.     Page(s) 288     /R Switch
  29427.             295-297 Predefined macros
  29428.             299-230 Predefined inference rules
  29429.  
  29430.  3. The "Microsoft QuickC Toolkit" reference manual
  29431.  
  29432.     Page(s) 158     /R Switch
  29433.             165-197 Predefined macros
  29434.             169     Predefined inference rules
  29435.  
  29436.  
  29437.  24. Looking for Files in Different Directories
  29438.  
  29439.  Product Version(s): 1.00 1.01 1.10 1.11 | 1.01 1.10 1.11
  29440.  Operating System:   MS-DOS              | OS/2
  29441.  Flags: ENDUSER | s_c s_quickc s_quickasm h_fortran
  29442.  Last Modified: 17-JUL-1990    ArticleIdent: Q60867
  29443.  
  29444.  If you use the "directory search" feature of NMAKE (curly braces "{}")
  29445.  to use a separate directory for some files, the location of these
  29446.  files cannot be inferred in subsequent dependency rules.
  29447.  
  29448.  The following code example demonstrates this confusion:
  29449.  
  29450.     test.exe: {\obj}test.obj
  29451.        link \obj\test.obj graphics.lib;
  29452.  
  29453.     test.obj: test.c test.h
  29454.        cl /c /Fo\obj\test.obj test.c
  29455.  
  29456.  If TEST.EXE and \OBJ\TEST.OBJ were up to date and we were to change
  29457.  one of the dependencies for TEST.OBJ, nothing would happen. This is
  29458.  because \OBJ\TEST.OBJ doesn't have any dependencies. The TEST.OBJ
  29459.  dependency line is only for the current directory. If we were to
  29460.  change the TEST.OBJ line to the following
  29461.  
  29462.     {\obj}test.obj: test.c test.h
  29463.  
  29464.  a change to TEST.C or TEST.H would cause \OBJ\TEST.OBJ and TEST.EXE
  29465.  to be updated.
  29466.  
  29467.  Note: NMAKE has a predefined inference rule for C.EXE that causes
  29468.  TEST.EXE to be relinked in the above example if it is out of date with
  29469.  TEST.C.
  29470.  
  29471.  
  29472.  25. /MAKE Option Is Invalid with NMAKE
  29473.  
  29474.  Product Version(s): 1.11   | 1.11
  29475.  Operating System:   MS-DOS | OS/2
  29476.  Flags: ENDUSER | docerr
  29477.  Last Modified: 25-MAY-1990    ArticleIdent: Q61619
  29478.  
  29479.  On Page 43 of the "Microsoft C Reference" manual for version 6.00,
  29480.  NMAKE is described as being upwardly compatible with the earl