.data ! these are loaded per their sizes: ! ld loads a word ! lduh loads a half (unsigned) ! ldub loads a byte (unsigned) x: .word 10 y: .half 20 z: .byte 30 .text set x, %r1 ld [%r1], %r2 set y, %r1 lduh [%r1], %r3 set z, %r1 ldub [%r1], %r4 .data ! these are loaded as words ! memory is byte aligned, but the ld ! instuction expects word alignment, ! hence the .align 4 directive is needed ! prior to the zz address to place this ! on a word boundary ! compare the results between ! %r2 and %r10, ! %r3 and %r11 ! %r4 and %r12 .align 4 xx: .word 10 yy: .half 20 .align 4 zz: .byte 30 .text set xx, %r1 ld [%r1], %r10 set yy, %r1 ld [%r1], %r11 set zz, %r1 ld [%r1], %r12 .data ! these are loaded per their sizes; ! loading is done as 'signed' ! compare the results between ! %r2, %r10 and %r18 ! %r3, %r11 and %r19 ! %r4, %r12 and %r20 .align 4 xxx: .word -10 yyy: .half -20 zzz: .byte -30 .text set xxx, %r1 ld [%r1], %r18 set yyy, %r1 ldsh [%r1], %r19 set zzz, %r1 ldsb [%r1], %r20 ta 0