Added Prodos detection for .dsk images, fixes to 80STORE switch.

This commit is contained in:
Shamus Hammons 2013-09-29 15:57:45 -05:00
parent 3a8c0287e8
commit 6b21449d90
3 changed files with 55 additions and 31 deletions

View File

@ -21,10 +21,12 @@ autoSaveState = 1
#floppyImage1 = ./disks/temp.nib
#floppyImage1 = ./disks/temp.dsk
# Yes
#floppyImage1 = ./disks/sneakers.do
# Yes
#floppyImage1 = ./disks/Gumball (Mr. Krac-Man and The Disk Jockey crack).dsk
# Yes
floppyImage1 = ./disks/prince_of_persia_boot.dsk
floppyImage2 = ./disks/prince_of_persia_a.dsk
#floppyImage1 = ./disks/prince_of_persia_boot.dsk
#floppyImage2 = ./disks/prince_of_persia_a.dsk
#floppyImage1 = ./disks/prince_of_persia_b.dsk
# Yes
#floppyImage1 = ./disks/Oregon Trail (Disk 1 of 2).dsk
@ -33,7 +35,7 @@ floppyImage2 = ./disks/prince_of_persia_a.dsk
#floppyImage1 = ./disks/bt1_boot.dsk
# Yes
#floppyImage1 = ./disks/bt2_boot.dsk
# Yes (no)
# Yes
#floppyImage1 = ./disks/bt3_boot_fixed.dsk
#floppyImage2 = ./disks/bt3_character_fixed.dsk
# Yes
@ -73,9 +75,13 @@ floppyImage2 = ./disks/prince_of_persia_a.dsk
#floppyImage1 = ./disks/ultima_ii-1.dsk
#floppyImage2 = ./disks/ultima_ii-2.dsk
# Yes, autoloads!
#floppyImage1 = ./disks/u2prog-patched.dsk
#floppyImage1 = ./disks/u2prog.dsk
#floppyImage2 = ./disks/u2master-jlh.dsk
#floppyImage2 = ./disks/u2player-jlh.dsk
# Yes
floppyImage1 = ./disks/Ultima_II_-_Program_Disk.dsk
floppyImage2 = ./disks/Ultima_II_-_Player_Disk-jlh.dsk
# Yes
#floppyImage1 = ./disks/TheHeist.dsk
# Yes
#floppyImage1 = ./disks/ult31snd.dsk

View File

@ -237,31 +237,41 @@ void FloppyDrive::DetectImageType(const char * filename, uint8_t driveNum)
WriteLog("FLOPPY: Found extension [%s]...\n", ext);
//Apparently .dsk can house either DOS order OR PRODOS order... !!! FIX !!!
//[DONE, see below why we don't need it]
if (strcasecmp(ext, ".po") == 0)
diskType[driveNum] = DT_PRODOS;
else if ((strcasecmp(ext, ".do") == 0) || (strcasecmp(ext, ".dsk") == 0))
{
// We assume this, but check for a PRODOS fingerprint. Trust, but
// verify. ;-)
diskType[driveNum] = DT_DOS33;
//WriteLog("Detected DOS 3.3 disk!\n");
/*
This doesn't seem to be accurate... Maybe it's just a ProDOS disk in a DOS33 order...
That would seem to be the case--just because it's a ProDOS disk doesn't mean anything
WRT to the disk image itself.
// This could really be a ProDOS order disk with a .dsk extension, so let's see...
char fingerprint[3][4] = {
{ 0x04, 0x00, 0x00, 0x00 }, // @ $500
{ 0x03, 0x00, 0x05, 0x00 }, // @ $700
{ 0x02, 0x00, 0x04, 0x00 } }; // @ $900
if ((strcmp((char *)(disk[driveNum] + 0x500), fingerprint[0]) == 0)
&& (strcmp((char *)(disk[driveNum] + 0x700), fingerprint[1]) == 0)
&& (strcmp((char *)(disk[driveNum] + 0x900), fingerprint[2]) == 0))
uint8_t fingerprint[4][4] = {
{ 0x00, 0x00, 0x03, 0x00 }, // @ $400
{ 0x02, 0x00, 0x04, 0x00 }, // @ $600
{ 0x03, 0x00, 0x05, 0x00 }, // @ $800
{ 0x04, 0x00, 0x00, 0x00 } // @ $A00
};
bool foundProdos = true;
for(uint32_t i=0; i<4; i++)
{
for(uint32_t j=0; j<4; j++)
{
if (disk[driveNum][0x400 + (i * 0x200) + j] != fingerprint[i][j])
{
foundProdos = false;
break;
}
}
}
if (foundProdos)
diskType[driveNum] = DT_PRODOS;
//*/
}
// Actually, it just might matter WRT to nybblyzing/denybblyzing
// (and, it does... :-P)
NybblizeImage(driveNum);
}
else if (diskSize[driveNum] == 143488)

View File

