Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. @name : Angela Castaneda
  2.  
  3. .data
  4. tempRet: .word 1
  5. count: .word 1
  6. nombre: .word 1
  7.  
  8.  
  9. hex: .word 0x12345678, 0xFEDCBA98, 0x01010101, 0x6db6db6d,0xFFFFFFFF,0x00000000
  10.  
  11.  
  12. str1: .asciz "Hex: \t%#010X\t \n"
  13. str2: .asciz "Binary: "
  14. str3: .asciz "CIST\t039\tAngela Castaneda"
  15.  
  16.  
  17. .text
  18. .global main
  19. .func main
  20.  
  21. main:
  22. ldr r1, =tempRet @Place to save return address
  23. str lr, [r1]
  24.  
  25. ldr r1, =count
  26. str lr, [r1]
  27.  
  28.  
  29. ldr r2, =nombre
  30. str lr, [r2]
  31.  
  32. ldr r0, =str3 @prints out my name
  33. bl puts
  34.  
  35.  
  36.  
  37.  
  38. mov r4, #0
  39.  
  40.  
  41.  
  42. DisplayHex:
  43.  
  44. ldr r12, = hex
  45. ldr r6, [r12, r4]
  46.  
  47. ldr r0, = str1
  48. mov r1, r6
  49. bl printf
  50.  
  51. add r4, r4, #1
  52. cmp r4, #5
  53. bne DisplayHex
  54.  
  55.  
  56.  
  57.  
  58. BinaryStuff:
  59. ldr r5, = hex
  60. ldr r6, [r5,r4]
  61.  
  62. ldr r0, = str2
  63. mov r1, r6
  64. bl printf
  65.  
  66. logShift:
  67. lsl r5, #1
  68. bcs addOne
  69. mov r0, #0x30
  70. bal display
  71. addOne:
  72. mov r0, #0x31
  73.  
  74. display:
  75. bl putchar
  76. blt logShift
  77.  
  78.  
  79.  
  80.  
  81. add r4, r4, #1
  82. cmp r4, #5
  83. blt BinaryStuff
  84.  
  85. loop:
  86. ldr r0, = str2 @takes str2 and puts it in r0 after str1 prints out
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. ldr r1, =count @Get the return address back
  94. ldr r4, [r1]
  95.  
  96. ldr r1, =tempRet @Get the return address back
  97. ldr lr, [r1]
  98.  
  99. //bne loop @goes through again if not equal
  100.  
  101.  
  102.  
  103. mov r0 , #0 @0 decimal is the exit code
  104. bx lr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement