📄 main.lst
字号:
##############################################################################
# #
# IAR M16C/60 C-Compiler V1.31B/WIN #
# #
# Compile time = 18/Apr/2000 17:33:36 #
# Memory model = near #
# Source file = d:\tolentino\sw_lcd_m16c\mini_emul\main.c #
# List file = d:\tolentino\sw_lcd_m16c\mini_emul\ice\list\main.lst#
# Object file = d:\tolentino\sw_lcd_m16c\mini_emul\ice\obj\main.r34 #
# Command line = -md -OD:\tolentino\Sw_lcd_M16c\Mini_emul\ice\Obj\ #
# -e -K -C -W16 -gA -RCODE -r0 #
# -LD:\tolentino\Sw_lcd_M16c\Mini_emul\ice\List\ -q #
# -t8 -ID:\SW\EW23\M16C\inc\ #
# D:\tolentino\Sw_lcd_M16c\Mini_emul\MAIN.C #
# #
# Copyright 1999 IAR Systems. All rights reserved. #
##############################################################################
\ NAME main(16)
\ RSEG CODE(1)
\ EXTERN TIME_OFF
\ EXTERN TIME_ON
\ EXTERN init_port
\ EXTERN lcd_1
\ EXTERN lcd_10
\ EXTERN lcd_11
\ EXTERN lcd_12
\ EXTERN lcd_2
\ EXTERN lcd_3
\ EXTERN lcd_4
\ EXTERN lcd_5
\ EXTERN lcd_6
\ EXTERN lcd_7
\ EXTERN lcd_8
\ EXTERN lcd_9
\ PUBLIC main
\ EXTERN port_1_c0
\ EXTERN port_1_c1
\ EXTERN port_1_c2
\ EXTERN port_1_c3
\ EXTERN port_2_c0
\ EXTERN port_2_c1
\ EXTERN port_2_c2
\ EXTERN port_2_c3
\ EXTERN port_3_c0
\ EXTERN port_3_c1
\ EXTERN port_3_c2
\ EXTERN port_3_c3
\ EXTERN port_4_c0
\ EXTERN port_4_c1
\ EXTERN port_4_c2
\ EXTERN port_4_c3
\ EXTERN port_5_c0
\ EXTERN port_5_c1
\ EXTERN port_5_c2
\ EXTERN port_5_c3
\ EXTERN state_lcd
\ EXTERN timer_100ms
\ EXTERN timer_a0_init_timer_mode
\ EXTERN timer_a0_interrupt_set
\ EXTERN timer_a0_set
\ EXTERN timer_a0_start
\ EXTERN timer_a1_init_timer_mode
\ EXTERN timer_a1_interrupt_set
\ EXTERN timer_a1_set
\ EXTERN timer_a1_start
\ EXTERN ?CLM16C_1_31_L00
\ RSEG CODE
\ main:
1 /**************************************************************************/
2 /**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**/
3 /**************************************************************************/
4 /**************************************************************************/
5 /* DISCLAIMER: */
6 /* We (MITSUBISHI ELECTRIC B.V.) do not warrant that the Software is */
7 /* free from claims by a third party of copyright, patent, trademark, */
8 /* trade secret or any other intellectual property infringement. */
9 /* */
10 /* Under no circumstances are we liable for any of the following: */
11 /* */
12 /* 1. third-party claims against you for losses or damages; */
13 /* 2. loss of, or damage to, your records or data; or */
14 /* 3. economic consequential damages (including lost profits or */
15 /* savings) or incidental damages, even if we are informed of */
16 /* their possibility. */
17 /* */
18 /* We do not warrant uninterrupted or error free operation of the */
19 /* Software. We have no obligation to provide service, defect */
20 /* correction, or any maintenance for the Software. We have no */
21 /* obligation to supply any Software updates or enhancements to you */
22 /* even if such are or later become available. */
23 /* */
24 /* IF YOU DOWNLOAD OR USE THIS SOFTWARE YOU AGREE TO THESE TERMS. */
25 /* */
26 /* THERE ARE NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING THE */
27 /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
28 /* PARTICULAR PURPOSE. */
29 /**************************************************************************/
30 /**************************************************************************/
31 /* */
32 /* */
33 /* Name: MAIN.C */
34 /* Date : 12.02.99 */
35 /* Author: CA */
36 /* Change: */
37 /* (Date) (Author) (Description) */
38 /* */
39 /**************************************************************************/
40
41 #define public extern
42 #include <intrm16c.h>
43 #include "sfr_3061.h"
44 #include "init.h"
45 #include "timer_a.h"
46 #include "sys.h"
47 #include "general.h"
48 #undef public
49
50 // global variables
51
52 // Main routine
53
54 void main (void)
55 {
\ 000000 ECCA PUSHM SB,A0,R1,R0
\ 000002 7DBA ADD.B #-6,SP
\ 000004 EB52 PUSHC SP
\ 000006 EB63 POPC SB
56 unsigned char buf;
57 unsigned int i;
58 unsigned int ms;
59 ms = 0;
\ 000008 D90A04 MOV.W #0,4[SB]
60 // disable_interrupt();
61
62 // init I/O Ports and special function register
63
64 init_port(); // initialize Port 0 to Port 10
\ 00000B FD...... JSR.A init_port
65 // init_reg(); // initialize Special Function Register
66 // init processor mode and system clock frequency
67
68 // processor_mode_set(); // set single-chip mode
69 // system_clock_set(); // no division mode
70 nop_instruction(); // for nothing
\ 00000F 04 NOP
71
72 // initialize variables
73 timer_100ms = 0;
\ 000010 D90F.... MOV.W #0,timer_100ms
74 state_lcd = STATE_LCD_OFF;
\ 000014 D90F.... MOV.W #0,state_lcd
75 // initialize peripherals
76 timer_a0_init_timer_mode(); /* fxin/32 */
\ 000018 FD...... JSR.A timer_a0_init_timer_mode
77 timer_a0_set(16000); /* underflow after 100ms at 10MHz */
\ 00001C 75C0803E MOV.W #16000,R0
\ 000020 FD...... JSR.A timer_a0_set
78
79 timer_a0_start();
\ 000024 FD...... JSR.A timer_a0_start
80 timer_a0_interrupt_set();
\ 000028 FD...... JSR.A timer_a0_interrupt_set
81 timer_a1_init_timer_mode(); /* fxin/32 */
\ 00002C FD...... JSR.A timer_a1_init_timer_mode
82 timer_a1_set(800); /* underflow after 2ms at 10MHz */
\ 000030 75C02003 MOV.W #800,R0
\ 000034 FD...... JSR.A timer_a1_set
83 timer_a1_interrupt_set();
\ 000038 FD...... JSR.A timer_a1_interrupt_set
84 timer_a1_start();
\ 00003C FD...... JSR.A timer_a1_start
85 i=0;
\ 000040 D90A02 MOV.W #0,2[SB]
86 TIME_ON = 950;
\ 000043 75CF.... MOV.W #950,TIME_ON
\ B603
87 TIME_OFF = 600;
\ 000049 75CF.... MOV.W #600,TIME_OFF
\ 5802
88 enable_interrupt();
\ 00004F EB64 FSET I
\ ?0001:
89 // start of main loop switch polling (play, record, off)
90 // Until STATE_LCD_18 movement of the string "CONTROL LCD" is simulated.
91 // Then string "WITH" in displayed.
92 // After this the string "M16C" is flashing a few times.
93 // Then some number sequences are displayed (look case STAGE_LCD_25).
94
95 for (;;)
96 {
97
98 // 1 second over
99 if(timer_100ms>=10) // timer_100ms is incremented in timer A0 interrupt
\ 000051 778F.... CMP.W #10,timer_100ms
\ 0A00
\ 000057 6CF9 JNC ?0001
\ ?0002:
100 {
101 timer_100ms=0;
\ 000059 D90F.... MOV.W #0,timer_100ms
102 // Every second new initialisation of the digits.
103 // After a case statement ist passed "state_lcd" is incremented
104 switch(state_lcd)
\ 00005D 73F0.... MOV.W state_lcd,R0
\ 000061 77500000 SUB.W #0,R0
\ 000065 7DCE12 JLT ?0052
\ 000068 77802400 CMP.W #36,R0
\ 00006C 680C JC ?0052
\ 00006E 7304 MOV.W R0,A0
\ 000070 A100 ADD.W R0,R0
\ 000072 A104 ADD.W R0,A0
\ 000074 7D0C.... JMPI.A ?0053:20[A0]
\ ..
\ ?0052:
\ 000079 F43207 JMP.W ?0047
\ ?0005:
105 {
106 case STATE_LCD_OFF: // -------- all digits are off
107 lcd_1 = LCD_OFF;
\ 00007C D90F.... MOV.W #0,lcd_1
108 lcd_2 = LCD_OFF;
\ 000080 D90F.... MOV.W #0,lcd_2
109 lcd_3 = LCD_OFF;
\ 000084 D90F.... MOV.W #0,lcd_3
110 lcd_4 = LCD_OFF;
\ 000088 D90F.... MOV.W #0,lcd_4
111 lcd_5 = LCD_OFF;
\ 00008C D90F.... MOV.W #0,lcd_5
112 lcd_6 = LCD_OFF;
\ 000090 D90F.... MOV.W #0,lcd_6
113 lcd_7 = LCD_OFF;
\ 000094 D90F.... MOV.W #0,lcd_7
114 lcd_8 = LCD_OFF;
\ 000098 D90F.... MOV.W #0,lcd_8
115 state_lcd = STATE_LCD_1; // next sequence-state is initialised
\ 00009C D91F.... MOV.W #1,state_lcd
116 break;
\ 0000A0 F40F07 JMP.W ?0004
\ ?0006:
117 case STATE_LCD_1: // -------C is displayed
118 lcd_1 = LCD_OFF;
\ 0000A3 D90F.... MOV.W #0,lcd_1
119 lcd_2 = LCD_OFF;
\ 0000A7 D90F.... MOV.W #0,lcd_2
120 lcd_3 = LCD_OFF;
\ 0000AB D90F.... MOV.W #0,lcd_3
121 lcd_4 = LCD_OFF;
\ 0000AF D90F.... MOV.W #0,lcd_4
122 lcd_5 = LCD_OFF;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -