ARM application development SDK for MNT ZZ9000 graphics and coprocessor card for classic Amiga computers.
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.

uwrite8.S 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Runtime ABI for the ARM Cortex-M0
  2. * uread4.S: unaligned memory read
  3. *
  4. * Copyright (c) 2017 Jörg Mische <bobbl@gmx.de>
  5. *
  6. * Permission to use, copy, modify, and/or distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  16. * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. .syntax unified
  19. .text
  20. .thumb
  21. .cpu cortex-m0
  22. @ int __aeabi_uwrite8(long longt r1:r0, void *r2)
  23. @
  24. @ Write 8 little endian bytes to unaligned memory address
  25. @
  26. .thumb_func
  27. .global __aeabi_uwrite8
  28. __aeabi_uwrite8:
  29. lsrs r3, r2, #1
  30. bcc .Lhalfword_aligned
  31. strb r0, [r2]
  32. adds r2, #1
  33. lsrs r0, r0, #8
  34. strh r0, [r2]
  35. lsrs r0, r0, #16
  36. lsls r3, r1, #8
  37. orrs r0, r3
  38. strh r0, [r2, #2]
  39. lsrs r1, r1, #8
  40. strh r1, [r2, #4]
  41. lsrs r1, r1, #16
  42. strb r1, [r2, #6]
  43. bx lr
  44. .Lhalfword_aligned:
  45. strh r0, [r2]
  46. lsrs r0, r0, #16
  47. strh r0, [r2, #2]
  48. strh r1, [r2, #4]
  49. lsrs r1, r1, #16
  50. strh r1, [r2, #6]
  51. bx lr