daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. yqm15fqu@cmp-16pi-16 ARMCW]$ cat test | ./cw2
  2. ^C
  3. [yqm15fqu@cmp-16pi-16 ARMCW]$ nano cw2.s
  4. [yqm15fqu@cmp-16pi-16 ARMCW]$ cat test | ./cw2
  5. ^X^C
  6. [yqm15fqu@cmp-16pi-16 ARMCW]$ nano cw2.s
  7.   GNU nano 2.8.6                                        File: cw2.s
  8.  
  9. @print.s
  10. .data
  11. string: .word 0
  12. char: .asciz "%c"
  13. .text
  14.         .global main
  15.         .extern printf
  16. main:
  17.  
  18.  
  19.         PUSH {r4,lr}
  20.  
  21.         MOV r5,r0
  22.         MOV r6,r1
  23. @       LDR r0,=pattern
  24. @       LDR r1,=string
  25. @       BL scanf
  26.  
  27. getchar:
  28.  
  29.         BL getchar
  30.         ADDS r0, #1
  31.         BEQ end
  32.  
  33.         MOV r1, r0
  34.         CMP r1, #90
  35.         BLE remcaps
  36.  
  37.  
  38.  
  39. remcaps:
  40.  
  41.         CMP r0, #65
  42.         BLE end
  43.  
  44.         ADD r0, #32
  45.         BL end
  46.  
  47.  
  48.  
  49. @       LDR r0,=string
  50. @       BL printf
  51.  
  52. @       MOV r2, #1
  53. @loop:
  54. @       CMP r2, #6
  55. @       bgt end
  56. @       LDR r0,=string
  57. @       BL printf
  58. @       add r2,r2,#1
  59. @       b loop
  60. @
  61.  
  62. @get:
  63. @       CMP r1, #10
  64. @       bgt end
  65. @       BL getchar
  66. @       ADD r0, r1
  67. @       b get
  68.  
  69.  
  70. end:
  71.  
  72. @       LDR r0,=string
  73. @       BL printf
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top