Wistaro

MOLECULOR_TermS_z80

Jun 4th, 2015
903
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //For more informations: http://bit.ly/MOLECULORTI
  2. //Created by Wistaro
  3.  
  4. AxesOff:GridOff
  5. 0->Xmin:0->Ymin
  6. 1->DeltaX:1->DeltaY
  7. ClrDraw
  8. Text(39,10,"A Program
  9. For(C,43,49
  10. Circle(C+13,10,C-40,{[i]
  11. End
  12. Text(~1,39,10,"
  13. Text(39,15,"By
  14. For(C,42,47,1
  15. Circle(C,50,C-40,{[i]
  16. End
  17. Text(~1,39,15,"
  18. Text(39,10,"Wistaro
  19. For(B,20,37,1
  20. Circle(B,20,B-40,{[i]
  21. End
  22. Line(33,35,42,48
  23. Line(44,46,34,32
  24. Line(55,13,41,18
  25. Line(53,10,35,16
  26. Line(24,44,24,60
  27. Line(24,60,30,55
  28. Line(30,55,36,60
  29. Line(36,60,36,44
  30. Text(10,58,"L E C U L O R
  31. Line(56,44,92,44
  32. Text(57,75,"v1.0.1
  33. StorePic 3
  34. Lbl M1
  35. DelVar V:RecallPic 3
  36. Text(35,60,"Quitter
  37. Text(21,60,"Saisir
  38. Text(28,60,"A propos
  39. 38->A
  40. Repeat K=105
  41. getKey->K
  42. A+7(K=25 and A!=38)-7(K=34 and A!=24->A
  43. If K:Then
  44. Pt-Off(56,24,2
  45. Pt-Off(56,38,2
  46. Pt-Off(56,31,2
  47. End
  48. Pt-On(56,A,2
  49. End
  50. If A=24:Goto Q
  51. If A=38:Goto S
  52. If A=31:Goto AW
  53. Lbl AW
  54. ClrDraw
  55. Text(0,30,"MOLECULOR
  56. Text(13,21,"Cree par Wistaro
  57. Text(27,0,"Prix programmation
  58. Text(34,0,"TIPlanet.org - 2015
  59. Text(49,0,"+d'infos:
  60. Text(56,0,"http://bit.ly/MOLECULOR
  61. Pause :ClrDraw:Goto M1
  62. Lbl Q
  63. DelVar [D]DelVar |LM:ClrDraw:ClrHome:Disp "
  64. Stop
  65. Lbl S
  66. ClrHome
  67. Output(4,1,"Rentre molecule:
  68. Output(5,1,"****************
  69. Output(8,1,"[!]: MAJUSCULES
  70. Output(6,1,"[!]: - pas ~
  71. Output(7,1,"[!]: DE pas D'
  72. Input "?>",Str1
  73. ClrHome:ClrDraw
  74. Goto MF
  75. Lbl M2
  76. DelVar VClrDraw:RecallPic 3
  77. For(A,5,0,~1
  78. Line(73,A,94,A,0
  79. End
  80. If length(Str9)<=23:Text(57,0,Str9
  81. Text(35,60,"Form brute
  82. Text(21,60,"Fiche infos
  83. Text(28,60,"Affichage
  84. 38->A
  85. Repeat K=105
  86. getKey->K
  87. If K=45:Then:ClrDraw:Goto M1:End
  88. A+7(K=25 and A!=38)-7(K=34 and A!=24->A
  89. If K:Then
  90. Pt-Off(56,24,2
  91. Pt-Off(56,38,2
  92. Pt-Off(56,31,2
  93. End
  94. Pt-On(56,A,2
  95. End
  96. ClrDraw
  97. If A=38:Goto MG
  98. If A=24:Then:9->V:Goto AP:End
  99. If A=31:Goto AP
  100. Lbl MG
  101. ClrDraw:RecallPic 4
  102. Pause :Goto M2
  103. Lbl MF
  104. "METHETHPROPBUTPENTHEXHEPTOCT->Str2
  105. DelVar |LM"ANEENEOLALONEOIQUEAMINEAMIDEOATE->Str3
  106. 15->dim(|LM
  107. {1,3,4,3,7,2,9,2,11,3,14,5,19,5,24,5,29,4->L2
  108. {1,4,5,3,8,4,12,3,15,4,19,3,22,4,26,3->L1
  109. Str1->Str9
  110. DelVar IinString(Str1,")-->I
  111. If I:Then
  112. inString("ZERS",sub(Str1,I-1,1->|LM(11
  113. sub(Str1,I+2,length(Str1)-(I+1->Str1
  114. End
  115. "--
  116. If I:"stereo"
  117. Text(45,0,"Isomerie: ",Ans,"/",sub("-ZERS",|LM(11)+1,1
  118. DelVar I
  119. inString(Str1,"-->A
  120. If not(A:Goto 3
  121. If inString(sub(Str1,A+1,3),"-":Goto 3
  122.  
  123. DelVar B
  124. If inString(sub(Str1,A,length(Str1)-A),"METHYL":Then:Ans->J:1->I:End
  125. If not(I) and inString(sub(Str1,A,length(Str1)-A),"ETHYL":Then:Ans->J:2->I:End
  126. 1->D
  127. (sub(Str1,A+1,2)="DI")->E
  128. For(B,A-1,1,~1
  129. D+1->D
  130. If sub(Str1,B,1)!=",":Then:expr(sub(Str1,B,1->C
  131. B-1->B:End
  132. C->|LM(D+1
  133. I->|LM(D+5
  134. If E:Then
  135. C->|LM(D+3
  136. I->|LM(D+7
  137. End:End
  138. sub(Str1,J+(8-I),length(Str1)-(J+(7-I->Str1
  139. Lbl 3
  140. Text(31,0,"Ramif pos carb: ",|LM(3),",",|LM(4),",",|LM(5),",",|LM(6
  141. Text(38,0,"Ramif nbr carb: ",|LM(7),",",|LM(8),",",|LM(9),",",|LM(10
  142. inString(Str1," DE"->K
  143. If K:Then
  144. sub(Str1,K+4,1+length(Str1)-(K+4->Str6
  145. sub(Str1,1,K-1->Str1
  146. End
  147. DelVar B
  148. For(A,1,15,2
  149. If not(B) and inString(Str1,sub(Str2,L1(A),L1(A+1:A->B
  150. End
  151. round(B/2,0->|LM(1
  152. DelVar B
  153. For(A,1,18,2
  154. If not(B) and inString(Str1,sub(Str3,L2(A),L2(A+1:Then:A->B
  155. End:End
  156. max((B=seq(theta,theta,1,17,2))(seq(theta,theta,1,9,1->|LM(2
  157. If |LM(2)=9:Then
  158. DelVar B
  159. For(A,1,15,2
  160. If not(B) and inString(Str6,sub(Str2,L1(A),L1(A+1:Then:A->B:End
  161. End
  162. round(B/2,0->|LM(14
  163. Text(24,57,"[Alk: ",Ans,"]"
  164.  
  165. End
  166. 1->|LM(12
  167. DelVar thetaIf B:inString(Str1,"-"+sub(Str3,L2(B),L2(B+1->theta
  168. If theta:expr(sub(Str1,theta-1,1))->|LM(12
  169. Text(52,0,"Place gr carac: ",|LM(12
  170. Lbl 1
  171. Horizontal 54
  172. If length(Str9)<=23:Then
  173. Str9:Else
  174. "Info Molecule:
  175. End
  176. Text(0,0,Ans
  177. Text(10,0,"Nb Carb (chn principale): ",|LM(1
  178. |LM(2->F
  179. If not(F:"Inconnu
  180. If F=1:"ALCANE
  181. If F=2:"ALCENE
  182. If F=3:"ALCOOL
  183. If F=4:"ALDEHYDE
  184. If F=5:"CETONE
  185. If F=6:"ACD CARBOXYLQ
  186. If F=7:"AMINE
  187. If F=8:"AMIDE
  188. If F=9:"ESTER
  189. Text(17,0,"Fam/Fonct: ",Ans
  190. If F=3:"HYDROXYLE/OH
  191. If F=4 or F=5:"CARBONYLE
  192. If F=6:"CARBOXYLE
  193. Text(24,0,"Gr carac: ",Ans
  194. StorePic 4
  195. Pause :Goto M2
  196. Lbl AP
  197. ClrDraw
  198. If |LM(1)>7 or (|LM(1)+|LM(14))>7:Goto M2
  199. seq(theta,theta,1,94,6->L4
  200. seq(theta,theta,3,60,7->L5
  201. DelVar [D]{9,16->dim([D]
  202. |LM(1->N
  203. "COHN='-OH''IIC-C"->Str1
  204. If length(Str9)<=23:Text(0,0,Str9
  205. Horizontal 55
  206.  
  207. Text(57,1,"C h a r g e m e n t . . .
  208. Horizontal 6
  209. For(A,1,N
  210. 1->[D](5,2A+1
  211. If A<N:7->[D](5,2A+2
  212. End
  213. 3->A:2->B
  214. {|LM(3),|LM(4),|LM(5),|LM(6)->L1
  215. {|LM(7),|LM(8),|LM(9),|LM(10)->L2
  216. For(theta,1,4
  217. L1(theta)->A
  218. L2(theta)->B
  219. DelVar Y
  220. If B=1:Then
  221. If [D](3,2A+1):2->Y
  222. 1->[D](3+2Y,2A+1
  223. 6->[D](4+Y,2A+1
  224. DelVar Y:End
  225.  
  226. If B=2:Then
  227. If [D](3,2A+1:2->Y
  228. 14->[D](3+2Y,2A+1
  229. 6->[D](4+Y,2A+1
  230. DelVar Y:End
  231. End
  232. |LM(12->P:|LM(2->F:|LM(14->E
  233. If F=4 or F=6 or F=9 or F=8:Then
  234. 10->[D](4,2N+1
  235. 2->[D](3,2N+1
  236. 6->[D](6,2N+1
  237. End
  238. If F=4:3->[D](7,2N+1
  239. If F=6:8->[D](7,2N+1
  240. If F=8:4->[D](7,2N+1
  241. If F=9:Then
  242. 2->[D](7,2N+1
  243. 7->[D](7,2N+2
  244. 2->H
  245. For(A,1,E
  246. 1->[D](7,2N+A+H
  247. If A!=E:7->[D](7,2N+A+1+H
  248. H+1->H
  249. End
  250. End
  251. If F=2:5->[D](5,2P+2
  252. If F=3 or F=5 or F=7:Then
  253. DelVar ADelVar B
  254. If P>1:Then
  255. If [D](4,2P+1:Then
  256. 6->A:7->B
  257. Else
  258. 4->A:3->B
  259. End:End:End
  260. If F=3:Then
  261. If P=1:Then
  262. 7->[D](5,2:2->[D](5,1
  263. Else
  264. 6->[D](A,2P+1:8->[D](B,2P+1
  265. End:End
  266. If F=5:Then
  267. If P=1:Then
  268. 5->[D](5,2:2->[D](5,1
  269. Else
  270. 10->[D](A,2P+1:2->[D](B,2P+1
  271. End:End
  272. If F=7:Then
  273. If P=1:Then
  274. 7->[D](5,2:4->[D](5,1
  275. Else
  276. 6->[D](A,2P+1:4->[D](B,2P+1
  277. End:End
  278. If V=9:Goto FB
  279. Lbl A2
  280. For(A,1,9
  281. For(B,1,16
  282. [D](A,B->D
  283. (D>=11)+1+int(D/8->C
  284. If D:Text(L5(A),L4(B),sub(Str1,D,C
  285. End:End
  286. StorePic 5
  287. Lbl A
  288. Text(57,0,"[[i]]Liaisons
  289. Text(57,37," Quitter
  290. Line(36,6,36,0
  291. Repeat K=13 or K=14
  292. getKey->K
  293. If K=11 or K=12:Goto H
  294. End
  295. Goto M2
  296. Lbl 1
  297. Lbl H
  298. ClrDraw
  299. Horizontal 54
  300. Horizontal 38
  301. Text(~1,0,0,"[[i]] Liaisons [[i]]
  302. Text(10,7,"{!} PAS OUBLIER LES H {!}
  303. Text(17,20,"dans la molecule
  304. Text(30,0,"Carbone (C): 4
  305. Text(37,0,"Oxigene (O): 2
  306. Text(45,0,"Hydrogene (H): 1
  307. Text(52,0,"Azote (N): 3
  308. Pause
  309. ClrDraw:RecallPic 5:Goto A
  310. Lbl FB
  311. DelVar CDelVar ODelVar NDelVar HDelVar T
  312. For(A,3,8
  313. For(B,1,16
  314. T+1->T
  315. Text(57,80,round(100T/96,0
  316. H+([D](A,B)=3->H
  317. If [D](A,B)=8:Then
  318. O+1->O
  319. H+1->H
  320. End
  321.  
  322. If [D](A,B)=1:Then
  323. C+1->C
  324. H+4->H
  325. H-([D](A+1,B)=6->H
  326. H-([D](A-1,B)=6->H
  327. H-2([D](A+1,B)=10->H
  328. H-2([D](A-1,B)=10->H
  329. If B>1:Then
  330. H-([D](A,B-1)=7->H
  331. H-2([D](A,B-1)=5->H
  332. End
  333. If B<16:Then
  334. H-([D](A,B+1)=7->H
  335. H-2([D](A,B+1)=5->H
  336. End:End
  337. [D](A,B)=14
  338. H+5(Ans->H
  339. C+2([D](A,B)=14->C
  340. If [D](A,B)=2:Then
  341. O+1->O
  342. H+2->H
  343. H-([D](A,B+1)=7->H
  344. H-2([D](A,B+1)=5->H
  345. H-([D](A-1,B)=6->H
  346. H-2([D](A-1,B)=10->H
  347. H-([D](A+1,B)=6->H
  348. H-2([D](A+1,B)=10->H
  349. End
  350. If [D](A,B)=4:Then
  351. N+1->N
  352. H+3->H
  353. H-([D](A,B+1)=7->H
  354. H-2([D](A,B+1)=5->H
  355. H-([D](A+1,B)=6->H
  356. H-([D](A-1,B)=6->H
  357. H-2([D](A+1,B)=10->H
  358. H-2([D](A-1,B)=10->H
  359. End
  360. End:End
  361. Text(10,5,"Atomes dans la molecule:
  362. Text(22,12,"Carbone: ",C
  363. Text(29,12,"Hydrogene: ",H
  364. Text(43,12,"Azote: ",N
  365. Text(36,12,"Oxygene: ",O
  366. For(T,5,0,~1
  367. Line(0,T,94,T,0
  368. End
  369. Text(57,0,"Formule brute:
  370. Text(57,53,"C",C," H",H," O",O," N",N
  371. Pause :DelVar VClrDraw:Goto M2
RAW Paste Data