; Listing generated by Microsoft (R) Optimizing Compiler Version 15.00.21022.08 

	TITLE	f:\ac356\A2F_AC356_DF2\A2F_AC356_DF\USBee\Host_application\C\USBeeEX2App.c
	.686P
	.XMM
	include listing.inc
	.model	flat

INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES

PUBLIC	_x
_DATA	SEGMENT
_x	DD	01H
?iBytesRead@?1??main@@9@9 DD 0ffffffffH			; `main'::`2'::iBytesRead
_DATA	ENDS
PUBLIC	??_C@_0CI@IOLHHDKL@Press?5any?5key?5to?5colse?5the?5appli@ ; `string'
PUBLIC	??_C@_05KOJMJHML@Done?6?$AA@			; `string'
PUBLIC	??_C@_0BJ@CBMHAJKJ@writing?5to?5file?5is?5done?6?$AA@ ; `string'
PUBLIC	??_C@_0BJ@BHODGJDB@Opening?5file?5is?5done?5?$CFd?6?$AA@ ; `string'
PUBLIC	??_C@_0O@FCJDFIPH@read_file?4txt?$AA@		; `string'
PUBLIC	??_C@_02CHHAKFFB@w?$CL?$AA@			; `string'
PUBLIC	??_C@_0CB@IHCKNNJB@reading?5data?5from?5eSRAM?5is?5DONE?6@ ; `string'
PUBLIC	??_C@_0CL@JEELHNNP@Serial?5port?5?$CFs?5successfully?5reco@ ; `string'
PUBLIC	??_C@_0CH@NAFPLEDN@Cann?8t?5set?5the?5UART?5port?5Setting@ ; `string'
PUBLIC	??_C@_0FC@OHCDGKAH@Cann?8t?5open?5UART?5port?0?5Please?5cl@ ; `string'
PUBLIC	??_C@_0DK@HHNIBBFN@Initialising?5the?5UART?5to?5read?5th@ ; `string'
PUBLIC	??_C@_0CP@NOBLOLEN@?5Data?5is?5successfully?5written?5to@ ; `string'
PUBLIC	??_C@_0BO@PGAJEKNC@Sending?5?$CFd?5bytes?5out?5the?5pod?6?$AA@ ; `string'
PUBLIC	??_C@_04ECGLBLOI@?9?9?9?9?$AA@			; `string'
PUBLIC	??_C@_0L@LHIJGEFO@size?5?$DN?5?$CFd?6?$AA@	; `string'
PUBLIC	??_C@_0BA@CJIGGFFH@file?5Opened?5?$CFd?6?$AA@	; `string'
PUBLIC	??_C@_08OKJMHBIC@test?4txt?$AA@			; `string'
PUBLIC	??_C@_02JDPG@rb?$AA@				; `string'
PUBLIC	??_C@_0O@BCICKKKO@Opening?5file?6?$AA@		; `string'
PUBLIC	??_C@_0BK@INBMHCK@Failure?5setting?5the?5mode?6?$AA@ ; `string'
PUBLIC	??_C@_0BL@JFGBAGEL@Press?5any?5key?5to?5continue?6?$AA@ ; `string'
PUBLIC	??_C@_0BP@KDAFBJBN@Setting?5the?5Mode?5to?5fast?5mode?6?$AA@ ; `string'
PUBLIC	??_C@_0BO@JBIFDCLK@Failure?5Initializing?5the?5Pod?6?$AA@ ; `string'
PUBLIC	??_C@_0BG@FMEENANB@Initializing?5the?5Pod?6?$AA@ ; `string'
PUBLIC	??_C@_0CP@HAGIIIOE@Sample?5USBee?5EX2?5Toolbuilder?5app@ ; `string'
PUBLIC	??_C@_0L@FGIFJNFN@C?3?7est?4txt?$AA@		; `string'
PUBLIC	??_C@_04GJNABJLD@COM3?$AA@			; `string'
PUBLIC	__$ArrayPad$
PUBLIC	_main
EXTRN	__imp__fclose:PROC
EXTRN	__imp__fwrite:PROC
EXTRN	__imp__ReadFile@20:PROC
EXTRN	__imp__SetCommState@8:PROC
EXTRN	__imp__GetCommState@8:PROC
EXTRN	__imp__GetLastError@0:PROC
EXTRN	__imp__CreateFileA@28:PROC
EXTRN	__imp__SetSignals@16:PROC
EXTRN	__imp__fread:PROC
EXTRN	__imp__rewind:PROC
EXTRN	__imp__ftell:PROC
EXTRN	__imp__fseek:PROC
EXTRN	__imp__fopen:PROC
EXTRN	__imp__SetMode@8:PROC
EXTRN	__imp__getch:PROC
EXTRN	__imp__InitializeEX2Pod@4:PROC
EXTRN	__imp__printf:PROC
EXTRN	_strcpy:PROC
EXTRN	___security_cookie:DWORD
EXTRN	@__security_check_cookie@4:PROC
EXTRN	@_RTC_CheckStackVars@8:PROC
EXTRN	__chkstk:PROC
EXTRN	__RTC_CheckEsp:PROC
EXTRN	__RTC_Shutdown:PROC
EXTRN	__RTC_InitBase:PROC
;	COMDAT ??_C@_0CI@IOLHHDKL@Press?5any?5key?5to?5colse?5the?5appli@
; File f:\ac356\a2f_ac356_df2\a2f_ac356_df\usbee\host_application\c\usbeeex2app.c
CONST	SEGMENT
??_C@_0CI@IOLHHDKL@Press?5any?5key?5to?5colse?5the?5appli@ DB 'Press any '
	DB	'key to colse the application', 0aH, 00H	; `string'
