;该
单片机为At
tiny45,该程序有哪些功能,菜鸟刚学看不太明白
;---------------------------------------
; byte constants:
;
.equ k00 = 0x00 ;
.equ k01 = 0x01 ;
.equ k02 = 0x02 ;
.equ k03 = 0x03 ;
.equ k04 = 0x04 ;
.equ k05 = 0x05 ;
.equ k08 = 0x08 ;
.equ k09 = 0x09 ;
.equ k0A = 0x0A ;
.equ k0D = 0x0D ;
.equ k10 = 0x10 ;
.equ k11 = 0x11 ;
.equ k14 = 0x14 ;
.equ k18 = 0x18 ;
.equ k1E = 0x1E ;
.equ k27 = 0x27 ; '''
.equ k2F = 0x2F ; '/'
.equ k30 = 0x30 ; '0'
.equ k32 = 0x32 ; '2'
.equ k37 = 0x37 ; '7'
.equ k3F = 0x3F ; '?'
.equ k41 = 0x41 ; 'A'
.equ k43 = 0x43 ; 'C'
.equ k46 = 0x46 ; 'F'
.equ k49 = 0x49 ; 'I'
.equ k4D = 0x4D ; 'M'
.equ k4E = 0x4E ; 'N'
.equ k4F = 0x4F ; 'O'
.equ k50 = 0x50 ; 'P'
.equ k52 = 0x52 ; 'R'
.equ k54 = 0x54 ; 'T'
.equ k55 = 0x55 ; 'U'
.equ k56 = 0x56 ; 'V'
.equ k57 = 0x57 ; 'W'
.equ k59 = 0x59 ; 'Y'
.equ k5F = 0x5F ; '_'
.equ k60 = 0x60 ; '`'
.equ k64 = 0x64 ; 'd'
.equ k80 = 0x80 ;
.equ kA0 = 0xA0 ; '?
.equ kA5 = 0xA5 ; '?
.equ kAC = 0xAC ; '?
.equ kAE = 0xAE ; '?
.equ kC4 = 0xC4 ; '?
.equ kC8 = 0xC8 ; '?
.equ kE8 = 0xE8 ; '?
.equ kF7 = 0xF7 ; '?
.equ kFA = 0xFA ; '?
.equ kFF = 0xFF ; ''
;
; io register addresses:
;
.equ p03 = 0x03
.equ p08 = 0x08
.equ p0D = 0x0D
.equ p11 = 0x11
.equ p12 = 0x12
.equ p13 = 0x13
.equ p16 = 0x16
.equ p17 = 0x17
.equ p18 = 0x18
.equ p1C = 0x1C
.equ p1D = 0x1D
.equ p1E = 0x1E
.equ p21 = 0x21
.equ p26 = 0x26
.equ p27 = 0x27
.equ p28 = 0x28
.equ p29 = 0x29
.equ p2A = 0x2A
.equ p2B = 0x2B
.equ p2C = 0x2C
.equ p2D = 0x2D
.equ p2E = 0x2E
.equ p2F = 0x2F
.equ p30 = 0x30
.equ p32 = 0x32
.equ p33 = 0x33
.equ p34 = 0x34
.equ p35 = 0x35
.equ p39 = 0x39
.equ p3B = 0x3B
.equ p3D = 0x3D
.equ p3E = 0x3E
.equ p3F = 0x3F
;
; pointer offsets:
;
.equ o00 = 0x00
.equ o01 = 0x01
.equ o02 = 0x02
.equ o03 = 0x03
.equ o04 = 0x04
.equ o07 = 0x07
;
; bit numbers:
;
.equ b0 = 0x00
.equ b1 = 0x01
.equ b2 = 0x02
.equ b3 = 0x03
.equ b4 = 0x04
.equ b5 = 0x05
.equ b6 = 0x06
.equ b7 = 0x07
;---------------------------------------
;
L0000:
rjmp _reset ; L0010
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
rjmp L0000
; ----------- jump on last line
nop
;
_reset:
; L0010:
cli
clr r30
out p1C,r30
out p35,r30
ldi r31,k18
wdr
; pc=0x16(0x2C)
;
in r26,p34
andi r26,kF7
out p34,r26
out p21,r31
out p21,r30
ldi r24,k0D
ldi r26,k02
clr r27
L001E:
st X+,r30
dec r24
brne L001E
; ----- branch on last line
ldi r24,k00
ldi r25,k01
ldi r26,k60
L0024:
st X+,r30
sbiw r24,k01
brne L0024
; ----- branch on last line
ldi r30,k1E
ldi r31,k00
L0029:
lpm r24,Z+
lpm r25,Z+
sbiw r24,k00
breq L0039
; ----- branch on last line
lpm r26,Z+
lpm r27,Z+
lpm r0,Z+
lpm r1,Z+
movw r22,r30
movw r30,r0
L0033:
lpm r0,Z+
st X+,r0
sbiw r24,k01
brne L0033
; ----- branch on last line
movw r30,r22
rjmp L0029
; ----------- jump on last line
L0039:
ldi r30,k00
out p11,r30
ldi r30,k00
out p12,r30
ldi r30,k00
out p13,r30
ldi r30,k5F
out p3D,r30
ldi r30,k01
out p3E,r30
ldi r28,kA0
ldi r29,k00
rjmp L012A
; ----------- jump on last line
L0046:
ldi r30,k80
out p26,r30
ldi r30,k00
out p26,r30
ldi r30,k3F
out p18,r30
rcall L021E
ldi r30,k00
out p2A,r30
out p33,r30
out p32,r30
out p29,r30
out p28,r30
out p27,r30
out p30,r30
out p2C,r30
out p2F,r30
out p2E,r30
out p2B,r30
out p2D,r30
out p3B,r30
out p35,r30
out p39,r30
out p0D,r30
ldi r30,k80
out p08,r30
ldi r30,k00
out p03,r30
ret
;----------------------*
; pc=0x63(0xC6)
;
L0063:
rcall L02AE
ldi r17,k00
ldi r18,k00
ldi r16,k00
L0067:
cpi r16,k0A
brcc L006F
; ----- branch on last line
rcall L0221
subi r30,k60
sbci r31,kFF
rcall L0224
subi r16,kFF
rjmp L0067
; ----------- jump on last line
L006F:
ldi r17,k10
ldi r18,k00
ldi r16,k00
L0072:
cpi r16,k02
brcc L007A
; ----- branch on last line
rcall L0221
subi r30,k54
sbci r31,kFF
rcall L0224
subi r16,kFF
rjmp L0072
; ----------- jump on last line
L007A:
ldi r17,k14
ldi r18,k00
ldi r16,k00
L007D:
cpi r16,k02
brcc L0085
; ----- branch on last line
rcall L0221
subi r30,k52
sbci r31,kFF
rcall L0224
subi r16,kFF
rjmp L007D
; ----------- jump on last line
L0085:
ldi r17,k18
ldi r18,k00
ldi r16,k00
L0088:
cpi r16,k04
brcc L0090
; ----- branch on last line
rcall L0221
subi r30,k50
sbci r31,kFF
rcall L0224
subi r16,kFF
rjmp L0088
; ----------- jump on last line
L0090:
rcall L02B4
adiw r28,k03
ret
;----------------------*
; pc=0x93(0x126)
;
L0093:
rcall L02AC
ldi r17,k00
ldi r18,k00
ldi r19,kA0
ldi r20,k00
ldi r16,k00
L0099:
cpi r16,k02
brcc L00A3
; ----- branch on last line
push r18
push r17
rcall L022D
pop r26
pop r27
rcall L0235
subi r16,kFF
rjmp L0099
; ----------- jump on last line
L00A3:
ldi r17,k10
ldi r18,k00
ldi r19,kAC
ldi r20,k00
ldi r16,k00
L00A8:
cpi r16,k02
brcc L00B2
; ----- branch on last line
push r18
push r17
rcall L022D
pop r26
pop r27
rcall L0235
subi r16,kFF
rjmp L00A8
; ----------- jump on last line
L00B2:
ldi r17,k14
ldi r18,k00
ldi r19,kAE
ldi r20,k00
ldi r16,k00
L00B7:
cpi r16,k02
brcc L00C1
; ----- branch on last line
push r18
push r17
rcall L022D
pop r26
pop r27
rcall L0235
subi r16,kFF
rjmp L00B7
; ----------- jump on last line
L00C1:
rcall L02B2
adiw r28,k05
ret
;----------------------*
; pc=0xC4(0x188)
;
L00C4:
rcall L02AF
ldi r17,k80
ldi r30,k3F
out p17,r30
rcall L023A
rcall L0242
ldi r16,k00
L00CB:
cpi r16,k08
brcc L00DE
; ----- branch on last line
rcall L023A
mov r30,r17
ldd r26,Y+o02
and r30,r26
cpi r30,k80
brne L00D5
; ----- branch on last line
sbi p18,b3
rjmp L00D8
; ----------- jump on last line
L00D5:
in r30,p18
andi r30,k37
out p18,r30
L00D8:
ldd r30,Y+o02
lsl r30
std Y+o02,r30
rcall L0242
subi r16,kFF
rjmp L00CB
; ----------- jump on last line
L00DE:
rcall L021E
ldi r30,k02
ldi r31,k00
rcall L0248
rcall L02B5
adiw r28,k03
ret
;----------------------*
; pc=0xE5(0x1CA)
;
L00E5:
rcall L02AD
ldi r17,k00
rcall L021E
L00E8:
rcall L024B
; --------- this is skippy
sbis p16,b4
rjmp L00EC
; --------- last may be skipped
; pc=0xEB(0x1D6)
;
rjmp L00E8
; ----------- jump on last line
L00EC:
ldi r24,kFA
ldi r25,k00
L00EE:
sbiw r24,k01
brne L00EE
; ----- branch on last line
rcall L024F
L00F1:
cpi r18,kE8
ldi r30,k03
cpc r19,r30
brcc L00FD
; ----- branch on last line
in r30,p16
andi r30,k10
cpi r30,k10
breq L00FD
; ----- branch on last line
rcall L024B
subi r18,kFF
sbci r19,kFF
rjmp L00F1
; ----------- jump on last line
L00FD:
ldi r24,k11
L00FE:
dec r24
brne L00FE
; ----- branch on last line
ldi r16,k00
L0101:
cpi r16,k08
brcc L0126
; ----- branch on last line
rcall L024F
L0104:
cpi r18,kC8
ldi r30,k00
cpc r19,r30
brcc L010E
; ----- branch on last line
; --------- this is skippy
sbis p16,b4
rjmp L010E
; --------- last may be skipped
; pc=0x10A(0x214)
;
rcall L024B
subi r18,kFF
sbci r19,kFF
rjmp L0104
; ----------- jump on last line
L010E:
ldi r24,k11
L010F:
dec r24
brne L010F
; ----- branch on last line
rcall L024F
L0112:
cpi r18,kC8
ldi r30,k00
cpc r19,r30
brcc L011E
; ----- branch on last line
in r30,p16
andi r30,k10
cpi r30,k10
breq L011E
; ----- branch on last line
rcall L024B
subi r18,kFF
sbci r19,kFF
rjmp L0112
; ----------- jump on last line
L011E:
lsl r17
in r30,p16
andi r30,k08
cpi r30,k08
brne L0124
; ----- branch on last line
ori r17,k01
L0124:
subi r16,kFF
rjmp L0101
; ----------- jump on last line
L0126:
mov r30,r17
rcall L02B3
adiw r28,k04
ret
;----------------------*
; pc=0x12A(0x254)
;
L012A:
sbiw r28,k08
ldi r17,k00
rcall L0046
L012D:
rcall L00E5
cpi r30,k56
brne L015E
; ----- branch on last line
rcall L00E5
cpi r30,k32
brne L015E
; ----- branch on last line
rcall L00E5
mov r20,r30
cpi r20,k30
brne L014A
; ----- branch on last line
ldi r16,k00
L0138:
cpi r16,k08
brcc L0144
; ----- branch on last line
rcall L0221
rcall L0252
push r31
push r30
rcall L00E5
pop r26
pop r27
st X,r30
subi r16,kFF
rjmp L0138
; ----------- jump on last line
L0144:
ldi r30,k0A
ldi r31,k00
rcall L0248
rcall L0256
ldi r17,k01
rjmp L015E
; ----------- jump on last line
L014A:
cpi r20,k57
brne L015E
; ----- branch on last line
ldi r16,k00
L014D:
cpi r16,k08
brcc L0159
; ----- branch on last line
rcall L0221
rcall L0252
push r31
push r30
rcall L00E5
pop r26
pop r27
st X,r30
subi r16,kFF
rjmp L014D
; ----------- jump on last line
L0159:
ldi r30,k0A
ldi r31,k00
rcall L0248
rcall L0256
ldi r17,k64
L015E:
cpi r17,k01
brne L0190
; ----- branch on last line
rcall L00E5
cpi r30,k43
brne L0190
; ----- branch on last line
rcall L00E5
cpi r30,kA5
brne L0190
; ----- branch on last line
ldi r30,k00
ldi r31,k00
movw r18,r30
movw r2,r30
rcall L0063
lds r2,D00A0
clr r3
lds r31,D00A1
ldi r30,k00
add r2,r30
adc r3,r31
movw r30,r2
adiw r30,k01
movw r2,r30
rcall L0265
st -Y,r2
rcall L00C4
mov r30,r3
rcall L0268
rcall L00E5
mov r18,r30
clr r19
rcall L00E5
mov r31,r30
ldi r30,k00
rcall L026B
rcall L0265
cp r2,r18
cpc r3,r19
brne L018D
; ----- branch on last line
movw r30,r2
sts D00A0,r30
sts D00A1,r3
rcall L026E
rjmp L018F
; ----------- jump on last line
L018D:
ldi r30,k4E
rcall L0272
L018F:
ldi r17,k02
L0190:
cpi r17,k02
brne L01A0
; ----- branch on last line
rcall L00E5
cpi r30,k59
brne L01A0
; ----- branch on last line
rcall L0265
lds r30,D00A2
rcall L0272
lds r30,D00A3
rcall L0272
lds r30,D00A4
rcall L0272
ldi r17,k03
L01A0:
cpi r17,k03
brne L01AD
; ----- branch on last line
rcall L00E5
cpi r30,k41
brne L01AD
; ----- branch on last line
rcall L0265
lds r30,D00A5
rcall L0272
lds r30,D00A6
rcall L0272
ldi r17,k04
L01AD:
cpi r17,k04
brne L01C3
; ----- branch on last line
rcall L00E5
cpi r30,k55
brne L01C3
; ----- branch on last line
rcall L00E5
cpi r30,k43
brne L01C3
; ----- branch on last line
rcall L0265
lds r30,D00B0
rcall L0272
lds r30,D00B1
rcall L0272
lds r30,D00B2
rcall L0272
lds r30,D00B3
rcall L0272
ldi r17,k05
L01C3:
cpi r17,k05
brne L01DD
; ----- branch on last line
rcall L00E5
cpi r30,k52
brne L01DD
; ----- branch on last line
rcall L00E5
cpi r30,k43
brne L01DD
; ----- branch on last line
rcall L0274
rcall L0279
mov r4,r18
mov r5,r19
rcall L024F
rcall L0280
mov r6,r18
mov r7,r19
rcall L0265
st -Y,r4
rcall L00C4
mov r30,r5
rcall L0268
st -Y,r6
rcall L00C4
mov r30,r7
rcall L0268
ldi r17,k00
L01DD:
cpi r17,k64
breq L01E0
; ----- branch on last line
rjmp L021B
; ----------- jump on last line
L01E0:
rcall L0063
rcall L0274
rcall L0279
mov r4,r18
mov r5,r19
rcall L024F
rcall L0280
mov r6,r18
mov r7,r19
rcall L00E5
cpi r30,k49
brne L021B
; ----- branch on last line
rcall L00E5
mov r20,r30
rcall L0265
cpi r20,k50
brne L01FB
; ----- branch on last line
movw r30,r4
adiw r30,k01
movw r4,r30
movw r30,r4
sts D00AC,r30
sts D00AD,r5
rcall L026E
rjmp L021A
; ----------- jump on last line
L01FB:
cpi r20,k46
brne L0207
; ----- branch on last line
movw r30,r6
adiw r30,k01
movw r6,r30
movw r30,r6
sts D00AE,r30
sts D00AF,r7
rcall L026E
rjmp L021A
; ----------- jump on last line
L0207:
cpi r20,k43
brne L0218
; ----- branch on last line
ldi r30,k00
sts D00A0,r30
sts D00A1,r30
sts D00AC,r30
sts D00AD,r30
sts D00AE,r30
sts D00AF,r30
rcall L026E
rjmp L021A
; ----------- jump on last line
L0218:
ldi r30,k4E
rcall L0272
L021A:
ldi r17,k00
L021B:
rcall L021E
rjmp L012D
; ----------- jump on last line
L021D:
rjmp L021D
; ----------- jump on last line
; pc=0x21E(0x43C)
;
L021E:
ldi r30,k27
out p17,r30
ret
;----------------------*
; pc=0x221(0x442)
;
L0221:
mov r30,r16
ldi r31,k00
ret
;----------------------*
; pc=0x224(0x448)
;
L0224:
movw r0,r30
mov r26,r17
mov r27,r18
subi r17,kFF
sbci r18,kFF
rcall L0293
movw r26,r0
st X,r30
ret
;----------------------*
; pc=0x22D(0x45A)
;
L022D:
subi r17,kFF
sbci r18,kFF
mov r26,r19
mov r27,r20
subi r19,kFF
sbci r20,kFF
ld r30,X
ret
;----------------------*
; pc=0x235(0x46A)
;
L0235:
rcall L029E
ldi r24,k03
L0237:
dec r24
brne L0237
; ----- branch on last line
ret
;----------------------*
; pc=0x23A(0x474)
;
L023A:
in r30,p18
andi r30,k2F
out p18,r30
ldi r24,kC8
ldi r25,k00
L023F:
sbiw r24,k01
brne L023F
; ----- branch on last line
ret
;----------------------*
; pc=0x242(0x484)
;
L0242:
sbi p18,b4
ldi r24,kC8
ldi r25,k00
L0245:
sbiw r24,k01
brne L0245
; ----- branch on last line
ret
;----------------------*
; pc=0x248(0x490)
;
L0248:
st -Y,r31
st -Y,r30
rjmp L0287
; ----------- jump on last line
L024B:
ldi r24,k03
L024C:
dec r24
brne L024C
; ----- branch on last line
ret
;----------------------*
; pc=0x24F(0x49E)
;
L024F:
ldi r18,k00
ldi r19,k00
ret
;----------------------*
; pc=0x252(0x4A4)
;
L0252:
movw r26,r28
add r30,r26
adc r31,r27
ret
;----------------------*
; pc=0x256(0x4AC)
;
L0256:
ldd r26,Y+o01
ldi r30,k43
eor r30,r26
st -Y,r30
rcall L00C4
ldd r26,Y+o03
ldi r30,k4F
eor r30,r26
st -Y,r30
rcall L00C4
ldd r26,Y+o07
ldi r30,k4D
eor r30,r26
st -Y,r30
rjmp L00C4
; ----------- jump on last line
L0265:
ldi r30,k05
ldi r31,k00
rjmp L0248
; ----------- jump on last line
L0268:
andi r31,k00
st -Y,r30
rjmp L00C4
; ----------- jump on last line
L026B:
add r18,r30
adc r19,r31
ret
;----------------------*
; pc=0x26E(0x4DC)
;
L026E:
ldi r30,k59
st -Y,r30
rcall L00C4
rjmp L0093
; ----------- jump on last line
L0272:
st -Y,r30
rjmp L00C4
; ----------- jump on last line
L0274:
ldi r30,k00
ldi r31,k00
movw r6,r30
movw r4,r30
rjmp L024F
; ----------- jump on last line
L0279:
lds r18,D00AC
clr r19
lds r31,D00AD
ldi r30,k00
rjmp L026B
; ----------- jump on last line
L0280:
lds r18,D00AE
clr r19
lds r31,D00AF
ldi r30,k00
rjmp L026B
; ----------- jump on last line
L0287:
ld r30,Y+
ld r31,Y+
adiw r30,k00
breq L0292
; ----- branch on last line
L028B:
ldi r24,kC4
ldi r25,k09
L028D:
sbiw r24,k01
brne L028D
; ----- branch on last line
wdr
; pc=0x290(0x520)
;
sbiw r30,k01
brne L028B
; ----- branch on last line
L0292:
ret
;----------------------*
; pc=0x293(0x526)
;
L0293:
; --------- this is skippy
sbic p1C,b1
rjmp L0293
; --------- last may be skipped
; pc=0x295(0x52A)
;
push r31
in r31,p3F
cli
out p1E,r26
sbi p1C,b0
in r30,p1D
out p3F,r31
pop r31
ret
;----------------------*
; pc=0x29E(0x53C)
;
L029E:
; --------- this is skippy
sbic p1C,b1
rjmp L029E
; --------- last may be skipped
; pc=0x2A0(0x540)
;
in r25,p3F
cli
out p1E,r26
sbi p1C,b0
in r24,p1D
cp r30,r24
breq L02AA
; ----- branch on last line
out p1D,r30
sbi p1C,b2
sbi p1C,b1
L02AA:
out p3F,r25
ret
;----------------------*
; pc=0x2AC(0x558)
;
L02AC:
st -Y,r20
L02AD:
st -Y,r19
L02AE:
st -Y,r18
L02AF:
st -Y,r17
st -Y,r16
ret
;----------------------*
; pc=0x2B2(0x564)
;
L02B2:
ldd r20,Y+o04
L02B3:
ldd r19,Y+o03
L02B4:
ldd r18,Y+o02
L02B5:
ldd r17,Y+o01
ldd r16,Y+o00
ret
;----------------------*
一周热门 更多>