help: bug in MSDOS kermit for PC

R.D.Eager rde at ukc.UUCP
Wed Nov 7 21:12:18 AEST 1984


    The  IBM  PC  version of Kermit can be assembled with Microsoft MASM
with no trouble.  However, later versions of MASM  (I  have  1.25)  make
more  stringent checks on the source, and fault the use of LEA on a code
label.  Version 1.00 (and presumably the IBM assembler) let it  through.
In fact the correct code is generated so you can ignore the error.

    A  more  sanitary solution to the assembly-time errors is to replace
the LEAs with what they  should  have  been  to  start  with. Since  the
references  are  not  modified  or  indexed,  just  the  OFFSET  will be
correct. So:

   Replace  LEA reg,xxx        by       MOV reg,OFFSET xxx

I have done this and it all checks out OK.

    Now, the DIR/COMMAND bug.  Although the  documentation  doesn't  say
so, it is critical in which order the segments are linked (segments, not
files). The  DEC  Rainbow  Kermit-MS  has  a  dummy file which should be
linked first to do the job; I wrote a  similar  one  from  memory  which
works fine.  Here it is:

          name   msxdmb
          datas  segment public 'datas'
          datas  ends
          code   segment public
          code   ends
          stack  segment para stack 'stack'
          stack  ends
          ends

I  haven't  tried the Rainbow one since it was on a distant (non-Kermit)
machine at the time, although I am pretty sure that the important  thing
is  to have the stack segment last.  To use this, simply assemble it and
give it to LINK as the first object module; this will force  ordering of
later modules into the correct sequence.

    The  explanation  is  that  Kermit  determines how much memory it is
using so that the excess can be returned to DOS before the EXEC call  (I
am  not  sure if this is necessary; different documents give conflicting
stories). The memory determination is done by subtracting the address of
the Program Segment Prefix from that of the end  of  the  stack. If  the
stack  isn't  the last segment, DOS loads COMMAND.COM right over Kermit,
trashing the code, the data areas and  even  the  parameters  passed  to
COMMAND.COM!

    It  may  be  that  Kermit  was developed with a linker (IBM's?) that
orders segments differently.  Anyway, there it is. It works for me.

     Bob Eager    (University of Kent, UK)
     (...!mcvax!ukc!rde)



More information about the Comp.sources.bugs mailing list