                              1 	.module main
                              2 
                              3 	;; define code segments link order
                              4 	.area CODE (CODE)
                              5 	.area CSEG (CODE)
                              6 	.area GSINIT (CODE)
                              7 	.area GSINIT2 (CODE)
                              8 
                              9 	;; -----------------------------------------------------
                             10 
                             11 	;; special function registers (which are not predefined)
                    0082     12 	dpl0    = 0x82
                    0083     13 	dph0    = 0x83
                    0084     14 	dpl1    = 0x84
                    0085     15 	dph1    = 0x85
                    0086     16 	dps     = 0x86
                    008E     17 	ckcon   = 0x8E
                    008F     18 	spc_fnc = 0x8F
                    0091     19 	exif    = 0x91
                    0092     20 	mpage   = 0x92
                    0098     21 	scon0   = 0x98
                    0099     22 	sbuf0   = 0x99
                    00C0     23 	scon1   = 0xC0
                    00C1     24 	sbuf1   = 0xC1
                    00D8     25 	eicon   = 0xD8
                    00E8     26 	eie     = 0xE8
                    00F8     27 	eip     = 0xF8
                             28 
                             29 	;; anchor xdata registers
                    7F00     30 	IN0BUF		= 0x7F00
                    7EC0     31 	OUT0BUF		= 0x7EC0
                    7E80     32 	IN1BUF		= 0x7E80
                    7E40     33 	OUT1BUF		= 0x7E40
                    7E00     34 	IN2BUF		= 0x7E00
                    7DC0     35 	OUT2BUF		= 0x7DC0
                    7D80     36 	IN3BUF		= 0x7D80
                    7D40     37 	OUT3BUF		= 0x7D40
                    7D00     38 	IN4BUF		= 0x7D00
                    7CC0     39 	OUT4BUF		= 0x7CC0
                    7C80     40 	IN5BUF		= 0x7C80
                    7C40     41 	OUT5BUF		= 0x7C40
                    7C00     42 	IN6BUF		= 0x7C00
                    7BC0     43 	OUT6BUF		= 0x7BC0
                    7B80     44 	IN7BUF		= 0x7B80
                    7B40     45 	OUT7BUF		= 0x7B40
                    7FE8     46 	SETUPBUF	= 0x7FE8
                    7FE8     47 	SETUPDAT	= 0x7FE8
                             48 
                    7FB4     49 	EP0CS		= 0x7FB4
                    7FB5     50 	IN0BC		= 0x7FB5
                    7FB6     51 	IN1CS		= 0x7FB6
                    7FB7     52 	IN1BC		= 0x7FB7
                    7FB8     53 	IN2CS		= 0x7FB8
                    7FB9     54 	IN2BC		= 0x7FB9
                    7FBA     55 	IN3CS		= 0x7FBA
                    7FBB     56 	IN3BC		= 0x7FBB
                    7FBC     57 	IN4CS		= 0x7FBC
                    7FBD     58 	IN4BC		= 0x7FBD
                    7FBE     59 	IN5CS		= 0x7FBE
                    7FBF     60 	IN5BC		= 0x7FBF
                    7FC0     61 	IN6CS		= 0x7FC0
                    7FC1     62 	IN6BC		= 0x7FC1
                    7FC2     63 	IN7CS		= 0x7FC2
                    7FC3     64 	IN7BC		= 0x7FC3
                    7FC5     65 	OUT0BC		= 0x7FC5
                    7FC6     66 	OUT1CS		= 0x7FC6
                    7FC7     67 	OUT1BC		= 0x7FC7
                    7FC8     68 	OUT2CS		= 0x7FC8
                    7FC9     69 	OUT2BC		= 0x7FC9
                    7FCA     70 	OUT3CS		= 0x7FCA
                    7FCB     71 	OUT3BC		= 0x7FCB
                    7FCC     72 	OUT4CS		= 0x7FCC
                    7FCD     73 	OUT4BC		= 0x7FCD
                    7FCE     74 	OUT5CS		= 0x7FCE
                    7FCF     75 	OUT5BC		= 0x7FCF
                    7FD0     76 	OUT6CS		= 0x7FD0
                    7FD1     77 	OUT6BC		= 0x7FD1
                    7FD2     78 	OUT7CS		= 0x7FD2
                    7FD3     79 	OUT7BC		= 0x7FD3
                             80 
                    7FA8     81 	IVEC		= 0x7FA8
                    7FA9     82 	IN07IRQ		= 0x7FA9
                    7FAA     83 	OUT07IRQ	= 0x7FAA
                    7FAB     84 	USBIRQ		= 0x7FAB
                    7FAC     85 	IN07IEN		= 0x7FAC
                    7FAD     86 	OUT07IEN	= 0x7FAD
                    7FAE     87 	USBIEN		= 0x7FAE
                    7FAF     88 	USBBAV		= 0x7FAF
                    7FB2     89 	BPADDRH		= 0x7FB2
                    7FB3     90 	BPADDRL		= 0x7FB3
                             91 
                    7FD4     92 	SUDPTRH		= 0x7FD4
                    7FD5     93 	SUDPTRL		= 0x7FD5
                    7FD6     94 	USBCS		= 0x7FD6
                    7FD7     95 	TOGCTL		= 0x7FD7
                    7FD8     96 	USBFRAMEL	= 0x7FD8
                    7FD9     97 	USBFRAMEH	= 0x7FD9
                    7FDB     98 	FNADDR		= 0x7FDB
                    7FDD     99 	USBPAIR		= 0x7FDD
                    7FDE    100 	IN07VAL		= 0x7FDE
                    7FDF    101 	OUT07VAL	= 0x7FDF
                    7FE3    102 	AUTOPTRH	= 0x7FE3
                    7FE4    103 	AUTOPTRL	= 0x7FE4
                    7FE5    104 	AUTODATA	= 0x7FE5
                            105 
                            106 	;; isochronous endpoints. only available if ISODISAB=0
                            107 
                    7F60    108 	OUT8DATA	= 0x7F60
                    7F61    109 	OUT9DATA	= 0x7F61
                    7F62    110 	OUT10DATA	= 0x7F62
                    7F63    111 	OUT11DATA	= 0x7F63
                    7F64    112 	OUT12DATA	= 0x7F64
                    7F65    113 	OUT13DATA	= 0x7F65
                    7F66    114 	OUT14DATA	= 0x7F66
                    7F67    115 	OUT15DATA	= 0x7F67
                            116 
                    7F68    117 	IN8DATA		= 0x7F68
                    7F69    118 	IN9DATA		= 0x7F69
                    7F6A    119 	IN10DATA	= 0x7F6A
                    7F6B    120 	IN11DATA	= 0x7F6B
                    7F6C    121 	IN12DATA	= 0x7F6C
                    7F6D    122 	IN13DATA	= 0x7F6D
                    7F6E    123 	IN14DATA	= 0x7F6E
                    7F6F    124 	IN15DATA	= 0x7F6F
                            125 
                    7F70    126 	OUT8BCH		= 0x7F70
                    7F71    127 	OUT8BCL		= 0x7F71
                    7F72    128 	OUT9BCH		= 0x7F72
                    7F73    129 	OUT9BCL		= 0x7F73
                    7F74    130 	OUT10BCH	= 0x7F74
                    7F75    131 	OUT10BCL	= 0x7F75
                    7F76    132 	OUT11BCH	= 0x7F76
                    7F77    133 	OUT11BCL	= 0x7F77
                    7F78    134 	OUT12BCH	= 0x7F78
                    7F79    135 	OUT12BCL	= 0x7F79
                    7F7A    136 	OUT13BCH	= 0x7F7A
                    7F7B    137 	OUT13BCL	= 0x7F7B
                    7F7C    138 	OUT14BCH	= 0x7F7C
                    7F7D    139 	OUT14BCL	= 0x7F7D
                    7F7E    140 	OUT15BCH	= 0x7F7E
                    7F7F    141 	OUT15BCL	= 0x7F7F
                            142 
                    7FF0    143 	OUT8ADDR	= 0x7FF0
                    7FF1    144 	OUT9ADDR	= 0x7FF1
                    7FF2    145 	OUT10ADDR	= 0x7FF2
                    7FF3    146 	OUT11ADDR	= 0x7FF3
                    7FF4    147 	OUT12ADDR	= 0x7FF4
                    7FF5    148 	OUT13ADDR	= 0x7FF5
                    7FF6    149 	OUT14ADDR	= 0x7FF6
                    7FF7    150 	OUT15ADDR	= 0x7FF7
                    7FF8    151 	IN8ADDR		= 0x7FF8
                    7FF9    152 	IN9ADDR		= 0x7FF9
                    7FFA    153 	IN10ADDR	= 0x7FFA
                    7FFB    154 	IN11ADDR	= 0x7FFB
                    7FFC    155 	IN12ADDR	= 0x7FFC
                    7FFD    156 	IN13ADDR	= 0x7FFD
                    7FFE    157 	IN14ADDR	= 0x7FFE
                    7FFF    158 	IN15ADDR	= 0x7FFF
                            159 
                    7FA0    160 	ISOERR		= 0x7FA0
                    7FA1    161 	ISOCTL		= 0x7FA1
                    7FA2    162 	ZBCOUNT		= 0x7FA2
                    7FE0    163 	INISOVAL	= 0x7FE0
                    7FE1    164 	OUTISOVAL	= 0x7FE1
                    7FE2    165 	FASTXFR		= 0x7FE2
                            166 
                            167 	;; CPU control registers
                            168 
                    7F92    169 	CPUCS		= 0x7F92
                            170 
                            171 	;; IO port control registers
                            172 
                    7F93    173 	PORTACFG	= 0x7F93
                    7F94    174 	PORTBCFG	= 0x7F94
                    7F95    175 	PORTCCFG	= 0x7F95
                    7F96    176 	OUTA		= 0x7F96
                    7F97    177 	OUTB		= 0x7F97
                    7F98    178 	OUTC		= 0x7F98
                    7F99    179 	PINSA		= 0x7F99
                    7F9A    180 	PINSB		= 0x7F9A
                    7F9B    181 	PINSC		= 0x7F9B
                    7F9C    182 	OEA		= 0x7F9C
                    7F9D    183 	OEB		= 0x7F9D
                    7F9E    184 	OEC		= 0x7F9E
                            185 
                            186 	;; I2C controller registers
                            187 
                    7FA5    188 	I2CS		= 0x7FA5
                    7FA6    189 	I2DAT		= 0x7FA6
                            190 
                            191 	;; FPGA defines
                    0003    192 	XC4K_IRLENGTH	= 3
                    0000    193 	XC4K_EXTEST	= 0
                    0001    194 	XC4K_PRELOAD	= 1
                    0005    195 	XC4K_CONFIGURE	= 5
                    0007    196 	XC4K_BYPASS	= 7
                            197 
                    2E64    198 	FPGA_CONFIGSIZE = 11876
                    0158    199 	FPGA_BOUND	= 344
                            200 
                    0000    201 	SOFTWARECONFIG	= 0
                            202 
                            203 	;; -----------------------------------------------------
                            204 
                            205 	.area CODE (CODE)
   0000 02s00r00            206 	ljmp	startup
   0003 02s00rDF            207 	ljmp	int0_isr
   0006                     208 	.ds	5
   000B 02s01r00            209 	ljmp	timer0_isr
   000E                     210 	.ds	5
   0013 02s01r30            211 	ljmp	int1_isr
   0016                     212 	.ds	5
   001B 02s01r51            213 	ljmp	timer1_isr
   001E                     214 	.ds	5
   0023 02s01r72            215 	ljmp	ser0_isr
   0026                     216 	.ds	5
   002B 02s01r95            217 	ljmp	timer2_isr
   002E                     218 	.ds	5
   0033 02s01rB6            219 	ljmp	resume_isr
   0036                     220 	.ds	5
   003B 02s01rD7            221 	ljmp	ser1_isr
   003E                     222 	.ds	5
   0043 02s01r00            223 	ljmp	usb_isr
   0046                     224 	.ds	5
   004B 02s01rFA            225 	ljmp	i2c_isr
   004E                     226 	.ds	5
   0053 02s02r1F            227 	ljmp	int4_isr
   0056                     228 	.ds	5
   005B 02s02r44            229 	ljmp	int5_isr
   005E                     230 	.ds	5
   0063 02s02r69            231 	ljmp	int6_isr
                            232 
   0066                     233 	.ds	0x9a
                            234 	;; USB interrupt dispatch table
   0100                     235 usb_isr:
   0100 02s02rD2            236 	ljmp	usb_sudav_isr
   0103                     237 	.ds	1
   0104 02s05rBA            238 	ljmp	usb_sof_isr
   0107                     239 	.ds	1
   0108 02s05rE5            240 	ljmp	usb_sutok_isr
   010B                     241 	.ds	1
   010C 02s06r10            242 	ljmp	usb_suspend_isr
   010F                     243 	.ds	1
   0110 02s06r3B            244 	ljmp	usb_usbreset_isr
   0113                     245 	.ds	1
   0114 32                  246 	reti
   0115                     247 	.ds	3
   0118 02s06r66            248 	ljmp	usb_ep0in_isr
   011B                     249 	.ds	1
   011C 02s06rBC            250 	ljmp	usb_ep0out_isr
   011F                     251 	.ds	1
   0120 02s07r78            252 	ljmp	usb_ep1in_isr
   0123                     253 	.ds	1
   0124 02s07rA6            254 	ljmp	usb_ep1out_isr
   0127                     255 	.ds	1
   0128 02s07rD1            256 	ljmp	usb_ep2in_isr
   012B                     257 	.ds	1
   012C 02s07rFC            258 	ljmp	usb_ep2out_isr
   012F                     259 	.ds	1
   0130 02s08r27            260 	ljmp	usb_ep3in_isr
   0133                     261 	.ds	1
   0134 02s08r52            262 	ljmp	usb_ep3out_isr
   0137                     263 	.ds	1
   0138 02s08r7D            264 	ljmp	usb_ep4in_isr
   013B                     265 	.ds	1
   013C 02s08rA8            266 	ljmp	usb_ep4out_isr
   013F                     267 	.ds	1
   0140 02s08rD3            268 	ljmp	usb_ep5in_isr
   0143                     269 	.ds	1
   0144 02s08rFE            270 	ljmp	usb_ep5out_isr
   0147                     271 	.ds	1
   0148 02s09r29            272 	ljmp	usb_ep6in_isr
   014B                     273 	.ds	1
   014C 02s09r54            274 	ljmp	usb_ep6out_isr
   014F                     275 	.ds	1
   0150 02s09r7F            276 	ljmp	usb_ep7in_isr
   0153                     277 	.ds	1
   0154 02s09rAA            278 	ljmp	usb_ep7out_isr
                            279 
                            280 	;; -----------------------------------------------------
                            281 
                            282 	.area   BSEG (BIT)
                            283 
                            284 	.area	ISEG (DATA)
   0000                     285 stack:		.ds	0x80
                            286 
                            287 	.area	DSEG (DATA)
   0000                     288 errcode:	.ds	1
   0001                     289 errval:		.ds	1
   0002                     290 cfgcount:	.ds	2
   0004                     291 leddiv:		.ds	1
   0005                     292 irqcount:	.ds	1
   0006                     293 ctrlcode:	.ds	1
   0007                     294 ctrladdr:	.ds	2
   0009                     295 ctrllen:	.ds	2
                            296 
                            297 	;; USB state
   000B                     298 numconfig:	.ds	1
   000C                     299 altsetting:	.ds	1
                            300 	
                            301 	.area	XSEG (DATA)
                            302 
                            303 
                            304 	.area	GSINIT (CODE)
   0000                     305 startup:
   0000 75 81r00            306 	mov	sp,#stack	; -1
   0003 E4                  307 	clr	a
   0004 F5 D0               308 	mov	psw,a
   0006 F5 86               309 	mov	dps,a
                            310 	;lcall	__sdcc_external_startup
                            311 	;mov	a,dpl0
                            312 	;jz	__sdcc_init_data
                            313 	;ljmp	__sdcc_program_startup
   0008                     314 __sdcc_init_data:
                            315 
                            316 	.area	GSINIT2 (CODE)
   0000                     317 __sdcc_program_startup:
                            318 	;; assembler code startup
   0000 E4                  319 	clr	a
   0001 F5*00               320 	mov	errcode,a
   0003 F5*01               321 	mov	errval,a
   0005 F5*02               322 	mov	cfgcount,a
   0007 F5*03               323 	mov	cfgcount+1,a
   0009 F5*05               324  	mov	irqcount,a
   000B F5*06               325  	mov	ctrlcode,a
   000D F5 86               326 	mov	dps,a
   000F F5 A8               327 	mov	ie,a
                            328 	;; some indirect register setup
   0011 75 8E 31            329 	mov	ckcon,#0x31	; one external wait state, to avoid chip bugs
                            330 	;; Timer setup:
                            331 	;; timer 0: LED blink    : T0M=0, CT0=0, MODE0=1
                            332 	;; timer 1: Baudrate gen : T1M=1, CT1=0, MODE1=2
   0014 75 89 21            333 	mov	tmod,#0x21
   0017 75 88 55            334 	mov	tcon,#0x55	; INT0/INT1 edge
   001A 75 8D 64            335 	mov	th1,#256-156	; 1200 bauds
   001D 75 87 00            336 	mov	pcon,#0		; SMOD0=0
                            337 	;; give Windows a chance to finish the writecpucs control transfer
                            338 	;; 10ms delay loop
   0020 90 E8 90            339 	mov	dptr,#(-6000)&0xffff
   0023 A3                  340 9$:	inc	dptr		; 3 cycles
   0024 E5 82               341 	mov	a,dpl0		; 2 cycles
   0026 45 83               342 	orl	a,dph0		; 2 cycles
   0028 70 F9               343 	jnz	9$		; 3 cycles
                            344 	;; init USB subsystem
   002A 90 7F A1            345 	mov	dptr,#ISOCTL
   002D 74 01               346 	mov	a,#1		; disable ISO endpoints
   002F F0                  347 	movx	@dptr,a
   0030 90 7F AF            348 	mov	dptr,#USBBAV
   0033 74 01               349 	mov	a,#1		; enable autovector, disable breakpoint logic
   0035 F0                  350 	movx	@dptr,a
   0036 E4                  351 	clr	a
   0037 90 7F E0            352 	mov	dptr,#INISOVAL
   003A F0                  353 	movx	@dptr,a
   003B 90 7F E1            354 	mov	dptr,#OUTISOVAL
   003E F0                  355 	movx	@dptr,a
   003F 90 7F DD            356 	mov	dptr,#USBPAIR
   0042 74 09               357 	mov	a,#0x9		; pair EP 2&3 for input & output
   0044 F0                  358 	movx	@dptr,a
   0045 90 7F DE            359 	mov	dptr,#IN07VAL
   0048 74 07               360 	mov	a,#0x7		; enable EP0+EP1+EP2
   004A F0                  361 	movx	@dptr,a
   004B 90 7F DF            362 	mov	dptr,#OUT07VAL
   004E 74 05               363 	mov	a,#0x5		; enable EP0+EP2
   0050 F0                  364 	movx	@dptr,a
                            365 	;; USB:	init endpoint toggles
   0051 90 7F D7            366 	mov	dptr,#TOGCTL
   0054 74 12               367 	mov	a,#0x12
   0056 F0                  368 	movx	@dptr,a
   0057 74 32               369 	mov	a,#0x32		; clear EP 2 in toggle
   0059 F0                  370 	movx	@dptr,a
   005A 74 02               371 	mov	a,#0x02
   005C F0                  372 	movx	@dptr,a
   005D 74 22               373 	mov	a,#0x22		; clear EP 2 out toggle
   005F F0                  374 	movx	@dptr,a
                            375 	;; configure IO ports
   0060 90 7F 93            376 	mov	dptr,#PORTACFG
   0063 74 00               377 	mov	a,#0
   0065 F0                  378 	movx	@dptr,a
   0066 90 7F 96            379 	mov	dptr,#OUTA
   0069 74 80               380 	mov	a,#0x80		; set PROG lo
   006B F0                  381 	movx	@dptr,a
   006C 90 7F 9C            382 	mov	dptr,#OEA
   006F 74 C2               383 	mov	a,#0xc2		; out: TMS,TDI,PROG  in: DONE
   0071 F0                  384 	movx	@dptr,a
   0072 90 7F 94            385 	mov	dptr,#PORTBCFG
   0075 74 00               386 	mov	a,#0
   0077 F0                  387 	movx	@dptr,a
   0078 90 7F 9D            388 	mov	dptr,#OEB
   007B 74 00               389 	mov	a,#0
   007D F0                  390 	movx	@dptr,a
   007E 90 7F 95            391 	mov	dptr,#PORTCCFG
   0081 74 00               392 	mov	a,#0
   0083 F0                  393 	movx	@dptr,a
   0084 90 7F 98            394 	mov	dptr,#OUTC
   0087 74 20               395 	mov	a,#0x20
   0089 F0                  396 	movx	@dptr,a
   008A 90 7F 9E            397 	mov	dptr,#OEC
   008D 74 2E               398 	mov	a,#0x2e		; out: LEDCON,LEDSTA,TCK,INIT  in: TDO
   008F F0                  399 	movx	@dptr,a
                            400 	;; enable interrupts
   0090 75 A8 82            401 	mov	ie,#0x82	; enable timer 0
   0093 75 E8 01            402 	mov	eie,#0x01	; enable USB interrupts
   0096 90 7F AE            403 	mov	dptr,#USBIEN
   0099 74 01               404 	mov	a,#1		; enable SUDAV interrupt
   009B F0                  405 	movx	@dptr,a
   009C 90 7F AC            406 	mov	dptr,#IN07IEN
   009F 74 03               407 	mov	a,#3		; enable EP0+EP1 interrupt
   00A1 F0                  408 	movx	@dptr,a
   00A2 90 7F AD            409 	mov	dptr,#OUT07IEN
   00A5 74 01               410 	mov	a,#1		; enable EP0 interrupt
   00A7 F0                  411 	movx	@dptr,a
                            412 	;; initialize UART 0 for config loading
   00A8 75 98 20            413 	mov	scon0,#0x20	; mode 0, CLK24/4
   00AB 75 99 FF            414 	mov	sbuf0,#0xff
                            415 	;; initialize USB state
   00AE E4                  416 	clr	a
   00AF F5*0B               417 	mov	numconfig,a
   00B1 F5*0C               418 	mov	altsetting,a
                    0000    419 	.if	0
                            420 	;; disconnect from USB bus
                            421 	mov	dptr,#USBCS
                            422 	mov	a,#10
                            423 	movx	@dptr,a
                            424 	;; wait 0.3 sec
                            425 	mov	r2,#30
                            426 	;; 10ms delay loop
                            427 0$:	mov	dptr,#(-6000)&0xffff
                            428 1$:	inc	dptr            ; 3 cycles
                            429 	mov	a,dpl0          ; 2 cycles
                            430 	orl	a,dph0          ; 2 cycles
                            431 	jnz	1$              ; 3 cycles
                            432 	djnz	r2,0$
                            433 	;; reconnect to USB bus
                            434 	mov	dptr,#USBCS
                            435 	mov	a,#2		; 8051 handles control
                            436 	movx	@dptr,a
                            437 	mov	a,#6		; reconnect, 8051 handles control
                            438 	movx	@dptr,a
                            439 	.else
   00B3 90 7F D6            440 	mov	dptr,#USBCS
   00B6 74 06               441 	mov	a,#6		; reconnect, 8051 handles control
   00B8 F0                  442 	movx	@dptr,a
                            443 	.endif
                            444 
                            445 	;; final
   00B9 12s07r59            446 	lcall	fillusbintr
                            447 	;; kludge; first OUT2 packet seems to be bogus
                            448 	;; wait for packet with length 1 and contents 0x55
                            449 
                            450 	;; some short delay
   00BC 90 7F 96            451 	mov	dptr,#OUTA
   00BF 74 82               452 	mov	a,#0x82		; set PROG hi
   00C1 F0                  453 	movx	@dptr,a
   00C2 90 7F 99            454 	mov	dptr,#PINSA
   00C5 E0                  455 	movx	a,@dptr
   00C6 30 E2 06            456 	jnb	acc.2,8$
                            457 	;; DONE stuck high
   00C9 75*00 80            458 	mov	errcode,#0x80
   00CC 02s01rF8            459 	ljmp	fpgaerr
   00CF 12s00r00            460 8$:	lcall	jtag_reset_tap
   00D2 7A 05               461 	mov	r2,#5
   00D4 7B 00               462 	mov	r3,#0
   00D6 7C 06               463 	mov	r4,#6
   00D8 12s00r06            464 	lcall	jtag_shiftout	; enter SHIFT-IR state
   00DB 7A 08               465 	mov	r2,#8
   00DD 7B 00               466 	mov	r3,#0
   00DF 7C 00               467 	mov	r4,#0
   00E1 12s00r06            468 	lcall	jtag_shiftout	; assume max. 8bit IR
   00E4 7A 08               469 	mov	r2,#8
   00E6 7B 01               470 	mov	r3,#1
   00E8 7C 00               471 	mov	r4,#0
   00EA 12s00r06            472 	lcall	jtag_shift	; shift in a single bit
   00ED 74 F8               473 	mov	a,#-(1<<XC4K_IRLENGTH)
   00EF 2F                  474 	add	a,r7
   00F0 60 08               475 	jz	2$
                            476 	;; JTAG instruction register error
   00F2 75*00 81            477 	mov	errcode,#0x81
   00F5 8F*01               478 	mov	errval,r7
   00F7 02s01rF8            479 	ljmp	fpgaerr
   00FA 7A 05               480 2$:	mov	r2,#XC4K_IRLENGTH+2
   00FC 7B 05               481 	mov	r3,#XC4K_CONFIGURE
   00FE 7C 0C               482 	mov	r4,#3<<(XC4K_IRLENGTH-1)
   0100 12s00r06            483 	lcall	jtag_shiftout	; shift in CONFIGURE insn, goto RUNTEST/IDLE state
   0103 90 7F 9E            484 	mov	dptr,#OEC
   0106 74 2A               485 	mov	a,#0x2a		; out: LEDCON,LEDSTA,TCK  in: TDO,INIT
   0108 F0                  486 	movx	@dptr,a
   0109 75*00 01            487 	mov	errcode,#1
   010C 90 7F 9B            488 	mov	dptr,#PINSC
   010F E0                  489 3$:	movx	a,@dptr
   0110 30 E2 FC            490 	jnb	acc.2,3$
   0113 7A 03               491 	mov	r2,#3
   0115 7B FF               492 	mov	r3,#0xff
   0117 7C 01               493 	mov	r4,#1
   0119 12s00r06            494 	lcall	jtag_shiftout	; advance to SHIFT-DR state
                            495 	;; software configuration: enable UART special func pins
   011C 90 7F 96            496 	mov	dptr,#OUTA
   011F 74 42               497 	mov	a,#0x42		; PROG hi, TMS lo, TDI hi
   0121 F0                  498 	movx	@dptr,a
                    0000    499 	.if	SOFTWARECONFIG
                            500 	.else
   0122 90 7F 93            501 	mov	dptr,#PORTACFG
   0125 74 40               502 	mov	a,#0x40		; TDI is special function pin
   0127 F0                  503 	movx	@dptr,a
   0128 90 7F 95            504 	mov	dptr,#PORTCCFG
   012B 74 02               505 	mov	a,#0x02		; TCK is special function pin
   012D F0                  506 	movx	@dptr,a
                            507 	.endif
                            508 	;; start
   012E 75*00 10            509 	mov	errcode,#0x10
                            510 
   0131 90 7F C8            511 	mov	dptr,#OUT2CS
   0134 E4                  512 	clr	a
   0135 F0                  513 	movx	@dptr,a
   0136 90 7F C9            514 	mov	dptr,#OUT2BC
   0139 F0                  515 	movx	@dptr,a		; arm EP2 OUT
                            516 	
                            517 	
   013A                     518 ldstloop:
   013A 90 7F C9            519 	mov	dptr,#OUT2BC
   013D F0                  520 	movx	@dptr,a		; arm EP2 OUT
   013E 90 7F C8            521 0$:	mov	dptr,#OUT2CS
   0141 E0                  522 	movx	a,@dptr
   0142 20 E1 F9            523 	jb	acc.1,0$
   0145 90 7F C9            524 	mov	dptr,#OUT2BC
   0148 E0                  525 	movx	a,@dptr
   0149 24 FE               526 	add	a,#-2
   014B 50 ED               527 	jnc	ldstloop
   014D 90 7D C0            528 	mov	dptr,#OUT2BUF
   0150 E0                  529 	movx	a,@dptr
   0151 B4 FF E6            530 	cjne	a,#0xff,ldstloop
   0154 A3                  531 	inc	dptr
   0155 E0                  532 	movx	a,@dptr
   0156 B4 04 E1            533 	cjne	a,#0x04,ldstloop
   0159 75*00 11            534 	mov	errcode,#0x11
   015C 80 0B               535 	sjmp	xxloadloop
                            536 
   015E                     537 loadloop:
   015E 90 7F C9            538 	mov	dptr,#OUT2BC
   0161 F0                  539 	movx	@dptr,a		; arm EP2 OUT
   0162 90 7F C8            540 0$:	mov	dptr,#OUT2CS
   0165 E0                  541 	movx	a,@dptr
   0166 20 E1 F9            542 	jb	acc.1,0$
   0169                     543 xxloadloop:
   0169 90 7F C9            544 	mov	dptr,#OUT2BC
   016C E0                  545 	movx	a,@dptr
   016D 60 EF               546 	jz	loadloop
   016F FF                  547 	mov	r7,a
   0170 25*02               548 	add	a,cfgcount
   0172 F5*02               549 	mov	cfgcount,a
   0174 E4                  550 	clr	a
   0175 35*03               551 	addc	a,cfgcount+1
   0177 F5*03               552 	mov	cfgcount+1,a
   0179 90 7D C0            553 	mov	dptr,#OUT2BUF
                    0000    554 	.if	SOFTWARECONFIG
                            555 1$:	movx	a,@dptr
                            556 	mov	r3,a
                            557 	mov	r2,#8
                            558 	inc	dps
                            559 2$:	mov	a,#2
                            560 	xch	a,r3
                            561 	rrc	a
                            562 	xch	a,r3
                            563 	mov	acc.6,c
                            564 	mov	dptr,#OUTA
                            565 	movx	@dptr,a
                            566 	mov	dptr,#OUTC
                            567 	movx	a,@dptr
                            568 	setb	acc.1
                            569 	movx	@dptr,a
                            570 	clr	acc.1
                            571 	movx	@dptr,a
                            572 	djnz	r2,2$
                            573 	dec	dps
                            574 	inc	dptr
                            575 	djnz	r7,1$
                            576 	.else
   017C E0                  577 	movx	a,@dptr
   017D 80 04               578 	sjmp	3$
   017F E0                  579 1$:	movx	a,@dptr
   0180 30 99 FD            580 2$:	jnb	scon0+1,2$
   0183 C2 99               581 3$:	clr	scon0+1
   0185 F5 99               582 	mov	sbuf0,a
   0187 A3                  583 	inc	dptr
   0188 DF F5               584 	djnz	r7,1$
                            585 	.endif
                            586 	;; check if init went low - indicates configuration error
   018A 90 7F 9B            587 	mov	dptr,#PINSC
   018D E0                  588 	movx	a,@dptr
   018E 20 E2 0C            589 	jb	acc.2,5$
                            590 	;; INIT low
   0191 90 7F C8            591 	mov	dptr,#OUT2CS
   0194 74 01               592 	mov	a,#0x01
   0196 F0                  593 	movx	@dptr,a
   0197 75*00 90            594 	mov	errcode,#0x90
   019A 02s01rF8            595 	ljmp	fpgaerr
   019D                     596 5$:	;; check for end of FPGA configuration data
   019D 74 9C               597 	mov	a,#<(-FPGA_CONFIGSIZE)
   019F 25*02               598 	add	a,cfgcount
   01A1 74 D1               599 	mov	a,#>(-FPGA_CONFIGSIZE)
   01A3 35*03               600 	addc	a,cfgcount+1
   01A5 50 B7               601 	jnc	loadloop
                            602 	;; configuration download complete, start FPGA
   01A7 90 7F 94            603 	mov	dptr,#PORTBCFG
   01AA 74 00               604 	mov	a,#0		; TDI no longer special function pin
   01AC F0                  605 	movx	@dptr,a
   01AD 90 7F 95            606 	mov	dptr,#PORTCCFG
   01B0 74 00               607 	mov	a,#0		; TCK no longer special function pin
   01B2 F0                  608 	movx	@dptr,a
                            609 	;; wait for done loop
   01B3 7F FA               610 	mov	r7,#250
   01B5                     611 doneloop:
   01B5 90 7F 99            612 	mov	dptr,#PINSA
   01B8 E0                  613 	movx	a,@dptr
   01B9 20 E2 1F            614 	jb	acc.2,doneactive
   01BC 90 7F 9B            615 	mov	dptr,#PINSC
   01BF E0                  616 	movx	a,@dptr
   01C0 20 E2 06            617 	jb	acc.2,1$
                            618 	;; INIT low
   01C3 75*00 90            619 	mov	errcode,#0x90
   01C6 02s01rF8            620 	ljmp	fpgaerr
   01C9 90 7F 98            621 1$:	mov	dptr,#OUTC
   01CC E0                  622 	movx	a,@dptr
   01CD D2 E1               623 	setb	acc.1
   01CF F0                  624 	movx	@dptr,a
   01D0 C2 E1               625 	clr	acc.1
   01D2 F0                  626 	movx	@dptr,a
   01D3 DF E0               627 	djnz	r7,doneloop
                            628 	;; DONE stuck low
   01D5 75*00 91            629 	mov	errcode,#0x91
   01D8 02s01rF8            630 	ljmp	fpgaerr
                            631 	
   01DB                     632 doneactive:
                            633 	;; generate 16 clock pulses to start up FPGA
   01DB 7F 10               634 	mov	r7,#16
   01DD 90 7F 98            635 	mov	dptr,#OUTC
   01E0 E0                  636 	movx	a,@dptr
   01E1 D2 E1               637 0$:	setb	acc.1
   01E3 F0                  638 	movx	@dptr,a
   01E4 C2 E1               639 	clr	acc.1
   01E6 F0                  640 	movx	@dptr,a
   01E7 DF F8               641 	djnz	r7,0$
   01E9 90 7F 95            642 	mov	dptr,#PORTCCFG
   01EC 74 C0               643 	mov	a,#0xc0		; RD/WR is special function pin
   01EE F0                  644 	movx	@dptr,a
   01EF 75*00 20            645 	mov	errcode,#0x20
                            646 
   01F2 90 C0 08            647 	mov	dptr,#0xc008
   01F5 74 C7               648 	mov	a,#0xc7
   01F7 F0                  649 	movx	@dptr,a
                            650 	
   01F8                     651 fpgaerr:
   01F8 80 FE               652 	sjmp	fpgaerr
                            653 
                            654 	.area	CSEG (CODE)
                    0002    655 	ar2 = 0x02
                    0003    656 	ar3 = 0x03
                    0004    657 	ar4 = 0x04
                    0005    658 	ar5 = 0x05
                    0006    659 	ar6 = 0x06
                    0007    660 	ar7 = 0x07
                    0000    661 	ar0 = 0x00
                    0001    662 	ar1 = 0x01
                            663 
                            664 	;; jtag_shift
                            665 	;; r2 = num
                            666 	;; r3 = tdi
                            667 	;; r4 = tms
                            668 	;; return: r7 = tdo
   0000                     669 jtag_reset_tap:
   0000 7A 05               670 	mov	r2,#5
   0002 7B 00               671 	mov	r3,#0
   0004 7C FF               672 	mov	r4,#0xff
   0006                     673 jtag_shiftout:
   0006                     674 jtag_shift:
   0006 7E 01               675 	mov	r6,#1
   0008 7F 00               676 	mov	r7,#0
   000A 74 02               677 1$:	mov	a,#2
   000C CB                  678 	xch	a,r3
   000D 13                  679 	rrc	a
   000E CB                  680 	xch	a,r3
   000F 92 E6               681 	mov	acc.6,c
   0011 CC                  682 	xch	a,r4
   0012 13                  683 	rrc	a
   0013 CC                  684 	xch	a,r4
   0014 92 E7               685 	mov	acc.7,c
   0016 90 7F 96            686 	mov	dptr,#OUTA
   0019 F0                  687 	movx	@dptr,a
   001A 90 7F 9B            688 	mov	dptr,#PINSC
   001D E0                  689 	movx	a,@dptr
   001E 30 E0 03            690 	jnb	acc.0,2$
   0021 EE                  691 	mov	a,r6
   0022 42 07               692 	orl	ar7,a
   0024 90 7F 98            693 2$:	mov	dptr,#OUTC
   0027 E0                  694 	movx	a,@dptr
   0028 D2 E1               695 	setb	acc.1
   002A F0                  696 	movx	@dptr,a
   002B C2 E1               697 	clr	acc.1
   002D F0                  698 	movx	@dptr,a
   002E EE                  699 	mov	a,r6
   002F 23                  700 	rl	a
   0030 FE                  701 	mov	r6,a
   0031 DA D7               702 	djnz	r2,1$
   0033 22                  703 	ret
                            704 
                            705 	;; EEPROM address where the serial number is located
                            706 	
   0034                     707 eepromstraddr:
   0034 10                  708 	.db	0x10
                            709 
                            710 	;; I2C Routines
                            711 	;; note: ckcon should be set to #0x31 to avoid chip bugs
                            712 
   0035                     713 writei2c:
                            714 	;; dptr: data to be sent
                            715 	;; b:    device address
                            716 	;; r7:   transfer length
                            717 	;; return: a: status (bytes remaining, 0xff bus error)
   0035 05 86               718 	inc	dps
   0037 90 7F A5            719 	mov	dptr,#I2CS
   003A C2 F0               720 	clr	b.0		; r/w = 0
   003C 74 80               721 	mov	a,#0x80		; start condition
   003E F0                  722 	movx	@dptr,a
   003F 90 7F A6            723 	mov	dptr,#I2DAT
   0042 E5 F0               724 	mov	a,b
   0044 F0                  725 	movx	@dptr,a
   0045 90 7F A5            726 	mov	dptr,#I2CS	
   0048 E0                  727 0$:	movx	a,@dptr
   0049 20 E2 20            728 	jb	acc.2,3$	; BERR
   004C 30 E0 F9            729 	jnb	acc.0,0$	; DONE
   004F 30 E1 0F            730 	jnb	acc.1,1$	; ACK
   0052 90 7F A6            731 	mov	dptr,#I2DAT
   0055 15 86               732 	dec	dps
   0057 E0                  733 	movx	a,@dptr
   0058 A3                  734 	inc	dptr
   0059 05 86               735 	inc	dps
   005B F0                  736 	movx	@dptr,a
   005C 90 7F A5            737 	mov	dptr,#I2CS
   005F DF E7               738 	djnz	r7,0$
   0061 74 40               739 1$:	mov	a,#0x40		; stop condition
   0063 F0                  740 	movx	@dptr,a
   0064 E0                  741 2$:	movx	a,@dptr
   0065 20 E6 FC            742 	jb	acc.6,2$
   0068 15 86               743 	dec	dps
   006A EF                  744 	mov	a,r7
   006B 22                  745 	ret
   006C 7F FF               746 3$:	mov	r7,#255
   006E 80 F1               747 	sjmp	1$
                            748 
   0070                     749 readi2c:
                            750 	;; dptr: data to be sent
                            751 	;; b:    device address
                            752 	;; r7:   transfer length
                            753 	;; return: a: status (bytes remaining, 0xff bus error)
   0070 05 86               754 	inc	dps
   0072 90 7F A5            755 	mov	dptr,#I2CS
   0075 D2 F0               756 	setb	b.0		; r/w = 1
   0077 74 80               757 	mov	a,#0x80		; start condition
   0079 F0                  758 	movx	@dptr,a
   007A 90 7F A6            759 	mov	dptr,#I2DAT
   007D E5 F0               760 	mov	a,b
   007F F0                  761 	movx	@dptr,a
   0080 90 7F A5            762 	mov	dptr,#I2CS
   0083 E0                  763 0$:	movx	a,@dptr
   0084 20 E2 4C            764 	jb	acc.2,9$	; BERR
   0087 30 E0 F9            765 	jnb	acc.0,0$	; DONE
   008A 30 E1 03            766 	jnb	acc.1,5$	; ACK
   008D EF                  767 	mov	a,r7
   008E 70 0B               768 	jnz	1$
   0090 74 40               769 5$:	mov	a,#0x40		; stop condition
   0092 F0                  770 	movx	@dptr,a
   0093 E0                  771 2$:	movx	a,@dptr
   0094 20 E6 FC            772 	jb	acc.6,2$
   0097 15 86               773 	dec	dps
   0099 E4                  774 	clr	a
   009A 22                  775 	ret
   009B B4 01 03            776 1$:	cjne	a,#1,3$
   009E 74 20               777 	mov	a,#0x20		; LASTRD = 1
   00A0 F0                  778 	movx	@dptr,a
   00A1 90 7F A6            779 3$:	mov	dptr,#I2DAT
   00A4 E0                  780 	movx	a,@dptr		; initiate first read
   00A5 90 7F A5            781 	mov	dptr,#I2CS
   00A8 E0                  782 4$:	movx	a,@dptr
   00A9 20 E2 27            783 	jb	acc.2,9$	; BERR
   00AC 30 E0 F9            784 	jnb	acc.0,4$	; DONE
   00AF EF                  785 	mov	a,r7
   00B0 B4 02 03            786 	cjne	a,#2,6$
   00B3 74 20               787 	mov	a,#0x20		; LASTRD = 1
   00B5 F0                  788 	movx	@dptr,a
   00B6 B4 01 03            789 6$:	cjne	a,#1,7$
   00B9 74 40               790 	mov	a,#0x40		; stop condition
   00BB F0                  791 	movx	@dptr,a
   00BC 90 7F A6            792 7$:	mov	dptr,#I2DAT
   00BF E0                  793 	movx	a,@dptr		; read data
   00C0 15 86               794 	dec	dps
   00C2 F0                  795 	movx	@dptr,a
   00C3 A3                  796 	inc	dptr
   00C4 05 86               797 	inc	dps
   00C6 90 7F A5            798 	mov	dptr,#I2CS
   00C9 DF DD               799 	djnz	r7,4$
   00CB E0                  800 8$:	movx	a,@dptr
   00CC 20 E6 FC            801 	jb	acc.6,8$
   00CF 15 86               802 	dec	dps
   00D1 E4                  803 	clr	a
   00D2 22                  804 	ret
   00D3 74 40               805 9$:	mov	a,#0x40		; stop condition
   00D5 F0                  806 	movx	@dptr,a
   00D6 E0                  807 10$:	movx	a,@dptr
   00D7 20 E6 FC            808 	jb	acc.6,10$
   00DA 74 FF               809 	mov	a,#255
   00DC 15 86               810 	dec	dps
   00DE 22                  811 	ret
                            812 
                            813 	;; ------------------ interrupt handlers ------------------------
                            814 
   00DF                     815 int0_isr:
   00DF C0 E0               816 	push	acc
   00E1 C0 F0               817 	push	b
   00E3 C0 82               818 	push	dpl0
   00E5 C0 83               819 	push	dph0
   00E7 C0 D0               820 	push	psw
   00E9 75 D0 00            821 	mov	psw,#0x00
   00EC C0 86               822 	push	dps
   00EE 75 86 00            823 	mov	dps,#0
                            824 	;; clear interrupt
   00F1 C2 89               825 	clr	tcon+1
                            826 	;; handle interrupt
                            827 	;; epilogue
   00F3 D0 86               828 	pop	dps
   00F5 D0 D0               829 	pop	psw
   00F7 D0 83               830 	pop	dph0
   00F9 D0 82               831 	pop	dpl0
   00FB D0 F0               832 	pop	b
   00FD D0 E0               833 	pop	acc
   00FF 32                  834 	reti
                            835 
   0100                     836 timer0_isr:
   0100 C0 E0               837 	push	acc
   0102 C0 F0               838 	push	b
   0104 C0 82               839 	push	dpl0
   0106 C0 83               840 	push	dph0
   0108 C0 D0               841 	push	psw
   010A 75 D0 00            842 	mov	psw,#0x00
   010D C0 86               843 	push	dps
   010F 75 86 00            844 	mov	dps,#0
                            845 	;; clear interrupt
   0112 C2 8D               846 	clr	tcon+5
                            847 	;; handle interrupt
   0114 05*04               848 	inc	leddiv
   0116 E5*04               849 	mov	a,leddiv
   0118 54 07               850 	anl	a,#7
   011A 70 07               851 	jnz	0$
   011C 90 7F 98            852 	mov	dptr,#OUTC
   011F E0                  853 	movx	a,@dptr
   0120 64 08               854 	xrl	a,#0x08
   0122 F0                  855 	movx	@dptr,a
   0123                     856 0$:
                            857 	;; epilogue
   0123 D0 86               858 	pop	dps
   0125 D0 D0               859 	pop	psw
   0127 D0 83               860 	pop	dph0
   0129 D0 82               861 	pop	dpl0
   012B D0 F0               862 	pop	b
   012D D0 E0               863 	pop	acc
   012F 32                  864 	reti
                            865 
   0130                     866 int1_isr:
   0130 C0 E0               867 	push	acc
   0132 C0 F0               868 	push	b
   0134 C0 82               869 	push	dpl0
   0136 C0 83               870 	push	dph0
   0138 C0 D0               871 	push	psw
   013A 75 D0 00            872 	mov	psw,#0x00
   013D C0 86               873 	push	dps
   013F 75 86 00            874 	mov	dps,#0
                            875 	;; clear interrupt
   0142 C2 8B               876 	clr	tcon+3
                            877 	;; handle interrupt
                            878 	;; epilogue
   0144 D0 86               879 	pop	dps
   0146 D0 D0               880 	pop	psw
   0148 D0 83               881 	pop	dph0
   014A D0 82               882 	pop	dpl0
   014C D0 F0               883 	pop	b
   014E D0 E0               884 	pop	acc
   0150 32                  885 	reti
                            886 
   0151                     887 timer1_isr:
   0151 C0 E0               888 	push	acc
   0153 C0 F0               889 	push	b
   0155 C0 82               890 	push	dpl0
   0157 C0 83               891 	push	dph0
   0159 C0 D0               892 	push	psw
   015B 75 D0 00            893 	mov	psw,#0x00
   015E C0 86               894 	push	dps
   0160 75 86 00            895 	mov	dps,#0
                            896 	;; clear interrupt
   0163 C2 8F               897 	clr	tcon+7
                            898 	;; handle interrupt
                            899 	;; epilogue
   0165 D0 86               900 	pop	dps
   0167 D0 D0               901 	pop	psw
   0169 D0 83               902 	pop	dph0
   016B D0 82               903 	pop	dpl0
   016D D0 F0               904 	pop	b
   016F D0 E0               905 	pop	acc
   0171 32                  906 	reti
                            907 
   0172                     908 ser0_isr:
   0172 C0 E0               909 	push	acc
   0174 C0 F0               910 	push	b
   0176 C0 82               911 	push	dpl0
   0178 C0 83               912 	push	dph0
   017A C0 D0               913 	push	psw
   017C 75 D0 00            914 	mov	psw,#0x00
   017F C0 86               915 	push	dps
   0181 75 86 00            916 	mov	dps,#0
                            917 	;; clear interrupt
   0184 C2 98               918 	clr	scon0+0
   0186 C2 99               919 	clr	scon0+1
                            920 	;; handle interrupt
                            921 	;; epilogue
   0188 D0 86               922 	pop	dps
   018A D0 D0               923 	pop	psw
   018C D0 83               924 	pop	dph0
   018E D0 82               925 	pop	dpl0
   0190 D0 F0               926 	pop	b
   0192 D0 E0               927 	pop	acc
   0194 32                  928 	reti
                            929 
   0195                     930 timer2_isr:
   0195 C0 E0               931 	push	acc
   0197 C0 F0               932 	push	b
   0199 C0 82               933 	push	dpl0
   019B C0 83               934 	push	dph0
   019D C0 D0               935 	push	psw
   019F 75 D0 00            936 	mov	psw,#0x00
   01A2 C0 86               937 	push	dps
   01A4 75 86 00            938 	mov	dps,#0
                            939 	;; clear interrupt
   01A7 C2 CF               940 	clr	t2con+7
                            941 	;; handle interrupt
                            942 	;; epilogue
   01A9 D0 86               943 	pop	dps
   01AB D0 D0               944 	pop	psw
   01AD D0 83               945 	pop	dph0
   01AF D0 82               946 	pop	dpl0
   01B1 D0 F0               947 	pop	b
   01B3 D0 E0               948 	pop	acc
   01B5 32                  949 	reti
                            950 
   01B6                     951 resume_isr:
   01B6 C0 E0               952 	push	acc
   01B8 C0 F0               953 	push	b
   01BA C0 82               954 	push	dpl0
   01BC C0 83               955 	push	dph0
   01BE C0 D0               956 	push	psw
   01C0 75 D0 00            957 	mov	psw,#0x00
   01C3 C0 86               958 	push	dps
   01C5 75 86 00            959 	mov	dps,#0
                            960 	;; clear interrupt
   01C8 C2 DC               961 	clr	eicon+4
                            962 	;; handle interrupt
                            963 	;; epilogue
   01CA D0 86               964 	pop	dps
   01CC D0 D0               965 	pop	psw
   01CE D0 83               966 	pop	dph0
   01D0 D0 82               967 	pop	dpl0
   01D2 D0 F0               968 	pop	b
   01D4 D0 E0               969 	pop	acc
   01D6 32                  970 	reti
                            971 
   01D7                     972 ser1_isr:
   01D7 C0 E0               973 	push	acc
   01D9 C0 F0               974 	push	b
   01DB C0 82               975 	push	dpl0
   01DD C0 83               976 	push	dph0
   01DF C0 D0               977 	push	psw
   01E1 75 D0 00            978 	mov	psw,#0x00
   01E4 C0 86               979 	push	dps
   01E6 75 86 00            980 	mov	dps,#0
                            981 	;; clear interrupt
   01E9 C2 C0               982 	clr	scon1+0
   01EB C2 C1               983 	clr	scon1+1
                            984 	;; handle interrupt
                            985 	;; epilogue
   01ED D0 86               986 	pop	dps
   01EF D0 D0               987 	pop	psw
   01F1 D0 83               988 	pop	dph0
   01F3 D0 82               989 	pop	dpl0
   01F5 D0 F0               990 	pop	b
   01F7 D0 E0               991 	pop	acc
   01F9 32                  992 	reti
                            993 
   01FA                     994 i2c_isr:
   01FA C0 E0               995 	push	acc
   01FC C0 F0               996 	push	b
   01FE C0 82               997 	push	dpl0
   0200 C0 83               998 	push	dph0
   0202 C0 D0               999 	push	psw
   0204 75 D0 00           1000 	mov	psw,#0x00
   0207 C0 86              1001 	push	dps
   0209 75 86 00           1002 	mov	dps,#0
                           1003 	;; clear interrupt
   020C E5 91              1004 	mov	a,exif
   020E C2 E5              1005 	clr	acc.5
   0210 F5 91              1006 	mov	exif,a
                           1007 	;; handle interrupt
                           1008 	;; epilogue
   0212 D0 86              1009 	pop	dps
   0214 D0 D0              1010 	pop	psw
   0216 D0 83              1011 	pop	dph0
   0218 D0 82              1012 	pop	dpl0
   021A D0 F0              1013 	pop	b
   021C D0 E0              1014 	pop	acc
   021E 32                 1015 	reti
                           1016 
   021F                    1017 int4_isr:
   021F C0 E0              1018 	push	acc
   0221 C0 F0              1019 	push	b
   0223 C0 82              1020 	push	dpl0
   0225 C0 83              1021 	push	dph0
   0227 C0 D0              1022 	push	psw
   0229 75 D0 00           1023 	mov	psw,#0x00
   022C C0 86              1024 	push	dps
   022E 75 86 00           1025 	mov	dps,#0
                           1026 	;; clear interrupt
   0231 E5 91              1027 	mov	a,exif
   0233 C2 E6              1028 	clr	acc.6
   0235 F5 91              1029 	mov	exif,a
                           1030 	;; handle interrupt
                           1031 	;; epilogue
   0237 D0 86              1032 	pop	dps
   0239 D0 D0              1033 	pop	psw
   023B D0 83              1034 	pop	dph0
   023D D0 82              1035 	pop	dpl0
   023F D0 F0              1036 	pop	b
   0241 D0 E0              1037 	pop	acc
   0243 32                 1038 	reti
                           1039 
   0244                    1040 int5_isr:
   0244 C0 E0              1041 	push	acc
   0246 C0 F0              1042 	push	b
   0248 C0 82              1043 	push	dpl0
   024A C0 83              1044 	push	dph0
   024C C0 D0              1045 	push	psw
   024E 75 D0 00           1046 	mov	psw,#0x00
   0251 C0 86              1047 	push	dps
   0253 75 86 00           1048 	mov	dps,#0
                           1049 	;; clear interrupt
   0256 E5 91              1050 	mov	a,exif
   0258 C2 E7              1051 	clr	acc.7
   025A F5 91              1052 	mov	exif,a
                           1053 	;; handle interrupt
                           1054 	;; epilogue
   025C D0 86              1055 	pop	dps
   025E D0 D0              1056 	pop	psw
   0260 D0 83              1057 	pop	dph0
   0262 D0 82              1058 	pop	dpl0
   0264 D0 F0              1059 	pop	b
   0266 D0 E0              1060 	pop	acc
   0268 32                 1061 	reti
                           1062 
   0269                    1063 int6_isr:
   0269 C0 E0              1064 	push	acc
   026B C0 F0              1065 	push	b
   026D C0 82              1066 	push	dpl0
   026F C0 83              1067 	push	dph0
   0271 C0 D0              1068 	push	psw
   0273 75 D0 00           1069 	mov	psw,#0x00
   0276 C0 86              1070 	push	dps
   0278 75 86 00           1071 	mov	dps,#0
                           1072 	;; clear interrupt
   027B C2 DB              1073 	clr	eicon+3
                           1074 	;; handle interrupt
                           1075 	;; epilogue
   027D D0 86              1076 	pop	dps
   027F D0 D0              1077 	pop	psw
   0281 D0 83              1078 	pop	dph0
   0283 D0 82              1079 	pop	dpl0
   0285 D0 F0              1080 	pop	b
   0287 D0 E0              1081 	pop	acc
   0289 32                 1082 	reti
                           1083 
   028A                    1084 xmemread::
   028A E5*09              1085 	mov	a,ctrllen
   028C FF                 1086 	mov	r7,a
   028D 24 C0              1087 	add	a,#-64
   028F F5*09              1088 	mov	ctrllen,a
   0291 E5*0A              1089 	mov	a,ctrllen+1
   0293 34 00              1090 	addc	a,#0
   0295 50 12              1091 	jnc	0$
   0297 E4                 1092 	clr	a
   0298 F5*09              1093 	mov	ctrllen,a
   029A F5*0A              1094 	mov	ctrllen+1,a
   029C F5*06              1095 	mov	ctrlcode,a
   029E 74 02              1096 	mov	a,#2		; ack control transfer
   02A0 90 7F B4           1097 	mov	dptr,#EP0CS
   02A3 F0                 1098 	movx	@dptr,a
   02A4 EF                 1099 	mov	a,r7
   02A5 60 25              1100 	jz	2$
   02A7 80 04              1101 	sjmp	1$
   02A9 F5*0A              1102 0$:	mov	ctrllen+1,a
   02AB 7F 40              1103 	mov	r7,#64
   02AD 8F 00              1104 1$:	mov	ar0,r7
   02AF 85*07 82           1105 	mov	dpl0,ctrladdr
   02B2 85*08 83           1106 	mov	dph0,ctrladdr+1
   02B5 05 86              1107 	inc	dps
   02B7 90 7F 00           1108 	mov	dptr,#IN0BUF
   02BA 15 86              1109 	dec	dps
   02BC E0                 1110 3$:	movx	a,@dptr
   02BD A3                 1111 	inc	dptr
   02BE 05 86              1112 	inc	dps
   02C0 F0                 1113 	movx	@dptr,a
   02C1 A3                 1114 	inc	dptr
   02C2 15 86              1115 	dec	dps
   02C4 D8 F6              1116 	djnz	r0,3$
   02C6 85 82*07           1117 	mov	ctrladdr,dpl0
   02C9 85 83*08           1118 	mov	ctrladdr+1,dph0
   02CC EF                 1119 2$:	mov	a,r7
   02CD 90 7F B5           1120 	mov	dptr,#IN0BC
   02D0 F0                 1121 	movx	@dptr,a
   02D1 22                 1122 	ret
                           1123 
   02D2                    1124 usb_sudav_isr:
   02D2 C0 E0              1125 	push	acc
   02D4 C0 F0              1126 	push	b
   02D6 C0 82              1127 	push	dpl0
   02D8 C0 83              1128 	push	dph0
   02DA C0 84              1129 	push	dpl1
   02DC C0 85              1130 	push	dph1
   02DE C0 D0              1131 	push	psw
   02E0 75 D0 00           1132 	mov	psw,#0x00
   02E3 C0 86              1133 	push	dps
   02E5 75 86 00           1134 	mov	dps,#0
   02E8 C0 00              1135 	push	ar0
   02EA C0 07              1136 	push	ar7
                           1137 	;; clear interrupt
   02EC E5 91              1138 	mov	a,exif
   02EE C2 E4              1139 	clr	acc.4
   02F0 F5 91              1140 	mov	exif,a
   02F2 90 7F AB           1141 	mov	dptr,#USBIRQ
   02F5 74 01              1142 	mov	a,#0x01
   02F7 F0                 1143 	movx	@dptr,a
                           1144 	;; handle interrupt
   02F8 75*06 00           1145 	mov	ctrlcode,#0		; reset control out code
   02FB 90 7F E9           1146 	mov	dptr,#SETUPDAT+1
   02FE E0                 1147 	movx	a,@dptr			; bRequest field
                           1148 	;; standard commands
                           1149 	;; USB_REQ_GET_DESCRIPTOR
   02FF B4 06 59           1150 	cjne	a,#USB_REQ_GET_DESCRIPTOR,cmdnotgetdesc
   0302 90 7F E8           1151 	mov	dptr,#SETUPDAT		; bRequestType == 0x80
   0305 E0                 1152 	movx	a,@dptr
   0306 B4 80 4F           1153 	cjne	a,#USB_DIR_IN,setupstallstd
   0309 90 7F EB           1154 	mov	dptr,#SETUPDAT+3
   030C E0                 1155 	movx	a,@dptr
   030D B4 01 0C           1156 	cjne	a,#USB_DT_DEVICE,cmdnotgetdescdev
   0310 90 7F D4           1157 	mov	dptr,#SUDPTRH
   0313 74s09              1158 	mov	a,#>devicedescr
   0315 F0                 1159 	movx	@dptr,a
   0316 A3                 1160 	inc	dptr
   0317 74rD5              1161 	mov	a,#<devicedescr
   0319 F0                 1162 	movx	@dptr,a
   031A 80 39              1163 	sjmp	setupackstd
   031C                    1164 cmdnotgetdescdev:
   031C B4 02 12           1165 	cjne	a,#USB_DT_CONFIG,cmdnotgetdesccfg
   031F 90 7F EA           1166 	mov	dptr,#SETUPDAT+2
   0322 E0                 1167 	movx	a,@dptr
   0323 70 33              1168 	jnz	setupstallstd
   0325 90 7F D4           1169 	mov	dptr,#SUDPTRH
   0328 74s09              1170 	mov	a,#>config0descr
   032A F0                 1171 	movx	@dptr,a
   032B A3                 1172 	inc	dptr
   032C 74rE7              1173 	mov	a,#<config0descr
   032E F0                 1174 	movx	@dptr,a
   032F 80 24              1175 	sjmp	setupackstd
   0331                    1176 cmdnotgetdesccfg:
   0331 B4 03 24           1177 	cjne	a,#USB_DT_STRING,setupstallstd
   0334 90 7F EA           1178 	mov	dptr,#SETUPDAT+2
   0337 E0                 1179 	movx	a,@dptr
   0338 24 FC              1180 	add	a,#-numstrings
   033A 40 1C              1181 	jc	setupstallstd
   033C E0                 1182 	movx	a,@dptr
   033D 25 E0              1183 	add	a,acc
   033F 24r2C              1184 	add	a,#<stringdescr
   0341 F5 82              1185 	mov	dpl0,a
   0343 E4                 1186 	clr	a
   0344 34s0A              1187 	addc	a,#>stringdescr
   0346 F5 83              1188 	mov	dph0,a
   0348 E0                 1189 	movx	a,@dptr
   0349 F5 F0              1190 	mov	b,a
   034B A3                 1191 	inc	dptr
   034C E0                 1192 	movx	a,@dptr
   034D 90 7F D4           1193 	mov	dptr,#SUDPTRH
   0350 F0                 1194 	movx	@dptr,a
   0351 A3                 1195 	inc	dptr
   0352 E5 F0              1196 	mov	a,b
   0354 F0                 1197 	movx	@dptr,a
                           1198 	; sjmp	setupackstd	
   0355                    1199 setupackstd:
   0355 02s05r9F           1200 	ljmp	setupack
   0358                    1201 setupstallstd:
   0358 02s05r9B           1202 	ljmp	setupstall
   035B                    1203 cmdnotgetdesc:
                           1204 	;; USB_REQ_SET_CONFIGURATION
   035B B4 09 41           1205 	cjne	a,#USB_REQ_SET_CONFIGURATION,cmdnotsetconf
   035E 90 7F E8           1206 	mov	dptr,#SETUPDAT
   0361 E0                 1207 	movx	a,@dptr
   0362 70 F4              1208 	jnz	setupstallstd
   0364 90 7F EA           1209 	mov	dptr,#SETUPDAT+2
   0367 E0                 1210 	movx	a,@dptr
   0368 24 FE              1211 	add	a,#-2
   036A 40 EC              1212 	jc	setupstallstd
   036C E0                 1213 	movx	a,@dptr
   036D F5*0B              1214 	mov	numconfig,a
   036F                    1215 cmdresettoggleshalt:
   036F 90 7F D7           1216 	mov	dptr,#TOGCTL
   0372 78 07              1217 	mov	r0,#7
   0374 E8                 1218 0$:	mov	a,r0
   0375 44 10              1219 	orl	a,#0x10
   0377 F0                 1220 	movx	@dptr,a
   0378 44 30              1221 	orl	a,#0x30
   037A F0                 1222 	movx	@dptr,a
   037B E8                 1223 	mov	a,r0
   037C F0                 1224 	movx	@dptr,a
   037D 44 20              1225 	orl	a,#0x20
   037F F0                 1226 	movx	@dptr,a
   0380 D8 F2              1227 	djnz	r0,0$
   0382 E4                 1228 	clr	a
   0383 F0                 1229 	movx	@dptr,a
   0384 74 02              1230 	mov	a,#2
   0386 90 7F B6           1231 	mov	dptr,#IN1CS
   0389 78 07              1232 	mov	r0,#7
   038B F0                 1233 1$:	movx	@dptr,a
   038C A3                 1234 	inc	dptr
   038D A3                 1235 	inc	dptr
   038E D8 FB              1236 	djnz	r0,1$
   0390 90 7F C6           1237 	mov	dptr,#OUT1CS
   0393 78 07              1238 	mov	r0,#7
   0395 F0                 1239 2$:	movx	@dptr,a
   0396 A3                 1240 	inc	dptr
   0397 A3                 1241 	inc	dptr
   0398 D8 FB              1242 	djnz	r0,2$
   039A 12s07r59           1243 	lcall	fillusbintr
   039D 80 B6              1244 	sjmp	setupackstd
   039F                    1245 cmdnotsetconf:
                           1246 	;; USB_REQ_SET_INTERFACE
   039F B4 0B 1A           1247 	cjne	a,#USB_REQ_SET_INTERFACE,cmdnotsetint
   03A2 90 7F E8           1248 	mov	dptr,#SETUPDAT
   03A5 E0                 1249 	movx	a,@dptr
   03A6 B4 01 AF           1250 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_OUT,setupstallstd
   03A9 E5*0B              1251 	mov	a,numconfig
   03AB B4 01 AA           1252 	cjne	a,#1,setupstallstd
   03AE 90 7F EC           1253 	mov	dptr,#SETUPDAT+4
   03B1 E0                 1254 	movx	a,@dptr
   03B2 70 A4              1255 	jnz	setupstallstd
   03B4 90 7F EA           1256 	mov	dptr,#SETUPDAT+2
   03B7 E0                 1257 	movx	a,@dptr
   03B8 F5*0C              1258 	mov	altsetting,a
   03BA 80 B3              1259 	sjmp	cmdresettoggleshalt
   03BC                    1260 cmdnotsetint:
                           1261 	;; USB_REQ_GET_INTERFACE
   03BC B4 0A 20           1262 	cjne	a,#USB_REQ_GET_INTERFACE,cmdnotgetint
   03BF 90 7F E8           1263 	mov	dptr,#SETUPDAT
   03C2 E0                 1264 	movx	a,@dptr
   03C3 B4 81 92           1265 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_IN,setupstallstd
   03C6 E5*0B              1266 	mov	a,numconfig
   03C8 B4 01 8D           1267 	cjne	a,#1,setupstallstd
   03CB 90 7F EC           1268 	mov	dptr,#SETUPDAT+4
   03CE E0                 1269 	movx	a,@dptr
   03CF 70 87              1270 	jnz	setupstallstd
   03D1 E5*0C              1271 	mov	a,altsetting
   03D3                    1272 cmdrespondonebyte:
   03D3 90 7F 00           1273 	mov	dptr,#IN0BUF
   03D6 F0                 1274 	movx	@dptr,a
   03D7 90 7F B5           1275 	mov	dptr,#IN0BC
   03DA 74 01              1276 	mov	a,#1
   03DC F0                 1277 	movx	@dptr,a	
   03DD 80 4E              1278 	sjmp	setupackstd2
   03DF                    1279 cmdnotgetint:
                           1280 	;; USB_REQ_GET_CONFIGURATION
   03DF B4 08 0B           1281 	cjne	a,#USB_REQ_GET_CONFIGURATION,cmdnotgetconf
   03E2 90 7F E8           1282 	mov	dptr,#SETUPDAT
   03E5 E0                 1283 	movx	a,@dptr
   03E6 B4 80 47           1284 	cjne	a,#USB_RECIP_DEVICE|USB_DIR_IN,setupstallstd2
   03E9 E5*0B              1285 	mov	a,numconfig
   03EB 80 E6              1286 	sjmp	cmdrespondonebyte	
   03ED                    1287 cmdnotgetconf:
                           1288 	;; USB_REQ_GET_STATUS (0)
   03ED 70 44              1289 	jnz	cmdnotgetstat
   03EF 90 7F E8           1290 	mov	dptr,#SETUPDAT
   03F2 E0                 1291 	movx	a,@dptr
   03F3 B4 80 11           1292 	cjne	a,#USB_RECIP_DEVICE|USB_DIR_IN,cmdnotgetstatdev
   03F6 74 01              1293 	mov	a,#1
   03F8                    1294 cmdrespondstat:
   03F8 90 7F 00           1295 	mov	dptr,#IN0BUF
   03FB F0                 1296 	movx	@dptr,a
   03FC A3                 1297 	inc	dptr
   03FD E4                 1298 	clr	a
   03FE F0                 1299 	movx	@dptr,a
   03FF 90 7F B5           1300 	mov	dptr,#IN0BC
   0402 74 02              1301 	mov	a,#2
   0404 F0                 1302 	movx	@dptr,a	
   0405 80 26              1303 	sjmp	setupackstd2
   0407                    1304 cmdnotgetstatdev:
   0407 B4 81 03           1305 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_IN,cmdnotgetstatintf
   040A E4                 1306 	clr	a
   040B 80 EB              1307 	sjmp	cmdrespondstat
   040D                    1308 cmdnotgetstatintf:
   040D B4 82 20           1309 	cjne	a,#USB_RECIP_ENDPOINT|USB_DIR_IN,setupstallstd2
   0410 90 7F EC           1310 	mov	dptr,#SETUPDAT+4
   0413 E0                 1311 	movx	a,@dptr
   0414 90 7F C4           1312 	mov	dptr,#OUT1CS-2
   0417 30 E7 03           1313 	jnb	acc.7,0$
   041A 90 7F B4           1314 	mov	dptr,#IN1CS-2
   041D 54 0F              1315 0$:	anl	a,#15
   041F 60 0F              1316 	jz	setupstallstd2
   0421 20 E3 0C           1317 	jb	acc.3,setupstallstd2
   0424 25 E0              1318 	add	a,acc
   0426 25 82              1319 	add	a,dpl0
   0428 F5 82              1320 	mov	dpl0,a
   042A E0                 1321 	movx	a,@dptr
   042B 80 CB              1322 	sjmp	cmdrespondstat
   042D                    1323 setupackstd2:
   042D 02s05r9F           1324 	ljmp	setupack
   0430                    1325 setupstallstd2:
   0430 02s05r9B           1326 	ljmp	setupstall
   0433                    1327 cmdnotgetstat:
                           1328 	;; USB_REQ_SET_FEATURE
   0433 B4 03 05           1329 	cjne	a,#USB_REQ_SET_FEATURE,cmdnotsetftr
   0436 75 F0 01           1330 	mov	b,#1
   0439 80 06              1331 	sjmp	handleftr
   043B                    1332 cmdnotsetftr:
                           1333 	;; USB_REQ_CLEAR_FEATURE
   043B B4 01 3E           1334 	cjne	a,#USB_REQ_CLEAR_FEATURE,cmdnotclrftr
   043E 75 F0 00           1335 	mov	b,#0
   0441                    1336 handleftr:
   0441 90 7F E8           1337 	mov	dptr,#SETUPDAT
   0444 E0                 1338 	movx	a,@dptr
   0445 B4 02 E8           1339 	cjne	a,#USB_RECIP_ENDPOINT|USB_DIR_OUT,setupstallstd2
   0448 A3                 1340 	inc	dptr
   0449 A3                 1341 	inc	dptr
   044A E0                 1342 	movx	a,@dptr
   044B 70 E3              1343 	jnz	setupstallstd2	; not ENDPOINT_HALT feature
   044D A3                 1344 	inc	dptr
   044E E0                 1345 	movx	a,@dptr
   044F 70 DF              1346 	jnz	setupstallstd2
   0451 A3                 1347 	inc	dptr
   0452 E0                 1348 	movx	a,@dptr
   0453 90 7F C4           1349 	mov	dptr,#OUT1CS-2
   0456 30 E7 05           1350 	jnb	acc.7,0$
   0459 90 7F B4           1351 	mov	dptr,#IN1CS-2
   045C 44 10              1352 	orl	a,#0x10
   045E 20 E3 CF           1353 0$:	jb	acc.3,setupstallstd2
                           1354 	;; clear data toggle
   0461 54 1F              1355 	anl	a,#0x1f
   0463 05 86              1356 	inc	dps
   0465 90 7F D7           1357 	mov	dptr,#TOGCTL
   0468 F0                 1358 	movx	@dptr,a
   0469 44 20              1359 	orl	a,#0x20
   046B F0                 1360 	movx	@dptr,a
   046C 54 0F              1361 	anl	a,#15
   046E F0                 1362 	movx	@dptr,a
   046F 15 86              1363 	dec	dps	
                           1364 	;; clear/set ep halt feature
   0471 25 E0              1365 	add	a,acc
   0473 25 82              1366 	add	a,dpl0
   0475 F5 82              1367 	mov	dpl0,a
   0477 E5 F0              1368 	mov	a,b
   0479 F0                 1369 	movx	@dptr,a
   047A 80 B1              1370 	sjmp	setupackstd2
   047C                    1371 cmdnotclrftr:
                           1372 	;; vendor specific commands
                           1373 	;; 0xa3
   047C B4 A3 3E           1374 	cjne	a,#0xa3,cmdnota3
   047F 90 7F EA           1375 	mov	dptr,#SETUPDAT+2
   0482 E0                 1376 	movx	a,@dptr
   0483 F5*07              1377 	mov	ctrladdr,a
   0485 A3                 1378 	inc	dptr
   0486 E0                 1379 	movx	a,@dptr
   0487 F5*08              1380 	mov	ctrladdr+1,a
   0489 24 50              1381 	add	a,#80
   048B 50 2D              1382 	jnc	setupstalla3
   048D 90 7F EE           1383 	mov	dptr,#SETUPDAT+6
   0490 E0                 1384 	movx	a,@dptr
   0491 F5*09              1385 	mov	ctrllen,a
   0493 25*07              1386 	add	a,ctrladdr
   0495 A3                 1387 	inc	dptr
   0496 E0                 1388 	movx	a,@dptr
   0497 F5*0A              1389 	mov	ctrllen+1,a
   0499 35*08              1390 	addc	a,ctrladdr+1
   049B 40 1D              1391 	jc	setupstalla3
   049D 90 7F E8           1392 	mov	dptr,#SETUPDAT		; bRequestType == 0x40
   04A0 E0                 1393 	movx	a,@dptr
   04A1 B4 40 0A           1394 	cjne	a,#0x40,1$
   04A4 75*06 01           1395 	mov	ctrlcode,#1
   04A7 90 7F C5           1396 	mov	dptr,#OUT0BC
   04AA F0                 1397 	movx	@dptr,a
   04AB 02s05rA5           1398 	ljmp	endusbisr
   04AE B4 C0 09           1399 1$:	cjne	a,#0xc0,setupstalla3	; bRequestType == 0xc0
   04B1 75*06 02           1400 	mov	ctrlcode,#2
   04B4 12s02r8A           1401 	lcall	xmemread
   04B7 02s05rA5           1402 	ljmp	endusbisr
   04BA                    1403 setupstalla3:
   04BA 02s05r9B           1404 	ljmp	setupstall
   04BD                    1405 cmdnota3:
                           1406 	;; 0xb1
   04BD B4 B1 3E           1407 	cjne	a,#0xb1,cmdnotb1
   04C0 90 7F E8           1408 	mov	dptr,#SETUPDAT		; bRequestType == 0xc0
   04C3 E0                 1409 	movx	a,@dptr
   04C4 B4 C0 34           1410 	cjne	a,#0xc0,setupstallb1
   04C7 90 7F 00           1411 	mov	dptr,#IN0BUF
   04CA E5*00              1412 	mov	a,errcode
   04CC F0                 1413 	movx	@dptr,a
   04CD A3                 1414 	inc	dptr
   04CE E5*01              1415 	mov	a,errval
   04D0 F0                 1416 	movx	@dptr,a
   04D1 A3                 1417 	inc	dptr
   04D2 E5 81              1418 	mov	a,sp
                           1419 
                           1420 ;;; xxxx
   04D4 C0 82              1421 	push	dpl0
   04D6 C0 83              1422 	push	dph0
   04D8 90 7F DF           1423 	mov	dptr,#OUT07VAL
   04DB E0                 1424 	movx	a,@dptr
   04DC D0 83              1425 	pop	dph0
   04DE D0 82              1426 	pop	dpl0
                           1427 ;;; xxxx
                           1428 	
   04E0 F0                 1429 	movx	@dptr,a
   04E1 A3                 1430 	inc	dptr
   04E2 74 00              1431 	mov	a,#0
                           1432 
                           1433 ;;; xxxx
   04E4 C0 82              1434 	push	dpl0
   04E6 C0 83              1435 	push	dph0
   04E8 90 7F C8           1436 	mov	dptr,#OUT2CS
   04EB E0                 1437 	movx	a,@dptr
   04EC D0 83              1438 	pop	dph0
   04EE D0 82              1439 	pop	dpl0
                           1440 ;;; xxxx
                           1441 	
   04F0 F0                 1442 	movx	@dptr,a
   04F1 A3                 1443 	inc	dptr
   04F2 90 7F B5           1444 	mov	dptr,#IN0BC
   04F5 74 04              1445 	mov	a,#4
   04F7 F0                 1446 	movx	@dptr,a
   04F8 02s05r9F           1447 	ljmp	setupack
   04FB                    1448 setupstallb1:
   04FB 02s05r9B           1449 	ljmp	setupstall
   04FE                    1450 cmdnotb1:
                           1451 	;; 0xb2
   04FE B4 B2 2B           1452 	cjne	a,#0xb2,cmdnotb2
   0501 90 7F E8           1453 	mov	dptr,#SETUPDAT		; bRequestType == 0xc0
   0504 E0                 1454 	movx	a,@dptr
   0505 B4 C0 21           1455 	cjne	a,#0xc0,setupstallb2
   0508 90 7F 00           1456 	mov	dptr,#IN0BUF
   050B E5*00              1457 	mov	a,errcode
   050D F0                 1458 	movx	@dptr,a
   050E A3                 1459 	inc	dptr
   050F E5*01              1460 	mov	a,errval
   0511 F0                 1461 	movx	@dptr,a
   0512 A3                 1462 	inc	dptr
   0513 E5*02              1463 	mov	a,cfgcount
   0515 F0                 1464 	movx	@dptr,a
   0516 A3                 1465 	inc	dptr
   0517 E5*03              1466 	mov	a,cfgcount+1
   0519 F0                 1467 	movx	@dptr,a
   051A A3                 1468 	inc	dptr
   051B E5*05              1469 	mov	a,irqcount
   051D F0                 1470 	movx	@dptr,a
   051E 90 7F B5           1471 	mov	dptr,#IN0BC
   0521 74 05              1472 	mov	a,#5
   0523 F0                 1473 	movx	@dptr,a
   0524 05*05              1474 	inc	irqcount
   0526 02s05r9F           1475 	ljmp	setupack
   0529                    1476 setupstallb2:
   0529 02s05r9B           1477 	ljmp	setupstall
   052C                    1478 cmdnotb2:
                           1479 	;; 0xb3
   052C B4 B3 2A           1480 	cjne	a,#0xb3,cmdnotb3
   052F 90 7F E8           1481 	mov	dptr,#SETUPDAT		; bRequestType == 0xc0
   0532 E0                 1482 	movx	a,@dptr
   0533 B4 C0 20           1483 	cjne	a,#0xc0,setupstallb3
                           1484 	;; read EEPROM
                    0006   1485 	serstrlen = 6
   0536 75 F0 A0           1486 	mov	b,#0xa0		; EEPROM address
   0539 90s00r34           1487 	mov	dptr,#eepromstraddr
   053C 7F 01              1488 	mov	r7,#1
   053E 12s00r35           1489 	lcall	writei2c
   0541 70 13              1490 	jnz	setupstallb3
   0543 90 7F 00           1491 	mov	dptr,#IN0BUF
   0546 7F 06              1492 	mov	r7,#serstrlen
   0548 12s00r70           1493 	lcall	readi2c
   054B 70 09              1494 	jnz	setupstallb3
   054D 74 06              1495 	mov	a,#serstrlen
   054F 90 7F B5           1496 	mov	dptr,#IN0BC
   0552 F0                 1497 	movx	@dptr,a
   0553 02s05r9F           1498 	ljmp	setupack
   0556                    1499 setupstallb3:
   0556 02s05r9B           1500 	ljmp	setupstall
   0559                    1501 cmdnotb3:
                           1502 	;; 0xb4
   0559 B4 B4 3F           1503 	cjne	a,#0xb4,cmdnotb4
   055C 90 7F EF           1504 	mov	dptr,#SETUPDAT+7
   055F E0                 1505 	movx	a,@dptr
   0560 70 36              1506 	jnz	setupstallb4
   0562 90 7F EE           1507 	mov	dptr,#SETUPDAT+6
   0565 E0                 1508 	movx	a,@dptr
   0566 F8                 1509 	mov	r0,a
   0567 FF                 1510 	mov	r7,a
   0568 24 C0              1511 	add	a,#-64
   056A 40 2C              1512 	jc	setupstallb4
   056C 90 7F EC           1513 	mov	dptr,#SETUPDAT+4	; wIndex
   056F E0                 1514 	movx	a,@dptr
   0570 F5 F0              1515 	mov	b,a
   0572 F5*07              1516 	mov	ctrladdr,a
   0574 90 7F E8           1517 	mov	dptr,#SETUPDAT
   0577 E0                 1518 	movx	a,@dptr
   0578 B4 40 0A           1519 	cjne	a,#0x40,0$		; bRequestType == 0x40
   057B 75*06 02           1520 	mov	ctrlcode,#2
   057E 90 7F C5           1521 	mov	dptr,#OUT0BC
   0581 F0                 1522 	movx	@dptr,a
   0582 02s05rA5           1523 	ljmp	endusbisr
   0585 B4 C0 10           1524 0$:	cjne	a,#0xc0,setupstallb4	; bRequestType == 0xc0
   0588 90 7F 00           1525 	mov	dptr,#IN0BUF
   058B 12s00r70           1526 	lcall	readi2c
   058E 70 08              1527 	jnz	setupstallb4
   0590 E8                 1528 	mov	a,r0
   0591 90 7F B5           1529 	mov	dptr,#IN0BC
   0594 F0                 1530 	movx	@dptr,a
   0595 02s05r9F           1531 	ljmp	setupack
   0598                    1532 setupstallb4:
   0598 02s05r9B           1533 	ljmp	setupstall
   059B                    1534 cmdnotb4:
                           1535 	;; unknown commands fall through to setupstall
                           1536 
   059B                    1537 setupstall:
   059B 74 03              1538 	mov	a,#3
   059D 80 02              1539 	sjmp	endsetup
   059F                    1540 setupack:
   059F 74 02              1541 	mov	a,#2
   05A1                    1542 endsetup:
   05A1 90 7F B4           1543 	mov	dptr,#EP0CS
   05A4 F0                 1544 	movx	@dptr,a
   05A5                    1545 endusbisr:
                           1546 	;; epilogue
   05A5 D0 07              1547 	pop	ar7
   05A7 D0 00              1548 	pop	ar0
   05A9 D0 86              1549 	pop	dps
   05AB D0 D0              1550 	pop	psw
   05AD D0 85              1551 	pop	dph1
   05AF D0 84              1552 	pop	dpl1
   05B1 D0 83              1553 	pop	dph0
   05B3 D0 82              1554 	pop	dpl0
   05B5 D0 F0              1555 	pop	b
   05B7 D0 E0              1556 	pop	acc
   05B9 32                 1557 	reti
                           1558 
   05BA                    1559 usb_sof_isr:
   05BA C0 E0              1560 	push	acc
   05BC C0 F0              1561 	push	b
   05BE C0 82              1562 	push	dpl0
   05C0 C0 83              1563 	push	dph0
   05C2 C0 D0              1564 	push	psw
   05C4 75 D0 00           1565 	mov	psw,#0x00
   05C7 C0 86              1566 	push	dps
   05C9 75 86 00           1567 	mov	dps,#0
                           1568 	;; clear interrupt
   05CC E5 91              1569 	mov	a,exif
   05CE C2 E4              1570 	clr	acc.4
   05D0 F5 91              1571 	mov	exif,a
   05D2 90 7F AB           1572 	mov	dptr,#USBIRQ
   05D5 74 02              1573 	mov	a,#0x02
   05D7 F0                 1574 	movx	@dptr,a
                           1575 	;; handle interrupt
                           1576 	;; epilogue
   05D8 D0 86              1577 	pop	dps
   05DA D0 D0              1578 	pop	psw
   05DC D0 83              1579 	pop	dph0
   05DE D0 82              1580 	pop	dpl0
   05E0 D0 F0              1581 	pop	b
   05E2 D0 E0              1582 	pop	acc
   05E4 32                 1583 	reti
                           1584 
                           1585 
   05E5                    1586 usb_sutok_isr:
   05E5 C0 E0              1587 	push	acc
   05E7 C0 F0              1588 	push	b
   05E9 C0 82              1589 	push	dpl0
   05EB C0 83              1590 	push	dph0
   05ED C0 D0              1591 	push	psw
   05EF 75 D0 00           1592 	mov	psw,#0x00
   05F2 C0 86              1593 	push	dps
   05F4 75 86 00           1594 	mov	dps,#0
                           1595 	;; clear interrupt
   05F7 E5 91              1596 	mov	a,exif
   05F9 C2 E4              1597 	clr	acc.4
   05FB F5 91              1598 	mov	exif,a
   05FD 90 7F AB           1599 	mov	dptr,#USBIRQ
   0600 74 04              1600 	mov	a,#0x04
   0602 F0                 1601 	movx	@dptr,a
                           1602 	;; handle interrupt
                           1603 	;; epilogue
   0603 D0 86              1604 	pop	dps
   0605 D0 D0              1605 	pop	psw
   0607 D0 83              1606 	pop	dph0
   0609 D0 82              1607 	pop	dpl0
   060B D0 F0              1608 	pop	b
   060D D0 E0              1609 	pop	acc
   060F 32                 1610 	reti
                           1611 
   0610                    1612 usb_suspend_isr:
   0610 C0 E0              1613 	push	acc
   0612 C0 F0              1614 	push	b
   0614 C0 82              1615 	push	dpl0
   0616 C0 83              1616 	push	dph0
   0618 C0 D0              1617 	push	psw
   061A 75 D0 00           1618 	mov	psw,#0x00
   061D C0 86              1619 	push	dps
   061F 75 86 00           1620 	mov	dps,#0
                           1621 	;; clear interrupt
   0622 E5 91              1622 	mov	a,exif
   0624 C2 E4              1623 	clr	acc.4
   0626 F5 91              1624 	mov	exif,a
   0628 90 7F AB           1625 	mov	dptr,#USBIRQ
   062B 74 08              1626 	mov	a,#0x08
   062D F0                 1627 	movx	@dptr,a
                           1628 	;; handle interrupt
                           1629 	;; epilogue
   062E D0 86              1630 	pop	dps
   0630 D0 D0              1631 	pop	psw
   0632 D0 83              1632 	pop	dph0
   0634 D0 82              1633 	pop	dpl0
   0636 D0 F0              1634 	pop	b
   0638 D0 E0              1635 	pop	acc
   063A 32                 1636 	reti
                           1637 
   063B                    1638 usb_usbreset_isr:
   063B C0 E0              1639 	push	acc
   063D C0 F0              1640 	push	b
   063F C0 82              1641 	push	dpl0
   0641 C0 83              1642 	push	dph0
   0643 C0 D0              1643 	push	psw
   0645 75 D0 00           1644 	mov	psw,#0x00
   0648 C0 86              1645 	push	dps
   064A 75 86 00           1646 	mov	dps,#0
                           1647 	;; clear interrupt
   064D E5 91              1648 	mov	a,exif
   064F C2 E4              1649 	clr	acc.4
   0651 F5 91              1650 	mov	exif,a
   0653 90 7F AB           1651 	mov	dptr,#USBIRQ
   0656 74 10              1652 	mov	a,#0x10
   0658 F0                 1653 	movx	@dptr,a
                           1654 	;; handle interrupt
                           1655 	;; epilogue
   0659 D0 86              1656 	pop	dps
   065B D0 D0              1657 	pop	psw
   065D D0 83              1658 	pop	dph0
   065F D0 82              1659 	pop	dpl0
   0661 D0 F0              1660 	pop	b
   0663 D0 E0              1661 	pop	acc
   0665 32                 1662 	reti
                           1663 
   0666                    1664 usb_ep0in_isr:
   0666 C0 E0              1665 	push	acc
   0668 C0 F0              1666 	push	b
   066A C0 82              1667 	push	dpl0
   066C C0 83              1668 	push	dph0
   066E C0 84              1669 	push	dpl1
   0670 C0 85              1670 	push	dph1
   0672 C0 D0              1671 	push	psw
   0674 75 D0 00           1672 	mov	psw,#0x00
   0677 C0 86              1673 	push	dps
   0679 75 86 00           1674 	mov	dps,#0
   067C C0 00              1675 	push	ar0
   067E C0 07              1676 	push	ar7
                           1677 	;; clear interrupt
   0680 E5 91              1678 	mov	a,exif
   0682 C2 E4              1679 	clr	acc.4
   0684 F5 91              1680 	mov	exif,a
   0686 90 7F A9           1681 	mov	dptr,#IN07IRQ
   0689 74 01              1682 	mov	a,#0x01
   068B F0                 1683 	movx	@dptr,a
                           1684 	;; handle interrupt
   068C E5*06              1685 	mov	a,ctrlcode
   068E B4 02 05           1686 	cjne	a,#2,0$
   0691 12s02r8A           1687 	lcall	xmemread
   0694 80 11              1688 	sjmp	ep0inendisr
   0696 90 7F B5           1689 0$:	mov	dptr,#IN0BC
   0699 E4                 1690 	clr	a
   069A F0                 1691 	movx	@dptr,a
   069B 80 04              1692 	sjmp	ep0inack
                           1693 
   069D                    1694 ep0install:
   069D 74 03              1695 	mov	a,#3
   069F 80 02              1696 	sjmp	ep0incs
   06A1                    1697 ep0inack:
   06A1 74 02              1698 	mov	a,#2
   06A3                    1699 ep0incs:
   06A3 90 7F B4           1700 	mov	dptr,#EP0CS
   06A6 F0                 1701 	movx	@dptr,a
   06A7                    1702 ep0inendisr:
                           1703 	;; epilogue
   06A7 D0 07              1704 	pop	ar7
   06A9 D0 00              1705 	pop	ar0
   06AB D0 86              1706 	pop	dps
   06AD D0 D0              1707 	pop	psw
   06AF D0 85              1708 	pop	dph1
   06B1 D0 84              1709 	pop	dpl1
   06B3 D0 83              1710 	pop	dph0
   06B5 D0 82              1711 	pop	dpl0
   06B7 D0 F0              1712 	pop	b
   06B9 D0 E0              1713 	pop	acc
   06BB 32                 1714 	reti
                           1715 
   06BC                    1716 usb_ep0out_isr:
   06BC C0 E0              1717 	push	acc
   06BE C0 F0              1718 	push	b
   06C0 C0 82              1719 	push	dpl0
   06C2 C0 83              1720 	push	dph0
   06C4 C0 84              1721 	push	dpl1
   06C6 C0 85              1722 	push	dph1
   06C8 C0 D0              1723 	push	psw
   06CA 75 D0 00           1724 	mov	psw,#0x00
   06CD C0 86              1725 	push	dps
   06CF 75 86 00           1726 	mov	dps,#0
   06D2 C0 00              1727 	push	ar0
   06D4 C0 06              1728 	push	ar6
                           1729 	;; clear interrupt
   06D6 E5 91              1730 	mov	a,exif
   06D8 C2 E4              1731 	clr	acc.4
   06DA F5 91              1732 	mov	exif,a
   06DC 90 7F AA           1733 	mov	dptr,#OUT07IRQ
   06DF 74 01              1734 	mov	a,#0x01
   06E1 F0                 1735 	movx	@dptr,a
                           1736 	;; handle interrupt
   06E2 E5*06              1737 	mov	a,ctrlcode		; check control code
   06E4 B4 01 36           1738 	cjne	a,#0x01,i2cwr
                           1739 	;; write to external memory
   06E7 90 7F C5           1740 	mov	dptr,#OUT0BC
   06EA E0                 1741 	movx	a,@dptr
   06EB 60 28              1742 	jz	0$
   06ED FF                 1743 	mov	r7,a
   06EE C3                 1744 	clr	c
   06EF E5*09              1745 	mov	a,ctrllen
   06F1 9F                 1746 	subb	a,r7
   06F2 F5*09              1747 	mov	ctrllen,a
   06F4 E5*0A              1748 	mov	a,ctrllen+1
   06F6 94 00              1749 	subb	a,#0
   06F8 F5*0A              1750 	mov	ctrllen+1,a
   06FA 40 38              1751 	jc	ep0outstall
   06FC 90 7E C0           1752 	mov	dptr,#OUT0BUF
   06FF 85*07 84           1753 	mov	dpl1,ctrladdr
   0702 85*08 85           1754 	mov	dph1,ctrladdr+1
   0705 E0                 1755 1$:	movx	a,@dptr
   0706 A3                 1756 	inc	dptr
   0707 05 86              1757 	inc	dps
   0709 F0                 1758 	movx	@dptr,a
   070A A3                 1759 	inc	dptr
   070B 15 86              1760 	dec	dps
   070D DF F6              1761 	djnz	r7,1$
   070F 85 84*07           1762 	mov	ctrladdr,dpl1
   0712 85 85*08           1763 	mov	ctrladdr+1,dph1
   0715 E5*09              1764 0$:	mov	a,ctrllen
   0717 45*0A              1765 	orl	a,ctrllen+1
   0719 60 20              1766 	jz	ep0outack
   071B 80 27              1767 	sjmp	ep0outendisr
                           1768 
                           1769 	;; write I2C eeprom
   071D B4 02 14           1770 i2cwr:	cjne	a,#0x02,ep0outstall
   0720 90 7F C5           1771 	mov	dptr,#OUT0BC
   0723 E0                 1772 	movx	a,@dptr
   0724 60 15              1773 	jz	ep0outack
   0726 FF                 1774 	mov	r7,a
   0727 85*07 F0           1775 	mov	b,ctrladdr
   072A 90 7E C0           1776 	mov	dptr,#OUT0BUF
   072D 12s00r35           1777 	lcall	writei2c
   0730 70 02              1778 	jnz	ep0outstall
   0732 80 07              1779 	sjmp	ep0outack
                           1780 
   0734                    1781 ep0outstall:
   0734 75*06 00           1782 	mov	ctrlcode,#0
   0737 74 03              1783 	mov	a,#3
   0739 80 05              1784 	sjmp	ep0outcs
   073B                    1785 ep0outack:
   073B 75*06 00           1786 	mov	ctrlcode,#0
   073E 74 02              1787 	mov	a,#2
   0740                    1788 ep0outcs:
   0740 90 7F B4           1789 	mov	dptr,#EP0CS
   0743 F0                 1790 	movx	@dptr,a
   0744                    1791 ep0outendisr:
                           1792 	;; epilogue
   0744 D0 06              1793 	pop	ar6
   0746 D0 00              1794 	pop	ar0
   0748 D0 86              1795 	pop	dps
   074A D0 D0              1796 	pop	psw
   074C D0 85              1797 	pop	dph1
   074E D0 84              1798 	pop	dpl1
   0750 D0 83              1799 	pop	dph0
   0752 D0 82              1800 	pop	dpl0
   0754 D0 F0              1801 	pop	b
   0756 D0 E0              1802 	pop	acc
   0758 32                 1803 	reti
                           1804 
   0759                    1805 fillusbintr::
   0759 90 7E 80           1806 	mov	dptr,#IN1BUF
   075C E5*00              1807 	mov	a,errcode
   075E F0                 1808 	movx	@dptr,a
   075F A3                 1809 	inc	dptr
   0760 E5*01              1810 	mov	a,errval
   0762 F0                 1811 	movx	@dptr,a
   0763 A3                 1812 	inc	dptr
   0764 E5*02              1813 	mov	a,cfgcount
   0766 F0                 1814 	movx	@dptr,a
   0767 A3                 1815 	inc	dptr
   0768 E5*03              1816 	mov	a,cfgcount+1
   076A F0                 1817 	movx	@dptr,a
   076B A3                 1818 	inc	dptr
   076C E5*05              1819 	mov	a,irqcount
   076E F0                 1820 	movx	@dptr,a
   076F 90 7F B7           1821 	mov	dptr,#IN1BC
   0772 74 05              1822 	mov	a,#5
   0774 F0                 1823 	movx	@dptr,a
   0775 05*05              1824 	inc	irqcount
   0777 22                 1825 	ret
                           1826 
   0778                    1827 usb_ep1in_isr:
   0778 C0 E0              1828 	push	acc
   077A C0 F0              1829 	push	b
   077C C0 82              1830 	push	dpl0
   077E C0 83              1831 	push	dph0
   0780 C0 D0              1832 	push	psw
   0782 75 D0 00           1833 	mov	psw,#0x00
   0785 C0 86              1834 	push	dps
   0787 75 86 00           1835 	mov	dps,#0
                           1836 	;; clear interrupt
   078A E5 91              1837 	mov	a,exif
   078C C2 E4              1838 	clr	acc.4
   078E F5 91              1839 	mov	exif,a
   0790 90 7F A9           1840 	mov	dptr,#IN07IRQ
   0793 74 02              1841 	mov	a,#0x02
   0795 F0                 1842 	movx	@dptr,a
                           1843 	;; handle interrupt
   0796 12s07r59           1844 	lcall	fillusbintr
                           1845 	;; epilogue
   0799 D0 86              1846 	pop	dps
   079B D0 D0              1847 	pop	psw
   079D D0 83              1848 	pop	dph0
   079F D0 82              1849 	pop	dpl0
   07A1 D0 F0              1850 	pop	b
   07A3 D0 E0              1851 	pop	acc
   07A5 32                 1852 	reti
                           1853 
   07A6                    1854 usb_ep1out_isr:
   07A6 C0 E0              1855 	push	acc
   07A8 C0 F0              1856 	push	b
   07AA C0 82              1857 	push	dpl0
   07AC C0 83              1858 	push	dph0
   07AE C0 D0              1859 	push	psw
   07B0 75 D0 00           1860 	mov	psw,#0x00
   07B3 C0 86              1861 	push	dps
   07B5 75 86 00           1862 	mov	dps,#0
                           1863 	;; clear interrupt
   07B8 E5 91              1864 	mov	a,exif
   07BA C2 E4              1865 	clr	acc.4
   07BC F5 91              1866 	mov	exif,a
   07BE 90 7F AA           1867 	mov	dptr,#OUT07IRQ
   07C1 74 02              1868 	mov	a,#0x02
   07C3 F0                 1869 	movx	@dptr,a
                           1870 	;; handle interrupt
                           1871 	;; epilogue
   07C4 D0 86              1872 	pop	dps
   07C6 D0 D0              1873 	pop	psw
   07C8 D0 83              1874 	pop	dph0
   07CA D0 82              1875 	pop	dpl0
   07CC D0 F0              1876 	pop	b
   07CE D0 E0              1877 	pop	acc
   07D0 32                 1878 	reti
                           1879 
   07D1                    1880 usb_ep2in_isr:
   07D1 C0 E0              1881 	push	acc
   07D3 C0 F0              1882 	push	b
   07D5 C0 82              1883 	push	dpl0
   07D7 C0 83              1884 	push	dph0
   07D9 C0 D0              1885 	push	psw
   07DB 75 D0 00           1886 	mov	psw,#0x00
   07DE C0 86              1887 	push	dps
   07E0 75 86 00           1888 	mov	dps,#0
                           1889 	;; clear interrupt
   07E3 E5 91              1890 	mov	a,exif
   07E5 C2 E4              1891 	clr	acc.4
   07E7 F5 91              1892 	mov	exif,a
   07E9 90 7F A9           1893 	mov	dptr,#IN07IRQ
   07EC 74 04              1894 	mov	a,#0x04
   07EE F0                 1895 	movx	@dptr,a
                           1896 	;; handle interrupt
                           1897 	;; epilogue
   07EF D0 86              1898 	pop	dps
   07F1 D0 D0              1899 	pop	psw
   07F3 D0 83              1900 	pop	dph0
   07F5 D0 82              1901 	pop	dpl0
   07F7 D0 F0              1902 	pop	b
   07F9 D0 E0              1903 	pop	acc
   07FB 32                 1904 	reti
                           1905 
   07FC                    1906 usb_ep2out_isr:
   07FC C0 E0              1907 	push	acc
   07FE C0 F0              1908 	push	b
   0800 C0 82              1909 	push	dpl0
   0802 C0 83              1910 	push	dph0
   0804 C0 D0              1911 	push	psw
   0806 75 D0 00           1912 	mov	psw,#0x00
   0809 C0 86              1913 	push	dps
   080B 75 86 00           1914 	mov	dps,#0
                           1915 	;; clear interrupt
   080E E5 91              1916 	mov	a,exif
   0810 C2 E4              1917 	clr	acc.4
   0812 F5 91              1918 	mov	exif,a
   0814 90 7F AA           1919 	mov	dptr,#OUT07IRQ
   0817 74 04              1920 	mov	a,#0x04
   0819 F0                 1921 	movx	@dptr,a
                           1922 	;; handle interrupt
                           1923 	;; epilogue
   081A D0 86              1924 	pop	dps
   081C D0 D0              1925 	pop	psw
   081E D0 83              1926 	pop	dph0
   0820 D0 82              1927 	pop	dpl0
   0822 D0 F0              1928 	pop	b
   0824 D0 E0              1929 	pop	acc
   0826 32                 1930 	reti
                           1931 
   0827                    1932 usb_ep3in_isr:
   0827 C0 E0              1933 	push	acc
   0829 C0 F0              1934 	push	b
   082B C0 82              1935 	push	dpl0
   082D C0 83              1936 	push	dph0
   082F C0 D0              1937 	push	psw
   0831 75 D0 00           1938 	mov	psw,#0x00
   0834 C0 86              1939 	push	dps
   0836 75 86 00           1940 	mov	dps,#0
                           1941 	;; clear interrupt
   0839 E5 91              1942 	mov	a,exif
   083B C2 E4              1943 	clr	acc.4
   083D F5 91              1944 	mov	exif,a
   083F 90 7F A9           1945 	mov	dptr,#IN07IRQ
   0842 74 08              1946 	mov	a,#0x08
   0844 F0                 1947 	movx	@dptr,a
                           1948 	;; handle interrupt
                           1949 	;; epilogue
   0845 D0 86              1950 	pop	dps
   0847 D0 D0              1951 	pop	psw
   0849 D0 83              1952 	pop	dph0
   084B D0 82              1953 	pop	dpl0
   084D D0 F0              1954 	pop	b
   084F D0 E0              1955 	pop	acc
   0851 32                 1956 	reti
                           1957 
   0852                    1958 usb_ep3out_isr:
   0852 C0 E0              1959 	push	acc
   0854 C0 F0              1960 	push	b
   0856 C0 82              1961 	push	dpl0
   0858 C0 83              1962 	push	dph0
   085A C0 D0              1963 	push	psw
   085C 75 D0 00           1964 	mov	psw,#0x00
   085F C0 86              1965 	push	dps
   0861 75 86 00           1966 	mov	dps,#0
                           1967 	;; clear interrupt
   0864 E5 91              1968 	mov	a,exif
   0866 C2 E4              1969 	clr	acc.4
   0868 F5 91              1970 	mov	exif,a
   086A 90 7F AA           1971 	mov	dptr,#OUT07IRQ
   086D 74 08              1972 	mov	a,#0x08
   086F F0                 1973 	movx	@dptr,a
                           1974 	;; handle interrupt
                           1975 	;; epilogue
   0870 D0 86              1976 	pop	dps
   0872 D0 D0              1977 	pop	psw
   0874 D0 83              1978 	pop	dph0
   0876 D0 82              1979 	pop	dpl0
   0878 D0 F0              1980 	pop	b
   087A D0 E0              1981 	pop	acc
   087C 32                 1982 	reti
                           1983 
   087D                    1984 usb_ep4in_isr:
   087D C0 E0              1985 	push	acc
   087F C0 F0              1986 	push	b
   0881 C0 82              1987 	push	dpl0
   0883 C0 83              1988 	push	dph0
   0885 C0 D0              1989 	push	psw
   0887 75 D0 00           1990 	mov	psw,#0x00
   088A C0 86              1991 	push	dps
   088C 75 86 00           1992 	mov	dps,#0
                           1993 	;; clear interrupt
   088F E5 91              1994 	mov	a,exif
   0891 C2 E4              1995 	clr	acc.4
   0893 F5 91              1996 	mov	exif,a
   0895 90 7F A9           1997 	mov	dptr,#IN07IRQ
   0898 74 10              1998 	mov	a,#0x10
   089A F0                 1999 	movx	@dptr,a
                           2000 	;; handle interrupt
                           2001 	;; epilogue
   089B D0 86              2002 	pop	dps
   089D D0 D0              2003 	pop	psw
   089F D0 83              2004 	pop	dph0
   08A1 D0 82              2005 	pop	dpl0
   08A3 D0 F0              2006 	pop	b
   08A5 D0 E0              2007 	pop	acc
   08A7 32                 2008 	reti
                           2009 
   08A8                    2010 usb_ep4out_isr:
   08A8 C0 E0              2011 	push	acc
   08AA C0 F0              2012 	push	b
   08AC C0 82              2013 	push	dpl0
   08AE C0 83              2014 	push	dph0
   08B0 C0 D0              2015 	push	psw
   08B2 75 D0 00           2016 	mov	psw,#0x00
   08B5 C0 86              2017 	push	dps
   08B7 75 86 00           2018 	mov	dps,#0
                           2019 	;; clear interrupt
   08BA E5 91              2020 	mov	a,exif
   08BC C2 E4              2021 	clr	acc.4
   08BE F5 91              2022 	mov	exif,a
   08C0 90 7F AA           2023 	mov	dptr,#OUT07IRQ
   08C3 74 10              2024 	mov	a,#0x10
   08C5 F0                 2025 	movx	@dptr,a
                           2026 	;; handle interrupt
                           2027 	;; epilogue
   08C6 D0 86              2028 	pop	dps
   08C8 D0 D0              2029 	pop	psw
   08CA D0 83              2030 	pop	dph0
   08CC D0 82              2031 	pop	dpl0
   08CE D0 F0              2032 	pop	b
   08D0 D0 E0              2033 	pop	acc
   08D2 32                 2034 	reti
                           2035 
   08D3                    2036 usb_ep5in_isr:
   08D3 C0 E0              2037 	push	acc
   08D5 C0 F0              2038 	push	b
   08D7 C0 82              2039 	push	dpl0
   08D9 C0 83              2040 	push	dph0
   08DB C0 D0              2041 	push	psw
   08DD 75 D0 00           2042 	mov	psw,#0x00
   08E0 C0 86              2043 	push	dps
   08E2 75 86 00           2044 	mov	dps,#0
                           2045 	;; clear interrupt
   08E5 E5 91              2046 	mov	a,exif
   08E7 C2 E4              2047 	clr	acc.4
   08E9 F5 91              2048 	mov	exif,a
   08EB 90 7F A9           2049 	mov	dptr,#IN07IRQ
   08EE 74 20              2050 	mov	a,#0x20
   08F0 F0                 2051 	movx	@dptr,a
                           2052 	;; handle interrupt
                           2053 	;; epilogue
   08F1 D0 86              2054 	pop	dps
   08F3 D0 D0              2055 	pop	psw
   08F5 D0 83              2056 	pop	dph0
   08F7 D0 82              2057 	pop	dpl0
   08F9 D0 F0              2058 	pop	b
   08FB D0 E0              2059 	pop	acc
   08FD 32                 2060 	reti
                           2061 
   08FE                    2062 usb_ep5out_isr:
   08FE C0 E0              2063 	push	acc
   0900 C0 F0              2064 	push	b
   0902 C0 82              2065 	push	dpl0
   0904 C0 83              2066 	push	dph0
   0906 C0 D0              2067 	push	psw
   0908 75 D0 00           2068 	mov	psw,#0x00
   090B C0 86              2069 	push	dps
   090D 75 86 00           2070 	mov	dps,#0
                           2071 	;; clear interrupt
   0910 E5 91              2072 	mov	a,exif
   0912 C2 E4              2073 	clr	acc.4
   0914 F5 91              2074 	mov	exif,a
   0916 90 7F AA           2075 	mov	dptr,#OUT07IRQ
   0919 74 20              2076 	mov	a,#0x20
   091B F0                 2077 	movx	@dptr,a
                           2078 	;; handle interrupt
                           2079 	;; epilogue
   091C D0 86              2080 	pop	dps
   091E D0 D0              2081 	pop	psw
   0920 D0 83              2082 	pop	dph0
   0922 D0 82              2083 	pop	dpl0
   0924 D0 F0              2084 	pop	b
   0926 D0 E0              2085 	pop	acc
   0928 32                 2086 	reti
                           2087 
   0929                    2088 usb_ep6in_isr:
   0929 C0 E0              2089 	push	acc
   092B C0 F0              2090 	push	b
   092D C0 82              2091 	push	dpl0
   092F C0 83              2092 	push	dph0
   0931 C0 D0              2093 	push	psw
   0933 75 D0 00           2094 	mov	psw,#0x00
   0936 C0 86              2095 	push	dps
   0938 75 86 00           2096 	mov	dps,#0
                           2097 	;; clear interrupt
   093B E5 91              2098 	mov	a,exif
   093D C2 E4              2099 	clr	acc.4
   093F F5 91              2100 	mov	exif,a
   0941 90 7F A9           2101 	mov	dptr,#IN07IRQ
   0944 74 40              2102 	mov	a,#0x40
   0946 F0                 2103 	movx	@dptr,a
                           2104 	;; handle interrupt
                           2105 	;; epilogue
   0947 D0 86              2106 	pop	dps
   0949 D0 D0              2107 	pop	psw
   094B D0 83              2108 	pop	dph0
   094D D0 82              2109 	pop	dpl0
   094F D0 F0              2110 	pop	b
   0951 D0 E0              2111 	pop	acc
   0953 32                 2112 	reti
                           2113 
   0954                    2114 usb_ep6out_isr:
   0954 C0 E0              2115 	push	acc
   0956 C0 F0              2116 	push	b
   0958 C0 82              2117 	push	dpl0
   095A C0 83              2118 	push	dph0
   095C C0 D0              2119 	push	psw
   095E 75 D0 00           2120 	mov	psw,#0x00
   0961 C0 86              2121 	push	dps
   0963 75 86 00           2122 	mov	dps,#0
                           2123 	;; clear interrupt
   0966 E5 91              2124 	mov	a,exif
   0968 C2 E4              2125 	clr	acc.4
   096A F5 91              2126 	mov	exif,a
   096C 90 7F AA           2127 	mov	dptr,#OUT07IRQ
   096F 74 40              2128 	mov	a,#0x40
   0971 F0                 2129 	movx	@dptr,a
                           2130 	;; handle interrupt
                           2131 	;; epilogue
   0972 D0 86              2132 	pop	dps
   0974 D0 D0              2133 	pop	psw
   0976 D0 83              2134 	pop	dph0
   0978 D0 82              2135 	pop	dpl0
   097A D0 F0              2136 	pop	b
   097C D0 E0              2137 	pop	acc
   097E 32                 2138 	reti
                           2139 
   097F                    2140 usb_ep7in_isr:
   097F C0 E0              2141 	push	acc
   0981 C0 F0              2142 	push	b
   0983 C0 82              2143 	push	dpl0
   0985 C0 83              2144 	push	dph0
   0987 C0 D0              2145 	push	psw
   0989 75 D0 00           2146 	mov	psw,#0x00
   098C C0 86              2147 	push	dps
   098E 75 86 00           2148 	mov	dps,#0
                           2149 	;; clear interrupt
   0991 E5 91              2150 	mov	a,exif
   0993 C2 E4              2151 	clr	acc.4
   0995 F5 91              2152 	mov	exif,a
   0997 90 7F A9           2153 	mov	dptr,#IN07IRQ
   099A 74 80              2154 	mov	a,#0x80
   099C F0                 2155 	movx	@dptr,a
                           2156 	;; handle interrupt
                           2157 	;; epilogue
   099D D0 86              2158 	pop	dps
   099F D0 D0              2159 	pop	psw
   09A1 D0 83              2160 	pop	dph0
   09A3 D0 82              2161 	pop	dpl0
   09A5 D0 F0              2162 	pop	b
   09A7 D0 E0              2163 	pop	acc
   09A9 32                 2164 	reti
                           2165 
   09AA                    2166 usb_ep7out_isr:
   09AA C0 E0              2167 	push	acc
   09AC C0 F0              2168 	push	b
   09AE C0 82              2169 	push	dpl0
   09B0 C0 83              2170 	push	dph0
   09B2 C0 D0              2171 	push	psw
   09B4 75 D0 00           2172 	mov	psw,#0x00
   09B7 C0 86              2173 	push	dps
   09B9 75 86 00           2174 	mov	dps,#0
                           2175 	;; clear interrupt
   09BC E5 91              2176 	mov	a,exif
   09BE C2 E4              2177 	clr	acc.4
   09C0 F5 91              2178 	mov	exif,a
   09C2 90 7F AA           2179 	mov	dptr,#OUT07IRQ
   09C5 74 80              2180 	mov	a,#0x80
   09C7 F0                 2181 	movx	@dptr,a
                           2182 	;; handle interrupt
                           2183 	;; epilogue
   09C8 D0 86              2184 	pop	dps
   09CA D0 D0              2185 	pop	psw
   09CC D0 83              2186 	pop	dph0
   09CE D0 82              2187 	pop	dpl0
   09D0 D0 F0              2188 	pop	b
   09D2 D0 E0              2189 	pop	acc
   09D4 32                 2190 	reti
                           2191 	
                           2192 	;; -----------------------------------------------------
                           2193 	;; USB descriptors
                           2194 	;; -----------------------------------------------------
                           2195 
                           2196 	;; Device and/or Interface Class codes
                    0000   2197 	USB_CLASS_PER_INTERFACE         = 0
                    0001   2198 	USB_CLASS_AUDIO                 = 1
                    0002   2199 	USB_CLASS_COMM                  = 2
                    0003   2200 	USB_CLASS_HID                   = 3
                    0007   2201 	USB_CLASS_PRINTER               = 7
                    0008   2202 	USB_CLASS_MASS_STORAGE          = 8
                    0009   2203 	USB_CLASS_HUB                   = 9
                    00FF   2204 	USB_CLASS_VENDOR_SPEC           = 0xff
                           2205 
                           2206 	;; Descriptor types
                    0001   2207 	USB_DT_DEVICE                   = 0x01
                    0002   2208 	USB_DT_CONFIG                   = 0x02
                    0003   2209 	USB_DT_STRING                   = 0x03
                    0004   2210 	USB_DT_INTERFACE                = 0x04
                    0005   2211 	USB_DT_ENDPOINT                 = 0x05
                           2212 
                           2213 	;; Standard requests
                    0000   2214 	USB_REQ_GET_STATUS              = 0x00
                    0001   2215 	USB_REQ_CLEAR_FEATURE           = 0x01
                    0003   2216 	USB_REQ_SET_FEATURE             = 0x03
                    0005   2217 	USB_REQ_SET_ADDRESS             = 0x05
                    0006   2218 	USB_REQ_GET_DESCRIPTOR          = 0x06
                    0007   2219 	USB_REQ_SET_DESCRIPTOR          = 0x07
                    0008   2220 	USB_REQ_GET_CONFIGURATION       = 0x08
                    0009   2221 	USB_REQ_SET_CONFIGURATION       = 0x09
                    000A   2222 	USB_REQ_GET_INTERFACE           = 0x0A
                    000B   2223 	USB_REQ_SET_INTERFACE           = 0x0B
                    000C   2224 	USB_REQ_SYNCH_FRAME             = 0x0C
                           2225 
                           2226 	;; USB Request Type and Endpoint Directions
                    0000   2227 	USB_DIR_OUT                     = 0
                    0080   2228 	USB_DIR_IN                      = 0x80
                           2229 
                    0000   2230 	USB_TYPE_STANDARD               = (0x00 << 5)
                    0020   2231 	USB_TYPE_CLASS                  = (0x01 << 5)
                    0040   2232 	USB_TYPE_VENDOR                 = (0x02 << 5)
                    0060   2233 	USB_TYPE_RESERVED               = (0x03 << 5)
                           2234 
                    0000   2235 	USB_RECIP_DEVICE                = 0x00
                    0001   2236 	USB_RECIP_INTERFACE             = 0x01
                    0002   2237 	USB_RECIP_ENDPOINT              = 0x02
                    0003   2238 	USB_RECIP_OTHER                 = 0x03
                           2239 
                           2240 	;; Request target types.
                    0000   2241 	USB_RT_DEVICE                   = 0x00
                    0001   2242 	USB_RT_INTERFACE                = 0x01
                    0002   2243 	USB_RT_ENDPOINT                 = 0x02
                           2244 
                    BAC0   2245 	VENDID	= 0xbac0
                    6135   2246 	PRODID	= 0x6135
                           2247 
   09D5                    2248 devicedescr:
   09D5 12                 2249 	.db	18			; bLength
   09D6 01                 2250 	.db	USB_DT_DEVICE		; bDescriptorType
   09D7 00 01              2251 	.db	0x00, 0x01		; bcdUSB
   09D9 FF                 2252 	.db	USB_CLASS_VENDOR_SPEC	; bDeviceClass
   09DA 00                 2253 	.db	0			; bDeviceSubClass
   09DB FF                 2254 	.db	0xff			; bDeviceProtocol
   09DC 40                 2255 	.db	0x40			; bMaxPacketSize0
   09DD C0 BA              2256 	.db	<VENDID,>VENDID		; idVendor
   09DF 35 61              2257 	.db	<PRODID,>PRODID		; idProduct
   09E1 02 00              2258 	.db	0x02,0x00		; bcdDevice
   09E3 01                 2259 	.db	1			; iManufacturer
   09E4 02                 2260 	.db	2			; iProduct
   09E5 03                 2261 	.db	3			; iSerialNumber
   09E6 01                 2262 	.db	1			; bNumConfigurations
                           2263 
   09E7                    2264 config0descr:
   09E7 09                 2265 	.db	9			; bLength
   09E8 02                 2266 	.db	USB_DT_CONFIG		; bDescriptorType
   09E9 45 00              2267 	.db	<config0sz,>config0sz	; wTotalLength
   09EB 01                 2268 	.db	1			; bNumInterfaces
   09EC 01                 2269 	.db	1			; bConfigurationValue
   09ED 00                 2270 	.db	0			; iConfiguration
   09EE 40                 2271 	.db	0b01000000		; bmAttributs (self powered)
   09EF 00                 2272 	.db	0			; MaxPower (mA/2) (self powered so 0)
                           2273 	;; interface descriptor I0:A0
   09F0 09                 2274 	.db	9			; bLength
   09F1 04                 2275 	.db	USB_DT_INTERFACE	; bDescriptorType
   09F2 00                 2276 	.db	0			; bInterfaceNumber
   09F3 00                 2277 	.db	0			; bAlternateSetting
   09F4 03                 2278 	.db	3			; bNumEndpoints
   09F5 FF                 2279 	.db	0xff			; bInterfaceClass (vendor specific)
   09F6 00                 2280 	.db	0x00			; bInterfaceSubClass
   09F7 FF                 2281 	.db	0xff			; bInterfaceProtocol (vendor specific)
   09F8 00                 2282 	.db	0			; iInterface
                           2283 	;; endpoint descriptor I0:A0:E0
   09F9 07                 2284 	.db	7			; bLength
   09FA 05                 2285 	.db	USB_DT_ENDPOINT		; bDescriptorType
   09FB 81                 2286 	.db	(USB_DIR_IN | 1)	; bEndpointAddress
   09FC 02                 2287 	.db	0x02			; bmAttributes (bulk)
   09FD 40 00              2288 	.db	0x40,0x00		; wMaxPacketSize
   09FF 00                 2289 	.db	0			; bInterval
                           2290 	;; endpoint descriptor I0:A0:E1
   0A00 07                 2291 	.db	7			; bLength
   0A01 05                 2292 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0A02 82                 2293 	.db	(USB_DIR_IN | 2)	; bEndpointAddress
   0A03 02                 2294 	.db	0x02			; bmAttributes (bulk)
   0A04 40 00              2295 	.db	0x40,0x00		; wMaxPacketSize
   0A06 00                 2296 	.db	0			; bInterval
                           2297 	;; endpoint descriptor I0:A0:E2
   0A07 07                 2298 	.db	7			; bLength
   0A08 05                 2299 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0A09 02                 2300 	.db	(USB_DIR_OUT | 2)	; bEndpointAddress
   0A0A 02                 2301 	.db	0x02			; bmAttributes (bulk)
   0A0B 40 00              2302 	.db	0x40,0x00		; wMaxPacketSize
   0A0D 00                 2303 	.db	0			; bInterval
                           2304 	;; interface descriptor I0:A1
   0A0E 09                 2305 	.db	9			; bLength
   0A0F 04                 2306 	.db	USB_DT_INTERFACE	; bDescriptorType
   0A10 00                 2307 	.db	0			; bInterfaceNumber
   0A11 01                 2308 	.db	1			; bAlternateSetting
   0A12 03                 2309 	.db	3			; bNumEndpoints
   0A13 FF                 2310 	.db	0xff			; bInterfaceClass (vendor specific)
   0A14 00                 2311 	.db	0x00			; bInterfaceSubClass
   0A15 FF                 2312 	.db	0xff			; bInterfaceProtocol (vendor specific)
   0A16 00                 2313 	.db	0			; iInterface
                           2314 	;; endpoint descriptor I0:A1:E0
   0A17 07                 2315 	.db	7			; bLength
   0A18 05                 2316 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0A19 81                 2317 	.db	(USB_DIR_IN | 1)	; bEndpointAddress
   0A1A 03                 2318 	.db	0x03			; bmAttributes (interrupt)
   0A1B 40 00              2319 	.db	0x40,0x00		; wMaxPacketSize
   0A1D 0A                 2320 	.db	10			; bInterval
                           2321 	;; endpoint descriptor I0:A1:E1
   0A1E 07                 2322 	.db	7			; bLength
   0A1F 05                 2323 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0A20 82                 2324 	.db	(USB_DIR_IN | 2)	; bEndpointAddress
   0A21 02                 2325 	.db	0x02			; bmAttributes (bulk)
   0A22 40 00              2326 	.db	0x40,0x00		; wMaxPacketSize
   0A24 00                 2327 	.db	0			; bInterval
                           2328 	;; endpoint descriptor I0:A1:E2
   0A25 07                 2329 	.db	7			; bLength
   0A26 05                 2330 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0A27 02                 2331 	.db	(USB_DIR_OUT | 2)	; bEndpointAddress
   0A28 02                 2332 	.db	0x02			; bmAttributes (bulk)
   0A29 40 00              2333 	.db	0x40,0x00		; wMaxPacketSize
   0A2B 00                 2334 	.db	0			; bInterval
                           2335 
                    0045   2336 config0sz = . - config0descr
                           2337 
   0A2C                    2338 stringdescr:
   0A2Cr34s0A              2339 	.db	<string0,>string0
   0A2Er38s0A              2340 	.db	<string1,>string1
   0A30r46s0A              2341 	.db	<string2,>string2
   0A32r66s0A              2342 	.db	<stringserial,>stringserial
                           2343 
                    0004   2344 numstrings = (. - stringdescr)/2
                           2345 
   0A34                    2346 string0:
   0A34 04                 2347 	.db	string0sz		; bLength
   0A35 03                 2348 	.db	USB_DT_STRING		; bDescriptorType
   0A36 00 00              2349 	.db	0,0			; LANGID[0]: Lang Neutral
                    0004   2350 string0sz = . - string0
                           2351 
   0A38                    2352 string1:
   0A38 0E                 2353 	.db	string1sz		; bLength
   0A39 03                 2354 	.db	USB_DT_STRING		; bDescriptorType
   0A3A 42 00 61 00 79 00  2355 	.db	'B,0,'a,0,'y,0,'c,0,'o,0,'m,0
        63 00 6F 00 6D 00
                    000E   2356 string1sz = . - string1
                           2357 
   0A46                    2358 string2:
   0A46 20                 2359 	.db	string2sz		; bLength
   0A47 03                 2360 	.db	USB_DT_STRING		; bDescriptorType
   0A48 55 00 53 00 42 00  2361 	.db	'U,0,'S,0,'B,0,'F,0,'L,0,'E,0,'X,0,' ,0
        46 00 4C 00 45 00
        58 00 20 00
   0A58 28 00 62 00 6C 00  2362 	.db	'(,0,'b,0,'l,0,'a,0,'n,0,'k,0,'),0
        61 00 6E 00 6B 00
        29 00
                    0020   2363 string2sz = . - string2
                           2364 
   0A66                    2365 stringserial:
   0A66 02                 2366 	.db	2			; bLength
   0A67 03                 2367 	.db	USB_DT_STRING		; bDescriptorType
   0A68 00 00 00 00 00 00  2368 	.dw	0,0,0,0,0,0,0,0
        00 00 00 00 00 00
        00 00 00 00
   0A78 00 00 00 00 00 00  2369 	.dw	0,0,0,0,0,0,0,0
        00 00 00 00 00 00
        00 00 00 00
                           2370 