CONST	ENDS
;	COMDAT ??_C@_05KOJMJHML@Done?6?$AA@
CONST	SEGMENT
??_C@_05KOJMJHML@Done?6?$AA@ DB 'Done', 0aH, 00H	; `string'
CONST	ENDS
;	COMDAT ??_C@_0BJ@CBMHAJKJ@writing?5to?5file?5is?5done?6?$AA@
CONST	SEGMENT
??_C@_0BJ@CBMHAJKJ@writing?5to?5file?5is?5done?6?$AA@ DB 'writing to file'
	DB	' is done', 0aH, 00H				; `string'
CONST	ENDS
;	COMDAT ??_C@_0BJ@BHODGJDB@Opening?5file?5is?5done?5?$CFd?6?$AA@
CONST	SEGMENT
??_C@_0BJ@BHODGJDB@Opening?5file?5is?5done?5?$CFd?6?$AA@ DB 'Opening file'
	DB	' is done %d', 0aH, 00H			; `string'
CONST	ENDS
;	COMDAT ??_C@_0O@FCJDFIPH@read_file?4txt?$AA@
CONST	SEGMENT
??_C@_0O@FCJDFIPH@read_file?4txt?$AA@ DB 'read_file.txt', 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_02CHHAKFFB@w?$CL?$AA@
CONST	SEGMENT
??_C@_02CHHAKFFB@w?$CL?$AA@ DB 'w+', 00H		; `string'
CONST	ENDS
;	COMDAT ??_C@_0CB@IHCKNNJB@reading?5data?5from?5eSRAM?5is?5DONE?6@
CONST	SEGMENT
??_C@_0CB@IHCKNNJB@reading?5data?5from?5eSRAM?5is?5DONE?6@ DB 'reading da'
	DB	'ta from eSRAM is DONE', 0aH, 00H		; `string'
CONST	ENDS
;	COMDAT ??_C@_0CL@JEELHNNP@Serial?5port?5?$CFs?5successfully?5reco@
CONST	SEGMENT
??_C@_0CL@JEELHNNP@Serial?5port?5?$CFs?5successfully?5reco@ DB 'Serial po'
	DB	'rt %s successfully reconfigured.', 0aH, 00H	; `string'
CONST	ENDS
;	COMDAT ??_C@_0CH@NAFPLEDN@Cann?8t?5set?5the?5UART?5port?5Setting@
CONST	SEGMENT
??_C@_0CH@NAFPLEDN@Cann?8t?5set?5the?5UART?5port?5Setting@ DB 'Cann''t se'
	DB	't the UART port Settings %d.', 0aH, 00H	; `string'
CONST	ENDS
;	COMDAT ??_C@_0FC@OHCDGKAH@Cann?8t?5open?5UART?5port?0?5Please?5cl@
CONST	SEGMENT
??_C@_0FC@OHCDGKAH@Cann?8t?5open?5UART?5port?0?5Please?5cl@ DB 'Cann''t o'
	DB	'pen UART port, Please close if the port is open by other appl'
	DB	'ication %d.', 0aH, 00H			; `string'
CONST	ENDS
;	COMDAT ??_C@_0DK@HHNIBBFN@Initialising?5the?5UART?5to?5read?5th@
CONST	SEGMENT
??_C@_0DK@HHNIBBFN@Initialising?5the?5UART?5to?5read?5th@ DB 'Initialisin'
	DB	'g the UART to read the data from External RAM', 0aH, 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_0CP@NOBLOLEN@?5Data?5is?5successfully?5written?5to@
