org 0000h ljmp initialize org 001bh ljmp increment org 0013h ljmp stopa org 0100h initialize: mov ie,#8ch ;mov ip,#0ch clr psw.3 clr psw.4 clr p2.1 clr p2.2 setb p2.0 notnaw: jb p2.0,notnaw ljmp adirection org 0200h adirection: setb p2.1 mov tl1,#00h mov th1,#00h mov tmod,#10h mov tcon,#44h waita: sjmp waita org 0250h increment: jnb p2.1,decre inc r0 cjne r0,#0ffh,waita ljmp stopa reti org 0275h decre: dec r0 cjne r0,#000h,waitb ljmp stopb org 0285h bdirection: setb ie.7 setb tcon.6 setb p2.2 waitb: sjmp waitb org 0300h stopa: clr ie.7 clr tcon.6 clr p2.1 lcall towth ljmp bdirection reti org 0375h stopb: clr ie.7 clr tcon.6 clr p2.2 org 0400h towth: mov a,tl1 cpl a cjne a,#000h,carry tlend: mov tl1,a mov a,th1 cpl a mov th1,a ret org 0425h carry: inc a ljmp tlend end