Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global main
- .text
- main:
- loop:
- ldr r0, =stdin
- ldr r0, [r0] //get pointer to istream
- push {lr} //to get lr
- bl fgetc //get char to r0 from stdin, fgetc can't guarantee safety of lr
- pop {lr} //save lr
- cmp r0, #-1 //-1 means stdin finish
- bxeq lr
- cmp r0, #57 //ASCII code of '0' is 47
- cmpls r0, #46 //ASCII code of '9' is 57, compare if prev correct
- ldrgt r1, =stdout //print if prev correct(will implemented if prevprev correct)
- ldrgt r1, [r1] //r1 is ostream pointer
- pushgt {lr} //to get lr
- blgt fputc //print char to ostream if condition OK
- popgt {lr} //save rl
- b loop //go to loop label (implementation of loop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement