;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.1.0 #7066 (Feb 26 2012) (Linux)
; This file was generated Mon Nov 11 18:21:14 2013
;--------------------------------------------------------
	.module usb_desc_strings
	.optsdcc -mmcs51 --model-small
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _usb_setup_strings
	.globl _i2c_write
	.globl _i2c_read
	.globl _JTAG_TDO
	.globl _JTAG_TDI
	.globl _JTAG_TMS
	.globl _JTAG_TCK
	.globl _string_ptrs
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
	.area RSEG    (ABS,DATA)
	.org 0x0000
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
	.area RSEG    (ABS,DATA)
	.org 0x0000
_JTAG_TCK	=	0x0080
_JTAG_TMS	=	0x0081
_JTAG_TDI	=	0x0083
_JTAG_TDO	=	0x0087
;--------------------------------------------------------
; overlayable register banks
;--------------------------------------------------------
	.area REG_BANK_0	(REL,OVR,DATA)
	.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
	.area DSEG    (DATA)
_setup_descriptor_PARM_2:
	.ds 3
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
	.area	OSEG    (OVR,DATA)
_str2unicode_PARM_2:
	.ds 3
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
	.area ISEG    (DATA)
;--------------------------------------------------------
; absolute internal ram data
;--------------------------------------------------------
	.area IABS    (ABS,DATA)
	.area IABS    (ABS,DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
	.area BSEG    (BIT)
_usb_setup_strings_sflag_1_1:
	.ds 1
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
	.area PSEG    (PAG,XDATA)
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
	.area XSEG    (XDATA)
_string_ptrs::
	.ds 16
_usb_setup_strings_ser_len_1_1:
	.ds 1
_usb_setup_strings_serial_1_1:
	.ds 105
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
	.area XABS    (ABS,XDATA)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG   (XDATA)
	.area HOME    (CODE)
	.area GSINIT0 (CODE)
	.area GSINIT1 (CODE)
	.area GSINIT2 (CODE)
	.area GSINIT3 (CODE)
	.area GSINIT4 (CODE)
	.area GSINIT5 (CODE)
	.area GSINIT  (CODE)
	.area GSFINAL (CODE)
	.area CSEG    (CODE)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area HOME    (CODE)
	.area GSINIT  (CODE)
	.area GSFINAL (CODE)
	.area GSINIT  (CODE)
;--------------------------------------------------------
; Home
;--------------------------------------------------------
	.area HOME    (CODE)
	.area HOME    (CODE)
;--------------------------------------------------------
; code
;--------------------------------------------------------
	.area CSEG    (CODE)
;------------------------------------------------------------
;Allocation info for local variables in function 'str2unicode'
;------------------------------------------------------------
;src                       Allocated with name '_str2unicode_PARM_2'
;dest                      Allocated to registers r6 r7 
;length                    Allocated to registers r2 
;------------------------------------------------------------
;	usb_desc_strings.c:49: static uchar str2unicode(__xdata uchar *dest, char *src)
;	-----------------------------------------
;	 function str2unicode
;	-----------------------------------------
_str2unicode:
	ar7 = 0x07
	ar6 = 0x06
	ar5 = 0x05
	ar4 = 0x04
	ar3 = 0x03
	ar2 = 0x02
	ar1 = 0x01
	ar0 = 0x00
	mov	r6,dpl
	mov	r7,dph
;	usb_desc_strings.c:61: while (*src != 0)
	mov	r3,_str2unicode_PARM_2
	mov	r4,(_str2unicode_PARM_2 + 1)
	mov	r5,(_str2unicode_PARM_2 + 2)
	mov	r2,#0x00
00101$:
	mov	dpl,r3
	mov	dph,r4
	mov	b,r5
	lcall	__gptrget
	mov	r1,a
	jz	00103$
;	usb_desc_strings.c:63: *dest++ = *src++;
	inc	r3
	cjne	r3,#0x00,00110$
	inc	r4
00110$:
	mov	dpl,r6
	mov	dph,r7
	mov	a,r1
	movx	@dptr,a
	inc	dptr
;	usb_desc_strings.c:64: *dest++ = 0;
	clr	a
	movx	@dptr,a
	inc	dptr
	mov	r6,dpl
	mov	r7,dph
;	usb_desc_strings.c:65: length++;
	inc	r2
	sjmp	00101$
00103$:
;	usb_desc_strings.c:72: return length<<1;
	mov	a,r2
	add	a,r2
	mov	dpl,a
	ret
;------------------------------------------------------------
;Allocation info for local variables in function 'setup_descriptor'
;------------------------------------------------------------
;string                    Allocated with name '_setup_descriptor_PARM_2'
;desc                      Allocated to registers r6 r7 
;------------------------------------------------------------
;	usb_desc_strings.c:75: static uchar setup_descriptor(__xdata usb_string *desc, char *string)
;	-----------------------------------------
;	 function setup_descriptor
;	-----------------------------------------
_setup_descriptor:
;	usb_desc_strings.c:77: desc->bDescriptorType = USB_DT_STRING;
	mov	r6,dpl
	mov  r7,dph
	inc	dptr
	mov	a,#0x03
	movx	@dptr,a
;	usb_desc_strings.c:78: desc->bLength = 2 + str2unicode((__xdata uchar *)desc + 2, string);
	mov	ar4,r6
	mov	ar5,r7
	mov	dpl,r4
	mov	dph,r5
	inc	dptr
	inc	dptr
	mov	_str2unicode_PARM_2,_setup_descriptor_PARM_2
	mov	(_str2unicode_PARM_2 + 1),(_setup_descriptor_PARM_2 + 1)
	mov	(_str2unicode_PARM_2 + 2),(_setup_descriptor_PARM_2 + 2)
	push	ar7
	push	ar6
	lcall	_str2unicode
	mov	a,dpl
	pop	ar6
	pop	ar7
	add	a,#0x02
	mov	r5,a
	mov	dpl,r6
	mov	dph,r7
	movx	@dptr,a
;	usb_desc_strings.c:86: return desc->bLength;
	mov	dpl,r5
	ret
;------------------------------------------------------------
;Allocation info for local variables in function 'usb_setup_strings'
;------------------------------------------------------------
;p                         Allocated to registers r4 r5 
;cnt                       Allocated to registers 
;desc                      Allocated to registers r6 r7 
;ser_len                   Allocated with name '_usb_setup_strings_ser_len_1_1'
;serial                    Allocated with name '_usb_setup_strings_serial_1_1'
;------------------------------------------------------------
;	usb_desc_strings.c:90: void usb_setup_strings(void)
;	-----------------------------------------
;	 function usb_setup_strings
;	-----------------------------------------
_usb_setup_strings:
;	usb_desc_strings.c:92: __bit sflag = 1;
	setb	_usb_setup_strings_sflag_1_1
;	usb_desc_strings.c:93: __xdata uchar ser_len = 0;
	mov	dptr,#_usb_setup_strings_ser_len_1_1
	clr	a
	movx	@dptr,a
;	usb_desc_strings.c:103: desc = (__xdata usb_string *)(&padding1 + 1);
	mov	r6,#(_padding1 + 0x0001)
	mov	r7,#((_padding1 + 0x0001) >> 8)
;	usb_desc_strings.c:105: desc->bLength         = 6;
	mov	dpl,r6
	mov	dph,r7
	mov	a,#0x06
	movx	@dptr,a
;	usb_desc_strings.c:106: desc->bDescriptorType = USB_DT_STRING;
	mov	dpl,r6
	mov	dph,r7
	inc	dptr
	mov	a,#0x03
	movx	@dptr,a
;	usb_desc_strings.c:107: p = &desc->wData;
	mov	a,#0x02
	add	a,r6
	mov	r4,a
	clr	a
	addc	a,r7
	mov	r5,a
;	usb_desc_strings.c:108: *p++ = 0;
	mov	dpl,r4
	mov	dph,r5
	clr	a
	movx	@dptr,a
	inc	dptr
;	usb_desc_strings.c:109: *p++ = 0;
	mov  r5,dph
	clr	a
	movx	@dptr,a
	inc	dptr
;	usb_desc_strings.c:110: *(__xdata ushort *)p = 0x0409; /* US English */
	mov	r4,dpl
	mov  r5,dph
	mov	a,#0x09
	movx	@dptr,a
	inc	dptr
	mov	a,#0x04
	movx	@dptr,a
;	usb_desc_strings.c:111: p += 2;
	mov	a,#0x02
	add	a,r4
	mov	r4,a
	clr	a
	addc	a,r5
	mov	r5,a
;	usb_desc_strings.c:113: string_ptrs[0] = desc;
	mov	dptr,#_string_ptrs
	mov	a,r6
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;	usb_desc_strings.c:115: string_ptrs[cnt++] = (__xdata usb_string *)p;
	mov	ar6,r4
	mov	ar7,r5
	mov	dptr,#(_string_ptrs + 0x0002)
	mov	a,r6
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;	usb_desc_strings.c:117: p += setup_descriptor((__xdata usb_string *)p, iManufacturer);
	mov	_setup_descriptor_PARM_2,#__str_0
	mov	(_setup_descriptor_PARM_2 + 1),#(__str_0 >> 8)
	mov	(_setup_descriptor_PARM_2 + 2),#0x80
	mov	dpl,r6
	mov	dph,r7
	push	ar5
	push	ar4
	lcall	_setup_descriptor
	mov	r7,dpl
	pop	ar4
	pop	ar5
	mov	a,r7
	add	a,r4
	mov	r4,a
	clr	a
	addc	a,r5
	mov	r5,a
;	usb_desc_strings.c:119: string_ptrs[cnt++] = (__xdata usb_string *)p;
	mov	ar6,r4
	mov	ar7,r5
	mov	dptr,#(_string_ptrs + 0x0004)
	mov	a,r6
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;	usb_desc_strings.c:120: p += setup_descriptor((__xdata usb_string *)p, iProduct);
	mov	_setup_descriptor_PARM_2,#__str_1
	mov	(_setup_descriptor_PARM_2 + 1),#(__str_1 >> 8)
	mov	(_setup_descriptor_PARM_2 + 2),#0x80
	mov	dpl,r6
	mov	dph,r7
	push	ar5
	push	ar4
	lcall	_setup_descriptor
	mov	r7,dpl
	pop	ar4
	pop	ar5
	mov	a,r7
	add	a,r4
	mov	r4,a
	clr	a
	addc	a,r5
	mov	r5,a
;	usb_desc_strings.c:122: string_ptrs[cnt++] = (__xdata usb_string *)p;
	mov	ar6,r4
	mov	ar7,r5
	mov	dptr,#(_string_ptrs + 0x0006)
	mov	a,r6
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;	usb_desc_strings.c:127: serial[0] = (ushort)EEPROM_SERIAL>>8;
	mov	dptr,#_usb_setup_strings_serial_1_1
	clr	a
	movx	@dptr,a
;	usb_desc_strings.c:128: serial[1] = (ushort)EEPROM_SERIAL & 0xff;
	mov	dptr,#(_usb_setup_strings_serial_1_1 + 0x0001)
	mov	a,#0x10
	movx	@dptr,a
;	usb_desc_strings.c:129: if (i2c_write(I2C_EEPROM_ADDR, serial, 2) == 0)
	mov	_i2c_write_PARM_2,#_usb_setup_strings_serial_1_1
	mov	(_i2c_write_PARM_2 + 1),#(_usb_setup_strings_serial_1_1 >> 8)
	mov	_i2c_write_PARM_3,#0x02
	mov	dpl,#0x51
	push	ar7
	push	ar6
	push	ar5
	push	ar4
	lcall	_i2c_write
	mov	a,dpl
	pop	ar4
	pop	ar5
	pop	ar6
	pop	ar7
	jnz	00102$
;	usb_desc_strings.c:130: sflag = 0;
	clr	_usb_setup_strings_sflag_1_1
00102$:
;	usb_desc_strings.c:132: if (!sflag || !i2c_read(I2C_EEPROM_ADDR, serial, 2))
	jnb	_usb_setup_strings_sflag_1_1,00103$
	mov	_i2c_read_PARM_2,#_usb_setup_strings_serial_1_1
	mov	(_i2c_read_PARM_2 + 1),#(_usb_setup_strings_serial_1_1 >> 8)
	mov	_i2c_read_PARM_3,#0x02
	mov	dpl,#0x51
	push	ar7
	push	ar6
	push	ar5
	push	ar4
	lcall	_i2c_read
	mov	a,dpl
	pop	ar4
	pop	ar5
	pop	ar6
	pop	ar7
	jnz	00104$
00103$:
;	usb_desc_strings.c:133: sflag = 0;
	clr	_usb_setup_strings_sflag_1_1
00104$:
;	usb_desc_strings.c:136: if (!sflag || (serial[0] != EEPROM_SERIAL_HDR1) || (serial[1] != EEPROM_SERIAL_HDR2))
	jnb	_usb_setup_strings_sflag_1_1,00106$
	mov	dptr,#_usb_setup_strings_serial_1_1
	movx	a,@dptr
	mov	r3,a
	cjne	r3,#0x5A,00106$
	mov	dptr,#(_usb_setup_strings_serial_1_1 + 0x0001)
	movx	a,@dptr
	mov	r3,a
	cjne	r3,#0xFE,00138$
	sjmp	00107$
00138$:
00106$:
;	usb_desc_strings.c:137: sflag = 0;
	clr	_usb_setup_strings_sflag_1_1
00107$:
;	usb_desc_strings.c:139: if (!sflag || !i2c_read(I2C_EEPROM_ADDR, &ser_len, 1))
	jnb	_usb_setup_strings_sflag_1_1,00110$
	mov	_i2c_read_PARM_2,#_usb_setup_strings_ser_len_1_1
	mov	(_i2c_read_PARM_2 + 1),#(_usb_setup_strings_ser_len_1_1 >> 8)
	mov	_i2c_read_PARM_3,#0x01
	mov	dpl,#0x51
	push	ar7
	push	ar6
	push	ar5
	push	ar4
	lcall	_i2c_read
	mov	a,dpl
	pop	ar4
	pop	ar5
	pop	ar6
	pop	ar7
	jnz	00111$
00110$:
;	usb_desc_strings.c:140: sflag = 0;
	clr	_usb_setup_strings_sflag_1_1
00111$:
;	usb_desc_strings.c:142: if (!sflag || (ser_len > USBDESC_SERIAL_MAX))
	jnb	_usb_setup_strings_sflag_1_1,00113$
	mov	dptr,#_usb_setup_strings_ser_len_1_1
	movx	a,@dptr
	mov  r3,a
	add	a,#0xff - 0x68
	jnc	00114$
00113$:
;	usb_desc_strings.c:143: sflag = 0;
	clr	_usb_setup_strings_sflag_1_1
00114$:
;	usb_desc_strings.c:145: if (!sflag || !i2c_read(I2C_EEPROM_ADDR, serial, ser_len))
	jnb	_usb_setup_strings_sflag_1_1,00116$
	mov	dptr,#_usb_setup_strings_ser_len_1_1
	movx	a,@dptr
	mov	_i2c_read_PARM_3,a
	mov	_i2c_read_PARM_2,#_usb_setup_strings_serial_1_1
	mov	(_i2c_read_PARM_2 + 1),#(_usb_setup_strings_serial_1_1 >> 8)
	mov	dpl,#0x51
	push	ar7
	push	ar6
	push	ar5
	push	ar4
	lcall	_i2c_read
	mov	a,dpl
	pop	ar4
	pop	ar5
	pop	ar6
	pop	ar7
	jnz	00117$
00116$:
;	usb_desc_strings.c:146: sflag = 0;
	clr	_usb_setup_strings_sflag_1_1
00117$:
;	usb_desc_strings.c:148: if (sflag)
	jnb	_usb_setup_strings_sflag_1_1,00120$
;	usb_desc_strings.c:151: serial[ser_len] = 0;
	mov	dptr,#_usb_setup_strings_ser_len_1_1
	movx	a,@dptr
	add	a,#_usb_setup_strings_serial_1_1
	mov	dpl,a
	clr	a
	addc	a,#(_usb_setup_strings_serial_1_1 >> 8)
	mov	dph,a
	clr	a
	movx	@dptr,a
;	usb_desc_strings.c:152: p += setup_descriptor((__xdata usb_string *)p, serial);
	mov	_setup_descriptor_PARM_2,#_usb_setup_strings_serial_1_1
	mov	(_setup_descriptor_PARM_2 + 1),#(_usb_setup_strings_serial_1_1 >> 8)
	mov	(_setup_descriptor_PARM_2 + 2),#0x00
	mov	dpl,r6
	mov	dph,r7
	push	ar5
	push	ar4
	lcall	_setup_descriptor
	mov	r3,dpl
	pop	ar4
	pop	ar5
	mov	a,r3
	add	a,r4
	mov	r4,a
	clr	a
	addc	a,r5
	mov	r5,a
	sjmp	00121$
00120$:
;	usb_desc_strings.c:155: p += setup_descriptor((__xdata usb_string *)p, iSerial);
	mov	_setup_descriptor_PARM_2,#__str_2
	mov	(_setup_descriptor_PARM_2 + 1),#(__str_2 >> 8)
	mov	(_setup_descriptor_PARM_2 + 2),#0x80
	mov	dpl,r6
	mov	dph,r7
	push	ar5
	push	ar4
	lcall	_setup_descriptor
	mov	r7,dpl
	pop	ar4
	pop	ar5
	mov	a,r7
	add	a,r4
	mov	r4,a
	clr	a
	addc	a,r5
	mov	r5,a
00121$:
;	usb_desc_strings.c:157: string_ptrs[cnt++] = (__xdata usb_string *)p;
	mov	ar6,r4
	mov	ar7,r5
	mov	dptr,#(_string_ptrs + 0x0008)
	mov	a,r6
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;	usb_desc_strings.c:158: p += setup_descriptor((__xdata usb_string *)p, iInter0Alt0HS);
	mov	_setup_descriptor_PARM_2,#__str_3
	mov	(_setup_descriptor_PARM_2 + 1),#(__str_3 >> 8)
	mov	(_setup_descriptor_PARM_2 + 2),#0x80
	mov	dpl,r6
	mov	dph,r7
	push	ar5
	push	ar4
	lcall	_setup_descriptor
	mov	r7,dpl
	pop	ar4
	pop	ar5
	mov	a,r7
	add	a,r4
	mov	r4,a
	clr	a
	addc	a,r5
	mov	r5,a
;	usb_desc_strings.c:160: string_ptrs[cnt++] = (__xdata usb_string *)p;
	mov	ar6,r4
	mov	ar7,r5
	mov	dptr,#(_string_ptrs + 0x000a)
	mov	a,r6
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;	usb_desc_strings.c:161: p += setup_descriptor((__xdata usb_string *)p, iInter0Alt1HS);
	mov	_setup_descriptor_PARM_2,#__str_4
	mov	(_setup_descriptor_PARM_2 + 1),#(__str_4 >> 8)
	mov	(_setup_descriptor_PARM_2 + 2),#0x80
	mov	dpl,r6
	mov	dph,r7
	push	ar5
	push	ar4
	lcall	_setup_descriptor
	mov	r7,dpl
	pop	ar4
	pop	ar5
	mov	a,r7
	add	a,r4
	mov	r4,a
	clr	a
	addc	a,r5
	mov	r5,a
;	usb_desc_strings.c:163: string_ptrs[cnt++] = (__xdata usb_string *)p;
	mov	ar6,r4
	mov	ar7,r5
	mov	dptr,#(_string_ptrs + 0x000c)
	mov	a,r6
	movx	@dptr,a
	inc	dptr
	mov	a,r7
	movx	@dptr,a
;	usb_desc_strings.c:164: p += setup_descriptor((__xdata usb_string *)p, iInter0Alt0FS);
	mov	_setup_descriptor_PARM_2,#__str_5
	mov	(_setup_descriptor_PARM_2 + 1),#(__str_5 >> 8)
	mov	(_setup_descriptor_PARM_2 + 2),#0x80
	mov	dpl,r6
	mov	dph,r7
	push	ar5
	push	ar4
	lcall	_setup_descriptor
	mov	r7,dpl
	pop	ar4
	pop	ar5
	mov	a,r7
	add	a,r4
	mov	r4,a
	clr	a
	addc	a,r5
	mov	r5,a
;	usb_desc_strings.c:166: string_ptrs[cnt] = (__xdata usb_string *)p;
	mov	dptr,#(_string_ptrs + 0x000e)
	mov	a,r4
	movx	@dptr,a
	inc	dptr
	mov	a,r5
	movx	@dptr,a
;	usb_desc_strings.c:167: p += setup_descriptor((__xdata usb_string *)p, iInter0Alt1FS);
	mov	_setup_descriptor_PARM_2,#__str_6
	mov	(_setup_descriptor_PARM_2 + 1),#(__str_6 >> 8)
	mov	(_setup_descriptor_PARM_2 + 2),#0x80
	mov	dpl,r4
	mov	dph,r5
	ljmp	_setup_descriptor
	.area CSEG    (CODE)
	.area CONST   (CODE)
__str_0:
	.ascii "Dimtel, Inc."
	.db 0x00
__str_1:
	.ascii "IGP12"
	.db 0x00
__str_2:
	.ascii "3.14159"
	.db 0x00
__str_3:
	.ascii "Service IF: JTAG/I2C"
	.db 0x00
__str_4:
	.ascii "Data IF: usbio"
	.db 0x00
__str_5:
	.ascii "JTAG/I2C FS"
	.db 0x00
__str_6:
	.ascii "Data IF: usbio FS"
	.db 0x00
	.area XINIT   (CODE)
	.area CABS    (ABS,CODE)
