![]() |
| ||
| Simple Operating System since im new here and this is my first post........ i started programming as a freshman (im now a sophmore) with VB, and have since, i and my teachers feel, have mastered that, tought myself C and am pretty accomplished in that language. I am working on the object oriented part of C. I am looking to create an operating system, have done some reasearch and found most say to use Assembely or a mix of assembely and C/C++. I have gone through a few assembely tutorials, and am completely ready and willing to spend a few years on this project if necessary. I have at my disposal a development envoriment consisting of a development machine and a test machine, and a way to transfer files between the two, but they are not directly linked. now that you have a slight background and know what i am capable of doing/learning here is my question. I would like to create a simple operating system for the x86 platform that will boot up the machine, check to see if a cd is in the cd-rom drive, if so, execute the code (mostlikely in C) from the CD, if not, execute some default code (again, mostlikely C) that will bring up a screen which i can code myself. wow, there really is no question in there......i guess what i want is to know is if there is an os out there that does this, or something close to this that i could modify. if not then how should i go about starting with this, and any help is apprecieated lol, hope i came across as clear |
| ||
| Re: Simple Operating System Quote:
BUT a floppy disk method is VERY easy, for just one, or two seperate floppy disk drives, i can send you code for a boot loader for fdd if you want? |
| ||
| Re: Simple Operating System Quote:
|
| ||
| Could I get a copy of the boot loader too? My email is jth_92@yahoo.com. Thanks. |
| ||
| sorry to dissappoint Its been ages since I did assembler, I had a simple notepad with save on same disk (no files, just a random permemenant spot of data), a bitmap file loader&display, serial debug terminal, robotics control (via parallel port), ect ect Before i ramble on about INT13 you have to understand what disk(0) means and what wiping out your bootsector does, means, and how to backup/restore it without loosing ALL the files on your hdd!!!!! i reccomend testing this on a computer with the hdd disconnected COMPLETELY. (so if it attempts to wipe the hdd, it will only give you an error?) Be warned. That was WAY back a while. There was a fire that took my hard drive AND my fucking backup! ughh! It wasnt terribly difficult, first you need to practise copying from hard drive to memory (use BIOS interupt 13h to copy your instructions from disk to memory) then move instruction execution pointer to the start of that address, DONT FORGET REGISTERS! lol once your there you can add program objects and a command interpreter (hint, model it on a "notepad" first, then add the actual interaction) but as always remember to save and restore registers (and instruction execution pointer?) after every program /begenning of interupt, and yes you CAN write your own interupts, but i have no clue how (DOS has a few) here is an unfinished (and untested) example i just pulled from (g)oogle real quick, it'll work because i recognise it's code, but you'll probably have to know basic assembler and registers ect... mov ah, 2 ; function 2, read sectors mov al, 1 ; read 1 sector mov ch, 0 ; track 0 mov cl, 0 ; sector 0 mov dh, 0 ; head 0 mov dl, 0 ; drive 0 (A:) (0=A, 80h = driv 0, 81h = drive 1) mov bx, offset buffer ; where to put the data (ES:BX) int 13h then you just need to execute the data in the buffer! :) NOTE ABOUT BOOT DISKS: im not sure about hdds, but with floppys and probably hdds too, you need to make sure a specific two bytes on the disk are set to a specific value in order for the BIOS to even ATTEMPT to copy&load the bootsector. very important. hope that helps! and good luck with your projects! NOTE: example is taken from http://www.programmersheaven.com/mb/...3h-service-02/ i make no claim to rights of blah blah blah ..... want me to take down?, PM me :P |
| ||
| Quote:
http://geezer.osdevbrasil.net/osd/code/ Tony |
| ||
| Func AH=2 INT 13h Disk Services: CH=Low eight bits of cylinder number CL=Sector number should start at 1 bits 6-7 represent two high bits of cylinder number (hard disk only). So the MBR would be at Cylinder/Track 0 head 0 Sector 1 "NOTE ABOUT BOOT DISKS: im not sure about hdds, but with floppys and probably hdds too, you need to make sure a specific two bytes on the disk are set to a specific value in order for the BIOS to even ATTEMPT to copy&load the bootsector. very important." This is true for floppy disks too. These two bytes are at offsets 510 - 511 (offsets relative to 0) and is a WORD which contains AA55 or a byte at a time 55-AA these are the last two bytes of the 512 byte boot sector, your bootloader must fit within 512-2 bytes or else it will have to load the rest from another part of the drive itself. Even in the documentation I have the track/cylinder seem to have the same meaning - but I read in MS-DOS encyclopedia that cylinder actually refers to the number of like numbered sectors on the drive. Learning how operating systems work or are implemented for a particular architecture can be qwite educational, x86: A 16-bit operating system is pretty straight forward, besides device drivers which require proprietary information lest the primitive services of the BIOS are used to create the drivers, and managing a file system on a harddisk, it uses the same parts of the architecture for implementing services for programs and managing them as do the applications which it serves. 32-bit architecture is not as straight forward, there are parts of it reserved for system programs, and several system data structures used by the CPU. It is more complicated. No reason to be discouraged at all though. Older DOS systems I believe had a bootloader on the MBR which contained a partition table with information on partitions on the drive and which was bootable. The MBR also contained the BIOS Parameter Block. The first sector of the bootable partition was loaded into memory and executed. Good day... [[AxxXx3BBbLbLLLaAzXxZiO]] |
| All times are GMT -4. The time now is 4:46 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC