Fibonacci in PowerPC ASM
#1
I was asked by a random person on Discord if I could make a Fibonacci sequence on PPC ASM. 

Example:
x + y = z
0 + 1 = 1
1 + 1 = 2
1 + 2 = 3
2 + 3 = 5
etc etc

He wanted the equation to loop and repeat until X equals 255 then the loop will start from the very beginning again. Anyway here's a quick fibonacci ASM sequence if anybody cares... Ofc, modify this according to store/load to/from memory addresses for use in Cheat Codes...

first_label:
li r16, 0x0
li r17, 0x1

second_label:
add r18, r17, r16
mr r16, r17
mr r17, r18

cmpwi r16, 0xFF
blt+ first_label
b second_label

Raw ASM:
3A000000 3A200001
7E518214 7E308B78
7E519378 2C1000FF
4180FFF0 4BFFFFE4
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)