Page 2 of 3
Re: Hydrogen OS first public preview release
Posted: Fri Aug 07, 2009 5:28 am
by f2
I hesitate now to rewrite some parts of the system in C. Making an OS in assembler is a good challenge, but I would like to make a port of the system to others architectures (eg x86_64 or ARM). Actually, I'm doing some tests with Nasm and Tiny C Compiler. It is possible that these tests give a new public release.
Re: Hydrogen OS first public preview release
Posted: Fri Aug 07, 2009 11:58 am
by Dex
Tommy, please do not be put off by portablaty and ASM think about using MACROS with them you can make any lanuage you want
Example turn asm in to basic just by adding a .inc
BasicX86.inc
Code: Select all
macro PRINT String{
local .Printer
local .Nextchar
local .Done
local .a
.Printer:
mov si, .a
mov ah, 0Eh
jmp .Nextchar
.Nextchar:
lodsb
or al, al
jz .Done
int 10h
jmp .Nextchar
jmp .Done
.a db String,10,13,0
.Done:
}
macro SCREEN mode
{
push ax
if mode = 0
mov ah,0h ;SCREEN 0; Default DOS screen mode
mov al,3h
int 10h
else if mode = 13
mov ah,0h ;SCREEN 13; VGA
mov al,13h
int 10h
end if
pop ax
}
macro SLEEP
{
;Output:
;ah = BIOS scancode of key pressed
;al = ASCII character of key pressed
;Could have also used...
; mov ah,8h
; int 21h
mov ah,0h
int 16h
}
macro END
{
mov ax,4Ch ;\END
int 21h ;/
}
macro LOCATE row,col
{
pusha
mov ah,2 ;Function 2
mov bh,0 ;Use page 0
mov dh,row ;row
mov dl,col ;col
int 10h
popa
}
And then you can do this:
Code: Select all
SCREEN 0
LOCATE 5,5
PRINT "Hello World"
SLEEP
END
With fasm you have both a x86 and Arm ver
.
NOTE: Example is for Dos.
Re: Hydrogen OS first public preview release
Posted: Fri Aug 07, 2009 12:21 pm
by f2
Finally, Hydrogen OS is and always will be an OS written in assembler. I have a lot of problems with TCC that I prefer to give up.
FASM is an excellent low-level assembler. With a good set of macros, it is really great.
Yes, there is an ARM port of FASM, and even a version for MIPS processors, located somewhere in the flatassembler forum.
Re: Hydrogen OS first public preview release
Posted: Fri Aug 07, 2009 3:08 pm
by gravaera
One solution to portability is to require that no matter what architecture it is to ported to, the compiler should be a cross version of ONE fixed compiler.
In my kernel, as it is so far, it's fully portable (even onto a another (probably embedded) architecture) as long as it's compiled with G++ compiler for that architecture/platform. I DO have a compiler.h setup, but it's really not that flexible. And it's irritating to use. So I end up not really using anything from that compiler.h setup, and therefore end up just having to require that anyone trying to port will have to use a G++ compiler of some sort.
Re: Hydrogen OS first public preview release
Posted: Fri Aug 07, 2009 4:12 pm
by NickJohnson
gravaera wrote:One solution to portability is to require that no matter what architecture it is to ported to, the compiler should be a cross version of ONE fixed compiler.
In my kernel, as it is so far, it's fully portable (even onto a another (probably embedded) architecture) as long as it's compiled with G++ compiler for that architecture/platform. I DO have a compiler.h setup, but it's really not that flexible. And it's irritating to use. So I end up not really using anything from that compiler.h setup, and therefore end up just having to require that anyone trying to port will have to use a G++ compiler of some sort.
Or simply adhere to the proper standards instead of using special compiler extensions. C++ might be a bit harder because the implementation is so complex, but there should be a simple common subset of features supported by most compilers. And just because something compiles on one arch with a compiler doesn't mean it will work on any other arch with the same compiler. I test my OS on a couple different compilers (mostly gcc and tcc) to make sure everything is proper.
And if you're using assembly, regardless of if the same assembler works for different architectures, you will *always* have to rewrite *all* of your kernel to port it. Dex's BASIC-like method would also require rewriting everything... if you want actual portability you might as well use C/C++ (assuming you want portability... that's not always the goal, and an assembly OS has speed and coolness points).
Re: Hydrogen OS first public preview release
Posted: Sat Aug 08, 2009 6:08 am
by Dex
NickJohnson wrote:Dex's BASIC-like method would also require rewriting everything... if you want actual portability you might as well use C/C++ (assuming you want portability... that's not always the goal, and an assembly OS has speed and coolness points).
Yes there will always be the need to do some rewriting, but this is not always a bad thing, to mod the underlining design to take addvantage of the processor .
The basic like method is more usefull for writing the apps in, but if you keep your kernel design KISS, its much easier to port, eg: my OS is abased on KISS and can run on both x86 and arm.
@Tommy, I like the clock in your demo, would it be possable to post the colors used for the background, digets and shadow, of the clock, as you got the look just right, thinks.
Re: Hydrogen OS first public preview release
Posted: Sat Aug 08, 2009 8:10 am
by f2
Dex wrote:
Yes there will always be the need to do some rewriting, but this is not always a bad thing, to mod the underlining design to take addvantage of the processor .
The basic like method is more usefull for writing the apps in, but if you keep your kernel design KISS, its much easier to port, eg: my OS is abased on KISS and can run on both x86 and arm.
What is KISS?
Dex wrote:@Tommy, I like the clock in your demo, would it be possable to post the colors used for the background, digets and shadow, of the clock, as you got the look just right, thinks.
background = 88976Eh
digits = 394030h
digits shadow = 68774Eh
Re: Hydrogen OS first public preview release
Posted: Sat Aug 08, 2009 10:11 am
by Dex
Thanks for the colors.
Here tells what KISS is about
http://en.wikipedia.org/wiki/KISS_principle
We (team DexOS) use it, as "Keep It Small and Simple"
Re: Hydrogen OS first public preview release
Posted: Sat Aug 08, 2009 12:01 pm
by f2
OK.
I hesitate to rewrite my OS in FASM, respecting the KISS model. Sol_Asm is a good assembler, but it is far from
complete, and as the sources are closed, contributions are impossible.
Re: Hydrogen OS first public preview release
Posted: Sun Aug 09, 2009 9:44 am
by Craze Frog
With 32 mb of memory the OS will not boot because it needs "a minimum of 32 mb of memory". It has that, so it shouldn't complain.
And also your mouse driver is broken. The mouse doesn't move in VMware.
Re: Hydrogen OS first public preview release
Posted: Sun Aug 09, 2009 2:13 pm
by f2
Craze Frog wrote:With 32 mb of memory the OS will not boot because it needs "a minimum of 32 mb of memory".
This is a weird bug which does not occur in other emulators.
NickJohnson wrote:Some people start at the GUI and work down, while others start with threading and IPC and work up. If you had both, I would be seriously impressed.
Rewriting has not been beneficial for the OS. Bugs have been fixed, others have emerged. I think it would be wise to take
the development from the beggining. Hydrogen OS project is now suspended. I have an old project of a 32-bit multitasking
DOS (called SDOS for "Small Disk Operating System" written in FASM, somewhere on a USB key. I think I will resume the
development of this project. The GUI that I wrote could be a simple SDOS application.
Re: Hydrogen OS first public preview release
Posted: Sun Aug 09, 2009 2:54 pm
by NickJohnson
Craze Frog wrote:With 32 mb of memory the OS will not boot because it needs "a minimum of 32 mb of memory". It has that, so it shouldn't complain.
Emulators (and real machines) rarely have/report the amount of memory you think you gave them. A 32MB stick of RAM could only be 31MB, or even less. Emulators also sometimes shave off a few KB/MB, for no real reason (afaik...). It would be wise to set the memory requirement to a small amount less than a power of 2, not just a power of two. It's not as bad as hard drives though
.
Re: Hydrogen OS first public preview release
Posted: Sun Aug 09, 2009 3:00 pm
by f2
NickJohnson wrote:Craze Frog wrote:With 32 mb of memory the OS will not boot because it needs "a minimum of 32 mb of memory". It has that, so it shouldn't complain.
Emulators also sometimes shave off a few KB/MB, for no real reason (afaik...).
It is precisely the problem!
However, I decided to redevelop my old DOS project. SDOS is small (64 KB only) and requires only
256KB of conventional memory.
At least there will be no problem
!
Re: Hydrogen OS first public preview release
Posted: Sun Aug 09, 2009 3:57 pm
by Coty
Dang I missed it
oh well, it looks cool.
Re: Hydrogen OS first public preview release
Posted: Sun Aug 09, 2009 5:10 pm
by Combuster
Even real BIOSes steal parts of the memory, at the top for (acpi) local storage, and the 384k from A0000-FFFFF, neither of which you can use.