Page 1 of 1

[SOLVED] Why does it matter to have some delays after I/O reading?

Posted: Sat Mar 16, 2024 5:01 am
by QB114514
I have following a tutorial to make my own OS. In the tutorial I see that there are some delays after each in instruction like this:

Code: Select all

in dx, al
jmp $+2
jmp $+2
jmp $+2
; Something
I'm confused with why does it matter. Can you help me know it?

Re: Why does it matter to have some delays after I/O reading

Posted: Tue Jun 11, 2024 10:33 pm
by Octocontrabass
QB114514 wrote:I have following a tutorial to make my own OS.
Careful. Most tutorials have bugs.
QB114514 wrote:In the tutorial I see that there are some delays after each in instruction like this:
It's not really after the IN instruction, it's between the IN instruction and the next I/O instruction.
QB114514 wrote:I'm confused with why does it matter. Can you help me know it?
It probably doesn't matter. Delays between I/O instructions are usually only needed on extremely old PCs, and the "jmp $+2" instruction only adds a delay on ancient (i386 and older) CPUs.

Re: Why does it matter to have some delays after I/O reading

Posted: Tue Jun 11, 2024 11:35 pm
by QB114514
So is it means it's not required on the most of modern PCs?

Re: Why does it matter to have some delays after I/O reading

Posted: Tue Jun 11, 2024 11:43 pm
by Octocontrabass
Correct.

Re: Why does it matter to have some delays after I/O reading

Posted: Tue Jun 11, 2024 11:54 pm
by QB114514
Thanks.

Re: [SOLVED] Why does it matter to have some delays after I/O reading?

Posted: Sat Jun 29, 2024 4:51 am
by QB114514
tl;dr it does NOT matter on the most platforms