- 39
- Posts
- 9
- Years
- Seen Jul 29, 2018
There you go, FBI-o-nacci!
Task 1:
for some reason it only calculates up to the 23rd (or so, dont remember) number, any numbers over 23 make it return strange stuff. probaply because registers cant hold bigger values?
Task 2:
i adjusted it so it only returns values up to 23
Task 3:
this one combines both of them, nothing special
Challenge:
takes the value of var 0x8000 (can be randomized via script) and checks if it is a fibonacci number, stores the n at 0x8000 if it is, stores 0 if its not
i have tested all of them and they worked fine for me, except for that issue with task 1.
Is there any way to store bigger values into registers?
Task 1:
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
main:
push {lr}
ldr r0, =(0x020370B8)
ldrh r1, [r0]
mov r2, #0x1
mov r3, #0x1
cmp r1, #0x0
beq storeval_r2greater
loop:
cmp r1, #0x1
beq storeval_r3greater
add r2, r2, r3
sub r1, r1, #0x1
cmp r1, #0x1
beq storeval_r2greater
add r3, r2, r3
sub r1, r1, #0x1
b loop
storeval_r2greater:
strh r2, [r0]
b end
storeval_r3greater:
strh r3, [r0]
b end
end:
pop {pc}
.align 2
Task 2:
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
main:
push {lr}
ldr r1, =(0x8044EC9)
bl linker
ldr r1, =(0x20370B8)
lsl r0, r0, #0x1B
lsr r0, r0, #0x1B
cmp r0, #0x18
bhs higher
end:
strh r0, [r1]
pop {pc}
higher:
sub r0, r0, #0x8
b end
linker:
bx r1
.align 2
Task 3:
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
main:
push {lr}
ldr r0, =(0x8A71F81)
bl linker
ldr r0, =(0x8A71E81)
bl linker
pop {pc}
linker:
bx r0
.align 2
Challenge:
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
main:
push {r4-r5, lr}
ldr r0, =(0x20370B8)
ldrh r5, [r0]
mov r4, #0x0
loop:
add r4, r4, #0x1
strh r4, [r0]
ldr r0, =(0x8A71E81)
bl linker
ldr r0, =(0x20370B8)
ldrh r2, [r0]
cmp r5, r2
beq end
cmp r5, r2
blo notfibo
b loop
notfibo:
mov r4, #0x0
end:
strh r4, [r0]
pop {r4-r5, pc}
linker:
bx r0
.align 2
i have tested all of them and they worked fine for me, except for that issue with task 1.
Is there any way to store bigger values into registers?