ps2simplesoft.s
来自「ATmega16应用例子」· S 代码 · 共 1,724 行 · 第 1/2 页
S
1,724 行
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
.dbline 323
;
xcall _I2C_Start
tst R16
brne L72
.dbline 324
;
clr R16
xjmp L71
L72:
.dbline 326
;
;
movw R16,R22
xcall _I2C_SendWrDAdr_
tst R16
brne L74
.dbline 327
;
clr R16
xjmp L71
L74:
.dbline 329
;
;
mov R16,R20
xcall _I2C_SendDat
tst R16
brne L76
.dbline 330
;
clr R16
xjmp L71
L76:
.dbline 332
;
;
xcall _I2C_Restart
tst R16
brne L78
.dbline 333
;
clr R16
xjmp L71
L78:
.dbline 335
;
;
ldd R16,y+4
xcall _I2C_SendRdDAdr
tst R16
brne L80
.dbline 336
;
clr R16
xjmp L71
L80:
.dbline 338
;
;
ldd R16,y+6
ldd R17,y+7
xcall _I2C_RcvNAckDat
tst R16
brne L82
.dbline 339
;
clr R16
xjmp L71
L82:
.dbline 341
;
;
ldi R24,148
out 0x36,R24
.dbline 343
;
;
ldi R16,1
.dbline -2
L71:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym l pRdDat 6 pc
.dbsym l rdDAdr 4 c
.dbsym r wordAdr 20 c
.dbsym r wrDAdr 22 i
.dbend
.dbfunc e I2C_Read_ _I2C_Read_ fc
; i -> R20
; num -> R22
; pRdDat -> R10,R11
; rdDAdr -> y+8
; wordAdr -> R20
; wrDAdr -> R12,R13
.even
_I2C_Read_::
xcall push_gset4
mov R20,R18
movw R12,R16
ldd R10,y+10
ldd R11,y+11
ldd R22,y+12
.dbline -1
.dbline 359
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
.dbline 362
;
;
;
xcall _I2C_Start
tst R16
brne L85
.dbline 363
;
clr R16
xjmp L84
L85:
.dbline 365
;
;
movw R16,R12
xcall _I2C_SendWrDAdr_
tst R16
brne L87
.dbline 366
;
clr R16
xjmp L84
L87:
.dbline 368
;
;
mov R16,R20
xcall _I2C_SendDat
tst R16
brne L89
.dbline 369
;
clr R16
xjmp L84
L89:
.dbline 371
;
;
xcall _I2C_Restart
tst R16
brne L91
.dbline 372
;
clr R16
xjmp L84
L91:
.dbline 374
;
;
ldd R16,y+8
xcall _I2C_SendRdDAdr
tst R16
brne L93
.dbline 375
;
clr R16
xjmp L84
L93:
.dbline 377
;
;
clr R20
xjmp L98
L95:
.dbline 378
;
mov R16,R20
clr R17
add R16,R10
adc R17,R11
xcall _I2C_RcvAckDat
tst R16
brne L99
.dbline 379
;
clr R16
xjmp L84
L99:
L96:
.dbline 377
inc R20
L98:
.dbline 377
mov R24,R22
subi R24,1
cp R20,R24
brlo L95
.dbline 381
;
;
mov R16,R20
clr R17
add R16,R10
adc R17,R11
xcall _I2C_RcvNAckDat
tst R16
brne L101
.dbline 382
;
clr R16
xjmp L84
L101:
.dbline 384
;
;
ldi R24,148
out 0x36,R24
.dbline 386
;
;
ldi R16,1
.dbline -2
L84:
xcall pop_gset4
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r num 22 c
.dbsym r pRdDat 10 pc
.dbsym l rdDAdr 8 c
.dbsym r wordAdr 20 c
.dbsym r wrDAdr 12 i
.dbend
.dbfile D:\ICC_H\Hardware.H
.dbfunc e delay50us _delay50us fV
; j -> R20
; t -> R16,R17
.even
_delay50us::
xcall push_gset1
.dbline -1
.dbline 98
.dbline 100
xjmp L107
L104:
.dbline 101
clr R20
xjmp L111
L108:
.dbline 102
L109:
.dbline 101
inc R20
L111:
.dbline 101
cpi R20,70
brlo L108
L105:
.dbline 100
subi R16,1
sbci R17,0
L107:
.dbline 100
clr R2
clr R3
cp R2,R16
cpc R3,R17
brlt L104
.dbline -2
.dbline 103
L103:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r j 20 c
.dbsym r t 16 I
.dbend
.dbfunc e delay50ms _delay50ms fV
; i -> R20,R21
; t -> R16,R17
.even
_delay50ms::
xcall push_gset1
.dbline -1
.dbline 113
.dbline 115
xjmp L116
L113:
.dbline 116
clr R20
clr R21
xjmp L120
L117:
.dbline 117
L118:
.dbline 116
subi R20,255 ; offset = 1
sbci R21,255
L120:
.dbline 116
cpi R20,162
ldi R30,205
cpc R21,R30
brlo L117
L114:
.dbline 115
subi R16,1
sbci R17,0
L116:
.dbline 115
clr R2
clr R3
cp R2,R16
cpc R3,R17
brlt L113
.dbline -2
.dbline 118
L112:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 i
.dbsym r t 16 I
.dbend
.area lit(rom, con, rel)
_unshifted::
.byte 28,'a
.byte 50,'b
.byte 33,'c
.byte 35,'d
.byte 36,'e
.byte 43,'f
.byte 52,'g
.byte 51,'h
.byte 'C,'i
.byte 59,'j
.byte 'B,'k
.byte 'K,'l
.byte 58,'m
.byte 49,'n
.byte 'D,'o
.byte 'M,'p
.byte 21,'q
.byte 45,'r
.byte 27,'s
.byte 44,'t
.byte 60,'u
.byte 42,'v
.byte 29,'w
.byte 34,'x
.byte 53,'y
.byte 26,'z
.byte 'E,48
.byte 22,49
.byte 30,50
.byte 38,51
.byte 37,52
.byte 46,53
.byte 54,54
.byte 61,55
.byte 62,56
.byte 'F,57
.byte 14,96
.byte 'N,45
.byte 'U,61
.byte 93,92
.byte 41,32
.byte 'T,91
.byte 91,93
.byte 'L,59
.byte 'R,39
.byte 'A,44
.byte 'I,46
.byte 'J,47
.byte 'q,46
.byte 'p,48
.byte 'i,49
.byte 'r,50
.byte 'z,51
.byte 'k,52
.byte 's,53
.byte 't,54
.byte 'l,55
.byte 'u,56
.byte 125,57
.dbfile D:\ICC_H\PS2.H
.dbsym e unshifted _unshifted A[118:59:2]kc
_shifted::
.byte 28,'A
.byte 50,'B
.byte 33,'C
.byte 35,'D
.byte 36,'E
.byte 43,'F
.byte 52,'G
.byte 51,'H
.byte 'C,'I
.byte 59,'J
.byte 'B,'K
.byte 'K,'L
.byte 58,'M
.byte 49,'N
.byte 'D,'O
.byte 'M,'P
.byte 21,'Q
.byte 45,'R
.byte 27,'S
.byte 44,'T
.byte 60,'U
.byte 42,'V
.byte 29,'W
.byte 34,'X
.byte 53,'Y
.byte 26,'Z
.byte 'E,48
.byte 22,49
.byte 30,50
.byte 38,51
.byte 37,52
.byte 46,53
.byte 54,54
.byte 61,55
.byte 62,56
.byte 'F,57
.byte 14,126
.byte 'N,95
.byte 'U,43
.byte 93,124
.byte 41,32
.byte 'T,123
.byte 91,125
.byte 'L,58
.byte 'R,34
.byte 'A,60
.byte 'I,62
.byte 'J,63
.byte 'q,46
.byte 'p,48
.byte 'i,49
.byte 'r,50
.byte 'z,51
.byte 'k,52
.byte 's,53
.byte 't,54
.byte 'l,55
.byte 'u,56
.byte 125,57
.dbsym e shifted _shifted A[118:59:2]kc
.area data(ram, con, rel)
.dbfile D:\ICC_H\PS2.H
_rcvF::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile D:\ICC_H\PS2.H
.dbfile E:\ProductPro\M16SD\ICCAVR\PS2\PS2SimpleSoft\PS2SimpleSoft.c
.dbsym e rcvF _rcvF c
L122:
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\ProductPro\M16SD\ICCAVR\PS2\PS2SimpleSoft\PS2SimpleSoft.c
.area text(rom, con, rel)
.dbfile E:\ProductPro\M16SD\ICCAVR\PS2\PS2SimpleSoft\PS2SimpleSoft.c
.dbfunc e check _check fV
.dbsym s rcvBits L122 c
.even
_check::
.dbline -1
.dbline 75
.dbline 78
sbi 0x17,1
.dbline 79
.dbline 79
nop
.dbline 79
nop
.dbline 79
nop
.dbline 79
nop
.dbline 79
.dbline 79
.dbline 80
sbi 0x18,1
.dbline 81
.dbline 81
nop
.dbline 81
nop
.dbline 81
nop
.dbline 81
nop
.dbline 81
.dbline 81
.dbline 83
cbi 0x17,1
.dbline 84
.dbline 84
nop
.dbline 84
nop
.dbline 84
nop
.dbline 84
nop
.dbline 84
.dbline 84
.dbline 85
sbic 0x16,1
rjmp L123
.dbline 86
.dbline 87
clr R2
lds R3,L122
cp R2,R3
brsh L125
mov R24,R3
cpi R24,9
brsh L125
.dbline 88
.dbline 89
lds R2,_keyVal
lsr R2
sts _keyVal,R2
.dbline 92
sbis 0x16,0
rjmp L127
.dbline 93
mov R24,R2
ori R24,128
sts _keyVal,R24
L127:
.dbline 94
L125:
.dbline 95
lds R24,L122
subi R24,255 ; addi 1
sts L122,R24
L129:
.dbline 96
L130:
.dbline 96
sbis 0x16,1
rjmp L129
.dbline 98
ldi R24,10
lds R2,L122
cp R24,R2
brsh L132
.dbline 99
.dbline 100
clr R2
sts L122,R2
.dbline 101
ldi R24,1
sts _rcvF,R24
.dbline 102
L132:
.dbline 103
L123:
.dbline -2
.dbline 104
L121:
.dbline 0 ; func end
ret
.dbend
.area data(ram, con, rel)
.dbfile E:\ProductPro\M16SD\ICCAVR\PS2\PS2SimpleSoft\PS2SimpleSoft.c
L135:
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\ProductPro\M16SD\ICCAVR\PS2\PS2SimpleSoft\PS2SimpleSoft.c
L136:
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile E:\ProductPro\M16SD\ICCAVR\PS2\PS2SimpleSoft\PS2SimpleSoft.c
.area text(rom, con, rel)
.dbfile E:\ProductPro\M16SD\ICCAVR\PS2\PS2SimpleSoft\PS2SimpleSoft.c
.dbfunc e keyHandle _keyHandle fV
.dbsym s shift L136 c
.dbsym s isUp L135 c
; i -> R20
; val -> R16
.even
_keyHandle::
xcall push_gset1
.dbline -1
.dbline 114
.dbline 118
clr R2
sts _rcvF,R2
.dbline 119
out 0x1b,R16
.dbline 120
lds R2,L135
tst R2
breq X3
xjmp L137
X3:
.dbline 121
.dbline 122
mov R20,R16
clr R21
cpi R20,89
ldi R30,0
cpc R21,R30
breq L144
ldi R24,89
ldi R25,0
cp R24,R20
cpc R25,R21
brlt L162
L161:
cpi R20,18
ldi R30,0
cpc R21,R30
breq L143
xjmp L139
L162:
cpi R20,240
ldi R30,0
cpc R21,R30
breq L142
xjmp L139
X1:
.dbline 123
L142:
.dbline 125
ldi R24,1
sts L135,R24
.dbline 126
xjmp L138
L143:
.dbline 128
ldi R24,1
sts L136,R24
.dbline 129
xjmp L138
L144:
.dbline 131
ldi R24,1
sts L136,R24
.dbline 132
xjmp L138
L139:
.dbline 134
lds R2,L136
tst R2
brne L145
.dbline 135
.dbline 141
clr R20
xjmp L150
L147:
.dbline 142
L148:
.dbline 141
inc R20
L150:
.dbline 141
ldi R24,2
mul R24,R20
movw R30,R0
ldi R24,<_unshifted
ldi R25,>_unshifted
add R30,R24
adc R31,R25
lpm R30,Z
cp R30,R16
breq L151
cpi R20,59
brlo L147
L151:
.dbline 143
ldi R24,2
mul R24,R20
movw R30,R0
ldi R24,<_unshifted
ldi R25,>_unshifted
add R30,R24
adc R31,R25
lpm R30,Z
cp R30,R16
breq X4
xjmp L138
X4:
.dbline 144
.dbline 146
xjmp L138
L145:
.dbline 148
.dbline 154
clr R20
xjmp L157
L154:
.dbline 155
L155:
.dbline 154
inc R20
L157:
.dbline 154
ldi R24,2
mul R24,R20
movw R30,R0
ldi R24,<_shifted
ldi R25,>_shifted
add R30,R24
adc R31,R25
lpm R30,Z
cp R30,R16
breq L158
cpi R20,59
brlo L154
L158:
.dbline 156
ldi R24,2
mul R24,R20
movw R30,R0
ldi R24,<_shifted
ldi R25,>_shifted
add R30,R24
adc R31,R25
lpm R30,Z
cp R30,R16
brne L138
.dbline 157
out 0x12,R16
.dbline 158
.dbline 159
.dbline 160
xjmp L138
L137:
.dbline 162
.dbline 163
clr R2
sts L135,R2
.dbline 164
mov R20,R16
clr R21
cpi R20,18
ldi R30,0
cpc R21,R30
breq L166
cpi R20,18
ldi R30,0
cpc R21,R30
brlt L163
L168:
cpi R20,89
ldi R30,0
cpc R21,R30
breq L167
xjmp L163
X2:
.dbline 165
L166:
.dbline 167
clr R2
sts L136,R2
.dbline 168
xjmp L164
L167:
.dbline 170
clr R2
sts L136,R2
.dbline 171
L163:
L164:
.dbline 173
L138:
.dbline -2
.dbline 174
L134:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r val 16 c
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 184
.dbline 185
ldi R24,255
out 0x1a,R24
.dbline 186
out 0x11,R24
.dbline 187
cbi 0x17,0
xjmp L171
L170:
.dbline 189
.dbline 190
xcall _check
.dbline 191
lds R2,_rcvF
tst R2
breq L173
.dbline 192
lds R16,_keyVal
xcall _keyHandle
L173:
.dbline 193
L171:
.dbline 188
xjmp L170
X5:
.dbline -2
.dbline 194
L169:
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile E:\ProductPro\M16SD\ICCAVR\PS2\PS2SimpleSoft\PS2SimpleSoft.c
_keyVal::
.blkb 1
.dbsym e keyVal _keyVal c
_dataElem::
.blkb 6
.dbfile D:\ICC_H\Software.H
.dbsym e dataElem _dataElem A[6:6]c
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?