Page 1 of 1

Strange input glitch

Posted: Thu Oct 26, 2017 11:18 am
by nm111
So, I have been trying to make an OS, but a glitch is getting in my way. When I type a command, sometimes the argument gets blanked out or replaced. I have no idea about where this glitch is happening, but it seems to occur more often when backspaces are used.
So for example:

Code: Select all

>echo Hello
Hello
>echo Hello
Heloo
>echo Hello
(nothing)
I am pretty sure this has nothing to do with my string-splitting routine, as that works pretty well in as a normal C program. Does anyone have any help? (OS is on https://github.com/nm111/NMOS)

Re: Strange input glitch

Posted: Thu Oct 26, 2017 1:59 pm
by zaval
nm111 wrote:So,
...
Does anyone have any help?
...
moronic signature wrote: _________________
Person: "How do I compile this on Windows?" Me: "Don't use Windows."
Image

Re: Strange input glitch

Posted: Thu Oct 26, 2017 2:55 pm
by iansjack
Perhaps I'm missing something, but I can't see where you define your getChar() and printf() functions.

As per the previous post, slagging off a particular operating system just makes you look like a kid trying (unsuccessfully) to be cool.

Re: Strange input glitch

Posted: Thu Oct 26, 2017 3:10 pm
by Octacone
iansjack wrote:Perhaps I'm missing something, but I can't see where you define your getChar() and printf() functions.

As per the previous post, slagging off a particular operating system just makes you look like a kid trying (unsuccessfully) to be cool.
I managed to find those... Inside the headers...

Re: Strange input glitch

Posted: Thu Oct 26, 2017 10:36 pm
by thepowersgang
At a quick guess, this is caused by bad rendering (either printing or scrolling).

With that said - Your code organisation has a lot of issues (non-inline code shouldn't be in headers, printf shouldn't deviate from the standard, indentation is pretty inconsistent, ...)

I suggest adding in a logging function (e.g. something like `void logf(const char*, ...);` that acts like printf) that writes to the first serial port and using that to debug your rendering issues (by logging the various values before you use them).

Re: Strange input glitch

Posted: Fri Oct 27, 2017 12:37 am
by iansjack
Octacone wrote:
iansjack wrote:Perhaps I'm missing something, but I can't see where you define your getChar() and printf() functions.

As per the previous post, slagging off a particular operating system just makes you look like a kid trying (unsuccessfully) to be cool.
I managed to find those... Inside the headers...
Ah, I see them.

That's going to lead to tears before bedtime.

Re: Strange input glitch

Posted: Fri Oct 27, 2017 11:11 pm
by MichaelPetch
I think you should consider looking at your CAPSLOCK and Shift handling code. I ran your code and originally couldn't reproduce the problems you mentioned, but I didn't use upper case characters. I accidentally turned on CAPSLOCK and discovered things go really wrong and then seem to cause issues for any command after that happens to have upper case letters in it. I also noticed that things start failing if I enter a number of characters while holding down the shift key. It seems if you follow them with a space things go terribly wrong. You may wish to revisit the code you have to process SHIFT/CAPSLOCK - you've got serious problems there.