Project Code Name: Vandior

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
SonOFBelial
Posts: 8
Joined: Fri Dec 07, 2007 2:46 pm

Post by SonOFBelial »

XCHG wrote:
SonOFBelial wrote: I'd be happy to join you, but first I'd like to know the direction you are going with the OS (what is your "vision" for it?).

Also, it's always nice to see coders who comment there code well. ASM coders have very good habits as far as commenting, and I wish others would pick up on it.
The main goal of the project is simple: Creating an Operating System that we will actually use. So it is not a hobby Operating System. I work on this Operating System for almost 3 hours a day now that I am a full-time MSC student and normally about 9 hours a day when I get time.

The main audience are Programmers and Scientists. The whole Operating System will revolve mainly around the aforementioned groups of people. Therefore, I am going to port or write a simple C compiler as the first program that runs in the Operating System in the User-Land.
Dex wrote:People who code, seem to get bored very easily, so do not like getting in voled in a long term project, but see it as a good challenge to add some part to a OS that interest them, plus they become part of it.
I very much like this idea. That's actually how I feel when trying to contribute to an already-existing project. I wouldn't want to get "too" involved. I think I will try to get people involved using this idea. Thanks.
I'd be happy to join in, as I am a member your OS's intended audiance.

I could port a clib (newlib http://sourceware.org/newlib/), perhaps), and then it might be possible to bootstrap a small C compiler like TCC.

you can contact me at son.of.belial [AT] hushmail [DOT] com[/url]
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

That's fantastic. It'd be great to be two people or even more working on this project. I will contact you by your email address with some specific information about the OS, source codes and etc.

If anybody else feels like joining us, please feel free to do so.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

If you would like, i would be happy to port Fasm to your OS XCHG, all i will need is that your OS can read/write to floppy or hdd, have basic memory management, and print string function.
Once you have them, let me know and i will port it.
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Checklist:
  • Memory Management √
  • HDD Access with a working File System √
  • Text Mode Video driver √
I will attach all the individual procedures/functions prototypes that are included in these three units. See if you believe they are enough for porting FASM, please. And thanks for considering doing this.
Attachments
Physical Memory Manager.txt
Vandior's Physical Memory Manager's prototypes
(2.58 KiB) Downloaded 71 times
HDD.txt
HDD Prototypes using the SSFS file system. Includes both high level abstract and low level interfaces.
(9.78 KiB) Downloaded 70 times
Video.txt
Text Mode Video driver 80*25 interface in Vandior.
(1.46 KiB) Downloaded 114 times
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Yes they seem fine, it maybe easier if i show you what you need to change and you implement it best for your OS.
Theres only 2 include files that need changing, the rest is self contained.

The first file called "fasm.asm" now what you do with this file depends what you use for your file format.
Eg: I use a flat bin format. in this file the only thing you need to change is how you get the commend line input, + change the print function to suite your OS, + a simple way of timing somethings eg: number of clock ticks.

Then you need to change in the file "system.inc" just replace these function with your own

Code: Select all


; flat assembler interface for Dex4u
; Copyright (c) 1999-2005, Tomasz Grysztar.
; All rights reserved.

LoadAddress = 0x300000
filepos 	 dd 0x0

;====================================================;
; init_memory.                                *fasm* ;
;====================================================;
init_memory:
	mov	[memory_start],0x800000
	mov	[memory_end],0xc00000
	mov	[additional_memory],0xc00000
	mov	[additional_memory_end],0xe00000
	ret

;====================================================;
; exit_program.                               *fasm* ;
;====================================================;
exit_program:
        mov   ecx,0
        call  [GetClockTicks]
        mov   esi,ExitMesage
        call  [PrintString]
        call  [WaitForKeyPress]
        mov   eax,[return]
        mov   esp,[eax]
      	ret

;====================================================;
; make_timestamp.                             *fasm* ;
;====================================================;
make_timestamp:
	push	ebx
;Code will be added for "timestamp" later.;
	pop	ebx
	ret

;====================================================;
; get_environment_variable.                   *fasm* ;
;====================================================; 
get_environment_variable:
;Code will be added for "environment variable" later.;
	ret

;====================================================;
; open.                                       *fasm* ;
;====================================================;
open:
        pushad
        push  es
        push  ds
        mov   [FileNameVar],edx
	mov   esi,edx
 	mov   edi,Filehandle
        mov   cx,20
        xor   eax,eax
FileHloop:
        add   edi,32
        inc   ax
        cmp   byte[es:edi],0
        je    Found
        loop  FileHloop
        jmp   file_error
Found:
        mov   [FileHandleNumer],eax
        mov   esi,[FileNameVar]
        mov   [testfile],edi
@@:
	lodsb
	stosb
	cmp	al,0
	jne	@b
        mov   edi,LoadAddress
        add   edi,[AdressAddOn]
        mov   [LoadAdressOfFile],edi
        mov   esi,[FileNameVar]
        call  [FloppyfileLoad]
        jc    file_error
        shl   ebx,9
        mov   [filesize],ebx
        add   [AdressAddOn],ebx
        add   [AdressAddOn],512
        mov   edi,[testfile]
        add   edi,12
        mov   eax,[LoadAdressOfFile]
        stosd
        mov  eax,[filesize]
        stosd
        call  [FddMotorOff]
        pop   ds
        pop   es
        popad
        mov  ebx,[FileHandleNumer]
        clc
	ret

file_error:
        mov   [ErrorCode],ah
        call  [FddMotorOff]
        pop   ds
        pop   es
        popad
        mov   ah,[ErrorCode]
	stc
	ret

;====================================================;
; create.                                     *fasm* ;
;====================================================; 
create:
	pushad
        push  es
        push  ds
        mov   [FileNameVar],edx
	mov   edi,Filehandle
        mov   cx,20
        xor   eax,eax
FileHcreateloop:
        add   edi,32 
        inc   ax
        cmp   byte[es:edi],0
        je    FoundCreate
        loop  FileHcreateloop
        jmp   CreateError
FoundCreate:  
        mov   [FileHandleNumer],eax
        mov   esi,[FileNameVar]
        mov   [testfile],edi
@@:
	lodsb
	stosb
	cmp   al,0
	jne   @b
        pop   ds
        pop   es
        popad
        mov   ebx,[FileHandleNumer]
        clc
	ret

CreateError:
        pop   ds
        pop   es
        popad
	stc
	ret


; ebx file handle
; ecx count of bytes to write
; edx pointer to buffer
;====================================================;
; write.                                      *fasm* ;
;====================================================;
write:
        pushad
        push  es
        push  ds
        mov   dword[NumberOfBinFile],ecx
        mov   dword[Buffer],edx
        mov   dword[Fhandler],ebx
        mov   ax,18h
        mov   ds,ax
        mov   es,ax
        cmp   [Fhandler],20
        ja    WriteFileToFloppyError
        cmp   [Fhandler],0
        je    WriteFileToFloppyError
        mov   esi,Filehandle
        mov   edx,[Fhandler]
        shl   edx,5  
        add   esi,edx
        mov   [NameAddress],esi
        call  [DeleteFile1]
        mov   esi,[NameAddress]
        mov   edi,[Buffer]
        mov   eax,[NumberOfBinFile]
        call  [WriteCommand]
        jc    WriteFileToFloppyError
        call  [FddMotorOff]
@@:
        pop   ds
        pop   es
        popad
        clc
	ret

WriteFileToFloppyError:
        call  [FddMotorOff]
        pop   ds
        pop   es
        popad
        stc
	ret

;====================================================;
; read.                                       *fasm* ;
;====================================================;
read:
        pushad
        push  es
        push  ds
        mov   dword[NumberOfBinFile],ecx
        mov   dword[Buffer],edx
        mov   dword[Fhandler],ebx
        mov   ax,18h
        mov   ds,ax
        mov   es,ax
        mov   edi,[Buffer]
        call  GetPointer
        add   esi,[filepos]
        mov   ecx,[NumberOfBinFile]
        cld
        rep   movsb
        pop   ds
        pop   es
        popad
        clc
	ret

;====================================================;
; close.                                      *fasm* ;
;====================================================;
close:	
        pushad
        push  es
        push  ds
        mov   edi,Filehandle
        shl   ebx,5
        add   edi,ebx
        mov   cx,30
        mov   al,0
        rep   stosb
        pop   ds
        pop   es
        popad
        ret

;====================================================;
; lseek.                                      *fasm* ;
;====================================================;
lseek:
        pushad
        mov   [Fhandler],ebx
        call  GetFileSize
        mov   [filesize],esi
	cmp   al,0
	jnz   @f
	mov   [filepos],0
@@:     cmp   al,1
	jnz   @f
@@:     cmp   al,2
	jnz   @f
	mov   eax,[filesize]
	mov   [filepos],eax
@@:     mov   eax,[filepos]
	add   eax,edx
	mov   [filepos],eax
        popad
        mov   eax,[filepos]
	ret


;====================================================;
; GetPointer.                                        ;
;====================================================; 
GetPointer:
        pushad
        mov   esi,Filehandle
        mov   edx,[Fhandler]
        shl   edx,5
        add   esi,edx
        add   esi,12
        lodsd
        mov   [var],eax
        popad
        mov   esi,[var]
        ret

;====================================================;
; GetFileSize.                                       ;
;====================================================; 
GetFileSize:
        pushad
        mov   esi,Filehandle
        mov   edx,[Fhandler]
        shl   edx,5
        add   esi,edx
        add   esi,16
        lodsd
        mov   [var],eax
        popad
        mov   esi,[var]
        ret

;====================================================;
; display_string.                             *fasm* ;
;====================================================; 
display_string:
        lodsb
	or    al,al
	jz    string_end
        call  DisplayChar
        jmp   display_string
string_end:
       	ret

;====================================================;
; display_number.                             *fasm* ;
;====================================================;
display_number:
        push  ebx
	mov   ecx,1000000000
	xor   edx,edx
	xor   bl,bl
display_loop:
	div   ecx
	push  edx
	cmp   ecx,1
	je    display_digit
	or    bl,bl
	jnz   display_digit
	or    al,al
	jz    digit_ok
	not   bl
display_digit:
	add   al,30h
	call  [PrintChar]
digit_ok:
	mov   eax,ecx
	xor   edx,edx
	mov   ecx,10
	div   ecx
	mov   ecx,eax
	pop   eax
	or    ecx,ecx
	jnz   display_loop
	pop   ebx
	ret

;====================================================;
; display_user_messages                       *fasm* ;
;====================================================;
display_user_messages:
	mov   [displayed_count],0
	call  flush_display_buffer
	cmp   [displayed_count],0
	je    line_break_ok
	cmp   [last_displayed],0Ah
	je    line_break_ok
        mov   esi,cr_lf
	call  [PrintString]
line_break_ok:
	ret
;====================================================;
; display_block.                              *fasm* ;
;====================================================;
display_block:
	jecxz	block_displayed
	add	[displayed_count],ecx
	mov	al,[esi+ecx-1]
	mov	[last_displayed],al
	push	ebx
DisplayCharacter:
        lods  byte [esi]
        call  DisplayChar
	loopd DisplayCharacter
        pop   ebx
block_displayed:
	ret

;====================================================;
; display_character.                          *fasm* ;
;====================================================; 
display_character:
	lods  byte [esi]
	call  DisplayChar
	loopd display_character
 	ret
;====================================================;
; fatal_error.                                *fasm* ;
;====================================================;	
fatal_error:
        mov   esi,error_prefix
        call  [PrintString]
        pop   esi
        call  display_string
        mov   esi,error_suffix
        call  [PrintString]
        mov   al,0FFh
        jmp   exit_program

;====================================================;
; assembler_error.                            *fasm* ;
;====================================================;
assembler_error:
        call	display_user_messages
	push	dword 0
	mov	ebx,[current_line]
get_error_lines:
	push	ebx
	test	byte [ebx+7],80h
	jz	display_error_line
	mov	edx,ebx
find_definition_origin:
	mov	edx,[edx+12]
	test	byte [edx+7],80h
	jnz	find_definition_origin
	push	edx
	mov	ebx,[ebx+8]
	jmp	get_error_lines
display_error_line:
	mov	esi,[ebx]
	call	[PrintString]
	mov	esi,line_number_start
	call	[PrintString]
	mov	eax,[ebx+4]
	and	eax,7FFFFFFFh
	call	display_number
	mov	al,']'
	call	display_character1
	pop	esi
	cmp	ebx,esi
	je	line_number_ok
	mov	al,20h
	call	display_character1
	push	esi
	mov	esi,[esi]
	movzx	ecx,byte [esi]
	inc	esi
	call	display_block
	mov	esi,line_number_start
	call	[PrintString]
	pop	esi
	mov	eax,[esi+4]
	and	eax,7FFFFFFFh
	call	display_number
	mov	al,']'
	call	display_character1
      line_number_ok:
	mov	esi,line_data_start
	call	display_string
	mov	esi,ebx
	mov	edx,[esi]
	call	open
	mov	al,2
	xor	edx,edx
	call	lseek
	mov	edx,[esi+8]
	sub	eax,edx
	push	eax
	xor	al,al
	call	lseek
	mov	ecx,[esp]
	mov	edx,[additional_memory]
	lea	eax,[edx+ecx]
	cmp	eax,[additional_memory_end]
	ja	out_of_memory
	call	read
	call	close
	pop	ecx
	mov	esi,[additional_memory]
get_line_data:
	mov	al,[esi]
	cmp	al,0Ah
	je	display_line_data
	cmp	al,0Dh
	je	display_line_data
	cmp	al,1Ah
	je	display_line_data
	or	al,al
	jz	display_line_data
	inc	esi
	loop	get_line_data
display_line_data:
	mov	ecx,esi
	mov	esi,[additional_memory]
	sub	ecx,esi
	call	display_block
	mov	esi,cr_lf
	call	display_string
	pop	ebx
	or	ebx,ebx
	jnz	display_error_line
        mov   esi,error_prefix
        call  [PrintString]
        pop   esi
        call  display_string
        mov   esi,error_suffix
        call  [PrintString]
        jmp   exit_program


;====================================================;
; DisplayChar.                                       ;
;====================================================; 
DisplayChar:
        pushad
        cmp   al,13
        jne   @f
        call  Next_line
        jmp   DisplayCharEnd
@@:
        cmp   al,0x20
        jne   @f
        call  space
        jmp   DisplayCharEnd
@@:
        cmp   al,0x09
        jne   @f
        call  tab
        jmp   DisplayCharEnd
@@:
	call  [PrintChar]
DisplayCharEnd:
        popad
        ret

;====================================================;
; display_character1.                                ;
;====================================================;
display_character1:
	call  [PrintChar]
        ret

;====================================================;
; next line.                                         ;
;====================================================; 
Next_line:
        push  esi
        mov   esi,cr_lf
	call  [PrintString]
        pop   esi
        ret

;====================================================;
; space.                                             ;
;====================================================; 
space:
        push  esi
        mov   esi,space1
	call  [PrintString]
        pop   esi
        ret   

;====================================================;
; tab.                                               ;
;====================================================; 
tab:
        push  esi
        mov   esi,tab1
	call  [PrintString]
        pop   esi
        ret   

 
var              dd 0
LoadAdressOfFile dd 0
NumberOfBinFile  dd 0
Buffer           dd 0
Fhandler         dd 0
FileHandleNumer  dd 0
testfile         dd 0
NameAddress      dd 0
AdressAddOn      dd 0
ErrorCode        db 0

character        db ?,0
bytes_count      dd ?

;textxy	 dd 0x000500A0
;dc	 db 0x0
filesize dd 0x0

displayed_count dd ?
last_displayed	rb 2

FileNameVar       dd 0
error_prefix	  db 'error: ',0
error_suffix	  db '.',0
line_data_start   db ':',13,0
cr_lf		  db 13,0
line_number_start db ' [',0
space1            db ' ',0
tab1              db '      ',0
macro dm string { db string,0 }
That it you assemble it and that all thats needed.
Let me no if you have any ?.
SonOFBelial
Posts: 8
Joined: Fri Dec 07, 2007 2:46 pm

Post by SonOFBelial »

TCC uses FASM as it's assembler, so having FASM ported is one step closer to having a working C compiler :)
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Thank you Dex. I am going to take a closer look at the source code you posted.

Willie: Definitely! I am going to talk to Spook also about porting NASM to Vandior. We could then see which one is easier to port.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

NASM is written in C, FASM is not... it's likely easier to port FASM to your OS, considering you don't have a C library..
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
SpooK
Member
Member
Posts: 260
Joined: Sun Jun 18, 2006 7:21 pm

Post by SpooK »

Brynet-Inc wrote:NASM is written in C, FASM is not... it's likely easier to port FASM to your OS, considering you don't have a C library..
Exactly. However, he may want to start with LibC support in order to not alienate all those C developers out there, not to mention the plethora of open-source projects that could be ported ;)
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

