News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

My stupid OS is not working!!

Started by thomasantony, January 06, 2005, 02:29:58 PM

Previous topic - Next topic

thomasantony

Hi,
   I am continuing my 32-bit OS. The keyboard ISR was working all right. I added a getch function and that too worked well. Then I started adding command handling. Then all the hell broke loose. The characters are not even being displayed now!! Hellp!!! :(

Thomas Antony

[attachment deleted by admin]
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

Robert Collins

Is this a DOS program? I noticed in your code you have 'int nn' instructions. I might be wrong but I think you do not have or use interupt calls in Win32 assembly. Correct me if I am wrong. 

P1

Note: I changed the title.

Let me enourage you in that, all worth while project(s) goes through phases like this.

At first Linux was a joke, now M$ thinks it's serious competition, to spend money for propaganda against it.

I don't the time to look at your code.  But remember, code is like eating a big meal.  You got to do it, a byte at a time.

Regards,  P1  :8)

Statix Star

P1,

It's ok if he wants to improve his skills; to save poor people from buying M$ too expensive.

Thomas Anthony,

You're young, P1 it's understimating because you might make M$ fall. Kidding, anyways to start an Os you need to have a lot of
recruits to make it. Why not merge into a FREEWARE OS? If you want to improve your skills then go. But remember, everyone is
better than one. Also don't support SUN; their products had such weird run-times. They might demolish MS and Assembly all the
micro-processors lost. Nano-tech it's going to be smaller than micro-chips. Worthy OS are for those who have lots of people working
that doesn't have to do with MS and SUN. Imagine, a FREE school; is having better students than private ones. Not open source,
this misc guys will take credit over it. XP it's not so bad, they did publish compilers from C Toolkit and Masm. You see, MS still hasn't
betray the optimize native running. Instead of gaining all the credits; they are giving charity, making friends to learn MS tools.
That's why they publish PSDK.
Sun is out of the league, they're just being stubborn. Let's hope that SUN start making the nano computers like MS is doing with their OS. So, they don't need to fight and also, become friends. :clap: 

thomasantony

Hi,
   The ints I use are defined in my IDT. They are like a syscall. And I am making this OS as a hobby. So plz look at my code and see whats wrong.

[attachment deleted by admin]
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

thomasantony

Hi,
   I finally found whats wrong!! Its really silly. I wasn't reading in enough sectors in the boot loader. The kernel was more than 7 sectors long and I was loading only 5 sectors!! I have fied it now!!

Thomas Antony

[attachment deleted by admin]
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free


thomasantony

Hi,
   Statix Star, Thanx for the links. I will check them out. I have made my 32-bit OS upto the level of my old 16-bit kernel, i.e, with some basic command handling. I suppose I should work on the memory management now. I am using paging. I wrote a proc to enable paging but it resets the Cpu just like that. It doesn't even throw an Exception. Please tell me what is wrong with the code. It is NASM code.


%define PAGE_DIRECTORY 09C000h
%define PAGE_TABLE 09D000h

Init_Paging:
cli
xor ecx,ecx
xor edx,edx
; mov byte[ds:0B8070h],'P' ; some indicators to show me
; mov byte[ds:0B8071h],02h ; where it is not working
@pg_loop1:
cmp ecx,1024
je @pg_1
mov eax,edx
or eax,3 ; set supervisor, read/write
mov dword[PAGE_TABLE+ecx*4],edx

add edx,4096
inc ecx
mov byte[ds:0B8074h],'P'
mov byte[ds:0B8075h],cl
jmp @pg_loop1
@pg_1:
mov eax,PAGE_TABLE
or eax,3
mov [es:PAGE_DIRECTORY],eax

mov ecx,1
mov byte[ds:0B8078h],'P'
mov byte[ds:0B8079h],0Dh
@pg_loop2:
cmp ecx,1024
je @pg_2
mov dword[PAGE_DIRECTORY+ecx*4],02h ; 010 binary supervisor, not present
inc ecx
jmp @pg_loop2
@pg_2:
xor eax,eax
mov cr3,eax
mov byte[ds:0B8082h],'P'
mov byte[ds:0B8083h],0Eh

mov eax,[es:PAGE_DIRECTORY]
mov cr3,eax

mov eax,cr0
or eax,80000000h
mov cr0,eax ; <------------this resets the CPU !!

mov byte[ds:0B8082h],'P'
mov byte[ds:0B8083h],0Eh

ret

Thomas Antony
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

thomasantony

Hi,
  I got it to work. There was a probelm in moveing the address into cr3. Anyway, I want to load my kernel to the 1mB mark. That is 100000h right. how do I do this using 16 bit int 13h b4 going into pmode. Do I use 1000h:0000 as the address?

Thomas Antony
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

Tedd

That should work, but note there are ROMs around that area, so it's not very safe to do so. I would put it somewhere much lower, there's plenty of space from 1000h all the way up to 9FFFh :U (above this are used for vga, cga, rom shadows, power management, etc)
No snowflake in an avalanche feels responsible.

MichaelW

Hi Thomas,

If you need to load it at the 1MB mark from real mode, then I think you should take advantage of the so-called High Memory Area (HMA). The HMA is a 65,520 byte block of extended memory that can be accessed from real mode in the address range FFFF:0010 to FFFF:FFFF. The HMA is 65,520 bytes in length instead of 65,536 bytes because the logical addresses FFFF:0000 to FFFF:000F and F000:FFF0 to F000:FFFF represent the same physical addresses. The HMA is accessible only when the 21st address line (A20) is enabled. If the A20 address line is disabled, then by design addresses FFFF:0010 to FFFF:FFFF "wrap" to the beginning of memory.
eschew obfuscation

Mark_Larson


  This might be a dumb question.  But almost all the hobby OSes I haves seen use paging.  Why?  Why not just use 32-bit protected mode?  It's faster than using paging anyways.
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

Tedd

Mark, the point is that until you get into 32-bit PM, you're stuck with whatever mode the cpu is currently in. That happens to be 16-bit segmented. As for paging, it's an option whether to use it or not, but virtual memory is difficult without it, and without virtual memory you're lacking in usable memory.
No snowflake in an avalanche feels responsible.

Mark_Larson


  AHhh,  I gotcha.  I forgot about virtual memory.  I am spoiled.  I have 2GB in my system.
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

thomasantony

Hi,
   Suppose I load the OS at 0FFFFh:0010h using int 13h. Then I switch to PMode in the bootloader itself. Then what offset should I jump to to get to the kernel? Also I have made a scrolling function(video.asm) that is not working very well. Plz check it out.

Thomas Antony

PS: Somebody said most OSes don't go beond the bootloader. Well mine has come a long way already. I was stumped once when the keyboard ISR didn't work. But now it is goign ok. This OS is a sort of a challenge for me.
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free