Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 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. mov r4,#0
  66. logShift:
  67. lsls r6, #1
  68. bcs addOne
  69. mov r0, #0x30
  70. bal display
  71. addOne:
  72. mov r0, #0x31
  73.  
  74. display:
  75. bl putchar
  76. add r4,r4, #1
  77.  
  78. cmp r4, #32
  79. blt logShift
  80.  
  81.  
  82.  
  83. add r4, r4, #1
  84. cmp r4, #5
  85. blt BinaryStuff
  86.  
  87. loop:
  88. ldr r0, = str2 @takes str2 and puts it in r0 after str1 prints out
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. ldr r1, =count @Get the return address back
  96. ldr r4, [r1]
  97.  
  98. ldr r1, =tempRet @Get the return address back
  99. ldr lr, [r1]
  100.  
  101. //bne loop @goes through again if not equal
  102.  
  103.  
  104.  
  105. mov r0 , #0 @0 decimal is the exit code
  106. bx lr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement