⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 udisk.s

📁 AVR单片机平台Atmega32+CH375A芯片读写U盘代码
💻 S
📖 第 1 页 / 共 5 页
字号:
	ldi R18,<_nComBuff+3
	ldi R19,>_nComBuff+3
	ldi R16,<_mCmdParam
	ldi R17,>_mCmdParam
	xcall _strcpy
	.dbline 448
	xcall _CH375FileErase
	sts _OperReturn,R16
	.dbline 449
	xcall _ReturnErrorCode
	.dbline 450
	ldi R24,2
	sts _B_status,R24
	.dbline 451
	xjmp L145
L159:
	.dbline 453
	ldi R16,255
	xcall _ModuleNewFile
	.dbline 454
	xjmp L145
L144:
	.dbline 456
	ldi R16,67
	xcall _ReturnErrorCode
	.dbline 457
	ldi R24,2
	sts _B_status,R24
	.dbline 458
L145:
	.dbline -2
L143:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e ModuleByteRead _ModuleByteRead fV
	.even
_ModuleByteRead::
	sbiw R28,2
	.dbline -1
	.dbline 469
	.dbline 470
	lds R2,_nComBuff+3
	lds R3,_nComBuff+3+1
	sts _rdcount,R2
	.dbline 471
	tst R2
	breq L163
	.dbline 472
	.dbline 473
	ldi R24,255
	cp R24,R2
	brsh L165
	.dbline 474
	.dbline 475
	sts _mCmdParam,R24
	.dbline 476
	xjmp L167
L165:
	.dbline 479
	.dbline 480
	lds R2,_rdcount
	sts _mCmdParam,R2
L167:
	.dbline 481
	cbi 0x12,7
	.dbline 482
	xcall _CH375ByteRead
	sts _OperReturn,R16
	.dbline 483
	sbi 0x12,7
	.dbline 484
	tst R16
	breq L168
	.dbline 485
	.dbline 486
	xcall _ReturnErrorCode
	.dbline 487
	xjmp L169
L168:
	.dbline 489
	.dbline 490
	ldi R24,64
	sts _nComBuff+2,R24
	.dbline 491
	lds R2,_mCmdParam
	clr R3
	std y+1,R3
	std y+0,R2
	ldi R18,<_mCmdParam+1
	ldi R19,>_mCmdParam+1
	ldi R16,<_nComBuff+3+2
	ldi R17,>_nComBuff+3+2
	xcall _CopyBytes
	.dbline 494
	lds R2,_mCmdParam
	clr R3
	sts _nComBuff+3+1,R3
	sts _nComBuff+3,R2
	.dbline 495
	lds R24,_nComBuff+3
	lds R25,_nComBuff+3+1
	adiw R24,5
	sts _nComBuff+1,R25
	sts _nComBuff,R24
	.dbline 496
	ldi R24,255
	sts _DataPrepared,R24
	.dbline 497
L169:
	.dbline 499
	.dbline 500
L163:
	.dbline 501
	ldi R24,3
	sts _B_status,R24
	.dbline -2
L161:
	adiw R28,2
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e ModuleAttrRead _ModuleAttrRead fV
	.even
_ModuleAttrRead::
	sbiw R28,2
	.dbline -1
	.dbline 508
	.dbline 509
	cbi 0x12,7
	.dbline 510
	xcall _CH375FileQuery
	sts _OperReturn,R16
	.dbline 511
	sbi 0x12,7
	.dbline 512
	tst R16
	breq L177
	.dbline 513
	.dbline 514
	xcall _ReturnErrorCode
	.dbline 515
	xjmp L178
L177:
	.dbline 517
	.dbline 518
	ldi R24,12
	ldi R25,0
	sts _nComBuff+1,R25
	sts _nComBuff,R24
	.dbline 519
	ldi R24,64
	sts _nComBuff+2,R24
	.dbline 520
	ldi R24,9
	std y+1,R25
	std y+0,R24
	ldi R18,<_mCmdParam
	ldi R19,>_mCmdParam
	ldi R16,<_nComBuff+3
	ldi R17,>_nComBuff+3
	xcall _CopyBytes
	.dbline 523
	ldi R24,255
	sts _DataPrepared,R24
	.dbline 524
L178:
	.dbline 525
	ldi R24,3
	sts _B_status,R24
	.dbline -2
L176:
	adiw R28,2
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e ModuleByteWrite _ModuleByteWrite fV
	.even
_ModuleByteWrite::
	sbiw R28,2
	.dbline -1
	.dbline 532
	.dbline 533
	lds R2,_nComBuff+3
	lds R3,_nComBuff+3+1
	sts _rdcount,R2
	.dbline 534
	tst R2
	breq L183
	.dbline 535
	.dbline 536
	ldi R24,255
	cp R24,R2
	brsh L185
	.dbline 537
	.dbline 538
	sts _mCmdParam,R24
	.dbline 539
	xjmp L187
L185:
	.dbline 542
	.dbline 543
	lds R2,_rdcount
	sts _mCmdParam,R2
L187:
	.dbline 544
	cbi 0x12,6
	.dbline 545
	lds R2,_mCmdParam
	clr R3
	std y+1,R3
	std y+0,R2
	ldi R18,<_nComBuff+3+2
	ldi R19,>_nComBuff+3+2
	ldi R16,<_mCmdParam+1
	ldi R17,>_mCmdParam+1
	xcall _CopyBytes
	.dbline 548
	xcall _CH375ByteWrite
	sts _OperReturn,R16
	.dbline 549
	sbi 0x12,6
	.dbline 550
	tst R16
	breq L191
	.dbline 551
	.dbline 552
	xcall _ReturnErrorCode
	.dbline 553
	xjmp L192
L191:
	.dbline 555
	.dbline 556
	lds R2,_mCmdParam
	clr R3
	sts _nComBuff+3+1,R3
	sts _nComBuff+3,R2
	.dbline 557
	ldi R24,64
	sts _nComBuff+2,R24
	.dbline 558
	lds R24,_nComBuff+3
	lds R25,_nComBuff+3+1
	adiw R24,5
	sts _nComBuff+1,R25
	sts _nComBuff,R24
	.dbline 559
L192:
	.dbline 560
	.dbline 561
L183:
	.dbline 562
	ldi R24,3
	sts _B_status,R24
	.dbline -2
L181:
	adiw R28,2
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e ModuleSectorRead _ModuleSectorRead fV
	.even
_ModuleSectorRead::
	sbiw R28,2
	.dbline -1
	.dbline 571
	.dbline 572
	lds R24,_CH375DiskStatus
	cpi R24,20
	brne L197
	.dbline 573
	.dbline 574
	ldi R24,1
	sts _mCmdParam,R24
	.dbline 575
	cbi 0x12,7
	.dbline 576
	xcall _CH375FileRead
	sts _OperReturn,R16
	.dbline 577
	sbi 0x12,7
	.dbline 578
	tst R16
	breq L199
	.dbline 579
	.dbline 580
	xcall _ReturnErrorCode
	.dbline 581
	xjmp L198
L199:
	.dbline 583
	.dbline 584
	ldi R24,512
	ldi R25,2
	std y+1,R25
	std y+0,R24
	ldi R18,<_FILE_DATA_BUF
	ldi R19,>_FILE_DATA_BUF
	ldi R16,<_nComBuff+3+2
	ldi R17,>_nComBuff+3+2
	xcall _CopyBytes
	.dbline 585
	lds R2,_mCmdParam
	clr R3
	sts _nComBuff+3+1,R3
	sts _nComBuff+3,R2
	.dbline 586
	ldi R24,64
	sts _nComBuff+2,R24
	.dbline 587
	ldi R18,9
	ldi R19,0
	lds R16,_nComBuff+3
	lds R17,_nComBuff+3+1
	xcall lsl16
	movw R24,R16
	adiw R24,5
	sts _nComBuff+1,R25
	sts _nComBuff,R24
	.dbline 588
	.dbline 589
	xjmp L198
L197:
	.dbline 591
	.dbline 592
	ldi R16,73
	xcall _ReturnErrorCode
	.dbline 593
L198:
	.dbline -2
L196:
	adiw R28,2
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e ModuleSectorWrite _ModuleSectorWrite fV
	.even
_ModuleSectorWrite::
	sbiw R28,2
	.dbline -1
	.dbline 601
	.dbline 602
	lds R24,_CH375DiskStatus
	cpi R24,20
	brne L207
	.dbline 603
	.dbline 604
	lds R2,_nComBuff+3
	lds R3,_nComBuff+3+1
	sts _mCmdParam,R2
	.dbline 605
	ldi R24,512
	ldi R25,2
	std y+1,R25
	std y+0,R24
	ldi R18,<_nComBuff+3+2
	ldi R19,>_nComBuff+3+2
	ldi R16,<_FILE_DATA_BUF
	ldi R17,>_FILE_DATA_BUF
	xcall _CopyBytes
	.dbline 606
	cbi 0x12,6
	.dbline 607
	xcall _CH375FileWrite
	sts _OperReturn,R16
	.dbline 608
	sbi 0x12,6
	.dbline 609
	tst R16
	breq L212
	.dbline 610
	.dbline 611
	xcall _ReturnErrorCode
	.dbline 612
	xjmp L208
L212:
	.dbline 614
	.dbline 615
	lds R2,_mCmdParam
	clr R3
	sts _nComBuff+3+1,R3
	sts _nComBuff+3,R2
	.dbline 616
	ldi R24,64
	sts _nComBuff+2,R24
	.dbline 617
	ldi R24,5
	ldi R25,0
	sts _nComBuff+1,R25
	sts _nComBuff,R24
	.dbline 618
	.dbline 619
	xjmp L208
L207:
	.dbline 621
	.dbline 622
	ldi R16,73
	xcall _ReturnErrorCode
	.dbline 623
L208:
	.dbline -2
L206:
	adiw R28,2
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e ModuleSetOffset _ModuleSetOffset fV
;     ModeLocate -> R20
	.even
_ModuleSetOffset::
	xcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 639
	.dbline 640
	cpi R20,255
	brne L217
	.dbline 641
	.dbline 642
	lds R4,_nComBuff+3+2
	lds R5,_nComBuff+3+2+1
	lds R2,_nComBuff+3
	lds R3,_nComBuff+3+1
	sts _mCmdParam+1,R3
	sts _mCmdParam,R2
	sts _mCmdParam+2+1,R5
	sts _mCmdParam+2,R4
	.dbline 643
	xcall _CH375FileLocate
	sts _OperReturn,R16
	.dbline 644
	tst R16
	breq L220
	.dbline 645
	xcall _ReturnErrorCode
	xjmp L218
L220:
	.dbline 647
	.dbline 648
	ldi R24,64
	sts _nComBuff+2,R24
	.dbline 649
	lds R4,_mCmdParam+2
	lds R5,_mCmdParam+2+1
	lds R2,_mCmdParam
	lds R3,_mCmdParam+1
	sts _nComBuff+3+1,R3
	sts _nComBuff+3,R2
	sts _nComBuff+3+2+1,R5
	sts _nComBuff+3+2,R4
	.dbline 650
	ldi R24,7
	ldi R25,0
	sts _nComBuff+1,R25
	sts _nComBuff,R24
	.dbline 651
	.dbline 652
	xjmp L218
L217:
	.dbline 654
	.dbline 655
	lds R4,_nComBuff+3+2
	lds R5,_nComBuff+3+2+1
	lds R2,_nComBuff+3
	lds R3,_nComBuff+3+1
	sts _mCmdParam+1,R3
	sts _mCmdParam,R2
	sts _mCmdParam+2+1,R5
	sts _mCmdParam+2,R4
	.dbline 656
	xcall _CH375ByteLocate
	sts _OperReturn,R16
	.dbline 657
	tst R16
	breq L225
	.dbline 658
	xcall _ReturnErrorCode
	xjmp L226
L225:
	.dbline 660
	.dbline 661
	ldi R24,64
	sts _nComBuff+2,R24
	.dbline 662
	lds R4,_mCmdParam+2
	lds R5,_mCmdParam+2+1
	lds R2,_mCmdParam
	lds R3,_mCmdParam+1
	sts _nComBuff+3+1,R3
	sts _nComBuff+3,R2
	sts _nComBuff+3+2+1,R5
	sts _nComBuff+3+2,R4
	.dbline 663
	ldi R24,7
	ldi R25,0
	sts _nComBuff+1,R25
	sts _nComBuff,R24
	.dbline 664
L226:
	.dbline 665
L218:
	.dbline -2
L216:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r ModeLocate 20 c
	.dbend
	.dbfunc e StatusOpen _StatusOpen fV
;        rdcount -> <dead>
	.even
_StatusOpen::
	xcall push_gset1
	.dbline -1
	.dbline 671
	.dbline 673
	lds R20,_nComBuff+2
	clr R21
	cpi R20,132
	ldi R30,0
	cpc R21,R30
	brne X7
	xjmp L242
X7:
	cpi R20,133
	ldi R30,0
	cpc R21,R30
	breq L234
	cpi R20,134
	ldi R30,0
	cpc R21,R30
	breq L236
	cpi R20,135
	ldi R30,0
	cpc R21,R30
	breq L235
	cpi R20,136
	ldi R30,0
	cpc R21,R30
	breq L239
	cpi R20,139
	ldi R30,0
	cpc R21,R30
	brne X8
	xjmp L244
X8:
	cpi R20,141
	ldi R30,0
	cpc R21,R30
	breq L237
	cpi R20,142
	ldi R30,0
	cpc R21,R30
	breq L238
	cpi R20,144
	ldi R30,0
	cpc R21,R30
	breq L243
	xjmp L230
X6:
	.dbline 674
L234:
	.dbline 676
	xcall _ModuleByteRead
	.dbline 677
	xjmp L231
L235:
	.dbline 679
	xcall _ModuleAttrRead
	.dbline 680
	xjmp L231
L236:
	.dbline 682
	xcall _ModuleByteWrite
	.dbline 683
	xjmp L231
L237:
	.dbline 685
	xcall _ModuleSectorRead
	.dbline 686
	xjmp L231
L238:
	.dbline 688
	xcall _ModuleSectorWrite
	.dbline 689
	xjmp L231
L239:
	.dbline 691

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -