diff --git a/Ample/Media.h b/Ample/Media.h index 9e09240..4a73fba 100644 --- a/Ample/Media.h +++ b/Ample/Media.h @@ -14,6 +14,7 @@ typedef struct Media { unsigned cass; unsigned cdrom; unsigned hard; + unsigned floppy_8; unsigned floppy_5_25; unsigned floppy_3_5; unsigned pseudo_disk; @@ -22,13 +23,14 @@ typedef struct Media { unsigned midiout; unsigned picture; unsigned rom; - uint64_t floppy_mask; + //uint64_t floppy_mask; } Media; typedef enum { MediaTypeError = -1, MediaTypeUnknown = 0, + MediaType_8, MediaType_5_25, MediaType_3_5, MediaType_HardDisk, diff --git a/Ample/Media.m b/Ample/Media.m index 0d86d7e..f6ce4d9 100644 --- a/Ample/Media.m +++ b/Ample/Media.m @@ -21,6 +21,7 @@ struct Media MediaFromDictionary(NSDictionary *dict) { _(hard); _(floppy_3_5); _(floppy_5_25); + _(floppy_8); _(pseudo_disk); _(bitbanger); _(midiin); @@ -38,8 +39,8 @@ void MediaAdd(Media *dest, const Media *src) { // could merge from src media but not currently set there. - unsigned count; - unsigned flops = dest->floppy_5_25 + dest->floppy_3_5; + //unsigned count; + //unsigned flops = dest->floppy_8 + dest->floppy_5_25 + dest->floppy_3_5; #define _(name) dest->name += src->name; @@ -48,6 +49,7 @@ void MediaAdd(Media *dest, const Media *src) { _(hard); _(floppy_3_5); _(floppy_5_25); + _(floppy_8); _(pseudo_disk); _(bitbanger); _(midiin); @@ -56,14 +58,15 @@ void MediaAdd(Media *dest, const Media *src) { _(rom); #undef _ - +#if 0 + // TODO - FLOPPY_8 if ((count = src->floppy_5_25)) { uint64_t bits = (1 << count) - 1; //dest->floppy_mask <<= count; bits <<= flops; dest->floppy_mask |= bits; } - +#endif } @@ -78,6 +81,7 @@ BOOL MediaEqual(const Media *lhs, const Media *rhs) { _(hard); _(floppy_3_5); _(floppy_5_25); + _(floppy_8); _(pseudo_disk); _(bitbanger); _(midiin); @@ -85,7 +89,7 @@ BOOL MediaEqual(const Media *lhs, const Media *rhs) { _(picture); _(rom); - _(floppy_mask); + //_(floppy_mask); return YES; #undef _ diff --git a/Ample/MediaViewController.m b/Ample/MediaViewController.m index 9fba415..0522490 100644 --- a/Ample/MediaViewController.m +++ b/Ample/MediaViewController.m @@ -321,6 +321,7 @@ if (first) return; first++; + _data[kIndexFloppy8] = [MediaCategory categoryWithTitle: @"8\" Floppies"]; _data[kIndexFloppy525] = [MediaCategory categoryWithTitle: @"5.25\" Floppies"]; _data[kIndexFloppy35] = [MediaCategory categoryWithTitle: @"3.5\" Floppies"]; _data[kIndexHardDrive] = [MediaCategory categoryWithTitle: @"Hard Drives"]; @@ -347,7 +348,7 @@ -(void)rebuildArgs { static char* prefix[] = { - "flop", "flop", "hard", "cdrm", "cass", "disk", "bitb", "min", "mout", "pic", "rom", + "flop", "flop", "flop", "hard", "cdrm", "cass", "disk", "bitb", "min", "mout", "pic", "rom", }; static_assert(SIZEOF(prefix) == CATEGORY_COUNT, "Missing item"); NSMutableArray *args = [NSMutableArray new]; @@ -356,16 +357,34 @@ for (unsigned j = 0; j < CATEGORY_COUNT; ++j) { - uint64_t floppy_mask = _media.floppy_mask; + //uint64_t floppy_mask = _media.floppy_mask; unsigned index = 0; MediaCategory *cat = _data[j]; NSInteger valid = [cat validCount]; + + // assumes floppy order is 8", 5.25", 3.5". + switch(j) { + case kIndexFloppy8: + index = 0; + break; + case kIndexFloppy525: + index = _media.floppy_8; + break; + case kIndexFloppy35: + index = _media.floppy_8 + _media.floppy_5_25; + break; + } + for (NSInteger i = 0; i < valid; ++i) { MediaItem *item = [cat objectAtIndex: i]; NSString *arg = [item argument]; + ++index; + if (!arg) continue; +#if 0 + // TODO -- FLOPPY_8 support. if (j == kIndexFloppy525) { // assumes < 64 floppies.... @@ -385,7 +404,7 @@ ++index; floppy_mask >>= 1; if (!arg) continue; - +#endif [args addObject: [NSString stringWithFormat: @"-%s%u", prefix[j], index]]; [args addObject: arg]; } @@ -439,6 +458,7 @@ x = media.name; cat = _data[index]; delta |= [cat setItemCount: x] _(hard, kIndexHardDrive); _(floppy_3_5, kIndexFloppy35); _(floppy_5_25, kIndexFloppy525); + _(floppy_8, kIndexFloppy8); _(pseudo_disk, kIndexDiskImage); _(bitbanger, kIndexBitBanger); _(midiin, kIndexMidiIn); @@ -758,6 +778,7 @@ static NSString *kDragType = @"private.ample.media"; switch(tag) { + case kIndexFloppy8: case kIndexFloppy525: case kIndexFloppy35: case kIndexHardDrive: @@ -825,6 +846,7 @@ static NSString *kDragType = @"private.ample.media"; switch(mt) { case MediaType_3_5: ix = kIndexFloppy35; break; case MediaType_5_25: ix = kIndexFloppy525; break; + case MediaType_8: ix = kIndexFloppy8; break; case MediaType_Cassette: ix = kIndexCassette; break; case MediaType_HardDisk: ix = kIndexHardDrive; break; case MediaType_CDROM: ix = kIndexCDROM; break; @@ -868,7 +890,7 @@ static NSString *kDragType = @"private.ample.media"; } static NSString * BookmarkStrings[] = { - @"flop_525", @"flop_35", @"hard", @"cdrm", @"cass", @"disk", @"bitb", @"midiin", @"midiout", @"pic", @"rom", + @"flop_8", @"flop_525", @"flop_35", @"hard", @"cdrm", @"cass", @"disk", @"bitb", @"midiin", @"midiout", @"pic", @"rom", }; static_assert(SIZEOF(BookmarkStrings) == CATEGORY_COUNT, "Missing item"); diff --git a/Ample/Slot.m b/Ample/Slot.m index 5edf8d5..171ac90 100644 --- a/Ample/Slot.m +++ b/Ample/Slot.m @@ -479,6 +479,7 @@ https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyVa _(hard); _(floppy_3_5); _(floppy_5_25); + _(floppy_8); _(pseudo_disk); _(bitbanger); _(midiin); diff --git a/Ample/TableCellView.h b/Ample/TableCellView.h index 787fc3d..b6bd675 100644 --- a/Ample/TableCellView.h +++ b/Ample/TableCellView.h @@ -12,7 +12,8 @@ enum { - kIndexFloppy525 = 0, + kIndexFloppy8 = 0, + kIndexFloppy525, kIndexFloppy35, kIndexHardDrive, kIndexCDROM, @@ -27,7 +28,7 @@ enum { kIndexLast }; -#define CATEGORY_COUNT 11 +#define CATEGORY_COUNT 12 static_assert(kIndexLast == CATEGORY_COUNT, "Invalid Category Count");