Zilog Z8 Encore! Macro Assembler Version 2.50 (08031703) 13-Oct-08 14:30:23 page: 1 PC Object I Line Source A 1 ; Zilog Z8 Encore! ANSI C Compiler Release 3.60 A 2 ; -nofastcall -const=RAM -model=L -nooptlink -regvar A 3 ; -noreduceopt -debug -revaa -peephole -localcse -optsize 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 Size Type A 13 ;_lt1 IMPORT 1 variable A 14 ;_t5 IMPORT 0 variable A 15 ;_t4 IMPORT 0 variable A 16 ;_t3 IMPORT 0 variable A 17 ;_t2 IMPORT 0 variable A 18 ;_t1 IMPORT 0 variable A 19 ;_subtmr IMPORT 0 variable A 20 ;_ircode IMPORT 0 variable A 21 A 22 A 23 ; Aggregate Stack Size: 0 (words) A 24 A 25 A 26 .FRAME _n_isr_timer0,?_n_isr_timer0,RDATA A 27 .FRAME _f_isr_timer0,?_f_isr_timer0,EDATA A 28 SEGMENT timer_TEXT 000000 A 29 _isr_timer0: A 30 .define "_isr_timer0" A 31 .value _isr_timer0 A 32 .class 2 A 33 .type 65 A 34 .type 0 A 35 .endef A 36 .begfunc "isr_timer0",25,"_isr_timer0" A 37 ; 1 /************************************************* A 38 ; 2 * Copyright (C) 1999-2004 by ZiLOG, Inc. A 39 ; 3 * All Rights Reserved A 40 ; 4 *************************************************/ A 41 ; 5 A 42 ; 6 #include A 43 ; 7 #include "main.h" A 44 ; 8 #include "timer.h" A 45 ; 9 A 46 ; 10 extern char subtmr; A 47 ; 11 extern char t1; A 48 ; 12 extern char t2; A 49 ; 13 extern char t3; A 50 ; 14 extern char t4; A 51 ; 15 extern char t5; A 52 ; 16 extern int lt1; Zilog Z8 Encore! Macro Assembler Version 2.50 (08031703) 13-Oct-08 14:30:23 page: 2 PC Object I Line Source timer.src A 53 ; 17 extern unsigned char ircode; A 54 ; 18 extern unsigned char oldir; A 55 ; 19 A 56 ; 20 ////////////////////////////////////////////////////////// A 57 ; 21 //10 mS Interrupt routine A 58 ; 22 A 59 ; 23 #pragma interrupt A 60 ; 24 void isr_timer0(void) A 61 ; 25 { A 62 ; 26 ircode=PCIN; // read ir input A 63 .line 26 000000 E8FDA000 A 64 LDX _ircode,4058 A 65 ; 27 ircode &= 0xf0; // erase unused bits A 66 .line 27 000004 59F00000 A 67 ANDX _ircode,#240 A 68 ; 28 subtmr -=1; A 69 .line 28 000008 09FF0000 A 70 ADDX _subtmr,#-1 A 71 ; 29 if(subtmr==0) A 72 .line 29 00000C A9000000 A 73 CPX _subtmr,#-0 000010 EB 3E A 74 JR NE,_1_L_11 A 75 ; 30 { A 76 ; 31 subtmr=10; A 77 .line 31 000012 E90A0000 A 78 LDX _subtmr,#10 A 79 ; 32 if(t1>0) t1 -=1; A 80 .line 32 000016 A9000000 A 81 CPX _t1,#-0 00001A 2B 04 A 82 JR LE,_1_L_2 00001C 09FF0000 A 83 ADDX _t1,#-1 000020 A 84 _1_L_2: A 85 ; 33 if(t2>0) t2 -=1; A 86 .line 33 000020 A9000000 A 87 CPX _t2,#-0 000024 2B 04 A 88 JR LE,_1_L_4 000026 09FF0000 A 89 ADDX _t2,#-1 00002A A 90 _1_L_4: A 91 ; 34 if(t3>0) t3 -=1; A 92 .line 34 00002A A9000000 A 93 CPX _t3,#-0 00002E 2B 04 A 94 JR LE,_1_L_6 000030 09FF0000 A 95 ADDX _t3,#-1 000034 A 96 _1_L_6: A 97 ; 35 if(t4>0) t4 -=1; A 98 .line 35 000034 A9000000 A 99 CPX _t4,#-0 000038 2B 04 A 100 JR LE,_1_L_8 00003A 09FF0000 A 101 ADDX _t4,#-1 00003E A 102 _1_L_8: A 103 ; 36 if(t5>0) t5 -=1; A 104 .line 36 Zilog Z8 Encore! Macro Assembler Version 2.50 (08031703) 13-Oct-08 14:30:23 page: 3 PC Object I Line Source timer.src 00003E A9000000 A 105 CPX _t5,#-0 000042 2B 04 A 106 JR LE,_1_L_9 000044 09FF0000 A 107 ADDX _t5,#-1 000048 A 108 _1_L_9: A 109 ; 37 lt1 +=1; // long sequence timer A 110 .line 37 000048 09010001 A 111 ADDX _lt1+1,#1 00004C 19000000 A 112 ADCX _lt1,#-0 A 113 ; 38 } A 114 ; 39 } 000050 A 115 _1_L_11: A 116 .line 39 000050 BF A 117 IRET A 118 .endfunc "isr_timer0",39,"_isr_timer0" A 119 SEGMENT ROM_DATA A 120 A 121 A 122 ;**************************** _init_timer0 *************************** A 123 ;Name Addr/Register Size Type A 124 ;_SET_VECTOR IMPORT ----- function A 125 A 126 A 127 ; Aggregate Stack Size: 0 (words) A 128 A 129 A 130 .FRAME _n_init_timer0,?_n_init_timer0,RDATA A 131 .FRAME _f_init_timer0,?_f_init_timer0,EDATA A 132 SEGMENT timer_TEXT 000051 A 133 _init_timer0: A 134 .define "_init_timer0" A 135 .value _init_timer0 A 136 .class 2 A 137 .type 65 A 138 .type 0 A 139 .endef A 140 .begfunc "init_timer0",44,"_init_timer0" A 141 ; 40 A 142 ; 41 ////////////////////////////////////////////////////////// A 143 ; 42 //Intialize Timer-0 A 144 ; 43 void init_timer0(void) A 145 ; 44 { A 146 ; 45 SET_VECTOR(TIMER0, isr_timer0); A 147 ; 46 T0H = 0x6; // Timer High A 148 .line 46 000051 E9060F00 A 149 LDX 3840,#6 A 150 ; 47 T0L = 0xc0; // Timer Low A 151 .line 47 000055 E9C00F01 A 152 LDX 3841,#192 A 153 ; 48 T0RH = 0x06; // Reload Compare High A 154 .line 48 000059 E9060F02 A 155 LDX 3842,#6 A 156 ; 49 T0RL = 0xc0; // Reload Compare Low 10mS interval Zilog Z8 Encore! Macro Assembler Version 2.50 (08031703) 13-Oct-08 14:30:23 page: 4 PC Object I Line Source timer.src A 157 .line 49 00005D E9C00F03 A 158 LDX 3843,#192 A 159 ; 50 T0CTL = 0xE9; // Continous/Prescale A 160 .line 50 000061 E9E90F07 A 161 LDX 3847,#233 A 162 ; 51 IRQ0ENH |= 0x20; // Set Interrupt Priority Nominal A 163 .line 51 000065 49200FC1 A 164 ORX 4033,#32 A 165 ; 52 IRQ0ENL &= 0xDF; // Set Interrupt Priority Nominal A 166 .line 52 000069 59DF0FC2 A 167 ANDX 4034,#223 A 168 ; 53 } A 169 .line 53 00006D AF A 170 RET A 171 .endfunc "init_timer0",53,"_init_timer0" A 172 SEGMENT ROM_DATA A 173 A 174 A 175 ;**************************** _wait *************************** A 176 ;Name Addr/Register Size Type A 177 ;_oldir IMPORT 0 variable A 178 ;_ircode IMPORT 0 variable A 179 ;_t1 IMPORT 0 variable A 180 ;wtime R15+4 1 parameter A 181 A 182 A 183 ; Aggregate Stack Size: 0 (words) A 184 A 185 A 186 .FRAME _n_wait,?_n_wait,RDATA A 187 .FRAME _f_wait,?_f_wait,EDATA A 188 SEGMENT timer_TEXT 00006E A 189 _wait: A 190 .define "_wait" A 191 .value _wait A 192 .class 2 A 193 .type 66 A 194 .type 0 A 195 .endef A 196 .begfunc "wait",57,"_wait" A 197 .define "wtime" A 198 .class 9 A 199 .value 4 A 200 .type 3 A 201 .type 0 A 202 .endef 00006E D6 0000 A 203 CALL __b_frameset00 A 204 ; 54 A 205 ; 55 // Wait timer A 206 ; 56 char wait(int wtime) A 207 ; 57 { A 208 ; 58 t1=wtime; // start timer Zilog Z8 Encore! Macro Assembler Version 2.50 (08031703) 13-Oct-08 14:30:23 page: 5 PC Object I Line Source timer.src A 209 .line 58 000071 880E05 A 210 LDX R0,5(RR14) 000074 940000 A 211 LDX _t1,R0 A 212 ; 59 while(t1>0) A 213 .line 59 000077 8B 18 A 214 JR _3_L_15 000079 A 215 _3_L_16: A 216 ; 60 { A 217 ; 61 if(ircode != oldir) // if ir input not sero A 218 .line 61 000079 A8 000000 A 219 CPX _ircode,_oldir 00007D 6B 12 A 220 JR Z,_3_L_15 A 221 ; 62 { A 222 ; 63 if(ircode >0) // and ircode is new A 223 .line 63 00007F A9000000 A 224 CPX _ircode,#-0 000083 3B 0C A 225 JR ULE,_3_L_15 A 226 ; 64 { A 227 ; 65 t1=0; // abort wait A 228 .line 65 000085 E9000000 A 229 LDX _t1,#-0 A 230 ; 66 oldir=ircode; // copy new ir code to old A 231 .line 66 000089 E8 000000 A 232 LDX _oldir,_ircode A 233 ; 67 return(1); // and indicate new ircode A 234 .line 67 00008D 0C01 A 235 LD R0,#1 00008F 8B 0A A 236 JR _3_L_18 A 237 ; 68 } A 238 ; 69 } A 239 ; 70 } 000091 A 240 _3_L_15: A 241 .line 70 A 242 .line 59 000091 880E05 A 243 LDX R0,5(RR14) 000094 A6E000 A 244 CP R0,#0 000097 AB E0 A 245 JR GT,_3_L_16 A 246 ; 71 return(0); // no new ir code A 247 .line 71 000099 B0E0 A 248 CLR R0 A 249 ; 72 } 00009B A 250 _3_L_18: A 251 .line 72 00009B D6 0000 A 252 CALL __b_framereset 00009E AF A 253 RET A 254 .endfunc "wait",72,"_wait" 00000C 0000 A 255 VECTOR TIMER0=_isr_timer0 A 256 XREF _oldir:EDATA A 257 XREF _ircode:EDATA A 258 XREF _lt1:EDATA A 259 XREF _t5:EDATA A 260 XREF _t4:EDATA Zilog Z8 Encore! Macro Assembler Version 2.50 (08031703) 13-Oct-08 14:30:23 page: 6 PC Object I Line Source timer.src A 261 XREF _t3:EDATA A 262 XREF _t2:EDATA A 263 XREF _t1:EDATA A 264 XREF _subtmr:EDATA A 265 XREF __b_framereset:ROM A 266 XREF __b_frameset00:ROM A 267 XDEF _wait A 268 XDEF _init_timer0 A 269 XDEF _isr_timer0 A 270 END Errors: 0 Warnings: 0 Lines Assembled: 271