.ugen .verstamp 3 11 .text .align 4 .file 2 "char-string.c" .globl main .loc 2 3 # 1 #include # 2 main() # 3 { .ent main 2 main: .option O1 ldgp $gp, 0($27) lda $sp, -2016($sp) .frame $sp, 2016, $26, 0 .prologue 1 .loc 2 3 .loc 2 8 # 4 # 5 char m[1000]; # 6 char n[1000]; # 7 int i; # 8 for (i=0; i<1000; i++) n[i] = m[i]; stl $31, 8($sp) .align 3 $32: .loc 2 8 ldl $1, 8($sp) addq $1, $sp, $2 .set noat -------------------------------------------------------------- # LOAD BYTE (the hard way) ldq_u $28, 1016($2) # R28 gets aligned 64-bit word # containing m[i] extbl $28, $2, $2 # this shifts the desired byte # to the low-order spot of R2 -------------------------------------------------------------- .set at addq $1, $sp, $3 .set noat -------------------------------------------------------------- # STORE BYTE (the hard way) ldq_u $28, 16($3) # R28 gets aligned 64-bit word # containing n[i] insbl $2, $3, $4 # "insert" some byte, I'd guess mskbl $28, $3, $28 # "mask" probably bis $28, $4, $28 # puts m[i] into n[i]'s word stq_u $28, 16($3) # store the aligned word back -------------------------------------------------------------- .set at ldl $5, 8($sp) addl $5, 1, $6 stl $6, 8($sp) subq $6, 1000, $7 blt $7, $32 .loc 2 9 # 9 } bis $31, $31, $0 .livereg 0xFC7F0002,0x3FC00000 lda $sp, 2016($sp) ret $31, ($26), 1 .end main