[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Re: Wierd Calls.
From: |
David VanHorn |
Subject: |
Re: [avr-gcc-list] Re: Wierd Calls. |
Date: |
Wed, 11 Mar 2009 10:23:58 -0400 |
Well.. Still flogging the horse here.
I have the .S file, but I don't know how to interpret it.
I carved up the statement even further, and moved the declarations so all the vars are in ram so I can watch them easily.
A = Raw_Data[0][Raw_Data_Index]; // Gives the expected result.
Bin = (A / Data_Divisor); // Gives nonsense, AND trashes data in ram!
Here's the asm output. The first line is what I'd expect.
1072: A = Raw_Data[0][Raw_Data_Index]; // Get the old data
+00000337: 91C00076 LDS R28,0x0076 Load direct from data space
+00000339: 91D00077 LDS R29,0x0077 Load direct from data space
The second one starts out normally, but then this call to 0x622, which is hosing everything.
1073: Bin = (A / Data_Divisor); // Find the bin for the old raw data
+0000033B: 01FE MOVW R30,R28 Copy register pair
+0000033C: 5FE2 SUBI R30,0xF2 Subtract immediate
+0000033D: 4FFE SBCI R31,0xFE Subtract immediate with carry
+0000033E: 8180 LDD R24,Z+0 Load indirect with displacement
+0000033F: E090 LDI R25,0x00 Load immediate
+00000340: E06F LDI R22,0x0F Load immediate
+00000341: E070 LDI R23,0x00 Load immediate
+00000342: 940E0622 CALL 0x00000622 Call subroutine
+00000344: 01DB MOVW R26,R22 Copy register pair
Here's where it calls to, +00000622 below. Interestingly, the code just walks right off the end if you get past the RET in 650, it does a few things, then wanders off into space.
607: lcd_command(dispAttr); /* display/cursor control */
+0000061D: 2F81 MOV R24,R17 Copy register
+0000061E: 940E057F CALL 0x0000057F Call subroutine
609: }/* lcd_init */
+00000620: 911F POP R17 Pop register from stack
+00000621: 9508 RET Subroutine return
609: }/* lcd_init */
+00000622: 1BAA SUB R26,R26 Subtract without carry
+00000623: 1BBB SUB R27,R27 Subtract without carry
+00000624: E151 LDI R21,0x11 Load immediate
+00000625: C007 RJMP PC+0x0008 Relative jump
+00000626: 1FAA ROL R26 Rotate Left Through Carry
+00000627: 1FBB ROL R27 Rotate Left Through Carry
+00000628: 17A6 CP R26,R22 Compare
+00000629: 07B7 CPC R27,R23 Compare with carry
+0000062A: F010 BRCS PC+0x03 Branch if carry set
+0000062B: 1BA6 SUB R26,R22 Subtract without carry
+0000062C: 0BB7 SBC R27,R23 Subtract with carry
+0000062D: 1F88 ROL R24 Rotate Left Through Carry
+0000062E: 1F99 ROL R25 Rotate Left Through Carry
+0000062F: 955A DEC R21 Decrement
+00000630: F7A9 BRNE PC-0x0A Branch if not equal
+00000631: 9580 COM R24 One's complement
+00000632: 9590 COM R25 One's complement
+00000633: 01BC MOVW R22,R24 Copy register pair
+00000634: 01CD MOVW R24,R26 Copy register pair
+00000635: 9508 RET Subroutine return
+00000636: 882A LDD R2,Y+18 Load indirect with displacement
+00000637: 8839 LDD R3,Y+17 Load indirect with displacement
+00000638: 8848 LDD R4,Y+16 Load indirect with displacement
+00000639: 845F LDD R5,Y+15 Load indirect with displacement
+0000063A: 846E LDD R6,Y+14 Load indirect with displacement
+0000063B: 847D LDD R7,Y+13 Load indirect with displacement
+0000063C: 848C LDD R8,Y+12 Load indirect with displacement
+0000063D: 849B LDD R9,Y+11 Load indirect with displacement
+0000063E: 84AA LDD R10,Y+10 Load indirect with displacement
+0000063F: 84B9 LDD R11,Y+9 Load indirect with displacement
+00000640: 84C8 LDD R12,Y+8 Load indirect with displacement
+00000641: 80DF LDD R13,Y+7 Load indirect with displacement
+00000642: 80EE LDD R14,Y+6 Load indirect with displacement
+00000643: 80FD LDD R15,Y+5 Load indirect with displacement
+00000644: 810C LDD R16,Y+4 Load indirect with displacement
+00000645: 811B LDD R17,Y+3 Load indirect with displacement
+00000646: 81AA LDD R26,Y+2 Load indirect with displacement
+00000647: 81B9 LDD R27,Y+1 Load indirect with displacement
+00000648: 0FCE ADD R28,R30 Add without carry
+00000649: 1DD1 ADC R29,R1 Add with carry
+0000064A: B60F IN R0,0x3F In from I/O location
+0000064B: 94F8 CLI Global Interrupt Disable
+0000064C: BFDE OUT 0x3E,R29 Out to I/O location
+0000064D: BE0F OUT 0x3F,R0 Out to I/O location
+0000064E: BFCD OUT 0x3D,R28 Out to I/O location
+0000064F: 01ED MOVW R28,R26 Copy register pair
+00000650: 9508 RET Subroutine return
+00000651: 94F8 CLI Global Interrupt Disable
+00000652: CFFF RJMP PC-0x0000 Relative jump
+00000653: 614D ORI R20,0x1D Logical OR with immediate
+00000654: 2D67 MOV R22,R7 Copy register
+00000655: 6553 ORI R21,0x53 Logical OR with immediate
+00000656: 736E ANDI R22,0x3E Logical AND with immediate
+00000657: 726F ANDI R22,0x2F Logical AND with immediate
+00000658: 3020 CPI R18,0x00 Compare with immediate
+00000659: 302E CPI R18,0x0E Compare with immediate
+0000065A: 2031 AND R3,R1 Logical AND
+0000065B: 6400 ORI R16,0x40 Logical OR with immediate
+0000065C: 8000 LDD R0,Z+0 Load indirect with displacement
+0000065D: 0064 ??? Data or unknown opcode
+0000065E: FFFF ??? Data or unknown opcode
+0000065F: FFFF ??? Data or unknown opcode
+00000660: FFFF ??? Data or unknown opcode
+00000661: FFFF ??? Data or unknown opcode
+00000662: FFFF ??? Data or unknown opcode
+00000663: FFFF ??? Data or unknown opcode
+00000664: FFFF ??? Data or unknown opcode
+00000665: FFFF ??? Data or unknown opcode
+00000666: FFFF ??? Data or unknown opcode
+00000667: FFFF ??? Data or unknown opcode
- [avr-gcc-list] Wierd Calls., David VanHorn, 2009/03/10
- RE: [avr-gcc-list] Wierd Calls., Weddington, Eric, 2009/03/10
- [avr-gcc-list] Re: Wierd Calls., David Brown, 2009/03/10
- Re: [avr-gcc-list] Re: Wierd Calls., David VanHorn, 2009/03/10
- Re: [avr-gcc-list] Re: Wierd Calls.,
David VanHorn <=
- RE: [avr-gcc-list] Re: Wierd Calls., Weddington, Eric, 2009/03/11
- Re: [avr-gcc-list] Re: Wierd Calls., Dave Hylands, 2009/03/11
- Re: [avr-gcc-list] Re: Wierd Calls., David VanHorn, 2009/03/11
- RE: [avr-gcc-list] Re: Wierd Calls., Dave Hansen, 2009/03/11
- Re: [avr-gcc-list] Re: Wierd Calls., Paulo Marques, 2009/03/12
- Re: [avr-gcc-list] Re: Wierd Calls., Dave Hylands, 2009/03/12
- RE: [avr-gcc-list] Re: Wierd Calls., Weddington, Eric, 2009/03/12
- Re: [avr-gcc-list] Re: Wierd Calls., Dave Hylands, 2009/03/13
- Re: [avr-gcc-list] Re: Wierd Calls., David VanHorn, 2009/03/13