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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
QB114514
Posts: 4
Joined: Mon Jul 17, 2023 6:00 pm
Libera.chat IRC: 114514

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

Post 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?
Last edited by QB114514 on Sat Jun 29, 2024 4:50 am, edited 1 time in total.
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

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

Post 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.
QB114514
Posts: 4
Joined: Mon Jul 17, 2023 6:00 pm
Libera.chat IRC: 114514

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

Post by QB114514 »

So is it means it's not required on the most of modern PCs?
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

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

Post by Octocontrabass »

Correct.
QB114514
Posts: 4
Joined: Mon Jul 17, 2023 6:00 pm
Libera.chat IRC: 114514

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

Post by QB114514 »

Thanks.
QB114514
Posts: 4
Joined: Mon Jul 17, 2023 6:00 pm
Libera.chat IRC: 114514

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

Post by QB114514 »

tl;dr it does NOT matter on the most platforms
Post Reply