This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.data | |
.balign 4 | |
strbuf: .skip 25 | |
.set strbuf_sz, . - strbuf | |
.balign 4 | |
newline: .ascii "\n" | |
.set newline_sz, . - newline | |
.text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.data | |
.balign 4 | |
zero_file: .string "/dev/zero" | |
.balign 4 | |
fail_open_msg: .ascii "cannot open /dev/zero!\n" | |
.set fail_open_msg_sz, . - fail_open_msg | |
.balign 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; input01.s.arm | |
.data | |
.balign 4 ; scanf format | |
in_format: .asciz "%d" | |
.balign 4 ; printf format | |
out_format: .asciz "%d\n" | |
.balign 4 ; read number from stdin | |
input_num: .word 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* array03.s.arm */ | |
.data | |
.balign 4 // array of 100 integers (4 bytes each) | |
a: .skip 400 | |
.balign 4 // struct of 1 char and 1 integer | |
s: .skip 8 // 8 bytes in total for padding (4-byte aligned) | |
.text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.global main | |
; r0 = accumulator | |
; r1 = first | |
; r2 = second | |
; r3 = step | |
main: | |
mov r1, #0 | |
mov r2, #1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; loop02.s.arm | |
.text | |
.global main | |
main: | |
mov r0, #0 ; accumulator | |
mov r1, #1 ; step | |
b check_loop | |
loop: | |
add r0, r1 ; accumulator += step | |
add r1, #1 ; step += 1 |
NewerOlder