I am using the Arduino IDE and an Uno to learn the basics of AVR assembler.
I have the following code. It works fine except the changes I make in the "Donner2" subroutine are not reflected in the final Z.
I have been mucking around with this for an hour now.. any help as to what i am doing wrong is much appreciated!!
LDI ZL , lo8( Table2 ) // Z at element 0 LDI ZH , hi8( Table2 ) // Z at element 0 ADIW Z , 5 // increment to element 5 LDI R16 , 0 // LDI R17 , 23 // // NOTE! If I RET here I will have array element position 5 as expected. RCALL Check4 LPM R24 , Z // // NOTE! This returns the value in array element 10, I expected the value in element 14 RET Check4: CP R16 , R17 BRNE Donner2 // branch if EQUAL // these 2 ADIWs are not in the final value!! ADIW Z , 1 // increment to element 11 ADIW Z , 3 // increment to element 14 RET Donner: RET Donner2: ADIW Z , 5 // increment Z by 3 RET