A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 1 DOS MACRO ASSEMBLER A51 V5.28m OBJECT MODULE PLACED IN LCP.OBJ ASSEMBLER INVOKED BY: C:\ANCHOR\KEIL2K\BIN\A51.EXE LCP.A51 RB(0) DB EP LOC OBJ LINE SOURCE 1 NAME LightingControlPanel 2 3 $INCLUDE(../Declare.A51) =1 4 ; This module declares the variables and constants used in the examples =1 5 ; It is common to all of the examples =1 6 ; =1 7 ; Declare Special Function Registers used 0088 =1 8 TimerControl DATA 088H 0089 =1 9 TimerMode DATA 089H 008C =1 10 Timer0High DATA 08CH 00A8 =1 11 EI DATA 0A8H 00E8 =1 12 EIE DATA 0E8H ; EZ-USB specific 0091 =1 13 EXIF DATA 091H ; EZ-USB specific 00D8 =1 14 EICON DATA 0D8H ; EZ-USB specific 0092 =1 15 PageReg DATA 092H ; EZ-USB specific, used with MOVX @Ri 0086 =1 16 DPS DATA 086H ; EZ-USB specific, used with dual data pointers =1 17 ; =1 18 ; "External" memory locations used, EZ-USB specific =1 19 ; Note that most of these variables are in Page 7FH 7FE8 =1 20 SETUPDAT EQU 07FE8H 7FD4 =1 21 SUDPTR EQU 07FD4H 7FB4 =1 22 EP0Control EQU 07FB4H 7F00 =1 23 EP0InBuffer EQU 07F00H 7EC0 =1 24 EP0OutBuffer EQU 07EC0H ; Not in Page 7FH 7E80 =1 25 EP1InBuffer EQU 07E80H ; Not in Page 7FH 7FB5 =1 26 IN0ByteCount EQU 07FB5H 7FC5 =1 27 Out0ByteCount EQU 07FC5H 7FB7 =1 28 IN1ByteCount EQU 07FB7H 7FAC =1 29 IN07IEN EQU 07FACH 7FA9 =1 30 IN07IRQ EQU 07FA9H 7FAD =1 31 OUT07IEN EQU 07FADH 7FAA =1 32 OUT07IRQ EQU 07FAAH 7FAE =1 33 USBIEN EQU 07FAEH 7FAB =1 34 USBIRQ EQU 07FABH 7FD6 =1 35 USBControl EQU 07FD6H 7FA6 =1 36 I2CData EQU 07FA6H 7FA5 =1 37 I2CControl EQU 07FA5H 7F93 =1 38 PortA_Config EQU 07F93H 7F94 =1 39 PortB_Config EQU 07F94H 7F95 =1 40 PortC_Config EQU 07F95H 7F96 =1 41 PortA_OUT EQU 07F96H 7F97 =1 42 PortB_OUT EQU 07F97H 7F98 =1 43 PortC_OUT EQU 07F98H 7F99 =1 44 PortA_PINS EQU 07F99H 7F9A =1 45 PortB_PINS EQU 07F9AH 7F9B =1 46 PortC_PINS EQU 07F9BH 7F9C =1 47 PortA_OE EQU 07F9CH 7F9D =1 48 PortB_OE EQU 07F9DH 7F9E =1 49 PortC_OE EQU 07F9EH =1 50 ; =1 51 ; Byte Variables =1 52 ---- =1 53 DSEG AT 20H 0020 =1 54 FLAGS: DS 1 ; This register is bit-addressable =1 55 ; Bit Variables 0000 =1 56 Configured EQU FLAGS.0 ; Is this device configured 0001 =1 57 STALL EQU FLAGS.1 ; Need to STALL endpoint 0 0002 =1 58 SendData EQU FLAGS.2 ; Need to send data to PC Host A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 2 0003 =1 59 IsDescriptor EQU FLAGS.3 ; Enable a shortcut reply =1 60 ; 0021 =1 61 MonitorSpace: DS 1FH ; Used by Dscope 0040 =1 62 Temp: DS 1 ; A temporary working register 0041 =1 63 Idle_Time: DS 1 ; The time the PC host wants us to wait 0042 =1 64 Expired_Time: DS 1 ; A downcounter for timed Reports 0043 =1 65 ReplyBuffer: DS 3 ; First byte is Count 0046 =1 66 CurrentConfiguration: 0046 =1 67 DS 1 ; Some examples support > 1 configurations =1 68 ; =1 69 ; Declare the specific variables used by each of the examples 0047 =1 70 Overlay EQU $ 0047 =1 71 Old_Buttons: DS 1 ; Used by BAL: stores current button position 0048 =1 72 LEDstrobe: DS 1 ; Used by BAL: strobe one LED on at a time 0049 =1 73 LEDvalue: DS 1 ; Used by BAL: stores current LED value 004A =1 74 Msec_Counter: DS 1 ; Used by BAL: counts up to 4 msec =1 75 0047 =1 76 ORG Overlay ; Overlay the variables (only one set in use at any one tim e) 0047 =1 77 I2CDataByte: DS 1 ; Used by I2C: keep a local copy of data read from I2C bus =1 78 0047 =1 79 ORG Overlay 0047 =1 80 LightValues: DS 6 ; Used by LP: local buffer for light brightness 004D =1 81 WorkingValues: DS 6 ; Used by LP: counted down each half cycle 0053 =1 82 Mask: DS 1 ; Used by LP: TurnON mask for Triacs 0004 =1 83 LastCycle EQU FLAGS.4 ; Used by LP: Tracks Positive & Negative Mains half cycles =1 84 0047 =1 85 ORG Overlay 0047 =1 86 CurrentPosition:DS 1 ; Used by Stepper: motor has 16 stable positions 0048 =1 87 MotorControl: DS 3 ; Used by Stepper: direction, Low(count) and High(count) =1 88 0047 =1 89 ORG Overlay 0047 =1 90 LimitValues: DS 12 ; Used by Temps: local buffer for limits =1 91 0047 =1 92 ORG Overlay 0047 =1 93 ButtonsValue: DS 1 ; Used by RB: buttons are read each full scan 0048 =1 94 DisplayPosition:DS 1 ; Used by RB: holds current display position 0049 =1 95 LEDBuffer: DS 42 ; Used by RB: local buffer for reader board =1 96 =1 97 ; 98 $INCLUDE(Vectors.A51) =1 99 ; This module is specific to the Lighting Control Panel (since it uses Timer 0) =1 100 ;. =1 101 ; It contains all of the interrupt vector declarations and =1 102 ; the first level interrupt servicing (register save, call subroutine, =1 103 ; clear interrupt source, restore registers, return) =1 104 ; Suspend and Resume are handled totally in this module =1 105 ; =1 106 ; A Reset sends us to Program space location 0 ---- =1 107 CSEG AT 0 ; Code space =1 108 USING 0 ; Reset forces Register Bank 0 0000 020355 =1 109 LJMP Reset =1 110 ; =1 111 ; The interrupt vector table is also located here =1 112 ; EZ-USB has two levels of USB interrupts: =1 113 ; 1-the main level is described in this table (at ORG 43H) =1 114 ; 2-there are 21 sources of USB interrupts and these are described in USB_ISR =1 115 ; This means that two levels of acknowledgement and clearing will be required =1 116 ; LJMP INT0_ISR ; Features not used are commented out 000B =1 117 ORG 0BH 000B 020158 =1 118 LJMP Timer0_ISR =1 119 ; ORG 13H =1 120 ; LJMP INT1_ISR =1 121 ; ORG 1BH =1 122 ; LJMP Timer1_ISR =1 123 ; ORG 23H A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 3 =1 124 ; LJMP UART0_ISR =1 125 ; ORG 2BH =1 126 ; LJMP Timer2_ISR =1 127 ; ORG 33H =1 128 ; LJMP WakeUp_ISR =1 129 ; ORG 3BH =1 130 ; LJMP UART1_ISR 0043 =1 131 ORG 43H 0043 020100 =1 132 LJMP USB_ISR ; Auto Vector will replace byte 45H =1 133 ; ORG 4BH =1 134 ; LJMP I2C_ISR =1 135 ; ORG 53H =1 136 ; LJMP INT4_ISR =1 137 ; ORG 5BH =1 138 ; LJMP INT5_ISR =1 139 ; ORG 63H =1 140 ; LJMP INT6_ISR =1 141 00E0 =1 142 ORG 0E0H ; Keep out of the way of dScope monitor =1 143 ; If you are not using dScope then this memory hole =1 144 ; may be used for useful routines. 0100 =1 145 ORG 100H 0100 02013C =1 146 USB_ISR:LJMP SUDAV_ISR 0103 00 =1 147 DB 0 ; Pad entries to 4 bytes 0104 020118 =1 148 LJMP SOF_ISR 0107 00 =1 149 DB 0 0108 020118 =1 150 LJMP SUTOK_ISR 010B 00 =1 151 DB 0 010C 020129 =1 152 LJMP Suspend_ISR 010F 00 =1 153 DB 0 0110 020120 =1 154 LJMP USBReset_ISR 0113 00 =1 155 DB 0 0114 020118 =1 156 LJMP Reserved 0117 00 =1 157 DB 0 =1 158 ; LJMP EP0In_ISR ; Endpoint Interrupts are not used in these examples =1 159 ; DB 0 ; Comment out features not used =1 160 ; LJMP EP0Out_ISR =1 161 ; DB 0 =1 162 ; LJMP EP1In_ISR =1 163 ; DB 0 =1 164 ; LJMP EP1Out_ISR =1 165 ; DB 0 =1 166 ; LJMP EP2In_ISR =1 167 ; DB 0 =1 168 ; LJMP EP2Out_ISR =1 169 ; DB 0 =1 170 ; LJMP EP3In_ISR =1 171 ; DB 0 =1 172 ; LJMP EP3Out_ISR =1 173 ; DB 0 =1 174 ; LJMP EP4In_ISR =1 175 ; DB 0 =1 176 ; LJMP EP4Out_ISR =1 177 ; DB 0 =1 178 ; LJMP EP5In_ISR =1 179 ; DB 0 =1 180 ; LJMP EP5Out_ISR =1 181 ; DB 0 =1 182 ; LJMP EP6In_ISR =1 183 ; DB 0 =1 184 ; LJMP EP6Out_ISR =1 185 ; DB 0 =1 186 ; LJMP EP7In_ISR =1 187 ; DB 0 =1 188 ; LJMP EP7Out_ISR =1 189 ; End of Interrupt Vector tables A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 4 =1 190 =1 191 ; When a feature is used insert the required interrupt processing here =1 192 ; The example use only used Endpoints 0 and 1 and also SOF for timing 0118 =1 193 Reserved: 0118 =1 194 INT0_ISR: 0118 =1 195 INT1_ISR: 0118 =1 196 Timer1_ISR: 0118 =1 197 UART0_ISR: 0118 =1 198 Timer2_ISR: 0118 =1 199 UART1_ISR: 0118 =1 200 I2C_ISR: 0118 =1 201 INT4_ISR: 0118 =1 202 INT5_ISR: 0118 =1 203 INT6_ISR: 0118 =1 204 SOF_ISR: 0118 =1 205 SUTOK_ISR: 0118 =1 206 EP0In_ISR: 0118 =1 207 EP0Out_ISR: 0118 =1 208 EP1In_ISR: 0118 =1 209 EP1Out_ISR: 0118 =1 210 EP2In_ISR: 0118 =1 211 EP2Out_ISR: 0118 =1 212 EP3In_ISR: 0118 =1 213 EP3Out_ISR: 0118 =1 214 EP4In_ISR: 0118 =1 215 EP4Out_ISR: 0118 =1 216 EP5In_ISR: 0118 =1 217 EP5Out_ISR: 0118 =1 218 EP6In_ISR: 0118 =1 219 EP6Out_ISR: 0118 =1 220 EP7In_ISR : 0118 =1 221 EP7Out_ISR: 0118 =1 222 Not_Used: ; Should not get any of these 0118 32 =1 223 RETI =1 224 0119 =1 225 ClearINT2: ; Tell the hardware that we're done 0119 E591 =1 226 MOV A, EXIF 011B C2E4 =1 227 CLR ACC.4 ; Clear the Interrupt 2 bit 011D F591 =1 228 MOV EXIF, A 011F 22 =1 229 RET =1 230 0120 =1 231 USBReset_ISR: ; Bus has been Reset, move to DEFAULT state 0120 C0E0 =1 232 PUSH ACC 0122 C200 =1 233 CLR Configured 0124 3119 =1 234 CALL ClearINT2 =1 235 ; No need to clear source of interrupt 0126 D0E0 =1 236 POP ACC 0128 32 =1 237 RETI =1 238 0129 =1 239 Suspend_ISR: ; SIE detected an Idle bus 0129 C0E0 =1 240 PUSH ACC 012B E587 =1 241 MOV A, PCON 012D 4401 =1 242 ORL A, #1 012F F587 =1 243 MOV PCON, A ; Go to sleep! 0131 00 =1 244 NOP 0132 00 =1 245 NOP ; Wake up here due to a USBResume 0133 00 =1 246 NOP 0134 3119 =1 247 CALL ClearINT2 0136 D0E0 =1 248 POP ACC 0138 32 =1 249 RETI =1 250 0139 =1 251 WakeUp_ISR: ; Not using external WAKEUP in these examples =1 252 ; So this must be due to a USBResume 0139 C2DC =1 253 CLR EICON.4 ; Clear the wakeup interrupt source 013B 32 =1 254 RETI =1 255 A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 5 013C =1 256 SUDAV_ISR: ; A Setup packet has been received 013C C0D0 =1 257 PUSH PSW ; Save Registers before the service routine 013E C0E0 =1 258 PUSH ACC 0140 C082 =1 259 PUSH DPL 0142 C083 =1 260 PUSH DPH 0144 120165 =1 261 CALL ServiceSetupPacket 0147 3119 =1 262 CALL ClearINT2 =1 263 ; Clear the source of the interrupt 0149 7401 =1 264 MOV A, #00000001b 014B 907FAB =1 265 MOV DPTR, #USBIRQ 014E F0 =1 266 MOVX @DPTR, A 014F D083 =1 267 ExitISR:POP DPH ; Restore Registers 0151 D082 =1 268 POP DPL 0153 D0E0 =1 269 POP ACC 0155 D0D0 =1 270 POP PSW 0157 32 =1 271 RETI =1 272 0158 =1 273 Timer0_ISR: 0158 C0D0 =1 274 PUSH PSW ; Save Registers before the service routine 015A C0E0 =1 275 PUSH ACC 015C C082 =1 276 PUSH DPL 015E C083 =1 277 PUSH DPH 0160 1203CA =1 278 CALL ServiceTimerRoutine =1 279 ; Source of the interrupt claered automatically 0163 80EA =1 280 JMP ExitISR =1 281 282 $INCLUDE(../USB_INT.A51) =1 283 ; This module is common to all of the examples. =1 284 ; It services USB Requests from the SIE. =1 285 ; Interpretation of the Output Reports is handled by MAIN =1 286 ; ---- =1 287 CSEG 0165 =1 288 ServiceSetupPacket: 0165 907FE8 =1 289 MOV DPTR, #SETUPDAT ; Point to Setup Packet data 0168 E0 =1 290 MOVX A, @DPTR ; Get the RequestType 0169 A2E7 =1 291 MOV C, ACC.7 ; Bit 7 = 1 means IO device needs to send data to P C Host 016B 9202 =1 292 MOV SendData, C 016D 545C =1 293 ANL A, #01011100b ; IF RequestType[6.4.3.2] = 1 THEN goto BadRequest 016F 7051 =1 294 JNZ BadRequest 0171 E0 =1 295 MOVX A, @DPTR ; IF RequestType[1&0] = 1 THEN goto BadRequest 0172 A2E0 =1 296 MOV C, ACC.0 0174 82E1 =1 297 ANL C, ACC.1 0176 404A =1 298 JC BadRequest 0178 30E502 =1 299 JNB ACC.5, NotB5 ; IF RequestType[5] = 1 THEN RequestType[1,0] = [1, 1] 017B 7403 =1 300 MOV A, #00000011b 017D 5403 =1 301 NotB5: ANL A, #00000011b ; Set CommandIndex[5,4] = RequestType[1,0] 017F C4 =1 302 SWAP A 0180 F540 =1 303 MOV Temp, A ; Save HI nibble of CommandIndex =1 304 ; Set CommandIndex[3,0] = Request[3,0] 0182 A3 =1 305 INC DPTR ; Point to Request 0183 E0 =1 306 MOVX A, @DPTR 0184 540F =1 307 ANL A, #00001111b ; Only 13 are defined today, handle in table 0186 4540 =1 308 ORL A, Temp 0188 1201D1 =1 309 CALL CorrectSubroutine ; goto CommandTable(CommandIndex) =1 310 ; Returns STALL=1 if a stall is required 018B 200134 =1 311 JB STALL, BadRequest 018E 300218 =1 312 JNB SendData, HandShake 0191 200320 =1 313 JB IsDescriptor, LoadSUDPTR; EZ-USB has a short cut for descriptors =1 314 ; Send data in ReplyBuffer 0194 907F02 =1 315 MOV DPTR, #EP0InBuffer+2 0197 7846 =1 316 MOV R0, #ReplyBuffer+3 0199 754003 =1 317 MOV Temp, #3 ; Copy maximum byte count 019C E6 =1 318 CopyRB: MOV A, @R0 019D F0 =1 319 MOVX @DPTR, A A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 6 019E 1582 =1 320 DEC DPL 01A0 18 =1 321 DEC R0 01A1 D540F8 =1 322 DJNZ Temp, CopyRB 01A4 E6 =1 323 MOV A, @R0 ; Get real byte count 01A5 =1 324 SendEP0InBuffer: 01A5 907FB5 =1 325 MOV DPTR, #In0ByteCount 01A8 =1 326 StartXfer: 01A8 F0 =1 327 MOVX @DPTR, A ; This write initiates the transfer 01A9 =1 328 HandShake: ; Handshake with host 01A9 754002 =1 329 MOV Temp, #00000010b ; Set HSNAK to tell the SIE that we're done 01AC =1 330 SetEP0Control: 01AC 907FB4 =1 331 MOV DPTR, #EP0Control 01AF E0 =1 332 MOVX A, @DPTR 01B0 4540 =1 333 ORL A, Temp 01B2 F0 =1 334 MOVX @DPTR, A 01B3 22 =1 335 RET 01B4 =1 336 LoadSUDPTR: ; Send the data pointed to by DPTR 01B4 858240 =1 337 MOV Temp, DPL 01B7 E583 =1 338 MOV A, DPH 01B9 907FD4 =1 339 MOV DPTR, #SUDPTR 01BC F0 =1 340 MOVX @DPTR, A 01BD E540 =1 341 MOV A, Temp 01BF A3 =1 342 INC DPTR 01C0 80E6 =1 343 JMP StartXfer 01C2 =1 344 BadRequest: ; Invalid Request was received 01C2 754003 =1 345 MOV Temp, #00000011b ; Set EP0STALL and HSNAK 01C5 80E5 =1 346 JMP SetEP0Control =1 347 01C7 =1 348 NextDPTR: ; Returns (DPTR + byte DPTR is pointing to) 01C7 E0 =1 349 MOVX A, @DPTR 01C8 =1 350 BumpDPTR: ; Returns (DPTR + ACC) 01C8 2582 =1 351 ADD A, DPL 01CA F582 =1 352 MOV DPL, A 01CC 5002 =1 353 JNC Skip 01CE 0583 =1 354 INC DPH ; Need 16 bit arithmetic here 01D0 22 =1 355 Skip: RET =1 356 01D1 =1 357 CorrectSubroutine: ; Jump to the subroutine that DPTR is pointing to 01D1 9001F6 =1 358 MOV DPTR, #CommandTable 01D4 31C8 =1 359 CALL BumpDPTR ; Point to entry 01D6 E0 =1 360 MOVX A, @DPTR ; Get the offset 01D7 9001F6 =1 361 MOV DPTR, #CommandTable 01DA 31C8 =1 362 CALL BumpDPTR ; Get the routine address 01DC C082 =1 363 PUSH DPL ; Create a RETURN address on stack 01DE C083 =1 364 PUSH DPH ; Note: JMP @A+DPTR not used since A, DPTR needed 01E0 7845 =1 365 MOV R0, #ReplyBuffer+2 01E2 E4 =1 366 CLR A 01E3 F6 =1 367 MOV @R0, A ; Clear ReplyBuffer 01E4 18 =1 368 DEC R0 01E5 F6 =1 369 MOV @R0, A 01E6 18 =1 370 DEC R0 01E7 7601 =1 371 MOV @R0, #1 ; Default non-descriptor reply 01E9 907FEA =1 372 MOV DPTR, #SETUPDAT+2 ; Point to LOW(wValue) 01EC E0 =1 373 MOVX A, @DPTR ; Many of the routines need these 01ED F5F0 =1 374 MOV B, A ; LOW(wValue) in B 01EF A3 =1 375 INC DPTR 01F0 E0 =1 376 MOVX A, @DPTR ; HIGH(wValue) in A 01F1 C201 =1 377 CLR STALL 01F3 C203 =1 378 CLR IsDescriptor 01F5 22 =1 379 RET ; Go to service routine =1 380 =1 381 ; Since the table only contains byte offsets, it is important that all these routines are =1 382 ; within one page (100H) of CommandTable =1 383 ; 01F6 =1 384 CommandTable: =1 385 ; First 16 commands are for the Device A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 7 01F6 6D =1 386 DB Device_Get_Status - CommandTable 01F7 40 =1 387 DB Device_Clear_Feature - CommandTable 01F8 40 =1 388 DB Invalid - CommandTable 01F9 40 =1 389 DB Device_Set_Feature - CommandTable 01FA 40 =1 390 DB Invalid - CommandTable 01FB 40 =1 391 DB Invalid - CommandTable ; SIE implements Device_Set_Address 01FC 81 =1 392 DB Get_Descriptor - CommandTable 01FD 40 =1 393 DB Set_Descriptor - CommandTable 01FE 6A =1 394 DB Get_Configuration - CommandTable 01FF 74 =1 395 DB Set_Configuration - CommandTable 0200 40 =1 396 DB Invalid - CommandTable 0201 40 =1 397 DB Invalid - CommandTable 0202 40 =1 398 DB Invalid - CommandTable 0203 40 =1 399 DB Invalid - CommandTable 0204 40 =1 400 DB Invalid - CommandTable 0205 40 =1 401 DB Invalid - CommandTable =1 402 ; Next 16 commands are for the Interface 0206 71 =1 403 DB Interface_Get_Status - CommandTable 0207 40 =1 404 DB Interface_Clear_Feature - CommandTable 0208 40 =1 405 DB Invalid - CommandTable 0209 40 =1 406 DB Interface_Set_Feature - CommandTable 020A 40 =1 407 DB Invalid - CommandTable 020B 40 =1 408 DB Invalid - CommandTable 020C A5 =1 409 DB Get_Class_Descriptor - CommandTable 020D 40 =1 410 DB Set_Class_Descriptor - CommandTable 020E 40 =1 411 DB Invalid - CommandTable 020F 40 =1 412 DB Invalid - CommandTable 0210 40 =1 413 DB Get_Interface - CommandTable 0211 40 =1 414 DB Set_Interface - CommandTable 0212 40 =1 415 DB Invalid - CommandTable 0213 40 =1 416 DB Invalid - CommandTable 0214 40 =1 417 DB Invalid - CommandTable 0215 40 =1 418 DB Invalid - CommandTable =1 419 ; Next 16 commands are for the Endpoint 0216 71 =1 420 DB Endpoint_Get_Status - CommandTable 0217 42 =1 421 DB Endpoint_Clear_Feature - CommandTable 0218 40 =1 422 DB Invalid - CommandTable 0219 40 =1 423 DB Endpoint_Set_Feature - CommandTable 021A 40 =1 424 DB Invalid - CommandTable 021B 40 =1 425 DB Invalid - CommandTable 021C 40 =1 426 DB Invalid - CommandTable 021D 40 =1 427 DB Invalid - CommandTable 021E 40 =1 428 DB Invalid - CommandTable 021F 40 =1 429 DB Invalid - CommandTable 0220 40 =1 430 DB Invalid - CommandTable 0221 40 =1 431 DB Invalid - CommandTable 0222 40 =1 432 DB Endpoint_Sync_Frame - CommandTable 0223 40 =1 433 DB Invalid - CommandTable 0224 40 =1 434 DB Invalid - CommandTable 0225 40 =1 435 DB Invalid - CommandTable =1 436 ; Next 16 commands are Class Requests 0226 40 =1 437 DB Invalid - CommandTable 0227 56 =1 438 DB Get_Report - CommandTable 0228 63 =1 439 DB Get_Idle - CommandTable 0229 40 =1 440 DB Get_Protocol - CommandTable 022A 40 =1 441 DB Invalid - CommandTable 022B 40 =1 442 DB Invalid - CommandTable 022C 40 =1 443 DB Invalid - CommandTable 022D 40 =1 444 DB Invalid - CommandTable 022E 40 =1 445 DB Invalid - CommandTable 022F 43 =1 446 DB Set_Report - CommandTable 0230 5D =1 447 DB Set_Idle - CommandTable 0231 40 =1 448 DB Set_Protocol - CommandTable 0232 40 =1 449 DB Invalid - CommandTable 0233 40 =1 450 DB Invalid - CommandTable 0234 40 =1 451 DB Invalid - CommandTable A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 8 0235 40 =1 452 DB Invalid - CommandTable =1 453 ; =1 454 ; Many requests are INVALID for this example 0236 =1 455 Get_Protocol: ; We are not a Boot device 0236 =1 456 Set_Protocol: ; We are not a Boot device 0236 =1 457 Set_Descriptor: ; Our Descriptors are static 0236 =1 458 Set_Class_Descriptor: ; Our Descriptors are static 0236 =1 459 Set_Interface: ; We only have one Interface 0236 =1 460 Get_Interface: ; We do not have an Alternate setting 0236 =1 461 Device_Set_Feature: ; We have no features that can be set or cleared 0236 =1 462 Interface_Set_Feature: ; We have no features that can be set or cleared 0236 =1 463 Endpoint_Set_Feature: ; We have no features that can be set or cleared 0236 =1 464 Device_Clear_Feature: ; We have no features that can be set or cleared 0236 =1 465 Interface_Clear_Feature: ; We have no features that can be set or cleared 0236 =1 466 Endpoint_Sync_Frame: ; We are not an Isonchronous device =1 467 0236 =1 468 Invalid: ; Invalid Request made, STALL the Endpoint 0236 D201 =1 469 SETB STALL =1 470 ; 0238 =1 471 Endpoint_Clear_Feature: ; We have no features that can be set or cleared =1 472 ; 0238 22 =1 473 Reply: RET =1 474 0239 =1 475 Set_Report: ; Host wants to sent us a Report. =1 476 ; The ONLY case in this example where host sends data to us 0239 3000FA =1 477 JNB Configured, Invalid ; Need to be Configured to do this command 023C 907FC5 =1 478 MOV DPTR, #Out0ByteCount ; Enable EP0OutBuffer to receive data 023F F0 =1 479 MOVX @DPTR, A ; Any value will do 0240 907FAA =1 480 MOV DPTR, #OUT07IRQ ; Wait for valid data in EP0OutBuffer 0243 E0 =1 481 Wait4D: MOVX A, @DPTR 0244 5401 =1 482 ANL A, #00000001b 0246 60FB =1 483 JZ Wait4D 0248 F0 =1 484 MOVX @DPTR, A ; Clear the interrupt 0249 0203BC =1 485 JMP ProcessOutputReport ; RETurn via this subroutine 024C =1 486 Get_Report: ; Host wants a Report 024C 3000E7 =1 487 JNB Configured, Invalid ; Need to be Configured to do this command 024F 08 =1 488 INC R0 ; Point to ReplyBuffer(1) 0250 7618 =1 489 MOV @R0, #18H ; Reply with a recognizable (arbitary) value 0252 22 =1 490 RET 0253 =1 491 Set_Idle: ; Host wants to tell us how often we should talk 0253 3000E0 =1 492 JNB Configured, Invalid ; Need to be Configured to do this command 0256 F541 =1 493 MOV Idle_Time, A 0258 22 =1 494 RET ; Handshake with host 0259 =1 495 Get_Idle: ; Host must have forgotten what he told us to do 0259 3000DA =1 496 JNB Configured, Invalid ; Need to be Configured to do this command 025C 08 =1 497 INC R0 ; Point to ReplyBuffer(1) 025D A641 =1 498 MOV @R0, Idle_Time 025F 22 =1 499 RET 0260 =1 500 Get_Configuration: ; Need to return 0 or 1 0260 300004 =1 501 JNB Configured, Configuration0 0263 =1 502 Configuration1: ; Same bit pattern as Device_Get_Status 0263 =1 503 Device_Get_Status: ; Only two bits of Device Status are defined 0263 08 =1 504 INC R0 ; Point to ReplyBuffer(1) 0264 7601 =1 505 MOV @R0, #1 ; Bit 1=Remote Wakeup(=0), Bit 0=Self Powered(=1) 0266 22 =1 506 RET 0267 =1 507 Configuration0: ; Same bit pattern as Interface_Get_Status 0267 =1 508 Interface_Get_Status: ; Interface Status is currently defined as 0 0267 =1 509 Endpoint_Get_Status: 0267 7602 =1 510 MOV @R0, #2 0269 22 =1 511 RET 026A =1 512 Set_Configuration: ; Valid values are 0 and 1 026A E5F0 =1 513 MOV A, B ; Get LOW(wValue) 026C 6006 =1 514 JZ Deconfigured 026E 14 =1 515 DEC A 026F 70C5 =1 516 JNZ Invalid 0271 D200 =1 517 SETB Configured A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 9 0273 22 =1 518 RET 0274 =1 519 Deconfigured: 0274 C200 =1 520 CLR Configured 0276 22 =1 521 RET 0277 =1 522 Get_Descriptor: ; Host wants to know who/what we are 0277 D203 =1 523 SETB IsDescriptor 0279 14 =1 524 DEC A ; Valid Values are 1, 2 and 3 027A 9002C1 =1 525 MOV DPTR, #DeviceDescriptor 027D 60B9 =1 526 JZ Reply 027F 14 =1 527 DEC A 0280 9002D3 =1 528 MOV DPTR, #ConfigurationDescriptor 0283 60B3 =1 529 JZ Reply 0285 14 =1 530 DEC A 0286 70AE =1 531 JNZ Invalid =1 532 ; Request is for a String Descriptor 0288 900305 =1 533 MOV DPTR, #String0 ; Point to String 0 028B E5F0 =1 534 MOV A, B ; Get String Index 028D =1 535 NextString: 028D 601E =1 536 JZ FixUpthenReply 028F F540 =1 537 MOV Temp, A ; Save String Index 0291 31C7 =1 538 CALL NextDPTR 0293 E0 =1 539 MOVX A, @DPTR ; Get the String Length (= 0 means we're at Backsto p) 0294 60A0 =1 540 JZ Invalid ; Asked for a string I don't have 0296 E540 =1 541 MOV A, Temp 0298 14 =1 542 DEC A 0299 80F2 =1 543 JMP NextString ; Check if we are there yet 029B =1 544 Get_Class_Descriptor: ; Valid values are 21H, 22H, 23H for Class Request 029B D203 =1 545 SETB IsDescriptor 029D C3 =1 546 CLR C 029E 9421 =1 547 SUBB A, #21H 02A0 9002E5 =1 548 MOV DPTR, #HIDDescriptor 02A3 6093 =1 549 JZ Reply 02A5 14 =1 550 DEC A 02A6 9002EE =1 551 MOV DPTR, #ReportDescriptor 02A9 608D =1 552 JZ Reply =1 553 ; DEC A ; This example does not use Physical Descriptors =1 554 ; JZ Send_Physical_Descriptor 02AB 8089 =1 555 JMP Invalid =1 556 ; =1 557 ; Error check: this MUST be on within a page of CommandTable 00B7 =1 558 WithinSamePage EQU $ - CommandTable =1 559 ; 02AD =1 560 FixUpthenReply: ; EZ-USB Rev D has a String Descriptor bug =1 561 ; Need to fill the IN0BUF (@ 7F00H) myself 02AD E0 =1 562 MOVX A, @DPTR ; Get the string length 02AE FF =1 563 MOV R7, A ; Save counter 02AF F5F0 =1 564 MOV B, A 02B1 7800 =1 565 MOV R0, #LOW(EP0InBuffer) ; PageReg = 7FH = HIGH(EP0InBuffer) 02B3 F2 =1 566 CopySD: MOVX @R0, A 02B4 08 =1 567 INC R0 02B5 A3 =1 568 INC DPTR 02B6 E0 =1 569 MOVX A, @DPTR 02B7 DFFA =1 570 DJNZ R7, CopySD =1 571 ; Fixup complete, get back to the program flow 02B9 D0E0 =1 572 POP ACC ; Get rid of the return address 02BB D0E0 =1 573 POP ACC 02BD E5F0 =1 574 MOV A, B ; Retrieve byte count 02BF 21A5 =1 575 JMP SendEP0InBuffer 576 $INCLUDE(DTables.A51) =1 577 ; This module declares the descriptors =1 578 ; =1 579 ; This example has one Device Descriptor with: =1 580 ; One Configuration - single IN port and single OUT port =1 581 ; One Interface - there is only one method of accessing the ports =1 582 ; One HID Descriptor - to make PC host software simpler A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 10 =1 583 ; No Endpoint Descriptors - HID Output Reports use EP0 =1 584 ; One Report Descriptor - six bytes OUT =1 585 ; Multiple Sting Descriptors - to aid the user =1 586 ; ---- =1 587 CSEG 02C1 =1 588 DeviceDescriptor: 02C1 1201 =1 589 DB 18, 1 ; Length, Type 02C3 0101 =1 590 DW 101H ; USB Rev 1.1 02C5 000000 =1 591 DB 0, 0, 0 ; Class, Subclass and Protocol 02C8 40 =1 592 DB 64 ; EP0 size 02C9 4242 =1 593 DW 4242H, 1, 1 ; Vendor ID, Product ID and Version 02CB 0001 02CD 0001 02CF 010200 =1 594 DB 1, 2, 0 ; Manufacturer, Product & Serial# Names 02D2 01 =1 595 DB 1 ; #Configs 02D3 =1 596 ConfigurationDescriptor: 02D3 0902 =1 597 DB 9, 2 ; Length, Type 02D5 1B00 =1 598 DB LOW(ConfigLength), HIGH(ConfigLength) 02D7 010100 =1 599 DB 1, 1, 0 ; #Interfaces, Configuration#, Config. Name 02DA 80 =1 600 DB 10000000b ; Attributes = Bus Powered 02DB 32 =1 601 DB 50 ; Max. Power is 50x2 = 100mA 02DC =1 602 InterfaceDescriptor: 02DC 0904 =1 603 DB 9, 4 ; Length, Type 02DE 000000 =1 604 DB 0, 0, 0 ; No alternate setting, HID OUTPUT uses EP0 02E1 03 =1 605 DB 3 ; Class = Human Interface Device 02E2 0000 =1 606 DB 0, 0 ; Subclass and Protocol 02E4 00 =1 607 DB 0 ; Interface Name 02E5 =1 608 HIDDescriptor: 02E5 0921 =1 609 DB 9, 21H ; Length, Type 02E7 0001 =1 610 DB 0, 1 ; HID Class Specification compliance 02E9 00 =1 611 DB 0 ; Country localization (=none) 02EA 01 =1 612 DB 1 ; Number of descriptors to follow 02EB 22 =1 613 DB 22H ; And it's a Report descriptor 02EC 1700 =1 614 DB LOW(ReportLength), HIGH(ReportLength) 001B =1 615 ConfigLength EQU $ - ConfigurationDescriptor =1 616 02EE =1 617 ReportDescriptor: ; Generated with HID Tool, copied to here 02EE 0600FF =1 618 DB 6, 0, 0FFH ; Usage_Page (Vendor Defined) 02F1 0901 =1 619 DB 9, 1 ; Usage (I/O Device) 02F3 A101 =1 620 DB 0A1H, 1 ; Collection (Application) 02F5 1901 =1 621 DB 19H, 1 ; Usage_Minimum 02F7 2902 =1 622 DB 29H, 2 ; Usage_Maximum 02F9 1500 =1 623 DB 15H, 0 ; Logical_Minimum (0) 02FB 26FF00 =1 624 DB 26H, 255, 0 ; Logical_Maximum (255) 02FE 7508 =1 625 DB 75H, 8 ; Report_Size (8) 0300 9506 =1 626 DB 95H, 6 ; Report_Count (6) = Lighting Values 0302 9102 =1 627 DB 91H, 2 ; Output (Data,Var,Abs) 0304 C0 =1 628 DB 0C0H ; End_Collection 0017 =1 629 ReportLength EQU $-ReportDescriptor =1 630 0305 =1 631 String0: ; Declare the UNICODE strings 0305 04030904 =1 632 DB 4, 3, 9, 4 ; Only English language strings supported 0309 =1 633 String1: ; Manufacturer 0309 2C03 =1 634 DB (String2-String1),3 ; Length, Type 030B 55005300 =1 635 DB "U",0,"S",0,"B",0," ",0,"D",0,"e",0,"s",0,"i",0,"g",0,"n",0," ", 0 030F 42002000 0313 44006500 0317 73006900 031B 67006E00 031F 2000 0321 42007900 =1 636 DB "B",0,"y",0," ",0,"E",0,"x",0,"a",0,"m",0,"p",0,"l",0,"e",0 0325 20004500 0329 78006100 032D 6D007000 0331 6C006500 0335 =1 637 String2: ; Product Name A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 11 0335 1E03 =1 638 DB (EndOfDescriptors-String2),3 0337 4C006900 =1 639 DB "L",0,"i",0,"g",0,"h",0,"t",0,"i",0,"n",0,"g",0 033B 67006800 033F 74006900 0343 6E006700 0347 20005000 =1 640 DB " ",0,"P",0,"a",0,"n",0,"e",0,"l",0 034B 61006E00 034F 65006C00 0353 =1 641 EndOfDescriptors: 0353 0000 =1 642 DW 0 ; Backstop for String Descriptors =1 643 =1 644 =1 645 646 $INCLUDE(Main.A51) =1 647 ; This module initializes the microcontroller then executes MAIN forever =1 648 ; =1 649 0355 =1 650 Reset: 0355 7581EB =1 651 MOV SP, #235 ; Initialize the Stack at top of internal memory 0358 75927F =1 652 MOV PageReg, #7FH ; Needed to use MOVX @Ri =1 653 035B 78D6 =1 654 MOV R0, #LOW(USBControl) ; Simulate a disconnect 035D E2 =1 655 MOVX A, @R0 035E 54F3 =1 656 ANL A, #11110011b ; Clear DISCON, DISCOE 0360 F2 =1 657 MOVX @R0, A 0361 1203AB =1 658 CALL Wait100msec ; Give the host time to react 0364 E2 =1 659 MOVX A, @R0 ; Reconnect with this new identity 0365 4406 =1 660 ORL A, #00000110b ; Set DISCOE to enable pullup resistor 0367 F2 =1 661 MOVX @R0, A ; Set RENUM so that 8051 handles USB requests 0368 E4 =1 662 CLR A 0369 F520 =1 663 MOV FLAGS, A ; Start in Default state 036B =1 664 InitializeIOSystem: ; This example uses PortA an OUT and =1 665 ; the lower 4 bits of PortC as IN =1 666 ; Assume a pre-existing configuration (ie Dscope) 036B 7893 =1 667 MOV R0, #LOW(PortA_Config) ; PageReg = 7F = HIGH(PortA_Config) 036D E4 =1 668 CLR A 036E F2 =1 669 MOVX @R0, A ; No alternate functions 036F 799C =1 670 MOV R1, #LOW(PortA_OE) 0371 F4 =1 671 CPL A ; = 0FFH 0372 F3 =1 672 MOVX @R1, A ; Enable PortA for Output 0373 7895 =1 673 MOV R0, #LOW(PortC_Config) ; PageReg = 7F = HIGH(PortC_Config) 0375 799E =1 674 MOV R1, #LOW(PortC_OE) 0377 E2 =1 675 MOVX A, @R0 ; Get current configuration 0378 54F0 =1 676 ANL A, #0F0H 037A F2 =1 677 MOVX @R0, A ; No alternate functions on lower nibble 037B E3 =1 678 MOVX A, @R1 ; Get current configuration 037C 54F0 =1 679 ANL A, #0F0H 037E F3 =1 680 MOVX @R1, A ; Enable PortC_Bits[3:0] for Input =1 681 ; Need to initialize Timer 0 to generate 40 microsecond interrupts 037F 758C50 =1 682 MOV Timer0High, #80 ; Reload Value 0382 E589 =1 683 MOV A, TimerMode ; Set up Timer 0 without changing Timer 1 0384 54F0 =1 684 ANL A, #0F0H ; Clear lower 4 bits 0386 D2E1 =1 685 SETB ACC.1 ; Set No Gate, Time, Mode 2 0388 F589 =1 686 MOV TimerMode, A 038A E588 =1 687 MOV A, TimerControl 038C 4430 =1 688 ORL A, #00110000b ; Turn on Timer 0 038E F588 =1 689 MOV TimerControl, A =1 690 0390 =1 691 InitializeInterruptSystem: ; First initialize the USB level 0390 78AC =1 692 MOV R0, #LOW(IN07IEN) 0392 F2 =1 693 MOVX @R0, A ; Disable interrupts from IN Endpoints 0-7 0393 08 =1 694 INC R0 0394 F2 =1 695 MOVX @R0, A ; Disable interrupts from OUT Endpoints 0-7 0395 08 =1 696 INC R0 0396 7401 =1 697 MOV A, #00000001b 0398 F2 =1 698 MOVX @R0, A ; Enable (Resume, Suspend) and SUDAV INTs A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 12 0399 08 =1 699 INC R0 039A 7401 =1 700 MOV A, #00000001b 039C F2 =1 701 MOVX @R0, A ; Enable Auto Vectoring for USB interrupts 039D 78AA =1 702 MOV R0, #LOW(OUT07IRQ) 039F 74FF =1 703 MOV A, #0FFH 03A1 F2 =1 704 MOVX @R0, A ; Clear out any pending interrupts =1 705 ; Now enable the main level 03A2 75E801 =1 706 MOV EIE, #00000001b ; Enable INT2 = USB Interrupt (only) 03A5 75A8C2 =1 707 MOV EI, #11000010b ; Enable interrupt subsystem: Timer 0 overflow =1 708 ; (and Ser1 for Dscope) =1 709 =1 710 ; Initialization Complete. =1 711 ; 03A8 =1 712 MAIN: 03A8 00 =1 713 NOP ; Not much of a main loop for this example 03A9 80FD =1 714 JMP MAIN ; All actions are initiated by interrupts =1 715 ; We are a slave, we wait to be told what to do =1 716 03AB =1 717 Wait100msec: 03AB 754064 =1 718 MOV Temp, #100 03AE =1 719 Wait1msec: ; A delay loop 03AE 90FB50 =1 720 MOV DPTR, #-1200 03B1 A3 =1 721 More: INC DPTR ; 3 cycles 03B2 E582 =1 722 MOV A, DPL ; + 2 03B4 4583 =1 723 ORL A, DPH ; + 2 03B6 70F9 =1 724 JNZ More ; + 3 = 10 cycles x 1200 = 1msec 03B8 D540F3 =1 725 DJNZ Temp, Wait1msec 03BB 22 =1 726 RET =1 727 03BC =1 728 ProcessOutputReport: ; A Report has just been received =1 729 ; The report is six bytes long =1 730 ; Save the values for the INTERRUPT service routine 03BC 7847 =1 731 MOV R0, #LightValues ; Initialize the pointers to be used 03BE 907EC0 =1 732 MOV DPTR, #EP0OutBuffer ; Point to the Report 03C1 7F06 =1 733 MOV R7, #6 03C3 E0 =1 734 CopyOR: MOVX A, @DPTR ; Retrieve Report Byte 1 03C4 F6 =1 735 MOV @R0, A 03C5 A3 =1 736 INC DPTR 03C6 08 =1 737 INC R0 03C7 DFFA =1 738 DJNZ R7, CopyOR 03C9 22 =1 739 RET =1 740 03CA =1 741 CreateInputReport: =1 742 ; Not used in this example =1 743 =1 744 745 $INCLUDE(Timer.A51) =1 746 ; This module services the real time interrupt =1 747 ; =1 748 ; Get a Real Time interrupt every 40 microseconds (from Timer 0) =1 749 ; =1 750 ; This routine generates a 40usec pulse which turns on a Triac (via an opto-isolator) =1 751 ; The 10msec LINE half cycle is divided into 250 40usec 'slots' =1 752 ; The position of the TurnON pulse will vary the phase angle of the power control =1 753 ; =1 754 ; The PC Host provides 6 "brightness" values, these are counted down each half-cycle =1 755 ; =1 756 ; The Triacs are on Port A bits [5:0] =1 757 ; A Line zero-cross detector is on Port C bit 0 =1 758 ; 03CA =1 759 ServiceTimerRoutine: 03CA 907F9B =1 760 MOV DPTR, #PortC_Pins ; First check if we have just changes cycles 03CD E0 =1 761 MOVX A, @DPTR 03CE 907F96 =1 762 MOV DPTR, #PortA_OUT ; Will need this later 03D1 A204 =1 763 MOV C, LastCycle 03D3 30E001 =1 764 JNB ACC.0, PositiveCycle ; Need an XRL C, but we don't have one! A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 13 03D6 B3 =1 765 CPL C 03D7 =1 766 PositiveCycle: 03D7 4013 =1 767 JC SameCycle 03D9 =1 768 CycleChange: 03D9 A2E0 =1 769 MOV C, ACC.0 ; Retreive current cycle 03DB 9204 =1 770 MOV LastCycle, C ; Save it for next time 03DD E4 =1 771 CLR A 03DE F0 =1 772 MOVX @DPTR, A ; Ensure all TurnON signals are low 03DF 7847 =1 773 MOV R0, #LightValues 03E1 794D =1 774 MOV R1, #WorkingValues 03E3 7F06 =1 775 MOV R7, #6 03E5 E6 =1 776 CCLoop: MOV A, @R0 ; Get the Light Values 03E6 F4 =1 777 CPL A ; Since we count down 03E7 F7 =1 778 MOV @R1, A ; Update the Working Values 03E8 08 =1 779 INC R0 03E9 09 =1 780 INC R1 03EA DFF9 =1 781 DJNZ R7, CCLoop ; Copy all six values 03EC =1 782 SameCycle: ; Check to see if any counters have expired 03EC 784D =1 783 MOV R0, #WorkingValues 03EE 755300 =1 784 MOV Mask, #0 ; Allow for XCH 03F1 7420 =1 785 MOV A, #00100000b ; Turn on signal for a Triac 03F3 =1 786 NextTriac: 03F3 C553 =1 787 XCH A, Mask ; Accumulate TurnON signals in A 03F5 8640 =1 788 MOV Temp, @R0 03F7 D54002 =1 789 DJNZ Temp, KeepOFF 03FA 4553 =1 790 ORL A, Mask ; Set a TurnON bit 03FC A640 =1 791 KeepOFF:MOV @R0, Temp 03FE 08 =1 792 INC R0 ; Ready for next loop 03FF C553 =1 793 XCH A, Mask 0401 03 =1 794 RR A ; Rotate Mask pattern 0402 70EF =1 795 JNZ NextTriac 0404 E553 =1 796 MOV A, Mask ; Retrieve TurnON pattern 0406 F0 =1 797 MOVX @DPTR, A ; TurnON triac(s) if required 0407 22 =1 798 RET =1 799 800 801 END A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 14 SYMBOL TABLE LISTING ------ ----- ------- N A M E T Y P E V A L U E ATTRIBUTES ACC . . . . . . . . . . . D ADDR 00E0H A B . . . . . . . . . . . . D ADDR 00F0H A BADREQUEST. . . . . . . . C ADDR 01C2H A BUMPDPTR. . . . . . . . . C ADDR 01C8H A BUTTONSVALUE. . . . . . . D ADDR 0047H A CCLOOP. . . . . . . . . . C ADDR 03E5H A CLEARINT2 . . . . . . . . C ADDR 0119H A COMMANDTABLE. . . . . . . C ADDR 01F6H A CONFIGLENGTH. . . . . . . N NUMB 001BH A CONFIGURATION0. . . . . . C ADDR 0267H A CONFIGURATION1. . . . . . C ADDR 0263H A CONFIGURATIONDESCRIPTOR . C ADDR 02D3H A CONFIGURED. . . . . . . . B ADDR 0020H.0 A COPYOR. . . . . . . . . . C ADDR 03C3H A COPYRB. . . . . . . . . . C ADDR 019CH A COPYSD. . . . . . . . . . C ADDR 02B3H A CORRECTSUBROUTINE . . . . C ADDR 01D1H A CREATEINPUTREPORT . . . . C ADDR 03CAH A CURRENTCONFIGURATION. . . D ADDR 0046H A CURRENTPOSITION . . . . . D ADDR 0047H A CYCLECHANGE . . . . . . . C ADDR 03D9H A DECONFIGURED. . . . . . . C ADDR 0274H A DEVICEDESCRIPTOR. . . . . C ADDR 02C1H A DEVICE_CLEAR_FEATURE. . . C ADDR 0236H A DEVICE_GET_STATUS . . . . C ADDR 0263H A DEVICE_SET_FEATURE. . . . C ADDR 0236H A DISPLAYPOSITION . . . . . D ADDR 0048H A DPH . . . . . . . . . . . D ADDR 0083H A DPL . . . . . . . . . . . D ADDR 0082H A DPS . . . . . . . . . . . D ADDR 0086H A EI. . . . . . . . . . . . D ADDR 00A8H A EICON . . . . . . . . . . D ADDR 00D8H A EIE . . . . . . . . . . . D ADDR 00E8H A ENDOFDESCRIPTORS. . . . . C ADDR 0353H A ENDPOINT_CLEAR_FEATURE. . C ADDR 0238H A ENDPOINT_GET_STATUS . . . C ADDR 0267H A ENDPOINT_SET_FEATURE. . . C ADDR 0236H A ENDPOINT_SYNC_FRAME . . . C ADDR 0236H A EP0CONTROL. . . . . . . . N NUMB 7FB4H A EP0INBUFFER . . . . . . . N NUMB 7F00H A EP0IN_ISR . . . . . . . . C ADDR 0118H A EP0OUTBUFFER. . . . . . . N NUMB 7EC0H A EP0OUT_ISR. . . . . . . . C ADDR 0118H A EP1INBUFFER . . . . . . . N NUMB 7E80H A EP1IN_ISR . . . . . . . . C ADDR 0118H A EP1OUT_ISR. . . . . . . . C ADDR 0118H A EP2IN_ISR . . . . . . . . C ADDR 0118H A EP2OUT_ISR. . . . . . . . C ADDR 0118H A EP3IN_ISR . . . . . . . . C ADDR 0118H A EP3OUT_ISR. . . . . . . . C ADDR 0118H A EP4IN_ISR . . . . . . . . C ADDR 0118H A EP4OUT_ISR. . . . . . . . C ADDR 0118H A EP5IN_ISR . . . . . . . . C ADDR 0118H A EP5OUT_ISR. . . . . . . . C ADDR 0118H A EP6IN_ISR . . . . . . . . C ADDR 0118H A EP6OUT_ISR. . . . . . . . C ADDR 0118H A EP7IN_ISR . . . . . . . . C ADDR 0118H A EP7OUT_ISR. . . . . . . . C ADDR 0118H A EXIF. . . . . . . . . . . D ADDR 0091H A EXITISR . . . . . . . . . C ADDR 014FH A A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 15 EXPIRED_TIME. . . . . . . D ADDR 0042H A FIXUPTHENREPLY. . . . . . C ADDR 02ADH A FLAGS . . . . . . . . . . D ADDR 0020H A GET_CLASS_DESCRIPTOR. . . C ADDR 029BH A GET_CONFIGURATION . . . . C ADDR 0260H A GET_DESCRIPTOR. . . . . . C ADDR 0277H A GET_IDLE. . . . . . . . . C ADDR 0259H A GET_INTERFACE . . . . . . C ADDR 0236H A GET_PROTOCOL. . . . . . . C ADDR 0236H A GET_REPORT. . . . . . . . C ADDR 024CH A HANDSHAKE . . . . . . . . C ADDR 01A9H A HIDDESCRIPTOR . . . . . . C ADDR 02E5H A I2CCONTROL. . . . . . . . N NUMB 7FA5H A I2CDATA . . . . . . . . . N NUMB 7FA6H A I2CDATABYTE . . . . . . . D ADDR 0047H A I2C_ISR . . . . . . . . . C ADDR 0118H A IDLE_TIME . . . . . . . . D ADDR 0041H A IN07IEN . . . . . . . . . N NUMB 7FACH A IN07IRQ . . . . . . . . . N NUMB 7FA9H A IN0BYTECOUNT. . . . . . . N NUMB 7FB5H A IN1BYTECOUNT. . . . . . . N NUMB 7FB7H A INITIALIZEINTERRUPTSYSTEM C ADDR 0390H A INITIALIZEIOSYSTEM. . . . C ADDR 036BH A INT0_ISR. . . . . . . . . C ADDR 0118H A INT1_ISR. . . . . . . . . C ADDR 0118H A INT4_ISR. . . . . . . . . C ADDR 0118H A INT5_ISR. . . . . . . . . C ADDR 0118H A INT6_ISR. . . . . . . . . C ADDR 0118H A INTERFACEDESCRIPTOR . . . C ADDR 02DCH A INTERFACE_CLEAR_FEATURE . C ADDR 0236H A INTERFACE_GET_STATUS. . . C ADDR 0267H A INTERFACE_SET_FEATURE . . C ADDR 0236H A INVALID . . . . . . . . . C ADDR 0236H A ISDESCRIPTOR. . . . . . . B ADDR 0020H.3 A KEEPOFF . . . . . . . . . C ADDR 03FCH A LASTCYCLE . . . . . . . . B ADDR 0020H.4 A LEDBUFFER . . . . . . . . D ADDR 0049H A LEDSTROBE . . . . . . . . D ADDR 0048H A LEDVALUE. . . . . . . . . D ADDR 0049H A LIGHTINGCONTROLPANEL. . . N NUMB ----- LIGHTVALUES . . . . . . . D ADDR 0047H A LIMITVALUES . . . . . . . D ADDR 0047H A LOADSUDPTR. . . . . . . . C ADDR 01B4H A MAIN. . . . . . . . . . . C ADDR 03A8H A MASK. . . . . . . . . . . D ADDR 0053H A MONITORSPACE. . . . . . . D ADDR 0021H A MORE. . . . . . . . . . . C ADDR 03B1H A MOTORCONTROL. . . . . . . D ADDR 0048H A MSEC_COUNTER. . . . . . . D ADDR 004AH A NEXTDPTR. . . . . . . . . C ADDR 01C7H A NEXTSTRING. . . . . . . . C ADDR 028DH A NEXTTRIAC . . . . . . . . C ADDR 03F3H A NOTB5 . . . . . . . . . . C ADDR 017DH A NOT_USED. . . . . . . . . C ADDR 0118H A OLD_BUTTONS . . . . . . . D ADDR 0047H A OUT07IEN. . . . . . . . . N NUMB 7FADH A OUT07IRQ. . . . . . . . . N NUMB 7FAAH A OUT0BYTECOUNT . . . . . . N NUMB 7FC5H A OVERLAY . . . . . . . . . D ADDR 0047H A PAGEREG . . . . . . . . . D ADDR 0092H A PCON. . . . . . . . . . . D ADDR 0087H A PORTA_CONFIG. . . . . . . N NUMB 7F93H A PORTA_OE. . . . . . . . . N NUMB 7F9CH A PORTA_OUT . . . . . . . . N NUMB 7F96H A PORTA_PINS. . . . . . . . N NUMB 7F99H A PORTB_CONFIG. . . . . . . N NUMB 7F94H A A51 MACRO ASSEMBLER LCP 25/07/99 18:37:13 PAGE 16 PORTB_OE. . . . . . . . . N NUMB 7F9DH A PORTB_OUT . . . . . . . . N NUMB 7F97H A PORTB_PINS. . . . . . . . N NUMB 7F9AH A PORTC_CONFIG. . . . . . . N NUMB 7F95H A PORTC_OE. . . . . . . . . N NUMB 7F9EH A PORTC_OUT . . . . . . . . N NUMB 7F98H A PORTC_PINS. . . . . . . . N NUMB 7F9BH A POSITIVECYCLE . . . . . . C ADDR 03D7H A PROCESSOUTPUTREPORT . . . C ADDR 03BCH A PSW . . . . . . . . . . . D ADDR 00D0H A REPLY . . . . . . . . . . C ADDR 0238H A REPLYBUFFER . . . . . . . D ADDR 0043H A REPORTDESCRIPTOR. . . . . C ADDR 02EEH A REPORTLENGTH. . . . . . . N NUMB 0017H A RESERVED. . . . . . . . . C ADDR 0118H A RESET . . . . . . . . . . C ADDR 0355H A SAMECYCLE . . . . . . . . C ADDR 03ECH A SENDDATA. . . . . . . . . B ADDR 0020H.2 A SENDEP0INBUFFER . . . . . C ADDR 01A5H A SERVICESETUPPACKET. . . . C ADDR 0165H A SERVICETIMERROUTINE . . . C ADDR 03CAH A SETEP0CONTROL . . . . . . C ADDR 01ACH A SETUPDAT. . . . . . . . . N NUMB 7FE8H A SET_CLASS_DESCRIPTOR. . . C ADDR 0236H A SET_CONFIGURATION . . . . C ADDR 026AH A SET_DESCRIPTOR. . . . . . C ADDR 0236H A SET_IDLE. . . . . . . . . C ADDR 0253H A SET_INTERFACE . . . . . . C ADDR 0236H A SET_PROTOCOL. . . . . . . C ADDR 0236H A SET_REPORT. . . . . . . . C ADDR 0239H A SKIP. . . . . . . . . . . C ADDR 01D0H A SOF_ISR . . . . . . . . . C ADDR 0118H A SP. . . . . . . . . . . . D ADDR 0081H A STALL . . . . . . . . . . B ADDR 0020H.1 A STARTXFER . . . . . . . . C ADDR 01A8H A STRING0 . . . . . . . . . C ADDR 0305H A STRING1 . . . . . . . . . C ADDR 0309H A STRING2 . . . . . . . . . C ADDR 0335H A SUDAV_ISR . . . . . . . . C ADDR 013CH A SUDPTR. . . . . . . . . . N NUMB 7FD4H A SUSPEND_ISR . . . . . . . C ADDR 0129H A SUTOK_ISR . . . . . . . . C ADDR 0118H A TEMP. . . . . . . . . . . D ADDR 0040H A TIMER0HIGH. . . . . . . . D ADDR 008CH A TIMER0_ISR. . . . . . . . C ADDR 0158H A TIMER1_ISR. . . . . . . . C ADDR 0118H A TIMER2_ISR. . . . . . . . C ADDR 0118H A TIMERCONTROL. . . . . . . D ADDR 0088H A TIMERMODE . . . . . . . . D ADDR 0089H A UART0_ISR . . . . . . . . C ADDR 0118H A UART1_ISR . . . . . . . . C ADDR 0118H A USBCONTROL. . . . . . . . N NUMB 7FD6H A USBIEN. . . . . . . . . . N NUMB 7FAEH A USBIRQ. . . . . . . . . . N NUMB 7FABH A USBRESET_ISR. . . . . . . C ADDR 0120H A USB_ISR . . . . . . . . . C ADDR 0100H A WAIT100MSEC . . . . . . . C ADDR 03ABH A WAIT1MSEC . . . . . . . . C ADDR 03AEH A WAIT4D. . . . . . . . . . C ADDR 0243H A WAKEUP_ISR. . . . . . . . C ADDR 0139H A WITHINSAMEPAGE. . . . . . N NUMB 00B7H A WORKINGVALUES . . . . . . D ADDR 004DH A REGISTER BANK(S) USED: 0 ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)