Author Topic: JoeOS: I'm gonna try some OS Development  (Read 31243 times)

0 Members and 1 Guest are viewing this topic.

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
JoeOS: I'm gonna try some OS Development
« on: June 16, 2005, 10:19:50 am »
Well, Warrior got somewhere, I guess..

I've been slacking off on learning ASM, and frankly I want to learn it. Also, with learning PHP and Java, I should know enough of the common syntax to slack my way though a bit of C++, so here I go. I found some online tutorials, and I probably have the entire source code to OptimaOS seeing as how Warrior always lobs it at me over AIM (<3), so I'm gonna give it a shot. I've got my old Compaq Presario CDS 520, now named poptart (Thanks Ergot!) as a test box, because MS VPC hates me. I'll let you guys know how it goes.

EDIT -
I now understand why they said we'll be hitting our heads against the wall for the majority of the time. Where the fuck is Warrior?
« Last Edit: June 19, 2005, 06:30:53 pm by zorm »
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: I'm gonna try some OS Development
« Reply #1 on: June 16, 2005, 05:04:33 pm »
Some powercord of his was being retarded and overheated randomly.  He had to send in is faulty "modem" to get a new power cord.  He'll be back soon.

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: I'm gonna try some OS Development
« Reply #2 on: June 16, 2005, 05:22:22 pm »
Seriously? Because I just talked to him last night, and hes on AIM right now (not responding).

EDIT -
Well he was on earlier.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: I'm gonna try some OS Development
« Reply #3 on: June 16, 2005, 07:48:12 pm »
JoeOS rocks out loud. It doesn't do a single damned thing, but loop infinitly. It rocks!

Code: [Select]
[BITS 16]             ;This tells us we are using 16 Bits
[ORG 0x7C00]          ;We need to tell it the origin now

start:
jmp $

times 510-($-$$) db 0 ;This fills the rest of unused space with 0s
dw 0xAA55             ;Now our signature

Warrior's holding my hand through displaying "JoeOS" to the screen. So far we haven't even mastered the J yet. I mean, its displaying and all.. its just not.

Code: [Select]
[BITS 16]             ;This tells us we are using 16 Bits
[ORG 0x7C00]          ;We need to tell it the origin now

start:

     xor ax, ax ; Make AX = 0
     mov cs, ax ; Setup our registers
     mov ds, ax ; Setup our registers
     mov es, ax ; Setup our registers
     mov fs, ax ; Setup our registers
     
     mov ah, 0Eh
     mov al, 'J'
     mov bh, 0
     mov bl, 0x07
     int 10h
     
jmp $

times 510-($-$$) db 0 ;This fills the rest of unused space with 0s
dw 0xAA55             ;Now our signature
« Last Edit: June 16, 2005, 08:01:40 pm by Joe[x86] »
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: I'm gonna try some OS Development
« Reply #4 on: June 16, 2005, 07:53:29 pm »
Uhm, what the hell? Why do all your comments say "we?" Do you program with a turd in your pocket? :D

Offline RoMi

  • x86
  • Hero Member
  • *****
  • Posts: 502
  • gg no re
    • View Profile
Re: I'm gonna try some OS Development
« Reply #5 on: June 16, 2005, 08:01:56 pm »
He has been assimilated into the computer, your resistance is futile.
-RoMi

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: I'm gonna try some OS Development
« Reply #6 on: June 16, 2005, 08:02:24 pm »
No, but Warriors holding my hand, in a non gay way. Hes giving me the comments to put in there anyhow. =).

EDIT -
I got my J.
(18:14:39) [x86] Warrior: OK U GOT A JAY
(18:15:45) [x86] Joe: YES I DID
(18:15:51) [x86] Joe: AND I GOT MY BRO TO COME LOOK AT IT!
(18:16:15) [x86] Joe: "Thats really really really gay!"
« Last Edit: June 16, 2005, 08:09:32 pm by Joe[x86] »
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Nate

  • Full Member
  • ***
  • Posts: 425
  • You all suck
    • View Profile
Re: I'm gonna try some OS Development
« Reply #7 on: June 16, 2005, 08:56:47 pm »
-----
« Last Edit: July 11, 2006, 06:25:19 pm by Nate »

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: I'm gonna try some OS Development
« Reply #8 on: June 16, 2005, 08:57:51 pm »
Omg, it printed JoeOS to the screen. I am totally the worlds most awesomest hacker!

Code: [Select]
[BITS 16] ;This tells us we are using 16 Bits
[ORG 0x7C00] ;We need to tell it the origin now

  start:

    ;xor ax, ax ; Make AX = 0
    ;mov cs, ax ; Setup our registers
    ;mov ds, ax ; Setup our registers
    ;mov es, ax ; Setup our registers
    ;mov fs, ax ; Setup our registers

    mov ah, 0Eh
    mov bh, 0
    mov bl, 0x07
    mov al, 'J'
    int 10h
    mov al, 'o'
    int 10h
    mov al, 'e'
    int 10h
    mov al, 'O'
    int 10h
    mov al, 'S'
    int 10h

  jmp $

times 510-($-$$) db 0 ;This fills the rest of unused space with 0s
dw 0xAA55 ;Now our signature

Now, when Warrior gets back from playing CS, I'm going to make it print colored strings!
« Last Edit: June 16, 2005, 09:00:50 pm by Joe[x86] »
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: I'm gonna try some OS Development
« Reply #9 on: June 16, 2005, 09:18:23 pm »
That's a very crappy way of printing strings :P

You should also note that in the bootloader as I have told you before you are limited to 512 bytes in which you must load a second stage using the int 0x13 and read however many sectors you want to whatever location in the memory you want.

In the second stage you should prepare to enter protected mode: Enable the a20 line so that you can access the full 4GB in protected mode, setup atleast 3 GDT entries (Null, Code, Data), set the lower bit in cr0, then do a far jump to set CS. Once you're in protected mode you can either load an additional GDT (since the usefulness of your bootloader's GDT can be doubted for some reason) or use the one from before. Then you must handle request for Interrupts and distinguish which ones are exceptions and which are interrupts. This is done by setting up the IDT and handling ISRs. Once you have a *strong* exception handler (you can print registers). I'd work on polling port 0x60 every time you recieve IRQ6 (keybord) for the current character then using a scan code to convert it to ASCII. At this point you can either implement your own variant of "printf" and start implementing your library, or do what I did and setup a sort of driver manager to manage requests for notification of drivers.

Like so:

ServiceA(console) requests Keyboard Notification
ServiceB(someotherservice) requests Keyboard Notificiation

Keyboard IRQ Handler recieves interrupt:
Sends to all of the currently "registered" services for the Driver

Advantages of this: You don't have to have a lot of code in your IRQ handler, just something to dish out whatever needed.

Additionally having an app be able to request scancodes "on the go" using some sort of getkb(int num) to read each character and format it into a string then return when the number is met.

After this I'd implement a scheduler and maybe pre-emptive multitasking whichever then have some kernel level tasks working and swithing first before you move to User Level.

Anything after that is up to you:
Possibly some sort of VFS compatiblity layer? Maybe just run on to implementing something like NTFS or ext2?
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: I'm gonna try some OS Development
« Reply #10 on: June 16, 2005, 09:19:49 pm »
Due to preference you may want to switch over to fasm which has basicly the same syntax of NASM but better error reporting and macros.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: I'm gonna try some OS Development
« Reply #11 on: June 16, 2005, 09:23:53 pm »
Your entire post went right over my head Warrior. Get back on AIM so we can take it nice and slow. Ugh, that sounds discusting. =p

EDIT -
I googled FASM. Am I looking for the flat assembler?
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: I'm gonna try some OS Development
« Reply #12 on: June 16, 2005, 09:27:30 pm »
Yep.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: I'm gonna try some OS Development
« Reply #13 on: June 16, 2005, 09:28:51 pm »
Good. GET ON AIM!
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: I'm gonna try some OS Development
« Reply #14 on: June 16, 2005, 10:46:18 pm »
*Hurrys up and tries to finish his asm book*
And like a fool I believed myself, and thought I was somebody else...