Author Topic: Operating System Development  (Read 3803 times)

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Operating System Development
« Reply #15 on: 16 November 2002, 06:02 »
Actually use Freedos its opensource!

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Operating System Development
« Reply #16 on: 16 November 2002, 06:08 »
quote:
Originally posted by Stryker:
i used to make programs with quickbasic (is it the good old days, or is it the undeducated days?) to make those .com files, anyone know if it uses dos interrupts? i made some pretty cool graphics programs, there would be an interesting operating system. i'll give it a shot.


That depends on if you call DOS interrupts in your assembly program or not. In assembly it's not going to use *anything* you do not write. If you call a DOS interrupt your program will use DOS interrupts. If you call a BIOS interrupt your program will use BIOS interrupts. And I can guarantee you that if you write your assembly program in Linux it will not contain DOS interrupts. Remember, it's one line of code for one processor instruction. You certainly will not be able to create a program like this in quickbasic.      

Maybe you are not ready for this. You might try something like X11 said and use a boot disk using a boot loader of another OS (doesn't have to be Microsoft). Then you can write your program in C or C++ and have it autoload when you boot the floppy. You could use FreeDOS and stick with that crappy DOS/WIN type of environment or you could use Linux or FreeBSD to create programs and your disk.

[ November 15, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Operating System Development
« Reply #17 on: 16 November 2002, 12:32 »
Found a couple of interesting links. The Win95 boot sector assembly code (reverse engineered, comments are great!):
http://www.singlix.com/trdos/win95_boot_sector.asm

Linux 2.0 boot sector code:
http://www.singlix.com/trdos/Linux%202_0%20Boot%20Sector.html

But this one might be the mother link which tells you how to use GCC (C) to make plain binary executable code that can be booted directly from a boot sector:
http://www.nondot.org/~sabre/os/articles/TheBootProcess/

In effect allowing you to boot your code without the help of any other code from any other vendor (not counting the code within your hardware). I think this is what you were asking to do in the first place.

And if you want to look at the boot sector source on your currect kernel, if you have the kernel source installed you will find it here:

/usr/src/linux*/arch/i386/boot/bootsect.S

*.S files contain assembly code that must be preprocessed. I just looked at the Makefile and here are the commands that you would use to turn that source into a binary executable boot sector that can be written to the first sector of a floppy or hard disk partition:

Code: [Select]

You should now find a file called "bootsect" which is exactly 512 bytes long and can be written to floppy with "dd if=bootsect of=/dev/fd0". Of course by itself it won't do much, probably just hang your system.

You might want to look at the comments within the other *.S files that are located in the same directory. There are only a few small files that are responsible for loading/running the kernel. You will need to know a little assembly in any case. Fortunately it doesn't take much.

[ November 16, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Operating System Development
« Reply #18 on: 16 November 2002, 13:32 »
Basically this boot sector code is 32 bit extension for a 16 bit patch to
an 8 bit boot sector originally coded for a 4 bit microprocessor, written
by a 2 bit company, that can't stand 1 bit of competition.


How would i go about compiling this is tasm?

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Operating System Development
« Reply #19 on: 16 November 2002, 13:53 »
You wouldn't compile it. But you might assemble it.  
Someone please remove this account. Thanks...

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Operating System Development
« Reply #20 on: 16 November 2002, 13:59 »
Oh yeah, thats what i ment

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Operating System Development
« Reply #21 on: 16 November 2002, 14:11 »
The instructions are right in the source between the 2 bit company and the top of the file:

C:> tasm win95 /m
C:> tlink win95,win95.bin /t
Someone please remove this account. Thanks...

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Operating System Development
« Reply #22 on: 16 November 2002, 14:49 »
Sorry i ment nasm, the one that comes with Red-Hat

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Operating System Development
« Reply #23 on: 16 November 2002, 23:43 »
You would have to do a little rewriting to assemble it with "nasm". This code is written in TASM format.  Look over that other link with nasm bootstrap examples. It shouldn't take much to convert it to nasm format:

http://www.nondot.org/sabre/os/files/Booting/nasmBoot.txt
Someone please remove this account. Thanks...