[an error occurred while processing this directive] [an error occurred while processing this directive]
Или ещё круче.
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
[an error occurred while processing this directive] [an error occurred while processing this directive]

Отправлено AlexD 28 марта 2002 г. 00:01
В ответ на: Ответ: подробнее отправлено Andy Дюх 27 марта 2002 г. 16:36


#define swap_i(x) ((x>>8)|(x<<8))

int a=56, b=78;

int swap_int(int q){
return (q>>8)|(q<<8);
}

void main(void){

a=swap_int(a);
b=swap_i(b);
}

##############################################################################
# #
# IAR Atmel AVR C/EC++ Compiler V2.26C/WIN 28/Mar/2002 03:09:50 #
# Copyright 1996-2001 IAR Systems. All rights reserved. #
# #
# Source file = C:\Document\AVR\Projects\Untitled1.c #
# Command line = -v0 -mt -o C:\Document\AVR\Projects\Debug\Obj\ -I #
# "C:\PROGRAM FILES\IAR SYSTEMS\EW23_226C\avr\SRC\CLIB\IN #
# C\" -lCN C:\Document\AVR\Projects\Debug\List\ -lA #
# C:\Document\AVR\Projects\Debug\List\ -e #
# --initializers_in_flash -s9 --cross_call_passes=2 #
# --debug --do_cross_call C:\Document\AVR\Projects\Untitl #
# ed1.c #
# List file = C:\Document\AVR\Projects\Debug\List\Untitled1.lst #
# Object file = C:\Document\AVR\Projects\Debug\Obj\Untitled1.r90 #
# #
# #
##############################################################################

1 #define swap_i(x) ((x>>8)|(x<<8))
2

\ In segment TINY_I, align 1, keep-with-next
\ 00000000 REQUIRE `?`
3 int a=56, b=78;
\ int __tiny a;
\ a:
\ 00000000 DS 2
\ 00000002 REQUIRE `?`
\ int __tiny b;
\ b:
\ 00000002 DS 2
\ 00000004 REQUIRE `?`
4

\ In segment CODE, align 2, keep-with-next
5 int swap_int(int q){
6 return (q>>8)|(q<<8);
\ __nearfunc int swap_int(int);
\ swap_int:
\ 00000000 2F21 MOV R18,R17
\ 00000002 2F10 MOV R17,R16
\ 00000004 2F02 MOV R16,R18
\ 00000006 9508 RET
7 }
8

\ In segment CODE, align 2, keep-with-next
9 void main(void){
10
11 a=swap_int(a);
\ __nearfunc void main();
\ main:
\ 00000000 .... LDI R30,a
\ 00000002 8110 LD R17,Z
\ 00000004 8121 LDD R18,Z+1
\ 00000006 8320 ST Z,R18
\ 00000008 8311 STD Z+1,R17
12 b=swap_i(b);
\ 0000000A 8112 LDD R17,Z+2
\ 0000000C 8123 LDD R18,Z+3
\ 0000000E 8322 STD Z+2,R18
\ 00000010 8313 STD Z+3,R17
13 }
\ 00000012 9508 RET



Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru