.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: ; Place your code here ; Give r3 the address of data Segment defined below lis r3, DataSeg@h ;r3 = Upper Address ori r3, r3, DataSeg@l ;r3 = r3 | lower 16 bits of address lwz r31,0(r3) ; load the contents of address computed as r3+0 into r31 lwz r30,4(r3) ; load the contents of address computed as r3+4 into r30 lwz r29,8(r3) ; load the contents of address computed as r3+8 into r29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Place instructions that perform addition here and stores final result to r31! blr ; Return back to the C code PPC_End_Asm: DataSeg: ; note that these values are words and ; hence the displacement in lwz instruction is in steps of 4 .word $10 ; a= 10 .word $20 ; b= 20 .word $30 ; c= 30