                              1 	.module main
                              2 
                              3 	;; ENDPOINTS
                              4 	;; EP0 in/out   Control
                              5 	;; EP1 in       Interrupt:  Status
                              6 	;;              Byte 0: Modem Status
                              7 	;;                Bit 0-1: Transmitter status
                              8 	;;                         0: idle (off)
                              9 	;;                         1: keyup
                             10 	;;                         2: transmitting packets
                             11 	;;                         3: tail
                             12 	;;                Bit 2:   PTT status (1=on)
                             13 	;;                Bit 3:   DCD
                             14 	;;                Bit 4:   RXB (Rx Packet Ready)
                             15 	;;                Bit 5:   UART transmitter empty
                             16 	;;                Bit 6-7: unused
                             17 	;;              Byte 1: Number of empty 64 byte chunks in TX fifo
                             18 	;;              Byte 2: Number of full 64 byte chunks in RX fifo
                             19 	;;              Byte 3: RSSI value
                             20 	;;              Byte 4:	IRQ count
                             21 	;;              Byte 5-20: (as needed) UART receiver chars
                             22 	;; EP2 out      Packets to be transmitted
                             23 	;; EP2 in       Received packets; note they have the CRC appended
                             24 
                             25 	;; COMMAND LIST
                             26 	;; C0 C0  read status (max. 23 bytes, first 6 same as EP1 in)
                             27 	;; C0 C8  read mode
                             28 	;;          Return:
                             29 	;;            Byte 0: 3 (MODE_AFSK)
                             30 	;; C0 C9  return serial number string
                             31 	;; C0 D0  get/set PTT/DCD/RSSI
                             32 	;;          wIndex = 1:	 set forced ptt to wValue
                             33 	;;          Return:
                             34 	;;            Byte 0: PTT status
                             35 	;;            Byte 1: DCD status
                             36 	;;            Byte 2: RSSI status
                             37 	;; C0 D1  get Bitrate
                             38 	;;          Return:
                             39 	;;            Byte 0-2: TX Bitrate
                             40 	;;            Byte 3-5: RX Bitrate
                             41 	;; 40 D2  set CON/STA led
                             42 	;;          Bits 0-1 of wValue
                             43 	;; 40 D3  send byte to UART
                             44 	;;          Byte in wValue
                             45 	;; C0 D4  get/set modem disconnect port (only if internal modem used, stalls otherwise)
                             46 	;;          wIndex = 1:	 write wValue to output register
                             47 	;;          wIndex = 2:	 write wValue to tristate mask register (1 = input, 0 = output)
                             48 	;;          Return:
                             49 	;;            Byte 0: Modem Disconnect Input
                             50 	;;            Byte 1: Modem Disconnect Output register
                             51 	;;            Byte 2: Modem Disconnect Tristate register
                             52 	;; C0 D5  get/set T7F port
                             53 	;;          wIndex = 1:	 write wValue to T7F output register
                             54 	;;          Return:
                             55 	;;            Byte 0: T7F Input
                             56 	;;            Byte 1: T7F Output register
                             57 
                             58 	;; define code segments link order
                             59 	.area CODE (CODE)
                             60 	.area CSEG (CODE)
                             61 	.area GSINIT (CODE)
                             62 	.area GSINIT2 (CODE)
                             63 
                             64 	;; -----------------------------------------------------
                             65 
                             66 	;; special function registers (which are not predefined)
                    0082     67 	dpl0    = 0x82
                    0083     68 	dph0    = 0x83
                    0084     69 	dpl1    = 0x84
                    0085     70 	dph1    = 0x85
                    0086     71 	dps     = 0x86
                    008E     72 	ckcon   = 0x8E
                    008F     73 	spc_fnc = 0x8F
                    0091     74 	exif    = 0x91
                    0092     75 	mpage   = 0x92
                    0098     76 	scon0   = 0x98
                    0099     77 	sbuf0   = 0x99
                    00C0     78 	scon1   = 0xC0
                    00C1     79 	sbuf1   = 0xC1
                    00D8     80 	eicon   = 0xD8
                    00E8     81 	eie     = 0xE8
                    00F8     82 	eip     = 0xF8
                             83 
                             84 	;; anchor xdata registers
                    7F00     85 	IN0BUF		= 0x7F00
                    7EC0     86 	OUT0BUF		= 0x7EC0
                    7E80     87 	IN1BUF		= 0x7E80
                    7E40     88 	OUT1BUF		= 0x7E40
                    7E00     89 	IN2BUF		= 0x7E00
                    7DC0     90 	OUT2BUF		= 0x7DC0
                    7D80     91 	IN3BUF		= 0x7D80
                    7D40     92 	OUT3BUF		= 0x7D40
                    7D00     93 	IN4BUF		= 0x7D00
                    7CC0     94 	OUT4BUF		= 0x7CC0
                    7C80     95 	IN5BUF		= 0x7C80
                    7C40     96 	OUT5BUF		= 0x7C40
                    7C00     97 	IN6BUF		= 0x7C00
                    7BC0     98 	OUT6BUF		= 0x7BC0
                    7B80     99 	IN7BUF		= 0x7B80
                    7B40    100 	OUT7BUF		= 0x7B40
                    7FE8    101 	SETUPBUF	= 0x7FE8
                    7FE8    102 	SETUPDAT	= 0x7FE8
                            103 
                    7FB4    104 	EP0CS		= 0x7FB4
                    7FB5    105 	IN0BC		= 0x7FB5
                    7FB6    106 	IN1CS		= 0x7FB6
                    7FB7    107 	IN1BC		= 0x7FB7
                    7FB8    108 	IN2CS		= 0x7FB8
                    7FB9    109 	IN2BC		= 0x7FB9
                    7FBA    110 	IN3CS		= 0x7FBA
                    7FBB    111 	IN3BC		= 0x7FBB
                    7FBC    112 	IN4CS		= 0x7FBC
                    7FBD    113 	IN4BC		= 0x7FBD
                    7FBE    114 	IN5CS		= 0x7FBE
                    7FBF    115 	IN5BC		= 0x7FBF
                    7FC0    116 	IN6CS		= 0x7FC0
                    7FC1    117 	IN6BC		= 0x7FC1
                    7FC2    118 	IN7CS		= 0x7FC2
                    7FC3    119 	IN7BC		= 0x7FC3
                    7FC5    120 	OUT0BC		= 0x7FC5
                    7FC6    121 	OUT1CS		= 0x7FC6
                    7FC7    122 	OUT1BC		= 0x7FC7
                    7FC8    123 	OUT2CS		= 0x7FC8
                    7FC9    124 	OUT2BC		= 0x7FC9
                    7FCA    125 	OUT3CS		= 0x7FCA
                    7FCB    126 	OUT3BC		= 0x7FCB
                    7FCC    127 	OUT4CS		= 0x7FCC
                    7FCD    128 	OUT4BC		= 0x7FCD
                    7FCE    129 	OUT5CS		= 0x7FCE
                    7FCF    130 	OUT5BC		= 0x7FCF
                    7FD0    131 	OUT6CS		= 0x7FD0
                    7FD1    132 	OUT6BC		= 0x7FD1
                    7FD2    133 	OUT7CS		= 0x7FD2
                    7FD3    134 	OUT7BC		= 0x7FD3
                            135 
                    7FA8    136 	IVEC		= 0x7FA8
                    7FA9    137 	IN07IRQ		= 0x7FA9
                    7FAA    138 	OUT07IRQ	= 0x7FAA
                    7FAB    139 	USBIRQ		= 0x7FAB
                    7FAC    140 	IN07IEN		= 0x7FAC
                    7FAD    141 	OUT07IEN	= 0x7FAD
                    7FAE    142 	USBIEN		= 0x7FAE
                    7FAF    143 	USBBAV		= 0x7FAF
                    7FB2    144 	BPADDRH		= 0x7FB2
                    7FB3    145 	BPADDRL		= 0x7FB3
                            146 
                    7FD4    147 	SUDPTRH		= 0x7FD4
                    7FD5    148 	SUDPTRL		= 0x7FD5
                    7FD6    149 	USBCS		= 0x7FD6
                    7FD7    150 	TOGCTL		= 0x7FD7
                    7FD8    151 	USBFRAMEL	= 0x7FD8
                    7FD9    152 	USBFRAMEH	= 0x7FD9
                    7FDB    153 	FNADDR		= 0x7FDB
                    7FDD    154 	USBPAIR		= 0x7FDD
                    7FDE    155 	IN07VAL		= 0x7FDE
                    7FDF    156 	OUT07VAL	= 0x7FDF
                    7FE3    157 	AUTOPTRH	= 0x7FE3
                    7FE4    158 	AUTOPTRL	= 0x7FE4
                    7FE5    159 	AUTODATA	= 0x7FE5
                            160 
                            161 	;; isochronous endpoints. only available if ISODISAB=0
                            162 
                    7F60    163 	OUT8DATA	= 0x7F60
                    7F61    164 	OUT9DATA	= 0x7F61
                    7F62    165 	OUT10DATA	= 0x7F62
                    7F63    166 	OUT11DATA	= 0x7F63
                    7F64    167 	OUT12DATA	= 0x7F64
                    7F65    168 	OUT13DATA	= 0x7F65
                    7F66    169 	OUT14DATA	= 0x7F66
                    7F67    170 	OUT15DATA	= 0x7F67
                            171 
                    7F68    172 	IN8DATA		= 0x7F68
                    7F69    173 	IN9DATA		= 0x7F69
                    7F6A    174 	IN10DATA	= 0x7F6A
                    7F6B    175 	IN11DATA	= 0x7F6B
                    7F6C    176 	IN12DATA	= 0x7F6C
                    7F6D    177 	IN13DATA	= 0x7F6D
                    7F6E    178 	IN14DATA	= 0x7F6E
                    7F6F    179 	IN15DATA	= 0x7F6F
                            180 
                    7F70    181 	OUT8BCH		= 0x7F70
                    7F71    182 	OUT8BCL		= 0x7F71
                    7F72    183 	OUT9BCH		= 0x7F72
                    7F73    184 	OUT9BCL		= 0x7F73
                    7F74    185 	OUT10BCH	= 0x7F74
                    7F75    186 	OUT10BCL	= 0x7F75
                    7F76    187 	OUT11BCH	= 0x7F76
                    7F77    188 	OUT11BCL	= 0x7F77
                    7F78    189 	OUT12BCH	= 0x7F78
                    7F79    190 	OUT12BCL	= 0x7F79
                    7F7A    191 	OUT13BCH	= 0x7F7A
                    7F7B    192 	OUT13BCL	= 0x7F7B
                    7F7C    193 	OUT14BCH	= 0x7F7C
                    7F7D    194 	OUT14BCL	= 0x7F7D
                    7F7E    195 	OUT15BCH	= 0x7F7E
                    7F7F    196 	OUT15BCL	= 0x7F7F
                            197 
                    7FF0    198 	OUT8ADDR	= 0x7FF0
                    7FF1    199 	OUT9ADDR	= 0x7FF1
                    7FF2    200 	OUT10ADDR	= 0x7FF2
                    7FF3    201 	OUT11ADDR	= 0x7FF3
                    7FF4    202 	OUT12ADDR	= 0x7FF4
                    7FF5    203 	OUT13ADDR	= 0x7FF5
                    7FF6    204 	OUT14ADDR	= 0x7FF6
                    7FF7    205 	OUT15ADDR	= 0x7FF7
                    7FF8    206 	IN8ADDR		= 0x7FF8
                    7FF9    207 	IN9ADDR		= 0x7FF9
                    7FFA    208 	IN10ADDR	= 0x7FFA
                    7FFB    209 	IN11ADDR	= 0x7FFB
                    7FFC    210 	IN12ADDR	= 0x7FFC
                    7FFD    211 	IN13ADDR	= 0x7FFD
                    7FFE    212 	IN14ADDR	= 0x7FFE
                    7FFF    213 	IN15ADDR	= 0x7FFF
                            214 
                    7FA0    215 	ISOERR		= 0x7FA0
                    7FA1    216 	ISOCTL		= 0x7FA1
                    7FA2    217 	ZBCOUNT		= 0x7FA2
                    7FE0    218 	INISOVAL	= 0x7FE0
                    7FE1    219 	OUTISOVAL	= 0x7FE1
                    7FE2    220 	FASTXFR		= 0x7FE2
                            221 
                            222 	;; CPU control registers
                            223 
                    7F92    224 	CPUCS		= 0x7F92
                            225 
                            226 	;; IO port control registers
                            227 
                    7F93    228 	PORTACFG	= 0x7F93
                    7F94    229 	PORTBCFG	= 0x7F94
                    7F95    230 	PORTCCFG	= 0x7F95
                    7F96    231 	OUTA		= 0x7F96
                    7F97    232 	OUTB		= 0x7F97
                    7F98    233 	OUTC		= 0x7F98
                    7F99    234 	PINSA		= 0x7F99
                    7F9A    235 	PINSB		= 0x7F9A
                    7F9B    236 	PINSC		= 0x7F9B
                    7F9C    237 	OEA		= 0x7F9C
                    7F9D    238 	OEB		= 0x7F9D
                    7F9E    239 	OEC		= 0x7F9E
                            240 
                            241 	;; I2C controller registers
                            242 
                    7FA5    243 	I2CS		= 0x7FA5
                    7FA6    244 	I2DAT		= 0x7FA6
                            245 
                            246 	;; Xilinx FPGA registers
                    C000    247 	FSKSHREG	= 0xc000
                    C001    248 	FSKSHSTATUS	= 0xc001
                    C004    249 	FSKRSSI		= 0xc004
                    C008    250 	FSKCTRL		= 0xc008
                    C009    251 	FSKSTAT		= 0xc009
                    C00A    252 	FSKT7FOUT	= 0xc00a
                    C00B    253 	FSKT7FIN	= 0xc00b
                    C00C    254 	FSKMDISCTRIS	= 0xc00c
                    C00D    255 	FSKMDISCOUT	= 0xc00d
                    C00E    256 	FSKMDISCIN	= 0xc00e
                            257 
                            258 	;; -----------------------------------------------------
                            259 
                            260 	.area CODE (CODE)
   0000 02s00r00            261 	ljmp	startup
   0003 02s02rE4            262 	ljmp	int0_isr
   0006                     263 	.ds	5
   000B 02s03r05            264 	ljmp	timer0_isr
   000E                     265 	.ds	5
   0013 02s03r26            266 	ljmp	int1_isr
   0016                     267 	.ds	5
   001B 02s03r47            268 	ljmp	timer1_isr
   001E                     269 	.ds	5
   0023 02s03r68            270 	ljmp	ser0_isr
   0026                     271 	.ds	5
   002B 02s03rA6            272 	ljmp	timer2_isr
   002E                     273 	.ds	5
   0033 02s03rC7            274 	ljmp	resume_isr
   0036                     275 	.ds	5
   003B 02s03rE8            276 	ljmp	ser1_isr
   003E                     277 	.ds	5
   0043 02s01r00            278 	ljmp	usb_isr
   0046                     279 	.ds	5
   004B 02s04r0B            280 	ljmp	i2c_isr
   004E                     281 	.ds	5
   0053 02s04r30            282 	ljmp	int4_isr
   0056                     283 	.ds	5
   005B 02s04r55            284 	ljmp	int5_isr
   005E                     285 	.ds	5
   0063 02s04r7A            286 	ljmp	int6_isr
                            287 
                            288 	;; Parameter block at 0xe0
   0066                     289 	.ds	0x7a
   00E0 B0 04 00            290 parbitratetx:	.db	<1200,>1200,0
   00E3 B0 04 00            291 parbitraterx:	.db	<1200,>1200,0
   00E6 00                  292 parextmodem:	.db	0
   00E7 01                  293 parpttmute:	.db	1
                            294 
                            295 	;; Serial# string at 0xf0
   00E8                     296 	.ds	8
   00F0                     297 parserial:
   00F0 30 30 30 30 30 30   298 	.db	'0,'0,'0,'0,'0,'0,'0,'0,0
        30 30 00
   00F9                     299 	.ds	7
                            300 
                            301 	;; USB interrupt dispatch table
   0100                     302 usb_isr:
   0100 02s04r9B            303 	ljmp	usb_sudav_isr
   0103                     304 	.ds	1
   0104 02s08rAD            305 	ljmp	usb_sof_isr
   0107                     306 	.ds	1
   0108 02s08rD8            307 	ljmp	usb_sutok_isr
   010B                     308 	.ds	1
   010C 02s09r03            309 	ljmp	usb_suspend_isr
   010F                     310 	.ds	1
   0110 02s09r2E            311 	ljmp	usb_usbreset_isr
   0113                     312 	.ds	1
   0114 32                  313 	reti
   0115                     314 	.ds	3
   0118 02s09r59            315 	ljmp	usb_ep0in_isr
   011B                     316 	.ds	1
   011C 02s09r94            317 	ljmp	usb_ep0out_isr
   011F                     318 	.ds	1
   0120 02s0Ar46            319 	ljmp	usb_ep1in_isr
   0123                     320 	.ds	1
   0124 02s0Ar74            321 	ljmp	usb_ep1out_isr
   0127                     322 	.ds	1
   0128 02s0Ar9F            323 	ljmp	usb_ep2in_isr
   012B                     324 	.ds	1
   012C 02s0ArCA            325 	ljmp	usb_ep2out_isr
   012F                     326 	.ds	1
   0130 02s0ArF5            327 	ljmp	usb_ep3in_isr
   0133                     328 	.ds	1
   0134 02s0Br20            329 	ljmp	usb_ep3out_isr
   0137                     330 	.ds	1
   0138 02s0Br4B            331 	ljmp	usb_ep4in_isr
   013B                     332 	.ds	1
   013C 02s0Br76            333 	ljmp	usb_ep4out_isr
   013F                     334 	.ds	1
   0140 02s0BrA1            335 	ljmp	usb_ep5in_isr
   0143                     336 	.ds	1
   0144 02s0BrCC            337 	ljmp	usb_ep5out_isr
   0147                     338 	.ds	1
   0148 02s0BrF7            339 	ljmp	usb_ep6in_isr
   014B                     340 	.ds	1
   014C 02s0Cr22            341 	ljmp	usb_ep6out_isr
   014F                     342 	.ds	1
   0150 02s0Cr4D            343 	ljmp	usb_ep7in_isr
   0153                     344 	.ds	1
   0154 02s0Cr78            345 	ljmp	usb_ep7out_isr
                            346 
                            347 	;; -----------------------------------------------------
                            348 
                    0020    349 	RXCHUNKS = 32
                    0010    350 	TXCHUNKS = 16
                            351 
                            352 	.area	OSEG (OVR,DATA)
                            353 	.area	BSEG (BIT)
   0000                     354 ctrl_ptt:	.ds	1
   0001                     355 ctrl_pttmute:	.ds	1
   0002                     356 ctrl_ledptt:	.ds	1
   0003                     357 ctrl_leddcdsrc:	.ds	1	; not implemented
   0004                     358 ctrl_clksel:	.ds	1	; not implemented
   0005                     359 ctrl_indacd:	.ds	1	; not implemented
   0006                     360 ctrl_indacz:	.ds	1	; not implemented
   0007                     361 ctrl_txdsrc:	.ds	1	; not implemented
                    0020    362 ctrlreg		=	0x20	; ((ctrl_ptt/8)+0x20)
                            363 
   0008                     364 pttmute:	.ds	1
   0009                     365 pttforcechg:	.ds	1
   000A                     366 uartempty:	.ds	1
                            367 
                            368 	.area	ISEG (DATA)
   0000                     369 txbcnt:		.ds	TXCHUNKS
   0010                     370 rxbcnt:		.ds	RXCHUNKS
   0030                     371 stack:		.ds	0x80-RXCHUNKS-TXCHUNKS
                            372 
                            373 	.area	DSEG (DATA)
   0000                     374 ctrlcode:	.ds	1
   0001                     375 ctrlcount:	.ds	2
   0003                     376 leddiv:		.ds	1
   0004                     377 irqcount:	.ds	1
                            378 	;; transmitter variables
   0005                     379 txstate:	.ds	1
   0006                     380 flagcnt:	.ds	2
   0008                     381 txwr:		.ds	1
   0009                     382 txrd:		.ds	1
   000A                     383 txtwr:		.ds	1
   000B                     384 txcrc:		.ds	2
   000D                     385 txshreg:	.ds	1
   000E                     386 txbnum:		.ds	1
   000F                     387 txptr:		.ds	1
   0010                     388 txskip:		.ds	1
   0011                     389 pttforce:	.ds	1
                            390 	;; receiver variables
   0012                     391 rxstate:	.ds	1
   0013                     392 rxwr:		.ds	1
   0014                     393 rxrd:		.ds	1
   0015                     394 rxtwr:		.ds	1
   0016                     395 rxcntc:		.ds	1
   0017                     396 rxcrc:		.ds	2
   0019                     397 rxshreg:	.ds	1
   001A                     398 rxbreg:		.ds	1
   001B                     399 rxbnum:		.ds	1
   001C                     400 rxptr:		.ds	1
                            401 
   001D                     402 tmprxcnt:	.ds	1
                            403 
                            404 	;; UART receiver
   001E                     405 uartbuf:	.ds	16
   002E                     406 uartwr:		.ds	1
   002F                     407 uartrd:		.ds	1
                            408 
                            409 	;; USB state
   0030                     410 numconfig:	.ds	1
   0031                     411 altsetting:	.ds	1
                            412 	
                            413 	.area	XSEG (DATA)
   0000                     414 txbuf:	.ds	TXCHUNKS*64
   0400                     415 rxbuf:	.ds	RXCHUNKS*64
                            416 
                            417 
                            418 	.area	GSINIT (CODE)
   0000                     419 startup:
   0000 75 81r30            420 	mov	sp,#stack	; -1
   0003 E4                  421 	clr	a
   0004 F5 D0               422 	mov	psw,a
   0006 F5 86               423 	mov	dps,a
                            424 	;lcall	__sdcc_external_startup
                            425 	;mov	a,dpl0
                            426 	;jz	__sdcc_init_data
                            427 	;ljmp	__sdcc_program_startup
   0008                     428 __sdcc_init_data:
                            429 
                            430 	.area	GSINIT2 (CODE)
   0000                     431 __sdcc_program_startup:
                            432 	;; assembler code startup
   0000 E4                  433 	clr	a
   0001 F5*05               434 	mov	txstate,a
   0003 F5*08               435 	mov	txwr,a
   0005 F5*09               436 	mov	txrd,a
   0007 F5*0A               437 	mov	txtwr,a
   0009 F5*11               438 	mov	pttforce,a
   000B F5*12               439 	mov	rxstate,a
   000D F5*13               440 	mov	rxwr,a
   000F F5*14               441 	mov	rxrd,a
   0011 F5*15               442 	mov	rxtwr,a
   0013 F5*04               443  	mov	irqcount,a
   0015 F5*2F               444 	mov	uartrd,a
   0017 F5*2E               445 	mov	uartwr,a
   0019 F5 86               446 	mov	dps,a
   001B D2*0A               447 	setb	uartempty
                            448 	;; some indirect register setup
   001D 75 8E 30            449 	mov	ckcon,#0x30	; zero external wait states, to avoid chip bugs
                            450 	;; Timer setup:
                            451 	;; timer 0: LED blink    : T0M=0, CT0=0, MODE0=1
                            452 	;; timer 1: Baudrate gen : T1M=1, CT1=0, MODE1=2
   0020 75 89 21            453 	mov	tmod,#0x21
   0023 75 88 55            454 	mov	tcon,#0x55	; INT0/INT1 edge
   0026 75 8D 64            455 	mov	th1,#256-156	; 1200 bauds
   0029 75 87 00            456 	mov	pcon,#0		; SMOD0=0
                            457 	;; init USB subsystem
   002C 90 7F A1            458 	mov	dptr,#ISOCTL
   002F 74 01               459 	mov	a,#1		; disable ISO endpoints
   0031 F0                  460 	movx	@dptr,a
   0032 90 7F AF            461 	mov	dptr,#USBBAV
   0035 74 01               462 	mov	a,#1		; enable autovector, disable breakpoint logic
   0037 F0                  463 	movx	@dptr,a
   0038 E4                  464 	clr	a
   0039 90 7F E0            465 	mov	dptr,#INISOVAL
   003C F0                  466 	movx	@dptr,a
   003D 90 7F E1            467 	mov	dptr,#OUTISOVAL
   0040 F0                  468 	movx	@dptr,a
   0041 90 7F DD            469 	mov	dptr,#USBPAIR
   0044 74 09               470 	mov	a,#0x9		; pair EP 2&3 for input & output
   0046 F0                  471 	movx	@dptr,a
   0047 90 7F DE            472 	mov	dptr,#IN07VAL
   004A 74 07               473 	mov	a,#0x7		; enable EP0+EP1+EP2
   004C F0                  474 	movx	@dptr,a
   004D 90 7F DF            475 	mov	dptr,#OUT07VAL
   0050 74 05               476 	mov	a,#0x5		; enable EP0+EP2
   0052 F0                  477 	movx	@dptr,a
                            478 	;; USB:	init endpoint toggles
   0053 90 7F D7            479 	mov	dptr,#TOGCTL
   0056 74 12               480 	mov	a,#0x12
   0058 F0                  481 	movx	@dptr,a
   0059 74 32               482 	mov	a,#0x32		; clear EP 2 in toggle
   005B F0                  483 	movx	@dptr,a
   005C 74 02               484 	mov	a,#0x02
   005E F0                  485 	movx	@dptr,a
   005F 74 22               486 	mov	a,#0x22		; clear EP 2 out toggle
   0061 F0                  487 	movx	@dptr,a
                            488 	;; configure IO ports
   0062 90 7F 93            489 	mov	dptr,#PORTACFG
   0065 74 00               490 	mov	a,#0
   0067 F0                  491 	movx	@dptr,a
   0068 90 7F 96            492 	mov	dptr,#OUTA
   006B 74 82               493 	mov	a,#0x82		; set PROG hi
   006D F0                  494 	movx	@dptr,a
   006E 90 7F 9C            495 	mov	dptr,#OEA
   0071 74 C2               496 	mov	a,#0xc2		; out: TMS,TDI,PROG  in: DONE
   0073 F0                  497 	movx	@dptr,a
   0074 90 7F 94            498 	mov	dptr,#PORTBCFG
   0077 74 00               499 	mov	a,#0
   0079 F0                  500 	movx	@dptr,a
   007A 90 7F 9D            501 	mov	dptr,#OEB
   007D 74 00               502 	mov	a,#0
   007F F0                  503 	movx	@dptr,a
   0080 90 7F 95            504 	mov	dptr,#PORTCCFG
   0083 74 C3               505 	mov	a,#0xc3		; RD/WR/TXD0/RXD0 are special function pins
   0085 F0                  506 	movx	@dptr,a
   0086 90 7F 98            507 	mov	dptr,#OUTC
   0089 74 28               508 	mov	a,#0x28
   008B F0                  509 	movx	@dptr,a
   008C 90 7F 9E            510 	mov	dptr,#OEC
   008F 74 2A               511 	mov	a,#0x2a		; out: LEDCON,LEDSTA,TCK  in: TDO,INIT
   0091 F0                  512 	movx	@dptr,a
                            513 	;; enable interrupts
   0092 75 A8 92            514 	mov	ie,#0x92	; enable timer 0 and ser 0 int
   0095 75 E8 01            515 	mov	eie,#0x01	; enable USB interrupts
   0098 90 7F AE            516 	mov	dptr,#USBIEN
   009B 74 01               517 	mov	a,#1		; enable SUDAV interrupt
   009D F0                  518 	movx	@dptr,a
   009E 90 7F AC            519 	mov	dptr,#IN07IEN
   00A1 74 03               520 	mov	a,#3		; enable EP0+EP1 interrupt
   00A3 F0                  521 	movx	@dptr,a
   00A4 90 7F AD            522 	mov	dptr,#OUT07IEN
   00A7 74 01               523 	mov	a,#1		; enable EP0 interrupt
   00A9 F0                  524 	movx	@dptr,a
                            525 	;; initialize UART 0 for T7F communication
   00AA 75 98 52            526 	mov	scon0,#0x52	; Mode 1, Timer 1, Receiver enable
                            527 	;; copy configuration to bit addressable variables
   00AD 75 20 42            528 	mov	ctrlreg,#0x42
   00B0 78rE7               529 	mov	r0,#parpttmute
   00B2 E2                  530 	movx	a,@r0
   00B3 A2 E0               531 	mov	c,acc.0
   00B5 92*08               532 	mov	pttmute,c
   00B7 92*01               533 	mov	ctrl_pttmute,c
                            534 	;; turn off transmitter
   00B9 E5 20               535 	mov	a,ctrlreg
   00BB 90 C0 08            536 	mov	dptr,#FSKCTRL
   00BE F0                  537 	movx	@dptr,a
                            538 	;; Initialize modem disc port / t7f port
   00BF 90 C0 0C            539 	mov	dptr,#FSKMDISCTRIS
   00C2 74 FF               540 	mov	a,#0xff
   00C4 F0                  541 	movx	@dptr,a
   00C5 90 C0 0D            542 	mov	dptr,#FSKMDISCOUT
   00C8 E4                  543 	clr	a
   00C9 F0                  544 	movx	@dptr,a
   00CA 90 C0 0A            545 	mov	dptr,#FSKT7FOUT
   00CD 74 1F               546 	mov	a,#0x1f
   00CF F0                  547 	movx	@dptr,a
                            548 	;; Copy serial number
   00D0 78rF0               549 	mov	r0,#parserial
   00D2 90s0Dr34            550 	mov	dptr,#stringserial+2
   00D5 E2                  551 1$:	movx	a,@r0
   00D6 60 06               552 	jz	2$
   00D8 F0                  553 	movx	@dptr,a
   00D9 A3                  554 	inc	dptr
   00DA A3                  555 	inc	dptr
   00DB 08                  556 	inc	r0
   00DC 80 F7               557 	sjmp	1$
   00DE E8                  558 2$:	mov	a,r0
   00DF 24 11               559 	add	a,#1-0xf0	; 1-parserial
   00E1 25 E0               560 	add	a,acc
   00E3 90s0Dr32            561 	mov	dptr,#stringserial
   00E6 F0                  562 	movx	@dptr,a
                            563 	;; initialize USB state
   00E7                     564 usbinit:
   00E7 E4                  565 	clr	a
   00E8 F5*30               566 	mov	numconfig,a
   00EA F5*31               567 	mov	altsetting,a
                            568 	;; give Windows a chance to finish the writecpucs control transfer
                            569 	;; 20ms delay loop
   00EC 90 D1 20            570 	mov	dptr,#(-12000)&0xffff
   00EF A3                  571 2$:	inc	dptr		; 3 cycles
   00F0 E5 82               572 	mov	a,dpl0		; 2 cycles
   00F2 45 83               573 	orl	a,dph0		; 2 cycles
   00F4 70 F9               574 	jnz	2$		; 3 cycles
                    0001    575 	.if	1
                            576 	;; disconnect from USB bus
   00F6 90 7F D6            577 	mov	dptr,#USBCS
   00F9 74 0A               578 	mov	a,#10
   00FB F0                  579 	movx	@dptr,a
                            580 	;; wait 0.3 sec
   00FC 7A 1E               581 	mov	r2,#30
                            582 	;; 10ms delay loop
   00FE 90 E8 90            583 0$:	mov	dptr,#(-6000)&0xffff
   0101 A3                  584 1$:	inc	dptr            ; 3 cycles
   0102 E5 82               585 	mov	a,dpl0          ; 2 cycles
   0104 45 83               586 	orl	a,dph0          ; 2 cycles
   0106 70 F9               587 	jnz	1$              ; 3 cycles
   0108 DA F4               588 	djnz	r2,0$
                            589 	;; reconnect to USB bus
   010A 90 7F D6            590 	mov	dptr,#USBCS
                            591 	;mov	a,#2		; 8051 handles control
                            592 	;movx	@dptr,a
   010D 74 06               593 	mov	a,#6		; reconnect, 8051 handles control
   010F F0                  594 	movx	@dptr,a
                            595 	.endif
                            596 	
                            597 	;; final
   0110 12s09rCF            598 	lcall	fillusbintr
                            599 	;; kludge; first OUT2 packet seems to be bogus
                            600 	;; wait for packet with length 1 and contents 0x55
   0113                     601 waitpkt1:
   0113 90 7F C8            602 	mov	dptr,#OUT2CS
   0116 E0                  603 	movx	a,@dptr
   0117 20 E1 F9            604 	jb	acc.1,waitpkt1
   011A 90 7F C9            605 	mov	dptr,#OUT2BC
   011D E0                  606 	movx	a,@dptr
   011E B4 01 0D            607 	cjne	a,#1,0$
   0121 90 7D C0            608 	mov	dptr,#OUT2BUF
   0124 E0                  609 	movx	a,@dptr
   0125 B4 55 06            610 	cjne	a,#0x55,0$
   0128 90 7F C9            611 	mov	dptr,#OUT2BC
   012B F0                  612 	movx	@dptr,a
   012C 80 06               613 	sjmp	pkt1received
   012E 90 7F C9            614 0$:	mov	dptr,#OUT2BC
   0131 F0                  615 	movx	@dptr,a
   0132 80 DF               616 	sjmp	waitpkt1
   0134                     617 pkt1received:
                            618 	;; start normal operation
   0134 02s00r22            619 	ljmp	mainloop
                            620 
                            621 
                            622 	.area	CSEG (CODE)
                    0002    623 	ar2 = 0x02
                    0003    624 	ar3 = 0x03
                    0004    625 	ar4 = 0x04
                    0005    626 	ar5 = 0x05
                    0006    627 	ar6 = 0x06
                    0007    628 	ar7 = 0x07
                    0000    629 	ar0 = 0x00
                    0001    630 	ar1 = 0x01
                            631 	
   0000                     632 setptt:
   0000 E5*05               633 	mov	a,txstate
   0002 45*11               634 	orl	a,pttforce
   0004 60 0D               635 	jz	pttoff
                            636 
   0006                     637 ptton:
   0006 C2*01               638 	clr	ctrl_pttmute
   0008 D2*00               639 	setb	ctrl_ptt
   000A D2*02               640 	setb	ctrl_ledptt
   000C E5 20               641 	mov	a,ctrlreg
   000E 90 C0 08            642 	mov	dptr,#FSKCTRL
   0011 F0                  643 	movx	@dptr,a
   0012 22                  644 	ret
                            645 
   0013                     646 pttoff:
   0013 C2*00               647 	clr	ctrl_ptt
   0015 A2*08               648 	mov	c,pttmute
   0017 92*01               649 	mov	ctrl_pttmute,c
   0019 C2*02               650 	clr	ctrl_ledptt
   001B E5 20               651 	mov	a,ctrlreg
   001D 90 C0 08            652 	mov	dptr,#FSKCTRL
   0020 F0                  653 	movx	@dptr,a
   0021 22                  654 	ret
                            655 
   0022                     656 mainloop:
                            657 	
                            658 	;; HDLC encoder
   0022                     659 txnopkt:
   0022 E5*09               660 	mov	a,txrd
   0024 B5*08 14            661 	cjne	a,txwr,txstartsend
   0027 12s01r71            662 	lcall	periodic
   002A E4                  663 	clr	a
   002B F5*05               664 	mov	txstate,a
   002D 90 C0 00            665 	mov	dptr,#FSKSHREG
   0030 F0                  666 	movx	@dptr,a
   0031 10*09 02            667 	jbc	pttforcechg,0$
   0034 80 EC               668 	sjmp	txnopkt
   0036 12s00r00            669 0$:	lcall	setptt
   0039 80 E7               670 	sjmp	txnopkt
   003B                     671 txstartsend:
   003B 75*05 01            672 	mov	txstate,#1
   003E 75*0E 08            673 	mov	txbnum,#8
   0041 75*0B FF            674 	mov	txcrc,#0xff
   0044 75*0C FF            675 	mov	txcrc+1,#0xff
                            676 	;; start txdelay
                            677 	;; read the number of flags to send from the first two bytes of the first packet
                    0001    678 	.if	1
   0047 E5*09               679 	mov	a,txrd
   0049 03                  680 	rr	a
   004A 03                  681 	rr	a
   004B F5 82               682 	mov	dpl0,a
   004D 54 C0               683 	anl	a,#0xc0
   004F 24r00               684 	add	a,#<txbuf
   0051 C5 82               685 	xch	a,dpl0
   0053 54 3F               686 	anl	a,#0x3f
   0055 34s00               687 	addc	a,#>txbuf
   0057 F5 83               688 	mov	dph0,a
                            689 	.else
                            690 	mov	a,txrd
                            691 	rr	a
                            692 	rr	a
                            693 	mov	dpl0,a
                            694 	anl	a,#0xc0
                            695 	xch	a,dpl0
                            696 	anl	a,#0x3f
                            697 	add	a,#>txbuf
                            698 	mov	dph0,a
                            699 	.endif
   0059 E0                  700 	movx	a,@dptr
   005A F5*06               701 	mov	flagcnt,a
   005C A3                  702 	inc	dptr
   005D E0                  703 	movx	a,@dptr
   005E F5*07               704 	mov	flagcnt+1,a
   0060 75*10 02            705 	mov	txskip,#2
                            706 	;; sanity check (limit txdelay to about 8s)
   0063 78rE1               707 	mov	r0,#parbitratetx+1
   0065 E2                  708 	movx	a,@r0
   0066 C3                  709 	clr	c
   0067 95*07               710 	subb	a,flagcnt+1
   0069 50 03               711 	jnc	2$
   006B E2                  712 	movx	a,@r0
   006C F5*07               713 	mov	flagcnt+1,a
   006E                     714 2$:
                            715 	;; check if count is at least two
   006E E5*09               716 	mov	a,txrd
   0070 24r00               717 	add	a,#txbcnt
   0072 F8                  718 	mov	r0,a
   0073 E6                  719 	mov	a,@r0
   0074 24 FE               720 	add	a,#-2
   0076 40 09               721 	jc	1$
   0078 75*06 01            722 	mov	flagcnt,#1
   007B 75*07 00            723 	mov	flagcnt+1,#0
   007E 75*10 00            724 	mov	txskip,#0
   0081                     725 1$:
                            726 	;; turn on PTT
   0081 12s00r06            727 	lcall	ptton
   0084                     728 txkeyup:
   0084 E5*06               729 	mov	a,flagcnt
   0086 24 FF               730 	add	a,#-1
   0088 F5*06               731 	mov	flagcnt,a
   008A E5*07               732 	mov	a,flagcnt+1
   008C 34 FF               733 	addc	a,#-1
   008E F5*07               734 	mov	flagcnt+1,a
   0090 50 0B               735 	jnc	txpreparepkt
   0092 12s01r71            736 	lcall	periodic
   0095 74 7E               737 	mov	a,#0x7e
   0097 90 C0 00            738 	mov	dptr,#FSKSHREG
   009A F0                  739 	movx	@dptr,a
   009B 80 E7               740 	sjmp	txkeyup
   009D                     741 txpreparepkt:
   009D 85*10*0F            742 	mov	txptr,txskip
   00A0 75*05 02            743 	mov	txstate,#2
   00A3                     744 txpktbyteloop:
   00A3 E5*09               745 	mov	a,txrd
   00A5 24r00               746 	add	a,#txbcnt
   00A7 F8                  747 	mov	r0,a
   00A8 E6                  748 	mov	a,@r0
   00A9 B5*0F 2B            749 	cjne	a,txptr,txchunkcont
                            750 	;; tx chunk ended
   00AC 75*10 00            751 	mov	txskip,#0
   00AF 20 E6 18            752 	jb	acc.6,txchunknoend
   00B2 E5*0B               753 	mov	a,txcrc
   00B4 F4                  754 	cpl	a
   00B5 12s01r2C            755 	lcall	txbytenocrc
   00B8 E5*0C               756 	mov	a,txcrc+1
   00BA F4                  757 	cpl	a
   00BB 12s01r2C            758 	lcall	txbytenocrc
   00BE 12s01r0A            759 	lcall	txflag
   00C1 75*0B FF            760 	mov	txcrc,#0xff
   00C4 75*0C FF            761 	mov	txcrc+1,#0xff	
   00C7 75*10 02            762 	mov	txskip,#2
   00CA                     763 txchunknoend:
   00CA E5*09               764 	mov	a,txrd
   00CC 04                  765 	inc	a
   00CD 54 0F               766 	anl	a,#(TXCHUNKS-1)
   00CF F5*09               767 	mov	txrd,a
   00D1 B5*08 C9            768 	cjne	a,txwr,txpreparepkt
   00D4 02s00rF3            769 	ljmp	txtail
   00D7                     770 txchunkcont:
                    0001    771 	.if	1
   00D7 E5*09               772 	mov	a,txrd
   00D9 03                  773 	rr	a
   00DA 03                  774 	rr	a
   00DB F5 82               775 	mov	dpl0,a
   00DD 54 C0               776 	anl	a,#0xc0
   00DF 25*0F               777 	add	a,txptr
   00E1 24r00               778 	add	a,#<txbuf
   00E3 C5 82               779 	xch	a,dpl0
   00E5 54 3F               780 	anl	a,#0x3f
   00E7 34s00               781 	addc	a,#>txbuf
   00E9 F5 83               782 	mov	dph0,a
                            783 	.else
                            784 	mov	a,txrd
                            785 	rr	a
                            786 	rr	a
                            787 	mov	dpl0,a
                            788 	anl	a,#0xc0
                            789 	add	a,txptr
                            790 	xch	a,dpl0
                            791 	anl	a,#0x3f
                            792 	addc	a,#>txbuf
                            793 	mov	dph0,a
                            794 	.endif
   00EB E0                  795 	movx	a,@dptr
   00EC 12s01r43            796 	lcall	txbyte	
   00EF 05*0F               797 	inc	txptr
   00F1 80 B0               798 	sjmp	txpktbyteloop
                            799 
   00F3                     800 txtail:
   00F3 12s01r0A            801 	lcall	txflag
   00F6 75*05 03            802 	mov	txstate,#3
   00F9 7A 14               803 	mov	r2,#20
   00FB D3                  804 0$:	setb	c
   00FC 12s01r17            805 	lcall	txbit
   00FF DA FA               806 	djnz	r2,0$
                            807 	;; turn off PTT
   0101 75*05 00            808 	mov	txstate,#0
   0104 12s00r00            809 	lcall	setptt
   0107 02s00r22            810 	ljmp	txnopkt
                            811 
   010A                     812 txflag:
   010A 7B 7E               813 	mov	r3,#0x7e
   010C 7A 08               814 	mov	r2,#8
   010E EB                  815 0$:	mov	a,r3
   010F 13                  816 	rrc	a
   0110 FB                  817 	mov	r3,a
   0111 12s01r17            818 	lcall	txbit
   0114 DA F8               819 	djnz	r2,0$
   0116 22                  820 	ret	
                            821 	
   0117                     822 txbit:
   0117 E5*0D               823 	mov	a,txshreg
   0119 13                  824 	rrc	a
   011A F5*0D               825 	mov	txshreg,a
   011C D5*0E 0C            826 	djnz	txbnum,0$
   011F 75*0E 08            827 	mov	txbnum,#8
   0122 12s01r71            828 	lcall	periodic
   0125 E5*0D               829 	mov	a,txshreg
   0127 90 C0 00            830 	mov	dptr,#FSKSHREG
   012A F0                  831 	movx	@dptr,a
   012B 22                  832 0$:	ret
                            833 
                            834 
   012C                     835 txbytenocrc:
   012C FB                  836 	mov	r3,a
   012D 7A 08               837 	mov	r2,#8
   012F EB                  838 0$:	mov	a,r3
   0130 13                  839 	rrc	a
   0131 FB                  840 	mov	r3,a
   0132 12s01r17            841 	lcall	txbit
   0135 E5*0D               842 	mov	a,txshreg
   0137 F4                  843 	cpl	a
   0138 54 F8               844 	anl	a,#0xf8
   013A 70 04               845 	jnz	1$
   013C C3                  846 	clr	c
   013D 12s01r17            847 	lcall	txbit		; add stuff bit
   0140 DA ED               848 1$:	djnz	r2,0$
   0142 22                  849 	ret
                            850 
   0143                     851 txbyte:
   0143 FB                  852 	mov	r3,a
   0144 7A 08               853 	mov	r2,#8
   0146 C3                  854 0$:	clr	c
   0147 E5*0C               855 	mov	a,txcrc+1
   0149 13                  856 	rrc	a
   014A F5*0C               857 	mov	txcrc+1,a
   014C E5*0B               858 	mov	a,txcrc
   014E 13                  859 	rrc	a
   014F F5*0B               860 	mov	txcrc,a
   0151 EB                  861 	mov	a,r3
   0152 30 E0 01            862 	jnb	acc.0,2$
   0155 B3                  863 	cpl	c
   0156 50 06               864 2$:	jnc	3$
   0158 63r0C 84            865 	xrl	txcrc+1,#0x84
   015B 63r0B 08            866 	xrl	txcrc,#0x08
   015E 13                  867 3$:	rrc	a
   015F FB                  868 	mov	r3,a
   0160 12s01r17            869 	lcall	txbit
   0163 E5*0D               870 	mov	a,txshreg
   0165 F4                  871 	cpl	a
   0166 54 F8               872 	anl	a,#0xf8
   0168 70 04               873 	jnz	1$
   016A C3                  874 	clr	c
   016B 12s01r17            875 	lcall	txbit		; add stuff bit
   016E DA D6               876 1$:	djnz	r2,0$
   0170 22                  877 	ret
                            878 
                            879 	
   0171                     880 periodic:
   0171 90 C0 01            881 	mov	dptr,#FSKSHSTATUS
   0174 E0                  882 	movx	a,@dptr
   0175 30 E1 01            883 	jnb	acc.1,0$
   0178 22                  884 	ret
   0179 30 E0 03            885 0$:	jnb	acc.0,1$
   017C 12s02r0C            886 	lcall	hdlcdec
   017F                     887 1$:
                            888 
   017F                     889 usbiostart:
                            890 	;; check for USB modem->host
   017F E5*14               891 	mov	a,rxrd
   0181 B5*13 47            892 	cjne	a,rxwr,usbcheckin
                            893 	;; check for USB host->modem
   0184                     894 usbcheckout:
   0184 90 7F C8            895 	mov	dptr,#OUT2CS
   0187 E0                  896 	movx	a,@dptr
   0188 20 E1 3E            897 	jb	acc.1,endusb2
   018B E5*08               898 	mov	a,txwr
   018D 24r00               899 	add	a,#txbcnt
   018F F8                  900 	mov	r0,a
   0190 E5*08               901 	mov	a,txwr
   0192 04                  902 	inc	a
   0193 54 0F               903 	anl	a,#(TXCHUNKS-1)
   0195 B5*09 03            904 	cjne	a,txrd,usbout2
   0198 02s02r09            905 	ljmp	endusb
   019B                     906 usbout2:
   019B FF                  907 	mov	r7,a
   019C 90 7F C9            908 	mov	dptr,#OUT2BC
   019F E0                  909 	movx	a,@dptr
   01A0 F6                  910 	mov	@r0,a
   01A1 60 20               911 	jz	usbout3
   01A3 FE                  912 	mov	r6,a
                    0001    913 	.if	1
   01A4 E5*08               914 	mov	a,txwr
   01A6 03                  915 	rr	a
   01A7 03                  916 	rr	a
   01A8 F5 84               917 	mov	dpl1,a
   01AA 54 C0               918 	anl	a,#0xc0
   01AC 24r00               919 	add	a,#<txbuf
   01AE C5 84               920 	xch	a,dpl1
   01B0 54 3F               921 	anl	a,#0x3f
   01B2 34s00               922 	addc	a,#>txbuf
   01B4 F5 85               923 	mov	dph1,a
                            924 	.else
                            925 	mov	a,txwr
                            926 	rr	a
                            927 	rr	a
                            928 	mov	dpl1,a
                            929 	anl	a,#0xc0
                            930 	xch	a,dpl1
                            931 	anl	a,#0x3f
                            932 	add	a,#>txbuf
                            933 	mov	dph1,a
                            934 	.endif
   01B6 90 7D C0            935 	mov	dptr,#OUT2BUF
   01B9                     936 usboutloop:
   01B9 E0                  937 	movx	a,@dptr
   01BA A3                  938 	inc	dptr
   01BB 05 86               939 	inc	dps
   01BD F0                  940 	movx	@dptr,a
   01BE A3                  941 	inc	dptr
   01BF 15 86               942 	dec	dps
   01C1 DE F6               943 	djnz	r6,usboutloop
   01C3                     944 usbout3:
   01C3 8F*08               945 	mov	txwr,r7
   01C5 90 7F C9            946 	mov	dptr,#OUT2BC
   01C8 F0                  947 	movx	@dptr,a		; rearm OUT2
   01C9                     948 endusb2:
   01C9 80 3E               949 	sjmp	endusb
                            950 
   01CB                     951 usbcheckin:
   01CB 90 7F B8            952 	mov	dptr,#IN2CS
   01CE E0                  953 	movx	a,@dptr
   01CF 20 E1 B2            954 	jb	acc.1,usbcheckout
   01D2 E5*14               955 	mov	a,rxrd
   01D4 24r10               956 	add	a,#rxbcnt
   01D6 F8                  957 	mov	r0,a
   01D7 E6                  958 	mov	a,@r0
   01D8 60 20               959 	jz	usbin1
   01DA FE                  960 	mov	r6,a
                    0001    961 	.if	1
   01DB E5*14               962 	mov	a,rxrd
   01DD 03                  963 	rr	a
   01DE 03                  964 	rr	a
   01DF F5 84               965 	mov	dpl1,a
   01E1 54 C0               966 	anl	a,#0xc0
   01E3 24r00               967 	add	a,#<rxbuf
   01E5 C5 84               968 	xch	a,dpl1	
   01E7 54 3F               969 	anl	a,#0x3f
   01E9 34s04               970 	addc	a,#>rxbuf
   01EB F5 85               971 	mov	dph1,a
                            972 	.else
                            973 	mov	a,rxrd
                            974 	rr	a
                            975 	rr	a
                            976 	mov	dpl1,a
                            977 	anl	a,#0xc0
                            978 	xch	a,dpl1	
                            979 	anl	a,#0x3f
                            980 	addc	a,#>rxbuf
                            981 	mov	dph1,a
                            982 	.endif
   01ED 90 7E 00            983 	mov	dptr,#IN2BUF
   01F0                     984 usbinloop:
   01F0 05 86               985 	inc	dps
   01F2 E0                  986 	movx	a,@dptr
   01F3 A3                  987 	inc	dptr
   01F4 15 86               988 	dec	dps
   01F6 F0                  989 	movx	@dptr,a
   01F7 A3                  990 	inc	dptr
   01F8 DE F6               991 	djnz	r6,usbinloop
   01FA                     992 usbin1:
   01FA E6                  993 	mov	a,@r0
   01FB 90 7F B9            994 	mov	dptr,#IN2BC
   01FE F0                  995 	movx	@dptr,a
   01FF E5*14               996 	mov	a,rxrd
   0201 04                  997 	inc	a
   0202 54 1F               998 	anl	a,#(RXCHUNKS-1)
   0204 F5*14               999 	mov	rxrd,a
   0206 02s01r84           1000 	ljmp	usbcheckout
                           1001 
   0209                    1002 endusb:
   0209 02s01r71           1003 	ljmp	periodic
                           1004 
                           1005 
                           1006 
                           1007 	;; Software HDLC decoder
   020C                    1008 hdlcdec:
   020C 90 C0 00           1009 	mov	dptr,#FSKSHREG
   020F E0                 1010 	movx	a,@dptr
   0210 FE                 1011 	mov	r6,a
   0211 7F 08              1012 	mov	r7,#8
   0213                    1013 hdlcdecloop:
   0213 EE                 1014 	mov	a,r6
   0214 13                 1015 	rrc	a
   0215 FE                 1016 	mov	r6,a
   0216 E5*19              1017 	mov	a,rxshreg
   0218 33                 1018 	rlc	a
   0219 F5*19              1019 	mov	rxshreg,a
   021B B4 7E 03           1020 	cjne	a,#0x7e,$0
   021E 02s02r9B           1021 	ljmp	hdlcdecflag
   0221 F4                 1022 $0:	cpl	a
   0222 54 7F              1023 	anl	a,#0x7f
   0224 60 0E              1024 	jz	hdlcdecabort
   0226 E5*12              1025 $1:	mov	a,rxstate
   0228 60 07              1026 	jz	hdlcdecendloop
   022A E5*19              1027 	mov	a,rxshreg
   022C 54 3F              1028 	anl	a,#0x3f
   022E B4 3E 08           1029 	cjne	a,#0x3e,hdlcdecrxbit
   0231                    1030 hdlcdecendloop:
   0231 DF E0              1031 	djnz	r7,hdlcdecloop
   0233 22                 1032 	ret
                           1033 
   0234                    1034 hdlcdecabort:
   0234 75*12 00           1035 	mov	rxstate,#0	; abort received
   0237 80 F8              1036 	sjmp	hdlcdecendloop
                           1037 
   0239                    1038 hdlcdecrxbit:
   0239 C3                 1039 	clr	c
   023A E5*17              1040 	mov	a,rxcrc
   023C 33                 1041 	rlc	a
   023D F5*17              1042 	mov	rxcrc,a
   023F E5*18              1043 	mov	a,rxcrc+1
   0241 33                 1044 	rlc	a
   0242 F5*18              1045 	mov	rxcrc+1,a
   0244 E5*19              1046 	mov	a,rxshreg
   0246 30 E0 01           1047 	jnb	acc.0,0$
   0249 B3                 1048 	cpl	c
   024A 50 06              1049 0$:	jnc	1$
   024C 63r17 21           1050 	xrl	rxcrc,#0x21
   024F 63r18 10           1051 	xrl	rxcrc+1,#0x10
   0252 13                 1052 1$:	rrc	a
   0253 E5*1A              1053 	mov	a,rxbreg
   0255 13                 1054 	rrc	a
   0256 F5*1A              1055 	mov	rxbreg,a
   0258 D5*1B D6           1056 	djnz	rxbnum,hdlcdecendloop
   025B 75*1B 08           1057 	mov	rxbnum,#8
                    0001   1058 	.if	1
   025E E5*15              1059 	mov	a,rxtwr
   0260 03                 1060 	rr	a
   0261 03                 1061 	rr	a
   0262 F5 82              1062 	mov	dpl0,a
   0264 54 C0              1063 	anl	a,#0xc0
   0266 25*1C              1064 	add	a,rxptr
   0268 24r00              1065 	add	a,#<rxbuf
   026A C5 82              1066 	xch	a,dpl0
   026C 54 3F              1067 	anl	a,#0x3f
   026E 34s04              1068 	addc	a,#>rxbuf
   0270 F5 83              1069 	mov	dph0,a
                           1070 	.else
                           1071 	mov	a,rxtwr
                           1072 	rr	a
                           1073 	rr	a
                           1074 	mov	dpl0,a
                           1075 	anl	a,#0xc0
                           1076 	add	a,rxptr
                           1077 	xch	a,dpl0
                           1078 	anl	a,#0x3f
                           1079 	addc	a,#>rxbuf
                           1080 	mov	dph0,a
                           1081 	.endif
   0272 E5*1A              1082 	mov	a,rxbreg
   0274 F0                 1083 	movx	@dptr,a
   0275 05*1C              1084 	inc	rxptr
   0277 E5*1C              1085 	mov	a,rxptr
   0279 30 E6 B5           1086 	jnb	acc.6,hdlcdecendloop
   027C E5*15              1087 	mov	a,rxtwr
   027E 24r10              1088 	add	a,#rxbcnt
   0280 F8                 1089 	mov	r0,a
   0281 76 40              1090 	mov	@r0,#64
   0283 E5*15              1091 	mov	a,rxtwr
   0285 04                 1092 	inc	a
   0286 54 1F              1093 	anl	a,#RXCHUNKS-1
   0288 B5*14 06           1094 	cjne	a,rxrd,2$
   028B 75*12 00           1095 	mov	rxstate,#0
   028E 02s02r31           1096 	ljmp	hdlcdecendloop
   0291 F5*15              1097 2$:	mov	rxtwr,a
   0293 75*1C 00           1098 	mov	rxptr,#0
   0296 05*16              1099 	inc	rxcntc
   0298 02s02r31           1100 	ljmp	hdlcdecendloop
                           1101 	
   029B                    1102 hdlcdecflag:
   029B E5*12              1103 	mov	a,rxstate
   029D 60 2F              1104 	jz	hdlcdecpreparenewpkt
                           1105 	;; check for correct CRC:
                           1106 	;; 1D0F -0-> 3A1E -1-> 641D -1-> D81B -1-> B036 -1-> 606C -1-> D0F9 -1-> A1F2
   029F E5*17              1107 	mov	a,rxcrc
   02A1 64 F2              1108 	xrl	a,#0xf2
   02A3 F8                 1109 	mov	r0,a
   02A4 E5*18              1110 	mov	a,rxcrc+1
   02A6 64 A1              1111 	xrl	a,#0xa1
   02A8 48                 1112 	orl	a,r0
   02A9 70 23              1113 	jnz	hdlcdecpreparenewpkt
   02AB E5*15              1114 	mov	a,rxtwr
   02AD 24r10              1115 	add	a,#rxbcnt
   02AF F8                 1116 	mov	r0,a
   02B0 E5*1C              1117 	mov	a,rxptr
   02B2 F6                 1118 	mov	@r0,a
   02B3 E5*16              1119 	mov	a,rxcntc
   02B5 70 07              1120 	jnz	3$
   02B7 74 FC              1121 	mov	a,#-4
   02B9 26                 1122 	add	a,@r0
   02BA 50 12              1123 	jnc	hdlcdecpreparenewpkt	; frame too short
   02BC 80 04              1124 	sjmp	4$
   02BE 24 F8              1125 3$:	add	a,#-8
   02C0 40 0C              1126 	jc	hdlcdecpreparenewpkt	; frame too long
   02C2 E5*15              1127 4$:	mov	a,rxtwr
   02C4 04                 1128 	inc	a
   02C5 54 1F              1129 	anl	a,#RXCHUNKS-1
   02C7 B5*14 02           1130 	cjne	a,rxrd,5$
   02CA 80 02              1131 	sjmp	hdlcdecpreparenewpkt
   02CC F5*13              1132 5$:	mov	rxwr,a
   02CE                    1133 hdlcdecpreparenewpkt:
   02CE E4                 1134 	clr	a
   02CF F5*16              1135 	mov	rxcntc,a
   02D1 F5*1C              1136 	mov	rxptr,a
   02D3 75*12 01           1137 	mov	rxstate,#1
   02D6 F4                 1138 	cpl	a
   02D7 F5*17              1139 	mov	rxcrc,a
   02D9 F5*18              1140 	mov	rxcrc+1,a
   02DB 75*1B 08           1141 	mov	rxbnum,#8
   02DE 85*13*15           1142 	mov	rxtwr,rxwr
   02E1 02s02r31           1143 	ljmp	hdlcdecendloop
                           1144 
                           1145 	
                    0000   1146 	.if	0
                           1147 	;; IO copy routine
                           1148 ioc1:
                           1149 	;; txpointers
                           1150 	add	a,#txbcnt
                           1151 	mov	r0,a
                    0001   1152 	.if	1
                           1153 	mov	a,txrd
                           1154 	rr	a
                           1155 	rr	a
                           1156 	mov	dpl1,a
                           1157 	anl	a,#0xc0
                           1158 	add	a,#<txbuf
                           1159 	xch	a,dpl1
                           1160 	anl	a,#0x3f
                           1161 	addc	a,#>txbuf
                           1162 	mov	dph1,a
                           1163 	.else
                           1164 	mov	a,txrd
                           1165 	rr	a
                           1166 	rr	a
                           1167 	mov	dpl1,a
                           1168 	anl	a,#0xc0
                           1169 	xch	a,dpl1
                           1170 	anl	a,#0x3f
                           1171 	add	a,#>txbuf
                           1172 	mov	dph1,a
                           1173 	.endif
                           1174 	;; rxpointers
                           1175 	mov	a,rxtwr
                           1176 	add	a,#rxbcnt
                           1177 	mov	r1,a
                    0001   1178 	.if	1
                           1179 	mov	a,rxtwr
                           1180 	rr	a
                           1181 	rr	a
                           1182 	mov	dpl0,a
                           1183 	anl	a,#0xc0
                           1184 	add	a,#<rxbuf
                           1185 	xch	a,dpl0
                           1186 	anl	a,#0x3f
                           1187 	addc	a,#>rxbuf
                           1188 	mov	dph0,a
                           1189 	.else
                           1190 	mov	a,rxtwr
                           1191 	rr	a
                           1192 	rr	a
                           1193 	mov	dpl0,a
                           1194 	anl	a,#0xc0
                           1195 	xch	a,dpl0
                           1196 	anl	a,#0x3f
                           1197 	add	a,#>rxbuf
                           1198 	mov	dph0,a
                           1199 	.endif
                           1200 	;; update rxpointer
                           1201 	mov	a,rxtwr
                           1202 	inc	a
                           1203 	anl	a,#(RXCHUNKS-1)
                           1204 	mov	rxtwr,a
                           1205 	cjne	a,rxrd,ioc2
                           1206 iocret:
                           1207 	ret
                           1208 
                           1209 	;; entry point
                           1210 iocopy:
                           1211 	mov	a,txrd
                           1212 	cjne	a,txwr,ioc1
                           1213 	ret
                           1214 
                           1215 ioc2:
                           1216 	mov	a,@r0
                           1217 	mov	@r1,a
                           1218 	jz	ioc3
                           1219 	mov	r7,a
                           1220 ioc4:
                           1221 	inc	dps
                           1222 	movx	a,@dptr
                           1223 	inc	dptr
                           1224 	dec	dps
                           1225 	movx	@dptr,a
                           1226 	inc	dptr
                           1227 	djnz	r7,ioc4
                           1228 ioc3:
                           1229 	mov	a,txrd
                           1230 	inc	a
                           1231 	anl	a,#(TXCHUNKS-1)
                           1232 	mov	txrd,a
                           1233 	mov	a,@r0
                           1234 	add	a,#-0x40
                           1235 	jc	iocret
                           1236 	mov	rxwr,rxtwr
                           1237 	ret
                           1238 	.endif
                           1239 
                           1240 	;; ------------------ interrupt handlers ------------------------
                           1241 
   02E4                    1242 int0_isr:
   02E4 C0 E0              1243 	push	acc
   02E6 C0 F0              1244 	push	b
   02E8 C0 82              1245 	push	dpl0
   02EA C0 83              1246 	push	dph0
   02EC C0 D0              1247 	push	psw
   02EE 75 D0 00           1248 	mov	psw,#0x00
   02F1 C0 86              1249 	push	dps
   02F3 75 86 00           1250 	mov	dps,#0
                           1251 	;; clear interrupt
   02F6 C2 89              1252 	clr	tcon+1
                           1253 	;; handle interrupt
                           1254 	;; epilogue
   02F8 D0 86              1255 	pop	dps
   02FA D0 D0              1256 	pop	psw
   02FC D0 83              1257 	pop	dph0
   02FE D0 82              1258 	pop	dpl0
   0300 D0 F0              1259 	pop	b
   0302 D0 E0              1260 	pop	acc
   0304 32                 1261 	reti
                           1262 
   0305                    1263 timer0_isr:
   0305 C0 E0              1264 	push	acc
   0307 C0 F0              1265 	push	b
   0309 C0 82              1266 	push	dpl0
   030B C0 83              1267 	push	dph0
   030D C0 D0              1268 	push	psw
   030F 75 D0 00           1269 	mov	psw,#0x00
   0312 C0 86              1270 	push	dps
   0314 75 86 00           1271 	mov	dps,#0
                           1272 	;; clear interrupt
   0317 C2 8D              1273 	clr	tcon+5
                           1274 	;; handle interrupt
                    0000   1275 	.if	0
                           1276 	inc	leddiv
                           1277 	mov	a,leddiv
                           1278 	anl	a,#7
                           1279 	jnz	0$
                           1280 	mov	dptr,#OUTC
                           1281 	movx	a,@dptr
                           1282 	xrl	a,#0x08
                           1283 	movx	@dptr,a
                           1284 0$:
                           1285 	.endif
                           1286 	;; epilogue
   0319 D0 86              1287 	pop	dps
   031B D0 D0              1288 	pop	psw
   031D D0 83              1289 	pop	dph0
   031F D0 82              1290 	pop	dpl0
   0321 D0 F0              1291 	pop	b
   0323 D0 E0              1292 	pop	acc
   0325 32                 1293 	reti
                           1294 
   0326                    1295 int1_isr:
   0326 C0 E0              1296 	push	acc
   0328 C0 F0              1297 	push	b
   032A C0 82              1298 	push	dpl0
   032C C0 83              1299 	push	dph0
   032E C0 D0              1300 	push	psw
   0330 75 D0 00           1301 	mov	psw,#0x00
   0333 C0 86              1302 	push	dps
   0335 75 86 00           1303 	mov	dps,#0
                           1304 	;; clear interrupt
   0338 C2 8B              1305 	clr	tcon+3
                           1306 	;; handle interrupt
                           1307 	;; epilogue
   033A D0 86              1308 	pop	dps
   033C D0 D0              1309 	pop	psw
   033E D0 83              1310 	pop	dph0
   0340 D0 82              1311 	pop	dpl0
   0342 D0 F0              1312 	pop	b
   0344 D0 E0              1313 	pop	acc
   0346 32                 1314 	reti
                           1315 
   0347                    1316 timer1_isr:
   0347 C0 E0              1317 	push	acc
   0349 C0 F0              1318 	push	b
   034B C0 82              1319 	push	dpl0
   034D C0 83              1320 	push	dph0
   034F C0 D0              1321 	push	psw
   0351 75 D0 00           1322 	mov	psw,#0x00
   0354 C0 86              1323 	push	dps
   0356 75 86 00           1324 	mov	dps,#0
                           1325 	;; clear interrupt
   0359 C2 8F              1326 	clr	tcon+7
                           1327 	;; handle interrupt
                           1328 	;; epilogue
   035B D0 86              1329 	pop	dps
   035D D0 D0              1330 	pop	psw
   035F D0 83              1331 	pop	dph0
   0361 D0 82              1332 	pop	dpl0
   0363 D0 F0              1333 	pop	b
   0365 D0 E0              1334 	pop	acc
   0367 32                 1335 	reti
                           1336 
   0368                    1337 ser0_isr:
   0368 C0 E0              1338 	push	acc
   036A C0 F0              1339 	push	b
   036C C0 82              1340 	push	dpl0
   036E C0 83              1341 	push	dph0
   0370 C0 D0              1342 	push	psw
   0372 75 D0 00           1343 	mov	psw,#0x00
   0375 C0 86              1344 	push	dps
   0377 75 86 00           1345 	mov	dps,#0
   037A C0 00              1346 	push	ar0
                           1347 	;; clear interrupt
   037C 10 98 16           1348 	jbc	scon0+0,1$	; RI
   037F 10 99 0F           1349 0$:	jbc	scon0+1,2$	; TI
                           1350 	;; handle interrupt
                           1351 	;; epilogue
   0382 D0 00              1352 3$:	pop	ar0
   0384 D0 86              1353 	pop	dps
   0386 D0 D0              1354 	pop	psw
   0388 D0 83              1355 	pop	dph0
   038A D0 82              1356 	pop	dpl0
   038C D0 F0              1357 	pop	b
   038E D0 E0              1358 	pop	acc
   0390 32                 1359 	reti
                           1360 
   0391 D2*0A              1361 2$:	setb	uartempty
   0393 80 EA              1362 	sjmp	0$
                           1363 
   0395 E5*2E              1364 1$:	mov	a,uartwr
   0397 24r1E              1365 	add	a,#uartbuf
   0399 F8                 1366 	mov	r0,a
   039A E5 99              1367 	mov	a,sbuf0
   039C F6                 1368 	mov	@r0,a
   039D E5*2E              1369 	mov	a,uartwr
   039F 04                 1370 	inc	a
   03A0 54 0F              1371 	anl	a,#0xf
   03A2 F5*2E              1372 	mov	uartwr,a
   03A4 80 DC              1373 	sjmp	3$
                           1374 
   03A6                    1375 timer2_isr:
   03A6 C0 E0              1376 	push	acc
   03A8 C0 F0              1377 	push	b
   03AA C0 82              1378 	push	dpl0
   03AC C0 83              1379 	push	dph0
   03AE C0 D0              1380 	push	psw
   03B0 75 D0 00           1381 	mov	psw,#0x00
   03B3 C0 86              1382 	push	dps
   03B5 75 86 00           1383 	mov	dps,#0
                           1384 	;; clear interrupt
   03B8 C2 CF              1385 	clr	t2con+7
                           1386 	;; handle interrupt
                           1387 	;; epilogue
   03BA D0 86              1388 	pop	dps
   03BC D0 D0              1389 	pop	psw
   03BE D0 83              1390 	pop	dph0
   03C0 D0 82              1391 	pop	dpl0
   03C2 D0 F0              1392 	pop	b
   03C4 D0 E0              1393 	pop	acc
   03C6 32                 1394 	reti
                           1395 
   03C7                    1396 resume_isr:
   03C7 C0 E0              1397 	push	acc
   03C9 C0 F0              1398 	push	b
   03CB C0 82              1399 	push	dpl0
   03CD C0 83              1400 	push	dph0
   03CF C0 D0              1401 	push	psw
   03D1 75 D0 00           1402 	mov	psw,#0x00
   03D4 C0 86              1403 	push	dps
   03D6 75 86 00           1404 	mov	dps,#0
                           1405 	;; clear interrupt
   03D9 C2 DC              1406 	clr	eicon+4
                           1407 	;; handle interrupt
                           1408 	;; epilogue
   03DB D0 86              1409 	pop	dps
   03DD D0 D0              1410 	pop	psw
   03DF D0 83              1411 	pop	dph0
   03E1 D0 82              1412 	pop	dpl0
   03E3 D0 F0              1413 	pop	b
   03E5 D0 E0              1414 	pop	acc
   03E7 32                 1415 	reti
                           1416 
   03E8                    1417 ser1_isr:
   03E8 C0 E0              1418 	push	acc
   03EA C0 F0              1419 	push	b
   03EC C0 82              1420 	push	dpl0
   03EE C0 83              1421 	push	dph0
   03F0 C0 D0              1422 	push	psw
   03F2 75 D0 00           1423 	mov	psw,#0x00
   03F5 C0 86              1424 	push	dps
   03F7 75 86 00           1425 	mov	dps,#0
                           1426 	;; clear interrupt
   03FA C2 C0              1427 	clr	scon1+0
   03FC C2 C1              1428 	clr	scon1+1
                           1429 	;; handle interrupt
                           1430 	;; epilogue
   03FE D0 86              1431 	pop	dps
   0400 D0 D0              1432 	pop	psw
   0402 D0 83              1433 	pop	dph0
   0404 D0 82              1434 	pop	dpl0
   0406 D0 F0              1435 	pop	b
   0408 D0 E0              1436 	pop	acc
   040A 32                 1437 	reti
                           1438 
   040B                    1439 i2c_isr:
   040B C0 E0              1440 	push	acc
   040D C0 F0              1441 	push	b
   040F C0 82              1442 	push	dpl0
   0411 C0 83              1443 	push	dph0
   0413 C0 D0              1444 	push	psw
   0415 75 D0 00           1445 	mov	psw,#0x00
   0418 C0 86              1446 	push	dps
   041A 75 86 00           1447 	mov	dps,#0
                           1448 	;; clear interrupt
   041D E5 91              1449 	mov	a,exif
   041F C2 E5              1450 	clr	acc.5
   0421 F5 91              1451 	mov	exif,a
                           1452 	;; handle interrupt
                           1453 	;; epilogue
   0423 D0 86              1454 	pop	dps
   0425 D0 D0              1455 	pop	psw
   0427 D0 83              1456 	pop	dph0
   0429 D0 82              1457 	pop	dpl0
   042B D0 F0              1458 	pop	b
   042D D0 E0              1459 	pop	acc
   042F 32                 1460 	reti
                           1461 
   0430                    1462 int4_isr:
   0430 C0 E0              1463 	push	acc
   0432 C0 F0              1464 	push	b
   0434 C0 82              1465 	push	dpl0
   0436 C0 83              1466 	push	dph0
   0438 C0 D0              1467 	push	psw
   043A 75 D0 00           1468 	mov	psw,#0x00
   043D C0 86              1469 	push	dps
   043F 75 86 00           1470 	mov	dps,#0
                           1471 	;; clear interrupt
   0442 E5 91              1472 	mov	a,exif
   0444 C2 E6              1473 	clr	acc.6
   0446 F5 91              1474 	mov	exif,a
                           1475 	;; handle interrupt
                           1476 	;; epilogue
   0448 D0 86              1477 	pop	dps
   044A D0 D0              1478 	pop	psw
   044C D0 83              1479 	pop	dph0
   044E D0 82              1480 	pop	dpl0
   0450 D0 F0              1481 	pop	b
   0452 D0 E0              1482 	pop	acc
   0454 32                 1483 	reti
                           1484 
   0455                    1485 int5_isr:
   0455 C0 E0              1486 	push	acc
   0457 C0 F0              1487 	push	b
   0459 C0 82              1488 	push	dpl0
   045B C0 83              1489 	push	dph0
   045D C0 D0              1490 	push	psw
   045F 75 D0 00           1491 	mov	psw,#0x00
   0462 C0 86              1492 	push	dps
   0464 75 86 00           1493 	mov	dps,#0
                           1494 	;; clear interrupt
   0467 E5 91              1495 	mov	a,exif
   0469 C2 E7              1496 	clr	acc.7
   046B F5 91              1497 	mov	exif,a
                           1498 	;; handle interrupt
                           1499 	;; epilogue
   046D D0 86              1500 	pop	dps
   046F D0 D0              1501 	pop	psw
   0471 D0 83              1502 	pop	dph0
   0473 D0 82              1503 	pop	dpl0
   0475 D0 F0              1504 	pop	b
   0477 D0 E0              1505 	pop	acc
   0479 32                 1506 	reti
                           1507 
   047A                    1508 int6_isr:
   047A C0 E0              1509 	push	acc
   047C C0 F0              1510 	push	b
   047E C0 82              1511 	push	dpl0
   0480 C0 83              1512 	push	dph0
   0482 C0 D0              1513 	push	psw
   0484 75 D0 00           1514 	mov	psw,#0x00
   0487 C0 86              1515 	push	dps
   0489 75 86 00           1516 	mov	dps,#0
                           1517 	;; clear interrupt
   048C C2 DB              1518 	clr	eicon+3
                           1519 	;; handle interrupt
                           1520 	;; epilogue
   048E D0 86              1521 	pop	dps
   0490 D0 D0              1522 	pop	psw
   0492 D0 83              1523 	pop	dph0
   0494 D0 82              1524 	pop	dpl0
   0496 D0 F0              1525 	pop	b
   0498 D0 E0              1526 	pop	acc
   049A 32                 1527 	reti
                           1528 
   049B                    1529 usb_sudav_isr:
   049B C0 E0              1530 	push	acc
   049D C0 F0              1531 	push	b
   049F C0 82              1532 	push	dpl0
   04A1 C0 83              1533 	push	dph0
   04A3 C0 84              1534 	push	dpl1
   04A5 C0 85              1535 	push	dph1
   04A7 C0 D0              1536 	push	psw
   04A9 75 D0 00           1537 	mov	psw,#0x00
   04AC C0 86              1538 	push	dps
   04AE 75 86 00           1539 	mov	dps,#0
   04B1 C0 00              1540 	push	ar0
   04B3 C0 07              1541 	push	ar7
                           1542 	;; clear interrupt
   04B5 E5 91              1543 	mov	a,exif
   04B7 C2 E4              1544 	clr	acc.4
   04B9 F5 91              1545 	mov	exif,a
   04BB 90 7F AB           1546 	mov	dptr,#USBIRQ
   04BE 74 01              1547 	mov	a,#0x01
   04C0 F0                 1548 	movx	@dptr,a
                           1549 	;; handle interrupt
   04C1 75*00 00           1550 	mov	ctrlcode,#0		; reset control out code
   04C4 90 7F E9           1551 	mov	dptr,#(SETUPDAT+1)
   04C7 E0                 1552 	movx	a,@dptr			; bRequest field
                           1553 	;; standard commands
                           1554 	;; USB_REQ_GET_DESCRIPTOR
   04C8 B4 06 59           1555 	cjne	a,#USB_REQ_GET_DESCRIPTOR,cmdnotgetdesc
   04CB 90 7F E8           1556 	mov	dptr,#SETUPDAT		; bRequestType == 0x80
   04CE E0                 1557 	movx	a,@dptr
   04CF B4 80 4F           1558 	cjne	a,#USB_DIR_IN,setupstallstd
   04D2 90 7F EB           1559 	mov	dptr,#SETUPDAT+3
   04D5 E0                 1560 	movx	a,@dptr
   04D6 B4 01 0C           1561 	cjne	a,#USB_DT_DEVICE,cmdnotgetdescdev
   04D9 90 7F D4           1562 	mov	dptr,#SUDPTRH
   04DC 74s0C              1563 	mov	a,#>devicedescr
   04DE F0                 1564 	movx	@dptr,a
   04DF A3                 1565 	inc	dptr
   04E0 74rA3              1566 	mov	a,#<devicedescr
   04E2 F0                 1567 	movx	@dptr,a
   04E3 80 39              1568 	sjmp	setupackstd
   04E5                    1569 cmdnotgetdescdev:
   04E5 B4 02 12           1570 	cjne	a,#USB_DT_CONFIG,cmdnotgetdesccfg
   04E8 90 7F EA           1571 	mov	dptr,#SETUPDAT+2
   04EB E0                 1572 	movx	a,@dptr
   04EC 70 33              1573 	jnz	setupstallstd
   04EE 90 7F D4           1574 	mov	dptr,#SUDPTRH
   04F1 74s0C              1575 	mov	a,#>config0descr
   04F3 F0                 1576 	movx	@dptr,a
   04F4 A3                 1577 	inc	dptr
   04F5 74rB5              1578 	mov	a,#<config0descr
   04F7 F0                 1579 	movx	@dptr,a
   04F8 80 24              1580 	sjmp	setupackstd
   04FA                    1581 cmdnotgetdesccfg:
   04FA B4 03 24           1582 	cjne	a,#USB_DT_STRING,setupstallstd
   04FD 90 7F EA           1583 	mov	dptr,#SETUPDAT+2
   0500 E0                 1584 	movx	a,@dptr
   0501 24 FC              1585 	add	a,#-numstrings
   0503 40 1C              1586 	jc	setupstallstd
   0505 E0                 1587 	movx	a,@dptr
   0506 25 E0              1588 	add	a,acc
   0508 24rFA              1589 	add	a,#<stringdescr
   050A F5 82              1590 	mov	dpl0,a
   050C E4                 1591 	clr	a
   050D 34s0C              1592 	addc	a,#>stringdescr
   050F F5 83              1593 	mov	dph0,a
   0511 E0                 1594 	movx	a,@dptr
   0512 F5 F0              1595 	mov	b,a
   0514 A3                 1596 	inc	dptr
   0515 E0                 1597 	movx	a,@dptr
   0516 90 7F D4           1598 	mov	dptr,#SUDPTRH
   0519 F0                 1599 	movx	@dptr,a
   051A A3                 1600 	inc	dptr
   051B E5 F0              1601 	mov	a,b
   051D F0                 1602 	movx	@dptr,a
                           1603 	; sjmp	setupackstd	
   051E                    1604 setupackstd:
   051E 02s08r92           1605 	ljmp	setupack
   0521                    1606 setupstallstd:
   0521 02s08r8E           1607 	ljmp	setupstall
   0524                    1608 cmdnotgetdesc:
                           1609 	;; USB_REQ_SET_CONFIGURATION
   0524 B4 09 41           1610 	cjne	a,#USB_REQ_SET_CONFIGURATION,cmdnotsetconf
   0527 90 7F E8           1611 	mov	dptr,#SETUPDAT
   052A E0                 1612 	movx	a,@dptr
   052B 70 F4              1613 	jnz	setupstallstd
   052D 90 7F EA           1614 	mov	dptr,#SETUPDAT+2
   0530 E0                 1615 	movx	a,@dptr
   0531 24 FE              1616 	add	a,#-2
   0533 40 EC              1617 	jc	setupstallstd
   0535 E0                 1618 	movx	a,@dptr
   0536 F5*30              1619 	mov	numconfig,a
   0538                    1620 cmdresettoggleshalt:
   0538 90 7F D7           1621 	mov	dptr,#TOGCTL
   053B 78 07              1622 	mov	r0,#7
   053D E8                 1623 0$:	mov	a,r0
   053E 44 10              1624 	orl	a,#0x10
   0540 F0                 1625 	movx	@dptr,a
   0541 44 30              1626 	orl	a,#0x30
   0543 F0                 1627 	movx	@dptr,a
   0544 E8                 1628 	mov	a,r0
   0545 F0                 1629 	movx	@dptr,a
   0546 44 20              1630 	orl	a,#0x20
   0548 F0                 1631 	movx	@dptr,a
   0549 D8 F2              1632 	djnz	r0,0$
   054B E4                 1633 	clr	a
   054C F0                 1634 	movx	@dptr,a
   054D 74 02              1635 	mov	a,#2
   054F 90 7F B6           1636 	mov	dptr,#IN1CS
   0552 78 07              1637 	mov	r0,#7
   0554 F0                 1638 1$:	movx	@dptr,a
   0555 A3                 1639 	inc	dptr
   0556 A3                 1640 	inc	dptr
   0557 D8 FB              1641 	djnz	r0,1$
   0559 90 7F C6           1642 	mov	dptr,#OUT1CS
   055C 78 07              1643 	mov	r0,#7
   055E F0                 1644 2$:	movx	@dptr,a
   055F A3                 1645 	inc	dptr
   0560 A3                 1646 	inc	dptr
   0561 D8 FB              1647 	djnz	r0,2$
   0563 12s09rCF           1648 	lcall	fillusbintr
   0566 80 B6              1649 	sjmp	setupackstd
   0568                    1650 cmdnotsetconf:
                           1651 	;; USB_REQ_SET_INTERFACE
   0568 B4 0B 1A           1652 	cjne	a,#USB_REQ_SET_INTERFACE,cmdnotsetint
   056B 90 7F E8           1653 	mov	dptr,#SETUPDAT
   056E E0                 1654 	movx	a,@dptr
   056F B4 01 AF           1655 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_OUT,setupstallstd
   0572 E5*30              1656 	mov	a,numconfig
   0574 B4 01 AA           1657 	cjne	a,#1,setupstallstd
   0577 90 7F EC           1658 	mov	dptr,#SETUPDAT+4
   057A E0                 1659 	movx	a,@dptr
   057B 70 A4              1660 	jnz	setupstallstd
   057D 90 7F EA           1661 	mov	dptr,#SETUPDAT+2
   0580 E0                 1662 	movx	a,@dptr
   0581 F5*31              1663 	mov	altsetting,a
   0583 80 B3              1664 	sjmp	cmdresettoggleshalt
   0585                    1665 cmdnotsetint:
                           1666 	;; USB_REQ_GET_INTERFACE
   0585 B4 0A 20           1667 	cjne	a,#USB_REQ_GET_INTERFACE,cmdnotgetint
   0588 90 7F E8           1668 	mov	dptr,#SETUPDAT
   058B E0                 1669 	movx	a,@dptr
   058C B4 81 92           1670 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_IN,setupstallstd
   058F E5*30              1671 	mov	a,numconfig
   0591 B4 01 8D           1672 	cjne	a,#1,setupstallstd
   0594 90 7F EC           1673 	mov	dptr,#SETUPDAT+4
   0597 E0                 1674 	movx	a,@dptr
   0598 70 87              1675 	jnz	setupstallstd
   059A E5*31              1676 	mov	a,altsetting
   059C                    1677 cmdrespondonebyte:
   059C 90 7F 00           1678 	mov	dptr,#IN0BUF
   059F F0                 1679 	movx	@dptr,a
   05A0 90 7F B5           1680 	mov	dptr,#IN0BC
   05A3 74 01              1681 	mov	a,#1
   05A5 F0                 1682 	movx	@dptr,a	
   05A6 80 4E              1683 	sjmp	setupackstd2
   05A8                    1684 cmdnotgetint:
                           1685 	;; USB_REQ_GET_CONFIGURATION
   05A8 B4 08 0B           1686 	cjne	a,#USB_REQ_GET_CONFIGURATION,cmdnotgetconf
   05AB 90 7F E8           1687 	mov	dptr,#SETUPDAT
   05AE E0                 1688 	movx	a,@dptr
   05AF B4 80 47           1689 	cjne	a,#USB_RECIP_DEVICE|USB_DIR_IN,setupstallstd2
   05B2 E5*30              1690 	mov	a,numconfig
   05B4 80 E6              1691 	sjmp	cmdrespondonebyte	
   05B6                    1692 cmdnotgetconf:
                           1693 	;; USB_REQ_GET_STATUS (0)
   05B6 70 44              1694 	jnz	cmdnotgetstat
   05B8 90 7F E8           1695 	mov	dptr,#SETUPDAT
   05BB E0                 1696 	movx	a,@dptr
   05BC B4 80 11           1697 	cjne	a,#USB_RECIP_DEVICE|USB_DIR_IN,cmdnotgetstatdev
   05BF 74 01              1698 	mov	a,#1
   05C1                    1699 cmdrespondstat:
   05C1 90 7F 00           1700 	mov	dptr,#IN0BUF
   05C4 F0                 1701 	movx	@dptr,a
   05C5 A3                 1702 	inc	dptr
   05C6 E4                 1703 	clr	a
   05C7 F0                 1704 	movx	@dptr,a
   05C8 90 7F B5           1705 	mov	dptr,#IN0BC
   05CB 74 02              1706 	mov	a,#2
   05CD F0                 1707 	movx	@dptr,a	
   05CE 80 26              1708 	sjmp	setupackstd2
   05D0                    1709 cmdnotgetstatdev:
   05D0 B4 81 03           1710 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_IN,cmdnotgetstatintf
   05D3 E4                 1711 	clr	a
   05D4 80 EB              1712 	sjmp	cmdrespondstat
   05D6                    1713 cmdnotgetstatintf:
   05D6 B4 82 20           1714 	cjne	a,#USB_RECIP_ENDPOINT|USB_DIR_IN,setupstallstd2
   05D9 90 7F EC           1715 	mov	dptr,#SETUPDAT+4
   05DC E0                 1716 	movx	a,@dptr
   05DD 90 7F C4           1717 	mov	dptr,#OUT1CS-2
   05E0 30 E7 03           1718 	jnb	acc.7,0$
   05E3 90 7F B4           1719 	mov	dptr,#IN1CS-2
   05E6 54 0F              1720 0$:	anl	a,#15
   05E8 60 0F              1721 	jz	setupstallstd2
   05EA 20 E3 0C           1722 	jb	acc.3,setupstallstd2
   05ED 25 E0              1723 	add	a,acc
   05EF 25 82              1724 	add	a,dpl0
   05F1 F5 82              1725 	mov	dpl0,a
   05F3 E0                 1726 	movx	a,@dptr
   05F4 80 CB              1727 	sjmp	cmdrespondstat
   05F6                    1728 setupackstd2:
   05F6 02s08r92           1729 	ljmp	setupack
   05F9                    1730 setupstallstd2:
   05F9 02s08r8E           1731 	ljmp	setupstall
   05FC                    1732 cmdnotgetstat:
                           1733 	;; USB_REQ_SET_FEATURE
   05FC B4 03 05           1734 	cjne	a,#USB_REQ_SET_FEATURE,cmdnotsetftr
   05FF 75 F0 01           1735 	mov	b,#1
   0602 80 06              1736 	sjmp	handleftr
   0604                    1737 cmdnotsetftr:
                           1738 	;; USB_REQ_CLEAR_FEATURE
   0604 B4 01 44           1739 	cjne	a,#USB_REQ_CLEAR_FEATURE,cmdnotclrftr
   0607 75 F0 00           1740 	mov	b,#0
   060A                    1741 handleftr:
   060A 90 7F E8           1742 	mov	dptr,#SETUPDAT
   060D E0                 1743 	movx	a,@dptr
   060E B4 02 E8           1744 	cjne	a,#USB_RECIP_ENDPOINT|USB_DIR_OUT,setupstallstd2
   0611 A3                 1745 	inc	dptr
   0612 A3                 1746 	inc	dptr
   0613 E0                 1747 	movx	a,@dptr
   0614 70 E3              1748 	jnz	setupstallstd2	; not ENDPOINT_HALT feature
   0616 A3                 1749 	inc	dptr
   0617 E0                 1750 	movx	a,@dptr
   0618 70 DF              1751 	jnz	setupstallstd2
   061A A3                 1752 	inc	dptr
   061B E0                 1753 	movx	a,@dptr
   061C 90 7F C4           1754 	mov	dptr,#OUT1CS-2
   061F 30 E7 05           1755 	jnb	acc.7,0$
   0622 90 7F B4           1756 	mov	dptr,#IN1CS-2
   0625 44 10              1757 	orl	a,#0x10
   0627 20 E3 CF           1758 0$:	jb	acc.3,setupstallstd2
                           1759 	;; clear data toggle
   062A 54 1F              1760 	anl	a,#0x1f
   062C 05 86              1761 	inc	dps
   062E 90 7F D7           1762 	mov	dptr,#TOGCTL
   0631 F0                 1763 	movx	@dptr,a
   0632 44 20              1764 	orl	a,#0x20
   0634 F0                 1765 	movx	@dptr,a
   0635 54 0F              1766 	anl	a,#15
   0637 F0                 1767 	movx	@dptr,a
   0638 15 86              1768 	dec	dps	
                           1769 	;; clear/set ep halt feature
   063A 25 E0              1770 	add	a,acc
   063C 25 82              1771 	add	a,dpl0
   063E F5 82              1772 	mov	dpl0,a
   0640 E5 F0              1773 	mov	a,b
   0642 F0                 1774 	movx	@dptr,a
   0643 80 B1              1775 	sjmp	setupackstd2
                           1776 
   0645                    1777 cmdnotc0_1:
   0645 02s07r08           1778 	ljmp	cmdnotc0
   0648                    1779 setupstallc0_1:
   0648 02s08r8E           1780 	ljmp	setupstall
                           1781 	
   064B                    1782 cmdnotclrftr:
                           1783 	;; vendor specific commands
                           1784 	;; 0xc0
   064B B4 C0 F7           1785 	cjne	a,#0xc0,cmdnotc0_1
   064E 90 7F E8           1786 	mov	dptr,#SETUPDAT		; bRequestType == 0xc0
   0651 E0                 1787 	movx	a,@dptr
   0652 B4 C0 F3           1788 	cjne	a,#0xc0,setupstallc0_1
                           1789 	;; fill status buffer
   0655 E5*05              1790 	mov	a,txstate
   0657 F5 F0              1791 	mov	b,a
   0659 D2 F2              1792 	setb	b.2
   065B 45*11              1793 	orl	a,pttforce
   065D B4 00 02           1794 	cjne	a,#0,0$
   0660 C2 F2              1795 	clr	b.2
   0662 90 C0 09           1796 0$:	mov	dptr,#FSKSTAT
   0665 E0                 1797 	movx	a,@dptr
   0666 A2 E0              1798 	mov	c,acc.0
   0668 92 F3              1799 	mov	b.3,c
   066A A2*0A              1800 	mov	c,uartempty
   066C 92 F5              1801 	mov	b.5,c
   066E E4                 1802 	clr	a
   066F 90 7F 04           1803 	mov	dptr,#(IN0BUF+4)
   0672 F0                 1804 	movx	@dptr,a
                           1805 	;; bytewide elements
   0673 90 7F 00           1806 	mov	dptr,#(IN0BUF)
   0676 E5 F0              1807 	mov	a,b
   0678 F0                 1808 	movx	@dptr,a
   0679 E5*08              1809 	mov	a,txwr
   067B F4                 1810 	cpl	a
   067C 25*09              1811 	add	a,txrd
   067E 54 0F              1812 	anl	a,#(TXCHUNKS-1)
   0680 90 7F 01           1813 	mov	dptr,#(IN0BUF+1)
   0683 F0                 1814 	movx	@dptr,a
   0684 E5*14              1815 	mov	a,rxrd
   0686 F4                 1816 	cpl	a
   0687 25*13              1817 	add	a,rxwr
   0689 04                 1818 	inc	a
   068A 54 1F              1819 	anl	a,#(RXCHUNKS-1)
   068C 90 7F 02           1820 	mov	dptr,#(IN0BUF+2)
   068F F0                 1821 	movx	@dptr,a
   0690 90 C0 04           1822 	mov	dptr,#FSKRSSI
   0693 E0                 1823 	movx	a,@dptr
   0694 90 7F 03           1824 	mov	dptr,#(IN0BUF+3)
   0697 F0                 1825 	movx	@dptr,a
                           1826 	;; counter
   0698 05*04              1827 	inc	irqcount
   069A E5*04              1828 	mov	a,irqcount
   069C 90 7F 05           1829 	mov	dptr,#(IN0BUF+5)
   069F F0                 1830 	movx	@dptr,a
                           1831 	;; additional fields (HDLC state mach)
   06A0 E5*05              1832 	mov	a,txstate
   06A2 A3                 1833 	inc	dptr
   06A3 F0                 1834 	movx	@dptr,a
   06A4 E5*09              1835 	mov	a,txrd
   06A6 A3                 1836 	inc	dptr
   06A7 F0                 1837 	movx	@dptr,a
   06A8 E5*08              1838 	mov	a,txwr
   06AA A3                 1839 	inc	dptr
   06AB F0                 1840 	movx	@dptr,a
   06AC E5*0A              1841 	mov	a,txtwr
   06AE A3                 1842 	inc	dptr
   06AF F0                 1843 	movx	@dptr,a
   06B0 74 00              1844 	mov	a,#0
   06B2 A3                 1845 	inc	dptr
   06B3 F0                 1846 	movx	@dptr,a
   06B4 E5*06              1847 	mov	a,flagcnt
   06B6 A3                 1848 	inc	dptr
   06B7 F0                 1849 	movx	@dptr,a
   06B8 E5*07              1850 	mov	a,flagcnt+1
   06BA A3                 1851 	inc	dptr
   06BB F0                 1852 	movx	@dptr,a
   06BC E5*12              1853 	mov	a,rxstate
   06BE A3                 1854 	inc	dptr
   06BF F0                 1855 	movx	@dptr,a
   06C0 E5*14              1856 	mov	a,rxrd
   06C2 A3                 1857 	inc	dptr
   06C3 F0                 1858 	movx	@dptr,a
   06C4 E5*13              1859 	mov	a,rxwr
   06C6 A3                 1860 	inc	dptr
   06C7 F0                 1861 	movx	@dptr,a
   06C8 E5*15              1862 	mov	a,rxtwr
   06CA A3                 1863 	inc	dptr
   06CB F0                 1864 	movx	@dptr,a
   06CC E5*16              1865 	mov	a,rxcntc
   06CE A3                 1866 	inc	dptr
   06CF F0                 1867 	movx	@dptr,a
                           1868 	;; FPGA registers
   06D0 E5*1D              1869 	mov	a,tmprxcnt
   06D2 90 7F 12           1870 	mov	dptr,#(IN0BUF+18)
   06D5 F0                 1871 	movx	@dptr,a
   06D6 90 C0 01           1872 	mov	dptr,#FSKSHSTATUS
   06D9 E0                 1873 	movx	a,@dptr
   06DA 90 7F 13           1874 	mov	dptr,#(IN0BUF+19)
   06DD F0                 1875 	movx	@dptr,a
   06DE 90 C0 08           1876 	mov	dptr,#FSKCTRL
   06E1 E0                 1877 	movx	a,@dptr
   06E2 90 7F 14           1878 	mov	dptr,#(IN0BUF+20)
   06E5 F0                 1879 	movx	@dptr,a
   06E6 90 C0 09           1880 	mov	dptr,#FSKSTAT
   06E9 E0                 1881 	movx	a,@dptr
   06EA 90 7F 15           1882 	mov	dptr,#(IN0BUF+21)
   06ED F0                 1883 	movx	@dptr,a
                           1884 	;; Anchor Registers
   06EE 90 7F C8           1885 	mov	dptr,#OUT2CS
   06F1 E0                 1886 	movx	a,@dptr
   06F2 90 7F 16           1887 	mov	dptr,#(IN0BUF+22)
   06F5 F0                 1888 	movx	@dptr,a
                           1889 	;; set length
   06F6 90 7F EE           1890 	mov	dptr,#SETUPDAT+6	; wLength
   06F9 E0                 1891 	movx	a,@dptr
   06FA 24 E9              1892 	add	a,#-(6+12+4+1)
   06FC 50 01              1893 	jnc	4$
   06FE E4                 1894 	clr	a
   06FF 24 17              1895 4$:	add	a,#(6+12+4+1)
   0701 90 7F B5           1896 	mov	dptr,#IN0BC
   0704 F0                 1897 	movx	@dptr,a
   0705 02s08r92           1898 	ljmp	setupack
   0708                    1899 cmdnotc0:
                           1900 	;; 0xc8
   0708 B4 C8 19           1901 	cjne	a,#0xc8,cmdnotc8
   070B 90 7F E8           1902 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   070E E0                 1903 	movx	a,@dptr
   070F B4 C0 0F           1904 	cjne	a,#0xc0,setupstallc8
   0712 74 03              1905 	mov	a,#3
   0714 90 7F 00           1906 	mov	dptr,#IN0BUF
   0717 F0                 1907 	movx	@dptr,a
   0718 90 7F B5           1908 	mov	dptr,#IN0BC
   071B 74 01              1909 	mov	a,#1
   071D F0                 1910 	movx	@dptr,a
   071E 02s08r92           1911 	ljmp	setupack
   0721                    1912 setupstallc8:
   0721 02s08r8E           1913 	ljmp	setupstall
   0724                    1914 cmdnotc8:
                           1915 	;; 0xc9
   0724 B4 C9 21           1916 	cjne	a,#0xc9,cmdnotc9
   0727 90 7F E8           1917 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   072A E0                 1918 	movx	a,@dptr
   072B B4 C0 17           1919 	cjne	a,#0xc0,setupstallc9
   072E 90 7F 00           1920 	mov	dptr,#IN0BUF
   0731 78rF0              1921 	mov	r0,#parserial
   0733 E2                 1922 0$:	movx	a,@r0
   0734 60 05              1923 	jz	1$
   0736 F0                 1924 	movx	@dptr,a
   0737 08                 1925 	inc	r0
   0738 A3                 1926 	inc	dptr
   0739 80 F8              1927 	sjmp	0$
   073B E8                 1928 1$:	mov	a,r0
   073C 24 10              1929 	add	a,#-0xf0	; -parserial
   073E 90 7F B5           1930 	mov	dptr,#IN0BC
   0741 F0                 1931 	movx	@dptr,a
   0742 02s08r92           1932 	ljmp	setupack
   0745                    1933 setupstallc9:
   0745 02s08r8E           1934 	ljmp	setupstall
   0748                    1935 cmdnotc9:
                           1936 	;; 0xd0
   0748 B4 D0 4D           1937 	cjne	a,#0xd0,cmdnotd0
   074B 90 7F E8           1938 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   074E E0                 1939 	movx	a,@dptr
   074F B4 C0 43           1940 	cjne	a,#0xc0,setupstalld0
   0752 90 7F EC           1941 	mov	dptr,#SETUPDAT+4	; wIndex
   0755 E0                 1942 	movx	a,@dptr
   0756 B4 01 0A           1943 	cjne	a,#1,0$
   0759 90 7F EA           1944 	mov	dptr,#SETUPDAT+2	; wValue
   075C E0                 1945 	movx	a,@dptr
   075D 54 01              1946 	anl	a,#1
   075F F5*11              1947 	mov	pttforce,a
   0761 D2*09              1948 	setb	pttforcechg
   0763                    1949 0$:	;; PTT status
   0763 90 7F 00           1950 	mov	dptr,#IN0BUF
   0766 E5*05              1951 	mov	a,txstate
   0768 45*11              1952 	orl	a,pttforce
   076A 60 02              1953 	jz	1$
   076C 74 01              1954 	mov	a,#1
   076E F0                 1955 1$:	movx	@dptr,a
                           1956 	;; DCD status
   076F 90 C0 09           1957 	mov	dptr,#FSKSTAT
   0772 E0                 1958 	movx	a,@dptr
   0773 54 01              1959 	anl	a,#1
   0775 64 01              1960 	xrl	a,#1
   0777 90 7F 01           1961 	mov	dptr,#IN0BUF+1
   077A F0                 1962 	movx	@dptr,a
                           1963 	;; RSSI
   077B 90 C0 04           1964 	mov	dptr,#FSKRSSI
   077E E0                 1965 	movx	a,@dptr
   077F 90 7F 02           1966 	mov	dptr,#IN0BUF+2
   0782 F0                 1967 	movx	@dptr,a
                           1968 	;; length
   0783 90 7F EE           1969 	mov	dptr,#SETUPDAT+6	; wLength
   0786 E0                 1970 	movx	a,@dptr
   0787 24 FD              1971 	add	a,#-3
   0789 50 01              1972 	jnc	2$
   078B E4                 1973 	clr	a
   078C 24 03              1974 2$:	add	a,#3
   078E 90 7F B5           1975 	mov	dptr,#IN0BC
   0791 F0                 1976 	movx	@dptr,a
   0792 02s08r92           1977 	ljmp	setupack
   0795                    1978 setupstalld0:
   0795 02s08r8E           1979 	ljmp	setupstall
   0798                    1980 cmdnotd0:
                           1981 	;; 0xd1
   0798 B4 D1 29           1982 	cjne	a,#0xd1,cmdnotd1
   079B 90 7F E8           1983 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   079E E0                 1984 	movx	a,@dptr
   079F B4 C0 1F           1985 	cjne	a,#0xc0,setupstalld1
   07A2 90 7F 00           1986 	mov	dptr,#IN0BUF
   07A5 78rE0              1987 	mov	r0,#parbitratetx
   07A7 7F 06              1988 	mov	r7,#6
   07A9 E2                 1989 1$:	movx	a,@r0
   07AA F0                 1990 	movx	@dptr,a
   07AB A3                 1991 	inc	dptr
   07AC 08                 1992 	inc	r0
   07AD DF FA              1993 	djnz	r7,1$
                           1994 	;; length
   07AF 90 7F EE           1995 	mov	dptr,#SETUPDAT+6	; wLength
   07B2 E0                 1996 	movx	a,@dptr
   07B3 24 FA              1997 	add	a,#-6
   07B5 50 01              1998 	jnc	2$
   07B7 E4                 1999 	clr	a
   07B8 24 06              2000 2$:	add	a,#6
   07BA 90 7F B5           2001 	mov	dptr,#IN0BC
   07BD F0                 2002 	movx	@dptr,a
   07BE 02s08r92           2003 	ljmp	setupack
   07C1                    2004 setupstalld1:
   07C1 02s08r8E           2005 	ljmp	setupstall
   07C4                    2006 cmdnotd1:
                           2007 	;; 0xd2
   07C4 B4 D2 20           2008 	cjne	a,#0xd2,cmdnotd2
   07C7 90 7F E8           2009 	mov	dptr,#SETUPDAT	; bRequestType == 0x40
   07CA E0                 2010 	movx	a,@dptr
   07CB B4 40 16           2011 	cjne	a,#0x40,setupstalld2
   07CE 90 7F EA           2012 	mov	dptr,#SETUPDAT+2	; wValue
   07D1 E0                 2013 	movx	a,@dptr
   07D2 F5 F0              2014 	mov	b,a
   07D4 90 7F 98           2015 	mov	dptr,#OUTC
   07D7 E0                 2016 	movx	a,@dptr
   07D8 A2 F0              2017 	mov	c,b.0
   07DA 92 E3              2018 	mov	acc.3,c
   07DC A2 F1              2019 	mov	c,b.1
   07DE 92 E5              2020 	mov	acc.5,c
   07E0 F0                 2021 	movx	@dptr,a
   07E1 02s08r92           2022 	ljmp	setupack
   07E4                    2023 setupstalld2:
   07E4 02s08r8E           2024 	ljmp	setupstall
   07E7                    2025 cmdnotd2:
                           2026 	;; 0xd3
   07E7 B4 D3 16           2027 	cjne	a,#0xd3,cmdnotd3
   07EA 90 7F E8           2028 	mov	dptr,#SETUPDAT	; bRequestType == 0x40
   07ED E0                 2029 	movx	a,@dptr
   07EE B4 40 07           2030 	cjne	a,#0x40,setupstalld3
   07F1 90 7F EA           2031 	mov	dptr,#SETUPDAT+2	; wValue
   07F4 E0                 2032 	movx	a,@dptr
   07F5 10*0A 03           2033 	jbc	uartempty,cmdd2cont
   07F8                    2034 setupstalld3:
   07F8 02s08r8E           2035 	ljmp	setupstall
   07FB                    2036 cmdd2cont:
   07FB F5 99              2037 	mov	sbuf0,a
   07FD 02s08r92           2038 	ljmp	setupack
   0800                    2039 cmdnotd3:
                           2040 	;; 0xd4
   0800 B4 D4 4D           2041 	cjne	a,#0xd4,cmdnotd4
   0803 90 7F E8           2042 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   0806 E0                 2043 	movx	a,@dptr
   0807 B4 C0 43           2044 	cjne	a,#0xc0,setupstalld4
   080A 90 7F EC           2045 	mov	dptr,#SETUPDAT+4	; wIndex
   080D E0                 2046 	movx	a,@dptr
   080E 90 7F EA           2047 	mov	dptr,#SETUPDAT+2	; wValue
   0811 B4 01 07           2048 	cjne	a,#1,0$
   0814 E0                 2049 	movx	a,@dptr
   0815 90 C0 0D           2050 	mov	dptr,#FSKMDISCOUT
   0818 F0                 2051 	movx	@dptr,a
   0819 80 08              2052 	sjmp	1$
   081B B4 02 05           2053 0$:	cjne	a,#2,1$
   081E E0                 2054 	movx	a,@dptr
   081F 90 C0 0C           2055 	mov	dptr,#FSKMDISCTRIS
   0822 F0                 2056 	movx	@dptr,a
   0823 90 C0 0E           2057 1$:	mov	dptr,#FSKMDISCIN
   0826 E0                 2058 	movx	a,@dptr
   0827 90 7F 00           2059 	mov	dptr,#IN0BUF+0
   082A F0                 2060 	movx	@dptr,a
   082B 90 C0 0D           2061 	mov	dptr,#FSKMDISCOUT
   082E E0                 2062 	movx	a,@dptr
   082F 90 7F 01           2063 	mov	dptr,#IN0BUF+1
   0832 F0                 2064 	movx	@dptr,a
   0833 90 C0 0C           2065 	mov	dptr,#FSKMDISCTRIS
   0836 E0                 2066 	movx	a,@dptr
   0837 90 7F 02           2067 	mov	dptr,#IN0BUF+2
   083A F0                 2068 	movx	@dptr,a
                           2069 	;; length
   083B 90 7F EE           2070 	mov	dptr,#SETUPDAT+6	; wLength
   083E E0                 2071 	movx	a,@dptr
   083F 24 FD              2072 	add	a,#-3
   0841 50 01              2073 	jnc	2$
   0843 E4                 2074 	clr	a
   0844 24 03              2075 2$:	add	a,#3
   0846 90 7F B5           2076 	mov	dptr,#IN0BC
   0849 F0                 2077 	movx	@dptr,a
   084A 02s08r92           2078 	ljmp	setupack
   084D                    2079 setupstalld4:
   084D 02s08r8E           2080 	ljmp	setupstall
   0850                    2081 cmdnotd4:
                           2082 	;; 0xd5
   0850 B4 D5 3B           2083 	cjne	a,#0xd5,cmdnotd5
   0853 90 7F E8           2084 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   0856 E0                 2085 	movx	a,@dptr
   0857 B4 C0 31           2086 	cjne	a,#0xc0,setupstalld5
   085A 90 7F EC           2087 	mov	dptr,#SETUPDAT+4	; wIndex
   085D E0                 2088 	movx	a,@dptr
   085E B4 01 08           2089 	cjne	a,#1,0$
   0861 90 7F EA           2090 	mov	dptr,#SETUPDAT+2	; wValue
   0864 E0                 2091 	movx	a,@dptr
   0865 90 C0 0A           2092 	mov	dptr,#FSKT7FOUT
   0868 F0                 2093 	movx	@dptr,a
   0869 90 C0 0B           2094 0$:	mov	dptr,#FSKT7FIN
   086C E0                 2095 	movx	a,@dptr
   086D 90 7F 00           2096 	mov	dptr,#IN0BUF+0
   0870 F0                 2097 	movx	@dptr,a
   0871 90 C0 0A           2098 	mov	dptr,#FSKT7FOUT
   0874 E0                 2099 	movx	a,@dptr
   0875 90 7F 01           2100 	mov	dptr,#IN0BUF+1
   0878 F0                 2101 	movx	@dptr,a
                           2102 	;; length
   0879 90 7F EE           2103 	mov	dptr,#SETUPDAT+6	; wLength
   087C E0                 2104 	movx	a,@dptr
   087D 24 FE              2105 	add	a,#-2
   087F 50 01              2106 	jnc	2$
   0881 E4                 2107 	clr	a
   0882 24 02              2108 2$:	add	a,#2
   0884 90 7F B5           2109 	mov	dptr,#IN0BC
   0887 F0                 2110 	movx	@dptr,a
   0888 02s08r92           2111 	ljmp	setupack
   088B                    2112 setupstalld5:
   088B 02s08r8E           2113 	ljmp	setupstall
   088E                    2114 cmdnotd5:
                           2115 	;; unknown commands fall through to setupstall
                           2116 
   088E                    2117 setupstall:
   088E 74 03              2118 	mov	a,#3
   0890 80 02              2119 	sjmp	endsetup
   0892                    2120 setupack:
   0892 74 02              2121 	mov	a,#2
   0894                    2122 endsetup:
   0894 90 7F B4           2123 	mov	dptr,#EP0CS
   0897 F0                 2124 	movx	@dptr,a
   0898                    2125 endusbisr:
                           2126 	;; epilogue
   0898 D0 07              2127 	pop	ar7
   089A D0 00              2128 	pop	ar0
   089C D0 86              2129 	pop	dps
   089E D0 D0              2130 	pop	psw
   08A0 D0 85              2131 	pop	dph1
   08A2 D0 84              2132 	pop	dpl1
   08A4 D0 83              2133 	pop	dph0
   08A6 D0 82              2134 	pop	dpl0
   08A8 D0 F0              2135 	pop	b
   08AA D0 E0              2136 	pop	acc
   08AC 32                 2137 	reti
                           2138 
   08AD                    2139 usb_sof_isr:
   08AD C0 E0              2140 	push	acc
   08AF C0 F0              2141 	push	b
   08B1 C0 82              2142 	push	dpl0
   08B3 C0 83              2143 	push	dph0
   08B5 C0 D0              2144 	push	psw
   08B7 75 D0 00           2145 	mov	psw,#0x00
   08BA C0 86              2146 	push	dps
   08BC 75 86 00           2147 	mov	dps,#0
                           2148 	;; clear interrupt
   08BF E5 91              2149 	mov	a,exif
   08C1 C2 E4              2150 	clr	acc.4
   08C3 F5 91              2151 	mov	exif,a
   08C5 90 7F AB           2152 	mov	dptr,#USBIRQ
   08C8 74 02              2153 	mov	a,#0x02
   08CA F0                 2154 	movx	@dptr,a
                           2155 	;; handle interrupt
                           2156 	;; epilogue
   08CB D0 86              2157 	pop	dps
   08CD D0 D0              2158 	pop	psw
   08CF D0 83              2159 	pop	dph0
   08D1 D0 82              2160 	pop	dpl0
   08D3 D0 F0              2161 	pop	b
   08D5 D0 E0              2162 	pop	acc
   08D7 32                 2163 	reti
                           2164 
                           2165 
   08D8                    2166 usb_sutok_isr:
   08D8 C0 E0              2167 	push	acc
   08DA C0 F0              2168 	push	b
   08DC C0 82              2169 	push	dpl0
   08DE C0 83              2170 	push	dph0
   08E0 C0 D0              2171 	push	psw
   08E2 75 D0 00           2172 	mov	psw,#0x00
   08E5 C0 86              2173 	push	dps
   08E7 75 86 00           2174 	mov	dps,#0
                           2175 	;; clear interrupt
   08EA E5 91              2176 	mov	a,exif
   08EC C2 E4              2177 	clr	acc.4
   08EE F5 91              2178 	mov	exif,a
   08F0 90 7F AB           2179 	mov	dptr,#USBIRQ
   08F3 74 04              2180 	mov	a,#0x04
   08F5 F0                 2181 	movx	@dptr,a
                           2182 	;; handle interrupt
                           2183 	;; epilogue
   08F6 D0 86              2184 	pop	dps
   08F8 D0 D0              2185 	pop	psw
   08FA D0 83              2186 	pop	dph0
   08FC D0 82              2187 	pop	dpl0
   08FE D0 F0              2188 	pop	b
   0900 D0 E0              2189 	pop	acc
   0902 32                 2190 	reti
                           2191 
   0903                    2192 usb_suspend_isr:
   0903 C0 E0              2193 	push	acc
   0905 C0 F0              2194 	push	b
   0907 C0 82              2195 	push	dpl0
   0909 C0 83              2196 	push	dph0
   090B C0 D0              2197 	push	psw
   090D 75 D0 00           2198 	mov	psw,#0x00
   0910 C0 86              2199 	push	dps
   0912 75 86 00           2200 	mov	dps,#0
                           2201 	;; clear interrupt
   0915 E5 91              2202 	mov	a,exif
   0917 C2 E4              2203 	clr	acc.4
   0919 F5 91              2204 	mov	exif,a
   091B 90 7F AB           2205 	mov	dptr,#USBIRQ
   091E 74 08              2206 	mov	a,#0x08
   0920 F0                 2207 	movx	@dptr,a
                           2208 	;; handle interrupt
                           2209 	;; epilogue
   0921 D0 86              2210 	pop	dps
   0923 D0 D0              2211 	pop	psw
   0925 D0 83              2212 	pop	dph0
   0927 D0 82              2213 	pop	dpl0
   0929 D0 F0              2214 	pop	b
   092B D0 E0              2215 	pop	acc
   092D 32                 2216 	reti
                           2217 
   092E                    2218 usb_usbreset_isr:
   092E C0 E0              2219 	push	acc
   0930 C0 F0              2220 	push	b
   0932 C0 82              2221 	push	dpl0
   0934 C0 83              2222 	push	dph0
   0936 C0 D0              2223 	push	psw
   0938 75 D0 00           2224 	mov	psw,#0x00
   093B C0 86              2225 	push	dps
   093D 75 86 00           2226 	mov	dps,#0
                           2227 	;; clear interrupt
   0940 E5 91              2228 	mov	a,exif
   0942 C2 E4              2229 	clr	acc.4
   0944 F5 91              2230 	mov	exif,a
   0946 90 7F AB           2231 	mov	dptr,#USBIRQ
   0949 74 10              2232 	mov	a,#0x10
   094B F0                 2233 	movx	@dptr,a
                           2234 	;; handle interrupt
                           2235 	;; epilogue
   094C D0 86              2236 	pop	dps
   094E D0 D0              2237 	pop	psw
   0950 D0 83              2238 	pop	dph0
   0952 D0 82              2239 	pop	dpl0
   0954 D0 F0              2240 	pop	b
   0956 D0 E0              2241 	pop	acc
   0958 32                 2242 	reti
                           2243 
   0959                    2244 usb_ep0in_isr:
   0959 C0 E0              2245 	push	acc
   095B C0 F0              2246 	push	b
   095D C0 82              2247 	push	dpl0
   095F C0 83              2248 	push	dph0
   0961 C0 84              2249 	push	dpl1
   0963 C0 85              2250 	push	dph1
   0965 C0 D0              2251 	push	psw
   0967 75 D0 00           2252 	mov	psw,#0x00
   096A C0 86              2253 	push	dps
   096C 75 86 00           2254 	mov	dps,#0
   096F C0 00              2255 	push	ar0
   0971 C0 07              2256 	push	ar7
                           2257 	;; clear interrupt
   0973 E5 91              2258 	mov	a,exif
   0975 C2 E4              2259 	clr	acc.4
   0977 F5 91              2260 	mov	exif,a
   0979 90 7F A9           2261 	mov	dptr,#IN07IRQ
   097C 74 01              2262 	mov	a,#0x01
   097E F0                 2263 	movx	@dptr,a
                           2264 	;; handle interrupt
                           2265 
                           2266 ;ep0install:
                           2267 ;	mov	a,#3
                           2268 ;	sjmp	ep0incs
                           2269 ;ep0inack:
                           2270 ;	mov	a,#2
                           2271 ;ep0incs:
                           2272 ;	mov	dptr,#EP0CS
                           2273 ;	movx	@dptr,a
                           2274 ;ep0inendisr:
                           2275 	;; epilogue
   097F D0 07              2276 	pop	ar7
   0981 D0 00              2277 	pop	ar0
   0983 D0 86              2278 	pop	dps
   0985 D0 D0              2279 	pop	psw
   0987 D0 85              2280 	pop	dph1
   0989 D0 84              2281 	pop	dpl1
   098B D0 83              2282 	pop	dph0
   098D D0 82              2283 	pop	dpl0
   098F D0 F0              2284 	pop	b
   0991 D0 E0              2285 	pop	acc
   0993 32                 2286 	reti
                           2287 
   0994                    2288 usb_ep0out_isr:
   0994 C0 E0              2289 	push	acc
   0996 C0 F0              2290 	push	b
   0998 C0 82              2291 	push	dpl0
   099A C0 83              2292 	push	dph0
   099C C0 84              2293 	push	dpl1
   099E C0 85              2294 	push	dph1
   09A0 C0 D0              2295 	push	psw
   09A2 75 D0 00           2296 	mov	psw,#0x00
   09A5 C0 86              2297 	push	dps
   09A7 75 86 00           2298 	mov	dps,#0
   09AA C0 00              2299 	push	ar0
   09AC C0 06              2300 	push	ar6
                           2301 	;; clear interrupt
   09AE E5 91              2302 	mov	a,exif
   09B0 C2 E4              2303 	clr	acc.4
   09B2 F5 91              2304 	mov	exif,a
   09B4 90 7F AA           2305 	mov	dptr,#OUT07IRQ
   09B7 74 01              2306 	mov	a,#0x01
   09B9 F0                 2307 	movx	@dptr,a
                           2308 	;; handle interrupt
                           2309 
                           2310 ;ep0outstall:
                           2311 ;	mov	ctrlcode,#0
                           2312 ;	mov	a,#3
                           2313 ;	sjmp	ep0outcs
                           2314 ;ep0outack:
                           2315 ;	mov	txwr,txtwr
                           2316 ;	mov	ctrlcode,#0
                           2317 ;	mov	a,#2
                           2318 ;ep0outcs:
                           2319 ;	mov	dptr,#EP0CS
                           2320 ;	movx	@dptr,a
                           2321 ;ep0outendisr:
                           2322 	;; epilogue
   09BA D0 06              2323 	pop	ar6
   09BC D0 00              2324 	pop	ar0
   09BE D0 86              2325 	pop	dps
   09C0 D0 D0              2326 	pop	psw
   09C2 D0 85              2327 	pop	dph1
   09C4 D0 84              2328 	pop	dpl1
   09C6 D0 83              2329 	pop	dph0
   09C8 D0 82              2330 	pop	dpl0
   09CA D0 F0              2331 	pop	b
   09CC D0 E0              2332 	pop	acc
   09CE 32                 2333 	reti
                           2334 
   09CF                    2335 fillusbintr::
   09CF E5*05              2336 	mov	a,txstate
   09D1 F5 F0              2337 	mov	b,a
   09D3 D2 F2              2338 	setb	b.2
   09D5 45*11              2339 	orl	a,pttforce
   09D7 B4 00 02           2340 	cjne	a,#0,0$
   09DA C2 F2              2341 	clr	b.2
   09DC 90 C0 09           2342 0$:	mov	dptr,#FSKSTAT
   09DF E0                 2343 	movx	a,@dptr
   09E0 A2 E0              2344 	mov	c,acc.0
   09E2 92 F3              2345 	mov	b.3,c
   09E4 A2*0A              2346 	mov	c,uartempty
   09E6 92 F5              2347 	mov	b.5,c
   09E8 D3                 2348 	setb	c
   09E9 E5*14              2349 	mov	a,rxrd
   09EB B5*13 06           2350 	cjne	a,rxwr,1$
   09EE 90 7F B8           2351 	mov	dptr,#(IN2CS)
   09F1 E0                 2352 	movx	a,@dptr
   09F2 A2 E1              2353 	mov	c,acc.1
   09F4 92 F4              2354 1$:	mov	b.4,c
                           2355 	;; bytewide elements
   09F6 90 7E 80           2356 	mov	dptr,#(IN1BUF)
   09F9 E5 F0              2357 	mov	a,b
   09FB F0                 2358 	movx	@dptr,a
   09FC E5*08              2359 	mov	a,txwr
   09FE F4                 2360 	cpl	a
   09FF 25*09              2361 	add	a,txrd
   0A01 54 0F              2362 	anl	a,#(TXCHUNKS-1)
   0A03 90 7E 81           2363 	mov	dptr,#(IN1BUF+1)
   0A06 F0                 2364 	movx	@dptr,a
   0A07 E5*14              2365 	mov	a,rxrd
   0A09 F4                 2366 	cpl	a
   0A0A 25*13              2367 	add	a,rxwr
   0A0C 04                 2368 	inc	a
   0A0D 54 1F              2369 	anl	a,#(RXCHUNKS-1)
   0A0F 90 7E 82           2370 	mov	dptr,#(IN1BUF+2)
   0A12 F0                 2371 	movx	@dptr,a
   0A13 90 C0 04           2372 	mov	dptr,#FSKRSSI
   0A16 E0                 2373 	movx	a,@dptr
   0A17 90 7E 83           2374 	mov	dptr,#(IN1BUF+3)
   0A1A F0                 2375 	movx	@dptr,a
                           2376 	; counter
   0A1B 05*04              2377 	inc	irqcount
   0A1D E5*04              2378 	mov	a,irqcount
   0A1F 90 7E 84           2379 	mov	dptr,#(IN1BUF+4)
   0A22 F0                 2380 	movx	@dptr,a
                           2381 	; UART buffer
   0A23 75 F0 05           2382 	mov	b,#5
   0A26 90 7E 85           2383 	mov	dptr,#(IN1BUF+5)
   0A29 E5*2F              2384 2$:	mov	a,uartrd
   0A2B B5*2E 07           2385 	cjne	a,uartwr,3$
                           2386 	; set length
   0A2E 90 7F B7           2387 	mov	dptr,#IN1BC
   0A31 E5 F0              2388 	mov	a,b
   0A33 F0                 2389 	movx	@dptr,a
   0A34 22                 2390 	ret
                           2391 	
   0A35 24r1E              2392 3$:	add	a,#uartbuf
   0A37 F8                 2393 	mov	r0,a
   0A38 E6                 2394 	mov	a,@r0
   0A39 F0                 2395 	movx	@dptr,a
   0A3A A3                 2396 	inc	dptr
   0A3B 05 F0              2397 	inc	b
   0A3D E5*2F              2398 	mov	a,uartrd
   0A3F 04                 2399 	inc	a
   0A40 54 0F              2400 	anl	a,#0xf
   0A42 F5*2F              2401 	mov	uartrd,a
   0A44 80 E3              2402 	sjmp	2$
                           2403 
                           2404 	
   0A46                    2405 usb_ep1in_isr:
   0A46 C0 E0              2406 	push	acc
   0A48 C0 F0              2407 	push	b
   0A4A C0 82              2408 	push	dpl0
   0A4C C0 83              2409 	push	dph0
   0A4E C0 D0              2410 	push	psw
   0A50 75 D0 00           2411 	mov	psw,#0x00
   0A53 C0 86              2412 	push	dps
   0A55 75 86 00           2413 	mov	dps,#0
                           2414 	;; clear interrupt
   0A58 E5 91              2415 	mov	a,exif
   0A5A C2 E4              2416 	clr	acc.4
   0A5C F5 91              2417 	mov	exif,a
   0A5E 90 7F A9           2418 	mov	dptr,#IN07IRQ
   0A61 74 02              2419 	mov	a,#0x02
   0A63 F0                 2420 	movx	@dptr,a
                           2421 	;; handle interrupt
   0A64 12s09rCF           2422 	lcall	fillusbintr
                           2423 	;; epilogue
   0A67 D0 86              2424 	pop	dps
   0A69 D0 D0              2425 	pop	psw
   0A6B D0 83              2426 	pop	dph0
   0A6D D0 82              2427 	pop	dpl0
   0A6F D0 F0              2428 	pop	b
   0A71 D0 E0              2429 	pop	acc
   0A73 32                 2430 	reti
                           2431 
   0A74                    2432 usb_ep1out_isr:
   0A74 C0 E0              2433 	push	acc
   0A76 C0 F0              2434 	push	b
   0A78 C0 82              2435 	push	dpl0
   0A7A C0 83              2436 	push	dph0
   0A7C C0 D0              2437 	push	psw
   0A7E 75 D0 00           2438 	mov	psw,#0x00
   0A81 C0 86              2439 	push	dps
   0A83 75 86 00           2440 	mov	dps,#0
                           2441 	;; clear interrupt
   0A86 E5 91              2442 	mov	a,exif
   0A88 C2 E4              2443 	clr	acc.4
   0A8A F5 91              2444 	mov	exif,a
   0A8C 90 7F AA           2445 	mov	dptr,#OUT07IRQ
   0A8F 74 02              2446 	mov	a,#0x02
   0A91 F0                 2447 	movx	@dptr,a
                           2448 	;; handle interrupt
                           2449 	;; epilogue
   0A92 D0 86              2450 	pop	dps
   0A94 D0 D0              2451 	pop	psw
   0A96 D0 83              2452 	pop	dph0
   0A98 D0 82              2453 	pop	dpl0
   0A9A D0 F0              2454 	pop	b
   0A9C D0 E0              2455 	pop	acc
   0A9E 32                 2456 	reti
                           2457 
   0A9F                    2458 usb_ep2in_isr:
   0A9F C0 E0              2459 	push	acc
   0AA1 C0 F0              2460 	push	b
   0AA3 C0 82              2461 	push	dpl0
   0AA5 C0 83              2462 	push	dph0
   0AA7 C0 D0              2463 	push	psw
   0AA9 75 D0 00           2464 	mov	psw,#0x00
   0AAC C0 86              2465 	push	dps
   0AAE 75 86 00           2466 	mov	dps,#0
                           2467 	;; clear interrupt
   0AB1 E5 91              2468 	mov	a,exif
   0AB3 C2 E4              2469 	clr	acc.4
   0AB5 F5 91              2470 	mov	exif,a
   0AB7 90 7F A9           2471 	mov	dptr,#IN07IRQ
   0ABA 74 04              2472 	mov	a,#0x04
   0ABC F0                 2473 	movx	@dptr,a
                           2474 	;; handle interrupt
                           2475 	;; epilogue
   0ABD D0 86              2476 	pop	dps
   0ABF D0 D0              2477 	pop	psw
   0AC1 D0 83              2478 	pop	dph0
   0AC3 D0 82              2479 	pop	dpl0
   0AC5 D0 F0              2480 	pop	b
   0AC7 D0 E0              2481 	pop	acc
   0AC9 32                 2482 	reti
                           2483 
   0ACA                    2484 usb_ep2out_isr:
   0ACA C0 E0              2485 	push	acc
   0ACC C0 F0              2486 	push	b
   0ACE C0 82              2487 	push	dpl0
   0AD0 C0 83              2488 	push	dph0
   0AD2 C0 D0              2489 	push	psw
   0AD4 75 D0 00           2490 	mov	psw,#0x00
   0AD7 C0 86              2491 	push	dps
   0AD9 75 86 00           2492 	mov	dps,#0
                           2493 	;; clear interrupt
   0ADC E5 91              2494 	mov	a,exif
   0ADE C2 E4              2495 	clr	acc.4
   0AE0 F5 91              2496 	mov	exif,a
   0AE2 90 7F AA           2497 	mov	dptr,#OUT07IRQ
   0AE5 74 04              2498 	mov	a,#0x04
   0AE7 F0                 2499 	movx	@dptr,a
                           2500 	;; handle interrupt
                           2501 	;; epilogue
   0AE8 D0 86              2502 	pop	dps
   0AEA D0 D0              2503 	pop	psw
   0AEC D0 83              2504 	pop	dph0
   0AEE D0 82              2505 	pop	dpl0
   0AF0 D0 F0              2506 	pop	b
   0AF2 D0 E0              2507 	pop	acc
   0AF4 32                 2508 	reti
                           2509 
   0AF5                    2510 usb_ep3in_isr:
   0AF5 C0 E0              2511 	push	acc
   0AF7 C0 F0              2512 	push	b
   0AF9 C0 82              2513 	push	dpl0
   0AFB C0 83              2514 	push	dph0
   0AFD C0 D0              2515 	push	psw
   0AFF 75 D0 00           2516 	mov	psw,#0x00
   0B02 C0 86              2517 	push	dps
   0B04 75 86 00           2518 	mov	dps,#0
                           2519 	;; clear interrupt
   0B07 E5 91              2520 	mov	a,exif
   0B09 C2 E4              2521 	clr	acc.4
   0B0B F5 91              2522 	mov	exif,a
   0B0D 90 7F A9           2523 	mov	dptr,#IN07IRQ
   0B10 74 08              2524 	mov	a,#0x08
   0B12 F0                 2525 	movx	@dptr,a
                           2526 	;; handle interrupt
                           2527 	;; epilogue
   0B13 D0 86              2528 	pop	dps
   0B15 D0 D0              2529 	pop	psw
   0B17 D0 83              2530 	pop	dph0
   0B19 D0 82              2531 	pop	dpl0
   0B1B D0 F0              2532 	pop	b
   0B1D D0 E0              2533 	pop	acc
   0B1F 32                 2534 	reti
                           2535 
   0B20                    2536 usb_ep3out_isr:
   0B20 C0 E0              2537 	push	acc
   0B22 C0 F0              2538 	push	b
   0B24 C0 82              2539 	push	dpl0
   0B26 C0 83              2540 	push	dph0
   0B28 C0 D0              2541 	push	psw
   0B2A 75 D0 00           2542 	mov	psw,#0x00
   0B2D C0 86              2543 	push	dps
   0B2F 75 86 00           2544 	mov	dps,#0
                           2545 	;; clear interrupt
   0B32 E5 91              2546 	mov	a,exif
   0B34 C2 E4              2547 	clr	acc.4
   0B36 F5 91              2548 	mov	exif,a
   0B38 90 7F AA           2549 	mov	dptr,#OUT07IRQ
   0B3B 74 08              2550 	mov	a,#0x08
   0B3D F0                 2551 	movx	@dptr,a
                           2552 	;; handle interrupt
                           2553 	;; epilogue
   0B3E D0 86              2554 	pop	dps
   0B40 D0 D0              2555 	pop	psw
   0B42 D0 83              2556 	pop	dph0
   0B44 D0 82              2557 	pop	dpl0
   0B46 D0 F0              2558 	pop	b
   0B48 D0 E0              2559 	pop	acc
   0B4A 32                 2560 	reti
                           2561 
   0B4B                    2562 usb_ep4in_isr:
   0B4B C0 E0              2563 	push	acc
   0B4D C0 F0              2564 	push	b
   0B4F C0 82              2565 	push	dpl0
   0B51 C0 83              2566 	push	dph0
   0B53 C0 D0              2567 	push	psw
   0B55 75 D0 00           2568 	mov	psw,#0x00
   0B58 C0 86              2569 	push	dps
   0B5A 75 86 00           2570 	mov	dps,#0
                           2571 	;; clear interrupt
   0B5D E5 91              2572 	mov	a,exif
   0B5F C2 E4              2573 	clr	acc.4
   0B61 F5 91              2574 	mov	exif,a
   0B63 90 7F A9           2575 	mov	dptr,#IN07IRQ
   0B66 74 10              2576 	mov	a,#0x10
   0B68 F0                 2577 	movx	@dptr,a
                           2578 	;; handle interrupt
                           2579 	;; epilogue
   0B69 D0 86              2580 	pop	dps
   0B6B D0 D0              2581 	pop	psw
   0B6D D0 83              2582 	pop	dph0
   0B6F D0 82              2583 	pop	dpl0
   0B71 D0 F0              2584 	pop	b
   0B73 D0 E0              2585 	pop	acc
   0B75 32                 2586 	reti
                           2587 
   0B76                    2588 usb_ep4out_isr:
   0B76 C0 E0              2589 	push	acc
   0B78 C0 F0              2590 	push	b
   0B7A C0 82              2591 	push	dpl0
   0B7C C0 83              2592 	push	dph0
   0B7E C0 D0              2593 	push	psw
   0B80 75 D0 00           2594 	mov	psw,#0x00
   0B83 C0 86              2595 	push	dps
   0B85 75 86 00           2596 	mov	dps,#0
                           2597 	;; clear interrupt
   0B88 E5 91              2598 	mov	a,exif
   0B8A C2 E4              2599 	clr	acc.4
   0B8C F5 91              2600 	mov	exif,a
   0B8E 90 7F AA           2601 	mov	dptr,#OUT07IRQ
   0B91 74 10              2602 	mov	a,#0x10
   0B93 F0                 2603 	movx	@dptr,a
                           2604 	;; handle interrupt
                           2605 	;; epilogue
   0B94 D0 86              2606 	pop	dps
   0B96 D0 D0              2607 	pop	psw
   0B98 D0 83              2608 	pop	dph0
   0B9A D0 82              2609 	pop	dpl0
   0B9C D0 F0              2610 	pop	b
   0B9E D0 E0              2611 	pop	acc
   0BA0 32                 2612 	reti
                           2613 
   0BA1                    2614 usb_ep5in_isr:
   0BA1 C0 E0              2615 	push	acc
   0BA3 C0 F0              2616 	push	b
   0BA5 C0 82              2617 	push	dpl0
   0BA7 C0 83              2618 	push	dph0
   0BA9 C0 D0              2619 	push	psw
   0BAB 75 D0 00           2620 	mov	psw,#0x00
   0BAE C0 86              2621 	push	dps
   0BB0 75 86 00           2622 	mov	dps,#0
                           2623 	;; clear interrupt
   0BB3 E5 91              2624 	mov	a,exif
   0BB5 C2 E4              2625 	clr	acc.4
   0BB7 F5 91              2626 	mov	exif,a
   0BB9 90 7F A9           2627 	mov	dptr,#IN07IRQ
   0BBC 74 20              2628 	mov	a,#0x20
   0BBE F0                 2629 	movx	@dptr,a
                           2630 	;; handle interrupt
                           2631 	;; epilogue
   0BBF D0 86              2632 	pop	dps
   0BC1 D0 D0              2633 	pop	psw
   0BC3 D0 83              2634 	pop	dph0
   0BC5 D0 82              2635 	pop	dpl0
   0BC7 D0 F0              2636 	pop	b
   0BC9 D0 E0              2637 	pop	acc
   0BCB 32                 2638 	reti
                           2639 
   0BCC                    2640 usb_ep5out_isr:
   0BCC C0 E0              2641 	push	acc
   0BCE C0 F0              2642 	push	b
   0BD0 C0 82              2643 	push	dpl0
   0BD2 C0 83              2644 	push	dph0
   0BD4 C0 D0              2645 	push	psw
   0BD6 75 D0 00           2646 	mov	psw,#0x00
   0BD9 C0 86              2647 	push	dps
   0BDB 75 86 00           2648 	mov	dps,#0
                           2649 	;; clear interrupt
   0BDE E5 91              2650 	mov	a,exif
   0BE0 C2 E4              2651 	clr	acc.4
   0BE2 F5 91              2652 	mov	exif,a
   0BE4 90 7F AA           2653 	mov	dptr,#OUT07IRQ
   0BE7 74 20              2654 	mov	a,#0x20
   0BE9 F0                 2655 	movx	@dptr,a
                           2656 	;; handle interrupt
                           2657 	;; epilogue
   0BEA D0 86              2658 	pop	dps
   0BEC D0 D0              2659 	pop	psw
   0BEE D0 83              2660 	pop	dph0
   0BF0 D0 82              2661 	pop	dpl0
   0BF2 D0 F0              2662 	pop	b
   0BF4 D0 E0              2663 	pop	acc
   0BF6 32                 2664 	reti
                           2665 
   0BF7                    2666 usb_ep6in_isr:
   0BF7 C0 E0              2667 	push	acc
   0BF9 C0 F0              2668 	push	b
   0BFB C0 82              2669 	push	dpl0
   0BFD C0 83              2670 	push	dph0
   0BFF C0 D0              2671 	push	psw
   0C01 75 D0 00           2672 	mov	psw,#0x00
   0C04 C0 86              2673 	push	dps
   0C06 75 86 00           2674 	mov	dps,#0
                           2675 	;; clear interrupt
   0C09 E5 91              2676 	mov	a,exif
   0C0B C2 E4              2677 	clr	acc.4
   0C0D F5 91              2678 	mov	exif,a
   0C0F 90 7F A9           2679 	mov	dptr,#IN07IRQ
   0C12 74 40              2680 	mov	a,#0x40
   0C14 F0                 2681 	movx	@dptr,a
                           2682 	;; handle interrupt
                           2683 	;; epilogue
   0C15 D0 86              2684 	pop	dps
   0C17 D0 D0              2685 	pop	psw
   0C19 D0 83              2686 	pop	dph0
   0C1B D0 82              2687 	pop	dpl0
   0C1D D0 F0              2688 	pop	b
   0C1F D0 E0              2689 	pop	acc
   0C21 32                 2690 	reti
                           2691 
   0C22                    2692 usb_ep6out_isr:
   0C22 C0 E0              2693 	push	acc
   0C24 C0 F0              2694 	push	b
   0C26 C0 82              2695 	push	dpl0
   0C28 C0 83              2696 	push	dph0
   0C2A C0 D0              2697 	push	psw
   0C2C 75 D0 00           2698 	mov	psw,#0x00
   0C2F C0 86              2699 	push	dps
   0C31 75 86 00           2700 	mov	dps,#0
                           2701 	;; clear interrupt
   0C34 E5 91              2702 	mov	a,exif
   0C36 C2 E4              2703 	clr	acc.4
   0C38 F5 91              2704 	mov	exif,a
   0C3A 90 7F AA           2705 	mov	dptr,#OUT07IRQ
   0C3D 74 40              2706 	mov	a,#0x40
   0C3F F0                 2707 	movx	@dptr,a
                           2708 	;; handle interrupt
                           2709 	;; epilogue
   0C40 D0 86              2710 	pop	dps
   0C42 D0 D0              2711 	pop	psw
   0C44 D0 83              2712 	pop	dph0
   0C46 D0 82              2713 	pop	dpl0
   0C48 D0 F0              2714 	pop	b
   0C4A D0 E0              2715 	pop	acc
   0C4C 32                 2716 	reti
                           2717 
   0C4D                    2718 usb_ep7in_isr:
   0C4D C0 E0              2719 	push	acc
   0C4F C0 F0              2720 	push	b
   0C51 C0 82              2721 	push	dpl0
   0C53 C0 83              2722 	push	dph0
   0C55 C0 D0              2723 	push	psw
   0C57 75 D0 00           2724 	mov	psw,#0x00
   0C5A C0 86              2725 	push	dps
   0C5C 75 86 00           2726 	mov	dps,#0
                           2727 	;; clear interrupt
   0C5F E5 91              2728 	mov	a,exif
   0C61 C2 E4              2729 	clr	acc.4
   0C63 F5 91              2730 	mov	exif,a
   0C65 90 7F A9           2731 	mov	dptr,#IN07IRQ
   0C68 74 80              2732 	mov	a,#0x80
   0C6A F0                 2733 	movx	@dptr,a
                           2734 	;; handle interrupt
                           2735 	;; epilogue
   0C6B D0 86              2736 	pop	dps
   0C6D D0 D0              2737 	pop	psw
   0C6F D0 83              2738 	pop	dph0
   0C71 D0 82              2739 	pop	dpl0
   0C73 D0 F0              2740 	pop	b
   0C75 D0 E0              2741 	pop	acc
   0C77 32                 2742 	reti
                           2743 
   0C78                    2744 usb_ep7out_isr:
   0C78 C0 E0              2745 	push	acc
   0C7A C0 F0              2746 	push	b
   0C7C C0 82              2747 	push	dpl0
   0C7E C0 83              2748 	push	dph0
   0C80 C0 D0              2749 	push	psw
   0C82 75 D0 00           2750 	mov	psw,#0x00
   0C85 C0 86              2751 	push	dps
   0C87 75 86 00           2752 	mov	dps,#0
                           2753 	;; clear interrupt
   0C8A E5 91              2754 	mov	a,exif
   0C8C C2 E4              2755 	clr	acc.4
   0C8E F5 91              2756 	mov	exif,a
   0C90 90 7F AA           2757 	mov	dptr,#OUT07IRQ
   0C93 74 80              2758 	mov	a,#0x80
   0C95 F0                 2759 	movx	@dptr,a
                           2760 	;; handle interrupt
                           2761 	;; epilogue
   0C96 D0 86              2762 	pop	dps
   0C98 D0 D0              2763 	pop	psw
   0C9A D0 83              2764 	pop	dph0
   0C9C D0 82              2765 	pop	dpl0
   0C9E D0 F0              2766 	pop	b
   0CA0 D0 E0              2767 	pop	acc
   0CA2 32                 2768 	reti
                           2769 
                           2770 	;; -----------------------------------------------------
                           2771 	;; USB descriptors
                           2772 	;; -----------------------------------------------------
                           2773 
                           2774 	;; Device and/or Interface Class codes
                    0000   2775 	USB_CLASS_PER_INTERFACE         = 0
                    0001   2776 	USB_CLASS_AUDIO                 = 1
                    0002   2777 	USB_CLASS_COMM                  = 2
                    0003   2778 	USB_CLASS_HID                   = 3
                    0007   2779 	USB_CLASS_PRINTER               = 7
                    0008   2780 	USB_CLASS_MASS_STORAGE          = 8
                    0009   2781 	USB_CLASS_HUB                   = 9
                    00FF   2782 	USB_CLASS_VENDOR_SPEC           = 0xff
                           2783 
                           2784 	;; Descriptor types
                    0001   2785 	USB_DT_DEVICE                   = 0x01
                    0002   2786 	USB_DT_CONFIG                   = 0x02
                    0003   2787 	USB_DT_STRING                   = 0x03
                    0004   2788 	USB_DT_INTERFACE                = 0x04
                    0005   2789 	USB_DT_ENDPOINT                 = 0x05
                           2790 
                           2791 	;; Standard requests
                    0000   2792 	USB_REQ_GET_STATUS              = 0x00
                    0001   2793 	USB_REQ_CLEAR_FEATURE           = 0x01
                    0003   2794 	USB_REQ_SET_FEATURE             = 0x03
                    0005   2795 	USB_REQ_SET_ADDRESS             = 0x05
                    0006   2796 	USB_REQ_GET_DESCRIPTOR          = 0x06
                    0007   2797 	USB_REQ_SET_DESCRIPTOR          = 0x07
                    0008   2798 	USB_REQ_GET_CONFIGURATION       = 0x08
                    0009   2799 	USB_REQ_SET_CONFIGURATION       = 0x09
                    000A   2800 	USB_REQ_GET_INTERFACE           = 0x0A
                    000B   2801 	USB_REQ_SET_INTERFACE           = 0x0B
                    000C   2802 	USB_REQ_SYNCH_FRAME             = 0x0C
                           2803 
                           2804 	;; USB Request Type and Endpoint Directions
                    0000   2805 	USB_DIR_OUT                     = 0
                    0080   2806 	USB_DIR_IN                      = 0x80
                           2807 
                    0000   2808 	USB_TYPE_STANDARD               = (0x00 << 5)
                    0020   2809 	USB_TYPE_CLASS                  = (0x01 << 5)
                    0040   2810 	USB_TYPE_VENDOR                 = (0x02 << 5)
                    0060   2811 	USB_TYPE_RESERVED               = (0x03 << 5)
                           2812 
                    0000   2813 	USB_RECIP_DEVICE                = 0x00
                    0001   2814 	USB_RECIP_INTERFACE             = 0x01
                    0002   2815 	USB_RECIP_ENDPOINT              = 0x02
                    0003   2816 	USB_RECIP_OTHER                 = 0x03
                           2817 
                           2818 	;; Request target types.
                    0000   2819 	USB_RT_DEVICE                   = 0x00
                    0001   2820 	USB_RT_INTERFACE                = 0x01
                    0002   2821 	USB_RT_ENDPOINT                 = 0x02
                           2822 
                    BAC0   2823 	VENDID	= 0xbac0
                    6136   2824 	PRODID	= 0x6136
                           2825 
   0CA3                    2826 devicedescr:
   0CA3 12                 2827 	.db	18			; bLength
   0CA4 01                 2828 	.db	USB_DT_DEVICE		; bDescriptorType
   0CA5 00 01              2829 	.db	0x00, 0x01		; bcdUSB
   0CA7 FF                 2830 	.db	USB_CLASS_VENDOR_SPEC	; bDeviceClass
   0CA8 00                 2831 	.db	0			; bDeviceSubClass
   0CA9 FF                 2832 	.db	0xff			; bDeviceProtocol
   0CAA 40                 2833 	.db	0x40			; bMaxPacketSize0
   0CAB C0 BA              2834 	.db	<VENDID,>VENDID		; idVendor
   0CAD 36 61              2835 	.db	<PRODID,>PRODID		; idProduct
   0CAF 01 00              2836 	.db	0x01,0x00		; bcdDevice
   0CB1 01                 2837 	.db	1			; iManufacturer
   0CB2 02                 2838 	.db	2			; iProduct
   0CB3 03                 2839 	.db	3			; iSerialNumber
   0CB4 01                 2840 	.db	1			; bNumConfigurations
                           2841 
   0CB5                    2842 config0descr:
   0CB5 09                 2843 	.db	9			; bLength
   0CB6 02                 2844 	.db	USB_DT_CONFIG		; bDescriptorType
   0CB7 45 00              2845 	.db	<config0sz,>config0sz	; wTotalLength
   0CB9 01                 2846 	.db	1			; bNumInterfaces
   0CBA 01                 2847 	.db	1			; bConfigurationValue
   0CBB 00                 2848 	.db	0			; iConfiguration
   0CBC 40                 2849 	.db	0b01000000		; bmAttributs (self powered)
   0CBD 00                 2850 	.db	0			; MaxPower (mA/2) (self powered so 0)
                           2851 	;; interface descriptor I0:A0
   0CBE 09                 2852 	.db	9			; bLength
   0CBF 04                 2853 	.db	USB_DT_INTERFACE	; bDescriptorType
   0CC0 00                 2854 	.db	0			; bInterfaceNumber
   0CC1 00                 2855 	.db	0			; bAlternateSetting
   0CC2 03                 2856 	.db	3			; bNumEndpoints
   0CC3 FF                 2857 	.db	0xff			; bInterfaceClass (vendor specific)
   0CC4 00                 2858 	.db	0x00			; bInterfaceSubClass
   0CC5 FF                 2859 	.db	0xff			; bInterfaceProtocol (vendor specific)
   0CC6 00                 2860 	.db	0			; iInterface
                           2861 	;; endpoint descriptor I0:A0:E0
   0CC7 07                 2862 	.db	7			; bLength
   0CC8 05                 2863 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CC9 81                 2864 	.db	(USB_DIR_IN | 1)	; bEndpointAddress
   0CCA 02                 2865 	.db	0x02			; bmAttributes (bulk)
   0CCB 40 00              2866 	.db	0x40,0x00		; wMaxPacketSize
   0CCD 00                 2867 	.db	0			; bInterval
                           2868 	;; endpoint descriptor I0:A0:E1
   0CCE 07                 2869 	.db	7			; bLength
   0CCF 05                 2870 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CD0 82                 2871 	.db	(USB_DIR_IN | 2)	; bEndpointAddress
   0CD1 02                 2872 	.db	0x02			; bmAttributes (bulk)
   0CD2 40 00              2873 	.db	0x40,0x00		; wMaxPacketSize
   0CD4 00                 2874 	.db	0			; bInterval
                           2875 	;; endpoint descriptor I0:A0:E2
   0CD5 07                 2876 	.db	7			; bLength
   0CD6 05                 2877 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CD7 02                 2878 	.db	(USB_DIR_OUT | 2)	; bEndpointAddress
   0CD8 02                 2879 	.db	0x02			; bmAttributes (bulk)
   0CD9 40 00              2880 	.db	0x40,0x00		; wMaxPacketSize
   0CDB 00                 2881 	.db	0			; bInterval
                           2882 	;; interface descriptor I0:A1
   0CDC 09                 2883 	.db	9			; bLength
   0CDD 04                 2884 	.db	USB_DT_INTERFACE	; bDescriptorType
   0CDE 00                 2885 	.db	0			; bInterfaceNumber
   0CDF 01                 2886 	.db	1			; bAlternateSetting
   0CE0 03                 2887 	.db	3			; bNumEndpoints
   0CE1 FF                 2888 	.db	0xff			; bInterfaceClass (vendor specific)
   0CE2 00                 2889 	.db	0x00			; bInterfaceSubClass
   0CE3 FF                 2890 	.db	0xff			; bInterfaceProtocol (vendor specific)
   0CE4 00                 2891 	.db	0			; iInterface
                           2892 	;; endpoint descriptor I0:A1:E0
   0CE5 07                 2893 	.db	7			; bLength
   0CE6 05                 2894 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CE7 81                 2895 	.db	(USB_DIR_IN | 1)	; bEndpointAddress
   0CE8 03                 2896 	.db	0x03			; bmAttributes (interrupt)
   0CE9 40 00              2897 	.db	0x40,0x00		; wMaxPacketSize
   0CEB 0A                 2898 	.db	10			; bInterval
                           2899 	;; endpoint descriptor I0:A1:E1
   0CEC 07                 2900 	.db	7			; bLength
   0CED 05                 2901 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CEE 82                 2902 	.db	(USB_DIR_IN | 2)	; bEndpointAddress
   0CEF 02                 2903 	.db	0x02			; bmAttributes (bulk)
   0CF0 40 00              2904 	.db	0x40,0x00		; wMaxPacketSize
   0CF2 00                 2905 	.db	0			; bInterval
                           2906 	;; endpoint descriptor I0:A1:E2
   0CF3 07                 2907 	.db	7			; bLength
   0CF4 05                 2908 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CF5 02                 2909 	.db	(USB_DIR_OUT | 2)	; bEndpointAddress
   0CF6 02                 2910 	.db	0x02			; bmAttributes (bulk)
   0CF7 40 00              2911 	.db	0x40,0x00		; wMaxPacketSize
   0CF9 00                 2912 	.db	0			; bInterval
                           2913 
                    0045   2914 config0sz = . - config0descr
                           2915 
   0CFA                    2916 stringdescr:
   0CFAr02s0D              2917 	.db	<string0,>string0
   0CFCr06s0D              2918 	.db	<string1,>string1
   0CFEr14s0D              2919 	.db	<string2,>string2
   0D00r32s0D              2920 	.db	<stringserial,>stringserial
                           2921 
                    0004   2922 numstrings = (. - stringdescr)/2
                           2923 
   0D02                    2924 string0:
   0D02 04                 2925 	.db	string0sz		; bLength
   0D03 03                 2926 	.db	USB_DT_STRING		; bDescriptorType
   0D04 00 00              2927 	.db	0,0			; LANGID[0]: Lang Neutral
                    0004   2928 string0sz = . - string0
                           2929 
   0D06                    2930 string1:
   0D06 0E                 2931 	.db	string1sz		; bLength
   0D07 03                 2932 	.db	USB_DT_STRING		; bDescriptorType
   0D08 42 00 61 00 79 00  2933 	.db	'B,0,'a,0,'y,0,'c,0,'o,0,'m,0
        63 00 6F 00 6D 00
                    000E   2934 string1sz = . - string1
                           2935 
   0D14                    2936 string2:
   0D14 1E                 2937 	.db	string2sz		; bLength
   0D15 03                 2938 	.db	USB_DT_STRING		; bDescriptorType
   0D16 55 00 53 00 42 00  2939 	.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
   0D26 28 00 41 00 46 00  2940 	.db	'(,0,'A,0,'F,0,'S,0,'K,0,'),0
        53 00 4B 00 29 00
                    001E   2941 string2sz = . - string2
                           2942 
   0D32                    2943 stringserial:
   0D32 02                 2944 	.db	2			; bLength
   0D33 03                 2945 	.db	USB_DT_STRING		; bDescriptorType
   0D34 00 00 00 00 00 00  2946 	.dw	0,0,0,0,0,0,0,0
        00 00 00 00 00 00
        00 00 00 00
   0D44 00 00 00 00 00 00  2947 	.dw	0,0,0,0,0,0,0,0
        00 00 00 00 00 00
        00 00 00 00
                           2948 
