flat assembler
Message board for the users of flat assembler.

Index > OS Construction > FreePascal and OS Creation?

Author
Thread Post new topic Reply to topic
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
If im not mistaken(im using FPC)Free pascal has an option to export code to ASM(Nasm,tasm etc)SO can i code the OS and then export it to asm and work?
I posted here since i found no other forum to post it in.
Post 07 Jun 2004, 14:38
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
Shouldn't you have posted in the OS Construction related forum and not in main?
Post 07 Jun 2004, 14:52
View user's profile Send private message Visit poster's website Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
Yes maybe Pascal has this option, also C/C++ has it ... so what?

ASM is used in OS because there are some things that are harder to do in HLL languages... like setiing protected mode (GDT and LIDT setup, selectors, paging and multitasking.

If you do not like ASM you do not have to use it for the whole OS, you can make only the needed parts in ASM and then continue into your preffered HLL language (c/Pascal/whatever)

HLL have a tenedency to hide information from the programmer...and this might be an obstacle in OS coding, but IF you really understand what you are doing, you could use HLL
Post 07 Jun 2004, 14:58
View user's profile Send private message Visit poster's website Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
Well,i have in mind the things you said.I was thinking make some include files like Emu8086's one to have some basic function/commands like "PRINT" etc sow i would need any pascal,c or whatever.
Im just new to ASM and i need help to make something like this.By doing this you save time.Heres an example:

You want to make a prgram and print some text.
You need to use DB commands and lots of stuff like this.
Why just dont type PRINT and then the text you want?
YOU save lots of time!Especially on BIG projects like OS development!
Post 07 Jun 2004, 15:30
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
Embrance wrote:
You want to make a prgram and print some text.
You need to use DB commands and lots of stuff like this.
Why just dont type PRINT and then the text you want?
YOU save lots of time!Especially on BIG projects like OS development!


Just write macros! There's no need to use a HLL for functionality like this. And believe me, you won't save much (if any) time by starting with an HLL and exporting to assembly.

_________________
Charles Childers, Programmer
Post 07 Jun 2004, 18:17
View user's profile Send private message Visit poster's website Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
I use macros like this:

ODS1_fmt <" DX=%i, DY=%i = %s ">,[one_bmp_dx],[one_bmp_dy],<offset sz_filename_bmp>
ODS <"here is my message">

besides you still have to type the message Razz

as crc say the path you are seeing in your mind is much more complicated than this simple macros... besides what difference is typing a "db" going to do?

Sometimes i think to algorithms for days or hours... so...

Besides how many big/huge projects have you done already and realized ... from you own experience... not from plain thinking ahead in your mind... that not typing DB is the issue in a huge project?


Last edited by bogdanontanu on 07 Jun 2004, 18:41; edited 2 times in total
Post 07 Jun 2004, 18:22
View user's profile Send private message Visit poster's website Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder
Print what to where though? If there is a concept of a console, then that question is answered simply enough, but if you are making your own OS, there won't be a console unless you make one yourself. That being said, you're most likely going to have to create your own printing routine. You're going to have to create your own fonts (or else be satisfied with having everything in text mode, in which case there will be supplied a system/OEM font built-in to the video BIOS that you will be using, and it will also take care of the "print to where" question. However, you will NOT be able to use any graphics whatsoever if you choose to do that (well, you'll have to switch into graphics mode, but then you won't have that font anymore and won't be able to treat the screen as a console anymore)). You could also do something like research the TrueType fonts format, for example, and then use premade fonts (you'll still have to code your own font rendering-engine though) but realize there are patent/copyright issues there and if you don't want to mess with that, better to just make your own.

Next, you will have to have some concept of a console or window in which to print in your mind and you will have to first render that on screen and then render the pixels to areas, starting from left to right (you could go any way, really, but I just find left to right most logical), and then plot pixels. You receive the pixels from your font rendering-engine. (Pass in a string, receive an array of pixels;))

_________________
Boycott Symantec/Norton/PowerQuest whenever possible
Post 07 Jun 2004, 18:30
View user's profile Send private message Reply with quote
Gambino



Joined: 20 Jul 2003
Posts: 44
Location: Romania
Gambino
Quote:
(well, you'll have to switch into graphics mode, but then you won't have that font anymore and won't be able to treat the screen as a console anymore).


That's not true! I programmed VESA and the standard BIOS font works both in TEXT modes and GRAPHIC modes. And with a little tweaking of the VGA registers you can create your own BIOS-like font very easily, and you can load it from a file and still works in TEXT modes and GRAPHIC modes.
A console enviroment it's easily coded...not a big deal
A GUI it's hard to code...because of the diffrents color depths and resolutions and you need to code software rendering primitives like lines,circles etc. and then create buttons,windows etc.

I think that Bogdan Ontanu has worked very hard on his GUI of Solar OS and that's a big deal Smile
Keep the good work going... Cool
Traiasca Romanii Wink
Post 09 Jun 2004, 06:09
View user's profile Send private message Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
Well my main thought are macros.How to create them?How they owrk?
Post 09 Jun 2004, 21:04
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
asically the assembler replaces the macro body for each macro instance at compile time...

A single line of a macro is expanded into multiple lines of code and calculations/ opertaions are also done at expansion time...

Somehow similar to what a HLL compiler does ... but more limited ... and also much more under your control

Using macros you can somehow redefine the ASM language to look much more like an HLL.

However they slowdown assemble/compile time and somehow hide what is really happening... but once you know what they are exactly doing and get experienced with macros, they can save a lot of typo and time... and unlike a HLL they are still under your control

For example:
Code:
;---------------------------------------
; define and output a formated string
;---------------------------------------
ODS_fmt MACRO mfmt1, marglist1 :VARARG
     LOCAL mstring1
              .data
                       mstring1        db mfmt1
                                    db 0    
            .code
               pushad
              call    wsprintfA,offset sz_val1,offset mstring1, marglist1
         Call    OutputDebugStringA,offset sz_val1
           popad
ENDM
    


Each time i call the macro like this:
ODS_fmt <"This is my counter:%i">,[my_counter]

The assembler replaces it with above lines. But because mstring1 is a LOCAL variable to the macro it gets a different name everytime, something like ??_C0001, ??_C002 etc etc .. also sz_val1 is defined elsewhere as a global string variable used for trash

Well this is TASM macro syntax, and FASM might be different... but the concepts are the same Wink

_________________
"Any intelligent fool can make things bigger,
more complex, and more violent.
It takes a touch of genius -- and a lot of courage --
to move in the opposite direction."
Post 10 Jun 2004, 00:41
View user's profile Send private message Visit poster's website Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder
Gambino wrote:
Quote:
(well, you'll have to switch into graphics mode, but then you won't have that font anymore and won't be able to treat the screen as a console anymore).


That's not true! I programmed VESA and the standard BIOS font works both in TEXT modes and GRAPHIC modes. And with a little tweaking of the VGA registers you can create your own BIOS-like font very easily, and you can load it from a file and still works in TEXT modes and GRAPHIC modes.
A console enviroment it's easily coded...not a big deal
A GUI it's hard to code...because of the diffrents color depths and resolutions and you need to code software rendering primitives like lines,circles etc. and then create buttons,windows etc.

I think that Bogdan Ontanu has worked very hard on his GUI of Solar OS and that's a big deal Smile
Keep the good work going... Cool
Traiasca Romanii Wink


Then I apologize as I was not aware of this. Does this work on standard VGA monitors too or only with SVGA?

_________________
Boycott Symantec/Norton/PowerQuest whenever possible
Post 10 Jun 2004, 01:10
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
It works with BIOS functions only .. so only in real mode, in protected mode you are on your own... but yes in real mode after a switch to GFX mode most BIOS and video cards are still able to draw a text message using internal font Wink
Post 10 Jun 2004, 02:05
View user's profile Send private message Visit poster's website Reply with quote
Gambino



Joined: 20 Jul 2003
Posts: 44
Location: Romania
Gambino
Quote:
Then I apologize as I was not aware of this. Does this work on standard VGA monitors too or only with SVGA?


The monitors has nothing to do with fonts and graphics...
The monitor only displays what the video card tell them Laughing
What's the diffrence between VGA and SVGA monitors Question
The diffrence is only that SVGA monitors support higher resolutions and refresh rates... Idea
Post 07 Jul 2004, 00:17
View user's profile Send private message Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
Does anyone know any OS (examples or complete working) that are made in Pascal?
Post 08 Jul 2004, 20:58
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
zenek_tm



Joined: 21 Mar 2004
Posts: 33
Location: Poland
zenek_tm
I found some time ago OS in development written using FPC and NASM. Didn't try it, but some sources were available. Here's the URL http://stormdos.sourceforge.net/.
Post 08 Jul 2004, 21:28
View user's profile Send private message Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
Post 08 Jul 2004, 21:30
View user's profile Send private message Visit poster's website Reply with quote
Embrance



Joined: 14 Mar 2004
Posts: 116
Location: Greece
Embrance
OK.Gonna check them!
Post 08 Jul 2004, 22:55
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.