AVR assembler guru help required!

Sorry for English usage - required to pass through the gateway.

Dear Sirs,

I had to start up AVR disassembly project. The system is very complicated and never been accessible in Russia before. It uses multiple interrupts, file system, errors handling and special registers for microprocessor (registers/bits description is available). Finally I mannaged to get out disassembly listing. It was correct! Unfortunately, I'm not experienced in AVR assembler programming and it tooks a lot of time for me to understand simple, common used functions in AVR code. The task is to understand and separate one of the algorithms used. I will explain more by mail snipped-for-privacy@modul.spb.ru (not in a newsgroup)

I would be grateful, if anybody, experienced in AVR programming could help me to understand destination of parts of the AVR code. In turn, I could help to those who like Forth programming for different processors to acquire suitable IDE. :)

Below there are a couple of examples from the project. I need an explanation "for dummies" to understand their destination.

ROM:0162 sub_162: ROM:0162 clr r0 ROM:0163 clr r1 ROM:0164 ROM:0164 loc_164: ROM:0164 cpi r16, 0 ROM:0165 cpc r16, r17 ROM:0166 breq loc_16F ROM:0167 lsr r17 ROM:0168 ror r16 ROM:0169 brcc loc_16C ROM:016A add r0, r20 ROM:016B adc r1, r21 ROM:016C ROM:016C loc_16C: ROM:016C lsl r20 ROM:016D rol r21 ROM:016E rjmp loc_164 ROM:016F ROM:016F loc_16F: ROM:016F mov r16, r0 ROM:0170 mov r17, r1 ROM:0171 ret

-----------------------------------------------

ROM:1045 lds r16, unk_D11D ROM:1047 lds r17, unk_D11E ROM:1049 ldi r20, 9 ROM:104A ldi r21, 0 ROM:104B call sub_180

ROM:0180 sub_180: ROM:0180 clr r0 ROM:0181 clr r1 ROM:0182 ldi r30, 0x10 ROM:0183 ROM:0183 loc_183: ROM:0183 dec r30 ROM:0184 brmi loc_18F ROM:0185 rol r16 ROM:0186 rol r17 ROM:0187 rol r0 ROM:0188 rol r1 ROM:0189 cp r0, r20 ROM:018A cpc r1, r21 ROM:018B brcs loc_183 ROM:018C sub r0, r20 ROM:018D sbc r1, r21 ROM:018E rjmp loc_183 ROM:018F ROM:018F loc_18F: ROM:018F rol r16 ROM:0190 rol r17 ROM:0191 mov r20, r0 ROM:0192 mov r21, r1 ROM:0193 com r16 ROM:0194 com r17 ROM:0195 ret

Regards, Ivan

Reply to
Ivan V. Krasnyj
Loading thread data ...
Reply to
Peter Kostenko

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.