[COMP1521] Wk3 TUT Directives

Question 2:

a: .word 42 -> Label:a Value:42

b: .space 4 -> Lable:b Value: ??

.align 用于凑地址用,节约内存使用

.byte 1,2,3,4 -> Label:d Value: 1,2,3,4

.word 1,2,3,4 -> Lable:e Value: 1 \ 2 \ 3 \ 4 每个字符占用4 byte内存,比如这里占用了16Bytes 内存。

Question 3:

int u; -> a: .space 4 (int 占用 4 bits 内存)

int v = 42; -> b: .word 42

char w; -> c: .space 1

char x = ‘a’; -> d: .byte ‘a’

double y; -> e: .space 8

int z[20]; -> f: .space 80 (20 * 4 bits)

Question 4:

aa: .word 42

bb: .word 666

cc: .word 1

.word 3

la $t0, aa $t0 = aa的地址

lw $t0, bb $t0 = 666

lb $t0, bb $t0 =

lw $t0, aa+4 $t0 = 666

发表评论