@ -347,15 +347,15 @@ WriteLog("Setting 80STORE to %s...\n", (store80Mode ? "ON" : "off"));
{
mainMemoryTextR = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryTextW = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
// mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
// mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
}
else
{
mainMemoryTextR = (ramwrt ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryTextW = (ramwrt ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryHGRR = (ramwrt ? &ram2[0x2000] : &ram[0x2000]);
mainMemoryHGRW = (ramwrt ? &ram2[0x2000] : &ram[0x2000]);
// mainMemoryHGRR = (ramwrt ? &ram2[0x2000] : &ram[0x2000]);
// mainMemoryHGRW = (ramwrt ? &ram2[0x2000] : &ram[0x2000]);
}
}
@ -364,12 +364,12 @@ void SwitchRAMRD(uint16_t address, uint8_t)
{
ramrd = (bool)(address & 0x01);
mainMemoryR = (ramrd ? &ram2[0x0200] : &ram[0x0200]);
mainMemoryHGRR = (ramrd ? &ram2[0x2000] : &ram[0x2000]);
if (store80Mode)
return;
mainMemoryTextR = (ramrd ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryHGRR = (ramrd ? &ram2[0x2000] : &ram[0x2000]);
}
@ -377,18 +377,18 @@ void SwitchRAMWRT(uint16_t address, uint8_t)
{
ramwrt = (bool)(address & 0x01);
mainMemoryW = (ramwrt ? &ram2[0x0200] : &ram[0x0200]);
mainMemoryHGRW = (ramwrt ? &ram2[0x2000] : &ram[0x2000]);
if (store80Mode)
return;
mainMemoryTextW = (ramwrt ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryHGRW = (ramwrt ? &ram2[0x2000] : &ram[0x2000]);
}
void SwitchSLOTCXROM(uint16_t address, uint8_t)
{
WriteLog("Setting SLOTCXROM to %s...\n", ((address & 0x01) ^ 0x01 ? "ON" : "off"));
//WriteLog("Setting SLOTCXROM to %s...\n", ((address & 0x01) ^ 0x01 ? "ON" : "off"));
// This is the only soft switch that breaks the usual convention.
slotCXROM = !((bool)(address & 0x01));
// slot3Memory = (slotCXROM ? &rom[0] : &rom[0xC300]);
@ -408,7 +408,7 @@ void SwitchALTZP(uint16_t address, uint8_t)
void SwitchSLOTC3ROM(uint16_t address, uint8_t)
{
//dumpDis = true;
WriteLog("Setting SLOTC3ROM to %s...\n", (address & 0x01 ? "ON" : "off"));
//WriteLog("Setting SLOTC3ROM to %s...\n", (address & 0x01 ? "ON" : "off"));
slotC3ROM = (bool)(address & 0x01);
// slotC3ROM = false;
// Seems the h/w forces this with an 80 column card in slot 3...
@ -642,6 +642,7 @@ WriteLog("SwitchLC: Read/write bank 2\n");
uint8_t SwitchTEXTR(uint16_t address)
{
WriteLog("Setting TEXT to %s...\n", (address & 0x01 ? "ON" : "off"));
textMode = (bool)(address & 0x01);
return 0;
}
@ -649,12 +650,14 @@ uint8_t SwitchTEXTR(uint16_t address)
void SwitchTEXTW(uint16_t address, uint8_t)
{
WriteLog("Setting TEXT to %s...\n", (address & 0x01 ? "ON" : "off"));
textMode = (bool)(address & 0x01);
}
uint8_t SwitchMIXEDR(uint16_t address)
{
WriteLog("Setting MIXED to %s...\n", (address & 0x01 ? "ON" : "off"));
mixedMode = (bool)(address & 0x01);
return 0;
}
@ -662,20 +665,22 @@ uint8_t SwitchMIXEDR(uint16_t address)
void SwitchMIXEDW(uint16_t address, uint8_t)
{
WriteLog("Setting MIXED to %s...\n", (address & 0x01 ? "ON" : "off"));
mixedMode = (bool)(address & 0x01);
}
uint8_t SwitchPAGE2R(uint16_t address)
{
WriteLog("Setting PAGE2 to %s...\n", (address & 0x01 ? "ON" : "off"));
displayPage2 = (bool)(address & 0x01);
if (store80Mode)
{
mainMemoryTextR = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryTextW = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
// mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
// mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
}
return 0;
@ -684,20 +689,22 @@ uint8_t SwitchPAGE2R(uint16_t address)
void SwitchPAGE2W(uint16_t address, uint8_t)
{
WriteLog("Setting PAGE2 to %s...\n", (address & 0x01 ? "ON" : "off"));
displayPage2 = (bool)(address & 0x01);
if (store80Mode)
{
mainMemoryTextR = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryTextW = (displayPage2 ? &ram2[0x0400] : &ram[0x0400]);
mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
// mainMemoryHGRR = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
// mainMemoryHGRW = (displayPage2 ? &ram2[0x2000] : &ram[0x2000]);
}
}
uint8_t SwitchHIRESR(uint16_t address)
{
WriteLog("Setting HIRES to %s...\n", (address & 0x01 ? "ON" : "off"));
hiRes = (bool)(address & 0x01);
return 0;
}
@ -705,6 +712,7 @@ uint8_t SwitchHIRESR(uint16_t address)
void SwitchHIRESW(uint16_t address, uint8_t)
{
WriteLog("Setting HIRES to %s...\n", (address & 0x01 ? "ON" : "off"));
hiRes = (bool)(address & 0x01);
}