CONST	SEGMENT
??_C@_0CP@NOBLOLEN@?5Data?5is?5successfully?5written?5to@ DB ' Data is su'
	DB	'ccessfully written to External RAM', 0aH, 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_0BO@PGAJEKNC@Sending?5?$CFd?5bytes?5out?5the?5pod?6?$AA@
CONST	SEGMENT
??_C@_0BO@PGAJEKNC@Sending?5?$CFd?5bytes?5out?5the?5pod?6?$AA@ DB 'Sendin'
	DB	'g %d bytes out the pod', 0aH, 00H		; `string'
CONST	ENDS
;	COMDAT ??_C@_04ECGLBLOI@?9?9?9?9?$AA@
CONST	SEGMENT
??_C@_04ECGLBLOI@?9?9?9?9?$AA@ DB '----', 00H		; `string'
CONST	ENDS
;	COMDAT ??_C@_0L@LHIJGEFO@size?5?$DN?5?$CFd?6?$AA@
CONST	SEGMENT
??_C@_0L@LHIJGEFO@size?5?$DN?5?$CFd?6?$AA@ DB 'size = %d', 0aH, 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_0BA@CJIGGFFH@file?5Opened?5?$CFd?6?$AA@
CONST	SEGMENT
??_C@_0BA@CJIGGFFH@file?5Opened?5?$CFd?6?$AA@ DB 'file Opened %d', 0aH, 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_08OKJMHBIC@test?4txt?$AA@
CONST	SEGMENT
??_C@_08OKJMHBIC@test?4txt?$AA@ DB 'test.txt', 00H	; `string'
CONST	ENDS
;	COMDAT ??_C@_02JDPG@rb?$AA@
CONST	SEGMENT
??_C@_02JDPG@rb?$AA@ DB 'rb', 00H			; `string'
CONST	ENDS
;	COMDAT ??_C@_0O@BCICKKKO@Opening?5file?6?$AA@
CONST	SEGMENT
??_C@_0O@BCICKKKO@Opening?5file?6?$AA@ DB 'Opening file', 0aH, 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_0BK@INBMHCK@Failure?5setting?5the?5mode?6?$AA@
CONST	SEGMENT
??_C@_0BK@INBMHCK@Failure?5setting?5the?5mode?6?$AA@ DB 'Failure setting '
	DB	'the mode', 0aH, 00H				; `string'
CONST	ENDS
;	COMDAT ??_C@_0BL@JFGBAGEL@Press?5any?5key?5to?5continue?6?$AA@
CONST	SEGMENT
??_C@_0BL@JFGBAGEL@Press?5any?5key?5to?5continue?6?$AA@ DB 'Press any key'
	DB	' to continue', 0aH, 00H			; `string'
CONST	ENDS
;	COMDAT ??_C@_0BP@KDAFBJBN@Setting?5the?5Mode?5to?5fast?5mode?6?$AA@
CONST	SEGMENT
??_C@_0BP@KDAFBJBN@Setting?5the?5Mode?5to?5fast?5mode?6?$AA@ DB 'Setting '
	DB	'the Mode to fast mode', 0aH, 00H		; `string'
CONST	ENDS
;	COMDAT ??_C@_0BO@JBIFDCLK@Failure?5Initializing?5the?5Pod?6?$AA@
CONST	SEGMENT
??_C@_0BO@JBIFDCLK@Failure?5Initializing?5the?5Pod?6?$AA@ DB 'Failure Ini'
	DB	'tializing the Pod', 0aH, 00H		; `string'
