Skip to content

Commit ddeb9c7

Browse files
kollokolloMarkus Hoffmann
authored andcommitted
Improved the detection and readout of HD-Floppies
1 parent fd236c6 commit ddeb9c7

File tree

1 file changed

+33
-34
lines changed

1 file changed

+33
-34
lines changed

FloppyDriveController.sketch/FloppyDriveController.sketch.ino

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ void measureTrackData() {
669669

670670
register unsigned char counter;
671671
long totalBits=0;
672-
long target = ((long)RAW_TRACKDATA_LENGTH)*(long)8;
672+
long target = ((long)RAW_TRACKDATA_LENGTH/4)*(long)8;
673673

674674
while (totalBits<target) {
675675
for (register unsigned char bits=0; bits<4; bits++) {
@@ -705,41 +705,40 @@ void measureTrackData() {
705705

706706
/* Now output the result: */
707707
char a[8];
708-
*i2a(t1,a,16)=0;
709-
writeByteToUART(a[0]);
710-
writeByteToUART(a[2]);
711-
writeByteToUART(a[3]);
712-
writeByteToUART(a[4]);
713-
writeByteToUART(10);
714-
*i2a(t2,a,16)=0;
715-
writeByteToUART(a[0]);
716-
writeByteToUART(a[2]);
717-
writeByteToUART(a[3]);
718-
writeByteToUART(a[4]);
719-
writeByteToUART(10);
720-
*i2a(t3,a,16)=0;
721-
writeByteToUART(a[0]);
722-
writeByteToUART(a[2]);
723-
writeByteToUART(a[3]);
724-
writeByteToUART(a[4]);
708+
byte i;
709+
i=0;
725710
writeByteToUART(10);
726-
*i2a(t4,a,16)=0;
727-
writeByteToUART(a[0]);
728-
writeByteToUART(a[2]);
729-
writeByteToUART(a[3]);
730-
writeByteToUART(a[4]);
711+
*i2a(t1,a,10)=0;
712+
while(a[i]) writeByteToUART(a[i++]);
713+
writeByteToUART('-');
714+
*i2a(t2,a,10)=0;
715+
i=0;
716+
while(a[i]) writeByteToUART(a[i++]);
717+
writeByteToUART('-');
718+
*i2a(t3,a,10)=0;
719+
i=0;
720+
while(a[i]) writeByteToUART(a[i++]);
731721
writeByteToUART(10);
732-
*i2a(t5,a,16)=0;
733-
writeByteToUART(a[0]);
734-
writeByteToUART(a[2]);
735-
writeByteToUART(a[3]);
736-
writeByteToUART(a[4]);
722+
*i2a(t4,a,10)=0;
723+
i=0;
724+
while(a[i]) writeByteToUART(a[i++]);
725+
writeByteToUART('-');
726+
*i2a(t5,a,10)=0;
727+
i=0;
728+
while(a[i]) writeByteToUART(a[i++]);
729+
writeByteToUART('-');
730+
*i2a(t6,a,10)=0;
731+
i=0;
732+
while(a[i]) writeByteToUART(a[i++]);
737733
writeByteToUART(10);
738-
*i2a(t6,a,16)=0;
739-
writeByteToUART(a[0]);
740-
writeByteToUART(a[2]);
741-
writeByteToUART(a[3]);
742-
writeByteToUART(a[4]);
734+
if(t5<100 && t6<100) {
735+
writeByteToUART('H');
736+
disktypeHD=1;
737+
} else {
738+
writeByteToUART('D');
739+
disktypeHD=0;
740+
}
741+
writeByteToUART('D');
743742
writeByteToUART(10);
744743
}
745744

@@ -759,7 +758,7 @@ void loop() {
759758
writeByteToUART('V'); // Followed
760759
writeByteToUART('1'); // By
761760
writeByteToUART('.'); // Version
762-
writeByteToUART('4'); // Number
761+
writeByteToUART('5'); // Number
763762
break;
764763

765764
// Command "." means go back to track 0

0 commit comments

Comments
 (0)