I ran into a conundrum when trying to get my UART0 sniffer program going.
After the BASCOM PUSHALL statement, R24 was always zero.
I compiled this code snipit and then disassembled it to see what PUSHALL did.
Code: |
Pushall ' <-- Seems to have strange effects when used here Franks_Push: !PUSH r16 !PUSH r24 !PUSH r25 !PUSH r26 !PUSH r27 !PUSH r28 !PUSH r29 !PUSH r30 !PUSH r31 |
Code: |
51: Pushall ' <-- Seems to have strange effects when used here +000000BB: 920F PUSH R0 Push register on stack +000000BC: 921F PUSH R1 Push register on stack +000000BD: 922F PUSH R2 Push register on stack +000000BE: 923F PUSH R3 Push register on stack +000000BF: 924F PUSH R4 Push register on stack +000000C0: 925F PUSH R5 Push register on stack +000000C1: 927F PUSH R7 Push register on stack +000000C2: 92AF PUSH R10 Push register on stack +000000C3: 92BF PUSH R11 Push register on stack +000000C4: 930F PUSH R16 Push register on stack +000000C5: 931F PUSH R17 Push register on stack +000000C6: 932F PUSH R18 Push register on stack +000000C7: 933F PUSH R19 Push register on stack +000000C8: 934F PUSH R20 Push register on stack +000000C9: 935F PUSH R21 Push register on stack +000000CA: 936F PUSH R22 Push register on stack +000000CB: 937F PUSH R23 Push register on stack +000000CC: 938F PUSH R24 Push register on stack +000000CD: 939F PUSH R25 Push register on stack +000000CE: 93AF PUSH R26 Push register on stack +000000CF: 93BF PUSH R27 Push register on stack +000000D0: 93CF PUSH R28 Push register on stack +000000D1: 93DF PUSH R29 Push register on stack +000000D2: 93EF PUSH R30 Push register on stack +000000D3: 93FF PUSH R31 Push register on stack +000000D4: B78F IN R24,0x3F In from I/O location +000000D5: 938F PUSH R24 Push register on stack +000000D6: B78B IN R24,0x3B In from I/O location +000000D7: 938F PUSH R24 Push register on stack +000000D8: 2788 CLR R24 Clear Register +000000D9: BF8B OUT 0x3B,R24 Out to I/O location Franks_Push: +000000DA: 930F PUSH R16 Push register on stack +000000DB: 938F PUSH R24 Push register on stack +000000DC: 939F PUSH R25 Push register on stack +000000DD: 93AF PUSH R26 Push register on stack +000000DE: 93BF PUSH R27 Push register on stack +000000DF: 93CF PUSH R28 Push register on stack +000000E0: 93DF PUSH R29 Push register on stack +000000E1: 93EF PUSH R30 Push register on stack +000000E2: 93FF PUSH R31 Push register on stack |
As one can see, R24 is not preserved by the PUSHALL statement. How interesting.
DISASSEMBLING:
I found the article about using AVR studio to disassembled code.
' https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=15283&highlight=obj
I gave up trying to get microchip studio 7.0 and downloaded Atmel AVR studio 4.19
So straightforward as described in the article.
No comments:
Post a Comment