Kodewerx https://www.kodewerx.org/forum/ |
|
ASM loop/goto problem https://www.kodewerx.org/forum/viewtopic.php?f=17&t=6907 |
Page 1 of 1 |
Author: | deviluc [ Sat Jul 18, 2009 3:04 am ] |
Post subject: | ASM loop/goto problem |
Hi i've got a problem with asm, when I want to code a code with an loop in it, the game crashes. Here is an exemple: Code: ldr r0,=0x00000043 ldr r1,=0x00000F30 loop: ldr r2,=0x020DB45D str r2,[r2] mla r3,r2,r1,r0 cmp r3,r1 bne loop ;if r3 is not equal to r1, go to loop bx r14 But when I try a code like this, the game freezes. Any suggestions? |
Author: | Parasyte [ Sat Jul 18, 2009 1:15 pm ] |
Post subject: | Re: ASM loop/goto problem |
Your code basically looks like this, written in C: Code: do { *(u32*)0x020DB45D = 0x020DB45D; } while (0x302344B3 != 0x00000F30); return; Maybe that helps to see what causes the infinite loop. But, I really don't understand the misaligned write... |
Author: | deviluc [ Mon Jul 20, 2009 2:47 am ] |
Post subject: | Re: ASM loop/goto problem |
hmm I could try your code, is there existing a compiler to compile c in ards? P.S.: is it possible to load an 8-bit/16-bit address in asm? |
Author: | Parasyte [ Mon Jul 20, 2009 7:41 pm ] |
Post subject: | Re: ASM loop/goto problem |
You don't want to compile the code I posted; it is functionally equivalent to what you posted, thus is would still hang. The reason I posted it at all was to illustrate the problem in a higher level language. The loop checks for the condition that the number 0x302344B3 is not equal to the number 0x00000F30. This condition is always true. Therefore, the loop will never end. To answer your second question: yes. Code: ldrb: Load byte (8-bit) ldrh: Load halfword (16-bit) ldr: Load word (32-bit) I take it you haven't done any programming before? |
Author: | deviluc [ Tue Jul 21, 2009 3:40 am ] |
Post subject: | Re: ASM loop/goto problem |
Thats what I want, i want a infinite loop but maybe this is the reason why the game crashes. I did qbasic, basic, visual basic, some c, html and now asm. But im only 14 years old so im not so experienced. thanks a lot! |
Author: | Parasyte [ Tue Jul 21, 2009 5:34 pm ] |
Post subject: | Re: ASM loop/goto problem |
An "infinite loop" is a crash: http://en.wikipedia.org/wiki/Infinite_loop Besides, if that's all you wanted, it's actually a lot more simple: Code: loop:
b loop |
Author: | James0x57 [ Wed Jul 22, 2009 8:50 am ] |
Post subject: | Re: ASM loop/goto problem |
I just lol'd |
Author: | deviluc [ Wed Jul 22, 2009 1:49 pm ] |
Post subject: | Re: ASM loop/goto problem |
why? |
Author: | HyperHacker [ Thu Jul 23, 2009 9:30 am ] |
Post subject: | Re: ASM loop/goto problem |
Because it will be stuck in your loop forever and never get to the actual game code. |
Author: | Parasyte [ Thu Jul 23, 2009 4:40 pm ] |
Post subject: | Re: ASM loop/goto problem |
Maybe it would be better trying to explain the specific goal you are after, instead of "putting the game into an infinite loop without crashing it ..." Because that's totally nonsensical. |
Author: | deviluc [ Fri Jul 24, 2009 1:32 am ] |
Post subject: | Re: ASM loop/goto problem |
I'm trying to make an autokill code for metroid prime hunters eu 1.1 I have all addresses but when I try to use the autokill code the game crashes. Code: ldr r0,=0x020da6c7 ldr r0,[r0] ldr r1,=0x00000000 PLAYER1: cmp r1,r0 beq PLAYER2 ldr r3,=0x020db27e ldr r3,[r3] cmp r3,r1 beq PLAYER2 LOOP1: ldr r3,offset ldr r4,playerx mla r2,r0,r3,r4 ldr r2,[r2] ldr r4,playery ldr r5,offset mla r3,r0,r5,r4 ldr r3,[r3] ldr r6,playerz mla r4,r0,r5,r6 ldr r4,[r4] ldr r5,=0x020DB7e0 ldr r6,=0x020DB7e4 ldr r7,=0x020DB7e8 str r2,[r5] str r3,[r6] str r4,[r7] ldr r3,=0x020db27e ldr r3,[r3] cmp r3,r1 beq PLAYER2 bne LOOP1 PLAYER2: cmp r0,#0x00000001 beq PLAYER3 ldr r3,=0x020DC1AE ldr r3,[r3] cmp r3,r1 beq PLAYER3 LOOP2: ldr r3,offset ldr r4,playerx mla r2,r0,r3,r4 ldr r2,[r2] ldr r4,playery ldr r5,offset mla r3,r0,r5,r4 ldr r3,[r3] ldr r6,playerz mla r4,r0,r5,r6 ldr r4,[r4] ldr r5,=0x020DB7e0 ldr r6,=0x020DB7e4 ldr r7,=0x020DB7e8 add r5,r5,#0x00000f30 add r6,r6,#0x00000f30 add r7,r7,#0x00000f30 str r2,[r5] str r3,[r6] str r4,[r7] ldr r3,=0x020DC1AE ldr r3,[r3] cmp r3,r1 beq PLAYER3 bne LOOP2 PLAYER3: cmp r0,#0x00000002 beq PLAYER4 ldr r3,=0x020DD0DE ldr r3,[r3] cmp r3,r1 beq PLAYER4 LOOP3: ldr r3,offset ldr r4,playerx mla r2,r0,r3,r4 ldr r2,[r2] ldr r4,playery ldr r5,offset mla r3,r0,r5,r4 ldr r3,[r3] ldr r6,playerz mla r4,r0,r5,r6 ldr r4,[r4] ldr r5,=0x020DB7e0 ldr r6,=0x020DB7e4 ldr r7,=0x020DB7e8 add r5,r5,#0x00000f30 add r6,r6,#0x00000f30 add r7,r7,#0x00000f30 add r5,r5,#0x00000f30 add r6,r6,#0x00000f30 add r7,r7,#0x00000f30 str r2,[r5] str r3,[r6] str r4,[r7] ldr r3,=0x020DD0DE ldr r3,[r3] cmp r3,r1 beq PLAYER4 bne LOOP3 PLAYER4: cmp r0,#0x00000003 beq PLAYER1 ldr r3,=0x020DE00E ldr r3,[r3] cmp r3,r1 beq PLAYER1 LOOP4: ldr r3,offset ldr r4,playerx mla r2,r0,r3,r4 ldr r2,[r2] ldr r4,playery ldr r5,offset mla r3,r0,r5,r4 ldr r3,[r3] ldr r6,playerz mla r4,r0,r5,r6 ldr r4,[r4] ldr r5,=0x020DB7e0 ldr r6,=0x020DB7e4 ldr r7,=0x020DB7e8 add r5,r5,#0x00000f30 add r6,r6,#0x00000f30 add r7,r7,#0x00000f30 add r5,r5,#0x00000f30 add r6,r6,#0x00000f30 add r7,r7,#0x00000f30 add r5,r5,#0x00000f30 add r6,r6,#0x00000f30 add r7,r7,#0x00000f30 str r2,[r5] str r3,[r6] str r4,[r7] ldr r3,=0x020DE00E ldr r3,[r3] cmp r3,r1 beq PLAYER1 bne LOOP4 bx r14 offset: .word 0x00000F30 playerx: .word 0x020DB7e0 playery: .word 0x020DB7e4 playerz: .word 0x020DB7e8 In this code I didn't take the right addresses cause I don't whant some noobs to cheat in the wi-fi. |
Author: | Parasyte [ Fri Jul 24, 2009 3:34 pm ] |
Post subject: | Re: ASM loop/goto problem |
n00bz, cheating on wifi? oh noes, the sky! It's falling!!! |
Author: | Hextator [ Fri Jul 24, 2009 9:06 pm ] |
Post subject: | |
Just to be an ass, I'd like to point out that arm-eabi-as accepts Code: b $ And would yield the same thing as Code: loop: b loop The $ operator is pretty damn nice. |
Author: | deviluc [ Sat Jul 25, 2009 1:23 am ] |
Post subject: | Re: ASM loop/goto problem |
I don't understand what you mean Zeld, sorry |
Page 1 of 1 | All times are UTC - 8 hours [ DST ] |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |