Bug in file.mfm??

HxC Floppy Emulator on Amiga support
Post Reply
Music4Lynx
Posts: 5
Joined: Wed Apr 27, 2011 1:18 pm

Bug in file.mfm??

Post by Music4Lynx »

Looking at the source code of your software, I saw the code file named "amiga_track.c" and in some places are changed rather odd bits of the even bits and vice versa. Look this:

your file amiga_track.c:
/* Track and sector info */

tmp = 0xff000000 | (tra<<16) | (sec<<8) | (11 - sec);
odd = (tmp & MFM_MASK) | MFM_FILLL;
even = ((tmp>>1) & MFM_MASK) | MFM_FILLL;
*(dest + 8) = (UBY) ((even & 0xff000000)>>24);
*(dest + 9) = (UBY) ((even & 0xff0000)>>16);
*(dest + 10) = (UBY) ((even & 0xff00)>>8);
*(dest + 11) = (UBY) ((even & 0xff));
*(dest + 12) = (UBY) ((odd & 0xff000000)>>24);
*(dest + 13) = (UBY) ((odd & 0xff0000)>>16);
*(dest + 14) = (UBY) ((odd & 0xff00)>>8);
*(dest + 15) = (UBY) ((odd & 0xff));

FAQ ADF and disk.c of the WinUAE:
HEADER
08/0x08 long 1 info (odd bits)
12/0x0c long 1 info (even bits)

deven = ((secbuf[4] << 24) | (secbuf[5] << 16)
| (secbuf[6] << 8) | (secbuf[7]));
dodd = deven >> 1;
deven &= 0x55555555; dodd &= 0x55555555;
mfmbuf[4] = dodd >> 16;
mfmbuf[5] = dodd;
mfmbuf[6] = deven>> 16;
mfmbuf[7] = deven;

First Odd bits and after Even bits...

Look this too:

Your file amiga_track.c said:
for (x = 64 ; x < 576; x++)
{
tmp = *(src + x - 64);
odd = (tmp & 0x55);
even = (tmp>>1) & 0x55;
*(dest + x) = (UBY) (even | MFM_FILLB);
*(dest + x + 512) = (UBY) (odd | MFM_FILLB);
}

FAQ ADF and disk.c of the WinUAE:
DATA
64/0x40 byte 512 coded data (odd)
576/0x240 byte 512 coded data (even)
1088/0x440
END OF DATA

for (i = 0; i < 512; i += 4){
deven = ((secbuf[i+32] << 24) | (secbuf[i+33] << 16)
| (secbuf[i+34] << 8) | (secbuf[i+35]));
dodd = deven >> 1;
deven &= 0x55555555; dodd &= 0x55555555;
mfmbuf[(i>>1)+32] = dodd >> 16;
mfmbuf[(i>>1)+33] = dodd;
mfmbuf[(i>>1)+256+32] = deven >> 16;
mfmbuf[(i>>1)+256+33] = deven;
}

First Odd bits and after Even bits again...

But you write in your file first even bits and after odd bits...
¿Is a bug??

Sorry for my english and thanks you.

Jeff
Site Admin
Posts: 8093
Joined: Fri Oct 20, 2006 12:12 am
Location: Paris
Contact:

Re: Bug in file.mfm??

Post by Jeff »

Music4Lynx wrote:
First Odd bits and after Even bits again...

But you write in your file first even bits and after odd bits...
¿Is a bug??

Sorry for my english and thanks you.
No this is not a bug, but this part was recently completely remplaced.

Music4Lynx
Posts: 5
Joined: Wed Apr 27, 2011 1:18 pm

Re: Bug in file.mfm??

Post by Music4Lynx »

Ok, thanks you very much,

another (last) question:

In the generated file.mfm with your software,
header checksum (odd) and data checksum (odd) are "0xAAAAAAAA" forever in all sectors. Is a bug this?
The even bits of the header checksums is OK (header checksum (even) = 0xAAAAAAA4 for the first sector, 0xAAAAA925 for the second sector, etc...), but odd bits of the header checksum are 0 (decode value) (or AA in MFM format) forever in all sectors.

¿Is a bug??

Sorry for my english and thanks you.

Post Reply