.export StartAsm ; Tells the linker to export the StartAsm ; label so other files can see it .function "StartAsm", PPC_Start_Asm, PPC_End_Asm-PPC_Start_Asm .text PPC_Start_Asm: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Assembly code ; StartAsm: ; your code goes here ; Give r2 the address of the data segment defined below lis r2, DataSeg@h ;r2 = upper halfword of address ori r2, r2, DataSeg@l ;r2 = r2 | lower halfword of address lwz r31,0(r2) ; load the value from memory at address r2+0 into r31 lwz r30,4(r2) ; load the value from memory at address r2+4 into r30 add r30, r30, r31 ; add r30+r31, and put the sum in r30 stw r30, 8(r2) ; store the sum into memory at address r2+8 blr ; Return back to the C code PPC_End_Asm: DataSeg: ;data values are words, so an offset from DataSeg is a multiple of 4 .word $11 .word $22 .word 0