⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.lis

📁 硬盘MP3播放器-MEGA128-VS1001K-USB-遥控-LCD-ICCAVR代码-硬盘-支持FAT32-单面PCB 第三部分
💻 LIS
📖 第 1 页 / 共 3 页
字号:
                        .module main.c
                        .area data(ram, con, rel)
 0000           _PageAddress16::
 0000                   .blkb 1
                        .area idata
 0000 00                .byte 0
                        .area data(ram, con, rel)
 0001                   .dbfile C:\DATA\MP3\BootLoader\main.c
 0001                   .dbsym e PageAddress16 _PageAddress16 c
                        .area text(rom, con, rel)
 0000                   .dbfile C:\DATA\MP3\BootLoader\main.c
 0000                   .dbfunc e BootLoad _BootLoad fV
                        .even
 0000           _BootLoad::
 0000                   .dbline -1
 0000                   .dbline 70
 0000           ; /*********************************************************/
 0000           ; /* BootLoader for ATMega128 & MP3 Ver:3.0  @ 16Mhz         */
 0000           ; /* Version 1.1 April 2003                                                              */
 0000           ; /* 1.0 : First Release                                                                         */
 0000           ; /* 1.1 : Add auto baud rate, code smaller                              */
 0000           ; /* 1.2 : Correct a bug with file larger than 65280 bytes.*/
 0000           ; /*                                                                                                             */     
 0000           ; /* Sylvain.Bissonnette@MicroSyl.com                                            */
 0000           ; /*********************************************************/
 0000           ; 
 0000           ; /*********************************************************/
 0000           ; /*                   I N C L U D E                                 */
 0000           ; /*********************************************************/   
 0000           ; #include "main.h"
 0000           ; #include "assembly.h"
 0000           ; #include "macros.h"
 0000           ; #include "iom128v.h"
 0000           ; 
 0000           ; /*********************************************************/
 0000           ; /*                   D E F I N E                           */
 0000           ; /*********************************************************/   
 0000           ; //#define      DeviceID        'A'    // Mega8                
 0000           ; //#define      DeviceID        'B'    // Mega16       
 0000           ; //#define      DeviceID        'C'    // Mega64       
 0000           ; #define        DeviceID        'D'    // Mega128      
 0000           ;                                               
 0000           ; //#define      FlashSize       'l'    // Flash 8k
 0000           ; //#define      FlashSize       'm'    // Flash 16k
 0000           ; //#define      FlashSize       'n'    // Flash 32k
 0000           ; //#define      FlashSize       'o'    // Flash 64k
 0000           ; #define        FlashSize       'p'    // Flash 128k
 0000           ; 
 0000           ; //#define      BootSize        'a'    // 128 word
 0000           ; //#define      BootSize        'b'    // 256 word
 0000           ; #define        BootSize        'c'    // 512 word
 0000           ; //#define      BootSize        'd'    // 1024 word
 0000           ; //#define      BootSize        'e'    // 2048 word
 0000           ; //#define      BootSize        'f'    // 4096 word
 0000           ; 
 0000           ; //#define      PageSize        'Q'    // 32 Bytes
 0000           ; //#define      PageSize        'R'    // 64 Bytes
 0000           ; //#define      PageSize        'S'    // 128 Bytes
 0000           ; #define        PageSize        'T'    // 256 Bytes            
 0000           ; //#define      PageSize        'U'    // 512 Bytes
 0000           ; 
 0000           ; //#define  PageByte    32     // 32 Bytes
 0000           ; //#define  PageByte    64     // 64 Bytes
 0000           ; //#define  PageByte    128     // 128 Bytes
 0000           ; #define  PageByte      256     // 256 Bytes           
 0000           ; //#define  PageByte    512     // 512 Bytes
 0000           ; 
 0000           ; #define  FALSE                 0
 0000           ; #define  TRUE          1
 0000           ; 
 0000           ; #define        EXECCODE        0xffff
 0000           ; 
 0000           ; /*********************************************************/
 0000           ; /*           G L O B A L    V A R I A B L E S                  */
 0000           ; /*********************************************************/   
 0000           ; 
 0000           ; unsigned char PageBuffer[PageByte];
 0000           ; unsigned int PageAddress;
 0000           ; unsigned char PageAddress16 = 0;
 0000           ; unsigned int RealPageAddress;
 0000           ; 
 0000           ; 
 0000           ; /*********************************************************/
 0000           ; 
 0000           ; void BootLoad(void)
 0000           ; {
 0000                   .dbline 71
 0000           ; SendDeviceID();
 0000 1ED0              xcall _SendDeviceID
 0002                   .dbline 72
 0002           ; TxChar('!');
 0002 01E2              ldi R16,33
 0004 F6D0              xcall _TxChar
 0006 19C0              xjmp L3
 0008           L2:
 0008                   .dbline 74
 0008           ; while(1)
 0008           ;               {
 0008                   .dbline 75
 0008           ;               GetPageNumber();
 0008 23D0              xcall _GetPageNumber
 000A                   .dbline 76
 000A           ;               if (RealPageAddress == EXECCODE) ExecCode();
 000A 80910000          lds R24,_RealPageAddress
 000E 90910100          lds R25,_RealPageAddress+1
 0012 8F3F              cpi R24,255
 0014 EFEF              ldi R30,255
 0016 9E07              cpc R25,R30
 0018 09F4              brne L5
 001A                   .dbline 76
 001A 40D0              xcall _ExecCode
 001C           L5:
 001C                   .dbline 78
 001C           ; 
 001C           ;               if (GetPage())
 001C 47D0              xcall _GetPage
 001E 0023              tst R16
 0020 51F0              breq L7
 0022                   .dbline 79
 0022           ;                  {
 0022                   .dbline 80
 0022           ;                  WriteFlash();
 0022 6DD0              xcall _WriteFlash
 0024                   .dbline 81
 0024           ;                  if (CheckFlash()) TxChar('!');
 0024 A7D0              xcall _CheckFlash
 0026 0023              tst R16
 0028 19F0              breq L9
 002A                   .dbline 81
 002A 01E2              ldi R16,33
 002C E2D0              xcall _TxChar
 002E 05C0              xjmp L8
 0030           L9:
 0030                   .dbline 82
 0030           ;                  else TxChar('@');
 0030 00E4              ldi R16,64
 0032 DFD0              xcall _TxChar
 0034                   .dbline 83
 0034           ;                  }
 0034 02C0              xjmp L8
 0036           L7:
 0036                   .dbline 84
 0036           ;               else TxChar('@');
 0036 00E4              ldi R16,64
 0038 DCD0              xcall _TxChar
 003A           L8:
 003A                   .dbline 85
 003A           L3:
 003A                   .dbline 73
 003A E6CF              xjmp L2
 003C           X0:
 003C                   .dbline -2
 003C                   .dbline 86
 003C           ;               }
 003C           ; }
 003C           L1:
 003C                   .dbline 0 ; func end
 003C 0895              ret
 003E                   .dbend
 003E                   .dbfunc e SendDeviceID _SendDeviceID fV
                        .even
 003E           _SendDeviceID::
 003E                   .dbline -1
 003E                   .dbline 90
 003E           ; 
 003E           ; /*********************************************************/
 003E           ; void SendDeviceID(void)
 003E           ; {
 003E                   .dbline 91
 003E           ; TxChar(DeviceID);
 003E 04E4              ldi R16,68
 0040 D8D0              xcall _TxChar
 0042                   .dbline 92
 0042           ; TxChar(FlashSize);
 0042 00E7              ldi R16,112
 0044 D6D0              xcall _TxChar
 0046                   .dbline 93
 0046           ; TxChar(BootSize);
 0046 03E6              ldi R16,99
 0048 D4D0              xcall _TxChar
 004A                   .dbline 94
 004A           ; TxChar(PageSize);
 004A 04E5              ldi R16,84
 004C D2D0              xcall _TxChar
 004E                   .dbline 95
 004E           ; RxChar();
 004E                   .dbline -2
 004E                   .dbline 96
 004E           ; }
 004E           L11:
 004E                   .dbline 0 ; func end
 004E CFC0              xjmp _RxChar
 0050                   .dbend
 0050                   .dbfunc e GetPageNumber _GetPageNumber fV
 0050           ; PageAddressLow -> R22
 0050           ; PageAddressHigh -> R20
                        .even
 0050           _GetPageNumber::
 0050 0E940000          xcall push_gset2
 0054                   .dbline -1
 0054                   .dbline 101
 0054           ; 
 0054           ; /*********************************************************/
 0054           ; 
 0054           ; void GetPageNumber(void)
 0054           ; {
 0054           L13:
 0054                   .dbline 105
 0054           L14:
 0054                   .dbline 105
 0054           ; unsigned char PageAddressHigh;
 0054           ; unsigned char PageAddressLow;
 0054           ; 
 0054           ; while(!IsChar());
 0054 C6D0              xcall _IsChar
 0056 0023              tst R16
 0058 E9F3              breq L13
 005A                   .dbline 106
 005A           ; PageAddressHigh = RxChar();
 005A C9D0              xcall _RxChar
 005C 402F              mov R20,R16
 005E           L16:
 005E                   .dbline 108
 005E           L17:
 005E                   .dbline 108
 005E           ; 
 005E           ; while(!IsChar());
 005E C1D0              xcall _IsChar
 0060 0023              tst R16
 0062 E9F3              breq L16
 0064                   .dbline 109
 0064           ; PageAddressLow = RxChar();
 0064 C4D0              xcall _RxChar
 0066 602F              mov R22,R16
 0068                   .dbline 111
 0068           ; 
 0068           ; RealPageAddress = (int)((PageAddressHigh << 8) + PageAddressLow);
 0068 342E              mov R3,R20
 006A 262E              mov R2,R22
 006C 30920100          sts _RealPageAddress+1,R3
 0070 20920000          sts _RealPageAddress,R2
 0074                   .dbline 112
 0074           ; PageAddress = ((unsigned int)PageAddressLow << 8);
 0074 262E              mov R2,R22
 0076 3324              clr R3
 0078 322C              mov R3,R2
 007A 2224              clr R2
 007C 30920300          sts _PageAddress+1,R3
 0080 20920200          sts _PageAddress,R2
 0084                   .dbline 113
 0084           ; if (PageAddressHigh) PageAddress16 = 1;
 0084 4423              tst R20
 0086 21F0              breq L19
 0088                   .dbline 113
 0088 81E0              ldi R24,1
 008A 80930000          sts _PageAddress16,R24
 008E 03C0              xjmp L20
 0090           L19:
 0090                   .dbline 114
 0090 2224              clr R2
 0092 20920000          sts _PageAddress16,R2
 0096           L20:
 0096                   .dbline -2
 0096                   .dbline 115
 0096           ; else PageAddress16 = 0;
 0096           ; }
 0096           L12:
 0096 0E940000          xcall pop_gset2
 009A                   .dbline 0 ; func end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -