MP2COD 3.70, COFF to COD File Converter
Copyright (c) 2004 Microchip Technology Inc.
Listing File Generated: Thu Sep 14 13:21:11 2006


Address  Value    Disassembly              Source                                                                           File
-------  -------  -----------------------  -------------------------------------------------------------------------------  -----
                                           /* $Id: c018i.c,v 1.3 2004/07/30 17:28:43 ConnerJ Exp $ */                       C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           /* Copyright (c)1999 Microchip Technology */                                     C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           /* MPLAB-C18 startup code, including initialized data */                         C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           /* external reference to the user's main routine */                              C:\mcc18\src\traditional\startup\c018i.c
                                           extern void main (void);                                                         C:\mcc18\src\traditional\startup\c018i.c
                                           /* prototype for the startup function */                                         C:\mcc18\src\traditional\startup\c018i.c
                                           void _entry (void);                                                              C:\mcc18\src\traditional\startup\c018i.c
                                           void _startup (void);                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           /* prototype for the initialized data setup */                                   C:\mcc18\src\traditional\startup\c018i.c
                                           void _do_cinit (void);                                                           C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           extern volatile near unsigned long short TBLPTR;                                 C:\mcc18\src\traditional\startup\c018i.c
                                           extern near unsigned FSR0;                                                       C:\mcc18\src\traditional\startup\c018i.c
                                           extern near char FPFLAGS;                                                        C:\mcc18\src\traditional\startup\c018i.c
                                           #define RND 6                                                                    C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           #pragma code _entry_scn=0x000000                                                 C:\mcc18\src\traditional\startup\c018i.c
                                           void                                                                             C:\mcc18\src\traditional\startup\c018i.c
                                           _entry (void)                                                                    C:\mcc18\src\traditional\startup\c018i.c
                                           {                                                                                C:\mcc18\src\traditional\startup\c018i.c
000000   efce     GOTO      0x19c          _asm goto _startup _endasm                                                       C:\mcc18\src\traditional\startup\c018i.c
000002   f000                                                                                                               
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
000004   0012     RETURN    0x0            }                                                                                C:\mcc18\src\traditional\startup\c018i.c
                                           #pragma code _startup_scn                                                        C:\mcc18\src\traditional\startup\c018i.c
                                           void                                                                             C:\mcc18\src\traditional\startup\c018i.c
                                           _startup (void)                                                                  C:\mcc18\src\traditional\startup\c018i.c
                                           {                                                                                C:\mcc18\src\traditional\startup\c018i.c
                                             _asm                                                                           C:\mcc18\src\traditional\startup\c018i.c
                                               // Initialize the stack pointer                                              C:\mcc18\src\traditional\startup\c018i.c
00019c   ee12     LFSR      0x1,0x200          lfsr 1, _stack                                                               C:\mcc18\src\traditional\startup\c018i.c
00019e   f000                                                                                                               
0001a0   ee22     LFSR      0x2,0x200          lfsr 2, _stack                                                               C:\mcc18\src\traditional\startup\c018i.c
0001a2   f000                                                                                                               
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
0001a4   6af8     CLRF      0xf8,0x0           clrf TBLPTRU, 0 // 1st silicon doesn't do this on POR                        C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
0001a6   9c01     BCF       0x1,0x6,0x0        bcf FPFLAGS,RND,0 // Initialize rounding flag for floating point libs        C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                               _endasm                                                                      C:\mcc18\src\traditional\startup\c018i.c
0001a8   ec16     CALL      0x2c,0x0           _do_cinit ();                                                                C:\mcc18\src\traditional\startup\c018i.c
0001aa   f000                                                                                                               
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           loop:                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                             // Call the user's main routine                                                C:\mcc18\src\traditional\startup\c018i.c
0001ac   ec8a     CALL      0x114,0x0        main ();                                                                       C:\mcc18\src\traditional\startup\c018i.c
0001ae   f000                                                                                                               
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
0001b0   d7fd     BRA       0x1ac            goto loop;                                                                     C:\mcc18\src\traditional\startup\c018i.c
0001b2   0012     RETURN    0x0            }                               /* end _startup() */                             C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           /* MPLAB-C18 initialized data memory support */                                  C:\mcc18\src\traditional\startup\c018i.c
                                           /* The linker will populate the _cinit table */                                  C:\mcc18\src\traditional\startup\c018i.c
                                           extern far rom struct                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           {                                                                                C:\mcc18\src\traditional\startup\c018i.c
                                             unsigned short num_init;                                                       C:\mcc18\src\traditional\startup\c018i.c
                                             struct _init_entry                                                             C:\mcc18\src\traditional\startup\c018i.c
                                             {                                                                              C:\mcc18\src\traditional\startup\c018i.c
                                               unsigned long from;                                                          C:\mcc18\src\traditional\startup\c018i.c
                                               unsigned long to;                                                            C:\mcc18\src\traditional\startup\c018i.c
                                               unsigned long size;                                                          C:\mcc18\src\traditional\startup\c018i.c
                                             }                                                                              C:\mcc18\src\traditional\startup\c018i.c
                                             entries[];                                                                     C:\mcc18\src\traditional\startup\c018i.c
                                           }                                                                                C:\mcc18\src\traditional\startup\c018i.c
                                           _cinit;                                                                          C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           #pragma code _cinit_scn                                                          C:\mcc18\src\traditional\startup\c018i.c
                                           void                                                                             C:\mcc18\src\traditional\startup\c018i.c
                                           _do_cinit (void)                                                                 C:\mcc18\src\traditional\startup\c018i.c
                                           {                                                                                C:\mcc18\src\traditional\startup\c018i.c
                                             /* we'll make the assumption in the following code that these statics          C:\mcc18\src\traditional\startup\c018i.c
                                              * will be allocated into the same bank.                                       C:\mcc18\src\traditional\startup\c018i.c
                                              */                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                             static short long prom;                                                        C:\mcc18\src\traditional\startup\c018i.c
                                             static unsigned short curr_byte;                                               C:\mcc18\src\traditional\startup\c018i.c
                                             static unsigned short curr_entry;                                              C:\mcc18\src\traditional\startup\c018i.c
                                             static short long data_ptr;                                                    C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                             // Initialized data...                                                         C:\mcc18\src\traditional\startup\c018i.c
00002c   0e2a     MOVLW     0x2a             TBLPTR = (short long)&_cinit;                                                  C:\mcc18\src\traditional\startup\c018i.c
00002e   6ef6     MOVWF     0xf6,0x0                                                                                        
000030   0e00     MOVLW     0x0                                                                                             
000032   6ef7     MOVWF     0xf7,0x0                                                                                        
000034   0e00     MOVLW     0x0                                                                                             
000036   6ef8     MOVWF     0xf8,0x0                                                                                        
                                             _asm                                                                           C:\mcc18\src\traditional\startup\c018i.c
000038   0100     MOVLB     0x0                movlb data_ptr                                                               C:\mcc18\src\traditional\startup\c018i.c
00003a   0009     TBLRDPOSTINC                 tblrdpostinc                                                                 C:\mcc18\src\traditional\startup\c018i.c
00003c   50f5     MOVF      0xf5,0x0,0x0       movf TABLAT, 0, 0                                                            C:\mcc18\src\traditional\startup\c018i.c
00003e   6f65     MOVWF     0x65,0x1           movwf curr_entry, 1                                                          C:\mcc18\src\traditional\startup\c018i.c
000040   0009     TBLRDPOSTINC                 tblrdpostinc                                                                 C:\mcc18\src\traditional\startup\c018i.c
000042   50f5     MOVF      0xf5,0x0,0x0       movf TABLAT, 0, 0                                                            C:\mcc18\src\traditional\startup\c018i.c
000044   6f66     MOVWF     0x66,0x1           movwf curr_entry+1, 1                                                        C:\mcc18\src\traditional\startup\c018i.c
                                             _endasm                                                                        C:\mcc18\src\traditional\startup\c018i.c
                                               //while (curr_entry)                                                         C:\mcc18\src\traditional\startup\c018i.c
                                               //{                                                                          C:\mcc18\src\traditional\startup\c018i.c
                                               test:                                                                        C:\mcc18\src\traditional\startup\c018i.c
                                               _asm                                                                         C:\mcc18\src\traditional\startup\c018i.c
000046   e103     BNZ       0x4e                bnz 3                                                                       C:\mcc18\src\traditional\startup\c018i.c
000048   6765     TSTFSZ    0x65,0x1           tstfsz curr_entry, 1                                                         C:\mcc18\src\traditional\startup\c018i.c
00004a   d001     BRA       0x4e               bra 1                                                                        C:\mcc18\src\traditional\startup\c018i.c
                                               _endasm                                                                      C:\mcc18\src\traditional\startup\c018i.c
00004c   d03d     BRA       0xc8               goto done;                                                                   C:\mcc18\src\traditional\startup\c018i.c
                                                 /* Count down so we only have to look up the data in _cinit                C:\mcc18\src\traditional\startup\c018i.c
                                                  * once.                                                                   C:\mcc18\src\traditional\startup\c018i.c
                                                  *                                                                         C:\mcc18\src\traditional\startup\c018i.c
                                                  * At this point we know that TBLPTR points to the top of the current      C:\mcc18\src\traditional\startup\c018i.c
                                                  * entry in _cinit, so we can just start reading the from, to, and         C:\mcc18\src\traditional\startup\c018i.c
                                                  * size values.                                                            C:\mcc18\src\traditional\startup\c018i.c
                                                  */                                                                        C:\mcc18\src\traditional\startup\c018i.c
                                                 _asm                                                                       C:\mcc18\src\traditional\startup\c018i.c
                                           	/* read the source address */                                                   C:\mcc18\src\traditional\startup\c018i.c
00004e   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
000050   50f5     MOVF      0xf5,0x0,0x0   	movf TABLAT, 0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
000052   6f60     MOVWF     0x60,0x1       	movwf prom, 1                                                                   C:\mcc18\src\traditional\startup\c018i.c
000054   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
000056   50f5     MOVF      0xf5,0x0,0x0   	movf TABLAT, 0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
000058   6f61     MOVWF     0x61,0x1       	movwf prom+1, 1                                                                 C:\mcc18\src\traditional\startup\c018i.c
00005a   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
00005c   50f5     MOVF      0xf5,0x0,0x0   	movf TABLAT, 0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
00005e   6f62     MOVWF     0x62,0x1       	movwf prom+2, 1                                                                 C:\mcc18\src\traditional\startup\c018i.c
                                           	/* skip a byte since it's stored as a 32bit int */                              C:\mcc18\src\traditional\startup\c018i.c
000060   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
                                           	/* read the destination address directly into FSR0 */                           C:\mcc18\src\traditional\startup\c018i.c
000062   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
000064   50f5     MOVF      0xf5,0x0,0x0   	movf TABLAT, 0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
000066   6ee9     MOVWF     0xe9,0x0       	movwf FSR0L, 0                                                                  C:\mcc18\src\traditional\startup\c018i.c
000068   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
00006a   50f5     MOVF      0xf5,0x0,0x0   	movf TABLAT, 0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
00006c   6eea     MOVWF     0xea,0x0       	movwf FSR0H, 0                                                                  C:\mcc18\src\traditional\startup\c018i.c
                                           	/* skip two bytes since it's stored as a 32bit int */                           C:\mcc18\src\traditional\startup\c018i.c
00006e   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
000070   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
                                           	/* read the destination address directly into FSR0 */                           C:\mcc18\src\traditional\startup\c018i.c
000072   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
000074   50f5     MOVF      0xf5,0x0,0x0   	movf TABLAT, 0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
000076   6f63     MOVWF     0x63,0x1       	movwf curr_byte, 1                                                              C:\mcc18\src\traditional\startup\c018i.c
000078   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
00007a   50f5     MOVF      0xf5,0x0,0x0   	movf TABLAT, 0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
00007c   6f64     MOVWF     0x64,0x1       	movwf curr_byte+1, 1                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           	/* skip two bytes since it's stored as a 32bit int */                           C:\mcc18\src\traditional\startup\c018i.c
00007e   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
000080   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
                                                 _endasm                                                                    C:\mcc18\src\traditional\startup\c018i.c
                                                 //prom = data_ptr->from;                                                   C:\mcc18\src\traditional\startup\c018i.c
                                                 //FSR0 = data_ptr->to;                                                     C:\mcc18\src\traditional\startup\c018i.c
                                                 //curr_byte = (unsigned short) data_ptr->size;                             C:\mcc18\src\traditional\startup\c018i.c
                                                 /* the table pointer now points to the next entry. Save it                 C:\mcc18\src\traditional\startup\c018i.c
                                                  * off since we'll be using the table pointer to do the copying            C:\mcc18\src\traditional\startup\c018i.c
                                                  * for the entry.                                                          C:\mcc18\src\traditional\startup\c018i.c
                                                  */                                                                        C:\mcc18\src\traditional\startup\c018i.c
000082   cff6     MOVFF     0xff6,0x67           data_ptr = TBLPTR;                                                         C:\mcc18\src\traditional\startup\c018i.c
000084   f067                                                                                                               
000086   cff7     MOVFF     0xff7,0x68                                                                                      
000088   f068                                                                                                               
00008a   cff8     MOVFF     0xff8,0x69                                                                                      
00008c   f069                                                                                                               
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                                 /* now assign the source address to the table pointer */                   C:\mcc18\src\traditional\startup\c018i.c
00008e   c060     MOVFF     0x60,0xff6           TBLPTR = prom;                                                             C:\mcc18\src\traditional\startup\c018i.c
000090   fff6                                                                                                               
000092   c061     MOVFF     0x61,0xff7                                                                                      
000094   fff7                                                                                                               
000096   c062     MOVFF     0x62,0xff8                                                                                      
000098   fff8                                                                                                               
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                                 /* do the copy loop */                                                     C:\mcc18\src\traditional\startup\c018i.c
                                                 _asm                                                                       C:\mcc18\src\traditional\startup\c018i.c
                                                   // determine if we have any more bytes to copy                           C:\mcc18\src\traditional\startup\c018i.c
00009a   0100     MOVLB     0x0            	movlb curr_byte                                                                 C:\mcc18\src\traditional\startup\c018i.c
00009c   5363     MOVF      0x63,0x1,0x1   	movf curr_byte, 1, 1                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           copy_loop:                                                                       C:\mcc18\src\traditional\startup\c018i.c
00009e   e102     BNZ       0xa4           	bnz 2 // copy_one_byte                                                          C:\mcc18\src\traditional\startup\c018i.c
0000a0   5364     MOVF      0x64,0x1,0x1   	movf curr_byte + 1, 1, 1                                                        C:\mcc18\src\traditional\startup\c018i.c
0000a2   e007     BZ        0xb2           	bz 7 // done_copying                                                            C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           copy_one_byte:                                                                   C:\mcc18\src\traditional\startup\c018i.c
0000a4   0009     TBLRDPOSTINC             	tblrdpostinc                                                                    C:\mcc18\src\traditional\startup\c018i.c
0000a6   50f5     MOVF      0xf5,0x0,0x0   	movf TABLAT, 0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
0000a8   6eee     MOVWF     0xee,0x0       	movwf POSTINC0, 0                                                               C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           	// decrement byte counter                                                       C:\mcc18\src\traditional\startup\c018i.c
0000aa   0763     DECF      0x63,0x1,0x1   	decf curr_byte, 1, 1                                                            C:\mcc18\src\traditional\startup\c018i.c
0000ac   e2f8     BC        0x9e           	bc -8 // copy_loop                                                              C:\mcc18\src\traditional\startup\c018i.c
0000ae   0764     DECF      0x64,0x1,0x1           decf curr_byte + 1, 1, 1                                                 C:\mcc18\src\traditional\startup\c018i.c
0000b0   d7f9     BRA       0xa4           	bra -7 // copy_one_byte                                                         C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           done_copying:                                                                    C:\mcc18\src\traditional\startup\c018i.c
                                                                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                                 _endasm                                                                    C:\mcc18\src\traditional\startup\c018i.c
                                                 /* restore the table pointer for the next entry */                         C:\mcc18\src\traditional\startup\c018i.c
0000b2   c067     MOVFF     0x67,0xff6           TBLPTR = data_ptr;                                                         C:\mcc18\src\traditional\startup\c018i.c
0000b4   fff6                                                                                                               
0000b6   c068     MOVFF     0x68,0xff7                                                                                      
0000b8   fff7                                                                                                               
0000ba   c069     MOVFF     0x69,0xff8                                                                                      
0000bc   fff8                                                                                                               
                                                 /* next entry... */                                                        C:\mcc18\src\traditional\startup\c018i.c
0000be   0100     MOVLB     0x0                  curr_entry--;                                                              C:\mcc18\src\traditional\startup\c018i.c
0000c0   0765     DECF      0x65,0x1,0x1                                                                                    
0000c2   0e00     MOVLW     0x0                                                                                             
0000c4   5b66     SUBWFB    0x66,0x1,0x1                                                                                    
0000c6   d7bf     BRA       0x46                 goto test;                                                                 C:\mcc18\src\traditional\startup\c018i.c
                                           done:                                                                            C:\mcc18\src\traditional\startup\c018i.c
                                           ;                                                                                C:\mcc18\src\traditional\startup\c018i.c
0000c8   0012     RETURN    0x0            }                                                                                C:\mcc18\src\traditional\startup\c018i.c
                                           /*                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************* D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *												TIMER DEMO                                                          D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Description:  Example 3 for PIC18-LF4550-STK1 board to :                       D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *				1. Blink LED D1 to D4 connected to PORTD<3:0> like example 1 by timer 0 interrupt D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * File:			..\src\chp3\src3_1\main.c                                              D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Software:		C18 version 2.40 under MPLAB 7.41 IDE                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Programmer: 	John Leung, TechToys Co. (www.TechToys.com.hk)                    D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Hardware:		PIC18-LF4550-STK1, with PIC18LF4550, 20.000 MHz crystal             D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Date:			14th Sept 2006                                                         D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Version:		1.0                                                                  D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Programmer:	John Leung                                                         D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Remarks:		Enable JP2 for LED.                                                  D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *				ICD2 employed for linker script 18f4550i.lkr.                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************* D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           */                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #include <p18cxxx.h>                                                             D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #include <timers.h>                                                              D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           /*                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *												Pragma Section                                                      D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Configuration bits under MPLAB v7.41 subject to changes on every little change on project settings. D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * So #pragma config statments used for configuration bits instead of using Configuration bits tab in MPLAB D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * Note: Refer to pdf document "mcc18\doc\MPLAB-C18-Addendum.pdf" under mcc18 installation directory for config D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           * 		variables available                                                          D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           */                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config FOSC   = HS			// HS oscillator                                    D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config CPUDIV = OSC4_PLL6	// OSC postscaler of 4 => CPU clock at 5MHz (20MHz/4) D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config PWRT   = ON			// PowerUp timer ON                                 D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config WDT    = OFF			// watchdog timer off                              D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config LVP    = OFF			// low level voltage OFF                           D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config BOR    = OFF			// brown out detect OFF                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config DEBUG  = ON			// Debug ON                                         D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config VREGEN = OFF			// Disable 3.3V internal regulator                 D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma config PBADEN = OFF 		// PORTB<4:0> as digital IO on reset               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           /*                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *												GLOBAL VARIABLES                                                    D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           */                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           unsigned char counter;                                                           D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           unsigned char millisecs;                                                         D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           /*                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *												FUNCTION PROTOTYPES                                                 D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           */                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           void blink_LED(void);                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           /*                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *												INTERRUPT VECTOR                                                    D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           */                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma code _HIGH_INTERRUPT_VECTOR = 0x000008                                   D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           void _high_ISR (void)                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           {                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
000008   ef65     GOTO      0xca               _asm goto blink_LED _endasm                                                  D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
00000a   f000                                                                                                               
00000c   0012     RETURN    0x0            }                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma code                                                                     D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           #pragma interrupt blink_LED                                                      D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000ca   cfda     MOVFF     0xfda,0xfe4    void blink_LED(void)                                                             D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000cc   ffe4                                                                                                               
0000ce   cfe2     MOVFF     0xfe2,0xfda                                                                                     
0000d0   ffda                                                                                                               
0000d2   cfe9     MOVFF     0xfe9,0xfe4                                                                                     
0000d4   ffe4                                                                                                               
0000d6   cfea     MOVFF     0xfea,0xfe4                                                                                     
0000d8   ffe4                                                                                                               
0000da   52e6     MOVF      0xe6,0x1,0x0                                                                                    
                                           {                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000dc   94f2     BCF       0xf2,0x2,0x0   	INTCONbits.TMR0IF = 0;                                                          D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000de   0e64     MOVLW     0x64           	WriteTimer0(100);                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000e0   6ee6     MOVWF     0xe6,0x0                                                                                        
0000e2   6ae6     CLRF      0xe6,0x0                                                                                        
0000e4   ec96     CALL      0x12c,0x0                                                                                       
0000e6   f000                                                                                                               
0000e8   52e5     MOVF      0xe5,0x1,0x0                                                                                    
0000ea   52e5     MOVF      0xe5,0x1,0x0                                                                                    
0000ec   0100     MOVLB     0x0            	if(millisecs++ == 100)                                                          D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000ee   516b     MOVF      0x6b,0x0,0x1                                                                                    
0000f0   2b6b     INCF      0x6b,0x1,0x1                                                                                    
0000f2   0864     SUBLW     0x64                                                                                            
0000f4   e104     BNZ       0xfe                                                                                            
                                           	{                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000f6   6b6b     CLRF      0x6b,0x1       		millisecs=0;                                                                   D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000f8   2b6a     INCF      0x6a,0x1,0x1   		counter++;                                                                     D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000fa   c06a     MOVFF     0x6a,0xf8c     		LATD = counter;                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000fc   ff8c                                                                                                               
                                           	}                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
0000fe   52e5     MOVF      0xe5,0x1,0x0   }                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
000100   cfe5     MOVFF     0xfe5,0xfea                                                                                     
000102   ffea                                                                                                               
000104   cfe5     MOVFF     0xfe5,0xfe9                                                                                     
000106   ffe9                                                                                                               
000108   cfe5     MOVFF     0xfe5,0xfda                                                                                     
00010a   ffda                                                                                                               
00010c   0011     RETFIE    0x1                                                                                             
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           void EnableHighInterrupts(void)                                                  D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           {                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
00010e   8ed0     BSF       0xd0,0x7,0x0   	RCONbits.IPEN = 1;							//enable interrupt priority levels                     D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
000110   8ef2     BSF       0xf2,0x7,0x0   	INTCONbits.GIEH = 1;						//enable all high priority interrupts                 D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
000112   0012     RETURN    0x0            }                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           /*                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           *													   MAIN                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           ******************************************************************************************************************** D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           */                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           void main(void)                                                                  D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           {                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
000114   0e0f     MOVLW     0xf            	ADCON1 = 0x0F;								//PORTA all digital operation                             D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
000116   6ec1     MOVWF     0xc1,0x0                                                                                        
000118   6a8c     CLRF      0x8c,0x0       	LATD = 0x00;								//use LED1 - LED4 as a simple counter                       D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
00011a   6a95     CLRF      0x95,0x0       	TRISD = 0x00; 								//configure PORTD for output                              D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           	OpenTimer0(	TIMER_INT_ON &					//interrupt disable                              D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           				T0_8BIT &						//Timer0 in 8-bit mode                                        D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           				T0_SOURCE_INT &					//internal clock source                                  D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
00011c   0ed2     MOVLW     0xd2           				T0_PS_1_8);						//1:8 prescaler                                             D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
00011e   6ee6     MOVWF     0xe6,0x0                                                                                        
000120   ecb2     CALL      0x164,0x0                                                                                       
000122   f000                                                                                                               
000124   52e5     MOVF      0xe5,0x1,0x0                                                                                    
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
000126   dff3     RCALL     0x10e          	EnableHighInterrupts();                                                         D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                                                                                            D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
000128   d7ff     BRA       0x128          	while(1)                                                                        D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           	{                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           		;			                                                                           D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                           	}                                                                               D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
00012a   0012     RETURN    0x0            }                                                                                D:\PIC18_LF4550_STK1\src\chp3\src3_1\main.c
                                                   LIST P=18F4550                                                           C:\MCC18\SRC\TRADIT~1\PROC\p18f4550.asm
                                                   LIST                                                                     C:\MCC18\SRC\TRADIT~1\PROC\p18f4550.asm
                                                   END                                                                      C:\MCC18\SRC\TRADIT~1\PROC\p18f4550.asm
                                           ;	RCS Header $Id: cmath18.asm,v 1.4 2004/10/01 19:13:22 GrosbaJ Exp $            C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                                                                                                            C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           ;       CMATH18 DATA DEFINITION FILE                                             C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                                                                                                            C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           ;******************************************************************************* C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           ;   VARIABLE ALLOCATION - Core math library routines                             C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           ;******************************************************************************* C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                                                                                                            C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           MATH_DATA      UDATA_ACS                                                         C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                                                                                                            C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           SIGN		RES 1       ; save location for sign in MSB                                C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           FPFLAGSbits                                                                      C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           FPFLAGS		RES 1       ; floating point library exception flags                    C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                                                                                                            C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                                   GLOBAL  SIGN, FPFLAGS, FPFLAGSbits                                       C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           	                                                                                C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                                   END                                                                      C:\MCC18\SRC\TRADIT~1\MATH\cmath18.asm
                                           /* $Id: t0open.c,v 1.1 2003/12/09 22:52:09 GrosbaJ Exp $ */                      C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           #include <p18cxxx.h>                                                             C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           #include <timers.h>                                                              C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                                                                                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           /********************************************************************            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           *    Function Name:  OpenTimer0                                     *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           *    Return Value:   void                                           *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           *    Parameters:     config: bit definitions to configure Timer0    *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           *    Description:    This routine resets the Timer0 regs to the     *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           *                    POR state and configures the interrupt, clock  *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           *                    source, edge and prescaler.                    *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           *    Notes:          The bit definitions for config can be found    *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           *                    in the timers.h file.                          *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                           ********************************************************************/            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000164   cfd9     MOVFF     0xfd9,0xfe6    void OpenTimer0(unsigned char config)                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000166   ffe6                                                                                                               
000168   cfda     MOVFF     0xfda,0xfe6                                                                                     
00016a   ffe6                                                                                                               
00016c   cfe1     MOVFF     0xfe1,0xfd9                                                                                     
00016e   ffd9                                                                                                               
000170   cfe2     MOVFF     0xfe2,0xfda                                                                                     
000172   ffda                                                                                                               
                                           {                                                                                C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000174   0efd     MOVLW     0xfd             T0CON = (0x7f & config);  // Configure timer, but don't start it yet           C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000176   50db     MOVF      0xdb,0x0,0x0                                                                                    
000178   0b7f     ANDLW     0x7f                                                                                            
00017a   6ed5     MOVWF     0xd5,0x0                                                                                        
00017c   6ad7     CLRF      0xd7,0x0         TMR0H = 0;                // Reset Timer0 to 0x0000                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
00017e   6ad6     CLRF      0xd6,0x0         TMR0L = 0;                                                                     C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000180   94f2     BCF       0xf2,0x2,0x0     INTCONbits.T0IF = 0;      // Clear Timer0 overflow flag                        C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                                                                                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000182   0efd     MOVLW     0xfd             if(config&0x80)           // If interrupts enabled                             C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000184   aedb     BTFSS     0xdb,0x7,0x0                                                                                    
000186   d002     BRA       0x18c                                                                                           
000188   8af2     BSF       0xf2,0x5,0x0       INTCONbits.T0IE = 1;    // Enable Timer0 overflow interrupt                  C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
00018a   d001     BRA       0x18e            else                                                                           C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
00018c   9af2     BCF       0xf2,0x5,0x0       INTCONbits.T0IE = 0;                                                         C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
                                                                                                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
00018e   8ed5     BSF       0xd5,0x7,0x0     T0CONbits.TMR0ON = 1;                                                          C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000190   52e5     MOVF      0xe5,0x1,0x0   }                                                                                C:\mcc18\src\TRADIT~1\pmc\Timers\t0open.c
000192   cfe5     MOVFF     0xfe5,0xfda                                                                                     
000194   ffda                                                                                                               
000196   cfe7     MOVFF     0xfe7,0xfd9                                                                                     
000198   ffd9                                                                                                               
00019a   0012     RETURN    0x0                                                                                             
                                           /* $Id: t0write.c,v 1.2 2004/01/07 20:03:08 sealep Exp $ */                      C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           #include <p18cxxx.h>                                                             C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           #include <timers.h>                                                              C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                                                                                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           /********************************************************************            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           *    Function Name:  WriteTimer0                                    *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           *    Return Value:   void                                           *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           *    Parameters:     int: value to write to Timer0                  *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           *    Description:    This routine writes a 16-bit value to Timer0   *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           *                    Timer0.                                        *            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                           ********************************************************************/            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
00012c   cfd9     MOVFF     0xfd9,0xfe6    void WriteTimer0(unsigned int timer0)                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
00012e   ffe6                                                                                                               
000130   cfda     MOVFF     0xfda,0xfe6                                                                                     
000132   ffe6                                                                                                               
000134   cfe1     MOVFF     0xfe1,0xfd9                                                                                     
000136   ffd9                                                                                                               
000138   cfe2     MOVFF     0xfe2,0xfda                                                                                     
00013a   ffda                                                                                                               
00013c   52e6     MOVF      0xe6,0x1,0x0                                                                                    
00013e   52e6     MOVF      0xe6,0x1,0x0                                                                                    
                                           {                                                                                C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                             union Timers timer;                                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
                                                                                                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
000140   0efc     MOVLW     0xfc             timer.lt = timer0;    // Copy timer value into union                           C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
000142   cfdb     MOVFF     0xfdb,0xfde                                                                                     
000144   ffde                                                                                                               
000146   cfdb     MOVFF     0xfdb,0xfdd                                                                                     
000148   ffdd                                                                                                               
                                                                                                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
00014a   0e01     MOVLW     0x1              TMR0H = timer.bt[1];  // Write high byte to Timer0                             C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
00014c   50db     MOVF      0xdb,0x0,0x0                                                                                    
00014e   6ed7     MOVWF     0xd7,0x0                                                                                        
000150   50df     MOVF      0xdf,0x0,0x0     TMR0L = timer.bt[0];  // Write low byte to Timer0                              C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
000152   6ed6     MOVWF     0xd6,0x0                                                                                        
000154   52e5     MOVF      0xe5,0x1,0x0   }                                                                                C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
000156   52e5     MOVF      0xe5,0x1,0x0                                                                                    
000158   52e5     MOVF      0xe5,0x1,0x0                                                                                    
00015a   cfe5     MOVFF     0xfe5,0xfda                                                                                     
00015c   ffda                                                                                                               
00015e   cfe7     MOVFF     0xfe7,0xfd9                                                                                     
000160   ffd9                                                                                                               
000162   0012     RETURN    0x0                                                                                             
                                                                                                                            C:\mcc18\src\TRADIT~1\pmc\Timers\t0write.c
