C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[62849] 오버 사이즈의 코드를 단축 하는 방법 질문 드립니다!
이정준 [wjdwns84] 689 읽음    2010-11-02 10:42

아래의 코드를 디버그 했는데 코드의 사이즈가 1024bytes 보다 큰 1369라서 에러가 떴습니다. 축소하는 방법 알려주실 수 없나요...참고로 광마우스의 동작을 컨트롤 하는 코드입니다.

 

#include <stdio.h>      /* common defines and macros */
#include <hidef.h>      /* common defines and macros */
#include <mc9s12c128.h>     /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12c128"

int Right;
int Left;
int Up;
int Down;
int Stop;
int curr_state;
int prev_state;

void main(void) {
 
 
  EnableInterrupts;
 
   /* set port B to output */
  DDRB_BIT4 = 1;
  DDRB_BIT5 = 1;
  DDRB_BIT6 = 1;
  DDRB_BIT7 = 1;


  /* set port T to input */
  DDRT = 0x00;
  /*enable pullups on pin 0 through 3 of port T */
  PERT_PERT2 = 1;
  PERT_PERT3 = 1;
  PERT_PERT4 = 1;
  PERT_PERT5 = 1;        
 
 
  /* Turn off LED1 through LED4 */
  PORTB = 0xF0; 

  /*int sci();*/
 
  Right = 0;       //Zero counter
  Left = 0;        //Zero counter
  Up = 0;          //Zero counter
  Down = 0;        //Zero counter
  Stop = 0;
 
/**********************X-Axis**********************/
  /* loop forever */

prev_state = 0x00;
 
/*for(;;){
  curr_state = (PTT && 0xF0);
  if(curr_state == prev_state)
    Stop++;
  else if(curr_state

  curr_state = prev_state;
  */
 
for(;;) {
    curr_state = (PTT && 0xF0);
    for(;;){
      if(curr_state == prev_state)
      break;
      else if(curr_state == 0x00)
   
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }
            
if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }if(curr_state == 0x00)
    for(;;){         
        if(curr_state == 0x10) {
          Up++;
          break;
        }
        if(curr_state == 0x20) {
          Down++;
          break;
        }
        if(curr_state == 0x40) {
          Right++;
          break;
        }
        if(curr_state == 0x50) {
          Right++;
          Up++;
          break;
        }
        if(curr_state == 0x60) {
          Right++;
          Down++;
          break;
        }
        if(curr_state == 0x80) {
          Left++;
          break;
        }
        if(curr_state == 0x90) {
          Left++;
          Up++;
          break;
        }
        if(curr_state == 0xA0) {
          Left++;
          Down++;
          break;
        }
             }            


+ -

관련 글 리스트
62849 오버 사이즈의 코드를 단축 하는 방법 질문 드립니다! 이정준 689 2010/11/02
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.