Allow for easier use of files - Just define what you know.

HD == hard drive - min file name req.
* Defaults to SCSI ID 0, LUN 0, 512 block size.
HD1 == SCSI ID 1, LUN 0, 512
HD11 == SCSI ID 1, LUN 1, 512
HD11_1024 == SCSI ID 1, LUN 1, 1024
HD System 7.0.1 Apps.dsk == ID 0, LUN 0, 512
* suffix no longer required
This commit is contained in:
Eric Helgeson 2021-06-09 19:28:12 -05:00
parent e427532f98
commit f0ca2fba80

View File

@ -427,17 +427,35 @@ void setup()
file.close(); file.close();
String file_name = String(name); String file_name = String(name);
file_name.toLowerCase(); file_name.toLowerCase();
if(file_name.startsWith("hd") && file_name.endsWith(".hda")) { if(file_name.startsWith("hd")) {
int id = name[HDIMG_ID_POS] - '0'; // Defaults for Hard Disks
int lun = name[HDIMG_LUN_POS] - '0'; int id = 0;
int blk = name[HDIMG_BLK_POS] - '0'; int lun = 0;
if(blk == 2) { int blk = 512;
blk = 256;
} else if(blk == 1) { // Positionally read in and coerase the chars to integers.
blk = 1024; // We only require the minimum and read in the next if provided.
} else { int file_name_length = file_name.length();
blk = 512; if(file_name_length > 2) // HD[N]
id = name[HDIMG_ID_POS] - '0' || 0;
if(file_name_length > 3) // HD0[N]
lun = name[HDIMG_LUN_POS] - '0' || 0;
int blk1, blk2, blk3, blk4 = 0;
if(file_name_length > 8) { // HD00_[111]
blk1 = name[HDIMG_BLK_POS] - '0';
blk2 = name[HDIMG_BLK_POS+1] - '0';
blk3 = name[HDIMG_BLK_POS+2] - '0';
if(file_name_length > 9) // HD00_NNN[1]
blk4 = name[HDIMG_BLK_POS+3] - '0';
} }
if(blk1 == 2 && blk2 == 5 && blk3 == 6) {
blk = 256;
} else if(blk1 == 1 && blk2 == 0 && blk3 == 2 && blk4 == 4) {
blk = 1024;
} else if(blk1 == 2 && blk2 == 0 && blk3 == 4 && blk4 == 8) {
blk = 2048;
}
if(id < NUM_SCSIID && lun < NUM_SCSILUN) { if(id < NUM_SCSIID && lun < NUM_SCSILUN) {
HDDIMG *h = &img[id][lun]; HDDIMG *h = &img[id][lun];
imageReady = hddimageOpen(h,name,id,lun,blk); imageReady = hddimageOpen(h,name,id,lun,blk);