home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / clock.zip / CLOCK.DOC < prev    next >
Text File  |  1987-01-04  |  4KB  |  130 lines

  1.                                                       CLOCK.DOC
  2.  
  3. CLOC╦ i≤ ß prograφ tha⌠ display≤ ß clocδ facσ oε thσ screen«  Thσ ì
  4. subroutine≤ arσ se⌠ u≡ t∩ allo≈ sizinτ anΣ positioninτ thσ clocδ ì
  5. anywherσ oε thσ screen¼ bu⌠ thσ defaul⌠ i≤ ful∞ screeε size«  
  6.  
  7. Thσ prograφ assume≤ aε IB═ P├ (o≥ compatible⌐ BIOS¼ ß CG┴ adapte≥ ì
  8. anΣ colo≥ monitor.
  9.  
  10. Thσ prograφ i≤ writteε iε ├ fo≥ speeΣ anΣ portability.
  11.  
  12.  
  13.  
  14. PSEUDO CODE
  15.  
  16. INITIALIZE
  17. DETERMINE SIZE, COLORS, AND LOCATION
  18. CLEAR SCREEN AREA
  19. PAINT CLOCK FACE
  20. PERFORM UNTIL <ESC>
  21.      BEGIN
  22.      GET TIME
  23.      PAINT HANDS
  24.      SEE IF KEYBOARD ENTRY
  25.      COMPUTE HOUR HAND
  26.      COMPUTE MINUTE HAND
  27.      COMPUTE SECOND HAND
  28.      END
  29. EXIT PROGRAM
  30.  
  31.  
  32.  
  33.  
  34. ALGORITHM USED TO COMPUTE AND PAINT HANDS
  35.  
  36. Durinτ initialization¼ 60 hanΣ image≤ arσ computeΣ anΣ storeΣ ì
  37. iε ß table«  Wheε thσ hand≤ arσ computed¼ the∙ refe≥ t∩ thi≤ ì
  38. table«  Thσ tablσ image≤ thσ seconΣ hand¼ ß straigh⌠ linσ oµ ì
  39. defineΣ widtΦ anΣ length«  Thσ minutσ hanΣ i≤ tw∩ pixel≤ wider¼ ì
  40. anΣ 1/┤ thσ length«  Thσ hou≥ hanΣ i≤ ┤ pixel≤ wide≥ anΣ 1/▓ a≤ ì
  41. long.
  42.  
  43. Wheε thσ computσ algorithm≤ pas≤ aε inde° t∩ thσ pain⌠ ì
  44. routinσ indicatinτ whicΦ hanΣ imagσ t∩ use«  Thσ pain⌠ routinσ ì
  45. wil∞ theε dra≈ thσ ne≈ hanΣ image≤ iε ß worδ area«  Thσ "newó ì
  46. worδ areß i≤ compareΣ witΦ thσ "currentó worδ areß anΣ onl∙ thσ ì
  47. changeΣ bit≤ arσ moveΣ t∩ thσ screeε buffer«  (Theε thσ ne≈ worδ ì
  48. areß become≤ thσ curren⌠ worδ area.)
  49.  
  50.  
  51. .paèHAND IMAGE TABLE
  52.  
  53. Thi≤á tablσ neeΣ no⌠ bσ 6░ entrie≤ long¼á rathe≥ i⌠ onl∙ need≤ t∩ ì
  54. bσ ╕ entrie≤ long«  Thσ clocδ facσ caε bσ divideΣ int∩ ì
  55. symmetrica∞ quadrant≤ rathe≥ easil∙ (1╡ min≤ pe≥ quad)«  EacΦ ì
  56. quadran⌠ caε bσ furthe≥ symmetricall∙ divideΣ iε half¼ bu⌠ no⌠ oε ì
  57. ß wholσ number«  Therefore¼ witΦ ß tablσ oµ eigh⌠ entries¼ thσ ì
  58. hands for all 60 entries can be described.
  59.  
  60.      Time Quad Oct  Entry     Clock hand
  61.      (sec)                     x, y co-ordinate
  62.  
  63.      00   1    1    0          a,-b 
  64.      01   1    1    1          a,-b
  65.      02   1    1    2          a,-b
  66.      03   1    1    3          a,-b
  67.      04   1    1    4          a,-b
  68.      05   1    1    5          a,-b
  69.      06   1    1    6          a,-b
  70.      07   1    1    7          a,-b
  71.  
  72.      08   2    2    7          b,-a
  73.      09   2    2    6          b,-a
  74.      10   2    2    5          b,-a
  75.      11   2    2    4          b,-a
  76.      12   2    2    3          b,-a
  77.      13   2    2    2          b,-a
  78.      14   2    2    1          b,-a
  79.  
  80.      15   2    3    0          b, a
  81.      16   2    3    1          b, a
  82.      17   2    3    2          b, a
  83.      18   2    3    3          b, a
  84.      19   2    3    4          b, a
  85.      20   2    3    5          b, a
  86.      21   2    3    6          b, a
  87.      22   2    3    7          b, a
  88.  
  89.      23   3    4    7          a, b
  90.      24   3    4    6          a, b
  91.      25   3    4    5          a, b
  92.      26   3    4    4          a, b
  93.      27   3    4    3          a, b
  94.      28   3    4    2          a, b
  95.      29   3    4    1          a, b
  96.  
  97.      30   3    5    0         -a, b
  98.      31   3    5    1         -a, b
  99.      32   3    5    2         -a, b
  100.      33   3    5    3         -a, b
  101.      34   3    5    4         -a, b
  102.      35   3    5    5         -a, b
  103.      36   3    5    6         -a, b
  104.      37   3    5    7         -a, b
  105. è     38   4    6    7         -b, a
  106.      39   4    6    6         -b, a
  107.      40   4    6    5         -b, a
  108.      41   4    6    4         -b, a
  109.      42   4    6    3         -b, a
  110.      43   4    6    2         -b, a
  111.      44   4    6    1         -b, a
  112.  
  113.      45   4    7    0         -b,-a
  114.      46   4    7    1         -b,-a
  115.      47   4    7    2         -b,-a
  116.      48   4    7    3         -b,-a
  117.      49   4    7    4         -b,-a
  118.      50   4    7    5         -b,-a
  119.      51   4    7    6         -b,-a
  120.      52   4    7    7         -b,-a
  121.  
  122.      53   1    8    7         -a,-b
  123.      54   1    8    6         -a,-b
  124.      55   1    8    5         -a,-b
  125.      56   1    8    4         -a,-b
  126.      57   1    8    3         -a,-b
  127.      58   1    8    2         -a,-b
  128.      59   1    8    1         -a,-b
  129.  
  130.