5.126 · exercise

Predict: strings

Work out the character codes, lengths, and numbers that byte loads, byte stores, and the strlen function leave behind.

0 of 5 correct

Predict the result

        .data
chip_m: .string "ARM64"

        .text
        ldr     x19, =chip_m
        ldrb    w20, [x19, 2]

Predict the result

        mov     w20, 'k'
        eor     w21, w20, 0x20

Predict the result

        .data
num_m:  .string "58"

        .text
        ldr     x19, =num_m
        ldrb    w20, [x19]
        ldrb    w21, [x19, 1]
        sub     w20, w20, '0'
        sub     w21, w21, '0'
        mov     w22, 10
        madd    w23, w20, w22, w21

Predict the result

        .data
part_m: .ascii  "fire"
rest_m: .string "fly"

        .text
        ldr     x0, =part_m
        bl      strlen

Predict the result

        .data
food_m: .string "sandwich"

        .text
        ldr     x19, =food_m
        strb    wzr, [x19, 4]
        mov     x0, x19
        bl      strlen