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

📄 utility.lst

📁 基于摩托罗拉S12标准源程序 包括:SCIO,Timer
💻 LST
📖 第 1 页 / 共 5 页
字号:
  0019 cb30         ADDB  #48
  001b 0700         BSR   tx_char0
  201:  }
  001d 32           PULA  
  001e 3d           RTS   
  202:  
  203:  
  204:  /*******************************************************************
  205:  * Wait for receiving char subroutine
  206:  * Description : Waiting for rx char
  207:  *			  :
  208:  * Example     : N/A  
  209:  * Input 	  : N/A
  210:  * Output	  : N/A
  211:  * Modify      : N/A
  212:  * Return      : char
  213:  ********************************************************************/ 
  214:  byte rx_char0()
  215:  {

Function: rx_char0
Source  : D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources\utility.c
Options : -Env"GENPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\cmd;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\prm;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\LIB;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\SRC;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"LIBPATH=D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Env"TEXTPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Lasm=%n.lst -ObjN="D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\S12_Ex4_Portb_ICD_Data\Flash_Application\ObjectCode\utility.c.o" -Ol0

  216:  	char data;
  217:  	
  218:  	while( (SC0SR1 & 0x20)==0);
  0000 4fcc20fc     BRCLR 204,#32,*+0 ;abs = 0000
  219:      data = SC0SR1;
  0004 d6cc         LDAB  204
  220:  	return(SC0DRL);
  0006 d6cf         LDAB  207
  221:  }
  0008 3d           RTS   
  222:  
  223:  /*******************************************************************
  224:  * Wait for receiving char subroutine
  225:  * Description : Waiting for rx char and display page information
  226:  *			  :
  227:  * Example     : N/A  
  228:  * Input 	  : menu_page
  229:  * Output	  : N/A
  230:  * Modify      : N/A
  231:  * Return      : char
  232:  ********************************************************************/ 
  233:  byte menurx_char0(char menu_page)
  234:  { 

Function: menurx_char0
Source  : D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources\utility.c
Options : -Env"GENPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\cmd;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\prm;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\LIB;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\SRC;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"LIBPATH=D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Env"TEXTPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Lasm=%n.lst -ObjN="D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\S12_Ex4_Portb_ICD_Data\Flash_Application\ObjectCode\utility.c.o" -Ol0

  0000 37           PSHB  
  235:  	char data;
  236:  	
  237:  	while( (SC0SR1 & 0x20)==0)
  0001 2007         BRA   *+9 ;abs = 000a
  238:  	{
  239:  	  delay1();
  0003 0700         BSR   delay1
  240:  	  disp_info(menu_page);		//display corresponding menu info 
  0005 e680         LDAB  0,SP
  0007 160000       JSR   disp_info
  000a 4fcc20f5     BRCLR 204,#32,*-7 ;abs = 0003
  241:  	} 
  242:  	data = SC0SR1;
  000e d6cc         LDAB  204
  243:  	return(SC0DRL);
  0010 d6cf         LDAB  207
  244:  }
  0012 32           PULA  
  0013 3d           RTS   
  245:  
  246:  /*******************************************************************
  247:  * Check user abort data display subroutine
  248:  * Description : Checking whether user abort or not
  249:  *			  :
  250:  * Example     : N/A  
  251:  * Input 	  : SC0SR1 empty?
  252:  * Output	  : 3 2 (ascii)
  253:  * Modify      : N/A
  254:  * Return      : status [OK for (DOT or ESC) or NOTOK for others chars]
  255:  ********************************************************************/ 
  256:  byte check_user_abort()
  257:  {

Function: check_user_abort
Source  : D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources\utility.c
Options : -Env"GENPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\cmd;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\prm;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\LIB;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\SRC;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"LIBPATH=D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Env"TEXTPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Lasm=%n.lst -ObjN="D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\S12_Ex4_Portb_ICD_Data\Flash_Application\ObjectCode\utility.c.o" -Ol0

  258:  	char data;
  259:  	
  260:  	if((SC0SR1 & 0x20)!=0)
  0000 4fcc200d     BRCLR 204,#32,*+17 ;abs = 0011
  261:      {
  262:         data=SC0DRL;
  0004 d6cf         LDAB  207
  263:         if(data==DOT||data==ESC)
  0006 c12e         CMPB  #46
  0008 2704         BEQ   *+6 ;abs = 000e
  000a c11b         CMPB  #27
  000c 2603         BNE   *+5 ;abs = 0011
  264:           return(OK);
  000e c601         LDAB  #1
  0010 3d           RTS   
  265:         else 
  266:           return(NOTOK);  
  267:      }
  268:      else
  269:        return(NOTOK);
  0011 c7           CLRB  
  270:  }
  0012 3d           RTS   
  271:  
  272:  /*******************************************************************
  273:  * Transmit out 1 char (ASCII) subroutine
  274:  * Description : Transmit out upper and lower 4 bit of char as ascii
  275:  *             : via RS232
  276:  *			  :
  277:  * Example     : 0x32  
  278:  * Input 	  : 0x32 (cdata)
  279:  * Output	  : 3 2 (ascii)
  280:  * Modify      : N/A
  281:  * Return      : void
  282:  ********************************************************************/ 
  283:  void send_asc(byte cdata)
  284:  {

Function: send_asc
Source  : D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources\utility.c
Options : -Env"GENPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\cmd;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\prm;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\LIB;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\SRC;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"LIBPATH=D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Env"TEXTPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Lasm=%n.lst -ObjN="D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\S12_Ex4_Portb_ICD_Data\Flash_Application\ObjectCode\utility.c.o" -Ol0

  285:  	if(cdata>9)
  0000 c109         CMPB  #9
  0002 2303         BLS   *+5 ;abs = 0007
  286:  	  tx_char0(cdata+'0'+7);
  0004 cb37         ADDB  #55
  0006 8f           SKIP2 
  287:  	else
  288:  	  tx_char0(cdata+'0');	  	
  0007 cb30         ADDB  #48
  0009 060000       JMP   tx_char0
  289:  }
  290:  
  291:  /*******************************************************************
  292:  * Convert HEX to ASCII subroutine
  293:  * Description : Convert hex to ascii and send out via RS232
  294:  *			  :
  295:  * Example     : 0x32  
  296:  * Input 	  : 0x32 (cdata)
  297:  * Output	  : 3 2 (ascii)
  298:  * Modify      : N/A
  299:  * Return      : void
  300:  ********************************************************************/ 
  301:  void hex_asc(byte cdata)
  302:  {

Function: hex_asc
Source  : D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources\utility.c
Options : -Env"GENPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\cmd;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\prm;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\LIB;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\SRC;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"LIBPATH=D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Env"TEXTPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Lasm=%n.lst -ObjN="D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\S12_Ex4_Portb_ICD_Data\Flash_Application\ObjectCode\utility.c.o" -Ol0

  0000 37           PSHB  
  303:  	send_asc((cdata>>4)&0x0f);
  0001 54           LSRB  
  0002 54           LSRB  
  0003 54           LSRB  
  0004 54           LSRB  
  0005 0700         BSR   send_asc
  304:  	send_asc((cdata)&0x0f);	
  0007 e680         LDAB  0,SP
  0009 c40f         ANDB  #15
  000b 0700         BSR   send_asc
  305:  }
  000d 32           PULA  
  000e 3d           RTS   
  306:  
  307:  /*******************************************************************
  308:  * Convert HEX to ASCII with additional spaces subroutine
  309:  * Description : Convert hex to ascii and send out spaces followed
  310:  *             : via RS232
  311:  *			  :
  312:  * Example     : 0x32  
  313:  * Input 	  : 0x32 (cdata), 3(space)
  314:  * Output	  : 3 2 _ _ _ (ascii)
  315:  * Modify      : N/A
  316:  * Return      : void
  317:  ********************************************************************/ 
  318:  void hex_asc_sp(byte cdata, byte space)
  319:  {

Function: hex_asc_sp
Source  : D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources\utility.c
Options : -Env"GENPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\cmd;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\prm;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\LIB;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\SRC;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"LIBPATH=D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Env"TEXTPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Lasm=%n.lst -ObjN="D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\S12_Ex4_Portb_ICD_Data\Flash_Application\ObjectCode\utility.c.o" -Ol0

  0000 3b           PSHD  
  0001 37           PSHB  
  320:  	int	i;
  321:  	
  322:  	hex_asc(cdata);
  0002 e685         LDAB  5,SP
  0004 0700         BSR   hex_asc
  323:  	for (i=0;i<space;i++)
  0006 c7           CLRB  
  0007 87           CLRA  
  0008 6c81         STD   1,SP
  000a 200a         BRA   *+12 ;abs = 0016
  324:  		tx_char0(' ');
  000c c620         LDAB  #32
  000e 160000       JSR   tx_char0
  0011 ee81         LDX   1,SP
  0013 08           INX   
  0014 6e81         STX   1,SP
  0016 e680         LDAB  0,SP
  0018 87           CLRA  
  0019 ac81         CPD   1,SP
  001b 2eef         BGT   *-15 ;abs = 000c
  325:  }
  001d 1b83         LEAS  3,SP
  001f 3d           RTS   
  326:  
  327:  /*******************************************************************
  328:  * Input int (dec) subroutine
  329:  * Description : Get the data(word) from user   
  330:  *             :   
  331:  *			  :
  332:  * Example     : N/A 
  333:  * Input 	  : N/A
  334:  * Output	  : *i_ptr
  335:  * Modify      : N/A
  336:  * Return      : status [OK for ('0'-'z') or NOTOK for others chars]
  337:  *********************************************************************/ 
  338:  byte input_int(unsigned int *i_ptr) //3046
  339:  {

Function: input_int
Source  : D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources\utility.c
Options : -Env"GENPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\cmd;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\prm;D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\sources;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\LIB;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\SRC;D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"LIBPATH=D:\Metrowerks\CodeWarrior CW12_V2.0\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Env"TEXTPATH=D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\bin" -Lasm=%n.lst -ObjN="D:\Code S12\Utility\S12DP256\S12 Ex4 Portb ICD\S12_Ex4_Portb_ICD_Data\Flash_Application\ObjectCode\utility.c.o" -Ol0

  0000 1b92         LEAS  -14,SP
  0002 3b           PSHD  
  340:  	byte		echo,cdata,loop=ENABLE;	
  0003 c601         LDAB  #1
  0005 6b8d         STAB  13,SP
  341:  	int			count=0,i,j;
  0007 c7           CLRB  
  0008 87           CLRA  
  0009 6c84         STD   4,SP
  342:  	unsigned int	i_data,i_data1,i_data2;
  343:  	
  344:  	
  345:  	i_data=0;
  000b 6c82         STD   2,SP
  346:  	*i_ptr=0;
  000d ee80         LDX   0,SP
  000f 6c00         STD   0,X
  347:  	
  348:  	while(loop == ENABLE)
  349:  	{
  350:  	  echo=rx_char0();
  0011 0700         BSR   rx_char0
  0013 6b88         STAB  8,SP
  351:  	  if((echo==ESC)||(echo==DOT)||(echo==CR)) 
  0015 c11b         CMPB  #27
  0017 2708         BEQ   *+10 ;abs = 0021
  0019 c12e         CMPB  #46
  001b 2704         BEQ   *+6 ;abs = 0021
  001d c10d         CMPB  #13
  001f 2602         BNE   *+4 ;abs = 0023
  352:  	    loop = DISABLE;			//break the while loop		
  0021 698d         CLR   13,SP
  353:        if (echo==BS || echo==DEL)
  0023 c108         CMPB  #8
  0025 2704         BEQ   *+6 ;abs = 002b
  0027 c17f         CMPB  #127
  0029 2620         BNE   *+34 ;abs = 004b
  354:        {
  355:         	if(count>0) 			//del 4 bit data in buffer
  002b ec84         LDD   4,SP
  002d 2f1c         BLE   *+30 ;abs = 004b
  356:         	{
  357:         	  count--;
  002f 830001       SUBD  #1
  0032 6c84         STD   4,SP
  358:         	  i_data=i_data>>4;
  0034 ec82         LDD   2,SP
  0036 49           LSRD  
  0037 49           LSRD  
  0038 49           LSRD  
  0039 49           LSRD  
  003a 6c82         STD   2,SP
  359:  	      tx_char0(echo);		//send bs the char on screen
  003c e688         LDAB  8,SP
  003e 160000       JSR   tx_char0
  360:  	      tx_char0(' ');		//send space to clear the char
  0041 c620         LDAB  #32
  0043 160000       JSR   tx_char0
  361:  	      tx_char0(echo);		//send bs again to move back the cursor
  0046 e688         LDAB  8,SP
  0048 160000       JSR   tx_char0
  362:  	    }
  363:        }
  364:        if (count<4)				//update 4 bit data to buffer

⌨️ 快捷键说明

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