Python-ELMO is a Python library which offers an encapsulation of the binary tool ELMO, in order to manipulate it easily in Python and SageMath script.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

elmoasmfunctions.s 4.6KB

  1. ##
  2. ## University of Bristol – Open Access Software Licence
  3. ## Copyright (c) 2016, The University of Bristol, a chartered
  4. ## corporation having Royal Charter number RC000648 and a charity
  5. ## (number X1121) and its place of administration being at Senate
  6. ## House, Tyndall Avenue, Bristol, BS8 1TH, United Kingdom.
  7. ## All rights reserved
  8. ##
  9. ## Redistribution and use in source and binary forms, with or without
  10. ## modification, are permitted provided that the following conditions
  11. ## are met:
  12. ##
  13. ## 1. Redistributions of source code must retain the above copyright
  14. ## notice, this list of conditions and the following disclaimer.
  15. ##
  16. ## 2. Redistributions in binary form must reproduce the above
  17. ## copyright notice, this list of conditions and the following
  18. ## disclaimer in the documentation and/or other materials provided
  19. ## with the distribution.
  20. ##
  21. ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. ## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. ## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. ## FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. ## COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  26. ## INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27. ## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. ## SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. ## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  30. ## STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  31. ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  32. ## OF THE POSSIBILITY OF SUCH DAMAGE.
  33. ##
  34. ## Any use of the software for scientific publications or commercial
  35. ## purposes should be reported to the University of Bristol
  36. ## (OSI-notifications@bristol.ac.uk and quote reference 2668). This is
  37. ## for impact and usage monitoring purposes only.
  38. ##
  39. ## Enquiries about further applications and development opportunities
  40. ## are welcome. Please contact elisabeth.oswald@bristol.ac.uk
  41. ##
  42. .syntax unified
  43. .text
  44. .thumb
  45. .func starttrigger
  46. .global starttrigger
  47. starttrigger:
  48. push {r0-r7}
  49. movs r4, #0xE0
  50. lsls r4, #24
  51. movs r5, #0x04
  52. eors r4, r5
  53. movs r5, #1
  54. str r5, [r4, #0]
  55. pop {r0-r7}
  56. bx lr
  57. .endfunc
  58. .func endtrigger
  59. .global endtrigger
  60. endtrigger:
  61. push {r0-r7}
  62. movs r4, #0xE0
  63. lsls r4, #24
  64. movs r5, #0x04
  65. eors r4, r5
  66. movs r5, #0
  67. str r5, [r4, #0]
  68. pop {r0-r7}
  69. bx lr
  70. .endfunc
  71. .func readbyte
  72. .global readbyte
  73. readbyte:
  74. push {r0-r7}
  75. movs r4, #0xE1
  76. lsls r4, #24
  77. ldr r1, [r4, #0]
  78. strb r1, [r0, #0]
  79. pop {r0-r7}
  80. bx lr
  81. .endfunc
  82. .func LoadN
  83. .global LoadN
  84. LoadN:
  85. push {r0-r7}
  86. movs r4, #0xE1
  87. lsls r4, #24
  88. movs r5, #0x10
  89. eors r4, r5
  90. ldr r1, [r4, #0]
  91. str r1, [r0, #0]
  92. pop {r0-r7}
  93. bx lr
  94. .endfunc
  95. .func randbyte
  96. .global randbyte
  97. randbyte:
  98. push {r0-r7}
  99. movs r4, #0xE1
  100. lsls r4, #24
  101. movs r5, #0x04
  102. eors r4, r5
  103. ldr r1, [r4, #0]
  104. strb r1, [r0, #0]
  105. pop {r0-r7}
  106. bx lr
  107. .endfunc
  108. .func getstart
  109. .global getstart
  110. getstart:
  111. push {r0-r7}
  112. movs r4, #0xE1
  113. lsls r4, #24
  114. movs r5, #0x08
  115. eors r4, r5
  116. ldr r1, [r4, #0]
  117. str r1, [r0, #0]
  118. pop {r0-r7}
  119. bx lr
  120. .endfunc
  121. .func getruncount
  122. .global getruncount
  123. getruncount:
  124. push {r0-r7}
  125. movs r4, #0xE1
  126. lsls r4, #24
  127. movs r5, #0x0C
  128. eors r4, r5
  129. ldr r1, [r4, #0]
  130. str r1, [r0, #0]
  131. pop {r0-r7}
  132. bx lr
  133. .endfunc
  134. .func printbyte
  135. .global printbyte
  136. printbyte:
  137. push {r0-r7}
  138. movs r4, #0xE0
  139. lsls r4, #24
  140. ldrb r5, [r0]
  141. str r5, [r4]
  142. pop {r0-r7}
  143. bx lr
  144. .endfunc
  145. .func endprogram
  146. .global endprogram
  147. endprogram:
  148. push {r0-r7}
  149. movs r4, #0xF0
  150. lsls r4, #24
  151. movs r5, #0
  152. str r5, [r4]
  153. pop {r0-r7}
  154. bx lr
  155. .endfunc
  156. .func initialisemaskflow
  157. .global initialisemaskflow
  158. # Takes address of key as input (r0)
  159. initialisemaskflow:
  160. push {r0-r7}
  161. movs r4, #0xE0
  162. lsls r4, #24
  163. movs r5, #0x40
  164. eors r4, r5
  165. str r0, [r4]
  166. pop {r0-r7}
  167. bx lr
  168. .endfunc
  169. .func resetmaskflow
  170. .global resetmaskflow
  171. resetmaskflow:
  172. push {r0-r7}
  173. movs r4, #0xE0
  174. lsls r4, #24
  175. movs r5, #0x42
  176. eors r4, r5
  177. movs r5, #0
  178. str r5, [r4]
  179. pop {r0-r7}
  180. bx lr
  181. .endfunc
  182. .func setmaskflowstart
  183. .global setmaskflowstart
  184. # Takes r0 as start number
  185. setmaskflowstart:
  186. push {r0-r7}
  187. movs r4, #0xE0
  188. lsls r4, #24
  189. movs r5, #0x44
  190. eors r4, r5
  191. str r0, [r4]
  192. pop {r0-r7}
  193. bx lr
  194. .endfunc
  195. .func resetdatafile
  196. .global resetdatafile
  197. resetdatafile:
  198. push {r0-r7}
  199. movs r4, #0xE0
  200. lsls r4, #24
  201. movs r5, #0x46
  202. eors r4, r5
  203. movs r5, #0
  204. str r5, [r4]
  205. pop {r0-r7}
  206. bx lr
  207. .endfunc