0

I am developing an OS kernel. I am facing a problem that till a particular size of the kernel - 8KB it runs perfectly but as it gets just a little over 8KB, it starts behaving abnormally. The clear screen function doesn't work, the scrolling function doesn't work etc.

I am using the bochs emulator with a 1.44MB floppy configuration.

My code working correctly is -

#include "functions.h"
#include "stdint.h"
#include "stddef.h"
#include "../drivers/colors.h"

void delay();
char getScancode();

void main()
{
    /*Declarations*/
    char* str = "Welcome to MyOS v0.2.4 By Anish Sharma 2017";
    char* status = "Welcome Anish Sharma";
    uint8_t i = 0;


    for(i=0;i<80;i++)
        putChar(' ',i,24,STATUS_COLOR);
    write_string_line(STATUS_COLOR,status,24);

    clrscr();
    print("The KERNEL has been loaded successfully at 0x1000 (memory address)");
    print(str);
    print(">>>");
    update_cursor(3,2);
    for(i=0;i<80;i++)
    {
        putChar(0xdb,i,3,i);
    }
    for(i=0;i<80;i++)
    {
        putChar(0xdb,i,4,i);
    }
    for(i=0;i<80;i++)
    {
        putChar(0xdb,i,5,i);
    }
    for(i=0;i<80;i++)
    {
        putChar(0xdb,i,6,i);
    }
    for(i=0;i<80;i++)
    {
        putChar(0xdb,i,3,i);
    }
}

The output is -

enter image description here

Adding just another -

for(i=0;i<80;i++)
{
    putChar(0xdb,i,3,i);
}

The output is -

enter image description here

Can anyone tell me what is causing this problem?

Anish Sharma
  • 314
  • 3
  • 18
  • how many sectors do you loads? why not just using the Bochs debugger anyway? – Margaret Bloom Jan 07 '17 at 09:58
  • Well I am reading 15 sectors – Anish Sharma Jan 07 '17 at 10:02
  • SO here lies the problem I would need to read the entire kernel ie 16 sectors. @MargaretBloom – Anish Sharma Jan 07 '17 at 10:03
  • Glad you find the issue. Allow me to remember you that "Why isn't this code working?" questions are off-topic on SO. You'll find the ability to debug your code on your own much more valuable that writing the code itself. – Margaret Bloom Jan 07 '17 at 10:05
  • I really don't know much about that debugger @MargaretBloom – Anish Sharma Jan 07 '17 at 10:07
  • [This will help](http://bochs.sourceforge.net/doc/docbook/user/internal-debugger.html). :) As a side note, beware that some BIOSes are not able to perform multitrack read, as you are approaching the sectors per track number of an HD 1.44 FD (i.e. 18), in case the loading stops abruptly, try separate reads. Though, Bochs firmware should not have such issue. – Margaret Bloom Jan 07 '17 at 10:15
  • @MargaretBloom : _"Why isn't this code working?"_ questions are on topic here **if** they meet some criteria _must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself._ . This particular question wouldn't meet that criteria because it doesn't provide the shortest code possible to reproduce it (MCVE). – Michael Petch Jan 07 '17 at 19:59
  • @MichaelPetch I'm very sure you know, just as I do, that for the set of tag we usually watch these kinds of questions almost never have the underlying academic aspect that the criteria you enumerated intended to catch. So few are the good exceptions that I feel no shame in sacrificing them in exchange for a lower number of LQ posts. Call me cynic. It's the year 2017. But thanks for correcting me, I never took the time pause and fully parse all the closing rule. My bad. :) – Margaret Bloom Jan 08 '17 at 08:00

0 Answers0