[hatari-devel] Hatari crashes with Mental Hangover demo
Thomas Huth
huth at users.berlios.de
Sun May 1 20:38:09 CEST 2011
Am Sat, 30 Apr 2011 20:29:53 +0200
schrieb Nicolas Pomarède <npomarede at corp.free.fr>:
> Le 30/04/2011 20:16, Eero Tamminen a écrit :
...
> >>> PS. While doing the patches, I noticed:
> >>> $ grep HDCSectorCount $(find . -type f)
> >>> ./hdc.h:extern short int HDCSectorCount;
> >>> ./hdc.c:short int HDCSectorCount;
> >>> ./hdc.c: fprintf(hdlogFile, "HDC sector count: 0x%x\n",
> >>> HDCSectorCount);
> >>> ./fdc.c: HDCSectorCount = 0;
> >>> ./fdc.c: DMAStatus_ff8606rd |=
> >>> (HDCSectorCount)?0x2:0; /* HDC */
> >>> ./fdc.c: DiskControllerByte = HDCSectorCount;
> >>>
> >>> What's the point in sector count that's never non-zero?
> >>
> >> What do you mean exactly ?
> >
> > From above you can see that "HDCSectorCount" can never get any
> > other value than zero (unlike e.g. FDCSectorCountRegister which
> > seems to be used for similar purpose). So what's the point in
> > having that variable?
> >
> > hdc.c code gets the HDC sector count with this macro, it doesn't use
> > the variable:
> > #define HD_SECTORCOUNT(a) (a.command[4]& 0xFF) /* get
> > sector count */
> >
> > How the fdc.c& hdc.c interact is quite ugly as fdc.c uses hdc.c
> > variables directly instead of there being HDC_* functions for this
> > stuff:
>
> Well, I can't speak for hdc.c, I never touched this part of the code.
> I guess it comes from Thomas and he certainly wanted to use the same
> logic in hdc.c than in fdc.c, which could explain some unused
> variables in the end.
hdc.c originally hasn't been written by me but by Sven de Marothy...
Dunno why this variable isn't used (anymore)? Maybe it was used in the
past, or it is not necessary since the ACSI commands are executed
immediately instead of delayed like the FDC commands?
Thomas
More information about the hatari-devel
mailing list