flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > End of RhynOS Goto page 1, 2, 3 Next |
Should I scrap RhynOS? | ||||||||||||||
|
||||||||||||||
Total Votes : 7 |
Author |
|
Artlav 14 Oct 2006, 12:43
Over the last 6 years i developed and scrapped 12 distinctly diffirent versions of Aprom OS - 6 BE, 2 PE and 4 AE ones.
Each time the scrap happend at the point, when the old idea reached its limit, and was incapable of supporting newer ideas. Simply put, each time i learned something new. So, just put it into history directory, and move on. About ISRs - make 3 stubs - IRQ primary IRQ secondary and ISR, and define the IDT in such a way, that all int's is going into the stubs. Then add your interrupts. Don't store the IDT in raw form - assemble it at run-time. About kernel size - try making a non-kernel system, when you got a loader, that will link together a set of modules into a functioning system (i call it "dissolving kernel"). |
|||
14 Oct 2006, 12:43 |
|
smiddy 14 Oct 2006, 13:17
rhyno_dagreat wrote: The thing that made my old OS bloated was the interrupt code (ISRs & IRQs, IDT, Remapping interrupts, etc). So, right now I am wondering if there is a way I can write my OS so that all I have in my IDT only the Keyboard and Timer interrupts, as well as only those IRQs, or do I have to do everything linearly? Also, I know many of you (Dex4U, Niels, Artlav, etc.) have seen my code, and have seen how big the interrupts.inc has gotten. I know in the future I will need ISRs, and was wondering if there was a way that I can make only the few ISRs I will need, skipping the elongated Intel Reserved ones. I haven't tried this, so your mileage may vary, but I suspect you can reserve memory for your entire IDT (all 256 intterupts). You can make a routine to populate it with your general interrupt handler (or unhandled interrupt), then populate it with your drivers for timers, keyboard, OS API, etcetera. I suspect that would releive much of bloat from your actual executeable. I suppose you could do the same for GDT, but normally that is a pretty small (in comparison) table, unless you're using many TSS' for task switching, then I think you may want to reserve in code and populate at runtime. Just thoughts... |
|||
14 Oct 2006, 13:17 |
|
Niels 14 Oct 2006, 14:42
Hello rhyno_dagreat,
If I was convinced that you really wrote the 'OS', I would have said, before you start over again find your mistakes, otherwise only luck will make a difference to the same story and luck is not a constant, its something that happens when you did the right things. Niels. |
|||
14 Oct 2006, 14:42 |
|
Niels 14 Oct 2006, 15:08
If you save at different progress points, in seperate files, you will have the advantage of at least two things:
First, when you re-use own crafted code, you still will be able to know what you are doing. Second, when the code is not functioning properly, you can make spagetti to make it work and learn from it. Niels. |
|||
14 Oct 2006, 15:08 |
|
Dex4u 14 Oct 2006, 18:37
My advice to you is use the kiss method, so the first thing to do is for now is use a bootloader that loads a com or exe file, this makes things simplee, heres a good one
http://alexfru.chat.ru/epm.html#bootprog By using this you can put your kernel on the floppy like any other program, also using this method you can run your OS from Dos. Another thing is do not be into much of a hurry to make your OS, as i started in OS dev by making bootable programs eg: games, cdplayers etc. From this you learn a lot, which is the main point for deving your own OS. Good luck. PS: @Niels, To lean is to copy, what other way is there to lean ?. |
|||
14 Oct 2006, 18:37 |
|
Niels 14 Oct 2006, 19:01
@Dex4u; To learn does not equals To copy, please observe and notice, discover the iddle. U there yet?
|
|||
14 Oct 2006, 19:01 |
|
rhyno_dagreat 14 Oct 2006, 20:07
Thank you all for your input. I shall keep the old sourcecode to learn from and find mistakes in, and basically use it for learning where I went wrong and fixing, and also optimizing.
@Dex4u - I was actually considering doing something like that. The only thing in my mind now that I'm wondering is can I still go with just BIOS interrupts? @Niels - In this particular sub-division of programming, how else can you really learn? It's not like there's hundereds of different books out there on "How to create your own OS." Especially in ASM. |
|||
14 Oct 2006, 20:07 |
|
sylwek32 14 Oct 2006, 20:09
Hey rhyno,
can you publish the rhynOS sourcecode here? |
|||
14 Oct 2006, 20:09 |
|
rhyno_dagreat 14 Oct 2006, 20:18
Sure, give me a moment.
RHYNLOAD.ASM Code: ;BOOTSTART org 7C00h jmp start message db 'Loading RhynOS...',13,10,0 start: xor ax, ax mov ds, ax mov si, message call bios_print load_os: mov ax, 0060h mov es, ax mov bx, 0000h mov ah, 02h mov al, 5 mov ch, 0 mov cl, 2 mov dh, 0 ;mov dl, 0 ; Not sure if needed, been told that dl already contains the drive that was booted on int 13h jmp 0060h:0000h bios_print: lodsb or al, al jz done mov ah, 0x0E int 0x10 jmp bios_print done: call load_os ;BOOTEND times 510-($-$$) db 0 dw 0xAA55 RHYNOS.ASM Code: org 0000h use16 cli mov ax, 0060h mov ds, ax add dword [gdt_descriptor+2], 600h lgdt [gdt_descriptor] mov eax, cr0 or eax, 1 mov cr0, eax jmp 08h:clear_pipe gdt: dd 0, 0 gdt_code: db 0FFh, 0FFh, 0, 0, 0, 10011010b, 11001111b, 0 gdt_data: db 0FFh, 0FFh, 0, 0, 0, 10010010b, 11001111b, 0 gdt_end: gdt_descriptor: dw gdt_end - gdt - 1 dd gdt org 0600h+$ use32 clear_pipe: mov ax, 10h mov ds, ax mov ss, ax mov esp, 090000h ;ACTUAL KERNEL CODE STARTS HERE mov si, WelMsg call PrintFunc call Reroute_PICs lidt [idtp] push ax mov al, 0 out 0A1h, al out 21h, al sti pop ax GetInput: int 0x21 cmp al, 02 je DoClrScrn jmp GetInput DoClrScrn: call ClrScrn call CmdPrintFunc ;KERNEL CODE ENDS HERE infinite_loop: jmp infinite_loop times 546-($-$$) db 0 include 'interrupts.inc' WelMsg db "Welcome to RhynOS! Press 1 To Continue.", 0 INTERRUPTS.INC Code: ;INTERRUPTS!!! YAY PrintFunc: mov ax, 10h mov ds, ax mov ebx, 0B8000h strloop: lodsb mov byte [ds:ebx], al inc ebx mov byte [ds:ebx], 1Bh cmp ax, 0 je done inc ebx inc ax jmp strloop done: ret ClrScrn: mov ax, 10h mov ds, ax mov ebx, 0B8000h mov ax, 0 clrloop: cmp ax, 2000 je done mov byte [ds:ebx], ' ' inc ebx mov byte [ds:ebx], 1Bh inc ebx inc ax jmp clrloop CmdPrintFunc: mov ax, 10h mov es, ax mov edi, 0B8000h xor eax, eax cmdloop: int 0x21 cmp al, 1Ch je done mov esi, eax mov cl, [esi+KeyBoard] mov byte [es:edi],cl inc edi mov byte [es:edi], 1Bh inc edi jmp cmdloop Reroute_PICs: ;send ICW1(Interrupt Control Word1) mov al, 11h ;out PIC1, ICW1 out 20h, al ;out PIC2 ICW1 out 0A0h, al ;send ICW2 mov al, 20h ;out PIC1 + 1, IRQ0 start point out 21h, al mov al, 28h ;out PIC2 + 1, IRQ8 start point out 0A1h, al ;send ICW3 ;IRQ2 to Connection to Slave PIC mov al, 04h out 21h, al mov al, 02h out 0A1h, al ;send ICW4 mov al, 01h out 21h, al out 0A1h, al ;disable IRQs mov al, 0FFh out 0A1h, al out 021h, al ret isr0: pusha push gs push fs push ds push es mov si, Err00 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr1: pusha push gs push fs push ds push es mov si, Err01 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr2: pusha push gs push fs push ds push es mov si, Err02 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr3: pusha push gs push fs push ds push es mov si, Err03 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr4: pusha push gs push fs push ds push es mov si, Err04 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr5: pusha push gs push fs push ds push es mov si, Err05 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr6: pusha push gs push fs push ds push es mov si, Err06 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr7: pusha push gs push fs push ds push es mov si, Err07 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr8: pusha push gs push fs push ds push es mov si, Err08 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr9: pusha push gs push fs push ds push es mov si, Err09 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr10: pusha push gs push fs push ds push es mov si, Err10 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr11: pusha push gs push fs push ds push es mov si, Err11 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr12: pusha push gs push fs push ds push es mov si, Err12 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr13: pusha push gs push fs push ds push es mov si, Err13 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr14: pusha push gs push fs push ds push es mov si, Err14 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr15: pusha push gs push fs push ds push es mov si, Err15 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr16: pusha push gs push fs push ds push es mov si, Err16 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr17: pusha push gs push fs push ds push es mov si, Err17 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr18: pusha push gs push fs push ds push es mov si, Err18 call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr19: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr20: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr21: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr22: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr23: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr24: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr25: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr26: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr27: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr28: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr29: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr30: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret isr31: pusha push gs push fs push ds push es mov si, ErrRes call PrintFunc cli hlt pop es pop ds pop fs pop gs popa iret irq0: mov si, TimerEnabled call PrintFunc mov al, 20h out 20h, al iret irq1: pushad push es push ds in al, 60h mov byte [ScanCode], al mov al, 20h out 20h, al pop ds pop es popad mov al, byte [ScanCode] iret idt_start: ;Interrupt Example ; dw start_address ; dw code_selector where ISR is being held ; dw type_settings for ISRs ; dw start_address2(bits 31-16) ; start_address2 should be 0 because the ; start address should be no more than 1 ; word value. ;FOR HISTORIC REFERENCE PURPOSES ONLY ;Original ISRS looked like the following ; ;dw 0x0000 ;dw 0x08 ;dw 0x8E00 ;dw 0x08 ; ;END OF HISTORIC REFERENCE ;SERVICE REQUEST INTS ;int0 dw isr0 dw 0x08 dw 0x8E00 dw 0x0 ;int1 dw isr1 dw 0x08 dw 0x8E00 dw 0x0 ;int2 dw isr2 dw 0x08 dw 0xE00 dw 0x0 ;int3 dw isr3 dw 0x08 dw 0x8E00 dw 0x0 ;int4 dw isr4 dw 0x08 dw 0x8E00 dw 0x0 ;int5 dw isr5 dw 0x08 dw 0x8E00 dw 0x0 ;int6 dw isr6 dw 0x08 dw 0x8E00 dw 0x0 ;int7 dw isr7 dw 0x08 dw 0x8E00 dw 0x0 ;int8 dw isr8 dw 0x08 dw 0x8E00 dw 0x0 ;int9 dw isr9 dw 0x08 dw 0x8E00 dw 0x0 ;int10 dw isr10 dw 0x08 dw 0x8E00 dw 0x0 ;int11 dw isr11 dw 0x08 dw 0x8E00 dw 0x0 ;int12 dw isr12 dw 0x08 dw 0x8E00 dw 0x0 ;int13 dw isr13 dw 0x08 dw 0x8E00 dw 0x0 ;int14 dw isr14 dw 0x08 dw 0x8E00 dw 0x0 ;int15 dw isr15 dw 0x08 dw 0xE00 dw 0x0 ;int16 dw isr16 dw 0x08 dw 0xE00 dw 0x0 ;int17 dw isr17 dw 0x08 dw 0xE00 dw 0x0 ;int18 dw isr18 dw 0x08 dw 0xE00 dw 0x0 ;int19 dw isr19 dw 0x08 dw 0xE00 dw 0x0 ;int20 dw isr20 dw 0x08 dw 0xE00 dw 0x0 ;int21 dw isr21 dw 0x08 dw 0xE00 dw 0x0 ;int22 dw isr22 dw 0x08 dw 0xE00 dw 0x0 ;int23 dw isr23 dw 0x08 dw 0xE00 dw 0x0 ;int24 dw isr24 dw 0x08 dw 0xE00 dw 0x0 ;int25 dw isr25 dw 0x08 dw 0xE00 dw 0x0 ;int26 dw isr26 dw 0x08 dw 0xE00 dw 0x0 ;int27 dw isr27 dw 0x08 dw 0xE00 dw 0x0 ;int28 dw isr28 dw 0x08 dw 0xE00 dw 0x0 ;int29 dw isr29 dw 0x08 dw 0xE00 dw 0x0 ;int30 dw isr30 dw 0x08 dw 0xE00 dw 0x0 ;int31 dw isr31 dw 0x08 dw 0xE00 dw 0x0 ;HARDWARE INTERRUPT REQUESTS ;int32 dw irq0 dw 0x08 dw 0x8E00 dw 0x0 ;int33 dw irq1 dw 0x08 dw 0x8E00 dw 0x0 idt_end: idtp: dw idt_end - idt_start - 1 dd idt_start TimerEnabled db "Timer Interrupt Enabled!", 0 Err00 db "Error 00 - Division By Zero",0 Err01 db "Error 01 - Debug",0 Err02 db "Error 02 - Non Maskable Interrupt",0 Err03 db "Error 03 - Breakpoint Exception",0 Err04 db "Error 04 - Into Detected Overflow",0 Err05 db "Error 05 - Out of Bounds",0 Err06 db "Error 06 - Invalid Opcode",0 Err07 db "Error 07 - No Coprocessor",0 Err08 db "Error 08 - Double Fault",0 Err09 db "Error 09 - Coprocessor Segment Overrun",0 Err10 db "Error 10 - Bad TSS",0 Err11 db "Error 11 - Segment Not Present",0 Err12 db "Error 12 - Stack Fault",0 Err13 db "Error 13 - General Protection Fault",0 Err14 db "Error 14 - Page Fault",0 Err15 db "Error 15 - Unknown Interrupt",0 Err16 db "Error 16 - Coprocessor Fault",0 Err17 db "Error 17 - Alignment Check",0 Err18 db "Error 18 - Machine Check",0 ErrRes db "Error - Reserved",0 KeyBoard db 0, 0, "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", 0, 0, "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", 0, 0, "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", "`", 0, "\", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", 0, "*", 0 ScanCode db 0 |
|||
14 Oct 2006, 20:18 |
|
rhyno_dagreat 14 Oct 2006, 22:49
As for my interrupts question, I like what Artlav posted. I'm thinking of maybe making one interrupt (kind of like what DOS does) for several different functions. Maybe sort of copy DOS, in a sense. I find it kind of funny that they use the second interrupt, usually labeled the Keyboard interrupt, for many different things, depending on what value ax has.
|
|||
14 Oct 2006, 22:49 |
|
sylwek32 14 Oct 2006, 23:25
hello rhyno,
i am making some modifications with a friend in rhynos.. can you tell me how to make a disk image of it? |
|||
14 Oct 2006, 23:25 |
|
Dex4u 14 Oct 2006, 23:52
Niels wrote: @Dex4u; To learn does not equals To copy, please observe and notice, discover the iddle. U there yet? Lets start at the beginning, your in school, your teacher shows you the letter "A" and tells you what letter it is, you copy him/her, once you say it right, she/he tells you thats right, you go from there, to your teacher writing on the blackboard a letter say "A" again you then write it in your book (in other words you copy it into your book ), you go from there to copying your name and so on. Any teacher that teachers you something, does so by showing you how to do it and you copy it. Look at any tut on ASM, they show you a hello world code and tell you what each part does, you copy it, from there you may add other demos togeather some time they do not work, so you find out why, but at the same time you are learning. Please tell me how you can learn without copying . Maybe you could read this: http://www.copy--paste.org/copy-paste-culture.htm That what a expert is, someone who does something, that looks easy, untill you try to copy it and find its not so easy. This does not mean you always copy, but until you have leant the basics. |
|||
14 Oct 2006, 23:52 |
|
rhyno_dagreat 15 Oct 2006, 00:03
sylwek32 wrote: hello rhyno, Ah, this was a trick of my own invention, my friend! I wrote a program in C++ that did it for me... I'm going to post the C++ source so you can do it to. The code should be pretty much self explainatory.
|
|||||||||||
15 Oct 2006, 00:03 |
|
rhyno_dagreat 15 Oct 2006, 03:31
Because I'm trying to grow more accustomed to using the Intel Architectual Manuals, I was wondering if anyone could tell me if there's any information in them about rerouting the PIC chips. Thanks!
|
|||
15 Oct 2006, 03:31 |
|
Artlav 15 Oct 2006, 04:30
Dex4u wrote:
In an area of created knowledges, yes you mostly learn by copyig others. But look on inventors, for example - they don't copy, they create what you later going to copy. Artists - just take a pen and start learning to drawing without copying anyone. And teachers not always show you, how to do things, they might just tell you, that now you should know how to solve the problem, so solve it yourself. Something man-made, like alphabets, languages, mathematics can be learned only by copying others. Something natural, like laws of physics, logic, phylosophy can also be learned without copying anyone. |
|||
15 Oct 2006, 04:30 |
|
Artlav 15 Oct 2006, 04:35
[quote="rhyno_dagreat"]
sylwek32 wrote:
As good as i understood it, it just copy all 3 files into one, and trims it to the size of floppy? Why write a program for this, if you can just copy-append the files? (append option on overwrite prompt, or "copy /B aplo.boot+Info.bin+root.img emu\a.img"-like batch command) |
|||
15 Oct 2006, 04:35 |
|
rhyno_dagreat 15 Oct 2006, 04:39
[quote="Artlav"]
rhyno_dagreat wrote:
I was half asleep when I wrote that at the time (It was midnight), and also I was hoping I could have sort of a filesystem setup inside of it in the future, which it never came to be. Also, I'm not too familiar with system calls for that kind of thing, so yeah... |
|||
15 Oct 2006, 04:39 |
|
Niels 15 Oct 2006, 13:44
@Dex4u, The learning process is not the same as the copy process, when I would teach you math, I will first let you copy the constants or I learn you why they are here in the first place, then I could make you really understand, in this case math. I personally didn't want to bring up school-teachers, too many times I encountered 'teachers' who tried to copy to one what they didn't understand and sometimes they hadn't even completed copies themselves, otherwise they would at least be in the position to carry out the correct message as they heard, considering the correct message have the right information.
Niels. ps. The process of learning to make correct sentences, starts indeed with relative-constants like the 'latin' character 'A' is for particularly languages. pps. If To learn was indeed as simple as To copy, then there wouldn't even be teachers who can't teach. A great teacher makes you understand. @Artlav, it is possible for me, to make you an non-copied alphabeth and there is less man-made things as you might realize. |
|||
15 Oct 2006, 13:44 |
|
Niels 15 Oct 2006, 13:58
Dex4u, the man who will make the first human-computer-brain, will tell you the exact same thing. It's not the copy-part, it's the original-part.
|
|||
15 Oct 2006, 13:58 |
|
Goto page 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.