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.

59 lines
1.9KB

  1. /***************************************************************************
  2. * Copyright (C) 2010 by Spencer Oliver *
  3. * spen@spen-soft.co.uk *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
  19. ***************************************************************************/
  20. /*
  21. r0 - address in - crc out
  22. r1 - char count
  23. */
  24. .text
  25. .arm
  26. _start:
  27. main:
  28. mov r2, r0
  29. mov r0, #0xffffffff /* crc */
  30. mov r3, r1
  31. mov r4, #0
  32. b ncomp
  33. nbyte:
  34. ldrb r1, [r2, r4]
  35. ldr r7, CRC32XOR
  36. eor r0, r0, r1, asl #24
  37. mov r5, #0
  38. loop:
  39. cmp r0, #0
  40. mov r6, r0, asl #1
  41. add r5, r5, #1
  42. mov r0, r6
  43. eorlt r0, r6, r7
  44. cmp r5, #8
  45. bne loop
  46. add r4, r4, #1
  47. ncomp:
  48. cmp r4, r3
  49. bne nbyte
  50. end:
  51. bkpt #0
  52. CRC32XOR: .word 0x04c11db7
  53. .end