I get lots of emails and PM to write some more Assembly language programs and as I have some time I thought of writing some more.
Its called Counters using the delay routine.
The subroutine we will use is as follows. This will behave as a delay for our counter
//FUNC MVI C, FF // Load Register C with the Hex value FF DCR C // Decrement the C Register // Address of the statment is XXXX JNZ XXXX // loop till you get the counter reduced to zero RET
LXI SP, 87DD // Load immediate stack pointer LXI H, 0000 // Load immediate register Pair H & L MVI B, 10 // Load Register B with the Hex value 10 SHLD 87FD // Store H & L direct PUSH B // Push register Pair B & C on stack CALL FUNC // Call the above subroutine POP B // Pop register Pair B & C off stack DCR B // Decrement B JNZ XXXX // - SHLD Location // Jump on no zero INX H // Increment H & L registers JMP XXXX // MVI B 10 location // Jump unconditional