📄 rbdc.lst
字号:
01DB 9001FA =1 357 MOV DPTR, #CommandTable
01DE 31CC =1 358 CALL BumpDPTR ; Get the routine address
01E0 C082 =1 359 PUSH DPL ; Create a RETURN address on stack
01E2 C083 =1 360 PUSH DPH ; Note: JMP @A+DPTR not used since A, DPTR needed
01E4 7845 =1 361 MOV R0, #ReplyBuffer+2
01E6 E4 =1 362 CLR A
01E7 F6 =1 363 MOV @R0, A ; Clear ReplyBuffer
01E8 18 =1 364 DEC R0
01E9 F6 =1 365 MOV @R0, A
01EA 18 =1 366 DEC R0
01EB 7601 =1 367 MOV @R0, #1 ; Default non-descriptor reply
01ED 907FEA =1 368 MOV DPTR, #SETUPDAT+2 ; Point to LOW(wValue)
01F0 E0 =1 369 MOVX A, @DPTR ; Many of the routines need these
01F1 F5F0 =1 370 MOV B, A ; LOW(wValue) in B
01F3 A3 =1 371 INC DPTR
01F4 E0 =1 372 MOVX A, @DPTR ; HIGH(wValue) in A
01F5 C201 =1 373 CLR STALL
01F7 C203 =1 374 CLR IsDescriptor
01F9 22 =1 375 RET ; Go to service routine
=1 376
=1 377 ; Since the table only contains byte offsets, it is important that all these routines are
=1 378 ; within one page (100H) of CommandTable
=1 379 ;
01FA =1 380 CommandTable:
=1 381 ; First 16 commands are for the Device
01FA 71 =1 382 DB Device_Get_Status - CommandTable
01FB 40 =1 383 DB Device_Clear_Feature - CommandTable
01FC 40 =1 384 DB Invalid - CommandTable
01FD 40 =1 385 DB Device_Set_Feature - CommandTable
A51 MACRO ASSEMBLER RBDC 25/07/99 15:58:57 PAGE 7
01FE 40 =1 386 DB Invalid - CommandTable
01FF 40 =1 387 DB Invalid - CommandTable ; SIE implements Device_Set_Address
0200 8A =1 388 DB Get_Descriptor - CommandTable
0201 40 =1 389 DB Set_Descriptor - CommandTable
0202 6A =1 390 DB Get_Configuration - CommandTable
0203 78 =1 391 DB Set_Configuration - CommandTable
0204 40 =1 392 DB Invalid - CommandTable
0205 40 =1 393 DB Invalid - CommandTable
0206 40 =1 394 DB Invalid - CommandTable
0207 40 =1 395 DB Invalid - CommandTable
0208 40 =1 396 DB Invalid - CommandTable
0209 40 =1 397 DB Invalid - CommandTable
=1 398 ; Next 16 commands are for the Interface
020A 75 =1 399 DB Interface_Get_Status - CommandTable
020B 40 =1 400 DB Interface_Clear_Feature - CommandTable
020C 40 =1 401 DB Invalid - CommandTable
020D 40 =1 402 DB Interface_Set_Feature - CommandTable
020E 40 =1 403 DB Invalid - CommandTable
020F 40 =1 404 DB Invalid - CommandTable
0210 B4 =1 405 DB Get_Class_Descriptor - CommandTable
0211 40 =1 406 DB Set_Class_Descriptor - CommandTable
0212 40 =1 407 DB Invalid - CommandTable
0213 40 =1 408 DB Invalid - CommandTable
0214 40 =1 409 DB Get_Interface - CommandTable
0215 40 =1 410 DB Set_Interface - CommandTable
0216 40 =1 411 DB Invalid - CommandTable
0217 40 =1 412 DB Invalid - CommandTable
0218 40 =1 413 DB Invalid - CommandTable
0219 40 =1 414 DB Invalid - CommandTable
=1 415 ; Next 16 commands are for the Endpoint
021A 75 =1 416 DB Endpoint_Get_Status - CommandTable
021B 42 =1 417 DB Endpoint_Clear_Feature - CommandTable
021C 40 =1 418 DB Invalid - CommandTable
021D 40 =1 419 DB Endpoint_Set_Feature - CommandTable
021E 40 =1 420 DB Invalid - CommandTable
021F 40 =1 421 DB Invalid - CommandTable
0220 40 =1 422 DB Invalid - CommandTable
0221 40 =1 423 DB Invalid - CommandTable
0222 40 =1 424 DB Invalid - CommandTable
0223 40 =1 425 DB Invalid - CommandTable
0224 40 =1 426 DB Invalid - CommandTable
0225 40 =1 427 DB Invalid - CommandTable
0226 40 =1 428 DB Endpoint_Sync_Frame - CommandTable
0227 40 =1 429 DB Invalid - CommandTable
0228 40 =1 430 DB Invalid - CommandTable
0229 40 =1 431 DB Invalid - CommandTable
=1 432 ; Next 16 commands are Class Requests
022A 40 =1 433 DB Invalid - CommandTable
022B 56 =1 434 DB Get_Report - CommandTable
022C 63 =1 435 DB Get_Idle - CommandTable
022D 40 =1 436 DB Get_Protocol - CommandTable
022E 40 =1 437 DB Invalid - CommandTable
022F 40 =1 438 DB Invalid - CommandTable
0230 40 =1 439 DB Invalid - CommandTable
0231 40 =1 440 DB Invalid - CommandTable
0232 40 =1 441 DB Invalid - CommandTable
0233 43 =1 442 DB Set_Report - CommandTable
0234 5D =1 443 DB Set_Idle - CommandTable
0235 40 =1 444 DB Set_Protocol - CommandTable
0236 40 =1 445 DB Invalid - CommandTable
0237 40 =1 446 DB Invalid - CommandTable
0238 40 =1 447 DB Invalid - CommandTable
0239 40 =1 448 DB Invalid - CommandTable
=1 449 ;
=1 450 ; Many requests are INVALID for this example
023A =1 451 Get_Protocol: ; We are not a Boot device
A51 MACRO ASSEMBLER RBDC 25/07/99 15:58:57 PAGE 8
023A =1 452 Set_Protocol: ; We are not a Boot device
023A =1 453 Set_Descriptor: ; Our Descriptors are static
023A =1 454 Set_Class_Descriptor: ; Our Descriptors are static
023A =1 455 Set_Interface: ; We only have one Interface
023A =1 456 Get_Interface: ; We do not have an Alternate setting
023A =1 457 Device_Set_Feature: ; We have no features that can be set or cleared
023A =1 458 Interface_Set_Feature: ; We have no features that can be set or cleared
023A =1 459 Endpoint_Set_Feature: ; We have no features that can be set or cleared
023A =1 460 Device_Clear_Feature: ; We have no features that can be set or cleared
023A =1 461 Interface_Clear_Feature: ; We have no features that can be set or cleared
023A =1 462 Endpoint_Sync_Frame: ; We are not an Isonchronous device
=1 463
023A =1 464 Invalid: ; Invalid Request made, STALL the Endpoint
023A D201 =1 465 SETB STALL
=1 466 ;
023C =1 467 Endpoint_Clear_Feature: ; We have no features that can be set or cleared
=1 468 ;
023C 22 =1 469 Reply: RET
=1 470
023D =1 471 Set_Report: ; Host wants to sent us a Report.
=1 472 ; The ONLY case in this example where host sends data to us
023D 3000FA =1 473 JNB Configured, Invalid ; Need to be Configured to do this command
0240 907FC5 =1 474 MOV DPTR, #Out0ByteCount ; Enable EP0OutBuffer to receive data
0243 F0 =1 475 MOVX @DPTR, A ; Any value will do
0244 907FAA =1 476 MOV DPTR, #OUT07IRQ ; Wait for valid data in EP0OutBuffer
0247 E0 =1 477 Wait4D: MOVX A, @DPTR
0248 5401 =1 478 ANL A, #00000001b
024A 60FB =1 479 JZ Wait4D
024C F0 =1 480 MOVX @DPTR, A ; Clear the interrupt
024D 02043F =1 481 JMP ProcessOutputReport ; RETurn via this subroutine
0250 =1 482 Get_Report: ; Host wants a Report
0250 3000E7 =1 483 JNB Configured, Invalid ; Need to be Configured to do this command
0253 08 =1 484 INC R0 ; Point to ReplyBuffer(1)
0254 7618 =1 485 MOV @R0, #18H ; Reply with a recognizable (arbitary) value
0256 22 =1 486 RET
0257 =1 487 Set_Idle: ; Host wants to tell us how often we should talk
0257 3000E0 =1 488 JNB Configured, Invalid ; Need to be Configured to do this command
025A F541 =1 489 MOV Idle_Time, A
025C 22 =1 490 RET ; Handshake with host
025D =1 491 Get_Idle: ; Host must have forgotten what he told us to do
025D 3000DA =1 492 JNB Configured, Invalid ; Need to be Configured to do this command
0260 08 =1 493 INC R0 ; Point to ReplyBuffer(1)
0261 A641 =1 494 MOV @R0, Idle_Time
0263 22 =1 495 RET
0264 =1 496 Get_Configuration:
0264 3000D5 =1 497 JNB Configured, Reply
0267 08 =1 498 INC R0
0268 A646 =1 499 MOV @R0, CurrentConfiguration
026A 22 =1 500 RET
026B =1 501 Device_Get_Status: ; Only two bits of Device Status are defined
026B 08 =1 502 INC R0 ; Point to ReplyBuffer(1)
026C 7601 =1 503 MOV @R0, #1 ; Bit 1=Remote Wakeup(=0), Bit 0=Self Powered(=1)
026E 22 =1 504 RET
026F =1 505 Interface_Get_Status: ; Interface Status is currently defined as 0
026F =1 506 Endpoint_Get_Status:
026F 7602 =1 507 MOV @R0, #2
0271 22 =1 508 RET
0272 =1 509 Set_Configuration: ; Valid values are 0 and 1
0272 E5F0 =1 510 MOV A, B ; Get LOW(wValue)
0274 600B =1 511 JZ Deconfigured
0276 C3 =1 512 CLR C
0277 9503 =1 513 SUBB A, ConfigurationCount+1 ; This example supports two configurations
0279 50BF =1 514 JNC Invalid
027B 85F046 =1 515 MOV CurrentConfiguration, B
027E D200 =1 516 SETB Configured
0280 22 =1 517 RET
A51 MACRO ASSEMBLER RBDC 25/07/99 15:58:57 PAGE 9
0281 =1 518 Deconfigured:
0281 C200 =1 519 CLR Configured
0283 22 =1 520 Reply2: RET
0284 =1 521 Get_Descriptor: ; Host wants to know who/what we are
0284 D203 =1 522 SETB IsDescriptor
0286 14 =1 523 DEC A ; Valid Values are 1, 2 and 3
0287 9002E0 =1 524 MOV DPTR, #DeviceDescriptor
028A 60B0 =1 525 JZ Reply
028C 14 =1 526 DEC A
028D 9002F2 =1 527 MOV DPTR, #TextConfigurationDescriptor
0290 30F103 =1 528 JNB B.1, Other1 ; B = Descriptor Index (=1 or 2)
0293 900333 =1 529 MOV DPTR, #DotConfigurationDescriptor
0296 60A4 =1 530 Other1: JZ Reply
0298 14 =1 531 DEC A
0299 709F =1 532 JNZ Invalid
=1 533 ; Request is for a String Descriptor
029B 900365 =1 534 MOV DPTR, #String0 ; Point to String 0
029E E5F0 =1 535 MOV A, B ; Get String Index
02A0 =1 536 NextString:
02A0 602A =1 537 JZ FixUpthenReply
02A2 F540 =1 538 MOV Temp, A ; Save String Index
02A4 31CB =1 539 CALL NextDPTR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -