📄 avrsms_zip.lst
字号:
##############################################################################
# #
# 24/Sep/2005 02:15:51 #
# IAR Atmel AVR C/C++ Compiler V4.10A/W32, Evaluation Version #
# Copyright 1996-2005 IAR Systems. All rights reserved. #
# #
# Source file = C:\Documents and Settings\vemund\Desktop\AVRGSM\Files\A #
# VRSMS_zip.c #
# Command line = --cpu=m128 -ms -o "C:\Documents and #
# Settings\vemund\Desktop\AVRGSM\Debug\Obj\" -lCN #
# "C:\Documents and Settings\vemund\Desktop\AVRGSM\Debug\ #
# List\" -lA "C:\Documents and #
# Settings\vemund\Desktop\AVRGSM\Debug\List\" -y #
# --initializers_in_flash -z3 --no_cse --no_inline #
# --no_code_motion --no_cross_call --no_clustering #
# --no_tbaa --debug -DENABLE_BIT_DEFINITIONS -e -I #
# D:\Programs\iar\avr\INC\ -I #
# D:\Programs\iar\avr\INC\CLIB\ --eeprom_size 4096 #
# "C:\Documents and Settings\vemund\Desktop\AVRGSM\Files\ #
# AVRSMS_zip.c" #
# List file = C:\Documents and Settings\vemund\Desktop\AVRGSM\Debug\L #
# ist\AVRSMS_zip.lst #
# Object file = C:\Documents and Settings\vemund\Desktop\AVRGSM\Debug\O #
# bj\AVRSMS_zip.r90 #
# #
# #
##############################################################################
C:\Documents and Settings\vemund\Desktop\AVRGSM\Files\AVRSMS_zip.c
1 /*! \file ********************************************************************
2 *
3 * Atmel Corporation
4 *
5 * - File : AVRSMS_zip.c
6 * - Compiler : IAR EWAAVR 4.10A
7 *
8 * - Support mail : avr@atmel.com
9 *
10 * - Supported devices : The example is written for ATmega169
11 *
12 *
13 * - AppNote : AVR323 - Interfacing Cellphones
14 *
15 * - Description : Example of how to use AVR Butterfly as Mobilephone controller
16 *
17 * $Revision: 1.1 $
18 * $Date: Tuesday, November 08, 2005 12:26:18 UTC $
19 *****************************************************************************/
20 #include"AVRSMS_zip.h"
21
22
23 //Flash constant
\ In segment NEAR_F, align 1, keep-with-next
24 const unsigned char __flash hex_lookup[] = hex_nmbr; //!< Lookup table -> int 2 hex
\ hex_lookup:
\ 00000000 313033323534 DB "0123456789ABCDEF"
\ 373639384241
\ 4443464500
\ In segment NEAR_F, align 1, keep-with-next
25 const unsigned char __flash mask[7] = {1,3,7,15,31,63,127}; //!< Lookup table -> mask
\ mask:
\ 00000000 03010F073F1F DB 1, 3, 7, 15, 31, 63, 127
\ 7F
\ In segment NEAR_F, align 1, keep-with-next
26 const unsigned char __flash power[7] = {128,64,32,16,8,4,2}; //!< Lookup table -> 2^( 7 - i )
\ power:
\ 00000000 408010200408 DB 128, 64, 32, 16, 8, 4, 2
\ 02
27
28
\ In segment CODE, align 2, keep-with-next
29 int ZIP_compress( unsigned char *in, unsigned char *discarded, unsigned char ret[] )
\ ZIP_compress:
30 {
\ 00000000 ........ CALL ?PROLOGUE6_L09
\ 00000004 REQUIRE ?Register_R4_is_cg_reg
\ 00000004 REQUIRE ?Register_R5_is_cg_reg
\ 00000004 01B8 MOVW R23:R22, R17:R16
\ 00000006 0129 MOVW R5:R4, R19:R18
\ 00000008 01DA MOVW R27:R26, R21:R20
31 //Local variables
32 int i,ii,iii;
33 unsigned char encode_c, now_c, next_c;
34
35 //Initialization
36 *discarded = 0;
\ 0000000A E000 LDI R16, 0
\ 0000000C 01F2 MOVW R31:R30, R5:R4
\ 0000000E 8300 ST Z, R16
37
38 for( i = ii = iii = 0; in[i] != '\0' && ( i < MESSAGE_LENGTH ); ) //Run through whole string
\ 00000010 E000 LDI R16, 0
\ 00000012 E010 LDI R17, 0
\ 00000014 0118 MOVW R3:R2, R17:R16
\ 00000016 01C8 MOVW R25:R24, R17:R16
\ 00000018 0198 MOVW R19:R18, R17:R16
\ 0000001A C008 RJMP ??ZIP_compress_0
39 {
40 now_c = in[i++]; //This char
41 next_c = in[i]; //Next potentially '\0'
42
43 //Last char?
44 if( next_c == '\0' )
45 {
46 next_c = 0;
47 }
48
49
50 encode_c = (now_c >> ii)+ (mask[ii] & next_c)*power[ii];
51 ret[iii++] = hex_lookup[(encode_c>>4)&0x0F]; //Insert first hex part
52 ret[iii++] = hex_lookup[(encode_c&0x0F)]; //Insert last hex part
53
54 if( ii == 6 ) //We have read a chunk of 7 chars, the next one will be discarded
55 {
56 ii=0;
\ ??ZIP_compress_1:
\ 0000001C E080 LDI R24, 0
\ 0000001E E090 LDI R25, 0
57 i++;
\ 00000020 5F2F SUBI R18, 255
\ 00000022 4F3F SBCI R19, 255
58 (*discarded)++;
\ 00000024 01F2 MOVW R31:R30, R5:R4
\ 00000026 8100 LD R16, Z
\ 00000028 9503 INC R16
\ 0000002A 8300 ST Z, R16
59 }
\ ??ZIP_compress_0:
\ 0000002C 01FB MOVW R31:R30, R23:R22
\ 0000002E 0FE2 ADD R30, R18
\ 00000030 1FF3 ADC R31, R19
\ 00000032 8100 LD R16, Z
\ 00000034 2300 TST R16
\ 00000036 F409 BRNE $+2+2
\ 00000038 C04C RJMP ??ZIP_compress_2
\ 0000003A 3520 CPI R18, 80
\ 0000003C E000 LDI R16, 0
\ 0000003E 0730 CPC R19, R16
\ 00000040 F00C BRLT $+2+2
\ 00000042 C047 RJMP ??ZIP_compress_2
\ 00000044 01FB MOVW R31:R30, R23:R22
\ 00000046 0FE2 ADD R30, R18
\ 00000048 1FF3 ADC R31, R19
\ 0000004A 8100 LD R16, Z
\ 0000004C 5F2F SUBI R18, 255
\ 0000004E 4F3F SBCI R19, 255
\ 00000050 01FB MOVW R31:R30, R23:R22
\ 00000052 0FE2 ADD R30, R18
\ 00000054 1FF3 ADC R31, R19
\ 00000056 8150 LD R21, Z
\ 00000058 2355 TST R21
\ 0000005A F409 BRNE ??ZIP_compress_3
\ 0000005C E050 LDI R21, 0
\ ??ZIP_compress_3:
\ 0000005E E010 LDI R17, 0
\ 00000060 2F48 MOV R20, R24
\ 00000062 ........ CALL ?SS_SHR_L02
\ 00000066 .... LDI R30, LOW(mask)
\ 00000068 .... LDI R31, (mask) >> 8
\ 0000006A 0FE8 ADD R30, R24
\ 0000006C 1FF9 ADC R31, R25
\ 0000006E 9144 LPM R20, Z
\ 00000070 2345 AND R20, R21
\ 00000072 .... LDI R30, LOW(power)
\ 00000074 .... LDI R31, (power) >> 8
\ 00000076 0FE8 ADD R30, R24
\ 00000078 1FF9 ADC R31, R25
\ 0000007A 9114 LPM R17, Z
\ 0000007C 9F41 MUL R20, R17
\ 0000007E 0E00 ADD R0, R16
\ 00000080 .... LDI R30, LOW(hex_lookup)
\ 00000082 .... LDI R31, (hex_lookup) >> 8
\ 00000084 2D00 MOV R16, R0
\ 00000086 9502 SWAP R16
\ 00000088 700F ANDI R16, 0x0F
\ 0000008A E010 LDI R17, 0
\ 0000008C 0FE0 ADD R30, R16
\ 0000008E 1FF1 ADC R31, R17
\ 00000090 9104 LPM R16, Z
\ 00000092 01FD MOVW R31:R30, R27:R26
\ 00000094 0DE2 ADD R30, R2
\ 00000096 1DF3 ADC R31, R3
\ 00000098 8300 ST Z, R16
\ 0000009A E001 LDI R16, 1
\ 0000009C 0E20 ADD R2, R16
\ 0000009E E000 LDI R16, 0
\ 000000A0 1E30 ADC R3, R16
\ 000000A2 .... LDI R30, LOW(hex_lookup)
\ 000000A4 .... LDI R31, (hex_lookup) >> 8
\ 000000A6 2D00 MOV R16, R0
\ 000000A8 E010 LDI R17, 0
\ 000000AA 700F ANDI R16, 0x0F
\ 000000AC 7010 ANDI R17, 0x00
\ 000000AE 0FE0 ADD R30, R16
\ 000000B0 1FF1 ADC R31, R17
\ 000000B2 9104 LPM R16, Z
\ 000000B4 01FD MOVW R31:R30, R27:R26
\ 000000B6 0DE2 ADD R30, R2
\ 000000B8 1DF3 ADC R31, R3
\ 000000BA 8300 ST Z, R16
\ 000000BC E001 LDI R16, 1
\ 000000BE 0E20 ADD R2, R16
\ 000000C0 E000 LDI R16, 0
\ 000000C2 1E30 ADC R3, R16
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -