По моему это гениально

Здpавствуй, All!

.............. wait10ms: rcall wait5ms ;5ms 7+x return addresses ;proceed with wait5ms ;+5ms wait5ms: rcall wait1ms ;1ms 6+x return addresses ;proceed with wait4ms ;+4ms wait4ms: rcall wait1ms ;1ms 6+x return addresses ;proceed with wait3ms ;+3ms wait3ms: rcall wait1ms ;1ms 6+x return addresses ;proceed with wait2ms ;+2ms wait2ms: rcall wait1ms ;1ms 6+x return addresses ;proceed with wait1ms ;+1ms wait1ms: rcall wait500us ;500╡s 5+x return addresses ;laeuft in wait500us ;+500╡s wait500us: rcall wait100us ;100╡s 4+x return addresses ;proceed with wait400us ;+400╡s wait400us: rcall wait100us ;100╡s 4+x return addresses ;proceed with wait300us ;+300╡s wait300us: rcall wait100us ;100╡s 4+x return addresses ;proceed with wait200us ;+200╡s wait200us: rcall wait100us ;100╡s 4+x return addresses ;proceed with wait100us ;+100╡s wait100us: rcall wait50us ;50╡s 3+x return addresses ;proceed with wait50us ;+50╡s wait50us: rcall wait10us ;10╡s 2+x return addresses ;proceed with wait40us ;+40╡s wait40us: rcall wait10us ;10╡s 2+x return addresses ;proceed with wait30us ;+30╡s wait30us: rcall wait10us ;10╡s 2+x return addresses ;proceed with wait20us ;+20╡s wait20us: rcall wait10us ;10╡s 2+x return addresses ;proceed with wait10us ;+10╡s /* 10╡s and below based on MCU clock rate * - rcall needs 3 clock cycles * - ret needs 4 clock cycles

*/ wait10us: ; 1+x return addresses

#if CPU_FREQ == 8000000 ;8MHz: clock cycle 125ns x = 2

.global wait5us ;wait 5╡s .global wait4us ;wait 4╡s .global wait3us ;wait 3╡s .global wait2us ;wait 2╡s .global wait1us ;wait 1╡s

;wait10us rcall wait5us ;5╡s ;proceed with wait5us ;+5╡s wait5us: rcall wait1us ;1╡s ;proceed with wait4us ;+4╡s wait4us: rcall wait1us ;1╡s ;proceed with wait3us ;+3us wait3us: rcall wait1us ;1╡s ;proceed with wait2us ;+2╡s wait2us: rcall wait1us ;1╡s ;proceed with wait1us ;+1╡s wait1us: nop ;1╡s #endif

ret

Это транслируется в:

0000784e <wait10ms>: ;proceed with wait10ms ;+10ms wait10ms: rcall wait5ms ;5ms 7+x return addresses 784e: 00 d0 rcall .+0 ; 0x7850 <wait5ms> 00007850 <wait5ms>: ;proceed with wait5ms ;+5ms wait5ms: rcall wait1ms ;1ms 6+x return addresses 7850: 03 d0 rcall .+6 ; 0x7858 <wait1ms> 00007852 <wait4ms>: ;proceed with wait4ms ;+4ms wait4ms: rcall wait1ms ;1ms 6+x return addresses 7852: 02 d0 rcall .+4 ; 0x7858 <wait1ms> 00007854 <wait3ms>: ;proceed with wait3ms ;+3ms wait3ms: rcall wait1ms ;1ms 6+x return addresses 7854: 01 d0 rcall .+2 ; 0x7858 <wait1ms> 00007856 <wait2ms>: ;proceed with wait2ms ;+2ms wait2ms: rcall wait1ms ;1ms 6+x return addresses 7856: 00 d0 rcall .+0 ; 0x7858 <wait1ms> 00007858 <wait1ms>: ;proceed with wait1ms ;+1ms wait1ms: rcall wait500us ;500╡s 5+x return addresses 7858: 00 d0 rcall .+0 ; 0x785a <wait500us> 0000785a <wait500us>: ;laeuft in wait500us ;+500╡s wait500us: rcall wait100us ;100╡s 4+x return addresses 785a: 03 d0 rcall .+6 ; 0x7862 <wait100us> 0000785c <wait400us>: ;proceed with wait400us ;+400╡s wait400us: rcall wait100us ;100╡s 4+x return addresses 785c: 02 d0 rcall .+4 ; 0x7862 <wait100us> 0000785e <wait300us>: ;proceed with wait300us ;+300╡s wait300us: rcall wait100us ;100╡s 4+x return addresses 785e: 01 d0 rcall .+2 ; 0x7862 <wait100us> 00007860 <wait200us>: ;proceed with wait200us ;+200╡s wait200us: rcall wait100us ;100╡s 4+x return addresses 7860: 00 d0 rcall .+0 ; 0x7862 <wait100us> 00007862 <wait100us>: ;proceed with wait100us ;+100╡s wait100us: rcall wait50us ;50╡s 3+x return addresses 7862: 00 d0 rcall .+0 ; 0x7864 <wait50us> 00007864 <wait50us>: ;proceed with wait50us ;+50╡s wait50us: rcall wait10us ;10╡s 2+x return addresses 7864: 03 d0 rcall .+6 ; 0x786c <wait10us> 00007866 <wait40us>: ;proceed with wait40us ;+40╡s wait40us: rcall wait10us ;10╡s 2+x return addresses 7866: 02 d0 rcall .+4 ; 0x786c <wait10us> 00007868 <wait30us>: ;proceed with wait30us ;+30╡s wait30us: rcall wait10us ;10╡s 2+x return addresses 7868: 01 d0 rcall .+2 ; 0x786c <wait10us> 0000786a <wait20us>: ;proceed with wait20us ;+20╡s wait20us: rcall wait10us ;10╡s 2+x return addresses 786a: 00 d0 rcall .+0 ; 0x786c <wait10us> 0000786c <wait10us>: .global wait3us ;wait 3╡s .global wait2us ;wait 2╡s .global wait1us ;wait 1╡s

;wait10us rcall wait5us ;5╡s 786c: 00 d0 rcall .+0 ; 0x786e <wait5us>

0000786e <wait5us>: ;proceed with wait5us ;+5╡s wait5us: rcall wait1us ;1╡s 786e: 03 d0 rcall .+6 ; 0x7876 <wait1us> 00007870 <wait4us>: ;proceed with wait4us ;+4╡s wait4us: rcall wait1us ;1╡s 7870: 02 d0 rcall .+4 ; 0x7876 <wait1us> 00007872 <wait3us>: ;proceed with wait3us ;+3us wait3us: rcall wait1us ;1╡s 7872: 01 d0 rcall .+2 ; 0x7876 <wait1us> 00007874 <wait2us>: ;proceed with wait2us ;+2╡s wait2us: rcall wait1us ;1╡s 7874: 00 d0 rcall .+0 ; 0x7876 <wait1us> 00007876 <wait1us>: ;proceed with wait1us ;+1╡s wait1us: nop ;1╡s 7876: 00 00 nop nop nop ;500ns #endif

ret 7878: 08 95 ret ...............

С уважением - Andrej

Reply to
Andrej Arnold
Loading thread data ...

Пpивет, Andrej! Отвечаю на письмо от 27 Feb 21 19:05:12 (AREA:RU.EMBEDDED) AA> Здpавствуй, All!

AA> .............. AA> x Origin: Как я попал на этот куpоpт? (2:5020/830.590)

ЭЭээээ?

Reply to
Valentin Kuznetsov

Здpавствуй, Valentin!

Суббота 27 Февраля 2021 22:58, ты писал(а) мне, AA>> x Origin: Как я попал на этот куpоpт? (2:5020/830.590) VK> ЭЭээээ? VK> * Origin: Разум WebФИДО пpиветствует Вас с куpоpта!! (2:5053/51.401) Один из моих начальников в Кургане любил так говорить.

Имелись ввиду - беспорядоные взаимоотношения между службами.

С уважением - Andrej

Reply to
Andrej Arnold

Пpивет, Andrej! Отвечаю на письмо от 28 Feb 21 15:05:14 (AREA:RU.EMBEDDED) VK>> ЭЭээээ?

AA> Имелись ввиду - беспоpядоные взаимоотношения между AA> службами.

Hо скомпилилось же!

Reply to
Valentin Kuznetsov

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.