Newsgroups: comp.sys.transputer
From: schedan@eskimo.com (Daniel Scheurell)
Subject: Re: Problem loading a 500K program using iserver
Organization: Eskimo North (206) For-Ever
Date: 11 May 94 04:02:56 GMT
Message-ID: <CpMDwx.Dt1@eskimo.com>

Andy Rabagliati (andyr@wizzy.com) wrote:
: In article <2qm3o4$bo@mimsy.cs.umd.edu>,
: Dr. C. Allen Sher <sher@cfar.umd.edu> wrote:
: >
: >Lately, we have had problem loading our 500K Transputer program 
: >onto the Transputer net.

: >The program has grown to exceed 500K in size,
: >with the individual lku files each having between 60K to 80K.
: >Lately, when we try to load the program by doing
: >
: >	iserver /se /sb file.btl,
: >
: >we get error messages like
: >
: >	Error - iserver - unable to write byte -24577 to the boot link
: >	because  .

: Looking in the source of an old iserver, I see that message. I notice
: that the ints being compared are plain ints - maybe you should recompile
: iserver with Length and Count as longs.

: Cheers,     Andy.

: PRIVATE VOID Boot()
: {
:    FILE *Fd;
:    BYTE Buffer[ BOOT_BUFFER_LENGTH ];
:    int Length=0, Count=0;                <<----***********************
:    INT32 Size=0;
:    static BYTE Flicks[]="|/-\\|/-\\" ;
:    int Flick=0;

:    if ( ( Fd=fopen( BootFileName, "rb" ) ) == NULL )
:       ABORT(MISC_EXIT, (SE, "cannot find boot file \"%s\"", BootFileName));
:    INFO(("Booting root transputer..."));

If I recall, BOOT_BUFFER_LENGTH was about 8K in the old server.  So the
return value from fread should not overflow a 16-bit int (MS-DOS size).

:    while ( ( Length = fread( Buffer, 1, BOOT_BUFFER_LENGTH, Fd ) ) > 0 )
:       {
:          DEBUG(("%d", Length));
:          Count = WriteLink( TheLink, Buffer, Length, BOOT_TIMEOUT );
:          Size += Count;
:          if ( Count != Length )
:          {
:             if (Count < 0)

Size is already a long (INT32), so it should be able to count up to 500K 
without overflowing.  Looks like the negative byte count is reported 
because Size is printed with %d instead of %ld.

:                ABORT(MISC_EXIT, (SE, "unable to write byte %d to the boot link because\n%s", 
:                                              Size, LinkMessages[0-Count]))
:             else
:                ABORT(MISC_EXIT, (SE, "unable to write byte %d to the boot link", Size ));

The disparity between the requested WriteLink length (Length) and the 
return value from WriteLink (Count) seems to cause the abort.  I don't 
recall seeing the LinkMessages array in the source that I've seen, but 
apparently WriteLink's negative return value is to be used to index into 
it.  And apparently there was no relevant message available.

Whenever I see this error, it's almost always because of some hardware 
mix-up on my part.  Like my NCS configuration not matching my configured 
hardware description.  Or system services incorrectly jumpered/switched 
on the motherboard.  Or a bad transputer :(

Hope this helps.

--

Dan

