5.106 · exercise

Predict: external data

How bytes land in .data: the size of each directive, what a string literal costs, how a table of addresses is indexed, and what happens to a total kept in .bss, outside any stack frame.

0 of 5 correct

Predict the result

        .data
flag_m:     .byte 1
year_m:     .hword 2026
total_m:    .dword 0

Predict the result

        .data
mer_m:      .string "mercury"
ven_m:      .string "venus"
ear_m:      .string "earth"
mar_m:      .string "mars"
jup_m:      .string "jupiter"

        .balign 8
planet_m:   .dword mer_m, ven_m, ear_m, mar_m, jup_m

Predict the result

        .data
msg_m:  .string "Hello"

Predict the result

        .bss
        .balign 4
tally_m:    .skip 4

        .text
        .balign 4
add_tally:
        ldr     x11, =tally_m
        ldr     w12, [x11]
        add     w12, w12, w0
        str     w12, [x11]
        ret

Predict the result

        .data
mer_m:      .string "mercury"
ven_m:      .string "venus"
ear_m:      .string "earth"
mar_m:      .string "mars"
jup_m:      .string "jupiter"

        .balign 8
planet_m:   .dword mer_m, ven_m, ear_m, mar_m, jup_m