Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. .global main
  2. .text
  3.  
  4.  
  5. main:
  6. loop:
  7. ldr r0, =stdin
  8. ldr r0, [r0] //get pointer to istream
  9. push {lr} //to get lr
  10. bl fgetc //get char to r0 from stdin, fgetc can't guarantee safety of lr
  11. pop {lr} //save lr
  12. cmp r0, #-1 //-1 means stdin finish
  13. bxeq lr
  14. cmp r0, #57 //ASCII code of '0' is 47
  15. cmpls r0, #46 //ASCII code of '9' is 57, compare if prev correct
  16. ldrgt r1, =stdout //print if prev correct(will implemented if prevprev correct)
  17. ldrgt r1, [r1] //r1 is ostream pointer
  18. pushgt {lr} //to get lr
  19. blgt fputc //print char to ostream if condition OK
  20. popgt {lr} //save rl
  21. b loop //go to loop label (implementation of loop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement