プチコンmkII

  1. ’┌──────────┐”
  2. ’│SAMPLE5   │”
  3. ’│ ハ゛イオリス゛ム │”
  4. ’└──────────┘”
  5. VISIBLE 1,1,0,0,0,1
  6. GPAGE 0:GCOLOR 0:GCLS
  7. COLOR 0:CLS
  8. CLEAR
  9. ’--- 
  10. DIM MDAY(12)
  11. DATA 31,28,31,30,31,30
  12. DATA 31,31,30,31,30,31
  13. FOR I=0 TO 11
  14.  READ MDAY(I)
  15. NEXT I
  16. ’--- 
  17. SPC = 8
  18. BGT = 4
  19. LINEH = 60
  20. LINEC = BGT + SPC + LINEH
  21. DAYW = 8:DRAWD = 30
  22. BGL = (256 - (DRAWD - 1) * DAYW - SPC * 2) / 2
  23. BGR = BGL + DAYW * (DRAWD - 1) + SPC * 2
  24. BGB = BGT + (SPC + LINEH) * 2 + SPC
  25. DIM DDAY(DRAWD)
  26. COLOR 0
  27. ’--- 
  28. @START
  29. CLS
  30. GCLS 14
  31. FOR I = 0 TO DRAWD - 1
  32.  DDAY(I) = FALSE
  33. NEXT
  34. PRINT”┌────────┐”
  35. PRINT”│ハ゛イオリス゛ム│”
  36. PRINT”└────────┘”
  37. ’--- 
  38. @INPUTDAY
  39. INPUT ”Ж:タンシ゛ョウヒ゛ハ(YYYYMMDD)”; DT$
  40. IF LEN(DT$) != 8 THEN @ERROR
  41. BYEAR = VAL(MID$(DT$, 0, 4))
  42. BMON = VAL(MID$(DT$, 4, 2))
  43. BDAY = VAL(MID$(DT$, 6, 2))
  44. IF BYEAR < 1900 THEN @ERROR
  45. IF BMON < 1 OR BMON > 12 THEN @ERROR
  46. IF BDAY < 1 THEN @ERROR
  47. DTREAD(DATE$), NYEAR, NMON, NDAY
  48. IF BYEAR > NYEAR THEN @ERROR
  49. YEAR = NYEAR
  50. MON = NMON
  51. DAY = NDAY
  52. GOSUB @CALCDAY
  53. TOTAL = CDAY
  54. YEAR = BYEAR
  55. MON = BMON
  56. DAY = BDAY
  57. GOSUB @CALCDAY
  58. LEAP = 0
  59. IF MON == 2 THEN GOSUB @CHKLEAP
  60. IF DAY > MDAY(MON - 1) + LEAP THEN @ERROR
  61. TOTAL = TOTAL + YEARDAY - CDAY
  62. IF BYEAR == NYEAR THEN @DRAW
  63. FOR YEAR = BYEAR TO NYEAR - 1
  64.  TOTAL = TOTAL + 365
  65.  GOSUB @CHKLEAP
  66.  TOTAL = TOTAL + LEAP
  67. NEXT
  68. ’--- 
  69. @DRAW
  70. CLS
  71. GCLS 4
  72. GFILL BGL, BGT, BGR, BGB, 15
  73. GCOLOR 14
  74. GBOX BGL, BGT, BGR, BGB
  75. X = BGL + SPC
  76. GLINE X, LINEC, BGR - SPC, LINEC
  77. Y = BGT + SPC
  78. X2 = X + DAYW * (DRAWD - 1)
  79. GLINE X, Y, X2, Y
  80. Y2 = Y + LINEH * 2
  81. FOR I = 1 TO DRAWD
  82.  GLINE X, Y, X, Y2
  83.  X = X + DAYW
  84. NEXT
  85. GLINE BGL + SPC, Y2, X2, Y2
  86. TX = 1
  87. X = BGL + SPC
  88. Y1 = Y2 + 1
  89. Y2 = Y1 + 1
  90. DAY = NDAY
  91. STEPD = 10
  92. GCOLOR 2
  93. COLOR 1
  94. FOR I = 1 TO DRAWD STEP STEPD
  95.  GLINE X, Y1, X - 1, Y2
  96.  GLINE X, Y1, X + 1, Y2
  97.  GPSET X, Y2
  98.  LOCATE TX, 17
  99.  PRINT DAY
  100.  X = X + STEPD * DAYW
  101.  TX = TX + STEPD
  102.  DAY = DAY + STEPD
  103.  IF DAY > MDAY(NMONTH) THEN NDAY = NDAY - MDAY(NMONTH)
  104. NEXT
  105. GCOLOR 14
  106. TX = 2
  107. TY = 20
  108. X1 = TX * 8 - 4
  109. Y1 = TY * 8 - 4
  110. X2 = 256 - X1
  111. Y2 = Y1 + (8 + 4) * 2
  112. GFILL X1, Y1, X2, Y2, 15
  113. GBOX X1, Y1, X2, Y2
  114. ’---
  115. LOCATE TX, TY
  116. PRINT ”シンタイ   カンシ゛ョウ   チセイ”
  117. Y = TY * 8 + 4
  118. X = 7 * 8
  119. GLINE X, Y, X + 8, Y, 4
  120. X = 16 * 8
  121. GLINE X, Y, X + 8, Y, 2
  122. X = 22 * 8
  123. GLINE X, Y, X + 8, Y, 11
  124. TY = TY + 1
  125. LOCATE TX, TY
  126. PRINT ”チュウイヒ゛”
  127. X1 = (TX + 7) * 8
  128. Y1 = TY * 8
  129. GBOX X1, Y1, X1 + 8, Y1 + 8, 2
  130. GCOLOR 4
  131. BDAY = 23
  132. GOSUB @DRAWLINE
  133. GCOLOR 2
  134. BDAY = 28
  135. GOSUB @DRAWLINE
  136. GCOLOR 11
  137. BDAY = 33
  138. GOSUB @DRAWLINE
  139. GCOLOR 14
  140. X = BGL + SPC - DAYW / 2
  141. Y1 = LINEC - DAYW / 2
  142. Y2 = Y1 + DAYW
  143. FOR I = O TO DRAWD - 1
  144.  IF DDAY(I) THEN GBOX X, Y1, X + DAYW, Y2, 2
  145.  X = X + DAYW
  146. NEXT
  147. ’---
  148. COLOR 0
  149. LOCATE 0,23
  150. PRINT”А=モウイチト゛”;
  151. @LOOP
  152. IF BUTTON()==16 THEN @START
  153. GOTO @LOOP
  154. ’--- 
  155. @CALCDAY
  156. CDAY = DAY
  157. IF MON == 1 THEN @JAN
  158. FOR I = 1 TO MON - 1
  159.  CDAY = CDAY + MDAY(I - 1)
  160. NEXT
  161. ’--- 
  162. @JAN
  163. LEAP = 0
  164. IF MON > 2 THEN GOSUB @CHKLEAP
  165. CDAY = CDAY + LEAP
  166. RETURN
  167. ’--- 
  168. @CHKLEAP
  169. LEAP = 0
  170. IF ((YEAR % 4) == 0) THEN LEAP = 1
  171. IF (YEAR % 400) == 0 THEN RETURN
  172. IF (YEAR % 100) == 0 THEN LEAP = 0
  173. RETURN
  174. ’--- 
  175. @DRAWLINE
  176. DAY = TOTAL
  177. YEAR = NYEAR
  178. MON = NMON
  179. X2 = BGL + SPC
  180. LEAP = 0
  181. GOSUB @CALCBIO
  182. FOR I = 0 TO DRAWD - 2
  183.  X1 = X2
  184.  Y1 = Y2
  185.  DAY = DAY + 1
  186.  X2 = X2 + DAYW
  187.  GOSUB @CALCBIO
  188.  GLINE X1, Y1, X2, Y2
  189.  GOSUB @CHKDDAY
  190. NEXT
  191. Y1 = Y2
  192. DAY = DAY + 1
  193. GOSUB @CALCBIO
  194. I = DRAWD - 1
  195. GOSUB @CHKDDAY
  196. RETURN
  197. ’--- 
  198. @CALCBIO
  199. Y2 = LINEC - SIN(DAY * 2 * PI() / BDAY) * LINEH
  200. RETURN
  201. ’--- 
  202. @CHKDDAY
  203. IF Y1 <= LINEC AND LINEC < Y2 THEN DDAY(I) = TRUE
  204. IF Y1 >= LINEC AND LINEC > Y2 THEN DDAY(I) = TRUE
  205. RETURN
  206. ’--- 
  207. @ERROR
  208. BEEP
  209. PRINT ”エラ-!”
  210. GOTO @INPUTDAY