Advertisement
Z0t

DefCon Badge POV Modfications with strings

Z0t
Aug 12th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '' -------------------------------------------
  2. '' Defcon 20 Badge POV
  3. ''
  4. '' Written by YakPiMP 2012
  5. ''
  6. '' yakhack.wordpress.com
  7. '' Slight modifications by zot to use strings, see http://yakhack.wordpress.com/2012/08/06/compiling-and-running-code-using-propeller-too/#comment-53
  8. '' -------------------------------------------
  9. VAR
  10.  
  11. byte count
  12. byte A[10]
  13. byte B[10]
  14. byte C[10]
  15. byte D[10]
  16. byte E[10]
  17. byte F[10]
  18. byte G[10]
  19. byte H[10]
  20. byte I[10]
  21. byte J[10]
  22. byte K[10]
  23. byte L[10]
  24. byte M[10]
  25. byte N[10]
  26. byte O[10]
  27. byte P[10]
  28. byte Q[10]
  29. byte R[10]
  30. byte S[10]
  31. byte T[10]
  32. byte U[10]
  33. byte V[10]
  34. byte W[10]
  35. byte X[10]
  36. byte Y[10]
  37. byte Z[10]
  38. byte SPACE[8]
  39. byte APOSTROPHE[8]
  40. byte SMILE[10]
  41. byte PERIOD[10]
  42. byte SIN[15]
  43. byte ZIGZAG[15]
  44. byte DICK[25]
  45.  
  46. CON
  47. LED1 = 16
  48. LED2 = 17
  49. LED3 = 18
  50. LED4 = 19
  51. LED5 = 20
  52. LED6 = 21
  53. LED7 = 22
  54. LED8 = 23
  55.  
  56. DELAY = 800
  57.  
  58. DAT 'Zot: This will set the string for DrawWORD, the ", 0" null terminates the string.
  59. DisplayWord byte "BADWOLF ", 0
  60.  
  61. PUB main
  62. InitLetters
  63. repeat 600
  64. DrawWORD
  65.  
  66. PUB DrawWORD | steps, countdw 'Zot: this will draw the letters forwards and then backwards
  67. countdw := 0 'I could reuse "count" but it messed with some debugging...
  68. steps := StrSize (@DisplayWord) 'Steps
  69. repeat steps
  70. case DisplayWord[countdw] 'Zot: I could not figure out how to call @A from "A" directly, so I built the long case statement.
  71. "A": DrawLetter(@A)
  72. "B": DrawLetter(@B)
  73. "C": DrawLetter(@C)
  74. "D": DrawLetter(@D)
  75. "E": DrawLetter(@E)
  76. "F": DrawLetter(@F)
  77. "G": DrawLetter(@G)
  78. "H": DrawLetter(@H)
  79. "I": DrawLetter(@I)
  80. "J": DrawLetter(@J)
  81. "K": DrawLetter(@K)
  82. "L": DrawLetter(@L)
  83. "M": DrawLetter(@M)
  84. "O": DrawLetter(@N)
  85. "N": DrawLetter(@O)
  86. "P": DrawLetter(@P)
  87. "Q": DrawLetter(@Q)
  88. "R": DrawLetter(@R)
  89. "S": DrawLetter(@S)
  90. "T": DrawLetter(@T)
  91. "U": DrawLetter(@U)
  92. "V": DrawLetter(@V)
  93. "W": DrawLetter(@W)
  94. "X": DrawLetter(@X)
  95. "Y": DrawLetter(@Y)
  96. "Z": DrawLetter(@Z)
  97. " ": DrawLetter(@SPACE)
  98. countdw += 1
  99. countdw := 0
  100. repeat steps
  101. case DisplayWord[countdw]
  102. "A": DrawLetterBackward(@A)
  103. "B": DrawLetterBackward(@B)
  104. "C": DrawLetterBackward(@C)
  105. "D": DrawLetterBackward(@D)
  106. "E": DrawLetterBackward(@E)
  107. "F": DrawLetterBackward(@F)
  108. "G": DrawLetterBackward(@G)
  109. "H": DrawLetterBackward(@H)
  110. "I": DrawLetterBackward(@I)
  111. "J": DrawLetterBackward(@J)
  112. "K": DrawLetterBackward(@K)
  113. "L": DrawLetterBackward(@L)
  114. "M": DrawLetterBackward(@M)
  115. "O": DrawLetterBackward(@N)
  116. "N": DrawLetterBackward(@O)
  117. "P": DrawLetterBackward(@P)
  118. "Q": DrawLetterBackward(@Q)
  119. "R": DrawLetterBackward(@R)
  120. "S": DrawLetterBackward(@S)
  121. "T": DrawLetterBackward(@T)
  122. "U": DrawLetterBackward(@U)
  123. "V": DrawLetterBackward(@V)
  124. "W": DrawLetterBackward(@W)
  125. "X": DrawLetterBackward(@X)
  126. "Y": DrawLetterBackward(@Y)
  127. "Z": DrawLetterBackward(@Z)
  128. " ": DrawLetterBackward(@SPACE)
  129. countdw += 1
  130.  
  131. PUB DrawLetter(letter)
  132. count := 1
  133. outa[LED1..LED8] := %00000000
  134.  
  135. repeat byte[letter]
  136. outa[LED1..LED8] := byte[letter + count]
  137. waitcnt(clkfreq/DELAY + cnt)
  138. count += 1
  139.  
  140. PUB DrawLetterBackward(letter)
  141. count := 0
  142. outa[LED1..LED8] := %00000000
  143.  
  144. repeat byte[letter]
  145. outa[LED1..LED8] := byte[letter + (byte[letter] - count)]
  146. waitcnt(clkfreq/DELAY + cnt)
  147. count += 1
  148.  
  149. PUB Wait(waitDelay)
  150. waitcnt(clkfreq/DELAY * waitDelay + cnt)
  151.  
  152. PUB InitLetters
  153. dira[LED1..LED8] := %11111111
  154.  
  155. A[0] := 6
  156. A[1] := %11111111
  157. A[2] := %11111111
  158. A[3] := %11101100
  159. A[4] := %11111111
  160. A[5] := %11111111
  161. A[6] := %0000000
  162.  
  163. B[0] := 5
  164. B[1] := %11111111
  165. B[2] := %11011011
  166. B[3] := %11011011
  167. B[4] := %01100110
  168. B[5] := %00000000
  169.  
  170. C[0] := 6
  171. C[1] := %11111111
  172. C[2] := %11111111
  173. C[3] := %11000011
  174. C[4] := %11000011
  175. C[5] := %11000011
  176. C[6] := %00000000
  177.  
  178. D[0] := 6
  179. D[1] := %11111111
  180. D[2] := %11111111
  181. D[3] := %11000011
  182. D[4] := %01100110
  183. D[5] := %00111100
  184. D[6] := %00000000
  185.  
  186. E[0] := 6
  187. E[1] := %11111111
  188. E[2] := %11111111
  189. E[3] := %11011011
  190. E[4] := %11011011
  191. E[5] := %11000011
  192. E[6] := %00000000
  193.  
  194. F[0] := 6
  195. F[1] := %11111111
  196. F[2] := %11111111
  197. F[3] := %11011000
  198. F[4] := %11011000
  199. F[5] := %11000000
  200. F[6] := %00000000
  201.  
  202. G[0] := 7
  203. G[1] := %11111111
  204. G[2] := %11111111
  205. G[3] := %11000011
  206. G[4] := %11011011
  207. G[5] := %11011011
  208. G[6] := %11011111
  209. G[7] := %00000000
  210.  
  211. H[0] := 7
  212. H[1] := %11111111
  213. H[2] := %11111111
  214. H[3] := %00011000
  215. H[4] := %00011000
  216. H[5] := %11111111
  217. H[6] := %11111111
  218. H[7] := %00000000
  219.  
  220. I[0] := 7
  221. I[1] := %11000011
  222. I[2] := %11000011
  223. I[3] := %11111111
  224. I[4] := %11111111
  225. I[5] := %11000011
  226. I[6] := %11000011
  227. I[7] := %00000000
  228.  
  229. J[0] := 7
  230. J[1] := %11000000
  231. J[2] := %11000000
  232. J[3] := %11111110
  233. J[4] := %11111111
  234. J[5] := %11000011
  235. J[6] := %11000111
  236. J[7] := %00000000
  237.  
  238. K[0] := 6
  239. K[1] := %11111111
  240. K[2] := %11111111
  241. K[3] := %00111100
  242. K[4] := %01100110
  243. K[5] := %11000011
  244. K[6] := %00000000
  245.  
  246. L[0] := 6
  247. L[1] := %11111111
  248. L[2] := %11111111
  249. L[3] := %00000011
  250. L[4] := %00000011
  251. L[5] := %00000011
  252. L[6] := %00000000
  253.  
  254. M[0] := 8
  255. M[1] := %11111111
  256. M[2] := %11111111
  257. M[3] := %01100000
  258. M[4] := %00111000
  259. M[5] := %01100000
  260. M[6] := %11111111
  261. M[7] := %11111111
  262. M[8] := %00000000
  263.  
  264. N[0] := 8
  265. N[1] := %11111111
  266. N[2] := %11111111
  267. N[3] := %01110000
  268. N[4] := %00011000
  269. N[5] := %00011100
  270. N[6] := %11111111
  271. N[7] := %11111111
  272. N[8] := %00000000
  273.  
  274. O[0] := 7
  275. O[1] := %11111111
  276. O[2] := %11111111
  277. O[3] := %11000011
  278. O[4] := %11000011
  279. O[5] := %11111111
  280. O[6] := %11111111
  281. O[7] := %00000000
  282.  
  283. P[0] := 6
  284. P[1] := %11111111
  285. P[2] := %11111111
  286. P[3] := %11001100
  287. P[4] := %11001100
  288. P[5] := %01111000
  289. P[6] := %00000000
  290.  
  291. Q[0] := 8
  292. Q[1] := %00000110
  293. Q[2] := %11111111
  294. Q[3] := %11111111
  295. Q[4] := %11001011
  296. Q[5] := %11000011
  297. Q[6] := %11111111
  298. Q[7] := %11111111
  299. Q[8] := %00000000
  300.  
  301. R[0] := 6
  302. R[1] := %11111111
  303. R[2] := %11111111
  304. R[3] := %11001100
  305. R[4] := %11001111
  306. R[5] := %01111001
  307. R[6] := %00000000
  308.  
  309. S[0] := 5
  310. S[1] := %01100011
  311. S[2] := %11110011
  312. S[3] := %11010011
  313. S[4] := %11001110
  314. S[5] := %00000000
  315.  
  316. T[0] := 7
  317. T[1] := %11000000
  318. T[2] := %11000000
  319. T[3] := %11111111
  320. T[4] := %11111111
  321. T[5] := %11000000
  322. T[6] := %11000000
  323. T[7] := %00000000
  324.  
  325. U[0] := 7
  326. U[1] := %11111111
  327. U[2] := %11111111
  328. U[3] := %00000011
  329. U[4] := %00000011
  330. U[5] := %11111111
  331. U[6] := %11111111
  332. U[7] := %00000000
  333.  
  334. V[0] := 7
  335. V[1] := %11111000
  336. V[2] := %11111110
  337. V[3] := %00000011
  338. V[4] := %00000011
  339. V[5] := %11111110
  340. V[6] := %11111000
  341. V[7] := %00000000
  342.  
  343. W[0] := 8
  344. W[1] := %11111111
  345. W[2] := %11111111
  346. W[3] := %00000110
  347. W[4] := %00011100
  348. W[5] := %00000110
  349. W[6] := %11111111
  350. W[7] := %11111111
  351. W[8] := %00000000
  352.  
  353. X[0] := 6
  354. X[1] := %11100111
  355. X[2] := %01111110
  356. X[3] := %00011000
  357. X[4] := %01111110
  358. X[5] := %11100111
  359. X[6] := %00000000
  360.  
  361. Y[0] := 7
  362. Y[1] := %11100000
  363. Y[2] := %01111000
  364. Y[3] := %00011111
  365. Y[4] := %00011111
  366. Y[5] := %01111000
  367. Y[6] := %11100000
  368. Y[7] := %00000000
  369.  
  370. Z[0] := 6
  371. Z[1] := %11000011
  372. Z[2] := %11001111
  373. Z[3] := %11011011
  374. Z[4] := %11110011
  375. Z[5] := %11000011
  376. Z[6] := %00000000
  377.  
  378. SPACE[0] := 5
  379. SPACE[1] := %00000000
  380. SPACE[2] := %00000000
  381. SPACE[3] := %00000000
  382. SPACE[4] := %00000000
  383. SPACE[5] := %00000000
  384.  
  385. APOSTROPHE[0] := 3
  386. APOSTROPHE[1] := %11100000
  387. APOSTROPHE[2] := %11100000
  388. APOSTROPHE[3] := %00000000
  389.  
  390. SMILE[0] := 8
  391. SMILE[1] := %01111110
  392. SMILE[2] := %10000001
  393. SMILE[3] := %10110101
  394. SMILE[4] := %10000101
  395. SMILE[5] := %10110101
  396. SMILE[6] := %10000001
  397. SMILE[7] := %01111110
  398. SMILE[8] := %00000000
  399.  
  400. Period[0] := 3
  401. Period[1] := %00000111
  402. Period[2] := %00000111
  403. Period[3] := %00000000
  404.  
  405. ZIGZAG[0] := 12
  406. ZIGZAG[1] := %11000000
  407. ZIGZAG[2] := %01100000
  408. ZIGZAG[3] := %00110000
  409. ZIGZAG[4] := %00011000
  410. ZIGZAG[5] := %00001100
  411. ZIGZAG[6] := %00000110
  412. ZIGZAG[7] := %00000011
  413. ZIGZAG[8] := %00000110
  414. ZIGZAG[9] := %00001100
  415. ZIGZAG[10] := %00011000
  416. ZIGZAG[11] := %00110000
  417. ZIGZAG[12] := %01100000
  418.  
  419. SIN[0] := 8
  420. SIN[1] := %11100000
  421. SIN[2] := %11100000
  422. SIN[3] := %00111000
  423. SIN[4] := %00011100
  424. SIN[5] := %00000111
  425. SIN[6] := %00000111
  426. SIN[7] := %00011100
  427. SIN[8] := %00111000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement