1 ;-------------------------------------------------------- 2 ; File Created by SDCC : free open source ANSI-C Compiler 3 ; Version 2.9.0 #5416 (Mar 22 2009) (MINGW32) 4 ; This file was generated Tue Nov 24 13:25:23 2015 5 ;-------------------------------------------------------- 6 .module timer 7 .optsdcc -mmcs51 --model-small 8 9 ;-------------------------------------------------------- 10 ; Public variables in this module 11 ;-------------------------------------------------------- 12 .globl _process_timer 13 .globl _emulator 14 .globl _SPR0 15 .globl _SPR1 16 .globl _CPHA 17 .globl _CPOL 18 .globl _SPIM 19 .globl _SPE 20 .globl _WCOL 21 .globl _ISPI 22 .globl _I2CI 23 .globl _I2CTX 24 .globl _I2CRS 25 .globl _I2CM 26 .globl _MDI 27 .globl _MCO 28 .globl _MDE 29 .globl _MDO 30 .globl _CS0 31 .globl _CS1 32 .globl _CS2 33 .globl _CS3 34 .globl _SCONV 35 .globl _CCONV 36 .globl _DMA 37 .globl _ADCI 38 .globl _P 39 .globl _F1 40 .globl _OV 41 .globl _RS0 42 .globl _RS1 43 .globl _F0 44 .globl _AC 45 .globl _CY 46 .globl _CAP2 47 .globl _CNT2 48 .globl _TR2 49 .globl _XEN 50 .globl _TCLK 51 .globl _RCLK 52 .globl _EXF2 53 .globl _TF2 54 .globl _WDE 55 .globl _WDS 56 .globl _WDR2 57 .globl _WDR1 58 .globl _PRE0 59 .globl _PRE1 60 .globl _PRE2 61 .globl _PX0 62 .globl _PT0 63 .globl _PX1 64 .globl _PT1 65 .globl _PS 66 .globl _PT2 67 .globl _PADC 68 .globl _PSI 69 .globl _RXD 70 .globl _TXD 71 .globl _INT0 72 .globl _INT1 73 .globl _T0 74 .globl _T1 75 .globl _WR 76 .globl _RD 77 .globl _EX0 78 .globl _ET0 79 .globl _EX1 80 .globl _ET1 81 .globl _ES 82 .globl _ET2 83 .globl _EADC 84 .globl _EA 85 .globl _RI 86 .globl _TI 87 .globl _RB8 88 .globl _TB8 89 .globl _REN 90 .globl _SM2 91 .globl _SM1 92 .globl _SM0 93 .globl _T2 94 .globl _T2EX 95 .globl _IT0 96 .globl _IE0 97 .globl _IT1 98 .globl _IE1 99 .globl _TR0 100 .globl _TF0 101 .globl _TR1 102 .globl _TF1 103 .globl _DACCON 104 .globl _DAC1H 105 .globl _DAC1L 106 .globl _DAC0H 107 .globl _DAC0L 108 .globl _SPICON 109 .globl _SPIDAT 110 .globl _ADCCON3 111 .globl _ADCGAINH 112 .globl _ADCGAINL 113 .globl _ADCOFSH 114 .globl _ADCOFSL 115 .globl _B 116 .globl _ADCCON1 117 .globl _I2CCON 118 .globl _ACC 119 .globl _PSMCON 120 .globl _ADCDATAH 121 .globl _ADCDATAL 122 .globl _ADCCON2 123 .globl _DMAP 124 .globl _DMAH 125 .globl _DMAL 126 .globl _PSW 127 .globl _TH2 128 .globl _TL2 129 .globl _RCAP2H 130 .globl _RCAP2L 131 .globl _T2CON 132 .globl _EADRL 133 .globl _WDCON 134 .globl _EDATA4 135 .globl _EDATA3 136 .globl _EDATA2 137 .globl _EDATA1 138 .globl _ETIM3 139 .globl _ETIM2 140 .globl _ETIM1 141 .globl _ECON 142 .globl _IP 143 .globl _P3 144 .globl _IE2 145 .globl _IE 146 .globl _P2 147 .globl _I2CADD 148 .globl _I2CDAT 149 .globl _SBUF 150 .globl _SCON 151 .globl _P1 152 .globl _TH1 153 .globl _TH0 154 .globl _TL1 155 .globl _TL0 156 .globl _TMOD 157 .globl _TCON 158 .globl _PCON 159 .globl _DPP 160 .globl _DPH 161 .globl _DPL 162 .globl _SP 163 .globl _P0 164 .globl _pre_rand 165 .globl _del 166 .globl _threshold 167 .globl _dif 168 .globl _period 169 .globl _low_add_volume 170 .globl _medium_volume 171 .globl _emulated_tank_volume 172 .globl _init_value 173 .globl _time 174 .globl _tank_value 175 .globl _get_tank_value 176 .globl _get_current_millis 177 .globl _get_time_interval 178 .globl _sleep 179 .globl _init_timer 180 .globl _next_rand 181 ;-------------------------------------------------------- 182 ; special function registers 183 ;-------------------------------------------------------- 184 .area RSEG (DATA) 0080 185 _P0 = 0x0080 0081 186 _SP = 0x0081 0082 187 _DPL = 0x0082 0083 188 _DPH = 0x0083 0084 189 _DPP = 0x0084 0087 190 _PCON = 0x0087 0088 191 _TCON = 0x0088 0089 192 _TMOD = 0x0089 008A 193 _TL0 = 0x008a 008B 194 _TL1 = 0x008b 008C 195 _TH0 = 0x008c 008D 196 _TH1 = 0x008d 0090 197 _P1 = 0x0090 0098 198 _SCON = 0x0098 0099 199 _SBUF = 0x0099 009A 200 _I2CDAT = 0x009a 009B 201 _I2CADD = 0x009b 00A0 202 _P2 = 0x00a0 00A8 203 _IE = 0x00a8 00A9 204 _IE2 = 0x00a9 00B0 205 _P3 = 0x00b0 00B8 206 _IP = 0x00b8 00B9 207 _ECON = 0x00b9 00BA 208 _ETIM1 = 0x00ba 00BB 209 _ETIM2 = 0x00bb 00C4 210 _ETIM3 = 0x00c4 00BC 211 _EDATA1 = 0x00bc 00BD 212 _EDATA2 = 0x00bd 00BE 213 _EDATA3 = 0x00be 00BF 214 _EDATA4 = 0x00bf 00C0 215 _WDCON = 0x00c0 00C6 216 _EADRL = 0x00c6 00C8 217 _T2CON = 0x00c8 00CA 218 _RCAP2L = 0x00ca 00CB 219 _RCAP2H = 0x00cb 00CC 220 _TL2 = 0x00cc 00CD 221 _TH2 = 0x00cd 00D0 222 _PSW = 0x00d0 00D2 223 _DMAL = 0x00d2 00D3 224 _DMAH = 0x00d3 00D4 225 _DMAP = 0x00d4 00D8 226 _ADCCON2 = 0x00d8 00D9 227 _ADCDATAL = 0x00d9 00DA 228 _ADCDATAH = 0x00da 00DF 229 _PSMCON = 0x00df 00E0 230 _ACC = 0x00e0 00E8 231 _I2CCON = 0x00e8 00EF 232 _ADCCON1 = 0x00ef 00F0 233 _B = 0x00f0 00F1 234 _ADCOFSL = 0x00f1 00F2 235 _ADCOFSH = 0x00f2 00F3 236 _ADCGAINL = 0x00f3 00F4 237 _ADCGAINH = 0x00f4 00F5 238 _ADCCON3 = 0x00f5 00F7 239 _SPIDAT = 0x00f7 00F8 240 _SPICON = 0x00f8 00F9 241 _DAC0L = 0x00f9 00FA 242 _DAC0H = 0x00fa 00FB 243 _DAC1L = 0x00fb 00FC 244 _DAC1H = 0x00fc 00FD 245 _DACCON = 0x00fd 246 ;-------------------------------------------------------- 247 ; special function bits 248 ;-------------------------------------------------------- 249 .area RSEG (DATA) 008F 250 _TF1 = 0x008f 008E 251 _TR1 = 0x008e 008D 252 _TF0 = 0x008d 008C 253 _TR0 = 0x008c 008B 254 _IE1 = 0x008b 008A 255 _IT1 = 0x008a 0089 256 _IE0 = 0x0089 0088 257 _IT0 = 0x0088 0091 258 _T2EX = 0x0091 0090 259 _T2 = 0x0090 009F 260 _SM0 = 0x009f 009E 261 _SM1 = 0x009e 009D 262 _SM2 = 0x009d 009C 263 _REN = 0x009c 009B 264 _TB8 = 0x009b 009A 265 _RB8 = 0x009a 0099 266 _TI = 0x0099 0098 267 _RI = 0x0098 00AF 268 _EA = 0x00af 00AE 269 _EADC = 0x00ae 00AD 270 _ET2 = 0x00ad 00AC 271 _ES = 0x00ac 00AB 272 _ET1 = 0x00ab 00AA 273 _EX1 = 0x00aa 00A9 274 _ET0 = 0x00a9 00A8 275 _EX0 = 0x00a8 00B7 276 _RD = 0x00b7 00B6 277 _WR = 0x00b6 00B5 278 _T1 = 0x00b5 00B4 279 _T0 = 0x00b4 00B3 280 _INT1 = 0x00b3 00B2 281 _INT0 = 0x00b2 00B1 282 _TXD = 0x00b1 00B0 283 _RXD = 0x00b0 00BF 284 _PSI = 0x00bf 00BE 285 _PADC = 0x00be 00BD 286 _PT2 = 0x00bd 00BC 287 _PS = 0x00bc 00BB 288 _PT1 = 0x00bb 00BA 289 _PX1 = 0x00ba 00B9 290 _PT0 = 0x00b9 00B8 291 _PX0 = 0x00b8 00C7 292 _PRE2 = 0x00c7 00C6 293 _PRE1 = 0x00c6 00C5 294 _PRE0 = 0x00c5 00C3 295 _WDR1 = 0x00c3 00C2 296 _WDR2 = 0x00c2 00C1 297 _WDS = 0x00c1 00C0 298 _WDE = 0x00c0 00CF 299 _TF2 = 0x00cf 00CE 300 _EXF2 = 0x00ce 00CD 301 _RCLK = 0x00cd 00CC 302 _TCLK = 0x00cc 00CB 303 _XEN = 0x00cb 00CA 304 _TR2 = 0x00ca 00C9 305 _CNT2 = 0x00c9 00C8 306 _CAP2 = 0x00c8 00D7 307 _CY = 0x00d7 00D6 308 _AC = 0x00d6 00D5 309 _F0 = 0x00d5 00D4 310 _RS1 = 0x00d4 00D3 311 _RS0 = 0x00d3 00D2 312 _OV = 0x00d2 00D1 313 _F1 = 0x00d1 00D0 314 _P = 0x00d0 00DF 315 _ADCI = 0x00df 00DE 316 _DMA = 0x00de 00DD 317 _CCONV = 0x00dd 00DC 318 _SCONV = 0x00dc 00DB 319 _CS3 = 0x00db 00DA 320 _CS2 = 0x00da 00D9 321 _CS1 = 0x00d9 00D8 322 _CS0 = 0x00d8 00EF 323 _MDO = 0x00ef 00EE 324 _MDE = 0x00ee 00ED 325 _MCO = 0x00ed 00EC 326 _MDI = 0x00ec 00EB 327 _I2CM = 0x00eb 00EA 328 _I2CRS = 0x00ea 00E9 329 _I2CTX = 0x00e9 00E8 330 _I2CI = 0x00e8 00FF 331 _ISPI = 0x00ff 00FE 332 _WCOL = 0x00fe 00FD 333 _SPE = 0x00fd 00FC 334 _SPIM = 0x00fc 00FB 335 _CPOL = 0x00fb 00FA 336 _CPHA = 0x00fa 00F9 337 _SPR1 = 0x00f9 00F8 338 _SPR0 = 0x00f8 339 ;-------------------------------------------------------- 340 ; overlayable register banks 341 ;-------------------------------------------------------- 342 .area REG_BANK_0 (REL,OVR,DATA) 0000 343 .ds 8 344 ;-------------------------------------------------------- 345 ; overlayable bit register bank 346 ;-------------------------------------------------------- 347 .area BIT_BANK (REL,OVR,DATA) 0000 348 bits: 0000 349 .ds 1 8000 350 b0 = bits[0] 8100 351 b1 = bits[1] 8200 352 b2 = bits[2] 8300 353 b3 = bits[3] 8400 354 b4 = bits[4] 8500 355 b5 = bits[5] 8600 356 b6 = bits[6] 8700 357 b7 = bits[7] 358 ;-------------------------------------------------------- 359 ; internal ram data 360 ;-------------------------------------------------------- 361 .area DSEG (DATA) 0000 362 _tank_value:: 0000 363 .ds 1 0001 364 _time:: 0001 365 .ds 1 0002 366 _init_value:: 0002 367 .ds 4 0006 368 _emulated_tank_volume:: 0006 369 .ds 1 0007 370 _medium_volume:: 0007 371 .ds 1 0008 372 _low_add_volume:: 0008 373 .ds 1 0009 374 _period:: 0009 375 .ds 1 000A 376 _dif:: 000A 377 .ds 1 000B 378 _threshold:: 000B 379 .ds 1 000C 380 _del:: 000C 381 .ds 1 000D 382 _pre_rand:: 000D 383 .ds 1 384 ;-------------------------------------------------------- 385 ; overlayable items in internal ram 386 ;-------------------------------------------------------- 387 .area OSEG (OVR,DATA) 388 ;-------------------------------------------------------- 389 ; indirectly addressable internal ram data 390 ;-------------------------------------------------------- 391 .area ISEG (DATA) 392 ;-------------------------------------------------------- 393 ; absolute internal ram data 394 ;-------------------------------------------------------- 395 .area IABS (ABS,DATA) 396 .area IABS (ABS,DATA) 397 ;-------------------------------------------------------- 398 ; bit data 399 ;-------------------------------------------------------- 400 .area BSEG (BIT) 401 ;-------------------------------------------------------- 402 ; paged external ram data 403 ;-------------------------------------------------------- 404 .area PSEG (PAG,XDATA) 405 ;-------------------------------------------------------- 406 ; external ram data 407 ;-------------------------------------------------------- 408 .area XSEG (XDATA) 409 ;-------------------------------------------------------- 410 ; absolute external ram data 411 ;-------------------------------------------------------- 412 .area XABS (ABS,XDATA) 413 ;-------------------------------------------------------- 414 ; external initialized ram data 415 ;-------------------------------------------------------- 416 .area XISEG (XDATA) 417 .area HOME (CODE) 418 .area GSINIT0 (CODE) 419 .area GSINIT1 (CODE) 420 .area GSINIT2 (CODE) 421 .area GSINIT3 (CODE) 422 .area GSINIT4 (CODE) 423 .area GSINIT5 (CODE) 424 .area GSINIT (CODE) 425 .area GSFINAL (CODE) 426 .area CSEG (CODE) 427 ;-------------------------------------------------------- 428 ; global & static initialisations 429 ;-------------------------------------------------------- 430 .area HOME (CODE) 431 .area GSINIT (CODE) 432 .area GSFINAL (CODE) 433 .area GSINIT (CODE) 434 ; SRC/timer.c:10: unsigned char emulated_tank_volume = 30; 0000 75*06 1E 435 mov _emulated_tank_volume,#0x1E 436 ; SRC/timer.c:11: unsigned char medium_volume = 30; 0003 75*07 1E 437 mov _medium_volume,#0x1E 438 ; SRC/timer.c:12: unsigned char low_add_volume = 20; 0006 75*08 14 439 mov _low_add_volume,#0x14 440 ; SRC/timer.c:13: unsigned char period = 50; 0009 75*09 32 441 mov _period,#0x32 442 ; SRC/timer.c:14: unsigned char dif = 3; 000C 75*0A 03 443 mov _dif,#0x03 444 ; SRC/timer.c:15: unsigned char threshold = 4; 000F 75*0B 04 445 mov _threshold,#0x04 446 ; SRC/timer.c:16: unsigned char del = 0; 0012 75*0C 00 447 mov _del,#0x00 448 ; SRC/timer.c:91: unsigned char pre_rand = 17; 0015 75*0D 11 449 mov _pre_rand,#0x11 450 ;-------------------------------------------------------- 451 ; Home 452 ;-------------------------------------------------------- 453 .area HOME (CODE) 454 .area HOME (CODE) 455 ;-------------------------------------------------------- 456 ; code 457 ;-------------------------------------------------------- 458 .area CSEG (CODE) 459 ;------------------------------------------------------------ 460 ;Allocation info for local variables in function 'get_tank_value' 461 ;------------------------------------------------------------ 462 ;------------------------------------------------------------ 463 ; SRC/timer.c:19: unsigned char get_tank_value() { 464 ; ----------------------------------------- 465 ; function get_tank_value 466 ; ----------------------------------------- 0000 467 _get_tank_value: 0002 468 ar2 = 0x02 0003 469 ar3 = 0x03 0004 470 ar4 = 0x04 0005 471 ar5 = 0x05 0006 472 ar6 = 0x06 0007 473 ar7 = 0x07 0000 474 ar0 = 0x00 0001 475 ar1 = 0x01 476 ; SRC/timer.c:20: return emulated_tank_volume; 0000 85*06 82 477 mov dpl,_emulated_tank_volume 0003 22 478 ret 479 ;------------------------------------------------------------ 480 ;Allocation info for local variables in function 'emulator' 481 ;------------------------------------------------------------ 482 ;------------------------------------------------------------ 483 ; SRC/timer.c:23: void emulator() 484 ; ----------------------------------------- 485 ; function emulator 486 ; ----------------------------------------- 0004 487 _emulator: 488 ; SRC/timer.c:27: if (time == 254) 0004 74 FE 489 mov a,#0xFE 0006 B5*01 21 490 cjne a,_time,00106$ 491 ; SRC/timer.c:29: del++; 0009 05*0C 492 inc _del 493 ; SRC/timer.c:30: if (del == 10) 000B 74 0A 494 mov a,#0x0A 000D B5*0C 1A 495 cjne a,_del,00106$ 496 ; SRC/timer.c:32: del = 0; 0010 75*0C 00 497 mov _del,#0x00 498 ; SRC/timer.c:33: if (emulated_tank_volume > 1) 0013 E5*06 499 mov a,_emulated_tank_volume 0015 24 FE 500 add a,#0xff - 0x01 0017 50 11 501 jnc 00106$ 502 ; SRC/timer.c:34: emulated_tank_volume = emulated_tank_volume - next_rand() % dif; 0019 12s01r26 503 lcall _next_rand 001C E5 82 504 mov a,dpl 001E 85*0A F0 505 mov b,_dif 0021 84 506 div ab 0022 AA F0 507 mov r2,b 0024 E5*06 508 mov a,_emulated_tank_volume 0026 C3 509 clr c 0027 9A 510 subb a,r2 0028 F5*06 511 mov _emulated_tank_volume,a 002A 512 00106$: 513 ; SRC/timer.c:37: if (emulated_tank_volume < threshold) emulated_tank_volume = next_rand() % medium_volume + low_add_volume; 002A C3 514 clr c 002B E5*06 515 mov a,_emulated_tank_volume 002D 95*0B 516 subb a,_threshold 002F 50 0F 517 jnc 00109$ 0031 12s01r26 518 lcall _next_rand 0034 E5 82 519 mov a,dpl 0036 85*07 F0 520 mov b,_medium_volume 0039 84 521 div ab 003A E5 F0 522 mov a,b 003C 25*08 523 add a,_low_add_volume 003E F5*06 524 mov _emulated_tank_volume,a 0040 525 00109$: 0040 22 526 ret 527 ;------------------------------------------------------------ 528 ;Allocation info for local variables in function 'process_timer' 529 ;------------------------------------------------------------ 530 ;------------------------------------------------------------ 531 ; SRC/timer.c:40: void process_timer(void) interrupt 1 532 ; ----------------------------------------- 533 ; function process_timer 534 ; ----------------------------------------- 0041 535 _process_timer: 0041 C0*00 536 push bits 0043 C0 E0 537 push acc 0045 C0 F0 538 push b 0047 C0 82 539 push dpl 0049 C0 83 540 push dph 004B C0 02 541 push (0+2) 004D C0 03 542 push (0+3) 004F C0 04 543 push (0+4) 0051 C0 05 544 push (0+5) 0053 C0 06 545 push (0+6) 0055 C0 07 546 push (0+7) 0057 C0 00 547 push (0+0) 0059 C0 01 548 push (0+1) 005B C0 D0 549 push psw 005D 75 D0 00 550 mov psw,#0x00 551 ; SRC/timer.c:42: time++; 0060 05*01 552 inc _time 553 ; SRC/timer.c:43: TH0 = (0xFF00 & init_value) >> 8; 0062 AB*03 554 mov r3,(_init_value + 1) 0064 8B 8C 555 mov _TH0,r3 556 ; SRC/timer.c:44: TL0 = (0x00FF & init_value); 0066 AA*02 557 mov r2,_init_value 0068 8A 8A 558 mov _TL0,r2 559 ; SRC/timer.c:45: emulator(); 006A 12s00r04 560 lcall _emulator 006D D0 D0 561 pop psw 006F D0 01 562 pop (0+1) 0071 D0 00 563 pop (0+0) 0073 D0 07 564 pop (0+7) 0075 D0 06 565 pop (0+6) 0077 D0 05 566 pop (0+5) 0079 D0 04 567 pop (0+4) 007B D0 03 568 pop (0+3) 007D D0 02 569 pop (0+2) 007F D0 83 570 pop dph 0081 D0 82 571 pop dpl 0083 D0 F0 572 pop b 0085 D0 E0 573 pop acc 0087 D0*00 574 pop bits 0089 32 575 reti 576 ;------------------------------------------------------------ 577 ;Allocation info for local variables in function 'get_current_millis' 578 ;------------------------------------------------------------ 579 ;temp Allocated to registers 580 ;------------------------------------------------------------ 581 ; SRC/timer.c:49: unsigned char get_current_millis(void) 582 ; ----------------------------------------- 583 ; function get_current_millis 584 ; ----------------------------------------- 008A 585 _get_current_millis: 586 ; SRC/timer.c:53: EA = 0; 008A C2 AF 587 clr _EA 588 ; SRC/timer.c:54: temp = time; 008C 85*01 82 589 mov dpl,_time 590 ; SRC/timer.c:55: EA = 1; 008F D2 AF 591 setb _EA 592 ; SRC/timer.c:57: return temp; 0091 22 593 ret 594 ;------------------------------------------------------------ 595 ;Allocation info for local variables in function 'get_time_interval' 596 ;------------------------------------------------------------ 597 ;t0 Allocated to registers r2 598 ;------------------------------------------------------------ 599 ; SRC/timer.c:61: unsigned char get_time_interval(unsigned char t0) 600 ; ----------------------------------------- 601 ; function get_time_interval 602 ; ----------------------------------------- 0092 603 _get_time_interval: 0092 AA 82 604 mov r2,dpl 605 ; SRC/timer.c:63: return get_current_millis() - t0; 0094 C0 02 606 push ar2 0096 12s00r8A 607 lcall _get_current_millis 0099 AB 82 608 mov r3,dpl 009B D0 02 609 pop ar2 009D EB 610 mov a,r3 009E C3 611 clr c 009F 9A 612 subb a,r2 00A0 F5 82 613 mov dpl,a 00A2 22 614 ret 615 ;------------------------------------------------------------ 616 ;Allocation info for local variables in function 'sleep' 617 ;------------------------------------------------------------ 618 ;delay Allocated to registers r2 619 ;startTime Allocated to registers r3 620 ;------------------------------------------------------------ 621 ; SRC/timer.c:67: void sleep(unsigned char delay) 622 ; ----------------------------------------- 623 ; function sleep 624 ; ----------------------------------------- 00A3 625 _sleep: 00A3 AA 82 626 mov r2,dpl 627 ; SRC/timer.c:69: unsigned char startTime = get_current_millis(); 00A5 C0 02 628 push ar2 00A7 12s00r8A 629 lcall _get_current_millis 00AA AB 82 630 mov r3,dpl 00AC D0 02 631 pop ar2 632 ; SRC/timer.c:71: while (get_time_interval(startTime) < delay); 00AE 633 00101$: 00AE 8B 82 634 mov dpl,r3 00B0 C0 02 635 push ar2 00B2 C0 03 636 push ar3 00B4 12s00r92 637 lcall _get_time_interval 00B7 AC 82 638 mov r4,dpl 00B9 D0 03 639 pop ar3 00BB D0 02 640 pop ar2 00BD C3 641 clr c 00BE EC 642 mov a,r4 00BF 9A 643 subb a,r2 00C0 40 EC 644 jc 00101$ 00C2 22 645 ret 646 ;------------------------------------------------------------ 647 ;Allocation info for local variables in function 'init_timer' 648 ;------------------------------------------------------------ 649 ;frequency Allocated to registers r2 r3 r4 r5 650 ;------------------------------------------------------------ 651 ; SRC/timer.c:75: void init_timer(unsigned long frequency) 652 ; ----------------------------------------- 653 ; function init_timer 654 ; ----------------------------------------- 00C3 655 _init_timer: 00C3 AA 82 656 mov r2,dpl 00C5 AB 83 657 mov r3,dph 00C7 AC F0 658 mov r4,b 00C9 FD 659 mov r5,a 660 ; SRC/timer.c:77: time = 0; 00CA 75*01 00 661 mov _time,#0x00 662 ; SRC/timer.c:79: set_vector(0x200B, (void *) process_timer); 00CD 7Er41 663 mov r6,#_process_timer 00CF 7Fs00 664 mov r7,#(_process_timer >> 8) 00D1 78 80 665 mov r0,#0x80 00D3 C0 02 666 push ar2 00D5 C0 03 667 push ar3 00D7 C0 04 668 push ar4 00D9 C0 05 669 push ar5 00DB C0 06 670 push ar6 00DD C0 07 671 push ar7 00DF C0 00 672 push ar0 00E1 90 20 0B 673 mov dptr,#0x200B 00E4 12s00r00 674 lcall _set_vector 00E7 15 81 675 dec sp 00E9 15 81 676 dec sp 00EB 15 81 677 dec sp 678 ; SRC/timer.c:81: init_value = 65536 - (921600 / frequency); 00ED 90 10 00 679 mov dptr,#0x1000 00F0 75 F0 0E 680 mov b,#0x0E 00F3 E4 681 clr a 00F4 12s00r00 682 lcall __divulong 00F7 AA 82 683 mov r2,dpl 00F9 AB 83 684 mov r3,dph 00FB AC F0 685 mov r4,b 00FD FD 686 mov r5,a 00FE E5 81 687 mov a,sp 0100 24 FC 688 add a,#0xfc 0102 F5 81 689 mov sp,a 0104 E4 690 clr a 0105 C3 691 clr c 0106 9A 692 subb a,r2 0107 F5*02 693 mov _init_value,a 0109 E4 694 clr a 010A 9B 695 subb a,r3 010B F5*03 696 mov (_init_value + 1),a 010D 74 01 697 mov a,#0x01 010F 9C 698 subb a,r4 0110 F5*04 699 mov (_init_value + 2),a 0112 E4 700 clr a 0113 9D 701 subb a,r5 0114 F5*05 702 mov (_init_value + 3),a 703 ; SRC/timer.c:82: TH0 = (0xFF00 & init_value) >> 8; 0116 AB*03 704 mov r3,(_init_value + 1) 0118 8B 8C 705 mov _TH0,r3 706 ; SRC/timer.c:83: TL0 = (0x00FF & init_value); 011A AA*02 707 mov r2,_init_value 011C 8A 8A 708 mov _TL0,r2 709 ; SRC/timer.c:86: TMOD |= 0x01; 011E 43 89 01 710 orl _TMOD,#0x01 711 ; SRC/timer.c:87: ET0 = 1; // Маска прерывания таймера 1 0121 D2 A9 712 setb _ET0 713 ; SRC/timer.c:88: TR0 = 1; // Разрешаем таймеру 0 считать 0123 D2 8C 714 setb _TR0 0125 22 715 ret 716 ;------------------------------------------------------------ 717 ;Allocation info for local variables in function 'next_rand' 718 ;------------------------------------------------------------ 719 ;timerValue Allocated to registers r2 720 ;newRandom Allocated to registers r2 721 ;------------------------------------------------------------ 722 ; SRC/timer.c:92: unsigned char next_rand(void) 723 ; ----------------------------------------- 724 ; function next_rand 725 ; ----------------------------------------- 0126 726 _next_rand: 727 ; SRC/timer.c:94: unsigned char timerValue = get_current_millis(); 0126 12s00r8A 728 lcall _get_current_millis 0129 AA 82 729 mov r2,dpl 730 ; SRC/timer.c:95: unsigned char newRandom = (timerValue * pre_rand + timerValue) % 256; 012B 8A F0 731 mov b,r2 012D E5*0D 732 mov a,_pre_rand 012F A4 733 mul ab 0130 FB 734 mov r3,a 0131 AC F0 735 mov r4,b 0133 7D 00 736 mov r5,#0x00 0135 EA 737 mov a,r2 0136 2B 738 add a,r3 0137 F5 82 739 mov dpl,a 0139 ED 740 mov a,r5 013A 3C 741 addc a,r4 013B F5 83 742 mov dph,a 013D E4 743 clr a 013E C0 E0 744 push acc 0140 74 01 745 mov a,#0x01 0142 C0 E0 746 push acc 0144 12s00r00 747 lcall __modsint 0147 AA 82 748 mov r2,dpl 0149 15 81 749 dec sp 014B 15 81 750 dec sp 751 ; SRC/timer.c:96: pre_rand = newRandom; 014D 8A*0D 752 mov _pre_rand,r2 753 ; SRC/timer.c:97: return newRandom; 014F 8A 82 754 mov dpl,r2 0151 22 755 ret 756 .area CSEG (CODE) 757 .area CONST (CODE) 758 .area XINIT (CODE) 759 .area CABS (ABS,CODE)