Strange input glitch

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
User avatar
nm111
Posts: 1
Joined: Thu Apr 13, 2017 8:24 am

Strange input glitch

Post 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)
Why is Windows bad? It's bulky, slow, and costs over £100. Throw it away and install something open-source, like Arch.
User avatar
zaval
Member
Member
Posts: 659
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: Strange input glitch

Post 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
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Strange input glitch

Post 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.
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Strange input glitch

Post 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...
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: Strange input glitch

Post 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).
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Strange input glitch

Post 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.
MichaelPetch
Member
Member
Posts: 799
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Strange input glitch

Post 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.
Post Reply