diff --git a/docs/NoSlotClock/DallasSmartWatchUtilityDisassembly.txt b/docs/NoSlotClock/DallasSmartWatchUtilityDisassembly.txt index 2488a9ab..02cccd89 100644 --- a/docs/NoSlotClock/DallasSmartWatchUtilityDisassembly.txt +++ b/docs/NoSlotClock/DallasSmartWatchUtilityDisassembly.txt @@ -1,7 +1,9 @@ -Dallas SmartWatch DS1216 (No-Slot-Clock) SmartWatch Utility (Version 1.1). +Dallas SmartWatch DS1216 (No-Slot-Clock) SmartWatch Utility (Version 1.1) "SWU.SYSTEM". Copyright 1987 Matthew Lee Stier. Partial disassembly and comments by Nick Westgate (and CiderPress). +Note: This code requires the clock to be in the internal C3 ROM space. (CD or CF ROM sockets.) + 2000- A2 FF LDX #$FF ;reset stack 2002- 9A TXS 2003- 20 58 22 JSR $2258 diff --git a/docs/NoSlotClock/GeosNoSlotClockDriverDisassembly.txt b/docs/NoSlotClock/GeosNoSlotClockDriverDisassembly.txt index fd03c480..bd125ed2 100644 --- a/docs/NoSlotClock/GeosNoSlotClockDriverDisassembly.txt +++ b/docs/NoSlotClock/GeosNoSlotClockDriverDisassembly.txt @@ -1,7 +1,7 @@ -Dallas SmartWatch DS1216 (No-Slot-Clock) GEOS driver. +No-Slot-Clock (Dallas SmartWatch DS1216) GEOS driver "NoSlot Clock". Partial disassembly and comments by Nick Westgate (and CiderPress). -Note: This code requires the clock to be in the internal C8 ROM space. +Note: This code requires the clock to be in the internal C8 ROM space. (CD or CF ROM sockets.) 0800- 4C 15 08 JMP $0815 ;read time 0803- 4C B8 08 JMP $08B8 diff --git a/docs/NoSlotClock/NoSlotClockDriverDisassembly.txt b/docs/NoSlotClock/NoSlotClockDriverDisassembly.txt index e0cc4f15..552334a6 100644 --- a/docs/NoSlotClock/NoSlotClockDriverDisassembly.txt +++ b/docs/NoSlotClock/NoSlotClockDriverDisassembly.txt @@ -1,7 +1,9 @@ -No-Slot-Clock (Dallas SmartWatch DS1216) ProDOS Driver. +No-Slot-Clock (Dallas SmartWatch DS1216) ProDOS Driver "NS.CLOCK.SYSTEM". Probably written by Craig Peterson in 1990. Partial disassembly and comments by Nick Westgate (and CiderPress). +Note: This code checks for the clock in internal C3, C8 and external slot ROM spaces. (CD, CF or slot ROM sockets.) + 2000- 38 SEC ;actually loads at $2000 2001- B0 03 BCS $2006 2003- 09 23 @@ -90,7 +92,7 @@ Partial disassembly and comments by Nick Westgate (and CiderPress). 10CF- 8C F8 13 STY $13F8 10D2- 8D 66 14 STA $1466 ;(STA $CFFF) 10D5- 8C 65 14 STY $1465 -10D8- A9 00 LDA #$00 ;slot (3, 1..7) +10D8- A9 00 LDA #$00 ;slot (3, 1..7, C8 internal) 10DA- 8D 9C 11 STA $119C ;count? 10DD- A9 03 LDA #$03 10DF- 09 C0 ORA #$C0 @@ -130,8 +132,7 @@ Partial disassembly and comments by Nick Westgate (and CiderPress). 112B- AD 9C 11 LDA $119C 112E- C9 08 CMP #$08 1130- 90 AD BCC $10DF -1132- D0 1D BNE $1151 ;stop after slots 3, 1..7 - +1132- D0 1D BNE $1151 ;loop for slots 3, 1..7 1134- A9 C0 LDA #$C0 ;prepare to check internal C8 ROM (where is this called from?) 1136- A0 15 LDY #$15 1138- 8D F9 13 STA $13F9 @@ -143,7 +144,7 @@ Partial disassembly and comments by Nick Westgate (and CiderPress). 1147- 8D 66 14 STA $1466 ;(STA $C006) 114A- 8C 65 14 STY $1465 114D- A9 C8 LDA #$C8 -114F- D0 93 BNE $10E4 ;set up addresses for internal C8 ROM +114F- D0 93 BNE $10E4 ;set up addresses for internal C8 ROM and test 1151- A0 03 LDY #$03 ;SmartWatch not found 1153- B9 97 11 LDA $1197,Y ;restore ProDOS date/time diff --git a/source/Memory.cpp b/source/Memory.cpp index 03a22516..fd1da43a 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -390,7 +390,7 @@ static BYTE __stdcall IOWrite_C07x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON case 0xB: return IO_Null(pc, addr, bWrite, d, nCyclesLeft); case 0xC: return IO_Null(pc, addr, bWrite, d, nCyclesLeft); // case 0xD: return IO_Null(pc, addr, bWrite, d, nCyclesLeft); - case 0xD: // No Slot Clock Hack for ProDOS + case 0xD: // Clock Hack for ProDOS (NB. Not for NoSlotClock) #if CLOCK_HACK_PRODOS Clock_Generic_UpdateProDos(); #endif @@ -469,6 +469,14 @@ BYTE __stdcall IO_Annunciator(WORD programcounter, WORD address, BYTE write, BYT return 0; } +inline bool IsPotentialNoSlotClockAccess(const WORD address) +{ + // Ref: Sather UAIIe 5-28 + const BYTE AddrHi = address >> 8; + return ( ((!SW_SLOTCXROM || !SW_SLOTC3ROM) && (AddrHi == 0xC3)) || // Internal ROM at [$C100-CFFF or $C300-C3FF] && AddrHi == $C3 + (!SW_SLOTCXROM && (AddrHi == 0xC8)) ); // Internal ROM at [$C100-CFFF] && AddrHi == $C8 +} + // Enabling expansion ROM ($C800..$CFFF]: // . Enable if: Enable1 && Enable2 // . Enable1 = I/O SELECT' (6502 accesses $Csxx) @@ -551,7 +559,7 @@ BYTE __stdcall IORead_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE v } } - if ((address >= 0xC300) && (address <= 0xC3FF)) + if (IsPotentialNoSlotClockAccess(address)) { int data = 0; if (g_NoSlotClock.Read(address, data)) @@ -585,7 +593,7 @@ BYTE __stdcall IORead_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE v BYTE __stdcall IOWrite_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE value, ULONG nCyclesLeft) { - if ((address >= 0xC300) && (address <= 0xC3FF)) + if (IsPotentialNoSlotClockAccess(address)) { g_NoSlotClock.Write(address); }