Article 153252 of comp.sys.apple2: Newsgroups: comp.sys.apple2 Subject: Re: No Slot Clock - Damaged? From: dempson@actrix.gen.nz (David Empson) Date: Tue, 12 Oct 1999 13:24:55 +1300 Message-ID: <1dzkcv3.ni5xsh1sbj7t6N%dempson@actrix.gen.nz> References: <19991009021849.10841.00000061@ng-fg1.aol.com> <19991010232021.01045.00000604@ng-bk1.aol.com> <1dzjfw1.1ii1gku1m81d3dN%dempson@actrix.gen.nz> <1mrM3.2847$Ck.6996@news1.mia> Organization: Empsoft User-Agent: MacSOUP/2.4.2 NNTP-Posting-Host: 202.49.157.176 X-Original-NNTP-Posting-Host: 202.49.157.176 X-Trace: 12 Oct 1999 13:22:47 NZST, 202.49.157.176 Lines: 107 Path: news1.icaen!news.uiowa.edu!news.physics.uiowa.edu!hammer.uoregon.edu!newsfeed.direct.ca!usenet.net.nz!news.iprolink.co.nz!news.actrix.gen.nz!dempson Xref: news1.icaen comp.sys.apple2:153252 Gus Vilomar wrote: > I thought the battery was dead on the chip but it actually had corrupted > data. David sent me some code he wrote in a few minutes that actually > resets the clock on the chip. It worked perfectly!! I'll list the code > below but if anybody needs the "bin" file, let me know and I'll be happy to > email it to them. > > thanks, > Gus > > FROM DAVID EMPSON: > > CALL-151 > 300:A2 00 78 2C 04 E0 BD 30 03 A0 08 4A B0 08 2C 00 > 310:E0 88 D0 F7 F0 06 2C 01 E0 88 D0 EF E8 E0 10 90 > 320:E5 58 60 > 330:C5 3A A3 5C C5 3A A3 5C 00 00 00 00 16 01 10 99 > 300G > BSAVE FIXWATCH,A$300,L$40 > > As you are on a IIc+, I'd strongly suggest disabling the accelerator > before trying this. > > (I'm assuming the SmartWatch is installed under the CF ROM on the > motherboard. I don't think it can go anywhere else.) I'm glad to hear that I was able to help Gus. Note that for this to work in a IIe, the SmartWatch must be under the EF ROM, not the CD ROM. (The program would have to be patched to refer to D000, D001 and D004 if the SmartWatch is under the CD ROM.) In case anyone is interested, here is a source listing of the program (which may need a little tidying up to actually work, e.g. by removing the spaces in the HEX line). This is for the Merlin assembler. * SmartWatch I/O lines are as follows: * A2 = read/-write * A0 = data to SmartWatch * D0 = data from SmartWatch * The following locations trigger the desired one-bit access, * assuming the SmartWatch is under the chip addressed when * accessing the range E000-E00F. * Read E000: write a zero * Read E001: write a one * Read E004: read (data returned in bit 0) ORG $300 LDX #0 SEI BIT E004 BYTELOOP: LDA DATA,X LDY #8 BITLOOP: LSR BCS WRITE1 BIT E000 DEY BNE BITLOOP BEQ NEXTBYTE WRITE1: BIT E001 DEY BNE BITLOOP NEXTBYTE: INX CPX #16 BCC BYTELOOP CLI RTS ORG $330 DATA: HEX C5 3A A3 5C C5 3A A3 5C HEX 00 00 00 00 16 01 10 99 A final point: this program can easily be modified to set the SmartWatch to an arbitrary date and time. The last eight bytes are the time written to the chip, which are in BCD (binary coded decimal). The registers are in the following order: Tenths and hundredths of seconds Seconds Minutes Hours (leave the top three bits clear for 24-hour mode) Day of week (1 = Sunday, 7 = Saturday, make sure the high digit is 1) Day of month Month Year (2 digits) Note that the day of week values are a convention only. The No Slot Clock driver might assign a different day of the week as 1. The OSC and RST bits are in the day register. Using a value of 1 in the high order digit of the day register ensures that OSC is 0 (enabled) and RST is 1 (disabled). The SmartWatch also supports 12-hour mode, with an AM/PM indicator in the hour register, but that wouldn't be compatible with the No Slot Clock driver. -- David Empson dempson@actrix.gen.nz Snail mail: P O Box 27-103, Wellington, New Zealand