I'm trying to make a hardware delay using the counter2 of 8254 IC by creating a square wave and counting the number of times the square wave value got 1:
mov al, 10101110B
out 43H, al
mov al, 33h
out 42H, al
mov al, 05h
out 42H, al
;;enable the port
in AL, 61H
push ax
OR AL, 00000011B ;;enable PB0 and PB1
out 61h, al
mov cx, 200
;;make delay
waitf1:
in al, 62H ;; Reads from 62H The result is always 20h
and al, 20h
cmp al, ah
je waitf1
mov ah, al
loop waitf1
pop ax
out 61h, al
the program stocks in a loop as the value read from port 62h
is alwas 20h
(PC5
is always 1) while I expected it to be a square wave.