News:

Facebook killed the radio star. And by radio star, I mean the premise of distributed forums around the internet. And that got got by Instagram/SnapChat. And that got got by TikTok. Where the fuck is the internet we once knew?

Main Menu

JoeOS: I'm gonna try some OS Development

Started by Joe, June 16, 2005, 10:19:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joe

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?
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


rabbit

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.

Joe

Seriously? Because I just talked to him last night, and hes on AIM right now (not responding).

EDIT -
Well he was on earlier.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Joe

#3
JoeOS rocks out loud. It doesn't do a single damned thing, but loop infinitly. It rocks!

[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.

[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
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Sidoh

Uhm, what the hell? Why do all your comments say "we?" Do you program with a turd in your pocket? :D

RoMi

He has been assimilated into the computer, your resistance is futile.
-RoMi

Joe

#6
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!"
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Nate

#7
-----

Joe

#8
Omg, it printed JoeOS to the screen. I am totally the worlds most awesomest hacker!

[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!
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Warrior

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

Warrior

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

Joe

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?
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Warrior

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

Joe

Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Blaze

*Hurrys up and tries to finish his asm book*
And like a fool I believed myself, and thought I was somebody else...