                              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: 1 (MODE_FSK) or 2 (MODE_EXTERNAL)
                             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
                    C001    247 	FSKRXCNT	= 0xc001
                    C002    248 	FSKRXDATA	= 0xc002
                    C003    249 	FSKRXFLAG	= 0xc003
                    C000    250 	FSKTXCNT	= 0xc000
                    C000    251 	FSKTXDATA	= 0xc000
                    C001    252 	FSKTXCRC	= 0xc001
                    C002    253 	FSKTXRAW	= 0xc002
                    C003    254 	FSKTXRAWCLR	= 0xc003
                    C004    255 	FSKRSSI		= 0xc004
                    C008    256 	FSKCTRL		= 0xc008
                    C009    257 	FSKSTAT		= 0xc009
                    C00A    258 	FSKT7FOUT	= 0xc00a
                    C00B    259 	FSKT7FIN	= 0xc00b
                    C00C    260 	FSKMDISCTRIS	= 0xc00c
                    C00D    261 	FSKMDISCOUT	= 0xc00d
                    C00E    262 	FSKMDISCIN	= 0xc00e
                            263 
                            264 	;; -----------------------------------------------------
                            265 
                            266 	.area CODE (CODE)
   0000 02s00r00            267 	ljmp	startup
   0003 02s02r93            268 	ljmp	int0_isr
   0006                     269 	.ds	5
   000B 02s02rB4            270 	ljmp	timer0_isr
   000E                     271 	.ds	5
   0013 02s02rD5            272 	ljmp	int1_isr
   0016                     273 	.ds	5
   001B 02s02rF6            274 	ljmp	timer1_isr
   001E                     275 	.ds	5
   0023 02s03r17            276 	ljmp	ser0_isr
   0026                     277 	.ds	5
   002B 02s03r55            278 	ljmp	timer2_isr
   002E                     279 	.ds	5
   0033 02s03r76            280 	ljmp	resume_isr
   0036                     281 	.ds	5
   003B 02s03r97            282 	ljmp	ser1_isr
   003E                     283 	.ds	5
   0043 02s01r00            284 	ljmp	usb_isr
   0046                     285 	.ds	5
   004B 02s03rBA            286 	ljmp	i2c_isr
   004E                     287 	.ds	5
   0053 02s03rDF            288 	ljmp	int4_isr
   0056                     289 	.ds	5
   005B 02s04r04            290 	ljmp	int5_isr
   005E                     291 	.ds	5
   0063 02s04r29            292 	ljmp	int6_isr
                            293 
                            294 	;; Parameter block at 0xe0
   0066                     295 	.ds	0x7a
   00E0 00 00 00            296 parbitratetx:	.db	0,0,0
   00E3 00 00 00            297 parbitraterx:	.db	0,0,0
   00E6 00                  298 parextmodem:	.db	0
   00E7 01                  299 parpttmute:	.db	1
                            300 
                            301 	;; Serial# string at 0xf0
   00E8                     302 	.ds	8
   00F0                     303 parserial:
   00F0 30 30 30 30 30 30   304 	.db	'0,'0,'0,'0,'0,'0,'0,'0,0
        30 30 00
   00F9                     305 	.ds	7
                            306 
                            307 	;; USB interrupt dispatch table
   0100                     308 usb_isr:
   0100 02s04r4A            309 	ljmp	usb_sudav_isr
   0103                     310 	.ds	1
   0104 02s08r78            311 	ljmp	usb_sof_isr
   0107                     312 	.ds	1
   0108 02s08rA3            313 	ljmp	usb_sutok_isr
   010B                     314 	.ds	1
   010C 02s08rCE            315 	ljmp	usb_suspend_isr
   010F                     316 	.ds	1
   0110 02s08rF9            317 	ljmp	usb_usbreset_isr
   0113                     318 	.ds	1
   0114 32                  319 	reti
   0115                     320 	.ds	3
   0118 02s09r24            321 	ljmp	usb_ep0in_isr
   011B                     322 	.ds	1
   011C 02s09r5F            323 	ljmp	usb_ep0out_isr
   011F                     324 	.ds	1
   0120 02s0Ar20            325 	ljmp	usb_ep1in_isr
   0123                     326 	.ds	1
   0124 02s0Ar4E            327 	ljmp	usb_ep1out_isr
   0127                     328 	.ds	1
   0128 02s0Ar79            329 	ljmp	usb_ep2in_isr
   012B                     330 	.ds	1
   012C 02s0ArA4            331 	ljmp	usb_ep2out_isr
   012F                     332 	.ds	1
   0130 02s0ArCF            333 	ljmp	usb_ep3in_isr
   0133                     334 	.ds	1
   0134 02s0ArFA            335 	ljmp	usb_ep3out_isr
   0137                     336 	.ds	1
   0138 02s0Br25            337 	ljmp	usb_ep4in_isr
   013B                     338 	.ds	1
   013C 02s0Br50            339 	ljmp	usb_ep4out_isr
   013F                     340 	.ds	1
   0140 02s0Br7B            341 	ljmp	usb_ep5in_isr
   0143                     342 	.ds	1
   0144 02s0BrA6            343 	ljmp	usb_ep5out_isr
   0147                     344 	.ds	1
   0148 02s0BrD1            345 	ljmp	usb_ep6in_isr
   014B                     346 	.ds	1
   014C 02s0BrFC            347 	ljmp	usb_ep6out_isr
   014F                     348 	.ds	1
   0150 02s0Cr27            349 	ljmp	usb_ep7in_isr
   0153                     350 	.ds	1
   0154 02s0Cr52            351 	ljmp	usb_ep7out_isr
                            352 
                            353 	;; -----------------------------------------------------
                            354 
                    0020    355 	RXCHUNKS = 32
                    0010    356 	TXCHUNKS = 16
                            357 
                    0000    358 	DEBUGIOCOPY	= 0
                    0000    359 	DEBUGRECEIVER	= 0
                            360 	
                            361 	.area	OSEG (OVR,DATA)
                            362 	.area	BSEG (BIT)
   0000                     363 ctrl_ptt:	.ds	1
   0001                     364 ctrl_pttmute:	.ds	1
   0002                     365 ctrl_ledptt:	.ds	1
   0003                     366 ctrl_leddcdsrc:	.ds	1
   0004                     367 ctrl_clksel:	.ds	1	; not implemented
   0005                     368 ctrl_indacd:	.ds	1
   0006                     369 ctrl_indacz:	.ds	1
   0007                     370 ctrl_txdsrc:	.ds	1
                    0020    371 ctrlreg		=	0x20	; ((ctrl_ptt/8)+0x20)
                            372 
   0008                     373 extmodem:	.ds	1
   0009                     374 pttmute:	.ds	1
   000A                     375 pttforcechg:	.ds	1
   000B                     376 uartempty:	.ds	1
                            377 		
                            378 	.area	ISEG (DATA)
   0000                     379 txbcnt:		.ds	TXCHUNKS
   0010                     380 rxbcnt:		.ds	RXCHUNKS
   0030                     381 stack:		.ds	0x80-RXCHUNKS-TXCHUNKS
                            382 	
                            383 	.area	DSEG (DATA)
   0000                     384 ctrlcode:	.ds	1
   0001                     385 ctrlcount:	.ds	2
   0003                     386 leddiv:		.ds	1
   0004                     387 irqcount:	.ds	1
                            388 	;; transmitter variables
   0005                     389 txstate:	.ds	1
   0006                     390 flagcnt:	.ds	2
   0008                     391 txwr:		.ds	1
   0009                     392 txrd:		.ds	1
   000A                     393 txtwr:		.ds	1
   000B                     394 txcnt:		.ds	1
   000C                     395 txaddr:		.ds	2
   000E                     396 txbptr:		.ds	1
   000F                     397 txskip:		.ds	1
   0010                     398 pttforce:	.ds	1
                            399 	;; receiver variables
   0011                     400 rxstate:	.ds	1
   0012                     401 rxwr:		.ds	1
   0013                     402 rxrd:		.ds	1
   0014                     403 rxtwr:		.ds	1
   0015                     404 rxcnt:		.ds	1
   0016                     405 rxcntc:		.ds	1
   0017                     406 rxaddr:		.ds	2
                            407 
   0019                     408 tmprxcnt:	.ds	1
                            409 
                            410 	;; UART receiver
   001A                     411 uartbuf:	.ds	16
   002A                     412 uartwr:		.ds	1
   002B                     413 uartrd:		.ds	1
                            414 
                            415 	;; Port state
   002C                     416 t7fout:		.ds	1
   002D                     417 mdisctris:	.ds	1
   002E                     418 mdiscout:	.ds	1
                            419 	
                            420 	;; USB state
   002F                     421 numconfig:	.ds	1
   0030                     422 altsetting:	.ds	1
                            423 
                            424 	.area	XSEG (DATA)
   0000                     425 txbuf:	.ds	TXCHUNKS*64
   0400                     426 rxbuf:	.ds	RXCHUNKS*64
                            427 
                            428 
                            429 	.area	GSINIT (CODE)
   0000                     430 startup:
   0000 75 81r30            431 	mov	sp,#stack	; -1
   0003 E4                  432 	clr	a
   0004 F5 D0               433 	mov	psw,a
   0006 F5 86               434 	mov	dps,a
                            435 	;lcall	__sdcc_external_startup
                            436 	;mov	a,dpl0
                            437 	;jz	__sdcc_init_data
                            438 	;ljmp	__sdcc_program_startup
   0008                     439 __sdcc_init_data:
                            440 
                            441 	.area	GSINIT2 (CODE)
   0000                     442 __sdcc_program_startup:
                            443 	;; assembler code startup
   0000 E4                  444 	clr	a
   0001 F5*05               445 	mov	txstate,a
   0003 F5*08               446 	mov	txwr,a
   0005 F5*09               447 	mov	txrd,a
   0007 F5*0A               448 	mov	txtwr,a
   0009 F5*10               449 	mov	pttforce,a
   000B F5*11               450 	mov	rxstate,a
   000D F5*12               451 	mov	rxwr,a
   000F F5*13               452 	mov	rxrd,a
   0011 F5*14               453 	mov	rxtwr,a
   0013 F5*04               454  	mov	irqcount,a
   0015 F5*2B               455 	mov	uartrd,a
   0017 F5*2A               456 	mov	uartwr,a
   0019 F5 86               457 	mov	dps,a
   001B D2*0B               458 	setb	uartempty
                            459 	;; some indirect register setup
   001D 75 8E 30            460 	mov	ckcon,#0x30	; zero external wait states, to avoid chip bugs
                            461 	;; Timer setup:
                            462 	;; timer 0: LED blink    : T0M=0, CT0=0, MODE0=1
                            463 	;; timer 1: Baudrate gen : T1M=1, CT1=0, MODE1=2
   0020 75 89 21            464 	mov	tmod,#0x21
   0023 75 88 55            465 	mov	tcon,#0x55	; INT0/INT1 edge
   0026 75 8D 64            466 	mov	th1,#256-156	; 1200 bauds
   0029 75 87 00            467 	mov	pcon,#0		; SMOD0=0
                            468 	;; init USB subsystem
   002C 90 7F A1            469 	mov	dptr,#ISOCTL
   002F 74 01               470 	mov	a,#1		; disable ISO endpoints
   0031 F0                  471 	movx	@dptr,a
   0032 90 7F AF            472 	mov	dptr,#USBBAV
   0035 74 01               473 	mov	a,#1		; enable autovector, disable breakpoint logic
   0037 F0                  474 	movx	@dptr,a
   0038 E4                  475 	clr	a
   0039 90 7F E0            476 	mov	dptr,#INISOVAL
   003C F0                  477 	movx	@dptr,a
   003D 90 7F E1            478 	mov	dptr,#OUTISOVAL
   0040 F0                  479 	movx	@dptr,a
   0041 90 7F DD            480 	mov	dptr,#USBPAIR
   0044 74 09               481 	mov	a,#0x9		; pair EP 2&3 for input & output
   0046 F0                  482 	movx	@dptr,a
   0047 90 7F DE            483 	mov	dptr,#IN07VAL
   004A 74 07               484 	mov	a,#0x7		; enable EP0+EP1+EP2
   004C F0                  485 	movx	@dptr,a
   004D 90 7F DF            486 	mov	dptr,#OUT07VAL
   0050 74 05               487 	mov	a,#0x5		; enable EP0+EP2
   0052 F0                  488 	movx	@dptr,a
                            489 	;; USB:	init endpoint toggles
   0053 90 7F D7            490 	mov	dptr,#TOGCTL
   0056 74 12               491 	mov	a,#0x12
   0058 F0                  492 	movx	@dptr,a
   0059 74 32               493 	mov	a,#0x32		; clear EP 2 in toggle
   005B F0                  494 	movx	@dptr,a
   005C 74 02               495 	mov	a,#0x02
   005E F0                  496 	movx	@dptr,a
   005F 74 22               497 	mov	a,#0x22		; clear EP 2 out toggle
   0061 F0                  498 	movx	@dptr,a
                            499 	;; configure IO ports
   0062 90 7F 93            500 	mov	dptr,#PORTACFG
   0065 74 00               501 	mov	a,#0
   0067 F0                  502 	movx	@dptr,a
   0068 90 7F 96            503 	mov	dptr,#OUTA
   006B 74 82               504 	mov	a,#0x82		; set PROG hi
   006D F0                  505 	movx	@dptr,a
   006E 90 7F 9C            506 	mov	dptr,#OEA
   0071 74 C2               507 	mov	a,#0xc2		; out: TMS,TDI,PROG  in: DONE
   0073 F0                  508 	movx	@dptr,a
   0074 90 7F 94            509 	mov	dptr,#PORTBCFG
   0077 74 00               510 	mov	a,#0
   0079 F0                  511 	movx	@dptr,a
   007A 90 7F 9D            512 	mov	dptr,#OEB
   007D 74 00               513 	mov	a,#0
   007F F0                  514 	movx	@dptr,a
   0080 90 7F 95            515 	mov	dptr,#PORTCCFG
   0083 74 C3               516 	mov	a,#0xc3		; RD/WR/TXD0/RXD0 are special function pins
   0085 F0                  517 	movx	@dptr,a
   0086 90 7F 98            518 	mov	dptr,#OUTC
   0089 74 28               519 	mov	a,#0x28
   008B F0                  520 	movx	@dptr,a
   008C 90 7F 9E            521 	mov	dptr,#OEC
   008F 74 2A               522 	mov	a,#0x2a		; out: LEDCON,LEDSTA,TCK  in: TDO,INIT
   0091 F0                  523 	movx	@dptr,a
                            524 	;; enable interrupts
   0092 75 A8 92            525 	mov	ie,#0x92	; enable timer 0 and ser 0 int
   0095 75 E8 01            526 	mov	eie,#0x01	; enable USB interrupts
   0098 90 7F AE            527 	mov	dptr,#USBIEN
   009B 74 01               528 	mov	a,#1		; enable SUDAV interrupt
   009D F0                  529 	movx	@dptr,a
   009E 90 7F AC            530 	mov	dptr,#IN07IEN
   00A1 74 03               531 	mov	a,#3		; enable EP0+EP1 interrupt
   00A3 F0                  532 	movx	@dptr,a
   00A4 90 7F AD            533 	mov	dptr,#OUT07IEN
   00A7 74 01               534 	mov	a,#1		; enable EP0 interrupt
   00A9 F0                  535 	movx	@dptr,a
                            536 	;; initialize UART 0 for T7F communication
   00AA 75 98 52            537 	mov	scon0,#0x52	; Mode 1, Timer 1, Receiver enable
                            538 	;; Copy serial number
   00AD 78rF0               539 	mov	r0,#parserial
   00AF 90s0Dr0C            540 	mov	dptr,#stringserial+2
   00B2 E2                  541 1$:	movx	a,@r0
   00B3 60 06               542 	jz	2$
   00B5 F0                  543 	movx	@dptr,a
   00B6 A3                  544 	inc	dptr
   00B7 A3                  545 	inc	dptr
   00B8 08                  546 	inc	r0
   00B9 80 F7               547 	sjmp	1$
   00BB E8                  548 2$:	mov	a,r0
   00BC 24 11               549 	add	a,#1-0xf0	; 1-parserial
   00BE 25 E0               550 	add	a,acc
   00C0 90s0Dr0A            551 	mov	dptr,#stringserial
   00C3 F0                  552 	movx	@dptr,a
                            553 	;; copy configuration to bit addressable variables
   00C4                     554 cpyconfig:
   00C4 75 20 42            555 	mov	ctrlreg,#0x42
   00C7 78rE6               556 	mov	r0,#parextmodem
   00C9 E2                  557 	movx	a,@r0
   00CA A2 E0               558 	mov	c,acc.0
   00CC 92*08               559 	mov	extmodem,c
   00CE 92*07               560 	mov	ctrl_txdsrc,c
   00D0 92*03               561 	mov	ctrl_leddcdsrc,c
   00D2 78rE7               562 	mov	r0,#parpttmute
   00D4 E2                  563 	movx	a,@r0
   00D5 A2 E0               564 	mov	c,acc.0
   00D7 92*09               565 	mov	pttmute,c
   00D9 92*01               566 	mov	ctrl_pttmute,c
                            567 	;; turn off transmitter
   00DB E5 20               568 	mov	a,ctrlreg
   00DD 90 C0 08            569 	mov	dptr,#FSKCTRL
   00E0 F0                  570 	movx	@dptr,a
                            571 	;; send reset pulse to external modem if selected
   00E1 90 C0 0C            572 	mov	dptr,#FSKMDISCTRIS
   00E4 74 FF               573 	mov	a,#0xff
   00E6 F0                  574 	movx	@dptr,a
   00E7 F5*2D               575 	mov	mdisctris,a
   00E9 30*08 09            576 	jnb	extmodem,3$
   00EC 74 67               577 	mov	a,#0x67		; RESET, RTS and TxD are outputs
   00EE F0                  578 	movx	@dptr,a
   00EF 90 C0 0D            579 	mov	dptr,#FSKMDISCOUT
   00F2 74 7F               580 	mov	a,#0x7f		; activate RESET
   00F4 F0                  581 	movx	@dptr,a
   00F5                     582 3$:
   00F5 90 C0 0A            583 	mov	dptr,#FSKT7FOUT
   00F8 74 1F               584 	mov	a,#0x1f
   00FA F0                  585 	movx	@dptr,a
   00FB F5*2C               586 	mov	t7fout,a
                            587 	;; initialize USB state
   00FD E4                  588 	clr	a
   00FE F5*2F               589 	mov	numconfig,a
   0100 F5*30               590 	mov	altsetting,a
                            591 	;; give Windows a chance to finish the writecpucs control transfer
                            592 	;; 20ms delay loop
   0102 90 D1 20            593 	mov	dptr,#(-12000)&0xffff
   0105 A3                  594 2$:	inc	dptr		; 3 cycles
   0106 E5 82               595 	mov	a,dpl0		; 2 cycles
   0108 45 83               596 	orl	a,dph0		; 2 cycles
   010A 70 F9               597 	jnz	2$		; 3 cycles
                    0001    598 	.if	1
                            599 	;; disconnect from USB bus
   010C 90 7F D6            600 	mov	dptr,#USBCS
   010F 74 0A               601 	mov	a,#10
   0111 F0                  602 	movx	@dptr,a
                            603 	;; wait 0.3 sec
   0112 7A 1E               604 	mov	r2,#30
                            605 	;; 10ms delay loop
   0114 90 E8 90            606 0$:	mov	dptr,#(-6000)&0xffff
   0117 A3                  607 1$:	inc	dptr            ; 3 cycles
   0118 E5 82               608 	mov	a,dpl0          ; 2 cycles
   011A 45 83               609 	orl	a,dph0          ; 2 cycles
   011C 70 F9               610 	jnz	1$              ; 3 cycles
   011E DA F4               611 	djnz	r2,0$
                            612 	;; reconnect to USB bus
   0120 90 7F D6            613 	mov	dptr,#USBCS
                            614 	;mov	a,#2		; 8051 handles control
                            615 	;movx	@dptr,a
   0123 74 06               616 	mov	a,#6		; reconnect, 8051 handles control
   0125 F0                  617 	movx	@dptr,a
                            618 	.endif
                            619 	;; terminate reset pulse to external modem if selected
   0126 30*08 08            620 	jnb	extmodem,4$
   0129 90 C0 0D            621 	mov	dptr,#FSKMDISCOUT
   012C 74 FF               622 	mov	a,#0xff		; deactivate RESET
   012E F0                  623 	movx	@dptr,a
   012F F5*2E               624 	mov	mdiscout,a
   0131                     625 4$:
                            626 	;; preinit RAM for debugging purposes (optional)
                    0000    627 	.if	0
                            628 inittxbuf:
                            629 	mov	r7,#TXCHUNKS
                            630 	mov	dptr,#txbuf
                            631 	mov	a,#0x55+1
                            632 0$:	mov	r6,#64
                            633 1$:	movx	@dptr,a
                            634 	inc	dptr
                            635 	djnz	r6,1$
                            636 	djnz	r7,0$
                            637 	.endif
                    0000    638 	.if	0
                            639 initrxbuf:
                            640 	mov	r7,#RXCHUNKS
                            641 	mov	dptr,#rxbuf
                            642 	mov	a,#0xaa
                            643 0$:	mov	r6,#64
                            644 1$:	movx	@dptr,a
                            645 	inc	dptr
                            646 	djnz	r6,1$
                            647 	djnz	r7,0$
                            648 	.endif
                            649 
                            650 	;; final
   0131 12s09r9A            651 	lcall	fillusbintr
                            652 	;; kludge; first OUT2 packet seems to be bogus
                            653 	;; wait for packet with length 1 and contents 0x55
   0134                     654 waitpkt1:
   0134 90 7F C8            655 	mov	dptr,#OUT2CS
   0137 E0                  656 	movx	a,@dptr
   0138 20 E1 F9            657 	jb	acc.1,waitpkt1
   013B 90 7F C9            658 	mov	dptr,#OUT2BC
   013E E0                  659 	movx	a,@dptr
   013F B4 01 0D            660 	cjne	a,#1,0$
   0142 90 7D C0            661 	mov	dptr,#OUT2BUF
   0145 E0                  662 	movx	a,@dptr
   0146 B4 55 06            663 	cjne	a,#0x55,0$
   0149 90 7F C9            664 	mov	dptr,#OUT2BC
   014C F0                  665 	movx	@dptr,a
   014D 80 06               666 	sjmp	pkt1received
   014F 90 7F C9            667 0$:	mov	dptr,#OUT2BC
   0152 F0                  668 	movx	@dptr,a
   0153 80 DF               669 	sjmp	waitpkt1
                            670 	;; clear RX FIFO
   0155                     671 pkt1received:
   0155 90 C0 03            672 	mov	dptr,#FSKRXFLAG
   0158 7F 40               673 	mov	r7,#64
   015A E0                  674 1$:	movx	a,@dptr
   015B DF FD               675 	djnz	r7,1$
                            676 	;; start normal operation
   015D 02s00r37            677 	ljmp	mainloop
                            678 
                            679 	.area	CSEG (CODE)
                    0002    680 	ar2 = 0x02
                    0003    681 	ar3 = 0x03
                    0004    682 	ar4 = 0x04
                    0005    683 	ar5 = 0x05
                    0006    684 	ar6 = 0x06
                    0007    685 	ar7 = 0x07
                    0000    686 	ar0 = 0x00
                    0001    687 	ar1 = 0x01
                            688 
                            689 	;; WARNING!  The assembler doesn't check for
                            690 	;; out of range short jump labels!! Double check
                            691 	;; that the jump labels are within the range!
                            692 	
   0000                     693 setptt:	
   0000 E5*05               694 	mov	a,txstate
   0002 45*10               695 	orl	a,pttforce
   0004 60 18               696 	jz	pttoff
                            697 
   0006                     698 ptton:
   0006 A2*08               699 	mov	c,extmodem
   0008 50 06               700 	jnc	0$
   000A 90 C0 0D            701 	mov	dptr,#FSKMDISCOUT
   000D 74 EF               702 	mov	a,#0xef
   000F F0                  703 	movx	@dptr,a
   0010 92*01               704 0$:	mov	ctrl_pttmute,c
   0012 B3                  705 	cpl	c
   0013 92*00               706 	mov	ctrl_ptt,c
   0015 D2*02               707 	setb	ctrl_ledptt
   0017 E5 20               708 	mov	a,ctrlreg
   0019 90 C0 08            709 	mov	dptr,#FSKCTRL
   001C F0                  710 	movx	@dptr,a
   001D 22                  711 	ret
                            712 
   001E                     713 pttoff:
   001E C2*00               714 	clr	ctrl_ptt
   0020 A2*08               715 	mov	c,extmodem
   0022 50 06               716 	jnc	3$
   0024 90 C0 0D            717 	mov	dptr,#FSKMDISCOUT
   0027 74 FF               718 	mov	a,#0xff
   0029 F0                  719 	movx	@dptr,a
   002A 72*09               720 3$:	orl	c,pttmute
   002C 92*01               721 	mov	ctrl_pttmute,c
   002E C2*02               722 	clr	ctrl_ledptt
   0030 E5 20               723 	mov	a,ctrlreg
   0032 90 C0 08            724 	mov	dptr,#FSKCTRL
   0035 F0                  725 	movx	@dptr,a
   0036 22                  726 	ret
                            727 
   0037                     728 mainloop:
                            729 	;; debug: copyloop
                    0000    730 	.if	DEBUGIOCOPY
                            731 iocopyloop:
                            732 	mov	a,txrd
                            733 	cjne	a,txwr,0$
                            734 	ljmp	iocopyloop
                            735 1$:	mov	a,@r0
                            736 	mov	@r1,a
                            737 	jz	3$
                            738 	mov	r7,a
                            739 4$:	inc	dps
                            740 	movx	a,@dptr
                            741 	inc	dptr
                            742 	dec	dps
                            743 	movx	@dptr,a
                            744 	inc	dptr
                            745 	djnz	r7,4$
                            746 3$:	mov	a,txrd
                            747 	inc	a
                            748 	anl	a,#(TXCHUNKS-1)
                            749 	mov	txrd,a
                            750 	mov	a,@r0
                            751 	add	a,#-0x40
                            752 	jc	5$
                            753 	mov	rxwr,rxtwr
                            754 5$:	ljmp	iocopyloop
                            755 0$:	;; txpointers
                            756 	add	a,#txbcnt
                            757 	mov	r0,a
                    0001    758 	.if	1
                            759 	mov	a,txrd
                            760 	rr	a
                            761 	rr	a
                            762 	mov	dpl1,a
                            763 	anl	a,#0xc0
                            764 	add	a,#<txbuf
                            765 	xch	a,dpl1
                            766 	anl	a,#0x3f
                            767 	addc	a,#>txbuf
                            768 	mov	dph1,a
                            769 	.else
                            770 	mov	a,txrd
                            771 	rr	a
                            772 	rr	a
                            773 	mov	dpl1,a
                            774 	anl	a,#0xc0
                            775 	xch	a,dpl1
                            776 	anl	a,#0x3f
                            777 	add	a,#>txbuf
                            778 	mov	dph1,a
                            779 	.endif
                            780 	;; rxpointers
                            781 	mov	a,rxtwr
                            782 	add	a,#rxbcnt
                            783 	mov	r1,a
                    0001    784 	.if	1
                            785 	mov	a,rxtwr
                            786 	rr	a
                            787 	rr	a
                            788 	mov	dpl0,a
                            789 	anl	a,#0xc0
                            790 	add	a,#<rxbuf
                            791 	xch	a,dpl0
                            792 	anl	a,#0x3f
                            793 	addc	a,#>rxbuf
                            794 	mov	dph0,a
                            795 	.else
                            796 	mov	a,rxtwr
                            797 	rr	a
                            798 	rr	a
                            799 	mov	dpl0,a
                            800 	anl	a,#0xc0
                            801 	xch	a,dpl0
                            802 	anl	a,#0x3f
                            803 	add	a,#>rxbuf
                            804 	mov	dph0,a
                            805 	.endif
                            806 	;; update rxpointer
                            807 	mov	a,rxtwr
                            808 	inc	a
                            809 	anl	a,#(RXCHUNKS-1)
                            810 	mov	rxtwr,a
                            811 	cjne	a,rxrd,1$
                            812 	ljmp	iocopyloop
                            813 	.endif
                            814 	;; first do TX
   0037                     815 txstartloop:
                            816 	;; check if idle or new packet
   0037 E5*05               817 	mov	a,txstate
   0039 60 06               818 	jz	txchknewpkt
   003B B4 02 52            819 	cjne	a,#2,txflagprepare
   003E 02s00rF8            820 	ljmp	txchunkstart
   0041                     821 txchknewpkt:
   0041 E5*08               822 	mov	a,txwr
   0043 B5*09 0C            823 	cjne	a,txrd,txbufnempty
   0046 10*0A 03            824 	jbc	pttforcechg,txidlepttforce
   0049                     825 rxstartloop1:
   0049 02s01r5C            826 	ljmp	rxstartloop
   004C                     827 txidlepttforce:
   004C 12s00r00            828 	lcall	setptt
   004F 02s01r5C            829 	ljmp	rxstartloop
   0052                     830 txbufnempty:
                            831 	;; start txdelay
                            832 	;; check length of first packet
   0052 E5*09               833 	mov	a,txrd
   0054 24r00               834 	add	a,#txbcnt
   0056 F8                  835 	mov	r0,a
   0057 E6                  836 	mov	a,@r0
   0058 24 FC               837 	add	a,#-4
   005A 40 03               838 	jc	1$
   005C 02s01r41            839 	ljmp	txnextpacket
   005F                     840 1$:
                            841 	;; read the number of flags to send from the first two bytes of the first packet
                    0001    842 	.if	1
   005F E5*09               843 	mov	a,txrd
   0061 03                  844 	rr	a
   0062 03                  845 	rr	a
   0063 F5 82               846 	mov	dpl0,a
   0065 54 C0               847 	anl	a,#0xc0
   0067 24r00               848 	add	a,#<txbuf
   0069 C5 82               849 	xch	a,dpl0
   006B 54 3F               850 	anl	a,#0x3f
   006D 34s00               851 	addc	a,#>txbuf
   006F F5 83               852 	mov	dph0,a
                            853 	.else
                            854 	mov	a,txrd
                            855 	rr	a
                            856 	rr	a
                            857 	mov	dpl0,a
                            858 	anl	a,#0xc0
                            859 	xch	a,dpl0
                            860 	anl	a,#0x3f
                            861 	add	a,#>txbuf
                            862 	mov	dph0,a
                            863 	.endif
   0071 E0                  864 	movx	a,@dptr
   0072 F5*06               865 	mov	flagcnt,a
   0074 A3                  866 	inc	dptr
   0075 E0                  867 	movx	a,@dptr
   0076 F5*07               868 	mov	flagcnt+1,a
   0078 05*05               869 	inc	txstate
   007A 75*0F 02            870 	mov	txskip,#2
                            871 	;; sanity check (limit txdelay to about 8s)
   007D 78rE2               872 	mov	r0,#parbitratetx+2
   007F E2                  873 	movx	a,@r0
   0080 70 0B               874 	jnz	2$
   0082 78rE1               875 	mov	r0,#parbitratetx+1
   0084 E2                  876 	movx	a,@r0
   0085 C3                  877 	clr	c
   0086 95*07               878 	subb	a,flagcnt+1
   0088 50 03               879 	jnc	2$
   008A E2                  880 	movx	a,@r0
   008B F5*07               881 	mov	flagcnt+1,a
   008D                     882 2$:
                            883 	;; turn on PTT
   008D 12s00r06            884 	lcall	ptton
                            885 	;; flag send routine
   0090                     886 txflagprepare:
   0090 90 C0 00            887 	mov	dptr,#FSKTXCNT
   0093 E0                  888 	movx	a,@dptr
   0094 60 B3               889 	jz	rxstartloop1
   0096 FF                  890 	mov	r7,a
                            891 	;; check if tx ready if external modem
   0097 90 C0 0E            892 	mov	dptr,#FSKMDISCIN
   009A E0                  893 	movx	a,@dptr
   009B 90 C0 03            894 	mov	dptr,#FSKTXRAWCLR
   009E A2 E5               895 	mov	c,acc.5
   00A0 82*08               896 	anl	c,extmodem
   00A2 40 28               897 	jc	txflgcntbig
                            898 	;clr	c
   00A4 E5*06               899 	mov	a,flagcnt
   00A6 FE                  900 	mov	r6,a
   00A7 9F                  901 	subb	a,r7
   00A8 F5*06               902 	mov	flagcnt,a
   00AA E5*07               903 	mov	a,flagcnt+1
   00AC 94 00               904 	subb	a,#0
   00AE F5*07               905 	mov	flagcnt+1,a
   00B0 50 1A               906 	jnc	txflgcntbig
                            907 	;; send final flags, update state
   00B2 EE                  908 	mov	a,r6
   00B3 60 05               909 	jz	1$
   00B5 74 7E               910 	mov	a,#0x7e
   00B7 F0                  911 0$:	movx	@dptr,a
   00B8 DE FD               912 	djnz	r6,0$
   00BA E5*05               913 1$:	mov	a,txstate
   00BC 04                  914 	inc	a
   00BD 54 03               915 	anl	a,#3
   00BF F5*05               916 	mov	txstate,a
   00C1 70 06               917 	jnz	2$
                            918 	;; turn off PTT
   00C3 12s00r00            919 	lcall	setptt
   00C6 02s01r5C            920 	ljmp	rxstartloop
   00C9 02s00rD4            921 2$:	ljmp	txnewchunk
                            922 	;; send txdelay flags
   00CC                     923 txflgcntbig:
   00CC 74 7E               924 	mov	a,#0x7e
   00CE F0                  925 0$:	movx	@dptr,a
   00CF DF FD               926 	djnz	r7,0$
   00D1                     927 rxstartloop2:
   00D1 02s01r5C            928 	ljmp	rxstartloop
                            929 
   00D4                     930 txnewchunk:
   00D4 E5*09               931 	mov	a,txrd
   00D6 24r00               932 	add	a,#txbcnt
   00D8 F5*0E               933 	mov	txbptr,a
   00DA F8                  934 	mov	r0,a
   00DB E6                  935 	mov	a,@r0
   00DC F4                  936 	cpl	a
   00DD 04                  937 	inc	a
   00DE 25*0F               938 	add	a,txskip
   00E0 40 5F               939 	jc	txnextpacket
   00E2 F5*0B               940 	mov	txcnt,a
                    0001    941 	.if	1
   00E4 E5*09               942 	mov	a,txrd
   00E6 03                  943 	rr	a
   00E7 03                  944 	rr	a
   00E8 F5*0C               945 	mov	txaddr,a
   00EA 54 C0               946 	anl	a,#0xc0
   00EC 25*0F               947 	add	a,txskip
   00EE 24r00               948 	add	a,#<txbuf
   00F0 C5*0C               949 	xch	a,txaddr
   00F2 54 3F               950 	anl	a,#0x3f
   00F4 34s00               951 	addc	a,#>txbuf
   00F6 F5*0D               952 	mov	txaddr+1,a
                            953 	.else
                            954 	mov	a,txrd
                            955 	rr	a
                            956 	rr	a
                            957 	mov	txaddr,a
                            958 	anl	a,#0xc0
                            959 	add	a,txskip
                            960 	xch	a,txaddr
                            961 	anl	a,#0x3f
                            962 	add	a,#>txbuf
                            963 	mov	txaddr+1,a
                            964 	.endif
   00F8                     965 txchunkstart:
   00F8 90 C0 00            966 	mov	dptr,#FSKTXCNT
   00FB E0                  967 	movx	a,@dptr
   00FC 60 D3               968 	jz	rxstartloop2
   00FE FF                  969 	mov	r7,a
   00FF E5*0B               970 	mov	a,txcnt
   0101 60 25               971 	jz	txchunkend
   0103 2F                  972 	add	a,r7
   0104 C5*0B               973 	xch	a,txcnt
   0106 50 06               974 	jnc	0$
   0108 F4                  975 	cpl	a
   0109 04                  976 	inc	a
   010A FF                  977 	mov	r7,a
   010B 75*0B 00            978 	mov	txcnt,#0
   010E 90 C0 00            979 0$:	mov	dptr,#FSKTXDATA
   0111 85*0C 84            980 	mov	dpl1,txaddr
   0114 85*0D 85            981 	mov	dph1,txaddr+1
   0117 05 86               982 1$:	inc	dps
   0119 E0                  983 	movx	a,@dptr
   011A A3                  984 	inc	dptr
   011B 15 86               985 	dec	dps
   011D F0                  986 	movx	@dptr,a
   011E DF F7               987 	djnz	r7,1$
   0120 85 84*0C            988 	mov	txaddr,dpl1
   0123 85 85*0D            989 	mov	txaddr+1,dph1
   0126 80 D0               990 	sjmp	txchunkstart
   0128                     991 txchunkend:
   0128 75*0F 00            992 	mov	txskip,#0
   012B A8*0E               993 	mov	r0,txbptr
   012D E6                  994 	mov	a,@r0
   012E 20 E6 13            995 	jb	acc.6,txnonewframe
   0131 EF                  996 	mov	a,r7
   0132 24 FD               997 	add	a,#-3
   0134 50 9B               998 	jnc	rxstartloop2
   0136 90 C0 01            999 	mov	dptr,#FSKTXCRC
   0139 F0                 1000 	movx	@dptr,a
   013A F0                 1001 	movx	@dptr,a
   013B 90 C0 03           1002 	mov	dptr,#FSKTXRAWCLR
   013E 74 7E              1003 	mov	a,#0x7e
   0140 F0                 1004 	movx	@dptr,a
   0141                    1005 txnextpacket:
   0141 75*0F 02           1006 	mov	txskip,#2
   0144                    1007 txnonewframe:
   0144 E5*09              1008 	mov	a,txrd
   0146 04                 1009 	inc	a
   0147 54 0F              1010 	anl	a,#TXCHUNKS-1
   0149 F5*09              1011 	mov	txrd,a
   014B B5*08 86           1012 	cjne	a,txwr,txnewchunk
   014E 05*05              1013 	inc	txstate
                           1014 	;; note: we need to stuff in more than 32 flags, to fill the buffer
                           1015 	;; (so we don't turn off PTT too early)
   0150 75*06 28           1016 	mov	flagcnt,#40
   0153 75*07 00           1017 	mov	flagcnt+1,#0
   0156 02s00r90           1018 	ljmp	txflagprepare
                           1019 
                    0000   1020 	.if	DEBUGRECEIVER
                           1021 rxstartloop:
                           1022 	mov	dptr,#FSKRXCNT
                           1023 	movx	a,@dptr
                           1024 	mov	tmprxcnt,a
                           1025 	inc	dpl0
                           1026 	add	a,#-16
                           1027 	jnc	2$
                    0001   1028 	.if	1
                           1029 	mov	a,rxwr
                           1030 	rr	a
                           1031 	rr	a
                           1032 	mov	dpl1,a
                           1033 	anl	a,#0xc0
                           1034 	add	a,#<rxbuf
                           1035 	xch	a,dpl1
                           1036 	anl	a,#0x3f
                           1037 	addc	a,#>rxbuf
                           1038 	mov	dph1,a
                           1039 	.else
                           1040 	mov	a,rxwr
                           1041 	rr	a
                           1042 	rr	a
                           1043 	mov	dpl1,a
                           1044 	anl	a,#0xc0
                           1045 	xch	a,dpl1
                           1046 	anl	a,#0x3f
                           1047 	add	a,#>rxbuf
                           1048 	mov	dph1,a	
                           1049 	.endif
                           1050 	mov	a,rxwr
                           1051 	add	a,#rxbcnt
                           1052 	mov	r0,a
                           1053 	mov	r7,#0
                           1054 0$:	movx	a,@dptr
                           1055 	jb	acc.5,1$
                           1056 	inc	dps
                           1057 	movx	@dptr,a
                           1058 	inc	dptr
                           1059 	dec	dps
                           1060 	inc	r7
                           1061 	jb	acc.7,0$
                           1062 	movx	a,@dptr
                           1063 	inc	dps
                           1064 	movx	@dptr,a
                           1065 	inc	dptr
                           1066 	dec	dps
                           1067 	inc	r7
                           1068 	sjmp	0$
                           1069 1$:	mov	@r0,ar7
                           1070 	mov	a,rxwr
                           1071 	inc	a
                           1072 	anl	a,#RXCHUNKS-1
                           1073 	mov	rxwr,a
                           1074 	mov	rxtwr,a
                           1075 2$:	ljmp	txstartloop
                           1076 	
                           1077 	.else
                           1078 	
   0159                    1079 usbiostart1:
   0159 02s01rFE           1080 	ljmp	usbiostart
                           1081 	;; real receiver starts here
   015C                    1082 rxstartloop:
   015C 90 C0 02           1083 	mov	dptr,#FSKRXDATA
   015F E5*11              1084 	mov	a,rxstate
   0161 70 32              1085 	jnz	rxdataloopstart
                           1086 	;; hunt for flags
   0163 80 01              1087 	sjmp	$1
   0165 E0                 1088 $0:	movx	a,@dptr		; read data value
   0166 E0                 1089 $1:	movx	a,@dptr		; read control value
   0167 20 E5 EF           1090 	jb	acc.5,usbiostart1
   016A 30 E7 F8           1091 	jnb	acc.7,$0
   016D                    1092 rxpreparepkt:
   016D 75*16 00           1093 	mov	rxcntc,#0
   0170 75*11 01           1094 	mov	rxstate,#1
   0173 E5*12              1095 	mov	a,rxwr
   0175 F5*14              1096 	mov	rxtwr,a
   0177                    1097 rxnewchunk:
                    0001   1098 	.if	1
   0177 E5*14              1099 	mov	a,rxtwr
   0179 03                 1100 	rr	a
   017A 03                 1101 	rr	a
   017B F5*17              1102 	mov	rxaddr,a
   017D 54 C0              1103 	anl	a,#0xc0
   017F 24r00              1104 	add	a,#<rxbuf
   0181 C5*17              1105 	xch	a,rxaddr
   0183 54 3F              1106 	anl	a,#0x3f
   0185 34s04              1107 	addc	a,#>rxbuf
   0187 F5*18              1108 	mov	rxaddr+1,a
                           1109 	.else
                           1110 	mov	a,rxtwr
                           1111 	rr	a
                           1112 	rr	a
                           1113 	mov	rxaddr,a
                           1114 	anl	a,#0xc0
                           1115 	xch	a,rxaddr
                           1116 	anl	a,#0x3f
                           1117 	add	a,#>rxbuf
                           1118 	mov	rxaddr+1,a
                           1119 	.endif
   0189 75*15 40           1120 	mov	rxcnt,#64
   018C 02s01r5C           1121 	ljmp	rxstartloop	; sjmp would be enough
                           1122 
   018F                    1123 rxabortframe:
   018F 75*11 00           1124 	mov	rxstate,#0
   0192 02s01r5C           1125 	ljmp	rxstartloop
                           1126 
   0195                    1127 rxdataloopstart:
   0195 AF*15              1128 	mov	r7,rxcnt
   0197 85*17 84           1129 	mov	dpl1,rxaddr
   019A 85*18 85           1130 	mov	dph1,rxaddr+1
   019D E0                 1131 0$:	movx	a,@dptr		; read command
   019E 20 E6 21           1132 	jb	acc.6,1$
   01A1 E0                 1133 	movx	a,@dptr
   01A2 05 86              1134 	inc	dps
   01A4 F0                 1135 	movx	@dptr,a
   01A5 A3                 1136 	inc	dptr
   01A6 15 86              1137 	dec	dps
   01A8 DF F3              1138 	djnz	r7,0$
   01AA E5*14              1139 	mov	a,rxtwr
   01AC 24r10              1140 	add	a,#rxbcnt
   01AE F8                 1141 	mov	r0,a
   01AF 76 40              1142 	mov	@r0,#64
   01B1 E5*14              1143 	mov	a,rxtwr
   01B3 04                 1144 	inc	a
   01B4 54 1F              1145 	anl	a,#RXCHUNKS-1
   01B6 B5*13 03           1146 	cjne	a,rxrd,2$
   01B9 02s01r8F           1147 	ljmp	rxabortframe
   01BC F5*14              1148 2$:	mov	rxtwr,a
   01BE 05*16              1149 	inc	rxcntc
   01C0 80 B5              1150 	sjmp	rxnewchunk
   01C2 8F*15              1151 1$:	mov	rxcnt,r7
   01C4 85 84*17           1152 	mov	rxaddr,dpl1
   01C7 85 85*18           1153 	mov	rxaddr+1,dph1
   01CA 20 E5 8C           1154 	jb	acc.5,usbiostart1	; empty
   01CD 20 E4 BF           1155 	jb	acc.4,rxabortframe	; abort received
   01D0 54 0F              1156 	anl	a,#0xf
   01D2 B4 0E 98           1157 	cjne	a,#0xe,rxpreparepkt	; CRC not ok or residue error
   01D5 E5*14              1158 	mov	a,rxtwr
   01D7 24r10              1159 	add	a,#rxbcnt
   01D9 F8                 1160 	mov	r0,a
   01DA 74 40              1161 	mov	a,#64
   01DC C3                 1162 	clr	c
   01DD 9F                 1163 	subb	a,r7
   01DE F6                 1164 	mov	@r0,a
   01DF E5*16              1165 	mov	a,rxcntc
   01E1 70 07              1166 	jnz	3$
   01E3 74 FC              1167 	mov	a,#-4
   01E5 26                 1168 	add	a,@r0
   01E6 50 13              1169 	jnc	6$		; frame too short
   01E8 80 04              1170 	sjmp	4$
   01EA 24 F8              1171 3$:	add	a,#-8
   01EC 40 0D              1172 	jc	6$		; frame too long
   01EE E5*14              1173 4$:	mov	a,rxtwr
   01F0 04                 1174 	inc	a
   01F1 54 1F              1175 	anl	a,#RXCHUNKS-1
   01F3 B5*13 03           1176 	cjne	a,rxrd,5$
   01F6 02s01r6D           1177 	ljmp	rxpreparepkt
   01F9 F5*12              1178 5$:	mov	rxwr,a
   01FB 02s01r6D           1179 6$:	ljmp	rxpreparepkt
                           1180 	.endif
                           1181 
   01FE                    1182 usbiostart:
                           1183 	;; check for USB modem->host
   01FE E5*13              1184 	mov	a,rxrd
   0200 B5*12 4F           1185 	cjne	a,rxwr,usbcheckin
                           1186 	;; check for USB host->modem
   0203                    1187 usbcheckout:
   0203 90 7F C8           1188 	mov	dptr,#OUT2CS
   0206 E0                 1189 	movx	a,@dptr
   0207 20 E1 46           1190 	jb	acc.1,endusb2
   020A E5*0A              1191 	mov	a,txtwr
   020C 24r00              1192 	add	a,#txbcnt
   020E F8                 1193 	mov	r0,a
   020F E5*0A              1194 	mov	a,txtwr
   0211 04                 1195 	inc	a
   0212 54 0F              1196 	anl	a,#(TXCHUNKS-1)
   0214 B5*09 03           1197 	cjne	a,txrd,usbout2
   0217 02s02r90           1198 	ljmp	endusb
   021A                    1199 usbout2:
   021A FF                 1200 	mov	r7,a
   021B 90 7F C9           1201 	mov	dptr,#OUT2BC
   021E E0                 1202 	movx	a,@dptr
   021F F6                 1203 	mov	@r0,a
   0220 FD                 1204 	mov	r5,a
   0221 60 20              1205 	jz	usbout3
   0223 FE                 1206 	mov	r6,a
                    0001   1207 	.if	1
   0224 E5*0A              1208 	mov	a,txtwr
   0226 03                 1209 	rr	a
   0227 03                 1210 	rr	a
   0228 F5 84              1211 	mov	dpl1,a
   022A 54 C0              1212 	anl	a,#0xc0
   022C 24r00              1213 	add	a,#<txbuf
   022E C5 84              1214 	xch	a,dpl1
   0230 54 3F              1215 	anl	a,#0x3f
   0232 34s00              1216 	addc	a,#>txbuf
   0234 F5 85              1217 	mov	dph1,a
                           1218 	.else
                           1219 	mov	a,txtwr
                           1220 	rr	a
                           1221 	rr	a
                           1222 	mov	dpl1,a
                           1223 	anl	a,#0xc0
                           1224 	xch	a,dpl1
                           1225 	anl	a,#0x3f
                           1226 	add	a,#>txbuf
                           1227 	mov	dph1,a
                           1228 	.endif
   0236 90 7D C0           1229 	mov	dptr,#OUT2BUF
   0239                    1230 usboutloop:
   0239 E0                 1231 	movx	a,@dptr
   023A A3                 1232 	inc	dptr
   023B 05 86              1233 	inc	dps
   023D F0                 1234 	movx	@dptr,a
   023E A3                 1235 	inc	dptr
   023F 15 86              1236 	dec	dps
   0241 DE F6              1237 	djnz	r6,usboutloop
   0243                    1238 usbout3:
   0243 8F*0A              1239 	mov	txtwr,r7
   0245 ED                 1240 	mov	a,r5
   0246 24 C0              1241 	add	a,#-64
   0248 60 02              1242 	jz	usbout4
   024A 8F*08              1243 	mov	txwr,r7
   024C                    1244 usbout4:	
   024C 90 7F C9           1245 	mov	dptr,#OUT2BC
   024F F0                 1246 	movx	@dptr,a		; rearm OUT2
   0250                    1247 endusb2:
   0250 80 3E              1248 	sjmp	endusb
                           1249 
   0252                    1250 usbcheckin:
   0252 90 7F B8           1251 	mov	dptr,#IN2CS
   0255 E0                 1252 	movx	a,@dptr
   0256 20 E1 AA           1253 	jb	acc.1,usbcheckout
                           1254 
                           1255 	;ljmp	xxinbuf
                           1256 	
   0259 E5*13              1257 	mov	a,rxrd
   025B 24r10              1258 	add	a,#rxbcnt
   025D F8                 1259 	mov	r0,a
   025E E6                 1260 	mov	a,@r0
   025F 60 20              1261 	jz	usbin1
   0261 FE                 1262 	mov	r6,a
                    0001   1263 	.if	1
   0262 E5*13              1264 	mov	a,rxrd
   0264 03                 1265 	rr	a
   0265 03                 1266 	rr	a
   0266 F5 84              1267 	mov	dpl1,a
   0268 54 C0              1268 	anl	a,#0xc0
   026A 24r00              1269 	add	a,#<rxbuf
   026C C5 84              1270 	xch	a,dpl1	
   026E 54 3F              1271 	anl	a,#0x3f
   0270 34s04              1272 	addc	a,#>rxbuf
   0272 F5 85              1273 	mov	dph1,a
                           1274 	.else
                           1275 	mov	a,rxrd
                           1276 	rr	a
                           1277 	rr	a
                           1278 	mov	dpl1,a
                           1279 	anl	a,#0xc0
                           1280 	xch	a,dpl1	
                           1281 	anl	a,#0x3f
                           1282 	addc	a,#>rxbuf
                           1283 	mov	dph1,a
                           1284 	.endif
   0274 90 7E 00           1285 	mov	dptr,#IN2BUF
   0277                    1286 usbinloop:
   0277 05 86              1287 	inc	dps
   0279 E0                 1288 	movx	a,@dptr
   027A A3                 1289 	inc	dptr
   027B 15 86              1290 	dec	dps
   027D F0                 1291 	movx	@dptr,a
   027E A3                 1292 	inc	dptr
   027F DE F6              1293 	djnz	r6,usbinloop
   0281                    1294 usbin1:
   0281 E6                 1295 	mov	a,@r0
   0282 90 7F B9           1296 	mov	dptr,#IN2BC
   0285 F0                 1297 	movx	@dptr,a
   0286 E5*13              1298 	mov	a,rxrd
   0288 04                 1299 	inc	a
   0289 54 1F              1300 	anl	a,#(RXCHUNKS-1)
   028B F5*13              1301 	mov	rxrd,a
   028D 02s02r03           1302 	ljmp	usbcheckout
                           1303 
   0290                    1304 endusb:
   0290 02s00r37           1305 	ljmp	txstartloop
                           1306 
                           1307 
                           1308 	;; ------------------ interrupt handlers ------------------------
                           1309 
   0293                    1310 int0_isr:
   0293 C0 E0              1311 	push	acc
   0295 C0 F0              1312 	push	b
   0297 C0 82              1313 	push	dpl0
   0299 C0 83              1314 	push	dph0
   029B C0 D0              1315 	push	psw
   029D 75 D0 00           1316 	mov	psw,#0x00
   02A0 C0 86              1317 	push	dps
   02A2 75 86 00           1318 	mov	dps,#0
                           1319 	;; clear interrupt
   02A5 C2 89              1320 	clr	tcon+1
                           1321 	;; handle interrupt
                           1322 	;; epilogue
   02A7 D0 86              1323 	pop	dps
   02A9 D0 D0              1324 	pop	psw
   02AB D0 83              1325 	pop	dph0
   02AD D0 82              1326 	pop	dpl0
   02AF D0 F0              1327 	pop	b
   02B1 D0 E0              1328 	pop	acc
   02B3 32                 1329 	reti
                           1330 
   02B4                    1331 timer0_isr:
   02B4 C0 E0              1332 	push	acc
   02B6 C0 F0              1333 	push	b
   02B8 C0 82              1334 	push	dpl0
   02BA C0 83              1335 	push	dph0
   02BC C0 D0              1336 	push	psw
   02BE 75 D0 00           1337 	mov	psw,#0x00
   02C1 C0 86              1338 	push	dps
   02C3 75 86 00           1339 	mov	dps,#0
                           1340 	;; clear interrupt
   02C6 C2 8D              1341 	clr	tcon+5
                           1342 	;; handle interrupt
                    0000   1343 	.if	0
                           1344 	inc	leddiv
                           1345 	mov	a,leddiv
                           1346 	anl	a,#7
                           1347 	jnz	0$
                           1348 	mov	dptr,#OUTC
                           1349 	movx	a,@dptr
                           1350 	xrl	a,#0x08
                           1351 	movx	@dptr,a
                           1352 0$:
                           1353 	.endif
                           1354 	;; epilogue
   02C8 D0 86              1355 	pop	dps
   02CA D0 D0              1356 	pop	psw
   02CC D0 83              1357 	pop	dph0
   02CE D0 82              1358 	pop	dpl0
   02D0 D0 F0              1359 	pop	b
   02D2 D0 E0              1360 	pop	acc
   02D4 32                 1361 	reti
                           1362 
   02D5                    1363 int1_isr:
   02D5 C0 E0              1364 	push	acc
   02D7 C0 F0              1365 	push	b
   02D9 C0 82              1366 	push	dpl0
   02DB C0 83              1367 	push	dph0
   02DD C0 D0              1368 	push	psw
   02DF 75 D0 00           1369 	mov	psw,#0x00
   02E2 C0 86              1370 	push	dps
   02E4 75 86 00           1371 	mov	dps,#0
                           1372 	;; clear interrupt
   02E7 C2 8B              1373 	clr	tcon+3
                           1374 	;; handle interrupt
                           1375 	;; epilogue
   02E9 D0 86              1376 	pop	dps
   02EB D0 D0              1377 	pop	psw
   02ED D0 83              1378 	pop	dph0
   02EF D0 82              1379 	pop	dpl0
   02F1 D0 F0              1380 	pop	b
   02F3 D0 E0              1381 	pop	acc
   02F5 32                 1382 	reti
                           1383 
   02F6                    1384 timer1_isr:
   02F6 C0 E0              1385 	push	acc
   02F8 C0 F0              1386 	push	b
   02FA C0 82              1387 	push	dpl0
   02FC C0 83              1388 	push	dph0
   02FE C0 D0              1389 	push	psw
   0300 75 D0 00           1390 	mov	psw,#0x00
   0303 C0 86              1391 	push	dps
   0305 75 86 00           1392 	mov	dps,#0
                           1393 	;; clear interrupt
   0308 C2 8F              1394 	clr	tcon+7
                           1395 	;; handle interrupt
                           1396 	;; epilogue
   030A D0 86              1397 	pop	dps
   030C D0 D0              1398 	pop	psw
   030E D0 83              1399 	pop	dph0
   0310 D0 82              1400 	pop	dpl0
   0312 D0 F0              1401 	pop	b
   0314 D0 E0              1402 	pop	acc
   0316 32                 1403 	reti
                           1404 
   0317                    1405 ser0_isr:
   0317 C0 E0              1406 	push	acc
   0319 C0 F0              1407 	push	b
   031B C0 82              1408 	push	dpl0
   031D C0 83              1409 	push	dph0
   031F C0 D0              1410 	push	psw
   0321 75 D0 00           1411 	mov	psw,#0x00
   0324 C0 86              1412 	push	dps
   0326 75 86 00           1413 	mov	dps,#0
   0329 C0 00              1414 	push	ar0
                           1415 	;; clear interrupt
   032B 10 98 16           1416 	jbc	scon0+0,1$	; RI
   032E 10 99 0F           1417 0$:	jbc	scon0+1,2$	; TI
                           1418 	;; handle interrupt
                           1419 	;; epilogue
   0331 D0 00              1420 3$:	pop	ar0
   0333 D0 86              1421 	pop	dps
   0335 D0 D0              1422 	pop	psw
   0337 D0 83              1423 	pop	dph0
   0339 D0 82              1424 	pop	dpl0
   033B D0 F0              1425 	pop	b
   033D D0 E0              1426 	pop	acc
   033F 32                 1427 	reti
                           1428 
   0340 D2*0B              1429 2$:	setb	uartempty
   0342 80 EA              1430 	sjmp	0$
                           1431 
   0344 E5*2A              1432 1$:	mov	a,uartwr
   0346 24r1A              1433 	add	a,#uartbuf
   0348 F8                 1434 	mov	r0,a
   0349 E5 99              1435 	mov	a,sbuf0
   034B F6                 1436 	mov	@r0,a
   034C E5*2A              1437 	mov	a,uartwr
   034E 04                 1438 	inc	a
   034F 54 0F              1439 	anl	a,#0xf
   0351 F5*2A              1440 	mov	uartwr,a
   0353 80 DC              1441 	sjmp	3$
                           1442 
   0355                    1443 timer2_isr:
   0355 C0 E0              1444 	push	acc
   0357 C0 F0              1445 	push	b
   0359 C0 82              1446 	push	dpl0
   035B C0 83              1447 	push	dph0
   035D C0 D0              1448 	push	psw
   035F 75 D0 00           1449 	mov	psw,#0x00
   0362 C0 86              1450 	push	dps
   0364 75 86 00           1451 	mov	dps,#0
                           1452 	;; clear interrupt
   0367 C2 CF              1453 	clr	t2con+7
                           1454 	;; handle interrupt
                           1455 	;; epilogue
   0369 D0 86              1456 	pop	dps
   036B D0 D0              1457 	pop	psw
   036D D0 83              1458 	pop	dph0
   036F D0 82              1459 	pop	dpl0
   0371 D0 F0              1460 	pop	b
   0373 D0 E0              1461 	pop	acc
   0375 32                 1462 	reti
                           1463 
   0376                    1464 resume_isr:
   0376 C0 E0              1465 	push	acc
   0378 C0 F0              1466 	push	b
   037A C0 82              1467 	push	dpl0
   037C C0 83              1468 	push	dph0
   037E C0 D0              1469 	push	psw
   0380 75 D0 00           1470 	mov	psw,#0x00
   0383 C0 86              1471 	push	dps
   0385 75 86 00           1472 	mov	dps,#0
                           1473 	;; clear interrupt
   0388 C2 DC              1474 	clr	eicon+4
                           1475 	;; handle interrupt
                           1476 	;; epilogue
   038A D0 86              1477 	pop	dps
   038C D0 D0              1478 	pop	psw
   038E D0 83              1479 	pop	dph0
   0390 D0 82              1480 	pop	dpl0
   0392 D0 F0              1481 	pop	b
   0394 D0 E0              1482 	pop	acc
   0396 32                 1483 	reti
                           1484 
   0397                    1485 ser1_isr:
   0397 C0 E0              1486 	push	acc
   0399 C0 F0              1487 	push	b
   039B C0 82              1488 	push	dpl0
   039D C0 83              1489 	push	dph0
   039F C0 D0              1490 	push	psw
   03A1 75 D0 00           1491 	mov	psw,#0x00
   03A4 C0 86              1492 	push	dps
   03A6 75 86 00           1493 	mov	dps,#0
                           1494 	;; clear interrupt
   03A9 C2 C0              1495 	clr	scon1+0
   03AB C2 C1              1496 	clr	scon1+1
                           1497 	;; handle interrupt
                           1498 	;; epilogue
   03AD D0 86              1499 	pop	dps
   03AF D0 D0              1500 	pop	psw
   03B1 D0 83              1501 	pop	dph0
   03B3 D0 82              1502 	pop	dpl0
   03B5 D0 F0              1503 	pop	b
   03B7 D0 E0              1504 	pop	acc
   03B9 32                 1505 	reti
                           1506 
   03BA                    1507 i2c_isr:
   03BA C0 E0              1508 	push	acc
   03BC C0 F0              1509 	push	b
   03BE C0 82              1510 	push	dpl0
   03C0 C0 83              1511 	push	dph0
   03C2 C0 D0              1512 	push	psw
   03C4 75 D0 00           1513 	mov	psw,#0x00
   03C7 C0 86              1514 	push	dps
   03C9 75 86 00           1515 	mov	dps,#0
                           1516 	;; clear interrupt
   03CC E5 91              1517 	mov	a,exif
   03CE C2 E5              1518 	clr	acc.5
   03D0 F5 91              1519 	mov	exif,a
                           1520 	;; handle interrupt
                           1521 	;; epilogue
   03D2 D0 86              1522 	pop	dps
   03D4 D0 D0              1523 	pop	psw
   03D6 D0 83              1524 	pop	dph0
   03D8 D0 82              1525 	pop	dpl0
   03DA D0 F0              1526 	pop	b
   03DC D0 E0              1527 	pop	acc
   03DE 32                 1528 	reti
                           1529 
   03DF                    1530 int4_isr:
   03DF C0 E0              1531 	push	acc
   03E1 C0 F0              1532 	push	b
   03E3 C0 82              1533 	push	dpl0
   03E5 C0 83              1534 	push	dph0
   03E7 C0 D0              1535 	push	psw
   03E9 75 D0 00           1536 	mov	psw,#0x00
   03EC C0 86              1537 	push	dps
   03EE 75 86 00           1538 	mov	dps,#0
                           1539 	;; clear interrupt
   03F1 E5 91              1540 	mov	a,exif
   03F3 C2 E6              1541 	clr	acc.6
   03F5 F5 91              1542 	mov	exif,a
                           1543 	;; handle interrupt
                           1544 	;; epilogue
   03F7 D0 86              1545 	pop	dps
   03F9 D0 D0              1546 	pop	psw
   03FB D0 83              1547 	pop	dph0
   03FD D0 82              1548 	pop	dpl0
   03FF D0 F0              1549 	pop	b
   0401 D0 E0              1550 	pop	acc
   0403 32                 1551 	reti
                           1552 
   0404                    1553 int5_isr:
   0404 C0 E0              1554 	push	acc
   0406 C0 F0              1555 	push	b
   0408 C0 82              1556 	push	dpl0
   040A C0 83              1557 	push	dph0
   040C C0 D0              1558 	push	psw
   040E 75 D0 00           1559 	mov	psw,#0x00
   0411 C0 86              1560 	push	dps
   0413 75 86 00           1561 	mov	dps,#0
                           1562 	;; clear interrupt
   0416 E5 91              1563 	mov	a,exif
   0418 C2 E7              1564 	clr	acc.7
   041A F5 91              1565 	mov	exif,a
                           1566 	;; handle interrupt
                           1567 	;; epilogue
   041C D0 86              1568 	pop	dps
   041E D0 D0              1569 	pop	psw
   0420 D0 83              1570 	pop	dph0
   0422 D0 82              1571 	pop	dpl0
   0424 D0 F0              1572 	pop	b
   0426 D0 E0              1573 	pop	acc
   0428 32                 1574 	reti
                           1575 
   0429                    1576 int6_isr:
   0429 C0 E0              1577 	push	acc
   042B C0 F0              1578 	push	b
   042D C0 82              1579 	push	dpl0
   042F C0 83              1580 	push	dph0
   0431 C0 D0              1581 	push	psw
   0433 75 D0 00           1582 	mov	psw,#0x00
   0436 C0 86              1583 	push	dps
   0438 75 86 00           1584 	mov	dps,#0
                           1585 	;; clear interrupt
   043B C2 DB              1586 	clr	eicon+3
                           1587 	;; handle interrupt
                           1588 	;; epilogue
   043D D0 86              1589 	pop	dps
   043F D0 D0              1590 	pop	psw
   0441 D0 83              1591 	pop	dph0
   0443 D0 82              1592 	pop	dpl0
   0445 D0 F0              1593 	pop	b
   0447 D0 E0              1594 	pop	acc
   0449 32                 1595 	reti
                           1596 
   044A                    1597 usb_sudav_isr:
   044A C0 E0              1598 	push	acc
   044C C0 F0              1599 	push	b
   044E C0 82              1600 	push	dpl0
   0450 C0 83              1601 	push	dph0
   0452 C0 84              1602 	push	dpl1
   0454 C0 85              1603 	push	dph1
   0456 C0 D0              1604 	push	psw
   0458 75 D0 00           1605 	mov	psw,#0x00
   045B C0 86              1606 	push	dps
   045D 75 86 00           1607 	mov	dps,#0
   0460 C0 00              1608 	push	ar0
   0462 C0 07              1609 	push	ar7
                           1610 	;; clear interrupt
   0464 E5 91              1611 	mov	a,exif
   0466 C2 E4              1612 	clr	acc.4
   0468 F5 91              1613 	mov	exif,a
   046A 90 7F AB           1614 	mov	dptr,#USBIRQ
   046D 74 01              1615 	mov	a,#0x01
   046F F0                 1616 	movx	@dptr,a
                           1617 	;; handle interrupt
   0470 75*00 00           1618 	mov	ctrlcode,#0		; reset control out code
   0473 90 7F E9           1619 	mov	dptr,#SETUPDAT+1
   0476 E0                 1620 	movx	a,@dptr			; bRequest field
                           1621 	;; standard commands
                           1622 	;; USB_REQ_GET_DESCRIPTOR
   0477 B4 06 59           1623 	cjne	a,#USB_REQ_GET_DESCRIPTOR,cmdnotgetdesc
   047A 90 7F E8           1624 	mov	dptr,#SETUPDAT		; bRequestType == 0x80
   047D E0                 1625 	movx	a,@dptr
   047E B4 80 4F           1626 	cjne	a,#USB_DIR_IN,setupstallstd
   0481 90 7F EB           1627 	mov	dptr,#SETUPDAT+3
   0484 E0                 1628 	movx	a,@dptr
   0485 B4 01 0C           1629 	cjne	a,#USB_DT_DEVICE,cmdnotgetdescdev
   0488 90 7F D4           1630 	mov	dptr,#SUDPTRH
   048B 74s0C              1631 	mov	a,#>devicedescr
   048D F0                 1632 	movx	@dptr,a
   048E A3                 1633 	inc	dptr
   048F 74r7D              1634 	mov	a,#<devicedescr
   0491 F0                 1635 	movx	@dptr,a
   0492 80 39              1636 	sjmp	setupackstd
   0494                    1637 cmdnotgetdescdev:
   0494 B4 02 12           1638 	cjne	a,#USB_DT_CONFIG,cmdnotgetdesccfg
   0497 90 7F EA           1639 	mov	dptr,#SETUPDAT+2
   049A E0                 1640 	movx	a,@dptr
   049B 70 33              1641 	jnz	setupstallstd
   049D 90 7F D4           1642 	mov	dptr,#SUDPTRH
   04A0 74s0C              1643 	mov	a,#>config0descr
   04A2 F0                 1644 	movx	@dptr,a
   04A3 A3                 1645 	inc	dptr
   04A4 74r8F              1646 	mov	a,#<config0descr
   04A6 F0                 1647 	movx	@dptr,a
   04A7 80 24              1648 	sjmp	setupackstd
   04A9                    1649 cmdnotgetdesccfg:
   04A9 B4 03 24           1650 	cjne	a,#USB_DT_STRING,setupstallstd
   04AC 90 7F EA           1651 	mov	dptr,#SETUPDAT+2
   04AF E0                 1652 	movx	a,@dptr
   04B0 24 FC              1653 	add	a,#-numstrings
   04B2 40 1C              1654 	jc	setupstallstd
   04B4 E0                 1655 	movx	a,@dptr
   04B5 25 E0              1656 	add	a,acc
   04B7 24rD4              1657 	add	a,#<stringdescr
   04B9 F5 82              1658 	mov	dpl0,a
   04BB E4                 1659 	clr	a
   04BC 34s0C              1660 	addc	a,#>stringdescr
   04BE F5 83              1661 	mov	dph0,a
   04C0 E0                 1662 	movx	a,@dptr
   04C1 F5 F0              1663 	mov	b,a
   04C3 A3                 1664 	inc	dptr
   04C4 E0                 1665 	movx	a,@dptr
   04C5 90 7F D4           1666 	mov	dptr,#SUDPTRH
   04C8 F0                 1667 	movx	@dptr,a
   04C9 A3                 1668 	inc	dptr
   04CA E5 F0              1669 	mov	a,b
   04CC F0                 1670 	movx	@dptr,a
                           1671 	; sjmp	setupackstd	
   04CD                    1672 setupackstd:
   04CD 02s08r5D           1673 	ljmp	setupack
   04D0                    1674 setupstallstd:
   04D0 02s08r59           1675 	ljmp	setupstall
   04D3                    1676 cmdnotgetdesc:
                           1677 	;; USB_REQ_SET_CONFIGURATION
   04D3 B4 09 41           1678 	cjne	a,#USB_REQ_SET_CONFIGURATION,cmdnotsetconf
   04D6 90 7F E8           1679 	mov	dptr,#SETUPDAT
   04D9 E0                 1680 	movx	a,@dptr
   04DA 70 F4              1681 	jnz	setupstallstd
   04DC 90 7F EA           1682 	mov	dptr,#SETUPDAT+2
   04DF E0                 1683 	movx	a,@dptr
   04E0 24 FE              1684 	add	a,#-2
   04E2 40 EC              1685 	jc	setupstallstd
   04E4 E0                 1686 	movx	a,@dptr
   04E5 F5*2F              1687 	mov	numconfig,a
   04E7                    1688 cmdresettoggleshalt:
   04E7 90 7F D7           1689 	mov	dptr,#TOGCTL
   04EA 78 07              1690 	mov	r0,#7
   04EC E8                 1691 0$:	mov	a,r0
   04ED 44 10              1692 	orl	a,#0x10
   04EF F0                 1693 	movx	@dptr,a
   04F0 44 30              1694 	orl	a,#0x30
   04F2 F0                 1695 	movx	@dptr,a
   04F3 E8                 1696 	mov	a,r0
   04F4 F0                 1697 	movx	@dptr,a
   04F5 44 20              1698 	orl	a,#0x20
   04F7 F0                 1699 	movx	@dptr,a
   04F8 D8 F2              1700 	djnz	r0,0$
   04FA E4                 1701 	clr	a
   04FB F0                 1702 	movx	@dptr,a
   04FC 74 02              1703 	mov	a,#2
   04FE 90 7F B6           1704 	mov	dptr,#IN1CS
   0501 78 07              1705 	mov	r0,#7
   0503 F0                 1706 1$:	movx	@dptr,a
   0504 A3                 1707 	inc	dptr
   0505 A3                 1708 	inc	dptr
   0506 D8 FB              1709 	djnz	r0,1$
   0508 90 7F C6           1710 	mov	dptr,#OUT1CS
   050B 78 07              1711 	mov	r0,#7
   050D F0                 1712 2$:	movx	@dptr,a
   050E A3                 1713 	inc	dptr
   050F A3                 1714 	inc	dptr
   0510 D8 FB              1715 	djnz	r0,2$
   0512 12s09r9A           1716 	lcall	fillusbintr
   0515 80 B6              1717 	sjmp	setupackstd
   0517                    1718 cmdnotsetconf:
                           1719 	;; USB_REQ_SET_INTERFACE
   0517 B4 0B 1A           1720 	cjne	a,#USB_REQ_SET_INTERFACE,cmdnotsetint
   051A 90 7F E8           1721 	mov	dptr,#SETUPDAT
   051D E0                 1722 	movx	a,@dptr
   051E B4 01 AF           1723 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_OUT,setupstallstd
   0521 E5*2F              1724 	mov	a,numconfig
   0523 B4 01 AA           1725 	cjne	a,#1,setupstallstd
   0526 90 7F EC           1726 	mov	dptr,#SETUPDAT+4
   0529 E0                 1727 	movx	a,@dptr
   052A 70 A4              1728 	jnz	setupstallstd
   052C 90 7F EA           1729 	mov	dptr,#SETUPDAT+2
   052F E0                 1730 	movx	a,@dptr
   0530 F5*30              1731 	mov	altsetting,a
   0532 80 B3              1732 	sjmp	cmdresettoggleshalt
   0534                    1733 cmdnotsetint:
                           1734 	;; USB_REQ_GET_INTERFACE
   0534 B4 0A 20           1735 	cjne	a,#USB_REQ_GET_INTERFACE,cmdnotgetint
   0537 90 7F E8           1736 	mov	dptr,#SETUPDAT
   053A E0                 1737 	movx	a,@dptr
   053B B4 81 92           1738 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_IN,setupstallstd
   053E E5*2F              1739 	mov	a,numconfig
   0540 B4 01 8D           1740 	cjne	a,#1,setupstallstd
   0543 90 7F EC           1741 	mov	dptr,#SETUPDAT+4
   0546 E0                 1742 	movx	a,@dptr
   0547 70 87              1743 	jnz	setupstallstd
   0549 E5*30              1744 	mov	a,altsetting
   054B                    1745 cmdrespondonebyte:
   054B 90 7F 00           1746 	mov	dptr,#IN0BUF
   054E F0                 1747 	movx	@dptr,a
   054F 90 7F B5           1748 	mov	dptr,#IN0BC
   0552 74 01              1749 	mov	a,#1
   0554 F0                 1750 	movx	@dptr,a	
   0555 80 4E              1751 	sjmp	setupackstd2
   0557                    1752 cmdnotgetint:
                           1753 	;; USB_REQ_GET_CONFIGURATION
   0557 B4 08 0B           1754 	cjne	a,#USB_REQ_GET_CONFIGURATION,cmdnotgetconf
   055A 90 7F E8           1755 	mov	dptr,#SETUPDAT
   055D E0                 1756 	movx	a,@dptr
   055E B4 80 47           1757 	cjne	a,#USB_RECIP_DEVICE|USB_DIR_IN,setupstallstd2
   0561 E5*2F              1758 	mov	a,numconfig
   0563 80 E6              1759 	sjmp	cmdrespondonebyte	
   0565                    1760 cmdnotgetconf:
                           1761 	;; USB_REQ_GET_STATUS (0)
   0565 70 44              1762 	jnz	cmdnotgetstat
   0567 90 7F E8           1763 	mov	dptr,#SETUPDAT
   056A E0                 1764 	movx	a,@dptr
   056B B4 80 11           1765 	cjne	a,#USB_RECIP_DEVICE|USB_DIR_IN,cmdnotgetstatdev
   056E 74 01              1766 	mov	a,#1
   0570                    1767 cmdrespondstat:
   0570 90 7F 00           1768 	mov	dptr,#IN0BUF
   0573 F0                 1769 	movx	@dptr,a
   0574 A3                 1770 	inc	dptr
   0575 E4                 1771 	clr	a
   0576 F0                 1772 	movx	@dptr,a
   0577 90 7F B5           1773 	mov	dptr,#IN0BC
   057A 74 02              1774 	mov	a,#2
   057C F0                 1775 	movx	@dptr,a	
   057D 80 26              1776 	sjmp	setupackstd2
   057F                    1777 cmdnotgetstatdev:
   057F B4 81 03           1778 	cjne	a,#USB_RECIP_INTERFACE|USB_DIR_IN,cmdnotgetstatintf
   0582 E4                 1779 	clr	a
   0583 80 EB              1780 	sjmp	cmdrespondstat
   0585                    1781 cmdnotgetstatintf:
   0585 B4 82 20           1782 	cjne	a,#USB_RECIP_ENDPOINT|USB_DIR_IN,setupstallstd2
   0588 90 7F EC           1783 	mov	dptr,#SETUPDAT+4
   058B E0                 1784 	movx	a,@dptr
   058C 90 7F C4           1785 	mov	dptr,#OUT1CS-2
   058F 30 E7 03           1786 	jnb	acc.7,0$
   0592 90 7F B4           1787 	mov	dptr,#IN1CS-2
   0595 54 0F              1788 0$:	anl	a,#15
   0597 60 0F              1789 	jz	setupstallstd2
   0599 20 E3 0C           1790 	jb	acc.3,setupstallstd2
   059C 25 E0              1791 	add	a,acc
   059E 25 82              1792 	add	a,dpl0
   05A0 F5 82              1793 	mov	dpl0,a
   05A2 E0                 1794 	movx	a,@dptr
   05A3 80 CB              1795 	sjmp	cmdrespondstat
   05A5                    1796 setupackstd2:
   05A5 02s08r5D           1797 	ljmp	setupack
   05A8                    1798 setupstallstd2:
   05A8 02s08r59           1799 	ljmp	setupstall
   05AB                    1800 cmdnotgetstat:
                           1801 	;; USB_REQ_SET_FEATURE
   05AB B4 03 05           1802 	cjne	a,#USB_REQ_SET_FEATURE,cmdnotsetftr
   05AE 75 F0 01           1803 	mov	b,#1
   05B1 80 06              1804 	sjmp	handleftr
   05B3                    1805 cmdnotsetftr:
                           1806 	;; USB_REQ_CLEAR_FEATURE
   05B3 B4 01 44           1807 	cjne	a,#USB_REQ_CLEAR_FEATURE,cmdnotclrftr
   05B6 75 F0 00           1808 	mov	b,#0
   05B9                    1809 handleftr:
   05B9 90 7F E8           1810 	mov	dptr,#SETUPDAT
   05BC E0                 1811 	movx	a,@dptr
   05BD B4 02 E8           1812 	cjne	a,#USB_RECIP_ENDPOINT|USB_DIR_OUT,setupstallstd2
   05C0 A3                 1813 	inc	dptr
   05C1 A3                 1814 	inc	dptr
   05C2 E0                 1815 	movx	a,@dptr
   05C3 70 E3              1816 	jnz	setupstallstd2	; not ENDPOINT_HALT feature
   05C5 A3                 1817 	inc	dptr
   05C6 E0                 1818 	movx	a,@dptr
   05C7 70 DF              1819 	jnz	setupstallstd2
   05C9 A3                 1820 	inc	dptr
   05CA E0                 1821 	movx	a,@dptr
   05CB 90 7F C4           1822 	mov	dptr,#OUT1CS-2
   05CE 30 E7 05           1823 	jnb	acc.7,0$
   05D1 90 7F B4           1824 	mov	dptr,#IN1CS-2
   05D4 44 10              1825 	orl	a,#0x10
   05D6 20 E3 CF           1826 0$:	jb	acc.3,setupstallstd2
                           1827 	;; clear data toggle
   05D9 54 1F              1828 	anl	a,#0x1f
   05DB 05 86              1829 	inc	dps
   05DD 90 7F D7           1830 	mov	dptr,#TOGCTL
   05E0 F0                 1831 	movx	@dptr,a
   05E1 44 20              1832 	orl	a,#0x20
   05E3 F0                 1833 	movx	@dptr,a
   05E4 54 0F              1834 	anl	a,#15
   05E6 F0                 1835 	movx	@dptr,a
   05E7 15 86              1836 	dec	dps	
                           1837 	;; clear/set ep halt feature
   05E9 25 E0              1838 	add	a,acc
   05EB 25 82              1839 	add	a,dpl0
   05ED F5 82              1840 	mov	dpl0,a
   05EF E5 F0              1841 	mov	a,b
   05F1 F0                 1842 	movx	@dptr,a
   05F2 80 B1              1843 	sjmp	setupackstd2
                           1844 
   05F4                    1845 cmdnotc0_1:
   05F4 02s06rC2           1846 	ljmp	cmdnotc0
   05F7                    1847 setupstallc0_1:
   05F7 02s08r59           1848 	ljmp	setupstall
                           1849 	
   05FA                    1850 cmdnotclrftr:
                           1851 	;; vendor specific commands
                           1852 	;; 0xc0
   05FA B4 C0 F7           1853 	cjne	a,#0xc0,cmdnotc0_1
   05FD 90 7F E8           1854 	mov	dptr,#SETUPDAT		; bRequestType == 0xc0
   0600 E0                 1855 	movx	a,@dptr
   0601 B4 C0 F3           1856 	cjne	a,#0xc0,setupstallc0_1
                           1857 	;; fill status buffer
   0604 E5*05              1858 	mov	a,txstate
   0606 F5 F0              1859 	mov	b,a
   0608 D2 F2              1860 	setb	b.2
   060A 45*10              1861 	orl	a,pttforce
   060C B4 00 02           1862 	cjne	a,#0,0$
   060F C2 F2              1863 	clr	b.2
   0611 90 C0 0E           1864 0$:	mov	dptr,#FSKMDISCIN
   0614 E0                 1865 	movx	a,@dptr
   0615 A2 E6              1866 	mov	c,acc.6
   0617 B3                 1867 	cpl	c
   0618 82*08              1868 	anl	c,extmodem
   061A 92 F3              1869 	mov	b.3,c
   061C 90 C0 09           1870 	mov	dptr,#FSKSTAT
   061F E0                 1871 	movx	a,@dptr
   0620 A2 E0              1872 	mov	c,acc.0
   0622 B0r08              1873 	anl	c,/extmodem
   0624 72 F3              1874 	orl	c,b.3
   0626 92 F3              1875 	mov	b.3,c
   0628 A2*0B              1876 	mov	c,uartempty
   062A 92 F5              1877 	mov	b.5,c
   062C E4                 1878 	clr	a
   062D 90 7F 04           1879 	mov	dptr,#(IN0BUF+4)
   0630 F0                 1880 	movx	@dptr,a
                           1881 	;; bytewide elements
   0631 90 7F 00           1882 	mov	dptr,#(IN0BUF)
   0634 E5 F0              1883 	mov	a,b
   0636 F0                 1884 	movx	@dptr,a
   0637 E5*08              1885 	mov	a,txwr
   0639 F4                 1886 	cpl	a
   063A 25*09              1887 	add	a,txrd
   063C 54 0F              1888 	anl	a,#(TXCHUNKS-1)
   063E 90 7F 01           1889 	mov	dptr,#(IN0BUF+1)
   0641 F0                 1890 	movx	@dptr,a
   0642 E5*13              1891 	mov	a,rxrd
   0644 F4                 1892 	cpl	a
   0645 25*12              1893 	add	a,rxwr
   0647 04                 1894 	inc	a
   0648 54 1F              1895 	anl	a,#(RXCHUNKS-1)
   064A 90 7F 02           1896 	mov	dptr,#(IN0BUF+2)
   064D F0                 1897 	movx	@dptr,a
   064E 90 C0 04           1898 	mov	dptr,#FSKRSSI
   0651 E0                 1899 	movx	a,@dptr
   0652 90 7F 03           1900 	mov	dptr,#(IN0BUF+3)
   0655 F0                 1901 	movx	@dptr,a
                           1902 	;; counter
   0656 05*04              1903 	inc	irqcount
   0658 E5*04              1904 	mov	a,irqcount
   065A 90 7F 05           1905 	mov	dptr,#(IN0BUF+5)
   065D F0                 1906 	movx	@dptr,a
                           1907 	;; additional fields (HDLC state mach)
   065E E5*05              1908 	mov	a,txstate
   0660 A3                 1909 	inc	dptr
   0661 F0                 1910 	movx	@dptr,a
   0662 E5*09              1911 	mov	a,txrd
   0664 A3                 1912 	inc	dptr
   0665 F0                 1913 	movx	@dptr,a
   0666 E5*08              1914 	mov	a,txwr
   0668 A3                 1915 	inc	dptr
   0669 F0                 1916 	movx	@dptr,a
   066A E5*0A              1917 	mov	a,txtwr
   066C A3                 1918 	inc	dptr
   066D F0                 1919 	movx	@dptr,a
   066E E5*0B              1920 	mov	a,txcnt
   0670 A3                 1921 	inc	dptr
   0671 F0                 1922 	movx	@dptr,a
   0672 E5*06              1923 	mov	a,flagcnt
   0674 A3                 1924 	inc	dptr
   0675 F0                 1925 	movx	@dptr,a
   0676 E5*07              1926 	mov	a,flagcnt+1
   0678 A3                 1927 	inc	dptr
   0679 F0                 1928 	movx	@dptr,a
   067A E5*11              1929 	mov	a,rxstate
   067C A3                 1930 	inc	dptr
   067D F0                 1931 	movx	@dptr,a
   067E E5*13              1932 	mov	a,rxrd
   0680 A3                 1933 	inc	dptr
   0681 F0                 1934 	movx	@dptr,a
   0682 E5*12              1935 	mov	a,rxwr
   0684 A3                 1936 	inc	dptr
   0685 F0                 1937 	movx	@dptr,a
   0686 E5*14              1938 	mov	a,rxtwr
   0688 A3                 1939 	inc	dptr
   0689 F0                 1940 	movx	@dptr,a
   068A E5*15              1941 	mov	a,rxcnt
   068C A3                 1942 	inc	dptr
   068D F0                 1943 	movx	@dptr,a
                           1944 	;; FPGA registers
   068E E5*19              1945 	mov	a,tmprxcnt
   0690 90 7F 12           1946 	mov	dptr,#(IN0BUF+18)
   0693 F0                 1947 	movx	@dptr,a
   0694 90 C0 00           1948 	mov	dptr,#FSKTXCNT
   0697 E0                 1949 	movx	a,@dptr
   0698 90 7F 13           1950 	mov	dptr,#(IN0BUF+19)
   069B F0                 1951 	movx	@dptr,a
   069C A3                 1952 	inc	dptr
   069D E5 20              1953 	mov	a,ctrlreg
   069F F0                 1954 	movx	@dptr,a
   06A0 90 C0 09           1955 	mov	dptr,#FSKSTAT
   06A3 E0                 1956 	movx	a,@dptr
   06A4 90 7F 15           1957 	mov	dptr,#(IN0BUF+21)
   06A7 F0                 1958 	movx	@dptr,a
                           1959 	;; Anchor Registers
   06A8 90 7F C8           1960 	mov	dptr,#OUT2CS
   06AB E0                 1961 	movx	a,@dptr
   06AC 90 7F 16           1962 	mov	dptr,#(IN0BUF+22)
   06AF F0                 1963 	movx	@dptr,a
                           1964 	;; set length
   06B0 90 7F EE           1965 	mov	dptr,#SETUPDAT+6	; wLength
   06B3 E0                 1966 	movx	a,@dptr
   06B4 24 E9              1967 	add	a,#-(6+12+4+1)
   06B6 50 01              1968 	jnc	4$
   06B8 E4                 1969 	clr	a
   06B9 24 17              1970 4$:	add	a,#(6+12+4+1)
   06BB 90 7F B5           1971 	mov	dptr,#IN0BC
   06BE F0                 1972 	movx	@dptr,a
   06BF 02s08r5D           1973 	ljmp	setupack
   06C2                    1974 cmdnotc0:
                           1975 	;; 0xc8
   06C2 B4 C8 1D           1976 	cjne	a,#0xc8,cmdnotc8
   06C5 90 7F E8           1977 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   06C8 E0                 1978 	movx	a,@dptr
   06C9 B4 C0 13           1979 	cjne	a,#0xc0,setupstallc8
   06CC 74 01              1980 	mov	a,#1
   06CE 30*08 01           1981 	jnb	extmodem,1$
   06D1 04                 1982 	inc	a
   06D2 90 7F 00           1983 1$:	mov	dptr,#IN0BUF
   06D5 F0                 1984 	movx	@dptr,a
   06D6 90 7F B5           1985 	mov	dptr,#IN0BC
   06D9 74 01              1986 	mov	a,#1
   06DB F0                 1987 	movx	@dptr,a
   06DC 02s08r5D           1988 	ljmp	setupack
   06DF                    1989 setupstallc8:
   06DF 02s08r59           1990 	ljmp	setupstall
   06E2                    1991 cmdnotc8:
                           1992 	;; 0xc9
   06E2 B4 C9 21           1993 	cjne	a,#0xc9,cmdnotc9
   06E5 90 7F E8           1994 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   06E8 E0                 1995 	movx	a,@dptr
   06E9 B4 C0 17           1996 	cjne	a,#0xc0,setupstallc9
   06EC 90 7F 00           1997 	mov	dptr,#IN0BUF
   06EF 78rF0              1998 	mov	r0,#parserial
   06F1 E2                 1999 0$:	movx	a,@r0
   06F2 60 05              2000 	jz	1$
   06F4 F0                 2001 	movx	@dptr,a
   06F5 08                 2002 	inc	r0
   06F6 A3                 2003 	inc	dptr
   06F7 80 F8              2004 	sjmp	0$
   06F9 E8                 2005 1$:	mov	a,r0
   06FA 24 10              2006 	add	a,#-0xf0	; -parserial
   06FC 90 7F B5           2007 	mov	dptr,#IN0BC
   06FF F0                 2008 	movx	@dptr,a
   0700 02s08r5D           2009 	ljmp	setupack
   0703                    2010 setupstallc9:
   0703 02s08r59           2011 	ljmp	setupstall
   0706                    2012 cmdnotc9:
                           2013 	;; 0xd0
   0706 B4 D0 5D           2014 	cjne	a,#0xd0,cmdnotd0
   0709 90 7F E8           2015 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   070C E0                 2016 	movx	a,@dptr
   070D B4 C0 53           2017 	cjne	a,#0xc0,setupstalld0
   0710 90 7F EC           2018 	mov	dptr,#SETUPDAT+4	; wIndex
   0713 E0                 2019 	movx	a,@dptr
   0714 B4 01 0A           2020 	cjne	a,#1,0$
   0717 90 7F EA           2021 	mov	dptr,#SETUPDAT+2	; wValue
   071A E0                 2022 	movx	a,@dptr
   071B 54 01              2023 	anl	a,#1
   071D F5*10              2024 	mov	pttforce,a
   071F D2*0A              2025 	setb	pttforcechg
   0721                    2026 0$:	;; PTT status
   0721 90 7F 00           2027 	mov	dptr,#IN0BUF
   0724 E5*05              2028 	mov	a,txstate
   0726 45*10              2029 	orl	a,pttforce
   0728 60 02              2030 	jz	1$
   072A 74 01              2031 	mov	a,#1
   072C F0                 2032 1$:	movx	@dptr,a
                           2033 	;; DCD status
   072D 90 C0 0E           2034 	mov	dptr,#FSKMDISCIN
   0730 E0                 2035 	movx	a,@dptr
   0731 A2 E6              2036 	mov	c,acc.6
   0733 A0r08              2037 	orl	c,/extmodem
   0735 92 F0              2038 	mov	b.0,c
   0737 90 C0 09           2039 	mov	dptr,#FSKSTAT
   073A E0                 2040 	movx	a,@dptr
   073B A2 E0              2041 	mov	c,acc.0
   073D 72*08              2042 	orl	c,extmodem
   073F 82 F0              2043 	anl	c,b.0
   0741 B3                 2044 	cpl	c
   0742 E4                 2045 	clr	a
   0743 92 E0              2046 	mov	acc.0,c
   0745 90 7F 01           2047 	mov	dptr,#IN0BUF+1
   0748 F0                 2048 	movx	@dptr,a
                           2049 	;; RSSI
   0749 90 C0 04           2050 	mov	dptr,#FSKRSSI
   074C E0                 2051 	movx	a,@dptr
   074D 90 7F 02           2052 	mov	dptr,#IN0BUF+2
   0750 F0                 2053 	movx	@dptr,a
                           2054 	;; length
   0751 90 7F EE           2055 	mov	dptr,#SETUPDAT+6	; wLength
   0754 E0                 2056 	movx	a,@dptr
   0755 24 FD              2057 	add	a,#-3
   0757 50 01              2058 	jnc	2$
   0759 E4                 2059 	clr	a
   075A 24 03              2060 2$:	add	a,#3
   075C 90 7F B5           2061 	mov	dptr,#IN0BC
   075F F0                 2062 	movx	@dptr,a
   0760 02s08r5D           2063 	ljmp	setupack
   0763                    2064 setupstalld0:
   0763 02s08r59           2065 	ljmp	setupstall
   0766                    2066 cmdnotd0:
                           2067 	;; 0xd1
   0766 B4 D1 29           2068 	cjne	a,#0xd1,cmdnotd1
   0769 90 7F E8           2069 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   076C E0                 2070 	movx	a,@dptr
   076D B4 C0 1F           2071 	cjne	a,#0xc0,setupstalld1
   0770 90 7F 00           2072 	mov	dptr,#IN0BUF
   0773 78rE0              2073 	mov	r0,#parbitratetx
   0775 7F 06              2074 	mov	r7,#6
   0777 E2                 2075 1$:	movx	a,@r0
   0778 F0                 2076 	movx	@dptr,a
   0779 A3                 2077 	inc	dptr
   077A 08                 2078 	inc	r0
   077B DF FA              2079 	djnz	r7,1$
                           2080 	;; length
   077D 90 7F EE           2081 	mov	dptr,#SETUPDAT+6	; wLength
   0780 E0                 2082 	movx	a,@dptr
   0781 24 FA              2083 	add	a,#-6
   0783 50 01              2084 	jnc	2$
   0785 E4                 2085 	clr	a
   0786 24 06              2086 2$:	add	a,#6
   0788 90 7F B5           2087 	mov	dptr,#IN0BC
   078B F0                 2088 	movx	@dptr,a
   078C 02s08r5D           2089 	ljmp	setupack
   078F                    2090 setupstalld1:
   078F 02s08r59           2091 	ljmp	setupstall
   0792                    2092 cmdnotd1:
                           2093 	;; 0xd2
   0792 B4 D2 20           2094 	cjne	a,#0xd2,cmdnotd2
   0795 90 7F E8           2095 	mov	dptr,#SETUPDAT	; bRequestType == 0x40
   0798 E0                 2096 	movx	a,@dptr
   0799 B4 40 16           2097 	cjne	a,#0x40,setupstalld2
   079C 90 7F EA           2098 	mov	dptr,#SETUPDAT+2	; wValue
   079F E0                 2099 	movx	a,@dptr
   07A0 F5 F0              2100 	mov	b,a
   07A2 90 7F 98           2101 	mov	dptr,#OUTC
   07A5 E0                 2102 	movx	a,@dptr
   07A6 A2 F0              2103 	mov	c,b.0
   07A8 92 E3              2104 	mov	acc.3,c
   07AA A2 F1              2105 	mov	c,b.1
   07AC 92 E5              2106 	mov	acc.5,c
   07AE F0                 2107 	movx	@dptr,a
   07AF 02s08r5D           2108 	ljmp	setupack
   07B2                    2109 setupstalld2:
   07B2 02s08r59           2110 	ljmp	setupstall
   07B5                    2111 cmdnotd2:
                           2112 	;; 0xd3
   07B5 B4 D3 16           2113 	cjne	a,#0xd3,cmdnotd3
   07B8 90 7F E8           2114 	mov	dptr,#SETUPDAT	; bRequestType == 0x40
   07BB E0                 2115 	movx	a,@dptr
   07BC B4 40 07           2116 	cjne	a,#0x40,setupstalld3
   07BF 90 7F EA           2117 	mov	dptr,#SETUPDAT+2	; wValue
   07C2 E0                 2118 	movx	a,@dptr
   07C3 10*0B 03           2119 	jbc	uartempty,cmdd2cont
   07C6                    2120 setupstalld3:
   07C6 02s08r59           2121 	ljmp	setupstall
   07C9                    2122 cmdd2cont:
   07C9 F5 99              2123 	mov	sbuf0,a
   07CB 02s08r5D           2124 	ljmp	setupack
   07CE                    2125 cmdnotd3:
                           2126 	;; 0xd4
   07CE B4 D4 4C           2127 	cjne	a,#0xd4,cmdnotd4
   07D1 90 7F E8           2128 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   07D4 E0                 2129 	movx	a,@dptr
   07D5 B4 C0 42           2130 	cjne	a,#0xc0,setupstalld4
   07D8 20*08 3F           2131 	jb	extmodem,setupstalld4
   07DB 90 7F EC           2132 	mov	dptr,#SETUPDAT+4	; wIndex
   07DE E0                 2133 	movx	a,@dptr
   07DF 90 7F EA           2134 	mov	dptr,#SETUPDAT+2	; wValue
   07E2 B4 01 09           2135 	cjne	a,#1,0$
   07E5 E0                 2136 	movx	a,@dptr
   07E6 90 C0 0D           2137 	mov	dptr,#FSKMDISCOUT
   07E9 F0                 2138 	movx	@dptr,a
   07EA F5*2E              2139 	mov	mdiscout,a
   07EC 80 0A              2140 	sjmp	1$
   07EE B4 02 07           2141 0$:	cjne	a,#2,1$
   07F1 E0                 2142 	movx	a,@dptr
   07F2 90 C0 0C           2143 	mov	dptr,#FSKMDISCTRIS
   07F5 F0                 2144 	movx	@dptr,a
   07F6 F5*2D              2145 	mov	mdisctris,a
   07F8 90 C0 0E           2146 1$:	mov	dptr,#FSKMDISCIN
   07FB E0                 2147 	movx	a,@dptr
   07FC 90 7F 00           2148 	mov	dptr,#IN0BUF+0
   07FF F0                 2149 	movx	@dptr,a
   0800 E5*2E              2150 	mov	a,mdiscout
   0802 A3                 2151 	inc	dptr
   0803 F0                 2152 	movx	@dptr,a
   0804 E5*2D              2153 	mov	a,mdisctris
   0806 A3                 2154 	inc	dptr
   0807 F0                 2155 	movx	@dptr,a
                           2156 	;; length
   0808 90 7F EE           2157 	mov	dptr,#SETUPDAT+6	; wLength
   080B E0                 2158 	movx	a,@dptr
   080C 24 FD              2159 	add	a,#-3
   080E 50 01              2160 	jnc	2$
   0810 E4                 2161 	clr	a
   0811 24 03              2162 2$:	add	a,#3
   0813 90 7F B5           2163 	mov	dptr,#IN0BC
   0816 F0                 2164 	movx	@dptr,a
   0817 02s08r5D           2165 	ljmp	setupack
   081A                    2166 setupstalld4:
   081A 02s08r59           2167 	ljmp	setupstall
   081D                    2168 cmdnotd4:
                           2169 	;; 0xd5
   081D B4 D5 39           2170 	cjne	a,#0xd5,cmdnotd5
   0820 90 7F E8           2171 	mov	dptr,#SETUPDAT	; bRequestType == 0xc0
   0823 E0                 2172 	movx	a,@dptr
   0824 B4 C0 2F           2173 	cjne	a,#0xc0,setupstalld5
   0827 90 7F EC           2174 	mov	dptr,#SETUPDAT+4	; wIndex
   082A E0                 2175 	movx	a,@dptr
   082B B4 01 0A           2176 	cjne	a,#1,0$
   082E 90 7F EA           2177 	mov	dptr,#SETUPDAT+2	; wValue
   0831 E0                 2178 	movx	a,@dptr
   0832 90 C0 0A           2179 	mov	dptr,#FSKT7FOUT
   0835 F0                 2180 	movx	@dptr,a
   0836 F5*2C              2181 	mov	t7fout,a
   0838 90 C0 0B           2182 0$:	mov	dptr,#FSKT7FIN
   083B E0                 2183 	movx	a,@dptr
   083C 90 7F 00           2184 	mov	dptr,#IN0BUF+0
   083F F0                 2185 	movx	@dptr,a
   0840 E5*2C              2186 	mov	a,t7fout
   0842 A3                 2187 	inc	dptr
   0843 F0                 2188 	movx	@dptr,a
                           2189 	;; length
   0844 90 7F EE           2190 	mov	dptr,#SETUPDAT+6	; wLength
   0847 E0                 2191 	movx	a,@dptr
   0848 24 FE              2192 	add	a,#-2
   084A 50 01              2193 	jnc	2$
   084C E4                 2194 	clr	a
   084D 24 02              2195 2$:	add	a,#2
   084F 90 7F B5           2196 	mov	dptr,#IN0BC
   0852 F0                 2197 	movx	@dptr,a
   0853 02s08r5D           2198 	ljmp	setupack
   0856                    2199 setupstalld5:
   0856 02s08r59           2200 	ljmp	setupstall
   0859                    2201 cmdnotd5:
                           2202 	;; unknown commands fall through to setupstall
                           2203 
   0859                    2204 setupstall:
   0859 74 03              2205 	mov	a,#3
   085B 80 02              2206 	sjmp	endsetup
   085D                    2207 setupack:
   085D 74 02              2208 	mov	a,#2
   085F                    2209 endsetup:
   085F 90 7F B4           2210 	mov	dptr,#EP0CS
   0862 F0                 2211 	movx	@dptr,a
   0863                    2212 endusbisr:
                           2213 	;; epilogue
   0863 D0 07              2214 	pop	ar7
   0865 D0 00              2215 	pop	ar0
   0867 D0 86              2216 	pop	dps
   0869 D0 D0              2217 	pop	psw
   086B D0 85              2218 	pop	dph1
   086D D0 84              2219 	pop	dpl1
   086F D0 83              2220 	pop	dph0
   0871 D0 82              2221 	pop	dpl0
   0873 D0 F0              2222 	pop	b
   0875 D0 E0              2223 	pop	acc
   0877 32                 2224 	reti
                           2225 
   0878                    2226 usb_sof_isr:
   0878 C0 E0              2227 	push	acc
   087A C0 F0              2228 	push	b
   087C C0 82              2229 	push	dpl0
   087E C0 83              2230 	push	dph0
   0880 C0 D0              2231 	push	psw
   0882 75 D0 00           2232 	mov	psw,#0x00
   0885 C0 86              2233 	push	dps
   0887 75 86 00           2234 	mov	dps,#0
                           2235 	;; clear interrupt
   088A E5 91              2236 	mov	a,exif
   088C C2 E4              2237 	clr	acc.4
   088E F5 91              2238 	mov	exif,a
   0890 90 7F AB           2239 	mov	dptr,#USBIRQ
   0893 74 02              2240 	mov	a,#0x02
   0895 F0                 2241 	movx	@dptr,a
                           2242 	;; handle interrupt
                           2243 	;; epilogue
   0896 D0 86              2244 	pop	dps
   0898 D0 D0              2245 	pop	psw
   089A D0 83              2246 	pop	dph0
   089C D0 82              2247 	pop	dpl0
   089E D0 F0              2248 	pop	b
   08A0 D0 E0              2249 	pop	acc
   08A2 32                 2250 	reti
                           2251 
                           2252 
   08A3                    2253 usb_sutok_isr:
   08A3 C0 E0              2254 	push	acc
   08A5 C0 F0              2255 	push	b
   08A7 C0 82              2256 	push	dpl0
   08A9 C0 83              2257 	push	dph0
   08AB C0 D0              2258 	push	psw
   08AD 75 D0 00           2259 	mov	psw,#0x00
   08B0 C0 86              2260 	push	dps
   08B2 75 86 00           2261 	mov	dps,#0
                           2262 	;; clear interrupt
   08B5 E5 91              2263 	mov	a,exif
   08B7 C2 E4              2264 	clr	acc.4
   08B9 F5 91              2265 	mov	exif,a
   08BB 90 7F AB           2266 	mov	dptr,#USBIRQ
   08BE 74 04              2267 	mov	a,#0x04
   08C0 F0                 2268 	movx	@dptr,a
                           2269 	;; handle interrupt
                           2270 	;; epilogue
   08C1 D0 86              2271 	pop	dps
   08C3 D0 D0              2272 	pop	psw
   08C5 D0 83              2273 	pop	dph0
   08C7 D0 82              2274 	pop	dpl0
   08C9 D0 F0              2275 	pop	b
   08CB D0 E0              2276 	pop	acc
   08CD 32                 2277 	reti
                           2278 
   08CE                    2279 usb_suspend_isr:
   08CE C0 E0              2280 	push	acc
   08D0 C0 F0              2281 	push	b
   08D2 C0 82              2282 	push	dpl0
   08D4 C0 83              2283 	push	dph0
   08D6 C0 D0              2284 	push	psw
   08D8 75 D0 00           2285 	mov	psw,#0x00
   08DB C0 86              2286 	push	dps
   08DD 75 86 00           2287 	mov	dps,#0
                           2288 	;; clear interrupt
   08E0 E5 91              2289 	mov	a,exif
   08E2 C2 E4              2290 	clr	acc.4
   08E4 F5 91              2291 	mov	exif,a
   08E6 90 7F AB           2292 	mov	dptr,#USBIRQ
   08E9 74 08              2293 	mov	a,#0x08
   08EB F0                 2294 	movx	@dptr,a
                           2295 	;; handle interrupt
                           2296 	;; epilogue
   08EC D0 86              2297 	pop	dps
   08EE D0 D0              2298 	pop	psw
   08F0 D0 83              2299 	pop	dph0
   08F2 D0 82              2300 	pop	dpl0
   08F4 D0 F0              2301 	pop	b
   08F6 D0 E0              2302 	pop	acc
   08F8 32                 2303 	reti
                           2304 
   08F9                    2305 usb_usbreset_isr:
   08F9 C0 E0              2306 	push	acc
   08FB C0 F0              2307 	push	b
   08FD C0 82              2308 	push	dpl0
   08FF C0 83              2309 	push	dph0
   0901 C0 D0              2310 	push	psw
   0903 75 D0 00           2311 	mov	psw,#0x00
   0906 C0 86              2312 	push	dps
   0908 75 86 00           2313 	mov	dps,#0
                           2314 	;; clear interrupt
   090B E5 91              2315 	mov	a,exif
   090D C2 E4              2316 	clr	acc.4
   090F F5 91              2317 	mov	exif,a
   0911 90 7F AB           2318 	mov	dptr,#USBIRQ
   0914 74 10              2319 	mov	a,#0x10
   0916 F0                 2320 	movx	@dptr,a
                           2321 	;; handle interrupt
                           2322 	;; epilogue
   0917 D0 86              2323 	pop	dps
   0919 D0 D0              2324 	pop	psw
   091B D0 83              2325 	pop	dph0
   091D D0 82              2326 	pop	dpl0
   091F D0 F0              2327 	pop	b
   0921 D0 E0              2328 	pop	acc
   0923 32                 2329 	reti
                           2330 
   0924                    2331 usb_ep0in_isr:
   0924 C0 E0              2332 	push	acc
   0926 C0 F0              2333 	push	b
   0928 C0 82              2334 	push	dpl0
   092A C0 83              2335 	push	dph0
   092C C0 84              2336 	push	dpl1
   092E C0 85              2337 	push	dph1
   0930 C0 D0              2338 	push	psw
   0932 75 D0 00           2339 	mov	psw,#0x00
   0935 C0 86              2340 	push	dps
   0937 75 86 00           2341 	mov	dps,#0
   093A C0 00              2342 	push	ar0
   093C C0 07              2343 	push	ar7
                           2344 	;; clear interrupt
   093E E5 91              2345 	mov	a,exif
   0940 C2 E4              2346 	clr	acc.4
   0942 F5 91              2347 	mov	exif,a
   0944 90 7F A9           2348 	mov	dptr,#IN07IRQ
   0947 74 01              2349 	mov	a,#0x01
   0949 F0                 2350 	movx	@dptr,a
                           2351 	;; handle interrupt
                           2352 
                           2353 ;ep0install:
                           2354 ;	mov	a,#3
                           2355 ;	sjmp	ep0incs
                           2356 ;ep0inack:
                           2357 ;	mov	a,#2
                           2358 ;ep0incs:
                           2359 ;	mov	dptr,#EP0CS
                           2360 ;	movx	@dptr,a
                           2361 ;ep0inendisr:
                           2362 	;; epilogue
   094A D0 07              2363 	pop	ar7
   094C D0 00              2364 	pop	ar0
   094E D0 86              2365 	pop	dps
   0950 D0 D0              2366 	pop	psw
   0952 D0 85              2367 	pop	dph1
   0954 D0 84              2368 	pop	dpl1
   0956 D0 83              2369 	pop	dph0
   0958 D0 82              2370 	pop	dpl0
   095A D0 F0              2371 	pop	b
   095C D0 E0              2372 	pop	acc
   095E 32                 2373 	reti
                           2374 
   095F                    2375 usb_ep0out_isr:
   095F C0 E0              2376 	push	acc
   0961 C0 F0              2377 	push	b
   0963 C0 82              2378 	push	dpl0
   0965 C0 83              2379 	push	dph0
   0967 C0 84              2380 	push	dpl1
   0969 C0 85              2381 	push	dph1
   096B C0 D0              2382 	push	psw
   096D 75 D0 00           2383 	mov	psw,#0x00
   0970 C0 86              2384 	push	dps
   0972 75 86 00           2385 	mov	dps,#0
   0975 C0 00              2386 	push	ar0
   0977 C0 06              2387 	push	ar6
                           2388 	;; clear interrupt
   0979 E5 91              2389 	mov	a,exif
   097B C2 E4              2390 	clr	acc.4
   097D F5 91              2391 	mov	exif,a
   097F 90 7F AA           2392 	mov	dptr,#OUT07IRQ
   0982 74 01              2393 	mov	a,#0x01
   0984 F0                 2394 	movx	@dptr,a
                           2395 	;; handle interrupt
                           2396 
                           2397 ;ep0outstall:
                           2398 ;	mov	ctrlcode,#0
                           2399 ;	mov	a,#3
                           2400 ;	sjmp	ep0outcs
                           2401 ;ep0outack:
                           2402 ;	mov	txwr,txtwr
                           2403 ;	mov	ctrlcode,#0
                           2404 ;	mov	a,#2
                           2405 ;ep0outcs:
                           2406 ;	mov	dptr,#EP0CS
                           2407 ;	movx	@dptr,a
                           2408 ;ep0outendisr:
                           2409 	;; epilogue
   0985 D0 06              2410 	pop	ar6
   0987 D0 00              2411 	pop	ar0
   0989 D0 86              2412 	pop	dps
   098B D0 D0              2413 	pop	psw
   098D D0 85              2414 	pop	dph1
   098F D0 84              2415 	pop	dpl1
   0991 D0 83              2416 	pop	dph0
   0993 D0 82              2417 	pop	dpl0
   0995 D0 F0              2418 	pop	b
   0997 D0 E0              2419 	pop	acc
   0999 32                 2420 	reti
                           2421 
   099A                    2422 fillusbintr::
   099A E5*05              2423 	mov	a,txstate
   099C F5 F0              2424 	mov	b,a
   099E D2 F2              2425 	setb	b.2
   09A0 45*10              2426 	orl	a,pttforce
   09A2 B4 00 02           2427 	cjne	a,#0,0$
   09A5 C2 F2              2428 	clr	b.2
   09A7 90 C0 0E           2429 0$:	mov	dptr,#FSKMDISCIN
   09AA E0                 2430 	movx	a,@dptr
   09AB A2 E6              2431 	mov	c,acc.6
   09AD B3                 2432 	cpl	c
   09AE 82*08              2433 	anl	c,extmodem
   09B0 92 F3              2434 	mov	b.3,c
   09B2 90 C0 09           2435 	mov	dptr,#FSKSTAT
   09B5 E0                 2436 	movx	a,@dptr
   09B6 A2 E0              2437 	mov	c,acc.0
   09B8 B0r08              2438 	anl	c,/extmodem
   09BA 72 F3              2439 	orl	c,b.3
   09BC 92 F3              2440 	mov	b.3,c
   09BE A2*0B              2441 	mov	c,uartempty
   09C0 92 F5              2442 	mov	b.5,c
   09C2 D3                 2443 	setb	c
   09C3 E5*13              2444 	mov	a,rxrd
   09C5 B5*12 06           2445 	cjne	a,rxwr,1$
   09C8 90 7F B8           2446 	mov	dptr,#(IN2CS)
   09CB E0                 2447 	movx	a,@dptr
   09CC A2 E1              2448 	mov	c,acc.1
   09CE 92 F4              2449 1$:	mov	b.4,c
                           2450 	;; bytewide elements
   09D0 90 7E 80           2451 	mov	dptr,#(IN1BUF)
   09D3 E5 F0              2452 	mov	a,b
   09D5 F0                 2453 	movx	@dptr,a
   09D6 E5*08              2454 	mov	a,txwr
   09D8 F4                 2455 	cpl	a
   09D9 25*09              2456 	add	a,txrd
   09DB 54 0F              2457 	anl	a,#(TXCHUNKS-1)
   09DD 90 7E 81           2458 	mov	dptr,#(IN1BUF+1)
   09E0 F0                 2459 	movx	@dptr,a
   09E1 E5*13              2460 	mov	a,rxrd
   09E3 F4                 2461 	cpl	a
   09E4 25*12              2462 	add	a,rxwr
   09E6 04                 2463 	inc	a
   09E7 54 1F              2464 	anl	a,#(RXCHUNKS-1)
   09E9 90 7E 82           2465 	mov	dptr,#(IN1BUF+2)
   09EC F0                 2466 	movx	@dptr,a
   09ED 90 C0 04           2467 	mov	dptr,#FSKRSSI
   09F0 E0                 2468 	movx	a,@dptr
   09F1 90 7E 83           2469 	mov	dptr,#(IN1BUF+3)
   09F4 F0                 2470 	movx	@dptr,a
                           2471 	; counter
   09F5 05*04              2472 	inc	irqcount
   09F7 E5*04              2473 	mov	a,irqcount
   09F9 90 7E 84           2474 	mov	dptr,#(IN1BUF+4)
   09FC F0                 2475 	movx	@dptr,a
                           2476 	; UART buffer
   09FD 75 F0 05           2477 	mov	b,#5
   0A00 90 7E 85           2478 	mov	dptr,#(IN1BUF+5)
   0A03 E5*2B              2479 2$:	mov	a,uartrd
   0A05 B5*2A 07           2480 	cjne	a,uartwr,3$
                           2481 	; set length
   0A08 90 7F B7           2482 	mov	dptr,#IN1BC
   0A0B E5 F0              2483 	mov	a,b
   0A0D F0                 2484 	movx	@dptr,a
   0A0E 22                 2485 	ret
                           2486 	
   0A0F 24r1A              2487 3$:	add	a,#uartbuf
   0A11 F8                 2488 	mov	r0,a
   0A12 E6                 2489 	mov	a,@r0
   0A13 F0                 2490 	movx	@dptr,a
   0A14 A3                 2491 	inc	dptr
   0A15 05 F0              2492 	inc	b
   0A17 E5*2B              2493 	mov	a,uartrd
   0A19 04                 2494 	inc	a
   0A1A 54 0F              2495 	anl	a,#0xf
   0A1C F5*2B              2496 	mov	uartrd,a
   0A1E 80 E3              2497 	sjmp	2$
                           2498 
                           2499 	
   0A20                    2500 usb_ep1in_isr:
   0A20 C0 E0              2501 	push	acc
   0A22 C0 F0              2502 	push	b
   0A24 C0 82              2503 	push	dpl0
   0A26 C0 83              2504 	push	dph0
   0A28 C0 D0              2505 	push	psw
   0A2A 75 D0 00           2506 	mov	psw,#0x00
   0A2D C0 86              2507 	push	dps
   0A2F 75 86 00           2508 	mov	dps,#0
                           2509 	;; clear interrupt
   0A32 E5 91              2510 	mov	a,exif
   0A34 C2 E4              2511 	clr	acc.4
   0A36 F5 91              2512 	mov	exif,a
   0A38 90 7F A9           2513 	mov	dptr,#IN07IRQ
   0A3B 74 02              2514 	mov	a,#0x02
   0A3D F0                 2515 	movx	@dptr,a
                           2516 	;; handle interrupt
   0A3E 12s09r9A           2517 	lcall	fillusbintr
                           2518 	;; epilogue
   0A41 D0 86              2519 	pop	dps
   0A43 D0 D0              2520 	pop	psw
   0A45 D0 83              2521 	pop	dph0
   0A47 D0 82              2522 	pop	dpl0
   0A49 D0 F0              2523 	pop	b
   0A4B D0 E0              2524 	pop	acc
   0A4D 32                 2525 	reti
                           2526 
   0A4E                    2527 usb_ep1out_isr:
   0A4E C0 E0              2528 	push	acc
   0A50 C0 F0              2529 	push	b
   0A52 C0 82              2530 	push	dpl0
   0A54 C0 83              2531 	push	dph0
   0A56 C0 D0              2532 	push	psw
   0A58 75 D0 00           2533 	mov	psw,#0x00
   0A5B C0 86              2534 	push	dps
   0A5D 75 86 00           2535 	mov	dps,#0
                           2536 	;; clear interrupt
   0A60 E5 91              2537 	mov	a,exif
   0A62 C2 E4              2538 	clr	acc.4
   0A64 F5 91              2539 	mov	exif,a
   0A66 90 7F AA           2540 	mov	dptr,#OUT07IRQ
   0A69 74 02              2541 	mov	a,#0x02
   0A6B F0                 2542 	movx	@dptr,a
                           2543 	;; handle interrupt
                           2544 	;; epilogue
   0A6C D0 86              2545 	pop	dps
   0A6E D0 D0              2546 	pop	psw
   0A70 D0 83              2547 	pop	dph0
   0A72 D0 82              2548 	pop	dpl0
   0A74 D0 F0              2549 	pop	b
   0A76 D0 E0              2550 	pop	acc
   0A78 32                 2551 	reti
                           2552 
   0A79                    2553 usb_ep2in_isr:
   0A79 C0 E0              2554 	push	acc
   0A7B C0 F0              2555 	push	b
   0A7D C0 82              2556 	push	dpl0
   0A7F C0 83              2557 	push	dph0
   0A81 C0 D0              2558 	push	psw
   0A83 75 D0 00           2559 	mov	psw,#0x00
   0A86 C0 86              2560 	push	dps
   0A88 75 86 00           2561 	mov	dps,#0
                           2562 	;; clear interrupt
   0A8B E5 91              2563 	mov	a,exif
   0A8D C2 E4              2564 	clr	acc.4
   0A8F F5 91              2565 	mov	exif,a
   0A91 90 7F A9           2566 	mov	dptr,#IN07IRQ
   0A94 74 04              2567 	mov	a,#0x04
   0A96 F0                 2568 	movx	@dptr,a
                           2569 	;; handle interrupt
                           2570 	;; epilogue
   0A97 D0 86              2571 	pop	dps
   0A99 D0 D0              2572 	pop	psw
   0A9B D0 83              2573 	pop	dph0
   0A9D D0 82              2574 	pop	dpl0
   0A9F D0 F0              2575 	pop	b
   0AA1 D0 E0              2576 	pop	acc
   0AA3 32                 2577 	reti
                           2578 
   0AA4                    2579 usb_ep2out_isr:
   0AA4 C0 E0              2580 	push	acc
   0AA6 C0 F0              2581 	push	b
   0AA8 C0 82              2582 	push	dpl0
   0AAA C0 83              2583 	push	dph0
   0AAC C0 D0              2584 	push	psw
   0AAE 75 D0 00           2585 	mov	psw,#0x00
   0AB1 C0 86              2586 	push	dps
   0AB3 75 86 00           2587 	mov	dps,#0
                           2588 	;; clear interrupt
   0AB6 E5 91              2589 	mov	a,exif
   0AB8 C2 E4              2590 	clr	acc.4
   0ABA F5 91              2591 	mov	exif,a
   0ABC 90 7F AA           2592 	mov	dptr,#OUT07IRQ
   0ABF 74 04              2593 	mov	a,#0x04
   0AC1 F0                 2594 	movx	@dptr,a
                           2595 	;; handle interrupt
                           2596 	;; epilogue
   0AC2 D0 86              2597 	pop	dps
   0AC4 D0 D0              2598 	pop	psw
   0AC6 D0 83              2599 	pop	dph0
   0AC8 D0 82              2600 	pop	dpl0
   0ACA D0 F0              2601 	pop	b
   0ACC D0 E0              2602 	pop	acc
   0ACE 32                 2603 	reti
                           2604 
   0ACF                    2605 usb_ep3in_isr:
   0ACF C0 E0              2606 	push	acc
   0AD1 C0 F0              2607 	push	b
   0AD3 C0 82              2608 	push	dpl0
   0AD5 C0 83              2609 	push	dph0
   0AD7 C0 D0              2610 	push	psw
   0AD9 75 D0 00           2611 	mov	psw,#0x00
   0ADC C0 86              2612 	push	dps
   0ADE 75 86 00           2613 	mov	dps,#0
                           2614 	;; clear interrupt
   0AE1 E5 91              2615 	mov	a,exif
   0AE3 C2 E4              2616 	clr	acc.4
   0AE5 F5 91              2617 	mov	exif,a
   0AE7 90 7F A9           2618 	mov	dptr,#IN07IRQ
   0AEA 74 08              2619 	mov	a,#0x08
   0AEC F0                 2620 	movx	@dptr,a
                           2621 	;; handle interrupt
                           2622 	;; epilogue
   0AED D0 86              2623 	pop	dps
   0AEF D0 D0              2624 	pop	psw
   0AF1 D0 83              2625 	pop	dph0
   0AF3 D0 82              2626 	pop	dpl0
   0AF5 D0 F0              2627 	pop	b
   0AF7 D0 E0              2628 	pop	acc
   0AF9 32                 2629 	reti
                           2630 
   0AFA                    2631 usb_ep3out_isr:
   0AFA C0 E0              2632 	push	acc
   0AFC C0 F0              2633 	push	b
   0AFE C0 82              2634 	push	dpl0
   0B00 C0 83              2635 	push	dph0
   0B02 C0 D0              2636 	push	psw
   0B04 75 D0 00           2637 	mov	psw,#0x00
   0B07 C0 86              2638 	push	dps
   0B09 75 86 00           2639 	mov	dps,#0
                           2640 	;; clear interrupt
   0B0C E5 91              2641 	mov	a,exif
   0B0E C2 E4              2642 	clr	acc.4
   0B10 F5 91              2643 	mov	exif,a
   0B12 90 7F AA           2644 	mov	dptr,#OUT07IRQ
   0B15 74 08              2645 	mov	a,#0x08
   0B17 F0                 2646 	movx	@dptr,a
                           2647 	;; handle interrupt
                           2648 	;; epilogue
   0B18 D0 86              2649 	pop	dps
   0B1A D0 D0              2650 	pop	psw
   0B1C D0 83              2651 	pop	dph0
   0B1E D0 82              2652 	pop	dpl0
   0B20 D0 F0              2653 	pop	b
   0B22 D0 E0              2654 	pop	acc
   0B24 32                 2655 	reti
                           2656 
   0B25                    2657 usb_ep4in_isr:
   0B25 C0 E0              2658 	push	acc
   0B27 C0 F0              2659 	push	b
   0B29 C0 82              2660 	push	dpl0
   0B2B C0 83              2661 	push	dph0
   0B2D C0 D0              2662 	push	psw
   0B2F 75 D0 00           2663 	mov	psw,#0x00
   0B32 C0 86              2664 	push	dps
   0B34 75 86 00           2665 	mov	dps,#0
                           2666 	;; clear interrupt
   0B37 E5 91              2667 	mov	a,exif
   0B39 C2 E4              2668 	clr	acc.4
   0B3B F5 91              2669 	mov	exif,a
   0B3D 90 7F A9           2670 	mov	dptr,#IN07IRQ
   0B40 74 10              2671 	mov	a,#0x10
   0B42 F0                 2672 	movx	@dptr,a
                           2673 	;; handle interrupt
                           2674 	;; epilogue
   0B43 D0 86              2675 	pop	dps
   0B45 D0 D0              2676 	pop	psw
   0B47 D0 83              2677 	pop	dph0
   0B49 D0 82              2678 	pop	dpl0
   0B4B D0 F0              2679 	pop	b
   0B4D D0 E0              2680 	pop	acc
   0B4F 32                 2681 	reti
                           2682 
   0B50                    2683 usb_ep4out_isr:
   0B50 C0 E0              2684 	push	acc
   0B52 C0 F0              2685 	push	b
   0B54 C0 82              2686 	push	dpl0
   0B56 C0 83              2687 	push	dph0
   0B58 C0 D0              2688 	push	psw
   0B5A 75 D0 00           2689 	mov	psw,#0x00
   0B5D C0 86              2690 	push	dps
   0B5F 75 86 00           2691 	mov	dps,#0
                           2692 	;; clear interrupt
   0B62 E5 91              2693 	mov	a,exif
   0B64 C2 E4              2694 	clr	acc.4
   0B66 F5 91              2695 	mov	exif,a
   0B68 90 7F AA           2696 	mov	dptr,#OUT07IRQ
   0B6B 74 10              2697 	mov	a,#0x10
   0B6D F0                 2698 	movx	@dptr,a
                           2699 	;; handle interrupt
                           2700 	;; epilogue
   0B6E D0 86              2701 	pop	dps
   0B70 D0 D0              2702 	pop	psw
   0B72 D0 83              2703 	pop	dph0
   0B74 D0 82              2704 	pop	dpl0
   0B76 D0 F0              2705 	pop	b
   0B78 D0 E0              2706 	pop	acc
   0B7A 32                 2707 	reti
                           2708 
   0B7B                    2709 usb_ep5in_isr:
   0B7B C0 E0              2710 	push	acc
   0B7D C0 F0              2711 	push	b
   0B7F C0 82              2712 	push	dpl0
   0B81 C0 83              2713 	push	dph0
   0B83 C0 D0              2714 	push	psw
   0B85 75 D0 00           2715 	mov	psw,#0x00
   0B88 C0 86              2716 	push	dps
   0B8A 75 86 00           2717 	mov	dps,#0
                           2718 	;; clear interrupt
   0B8D E5 91              2719 	mov	a,exif
   0B8F C2 E4              2720 	clr	acc.4
   0B91 F5 91              2721 	mov	exif,a
   0B93 90 7F A9           2722 	mov	dptr,#IN07IRQ
   0B96 74 20              2723 	mov	a,#0x20
   0B98 F0                 2724 	movx	@dptr,a
                           2725 	;; handle interrupt
                           2726 	;; epilogue
   0B99 D0 86              2727 	pop	dps
   0B9B D0 D0              2728 	pop	psw
   0B9D D0 83              2729 	pop	dph0
   0B9F D0 82              2730 	pop	dpl0
   0BA1 D0 F0              2731 	pop	b
   0BA3 D0 E0              2732 	pop	acc
   0BA5 32                 2733 	reti
                           2734 
   0BA6                    2735 usb_ep5out_isr:
   0BA6 C0 E0              2736 	push	acc
   0BA8 C0 F0              2737 	push	b
   0BAA C0 82              2738 	push	dpl0
   0BAC C0 83              2739 	push	dph0
   0BAE C0 D0              2740 	push	psw
   0BB0 75 D0 00           2741 	mov	psw,#0x00
   0BB3 C0 86              2742 	push	dps
   0BB5 75 86 00           2743 	mov	dps,#0
                           2744 	;; clear interrupt
   0BB8 E5 91              2745 	mov	a,exif
   0BBA C2 E4              2746 	clr	acc.4
   0BBC F5 91              2747 	mov	exif,a
   0BBE 90 7F AA           2748 	mov	dptr,#OUT07IRQ
   0BC1 74 20              2749 	mov	a,#0x20
   0BC3 F0                 2750 	movx	@dptr,a
                           2751 	;; handle interrupt
                           2752 	;; epilogue
   0BC4 D0 86              2753 	pop	dps
   0BC6 D0 D0              2754 	pop	psw
   0BC8 D0 83              2755 	pop	dph0
   0BCA D0 82              2756 	pop	dpl0
   0BCC D0 F0              2757 	pop	b
   0BCE D0 E0              2758 	pop	acc
   0BD0 32                 2759 	reti
                           2760 
   0BD1                    2761 usb_ep6in_isr:
   0BD1 C0 E0              2762 	push	acc
   0BD3 C0 F0              2763 	push	b
   0BD5 C0 82              2764 	push	dpl0
   0BD7 C0 83              2765 	push	dph0
   0BD9 C0 D0              2766 	push	psw
   0BDB 75 D0 00           2767 	mov	psw,#0x00
   0BDE C0 86              2768 	push	dps
   0BE0 75 86 00           2769 	mov	dps,#0
                           2770 	;; clear interrupt
   0BE3 E5 91              2771 	mov	a,exif
   0BE5 C2 E4              2772 	clr	acc.4
   0BE7 F5 91              2773 	mov	exif,a
   0BE9 90 7F A9           2774 	mov	dptr,#IN07IRQ
   0BEC 74 40              2775 	mov	a,#0x40
   0BEE F0                 2776 	movx	@dptr,a
                           2777 	;; handle interrupt
                           2778 	;; epilogue
   0BEF D0 86              2779 	pop	dps
   0BF1 D0 D0              2780 	pop	psw
   0BF3 D0 83              2781 	pop	dph0
   0BF5 D0 82              2782 	pop	dpl0
   0BF7 D0 F0              2783 	pop	b
   0BF9 D0 E0              2784 	pop	acc
   0BFB 32                 2785 	reti
                           2786 
   0BFC                    2787 usb_ep6out_isr:
   0BFC C0 E0              2788 	push	acc
   0BFE C0 F0              2789 	push	b
   0C00 C0 82              2790 	push	dpl0
   0C02 C0 83              2791 	push	dph0
   0C04 C0 D0              2792 	push	psw
   0C06 75 D0 00           2793 	mov	psw,#0x00
   0C09 C0 86              2794 	push	dps
   0C0B 75 86 00           2795 	mov	dps,#0
                           2796 	;; clear interrupt
   0C0E E5 91              2797 	mov	a,exif
   0C10 C2 E4              2798 	clr	acc.4
   0C12 F5 91              2799 	mov	exif,a
   0C14 90 7F AA           2800 	mov	dptr,#OUT07IRQ
   0C17 74 40              2801 	mov	a,#0x40
   0C19 F0                 2802 	movx	@dptr,a
                           2803 	;; handle interrupt
                           2804 	;; epilogue
   0C1A D0 86              2805 	pop	dps
   0C1C D0 D0              2806 	pop	psw
   0C1E D0 83              2807 	pop	dph0
   0C20 D0 82              2808 	pop	dpl0
   0C22 D0 F0              2809 	pop	b
   0C24 D0 E0              2810 	pop	acc
   0C26 32                 2811 	reti
                           2812 
   0C27                    2813 usb_ep7in_isr:
   0C27 C0 E0              2814 	push	acc
   0C29 C0 F0              2815 	push	b
   0C2B C0 82              2816 	push	dpl0
   0C2D C0 83              2817 	push	dph0
   0C2F C0 D0              2818 	push	psw
   0C31 75 D0 00           2819 	mov	psw,#0x00
   0C34 C0 86              2820 	push	dps
   0C36 75 86 00           2821 	mov	dps,#0
                           2822 	;; clear interrupt
   0C39 E5 91              2823 	mov	a,exif
   0C3B C2 E4              2824 	clr	acc.4
   0C3D F5 91              2825 	mov	exif,a
   0C3F 90 7F A9           2826 	mov	dptr,#IN07IRQ
   0C42 74 80              2827 	mov	a,#0x80
   0C44 F0                 2828 	movx	@dptr,a
                           2829 	;; handle interrupt
                           2830 	;; epilogue
   0C45 D0 86              2831 	pop	dps
   0C47 D0 D0              2832 	pop	psw
   0C49 D0 83              2833 	pop	dph0
   0C4B D0 82              2834 	pop	dpl0
   0C4D D0 F0              2835 	pop	b
   0C4F D0 E0              2836 	pop	acc
   0C51 32                 2837 	reti
                           2838 
   0C52                    2839 usb_ep7out_isr:
   0C52 C0 E0              2840 	push	acc
   0C54 C0 F0              2841 	push	b
   0C56 C0 82              2842 	push	dpl0
   0C58 C0 83              2843 	push	dph0
   0C5A C0 D0              2844 	push	psw
   0C5C 75 D0 00           2845 	mov	psw,#0x00
   0C5F C0 86              2846 	push	dps
   0C61 75 86 00           2847 	mov	dps,#0
                           2848 	;; clear interrupt
   0C64 E5 91              2849 	mov	a,exif
   0C66 C2 E4              2850 	clr	acc.4
   0C68 F5 91              2851 	mov	exif,a
   0C6A 90 7F AA           2852 	mov	dptr,#OUT07IRQ
   0C6D 74 80              2853 	mov	a,#0x80
   0C6F F0                 2854 	movx	@dptr,a
                           2855 	;; handle interrupt
                           2856 	;; epilogue
   0C70 D0 86              2857 	pop	dps
   0C72 D0 D0              2858 	pop	psw
   0C74 D0 83              2859 	pop	dph0
   0C76 D0 82              2860 	pop	dpl0
   0C78 D0 F0              2861 	pop	b
   0C7A D0 E0              2862 	pop	acc
   0C7C 32                 2863 	reti
                           2864 	
                           2865 	;; -----------------------------------------------------
                           2866 	;; USB descriptors
                           2867 	;; -----------------------------------------------------
                           2868 
                           2869 	;; Device and/or Interface Class codes
                    0000   2870 	USB_CLASS_PER_INTERFACE         = 0
                    0001   2871 	USB_CLASS_AUDIO                 = 1
                    0002   2872 	USB_CLASS_COMM                  = 2
                    0003   2873 	USB_CLASS_HID                   = 3
                    0007   2874 	USB_CLASS_PRINTER               = 7
                    0008   2875 	USB_CLASS_MASS_STORAGE          = 8
                    0009   2876 	USB_CLASS_HUB                   = 9
                    00FF   2877 	USB_CLASS_VENDOR_SPEC           = 0xff
                           2878 
                           2879 	;; Descriptor types
                    0001   2880 	USB_DT_DEVICE                   = 0x01
                    0002   2881 	USB_DT_CONFIG                   = 0x02
                    0003   2882 	USB_DT_STRING                   = 0x03
                    0004   2883 	USB_DT_INTERFACE                = 0x04
                    0005   2884 	USB_DT_ENDPOINT                 = 0x05
                           2885 
                           2886 	;; Standard requests
                    0000   2887 	USB_REQ_GET_STATUS              = 0x00
                    0001   2888 	USB_REQ_CLEAR_FEATURE           = 0x01
                    0003   2889 	USB_REQ_SET_FEATURE             = 0x03
                    0005   2890 	USB_REQ_SET_ADDRESS             = 0x05
                    0006   2891 	USB_REQ_GET_DESCRIPTOR          = 0x06
                    0007   2892 	USB_REQ_SET_DESCRIPTOR          = 0x07
                    0008   2893 	USB_REQ_GET_CONFIGURATION       = 0x08
                    0009   2894 	USB_REQ_SET_CONFIGURATION       = 0x09
                    000A   2895 	USB_REQ_GET_INTERFACE           = 0x0A
                    000B   2896 	USB_REQ_SET_INTERFACE           = 0x0B
                    000C   2897 	USB_REQ_SYNCH_FRAME             = 0x0C
                           2898 
                           2899 	;; USB Request Type and Endpoint Directions
                    0000   2900 	USB_DIR_OUT                     = 0
                    0080   2901 	USB_DIR_IN                      = 0x80
                           2902 
                    0000   2903 	USB_TYPE_STANDARD               = (0x00 << 5)
                    0020   2904 	USB_TYPE_CLASS                  = (0x01 << 5)
                    0040   2905 	USB_TYPE_VENDOR                 = (0x02 << 5)
                    0060   2906 	USB_TYPE_RESERVED               = (0x03 << 5)
                           2907 
                    0000   2908 	USB_RECIP_DEVICE                = 0x00
                    0001   2909 	USB_RECIP_INTERFACE             = 0x01
                    0002   2910 	USB_RECIP_ENDPOINT              = 0x02
                    0003   2911 	USB_RECIP_OTHER                 = 0x03
                           2912 
                           2913 	;; Request target types.
                    0000   2914 	USB_RT_DEVICE                   = 0x00
                    0001   2915 	USB_RT_INTERFACE                = 0x01
                    0002   2916 	USB_RT_ENDPOINT                 = 0x02
                           2917 
                    BAC0   2918 	VENDID	= 0xbac0
                    6136   2919 	PRODID	= 0x6136
                           2920 
   0C7D                    2921 devicedescr:
   0C7D 12                 2922 	.db	18			; bLength
   0C7E 01                 2923 	.db	USB_DT_DEVICE		; bDescriptorType
   0C7F 00 01              2924 	.db	0x00, 0x01		; bcdUSB
   0C81 FF                 2925 	.db	USB_CLASS_VENDOR_SPEC	; bDeviceClass
   0C82 00                 2926 	.db	0			; bDeviceSubClass
   0C83 FF                 2927 	.db	0xff			; bDeviceProtocol
   0C84 40                 2928 	.db	0x40			; bMaxPacketSize0
   0C85 C0 BA              2929 	.db	<VENDID,>VENDID		; idVendor
   0C87 36 61              2930 	.db	<PRODID,>PRODID		; idProduct
   0C89 02 00              2931 	.db	0x02,0x00		; bcdDevice
   0C8B 01                 2932 	.db	1			; iManufacturer
   0C8C 02                 2933 	.db	2			; iProduct
   0C8D 03                 2934 	.db	3			; iSerialNumber
   0C8E 01                 2935 	.db	1			; bNumConfigurations
                           2936 
   0C8F                    2937 config0descr:
   0C8F 09                 2938 	.db	9			; bLength
   0C90 02                 2939 	.db	USB_DT_CONFIG		; bDescriptorType
   0C91 45 00              2940 	.db	<config0sz,>config0sz	; wTotalLength
   0C93 01                 2941 	.db	1			; bNumInterfaces
   0C94 01                 2942 	.db	1			; bConfigurationValue
   0C95 00                 2943 	.db	0			; iConfiguration
   0C96 40                 2944 	.db	0b01000000		; bmAttributs (self powered)
   0C97 00                 2945 	.db	0			; MaxPower (mA/2) (self powered so 0)
                           2946 	;; interface descriptor I0:A0
   0C98 09                 2947 	.db	9			; bLength
   0C99 04                 2948 	.db	USB_DT_INTERFACE	; bDescriptorType
   0C9A 00                 2949 	.db	0			; bInterfaceNumber
   0C9B 00                 2950 	.db	0			; bAlternateSetting
   0C9C 03                 2951 	.db	3			; bNumEndpoints
   0C9D FF                 2952 	.db	0xff			; bInterfaceClass (vendor specific)
   0C9E 00                 2953 	.db	0x00			; bInterfaceSubClass
   0C9F FF                 2954 	.db	0xff			; bInterfaceProtocol (vendor specific)
   0CA0 00                 2955 	.db	0			; iInterface
                           2956 	;; endpoint descriptor I0:A0:E0
   0CA1 07                 2957 	.db	7			; bLength
   0CA2 05                 2958 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CA3 81                 2959 	.db	(USB_DIR_IN | 1)	; bEndpointAddress
   0CA4 02                 2960 	.db	0x02			; bmAttributes (bulk)
   0CA5 40 00              2961 	.db	0x40,0x00		; wMaxPacketSize
   0CA7 00                 2962 	.db	0			; bInterval
                           2963 	;; endpoint descriptor I0:A0:E1
   0CA8 07                 2964 	.db	7			; bLength
   0CA9 05                 2965 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CAA 82                 2966 	.db	(USB_DIR_IN | 2)	; bEndpointAddress
   0CAB 02                 2967 	.db	0x02			; bmAttributes (bulk)
   0CAC 40 00              2968 	.db	0x40,0x00		; wMaxPacketSize
   0CAE 00                 2969 	.db	0			; bInterval
                           2970 	;; endpoint descriptor I0:A0:E2
   0CAF 07                 2971 	.db	7			; bLength
   0CB0 05                 2972 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CB1 02                 2973 	.db	(USB_DIR_OUT | 2)	; bEndpointAddress
   0CB2 02                 2974 	.db	0x02			; bmAttributes (bulk)
   0CB3 40 00              2975 	.db	0x40,0x00		; wMaxPacketSize
   0CB5 00                 2976 	.db	0			; bInterval
                           2977 	;; interface descriptor I0:A1
   0CB6 09                 2978 	.db	9			; bLength
   0CB7 04                 2979 	.db	USB_DT_INTERFACE	; bDescriptorType
   0CB8 00                 2980 	.db	0			; bInterfaceNumber
   0CB9 01                 2981 	.db	1			; bAlternateSetting
   0CBA 03                 2982 	.db	3			; bNumEndpoints
   0CBB FF                 2983 	.db	0xff			; bInterfaceClass (vendor specific)
   0CBC 00                 2984 	.db	0x00			; bInterfaceSubClass
   0CBD FF                 2985 	.db	0xff			; bInterfaceProtocol (vendor specific)
   0CBE 00                 2986 	.db	0			; iInterface
                           2987 	;; endpoint descriptor I0:A1:E0
   0CBF 07                 2988 	.db	7			; bLength
   0CC0 05                 2989 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CC1 81                 2990 	.db	(USB_DIR_IN | 1)	; bEndpointAddress
   0CC2 03                 2991 	.db	0x03			; bmAttributes (interrupt)
   0CC3 40 00              2992 	.db	0x40,0x00		; wMaxPacketSize
   0CC5 0A                 2993 	.db	10			; bInterval
                           2994 	;; endpoint descriptor I0:A1:E1
   0CC6 07                 2995 	.db	7			; bLength
   0CC7 05                 2996 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CC8 82                 2997 	.db	(USB_DIR_IN | 2)	; bEndpointAddress
   0CC9 02                 2998 	.db	0x02			; bmAttributes (bulk)
   0CCA 40 00              2999 	.db	0x40,0x00		; wMaxPacketSize
   0CCC 00                 3000 	.db	0			; bInterval
                           3001 	;; endpoint descriptor I0:A1:E2
   0CCD 07                 3002 	.db	7			; bLength
   0CCE 05                 3003 	.db	USB_DT_ENDPOINT		; bDescriptorType
   0CCF 02                 3004 	.db	(USB_DIR_OUT | 2)	; bEndpointAddress
   0CD0 02                 3005 	.db	0x02			; bmAttributes (bulk)
   0CD1 40 00              3006 	.db	0x40,0x00		; wMaxPacketSize
   0CD3 00                 3007 	.db	0			; bInterval
                           3008 
                    0045   3009 config0sz = . - config0descr
                           3010 
   0CD4                    3011 stringdescr:
   0CD4rDCs0C              3012 	.db	<string0,>string0
   0CD6rE0s0C              3013 	.db	<string1,>string1
   0CD8rEEs0C              3014 	.db	<string2,>string2
   0CDAr0As0D              3015 	.db	<stringserial,>stringserial
                           3016 
                    0004   3017 numstrings = (. - stringdescr)/2
                           3018 
   0CDC                    3019 string0:
   0CDC 04                 3020 	.db	string0sz		; bLength
   0CDD 03                 3021 	.db	USB_DT_STRING		; bDescriptorType
   0CDE 00 00              3022 	.db	0,0			; LANGID[0]: Lang Neutral
                    0004   3023 string0sz = . - string0
                           3024 
   0CE0                    3025 string1:
   0CE0 0E                 3026 	.db	string1sz		; bLength
   0CE1 03                 3027 	.db	USB_DT_STRING		; bDescriptorType
   0CE2 42 00 61 00 79 00  3028 	.db	'B,0,'a,0,'y,0,'c,0,'o,0,'m,0
        63 00 6F 00 6D 00
                    000E   3029 string1sz = . - string1
                           3030 
   0CEE                    3031 string2:
   0CEE 1C                 3032 	.db	string2sz		; bLength
   0CEF 03                 3033 	.db	USB_DT_STRING		; bDescriptorType
   0CF0 55 00 53 00 42 00  3034 	.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
   0D00 28 00 46 00 53 00  3035 	.db	'(,0,'F,0,'S,0,'K,0,'),0
        4B 00 29 00
                    001C   3036 string2sz = . - string2
                           3037 
   0D0A                    3038 stringserial:
   0D0A 02                 3039 	.db	2			; bLength
   0D0B 03                 3040 	.db	USB_DT_STRING		; bDescriptorType
   0D0C 00 00 00 00 00 00  3041 	.dw	0,0,0,0,0,0,0,0
        00 00 00 00 00 00
        00 00 00 00
   0D1C 00 00 00 00 00 00  3042 	.dw	0,0,0,0,0,0,0,0
        00 00 00 00 00 00
        00 00 00 00
                           3043 
