|
发表于 2007-3-10 20:15:08
|
显示全部楼层
以下是这段测试程序的汇编代码
+00000000: 940C002B JMP 0x0000002B Jump 到初始化程序(cvavr的)
+00000002: 940C005B JMP 0x0000005B Jump 到INT0的中断服务程序
+00000004: 940C0000 JMP 0x00000000 Jump
+00000006: 940C0000 JMP 0x00000000 Jump
+00000008: 940C0000 JMP 0x00000000 Jump
+0000000A: 940C0000 JMP 0x00000000 Jump
+0000000C: 940C0000 JMP 0x00000000 Jump
+0000000E: 940C0000 JMP 0x00000000 Jump
+00000010: 940C0000 JMP 0x00000000 Jump
+00000012: 940C0000 JMP 0x00000000 Jump
+00000014: 940C0000 JMP 0x00000000 Jump
+00000016: 940C0000 JMP 0x00000000 Jump
+00000018: 940C0000 JMP 0x00000000 Jump
+0000001A: 940C0000 JMP 0x00000000 Jump
+0000001C: 940C0000 JMP 0x00000000 Jump
+0000001E: 940C0000 JMP 0x00000000 Jump
+00000020: 940C0000 JMP 0x00000000 Jump
+00000022: 940C0000 JMP 0x00000000 Jump
+00000024: 940C0000 JMP 0x00000000 Jump
+00000026: 940C0000 JMP 0x00000000 Jump
+00000028: 940C0000 JMP 0x00000000 Jump
+0000002A: 0000 NOP No operation
+0000002B: 94F8 CLI Global Interrupt Disable (关中断,cvavr的初始化开始)
+0000002C: 27EE CLR R30 Clear Register
+0000002D: BBEC OUT 0x1C,R30 Out to I/O location
+0000002E: E0F1 LDI R31,0x01 Load immediate
+0000002F: BFFB OUT 0x3B,R31 Out to I/O location
+00000030: BFEB OUT 0x3B,R30 Out to I/O location
+00000031: BFE5 OUT 0x35,R30 Out to I/O location
+00000032: E1F8 LDI R31,0x18 Load immediate
+00000033: BDF1 OUT 0x21,R31 Out to I/O location
+00000034: BDE1 OUT 0x21,R30 Out to I/O location
+00000035: E08D LDI R24,0x0D Load immediate
+00000036: E0A2 LDI R26,0x02 Load immediate
+00000037: 27BB CLR R27 Clear Register
+00000038: 93ED ST X+,R30 Store indirect and postincrement
+00000039: 958A DEC R24 Decrement
+0000003A: F7E9 BRNE PC-0x02 Branch if not equal
+0000003B: E080 LDI R24,0x00 Load immediate
+0000003C: E094 LDI R25,0x04 Load immediate
+0000003D: E6A0 LDI R26,0x60 Load immediate
+0000003E: 93ED ST X+,R30 Store indirect and postincrement
+0000003F: 9701 SBIW R24,0x01 Subtract immediate from word
+00000040: F7E9 BRNE PC-0x02 Branch if not equal
+00000041: E5E4 LDI R30,0x54 Load immediate
+00000042: E0F0 LDI R31,0x00 Load immediate
+00000043: 9185 LPM R24,Z+ Load program memory and postincrement
+00000044: 9195 LPM R25,Z+ Load program memory and postincrement
+00000045: 9700 SBIW R24,0x00 Subtract immediate from word
+00000046: F061 BREQ PC+0x0D Branch if equal
+00000047: 91A5 LPM R26,Z+ Load program memory and postincrement
+00000048: 91B5 LPM R27,Z+ Load program memory and postincrement
+00000049: 9005 LPM R0,Z+ Load program memory and postincrement
+0000004A: 9015 LPM R1,Z+ Load program memory and postincrement
+0000004B: 01BF MOVW R22,R30 Copy register pair
+0000004C: 01F0 MOVW R30,R0 Copy register pair
+0000004D: 9005 LPM R0,Z+ Load program memory and postincrement
+0000004E: 920D ST X+,R0 Store indirect and postincrement
+0000004F: 9701 SBIW R24,0x01 Subtract immediate from word
+00000050: F7E1 BRNE PC-0x03 Branch if not equal
+00000051: 01FB MOVW R30,R22 Copy register pair
+00000052: CFF0 RJMP PC-0x000F Relative jump
+00000053: E5EF LDI R30,0x5F Load immediate
+00000054: BFED OUT 0x3D,R30 Out to I/O location
+00000055: E0E4 LDI R30,0x04 Load immediate
+00000056: BFEE OUT 0x3E,R30 Out to I/O location
+00000057: E6C0 LDI R28,0x60 Load immediate
+00000058: E0D1 LDI R29,0x01 Load immediate
+00000059: 940C0069 JMP 0x00000069 Jump 到MAIN()函数(用户的初始化)
========================================================================
;INT0中断服务:
+0000005B: 93EA ST -Y,R30 Store indirect and predecrement
+0000005C: B7EF IN R30,0x3F In from I/O location
+0000005D: 93EA ST -Y,R30 Store indirect and predecrement
+0000005E: 9443 INC R4 Increment
+0000005F: E7ED LDI R30,0x7D Load immediate
+00000060: 164E CP R4,R30 Compare
+00000061: F018 BRCS PC+0x04 Branch if carry set
+00000062: 2444 CLR R4 Clear Register
+00000063: 9468 SET Set T in SREG
+00000064: F820 BLD R2,0 Bit load from T to register
+00000065: 91E9 LD R30,Y+ Load indirect and postincrement
+00000066: BFEF OUT 0x3F,R30 Out to I/O location
+00000067: 91E9 LD R30,Y+ Load indirect and postincrement
+00000068: 9518 RETI Interrupt return
;INT0中断返回
=======================================================================
;用户的MAIN()开始
+00000069: E0E0 LDI R30,0x00 Load immediate
+0000006A: BBEB OUT 0x1B,R30 Out to I/O location
+0000006B: EFEF SER R30 Set Register
+0000006C: BBEA OUT 0x1A,R30 Out to I/O location
+0000006D: B7EB IN R30,0x3B In from I/O location
+0000006E: 64E0 ORI R30,0x40 Logical OR with immediate
+0000006F: BFEB OUT 0x3B,R30 Out to I/O location
+00000070: E0E2 LDI R30,0x02 Load immediate
+00000071: BFE5 OUT 0x35,R30 Out to I/O location
+00000072: E0E0 LDI R30,0x00 Load immediate
+00000073: BFE4 OUT 0x34,R30 Out to I/O location
+00000074: E4E0 LDI R30,0x40 Load immediate
+00000075: BFEA OUT 0x3A,R30 Out to I/O location
+00000076: 9478 SEI Global Interrupt Enable (开放全局中断)
----------------------------------------------------------------------------
;while()循环开始
+00000077: FE20 SBRS R2,0 Skip if bit in register set
+00000078: C005 RJMP PC+0x0006 Relative jump
+00000079: 94E8 CLT Clear T in SREG
+0000007A: F820 BLD R2,0 Bit load from T to register
+0000007B: B3EB IN R30,0x1B In from I/O location
+0000007C: 95E0 COM R30 One's complement
+0000007D: BBEB OUT 0x1B,R30 Out to I/O location
+0000007E: CFF8 RJMP PC-0x0007 Relative jump
+0000007F: CFFF RJMP PC-0x0000 Relative jump |
|