The document describes an assembly language program that implements delays. It contains two nested loops, DELAY10 and DELAY20, that decrement counters in registers B and D respectively. The total execution time Tn is calculated as 83+Ne[31+42Ni] where N is the number of iterations and e and i are the execution times of individual instructions. For sample counter values of 5000 and 10000, Tn is calculated to be 525,155,000 clock cycles, corresponding to a runtime of 210.06 seconds for a 5MHz clock.
The document describes an assembly language program that implements delays. It contains two nested loops, DELAY10 and DELAY20, that decrement counters in registers B and D respectively. The total execution time Tn is calculated as 83+Ne[31+42Ni] where N is the number of iterations and e and i are the execution times of individual instructions. For sample counter values of 5000 and 10000, Tn is calculated to be 525,155,000 clock cycles, corresponding to a runtime of 210.06 seconds for a 5MHz clock.
The document describes an assembly language program that implements delays. It contains two nested loops, DELAY10 and DELAY20, that decrement counters in registers B and D respectively. The total execution time Tn is calculated as 83+Ne[31+42Ni] where N is the number of iterations and e and i are the execution times of individual instructions. For sample counter values of 5000 and 10000, Tn is calculated to be 525,155,000 clock cycles, corresponding to a runtime of 210.06 seconds for a 5MHz clock.
DELAY: push B ; 1001 C5 CO 12 push PSW ; lxi B,1000 ; 1002 01 CO 10 1003 E8 OP1 push B ; 1004 03 OP2 lxi B,1000 ; DELAY10: ; DELAY10: ; mvi A,100 ; 1005 3E CO 7 1006 64 OP1 mvi A,100 ; DELAY20: DELAY20: nop ; 1007 00 CO 4 inr A ; A-1 1008 3C CO 4 nop ; inr A ; A-1 1008 3C CO 4 inr A ; A+1 cpi 200 ; 1009 FE CO 7 100A C8 OP1 inr A ; A+1 jnz DELAY20 ; 100B C2 CO 7/10 cpi 200 ; 100C 07 OP1 jnz DELAY20 ; 100D 10 OP2 nop ; 100E 00 CO 4 nop ; dcx B ; BC-1 100F 0B CO 6 dcx B ; BC-1 dcx B ; BC-1 1010 0B CO 6 mov A,C ; 1011 79 CO 4 dcx B ; BC-1 ora B ; 1012 B0 CO 4 mov A,C ; jnz DELAY10 ; Z=? 1013 C2 CO 7/10 1014 05 OP1 ora B ; 1015 10 OP2 jnz DELAY10 ; Z=? pop B ; 1016 C1 CO 10 pop B ; pop PSW ; 1017 F1 CO 10 ret ; 1018 C9 CO 10 pop PSW ; ret ; Tn = 12+12+10+ Ne[7+Ni(4+4+4+7+10)-3 +4+6+6+4+4+10]-3+ 10+10+10 Tn=61+Ne[38+29Ni] Tn(1000/2,100/2) =61+ 1000/2*[38+29*100/2] Tn=744,061 T(Cy=5MHz) =Tn*2/Cy =744,061*2/5E6 =297.6 mSeg DELAY: push PSW ; push B ; push D ; lxi B,5000 ; BC DELAY10: ; lxi D,10000 ; DE DELAY20: dcx D ; DE-1 dcx D ; DE-1 dcx D ; DE-1 dcx D ; DE-1 mov A,E; ora D ; Afecta Z jnz DELAY20 ; dcx B ; BC-1 mov A,C ; ora B ; Afecta Z jnz DELAY10 ; Z=? pop D ; pop B ; pop PSW ; ret ; DELAY: push PSW ; 1000 F5 CO 12 push B ; 1001 C5 CO 12 push D ; 1002 D5 CO 12 lxi B,5000 1388h ; BC 1003 01 CO 10 1004 88 OP1 1005 13 OP2 Tn = 12+12+12+10+ DELAY10: ; lxi D,10000 2710h ; DE 1006 11 CO 10 Ne[10+Ni(6+6+6+6+4+4+10)-3 1007 10 OP1 1008 27 OP2 +6+4+4+10]-3+ DELAY20: 10+10+10+10 dcx D ; DE-1 1009 1B CO 6 dcx D ; DE-1 100A 1B CO 6 Tn=83+Ne[31+42Ni] dcx D ; DE-1 100B 1B CO 6 dcx D ; DE-1 100C 1B CO 6 Tn(5000/1,10000/4) =83+ mov A,E ora D ; ; Afecta Z 100D 100E 7B B2 CO CO 4 4 5000/1*[31+42*10000/4] jnz DELAY20 ; 100F C2 CO 7/10 Tn=525,155,000 1010 09 OP1 1011 10 OP2 T(Cy=5MHz) =Tn*2/Cy dcx B ; BC-1 1012 0B CO 6 mov A,C ; 1013 79 CO 4 =525,155,000*2/5E6 ora B ; Afecta Z 1014 B0 CO 4 =210.06 Seg jnz DELAY10 ; Z=? 1015 C2 CO 7/10 1016 06 OP1 1017 10 OP2 pop D ; 1018 D1 CO 10 pop B ; 1019 C1 CO 10 pop PSW ; 101A F1 CO 10 ret ; 101B C9 CO 10