Path: news1.icaen!news.uiowa.edu!news1.chicago.iagnet.net!iagnet.net!ais.net!News.Toronto.iSTAR.net!News.Vancouver.iSTAR.net!news.istar.net!mars.online.uleth.ca!jeff.oliver@uleth.ca From: Patrick Duffy Newsgroups: comp.binaries.apple2 Subject: Mountain Computer Clock card ProDOS usage. Date: Sat, 18 Apr 1998 18:27:59 -0600 Organization: UPANET Lines: 348 Message-ID: <3539450F.23F3@upanet.uleth.ca> Reply-To: Patrick NNTP-Posting-Host: uts01-03.cc.uleth.ca Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1B977EBE394F" X-Mailer: Mozilla 3.01Gold (Win95; I) Xref: news1.icaen comp.binaries.apple2:10170 This is a multi-part message in MIME format. --------------1B977EBE394F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I have received a number of requests for the software I developed using an idea obtained in Edmonton, Alberta in 1988 from the Apple Computer Users Group there. I developed a number of Applesoft Basic programs that somewhat automated the setting of both the ProDOS and Mountain Computer Clock time and date nad also annually updated the patch required for ProDOS to recognize the card. Attached is the text of a supplement to the Mountain Computer Clock Users manual and the technical details as to ProDOS usage via a patch. I went beyond the patch documentation to automate in Applesoft Basic the annual patch updating process required. -- PATRICK M. DUFFY Mailto:duffyfam@upanet.uleth.ca 30 Acadia Road West, Lethbridge, Alberta, Canada T1K 3X8 Home(403-381-1981), Bindloss teacherage(403-379-2025) --------------1B977EBE394F Content-Type: text/plain; charset=us-ascii; name="mccclock.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mccclock.txt" Mountain Computer CLOCK Card ProDOS Usage Notes Installation: The installation procedure for the CLOCK card is the same as printed in the manual but here are directions that will also set it up for ProDOS at the same time. All page number references in the following directions refer to the Mountain Computer Clock manual. 1. Make a copy of the ProDOS files (if you have them) on a ProDOS bootable disk. 2. Connect both terminals of the battery clip to the Clock card Ni-Cad battery. 3. Plug the power supply into the clock board and then connect it to the household current. 4. Allow the power supply to charge the NiCad battery tor about 18 to 24 hours before proceeding with step 5. 5. Turn off all power to the computer and disconnect the Clock card power supply from the household current and Clock card. 6. Set the LEAP YEAR switch on the card appropriately (p.? of Manual) 7. Set the WRITE PROTECT switch to the W (write) position. 8. Route the external power supply through the rear panel of the computer and plug it into the card but don't plug in the household current end. 9. Plug the clock into one of slots 2, 4, 5, 6, or 7 making note of the slot number for future reference 10. Make sure the card is firmly in the slot then connect the external power supply into the household current. 11. Boot your copy of the CLOCK ProDOS software and use it to practice on. You can later modify ProDOS on your other disks or copy modified versions using regular file copy programs. 12. Select the MACHINE INFORMATION option this will verify if the CLOCK card is installed and confirm the SLOT NUMBER. 13. Select the TIME UTILITY option. Set the date and time correctly about a minute ahead of the real time. Indicate that you wish to set the CLOCK card. Press the key when asked and the real time is within a second of the time you indicated. Your clock card will be set properly IF you had the write switch on. (If you didn't set the switch properly then power off, set it, and reboot.) Ignore the year for now because it isn't set on the CLOCK card. 14. Exit to the main menu and select the option to install the Mountain Clock driver on ProDOS and use the ProDOS on this copy of the CLOCK disk for the practice. 15. Make sure you have answered the YEAR and CLOCK SLOT NUMBER questions accurately. You will need to reconfigure ProDOS using this option if you wish to use to use the CLOCK card in another slot and annually in order to update the year. 16. Reboot the copy of ProDOS just modified and it should now recognize the CLOCK card automatically (every time). You can check this with the TIME UTILITY. If the time and date are accurate then slide the WRITE PROTECT switch to the WP (Write Protect) position so tha!. the card c:annot be accidentally reset by wild sottware. That's it until: a. You change the CLOCK card slot (so reconfigure ProDOS) b. The year changes (so reconfigure ProDOS) c. Standard to Daylight time changes (reset the time) d. You unplug the external supply to the clock for more than a day or two. e. The clock needs resetting (just reset the time) All of these contingencies can be met using the ProDOS CLOCK clock programs I have developed by just making selections and answering questions. THE MANUAL If you wish to read the manual I recommend the following sections as worthy: INTRODUCTION p. i PLUGGING IN p. 1 (in case I missed the fine points) THE BATTERY p. 1,2 (just use the charger full-time) SETTING THE TIME p. 2,4 (skip the Applesoft basic program) The rest of the manual is for programmers that wish to use the CLOCK card for other purposes. It is technical and based on DOS 3.3. The sample programs on the Mountain Computer Clock card disk have been modified for ProDOS and can be supplied on a ProDOS disk. There is no support from Mountain Computer (which no longer exists to my knowledge) but the card is quite reliable. The beauty of the ProDOS patch and the supporting programs (which I developed or modified) is that they automate the use of the clock -- but keep the manual anyway (it has a pretty cover). SAMPLE PROGRAMS The sample programs referred to by the Manual are on the DOS 3.3 disk. Their corresponding ProDOS versions are as follows: ProDOS version Dos 3.3 Program Name AMPM APPLESOFT AM/PM CLOCKFACE ANALOG CLOCK FINDER CLOCKFINDER SETTIME SET THE TIME TIMER ELAPSED TIMEK Since the clock card does not keep track of the year some of the sample programs on the DOS 3.3 disk have to have the current year information updated within the program. The ProDOS versions of these programs assume that ProDOS has not been patched with a Mountain Computer Clock driver. To keep the ProDOS sample programs consistent with the manual they also have the current year information in the program. The programs that require a change to a Basic statement to set the current year are as follows: DOS 3.3 Programs ProDOS versions APPLESOFT AM/PM AMPM APPLESOFT DATE AND TIME DATETIME INTEGER AM/PM INTEGER DATE AND TIME ProDOS Software The software is essentially beggarwarie (I beg you to send me money so my wife won't complain about the time I spend on the computer). I am no longer updating it although I did a lot to improve it for my own purposes. If you wish to receive the ProDOS programs send $15 (including shipping and handling) in Canadian or U.S. funds to: Patrick Duffy SPD Enterprises 30 Acadia Road West Lethbridge, Alberta, Canada TlJ 3X8 Feel free to email me at mailto:duffyfam@upanet.uleth.ca if you have questions. I am sometimes slow to reply. Note: I have a few Mountain Computer Clock Cards still available for $25 including shipping and handling. They come complete with power supply and manual but will need a rechargable 9-volt battery. --------------1B977EBE394F Content-Type: text/plain; charset=iso-8859-1; name="MCdrvnt.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="MCdrvnt.txt" Prodos Driver for the Mountain Clock Card by Hens Schimanke originally published in the Feb/Mar 88 edition of the Birdsheet (Ver= sion 4.1) published by EAGLE (Edmonton Apple Users Group) = When Apple came out with PRODOS, they added a number of handy feature= s. One of these is the ability to date stamp files if your Apple has a co= mpatible clock. This is fine for someone with a GS or a Thunderclock. The= re are many of us out there who got a Mountain clock card because it was = very cheap, but PRODOS won't recognize it. And for those of you who still= haven't got a patch to make PRODOS use the Mountain Clock here it is. Installing this patch will modify PRODOS so that it will recognize on= ly the Mountain Card. First assemble the program or enter it from the Mon= itor. (If using the Monitor, it must be put somewhere in main memory, suc= h as $1742 and then saved to disk. Actual load address is not important).= Then from BASIC, perform the following step: BLOAD PRODOS, A$2000, TSYS.= BLOAD MTN.DRIVER,A$5100. POKE 10233,8: POKE 10235,44: POKE 10237,207: PO= KE 10239,8. UNLOCK PRODOS. BSAVE PRODOS,A$2OOO,TSYS. LOCK PRODOS. For an explanation, let's start with how PRODOS handles the Thundercl= ock. During the boot process, it checks all the slots for a clock card by= comparing bytes 0, 2, 4 and 6 on each card's ROM with the values startin= g at $27F9 in PRODOS (version 1.4). If they match, the driver is loaded a= nd modified for the correct slot, the machine id byte is updated and the = clock vector in the Global Page is pointed to the clock routine. All we d= o is change the bytes in PRODOS to match those of the Mountain Card and P= RODOS will chug merrily along. However, the process for reading the Mountain Card is quite different= from that of the Thunderclock, so the old routines won't work. What the = PRODOS driver does is set the proper mode on the clock and then call the = read routine. The clock then leaves the time in the input buffer at $200= in the form: Month, Day of the Week, Day, Hour, Minute, Second. These ar= e ASCII bytes with the high bit set, two bytes for each value and separat= ed by a comma. The driver converts these into hex values, uses the combin= ation of month, day and day of the week to work out what year it is and c= ompresses this information into the four PRODOS date bytes. In this proce= ss, it uses at least the first 18 bytes of the input buffer and zero page= locations $3A to $3E, so we can safely use them as well. The Mountain Clock works a little differently. The time is left start= ing at $280 in the input buffer, but all the digits are in reverse order.= There is no data for the day of the week. It uses zero page locations $3= 8 and $39 to call the clock. As well $2AO and $2A1 are used for temporary= storage. $280 is used by PRODOS as an auxiliary pathname buffer, so its = use by the clock would destroy some functions. We will have to save and r= estore the contents of these locations to avoid messing up PRODOS and wha= tever system program happens to be running. We also have a limited amount= of space in which to store our routine. The areas immediately to either = side of the driver ($D700 - $D741 and $D7C0 - $D7FF) are used by PRODOS f= or pathname buffers and writing over these will either confuse PRODOS or = destroy our routine. Therefore this routine will have to accomplish it's= task with minimum memory usage. This is done in the following manner. In lines 25 to 35 in the listin= g, the overwritten parts of memory are saved. $38 and $39, which are the = standard input vectors, are saved in the X and Y registers which are not = used by the clock routine. The temporary counters at $WO are saved on !he= stack. The rest is saved in the first 20 bytes of the input buffer, wher= e the Thunderclock normally leaves the time This buffer could be located anywhere in memory that is safe from PRO= DOS or the current system program. I chose to put it at $200 because the = Thunderclock uses this area and it would normally be written over anyhow.= Another possibility is $300, but that is used by many other patches so = it is also unsuitable. My preferred choice is at the end of the clock ro= utine, so that none of the input buffer is affected by a get time call. H= owever, this makes the routine one byte longer than it should be. Use of = this byte would destroy the last byte of the prefix kept by PRODOS, but o= nly if the pathname of the prefix was 63 characters long, fhe maximum all= owed. I don't ever recall having a prefix that long, so I expect it's saf= e enough. To do this, change the bytes in the program that refer to BUFF-= i from FF 01 to AC D7 or change line 87 to BUFF DS 20. Lines 36 to 38 call the clock routine. As a validity check, the clock= requires that the high byte of the clock slot ($C1 in the listing) be in= the accumulator and in $39. This value could have been set by loading th= at data into the accumulator directly. However, then a separate relocator= patch to Prodos would have to be written to change that value for differ= ent slots. The PRODOS relocator only relocates the 3 byte JSR instruction= for the clock. I got around this by getting the value directly from the = program itself, at P2+2, which has that value. Next the zero page locations are restored, because we need the X and = Y registers from here on. The next task is to convert the ASCII bytes left by the clock into he= x data we can use. This is done by lines 45 to 53. The tens digit is mult= iplied by ten in binary by first multiplying by 2 (ASL instruction) and t= hen adding that to tens multiplied by 8 (3 ASL instructionsj. Then that i= s added to the ones digit and a fudge factor is used to get the hex value= =2E It should be noted that this is a "quick and dirty" routine. Under or= dinary circumstances, the high nibble should be masked off (e.g. the digi= t is stored as $B1, of which only the 1 is significant) and the carry sho= uld be set or cleared as necessary with each addition or subtraction. Sin= ce space is at a premium, and we have a limited range of anticipated valu= es to deal with, all these conventions can be dispensed with and lumped t= ogether in the "fudge factor". This routine does work for all expected va= lues. The results of this operation are saved on the stack for later retr= ieval. By line 58 all the data we require is on the stack in four hex byt= es. At this point it is worthwhile to explain how PRODOS stores the time.= The minute and hour are stored at $BF92 and $BF93 as normal hex bytes. T= he three items of year, month and day are compressed into two bytes. The = maximum value for the year is 100, which requires 7 bits. The month has a= maximum value of 12 which will fit into 4 bytes, and the day will fit in= to 5 bits which totals 16, or two bytes. The year occupies the top 7 bits= of $BF91 and the day of the month is in the bottom five bits of $BF90. T= he lower 3 bits of the month is in the top of $BF90 and the remaining bit= is the lowest bit of $BF91. In short, the bits look like this, starting = at $BF90: MMMDDDDD YYYYYYYM OOmmmmmm OOhhhhhh. Now the routine must arrange the data in the same way. Minute and hou= r are just stored in the proper places. The day is pulled off the stack a= nd saved in a temporary counter in line 64. The month is then shifted ove= r and the bottom 3 bits are added to the day byte by the ORA instruction = in line 71. This is stored in its proper place. At this point, the high b= it of the month is still in carry flag where it was left by the shifts. T= his is then rotated into the year byte and stored. Since the Mountain car= d has no way of storing any other data, such as year or day of the week, = the software must supply it. In this case the date byte in line 73 must b= e updated yearly. This can be done from BASIC by a Poke 20820,YEAR. Finally, the data from the input buffer that was saved is now put bac= k, in lines 77 to 85 and that accomplishes our task. It should be noted t= hat in line 42, Y was set to a value of 32, which is not the offset from = the beginning of the time buffer. This was done so that when the A8CII to= hex loop had run 4 times, the value left in Y would be 20, which is requ= ired to the next loop. This avoids reloading Y and saves two bytes. That's all there is to it. With only one annual update, this patch sh= ould keep all your files date stamped. --------------1B977EBE394F Content-Type: text/plain; charset=us-ascii; name="MCdrvlst.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="MCdrvlst.txt" 1 **************************************** 2 * 3 * Mountain Clock Driver 4 * for PRODOS 5 * 6 * by Hans Schimanke 7 * 8 *************************************** 9 * 0038 10 KSWL EQU $38 ;Keyboard Input Vector 0039 11 KSWH EQU $39 003A 12 A1L EQU $3A ;Temporary Storage 0280 13 TIME EQU $0280 ;Mountain Time buffer BF90 14 MTHDAY EQU $BF90 ;Prodos Month $ Day BF91 15 YEAR EQU $BF91 ;Prodos Year BF92 16 MINUTE EQU $BF92 ;Prodos Minute BF93 17 HOUR EQU $BF93 ;Prodos Hour C100 18 RDCLOCX EQU $C100 ;Call Clock Routine 19 * 20 * This file is loaded into PRODOS 1.4 at $5100 21 * Modify: $27F9:$08 $27FB:$2C $27FD:$CF $27FF:$08 22 * D742:D742 23 ORG $D742 D742: 24 * D742:A0 14 25 START LDY #20 ;Save part of input D744:B9 80 02 26 STORE LDA TIME,Y ;buffer for Prodos D747:99 FF 01 27 STA BUFF-1,Y D74A:88 28 DEY D74B:DO F7 0744 29 BNE STORE D74D:AD AO 02 30 LDA $2A0 D750:48 31 PHA D751:AD Al 02 32 LDA $2A1 D754:48 33 PHA D755:A4 38 34 LDY KSWL ;Save input vector D7571A6 39 35 LDX KSWH ;X and Y saved by clock D759:AD 60 D7 36 LDA P2+2 ;get high byte of clock D75C:85 39 37 BTA KSWH ;set up to call clock D75E:20 00 C1 38 P2 JSR RDCLOCX ;read clock D761:86 39 39 STX KSWH ;restore input vectors D763:84 38 40 STY KSWL D765: 41 * D765:A0 20 42 LDY #32 ;Y indexes into buffer D767:A2 04 43 LDX #4 ;get 4 bytes of time D769:88 44 ASC2HEX DEY D76A:B9 74 02 45 LDA TIME+$l3-31,Y ;get tens digit D76D:0A 46 ASL ;2x, ignore bits 4-7 D76E:85 3A 47 STA A1L ;save that temporarily D770:0A 48 ASL ;mpy by 8 D771:0A 49 ASL D772:65 3A 50 ADC A1L ;add to get 10x D774:88 51 DEY ;next byte D775:79 74 02 52 ADC TIME+$13-31,Y ;add ones D778:E9 91 53 SBC #$91 ;fudge factor D77A:88 54 DEY ;next byte D77B:48 55 PHA ;save on stack D77C:CA 56 DEX D77D:DO EA D769 57 BNE ASC2HEX ;NOTE: this address will need adjustment D77F: 58 * D77F:68 59 FLA ;get minute D780:8D 92 BF 60 STA MINUTE ;give it to Prodos D783:68 61 PLA D784:8D 93 BF 62 STA HOUR ;hour too D787:68 63 PLA ;get day D788:85 3A 64 STA A1L ;save temp D78A:68 65 PLA ;get month D78B:0A 66 ASL ;shift over for Prodos D78C:0A 67 A8L D78D:0A 68 ASL D78E:0A 69 ASL D78F:0A 70 ASL D790:05 3A 71 ORA A1L ;add to day D792:8D 90 BF 72 BTA MTHDAY ;give to Prodos D795:A9 58 73 LDA #88 ;make up a year - last two digits D797:2A 74 ROL ;add carry from month D798:8D 91 BF 75 STA YEAR ;save that D79B: 76 * D79B:68 77 FLA ;restore input buffer D79C:8D Al 02 78 STA $2A1 D79F:68 79 PLA D7A0:8D AO 02 80 STA $2A0 D7A3:B9 FF 01 81 RESTORE LDA BUFF-l,Y ;Y= 20 from last loop D7A6:99 80 02 82 STA TIME,Y ;restore buffer D7A9:88 83 DEY D7AA:DO F7 D7A3 84 BWE RESTORE ;NOTE: this address will need adjustment D7AC:6O 85 RTS ;And finished! D7AD: 86 * D7AD: 0200 87 BUFF EQU $200 ;save input buller --------------1B977EBE394F--