Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 17-Feb-12 10:15:50 page: 1 PC Object I Line Source A 1 ; Zilog Z8 Encore! ANSI C Compiler Release 3.62 A 2 ; -nolocalcse -optsize -nofastcall -const=RAM - A 3 ; -nooptlink -noregvar -reduceopt -debug -norev A 4 ; -alias A 5 DEFINE timer_TEXT,SPACE=ROM A 6 FILE ".\TIMER.C" A 7 .debug "C" A 8 SEGMENT ROM_DATA A 9 A 10 A 11 ;**************************** _isr_timer0 ***** A 12 ;Name Addr/Register S A 13 ;_lt1 IMPORT A 14 ;_t5 IMPORT A 15 ;_t4 IMPORT A 16 ;_t3 IMPORT A 17 ;_t2 IMPORT A 18 ;_t1 IMPORT A 19 ;_subtmr IMPORT A 20 A 21 A 22 ; Aggregate Stack Size: 0 (words) A 23 A 24 A 25 .FRAME _n_isr_timer0,?_n_isr_timer0,RDATA A 26 SEGMENT timer_TEXT 000000 A 27 _isr_timer0: A 28 .define "_isr_timer0" A 29 .value _isr_timer0 A 30 .class 2 A 31 .type 65 A 32 .type 0 A 33 .endef A 34 .begfunc "isr_timer0",25,"_isr_timer0" 000000 C8FFD0 A 35 PUSHX 4093 000003 E8 000FFD A 36 LDX 4093,__intrp 000007 09100000 A 37 ADDX __intrp,#16 00000B 70EF A 38 PUSH R15 00000D 84FFFF A 39 LDX R15,4095 A 40 ; 1 /************************************** A 41 ; 2 * Copyright (C) 1999-2004 by ZiLOG, A 42 ; 3 * All Rights Reserved A 43 ; 4 ************************************** A 44 ; 5 A 45 ; 6 #include A 46 ; 7 #include "main.h" A 47 ; 8 #include "timer.h" A 48 ; 9 A 49 ; 10 extern char subtmr; A 50 ; 11 extern char t1; A 51 ; 12 extern char t2; A 52 ; 13 extern char t3; Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 17-Feb-12 10:15:50 page: 2 PC Object I Line Source timer.src A 53 ; 14 extern char t4; A 54 ; 15 extern char t5; A 55 ; 16 extern int lt1; A 56 ; 17 //extern unsigned char ircode; A 57 ; 18 //extern unsigned char oldir; A 58 ; 19 A 59 ; 20 /////////////////////////////////////// A 60 ; 21 //10 mS Interrupt routine A 61 ; 22 A 62 ; 23 #pragma interrupt A 63 ; 24 void isr_timer0(void) A 64 ; 25 { A 65 ; 26 // ircode=PCIN; // read ir A 66 ; 27 // ircode &= 0xf0; // erase un A 67 ; 28 subtmr -=1; A 68 .line 28 000010 30 00 A 69 DEC _subtmr A 70 ; 29 if(subtmr==0) A 71 .line 29 000012 A6 00 00 A 72 CP _subtmr,#0 000015 EB 2C A 73 JR NE,_1_L_11 A 74 ; 30 { A 75 ; 31 subtmr=10; A 76 .line 31 000017 E6 00 0A A 77 LD _subtmr,#10 A 78 ; 32 if(t1>0) t1 -=1; A 79 .line 32 00001A A6 00 00 A 80 CP _t1,#0 00001D 2B 02 A 81 JR LE,_1_L_2 00001F 30 00 A 82 DEC _t1 000021 A 83 _1_L_2: A 84 ; 33 if(t2>0) t2 -=1; A 85 .line 33 000021 A6 00 00 A 86 CP _t2,#0 000024 2B 02 A 87 JR LE,_1_L_4 000026 30 00 A 88 DEC _t2 000028 A 89 _1_L_4: A 90 ; 34 if(t3>0) t3 -=1; A 91 .line 34 000028 A6 00 00 A 92 CP _t3,#0 00002B 2B 02 A 93 JR LE,_1_L_6 00002D 30 00 A 94 DEC _t3 00002F A 95 _1_L_6: A 96 ; 35 if(t4>0) t4 -=1; A 97 .line 35 00002F A6 00 00 A 98 CP _t4,#0 000032 2B 02 A 99 JR LE,_1_L_8 000034 30 00 A 100 DEC _t4 000036 A 101 _1_L_8: A 102 ; 36 if(t5>0) t5 -=1; A 103 .line 36 000036 A6 00 00 A 104 CP _t5,#0 Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 17-Feb-12 10:15:50 page: 3 PC Object I Line Source timer.src 000039 2B 02 A 105 JR LE,_1_L_9 00003B 30 00 A 106 DEC _t5 00003D A 107 _1_L_9: A 108 ; 37 lt1 +=1; // long seq A 109 .line 37 00003D 06 01 01 A 110 ADD _lt1+1,#1 000040 16 00 00 A 111 ADC _lt1,#0 A 112 ; 38 } A 113 ; 39 } 000043 A 114 _1_L_11: A 115 .line 39 000043 50EF A 116 POP R15 000045 29100000 A 117 SUBX __intrp,#16 000049 D8FFD0 A 118 POPX 4093 00004C BF A 119 IRET A 120 .endfunc "isr_timer0",39,"_isr_timer0" A 121 SEGMENT ROM_DATA A 122 A 123 A 124 ;**************************** _init_timer0 **** A 125 ;Name Addr/Register S A 126 ;_SET_VECTOR IMPORT -- A 127 A 128 A 129 ; Aggregate Stack Size: 0 (words) A 130 A 131 A 132 .FRAME _n_init_timer0,?_n_init_timer0,RDATA A 133 SEGMENT timer_TEXT 00004D A 134 _init_timer0: A 135 .define "_init_timer0" A 136 .value _init_timer0 A 137 .class 2 A 138 .type 65 A 139 .type 0 A 140 .endef A 141 .begfunc "init_timer0",44,"_init_timer0" 00004D 70EF A 142 PUSH R15 00004F 84FFFF A 143 LDX R15,4095 A 144 ; 40 A 145 ; 41 /////////////////////////////////////// A 146 ; 42 //Intialize Timer-0 A 147 ; 43 void init_timer0(void) A 148 ; 44 { A 149 ; 45 SET_VECTOR(TIMER0, isr_timer0); A 150 ; 46 T0H = 0x6; // Timer High A 151 .line 46 000052 E9060F00 A 152 LDX 3840,#6 A 153 ; 47 T0L = 0xc0; // Timer Low A 154 .line 47 000056 E9C00F01 A 155 LDX 3841,#192 A 156 ; 48 T0RH = 0x06; // Reload Compare H Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 17-Feb-12 10:15:50 page: 4 PC Object I Line Source timer.src A 157 .line 48 00005A E9060F02 A 158 LDX 3842,#6 A 159 ; 49 T0RL = 0xc0; // Reload Compare L A 160 .line 49 00005E E9C00F03 A 161 LDX 3843,#192 A 162 ; 50 T0CTL = 0xE9; // Continous/Presca A 163 .line 50 000062 E9E90F07 A 164 LDX 3847,#233 A 165 ; 51 IRQ0ENH |= 0x20; // Set Interrup A 166 .line 51 000066 49200FC1 A 167 ORX 4033,#32 A 168 ; 52 IRQ0ENL &= 0xDF; // Set Interrup A 169 .line 52 00006A 59DF0FC2 A 170 ANDX 4034,#223 A 171 ; 53 } A 172 .line 53 00006E 50EF A 173 POP R15 000070 AF A 174 RET A 175 .endfunc "init_timer0",53,"_init_timer0" A 176 SEGMENT ROM_DATA A 177 A 178 A 179 ;**************************** _wait *********** A 180 ;Name Addr/Register S A 181 ;_t1 IMPORT A 182 ;wtime R15+3 A 183 A 184 A 185 ; Aggregate Stack Size: 0 (words) A 186 A 187 A 188 .FRAME _n_wait,?_n_wait,RDATA A 189 SEGMENT timer_TEXT 000071 A 190 _wait: A 191 .define "_wait" A 192 .value _wait A 193 .class 2 A 194 .type 66 A 195 .type 0 A 196 .endef A 197 .begfunc "wait",57,"_wait" A 198 .define "wtime" A 199 .class 9 A 200 .value 3 A 201 .type 3 A 202 .type 0 A 203 .endef 000071 70EF A 204 PUSH R15 000073 84FFFF A 205 LDX R15,4095 A 206 ; 54 A 207 ; 55 // Wait timer A 208 ; 56 char wait(int wtime) Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 17-Feb-12 10:15:50 page: 5 PC Object I Line Source timer.src A 209 ; 57 { A 210 ; 58 t1=wtime; // start timer A 211 .line 58 000076 C70F04 A 212 LD R0,4(R15) 000079 E4E0 00 A 213 LD _t1,R0 A 214 ; 59 while(t1>0) 00007C A 215 _3_L_13: A 216 .line 59 00007C A6 00 00 A 217 CP _t1,#0 00007F AB FB A 218 JR GT,_3_L_13 A 219 ; 60 { A 220 ; 61 // if(ircode != oldir) // if i A 221 ; 62 // { A 222 ; 63 // if(ircode >0) // and ircode i A 223 ; 64 // { A 224 ; 65 // t1=0; // abor A 225 ; 66 // oldir=ircode; // copy A 226 ; 67 // return(1); // and A 227 ; 68 // } A 228 ; 69 // } A 229 ; 70 } A 230 .line 70 A 231 ; 71 return(0); // no new i A 232 .line 71 000081 B0E0 A 233 CLR R0 A 234 ; 72 } A 235 .line 72 000083 50EF A 236 POP R15 000085 AF A 237 RET A 238 .endfunc "wait",72,"_wait" 00000C 0000 A 239 VECTOR TIMER0=_isr_timer0 A 240 XREF _lt1:RDATA A 241 XREF _t5:RDATA A 242 XREF _t4:RDATA A 243 XREF _t3:RDATA A 244 XREF _t2:RDATA A 245 XREF _t1:RDATA A 246 XREF _subtmr:RDATA A 247 XREF __intrp:RDATA A 248 XDEF _wait A 249 XDEF _init_timer0 A 250 XDEF _isr_timer0 A 251 END Errors: 0 Warnings: 0 Lines Assembled: 252