How to set 1 second time delay at assembly language 8086
You can use interrupt 1Ah
/ function 00h
(GET SYSTEM TIME) to get the number of clock ticks (18.2/s) since midnight in CX:DX
.
So to wait approximately 1 second using this method you'd execute this interrupt function once, save CX:DX in a variable, then execute the same interrupt in a loop until the absolute value of CX:DX - firstCX:DX
is greater than 18.
Set 1 million microseconds interval (1 second) By using below instruction .
MOV CX, 0FH
MOV DX, 4240H
MOV AH, 86H
INT 15H
You can set multiple second delay by using 86H and INT 15H
check these links for more details
Waits a specified number of microseconds before returning control to the caller
INT 15H 86H: Wait
What i finally ended up using was the nop loop
; start delay
mov bp, 43690
mov si, 43690
delay2:
dec bp
nop
jnz delay2
dec si
cmp si,0
jnz delay2
; end delay
I used two registers which I set them both to any high value and its gonna keep on looping until both values go to zero
What I used here was AAAA
for both SI and BP
, i ended up with roughly 1 second for each delay loop.
Thanks for the help guys, and yes, we still use MS DOS for this assembly language course :(