CONST	ENDS
;	COMDAT ??_C@_0BG@FMEENANB@Initializing?5the?5Pod?6?$AA@
CONST	SEGMENT
??_C@_0BG@FMEENANB@Initializing?5the?5Pod?6?$AA@ DB 'Initializing the Pod'
	DB	0aH, 00H					; `string'
CONST	ENDS
;	COMDAT ??_C@_0CP@HAGIIIOE@Sample?5USBee?5EX2?5Toolbuilder?5app@
CONST	SEGMENT
??_C@_0CP@HAGIIIOE@Sample?5USBee?5EX2?5Toolbuilder?5app@ DB 'Sample USBee'
	DB	' EX2 Toolbuilder application in C', 0aH, 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_0L@FGIFJNFN@C?3?7est?4txt?$AA@
CONST	SEGMENT
??_C@_0L@FGIFJNFN@C?3?7est?4txt?$AA@ DB 'C:', 09H, 'est.txt', 00H ; `string'
CONST	ENDS
;	COMDAT ??_C@_04GJNABJLD@COM3?$AA@
CONST	SEGMENT
??_C@_04GJNABJLD@COM3?$AA@ DB 'COM3', 00H		; `string'
CONST	ENDS
;	COMDAT rtc$TMZ
rtc$TMZ	SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ	ENDS
;	COMDAT rtc$IMZ
rtc$IMZ	SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
; Function compile flags: /Odtp /RTCsu /ZI
rtc$IMZ	ENDS
;	COMDAT _main
_TEXT	SEGMENT
_read_buffer$ = -43320					; size = 5112
_dcb$ = -38200						; size = 28
_fSuccess$ = -38164					; size = 4
_hCom$ = -38152						; size = 4
_pcCommPort$ = -38140					; size = 5
_buffer$ = -38124					; size = 5116
_length$ = -33000					; size = 4
_result$ = -32988					; size = 4
_size$ = -32976						; size = 4
_fp_read$ = -32964					; size = 4
_fp$ = -32952						; size = 4
_filename$ = -32940					; size = 100
_PodNumber$ = -32832					; size = 4
_ch$ = -32817						; size = 1
_x$ = -32808						; size = 4
_ReturnVal$ = -32796					; size = 4
_DataOutBuffer$ = -32784				; size = 16384
__$ArrayPad$ = -4					; size = 4
_argc$ = 8						; size = 4
_argv$ = 12						; size = 4
_main	PROC						; COMDAT

; 39   : {

	push	ebp
	mov	ebp, esp
	mov	eax, 43516				; 0000a9fcH
	call	__chkstk
	push	ebx
	push	esi
	push	edi
	lea	edi, DWORD PTR [ebp-43516]
	mov	ecx, 10879				; 00002a7fH
	mov	eax, -858993460				; ccccccccH
	rep stosd
	mov	eax, DWORD PTR ___security_cookie
	xor	eax, ebp
	mov	DWORD PTR __$ArrayPad$[ebp], eax

; 40   : 	unsigned char DataInBuffer[RX_BYTES];
; 41   : 	unsigned char DataOutBuffer[TX_BYTES];
; 42   : 	int ReturnVal;
; 43   : 	unsigned long x;
; 44   : 	unsigned char ch = 0;

	mov	BYTE PTR _ch$[ebp], 0

; 45   : 	unsigned int PodNumber;		
; 46   : 	char filename[100];/* = "C:\test.txt";*/
; 47   : 	FILE *fp, *fp_read;
; 48   : 	long size,result, length;
; 49   : 	unsigned char buffer[5116];
; 50   : 	char pcCommPort[5]="COM3";

	mov	eax, DWORD PTR ??_C@_04GJNABJLD@COM3?$AA@
	mov	DWORD PTR _pcCommPort$[ebp], eax
	mov	cl, BYTE PTR ??_C@_04GJNABJLD@COM3?$AA@+4
	mov	BYTE PTR _pcCommPort$[ebp+4], cl

; 51   : 	HANDLE hCom;
; 52   : 	BOOL fSuccess;
; 53   : 	DCB dcb;
; 54   :     static DWORD iBytesRead = -1;
; 55   : 	char read_buffer[5112];
; 56   : 	//char COM_NUMBER = '4';
; 57   : 		// USBee EX2 I/O Functions
; 58   :     strcpy(filename, "C:\test.txt");

	push	OFFSET ??_C@_0L@FGIFJNFN@C?3?7est?4txt?$AA@
	lea	eax, DWORD PTR _filename$[ebp]
	push	eax
	call	_strcpy
	add	esp, 8

; 59   : 	printf("Sample USBee EX2 Toolbuilder application in C\n");

	mov	esi, esp
	push	OFFSET ??_C@_0CP@HAGIIIOE@Sample?5USBee?5EX2?5Toolbuilder?5app@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 60   : 	
; 61   : 	PodNumber = 6105;		// Change this to your pod number

	mov	DWORD PTR _PodNumber$[ebp], 6105	; 000017d9H

; 62   : 
; 63   : 	for(x=2;x<TX_BYTES;x++) DataOutBuffer[x]= (char)x;

	mov	DWORD PTR _x$[ebp], 2
	jmp	SHORT $LN8@main
$LN7@main:
	mov	eax, DWORD PTR _x$[ebp]
	add	eax, 1
	mov	DWORD PTR _x$[ebp], eax
$LN8@main:
	cmp	DWORD PTR _x$[ebp], 16384		; 00004000H
	jae	SHORT $LN6@main
	mov	eax, DWORD PTR _x$[ebp]
	mov	cl, BYTE PTR _x$[ebp]
	mov	BYTE PTR _DataOutBuffer$[ebp+eax], cl
	jmp	SHORT $LN7@main
$LN6@main:

; 64   : 	
; 65   : 	printf("Initializing the Pod\n");

	mov	esi, esp
	push	OFFSET ??_C@_0BG@FMEENANB@Initializing?5the?5Pod?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 66   : 	ReturnVal = InitializeEX2Pod(PodNumber);

	mov	esi, esp
	mov	eax, DWORD PTR _PodNumber$[ebp]
	push	eax
	call	DWORD PTR __imp__InitializeEX2Pod@4
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _ReturnVal$[ebp], eax

; 67   : 	if (ReturnVal != 1) {

	cmp	DWORD PTR _ReturnVal$[ebp], 1
	je	SHORT $LN5@main

; 68   : 		printf("Failure Initializing the Pod\n");

	mov	esi, esp
	push	OFFSET ??_C@_0BO@JBIFDCLK@Failure?5Initializing?5the?5Pod?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 69   : 		getch();

	mov	esi, esp
	call	DWORD PTR __imp__getch
	cmp	esi, esp
	call	__RTC_CheckEsp

; 70   : 		return 0;

	xor	eax, eax
	jmp	$LN9@main
$LN5@main:

; 71   : 	}
; 72   : 
; 73   : 	printf("Setting the Mode to fast mode\n");

	mov	esi, esp
	push	OFFSET ??_C@_0BP@KDAFBJBN@Setting?5the?5Mode?5to?5fast?5mode?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 74   : 	ReturnVal = SetMode(PodNumber, FAST_ONEWAY_DATA | DATA_CHANGES_ON_FALLING_EDGE | _1MHz );	

	mov	esi, esp
	push	17					; 00000011H
	mov	eax, DWORD PTR _PodNumber$[ebp]
	push	eax
	call	DWORD PTR __imp__SetMode@8
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _ReturnVal$[ebp], eax

; 75   : 	printf("Press any key to continue\n");

	mov	esi, esp
	push	OFFSET ??_C@_0BL@JFGBAGEL@Press?5any?5key?5to?5continue?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 76   : 	getch();

	mov	esi, esp
	call	DWORD PTR __imp__getch
	cmp	esi, esp
	call	__RTC_CheckEsp

; 77   : 	//ReturnVal = SetMode(PodNumber, 4 );		
; 78   : #if 1
; 79   : 	if (ReturnVal != 1) {

	cmp	DWORD PTR _ReturnVal$[ebp], 1
	je	SHORT $LN4@main

; 80   : 		printf("Failure setting the mode\n");

	mov	esi, esp
	push	OFFSET ??_C@_0BK@INBMHCK@Failure?5setting?5the?5mode?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 81   : 		getch();

	mov	esi, esp
	call	DWORD PTR __imp__getch
	cmp	esi, esp
	call	__RTC_CheckEsp

; 82   : 		return 0;

	xor	eax, eax
	jmp	$LN9@main
$LN4@main:

; 83   : 	}
; 84   : #endif
; 85   : 	printf("Opening file\n");

	mov	esi, esp
	push	OFFSET ??_C@_0O@BCICKKKO@Opening?5file?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 86   : 	fp = fopen("test.txt","rb");

	mov	esi, esp
	push	OFFSET ??_C@_02JDPG@rb?$AA@
	push	OFFSET ??_C@_08OKJMHBIC@test?4txt?$AA@
	call	DWORD PTR __imp__fopen
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _fp$[ebp], eax

; 87   : 	printf("file Opened %d\n", fp);

	mov	esi, esp
	mov	eax, DWORD PTR _fp$[ebp]
	push	eax
	push	OFFSET ??_C@_0BA@CJIGGFFH@file?5Opened?5?$CFd?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp

; 88   : 
; 89   :     // obtain file size:
; 90   :     fseek (fp , 0 , SEEK_END);

	mov	esi, esp
	push	2
	push	0
	mov	eax, DWORD PTR _fp$[ebp]
	push	eax
	call	DWORD PTR __imp__fseek
	add	esp, 12					; 0000000cH
	cmp	esi, esp
	call	__RTC_CheckEsp

; 91   :     size = ftell (fp);

	mov	esi, esp
	mov	eax, DWORD PTR _fp$[ebp]
	push	eax
	call	DWORD PTR __imp__ftell
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _size$[ebp], eax

; 92   :     rewind (fp);

	mov	esi, esp
	mov	eax, DWORD PTR _fp$[ebp]
	push	eax
	call	DWORD PTR __imp__rewind
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 93   : 
; 94   :     printf("size = %d\n", size);

	mov	esi, esp
	mov	eax, DWORD PTR _size$[ebp]
	push	eax
	push	OFFSET ??_C@_0L@LHIJGEFO@size?5?$DN?5?$CFd?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp

; 95   :     length = size;

	mov	eax, DWORD PTR _size$[ebp]
	mov	DWORD PTR _length$[ebp], eax

; 96   : 
; 97   :        printf("----");

	mov	esi, esp
	push	OFFSET ??_C@_04ECGLBLOI@?9?9?9?9?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 98   : 
; 99   :        result = fread (buffer,1,length,fp);

	mov	esi, esp
	mov	eax, DWORD PTR _fp$[ebp]
	push	eax
	mov	ecx, DWORD PTR _length$[ebp]
	push	ecx
	push	1
	lea	edx, DWORD PTR _buffer$[ebp]
	push	edx
	call	DWORD PTR __imp__fread
	add	esp, 16					; 00000010H
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _result$[ebp], eax

; 100  : 	
; 101  : 
; 102  : 	printf("Sending %d bytes out the pod\n",size);

	mov	esi, esp
	mov	eax, DWORD PTR _size$[ebp]
	push	eax
	push	OFFSET ??_C@_0BO@PGAJEKNC@Sending?5?$CFd?5bytes?5out?5the?5pod?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp

; 103  : 	SetSignals (PodNumber, 0xFF /* Don't Care */, size, buffer);

	mov	esi, esp
	lea	eax, DWORD PTR _buffer$[ebp]
	push	eax
	mov	ecx, DWORD PTR _size$[ebp]
	push	ecx
	push	255					; 000000ffH
	mov	edx, DWORD PTR _PodNumber$[ebp]
	push	edx
	call	DWORD PTR __imp__SetSignals@16
	cmp	esi, esp
	call	__RTC_CheckEsp

; 104  : 	printf(" Data is successfully written to External RAM\n");

	mov	esi, esp
	push	OFFSET ??_C@_0CP@NOBLOLEN@?5Data?5is?5successfully?5written?5to@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 105  : 
; 106  : 	printf("Initialising the UART to read the data from External RAM\n");

	mov	esi, esp
	push	OFFSET ??_C@_0DK@HHNIBBFN@Initialising?5the?5UART?5to?5read?5th@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 107  :    //strcat(pcCommPort,COM_NUMBER);
; 108  :    hCom = CreateFile( pcCommPort,
; 109  :                       GENERIC_READ | GENERIC_WRITE,
; 110  :                       0, // must be opened with exclusive-access
; 111  :                       NULL, // no security attributes
; 112  :                       OPEN_EXISTING, // must use OPEN_EXISTING
; 113  :                       0, // not overlapped I/O
; 114  :                       NULL // hTemplate must be NULL for comm devices
; 115  :                      );

	mov	esi, esp
	push	0
	push	0
	push	3
	push	0
	push	0
	push	-1073741824				; c0000000H
	lea	eax, DWORD PTR _pcCommPort$[ebp]
	push	eax
	call	DWORD PTR __imp__CreateFileA@28
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _hCom$[ebp], eax

; 116  : 
; 117  :    if (hCom == INVALID_HANDLE_VALUE)

	cmp	DWORD PTR _hCom$[ebp], -1
	jne	SHORT $LN3@main

; 118  :    {
; 119  :      // Handle the error.
; 120  :        printf ("Cann't open UART port, Please close if the port is open by other application %d.\n", GetLastError());

	mov	esi, esp
	call	DWORD PTR __imp__GetLastError@0
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	esi, esp
	push	eax
	push	OFFSET ??_C@_0FC@OHCDGKAH@Cann?8t?5open?5UART?5port?0?5Please?5cl@
	call	DWORD PTR __imp__printf
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp

; 121  :        return (1);

	mov	eax, 1
	jmp	$LN9@main
$LN3@main:

; 122  :    }
; 123  : 
; 124  : // Build on the current configuration, and skip setting the size
; 125  : // of the input and output buffers with SetupComm.
; 126  : 
; 127  :    fSuccess = GetCommState(hCom, &dcb);

	mov	esi, esp
	lea	eax, DWORD PTR _dcb$[ebp]
	push	eax
	mov	ecx, DWORD PTR _hCom$[ebp]
	push	ecx
	call	DWORD PTR __imp__GetCommState@8
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _fSuccess$[ebp], eax

; 128  : 
; 129  :    if (!fSuccess)

	cmp	DWORD PTR _fSuccess$[ebp], 0
	jne	SHORT $LN2@main

; 130  :    {
; 131  :        // Handle the error.
; 132  :        printf ("Cann't open UART port, Please close if the port is open by other application %d.\n", GetLastError());

	mov	esi, esp
	call	DWORD PTR __imp__GetLastError@0
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	esi, esp
	push	eax
	push	OFFSET ??_C@_0FC@OHCDGKAH@Cann?8t?5open?5UART?5port?0?5Please?5cl@
	call	DWORD PTR __imp__printf
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp

; 133  :        return (2);

	mov	eax, 2
	jmp	$LN9@main
$LN2@main:

; 134  :    }
; 135  : 
; 136  : // Fill in DCB: 57,600 bps, 8 data bits, no parity, and 1 stop bit.
; 137  : 
; 138  :    dcb.BaudRate = CBR_57600; // set the baud rate

	mov	DWORD PTR _dcb$[ebp+4], 57600		; 0000e100H

; 139  :    dcb.ByteSize = 8; // data size, xmit, and rcv

	mov	BYTE PTR _dcb$[ebp+18], 8

; 140  :    dcb.Parity = NOPARITY; // no parity bit

	mov	BYTE PTR _dcb$[ebp+19], 0

; 141  :    dcb.StopBits = ONESTOPBIT; // one stop bit

	mov	BYTE PTR _dcb$[ebp+20], 0

; 142  : 
; 143  :    fSuccess = SetCommState(hCom, &dcb);

	mov	esi, esp
	lea	eax, DWORD PTR _dcb$[ebp]
	push	eax
	mov	ecx, DWORD PTR _hCom$[ebp]
	push	ecx
	call	DWORD PTR __imp__SetCommState@8
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _fSuccess$[ebp], eax

; 144  : 
; 145  :    if (!fSuccess)

	cmp	DWORD PTR _fSuccess$[ebp], 0
	jne	SHORT $LN1@main

; 146  :    {
; 147  :      // Handle the error.
; 148  :        printf ("Cann't set the UART port Settings %d.\n", GetLastError());

	mov	esi, esp
	call	DWORD PTR __imp__GetLastError@0
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	esi, esp
	push	eax
	push	OFFSET ??_C@_0CH@NAFPLEDN@Cann?8t?5set?5the?5UART?5port?5Setting@
	call	DWORD PTR __imp__printf
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp

; 149  :         return (3);

	mov	eax, 3
	jmp	$LN9@main
$LN1@main:

; 150  :    }
; 151  : 
; 152  :     printf ("Serial port %s successfully reconfigured.\n", pcCommPort);

	mov	esi, esp
	lea	eax, DWORD PTR _pcCommPort$[ebp]
	push	eax
	push	OFFSET ??_C@_0CL@JEELHNNP@Serial?5port?5?$CFs?5successfully?5reco@
	call	DWORD PTR __imp__printf
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp

; 153  : 	ReadFile(hCom, (char *)&read_buffer, size,&iBytesRead,NULL);

	mov	esi, esp
	push	0
	push	OFFSET ?iBytesRead@?1??main@@9@9
	mov	eax, DWORD PTR _size$[ebp]
	push	eax
	lea	ecx, DWORD PTR _read_buffer$[ebp]
	push	ecx
	mov	edx, DWORD PTR _hCom$[ebp]
	push	edx
	call	DWORD PTR __imp__ReadFile@20
	cmp	esi, esp
	call	__RTC_CheckEsp

; 154  :     printf ("reading data from eSRAM is DONE\n");

	mov	esi, esp
	push	OFFSET ??_C@_0CB@IHCKNNJB@reading?5data?5from?5eSRAM?5is?5DONE?6@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 155  : 
; 156  : 	fp_read = fopen("read_file.txt","w+");

	mov	esi, esp
	push	OFFSET ??_C@_02CHHAKFFB@w?$CL?$AA@
	push	OFFSET ??_C@_0O@FCJDFIPH@read_file?4txt?$AA@
	call	DWORD PTR __imp__fopen
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp
	mov	DWORD PTR _fp_read$[ebp], eax

; 157  :     printf ("Opening file is done %d\n",fp_read);

	mov	esi, esp
	mov	eax, DWORD PTR _fp_read$[ebp]
	push	eax
	push	OFFSET ??_C@_0BJ@BHODGJDB@Opening?5file?5is?5done?5?$CFd?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 8
	cmp	esi, esp
	call	__RTC_CheckEsp

; 158  : 
; 159  : //	fwrite(read_buffer,2048,4096,fp_read);
; 160  : 	fwrite(read_buffer,1,size,fp_read);

	mov	esi, esp
	mov	eax, DWORD PTR _fp_read$[ebp]
	push	eax
	mov	ecx, DWORD PTR _size$[ebp]
	push	ecx
	push	1
	lea	edx, DWORD PTR _read_buffer$[ebp]
	push	edx
	call	DWORD PTR __imp__fwrite
	add	esp, 16					; 00000010H
	cmp	esi, esp
	call	__RTC_CheckEsp

; 161  :     printf ("writing to file is done\n");

	mov	esi, esp
	push	OFFSET ??_C@_0BJ@CBMHAJKJ@writing?5to?5file?5is?5done?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 162  : 
; 163  : 	fclose(fp_read);

	mov	esi, esp
	mov	eax, DWORD PTR _fp_read$[ebp]
	push	eax
	call	DWORD PTR __imp__fclose
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 164  : 	printf("Done\n");

	mov	esi, esp
	push	OFFSET ??_C@_05KOJMJHML@Done?6?$AA@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 165  : 	printf("Press any key to colse the application\n");

	mov	esi, esp
	push	OFFSET ??_C@_0CI@IOLHHDKL@Press?5any?5key?5to?5colse?5the?5appli@
	call	DWORD PTR __imp__printf
	add	esp, 4
	cmp	esi, esp
	call	__RTC_CheckEsp

; 166  : 	getch();

	mov	esi, esp
	call	DWORD PTR __imp__getch
	cmp	esi, esp
	call	__RTC_CheckEsp

; 167  : 	return(0);

	xor	eax, eax
$LN9@main:

; 168  : 
; 169  : }

	push	edx
	mov	ecx, ebp
	push	eax
	lea	edx, DWORD PTR $LN19@main
	call	@_RTC_CheckStackVars@8
	pop	eax
	pop	edx
	pop	edi
	pop	esi
	pop	ebx
	mov	ecx, DWORD PTR __$ArrayPad$[ebp]
	xor	ecx, ebp
	call	@__security_check_cookie@4
	add	esp, 43516				; 0000a9fcH
	cmp	ebp, esp
	call	__RTC_CheckEsp
	mov	esp, ebp
	pop	ebp
	ret	0
	npad	1
$LN19@main:
	DD	7
	DD	$LN18@main
$LN18@main:
	DD	-16392					; ffffbff8H
	DD	16384					; 00004000H
	DD	$LN11@main
	DD	-32784					; ffff7ff0H
	DD	16384					; 00004000H
	DD	$LN12@main
	DD	-32940					; ffff7f54H
	DD	100					; 00000064H
	DD	$LN13@main
	DD	-38124					; ffff6b14H
	DD	5116					; 000013fcH
	DD	$LN14@main
	DD	-38140					; ffff6b04H
	DD	5
	DD	$LN15@main
	DD	-38200					; ffff6ac8H
	DD	28					; 0000001cH
	DD	$LN16@main
	DD	-43320					; ffff56c8H
	DD	5112					; 000013f8H
	DD	$LN17@main
$LN17@main:
	DB	114					; 00000072H
	DB	101					; 00000065H
	DB	97					; 00000061H
	DB	100					; 00000064H
	DB	95					; 0000005fH
	DB	98					; 00000062H
	DB	117					; 00000075H
	DB	102					; 00000066H
	DB	102					; 00000066H
	DB	101					; 00000065H
	DB	114					; 00000072H
	DB	0
$LN16@main:
	DB	100					; 00000064H
	DB	99					; 00000063H
	DB	98					; 00000062H
	DB	0
$LN15@main:
	DB	112					; 00000070H
	DB	99					; 00000063H
	DB	67					; 00000043H
	DB	111					; 0000006fH
	DB	109					; 0000006dH
	DB	109					; 0000006dH
	DB	80					; 00000050H
	DB	111					; 0000006fH
	DB	114					; 00000072H
	DB	116					; 00000074H
	DB	0
$LN14@main:
	DB	98					; 00000062H
	DB	117					; 00000075H
	DB	102					; 00000066H
	DB	102					; 00000066H
	DB	101					; 00000065H
	DB	114					; 00000072H
	DB	0
$LN13@main:
	DB	102					; 00000066H
	DB	105					; 00000069H
	DB	108					; 0000006cH
	DB	101					; 00000065H
	DB	110					; 0000006eH
	DB	97					; 00000061H
	DB	109					; 0000006dH
	DB	101					; 00000065H
	DB	0
$LN12@main:
	DB	68					; 00000044H
	DB	97					; 00000061H
	DB	116					; 00000074H
	DB	97					; 00000061H
	DB	79					; 0000004fH
	DB	117					; 00000075H
	DB	116					; 00000074H
	DB	66					; 00000042H
	DB	117					; 00000075H
	DB	102					; 00000066H
	DB	102					; 00000066H
	DB	101					; 00000065H
	DB	114					; 00000072H
	DB	0
$LN11@main:
	DB	68					; 00000044H
	DB	97					; 00000061H
	DB	116					; 00000074H
	DB	97					; 00000061H
	DB	73					; 00000049H
	DB	110					; 0000006eH
	DB	66					; 00000042H
	DB	117					; 00000075H
	DB	102					; 00000066H
	DB	102					; 00000066H
	DB	101					; 00000065H
	DB	114					; 00000072H
	DB	0
_main	ENDP
_TEXT	ENDS
END
