OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 1:30 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Strange behaviour of compiler (Same code is not working
PostPosted: Sun Dec 25, 2016 2:24 am 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
That site is pretty impressive. If only there were an onlineassembler.com to go with it, I could do all of my OS development on my iPhone. :)

It does, however, make me realize just how primitive our development tools really are.

For example, the site will show you, graphically, which code runs in a loop, and which code blocks call other code blocks. When I get a chance, I'm going to try uploading my entire compiled OS to see what it looks like.

_________________
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott


Top
 Profile  
 
 Post subject: Re: Strange behaviour of compiler (Same code is not working
PostPosted: Sun Dec 25, 2016 5:57 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 723
Location: Tallinn, Estonia
SpyderTL wrote:
That site is pretty impressive. If only there were an onlineassembler.com to go with it,


There's something for C++-to-assembler online, which is quite nice too http://godbolt.org

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: Strange behaviour of compiler (Same code is not working
PostPosted: Sun Dec 25, 2016 11:31 am 
Offline
Member
Member
User avatar

Joined: Sun Nov 20, 2016 7:26 am
Posts: 155
Location: Somewhere
Octocontrabass wrote:
Agola wrote:
That made me suspect about optimization for recursive functions

Is keyboard_getchar() supposed to be recursive? If so, you've forgotten a "return" statement.
Code:
if (scancode & 0x80) return keyboard_getchar();

Is it possible the "keyboard_getchar()" was working without return?
Because it was working, I know. Just not sure it was "return keyboard_getchar();" or "keyboard_getchar();"

And does newlib handle backspace while reading from stdin?
Or have I handle backspace myself?

_________________
Keyboard not found!

Press F1 to run setup.
Press F2 to continue.


Top
 Profile  
 
 Post subject: Re: Strange behaviour of compiler (Same code is not working
PostPosted: Sun Dec 25, 2016 12:44 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5143
Agola wrote:
Is it possible the "keyboard_getchar()" was working without return?

Maybe, maybe not. I would have to see the code you lost to tell you.

Agola wrote:
And does newlib handle backspace while reading from stdin?
Or have I handle backspace myself?

As far as I can tell, newlib doesn't handle backspace when reading from anything.


Top
 Profile  
 
 Post subject: Re: Strange behaviour of compiler (Same code is not working
PostPosted: Sun Dec 25, 2016 1:41 pm 
Offline
Member
Member
User avatar

Joined: Sun Nov 20, 2016 7:26 am
Posts: 155
Location: Somewhere
Octocontrabass wrote:
Agola wrote:
Is it possible the "keyboard_getchar()" was working without return?

Maybe, maybe not. I would have to see the code you lost to tell you.

Agola wrote:
And does newlib handle backspace while reading from stdin?
Or have I handle backspace myself?

As far as I can tell, newlib doesn't handle backspace when reading from anything.


I think the old "keyboard_getchar()" was:

Code:
char keyboard_getchar()
{
    while (!(inb(0x64) & 0x1));

    unsigned char scancode = inb(0x60);

    if (scancode & 0x80) keyboard_getchar();
   
    char chr = key_list[scancode];
    terminal_putchar(chr);

    return chr;
}


Maybe I deleted the return *accidentally*, or maybe it was working and it is not working now (that is strange :?)

Compared their assembly outputs, they look nearly identical, I don't know what is the problem really :shock:

_________________
Keyboard not found!

Press F1 to run setup.
Press F2 to continue.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], Google [Bot], SemrushBot [Bot] and 114 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group