CCSC中怎样才能使汇编后的GOTO变为CALL?
CCSC中应怎样才能使在汇编时的GOTO变为CALL,以压缩空间。相关程式如下:CCSC程式:while(1)
{
sub1() ; //1
sub2() ; //2
sub3() ; //3
sub4() ; //4
sub5() ; //5
sub2() ; //6
sub7() ; //7
//sub8() ; //8
subprogram8_9_flag =0; // 0 is subprogram8
sub8_9() ; //8 在汇编时生成GOTO,为何不是CALL
//sub9() ; //9
subprogram8_9_flag =1; //1 is subprogram9
sub8_9() ; //9 在汇编时生成GOTO,为何不是CALL
sub3() ; //10
sub11(); //11
sub5() ; //12
sub2() ; //13
//sub7() ; //14
}
汇编后的程式:
.................... subprogram8_9_flag =0; // 0 is subprogram8
*
0132:CLRF 0A
.................... sub8_9() ; //8 在汇编时生成GOTO,为何不是CALL
.................... //sub9() ; //9
.................... subprogram8_9_flag =1; //1 is subprogram9
*
0150:MOVLW01
0151:MOVWF0A
.................... sub8_9() ; //9 在汇编时生成GOTO,为何不是CALL
.................... sub3() ; //10
.................... sub11(); //11
.................... sub5() ; //12
.................... sub2() ; //13 当main()中只调了一次
sub1(i) ;
sub2(j) ;
时候,生成goto语句。
两次及其以上,
生成call语句。 #if defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,PROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=1200, xmit=PIN_C6, rcv=PIN_C7)
#elif defined(__PCH__)
#include <18F452.h>
#fuses HS,NOWDT,PROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=1200, xmit=PIN_C6, rcv=PIN_C7)
#endif
void sub1(int8 i)
{
i++;
}
void sub2(int8 j)
{
j++;
}
void main(void)
{
int8 i,j;
i=0;
j=0;
while(1)
{
sub1(i) ; file://1
sub2(j) ; file://2
sub1(i) ; file://1
sub2(j) ; file://2
sub1(i) ; file://1
sub2(j) ; file://2
}
}
——————————————————————————————
CCS PCH C Compiler, Version 3.187, 16465
Filename: C:\Documents and Settings\lanyong\My Documents\1.LST
ROM used: 104 (0%)
Largest free fragment is 32664
RAM used: 7 (0%) at main() level
8 (1%) worst case
Stack: 1 locations
*
0000:GOTO main
....................#if defined(__PCM__)
.................... #include <16F877.h>
.................... #fuses HS,NOWDT,PROTECT,NOLVP
.................... #use delay(clock=20000000)
.................... #use rs232(baud=1200, xmit=PIN_C6, rcv=PIN_C7)
....................
.................... #elif defined(__PCH__)
.................... #include <18F452.h>
....................//////// Standard Header file for the PIC18F452 device ////////////////
.................... #device PIC18F452
.................... #list
....................
.................... #fuses HS,NOWDT,PROTECT,NOLVP
.................... #use delay(clock=20000000)
.................... #use rs232(baud=1200, xmit=PIN_C6, rcv=PIN_C7)
.................... #endif
....................
.................... void sub1(int8 i)
.................... {
0004:NOP(FFFF)
.................... i++;
0006:INCF i,F
.................... }
0008:RETLW00
000A:NOP(FFFF)
....................
.................... void sub2(int8 j)
.................... {
000C:NOP(FFFF)
.................... j++;
000E:INCF j,F
.................... }
0010:RETLW00
0012:NOP(FFFF)
....................
.................... void main(void)
.................... {
0014:NOP(FFFF)
0016:CLRF TBLPTRU
0018:BCF RCON.7
001A:CLRF FSR0H
001C:CLRF FSR0L
001E:MOVLW06
0020:MOVWFADCON1
0022:MOVLWFF
0024:MOVWFSPBRG
0026:MOVLW22
0028:MOVWFTXSTA
002A:MOVLW90
002C:MOVWFRCSTA
.................... int8 i,j;
.................... i=0;
002E:CLRF i
.................... j=0;
0030:CLRF j
....................
.................... while(1)
.................... {
.................... sub1(i) ; file://1
0032:MOVFFi,i
0036:CALL sub1
.................... sub2(j) ; file://2
003A:MOVFFj,j
003E:CALL sub2
....................
.................... sub1(i) ; file://1
0042:MOVFFi,i
0046:CALL sub1
.................... sub2(j) ; file://2
004A:MOVFFj,j
004E:CALL sub2
....................
.................... sub1(i) ; file://1
0052:MOVFFi,i
0056:CALL sub1
.................... sub2(j) ; file://2
005A:MOVFFj,j
005E:CALL sub2
.................... }
0062:GOTO 0032
....................
.................... }
....................
0066:SLEEP
Configuration Fuses:
Word1: 2200 HS NOOSCSEN
Word2: 0E0F BROWNOUT WDT128 NOWDT BORV20 NOPUT
Word3: 0100 CCP2C1
Word4: 0081 STVREN NODEBUG NOLVP
Word5: C000 PROTECT NOCPD NOCPB
Word6: E00F NOWRT NOWRTD NOWRTB NOWRTC
Word7: 400F NOEBTR NOEBTRB
页:
[1]