Home

TimeMaster II H.O Manual v1.2

image

Contents

1. 050 JMP INT INTERRUPT CALL 768 060 JMP RESET COUNT CALL 771 070 JMP SAVE COUNT CALL 774 080 JMP STOP INTERRUPT CALL 777 090 100 MSCNT SAFE B54 780 783 MSB FIRST 10 20 SLOT 16 BS SNO ZERO IF NOT FOUND 130 140 INIT INTERRUPT 150 SEI DISABLE 160 FIND TIMEMASTER TI SLOT 70 LDY C7 START WITH SLOT 7 180 1 STY GET ROM BYTE 2 190 LDX SFE LOOK FOR B2 AT SCNFE 200 JSR GET ROM BYTE 210 582 220 2 230 5 240 JSR GET ROM BYTE 250 CMP 08 PHP SCNOO 260 BNE 2 NOT THIS SLOT 270 JSR GET ROM BYTE 280 CMP 78 SEI AT SCNO1 290 3 THIS SLOT 300 2 DEY NEXT SLOT DOWN 310 455 1 320 BCS 1 330 RTS 340 STUFF SLOT NO VALUE 350 3 TYA SCN 360 ASL 370 ASL 380 ASL 1390 ASL 1400 STA SLOT 16 SNO 1410 BEQ RETURN NO TIMEMASTER II FOUND 1420 TAX 1430 LOAD INTERRUPT VECTOR 1440 LDA IRQ HANDLE 1450 STA S3FE 460 LDA I RQ HANDLER 1470 STA S3FF 1480 SET UP INTERRUPTIONS 1490 LDA 0 POINT AT DIRECTION REGS 500 STA 5 081 510 STA 5 083 520 STA C080 X PORT A ALL INPUT 530 LDA 540 STA C082 X PORT B ALL OUTPUT 1550 LDA 05 SELECT INTERVAL CRA 560 STA 5 081 570 LDA 4 404 CRB 580 STA 5 083 590 LDA 52 ENABLE INT
2. 100 SLOT 4 clock slot 110 D CHRS 4 HOME D control D 120 PRINT DS7IN SLOT set input to clock 130 PRINT DS PR SLOT set output to clock 140 INPUT get the tim 150 PRINT D IN 0 restore keyboard in 160 PRINT DS PR 0 restore keyboard out 170 VTAB 12 HTAB 10 center the display 180 PRINT 5 print the time 190 IF PEEK 16384 128 THEN 120 key pressed 200 POKE 16368 0 reset key test If you want to rearrange the time date to a different format you can use the MIDS function to pick any part out of the formatted string The following examples show how to access various portions of the TIMEMASTER and APPLECLOCK formats please see your APPLESOFT TUTORIAL if you are unfamiliar with string manipulation It s really quite easy TRY IT TIMEMASTER format MO DD YY HH MI SS WKS LEFTS AS 1 day of week 0 6 MOS MIDS AS 3 2 month 01 12 DAS MIDS AS 6 2 day of month 01 31 YRS MIDS AS 9 2 year 00 99 MIDS AS 12 2 hour 00 23 MIS MIDS AS 15 2 minute 007 597 SES RIGHTS AS 2 second 00 59 APPLECLOCK format MO DD HH MI SS WYY WKS 16 1 0 6 MOS LEFTS AS 2 mon
3. 1040 1050 READ TIME 1060 LDA C4 FILLEDIN BY CALLER IF 070 STA SLOT1 080 STA SLOT2 090 STA SLOT3 00 STA SLOT4 TEOL 1110 LDA SC4FF TIMEMASTERII WITH 5W3 5W4 1120 SLOT1 EQ BYTE 130 CMP 503 140 BNE OLD MODES NOT TIMEMASTER II MODE 150 LDA 4 SELECT TIME MASTER MODE 160 JSR SC4OB MODE SELECTION 70 SLOT2 SCN BYTE 80 JSR SC408 READ TIME TO 200 90 SLOT3 200 1210 220 OLD MODE 230 LDA 38 KSWL PUT CURRENT 240 PHA INPUT HOOK 250 LDA 39 KSWH THE STACK 260 PHA 1270 280 LDA 4 C4 SCN N SLOT CLOCK IS IN 290 SLOT4 EQ 1 300 STA 39 KSWH 310 LDX 0 320 STX 38 KSWL 1330 19 032 20 18 FD 1340 1 JSR SFD18 MONITOR KEY INPUT ROUTINE 032 9D 00 02 1350 STA 200 x SAVE CHARACTER FROM CLOCK 0332 8 1360 INX 0 3 3 3 69 8D 1370 58 END OF INPUT 0335 DO F5 1370 BNE 1 13 90 0337 68 1400 PLA RESTORE INPUT HOOK 0338 85 39 1410 STA 39 KSWH 033A 68 1420 PLA 033 85 38 1430 STA 38 KSWL 0330 60 1440 RTS The above subroutine is on your TIMEMASTER disk source code is in S ML ALL MODES in the format for the 5 Macro Assembler The object code is in B ML ALL MODES
4. Q3CF 0C 2330 INTERVAL CRB DA 4 4 5 12 2340 0300 CALL 768 0399 INTERRUPT ENABL 0303 CALL 771 0349 INTERRUPT INIT 0306 CALL 774 038E INTERRUPT READ 0309 CALL 777 0120391 030C CALL 780 0383 INTERREJPT ZERO 030F CALL 783 0120388 0311 CALL 785 ED INTERVAL 03C6 COUNT 03CA INTERVAL CRA EC COUNT SAVE 03CC INTERVAL CRB 0311 FIND SLOT O3AD IRQ I IANDLER 0120313 0220335 032033C SC MODE 03A8 GET ROM BYTE SB SLOT 039B INTSRRUPT CLSAR 03B0 SLOT16 01 03139 02 03 1 26 CONTROLLING INTERRUPTS WITHOUT MACHINE LANGUAGI GI 3 In order to illustrate how to program interrupts using Applesoft without separate machine language files the following program was written by Bill Goodwill Bill s program sets up the clock to interrupt once per second Three tiny machine language programs are POKEd into memory at 300 a routine which the IRQ interrupt and at CALL 782 a program to enable the IRQ interrupt At each interrupt the program at 300 stores a non zero value at TAD so that the Applesoft program will know interrupt occurred Bill s Applesoft program is in a tight loop waiting for a non ero value line 2400 For grins period is printed every trip through this loop When PEEK 77 is finally non zero Bi
5. 1 Make a backup copy of your H O disk before installing the clock or doing anything else has many options These options sometimes confuse computer novice The ONLY way we could have made the H O easier to use would be to have limited its performance Some of the programs on the disk were written for just of the modes the TIMEMASTER II H O is really 8 clocks in one so be sure you are in the right mode for the sample program you are experimenting with Your new clock uses the latest in CMOS and NMOS large scale integration 51 technology to bring to you unique peripheral which retains the day date and time even when your Apple computer is turned off The on board ROM allows the highest degree of programming simplicity as well as a very high degree of compatibility with existing software The TIMEMASTER was designed to meet or exceed all of Apple s high quality standards
6. When we RUN this program using the commands shown we get the following results RUN COMMAND AQ turns on the light COMMAND AR turns the light off COMMAND turns on the radio COMMAND BR turns off the radio COMMAND turns light on then dims it COMMAND ASSSSSSSSSSSS brightens the light COMMAND AR turns off the light COMMAND turns on the light and radio COMMAND ARBR turns them both off And now what you ve all been waiting for a program that will send commands to your REMOTE MODULES at specific times using the clock function of the This program will dim brighten a light connected to REMOTE MODULE 1 every 30 seconds 10 TEXT HOME just good programing 20 SLOT 4 or any slot 30 PRINT 4 SLOT set input to clock 40 PRINT 4 PR4 SLOT set output to clock 50 ENBUT 95 AS get time from clock 60 PRINT CHRS 4 1 0 restore keyboard 70 PRINT CHRS 4 PR 0 restore output 80 SECS RIGHTS AS 2 throw away all but sec 90 VTAB 4 PRINT SEC SECS display seconds 100 PRINT CHRS 4 PR4 SLOT get ready to send code 110 IF SECS 00 THEN PRINT A RT dim if sec 00 120 IF 5 5 15 THEN PRINT A RS brighten if sec 15 130 IF SECS 30 THEN PRINT A RT dim if sec 30 140 IF SECS 45 THEN PRINT A RS brighten if sec 45 150 PRINT CHRS 4 PR 0 restore keyboard 160
7. You will find that the command console has 22 command buttons Sixteen for setting devices 1 through 16 and 6 function buttons Your BSR interface can simulate the pushing of all 22 command buttons Remote modules can be purchased in two types an appliance module which simply turns things on and off and can handle heavy loads The second type is a lighting module which comes in several styles a plug in lamp type wall mount single pole and 3 way style that fit neatly where your old light switch was Please read the owners manual that comes with the BSR command console and remote modules before using the Timemaster H O BSR interface it is also a good idea to experiment a little bit with the command console and a few remote modules To connect the BSR interface to your slip the interface connector over th lower 4 pin plug taking care that the two wires going into the connector go over the lowest two pins of this connector Please refer to the drawing below 11 The transducer itself should be placed near nough to the controller to operate This can be as far away as 6 or 8 feet if the transducer is aimed directly at the pickup inside the controller box After installing the H O with the BSR interface attached you can type in the program below to test the positioning of the transducer Whe
8. 3 COUNT X COUNT SAFE X DECREMENT X Pail 25 1960 INTERRUPT ENABLE 0399 58 1970 CLI ALLOW INTERRUPTS AGAI 039A 60 1980 RTS 1990 2000 INTERREJPT CLEAR 039 78 2010 SEI DISABLE INTERRUPTS 039C AE BO 03 2020 LDX SLOT16 039F A9 04 2030 LDA 04 03 1 9D 81 CO 2040 STA 5 081 03 4 9D 83 CO 2050 STA C083 X 03 7 60 2060 RTS 2070 2080 GET ROM BYTE 03A8 BD 00 C7 2090 LDA C700 x E8 2100 INX 60 2110 RTS 2120 2130 IRQ HANDLER O3AD 8A 2140 TXA SAVE X REG 48 2150 O3AF A2 BO 2160 LDX SLOT16 SNO 03 0 2170 SLOT16 1 03B1 BD 80 CO 2180 LDA C080 X CLEAR INTERRUPT O3B4 BD 82 CO 2190 LDA C082 X O3B7 A2 03 2200 LDX 43 O3B9 FE C6 03 2210 1 INC COUNT X O3BC DO 03 2220 BNE 2 2230 10 F8 2240 1 03C1 68 2250 lt 2 PLA RESTORE X AND A REGS 03C2 AA 2260 TAX 03C3 AS 45 2270 LDA 45 GET SAVED A REG 03C5 40 2280 RTI RETURN 2290 03 6 2300 COUNT 5 4 2310 05 2320 INTERVAL CRA DA 5 12
9. Your new TIMEMASTER 0 18 fourth generation of clock cards designed by Applied Engineering Our first clock card was designed in 1980 It was called th Tim II Our second clock card was the Timemaster and it had many improvements over the old Time II the Timemaster we added PRODOS compatibility With the Timemaster II H O we ve added BSR control and other features and yet maintained software compatibility with both the older Timemaster and Timemaster We consider the TIMEMASTER just for short to represent the zenith in computer clock technology TE has received rave reviews from both professional programmers beginning programmers as well the average computer user Again welcome to the world of real time IN YOUR APPLI GI INSTALLING O 1 1 TURN OFF THE APPLE S POWER SWITCH This is very important to prevent damaging the Apple as well as your H O 2 Remove the cover from the Apple 3 Plug your into any slot except 0 The Apple e has no slot 0 Slot 4 is the preferred slot because some commercial software expects a clock to be in slot 4 but any slot is fine Insert the fingers of the circuit board into the slot you have chosen fingers will
10. nj fact that all clock cards f manual with way technical and other hand Skim over the information four skill if you re if you possess beginning sections and move right for levels just beginning programming rel m O programming The skill through 4 heading you smarter about Skill is in Please do not be may think Or of applications different kinds them will for H O for enjoy use owning of peopl in it oyed designing it and constructing literally thousands Each level hav Bo at comput ated sections computer section is indicated parentheses are beyond you computers th just intimidated by reading skill EG the because than you think Timemaster cha pricd to computing ting Skills righ your and e buy Apple of categori skill In 2 th this you can avoid t of the manual you into th each level fall with of will t On one more the can quickly into the necessary of e numbers 1 section S nces are course you re of commerciall required to us y prepared automatically today is begins in the However this these four ski and nearly all easier order 11 is not serious H O be
11. CALL 780 Enable interrupts Enables interrupts with the CLI instruction without changing the clock card setup CALL 783 Disable interrupts Disables interrupts with the SEI instruction without de selecting clock card interrupts Interrupts may later be r nabled with CALL 780 CLOCK UTILITIES SOURCE CODE 4 1010 SAVE S CLOCK UTILITIES 1020 1030 OR 300 1040 TF B CLOCK UTILITIES EB 1050 1060 SLOT EQ SEB PEEK 235 1070 MODE EQ SEC 236 ED 1080 INTERVAL EQ SED POKE 237 O MS 1 SEC 2 M1N 3 HR 1090 COUNT SAFE EQ SEC SEF 239 00 110 o 1120 0300 4C 49 03 1130 CALL 768 JMP INTERRUPT INIT 0303 4C 9B 03 1140 CALL 771 JMP INTERRUPT CLEAR 0306 4 83 03 1150 CALL 774 JMP INTERRUPT ZERO 0309 4 8E 03 1160 CALL 777 JMP INTERROPT READ 030c 4C 99 03 1170 CALL 780 JMP INTERRUPT ENABLE 030F 78 1180 CALL 783 SEI DISABLE 0310 60 1190 RTS 0311 1200 CALL 785 EQ FIND
12. You ll find many All machine Macro with the software reviewers that the S C assembler is the best regret that remind our or no sour at low cost we cannot provide customers that competit ce code at all from 5 Softwar The source code for oth tive clock cards Macro assembler number 2 5 t phon 4 324 2050 er assemblers come with little may be purchased and we agree We We Welcome to the world of real time Your Applied Engineering TIMEMASTER will greatly expand the use of your Apple computer by adding the dimension of real time and date in intervals of 1 millisecond to 99 years Applications of the H O are limited only to the imagination Anywhere you need to know the time or date you can use the Applications include time date stamping of reports checks letters file updates calculating time intervals and recording measurements data logging As you read this manual you will soon learn why the TIMEMASTER series is the favorite among professional programmers del
13. 178 THEN SLOT 1050 1060 IF SLOT 0 THEN RETURN 1070 PEEK ADDP 255 1080 PRINT SLOT SLOT AP The values of AP can be interpreted easily AP MODE AP MODE 1 APPLECLOCK 3 IIMEMASTER READING THE TIME WITH MILLISECONDS 2 Before we begin our discussion of millisecond time we remind the user not to go through the extra steps required for millisecond accuracy if the events being measured or program lengths will not allow you to realize this accuracy in a true sense To quote an old and wise lab technician Don t measure it with a micrometer mark it with chalk then cut it with an ax But if it s milliseconds you want a few additional commands will enable milliseconds the If you want to know the time to the nearest millisecond please read on however most people are really trying to measure th lapsed time in milliseconds between two events If this is what you re trying to do pleas 5 th program on the Timemaster II disk called Millisecond Timer Any use of the H O involving milliseconds requires th us of interrupts DOS 3 3 has inconsistency in that it sometimes cause interrupt software to crash This particular bug has been discussed several Apple magazines Applied Engineering has written program called PAT
14. PRODOS look up table goes from 1981 to 1987 After 1987 i will restart again with 1981 Even though your H O will show th correct year of 1988 PRO DOS will not read the year from the H O Apple Computer is expected to directly support the H O in future releases of PRODOS Until then you will have to live with the same limitations that the buyers of other clock cards will be stuck with forever 1 step backwards to be compatible with Apple s new PRODOS t e 17 For those program The easiest way to read the is to call on the built in firmware the same way a The technique to use depends does EADI NG TI M EMAST ER H keep reading O IN 6502 of you that wish to use the H O Lt hus is not you you have chosen MACHI NE CODE 4 machine language EUEN t BAS he page quickly from a machine language program C program upon the switch selected mode If you have NOT chosen the TIMEMASTER mode switch 2 open then you can use the following short subroutine There four elementary steps involved 1 save the current input hook 538 539 2 set input hook to 300
15. An Applesoft BASIC program which loads B ML ALL MODES and CALLS it is called ML ALL MODES READING THE CLOCK WITHOUT USING THE ON BOARD FIRMWARE 3 Sometimes you may want to read the without using the programs in the on board ROM This is not too difficult and the job can be broken down into the following tasks e Initialize the PIA chip 2 Hold the clock Address a digit 4 Read the digit Repeat steps 3 4 until all relevant digits have been read 6 Release the clock and allow interrupts The following Applesoft program shows how it can be done The intended to be second intervals program is on your H O disk The program is instructive nature as Applesoft does not quite run fast enough to update the time precise on 10 DIM 30 20 HOME INPUT SLOT SLOT IF SLOT lt 1 OR SLOT gt 7 THEN PRINT CHRS 7 GOTO 20 40 GOSUB 2300 REM READ FORMAT DATA 50 GOSUB 2000 REM INITIALIZE PIA 60 GOSUB 2100 REM READ CLOCK 70 VTAB 10 HTAB 10 PRINT T 80 IF PEEK 16384 128 THEN 60 90 POKE 16368 0 END 2000 REM SETUP PIA 2010 49280 SLOT 16 REM 080 SNO 2020 1 PB PA 2 CB 3 2030 lt gt 0 2060 REM AL
16. BITS POKE A 2 255 REM PORT B OUTPUT 8 BITS REM THE NEXT 2 POKES DETERMINE INTERRUPT RATE REM THIS BASIC PROGRAM IS TOO SLOW FOR 1024 HZ INTERRUPTS POKE A 1 12 REM CONTROL REGISTER A 1 PER SECOND POKE A 3 4 REM CONTROL REGISTER B POKE A 2 47 REM TELL PTA TO PASS INTERRUPTS X PEEK A REM CLEAR FLAGS 779 REM BASIC FLAG ADDRESS 2 0 REM FLAG VALUE WHEN CLEAR CALL 782 REM ENABLE INTERRUPTS 3 REM NUMBER OF INTERRUPTS PER CYCLE ONERR GOTO 2380 GOTO 2460 REM TWIT CALL 780 STOP REM DISABLE INTERRUPTS BEFORE HALTING IF PEEK F Z THEN PRINT GOTO 2400 REM WAIT FOR TNT PRINT REM DO THE FOLLOWING ON EVERY INTERRUPT POKE 2 REM RESTORE FLAG AFTER INTERRUPT 1 IF C T THEN 2400 REM TNCR CTR COMPARE TO MAX REM PERFORM THIS OPERATION WHENEVER COUNT REACHES MAX 0 REM INIT COUNTER PRINT D CHR 4 PRINT PRINT DS IN SLOT PRINT DS PR SLOT VTAB 5 INPUT K PRINT D IN 0 PRINT DS PR 0 PRINT CALL 958 POKE A 1 12 REM CONTROL REGISTER 1 PER SECOND POKE A 3 4 REM CONTROL REGISTER B GOTO 2400 29 CP M AND YOUR TIMEMASTER H O 2 The TIMEMASTER H O may be used under the CP M operating system with the appropriate software When using MBASIC or GEASIC your H O
17. ECONDS 1 1 T H G Far 0000020 1 222 2 2 2 2 C D THE VARIABLES ME STRING 13 DAY STRING 18 A 1 HHP O he functions listed return the integer value of the function ame Note that the CLDAY is the day of week and the CLHOURS is he hours 0 to 23 format These return the same information that S returned when using the input statement in BASIC pet E The procedure GETCLOCK sets the strings time and TODAY with the current time and date The time string returns the time in the following format 12 30 08 PM while the TODAY string is in the format of SUN MAR 20 1983 and both have leading and trailing blanks To use these utilities the system library on your boot disk will need to be replaced with the system library on the suppied disk The file system start up will also need to be included on your boot disk if the automatic dating feature is desired The three text files supplied are the programs that were used to make the TIMEMASTER II unit 31 DISK CONTENTS 1 Your TIMEMASTER II H O disk contains many useful and instructive example programs Some of these hav been mentioned the preceding pages The disk is not protected however it is copyrighted and you can and should make a backup cop
18. LA 2010 RTI RETURN 2020 2030 STOP INTERRUPT 2040 SEI 2050 RTS 2060 2070 MSCNT BS 4 2080 Sel
19. Now reRUN the program by changing the to other letters you can vary how long the BUTTON is pressed When the H O sees the i it knows that the next character is the duration code for the following DIM or BRIGHT S commands The letters A thru 2 used here for duration control should not confused with the letters A thru V 1 used as button commands To use the next sample program you will need a lamp on 1 with a lamp module and appliance module on 2 Plug both remotes into wall outlets nearby If you have small radio to plug into the appliance module it would help you know when the module is turned on sure your COMMAND CONSOLE is plugged in be sure everything is set up properly press button 1 then press ON on the COMMAND CONSOLE Then press 2 ON on the COMMAND CONSOLE Now press 1 OEE NOUS OFF The light and the radio should have turned on and then off Lf not check to see if you have things set up properly and try again Now enter the program below that will allow us to xercis th H O s BSR capability 90 INPUT WHAT SLOT IS THE IN 5 100 INPUT COMMAND 110 IF B THEN END 120 PRINT CHR 4 5 130 PRINT 140 PRINT CHRS 4 PR 0 150 GOTO 100 ES
20. and can supply the time date information formatted in seven different ways The desired format is selected by PRINTing a single character to specify which format to use In the following table the character between quotation marks is the format selection character Each format is illustrated using Friday December 14 1984 3 30 PM MO DD HH MI SS WYY APPLE CLOCK MODE 12 14 15 30 23 384 MO DD YY HH MI SS IIMEMASTER MODE 3 12 14 84 15 30 23 5 WWW DD HH MI SS THUNDER CLOCK FRI DEC 14 03 30 23 APPLESOFT a WWW MMM DD 55 THUNDER CLOCK FRI DEC 14 15 30 23 APPLESOFT 4 MO OW DD HH MI SS THUNDER CLOCK 125 05 514 15 30 23 APPLESOFT gt WWW DD 55 THUNDER CLOCK FRI DEC 14 03 30 23 PM INTEGER lt WWW MMM DD 55 THUNDER CLOCK FRI DEC 14 15 30 23 INTEGER So that the colons accepted Applesoft INPUT statement formats which contain colons are preceded by a quotation mark The quotation mark tells Applesoft to allow colons in the input string The first four formats above designed for use with Applesoft and include the leading quotation mark last two formats designed for use with Integer BASIC and begin with a space rather than a quotation m
21. automatically record the current date and time on file names in the catalog when you SAVE BSAVE or RENAME files This feature is found in many large computer systems as well as Apple pascal sos and PRO DOS Some small but significant patches must be made to DOS 3 3 to allow automatic time date stamping of your files First a routine to read the clock overlay the time date string on your file name must be called for every SAVE BSAVE or RENAME command Second the two places inside DOS 3 3 wher fil names are compared must be modified to ignore the right end of the names where the time date string may or may not be found A program on the TIMEMASTER II H O disk called INSTALL DOS DATER will automatically make these patches for you This program allows you to specify what portion of the time date string you want to use in stamping file names The DOS DATER patches require that the H O be in th Timemaster mode switch 2 open The Timemaster format must b used becaus other clock cards contain no year information INSTALL DOS DATER searches slots 1 through 7 to find your 1 1 0 and checks that you have the right mode selected You can select any contiguous portion of the formatted date and time MO DD YY 55 The most commonly used stamp is the MO DD YY portion with the leading space Usi
22. the TIMEMASTER mode your job is even easier There are two direct entries in the TIMEMASTER mode firmware which you can use from machine language Their use is illustrated in the following subroutine 0300 A9 BA 1000 LDA SELECT TIME MASTER MODE 0302 20 OB C4 1010 JSR C4 B MODE SELECTION 0305 20 08 C4 1020 JSR 5 408 READ TIME TO 200 0305 60 1030 RTS If your 0 is not in slot 4 modify lines 1010 and 1020 appropriately The entry at CsOB receives th format selection character The entry at 5 508 reads the clock and stores the correctly formatted string at 200 terminated by carriage return If you want to write a machine language program which can read the clock no matter how switch 2 is set you can merely look at SCsFF to see which mode the is The following program does just that mode 0300 A9 C4 DIFFERENT 0 302 8D 10 0305 8D 19 0309 8D LC 0 30B 28D 25 030 AD FF OFF 0310 569 203 0313 DO 09 0315 A9 BA 0317 20 OB 0319 031 20 08 031D 60 031 0320 0321 0323 38 39 0324 A9 C4 0325 0 326 95 39 0328 A2 00 032A 86 38 C4 and proceeds to read the clock according to its
23. where s slot of IIMEMASTER II 3 read the time storing in a buffer 4 restore the original input hook 1040 1050 READ TIME 0300 A5 38 1060 LDA 38 KSWL PUT CURRENT 0312 48 1070 PHA INPUT HOOK 0303 A5 39 1080 LDA 39 KSWH ON THE STACK 0365 48 1090 PHA 1100 0306 A9 C4 1110 LDA C4 SCN N SLOT CLOCK IS 0308 85 39 120 STA 539 KSWH 030A A2 00 130 LDX 0 030 86 38 140 STX 538 KSWL 150 030E 20 18 FD 60 1 JSR SFD18 MONITOR KEY INPUT ROUTINE 0311 9D 00 02 70 STA 200 X SAVE CHARACTER FROM CLOCK 0314 E8 180 INX 0315 C9 8D 190 58 END OF INPUT 0317 DO F5 200 BNE 1 209 F 0319 68 220 PLA RESTORE INPUT HOOK 031A 85 39 230 STA 39 KSWH 031 68 240 0310 85 38 250 538 KSWL 031F 60 260 RTS After the subroutine has executed the time date string is in the buffer at 200 The above Source code is in the S ML Macro Assembler Applesoft is called BAS The ML OLD MODES subroutine is on your OLD object C program which loads ending with a carriage return IIM EMAST R in t in ML MODES code is B 18 ML DJ Db EJ H O D MODI ES disk The format for the S C OLD MODI ES An and CALLS it you have chosen to use
24. 0 80 pex LA pei pus Y BS OB DB BS aS 1500 1510 1520 1530 1540 1550 1560 1570 1580 1590 1600 1610 1620 1630 1640 1650 1660 1670 1680 1690 1700 1710 1720 1730 1740 1750 1760 1770 1780 1790 1800 1810 1820 1830 1840 1850 1860 1870 1880 1890 1900 1910 1920 1930 1940 1950 0 STUFF SLOT 5 VALUE v3 TYA AND STA ASL ASL ASL ASL STA RTS SOF SLOT SLOT16 SNO INTERRUPT INI LOAD INTERRUPT VECTOR LDA IRQ HANDLER STA 53 LDA IRQ HANDLER STA SET UP INTERRUPTIONS LDX SLOT16 LDA 40 POINT AT DIRECTION REGS STA 5 081 STA C083 X STA C080 X PORT A ALL INPUT STA 5 082 PORT B ALL OUTPUT LDA INTERVAL 0 3 AND 503 TAY LDA INTERVAL CRA Y STA 5 081 5 MS 12 SEC 4 1 4 HR LDA INTERVAL CRB Y STA 5 083 4 MS 4 5 5 12 HR LDA 52 ENABLE INTERRUPTS OUT PIA STA 5 082 LDA C080 X CLEAR PREVIOUS INTERRUPT LDA 5 082 INTERRUPT ZERO EI DA DX TA EX PL uJ g Q t F Q SET INTERRUPT DISABLE 0 ZERO THE 4 BYTE COUNTER 3 COUNT X DECREMENT X ui INTERRUPT READ SEI LDX DA TA EX PL m kt DISABLE INTERRUPTS WHILE
25. CH DOS 3 3 FOR INTERRUPTS found on Timemaster H O disk This program will fix DOS 3 3 to work with interrupts After running this program you can INITialize as many disks as you d like Always run the PATCH DOS 3 3 FOR INTERRUPTS before using any millisecond or interrupt capabilities or use boot disk that has the modification already made to it Your Timemaster II disk is such a disk so after booting up on th Timemaster disk you can simply INITialize new disks Commercial programs that use interrupts make this patch automatically The use of interrupts with PRODOS are extremely complex and therefor recommend the use of DOS 3 3 until the many bugs in PRODOS are worked out The millisecond feature is enabled by printing a period to the clock card after selecting the format Format selection clears the interrupt selection The firmware sets up the vector at and 3FF to point to an interrupt handler ROM and sets a flag that will cause interrupts on the clock card to be set up One additional step has to be done from your program which is to enable the IRQ interrupt with a CLI instruction In Applesoft you can issue a CLI instruction by POKEing a CLI and RTS and then calling them as in line 100 below The following p
26. GOTO 30 get new time BSR set ups can vary from the simple to the complicated For example you could have two H O s in your Apple that went to two different COMMAND CONSOLES each with its own separate house code This would give you control over 32 different devices It is also possible to have one COMMAND CONSOLE in the study with your computer and another COMMAND CONSOLE in the bedroom set to the same house code Each COMMAND CONSOLE would control the same devices 14 BASE CALIBRATION 1 Your has a quartz crystal time base which oscillates at 32 768 HZ This frequency can adjusted up or down approximately 2 HZ by the trimmer capacitor which is next to the DIP switches at the rear of the board Your H O was calibrated at the factory to 32 768 0 HZ 0 002 The manufacturer of the crystal specifies that the frequency may age up to 0 005 or 5 parts per million in one year If the clock is consistently gaining or losing time you may wish to adjust the trimmer Using a small screwdriver turn the trimmer SLIGHTLY clockwise to speed up the clock or counter clockwise to slow it down 1 30 SECOND ADJUST 2 Your H O has the ability to adjust the seconds 30 momentarily connecting the two top pins on the upper four connector marked 5V and marked ADJ for adjust you can reset the seconds to 00 adding one minute if the seconds
27. IF HR 0 THEN HR 12 IF HR gt 12 THEN HR HR 12 There are number of programs included on disk with your H O which read and display the clock Try them and then analyze how they are programmed FINDING THE CLOCK SLOT BY SOFTWARE 2 Each switch selected mode of the TIMEMASTER II has unique firmware signature in ROM Some of the signature bytes ar embedded in certain locations for compatibility with commercial software written for different clock cards For example special effort was made to make the APPLE CLOCK mode appear to software as though you have the Mountain Hardware card As well a simple to use Signature was added to distinguish the Applied Engineering card from other brands and to distinguish the various switch selected modes The following subroutine will search slots 1 through 7 for a TIMEMASTER card If no is found the subroutine will return with SLOT 0 found SLOT will equal the slot number and AP will equal 1 or 3 indicating which switch selected mode is set 1000 REM FIND TIMEMASTER II H O SLOT 1010 SLOT 0 1020 FOR 1 TO 7 1030 ADDR 12 4096 1 256 REM 5 500 1040 IF PEEK ADDR 28 AND PEEK ADDR 1 120 AND PEEK ADDR 254
28. INT 4 PR40 The program will receive the formatted date time information in the string 5 in the format determined by the MODE switch on the H O The easiest way to tell what mode you have is to add one more line to the program 160 PRINT Type in the program above and run it Remember to put in line 100 the slot number that your H O is in If you have switch selected the TIMEMASTER mode you can specify which of the formats to use Change line 130 to of the following and try running the program again 130 INPUT AS 130 INPUT A 130 INPUT 5 130 INPUT amp AS Ihe TIMEMASTER mode also includes a format which returns numeric values rather than a string and happens to be the mode used internally by Apple PRO DOS Change line 130 and 160 like this and RUN again 130 INPUT it MNTH WEEK DAY HR MIN SEC 160 PRINT MNTH WEEK DAY HR MIN SEC It is a good programming technique to put 4 in a string variable D rather than including it spelled out in each DOS command line Another useful change to our demonstration program would be to keep reading the display the time in a loop until you press any key on the keyboard Combining these changes produces the program on the next page TRY IT
29. K 236 will be 3 if the H O is in the normal mode or 1 in the Appleclock mode I The other six subroutines deal with interrupts CALL 768 Initialize interrupts CALL 771 Turn off interrupts CALL 774 Clear interrupt counter CALL 777 Read interrupt counter CALL 780 Enable interrupts CALL 783 Disable interrupts CALL 768 Initialize interrupts Four interrupt intervals are available You select which one you want by POKE 237 POKE 237 0 CALL 768 1024 times per second POKE 237 1 CALL 768 once per second POKE 237 2 CALL 768 once per minute POKE 237 3 CALL 768 once per hour CALL 768 puts the address of an interrupt handler into 3FE and 3FF clears an interrupt counter selects the interrupt interval you hav specified and enables interrupts with a CLI instruction CALL 771 Turn off interrupts This CALL disables interrupts with an SEI instruction and de selects interrupts on the clock CALL 774 Clear interrupt counter Zeroes the 32 bit counter 23 CALL 777 Read interrupt counter Disables interrupts copies the interrupt 32 bit counter into 236 237 238 and 239 and re enables interrupts You may follow CALL 777 with CNT PEEK 239 256 238 65536 PEEK 237 16777216 236
30. ONVERT on the PRO DOS Users Disk are B MILLISECONDS ANALOG CLOCK MILLISECONDS FIND TIMEMASTER II SLOT amp MODE MILLISECOND STOPWATCH READ TIME NO ROM TIME LIMIT QUIZ ML ALL MODES BASIC INTERRUPT ROUTINE B ML ALL MODES SET CLOCK ML OLD MODES EXAMPLE HOOKS B ML OLD MODES DATE amp TIME DISPLAY TIME II DEMO The file names will be changed CONVERT so that non letters become periods and truncated to 15 characters With two exceptions these programs will function under PRO DOS without modification The two programs ML ALL MODES and ML OLD MODES must slightly modified to correct the names of the binary files loaded in line 30 of both programs COMMON QUESTIONS ABOUT THE TIMEMASTER II H O 1 Q Which slot should I plug the TIMEMASTER II H O into A Any empty slot from slot 1 through slot 7 will do but we recommend slot 4 if it s available Some commercial software expects a clock to in slot 4 without looking anywhere else Q The program I have says it works with a clock card but can t get it to work with the TIMEMASTER II H O A You may have purchased a dud program The H O has been tested with dozens of clock type programs You may want to contact the software publishers help Applied Engineering is very cooperative with programming companies and most software houses will be eager to solve
31. OUT OF PIA 36 038D 038F 0390 0391 0392 0395 0398 039A 039D 039 03A0 03A2 03A3 03A4 03A5 03A6 7 03A8 QUO UT i 60 BD 8 60 B oo gt gt O Ed S Fl oo 82 80 00 45 CO 1600 STA 5 082 CO 1610 LDA C080 X CLEAR LAST INT USE 5 080 FOR 1024 amp iSEC USE C082 FOR iMIN amp 1 HOUR 1620 630 RESET COUNT 640 LDA itO ZERO THE 4 BYTE COUNTER 03 650 STA MSCNT 03 660 STA MSCNT 1 03 670 STA MSCNT 2 03 680 STA MSCNT 3 690 700 SAVE COUNT 710 SEI DISABLE INTERRUPTS 720 LDX 3 WHILE COPYING TUE COUNT 03 7 530 ol LDA MSCNT X O A SAFE LOCATION 03 740 STA MSCNT SAFE X 750 DEX 760 BPL 1 770 CLI ALLOW INTERRUPTS 780 RETURN RTS 790 800 ET ROM BYTE C 810 LDA C700 X 820 INX 830 RTS 840 85 09 860 IRQ HANDLER 870 LDA 45 SAVE 880 PHA 890 TXA SAVE X REG 1900 03 1910 LDX SLOT 16 SNO CO 920 LDA C080 X CLEAR INTERRUPT 1930 LDX 43 iNCREMENT COUNTER 03 1940 1 INC MSCNT X 1950 BNE 2 1960 DEX 1970 BPL 1 1980 2 PLA RESTORE X AND A REGS 1990 TAX 2000
32. RE UPON INTERRUPT 2030 REM 768 LDA 01 SET FLAG FOR BASIC 2040 REM STA 779 2050 REM LDA PIA CLEAR PIA 2060 REM LD 45 RESTORE ACCUMULATOR 2070 REM RTI IHEN RETURN 2080 REM 779 BYTE 00 BASIC FLAG 2090 REM USE CALL 780 TO DISABLE INTERRUPTS 28 100 110 120 130 140 150 160 170 180 190 2210 2220 2240 2250 2260 2270 2280 2290 2300 2310 2320 2330 2340 2350 2360 2370 2380 2400 2410 2420 2430 2450 2460 2470 2485 2490 2500 2510 2520 2530 2540 2550 2560 NONNNNNN SS PN REM 780 SET REM RTS REM USE CALL 782 TO ENABLE INTERRUPTS REM 782 CLI REM RTS DATA 169 1 141 11 3 173 208 192 165 69 64 0 120 96 88 96 FOR A 768 TO 783 READ X POKE A X NEXT A CALL 780 REM TURN OFF INTERRUPTS POKE 1022 0 POKE 1023 3 REM POINT TO INTERRUPT HANDLER 16256 16 SLOT BASE ADDRESS C080 SNO POKE 774 128 SLOT 16 POKE A 1 0 POKE A 3 0 REM DATA DIRECTION REGS POKE A 0 REM PORT A INPUT 8
33. READY SET UP 2040 POKE CA 0 POKE CB 0 POKE PA 0 POKE PB 255 REM SET DIRECTION REGISTERS 20 2050 4 4 REM POINT DATA REGISTERS 2060 2100 REM READ CLOCK USING FORMAT 2110 TS ROR GI TO NG 2120 POKE PB 16 REM HOLD CLOCK 2130 D IF D gt 127 THEN 2170 2140 16 D 56 OR D 53 THEN M 4 2150 REM READ THE DIGIT 2160 D T INT T M M 176 2170 T T CHRS D 2180 NEXT 2190 POKE PB 47 RETURN 2300 REM W MM DD YY HH MM SS FORMAT 2310 DATA 54 160 58 57 175 56 55 175 60 59 160 53 52 186 51 50 186 49 48 0 2320 NC 0 2330 READ D D 0 THEN RETURN 2340 NC NC 1 FMT NC D GOTO 2330 In the program above the PIA chip is initialized by the subroutine at line 2000 The subroutine at line 2300 reads a format definition into the array ENT The numbers in the list are either clock digit addresses values from 48 through 60 or ACSII characters values 127 Clock Registers ASCII Character Tens Units Digit Digit Year 60 59 160 space Month 58 57 175 slash Day 56 55 186 colon Day of week none 54 0 end of format Hour 53 52 Minute 50 49 48 T
34. RRUPT Source file 5 Macro Assembler of B TIME BY INTERRUPT B TIME BY INTERRUPT BRUN this to put current date time on top line of screen It will stay there while you work and be updated every second BASIC INTERRUPT ROUTINE Bill Goodwill s program which sets up interrupts and demonstrates them entirely within Applesoft 32 PATCH DOS 3 3 FOR INT SET CLOCK tz XAMPLE I HOOKS DATE amp TIME DISPLAY ANALOG CLOCK FIND TIMEMASTER SLOT amp MODE NO ROM ML ALL MODES S ML ALL MODES ALL MODES ML OLD MODI CI S S ML OLD MODES B ML OLD INSTALL DOS DATER ERRUPTS Installs patches which make DOS 3 3 See text safe for interrupts The program to use when you need to set a new time and or date in your TIMEMASTER Three different TIMEMASTER II and read it Nicely displays date and time every second ways to hook in the updating Reads the clock and displays date and time in all available formats according to selected mode moving hands and an audib ErGk tock Program which finds the s mode of your TIMEMASTER I le lo Displays an old fashioned c
35. SLOT T2307 1220 FIND SLOT 0311 C7 1230 LDY 5 7 START WITH SLOT 7 0313 8 AA 03 1240 1 STY 2 0316 AD FF CF 1250 LDA SCFFF RELEASE C800 SPACE 0319 2 FE 1260 LDX LOOK FOR 5 2 AT SCNFE 031 20 A8 03 1270 JSR GET ROM BYTE 031E C9 B2 1280 t B2 0320 DO 13 1290 BNE 2 0322 20 A8 03 1300 JSR GET ROM BYTE MODE BYTE 0325 85 E 1310 STA MODE 0327 20 A8 03 1320 JSR GET ROM BYTE 032 9 08 1330 08 PHP AT 5 032C DO 07 1340 BNE 2 NOT THIS SLOT 032 20 A8 03 1350 JSR GET ROM BYTE 0331 C9 78 1360 578 SEI AT 5 1 0333 07 370 THIS SLOT 0335 88 380 2 DEY NEXT SLOT DOWN 0336 390 CPY SC1 0338 0 9 400 BGS g 24 033A 000 033 98 033D 29 033 85 0341 0342 0343 0344 0A 0345 8D 0348 60 0349 78 034A 034 8D 034 9 0351 8D 0354 0357 9 0359 9D 035C 035 9D 0362 0364 9 0367 5 0369 29 036 8 036C B9 036 9D 0372 B9 0375 9D 0378 037 9D 037D BD 0380 BD 0383 78 0384 0386 A2 0388 9D 038 038 10 038 78 038 A2 0391 BD 0394 95 0396 0397 10 BO CA 83 2 82 80 82 00 03 6 03 C6 BC F8 03 03 03 03 CO CO CO CO 03 CO 03 CO CO CO CO 03 03 1410 1420 1430 40 50 60 7
36. TIMEMASTER II USER MANUAL APPLIED ENGINEERING Box 798 Carrollton Texas 75006 5 INTRODUCTION 2 INSTALLATION 4 TIMEMASTER II H O SWITCHES 4 MODE SELECTION 5 SETTING THE CLOCK 6 READING THE CLOCK 7 FINDING THE TIMEMASTER II H O BY SOFTWARE 9 READING THE TIME WITH MILLISECONDS 10 THE BSR REMOTE CONTROL OPTION 11 TIME BASE CALIBRATION 15 THE BATTERY 15 DOS DATER 16 TIME DATE STAMPING IN PRO DOS 17 READING THE TIMEMASTER II IN 6502 MACHINE CODE 18 READING THE CLOCK WITHOUT USING FIRMWARE 20 INTERRUPTS 22 CP M AND YOUR TIMEMASTER II H O 30 USING PASCAL WITH THE TIMEMASTER II H O 31 DISK CONTENTS 32 COMMON QUESTIONS ABOUT THE TIMEMASTER II H O 34 SOURCE CODE FOR MILLISECONDS 36 NOTICE THE TIMEMASTER II H O DESIGN PCB LAYOUT AND ROM FIRMWARE WERE COPYRIGHTED IN 1984 BY APPLIED ENGINE I RING THIS MANUAL IS ALSO COPYRIGHTED A PATENT IS PENDING ON THE TIM EMAST ER II H O comp usin it uter We Because of t computers and different typ sections in very g it as much as w ne es this much for sel ecc feel confident that ing the you
37. ark Even though there are two formats which display the time in AM PM format using 12 hour clock the internal hardware is still keeping time in 24 hour format I APPLE CLOCK MODE SW 2 closed 1 The Apple Clock mode emulates the format of the Mountain Hardware Apple Clock for compatibility with commercial software which specifies the Mountain Hardware card and does not allow other brands Certain signature bytes in the firmware for this mode should be recognized by such software allowing you to use it with your H O The Mountain Hardware card delivers the time dat in this format MO DD HH MI SS MMM Note the semicolons separating hours minutes and seconds The last three digits are milliseconds Hours are given for a 24 hour clock 00 23 Note also that day of week and year values are not present The Mountain Hardware clock does not provide any day of week or year values The H O card substitutes day of week and year values for the millisecond values If you need time to the nearest millisecong the H O can deliver it in a much more accurate way Please see page 10 for more information So the H O substitutes colons for semicolons giving the standard display of time MO DD HH MI SS WYY 12 14 15 30 23 384 Fri Dec 14 1984 3 30 PM So that the colons can accepted Applesoft INPUT Statement the format is preceded by a quot
38. ation mark The quotation mark tellsApplesoft to allow colons in the input string T SETTING THE CLOCK 1 set the Glock the switch marked SET switch 1 must be closed ON Once the time and date have been properly set you may wish to protect the clock by placing switch 1 in the open off position However as of yet no accidental time change has ever occurred The program called SET CLOCK conveniently reads the current clock setting allows you to enter new date and time values and then sets the clock to these new values at your signal RUN the program and follow the directions on your screen The program automatically finds your TIMEMASTER II H O card by searching slots 1 through 7 for certain signature bytes The program also determines which mode you have selected with switch 2 READING THE CLOCK 2 It is very easy to read the date and time from the H O The contains 2048 bytes of on board ROM ROM contains the Software that makes it easy to obtain the date and time The simplest way to read the date and time involves three steps 1 set input and output to the H O 2 INPUT the date time info 3 restore input and output to keyboard and screen Here is a simple example 100 SLOT 4 110 PRINT 4 IN SLOT 120 PRINT CHRS 4 PR4 SLOT 130 INPUT 5 140 PRINT 4 0 150 PR
39. can be used m ost easily by POKEing a short interface routine sample program that shows how this is done may found the H O disk The program is called T CPMDE1 and is stored a text file which can be converted to the CP M system by using the APDOS utility on the CP M master disk This program was written for the TIMEMASTER mode To convert the APPLE DOS text file to a CP M file do the following 1 Put a copy of your H O disk in drive 2 B 2 Put a CP M disk wi th BASIC and APDOS on it in drive 1 A 3 Turn on computer or do a PR 6 RETURN gt SO YOU GET AN A gt 4 Type APDOS lt RETURN gt YOU SHOULD NOW HAVE AN 5 Type TM1 BAS T CPMDE1 RETURN this will convert T CPMDEI 6 Type control C this will put you back in CP M You should now have a program on your CP M disk called TM1 This program can be run from MBASIC or GBASIC 30 USING PASCAL WITH THE TIMEMASTER H O 2 In Pascal an intrinsic unit has been supplied to nabl th access of the from within a Pascal program The unit 15 already linked into a standard Pascal library and can be accessed with the statement Uses TIMEMASTER in a programs heading The unit supplies the following functions and procedures ROCEDUI Jj E GETCLOCK NCTI NCTI NCTI NCTI NCTI NCTI NCTI DAY LMONTH DATE FEAR GG EE ES
40. cause h Software programs software designed to read your clock card Skill levels are designed to no programn a use under ha lot ning undreds nt In general developm the man ual and moves to the more advanced strictly adhered to levels follows below A description of 1 You should know how to get inside your Apple make a copy of a disk be able to CATALOG a disk and RUN a program If you do not know how to do this pleas S pages 57 through 69 in the Apple Ie owners manual or pages 15 and 16 in the Apple I Applesoft Tutorial 2 Simple BASIC Programming Skills If you do not currently possess these skills a few hours spent with the Applesoft Tutorial will give them to you 3 Advanced BASIC Programming Skills small knowledge of electronics You should know what is meant by when this line is pulled low and be able to convert numbers from hex to decimal and back again This skill level is rarely shown becaus th TimeMaster II H O is so easy to use in BASIC 4 Machine Language Programmer As the title would indicate you need to know h in source language Assembler W listings programs this on disk xperimented with many assembl as well ow to program in machine language manual written as disk the ers on with 5
41. e to type all 30 characters of the file name which includes the time dat stamp There are two places that file names are compared inside DOS 3 3 and both of them must be patched to shorten the EFFECTIVE file name Th ffectiv E nam is 30 characters long minus the length of your time stamp If you are using the recommended stamp of MO DD YY your effective file is 30 9 or 21 characters You need the following POKES POKE 19965 21 in the catalog search routine POKE 22653 20 in the OPEN command handler Note that the second puts value one less than the ffective length into DOS AUTOMATIC TIME DATE STAMPING FILES IN PRODOS 1 PRO DOS will automatically time and date stamp files with the H 0 in the TIMEMASTER mode switch 2 open PRODOS goes one step further than the patches for DOS 3 3 in that the date and time of original creation of a file is kept along with the date and time of last modification A word of caution should be mentioned regarding date stamping of files PRODOS PRODOS was written for an older design clock made by another company This clock does not have any year information so PRODOS calculates the year based on the date and day of week In other words if it s the 16th and it s Monday it must 1984 So the TIMEMASTER had to take smal
42. enter the slot with some friction and will then seat firmly 4 Make certain switch 1 on the H O is in the ON closed position 5 Replace the Apple s cover SWITCHES 1 There is device in the upper left corner of the card containing 4 switches These provide control over the display format enable disable interrupts and more Please never us pen or pencil to change switch settings A bent out paper clip works best SET Must be closed when setting the clock MODE Selects display mode see below NMI Enables Non Maskable Interrupt IRQ Enables Interrupt Request Note OPEN OFF Push down toward OPEN to turn switch off The normal settings are switches 1 and 4 closed and 2 and 3 open MODE SELECTION 1 Your has two Switch selectable modes controlled by switch 2 on the card The most powerful of these modes is called the TIMEMASTER mode which includes compatibility with both DOS 3 3 and PRO DOS The other mode is included for compatibility with certain older commercial software products which were designed around older generation clocks and do not allow modification for direct usage with the 11 0 MODE Sw 2 Format TIMEMASTER open various see below Apple Clock closed MO DD HH MM SS WYY IIMEMASTER MODI GI SW 2 open 1 This is the most powerful mode
43. f interrupt handling are best done with machine language routines The source listing of a program that uses interrupts is on the last page of this manual The name of this program is MILLISECONDS Both source and object files on your H O disk in S MILLISECONDS and B MILLISECONDS respectively The source file is in the format for the 5 Macro Assembler Ther ar several programs on your disk which load B MILLISECONDS and use the subroutines to illustrate the use of interrupts MILLISECONDS will display a running count of milliseconds using the 1024 Hertz interrupt MILLISECOND STOPWATCH will allow you to precisely tim th interval between two presses of the space bar using your Apple as stopwatch with accuracy to the nearest millisecond TIME LIMIT QUIZ illustrates using interrupts to provide a time limit to some activity by the user in this case an interesting multiple choice quiz It is interesting to listen to the Apple bell while millisecond interrupts are being processed Try it and you will hear what happens when you slow down timed loops to process interrupts Note that the interrupt interval generated on the card is 1 1024th of a second which is not a millisecond it is about 0 977 milliseconds Programs such as those above which need real milliseconds must multiply the 1024 Hz counter value b
44. he subroutine at line 2100 reads the clock by stepping through the format array Line 2120 holds the clock and line 2190 releases it The Applesoft program above is very similar in concept to the programs in the on board ROMs By varying the format definition many different arrangements of the clock data can be displayed An assembly language program which reads the clock without using on board firmware is on the TIMEMASTER II H O disk The source code is in the file named 5 BY INTERRUPT in the format of the 5 Macro Assembler object code which can be BRUN is in th f named B TIME BY 21 INTERRUPTS 3 One of the main features of the is the ability to generate interrupts at set intervals Interrupts can add new dimensions to your Apple For instance background and foreground programming is possible by letting the interrupt handler routine initiate the background program Also data can be sampled at precise intervals The following interrupt intervals are available 1 1024 second 1 second 1 minute or 1 hour The interval is selected by storing values from the table below in the control registers on the clock card Time Control Register CRA CRB none S04 504 1024 Hz 05 504 1 SOC 04 Min 504 505 Hour 04 50 SAMPLE INTERRUPT PROGRAMS 3 This and other details o
45. ll zeroes it and counts the event in C and prints slash for grins again When C finally reaches the limit T the program reads the clock and displays it on the screen You could substitute your own list of activities to be performed after each interrupt and after each time the counter C reaches the limit T PATCHES FOR DOS 3 3 WHEN USING INTERRUPTS 3 The Apple and DOS designers must not have really expected users to take advantage of interrupts The IRQ interrupt handler inside the Apple monitor ROM saves the A register at location 45 in RAM This would be all right except that DOS 3 3 uses location 45 in 25 different places as a temporary variable An interrupt at the wrong time could greatly confuse DOS and the potential of clobbering a disk or at least a running program The easiest way around the problem is to be certain that the IRQ interrupt is disabled before any every DOS command enabled when the DOS commands are finished Another approach tried in a product called Doubletime Printer from Southwestern Data Systems is to replace the monitor ROM chip with one which does not use location 45 The best solution is to patch DOS 3 3 50 that it does not use location 45 The program called PATCH DOS 3 3 FOR INTERRUPTS on the H O disk installs patches which make DOS 3 3 completely compatible with the use of the IRQ interrupt If y
46. lock with t and Program which reads and displays the date and on board ROM firmware Calls B ML ALL MODES time without using the to read the date time string regardless of the mode select Source file B ML ALL MODES 5 Macro Assembler by 5W3 and 514 of a program which reads the date time string in assembly language Object file used by ML ALL MODES Calls B ML OLD MODES to read the date time string which works in TIMEMAST ER mode only when NOT Source file B ML OLD MODES languages Object file used by ML S C Macro Assembler a program which reads the date time string in assembly OLD MODI of GI 5 Modifies DOS 3 3 in memory to stamp date and or time on files with SAVE BSAVE RENAME or INI 33 T 5 205 DATER Source file S C Macro Assembler B DOS DATER Object file used by INSTALL DOS DATER TALKING CLOCK If you have an Echo II this program will speak the time once per minute TALK Used by TALKING CLOCK do not BRUN T CPMDE1 CP M demo The files which can be moved to PRO DOS using C
47. n the program is running you should see the red light on the controller flashing on and off 100 PR 4 or whatever slot 110 PRINT 0 120 GOTO 110 press CTRL RESET to stop The firmware includes the ability to send signals to the BSR system After selecting the H O with PR s C s is the slot you can print code letters to cause the various commands to be sent The code letters correspond to the command console buttons as follows CODE COMMAND CODE COMMAND LETTER BUTTON LETTER BUTTON A J L 12 2 1 3 3 N 14 D 4 0 15 5 E 16 F 6 Q ON G 7 8 5 BRIGHT E 9 J 10 U ALL LIGHTS ON K 11 ALL OFF For example to turn on light 1 do this 2 100 PRINT CHRS 4 PR 4 or whatever slot PRINT AQ 120 PRINT 4 0 The A is button 1 and is ON Each command code is automatically transmitted 5 times to be certain it is correctly understood by the BSR controller This is equivalent to holding down the button on the command console for about 1 2 second The BRIGHT DIM commands are special The range from fully OFF to fully ON is divided into many small steps If you press and hold down the DIM button it takes about 5 seconds to run through enough steps to fully dim the selected light corre
48. ng INSTALL DOS DATER you can select the portion of the string you wish to use with the arrow keys and the 12 and R keys When the string is as you like it press RETURN and the patches will be recorded Simply follow the directions in the program to modify as many DOS 3 3 disks as you d like Once the patches have been applied to the DOS booted any disks you initialize with the INIT command will have the patched DOS on them After you become familiar with the various features of time date stamping your files you may wish to update the DOS on the older disks The slot your was in at the time INSTALL DOS DATER was executed is frozen into the installed patches so do not try to move the card to another slot If you do move your H O to a different slot you will have to reRUN INSTALL DOS DATER There is normally no problem with using the patched DOS with any existing programs on disks as long as they are not protected Any new files SAVEd BSAVEd or RENAMEd will have the current date added The INIT command will also caus th dat to be added to the greeting prOgram s name Should you ever running with an unpatched DOS and want to use files that have time date stamps you will probably want to temporarily patch the 16 DOS memory so that it ignores the time dat stamp You don t have to but if you don t you will hav
49. ou are expecting to use the millisecond interrupt for precise interval counting other purposes you may still have conflict with DOS Because disk I O operations are critically timed with software DOS 3 3 disables the interrupt during the reading or writing of the disk data The IRQ interrupt will be ignored during the time it takes to bring a drive up to speed find the proper track and sector and read or write the data 21 TO READ THE TIME DATE UNDER AN INTERRUPT 3 It is usually not a good idea to try to use the built in firmware to read the time and date in an interrupt driven program The H O firmwar uses th system input buffer at 200 to build the time date string It is possible that your use of the clock interrupt does not require all of the clock data Perhaps only certain clock registers need to be read so that a separate machine language program could be much faster than an attempt to read the whole clock using the on board firmware To keep interrupt overhead to a minimum your interrupt routine could read only selected registers The on board firmware forgets your interrupt interval selection in most cases If you don t want to reestablish the interrupt interval after each clock read you may want to use separate clock read program A program is on your H O disk which reads the clock and formats the date and time The sou
50. rce code is in the file named S TIME BY INTERRUPT in the format of the 5 Macro Assembler The object code which can be BRUN is in B TIME BY HOW TO DISABLE INI I 4 Once you begin using interrupts it is important to know how to disable them The IRQ interrupt can be disabled using the SE instruction from machine language programs Pressing RESET or Ctrl RESET in newer Apples will disable the IRQ interrupt RESET will also clear the interrupt selections in the clock card so that both IRO and NMI interrupts will cease Both IRQ and NMI interrupts from the clock can be cleared disabled by storing a zero value in the control registers SCO81 NO AND C083 NO Since the clock interrupts must be connected to the Apple bus by switches 3 or 4 on the clock card flipping the switches off will obviously disconnect the interrupts 1990 REM BASIC INTERRUPT ROUTINE BY WILLIAM P GOODWILL 2000 TEXT HOME INPUT WHAT SLOT IS THE TIMEMASTER IN SLOT IF SLOT lt 1 OR SLOT gt 7 THEN 2000 2010 REM LOAD 3 SMALL ASSY LANGUAGE ROUTINES 2020 REM HE
51. rogram shows how it assumes your clock card is in slot 4 100 POKE 768 88 POKE 769 96 CALL 768 set up interrupts 110 TEXT HOME good programing 120 PRINT PRESS A KEY TO END ref to line 200 130 SLOT 4 or any slot set clock input 140 PRINT CHR 4 IN SLOT set clock output 150 PRINT CHRS 4 PRE SLOT get the tim 160 INPUT 170 PRINT CHRS 4 IN 0 restore keyboard restore output 180 PRINT 4 PR 0 print the time 190 VTAB 4 PRINT 200 IF PEEK 16384 128 THEN 120 key pressed reset key ck 210 POKE 16368 0 10 THE BSR CONTROL OPTION 1 The Applied Engineering BSR Remote Control option allows your Apple to send control signals to your BSR ultrasonic command console The command console then sends these signals along your existing 120 volt AC wiring To remotely control appliances or lights or almost any electrical device you plug into BSR remote module The BSR interface is designed to operate with the BSR x 10 ultrasonic command console model UC301 or model GDP 1510 from Heathkit NOT a kit This is the same command console that operates with the BSR x 10 cordless controller sur you have the right model of command console or it will not be able to hear the signals from your Timemaster 0 BSR interface The command consol sold by Radio Shack is not compatible with the BSR option because it has no ultrasonic receiver
52. sate you If your program is really spectacular you may want a software publisher to sell it for you The TIMEMASTER II seems to be way out in front of its competition in both features and price How did you do it Apple peripherals are our only business that s why we re so good at it MILLISECONDS SOURCE CODE 1020 OR 300 1030 TF B MILLISECONDS 1040 35 0300 4 11 0303 4 6 0306 4C 7A 0309 4C A6 030C 0310 0311 78 0312 AO C7 0314 8C 8A 0317 A2 FE 0319 20 88 Q31TC C9 B2 031 DO OF 0320 E 0321 20 88 0324 C9 08 0326 DO 07 0328 20 88 032B C9 78 032D FO 06 032F 88 0330 0332 0334 60 325 5296 0336 0337 0338 0339 033A 8D 10 033D FO 48 033F AA 0340 A9 8D 0342 8D FE 0345 A9 03 0347 8D FF 034A A9 00 034C 9D 81 034F 9D 83 0352 9D 80 0355 A9 FF 0357 9D 82 035A A9 05 Q3 9p 9 03SF A9 04 0361 9D 83 0364 A9 2F 03 03 03 03 03 03 03 03 03 03 03 CO CO CO CO CO
53. spondingly 5 seconds of BRIGHT will bring it back to fully on The firmware simulates holding down the button and you have the option of telling it how long to hold it down For the following sample program you will need a light connected to button 1 Use the BSR controller manually and push 1 then 12 the light does not come on down the BRIGHT button N 10 PRINT CHR 4 4 20 PRINT 30 PRINT CHRS 4 PR o The A is the more di mming you ll get it may be necessary to hold ow type in the following program Now change line 20 to for button 1 and the T means DIM the more T s 20 PRINT ASSSSSSSSSSSSSS Now reRUN the program and notice that the light will brighten A shorthand way of controlling the number of DIM or BRIGHT commands issued each time T or 5 is printed is available printing a i followed by a letter A through Z to select the number of times the DIM or BRIGHT command will transmitted for each T DIM or 5 BRIGHT A for a little Z for a lot So let s change line 20 the program above to use the command to dim the light on button 1 Now change line 20 to 20 PRINT A NTII
54. th 017 12 DAS MIDS A 4 2 day of month 01 31 YRS RIGHTS AS 2 year 00 99 HRS 7 2 hour 00 23 MIS MIDS AS 1 1 minute 00 59 SES MIDS AS 13 2 second 00 59 So if you are only interested in seconds we need only add or change these lines to the last program 180 SES RIGHTS AS 2 185 PRINT SES Jj If you want the values as numbers simply use the VAL function For example the day of week as a number would WK VAL WKS Using the day of week a number allows you to look up the full Spelling of the day name One easy to program it would be like this VAL WKS WK 3 THEN WKS WEDNESDAY IF WK O THEN WKS SUNDAY IF WK 4 THEN WKS THURSDAY IF WK 1 THEN 5 MONDAY IF WK 5 THEN 6 FRIDAY IF WK 2 THEN WKS TUESDAY IF WK 6 THEN WKS SATURDAY You can obviously doa similar thing to the spelling of the month names You can prefix the year with a 19 or a 20 using any method you like If you have the clock set in one of the 24 hour modes and still want to read times you use the following program Segment to convert the hour and append or as appropriate HR VAL HRS IF gt 11 THEN APS IF HR lt 12 THEN APS
55. were greater than 30 It should be reminded that the set clock routine on the Timemaster II H O disk can set the clock as accurately as you can push the return key however in some Scientific applications it may be necessary to trim the time accurately using the 30 second adjust feature THE BATTERY 1 H O is supplied with rechargeabl battery to keep the clock running when the computer is turned off or when power fails The H O will automatically detect power going off and switch to the on board battery clock will continue keeping time while the on board battery supplies power The battery is charging whenever power is applied to the APPLE The time to fully charge a discharged battery is approximately 10 hours Your may be used while charging the battery A fully charged battery can keep the clock running for 5 to 7 months In order to keep the battery charged your APPLE should be turned on at least 0 5 of the time or about 1 hour a week or 4 hours a month The battery CANNOT overcharged and under normal use it will not require attention 36 T I 25 M E 20 15 16 2 WEEKS e 1 2 3 1 5 6 7 e 3 18 iL i2 TIME TO FULLY CHARGE BATTERY IN HOURS T5 AUTOMATIC TIME DATE STAMPING OF FILES DOS 3 3 2 One nice application of the H O is to
56. y 1000 1024 22 two files S TIME BY INTERRUPT and B TIME BY INTERRUPT are the source and object files for another program which uses interrupts Again the source file is in the format of the S C Macro Assembler you BRUN B TIME BY INTERRUPT the top two lines of the screen display will be used to display the current date and time The time will be updated every second INTERRUPT UTILITIES 3 A binary file named B CLOCK UTILITIES is on the H O User Disk This file contains seven very useful programs which can be called from an Applesoft program to work when you want to use interrupts The file is designed to be BLOADed at 300 and uses all of the space from 300 through 3CF Five bytes from SEB through SEF not used by Applesoft or DOS are used for communication between the UTILITIES and your Applesoft program Include the following statement at the beginning of your Applesoft program PRINT CHR 4 BLOAD B CLOCK UTILITIES CALL 785 The CALL 785 searches from slot 7 down toward slot 1 looking for the H O Even if you know ahead of time which slot is being used you still must CALL 785 to set up the utilities After CALL 785 you can PEEK 235 for the slot number If PEEK 235 is zero no H O was found PEE
57. y using any standard Apple disk copy program for example COPYA on the DOS 3 3 System Master Diskette Side one of the diskette which is labeled contains DOS 3 3 Copyright 1981 by Apple Computer Inc A small patch has been made to this DOS to speed up the LOAD BLOAD RUN and BRUN commands The programs on this side include a file which can be moved to a CP M environment The others can be used either with DOS 3 3 and many of them with Apple PRO DOS Side two of the diskette contains files intended to be used with Apple Pascal There are seveal files on side one of the H O diskette which are type thu Normally file type I signifies Integer BASIC files but in this case it signifies source assembly language files to be used with the S C Macro Assembler You may also have other programs on the disk S MILLISECONDS Source file 5 Macro Assembler of B MILLISECONDS B MILLISECONDS Object file used by next three programs which sets up and processes millisecond interrupts MILLISECONDS Uses B MILLISECONDS to give a running display of elapsed milliseconds MILLISECOND STOPWATCH Uses B MILLISECONDS to provide a very precise stopwatch THE LIMIT QUIZ Uses B MILLISECONDS to give a fun multiple choice quiz with time limits on your responses S TIME BY INTE
58. your problem because of the large volume of TIMEMASTER sales By helping you they will be helping their other customers as well 34 What mode is recommended for my own programming Ihe TIMEMASTER mode switch 2 open I m thinking of buying a program that says it will work with a real time clock Does this automatically mean that it will work with the H O usually but not always Try to check with the author of the program to make sure that he supports TIMEMASTER Over 300 software developers have purchased the TIMEMASTER SO compatibility problems should be rare I With some of the sample programs I will see a cursor looking thing flashing on part of the screen What causes this The cursor is caused whenever control is restored to the Screen This is part of the Apple monitor ROM and cannot be avoided when using PR s The cursor appears to flash becaus th clock is constantly being reread However most programs only read the clock periodically thereby preventing the cursor from reappearing If you are going to write a program that must constantly read the clock you might want to not use the on board firmware or do it with interrupts I ve written this really neat program that uses the H O Should I give it to Applied Engineering Depending on the quality of the program Applied Engineering may compen

Download Pdf Manuals

image

Related Search

Related Contents

Philips In-Ear Neckstrap Headphones  JAY® J3 Back - Altonaids Mobility Ltd  Video Registratore Digitale a 9 Canali Manuale d`Installazione ed Uso  The Comfort and Luxury You Deserve  H.264 Multiplex 4CH LCD DVR Support mobile - an  D0136.... OXIGEL PAVONADO 02.09  Samsung S690 User Manual  AVF UL400PB flat panel wall mount  Mise en page 1 - Ville de Freyming    

Copyright © All rights reserved.
Failed to retrieve file