Message from @redd
Discord ID: 430519101371449344
I fucking got it mother fuckers
```
.data
print: .asciz "%d\n"
scan: .asciz "%d"
array: .skip 20
a: .word
.text
.global main
main:
push {fp, lr}
mov r6, #0 /* r6 <- 0 (sum) */
mov r7, #0 /* r7 <- 0 (loop counter) */
ldr r4, =array /* r4 <- &array */
in_loop:
cmp r7, #4 /* compare r7 and 4 */
bgt in_loop_end /* branch to in_loop_end if r3 >= 4 */
ldr r0, =scan /* r0 <- &scan */
ldr r1, =a /* r1 <- &a */
bl scanf /* calls scanf */
ldr r1, =a /* r1 <- &a */
ldr r9, [r1] /* r9 <- value at address r1 */
str r9, [r4] /* store value of r9 into address of r4 */
add r4, r4, #4 /* r4 <- r4 + 4 */
add r7, r7, #1 /* r7 <- r7 + 1 */
b in_loop /* branch to in_loop */
in_loop_end:
mov r7, #0 /* r7 <- 0 (loop counter) */
ldr r4, =array /* r4 <- &array */
sum_loop:
cmp r7, #4 /* compare r7 and 4 */
bgt sum_loop_end /* branch to sum_loop_end if r3 >= 4 */
ldr r5, [r4] /* r5 <- value at address r4 */
add r6, r6, r5 /* add onto sum in r6 with r5 as array[i] */
add r4, r4, #4 /* r4 <- r4 + 4 */
add r7, r7, #1 /* r7 <- r7 + 1 */
b sum_loop /* branch to sum_loop */
sum_loop_end:
mov r1, r6 /* r1 <- r6 */
ldr r0, =print /* r1 <- print */
bl printf /* calls printf */
pop {fp, pc}
```
AAAAH
assembly
what is the code for>
to be fair you have to have a very high IQ to understand ARM Assembly
read in 5 numbers from scanf and sum them
and... why?
😄
class
I have been trying to deal with assembly for a while
reverse engineering AAA games is no easy task
lmao
rip gg
especially when those fuckers pack and encrypt their binaries
I think they packed their code into a data segment, then read it into protected execute only memory space when the exe is launched
windows sucks, trying to see if I can have any luck by manually parsing portable executables with a custom VM written in c++
I got it running, installing ddd now, see if I can get X11 redirect working for it.
do you use vim key bindings?
👌🏻
also what distro you using on your desktop?
I use Mageia.
🙀
Gnome Shell, Terminator for the terminal.
@meratrix good job dude 👍
lol I am still kinda new to linux
got a custom arch linux install with minimal packages installed
I consider Mageia to be the best newbie-friendly distro.
yeah well I just dived into the deep end
gentoo is the most user friendly to install tbh
<a:one_spinny_boi:393574438769131522>
seriously tho, arch has the best wiki
Most distros are "user friendly" to install these days.
Mageia has the Mageia Control Center, to do most setup tasks. No need to google some obscure instructions about `sudo gedit /etc/...`.
And if you want to learn what's happening behind the scenes, you can configure it to show logs of all the commands it's running.
I learned a lot thanks to that.
<:feelsrage:331855271339229184> *insert obnoxious, immature comment in defense of my chosen distro here*
REEEEEEEEEEEEEE arch is better
you can rice the shit out of arch and I like its wiki