| 636 | } |
| 637 | |
| 638 | void Win32Frame::GetTrackSector(UINT slot, int& drive1Track, int& drive2Track, int& activeFloppy) |
| 639 | { |
| 640 | // DOS3.3 ProDOS |
| 641 | // Slot $B7E9 $BE3C(DEFSLT=Default Slot) ; ref: Beneath Apple ProDOS 8-3. Not ProDOS v1.9 (16-JUL-90) |
| 642 | // Drive $B7EA $BE3D(DEFDRV=Default Drive) ; ref: Beneath Apple ProDOS 8-3 |
| 643 | // Track $B7EC LC1 $D356 |
| 644 | // Sector $B7ED LC1 $D357 |
| 645 | // Unit - LC1 $D359 ; ref: Beneath Apple ProDOS 1.20 and 1.30 Supplement, p83 |
| 646 | // RWTS LC1 $D300 |
| 647 | |
| 648 | drive1Track = drive2Track = activeFloppy = 0; |
| 649 | if (GetCardMgr().QuerySlot(slot) != CT_Disk2) |
| 650 | return; |
| 651 | |
| 652 | Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot)); |
| 653 | activeFloppy = disk2Card.GetCurrentDrive(); |
| 654 | drive1Track = disk2Card.GetTrack(DRIVE_1); |
| 655 | drive2Track = disk2Card.GetTrack(DRIVE_2); |
| 656 | |
| 657 | // Probe known OS's for default Slot/Track/Sector |
| 658 | const bool isProDOS = ReadByteFromMemory(0xBF00) == 0x4C; |
| 659 | bool isSectorValid = false; |
| 660 | int drive1Sector = -1, drive2Sector = -1; |
| 661 | |
| 662 | // Try DOS3.3 Sector |
| 663 | if (!isProDOS) |
| 664 | { |
| 665 | const int nDOS33slot = ReadByteFromMemory(0xB7E9) / 16; |
| 666 | const int nDOS33track = ReadByteFromMemory(0xB7EC); |
| 667 | const int nDOS33sector = ReadByteFromMemory(0xB7ED); |
| 668 | |
| 669 | if ((nDOS33slot == slot) |
| 670 | && (nDOS33track >= 0 && nDOS33track < 40) |
| 671 | && (nDOS33sector >= 0 && nDOS33sector < 16)) |
| 672 | { |
| 673 | #if _DEBUG && 0 |
| 674 | if (nDOS33track != nDisk1Track) |
| 675 | { |
| 676 | LogOutput("\n\n\nWARNING: DOS33Track: %d (%02X) != nDisk1Track: %d (%02X)\n\n\n", nDOS33track, nDOS33track, nDisk1Track, nDisk1Track); |
| 677 | } |
| 678 | #endif // _DEBUG |
| 679 | |
| 680 | /**/ if (activeFloppy == 0) drive1Sector = nDOS33sector; |
| 681 | else if (activeFloppy == 1) drive2Sector = nDOS33sector; |
| 682 | |
| 683 | isSectorValid = true; |
| 684 | } |
| 685 | } |
| 686 | else // isProDOS |
| 687 | { |
| 688 | // we can't just read from mem[ 0xD357 ] since it might be bank-switched from ROM |
| 689 | // and we need the Language Card RAM |
| 690 | const int nProDOStrack = *MemGetMainPtrWithLC(0xC356); // LC1 $D356 |
| 691 | const int nProDOSsector = *MemGetMainPtrWithLC(0xC357); // LC1 $D357 |
| 692 | const int nProDOSslot = *MemGetMainPtrWithLC(0xC359) / 16; // LC1 $D359 |
| 693 | |
| 694 | if ((nProDOSslot == slot) |
| 695 | && (nProDOStrack >= 0 && nProDOStrack < 40) |
nothing calls this directly
no test coverage detected