home *** CD-ROM | disk | FTP | other *** search
- CLOCK.DOC
-
- CLOC╦ i≤ ß prograφ tha⌠ display≤ ß clocδ facσ oε thσ screen« Thσ ì
- subroutine≤ arσ se⌠ u≡ t∩ allo≈ sizinτ anΣ positioninτ thσ clocδ ì
- anywherσ oε thσ screen¼ bu⌠ thσ defaul⌠ i≤ ful∞ screeε size«
-
- Thσ prograφ assume≤ aε IB═ P├ (o≥ compatible⌐ BIOS¼ ß CG┴ adapte≥ ì
- anΣ colo≥ monitor.
-
- Thσ prograφ i≤ writteε iε ├ fo≥ speeΣ anΣ portability.
-
-
-
- PSEUDO CODE
-
- INITIALIZE
- DETERMINE SIZE, COLORS, AND LOCATION
- CLEAR SCREEN AREA
- PAINT CLOCK FACE
- PERFORM UNTIL <ESC>
- BEGIN
- GET TIME
- PAINT HANDS
- SEE IF KEYBOARD ENTRY
- COMPUTE HOUR HAND
- COMPUTE MINUTE HAND
- COMPUTE SECOND HAND
- END
- EXIT PROGRAM
-
-
-
-
- ALGORITHM USED TO COMPUTE AND PAINT HANDS
-
- Durinτ initialization¼ 60 hanΣ image≤ arσ computeΣ anΣ storeΣ ì
- iε ß table« Wheε thσ hand≤ arσ computed¼ the∙ refe≥ t∩ thi≤ ì
- table« Thσ tablσ image≤ thσ seconΣ hand¼ ß straigh⌠ linσ oµ ì
- defineΣ widtΦ anΣ length« Thσ minutσ hanΣ i≤ tw∩ pixel≤ wider¼ ì
- anΣ 1/┤ thσ length« Thσ hou≥ hanΣ i≤ ┤ pixel≤ wide≥ anΣ 1/▓ a≤ ì
- long.
-
- Wheε thσ computσ algorithm≤ pas≤ aε inde° t∩ thσ pain⌠ ì
- routinσ indicatinτ whicΦ hanΣ imagσ t∩ use« Thσ pain⌠ routinσ ì
- wil∞ theε dra≈ thσ ne≈ hanΣ image≤ iε ß worδ area« Thσ "newó ì
- worδ areß i≤ compareΣ witΦ thσ "currentó worδ areß anΣ onl∙ thσ ì
- changeΣ bit≤ arσ moveΣ t∩ thσ screeε buffer« (Theε thσ ne≈ worδ ì
- areß become≤ thσ curren⌠ worδ area.)
-
-
- .paèHAND IMAGE TABLE
-
- Thi≤á tablσ neeΣ no⌠ bσ 6░ entrie≤ long¼á rathe≥ i⌠ onl∙ need≤ t∩ ì
- bσ ╕ entrie≤ long« Thσ clocδ facσ caε bσ divideΣ int∩ ì
- symmetrica∞ quadrant≤ rathe≥ easil∙ (1╡ min≤ pe≥ quad)« EacΦ ì
- quadran⌠ caε bσ furthe≥ symmetricall∙ divideΣ iε half¼ bu⌠ no⌠ oε ì
- ß wholσ number« Therefore¼ witΦ ß tablσ oµ eigh⌠ entries¼ thσ ì
- hands for all 60 entries can be described.
-
- Time Quad Oct Entry Clock hand
- (sec) x, y co-ordinate
-
- 00 1 1 0 a,-b
- 01 1 1 1 a,-b
- 02 1 1 2 a,-b
- 03 1 1 3 a,-b
- 04 1 1 4 a,-b
- 05 1 1 5 a,-b
- 06 1 1 6 a,-b
- 07 1 1 7 a,-b
-
- 08 2 2 7 b,-a
- 09 2 2 6 b,-a
- 10 2 2 5 b,-a
- 11 2 2 4 b,-a
- 12 2 2 3 b,-a
- 13 2 2 2 b,-a
- 14 2 2 1 b,-a
-
- 15 2 3 0 b, a
- 16 2 3 1 b, a
- 17 2 3 2 b, a
- 18 2 3 3 b, a
- 19 2 3 4 b, a
- 20 2 3 5 b, a
- 21 2 3 6 b, a
- 22 2 3 7 b, a
-
- 23 3 4 7 a, b
- 24 3 4 6 a, b
- 25 3 4 5 a, b
- 26 3 4 4 a, b
- 27 3 4 3 a, b
- 28 3 4 2 a, b
- 29 3 4 1 a, b
-
- 30 3 5 0 -a, b
- 31 3 5 1 -a, b
- 32 3 5 2 -a, b
- 33 3 5 3 -a, b
- 34 3 5 4 -a, b
- 35 3 5 5 -a, b
- 36 3 5 6 -a, b
- 37 3 5 7 -a, b
- è 38 4 6 7 -b, a
- 39 4 6 6 -b, a
- 40 4 6 5 -b, a
- 41 4 6 4 -b, a
- 42 4 6 3 -b, a
- 43 4 6 2 -b, a
- 44 4 6 1 -b, a
-
- 45 4 7 0 -b,-a
- 46 4 7 1 -b,-a
- 47 4 7 2 -b,-a
- 48 4 7 3 -b,-a
- 49 4 7 4 -b,-a
- 50 4 7 5 -b,-a
- 51 4 7 6 -b,-a
- 52 4 7 7 -b,-a
-
- 53 1 8 7 -a,-b
- 54 1 8 6 -a,-b
- 55 1 8 5 -a,-b
- 56 1 8 4 -a,-b
- 57 1 8 3 -a,-b
- 58 1 8 2 -a,-b
- 59 1 8 1 -a,-b
-