[hatari-devel] Wotanoid problem : final fix before commit ?

Thomas Huth huth at users.berlios.de
Sun Jan 24 19:22:21 CET 2010


On Sun, 24 Jan 2010 14:27:40 +0200
Eero Tamminen <eerot at users.berlios.de> wrote:

> On Sunday 24 January 2010, George Nakos wrote:
> > Sunday, January 24, 2010, 1:42:02 PM, you wrote:
> > > On Sunday 24 January 2010, Laurent Sallafranque wrote:
> > >> >>> I've looked at the compendium.
> > >> >>> I haven't found anything about this -1 length call.
> > >> >>
> > >> >> My  memory  is  a bit hazy, but I think this just tells
> > >> >> gemdos to read $ffffffff  bytes  from the file. Of course
> > >> >> gemdos will read as much as the  file  size  and then return
> > >> >> an error in d0.l. It's the lazy man's approach  to  doing
> > >> >> things  the  Right Way(tm) (i.e. getting the file length  -or
> > >> >> knowing it beforehand- and calling fread() with the proper
> > >> >> amount of bytes)
> > >
> > > George, have you actually used this on actual HW so that it has
> > > worked? With which TOS version(s) it works like that?
> >
> > Yup,  on  a STE with TOS 1.62UK and STFM with TOS 1.02UK. Also,
> > that's we use that in ULSv3 for a couple of years now and it works
> > in all our test equipment (MSTEs, Falcons, a TT, etc)
> 
> Thanks.  Then it seems that EmuTOS is (as usual) broken and
> documentation is wrong too & Laurent's patch is fine.

This is the original fread function from the 1985 GEMDOS sources by
Digital Research:

/*
**  xread -
**      read 'len' bytes  from handle 'h'
**
**      Function 0x3F   f_read
**
**      Error returns
**              EIHNDL
**              bios()
**
**      Last modified   SCC     8 Apr 85
*/

long    xread(h,len,ubufr) 
        int h;
        long len;
        char *ubufr;
{
        OFD     *p;
        long    ixread() ;

        if (p = getofd(h))
                return(ixread(p,len,ubufr));

        return(EIHNDL);
}

/*
**  ixread -
**
**      Last modified   SCC     26 July 85
*/

long    ixread(p,len,ubufr)
        REG OFD *p;
        long len;
        char *ubufr;
{
        long maxlen;

        /*Make sure file not opened as write only.*/
        if (p->o_mod == 1)
                return (EACCDN);

        if (len > (maxlen = p->o_fileln - p->o_bytnum))
                len = maxlen;

        if (len > 0)
                return(xrw(0,p,len,ubufr,xfr2usr));

        return(0L);     /* zero bytes read for zero requested */
}


To me this looks like the size parameter is _signed_.

I can hardly believe that Atari really changed this behaviour, since
hardly anybody was thinking about files > 2 GB at that point in time.
So I suggest that you write a little test program and to run it with
all TOS versions from 1.00 to 4.04 (from floppy disk of course) to see
whether Atari really changed this behaviour.

 Thomas



More information about the hatari-devel mailing list