The last time I wrote 8080/8085/z80 code was somewhere in 80's, but here are my 2 cents:
- the label "UP" is not defined (it should be before "RAL" instruction
- the label "NEXT" is not defined, it should be before "DCR C" instruction
- "MVI A, 0H" should be "MVI A, 8H" where you calculate number of zeroes