Program works as a 24bit counter and its state is written on ports A,B,D (where A is the highest and D is the lowest). When counter reach value FFFFFF hex it is cleared and counts upward again.