ASM code help needed! :/

Started by PoptartHunter, May 23, 2012, 10:56:09 PM

Previous topic - Next topic

PoptartHunter

I found coordinates for a computer on Seatown (MW3), and I want to make a code that makes the computer "follow" you. But, i dont just want to simply write my player co-ords to the computer co-ords, I want to keep the computer a certain distance away from my player at all time, so it's just right behind me floating in the air, if that makes sense.. Anyways, here's the assembly I wrote and the compiled code... For some reason it freezes my Wii though :( Any help would be extremely appreciated!!  

Yes, this code is for online but it is in no way advantageous, just humorous! :)

stwu r1,-80(r1) # make space for 18 registers
stmw r14,8(r1) # push r14-r31 onto the stack

lis r31,9117
ori r31,r31,0xA9D0 # Load x computer coords
lis r30,9117
ori r30,r30,0xA9D4 # Load y computer coords
Lis r29,9117
ori r29,r29,0xA9D8 # Load z computer coords
lis r28,0x808A
ori r28,r28,0x1C1C # Load x player coords
lis r27,0x808A
ori r27,r27,0x1C20 # Load y player coords
lis r26,0x808A
ori r26,r26,0x1C24 # Load z player coords

lwz r25,0(r28) # Load value at x player coords
lwz r24,0(r27) # Load value at y player coords
lwz r23,0(r26) # Load value at z player coords

lwz r22,0(r31) # Load value at x computer coords
lwz r21,0(r30) # Load value at y computer coords
lwz r20,0(r29) # Load value at z computer coords

#Value Calculations (add/sub, get difference)
sub r19,r28,r31 # store difference between x player coords and x computer coords in r19
sub r18,r27,r30 # store difference between y player coords and y computer coords in r18

#Add the difference between the computer coords and the player coords to the computer coords:
add r17,r19,r31
add r16,r18,r30

#Store calculated coordinates difference back to computer coords:
stw r17,0(r31)
stw r16,0(r30)
stw r26,0(r29)

lmw r14,8(r1) # pop r14-r31 off the stack
addi r1,r1,80 # release the space
blr

--
Computer Stalks You [PoptartHunter]
C0000000 00000010
9421FFB0 BDC10008
3FE0239D 63FFA9D0
3FC0239D 63DEA9D4
3FA0239D 63BDA9D8
3F80808A 639C1C1C
3F60808A 637B1C20
3F40808A 635A1C24
833C0000 831B0000
82FA0000 82DF0000
82BE0000 829D0000
7E7FE050 7E5ED850
7E33FA14 7E12F214
923F0000 921E0000
935D0000 B9C10008
38210050 4E800020
4E800020 00000000
This be my signature.

Bully@Wiiplaza

#1
Ridiculously bad assembly, btw (use one register and then offsets). It won´t work with your subs and adds either. It freezes because you didn´t use "zero times the hex number" all the time. You don´t need a stack frame when you e.g. only use r10, r11 and r12 (yes, that´s possible by reusing registers efficiently).

You have to load into float registers and then add some float to it to keep a specific distance. Adding negative values is the same as substracting them (you most likely only need adding). Maybe apply it to all three coordinates also. You have to figure which distance float may be appropriate for it.

You could also study some of my codes which do something like this in other contexts (geckocodes).
My Wii hacking site...
http://bullywiihacks.com/

My youtube account with a lot of hacking videos...
http://www.youtube.com/user/BullyWiiPlaza

~Bully