Trying to Understand Assembly code

Hi everyone,

I came across this old piece of code in hex, deassembled it using ‘avr-objdump’ and was left with a piece of code I am trying to understand. I do not have any access to the source code. Am looking for help understanding the fundamentals of what this section of code does. It was contained inside of the loop function.

3312: 80 91 92 02 lds r24, 0x0292
3316: 90 91 93 02 lds r25, 0x0293
331a: a0 91 94 02 lds r26, 0x0294
331e: b0 91 95 02 lds r27, 0x0295
3322: 40 91 8e 02 lds r20, 0x028E
3326: 50 91 8f 02 lds r21, 0x028F
332a: 60 91 90 02 lds r22, 0x0290
332e: 70 91 91 02 lds r23, 0x0291
3332: 84 0f add r24, r20
3334: 95 1f adc r25, r21
3336: a6 1f adc r26, r22
3338: b7 1f adc r27, r23
333a: 40 91 8a 02 lds r20, 0x028A
333e: 50 91 8b 02 lds r21, 0x028B
3342: 60 91 8c 02 lds r22, 0x028C
3346: 70 91 8d 02 lds r23, 0x028D
334a: 84 0f add r24, r20
334c: 95 1f adc r25, r21
334e: a6 1f adc r26, r22
3350: b7 1f adc r27, r23
3352: 40 91 86 02 lds r20, 0x0286
3356: 50 91 87 02 lds r21, 0x0287
335a: 60 91 88 02 lds r22, 0x0288
335e: 70 91 89 02 lds r23, 0x0289
3362: 84 0f add r24, r20
3364: 95 1f adc r25, r21
3366: a6 1f adc r26, r22
3368: b7 1f adc r27, r23
336a: 81 15 cp r24, r1
336c: 9f 49 sbci r25, 0x9F ; 159
336e: a4 42 sbci r26, 0x24 ; 36
3370: b1 05 cpc r27, r1
3372: 0c f0 brlt .+2 ; 0x3376
3374: 64 c0 rjmp .+200 ; 0x343e
3376: 28 e2 ldi r18, 0x28 ; 40
3378: 33 e2 ldi r19, 0x23 ; 35
337a: 30 93 19 02 sts 0x0219, r19
337e: 20 93 18 02 sts 0x0218, r18
3382: 80 ea ldi r24, 0xA0 ; 160
3384: 96 e8 ldi r25, 0x86 ; 134
3386: a1 e0 ldi r26, 0x01 ; 1
3388: b0 e0 ldi r27, 0x00 ; 0
338a: 80 93 14 02 sts 0x0214, r24
338e: 90 93 15 02 sts 0x0215, r25
3392: a0 93 16 02 sts 0x0216, r26
3396: b0 93 17 02 sts 0x0217, r27
339a: 30 93 13 02 sts 0x0213, r19
339e: 20 93 12 02 sts 0x0212, r18
33a2: 80 93 0e 02 sts 0x020E, r24
33a6: 90 93 0f 02 sts 0x020F, r25
33aa: a0 93 10 02 sts 0x0210, r26
33ae: b0 93 11 02 sts 0x0211, r27
33b2: 30 93 0d 02 sts 0x020D, r19
33b6: 20 93 0c 02 sts 0x020C, r18
33ba: 80 93 08 02 sts 0x0208, r24
33be: 90 93 09 02 sts 0x0209, r25
33c2: a0 93 0a 02 sts 0x020A, r26
33c6: b0 93 0b 02 sts 0x020B, r27
33ca: 30 93 07 02 sts 0x0207, r19
33ce: 20 93 06 02 sts 0x0206, r18
33d2: 80 93 02 02 sts 0x0202, r24
33d6: 90 93 03 02 sts 0x0203, r25
33da: a0 93 04 02 sts 0x0204, r26
33de: b0 93 05 02 sts 0x0205, r27
33e2: 80 e1 ldi r24, 0x10 ; 16
33e4: 97 e2 ldi r25, 0x27 ; 39
33e6: a0 e0 ldi r26, 0x00 ; 0
33e8: b0 e0 ldi r27, 0x00 ; 0
33ea: 80 93 28 02 sts 0x0228, r24
33ee: 90 93 29 02 sts 0x0229, r25
33f2: a0 93 2a 02 sts 0x022A, r26
33f6: b0 93 2b 02 sts 0x022B, r27
33fa: 80 93 24 02 sts 0x0224, r24
33fe: 90 93 25 02 sts 0x0225, r25
3402: a0 93 26 02 sts 0x0226, r26
3406: b0 93 27 02 sts 0x0227, r27
340a: 80 e2 ldi r24, 0x20 ; 32
340c: 9e e4 ldi r25, 0x4E ; 78
340e: a0 e0 ldi r26, 0x00 ; 0
3410: b0 e0 ldi r27, 0x00 ; 0
3412: 80 93 20 02 sts 0x0220, r24
3416: 90 93 21 02 sts 0x0221, r25
341a: a0 93 22 02 sts 0x0222, r26
341e: b0 93 23 02 sts 0x0223, r27
3422: 80 93 1c 02 sts 0x021C, r24
3426: 90 93 1d 02 sts 0x021D, r25
342a: a0 93 1e 02 sts 0x021E, r26
342e: b0 93 1f 02 sts 0x021F, r27
3432: 80 e3 ldi r24, 0x30 ; 48
3434: 95 e7 ldi r25, 0x75 ; 117
3436: 90 93 01 02 sts 0x0201, r25
343a: 80 93 00 02 sts 0x0200, r24
343e: 68 e5 ldi r22, 0x58 ; 88
3440: 7b e1 ldi r23, 0x1B ; 27
3442: 80 e0 ldi r24, 0x00 ; 0
3444: 90 e0 ldi r25, 0x00 ; 0
3446: 37 d2 rcall .+1134 ; 0x38b6
3448: 84 e6 ldi r24, 0x64 ; 100
344a: 90 e0 ldi r25, 0x00 ; 0
344c: 90 93 6b 02 sts 0x026B, r25
3450: 80 93 6a 02 sts 0x026A, r24
3454: 10 92 69 02 sts 0x0269, r1
3458: 10 92 68 02 sts 0x0268, r1
345c: 80 ed ldi r24, 0xD0 ; 208
345e: 97 e0 ldi r25, 0x07 ; 7
3460: 90 93 67 02 sts 0x0267, r25
3464: 80 93 66 02 sts 0x0266, r24
3468: 0a e0 ldi r16, 0x0A ; 10
346a: 10 e0 ldi r17, 0x00 ; 0
346c: 10 93 65 02 sts 0x0265, r17
3470: 00 93 64 02 sts 0x0264, r16
3474: 8a e1 ldi r24, 0x1A ; 26
3476: 90 e0 ldi r25, 0x00 ; 0
3478: 90 93 63 02 sts 0x0263, r25
347c: 80 93 62 02 sts 0x0262, r24
3480: 80 91 28 02 lds r24, 0x0228
3484: 90 91 29 02 lds r25, 0x0229
3488: a0 91 2a 02 lds r26, 0x022A
348c: b0 91 2b 02 lds r27, 0x022B
3490: 80 93 5a 02 sts 0x025A, r24
3494: 90 93 5b 02 sts 0x025B, r25
3498: a0 93 5c 02 sts 0x025C, r26
349c: b0 93 5d 02 sts 0x025D, r27
34a0: 80 91 20 02 lds r24, 0x0220
34a4: 90 91 21 02 lds r25, 0x0221
34a8: a0 91 22 02 lds r26, 0x0222
34ac: b0 91 23 02 lds r27, 0x0223
34b0: 80 93 56 02 sts 0x0256, r24
34b4: 90 93 57 02 sts 0x0257, r25
34b8: a0 93 58 02 sts 0x0258, r26
34bc: b0 93 59 02 sts 0x0259, r27

I came across this old piece of code

may be the context of that old piece of code would give you a clue?

Look up what the instructions do -- it is very straightforward. The first 12 lines add two 32 bit numbers.

Please post all code properly.

https://www.google.com/search?q=avr+instruction+set

Each processor datasheet includes some of the same material.

It adds a bunch of numbers together and if they're >240000
It saves 9000, 10000, 30000 and 100000 to a bunch of memory locations
Then it calls delay(7000) and saves 100, 0, 2000, 10 and 26 to several locations