I agree with spook point, and the biggest impact on your OS would be the implementing of LibC.
But is so easy to port fasm, took me less than a hour once i had the above functions, so for little work you have a great assembler ported.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Just a thought - if you get FASM / NASM ported, this may be a good topic for the wiki.

Cheers,
Adam
SpooK
Member
Member
Posts: 260
Joined: Sun Jun 18, 2006 7:21 pm

Post by SpooK »

AJ wrote:Just a thought - if you get FASM / NASM ported, this may be a good topic for the wiki.

Cheers,
Adam
Porting NASM is less about NASM and more about getting a c99-compliant LibC supported (look into newlib or PDCLIB?) along with linking/objcopy or using pre-existing object file formats.
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Brynet-Inc wrote:NASM is written in C, FASM is not... it's likely easier to port FASM to your OS, considering you don't have a C library..
Willi and I are going to port a C library to Vandior. This will be done after the implementation of Virtual Memory and System Calls of course (which are our current development stages).

Just a quick post here: I had promised I would release the first beta and debug version of Vandior on 20th. I'm going to have to put this release day off for about another 4 or 5 days. Hopefully it will be released on 25th (Not that you guys are waiting for the release date impatiently :P)

For the assembler, perhaps with Dex's help, we will be able to get FASM ported, up and running. Then we will probably port a small C compiler.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
crazygray1
Member
Member
Posts: 168
Joined: Thu Nov 22, 2007 7:18 pm
Location: USA,Hawaii,Honolulu(Seriously)

Post by crazygray1 »

Your OS is pretty cool. :D
How long has it taken you to get to this point :?:
Codname: Cipher
Working On: Design Doc(CFFS file system)
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

crazygray1 wrote:Your OS is pretty cool. :D
How long has it taken you to get to this point :?:
Hey thanks. I have been working on this Operating System, as my logs show, since early February 2007 :D
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Post Reply