mirror of
https://github.com/ksherlock/ample.git
synced 2024-06-10 00:29:55 +00:00
8" floppy support (PDP 11, etc)
This commit is contained in:
parent
bff5617e3c
commit
3f05793466
|
@ -14,6 +14,7 @@ typedef struct Media {
|
||||||
unsigned cass;
|
unsigned cass;
|
||||||
unsigned cdrom;
|
unsigned cdrom;
|
||||||
unsigned hard;
|
unsigned hard;
|
||||||
|
unsigned floppy_8;
|
||||||
unsigned floppy_5_25;
|
unsigned floppy_5_25;
|
||||||
unsigned floppy_3_5;
|
unsigned floppy_3_5;
|
||||||
unsigned pseudo_disk;
|
unsigned pseudo_disk;
|
||||||
|
@ -22,13 +23,14 @@ typedef struct Media {
|
||||||
unsigned midiout;
|
unsigned midiout;
|
||||||
unsigned picture;
|
unsigned picture;
|
||||||
unsigned rom;
|
unsigned rom;
|
||||||
uint64_t floppy_mask;
|
//uint64_t floppy_mask;
|
||||||
} Media;
|
} Media;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MediaTypeError = -1,
|
MediaTypeError = -1,
|
||||||
MediaTypeUnknown = 0,
|
MediaTypeUnknown = 0,
|
||||||
|
MediaType_8,
|
||||||
MediaType_5_25,
|
MediaType_5_25,
|
||||||
MediaType_3_5,
|
MediaType_3_5,
|
||||||
MediaType_HardDisk,
|
MediaType_HardDisk,
|
||||||
|
|
|
@ -21,6 +21,7 @@ struct Media MediaFromDictionary(NSDictionary *dict) {
|
||||||
_(hard);
|
_(hard);
|
||||||
_(floppy_3_5);
|
_(floppy_3_5);
|
||||||
_(floppy_5_25);
|
_(floppy_5_25);
|
||||||
|
_(floppy_8);
|
||||||
_(pseudo_disk);
|
_(pseudo_disk);
|
||||||
_(bitbanger);
|
_(bitbanger);
|
||||||
_(midiin);
|
_(midiin);
|
||||||
|
@ -38,8 +39,8 @@ void MediaAdd(Media *dest, const Media *src) {
|
||||||
|
|
||||||
// could merge from src media but not currently set there.
|
// could merge from src media but not currently set there.
|
||||||
|
|
||||||
unsigned count;
|
//unsigned count;
|
||||||
unsigned flops = dest->floppy_5_25 + dest->floppy_3_5;
|
//unsigned flops = dest->floppy_8 + dest->floppy_5_25 + dest->floppy_3_5;
|
||||||
|
|
||||||
|
|
||||||
#define _(name) dest->name += src->name;
|
#define _(name) dest->name += src->name;
|
||||||
|
@ -48,6 +49,7 @@ void MediaAdd(Media *dest, const Media *src) {
|
||||||
_(hard);
|
_(hard);
|
||||||
_(floppy_3_5);
|
_(floppy_3_5);
|
||||||
_(floppy_5_25);
|
_(floppy_5_25);
|
||||||
|
_(floppy_8);
|
||||||
_(pseudo_disk);
|
_(pseudo_disk);
|
||||||
_(bitbanger);
|
_(bitbanger);
|
||||||
_(midiin);
|
_(midiin);
|
||||||
|
@ -56,14 +58,15 @@ void MediaAdd(Media *dest, const Media *src) {
|
||||||
_(rom);
|
_(rom);
|
||||||
#undef _
|
#undef _
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// TODO - FLOPPY_8
|
||||||
if ((count = src->floppy_5_25)) {
|
if ((count = src->floppy_5_25)) {
|
||||||
uint64_t bits = (1 << count) - 1;
|
uint64_t bits = (1 << count) - 1;
|
||||||
//dest->floppy_mask <<= count;
|
//dest->floppy_mask <<= count;
|
||||||
bits <<= flops;
|
bits <<= flops;
|
||||||
dest->floppy_mask |= bits;
|
dest->floppy_mask |= bits;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +81,7 @@ BOOL MediaEqual(const Media *lhs, const Media *rhs) {
|
||||||
_(hard);
|
_(hard);
|
||||||
_(floppy_3_5);
|
_(floppy_3_5);
|
||||||
_(floppy_5_25);
|
_(floppy_5_25);
|
||||||
|
_(floppy_8);
|
||||||
_(pseudo_disk);
|
_(pseudo_disk);
|
||||||
_(bitbanger);
|
_(bitbanger);
|
||||||
_(midiin);
|
_(midiin);
|
||||||
|
@ -85,7 +89,7 @@ BOOL MediaEqual(const Media *lhs, const Media *rhs) {
|
||||||
_(picture);
|
_(picture);
|
||||||
_(rom);
|
_(rom);
|
||||||
|
|
||||||
_(floppy_mask);
|
//_(floppy_mask);
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
#undef _
|
#undef _
|
||||||
|
|
|
@ -321,6 +321,7 @@
|
||||||
if (first) return;
|
if (first) return;
|
||||||
first++;
|
first++;
|
||||||
|
|
||||||
|
_data[kIndexFloppy8] = [MediaCategory categoryWithTitle: @"8\" Floppies"];
|
||||||
_data[kIndexFloppy525] = [MediaCategory categoryWithTitle: @"5.25\" Floppies"];
|
_data[kIndexFloppy525] = [MediaCategory categoryWithTitle: @"5.25\" Floppies"];
|
||||||
_data[kIndexFloppy35] = [MediaCategory categoryWithTitle: @"3.5\" Floppies"];
|
_data[kIndexFloppy35] = [MediaCategory categoryWithTitle: @"3.5\" Floppies"];
|
||||||
_data[kIndexHardDrive] = [MediaCategory categoryWithTitle: @"Hard Drives"];
|
_data[kIndexHardDrive] = [MediaCategory categoryWithTitle: @"Hard Drives"];
|
||||||
|
@ -347,7 +348,7 @@
|
||||||
-(void)rebuildArgs {
|
-(void)rebuildArgs {
|
||||||
|
|
||||||
static char* prefix[] = {
|
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");
|
static_assert(SIZEOF(prefix) == CATEGORY_COUNT, "Missing item");
|
||||||
NSMutableArray *args = [NSMutableArray new];
|
NSMutableArray *args = [NSMutableArray new];
|
||||||
|
@ -356,16 +357,34 @@
|
||||||
|
|
||||||
for (unsigned j = 0; j < CATEGORY_COUNT; ++j) {
|
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;
|
unsigned index = 0;
|
||||||
|
|
||||||
MediaCategory *cat = _data[j];
|
MediaCategory *cat = _data[j];
|
||||||
NSInteger valid = [cat validCount];
|
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) {
|
for (NSInteger i = 0; i < valid; ++i) {
|
||||||
|
|
||||||
MediaItem *item = [cat objectAtIndex: i];
|
MediaItem *item = [cat objectAtIndex: i];
|
||||||
NSString *arg = [item argument];
|
NSString *arg = [item argument];
|
||||||
|
|
||||||
|
++index;
|
||||||
|
if (!arg) continue;
|
||||||
|
#if 0
|
||||||
|
// TODO -- FLOPPY_8 support.
|
||||||
|
|
||||||
if (j == kIndexFloppy525) {
|
if (j == kIndexFloppy525) {
|
||||||
// assumes < 64 floppies....
|
// assumes < 64 floppies....
|
||||||
|
@ -385,7 +404,7 @@
|
||||||
++index;
|
++index;
|
||||||
floppy_mask >>= 1;
|
floppy_mask >>= 1;
|
||||||
if (!arg) continue;
|
if (!arg) continue;
|
||||||
|
#endif
|
||||||
[args addObject: [NSString stringWithFormat: @"-%s%u", prefix[j], index]];
|
[args addObject: [NSString stringWithFormat: @"-%s%u", prefix[j], index]];
|
||||||
[args addObject: arg];
|
[args addObject: arg];
|
||||||
}
|
}
|
||||||
|
@ -439,6 +458,7 @@ x = media.name; cat = _data[index]; delta |= [cat setItemCount: x]
|
||||||
_(hard, kIndexHardDrive);
|
_(hard, kIndexHardDrive);
|
||||||
_(floppy_3_5, kIndexFloppy35);
|
_(floppy_3_5, kIndexFloppy35);
|
||||||
_(floppy_5_25, kIndexFloppy525);
|
_(floppy_5_25, kIndexFloppy525);
|
||||||
|
_(floppy_8, kIndexFloppy8);
|
||||||
_(pseudo_disk, kIndexDiskImage);
|
_(pseudo_disk, kIndexDiskImage);
|
||||||
_(bitbanger, kIndexBitBanger);
|
_(bitbanger, kIndexBitBanger);
|
||||||
_(midiin, kIndexMidiIn);
|
_(midiin, kIndexMidiIn);
|
||||||
|
@ -758,6 +778,7 @@ static NSString *kDragType = @"private.ample.media";
|
||||||
|
|
||||||
switch(tag) {
|
switch(tag) {
|
||||||
|
|
||||||
|
case kIndexFloppy8:
|
||||||
case kIndexFloppy525:
|
case kIndexFloppy525:
|
||||||
case kIndexFloppy35:
|
case kIndexFloppy35:
|
||||||
case kIndexHardDrive:
|
case kIndexHardDrive:
|
||||||
|
@ -825,6 +846,7 @@ static NSString *kDragType = @"private.ample.media";
|
||||||
switch(mt) {
|
switch(mt) {
|
||||||
case MediaType_3_5: ix = kIndexFloppy35; break;
|
case MediaType_3_5: ix = kIndexFloppy35; break;
|
||||||
case MediaType_5_25: ix = kIndexFloppy525; break;
|
case MediaType_5_25: ix = kIndexFloppy525; break;
|
||||||
|
case MediaType_8: ix = kIndexFloppy8; break;
|
||||||
case MediaType_Cassette: ix = kIndexCassette; break;
|
case MediaType_Cassette: ix = kIndexCassette; break;
|
||||||
case MediaType_HardDisk: ix = kIndexHardDrive; break;
|
case MediaType_HardDisk: ix = kIndexHardDrive; break;
|
||||||
case MediaType_CDROM: ix = kIndexCDROM; break;
|
case MediaType_CDROM: ix = kIndexCDROM; break;
|
||||||
|
@ -868,7 +890,7 @@ static NSString *kDragType = @"private.ample.media";
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSString * BookmarkStrings[] = {
|
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");
|
static_assert(SIZEOF(BookmarkStrings) == CATEGORY_COUNT, "Missing item");
|
||||||
|
|
||||||
|
|
|
@ -479,6 +479,7 @@ https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/KeyVa
|
||||||
_(hard);
|
_(hard);
|
||||||
_(floppy_3_5);
|
_(floppy_3_5);
|
||||||
_(floppy_5_25);
|
_(floppy_5_25);
|
||||||
|
_(floppy_8);
|
||||||
_(pseudo_disk);
|
_(pseudo_disk);
|
||||||
_(bitbanger);
|
_(bitbanger);
|
||||||
_(midiin);
|
_(midiin);
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kIndexFloppy525 = 0,
|
kIndexFloppy8 = 0,
|
||||||
|
kIndexFloppy525,
|
||||||
kIndexFloppy35,
|
kIndexFloppy35,
|
||||||
kIndexHardDrive,
|
kIndexHardDrive,
|
||||||
kIndexCDROM,
|
kIndexCDROM,
|
||||||
|
@ -27,7 +28,7 @@ enum {
|
||||||
|
|
||||||
kIndexLast
|
kIndexLast
|
||||||
};
|
};
|
||||||
#define CATEGORY_COUNT 11
|
#define CATEGORY_COUNT 12
|
||||||
static_assert(kIndexLast == CATEGORY_COUNT, "Invalid Category Count");
|
static_assert(kIndexLast == CATEGORY_COUNT, "Invalid Category Count");
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user