Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 07-Jul-12 11:11:18 page: 1 PC Object I Line Source A 1 ; Zilog Z8 Encore! ANSI C Compiler Release 3.62 A 2 ; -nolocalcse -optsize -fastcall -const=RAM -mo A 3 ; -nooptlink -regvar -reduceopt -debug -norevaa A 4 ; -alias A 5 DEFINE project_TEXT,SPACE=ROM A 6 FILE "..\PROJECT.C" A 7 .debug "C" A 8 SEGMENT NEAR_BSS 000000 A 9 _byte: 000000 A 10 DS 1 A 11 .define "byte" A 12 .alias "_byte" A 13 .class 147 A 14 .value _byte A 15 .type 12 A 16 .type 0 A 17 .endef 000001 A 18 _counter: 000001 A 19 DS 1 A 20 .define "counter" A 21 .alias "_counter" A 22 .class 147 A 23 .value _counter A 24 .type 12 A 25 .type 0 A 26 .endef 000002 A 27 _n: 000002 A 28 DS 1 A 29 .define "n" A 30 .alias "_n" A 31 .class 147 A 32 .value _n A 33 .type 12 A 34 .type 0 A 35 .endef 000003 A 36 _x: 000003 A 37 DS 4*1 A 38 .define "x" A 39 .alias "_x" A 40 .class 147 A 41 .value _x A 42 .type 5 A 43 .type 0 A 44 .endef A 45 SEGMENT NEAR_DATA 000000 A 46 _Num: 000000 BF A 47 DB 191 000001 06 A 48 DB 6 000002 DB A 49 DB 219 000003 4F A 50 DB 79 000004 E6 A 51 DB 230 000005 6D A 52 DB 109 Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 07-Jul-12 11:11:18 page: 2 PC Object I Line Source project.src 000006 FD A 53 DB 253 000007 07 A 54 DB 7 000008 FF A 55 DB 255 000009 67 A 56 DB 103 A 57 .define "Num" A 58 .alias "_Num" A 59 .class 133 A 60 .value _Num A 61 .dim 10 A 62 .type 98 A 63 .type 0 A 64 .endef A 65 SEGMENT ROM_DATA A 66 A 67 A 68 ;**************************** _clock ********** A 69 ;Name Addr/Register S A 70 A 71 A 72 ; Aggregate Stack Size: 0 (words) A 73 A 74 A 75 .FRAME _n_clock,?_n_clock,RDATA A 76 SEGMENT project_TEXT 000000 A 77 _clock: A 78 .define "_clock" A 79 .value _clock A 80 .class 2 A 81 .type 65 A 82 .type 0 A 83 .endef A 84 .begfunc "clock",15,"_clock" 000000 70EF A 85 PUSH R15 000002 84FFFF A 86 LDX R15,4095 A 87 ; 1 #include A 88 ; 2 A 89 ; 3 near unsigned char byte; A 90 ; 4 near unsigned char counter; A 91 ; 5 near unsigned char n; A 92 ; 6 long x; A 93 ; 7 A 94 ; 8 #define DAT 0x01; A 95 ; 9 #define STR 0x02; A 96 ; 10 #define CLK 0x04; A 97 ; 11 A 98 ; 12 char Num[10] = {0xBF, 0x06, 0xDB, 0x4F, A 99 ; 13 A 100 ; 14 void clock(void) A 101 ; 15 { A 102 ; 16 PCOUT &= ~CLK; A 103 .line 16 000005 59FB0FDB A 104 ANDX 4059,#-5 Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 07-Jul-12 11:11:18 page: 3 PC Object I Line Source project.src A 105 ; 17 PCOUT |= CLK; A 106 .line 17 000009 49040FDB A 107 ORX 4059,#4 A 108 ; 18 } A 109 .line 18 00000D 50EF A 110 POP R15 00000F AF A 111 RET A 112 .endfunc "clock",18,"_clock" A 113 SEGMENT ROM_DATA A 114 A 115 A 116 ;**************************** _strobe ********* A 117 ;Name Addr/Register S A 118 A 119 A 120 ; Aggregate Stack Size: 0 (words) A 121 A 122 A 123 .FRAME _n_strobe,?_n_strobe,RDATA A 124 SEGMENT project_TEXT 000010 A 125 _strobe: A 126 .define "_strobe" A 127 .value _strobe A 128 .class 2 A 129 .type 65 A 130 .type 0 A 131 .endef A 132 .begfunc "strobe",21,"_strobe" 000010 70EF A 133 PUSH R15 000012 84FFFF A 134 LDX R15,4095 A 135 ; 19 A 136 ; 20 void strobe(void) A 137 ; 21 { A 138 ; 22 PCOUT &= ~STR; A 139 .line 22 000015 59FD0FDB A 140 ANDX 4059,#-3 A 141 ; 23 PCOUT |= STR; A 142 .line 23 000019 49020FDB A 143 ORX 4059,#2 A 144 ; 24 } A 145 .line 24 00001D 50EF A 146 POP R15 00001F AF A 147 RET A 148 .endfunc "strobe",24,"_strobe" A 149 SEGMENT ROM_DATA A 150 A 151 A 152 ;**************************** _out_LEDs ******* A 153 ;Name Addr/Register S A 154 A 155 A 156 ; Aggregate Stack Size: 0 (words) Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 07-Jul-12 11:11:18 page: 4 PC Object I Line Source project.src A 157 A 158 A 159 .FRAME _n_out_LEDs,?_n_out_LEDs,RDATA A 160 .FCALL _n_clock A 161 .FCALL _n_strobe A 162 SEGMENT project_TEXT 000020 A 163 _out_LEDs: A 164 .define "_out_LEDs" A 165 .value _out_LEDs A 166 .class 2 A 167 .type 65 A 168 .type 0 A 169 .endef A 170 .begfunc "out_LEDs",27,"_out_LEDs" 000020 70EF A 171 PUSH R15 000022 84FFFF A 172 LDX R15,4095 A 173 ; 25 A 174 ; 26 void out_LEDs() A 175 ; 27 { A 176 ; 28 asm("ld _counter,#8"); // mag A 177 .line 28 000025 E6 01 08 A 178 ld _counter,#8 A 179 ; 29 asm("back:"); A 180 .line 29 000028 A 181 back: A 182 ; 30 PCOUT &= ~DAT; A 183 .line 30 000028 59FE0FDB A 184 ANDX 4059,#-2 A 185 ; 31 asm("rrc _byte"); A 186 .line 31 00002C C0 00 A 187 rrc _byte A 188 ; 32 asm("jr nc,clkin"); A 189 .line 32 00002E FB 04 A 190 jr nc,clkin A 191 ; 33 PCOUT |= DAT; A 192 .line 33 000030 49010FDB A 193 ORX 4059,#1 A 194 ; 34 asm("clkin:"); A 195 .line 34 000034 A 196 clkin: A 197 ; 35 clock(); A 198 .line 35 000034 D6 0000 A 199 CALL _clock A 200 ; 36 asm("dec _counter"); A 201 .line 36 000037 30 01 A 202 dec _counter A 203 ; 37 asm("jr nz,back"); A 204 .line 37 000039 EB ED A 205 jr nz,back A 206 ; 38 strobe(); A 207 .line 38 00003B D6 0010 A 208 CALL _strobe Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 07-Jul-12 11:11:18 page: 5 PC Object I Line Source project.src A 209 ; 39 } A 210 .line 39 00003E 50EF A 211 POP R15 000040 AF A 212 RET A 213 .endfunc "out_LEDs",39,"_out_LEDs" A 214 SEGMENT ROM_DATA A 215 A 216 A 217 ;**************************** _init_gpio ****** A 218 ;Name Addr/Register S A 219 A 220 A 221 ; Aggregate Stack Size: 0 (words) A 222 A 223 A 224 .FRAME _n_init_gpio,?_n_init_gpio,RDATA A 225 SEGMENT project_TEXT 000041 A 226 _init_gpio: A 227 .define "_init_gpio" A 228 .value _init_gpio A 229 .class 2 A 230 .type 65 A 231 .type 0 A 232 .endef A 233 .begfunc "init_gpio",42,"_init_gpio" 000041 70EF A 234 PUSH R15 000043 84FFFF A 235 LDX R15,4095 A 236 ; 40 A 237 ; 41 void init_gpio(void) A 238 ; 42 { A 239 ; 43 PCDD = 0x00; A 240 .line 43 000046 E9010FD8 A 241 LDX 4056,#1 00004A E9000FD9 A 242 LDX 4057,#-0 A 243 ; 44 PCOUT = 0xFF; A 244 .line 44 00004E E9FF0FDB A 245 LDX 4059,#255 A 246 ; 45 } A 247 .line 45 000052 50EF A 248 POP R15 000054 AF A 249 RET A 250 .endfunc "init_gpio",45,"_init_gpio" A 251 SEGMENT ROM_DATA A 252 A 253 A 254 ;**************************** _main *********** A 255 ;Name Addr/Register S A 256 ;_x STATIC A 257 ;_byte STATIC A 258 ;_n STATIC A 259 ;_Num STATIC A 260 ;_DI IMPORT -- Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 07-Jul-12 11:11:18 page: 6 PC Object I Line Source project.src A 261 A 262 A 263 ; Aggregate Stack Size: 0 (words) A 264 A 265 A 266 .FRAME _n_main,?_n_main,RDATA A 267 .FCALL _n_init_gpio A 268 .FCALL _n_out_LEDs A 269 SEGMENT project_TEXT 000055 A 270 _main: A 271 .define "_main" A 272 .value _main A 273 .class 2 A 274 .type 65 A 275 .type 0 A 276 .endef A 277 .begfunc "main",48,"_main" 000055 70EF A 278 PUSH R15 000057 84FFFF A 279 LDX R15,4095 A 280 ; 46 A 281 ; 47 void main(void) A 282 ; 48 { A 283 ; 49 DI(); A 284 .line 49 00005A 8F A 285 DI A 286 ; 50 init_gpio(); A 287 .line 50 00005B D6 0041 A 288 CALL _init_gpio A 289 ; 51 back: A 290 .line 51 00005E A 291 _5_L_4: A 292 ; 52 byte = Num[n]; A 293 .line 52 00005E 0C 00 A 294 LD R0,#_Num 000060 04 02 E0 A 295 ADD R0,_n 000063 E5E0 00 A 296 LD _byte,@R0 A 297 ; 53 out_LEDs(); A 298 .line 53 000066 D6 0020 A 299 CALL _out_LEDs 000069 8B 13 A 300 JR _5_L_6 A 301 ; 54 for(x=0; x<142000; x++){} //a 00006B A 302 _5_L_7: A 303 .line 54 00006B A6 06 B0 A 304 CP _x+3,#176 00006E 1FA6 05 2A A 305 CPC _x+2,#42 000072 1FA6 04 02 A 306 CPC _x+1,#2 000076 1FA6 03 00 A 307 CPC _x,#-0 00007A 1B 0C A 308 JR LT,_5_L_9 00007C 8B 18 A 309 JR _5_L_11 00007E A 310 _5_L_6: 00007E B0 03 A 311 CLR _x 000080 B0 04 A 312 CLR _x+1 Zilog Z8 Encore! Macro Assembler Version 2.52 (10101401) 07-Jul-12 11:11:18 page: 7 PC Object I Line Source project.src 000082 B0 05 A 313 CLR _x+2 000084 B0 06 A 314 CLR _x+3 000086 8B E3 A 315 JR _5_L_7 000088 A 316 _5_L_9: 000088 06 06 01 A 317 ADD _x+3,#1 00008B 16 05 00 A 318 ADC _x+2,#0 00008E 16 04 00 A 319 ADC _x+1,#0 000091 16 03 00 A 320 ADC _x,#0 000094 8B D5 A 321 JR _5_L_7 000096 A 322 _5_L_11: A 323 ; 55 n++; A 324 .line 55 000096 20 02 A 325 INC _n A 326 ; 56 if(n == 10) A 327 .line 56 000098 A6 02 0A A 328 CP _n,#10 00009B EB C1 A 329 JR NE,_5_L_4 A 330 ; 57 n = 0; A 331 .line 57 00009D B0 02 A 332 CLR _n A 333 ; 58 goto back; A 334 .line 58 00009F 8B BD A 335 JR _5_L_4 A 336 .line 59 0000A1 50EF A 337 POP R15 0000A3 AF A 338 RET A 339 .endfunc "main",59,"_main" A 340 XDEF _main A 341 XDEF _init_gpio A 342 XDEF _out_LEDs A 343 XDEF _strobe A 344 XDEF _clock A 345 XDEF _Num A 346 XDEF _x A 347 XDEF _n A 348 XDEF _counter A 349 XDEF _byte A 350 END Errors: 0 Warnings: 0 Lines Assembled: 351