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